Files
torebki-fabiola.pl/wp-content/plugins/mapster-wp-maps/admin/js/dist/compiled/maplibre-threebox-mwp.js
2026-03-05 13:07:40 +01:00

29 lines
1.9 MiB
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).maplibregl=e()}(this,(function(){"use strict";var t,e,n;function r(r,i){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",a={};t(a);n=i(a);"undefined"!=typeof window&&(n.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=i;else t=i}r(0,(function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n=r;function r(t,e,n,r){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=n,this.p2y=r}r.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},r.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},r.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},r.prototype.solveCurveX=function(t,e){var n,r,i,o,a;for(void 0===e&&(e=1e-6),i=t,a=0;a<8;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=o/s}if((i=t)<(n=0))return n;if(i>(r=1))return r;for(;n<r;){if(o=this.sampleCurveX(i),Math.abs(o-t)<e)return i;t>o?n=i:r=i,i=.5*(r-n)+n}return i},r.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var i=o;function o(t,e){this.x=t,this.y=e}o.prototype={clone:function(){return new o(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),r=n*this.x+e*this.y;return this.x=e*this.x-n*this.y,this.y=r,this},_rotateAround:function(t,e){var n=Math.cos(t),r=Math.sin(t),i=e.y+r*(this.x-e.x)+n*(this.y-e.y);return this.x=e.x+n*(this.x-e.x)-r*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},o.convert=function(t){return t instanceof o?t:Array.isArray(t)?new o(t[0],t[1]):t};var a="undefined"!=typeof self?self:{},s=Math.pow(2,53)-1;function l(t,e,r,i){var o=new n(t,e,r,i);return function(t){return o.solve(t)}}var c=l(.25,.1,.25,1);function u(t,e,n){return Math.min(n,Math.max(e,t))}function p(t,e,n){var r=n-e,i=((t-e)%r+r)%r+e;return i===e?n:i}function h(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];for(var r=0,i=e;r<i.length;r+=1){var o=i[r];for(var a in o)t[a]=o[a]}return t}var d=1;function f(){return d++}function m(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function g(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function y(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function v(t,e){return-1!==t.indexOf(e,t.length-e.length)}function _(t,e,n){var r={};for(var i in t)r[i]=e.call(n||this,t[i],i,t);return r}function x(t,e,n){var r={};for(var i in t)e.call(n||this,t[i],i,t)&&(r[i]=t[i]);return r}function b(t){return Array.isArray(t)?t.map(b):"object"==typeof t&&t?_(t,b):t}var w={};function M(t){w[t]||("undefined"!=typeof console&&console.warn(t),w[t]=!0)}function S(t,e,n){return(n.y-t.y)*(e.x-t.x)>(e.y-t.y)*(n.x-t.x)}function T(t){for(var e=0,n=0,r=t.length,i=r-1,o=void 0,a=void 0;n<r;i=n++)e+=((a=t[i]).x-(o=t[n]).x)*(o.y+a.y);return e}function E(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function A(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,n,r,i){var o=r||i;return e[n]=!o||o.toLowerCase(),""})),e["max-age"]){var n=parseInt(e["max-age"],10);isNaN(n)?delete e["max-age"]:e["max-age"]=n}return e}var C=null;function L(t){if(null==C){var e=t.navigator?t.navigator.userAgent:null;C=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return C}function P(t){try{var e=a[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var I,R,k,z,D=a.performance&&a.performance.now?a.performance.now.bind(a.performance):Date.now.bind(Date),O=a.requestAnimationFrame||a.mozRequestAnimationFrame||a.webkitRequestAnimationFrame||a.msRequestAnimationFrame,F=a.cancelAnimationFrame||a.mozCancelAnimationFrame||a.webkitCancelAnimationFrame||a.msCancelAnimationFrame,B={now:D,frame:function(t){var e=O(t);return{cancel:function(){return F(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var n=a.document.createElement("canvas"),r=n.getContext("2d");if(!r)throw new Error("failed to create canvas 2d context");return n.width=t.width,n.height=t.height,r.drawImage(t,0,0,t.width,t.height),r.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return I||(I=a.document.createElement("a")),I.href=t,I.href},hardwareConcurrency:a.navigator&&a.navigator.hardwareConcurrency||4,get devicePixelRatio(){return a.devicePixelRatio},get prefersReducedMotion(){return!!a.matchMedia&&(null==R&&(R=a.matchMedia("(prefers-reduced-motion: reduce)")),R.matches)}},N={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},U={supported:!1,testSupport:function(t){!j&&z&&(V?G(t):k=t)}},j=!1,V=!1;function G(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,z),t.isContextLost())return;U.supported=!0}catch(t){}t.deleteTexture(e),j=!0}a.document&&((z=a.document.createElement("img")).onload=function(){k&&G(k),k=null,V=!0},z.onerror=function(){j=!0,k=null},z.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var H="01",W=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function q(t){return 0===t.indexOf("mapbox:")}W.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",H,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},W.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},W.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},W.prototype.normalizeStyleURL=function(t,e){if(!q(t))return t;var n=J(t);return n.path="/styles/v1"+n.path,this._makeAPIURL(n,this._customAccessToken||e)},W.prototype.normalizeGlyphsURL=function(t,e){if(!q(t))return t;var n=J(t);return n.path="/fonts/v1"+n.path,this._makeAPIURL(n,this._customAccessToken||e)},W.prototype.normalizeSourceURL=function(t,e){if(!q(t))return t;var n=J(t);return n.path="/v4/"+n.authority+".json",n.params.push("secure"),this._makeAPIURL(n,this._customAccessToken||e)},W.prototype.normalizeSpriteURL=function(t,e,n,r){var i=J(t);return q(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+n,this._makeAPIURL(i,this._customAccessToken||r)):(i.path+=""+e+n,Y(i))},W.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!q(t))return t;var n=J(t);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,(B.devicePixelRatio>=2||512===e?"@2x":"")+(U.supported?".webp":"$1")),n.path=n.path.replace(/^.+\/v4\//,"/"),n.path="/v4"+n.path;var r=this._customAccessToken||function(t){for(var e=0,n=t;e<n.length;e+=1){var r=n[e].match(/^access_token=(.*)$/);if(r)return r[1]}return null}(n.params)||N.ACCESS_TOKEN;return N.REQUIRE_ACCESS_TOKEN&&r&&this._skuToken&&n.params.push("sku="+this._skuToken),this._makeAPIURL(n,r)},W.prototype.canonicalizeTileURL=function(t,e){var n=J(t);if(!n.path.match(/(^\/v4\/)/)||!n.path.match(/\.[\w]+$/))return t;var r="mapbox://tiles/";r+=n.path.replace("/v4/","");var i=n.params;return e&&(i=i.filter((function(t){return!t.match(/^access_token=/)}))),i.length&&(r+="?"+i.join("&")),r},W.prototype.canonicalizeTileset=function(t,e){for(var n=!!e&&q(e),r=[],i=0,o=t.tiles||[];i<o.length;i+=1){var a=o[i];X(a)?r.push(this.canonicalizeTileURL(a,n)):r.push(a)}return r},W.prototype._makeAPIURL=function(t,e){var n="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",r=J(N.API_URL);if(t.protocol=r.protocol,t.authority=r.authority,"http"===t.protocol){var i=t.params.indexOf("secure");i>=0&&t.params.splice(i,1)}if("/"!==r.path&&(t.path=""+r.path+t.path),!N.REQUIRE_ACCESS_TOKEN)return Y(t);if(!(e=e||N.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+n);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+n);return t.params=t.params.filter((function(t){return-1===t.indexOf("access_token")})),t.params.push("access_token="+e),Y(t)},W.prototype.setTransformRequest=function(t){this._transformRequestFn=t};var Z=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function X(t){return Z.test(t)}var $=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function J(t){var e=t.match($);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function Y(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}function Q(t){if(!t)return null;var e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(a.atob(e[1]).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return null}}var K=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};K.prototype.getStorageKey=function(t){var e,n=Q(N.ACCESS_TOKEN);return e=n&&n.u?a.btoa(encodeURIComponent(n.u).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x"+e))}))):N.ACCESS_TOKEN||"",t?"mapbox.eventData."+t+":"+e:"mapbox.eventData:"+e},K.prototype.fetchEventData=function(){var t=P("localStorage"),e=this.getStorageKey(),n=this.getStorageKey("uuid");if(t)try{var r=a.localStorage.getItem(e);r&&(this.eventData=JSON.parse(r));var i=a.localStorage.getItem(n);i&&(this.anonId=i)}catch(t){M("Unable to read from LocalStorage")}},K.prototype.saveEventData=function(){var t=P("localStorage"),e=this.getStorageKey(),n=this.getStorageKey("uuid");if(t)try{a.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&a.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){M("Unable to write to LocalStorage")}},K.prototype.processRequests=function(t){},K.prototype.postEvent=function(t,e,n,r){var i=this;if(N.EVENTS_URL){var o=J(N.EVENTS_URL);o.params.push("access_token="+(r||N.ACCESS_TOKEN||""));var a={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.15.2",skuId:H,userId:this.anonId},s=e?h(a,e):a,l={url:Y(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=wt(l,(function(t){i.pendingRequest=null,n(t),i.saveEventData(),i.processRequests(r)}))}},K.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var tt,et,nt=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,n,r){this.skuToken=n,(N.EVENTS_URL&&r||N.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return q(t)||X(t)})))&&this.queueRequest({id:e,timestamp:Date.now()},r)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var n=this.queue.shift(),r=n.id,i=n.timestamp;r&&this.success[r]||(this.anonId||this.fetchEventData(),g(this.anonId)||(this.anonId=m()),this.postEvent(i,{skuToken:this.skuToken},(function(t){t||r&&(e.success[r]=!0)}),t))}},e}(K),rt=new(function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){N.EVENTS_URL&&N.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return q(t)||X(t)}))&&this.queueRequest(Date.now(),e)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var n=Q(N.ACCESS_TOKEN),r=n?n.u:N.ACCESS_TOKEN,i=r!==this.eventData.tokenU;g(this.anonId)||(this.anonId=m(),i=!0);var o=this.queue.shift();if(this.eventData.lastSuccess){var a=new Date(this.eventData.lastSuccess),s=new Date(o),l=(o-this.eventData.lastSuccess)/864e5;i=i||l>=1||l<-1||a.getDate()!==s.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(o,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=o,e.eventData.tokenU=r)}),t)}},e}(K)),it=rt.postTurnstileEvent.bind(rt),ot=new nt,at=ot.postMapLoadEvent.bind(ot),st=500,lt=50;function ct(){a.caches&&!tt&&(tt=a.caches.open("mapbox-tiles"))}function ut(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var pt,ht=1/0;function dt(){return null==pt&&(pt=a.OffscreenCanvas&&new a.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.createImageBitmap),pt}var ft={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ft);var mt=function(t){function e(e,n,r){401===n&&X(r)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,e),this.status=n,this.url=r,this.name=this.constructor.name,this.message=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),gt=E()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===a.location.protocol?a.parent:a).location.href};function yt(t,e){var n,r=new a.AbortController,i=new a.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:gt(),signal:r.signal}),o=!1,s=!1,l=(n=i.url).indexOf("sku=")>0&&X(n);"json"===t.type&&i.headers.set("Accept","application/json");var c=function(n,r,o){if(!s){if(n&&"SecurityError"!==n.message&&M(n),r&&o)return u(r);var c=Date.now();a.fetch(i).then((function(n){if(n.ok){var r=l?n.clone():null;return u(n,r,c)}return e(new mt(n.statusText,n.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},u=function(n,r,l){("arrayBuffer"===t.type?n.arrayBuffer():"json"===t.type?n.json():n.text()).then((function(t){s||(r&&l&&function(t,e,n){if(ct(),tt){var r={status:e.status,statusText:e.statusText,headers:new a.Headers};e.headers.forEach((function(t,e){return r.headers.set(e,t)}));var i=A(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&r.headers.set("Expires",new Date(n+1e3*i["max-age"]).toUTCString()),new Date(r.headers.get("Expires")).getTime()-n<42e4||function(t,e){if(void 0===et)try{new Response(new ReadableStream),et=!0}catch(t){et=!1}et?e(t.body):t.blob().then(e)}(e,(function(e){var n=new a.Response(e,r);ct(),tt&&tt.then((function(e){return e.put(ut(t.url),n)})).catch((function(t){return M(t.message)}))})))}}(i,r,l),o=!0,e(null,t,n.headers.get("Cache-Control"),n.headers.get("Expires")))})).catch((function(t){s||e(new Error(t.message))}))};return l?function(t,e){if(ct(),!tt)return e(null);var n=ut(t.url);tt.then((function(t){t.match(n).then((function(r){var i=function(t){if(!t)return!1;var e=new Date(t.headers.get("Expires")||0),n=A(t.headers.get("Cache-Control")||"");return e>Date.now()&&!n["no-cache"]}(r);t.delete(n),i&&t.put(n,r.clone()),e(null,r,i)})).catch(e)})).catch(e)}(i,c):c(null,null),{cancel:function(){s=!0,o||r.abort()}}}var vt,_t,xt=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(E()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!E()){var n=t.url.substring(0,t.url.indexOf("://"));return(N.REGISTERED_PROTOCOLS[n]||yt)(t,e)}}if(!(/^file:/.test(r=t.url)||/^file:/.test(gt())&&!/^\w+:/.test(r))){if(a.fetch&&a.Request&&a.AbortController&&a.Request.prototype.hasOwnProperty("signal"))return yt(t,e);if(E()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){var n=new a.XMLHttpRequest;for(var r in n.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(n.responseType="arraybuffer"),t.headers)n.setRequestHeader(r,t.headers[r]);return"json"===t.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===t.credentials,n.onerror=function(){e(new Error(n.statusText))},n.onload=function(){if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){var r=n.response;if("json"===t.type)try{r=JSON.parse(n.response)}catch(t){return e(t)}e(null,r,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else e(new mt(n.statusText,n.status,t.url))},n.send(t.body),{cancel:function(){return n.abort()}}}(t,e)},bt=function(t,e){return xt(h(t,{type:"arrayBuffer"}),e)},wt=function(t,e){return xt(h(t,{method:"POST"}),e)},Mt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";vt=[],_t=0;var St=function(t,e){if(U.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),_t>=N.MAX_PARALLEL_IMAGE_REQUESTS){var n={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return vt.push(n),n}_t++;var r=!1,i=function(){if(!r)for(r=!0,_t--;vt.length&&_t<N.MAX_PARALLEL_IMAGE_REQUESTS;){var t=vt.shift();t.cancelled||(t.cancel=St(t.requestParameters,t.callback).cancel)}},o=bt(t,(function(t,n,r,o){i(),t?e(t):n&&(dt()?function(t,e){var n=new a.Blob([new Uint8Array(t)],{type:"image/png"});a.createImageBitmap(n).then((function(t){e(null,t)})).catch((function(t){e(new Error("Could not load image because of "+t.message+". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}))}(n,e):function(t,e,n,r){var i=new a.Image,o=a.URL;i.onload=function(){e(null,i),o.revokeObjectURL(i.src),i.onload=null,a.requestAnimationFrame((function(){i.src=Mt}))},i.onerror=function(){return e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))};var s=new a.Blob([new Uint8Array(t)],{type:"image/png"});i.cacheControl=n,i.expires=r,i.src=t.byteLength?o.createObjectURL(s):Mt}(n,e,r,o))}));return{cancel:function(){o.cancel(),i()}}};function Tt(t,e,n){n[t]&&-1!==n[t].indexOf(e)||(n[t]=n[t]||[],n[t].push(e))}function Et(t,e,n){if(n&&n[t]){var r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}var At=function(t,e){void 0===e&&(e={}),h(this,e),this.type=t},Ct=function(t){function e(e,n){void 0===n&&(n={}),t.call(this,"error",h({error:e},n))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(At),Lt=function(){};Lt.prototype.on=function(t,e){return this._listeners=this._listeners||{},Tt(t,e,this._listeners),this},Lt.prototype.off=function(t,e){return Et(t,e,this._listeners),Et(t,e,this._oneTimeListeners),this},Lt.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},Tt(t,e,this._oneTimeListeners),this},Lt.prototype.fire=function(t,e){"string"==typeof t&&(t=new At(t,e||{}));var n=t.type;if(this.listens(n)){t.target=this;for(var r=0,i=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];r<i.length;r+=1)i[r].call(this,t);for(var o=0,a=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];o<a.length;o+=1){var s=a[o];Et(n,s,this._oneTimeListeners),s.call(this,t)}var l=this._eventedParent;l&&(h(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),l.fire(t))}else t instanceof Ct&&console.error(t.error);return this},Lt.prototype.listens=function(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},Lt.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var Pt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},It=function(t,e,n,r){this.message=(t?t+": ":"")+n,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__)};function Rt(t){var e=t.value;return e?[new It(t.key,e,"constants have been deprecated as of v8")]:[]}function kt(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];for(var r=0,i=e;r<i.length;r+=1){var o=i[r];for(var a in o)t[a]=o[a]}return t}function zt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Dt(t){if(Array.isArray(t))return t.map(Dt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){var e={};for(var n in t)e[n]=Dt(t[n]);return e}return zt(t)}var Ot=function(t){function e(e,n){t.call(this,n),this.message=n,this.key=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),Ft=function(t,e){void 0===e&&(e=[]),this.parent=t,this.bindings={};for(var n=0,r=e;n<r.length;n+=1){var i=r[n];this.bindings[i[0]]=i[1]}};Ft.prototype.concat=function(t){return new Ft(this,t)},Ft.prototype.get=function(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")},Ft.prototype.has=function(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)};var Bt={kind:"null"},Nt={kind:"number"},Ut={kind:"string"},jt={kind:"boolean"},Vt={kind:"color"},Gt={kind:"object"},Ht={kind:"value"},Wt={kind:"collator"},qt={kind:"formatted"},Zt={kind:"resolvedImage"};function Xt(t,e){return{kind:"array",itemType:t,N:e}}function $t(t){if("array"===t.kind){var e=$t(t.itemType);return"number"==typeof t.N?"array<"+e+", "+t.N+">":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Jt=[Bt,Nt,Ut,jt,Vt,qt,Gt,Xt(Ht),Zt];function Yt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Yt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var n=0,r=Jt;n<r.length;n+=1)if(!Yt(r[n],e))return null}return"Expected "+$t(t)+" but found "+$t(e)+" instead."}function Qt(t,e){return e.some((function(e){return e.kind===t.kind}))}function Kt(t,e){return e.some((function(e){return"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t}))}var te=e((function(t,e){var n={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 r(t){return(t=Math.round(t))<0?0:t>255?255:t}function i(t){return r("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function a(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in n)return n[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=s.indexOf("("),c=s.indexOf(")");if(-1!==l&&c+1===s.length){var u=s.substr(0,l),p=s.substr(l+1,c-(l+1)).split(","),h=1;switch(u){case"rgba":if(4!==p.length)return null;h=o(p.pop());case"rgb":return 3!==p.length?null:[i(p[0]),i(p[1]),i(p[2]),h];case"hsla":if(4!==p.length)return null;h=o(p.pop());case"hsl":if(3!==p.length)return null;var d=(parseFloat(p[0])%360+360)%360/360,f=o(p[1]),m=o(p[2]),g=m<=.5?m*(f+1):m+f-m*f,y=2*m-g;return[r(255*a(y,g,d+1/3)),r(255*a(y,g,d)),r(255*a(y,g,d-1/3)),h];default:return null}}return null}}catch(t){}})).parseCSSColor,ee=function(t,e,n,r){void 0===r&&(r=1),this.r=t,this.g=e,this.b=n,this.a=r};ee.parse=function(t){if(t){if(t instanceof ee)return t;if("string"==typeof t){var e=te(t);if(e)return new ee(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},ee.prototype.toString=function(){var t=this.toArray(),e=t[1],n=t[2],r=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(n)+","+r+")"},ee.prototype.toArray=function(){var t=this.a;return 0===t?[0,0,0,0]:[255*this.r/t,255*this.g/t,255*this.b/t,t]},ee.black=new ee(0,0,0,1),ee.white=new ee(1,1,1,1),ee.transparent=new ee(0,0,0,0),ee.red=new ee(1,0,0,1);var ne=function(t,e,n){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};ne.prototype.compare=function(t,e){return this.collator.compare(t,e)},ne.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var re=function(t,e,n,r,i){this.text=t,this.image=e,this.scale=n,this.fontStack=r,this.textColor=i},ie=function(t){this.sections=t};ie.fromString=function(t){return new ie([new re(t,null,null,null,null)])},ie.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},ie.factory=function(t){return t instanceof ie?t:ie.fromString(t)},ie.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},ie.prototype.serialize=function(){for(var t=["format"],e=0,n=this.sections;e<n.length;e+=1){var r=n[e];if(r.image)t.push(["image",r.image.name]);else{t.push(r.text);var i={};r.fontStack&&(i["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(i["font-scale"]=r.scale),r.textColor&&(i["text-color"]=["rgba"].concat(r.textColor.toArray())),t.push(i)}}return t};var oe=function(t){this.name=t.name,this.available=t.available};function ae(t,e,n,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:"Invalid rgba value ["+[t,e,n,r].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof r?[t,e,n,r]:[t,e,n]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function se(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof ee)return!0;if(t instanceof ne)return!0;if(t instanceof ie)return!0;if(t instanceof oe)return!0;if(Array.isArray(t)){for(var e=0,n=t;e<n.length;e+=1)if(!se(n[e]))return!1;return!0}if("object"==typeof t){for(var r in t)if(!se(t[r]))return!1;return!0}return!1}function le(t){if(null===t)return Bt;if("string"==typeof t)return Ut;if("boolean"==typeof t)return jt;if("number"==typeof t)return Nt;if(t instanceof ee)return Vt;if(t instanceof ne)return Wt;if(t instanceof ie)return qt;if(t instanceof oe)return Zt;if(Array.isArray(t)){for(var e,n=t.length,r=0,i=t;r<i.length;r+=1){var o=le(i[r]);if(e){if(e===o)continue;e=Ht;break}e=o}return Xt(e||Ht,n)}return Gt}function ce(t){var e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof ee||t instanceof ie||t instanceof oe?t.toString():JSON.stringify(t)}oe.prototype.toString=function(){return this.name},oe.fromString=function(t){return t?new oe({name:t,available:!1}):null},oe.prototype.serialize=function(){return["image",this.name]};var ue=function(t,e){this.type=t,this.value=e};ue.parse=function(t,e){if(2!==t.length)return e.error("'literal' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(!se(t[1]))return e.error("invalid value");var n=t[1],r=le(n),i=e.expectedType;return"array"!==r.kind||0!==r.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(r=i),new ue(r,n)},ue.prototype.evaluate=function(){return this.value},ue.prototype.eachChild=function(){},ue.prototype.outputDefined=function(){return!0},ue.prototype.serialize=function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof ee?["rgba"].concat(this.value.toArray()):this.value instanceof ie?this.value.serialize():this.value};var pe=function(t){this.name="ExpressionEvaluationError",this.message=t};pe.prototype.toJSON=function(){return this.message};var he={string:Ut,number:Nt,boolean:jt,object:Gt},de=function(t,e){this.type=t,this.args=e};de.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var n,r=1,i=t[0];if("array"===i){var o,a;if(t.length>2){var s=t[1];if("string"!=typeof s||!(s in he)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);o=he[s],r++}else o=Ht;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],r++}n=Xt(o,a)}else n=he[i];for(var l=[];r<t.length;r++){var c=e.parse(t[r],r,Ht);if(!c)return null;l.push(c)}return new de(n,l)},de.prototype.evaluate=function(t){for(var e=0;e<this.args.length;e++){var n=this.args[e].evaluate(t);if(!Yt(this.type,le(n)))return n;if(e===this.args.length-1)throw new pe("Expected value to be of type "+$t(this.type)+", but found "+$t(le(n))+" instead.")}return null},de.prototype.eachChild=function(t){this.args.forEach(t)},de.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},de.prototype.serialize=function(){var t=this.type,e=[t.kind];if("array"===t.kind){var n=t.itemType;if("string"===n.kind||"number"===n.kind||"boolean"===n.kind){e.push(n.kind);var r=t.N;("number"==typeof r||this.args.length>1)&&e.push(r)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var fe=function(t){this.type=qt,this.sections=t};fe.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var n=t[1];if(!Array.isArray(n)&&"object"==typeof n)return e.error("First argument must be an image or text section.");for(var r=[],i=!1,o=1;o<=t.length-1;++o){var a=t[o];if(i&&"object"==typeof a&&!Array.isArray(a)){i=!1;var s=null;if(a["font-scale"]&&!(s=e.parse(a["font-scale"],1,Nt)))return null;var l=null;if(a["text-font"]&&!(l=e.parse(a["text-font"],1,Xt(Ut))))return null;var c=null;if(a["text-color"]&&!(c=e.parse(a["text-color"],1,Vt)))return null;var u=r[r.length-1];u.scale=s,u.font=l,u.textColor=c}else{var p=e.parse(t[o],1,Ht);if(!p)return null;var h=p.type.kind;if("string"!==h&&"value"!==h&&"null"!==h&&"resolvedImage"!==h)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,r.push({content:p,scale:null,font:null,textColor:null})}}return new fe(r)},fe.prototype.evaluate=function(t){return new ie(this.sections.map((function(e){var n=e.content.evaluate(t);return le(n)===Zt?new re("",n,null,null,null):new re(ce(n),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},fe.prototype.eachChild=function(t){for(var e=0,n=this.sections;e<n.length;e+=1){var r=n[e];t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}},fe.prototype.outputDefined=function(){return!1},fe.prototype.serialize=function(){for(var t=["format"],e=0,n=this.sections;e<n.length;e+=1){var r=n[e];t.push(r.content.serialize());var i={};r.scale&&(i["font-scale"]=r.scale.serialize()),r.font&&(i["text-font"]=r.font.serialize()),r.textColor&&(i["text-color"]=r.textColor.serialize()),t.push(i)}return t};var me=function(t){this.type=Zt,this.input=t};me.parse=function(t,e){if(2!==t.length)return e.error("Expected two arguments.");var n=e.parse(t[1],1,Ut);return n?new me(n):e.error("No image name provided.")},me.prototype.evaluate=function(t){var e=this.input.evaluate(t),n=oe.fromString(e);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(e)>-1),n},me.prototype.eachChild=function(t){t(this.input)},me.prototype.outputDefined=function(){return!1},me.prototype.serialize=function(){return["image",this.input.serialize()]};var ge={"to-boolean":jt,"to-color":Vt,"to-number":Nt,"to-string":Ut},ye=function(t,e){this.type=t,this.args=e};ye.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var n=t[0];if(("to-boolean"===n||"to-string"===n)&&2!==t.length)return e.error("Expected one argument.");for(var r=ge[n],i=[],o=1;o<t.length;o++){var a=e.parse(t[o],o,Ht);if(!a)return null;i.push(a)}return new ye(r,i)},ye.prototype.evaluate=function(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){for(var e,n,r=0,i=this.args;r<i.length;r+=1){if(n=null,(e=i[r].evaluate(t))instanceof ee)return e;if("string"==typeof e){var o=t.parseColor(e);if(o)return o}else if(Array.isArray(e)&&!(n=e.length<3||e.length>4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":ae(e[0],e[1],e[2],e[3])))return new ee(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new pe(n||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var a=null,s=0,l=this.args;s<l.length;s+=1){if(null===(a=l[s].evaluate(t)))return 0;var c=Number(a);if(!isNaN(c))return c}throw new pe("Could not convert "+JSON.stringify(a)+" to number.")}return"formatted"===this.type.kind?ie.fromString(ce(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?oe.fromString(ce(this.args[0].evaluate(t))):ce(this.args[0].evaluate(t))},ye.prototype.eachChild=function(t){this.args.forEach(t)},ye.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},ye.prototype.serialize=function(){if("formatted"===this.type.kind)return new fe([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new me(this.args[0]).serialize();var t=["to-"+this.type.kind];return this.eachChild((function(e){t.push(e.serialize())})),t};var ve=["Unknown","Point","LineString","Polygon"],_e=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null};_e.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},_e.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?ve[this.feature.type]:this.feature.type:null},_e.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},_e.prototype.canonicalID=function(){return this.canonical},_e.prototype.properties=function(){return this.feature&&this.feature.properties||{}},_e.prototype.parseColor=function(t){var e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=ee.parse(t)),e};var xe=function(t,e,n,r){this.name=t,this.type=e,this._evaluate=n,this.args=r};xe.prototype.evaluate=function(t){return this._evaluate(t,this.args)},xe.prototype.eachChild=function(t){this.args.forEach(t)},xe.prototype.outputDefined=function(){return!1},xe.prototype.serialize=function(){return[this.name].concat(this.args.map((function(t){return t.serialize()})))},xe.parse=function(t,e){var n,r=t[0],i=xe.definitions[r];if(!i)return e.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0);for(var o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter((function(e){var n=e[0];return!Array.isArray(n)||n.length===t.length-1})),l=null,c=0,u=s;c<u.length;c+=1){var p=u[c],h=p[0],d=p[1];l=new Ve(e.registry,e.path,null,e.scope);for(var f=[],m=!1,g=1;g<t.length;g++){var y=t[g],v=Array.isArray(h)?h[g-1]:h.type,_=l.parse(y,1+f.length,v);if(!_){m=!0;break}f.push(_)}if(!m)if(Array.isArray(h)&&h.length!==f.length)l.error("Expected "+h.length+" arguments, but found "+f.length+" instead.");else{for(var x=0;x<f.length;x++){var b=Array.isArray(h)?h[x]:h.type,w=f[x];l.concat(x+1).checkSubtype(b,w.type)}if(0===l.errors.length)return new xe(r,o,d,f)}}if(1===s.length)(n=e.errors).push.apply(n,l.errors);else{for(var M=(s.length?s:a).map((function(t){var e;return e=t[0],Array.isArray(e)?"("+e.map($t).join(", ")+")":"("+$t(e.type)+"...)"})).join(" | "),S=[],T=1;T<t.length;T++){var E=e.parse(t[T],1+S.length);if(!E)return null;S.push($t(E.type))}e.error("Expected arguments of type "+M+", but found ("+S.join(", ")+") instead.")}return null},xe.register=function(t,e){for(var n in xe.definitions=e,e)t[n]=xe};var be=function(t,e,n){this.type=Wt,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=e};function we(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Me(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Se(t,e){var n=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(n*i*8192),Math.round(r*i*8192)]}function Te(t,e,n){return e[1]>t[1]!=n[1]>t[1]&&t[0]<(n[0]-e[0])*(t[1]-e[1])/(n[1]-e[1])+e[0]}function Ee(t,e){for(var n,r,i,o,a,s,l,c=!1,u=0,p=e.length;u<p;u++)for(var h=e[u],d=0,f=h.length;d<f-1;d++){if((o=(n=t)[0]-(r=h[d])[0])*(l=n[1]-(i=h[d+1])[1])-(s=n[0]-i[0])*(a=n[1]-r[1])==0&&o*s<=0&&a*l<=0)return!1;Te(t,h[d],h[d+1])&&(c=!c)}return c}function Ae(t,e){for(var n=0;n<e.length;n++)if(Ee(t,e[n]))return!0;return!1}function Ce(t,e,n,r){var i=r[0]-n[0],o=r[1]-n[1],a=(t[0]-n[0])*o-i*(t[1]-n[1]),s=(e[0]-n[0])*o-i*(e[1]-n[1]);return a>0&&s<0||a<0&&s>0}function Le(t,e,n){for(var r=0,i=n;r<i.length;r+=1)for(var o=i[r],a=0;a<o.length-1;++a)if(0!=(p=[(u=o[a+1])[0]-(c=o[a])[0],u[1]-c[1]])[0]*(h=[(l=e)[0]-(s=t)[0],l[1]-s[1]])[1]-p[1]*h[0]&&Ce(s,l,c,u)&&Ce(c,u,s,l))return!0;var s,l,c,u,p,h;return!1}function Pe(t,e){for(var n=0;n<t.length;++n)if(!Ee(t[n],e))return!1;for(var r=0;r<t.length-1;++r)if(Le(t[r],t[r+1],e))return!1;return!0}function Ie(t,e){for(var n=0;n<e.length;n++)if(Pe(t,e[n]))return!0;return!1}function Re(t,e,n){for(var r=[],i=0;i<t.length;i++){for(var o=[],a=0;a<t[i].length;a++){var s=Se(t[i][a],n);we(e,s),o.push(s)}r.push(o)}return r}function ke(t,e,n){for(var r=[],i=0;i<t.length;i++){var o=Re(t[i],e,n);r.push(o)}return r}function ze(t,e,n,r){if(t[0]<n[0]||t[0]>n[2]){var i=.5*r,o=t[0]-n[0]>i?-r:n[0]-t[0]>i?r:0;0===o&&(o=t[0]-n[2]>i?-r:n[2]-t[0]>i?r:0),t[0]+=o}we(e,t)}function De(t,e,n,r){for(var i=8192*Math.pow(2,r.z),o=[8192*r.x,8192*r.y],a=[],s=0,l=t;s<l.length;s+=1)for(var c=0,u=l[s];c<u.length;c+=1){var p=u[c],h=[p.x+o[0],p.y+o[1]];ze(h,e,n,i),a.push(h)}return a}function Oe(t,e,n,r){for(var i,o=8192*Math.pow(2,r.z),a=[8192*r.x,8192*r.y],s=[],l=0,c=t;l<c.length;l+=1){for(var u=[],p=0,h=c[l];p<h.length;p+=1){var d=h[p],f=[d.x+a[0],d.y+a[1]];we(e,f),u.push(f)}s.push(u)}if(e[2]-e[0]<=o/2){(i=e)[0]=i[1]=1/0,i[2]=i[3]=-1/0;for(var m=0,g=s;m<g.length;m+=1)for(var y=0,v=g[m];y<v.length;y+=1)ze(v[y],e,n,o)}return s}be.parse=function(t,e){if(2!==t.length)return e.error("Expected one argument.");var n=t[1];if("object"!=typeof n||Array.isArray(n))return e.error("Collator options argument must be an object.");var r=e.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,jt);if(!r)return null;var i=e.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,jt);if(!i)return null;var o=null;return n.locale&&!(o=e.parse(n.locale,1,Ut))?null:new be(r,i,o)},be.prototype.evaluate=function(t){return new ne(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)},be.prototype.eachChild=function(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)},be.prototype.outputDefined=function(){return!1},be.prototype.serialize=function(){var t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]};var Fe=function(t,e){this.type=jt,this.geojson=t,this.geometries=e};function Be(t){if(t instanceof xe){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Fe)return!1;var e=!0;return t.eachChild((function(t){e&&!Be(t)&&(e=!1)})),e}function Ne(t){if(t instanceof xe&&"feature-state"===t.name)return!1;var e=!0;return t.eachChild((function(t){e&&!Ne(t)&&(e=!1)})),e}function Ue(t,e){if(t instanceof xe&&e.indexOf(t.name)>=0)return!1;var n=!0;return t.eachChild((function(t){n&&!Ue(t,e)&&(n=!1)})),n}Fe.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(se(t[1])){var n=t[1];if("FeatureCollection"===n.type)for(var r=0;r<n.features.length;++r){var i=n.features[r].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new Fe(n,n.features[r].geometry)}else if("Feature"===n.type){var o=n.geometry.type;if("Polygon"===o||"MultiPolygon"===o)return new Fe(n,n.geometry)}else if("Polygon"===n.type||"MultiPolygon"===n.type)return new Fe(n,n)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")},Fe.prototype.evaluate=function(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){var n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){var o=Re(e.coordinates,r,i),a=De(t.geometry(),n,r,i);if(!Me(n,r))return!1;for(var s=0,l=a;s<l.length;s+=1)if(!Ee(l[s],o))return!1}if("MultiPolygon"===e.type){var c=ke(e.coordinates,r,i),u=De(t.geometry(),n,r,i);if(!Me(n,r))return!1;for(var p=0,h=u;p<h.length;p+=1)if(!Ae(h[p],c))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){var n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){var o=Re(e.coordinates,r,i),a=Oe(t.geometry(),n,r,i);if(!Me(n,r))return!1;for(var s=0,l=a;s<l.length;s+=1)if(!Pe(l[s],o))return!1}if("MultiPolygon"===e.type){var c=ke(e.coordinates,r,i),u=Oe(t.geometry(),n,r,i);if(!Me(n,r))return!1;for(var p=0,h=u;p<h.length;p+=1)if(!Ie(h[p],c))return!1}return!0}(t,this.geometries)}return!1},Fe.prototype.eachChild=function(){},Fe.prototype.outputDefined=function(){return!0},Fe.prototype.serialize=function(){return["within",this.geojson]};var je=function(t,e){this.type=e.type,this.name=t,this.boundExpression=e};je.parse=function(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");var n=t[1];return e.scope.has(n)?new je(n,e.scope.get(n)):e.error('Unknown variable "'+n+'". Make sure "'+n+'" has been bound in an enclosing "let" expression before using it.',1)},je.prototype.evaluate=function(t){return this.boundExpression.evaluate(t)},je.prototype.eachChild=function(){},je.prototype.outputDefined=function(){return!1},je.prototype.serialize=function(){return["var",this.name]};var Ve=function(t,e,n,r,i){void 0===e&&(e=[]),void 0===r&&(r=new Ft),void 0===i&&(i=[]),this.registry=t,this.path=e,this.key=e.map((function(t){return"["+t+"]"})).join(""),this.scope=r,this.errors=i,this.expectedType=n};function Ge(t,e){for(var n,r=t.length-1,i=0,o=r,a=0;i<=o;)if((n=t[a=Math.floor((i+o)/2)])<=e){if(a===r||e<t[a+1])return a;i=a+1}else{if(!(n>e))throw new pe("Input is not a number.");o=a-1}return 0}Ve.prototype.parse=function(t,e,n,r,i){return void 0===i&&(i={}),e?this.concat(e,n,r)._parse(t,i):this._parse(t,i)},Ve.prototype._parse=function(t,e){function n(t,e,n){return"assert"===n?new de(e,[t]):"coerce"===n?new ye(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var r=t[0];if("string"!=typeof r)return this.error("Expression name must be a string, but found "+typeof r+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var i=this.registry[r];if(i){var o=i.parse(t,this);if(!o)return null;if(this.expectedType){var a=this.expectedType,s=o.type;if("string"!==a.kind&&"number"!==a.kind&&"boolean"!==a.kind&&"object"!==a.kind&&"array"!==a.kind||"value"!==s.kind)if("color"!==a.kind&&"formatted"!==a.kind&&"resolvedImage"!==a.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(a,s))return null}else o=n(o,a,e.typeAnnotation||"coerce");else o=n(o,a,e.typeAnnotation||"assert")}if(!(o instanceof ue)&&"resolvedImage"!==o.type.kind&&function t(e){if(e instanceof je)return t(e.boundExpression);if(e instanceof xe&&"error"===e.name)return!1;if(e instanceof be)return!1;if(e instanceof Fe)return!1;var n=e instanceof ye||e instanceof de,r=!0;return e.eachChild((function(e){r=n?r&&t(e):r&&e instanceof ue})),!!r&&Be(e)&&Ue(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(o)){var l=new _e;try{o=new ue(o.type,o.evaluate(l))}catch(t){return this.error(t.message),null}}return o}return this.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},Ve.prototype.concat=function(t,e,n){var r="number"==typeof t?this.path.concat(t):this.path,i=n?this.scope.concat(n):this.scope;return new Ve(this.registry,r,e||null,i,this.errors)},Ve.prototype.error=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];var r=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new Ot(r,t))},Ve.prototype.checkSubtype=function(t,e){var n=Yt(t,e);return n&&this.error(n),n};var He=function(t,e,n){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var r=0,i=n;r<i.length;r+=1){var o=i[r],a=o[1];this.labels.push(o[0]),this.outputs.push(a)}};function We(t,e,n){return t*(1-n)+e*n}He.parse=function(t,e){if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");var n=e.parse(t[1],1,Nt);if(!n)return null;var r=[],i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(var o=1;o<t.length;o+=2){var a=1===o?-1/0:t[o],s=t[o+1],l=o,c=o+1;if("number"!=typeof a)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',l);if(r.length&&r[r.length-1][0]>=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);var u=e.parse(s,c,i);if(!u)return null;i=i||u.type,r.push([a,u])}return new He(i,n,r)},He.prototype.evaluate=function(t){var e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);var r=this.input.evaluate(t);if(r<=e[0])return n[0].evaluate(t);var i=e.length;return r>=e[i-1]?n[i-1].evaluate(t):n[Ge(e,r)].evaluate(t)},He.prototype.eachChild=function(t){t(this.input);for(var e=0,n=this.outputs;e<n.length;e+=1)t(n[e])},He.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},He.prototype.serialize=function(){for(var t=["step",this.input.serialize()],e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var qe=Object.freeze({__proto__:null,number:We,color:function(t,e,n){return new ee(We(t.r,e.r,n),We(t.g,e.g,n),We(t.b,e.b,n),We(t.a,e.a,n))},array:function(t,e,n){return t.map((function(t,r){return We(t,e[r],n)}))}}),Ze=6/29*3*(6/29),Xe=Math.PI/180,$e=180/Math.PI;function Je(t){return t>.008856451679035631?Math.pow(t,1/3):t/Ze+4/29}function Ye(t){return t>6/29?t*t*t:Ze*(t-4/29)}function Qe(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Ke(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function tn(t){var e=Ke(t.r),n=Ke(t.g),r=Ke(t.b),i=Je((.4124564*e+.3575761*n+.1804375*r)/.95047),o=Je((.2126729*e+.7151522*n+.072175*r)/1);return{l:116*o-16,a:500*(i-o),b:200*(o-Je((.0193339*e+.119192*n+.9503041*r)/1.08883)),alpha:t.a}}function en(t){var e=(t.l+16)/116,n=isNaN(t.a)?e:e+t.a/500,r=isNaN(t.b)?e:e-t.b/200;return e=1*Ye(e),n=.95047*Ye(n),r=1.08883*Ye(r),new ee(Qe(3.2404542*n-1.5371385*e-.4985314*r),Qe(-.969266*n+1.8760108*e+.041556*r),Qe(.0556434*n-.2040259*e+1.0572252*r),t.alpha)}function nn(t,e,n){var r=e-t;return t+n*(r>180||r<-180?r-360*Math.round(r/360):r)}var rn={forward:tn,reverse:en,interpolate:function(t,e,n){return{l:We(t.l,e.l,n),a:We(t.a,e.a,n),b:We(t.b,e.b,n),alpha:We(t.alpha,e.alpha,n)}}},on={forward:function(t){var e=tn(t),n=e.l,r=e.a,i=e.b,o=Math.atan2(i,r)*$e;return{h:o<0?o+360:o,c:Math.sqrt(r*r+i*i),l:n,alpha:t.a}},reverse:function(t){var e=t.h*Xe,n=t.c;return en({l:t.l,a:Math.cos(e)*n,b:Math.sin(e)*n,alpha:t.alpha})},interpolate:function(t,e,n){return{h:nn(t.h,e.h,n),c:We(t.c,e.c,n),l:We(t.l,e.l,n),alpha:We(t.alpha,e.alpha,n)}}},an=Object.freeze({__proto__:null,lab:rn,hcl:on}),sn=function(t,e,n,r,i){this.type=t,this.operator=e,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(var o=0,a=i;o<a.length;o+=1){var s=a[o],l=s[1];this.labels.push(s[0]),this.outputs.push(l)}};function ln(t,e,n,r){var i=r-n,o=t-n;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}sn.interpolationFactor=function(t,e,r,i){var o=0;if("exponential"===t.name)o=ln(e,t.base,r,i);else if("linear"===t.name)o=ln(e,1,r,i);else if("cubic-bezier"===t.name){var a=t.controlPoints;o=new n(a[0],a[1],a[2],a[3]).solve(ln(e,1,r,i))}return o},sn.parse=function(t,e){var n=t[0],r=t[1],i=t[2],o=t.slice(3);if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){var a=r[1];if("number"!=typeof a)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:a}}else{if("cubic-bezier"!==r[0])return e.error("Unknown interpolation type "+String(r[0]),1,0);var s=r.slice(1);if(4!==s.length||s.some((function(t){return"number"!=typeof t||t<0||t>1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(i=e.parse(i,2,Nt)))return null;var l=[],c=null;"interpolate-hcl"===n||"interpolate-lab"===n?c=Vt:e.expectedType&&"value"!==e.expectedType.kind&&(c=e.expectedType);for(var u=0;u<o.length;u+=2){var p=o[u],h=o[u+1],d=u+3,f=u+4;if("number"!=typeof p)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(l.length&&l[l.length-1][0]>=p)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);var m=e.parse(h,f,c);if(!m)return null;c=c||m.type,l.push([p,m])}return"number"===c.kind||"color"===c.kind||"array"===c.kind&&"number"===c.itemType.kind&&"number"==typeof c.N?new sn(c,n,r,i,l):e.error("Type "+$t(c)+" is not interpolatable.")},sn.prototype.evaluate=function(t){var e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);var r=this.input.evaluate(t);if(r<=e[0])return n[0].evaluate(t);var i=e.length;if(r>=e[i-1])return n[i-1].evaluate(t);var o=Ge(e,r),a=sn.interpolationFactor(this.interpolation,r,e[o],e[o+1]),s=n[o].evaluate(t),l=n[o+1].evaluate(t);return"interpolate"===this.operator?qe[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?on.reverse(on.interpolate(on.forward(s),on.forward(l),a)):rn.reverse(rn.interpolate(rn.forward(s),rn.forward(l),a))},sn.prototype.eachChild=function(t){t(this.input);for(var e=0,n=this.outputs;e<n.length;e+=1)t(n[e])},sn.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},sn.prototype.serialize=function(){var t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);for(var e=[this.operator,t,this.input.serialize()],n=0;n<this.labels.length;n++)e.push(this.labels[n],this.outputs[n].serialize());return e};var cn=function(t,e){this.type=t,this.args=e};cn.parse=function(t,e){if(t.length<2)return e.error("Expectected at least one argument.");var n=null,r=e.expectedType;r&&"value"!==r.kind&&(n=r);for(var i=[],o=0,a=t.slice(1);o<a.length;o+=1){var s=e.parse(a[o],1+i.length,n,void 0,{typeAnnotation:"omit"});if(!s)return null;n=n||s.type,i.push(s)}var l=r&&i.some((function(t){return Yt(r,t.type)}));return new cn(l?Ht:n,i)},cn.prototype.evaluate=function(t){for(var e,n=null,r=0,i=0,o=this.args;i<o.length&&(r++,(n=o[i].evaluate(t))&&n instanceof oe&&!n.available&&(e||(e=n.name),n=null,r===this.args.length&&(n=e)),null===n);i+=1);return n},cn.prototype.eachChild=function(t){this.args.forEach(t)},cn.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},cn.prototype.serialize=function(){var t=["coalesce"];return this.eachChild((function(e){t.push(e.serialize())})),t};var un=function(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e};un.prototype.evaluate=function(t){return this.result.evaluate(t)},un.prototype.eachChild=function(t){for(var e=0,n=this.bindings;e<n.length;e+=1)t(n[e][1]);t(this.result)},un.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found "+(t.length-1)+" instead.");for(var n=[],r=1;r<t.length-1;r+=2){var i=t[r];if("string"!=typeof i)return e.error("Expected string, but found "+typeof i+" instead.",r);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",r);var o=e.parse(t[r+1],r+1);if(!o)return null;n.push([i,o])}var a=e.parse(t[t.length-1],t.length-1,e.expectedType,n);return a?new un(n,a):null},un.prototype.outputDefined=function(){return this.result.outputDefined()},un.prototype.serialize=function(){for(var t=["let"],e=0,n=this.bindings;e<n.length;e+=1){var r=n[e];t.push(r[0],r[1].serialize())}return t.push(this.result.serialize()),t};var pn=function(t,e,n){this.type=t,this.index=e,this.input=n};pn.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var n=e.parse(t[1],1,Nt),r=e.parse(t[2],2,Xt(e.expectedType||Ht));return n&&r?new pn(r.type.itemType,n,r):null},pn.prototype.evaluate=function(t){var e=this.index.evaluate(t),n=this.input.evaluate(t);if(e<0)throw new pe("Array index out of bounds: "+e+" < 0.");if(e>=n.length)throw new pe("Array index out of bounds: "+e+" > "+(n.length-1)+".");if(e!==Math.floor(e))throw new pe("Array index must be an integer, but found "+e+" instead.");return n[e]},pn.prototype.eachChild=function(t){t(this.index),t(this.input)},pn.prototype.outputDefined=function(){return!1},pn.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var hn=function(t,e){this.type=jt,this.needle=t,this.haystack=e};hn.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var n=e.parse(t[1],1,Ht),r=e.parse(t[2],2,Ht);return n&&r?Qt(n.type,[jt,Ut,Nt,Bt,Ht])?new hn(n,r):e.error("Expected first argument to be of type boolean, string, number or null, but found "+$t(n.type)+" instead"):null},hn.prototype.evaluate=function(t){var e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!Kt(e,["boolean","string","number","null"]))throw new pe("Expected first argument to be of type boolean, string, number or null, but found "+$t(le(e))+" instead.");if(!Kt(n,["string","array"]))throw new pe("Expected second argument to be of type array or string, but found "+$t(le(n))+" instead.");return n.indexOf(e)>=0},hn.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},hn.prototype.outputDefined=function(){return!0},hn.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var dn=function(t,e,n){this.type=Nt,this.needle=t,this.haystack=e,this.fromIndex=n};dn.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var n=e.parse(t[1],1,Ht),r=e.parse(t[2],2,Ht);if(!n||!r)return null;if(!Qt(n.type,[jt,Ut,Nt,Bt,Ht]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+$t(n.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Nt);return i?new dn(n,r,i):null}return new dn(n,r)},dn.prototype.evaluate=function(t){var e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!Kt(e,["boolean","string","number","null"]))throw new pe("Expected first argument to be of type boolean, string, number or null, but found "+$t(le(e))+" instead.");if(!Kt(n,["string","array"]))throw new pe("Expected second argument to be of type array or string, but found "+$t(le(n))+" instead.");if(this.fromIndex){var r=this.fromIndex.evaluate(t);return n.indexOf(e,r)}return n.indexOf(e)},dn.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},dn.prototype.outputDefined=function(){return!1},dn.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var fn=function(t,e,n,r,i,o){this.inputType=t,this.type=e,this.input=n,this.cases=r,this.outputs=i,this.otherwise=o};fn.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var n,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(var i={},o=[],a=2;a<t.length-1;a+=2){var s=t[a],l=t[a+1];Array.isArray(s)||(s=[s]);var c=e.concat(a);if(0===s.length)return c.error("Expected at least one branch label.");for(var u=0,p=s;u<p.length;u+=1){var h=p[u];if("number"!=typeof h&&"string"!=typeof h)return c.error("Branch labels must be numbers or strings.");if("number"==typeof h&&Math.abs(h)>Number.MAX_SAFE_INTEGER)return c.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof h&&Math.floor(h)!==h)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,le(h)))return null}else n=le(h);if(void 0!==i[String(h)])return c.error("Branch labels must be unique.");i[String(h)]=o.length}var d=e.parse(l,a,r);if(!d)return null;r=r||d.type,o.push(d)}var f=e.parse(t[1],1,Ht);if(!f)return null;var m=e.parse(t[t.length-1],t.length-1,r);return m?"value"!==f.type.kind&&e.concat(1).checkSubtype(n,f.type)?null:new fn(n,r,f,i,o,m):null},fn.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(le(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},fn.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},fn.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},fn.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],n=[],r={},i=0,o=Object.keys(this.cases).sort();i<o.length;i+=1){var a=o[i];void 0===(p=r[this.cases[a]])?(r[this.cases[a]]=n.length,n.push([this.cases[a],[a]])):n[p][1].push(a)}for(var s=function(e){return"number"===t.inputType.kind?Number(e):e},l=0,c=n;l<c.length;l+=1){var u=c[l],p=u[0],h=u[1];e.push(1===h.length?s(h[0]):h.map(s)),e.push(this.outputs[outputIndex$1].serialize())}return e.push(this.otherwise.serialize()),e};var mn=function(t,e,n){this.type=t,this.branches=e,this.otherwise=n};mn.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found only "+(t.length-1)+".");if(t.length%2!=0)return e.error("Expected an odd number of arguments.");var n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var r=[],i=1;i<t.length-1;i+=2){var o=e.parse(t[i],i,jt);if(!o)return null;var a=e.parse(t[i+1],i+1,n);if(!a)return null;r.push([o,a]),n=n||a.type}var s=e.parse(t[t.length-1],t.length-1,n);return s?new mn(n,r,s):null},mn.prototype.evaluate=function(t){for(var e=0,n=this.branches;e<n.length;e+=1){var r=n[e],i=r[1];if(r[0].evaluate(t))return i.evaluate(t)}return this.otherwise.evaluate(t)},mn.prototype.eachChild=function(t){for(var e=0,n=this.branches;e<n.length;e+=1){var r=n[e],i=r[1];t(r[0]),t(i)}t(this.otherwise)},mn.prototype.outputDefined=function(){return this.branches.every((function(t){return t[1].outputDefined()}))&&this.otherwise.outputDefined()},mn.prototype.serialize=function(){var t=["case"];return this.eachChild((function(e){t.push(e.serialize())})),t};var gn=function(t,e,n,r){this.type=t,this.input=e,this.beginIndex=n,this.endIndex=r};function yn(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function vn(t,e,n,r){return 0===r.compare(e,n)}function _n(t,e,n){var r="=="!==t&&"!="!==t;return function(){function i(t,e,n){this.type=jt,this.lhs=t,this.rhs=e,this.collator=n,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}return i.parse=function(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");var n=t[0],o=e.parse(t[1],1,Ht);if(!o)return null;if(!yn(n,o.type))return e.concat(1).error('"'+n+"\" comparisons are not supported for type '"+$t(o.type)+"'.");var a=e.parse(t[2],2,Ht);if(!a)return null;if(!yn(n,a.type))return e.concat(2).error('"'+n+"\" comparisons are not supported for type '"+$t(a.type)+"'.");if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot compare types '"+$t(o.type)+"' and '"+$t(a.type)+"'.");r&&("value"===o.type.kind&&"value"!==a.type.kind?o=new de(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new de(o.type,[a])));var s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(!(s=e.parse(t[3],3,Wt)))return null}return new i(o,a,s)},i.prototype.evaluate=function(i){var o=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){var s=le(o),l=le(a);if(s.kind!==l.kind||"string"!==s.kind&&"number"!==s.kind)throw new pe('Expected arguments for "'+t+'" to be (string, string) or (number, number), but found ('+s.kind+", "+l.kind+") instead.")}if(this.collator&&!r&&this.hasUntypedArgument){var c=le(o),u=le(a);if("string"!==c.kind||"string"!==u.kind)return e(i,o,a)}return this.collator?n(i,o,a,this.collator.evaluate(i)):e(i,o,a)},i.prototype.eachChild=function(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)},i.prototype.outputDefined=function(){return!0},i.prototype.serialize=function(){var e=[t];return this.eachChild((function(t){e.push(t.serialize())})),e},i}()}gn.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var n=e.parse(t[1],1,Ht),r=e.parse(t[2],2,Nt);if(!n||!r)return null;if(!Qt(n.type,[Xt(Ht),Ut,Ht]))return e.error("Expected first argument to be of type array or string, but found "+$t(n.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Nt);return i?new gn(n.type,n,r,i):null}return new gn(n.type,n,r)},gn.prototype.evaluate=function(t){var e=this.input.evaluate(t),n=this.beginIndex.evaluate(t);if(!Kt(e,["string","array"]))throw new pe("Expected first argument to be of type array or string, but found "+$t(le(e))+" instead.");if(this.endIndex){var r=this.endIndex.evaluate(t);return e.slice(n,r)}return e.slice(n)},gn.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},gn.prototype.outputDefined=function(){return!1},gn.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var xn=_n("==",(function(t,e,n){return e===n}),vn),bn=_n("!=",(function(t,e,n){return e!==n}),(function(t,e,n,r){return!vn(0,e,n,r)})),wn=_n("<",(function(t,e,n){return e<n}),(function(t,e,n,r){return r.compare(e,n)<0})),Mn=_n(">",(function(t,e,n){return e>n}),(function(t,e,n,r){return r.compare(e,n)>0})),Sn=_n("<=",(function(t,e,n){return e<=n}),(function(t,e,n,r){return r.compare(e,n)<=0})),Tn=_n(">=",(function(t,e,n){return e>=n}),(function(t,e,n,r){return r.compare(e,n)>=0})),En=function(t,e,n,r,i){this.type=Ut,this.number=t,this.locale=e,this.currency=n,this.minFractionDigits=r,this.maxFractionDigits=i};En.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var n=e.parse(t[1],1,Nt);if(!n)return null;var r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");var i=null;if(r.locale&&!(i=e.parse(r.locale,1,Ut)))return null;var o=null;if(r.currency&&!(o=e.parse(r.currency,1,Ut)))return null;var a=null;if(r["min-fraction-digits"]&&!(a=e.parse(r["min-fraction-digits"],1,Nt)))return null;var s=null;return r["max-fraction-digits"]&&!(s=e.parse(r["max-fraction-digits"],1,Nt))?null:new En(n,i,o,a,s)},En.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},En.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},En.prototype.outputDefined=function(){return!1},En.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var An=function(t){this.type=Nt,this.input=t};An.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var n=e.parse(t[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?e.error("Expected argument of type string or array, but found "+$t(n.type)+" instead."):new An(n):null},An.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new pe("Expected value to be of type string or array, but found "+$t(le(e))+" instead.")},An.prototype.eachChild=function(t){t(this.input)},An.prototype.outputDefined=function(){return!1},An.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Cn={"==":xn,"!=":bn,">":Mn,"<":wn,">=":Tn,"<=":Sn,array:de,at:pn,boolean:de,case:mn,coalesce:cn,collator:be,format:fe,image:me,in:hn,"index-of":dn,interpolate:sn,"interpolate-hcl":sn,"interpolate-lab":sn,length:An,let:un,literal:ue,match:fn,number:de,"number-format":En,object:de,slice:gn,step:He,string:de,"to-boolean":ye,"to-color":ye,"to-number":ye,"to-string":ye,var:je,within:Fe};function Ln(t,e){var n=e[0],r=e[1],i=e[2],o=e[3];n=n.evaluate(t),r=r.evaluate(t),i=i.evaluate(t);var a=o?o.evaluate(t):1,s=ae(n,r,i,a);if(s)throw new pe(s);return new ee(n/255*a,r/255*a,i/255*a,a)}function Pn(t,e){return t in e}function In(t,e){var n=e[t];return void 0===n?null:n}function Rn(t){return{type:t}}function kn(t){return{result:"success",value:t}}function zn(t){return{result:"error",value:t}}function Dn(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function On(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Fn(t){return!!t.expression&&t.expression.interpolated}function Bn(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Nn(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Un(t){return t}function jn(t,e,n){return void 0!==t?t:void 0!==e?e:void 0!==n?n:void 0}function Vn(t,e,n,r,i){return jn(typeof n===i?r[n]:void 0,t.default,e.default)}function Gn(t,e,n){if("number"!==Bn(n))return jn(t.default,e.default);var r=t.stops.length;if(1===r)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[r-1][0])return t.stops[r-1][1];var i=Ge(t.stops.map((function(t){return t[0]})),n);return t.stops[i][1]}function Hn(t,e,n){var r=void 0!==t.base?t.base:1;if("number"!==Bn(n))return jn(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[i-1][0])return t.stops[i-1][1];var o=Ge(t.stops.map((function(t){return t[0]})),n),a=function(t,e,n,r){var i=r-n,o=t-n;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}(n,r,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],c=qe[e.type]||Un;if(t.colorSpace&&"rgb"!==t.colorSpace){var u=an[t.colorSpace];c=function(t,e){return u.reverse(u.interpolate(u.forward(t),u.forward(e),a))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=s.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==n&&void 0!==r)return c(n,r,a)}}:c(s,l,a)}function Wn(t,e,n){return"color"===e.type?n=ee.parse(n):"formatted"===e.type?n=ie.fromString(n.toString()):"resolvedImage"===e.type?n=oe.fromString(n.toString()):Bn(n)===e.type||"enum"===e.type&&e.values[n]||(n=void 0),jn(n,t.default,e.default)}xe.register(Cn,{error:[{kind:"error"},[Ut],function(t,e){throw new pe(e[0].evaluate(t))}],typeof:[Ut,[Ht],function(t,e){return $t(le(e[0].evaluate(t)))}],"to-rgba":[Xt(Nt,4),[Vt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Vt,[Nt,Nt,Nt],Ln],rgba:[Vt,[Nt,Nt,Nt,Nt],Ln],has:{type:jt,overloads:[[[Ut],function(t,e){return Pn(e[0].evaluate(t),t.properties())}],[[Ut,Gt],function(t,e){var n=e[1];return Pn(e[0].evaluate(t),n.evaluate(t))}]]},get:{type:Ht,overloads:[[[Ut],function(t,e){return In(e[0].evaluate(t),t.properties())}],[[Ut,Gt],function(t,e){var n=e[1];return In(e[0].evaluate(t),n.evaluate(t))}]]},"feature-state":[Ht,[Ut],function(t,e){return In(e[0].evaluate(t),t.featureState||{})}],properties:[Gt,[],function(t){return t.properties()}],"geometry-type":[Ut,[],function(t){return t.geometryType()}],id:[Ht,[],function(t){return t.id()}],zoom:[Nt,[],function(t){return t.globals.zoom}],"heatmap-density":[Nt,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Nt,[],function(t){return t.globals.lineProgress||0}],accumulated:[Ht,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Nt,Rn(Nt),function(t,e){for(var n=0,r=0,i=e;r<i.length;r+=1)n+=i[r].evaluate(t);return n}],"*":[Nt,Rn(Nt),function(t,e){for(var n=1,r=0,i=e;r<i.length;r+=1)n*=i[r].evaluate(t);return n}],"-":{type:Nt,overloads:[[[Nt,Nt],function(t,e){var n=e[1];return e[0].evaluate(t)-n.evaluate(t)}],[[Nt],function(t,e){return-e[0].evaluate(t)}]]},"/":[Nt,[Nt,Nt],function(t,e){var n=e[1];return e[0].evaluate(t)/n.evaluate(t)}],"%":[Nt,[Nt,Nt],function(t,e){var n=e[1];return e[0].evaluate(t)%n.evaluate(t)}],ln2:[Nt,[],function(){return Math.LN2}],pi:[Nt,[],function(){return Math.PI}],e:[Nt,[],function(){return Math.E}],"^":[Nt,[Nt,Nt],function(t,e){var n=e[1];return Math.pow(e[0].evaluate(t),n.evaluate(t))}],sqrt:[Nt,[Nt],function(t,e){return Math.sqrt(e[0].evaluate(t))}],log10:[Nt,[Nt],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN10}],ln:[Nt,[Nt],function(t,e){return Math.log(e[0].evaluate(t))}],log2:[Nt,[Nt],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN2}],sin:[Nt,[Nt],function(t,e){return Math.sin(e[0].evaluate(t))}],cos:[Nt,[Nt],function(t,e){return Math.cos(e[0].evaluate(t))}],tan:[Nt,[Nt],function(t,e){return Math.tan(e[0].evaluate(t))}],asin:[Nt,[Nt],function(t,e){return Math.asin(e[0].evaluate(t))}],acos:[Nt,[Nt],function(t,e){return Math.acos(e[0].evaluate(t))}],atan:[Nt,[Nt],function(t,e){return Math.atan(e[0].evaluate(t))}],min:[Nt,Rn(Nt),function(t,e){return Math.min.apply(Math,e.map((function(e){return e.evaluate(t)})))}],max:[Nt,Rn(Nt),function(t,e){return Math.max.apply(Math,e.map((function(e){return e.evaluate(t)})))}],abs:[Nt,[Nt],function(t,e){return Math.abs(e[0].evaluate(t))}],round:[Nt,[Nt],function(t,e){var n=e[0].evaluate(t);return n<0?-Math.round(-n):Math.round(n)}],floor:[Nt,[Nt],function(t,e){return Math.floor(e[0].evaluate(t))}],ceil:[Nt,[Nt],function(t,e){return Math.ceil(e[0].evaluate(t))}],"filter-==":[jt,[Ut,Ht],function(t,e){var n=e[0],r=e[1];return t.properties()[n.value]===r.value}],"filter-id-==":[jt,[Ht],function(t,e){var n=e[0];return t.id()===n.value}],"filter-type-==":[jt,[Ut],function(t,e){var n=e[0];return t.geometryType()===n.value}],"filter-<":[jt,[Ut,Ht],function(t,e){var n=e[0],r=e[1],i=t.properties()[n.value],o=r.value;return typeof i==typeof o&&i<o}],"filter-id-<":[jt,[Ht],function(t,e){var n=e[0],r=t.id(),i=n.value;return typeof r==typeof i&&r<i}],"filter->":[jt,[Ut,Ht],function(t,e){var n=e[0],r=e[1],i=t.properties()[n.value],o=r.value;return typeof i==typeof o&&i>o}],"filter-id->":[jt,[Ht],function(t,e){var n=e[0],r=t.id(),i=n.value;return typeof r==typeof i&&r>i}],"filter-<=":[jt,[Ut,Ht],function(t,e){var n=e[0],r=e[1],i=t.properties()[n.value],o=r.value;return typeof i==typeof o&&i<=o}],"filter-id-<=":[jt,[Ht],function(t,e){var n=e[0],r=t.id(),i=n.value;return typeof r==typeof i&&r<=i}],"filter->=":[jt,[Ut,Ht],function(t,e){var n=e[0],r=e[1],i=t.properties()[n.value],o=r.value;return typeof i==typeof o&&i>=o}],"filter-id->=":[jt,[Ht],function(t,e){var n=e[0],r=t.id(),i=n.value;return typeof r==typeof i&&r>=i}],"filter-has":[jt,[Ht],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[jt,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[jt,[Xt(Ut)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[jt,[Xt(Ht)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[jt,[Ut,Xt(Ht)],function(t,e){var n=e[0];return e[1].value.indexOf(t.properties()[n.value])>=0}],"filter-in-large":[jt,[Ut,Xt(Ht)],function(t,e){var n=e[0],r=e[1];return function(t,e,n,r){for(;n<=r;){var i=n+r>>1;if(e[i]===t)return!0;e[i]>t?r=i-1:n=i+1}return!1}(t.properties()[n.value],r.value,0,r.value.length-1)}],all:{type:jt,overloads:[[[jt,jt],function(t,e){var n=e[1];return e[0].evaluate(t)&&n.evaluate(t)}],[Rn(jt),function(t,e){for(var n=0,r=e;n<r.length;n+=1)if(!r[n].evaluate(t))return!1;return!0}]]},any:{type:jt,overloads:[[[jt,jt],function(t,e){var n=e[1];return e[0].evaluate(t)||n.evaluate(t)}],[Rn(jt),function(t,e){for(var n=0,r=e;n<r.length;n+=1)if(r[n].evaluate(t))return!0;return!1}]]},"!":[jt,[jt],function(t,e){return!e[0].evaluate(t)}],"is-supported-script":[jt,[Ut],function(t,e){var n=t.globals&&t.globals.isSupportedScript;return!n||n(e[0].evaluate(t))}],upcase:[Ut,[Ut],function(t,e){return e[0].evaluate(t).toUpperCase()}],downcase:[Ut,[Ut],function(t,e){return e[0].evaluate(t).toLowerCase()}],concat:[Ut,Rn(Ht),function(t,e){return e.map((function(e){return ce(e.evaluate(t))})).join("")}],"resolved-locale":[Ut,[Wt],function(t,e){return e[0].evaluate(t).resolvedLocale()}]});var qn=function(t,e){this.expression=t,this._warningHistory={},this._evaluator=new _e,this._defaultValue=e?function(t){return"color"===t.type&&Nn(t.default)?new ee(0,0,0,0):"color"===t.type?ee.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null};function Zn(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Cn}function Xn(t,e){var n=new Ve(Cn,[],e?function(t){var e={color:Vt,string:Ut,number:Nt,enum:Ut,boolean:jt,formatted:qt,resolvedImage:Zt};return"array"===t.type?Xt(e[t.value]||Ht,t.length):e[t.type]}(e):void 0),r=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?kn(new qn(r,e)):zn(n.errors)}qn.prototype.evaluateWithoutErrorHandling=function(t,e,n,r,i,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)},qn.prototype.evaluate=function(t,e,n,r,i,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o||null;try{var a=this.expression.evaluate(this._evaluator);if(null==a||"number"==typeof a&&a!=a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new pe("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(a)+" instead.");return a}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var $n=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Ne(e.expression)};$n.prototype.evaluateWithoutErrorHandling=function(t,e,n,r,i,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,r,i,o)},$n.prototype.evaluate=function(t,e,n,r,i,o){return this._styleExpression.evaluate(t,e,n,r,i,o)};var Jn=function(t,e,n,r){this.kind=t,this.zoomStops=n,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Ne(e.expression),this.interpolationType=r};function Yn(t,e){if("error"===(t=Xn(t,e)).result)return t;var n=t.value.expression,r=Be(n);if(!r&&!Dn(e))return zn([new Ot("","data expressions not supported")]);var i=Ue(n,["zoom"]);if(!i&&!On(e))return zn([new Ot("","zoom expressions not supported")]);var o=function t(e){var n=null;if(e instanceof un)n=t(e.result);else if(e instanceof cn)for(var r=0,i=e.args;r<i.length&&!(n=t(i[r]));r+=1);else(e instanceof He||e instanceof sn)&&e.input instanceof xe&&"zoom"===e.input.name&&(n=e);return n instanceof Ot||e.eachChild((function(e){var r=t(e);r instanceof Ot?n=r:!n&&r?n=new Ot("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&r&&n!==r&&(n=new Ot("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),n}(n);return o||i?o instanceof Ot?zn([o]):o instanceof sn&&!Fn(e)?zn([new Ot("",'"interpolate" expressions cannot be used with this property')]):kn(o?new Jn(r?"camera":"composite",t.value,o.labels,o instanceof sn?o.interpolation:void 0):new $n(r?"constant":"source",t.value)):zn([new Ot("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}Jn.prototype.evaluateWithoutErrorHandling=function(t,e,n,r,i,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,r,i,o)},Jn.prototype.evaluate=function(t,e,n,r,i,o){return this._styleExpression.evaluate(t,e,n,r,i,o)},Jn.prototype.interpolationFactor=function(t,e,n){return this.interpolationType?sn.interpolationFactor(this.interpolationType,t,e,n):0};var Qn=function(t,e){this._parameters=t,this._specification=e,kt(this,function t(e,n){var r,i,o,a="color"===n.type,s=e.stops&&"object"==typeof e.stops[0][0],l=s||!(s||void 0!==e.property),c=e.type||(Fn(n)?"exponential":"interval");if(a&&((e=kt({},e)).stops&&(e.stops=e.stops.map((function(t){return[t[0],ee.parse(t[1])]}))),e.default=ee.parse(e.default?e.default:n.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!an[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);if("exponential"===c)r=Hn;else if("interval"===c)r=Gn;else if("categorical"===c){r=Vn,i=Object.create(null);for(var u=0,p=e.stops;u<p.length;u+=1){var h=p[u];i[h[0]]=h[1]}o=typeof e.stops[0][0]}else{if("identity"!==c)throw new Error('Unknown function type "'+c+'"');r=Wn}if(s){for(var d={},f=[],m=0;m<e.stops.length;m++){var g=e.stops[m],y=g[0].zoom;void 0===d[y]&&(d[y]={zoom:y,type:e.type,property:e.property,default:e.default,stops:[]},f.push(y)),d[y].stops.push([g[0].value,g[1]])}for(var v=[],_=0,x=f;_<x.length;_+=1){var b=x[_];v.push([d[b].zoom,t(d[b],n)])}var w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:sn.interpolationFactor.bind(void 0,w),zoomStops:v.map((function(t){return t[0]})),evaluate:function(t,r){var i=t.zoom;return Hn({stops:v,base:e.base},n,i).evaluate(i,r)}}}if(l){var M="exponential"===c?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:sn.interpolationFactor.bind(void 0,M),zoomStops:e.stops.map((function(t){return t[0]})),evaluate:function(t){return r(e,n,t.zoom,i,o)}}}return{kind:"source",evaluate:function(t,a){var s=a&&a.properties?a.properties[e.property]:void 0;return void 0===s?jn(e.default,n.default):r(e,n,s,i,o)}}}(this._parameters,this._specification))};function Kn(t){var e=t.key,n=t.value,r=t.valueSpec||{},i=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=[],l=Bn(n);if("object"!==l)return[new It(e,n,"object expected, "+l+" found")];for(var c in n){var u=c.split(".")[0],p=r[u]||r["*"],h=void 0;if(i[u])h=i[u];else if(r[u])h=Sr;else if(i["*"])h=i["*"];else{if(!r["*"]){s.push(new It(e,n[c],'unknown property "'+c+'"'));continue}h=Sr}s=s.concat(h({key:(e?e+".":e)+c,value:n[c],valueSpec:p,style:o,styleSpec:a,object:n,objectKey:c},n))}for(var d in r)i[d]||r[d].required&&void 0===r[d].default&&void 0===n[d]&&s.push(new It(e,n,'missing required property "'+d+'"'));return s}function tr(t){var e=t.value,n=t.valueSpec,r=t.style,i=t.styleSpec,o=t.key,a=t.arrayElementValidator||Sr;if("array"!==Bn(e))return[new It(o,e,"array expected, "+Bn(e)+" found")];if(n.length&&e.length!==n.length)return[new It(o,e,"array length "+n.length+" expected, length "+e.length+" found")];if(n["min-length"]&&e.length<n["min-length"])return[new It(o,e,"array length at least "+n["min-length"]+" expected, length "+e.length+" found")];var s={type:n.value,values:n.values};i.$version<7&&(s.function=n.function),"object"===Bn(n.value)&&(s=n.value);for(var l=[],c=0;c<e.length;c++)l=l.concat(a({array:e,arrayIndex:c,value:e[c],valueSpec:s,style:r,styleSpec:i,key:o+"["+c+"]"}));return l}function er(t){var e=t.key,n=t.value,r=t.valueSpec,i=Bn(n);return"number"===i&&n!=n&&(i="NaN"),"number"!==i?[new It(e,n,"number expected, "+i+" found")]:"minimum"in r&&n<r.minimum?[new It(e,n,n+" is less than the minimum value "+r.minimum)]:"maximum"in r&&n>r.maximum?[new It(e,n,n+" is greater than the maximum value "+r.maximum)]:[]}function nr(t){var e,n,r,i=t.valueSpec,o=zt(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,l=!s,c="array"===Bn(t.value.stops)&&"array"===Bn(t.value.stops[0])&&"object"===Bn(t.value.stops[0][0]),u=Kn({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new It(t.key,t.value,'identity function may not have a "stops" property')];var e=[],n=t.value;return e=e.concat(tr({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:p})),"array"===Bn(n)&&0===n.length&&e.push(new It(t.key,n,"array must have at least one stop")),e},default:function(t){return Sr({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&u.push(new It(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||u.push(new It(t.key,t.value,'missing required property "stops"')),"exponential"===o&&t.valueSpec.expression&&!Fn(t.valueSpec)&&u.push(new It(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Dn(t.valueSpec)?u.push(new It(t.key,t.value,"property functions not supported")):s&&!On(t.valueSpec)&&u.push(new It(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!c||void 0!==t.value.property||u.push(new It(t.key,t.value,'"property" property is required')),u;function p(t){var e=[],o=t.value,s=t.key;if("array"!==Bn(o))return[new It(s,o,"array expected, "+Bn(o)+" found")];if(2!==o.length)return[new It(s,o,"array length 2 expected, length "+o.length+" found")];if(c){if("object"!==Bn(o[0]))return[new It(s,o,"object expected, "+Bn(o[0])+" found")];if(void 0===o[0].zoom)return[new It(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new It(s,o,"object stop key must have value")];if(r&&r>zt(o[0].zoom))return[new It(s,o[0].zoom,"stop zoom values must appear in ascending order")];zt(o[0].zoom)!==r&&(r=zt(o[0].zoom),n=void 0,a={}),e=e.concat(Kn({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:er,value:h}}))}else e=e.concat(h({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return Zn(Dt(o[1]))?e.concat([new It(s+"[1]",o[1],"expressions are not allowed in function stops.")]):e.concat(Sr({key:s+"[1]",value:o[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function h(t,r){var s=Bn(t.value),l=zt(t.value),c=null!==t.value?t.value:r;if(e){if(s!==e)return[new It(t.key,c,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new It(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var u="number expected, "+s+" found";return Dn(i)&&void 0===o&&(u+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new It(t.key,c,u)]}return"categorical"!==o||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==o&&"number"===s&&void 0!==n&&l<n?[new It(t.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===o&&l in a?[new It(t.key,c,"stop domain values must be unique")]:(a[l]=!0,[])):[new It(t.key,c,"integer expected, found "+l)]}}function rr(t){var e=("property"===t.expressionContext?Yn:Xn)(Dt(t.value),t.valueSpec);if("error"===e.result)return e.value.map((function(e){return new It(""+t.key+e.key,t.value,e.message)}));var n=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!n.outputDefined())return[new It(t.key,t.value,'Invalid data expression for "'+t.propertyKey+'". Output values must be contained as literals within the expression.')];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Ne(n))return[new It(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Ne(n))return[new It(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Ue(n,["zoom","feature-state"]))return[new It(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Be(n))return[new It(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ir(t){var e=t.key,n=t.value,r=t.valueSpec,i=[];return Array.isArray(r.values)?-1===r.values.indexOf(zt(n))&&i.push(new It(e,n,"expected one of ["+r.values.join(", ")+"], "+JSON.stringify(n)+" found")):-1===Object.keys(r.values).indexOf(zt(n))&&i.push(new It(e,n,"expected one of ["+Object.keys(r.values).join(", ")+"], "+JSON.stringify(n)+" found")),i}function or(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,n=t.slice(1);e<n.length;e+=1){var r=n[e];if(!or(r)&&"boolean"!=typeof r)return!1}return!0;default:return!0}}Qn.deserialize=function(t){return new Qn(t._parameters,t._specification)},Qn.serialize=function(t){return{_parameters:t._parameters,_specification:t._specification}};var ar={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function sr(t){if(null==t)return{filter:function(){return!0},needGeometry:!1};or(t)||(t=cr(t));var e=Xn(t,ar);if("error"===e.result)throw new Error(e.value.map((function(t){return t.key+": "+t.message})).join(", "));return{filter:function(t,n,r){return e.value.evaluate(t,n,{},r)},needGeometry:function t(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(var n=1;n<e.length;n++)if(t(e[n]))return!0;return!1}(t)}}function lr(t,e){return t<e?-1:t>e?1:0}function cr(t){if(!t)return!0;var e,n=t[0];return t.length<=1?"any"!==n:"=="===n?ur(t[1],t[2],"=="):"!="===n?dr(ur(t[1],t[2],"==")):"<"===n||">"===n||"<="===n||">="===n?ur(t[1],t[2],n):"any"===n?(e=t.slice(1),["any"].concat(e.map(cr))):"all"===n?["all"].concat(t.slice(1).map(cr)):"none"===n?["all"].concat(t.slice(1).map(cr).map(dr)):"in"===n?pr(t[1],t.slice(2)):"!in"===n?dr(pr(t[1],t.slice(2))):"has"===n?hr(t[1]):"!has"===n?dr(hr(t[1])):"within"!==n||t}function ur(t,e,n){switch(t){case"$type":return["filter-type-"+n,e];case"$id":return["filter-id-"+n,e];default:return["filter-"+n,t,e]}}function pr(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(lr)]]:["filter-in-small",t,["literal",e]]}}function hr(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function dr(t){return["!",t]}function fr(t){return or(Dt(t.value))?rr(kt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var n=e.value,r=e.key;if("array"!==Bn(n))return[new It(r,n,"array expected, "+Bn(n)+" found")];var i,o=e.styleSpec,a=[];if(n.length<1)return[new It(r,n,"filter array must have at least 1 element")];switch(a=a.concat(ir({key:r+"[0]",value:n[0],valueSpec:o.filter_operator,style:e.style,styleSpec:e.styleSpec})),zt(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===zt(n[1])&&a.push(new It(r,n,'"$type" cannot be use with operator "'+n[0]+'"'));case"==":case"!=":3!==n.length&&a.push(new It(r,n,'filter array for operator "'+n[0]+'" must have 3 elements'));case"in":case"!in":n.length>=2&&"string"!==(i=Bn(n[1]))&&a.push(new It(r+"[1]",n[1],"string expected, "+i+" found"));for(var s=2;s<n.length;s++)i=Bn(n[s]),"$type"===zt(n[1])?a=a.concat(ir({key:r+"["+s+"]",value:n[s],valueSpec:o.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&a.push(new It(r+"["+s+"]",n[s],"string, number, or boolean expected, "+i+" found"));break;case"any":case"all":case"none":for(var l=1;l<n.length;l++)a=a.concat(t({key:r+"["+l+"]",value:n[l],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=Bn(n[1]),2!==n.length?a.push(new It(r,n,'filter array for "'+n[0]+'" operator must have 2 elements')):"string"!==i&&a.push(new It(r+"[1]",n[1],"string expected, "+i+" found"));break;case"within":i=Bn(n[1]),2!==n.length?a.push(new It(r,n,'filter array for "'+n[0]+'" operator must have 2 elements')):"object"!==i&&a.push(new It(r+"[1]",n[1],"object expected, "+i+" found"))}return a}(t)}function mr(t,e){var n=t.key,r=t.style,i=t.styleSpec,o=t.value,a=t.objectKey,s=i[e+"_"+t.layerType];if(!s)return[];var l=a.match(/^(.*)-transition$/);if("paint"===e&&l&&s[l[1]]&&s[l[1]].transition)return Sr({key:n,value:o,valueSpec:i.transition,style:r,styleSpec:i});var c,u=t.valueSpec||s[a];if(!u)return[new It(n,o,'unknown property "'+a+'"')];if("string"===Bn(o)&&Dn(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new It(n,o,'"'+a+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(c[1])+" }`.")];var p=[];return"symbol"===t.layerType&&("text-field"===a&&r&&!r.glyphs&&p.push(new It(n,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Nn(Dt(o))&&"identity"===zt(o.type)&&p.push(new It(n,o,'"text-font" does not support identity functions'))),p.concat(Sr({key:t.key,value:o,valueSpec:u,style:r,styleSpec:i,expressionContext:"property",propertyType:e,propertyKey:a}))}function gr(t){return mr(t,"paint")}function yr(t){return mr(t,"layout")}function vr(t){var e=[],n=t.value,r=t.key,i=t.style,o=t.styleSpec;n.type||n.ref||e.push(new It(r,n,'either "type" or "ref" is required'));var a,s=zt(n.type),l=zt(n.ref);if(n.id)for(var c=zt(n.id),u=0;u<t.arrayIndex;u++){var p=i.layers[u];zt(p.id)===c&&e.push(new It(r,n.id,'duplicate layer id "'+n.id+'", previously used at line '+p.id.__line__))}if("ref"in n)["type","source","source-layer","filter","layout"].forEach((function(t){t in n&&e.push(new It(r,n[t],'"'+t+'" is prohibited for ref layers'))})),i.layers.forEach((function(t){zt(t.id)===l&&(a=t)})),a?a.ref?e.push(new It(r,n.ref,"ref cannot reference another ref layer")):s=zt(a.type):e.push(new It(r,n.ref,'ref layer "'+l+'" not found'));else if("background"!==s)if(n.source){var h=i.sources&&i.sources[n.source],d=h&&zt(h.type);h?"vector"===d&&"raster"===s?e.push(new It(r,n.source,'layer "'+n.id+'" requires a raster source')):"raster"===d&&"raster"!==s?e.push(new It(r,n.source,'layer "'+n.id+'" requires a vector source')):"vector"!==d||n["source-layer"]?"raster-dem"===d&&"hillshade"!==s?e.push(new It(r,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!n.paint||!n.paint["line-gradient"]||"geojson"===d&&h.lineMetrics||e.push(new It(r,n,'layer "'+n.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):e.push(new It(r,n,'layer "'+n.id+'" must specify a "source-layer"')):e.push(new It(r,n.source,'source "'+n.source+'" not found'))}else e.push(new It(r,n,'missing required property "source"'));return e=e.concat(Kn({key:r,value:n,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return Sr({key:r+".type",value:n.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:n,objectKey:"type"})},filter:fr,layout:function(t){return Kn({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return yr(kt({layerType:s},t))}}})},paint:function(t){return Kn({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return gr(kt({layerType:s},t))}}})}}}))}function _r(t){var e=t.value,n=t.key,r=Bn(e);return"string"!==r?[new It(n,e,"string expected, "+r+" found")]:[]}var xr={promoteId:function(t){var e=t.key,n=t.value;if("string"===Bn(n))return _r({key:e,value:n});var r=[];for(var i in n)r.push.apply(r,_r({key:e+"."+i,value:n[i]}));return r}};function br(t){var e=t.value,n=t.key,r=t.styleSpec,i=t.style;if(!e.type)return[new It(n,e,'"type" is required')];var o,a=zt(e.type);switch(a){case"vector":case"raster":case"raster-dem":return Kn({key:n,value:e,valueSpec:r["source_"+a.replace("-","_")],style:t.style,styleSpec:r,objectElementValidators:xr});case"geojson":if(o=Kn({key:n,value:e,valueSpec:r.source_geojson,style:i,styleSpec:r,objectElementValidators:xr}),e.cluster)for(var s in e.clusterProperties){var l=e.clusterProperties[s],c=l[0],u="string"==typeof c?[c,["accumulated"],["get",s]]:c;o.push.apply(o,rr({key:n+"."+s+".map",value:l[1],expressionContext:"cluster-map"})),o.push.apply(o,rr({key:n+"."+s+".reduce",value:u,expressionContext:"cluster-reduce"}))}return o;case"video":return Kn({key:n,value:e,valueSpec:r.source_video,style:i,styleSpec:r});case"image":return Kn({key:n,value:e,valueSpec:r.source_image,style:i,styleSpec:r});case"canvas":return[new It(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ir({key:n+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:r})}}function wr(t){var e=t.value,n=t.styleSpec,r=n.light,i=t.style,o=[],a=Bn(e);if(void 0===e)return o;if("object"!==a)return o.concat([new It("light",e,"object expected, "+a+" found")]);for(var s in e){var l=s.match(/^(.*)-transition$/);o=o.concat(l&&r[l[1]]&&r[l[1]].transition?Sr({key:s,value:e[s],valueSpec:n.transition,style:i,styleSpec:n}):r[s]?Sr({key:s,value:e[s],valueSpec:r[s],style:i,styleSpec:n}):[new It(s,e[s],'unknown property "'+s+'"')])}return o}var Mr={"*":function(){return[]},array:tr,boolean:function(t){var e=t.value,n=t.key,r=Bn(e);return"boolean"!==r?[new It(n,e,"boolean expected, "+r+" found")]:[]},number:er,color:function(t){var e=t.key,n=t.value,r=Bn(n);return"string"!==r?[new It(e,n,"color expected, "+r+" found")]:null===te(n)?[new It(e,n,'color expected, "'+n+'" found')]:[]},constants:Rt,enum:ir,filter:fr,function:nr,layer:vr,object:Kn,source:br,light:wr,string:_r,formatted:function(t){return 0===_r(t).length?[]:rr(t)},resolvedImage:function(t){return 0===_r(t).length?[]:rr(t)}};function Sr(t){var e=t.value,n=t.valueSpec,r=t.styleSpec;return n.expression&&Nn(zt(e))?nr(t):n.expression&&Zn(Dt(e))?rr(t):n.type&&Mr[n.type]?Mr[n.type](t):Kn(kt({},t,{valueSpec:n.type?r[n.type]:n}))}function Tr(t){var e=t.value,n=t.key,r=_r(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new It(n,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new It(n,e,'"glyphs" url must include a "{range}" token'))),r}function Er(t,e){void 0===e&&(e=Pt);var n=[];return n=n.concat(Sr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:Tr,"*":function(){return[]}}})),t.constants&&(n=n.concat(Rt({key:"constants",value:t.constants,style:t,styleSpec:e}))),Ar(n)}function Ar(t){return[].concat(t).sort((function(t,e){return t.line-e.line}))}function Cr(t){return function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return Ar(t.apply(this,e))}}Er.source=Cr(br),Er.light=Cr(wr),Er.layer=Cr(vr),Er.filter=Cr(fr),Er.paintProperty=Cr(gr),Er.layoutProperty=Cr(yr);var Lr=Er,Pr=Lr.light,Ir=Lr.paintProperty,Rr=Lr.layoutProperty;function kr(t,e){var n=!1;if(e&&e.length)for(var r=0,i=e;r<i.length;r+=1)t.fire(new Ct(new Error(i[r].message))),n=!0;return n}var zr=Dr;function Dr(t,e,n){var r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(n=i[2]);for(var o=0;o<this.d*this.d;o++){var a=i[3+o],s=i[3+o+1];r.push(a===s?null:i.subarray(a,s))}var l=i[3+r.length+1];this.keys=i.subarray(i[3+r.length],l),this.bboxes=i.subarray(l),this.insert=this._insertReadonly}else{this.d=e+2*n;for(var c=0;c<this.d*this.d;c++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=n,this.scale=e/t,this.uid=0;var u=n/e*t;this.min=-u,this.max=t+u}Dr.prototype.insert=function(t,e,n,r,i){this._forEachCell(e,n,r,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)},Dr.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},Dr.prototype._insertCell=function(t,e,n,r,i,o){this.cells[i].push(o)},Dr.prototype.query=function(t,e,n,r,i){var o=this.min,a=this.max;if(t<=o&&e<=o&&a<=n&&a<=r&&!i)return Array.prototype.slice.call(this.keys);var s=[];return this._forEachCell(t,e,n,r,this._queryCell,s,{},i),s},Dr.prototype._queryCell=function(t,e,n,r,i,o,a,s){var l=this.cells[i];if(null!==l)for(var c=this.keys,u=this.bboxes,p=0;p<l.length;p++){var h=l[p];if(void 0===a[h]){var d=4*h;(s?s(u[d+0],u[d+1],u[d+2],u[d+3]):t<=u[d+2]&&e<=u[d+3]&&n>=u[d+0]&&r>=u[d+1])?(a[h]=!0,o.push(c[h])):a[h]=!1}}},Dr.prototype._forEachCell=function(t,e,n,r,i,o,a,s){for(var l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),u=this._convertToCellCoord(n),p=this._convertToCellCoord(r),h=l;h<=u;h++)for(var d=c;d<=p;d++){var f=this.d*d+h;if((!s||s(this._convertFromCellCoord(h),this._convertFromCellCoord(d),this._convertFromCellCoord(h+1),this._convertFromCellCoord(d+1)))&&i.call(this,t,e,n,r,f,o,a,s))return}},Dr.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Dr.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Dr.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,n=0,r=0;r<this.cells.length;r++)n+=this.cells[r].length;var i=new Int32Array(e+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;for(var o=e,a=0;a<t.length;a++){var s=t[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+t.length]=o,i.set(this.keys,o),i[3+t.length+1]=o+=this.keys.length,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer};var Or=a.ImageData,Fr=a.ImageBitmap,Br={};function Nr(t,e,n){void 0===n&&(n={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Br[t]={klass:e,omit:n.omit||[],shallow:n.shallow||[]}}for(var Ur in Nr("Object",Object),zr.serialize=function(t,e){var n=t.toArrayBuffer();return e&&e.push(n),{buffer:n}},zr.deserialize=function(t){return new zr(t.buffer)},Nr("Grid",zr),Nr("Color",ee),Nr("Error",Error),Nr("ResolvedImage",oe),Nr("StylePropertyFunction",Qn),Nr("StyleExpression",qn,{omit:["_evaluator"]}),Nr("ZoomDependentExpression",Jn),Nr("ZoomConstantExpression",$n),Nr("CompoundExpression",xe,{omit:["_evaluate"]}),Cn)Cn[Ur]._classRegistryKey||Nr("Expression_"+Ur,Cn[Ur]);function jr(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Vr(t){return Fr&&t instanceof Fr}function Gr(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(jr(t)||Vr(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){var n=t;return e&&e.push(n.buffer),n}if(t instanceof Or)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){for(var r=[],i=0,o=t;i<o.length;i+=1)r.push(Gr(o[i],e));return r}if("object"==typeof t){var a=t.constructor,s=a._classRegistryKey;if(!s)throw new Error("can't serialize object of unregistered class");var l=a.serialize?a.serialize(t,e):{};if(!a.serialize){for(var c in t)if(t.hasOwnProperty(c)&&!(Br[s].omit.indexOf(c)>=0)){var u=t[c];l[c]=Br[s].shallow.indexOf(c)>=0?u:Gr(u,e)}t instanceof Error&&(l.message=t.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof t)}function Hr(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||jr(t)||Vr(t)||ArrayBuffer.isView(t)||t instanceof Or)return t;if(Array.isArray(t))return t.map(Hr);if("object"==typeof t){var e=t.$name||"Object",n=Br[e].klass;if(!n)throw new Error("can't deserialize unregistered class "+e);if(n.deserialize)return n.deserialize(t);for(var r=Object.create(n.prototype),i=0,o=Object.keys(t);i<o.length;i+=1){var a=o[i];if("$name"!==a){var s=t[a];r[a]=Br[e].shallow.indexOf(a)>=0?s:Hr(s)}}return r}throw new Error("can't deserialize object of type "+typeof t)}var Wr=function(){this.first=!0};Wr.prototype.update=function(t,e){var n=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=n,!0))};var qr={"Latin-1 Supplement":function(t){return t>=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function Zr(t){for(var e=0,n=t;e<n.length;e+=1)if(Xr(n[e].charCodeAt(0)))return!0;return!1}function Xr(t){return!(746!==t&&747!==t&&(t<4352||!(qr["Bopomofo Extended"](t)||qr.Bopomofo(t)||qr["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||qr["CJK Compatibility Ideographs"](t)||qr["CJK Compatibility"](t)||qr["CJK Radicals Supplement"](t)||qr["CJK Strokes"](t)||!(!qr["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||qr["CJK Unified Ideographs Extension A"](t)||qr["CJK Unified Ideographs"](t)||qr["Enclosed CJK Letters and Months"](t)||qr["Hangul Compatibility Jamo"](t)||qr["Hangul Jamo Extended-A"](t)||qr["Hangul Jamo Extended-B"](t)||qr["Hangul Jamo"](t)||qr["Hangul Syllables"](t)||qr.Hiragana(t)||qr["Ideographic Description Characters"](t)||qr.Kanbun(t)||qr["Kangxi Radicals"](t)||qr["Katakana Phonetic Extensions"](t)||qr.Katakana(t)&&12540!==t||!(!qr["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!qr["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||qr["Unified Canadian Aboriginal Syllabics"](t)||qr["Unified Canadian Aboriginal Syllabics Extended"](t)||qr["Vertical Forms"](t)||qr["Yijing Hexagram Symbols"](t)||qr["Yi Syllables"](t)||qr["Yi Radicals"](t))))}function $r(t){return!(Xr(t)||function(t){return!!(qr["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||qr["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||qr["Letterlike Symbols"](t)||qr["Number Forms"](t)||qr["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||qr["Control Pictures"](t)&&9251!==t||qr["Optical Character Recognition"](t)||qr["Enclosed Alphanumerics"](t)||qr["Geometric Shapes"](t)||qr["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||qr["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||qr["CJK Symbols and Punctuation"](t)||qr.Katakana(t)||qr["Private Use Area"](t)||qr["CJK Compatibility Forms"](t)||qr["Small Form Variants"](t)||qr["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Jr(t){return t>=1424&&t<=2303||qr["Arabic Presentation Forms-A"](t)||qr["Arabic Presentation Forms-B"](t)}function Yr(t,e){return!(!e&&Jr(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||qr.Khmer(t))}function Qr(t){for(var e=0,n=t;e<n.length;e+=1)if(Jr(n[e].charCodeAt(0)))return!0;return!1}var Kr=null,ti="unavailable",ei=null,ni=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(ti="error"),Kr&&Kr(t)};function ri(){ii.fire(new At("pluginStateChange",{pluginStatus:ti,pluginURL:ei}))}var ii=new Lt,oi=function(){return ti},ai=function(){if("deferred"!==ti||!ei)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ti="loading",ri(),ei&&bt({url:ei},(function(t){t?ni(t):(ti="loaded",ri())}))},si={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return"loaded"===ti||null!=si.applyArabicShaping},isLoading:function(){return"loading"===ti},setState:function(t){ti=t.pluginStatus,ei=t.pluginURL},isParsed:function(){return null!=si.applyArabicShaping&&null!=si.processBidirectionalText&&null!=si.processStyledBidirectionalText},getPluginURL:function(){return ei}},li=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Wr,this.transition={})};li.prototype.isSupportedScript=function(t){return function(t,e){for(var n=0,r=t;n<r.length;n+=1)if(!Yr(r[n].charCodeAt(0),e))return!1;return!0}(t,si.isLoaded())},li.prototype.crossFadingFactor=function(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},li.prototype.getCrossfadeParameters=function(){var t=this.zoom,e=t-Math.floor(t),n=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*e}};var ci=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Nn(t))return new Qn(t,e);if(Zn(t)){var n=Yn(t,e);if("error"===n.result)throw new Error(n.value.map((function(t){return t.key+": "+t.message})).join(", "));return n.value}var r=t;return"string"==typeof t&&"color"===e.type&&(r=ee.parse(t)),{kind:"constant",evaluate:function(){return r}}}(void 0===e?t.specification.default:e,t.specification)};ci.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},ci.prototype.possiblyEvaluate=function(t,e,n){return this.property.possiblyEvaluate(this,t,e,n)};var ui=function(t){this.property=t,this.value=new ci(t,void 0)};ui.prototype.transitioned=function(t,e){return new hi(this.property,this.value,e,h({},t.transition,this.transition),t.now)},ui.prototype.untransitioned=function(){return new hi(this.property,this.value,null,{},0)};var pi=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};pi.prototype.getValue=function(t){return b(this._values[t].value.value)},pi.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new ui(this._values[t].property)),this._values[t].value=new ci(this._values[t].property,null===e?void 0:b(e))},pi.prototype.getTransition=function(t){return b(this._values[t].transition)},pi.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new ui(this._values[t].property)),this._values[t].transition=b(e)||void 0},pi.prototype.serialize=function(){for(var t={},e=0,n=Object.keys(this._values);e<n.length;e+=1){var r=n[e],i=this.getValue(r);void 0!==i&&(t[r]=i);var o=this.getTransition(r);void 0!==o&&(t[r+"-transition"]=o)}return t},pi.prototype.transitioned=function(t,e){for(var n=new di(this._properties),r=0,i=Object.keys(this._values);r<i.length;r+=1){var o=i[r];n._values[o]=this._values[o].transitioned(t,e._values[o])}return n},pi.prototype.untransitioned=function(){for(var t=new di(this._properties),e=0,n=Object.keys(this._values);e<n.length;e+=1){var r=n[e];t._values[r]=this._values[r].untransitioned()}return t};var hi=function(t,e,n,r,i){this.property=t,this.value=e,this.begin=i+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=n)};hi.prototype.possiblyEvaluate=function(t,e,n){var r=t.now||0,i=this.value.possiblyEvaluate(t,e,n),o=this.prior;if(o){if(r>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(r<this.begin)return o.possiblyEvaluate(t,e,n);var a=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,n),i,function(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}(a))}return i};var di=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};di.prototype.possiblyEvaluate=function(t,e,n){for(var r=new gi(this._properties),i=0,o=Object.keys(this._values);i<o.length;i+=1){var a=o[i];r._values[a]=this._values[a].possiblyEvaluate(t,e,n)}return r},di.prototype.hasTransition=function(){for(var t=0,e=Object.keys(this._values);t<e.length;t+=1)if(this._values[e[t]].prior)return!0;return!1};var fi=function(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)};fi.prototype.getValue=function(t){return b(this._values[t].value)},fi.prototype.setValue=function(t,e){this._values[t]=new ci(this._values[t].property,null===e?void 0:b(e))},fi.prototype.serialize=function(){for(var t={},e=0,n=Object.keys(this._values);e<n.length;e+=1){var r=n[e],i=this.getValue(r);void 0!==i&&(t[r]=i)}return t},fi.prototype.possiblyEvaluate=function(t,e,n){for(var r=new gi(this._properties),i=0,o=Object.keys(this._values);i<o.length;i+=1){var a=o[i];r._values[a]=this._values[a].possiblyEvaluate(t,e,n)}return r};var mi=function(t,e,n){this.property=t,this.value=e,this.parameters=n};mi.prototype.isConstant=function(){return"constant"===this.value.kind},mi.prototype.constantOr=function(t){return"constant"===this.value.kind?this.value.value:t},mi.prototype.evaluate=function(t,e,n,r){return this.property.evaluate(this.value,this.parameters,t,e,n,r)};var gi=function(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)};gi.prototype.get=function(t){return this._values[t]};var yi=function(t){this.specification=t};yi.prototype.possiblyEvaluate=function(t,e){return t.expression.evaluate(e)},yi.prototype.interpolate=function(t,e,n){var r=qe[this.specification.type];return r?r(t,e,n):t};var vi=function(t,e){this.specification=t,this.overrides=e};vi.prototype.possiblyEvaluate=function(t,e,n,r){return new mi(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},n,r)}:t.expression,e)},vi.prototype.interpolate=function(t,e,n){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new mi(this,{kind:"constant",value:void 0},t.parameters);var r=qe[this.specification.type];return r?new mi(this,{kind:"constant",value:r(t.value.value,e.value.value,n)},t.parameters):t},vi.prototype.evaluate=function(t,e,n,r,i,o){return"constant"===t.kind?t.value:t.evaluate(e,n,r,i,o)};var _i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(t,e,n,r){if(void 0===t.value)return new mi(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},n,r),o="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,a=this._calculate(o,o,o,e);return new mi(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){var s=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new mi(this,{kind:"constant",value:s},e)}return new mi(this,t.expression,e)},e.prototype.evaluate=function(t,e,n,r,i,o){if("source"===t.kind){var a=t.evaluate(e,n,r,i,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},n,r),t.evaluate({zoom:Math.floor(e.zoom)},n,r),t.evaluate({zoom:Math.floor(e.zoom)+1},n,r),e):t.value},e.prototype._calculate=function(t,e,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:n,to:e}},e.prototype.interpolate=function(t){return t},e}(vi),xi=function(t){this.specification=t};xi.prototype.possiblyEvaluate=function(t,e,n,r){if(void 0!==t.value){if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},n,r);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new li(Math.floor(e.zoom-1),e)),t.expression.evaluate(new li(Math.floor(e.zoom),e)),t.expression.evaluate(new li(Math.floor(e.zoom+1),e)),e)}},xi.prototype._calculate=function(t,e,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:n,to:e}},xi.prototype.interpolate=function(t){return t};var bi=function(t){this.specification=t};bi.prototype.possiblyEvaluate=function(t,e,n,r){return!!t.expression.evaluate(e,null,{},n,r)},bi.prototype.interpolate=function(){return!1};var wi=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var n=t[e];n.specification.overridable&&this.overridableProperties.push(e);var r=this.defaultPropertyValues[e]=new ci(n,void 0),i=this.defaultTransitionablePropertyValues[e]=new ui(n);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}};Nr("DataDrivenProperty",vi),Nr("DataConstantProperty",yi),Nr("CrossFadedDataDrivenProperty",_i),Nr("CrossFadedProperty",xi),Nr("ColorRampProperty",bi);var Mi=function(t){function e(e,n){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),n.layout&&(this._unevaluatedLayout=new fi(n.layout)),n.paint)){for(var r in this._transitionablePaint=new pi(n.paint),e.paint)this.setPaintProperty(r,e.paint[r],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new gi(n.paint)}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,n){void 0===n&&(n={}),null!=e&&this._validate(Rr,"layers."+this.id+".layout."+t,t,e,n)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)},e.prototype.getPaintProperty=function(t){return v(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,n){if(void 0===n&&(n={}),null!=e&&this._validate(Ir,"layers."+this.id+".paint."+t,t,e,n))return!1;if(v(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var r=this._transitionablePaint._values[t],i="cross-faded-data-driven"===r.property.specification["property-type"],o=r.value.isDataDriven(),a=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||o||i||this._handleOverridablePaintPropertyUpdate(t,a,s)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,n){return!1},e.prototype.isHidden=function(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),x(t,(function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,n,r,i){return void 0===i&&(i={}),(!i||!1!==i.validate)&&kr(this,t.call(Lr,{key:e,layerType:this.type,objectKey:n,value:r,styleSpec:Pt,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return!1},e.prototype.isTileClipped=function(){return!1},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof mi&&Dn(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(Lt),Si={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Ti=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},Ei=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Ai(t,e){void 0===e&&(e=1);var n=0,r=0;return{members:t.map((function(t){var i=Si[t.type].BYTES_PER_ELEMENT,o=n=Ci(n,Math.max(e,i)),a=t.components||1;return r=Math.max(r,i),n+=i*a,{name:t.name,type:t.type,components:a,offset:o}})),size:Ci(n,Math.max(r,e)),alignment:e}}function Ci(t,e){return Math.ceil(t/e)*e}Ei.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Ei.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},Ei.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Ei.prototype.clear=function(){this.length=0},Ei.prototype.resize=function(t){this.reserve(t),this.length=t},Ei.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},Ei.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Li=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var n=this.length;return this.resize(n+1),this.emplace(n,t,e)},e.prototype.emplace=function(t,e,n){var r=2*t;return this.int16[r+0]=e,this.int16[r+1]=n,t},e}(Ei);Li.prototype.bytesPerElement=4,Nr("StructArrayLayout2i4",Li);var Pi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,n,r)},e.prototype.emplace=function(t,e,n,r,i){var o=4*t;return this.int16[o+0]=e,this.int16[o+1]=n,this.int16[o+2]=r,this.int16[o+3]=i,t},e}(Ei);Pi.prototype.bytesPerElement=8,Nr("StructArrayLayout4i8",Pi);var Ii=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,n,r,i,o)},e.prototype.emplace=function(t,e,n,r,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Ei);Ii.prototype.bytesPerElement=12,Nr("StructArrayLayout2i4i12",Ii);var Ri=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,n,r,i,o)},e.prototype.emplace=function(t,e,n,r,i,o,a){var s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=n,this.uint8[l+4]=r,this.uint8[l+5]=i,this.uint8[l+6]=o,this.uint8[l+7]=a,t},e}(Ei);Ri.prototype.bytesPerElement=8,Nr("StructArrayLayout2i4ub8",Ri);var ki=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var n=this.length;return this.resize(n+1),this.emplace(n,t,e)},e.prototype.emplace=function(t,e,n){var r=2*t;return this.float32[r+0]=e,this.float32[r+1]=n,t},e}(Ei);ki.prototype.bytesPerElement=8,Nr("StructArrayLayout2f8",ki);var zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r,i,o,a,s,l,c){var u=this.length;return this.resize(u+1),this.emplace(u,t,e,n,r,i,o,a,s,l,c)},e.prototype.emplace=function(t,e,n,r,i,o,a,s,l,c,u){var p=10*t;return this.uint16[p+0]=e,this.uint16[p+1]=n,this.uint16[p+2]=r,this.uint16[p+3]=i,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=l,this.uint16[p+8]=c,this.uint16[p+9]=u,t},e}(Ei);zi.prototype.bytesPerElement=20,Nr("StructArrayLayout10ui20",zi);var Di=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r,i,o,a,s,l,c,u,p){var h=this.length;return this.resize(h+1),this.emplace(h,t,e,n,r,i,o,a,s,l,c,u,p)},e.prototype.emplace=function(t,e,n,r,i,o,a,s,l,c,u,p,h){var d=12*t;return this.int16[d+0]=e,this.int16[d+1]=n,this.int16[d+2]=r,this.int16[d+3]=i,this.uint16[d+4]=o,this.uint16[d+5]=a,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=u,this.int16[d+10]=p,this.int16[d+11]=h,t},e}(Ei);Di.prototype.bytesPerElement=24,Nr("StructArrayLayout4i4ui4i24",Di);var Oi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)},e.prototype.emplace=function(t,e,n,r){var i=3*t;return this.float32[i+0]=e,this.float32[i+1]=n,this.float32[i+2]=r,t},e}(Ei);Oi.prototype.bytesPerElement=12,Nr("StructArrayLayout3f12",Oi);var Fi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint32[1*t+0]=e,t},e}(Ei);Fi.prototype.bytesPerElement=4,Nr("StructArrayLayout1ul4",Fi);var Bi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r,i,o,a,s,l){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,n,r,i,o,a,s,l)},e.prototype.emplace=function(t,e,n,r,i,o,a,s,l,c){var u=10*t,p=5*t;return this.int16[u+0]=e,this.int16[u+1]=n,this.int16[u+2]=r,this.int16[u+3]=i,this.int16[u+4]=o,this.int16[u+5]=a,this.uint32[p+3]=s,this.uint16[u+8]=l,this.uint16[u+9]=c,t},e}(Ei);Bi.prototype.bytesPerElement=20,Nr("StructArrayLayout6i1ul2ui20",Bi);var Ni=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,n,r,i,o)},e.prototype.emplace=function(t,e,n,r,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Ei);Ni.prototype.bytesPerElement=12,Nr("StructArrayLayout2i2i2i12",Ni);var Ui=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r,i){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,n,r,i)},e.prototype.emplace=function(t,e,n,r,i,o){var a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=n,this.float32[a+2]=r,this.int16[s+6]=i,this.int16[s+7]=o,t},e}(Ei);Ui.prototype.bytesPerElement=16,Nr("StructArrayLayout2f1f2i16",Ui);var ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,n,r)},e.prototype.emplace=function(t,e,n,r,i){var o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=n,this.float32[a+1]=r,this.float32[a+2]=i,t},e}(Ei);ji.prototype.bytesPerElement=12,Nr("StructArrayLayout2ub2f12",ji);var Vi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)},e.prototype.emplace=function(t,e,n,r){var i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=n,this.uint16[i+2]=r,t},e}(Ei);Vi.prototype.bytesPerElement=6,Nr("StructArrayLayout3ui6",Vi);var Gi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r,i,o,a,s,l,c,u,p,h,d,f,m,g){var y=this.length;return this.resize(y+1),this.emplace(y,t,e,n,r,i,o,a,s,l,c,u,p,h,d,f,m,g)},e.prototype.emplace=function(t,e,n,r,i,o,a,s,l,c,u,p,h,d,f,m,g,y){var v=24*t,_=12*t,x=48*t;return this.int16[v+0]=e,this.int16[v+1]=n,this.uint16[v+2]=r,this.uint16[v+3]=i,this.uint32[_+2]=o,this.uint32[_+3]=a,this.uint32[_+4]=s,this.uint16[v+10]=l,this.uint16[v+11]=c,this.uint16[v+12]=u,this.float32[_+7]=p,this.float32[_+8]=h,this.uint8[x+36]=d,this.uint8[x+37]=f,this.uint8[x+38]=m,this.uint32[_+10]=g,this.int16[v+22]=y,t},e}(Ei);Gi.prototype.bytesPerElement=48,Nr("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Gi);var Hi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r,i,o,a,s,l,c,u,p,h,d,f,m,g,y,v,_,x,b,w,M,S,T,E,A){var C=this.length;return this.resize(C+1),this.emplace(C,t,e,n,r,i,o,a,s,l,c,u,p,h,d,f,m,g,y,v,_,x,b,w,M,S,T,E,A)},e.prototype.emplace=function(t,e,n,r,i,o,a,s,l,c,u,p,h,d,f,m,g,y,v,_,x,b,w,M,S,T,E,A,C){var L=34*t,P=17*t;return this.int16[L+0]=e,this.int16[L+1]=n,this.int16[L+2]=r,this.int16[L+3]=i,this.int16[L+4]=o,this.int16[L+5]=a,this.int16[L+6]=s,this.int16[L+7]=l,this.uint16[L+8]=c,this.uint16[L+9]=u,this.uint16[L+10]=p,this.uint16[L+11]=h,this.uint16[L+12]=d,this.uint16[L+13]=f,this.uint16[L+14]=m,this.uint16[L+15]=g,this.uint16[L+16]=y,this.uint16[L+17]=v,this.uint16[L+18]=_,this.uint16[L+19]=x,this.uint16[L+20]=b,this.uint16[L+21]=w,this.uint16[L+22]=M,this.uint32[P+12]=S,this.float32[P+13]=T,this.float32[P+14]=E,this.float32[P+15]=A,this.float32[P+16]=C,t},e}(Ei);Hi.prototype.bytesPerElement=68,Nr("StructArrayLayout8i15ui1ul4f68",Hi);var Wi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.float32[1*t+0]=e,t},e}(Ei);Wi.prototype.bytesPerElement=4,Nr("StructArrayLayout1f4",Wi);var qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)},e.prototype.emplace=function(t,e,n,r){var i=3*t;return this.int16[i+0]=e,this.int16[i+1]=n,this.int16[i+2]=r,t},e}(Ei);qi.prototype.bytesPerElement=6,Nr("StructArrayLayout3i6",qi);var Zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)},e.prototype.emplace=function(t,e,n,r){var i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=n,this.uint16[i+3]=r,t},e}(Ei);Zi.prototype.bytesPerElement=8,Nr("StructArrayLayout1ul2ui8",Zi);var Xi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var n=this.length;return this.resize(n+1),this.emplace(n,t,e)},e.prototype.emplace=function(t,e,n){var r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=n,t},e}(Ei);Xi.prototype.bytesPerElement=4,Nr("StructArrayLayout2ui4",Xi);var $i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint16[1*t+0]=e,t},e}(Ei);$i.prototype.bytesPerElement=2,Nr("StructArrayLayout1ui2",$i);var Ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,r){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,n,r)},e.prototype.emplace=function(t,e,n,r,i){var o=4*t;return this.float32[o+0]=e,this.float32[o+1]=n,this.float32[o+2]=r,this.float32[o+3]=i,t},e}(Ei);Ji.prototype.bytesPerElement=16,Nr("StructArrayLayout4f16",Ji);var Yi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return n.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},n.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},n.x1.get=function(){return this._structArray.int16[this._pos2+2]},n.y1.get=function(){return this._structArray.int16[this._pos2+3]},n.x2.get=function(){return this._structArray.int16[this._pos2+4]},n.y2.get=function(){return this._structArray.int16[this._pos2+5]},n.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},n.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},n.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},n.anchorPoint.get=function(){return new i(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,n),e}(Ti);Yi.prototype.size=20;var Qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Yi(this,t)},e}(Bi);Nr("CollisionBoxArray",Qi);var Ki=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return n.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},n.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},n.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},n.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},n.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},n.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},n.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},n.segment.get=function(){return this._structArray.uint16[this._pos2+10]},n.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},n.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},n.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},n.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},n.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},n.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},n.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t},n.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},n.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t},n.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},n.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t},n.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,n),e}(Ti);Ki.prototype.size=48;var to=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Ki(this,t)},e}(Gi);Nr("PlacedSymbolArray",to);var eo=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return n.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},n.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},n.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},n.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},n.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},n.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},n.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},n.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},n.key.get=function(){return this._structArray.uint16[this._pos2+8]},n.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},n.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},n.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},n.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},n.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},n.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},n.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},n.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},n.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},n.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},n.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},n.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},n.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},n.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},n.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},n.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t},n.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},n.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},n.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},n.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,n),e}(Ti);eo.prototype.size=68;var no=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new eo(this,t)},e}(Hi);Nr("SymbolInstanceArray",no);var ro=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}(Wi);Nr("GlyphOffsetArray",ro);var io=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e}(qi);Nr("SymbolLineVertexArray",io);var oo=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return n.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},n.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},n.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,n),e}(Ti);oo.prototype.size=8;var ao=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new oo(this,t)},e}(Zi);Nr("FeatureIndexArray",ao);var so=Ai([{name:"a_pos",components:2,type:"Int16"}],4).members,lo=function(t){void 0===t&&(t=[]),this.segments=t};function co(t,e){return 256*(t=u(Math.floor(t),0,255))+u(Math.floor(e),0,255)}lo.prototype.prepareSegment=function(t,e,n,r){var i=this.segments[this.segments.length-1];return t>lo.MAX_VERTEX_ARRAY_LENGTH&&M("Max vertices per segment is "+lo.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!i||i.vertexLength+t>lo.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==r)&&(i={vertexOffset:e.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==r&&(i.sortKey=r),this.segments.push(i)),i},lo.prototype.get=function(){return this.segments},lo.prototype.destroy=function(){for(var t=0,e=this.segments;t<e.length;t+=1){var n=e[t];for(var r in n.vaos)n.vaos[r].destroy()}},lo.simpleSegment=function(t,e,n,r){return new lo([{vertexOffset:t,primitiveOffset:e,vertexLength:n,primitiveLength:r,vaos:{},sortKey:0}])},lo.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Nr("SegmentVector",lo);var uo=Ai([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),po=e((function(t){t.exports=function(t,e){var n,r,i,o,a,s,l,c;for(r=t.length-(n=3&t.length),i=e,a=3432918353,s=461845907,c=0;c<r;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,i=27492+(65535&(o=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),ho=e((function(t){t.exports=function(t,e){for(var n,r=t.length,i=e^r,o=0;r>=4;)n=1540483477*(65535&(n=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(n>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:i^=(255&t.charCodeAt(o+2))<<16;case 2:i^=(255&t.charCodeAt(o+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(o)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}})),fo=po,mo=ho;fo.murmur3=po,fo.murmur2=mo;var go=function(){this.ids=[],this.positions=[],this.indexed=!1};go.prototype.add=function(t,e,n,r){this.ids.push(vo(t)),this.positions.push(e,n,r)},go.prototype.getPositions=function(t){for(var e=vo(t),n=0,r=this.ids.length-1;n<r;){var i=n+r>>1;this.ids[i]>=e?r=i:n=i+1}for(var o=[];this.ids[n]===e;)o.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return o},go.serialize=function(t,e){var n=new Float64Array(t.ids),r=new Uint32Array(t.positions);return function t(e,n,r,i){for(;r<i;){for(var o=e[r+i>>1],a=r-1,s=i+1;;){do{a++}while(e[a]<o);do{s--}while(e[s]>o);if(a>=s)break;_o(e,a,s),_o(n,3*a,3*s),_o(n,3*a+1,3*s+1),_o(n,3*a+2,3*s+2)}s-r<i-s?(t(e,n,r,s),r=s+1):(t(e,n,s+1,i),i=s)}}(n,r,0,n.length-1),e&&e.push(n.buffer,r.buffer),{ids:n,positions:r}},go.deserialize=function(t){var e=new go;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e};var yo=Math.pow(2,53)-1;function vo(t){var e=+t;return!isNaN(e)&&e<=yo?e:fo(String(t))}function _o(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}Nr("FeaturePositionMap",go);var xo=function(t,e){this.gl=t.gl,this.location=e},bo=function(t){function e(e,n){t.call(this,e,n),this.current=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))},e}(xo),wo=function(t){function e(e,n){t.call(this,e,n),this.current=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))},e}(xo),Mo=function(t){function e(e,n){t.call(this,e,n),this.current=[0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))},e}(xo),So=function(t){function e(e,n){t.call(this,e,n),this.current=[0,0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))},e}(xo),To=function(t){function e(e,n){t.call(this,e,n),this.current=[0,0,0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))},e}(xo),Eo=function(t){function e(e,n){t.call(this,e,n),this.current=ee.transparent}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))},e}(xo),Ao=new Float32Array(16),Co=function(t){function e(e,n){t.call(this,e,n),this.current=Ao}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(var e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}},e}(xo);function Lo(t){return[co(255*t.r,255*t.g),co(255*t.b,255*t.a)]}var Po=function(t,e,n){this.value=t,this.uniformNames=e.map((function(t){return"u_"+t})),this.type=n};Po.prototype.setUniform=function(t,e,n){t.set(n.constantOr(this.value))},Po.prototype.getBinding=function(t,e,n){return"color"===this.type?new Eo(t,e):new wo(t,e)};var Io=function(t,e){this.uniformNames=e.map((function(t){return"u_"+t})),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1};Io.prototype.setConstantPatternPositions=function(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr},Io.prototype.setUniform=function(t,e,n,r){var i="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;i&&t.set(i)},Io.prototype.getBinding=function(t,e,n){return"u_pattern"===n.substr(0,9)?new To(t,e):new wo(t,e)};var Ro=function(t,e,n,r){this.expression=t,this.type=n,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===n?2:1,offset:0}})),this.paintVertexArray=new r};Ro.prototype.populatePaintArray=function(t,e,n,r,i){var o=this.paintVertexArray.length,a=this.expression.evaluate(new li(0),e,{},r,[],i);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)},Ro.prototype.updatePaintArray=function(t,e,n,r){var i=this.expression.evaluate({zoom:0},n,r);this._setPaintValue(t,e,i)},Ro.prototype._setPaintValue=function(t,e,n){if("color"===this.type)for(var r=Lo(n),i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1]);else{for(var o=t;o<e;o++)this.paintVertexArray.emplace(o,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}},Ro.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},Ro.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()};var ko=function(t,e,n,r,i,o){this.expression=t,this.uniformNames=e.map((function(t){return"u_"+t+"_t"})),this.type=n,this.useIntegerZoom=r,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===n?4:2,offset:0}})),this.paintVertexArray=new o};ko.prototype.populatePaintArray=function(t,e,n,r,i){var o=this.expression.evaluate(new li(this.zoom),e,{},r,[],i),a=this.expression.evaluate(new li(this.zoom+1),e,{},r,[],i),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)},ko.prototype.updatePaintArray=function(t,e,n,r){var i=this.expression.evaluate({zoom:this.zoom},n,r),o=this.expression.evaluate({zoom:this.zoom+1},n,r);this._setPaintValue(t,e,i,o)},ko.prototype._setPaintValue=function(t,e,n,r){if("color"===this.type)for(var i=Lo(n),o=Lo(r),a=t;a<e;a++)this.paintVertexArray.emplace(a,i[0],i[1],o[0],o[1]);else{for(var s=t;s<e;s++)this.paintVertexArray.emplace(s,n,r);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(r))}},ko.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},ko.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},ko.prototype.setUniform=function(t,e){var n=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=u(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);t.set(r)},ko.prototype.getBinding=function(t,e,n){return new wo(t,e)};var zo=function(t,e,n,r,i,o){this.expression=t,this.type=e,this.useIntegerZoom=n,this.zoom=r,this.layerId=o,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i};zo.prototype.populatePaintArray=function(t,e,n){var r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,e.patterns&&e.patterns[this.layerId],n)},zo.prototype.updatePaintArray=function(t,e,n,r,i){this._setPaintValues(t,e,n.patterns&&n.patterns[this.layerId],i)},zo.prototype._setPaintValues=function(t,e,n,r){if(r&&n){var i=r[n.min],o=r[n.mid],a=r[n.max];if(i&&o&&a)for(var s=t;s<e;s++)this.zoomInPaintVertexArray.emplace(s,o.tl[0],o.tl[1],o.br[0],o.br[1],i.tl[0],i.tl[1],i.br[0],i.br[1],o.pixelRatio,i.pixelRatio),this.zoomOutPaintVertexArray.emplace(s,o.tl[0],o.tl[1],o.br[0],o.br[1],a.tl[0],a.tl[1],a.br[0],a.br[1],o.pixelRatio,a.pixelRatio)}},zo.prototype.upload=function(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,uo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,uo.members,this.expression.isStateDependent))},zo.prototype.destroy=function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()};var Do=function(t,e,n){this.binders={},this._buffers=[];var r=[];for(var i in t.paint._values)if(n(i)){var o=t.paint.get(i);if(o instanceof mi&&Dn(o.property.specification)){var a=Fo(i,t.type),s=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,u=o.property.specification["property-type"],p="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===s.kind)this.binders[i]=p?new Io(s.value,a):new Po(s.value,a,l),r.push("/u_"+i);else if("source"===s.kind||p){var h=Bo(i,l,"source");this.binders[i]=p?new zo(s,l,c,e,h,t.id):new Ro(s,a,l,h),r.push("/a_"+i)}else{var d=Bo(i,l,"composite");this.binders[i]=new ko(s,a,l,c,e,d),r.push("/z_"+i)}}}this.cacheKey=r.sort().join("")};Do.prototype.getMaxValue=function(t){var e=this.binders[t];return e instanceof Ro||e instanceof ko?e.maxValue:0},Do.prototype.populatePaintArrays=function(t,e,n,r,i){for(var o in this.binders){var a=this.binders[o];(a instanceof Ro||a instanceof ko||a instanceof zo)&&a.populatePaintArray(t,e,n,r,i)}},Do.prototype.setConstantPatternPositions=function(t,e){for(var n in this.binders){var r=this.binders[n];r instanceof Io&&r.setConstantPatternPositions(t,e)}},Do.prototype.updatePaintArrays=function(t,e,n,r,i){var o=!1;for(var a in t)for(var s=0,l=e.getPositions(a);s<l.length;s+=1){var c=l[s],u=n.feature(c.index);for(var p in this.binders){var h=this.binders[p];if((h instanceof Ro||h instanceof ko||h instanceof zo)&&!0===h.expression.isStateDependent){var d=r.paint.get(p);h.expression=d.value,h.updatePaintArray(c.start,c.end,u,t[a],i),o=!0}}}return o},Do.prototype.defines=function(){var t=[];for(var e in this.binders){var n=this.binders[e];(n instanceof Po||n instanceof Io)&&t.push.apply(t,n.uniformNames.map((function(t){return"#define HAS_UNIFORM_"+t})))}return t},Do.prototype.getBinderAttributes=function(){var t=[];for(var e in this.binders){var n=this.binders[e];if(n instanceof Ro||n instanceof ko)for(var r=0;r<n.paintVertexAttributes.length;r++)t.push(n.paintVertexAttributes[r].name);else if(n instanceof zo)for(var i=0;i<uo.members.length;i++)t.push(uo.members[i].name)}return t},Do.prototype.getBinderUniforms=function(){var t=[];for(var e in this.binders){var n=this.binders[e];if(n instanceof Po||n instanceof Io||n instanceof ko)for(var r=0,i=n.uniformNames;r<i.length;r+=1)t.push(i[r])}return t},Do.prototype.getPaintVertexBuffers=function(){return this._buffers},Do.prototype.getUniforms=function(t,e){var n=[];for(var r in this.binders){var i=this.binders[r];if(i instanceof Po||i instanceof Io||i instanceof ko)for(var o=0,a=i.uniformNames;o<a.length;o+=1){var s=a[o];if(e[s]){var l=i.getBinding(t,e[s],s);n.push({name:s,property:r,binding:l})}}}return n},Do.prototype.setUniforms=function(t,e,n,r){for(var i=0,o=e;i<o.length;i+=1){var a=o[i],s=a.name,l=a.property;this.binders[l].setUniform(a.binding,r,n.get(l),s)}},Do.prototype.updatePaintBuffers=function(t){for(var e in this._buffers=[],this.binders){var n=this.binders[e];if(t&&n instanceof zo){var r=2===t.fromScale?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(n instanceof Ro||n instanceof ko)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}},Do.prototype.upload=function(t){for(var e in this.binders){var n=this.binders[e];(n instanceof Ro||n instanceof ko||n instanceof zo)&&n.upload(t)}this.updatePaintBuffers()},Do.prototype.destroy=function(){for(var t in this.binders){var e=this.binders[t];(e instanceof Ro||e instanceof ko||e instanceof zo)&&e.destroy()}};var Oo=function(t,e,n){void 0===n&&(n=function(){return!0}),this.programConfigurations={};for(var r=0,i=t;r<i.length;r+=1){var o=i[r];this.programConfigurations[o.id]=new Do(o,e,n)}this.needsUpload=!1,this._featureMap=new go,this._bufferOffset=0};function Fo(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(e+"-","").replace(/-/g,"_")]}function Bo(t,e,n){var r={color:{source:ki,composite:Ji},number:{source:Wi,composite:ki}},i=function(t){return{"line-pattern":{source:zi,composite:zi},"fill-pattern":{source:zi,composite:zi},"fill-extrusion-pattern":{source:zi,composite:zi}}[t]}(t);return i&&i[n]||r[e][n]}Oo.prototype.populatePaintArrays=function(t,e,n,r,i,o){for(var a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(t,e,r,i,o);void 0!==e.id&&this._featureMap.add(e.id,n,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0},Oo.prototype.updatePaintArrays=function(t,e,n,r){for(var i=0,o=n;i<o.length;i+=1){var a=o[i];this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(t,this._featureMap,e,a,r)||this.needsUpload}},Oo.prototype.get=function(t){return this.programConfigurations[t]},Oo.prototype.upload=function(t){if(this.needsUpload){for(var e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}},Oo.prototype.destroy=function(){for(var t in this.programConfigurations)this.programConfigurations[t].destroy()},Nr("ConstantBinder",Po),Nr("CrossFadedConstantBinder",Io),Nr("SourceExpressionBinder",Ro),Nr("CrossFadedCompositeBinder",zo),Nr("CompositeExpressionBinder",ko),Nr("ProgramConfiguration",Do,{omit:["_buffers"]}),Nr("ProgramConfigurationSet",Oo);var No=Math.pow(2,14)-1,Uo=-No-1;function jo(t){for(var e=8192/t.extent,n=t.loadGeometry(),r=0;r<n.length;r++)for(var i=n[r],o=0;o<i.length;o++){var a=i[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=u(s,Uo,No),a.y=u(l,Uo,No),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&M("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return n}function Vo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?jo(t):[]}}function Go(t,e,n,r,i){t.emplaceBack(2*e+(r+1)/2,2*n+(i+1)/2)}var Ho=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Li,this.indexArray=new Vi,this.segments=new lo,this.programConfigurations=new Oo(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Wo(t,e){for(var n=0;n<t.length;n++)if(ta(e,t[n]))return!0;for(var r=0;r<e.length;r++)if(ta(t,e[r]))return!0;return!!$o(t,e)}function qo(t,e,n){return!!ta(t,e)||!!Yo(e,t,n)}function Zo(t,e){if(1===t.length)return Ko(e,t[0]);for(var n=0;n<e.length;n++)for(var r=e[n],i=0;i<r.length;i++)if(ta(t,r[i]))return!0;for(var o=0;o<t.length;o++)if(Ko(e,t[o]))return!0;for(var a=0;a<e.length;a++)if($o(t,e[a]))return!0;return!1}function Xo(t,e,n){if(t.length>1){if($o(t,e))return!0;for(var r=0;r<e.length;r++)if(Yo(e[r],t,n))return!0}for(var i=0;i<t.length;i++)if(Yo(t[i],e,n))return!0;return!1}function $o(t,e){if(0===t.length||0===e.length)return!1;for(var n=0;n<t.length-1;n++)for(var r=t[n],i=t[n+1],o=0;o<e.length-1;o++)if(Jo(r,i,e[o],e[o+1]))return!0;return!1}function Jo(t,e,n,r){return S(t,n,r)!==S(e,n,r)&&S(t,e,n)!==S(t,e,r)}function Yo(t,e,n){var r=n*n;if(1===e.length)return t.distSqr(e[0])<r;for(var i=1;i<e.length;i++)if(Qo(t,e[i-1],e[i])<r)return!0;return!1}function Qo(t,e,n){var r=e.distSqr(n);if(0===r)return t.distSqr(e);var i=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;return t.distSqr(i<0?e:i>1?n:n.sub(e)._mult(i)._add(e))}function Ko(t,e){for(var n,r,i,o=!1,a=0;a<t.length;a++)for(var s=0,l=(n=t[a]).length-1;s<n.length;l=s++)(r=n[s]).y>e.y!=(i=n[l]).y>e.y&&e.x<(i.x-r.x)*(e.y-r.y)/(i.y-r.y)+r.x&&(o=!o);return o}function ta(t,e){for(var n=!1,r=0,i=t.length-1;r<t.length;i=r++){var o=t[r],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n}function ea(t,e,n){var r=n[0],i=n[2];if(t.x<r.x&&e.x<r.x||t.x>i.x&&e.x>i.x||t.y<r.y&&e.y<r.y||t.y>i.y&&e.y>i.y)return!1;var o=S(t,e,n[0]);return o!==S(t,e,n[1])||o!==S(t,e,n[2])||o!==S(t,e,n[3])}function na(t,e,n){var r=e.paint.get(t).value;return"constant"===r.kind?r.value:n.programConfigurations.get(e.id).getMaxValue(t)}function ra(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ia(t,e,n,r,o){if(!e[0]&&!e[1])return t;var a=i.convert(e)._mult(o);"viewport"===n&&a._rotate(-r);for(var s=[],l=0;l<t.length;l++)s.push(t[l].sub(a));return s}Ho.prototype.populate=function(t,e,n){var r=this.layers[0],i=[],o=null,a=!1;"circle"===r.type&&(a=!(o=r.layout.get("circle-sort-key")).isConstant());for(var s=0,l=t;s<l.length;s+=1){var c=l[s],u=c.feature,p=c.id,h=c.index,d=c.sourceLayerIndex,f=this.layers[0]._featureFilter.needGeometry,m=Vo(u,f);if(this.layers[0]._featureFilter.filter(new li(this.zoom),m,n)){var g=a?o.evaluate(m,{},n):void 0,y={id:p,properties:u.properties,type:u.type,sourceLayerIndex:d,index:h,geometry:f?m.geometry:jo(u),patterns:{},sortKey:g};i.push(y)}}a&&i.sort((function(t,e){return t.sortKey-e.sortKey}));for(var v=0,_=i;v<_.length;v+=1){var x=_[v],b=x.geometry,w=x.index,M=x.sourceLayerIndex,S=t[w].feature;this.addFeature(x,b,w,n),e.featureIndex.insert(S,b,w,M,this.index)}},Ho.prototype.update=function(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)},Ho.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Ho.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Ho.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,so),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Ho.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Ho.prototype.addFeature=function(t,e,n,r){for(var i=0,o=e;i<o.length;i+=1)for(var a=0,s=o[i];a<s.length;a+=1){var l=s[a],c=l.x,u=l.y;if(!(c<0||c>=8192||u<0||u>=8192)){var p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),h=p.vertexLength;Go(this.layoutVertexArray,c,u,-1,-1),Go(this.layoutVertexArray,c,u,1,-1),Go(this.layoutVertexArray,c,u,1,1),Go(this.layoutVertexArray,c,u,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+3,h+2),p.vertexLength+=4,p.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{},r)},Nr("CircleBucket",Ho,{omit:["layers"]});var oa=new wi({"circle-sort-key":new vi(Pt.layout_circle["circle-sort-key"])}),aa={paint:new wi({"circle-radius":new vi(Pt.paint_circle["circle-radius"]),"circle-color":new vi(Pt.paint_circle["circle-color"]),"circle-blur":new vi(Pt.paint_circle["circle-blur"]),"circle-opacity":new vi(Pt.paint_circle["circle-opacity"]),"circle-translate":new yi(Pt.paint_circle["circle-translate"]),"circle-translate-anchor":new yi(Pt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new yi(Pt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new yi(Pt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new vi(Pt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new vi(Pt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new vi(Pt.paint_circle["circle-stroke-opacity"])}),layout:oa},sa="undefined"!=typeof Float32Array?Float32Array:Array;function la(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ca(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],p=e[8],h=e[9],d=e[10],f=e[11],m=e[12],g=e[13],y=e[14],v=e[15],_=n[0],x=n[1],b=n[2],w=n[3];return t[0]=_*r+x*s+b*p+w*m,t[1]=_*i+x*l+b*h+w*g,t[2]=_*o+x*c+b*d+w*y,t[3]=_*a+x*u+b*f+w*v,t[4]=(_=n[4])*r+(x=n[5])*s+(b=n[6])*p+(w=n[7])*m,t[5]=_*i+x*l+b*h+w*g,t[6]=_*o+x*c+b*d+w*y,t[7]=_*a+x*u+b*f+w*v,t[8]=(_=n[8])*r+(x=n[9])*s+(b=n[10])*p+(w=n[11])*m,t[9]=_*i+x*l+b*h+w*g,t[10]=_*o+x*c+b*d+w*y,t[11]=_*a+x*u+b*f+w*v,t[12]=(_=n[12])*r+(x=n[13])*s+(b=n[14])*p+(w=n[15])*m,t[13]=_*i+x*l+b*h+w*g,t[14]=_*o+x*c+b*d+w*y,t[15]=_*a+x*u+b*f+w*v,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,n=arguments.length;n--;)e+=t[n]*t[n];return Math.sqrt(e)});var ua,pa=ca;function ha(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,t}ua=new sa(3),sa!=Float32Array&&(ua[0]=0,ua[1]=0,ua[2]=0),function(){var t=new sa(4);sa!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}();var da=(function(){var t=new sa(2);sa!=Float32Array&&(t[0]=0,t[1]=0)}(),function(t){function e(e){t.call(this,e,aa)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Ho(t)},e.prototype.queryRadius=function(t){var e=t;return na("circle-radius",this,e)+na("circle-stroke-width",this,e)+ra(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,n,r,i,o,a,s){for(var l=ia(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),c=this.paint.get("circle-radius").evaluate(e,n)+this.paint.get("circle-stroke-width").evaluate(e,n),u="map"===this.paint.get("circle-pitch-alignment"),p=u?l:function(t,e){return t.map((function(t){return fa(t,e)}))}(l,s),h=u?c*a:c,d=0,f=r;d<f.length;d+=1)for(var m=0,g=f[d];m<g.length;m+=1){var y=g[m],v=u?y:fa(y,s),_=h,x=ha([],[y.x,y.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?_*=x[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(_*=o.cameraToCenterDistance/x[3]),qo(p,v,_))return!0}return!1},e}(Mi));function fa(t,e){var n=ha([],[t.x,t.y,0,1],e);return new i(n[0]/n[3],n[1]/n[3])}var ma=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Ho);function ga(t,e,n,r){var i=e.width,o=e.height;if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==i*o*n)throw new RangeError("mismatched image size")}else r=new Uint8Array(i*o*n);return t.width=i,t.height=o,t.data=r,t}function ya(t,e,n){var r=e.width,i=e.height;if(r!==t.width||i!==t.height){var o=ga({},{width:r,height:i},n);va(t,o,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,r),height:Math.min(t.height,i)},n),t.width=r,t.height=i,t.data=o.data}}function va(t,e,n,r,i,o){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,l=0;l<i.height;l++)for(var c=((n.y+l)*t.width+n.x)*o,u=((r.y+l)*e.width+r.x)*o,p=0;p<i.width*o;p++)s[u+p]=a[c+p];return e}Nr("HeatmapBucket",ma,{omit:["layers"]});var _a=function(t,e){ga(this,t,1,e)};_a.prototype.resize=function(t){ya(this,t,1)},_a.prototype.clone=function(){return new _a({width:this.width,height:this.height},new Uint8Array(this.data))},_a.copy=function(t,e,n,r,i){va(t,e,n,r,i,1)};var xa=function(t,e){ga(this,t,4,e)};xa.prototype.resize=function(t){ya(this,t,4)},xa.prototype.replace=function(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t},xa.prototype.clone=function(){return new xa({width:this.width,height:this.height},new Uint8Array(this.data))},xa.copy=function(t,e,n,r,i){va(t,e,n,r,i,4)},Nr("AlphaImage",_a),Nr("RGBAImage",xa);var ba={paint:new wi({"heatmap-radius":new vi(Pt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new vi(Pt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new yi(Pt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new bi(Pt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new yi(Pt.paint_heatmap["heatmap-opacity"])})};function wa(t){var e={},n=t.resolution||256,r=t.clips?t.clips.length:1,i=t.image||new xa({width:n,height:r}),o=function(n,r,o){e[t.evaluationKey]=o;var a=t.expression.evaluate(e);i.data[n+r+0]=Math.floor(255*a.r/a.a),i.data[n+r+1]=Math.floor(255*a.g/a.a),i.data[n+r+2]=Math.floor(255*a.b/a.a),i.data[n+r+3]=Math.floor(255*a.a)};if(t.clips)for(var a=0,s=0;a<r;++a,s+=4*n)for(var l=0,c=0;l<n;l++,c+=4){var u=l/(n-1),p=t.clips[a];o(s,c,p.start*(1-u)+p.end*u)}else for(var h=0,d=0;h<n;h++,d+=4)o(0,d,h/(n-1));return i}var Ma=function(t){function e(e){t.call(this,e,ba),this._updateColorRamp()}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new ma(t)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){"heatmap-color"===t&&this._updateColorRamp()},e.prototype._updateColorRamp=function(){this.colorRamp=wa({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null},e.prototype.resize=function(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility},e}(Mi),Sa={paint:new wi({"hillshade-illumination-direction":new yi(Pt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new yi(Pt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new yi(Pt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new yi(Pt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new yi(Pt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new yi(Pt.paint_hillshade["hillshade-accent-color"])})},Ta=function(t){function e(e){t.call(this,e,Sa)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility},e}(Mi),Ea=Ai([{name:"a_pos",components:2,type:"Int16"}],4).members,Aa=La,Ca=La;function La(t,e,n){n=n||2;var r,i,o,a,s,l,c,u=e&&e.length,p=u?e[0]*n:t.length,h=Pa(t,0,p,n,!0),d=[];if(!h||h.next===h.prev)return d;if(u&&(h=function(t,e,n,r){var i,o,a,s=[];for(i=0,o=e.length;i<o;i++)(a=Pa(t,e[i]*r,i<o-1?e[i+1]*r:t.length,r,!1))===a.next&&(a.steiner=!0),s.push(ja(a));for(s.sort(Fa),i=0;i<s.length;i++)Ba(s[i],n),n=Ia(n,n.next);return n}(t,e,h,n)),t.length>80*n){r=o=t[0],i=a=t[1];for(var f=n;f<p;f+=n)(s=t[f])<r&&(r=s),(l=t[f+1])<i&&(i=l),s>o&&(o=s),l>a&&(a=l);c=0!==(c=Math.max(o-r,a-i))?1/c:0}return Ra(h,d,n,r,i,c),d}function Pa(t,e,n,r,i){var o,a;if(i===ts(t,e,n,r)>0)for(o=e;o<n;o+=r)a=Ya(o,t[o],t[o+1],a);else for(o=n-r;o>=e;o-=r)a=Ya(o,t[o],t[o+1],a);return a&&Wa(a,a.next)&&(Qa(a),a=a.next),a}function Ia(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Wa(r,r.next)&&0!==Ha(r.prev,r,r.next))r=r.next;else{if(Qa(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Ra(t,e,n,r,i,o,a){if(t){!a&&o&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=Ua(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,a,s,l,c=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,r=n,s=0,e=0;e<c&&(s++,r=r.nextZ);e++);for(l=c;s>0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(a>1)}(i)}(t,r,i,o);for(var s,l,c=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?za(t,r,i,o):ka(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),Qa(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?Ra(t=Da(Ia(t),e,n),e,n,r,i,o,2):2===a&&Oa(t,e,n,r,i,o):Ra(Ia(t),e,n,r,i,o,1);break}}}function ka(t){var e=t.prev,n=t,r=t.next;if(Ha(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Va(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Ha(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function za(t,e,n,r){var i=t.prev,o=t,a=t.next;if(Ha(i,o,a)>=0)return!1;for(var s=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,l=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,c=Ua(i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,e,n,r),u=Ua(s,l,e,n,r),p=t.prevZ,h=t.nextZ;p&&p.z>=c&&h&&h.z<=u;){if(p!==t.prev&&p!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Ha(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,h!==t.prev&&h!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,h.x,h.y)&&Ha(h.prev,h,h.next)>=0)return!1;h=h.nextZ}for(;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Ha(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;h&&h.z<=u;){if(h!==t.prev&&h!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,h.x,h.y)&&Ha(h.prev,h,h.next)>=0)return!1;h=h.nextZ}return!0}function Da(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!Wa(i,o)&&qa(i,r,r.next,o)&&$a(i,o)&&$a(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),Qa(r),Qa(r.next),r=t=o),r=r.next}while(r!==t);return Ia(r)}function Oa(t,e,n,r,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Ga(a,s)){var l=Ja(a,s);return a=Ia(a,a.next),l=Ia(l,l.next),Ra(a,e,n,r,i,o),void Ra(l,e,n,r,i,o)}s=s.next}a=a.next}while(a!==t)}function Fa(t,e){return t.x-e.x}function Ba(t,e){if(e=function(t,e){var n,r=e,i=t.x,o=t.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>a){if(a=s,s===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!n)return null;if(i===a)return n;var l,c=n,u=n.x,p=n.y,h=1/0;r=n;do{i>=r.x&&r.x>=u&&i!==r.x&&Va(o<p?i:a,o,u,p,o<p?a:i,o,r.x,r.y)&&(l=Math.abs(o-r.y)/(i-r.x),$a(r,t)&&(l<h||l===h&&(r.x>n.x||r.x===n.x&&Na(n,r)))&&(n=r,h=l)),r=r.next}while(r!==c);return n}(t,e)){var n=Ja(e,t);Ia(e,e.next),Ia(n,n.next)}}function Na(t,e){return Ha(t.prev,t,e.prev)<0&&Ha(e.next,t,t.next)<0}function Ua(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ja(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Va(t,e,n,r,i,o,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(r-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function Ga(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&qa(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&($a(t,e)&&$a(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(Ha(t.prev,t,e.prev)||Ha(t,e.prev,e))||Wa(t,e)&&Ha(t.prev,t,t.next)>0&&Ha(e.prev,e,e.next)>0)}function Ha(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Wa(t,e){return t.x===e.x&&t.y===e.y}function qa(t,e,n,r){var i=Xa(Ha(t,e,n)),o=Xa(Ha(t,e,r)),a=Xa(Ha(n,r,t)),s=Xa(Ha(n,r,e));return i!==o&&a!==s||!(0!==i||!Za(t,n,e))||!(0!==o||!Za(t,r,e))||!(0!==a||!Za(n,t,r))||!(0!==s||!Za(n,e,r))}function Za(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Xa(t){return t>0?1:t<0?-1:0}function $a(t,e){return Ha(t.prev,t,t.next)<0?Ha(t,e,t.next)>=0&&Ha(t,t.prev,e)>=0:Ha(t,e,t.prev)<0||Ha(t,t.next,e)<0}function Ja(t,e){var n=new Ka(t.i,t.x,t.y),r=new Ka(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Ya(t,e,n,r){var i=new Ka(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Qa(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ka(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ts(t,e,n,r){for(var i=0,o=e,a=n-r;o<n;o+=r)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}function es(t,e,n,r,i){!function t(e,n,r,i,o){for(;i>r;){if(i-r>600){var a=i-r+1,s=n-r+1,l=Math.log(a),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);t(e,n,Math.max(r,Math.floor(n-s*c/a+u)),Math.min(i,Math.floor(n+(a-s)*c/a+u)),o)}var p=e[n],h=r,d=i;for(ns(e,r,n),o(e[i],p)>0&&ns(e,r,i);h<d;){for(ns(e,h,d),h++,d--;o(e[h],p)<0;)h++;for(;o(e[d],p)>0;)d--}0===o(e[r],p)?ns(e,r,d):ns(e,++d,i),d<=n&&(r=d+1),n<=d&&(i=d-1)}}(t,e,n||0,r||t.length-1,i||rs)}function ns(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function rs(t,e){return t<e?-1:t>e?1:0}function is(t,e){var n=t.length;if(n<=1)return[t];for(var r,i,o=[],a=0;a<n;a++){var s=T(t[a]);0!==s&&(t[a].area=Math.abs(s),void 0===i&&(i=s<0),i===s<0?(r&&o.push(r),r=[t[a]]):r.push(t[a]))}if(r&&o.push(r),e>1)for(var l=0;l<o.length;l++)o[l].length<=e||(es(o[l],e,1,o[l].length-1,os),o[l]=o[l].slice(0,e));return o}function os(t,e){return e.area-t.area}function as(t,e,n){for(var r=n.patternDependencies,i=!1,o=0,a=e;o<a.length;o+=1){var s=a[o].paint.get(t+"-pattern");s.isConstant()||(i=!0);var l=s.constantOr(null);l&&(i=!0,r[l.to]=!0,r[l.from]=!0)}return i}function ss(t,e,n,r,i){for(var o=i.patternDependencies,a=0,s=e;a<s.length;a+=1){var l=s[a],c=l.paint.get(t+"-pattern").value;if("constant"!==c.kind){var u=c.evaluate({zoom:r-1},n,{},i.availableImages),p=c.evaluate({zoom:r},n,{},i.availableImages),h=c.evaluate({zoom:r+1},n,{},i.availableImages);p=p&&p.name?p.name:p,h=h&&h.name?h.name:h,o[u=u&&u.name?u.name:u]=!0,o[p]=!0,o[h]=!0,n.patterns[l.id]={min:u,mid:p,max:h}}}return n}La.deviation=function(t,e,n,r){var i=e&&e.length,o=Math.abs(ts(t,0,i?e[0]*n:t.length,n));if(i)for(var a=0,s=e.length;a<s;a++)o-=Math.abs(ts(t,e[a]*n,a<s-1?e[a+1]*n:t.length,n));var l=0;for(a=0;a<r.length;a+=3){var c=r[a]*n,u=r[a+1]*n,p=r[a+2]*n;l+=Math.abs((t[c]-t[p])*(t[u+1]-t[c+1])-(t[c]-t[u])*(t[p+1]-t[c+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},La.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)n.vertices.push(t[i][o][a]);i>0&&n.holes.push(r+=t[i-1].length)}return n},Aa.default=Ca;var ls=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Li,this.indexArray=new Vi,this.indexArray2=new Xi,this.programConfigurations=new Oo(t.layers,t.zoom),this.segments=new lo,this.segments2=new lo,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};ls.prototype.populate=function(t,e,n){this.hasPattern=as("fill",this.layers,e);for(var r=this.layers[0].layout.get("fill-sort-key"),i=!r.isConstant(),o=[],a=0,s=t;a<s.length;a+=1){var l=s[a],c=l.feature,u=l.id,p=l.index,h=l.sourceLayerIndex,d=this.layers[0]._featureFilter.needGeometry,f=Vo(c,d);if(this.layers[0]._featureFilter.filter(new li(this.zoom),f,n)){var m=i?r.evaluate(f,{},n,e.availableImages):void 0,g={id:u,properties:c.properties,type:c.type,sourceLayerIndex:h,index:p,geometry:d?f.geometry:jo(c),patterns:{},sortKey:m};o.push(g)}}i&&o.sort((function(t,e){return t.sortKey-e.sortKey}));for(var y=0,v=o;y<v.length;y+=1){var _=v[y],x=_.geometry,b=_.index,w=_.sourceLayerIndex;if(this.hasPattern){var M=ss("fill",this.layers,_,this.zoom,e);this.patternFeatures.push(M)}else this.addFeature(_,x,b,n,{});e.featureIndex.insert(t[b].feature,x,b,w,this.index)}},ls.prototype.update=function(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)},ls.prototype.addFeatures=function(t,e,n){for(var r=0,i=this.patternFeatures;r<i.length;r+=1){var o=i[r];this.addFeature(o,o.geometry,o.index,e,n)}},ls.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},ls.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},ls.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ea),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0},ls.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())},ls.prototype.addFeature=function(t,e,n,r,i){for(var o=0,a=is(e,500);o<a.length;o+=1){for(var s=a[o],l=0,c=0,u=s;c<u.length;c+=1)l+=u[c].length;for(var p=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray),h=p.vertexLength,d=[],f=[],m=0,g=s;m<g.length;m+=1){var y=g[m];if(0!==y.length){y!==s[0]&&f.push(d.length/2);var v=this.segments2.prepareSegment(y.length,this.layoutVertexArray,this.indexArray2),_=v.vertexLength;this.layoutVertexArray.emplaceBack(y[0].x,y[0].y),this.indexArray2.emplaceBack(_+y.length-1,_),d.push(y[0].x),d.push(y[0].y);for(var x=1;x<y.length;x++)this.layoutVertexArray.emplaceBack(y[x].x,y[x].y),this.indexArray2.emplaceBack(_+x-1,_+x),d.push(y[x].x),d.push(y[x].y);v.vertexLength+=y.length,v.primitiveLength+=y.length}}for(var b=Aa(d,f),w=0;w<b.length;w+=3)this.indexArray.emplaceBack(h+b[w],h+b[w+1],h+b[w+2]);p.vertexLength+=l,p.primitiveLength+=b.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,i,r)},Nr("FillBucket",ls,{omit:["layers","patternFeatures"]});var cs=new wi({"fill-sort-key":new vi(Pt.layout_fill["fill-sort-key"])}),us={paint:new wi({"fill-antialias":new yi(Pt.paint_fill["fill-antialias"]),"fill-opacity":new vi(Pt.paint_fill["fill-opacity"]),"fill-color":new vi(Pt.paint_fill["fill-color"]),"fill-outline-color":new vi(Pt.paint_fill["fill-outline-color"]),"fill-translate":new yi(Pt.paint_fill["fill-translate"]),"fill-translate-anchor":new yi(Pt.paint_fill["fill-translate-anchor"]),"fill-pattern":new _i(Pt.paint_fill["fill-pattern"])}),layout:cs},ps=function(t){function e(e){t.call(this,e,us)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,n){t.prototype.recalculate.call(this,e,n);var r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},e.prototype.createBucket=function(t){return new ls(t)},e.prototype.queryRadius=function(){return ra(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(t,e,n,r,i,o,a){return Zo(ia(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,a),r)},e.prototype.isTileClipped=function(){return!0},e}(Mi),hs=Ai([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4).members,ds=fs;function fs(t,e,n,r,i){this.properties={},this.extent=n,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=i,t.readFields(ms,this,e)}function ms(t,e,n){1==t?e.id=n.readVarint():2==t?function(t,e){for(var n=t.readVarint()+t.pos;t.pos<n;){var r=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[r]=i}}(n,e):3==t?e.type=n.readVarint():4==t&&(e._geometry=n.pos)}function gs(t){for(var e,n,r=0,i=0,o=t.length,a=o-1;i<o;a=i++)r+=((n=t[a]).x-(e=t[i]).x)*(e.y+n.y);return r}fs.types=["Unknown","Point","LineString","Polygon"],fs.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,r=1,o=0,a=0,s=0,l=[];t.pos<n;){if(o<=0){var c=t.readVarint();r=7&c,o=c>>3}if(o--,1===r||2===r)a+=t.readSVarint(),s+=t.readSVarint(),1===r&&(e&&l.push(e),e=[]),e.push(new i(a,s));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&l.push(e),l},fs.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;t.pos<e;){if(r<=0){var u=t.readVarint();n=7&u,r=u>>3}if(r--,1===n||2===n)(i+=t.readSVarint())<a&&(a=i),i>s&&(s=i),(o+=t.readSVarint())<l&&(l=o),o>c&&(c=o);else if(7!==n)throw new Error("unknown command "+n)}return[a,l,s,c]},fs.prototype.toGeoJSON=function(t,e,n){var r,i,o=this.extent*Math.pow(2,n),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),c=fs.types[this.type];function u(t){for(var e=0;e<t.length;e++){var n=t[e];t[e]=[360*(n.x+a)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(n.y+s)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(r=0;r<l.length;r++)p[r]=l[r][0];u(l=p);break;case 2:for(r=0;r<l.length;r++)u(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var n,r,i=[],o=0;o<e;o++){var a=gs(t[o]);0!==a&&(void 0===r&&(r=a<0),r===a<0?(n&&i.push(n),n=[t[o]]):n.push(t[o]))}return n&&i.push(n),i}(l),r=0;r<l.length;r++)for(i=0;i<l[r].length;i++)u(l[r][i])}1===l.length?l=l[0]:c="Multi"+c;var h={type:"Feature",geometry:{type:c,coordinates:l},properties:this.properties};return"id"in this&&(h.id=this.id),h};var ys=vs;function vs(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(_s,this,e),this.length=this._features.length}function _s(t,e,n){15===t?e.version=n.readVarint():1===t?e.name=n.readString():5===t?e.extent=n.readVarint():2===t?e._features.push(n.pos):3===t?e._keys.push(n.readString()):4===t&&e._values.push(function(t){for(var e=null,n=t.readVarint()+t.pos;t.pos<n;){var r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(n))}function xs(t,e,n){if(3===t){var r=new ys(n,n.readVarint()+n.pos);r.length&&(e[r.name]=r)}}vs.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new ds(this._pbf,e,this.extent,this._keys,this._values)};var bs={VectorTile:function(t,e){this.layers=t.readFields(xs,{},e)},VectorTileFeature:ds,VectorTileLayer:ys},ws=bs.VectorTileFeature.types,Ms=Math.pow(2,13);function Ss(t,e,n,r,i,o,a,s){t.emplaceBack(e,n,2*Math.floor(r*Ms)+a,i*Ms*2,o*Ms*2,Math.round(s))}var Ts=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ii,this.indexArray=new Vi,this.programConfigurations=new Oo(t.layers,t.zoom),this.segments=new lo,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Es(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}Ts.prototype.populate=function(t,e,n){this.features=[],this.hasPattern=as("fill-extrusion",this.layers,e);for(var r=0,i=t;r<i.length;r+=1){var o=i[r],a=o.feature,s=o.id,l=o.index,c=o.sourceLayerIndex,u=this.layers[0]._featureFilter.needGeometry,p=Vo(a,u);if(this.layers[0]._featureFilter.filter(new li(this.zoom),p,n)){var h={id:s,sourceLayerIndex:c,index:l,geometry:u?p.geometry:jo(a),properties:a.properties,type:a.type,patterns:{}};this.hasPattern?this.features.push(ss("fill-extrusion",this.layers,h,this.zoom,e)):this.addFeature(h,h.geometry,l,n,{}),e.featureIndex.insert(a,h.geometry,l,c,this.index,!0)}}},Ts.prototype.addFeatures=function(t,e,n){for(var r=0,i=this.features;r<i.length;r+=1){var o=i[r];this.addFeature(o,o.geometry,o.index,e,n)}},Ts.prototype.update=function(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)},Ts.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Ts.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Ts.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,hs),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Ts.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Ts.prototype.addFeature=function(t,e,n,r,i){for(var o=0,a=is(e,500);o<a.length;o+=1){for(var s=a[o],l=0,c=0,u=s;c<u.length;c+=1)l+=u[c].length;for(var p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),h=0,d=s;h<d.length;h+=1){var f=d[h];if(0!==f.length&&!((R=f).every((function(t){return t.x<0}))||R.every((function(t){return t.x>8192}))||R.every((function(t){return t.y<0}))||R.every((function(t){return t.y>8192}))))for(var m=0,g=0;g<f.length;g++){var y=f[g];if(g>=1){var v=f[g-1];if(!Es(y,v)){p.vertexLength+4>lo.MAX_VERTEX_ARRAY_LENGTH&&(p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var _=y.sub(v)._perp()._unit(),x=v.dist(y);m+x>32768&&(m=0),Ss(this.layoutVertexArray,y.x,y.y,_.x,_.y,0,0,m),Ss(this.layoutVertexArray,y.x,y.y,_.x,_.y,0,1,m),Ss(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,0,m+=x),Ss(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,1,m);var b=p.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),p.vertexLength+=4,p.primitiveLength+=2}}}}if(p.vertexLength+l>lo.MAX_VERTEX_ARRAY_LENGTH&&(p=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),"Polygon"===ws[t.type]){for(var w=[],M=[],S=p.vertexLength,T=0,E=s;T<E.length;T+=1){var A=E[T];if(0!==A.length){A!==s[0]&&M.push(w.length/2);for(var C=0;C<A.length;C++){var L=A[C];Ss(this.layoutVertexArray,L.x,L.y,0,0,1,1,0),w.push(L.x),w.push(L.y)}}}for(var P=Aa(w,M),I=0;I<P.length;I+=3)this.indexArray.emplaceBack(S+P[I],S+P[I+2],S+P[I+1]);p.primitiveLength+=P.length/3,p.vertexLength+=l}}var R;this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,i,r)},Nr("FillExtrusionBucket",Ts,{omit:["layers","features"]});var As={paint:new wi({"fill-extrusion-opacity":new yi(Pt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new vi(Pt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new yi(Pt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new yi(Pt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new _i(Pt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new vi(Pt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new vi(Pt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new yi(Pt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})},Cs=function(t){function e(e){t.call(this,e,As)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Ts(t)},e.prototype.queryRadius=function(){return ra(this.paint.get("fill-extrusion-translate"))},e.prototype.is3D=function(){return!0},e.prototype.queryIntersectsFeature=function(t,e,n,r,o,a,s,l){var c=ia(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),u=this.paint.get("fill-extrusion-height").evaluate(e,n),p=this.paint.get("fill-extrusion-base").evaluate(e,n),h=function(t,e,n,r){for(var o=[],a=0,s=t;a<s.length;a+=1){var l=s[a],c=[l.x,l.y,0,1];ha(c,c,e),o.push(new i(c[0]/c[3],c[1]/c[3]))}return o}(c,l),d=function(t,e,n,r){for(var o=[],a=[],s=r[8]*e,l=r[9]*e,c=r[10]*e,u=r[11]*e,p=r[8]*n,h=r[9]*n,d=r[10]*n,f=r[11]*n,m=0,g=t;m<g.length;m+=1){for(var y=[],v=[],_=0,x=g[m];_<x.length;_+=1){var b=x[_],w=b.x,M=b.y,S=r[0]*w+r[4]*M+r[12],T=r[1]*w+r[5]*M+r[13],E=r[2]*w+r[6]*M+r[14],A=r[3]*w+r[7]*M+r[15],C=E+c,L=A+u,P=S+p,I=T+h,R=E+d,k=A+f,z=new i((S+s)/L,(T+l)/L);z.z=C/L,y.push(z);var D=new i(P/k,I/k);D.z=R/k,v.push(D)}o.push(y),a.push(v)}return[o,a]}(r,p,u,l);return function(t,e,n){var r=1/0;Zo(n,e)&&(r=Ps(n,e[0]));for(var i=0;i<e.length;i++)for(var o=e[i],a=t[i],s=0;s<o.length-1;s++){var l=o[s],c=[l,o[s+1],a[s+1],a[s],l];Wo(n,c)&&(r=Math.min(r,Ps(n,c)))}return r!==1/0&&r}(d[0],d[1],h)},e}(Mi);function Ls(t,e){return t.x*e.x+t.y*e.y}function Ps(t,e){if(1===t.length){for(var n,r=0,i=e[r++];!n||i.equals(n);)if(!(n=e[r++]))return 1/0;for(;r<e.length;r++){var o=e[r],a=t[0],s=n.sub(i),l=o.sub(i),c=a.sub(i),u=Ls(s,s),p=Ls(s,l),h=Ls(l,l),d=Ls(c,s),f=Ls(c,l),m=u*h-p*p,g=(h*d-p*f)/m,y=(u*f-p*d)/m,v=i.z*(1-g-y)+n.z*g+o.z*y;if(isFinite(v))return v}return 1/0}for(var _=1/0,x=0,b=e;x<b.length;x+=1)_=Math.min(_,b[x].z);return _}var Is=Ai([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4).members,Rs=Ai([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]).members,ks=bs.VectorTileFeature.types,zs=Math.cos(Math.PI/180*37.5),Ds=Math.pow(2,14)/.5,Os=function(t){var e=this;this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((function(t){e.gradients[t.id]={}})),this.layoutVertexArray=new Ri,this.layoutVertexArray2=new ki,this.indexArray=new Vi,this.programConfigurations=new Oo(t.layers,t.zoom),this.segments=new lo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};Os.prototype.populate=function(t,e,n){this.hasPattern=as("line",this.layers,e);for(var r=this.layers[0].layout.get("line-sort-key"),i=!r.isConstant(),o=[],a=0,s=t;a<s.length;a+=1){var l=s[a],c=l.feature,u=l.id,p=l.index,h=l.sourceLayerIndex,d=this.layers[0]._featureFilter.needGeometry,f=Vo(c,d);if(this.layers[0]._featureFilter.filter(new li(this.zoom),f,n)){var m=i?r.evaluate(f,{},n):void 0,g={id:u,properties:c.properties,type:c.type,sourceLayerIndex:h,index:p,geometry:d?f.geometry:jo(c),patterns:{},sortKey:m};o.push(g)}}i&&o.sort((function(t,e){return t.sortKey-e.sortKey}));for(var y=0,v=o;y<v.length;y+=1){var _=v[y],x=_.geometry,b=_.index,w=_.sourceLayerIndex;if(this.hasPattern){var M=ss("line",this.layers,_,this.zoom,e);this.patternFeatures.push(M)}else this.addFeature(_,x,b,n,{});e.featureIndex.insert(t[b].feature,x,b,w,this.index)}},Os.prototype.update=function(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)},Os.prototype.addFeatures=function(t,e,n){for(var r=0,i=this.patternFeatures;r<i.length;r+=1){var o=i[r];this.addFeature(o,o.geometry,o.index,e,n)}},Os.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Os.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Os.prototype.upload=function(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Rs)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Is),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Os.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Os.prototype.lineFeatureClips=function(t){if(t.properties&&t.properties.hasOwnProperty("mapbox_clip_start")&&t.properties.hasOwnProperty("mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}},Os.prototype.addFeature=function(t,e,n,r,i){var o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),s=o.get("line-cap"),l=o.get("line-miter-limit"),c=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(var u=0,p=e;u<p.length;u+=1)this.addLine(p[u],t,a,s,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,i,r)},Os.prototype.addLine=function(t,e,n,r,i,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(var a=0;a<t.length-1;a++)this.totalDistance+=t[a].dist(t[a+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}for(var s="Polygon"===ks[e.type],l=t.length;l>=2&&t[l-1].equals(t[l-2]);)l--;for(var c=0;c<l-1&&t[c].equals(t[c+1]);)c++;if(!(l<(s?3:2))){"bevel"===n&&(i=1.05);var u,p=this.overscaling<=16?122880/(512*this.overscaling):0,h=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray),d=void 0,f=void 0,m=void 0,g=void 0;this.e1=this.e2=-1,s&&(g=t[c].sub(u=t[l-2])._unit()._perp());for(var y=c;y<l;y++)if(!(f=y===l-1?s?t[c+1]:void 0:t[y+1])||!t[y].equals(f)){g&&(m=g),u&&(d=u),u=t[y],g=f?f.sub(u)._unit()._perp():m;var v=(m=m||g).add(g);0===v.x&&0===v.y||v._unit();var _=m.x*g.x+m.y*g.y,x=v.x*g.x+v.y*g.y,b=0!==x?1/x:1/0,w=2*Math.sqrt(2-2*x),M=x<zs&&d&&f,S=m.x*g.y-m.y*g.x>0;if(M&&y>c){var T=u.dist(d);if(T>2*p){var E=u.sub(u.sub(d)._mult(p/T)._round());this.updateDistance(d,E),this.addCurrentVertex(E,m,0,0,h),d=E}}var A=d&&f,C=A?n:s?"butt":r;if(A&&"round"===C&&(b<o?C="miter":b<=2&&(C="fakeround")),"miter"===C&&b>i&&(C="bevel"),"bevel"===C&&(b>2&&(C="flipbevel"),b<i&&(C="miter")),d&&this.updateDistance(d,u),"miter"===C)v._mult(b),this.addCurrentVertex(u,v,0,0,h);else if("flipbevel"===C){if(b>100)v=g.mult(-1);else{var L=b*m.add(g).mag()/m.sub(g).mag();v._perp()._mult(L*(S?-1:1))}this.addCurrentVertex(u,v,0,0,h),this.addCurrentVertex(u,v.mult(-1),0,0,h)}else if("bevel"===C||"fakeround"===C){var P=-Math.sqrt(b*b-1),I=S?P:0,R=S?0:P;if(d&&this.addCurrentVertex(u,m,I,R,h),"fakeround"===C)for(var k=Math.round(180*w/Math.PI/20),z=1;z<k;z++){var D=z/k;if(.5!==D){var O=D-.5;D+=D*O*(D-1)*((1.0904+_*(_*(3.55645-1.43519*_)-3.2452))*O*O+(.848013+_*(.215638*_-1.06021)))}var F=g.sub(m)._mult(D)._add(m)._unit()._mult(S?-1:1);this.addHalfVertex(u,F.x,F.y,!1,S,0,h)}f&&this.addCurrentVertex(u,g,-I,-R,h)}else if("butt"===C)this.addCurrentVertex(u,v,0,0,h);else if("square"===C){var B=d?1:-1;this.addCurrentVertex(u,v,B,B,h)}else"round"===C&&(d&&(this.addCurrentVertex(u,m,0,0,h),this.addCurrentVertex(u,m,1,1,h,!0)),f&&(this.addCurrentVertex(u,g,-1,-1,h,!0),this.addCurrentVertex(u,g,0,0,h)));if(M&&y<l-1){var N=u.dist(f);if(N>2*p){var U=u.add(f.sub(u)._mult(p/N)._round());this.updateDistance(u,U),this.addCurrentVertex(U,g,0,0,h),u=U}}}}},Os.prototype.addCurrentVertex=function(t,e,n,r,i,o){void 0===o&&(o=!1);var a=e.y*r-e.x,s=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*n,e.y-e.x*n,o,!1,n,i),this.addHalfVertex(t,a,s,o,!0,-r,i),this.distance>Ds/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,n,r,i,o))},Os.prototype.addHalfVertex=function(t,e,n,r,i,o,a){var s=.5*(this.lineClips?this.scaledDistance*(Ds-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t.x<<1)+(r?1:0),(t.y<<1)+(i?1:0),Math.round(63*e)+128,Math.round(63*n)+128,1+(0===o?0:o<0?-1:1)|(63&s)<<2,s>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);var l=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),a.primitiveLength++),i?this.e2=l:this.e1=l},Os.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance},Os.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},Nr("LineBucket",Os,{omit:["layers","patternFeatures"]});var Fs=new wi({"line-cap":new yi(Pt.layout_line["line-cap"]),"line-join":new vi(Pt.layout_line["line-join"]),"line-miter-limit":new yi(Pt.layout_line["line-miter-limit"]),"line-round-limit":new yi(Pt.layout_line["line-round-limit"]),"line-sort-key":new vi(Pt.layout_line["line-sort-key"])}),Bs={paint:new wi({"line-opacity":new vi(Pt.paint_line["line-opacity"]),"line-color":new vi(Pt.paint_line["line-color"]),"line-translate":new yi(Pt.paint_line["line-translate"]),"line-translate-anchor":new yi(Pt.paint_line["line-translate-anchor"]),"line-width":new vi(Pt.paint_line["line-width"]),"line-gap-width":new vi(Pt.paint_line["line-gap-width"]),"line-offset":new vi(Pt.paint_line["line-offset"]),"line-blur":new vi(Pt.paint_line["line-blur"]),"line-dasharray":new xi(Pt.paint_line["line-dasharray"]),"line-pattern":new _i(Pt.paint_line["line-pattern"]),"line-gradient":new bi(Pt.paint_line["line-gradient"])}),layout:Fs},Ns=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,n){return n=new li(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),t.prototype.possiblyEvaluate.call(this,e,n)},e.prototype.evaluate=function(e,n,r,i){return n=h({},n,{zoom:Math.floor(n.zoom)}),t.prototype.evaluate.call(this,e,n,r,i)},e}(vi))(Bs.paint.properties["line-width"].specification);Ns.useIntegerZoom=!0;var Us=function(t){function e(e){t.call(this,e,Bs),this.gradientVersion=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof He,this.gradientVersion=(this.gradientVersion+1)%s)},e.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},e.prototype.recalculate=function(e,n){t.prototype.recalculate.call(this,e,n),this.paint._values["line-floorwidth"]=Ns.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Os(t)},e.prototype.queryRadius=function(t){var e=t,n=js(na("line-width",this,e),na("line-gap-width",this,e)),r=na("line-offset",this,e);return n/2+Math.abs(r)+ra(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,n,r,o,a,s){var l=ia(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),c=s/2*js(this.paint.get("line-width").evaluate(e,n),this.paint.get("line-gap-width").evaluate(e,n)),u=this.paint.get("line-offset").evaluate(e,n);return u&&(r=function(t,e){for(var n=[],r=new i(0,0),o=0;o<t.length;o++){for(var a=t[o],s=[],l=0;l<a.length;l++){var c=a[l],u=a[l+1],p=0===l?r:c.sub(a[l-1])._unit()._perp(),h=l===a.length-1?r:u.sub(c)._unit()._perp(),d=p._add(h)._unit();d._mult(1/(d.x*h.x+d.y*h.y)),s.push(d._mult(e)._add(c))}n.push(s)}return n}(r,u*s)),function(t,e,n){for(var r=0;r<e.length;r++){var i=e[r];if(t.length>=3)for(var o=0;o<i.length;o++)if(ta(t,i[o]))return!0;if(Xo(t,i,n))return!0}return!1}(l,r,c)},e.prototype.isTileClipped=function(){return!0},e}(Mi);function js(t,e){return e>0?e+2*t:t}var Vs=Ai([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Gs=Ai([{name:"a_projected_pos",components:3,type:"Float32"}],4),Hs=(Ai([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Ai([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),Ws=(Ai([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Ai([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),qs=Ai([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Zs(t,e,n){return t.sections.forEach((function(t){t.text=function(t,e,n){var r=e.layout.get("text-transform").evaluate(n,{});return"uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),si.applyArabicShaping&&(t=si.applyArabicShaping(t)),t}(t.text,e,n)})),t}Ai([{name:"triangle",components:3,type:"Uint16"}]),Ai([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Ai([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ai([{type:"Float32",name:"offsetX"}]),Ai([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Xs={"!":"︕","#":"",$:"","%":"","&":"","(":"︵",")":"︶","*":"","+":"",",":"︐","-":"︲",".":"・","/":"",":":"︓",";":"︔","<":"︿","=":"",">":"﹀","?":"︖","@":"","[":"﹇","\\":"","]":"﹈","^":"",_:"︳","`":"","{":"︷","|":"―","}":"︸","~":"","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","":"︲","—":"︱","":"﹃","":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","":"︹","":"︺","〖":"︗","〗":"︘","":"︕","":"︵","":"︶","":"︐","":"︲","":"・","":"︓","":"︔","":"︿","":"﹀","":"︖","":"﹇","":"﹈","_":"︳","":"︷","":"―","":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},$s=function(t,e,n,r,i){var o,a,s=8*i-r-1,l=(1<<s)-1,c=l>>1,u=-7,p=n?i-1:0,h=n?-1:1,d=t[e+p];for(p+=h,o=d&(1<<-u)-1,d>>=-u,u+=s;u>0;o=256*o+t[e+p],p+=h,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+t[e+p],p+=h,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},Js=function(t,e,n,r,i,o){var a,s,l,c=8*o-i-1,u=(1<<c)-1,p=u>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,f=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+p>=1?h/l:h*Math.pow(2,1-p))*l>=2&&(a++,l/=2),a+p>=u?(s=0,a=u):a+p>=1?(s=(e*l-1)*Math.pow(2,i),a+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[n+d]=255&s,d+=f,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[n+d]=255&a,d+=f,a/=256,c-=8);t[n+d-f]|=128*m},Ys=Qs;function Qs(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Qs.Varint=0,Qs.Fixed64=1,Qs.Bytes=2,Qs.Fixed32=5;var Ks="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function tl(t){return t.type===Qs.Bytes?t.readVarint()+t.pos:t.pos+1}function el(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function nl(t,e,n){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=t;i--)n.buf[i+r]=n.buf[i]}function rl(t,e){for(var n=0;n<t.length;n++)e.writeVarint(t[n])}function il(t,e){for(var n=0;n<t.length;n++)e.writeSVarint(t[n])}function ol(t,e){for(var n=0;n<t.length;n++)e.writeFloat(t[n])}function al(t,e){for(var n=0;n<t.length;n++)e.writeDouble(t[n])}function sl(t,e){for(var n=0;n<t.length;n++)e.writeBoolean(t[n])}function ll(t,e){for(var n=0;n<t.length;n++)e.writeFixed32(t[n])}function cl(t,e){for(var n=0;n<t.length;n++)e.writeSFixed32(t[n])}function ul(t,e){for(var n=0;n<t.length;n++)e.writeFixed64(t[n])}function pl(t,e){for(var n=0;n<t.length;n++)e.writeSFixed64(t[n])}function hl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function dl(t,e,n){t[n]=e,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function fl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function ml(t,e,n){1===t&&n.readMessage(gl,e)}function gl(t,e,n){if(3===t){var r=n.readMessage(yl,{}),i=r.width,o=r.height,a=r.left,s=r.top,l=r.advance;e.push({id:r.id,bitmap:new _a({width:i+6,height:o+6},r.bitmap),metrics:{width:i,height:o,left:a,top:s,advance:l}})}}function yl(t,e,n){1===t?e.id=n.readVarint():2===t?e.bitmap=n.readBytes():3===t?e.width=n.readVarint():4===t?e.height=n.readVarint():5===t?e.left=n.readSVarint():6===t?e.top=n.readSVarint():7===t&&(e.advance=n.readVarint())}function vl(t){for(var e=0,n=0,r=0,i=t;r<i.length;r+=1){var o=i[r];e+=o.w*o.h,n=Math.max(n,o.w)}t.sort((function(t,e){return e.h-t.h}));for(var a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}],s=0,l=0,c=0,u=t;c<u.length;c+=1)for(var p=u[c],h=a.length-1;h>=0;h--){var d=a[h];if(!(p.w>d.w||p.h>d.h)){if(p.x=d.x,p.y=d.y,l=Math.max(l,p.y+p.h),s=Math.max(s,p.x+p.w),p.w===d.w&&p.h===d.h){var f=a.pop();h<a.length&&(a[h]=f)}else p.h===d.h?(d.x+=p.w,d.w-=p.w):p.w===d.w?(d.y+=p.h,d.h-=p.h):(a.push({x:d.x+p.w,y:d.y,w:d.w-p.w,h:p.h}),d.y+=p.h,d.h-=p.h);break}}return{w:s,h:l,fill:e/(s*l)||0}}Qs.prototype={destroy:function(){this.buf=null},readFields:function(t,e,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=7&r,t(i,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=hl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=fl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=hl(this.buf,this.pos)+4294967296*hl(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=hl(this.buf,this.pos)+4294967296*fl(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=$s(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=$s(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,n,r=this.buf;return e=127&(n=r[this.pos++]),n<128?e:(e|=(127&(n=r[this.pos++]))<<7,n<128?e:(e|=(127&(n=r[this.pos++]))<<14,n<128?e:(e|=(127&(n=r[this.pos++]))<<21,n<128?e:function(t,e,n){var r,i,o=n.buf;if(r=(112&(i=o[n.pos++]))>>4,i<128)return el(t,r,e);if(r|=(127&(i=o[n.pos++]))<<3,i<128)return el(t,r,e);if(r|=(127&(i=o[n.pos++]))<<10,i<128)return el(t,r,e);if(r|=(127&(i=o[n.pos++]))<<17,i<128)return el(t,r,e);if(r|=(127&(i=o[n.pos++]))<<24,i<128)return el(t,r,e);if(r|=(1&(i=o[n.pos++]))<<31,i<128)return el(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ks?function(t,e,n){return Ks.decode(t.subarray(e,n))}(this.buf,e,t):function(t,e,n){for(var r="",i=e;i<n;){var o,a,s,l=t[i],c=null,u=l>239?4:l>223?3:l>191?2:1;if(i+u>n)break;1===u?l<128&&(c=l):2===u?128==(192&(o=t[i+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(a=t[i+2],128==(192&(o=t[i+1]))&&128==(192&a)&&((c=(15&l)<<12|(63&o)<<6|63&a)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(a=t[i+2],s=t[i+3],128==(192&(o=t[i+1]))&&128==(192&a)&&128==(192&s)&&((c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),i+=u}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Qs.Bytes)return t.push(this.readVarint(e));var n=tl(this);for(t=t||[];this.pos<n;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Qs.Bytes)return t.push(this.readSVarint());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Qs.Bytes)return t.push(this.readBoolean());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Qs.Bytes)return t.push(this.readFloat());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Qs.Bytes)return t.push(this.readDouble());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Qs.Bytes)return t.push(this.readFixed32());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Qs.Bytes)return t.push(this.readSFixed32());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Qs.Bytes)return t.push(this.readFixed64());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Qs.Bytes)return t.push(this.readSFixed64());var e=tl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Qs.Varint)for(;this.buf[this.pos++]>127;);else if(e===Qs.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Qs.Fixed32)this.pos+=4;else{if(e!==Qs.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var n=new Uint8Array(e);n.set(this.buf),this.buf=n,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),dl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),dl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),dl(this.buf,-1&t,this.pos),dl(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),dl(this.buf,-1&t,this.pos),dl(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var n,r;if(t>=0?(n=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,n.buf[n.pos]=127&(t>>>=7)}(n,0,e),function(t,e){var n=(7&t)<<4;e.buf[e.pos++]|=n|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,n){for(var r,i,o=0;o<e.length;o++){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){r>56319||o+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):i=r;continue}if(r<56320){t[n++]=239,t[n++]=191,t[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[n++]=239,t[n++]=191,t[n++]=189,i=null);r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:(r<65536?t[n++]=r>>12|224:(t[n++]=r>>18|240,t[n++]=r>>12&63|128),t[n++]=r>>6&63|128),t[n++]=63&r|128)}return n}(this.buf,t,this.pos);var n=this.pos-e;n>=128&&nl(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),Js(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Js(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n<e;n++)this.buf[this.pos++]=t[n]},writeRawMessage:function(t,e){this.pos++;var n=this.pos;t(e,this);var r=this.pos-n;r>=128&&nl(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,Qs.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,il,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,sl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,ol,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,al,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ll,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,cl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,ul,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,pl,e)},writeBytesField:function(t,e){this.writeTag(t,Qs.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Qs.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Qs.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Qs.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Qs.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Qs.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Qs.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Qs.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Qs.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Qs.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var _l=function(t,e){var n=e.pixelRatio,r=e.version,i=e.stretchX,o=e.stretchY,a=e.content;this.paddedRect=t,this.pixelRatio=n,this.stretchX=i,this.stretchY=o,this.content=a,this.version=r},xl={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};xl.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},xl.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},xl.tlbr.get=function(){return this.tl.concat(this.br)},xl.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(_l.prototype,xl);var bl=function(t,e){var n={},r={};this.haveRenderCallbacks=[];var i=[];this.addImages(t,n,i),this.addImages(e,r,i);var o=vl(i),a=new xa({width:o.w||1,height:o.h||1});for(var s in t){var l=t[s],c=n[s].paddedRect;xa.copy(l.data,a,{x:0,y:0},{x:c.x+1,y:c.y+1},l.data)}for(var u in e){var p=e[u],h=r[u].paddedRect,d=h.x+1,f=h.y+1,m=p.data.width,g=p.data.height;xa.copy(p.data,a,{x:0,y:0},{x:d,y:f},p.data),xa.copy(p.data,a,{x:0,y:g-1},{x:d,y:f-1},{width:m,height:1}),xa.copy(p.data,a,{x:0,y:0},{x:d,y:f+g},{width:m,height:1}),xa.copy(p.data,a,{x:m-1,y:0},{x:d-1,y:f},{width:1,height:g}),xa.copy(p.data,a,{x:0,y:0},{x:d+m,y:f},{width:1,height:g})}this.image=a,this.iconPositions=n,this.patternPositions=r};bl.prototype.addImages=function(t,e,n){for(var r in t){var i=t[r],o={x:0,y:0,w:i.data.width+2,h:i.data.height+2};n.push(o),e[r]=new _l(o,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(r)}},bl.prototype.patchUpdatedImages=function(t,e){for(var n in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[n],t.getImage(n),e),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n),e)},bl.prototype.patchUpdatedImage=function(t,e,n){if(t&&e&&t.version!==e.version){t.version=e.version;var r=t.tl;n.update(e.data,void 0,{x:r[0],y:r[1]})}},Nr("ImagePosition",_l),Nr("ImageAtlas",bl);var wl={horizontal:1,vertical:2,horizontalOnly:3},Ml=function(){this.scale=1,this.fontStack="",this.imageName=null};Ml.forText=function(t,e){var n=new Ml;return n.scale=t||1,n.fontStack=e,n},Ml.forImage=function(t){var e=new Ml;return e.imageName=t,e};var Sl=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function Tl(t,e,n,r,i,o,a,s,l,c,u,p,h,d,f,m){var g,y=Sl.fromFeature(t,i);p===wl.vertical&&y.verticalizePunctuation();var v=si.processBidirectionalText,_=si.processStyledBidirectionalText;if(v&&1===y.sections.length){g=[];for(var x=0,b=v(y.toString(),Rl(y,c,o,e,r,d,f));x<b.length;x+=1){var w=b[x],M=new Sl;M.text=w,M.sections=y.sections;for(var S=0;S<w.length;S++)M.sectionIndex.push(0);g.push(M)}}else if(_){g=[];for(var T=0,E=_(y.text,y.sectionIndex,Rl(y,c,o,e,r,d,f));T<E.length;T+=1){var A=E[T],C=new Sl;C.text=A[0],C.sectionIndex=A[1],C.sections=y.sections,g.push(C)}}else g=function(t,e){for(var n=[],r=t.text,i=0,o=0,a=e;o<a.length;o+=1){var s=a[o];n.push(t.substring(i,s)),i=s}return i<r.length&&n.push(t.substring(i,r.length)),n}(y,Rl(y,c,o,e,r,d,f));var L=[],P={positionedLines:L,text:y.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(t,e,n,r,i,o,a,s,l,c,u,p){for(var h=0,d=-17,f=0,m=0,g="right"===s?1:"left"===s?0:.5,y=0,v=0,_=i;v<_.length;v+=1){var x=_[v];x.trim();var b=x.getMaxScale(),w=24*(b-1),M={positionedGlyphs:[],lineOffset:0};t.positionedLines[y]=M;var S=M.positionedGlyphs,T=0;if(x.length()){for(var E=0;E<x.length();E++){var A=x.getSection(E),C=x.getSectionIndex(E),L=x.getCharCode(E),P=0,I=null,R=null,k=null,z=24,D=!(l===wl.horizontal||!u&&!Xr(L)||u&&(El[L]||(H=L,qr.Arabic(H)||qr["Arabic Supplement"](H)||qr["Arabic Extended-A"](H)||qr["Arabic Presentation Forms-A"](H)||qr["Arabic Presentation Forms-B"](H))));if(A.imageName){var O=r[A.imageName];if(!O)continue;k=A.imageName,t.iconsInText=t.iconsInText||!0,R=O.paddedRect;var F=O.displaySize;A.scale=24*A.scale/p,P=w+(24-F[1]*A.scale),z=(I={width:F[0],height:F[1],left:1,top:-3,advance:D?F[1]:F[0]}).advance;var B=D?F[0]*A.scale-24*b:F[1]*A.scale-24*b;B>0&&B>T&&(T=B)}else{var N=n[A.fontStack],U=N&&N[L];if(U&&U.rect)R=U.rect,I=U.metrics;else{var j=e[A.fontStack],V=j&&j[L];if(!V)continue;I=V.metrics}P=24*(b-A.scale)}D?(t.verticalizable=!0,S.push({glyph:L,imageName:k,x:h,y:d+P,vertical:D,scale:A.scale,fontStack:A.fontStack,sectionIndex:C,metrics:I,rect:R}),h+=z*A.scale+c):(S.push({glyph:L,imageName:k,x:h,y:d+P,vertical:D,scale:A.scale,fontStack:A.fontStack,sectionIndex:C,metrics:I,rect:R}),h+=I.advance*A.scale+c)}0!==S.length&&(f=Math.max(h-c,f),zl(S,0,S.length-1,g,T)),h=0;var G=o*b+T;M.lineOffset=Math.max(T,w),d+=G,m=Math.max(G,m),++y}else d+=o,++y}var H,W=d- -17,q=kl(a),Z=q.horizontalAlign,X=q.verticalAlign;(function(t,e,n,r,i,o,a,s,l){var c,u=(e-n)*i;c=o!==a?-s*r- -17:(-r*l+.5)*a;for(var p=0,h=t;p<h.length;p+=1)for(var d=0,f=h[p].positionedGlyphs;d<f.length;d+=1){var m=f[d];m.x+=u,m.y+=c}})(t.positionedLines,g,Z,X,f,m,o,W,i.length),t.top+=-X*W,t.bottom=t.top+W,t.left+=-Z*f,t.right=t.left+f}(P,e,n,r,g,a,s,l,p,c,h,m),!function(t){for(var e=0,n=t;e<n.length;e+=1)if(0!==n[e].positionedGlyphs.length)return!1;return!0}(L)&&P}Sl.fromFeature=function(t,e){for(var n=new Sl,r=0;r<t.sections.length;r++){var i=t.sections[r];i.image?n.addImageSection(i):n.addTextSection(i,e)}return n},Sl.prototype.length=function(){return this.text.length},Sl.prototype.getSection=function(t){return this.sections[this.sectionIndex[t]]},Sl.prototype.getSectionIndex=function(t){return this.sectionIndex[t]},Sl.prototype.getCharCode=function(t){return this.text.charCodeAt(t)},Sl.prototype.verticalizePunctuation=function(){this.text=function(t){for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n+1)||null,i=t.charCodeAt(n-1)||null;e+=r&&$r(r)&&!Xs[t[n+1]]||i&&$r(i)&&!Xs[t[n-1]]||!Xs[t[n]]?t[n]:Xs[t[n]]}return e}(this.text)},Sl.prototype.trim=function(){for(var t=0,e=0;e<this.text.length&&El[this.text.charCodeAt(e)];e++)t++;for(var n=this.text.length,r=this.text.length-1;r>=0&&r>=t&&El[this.text.charCodeAt(r)];r--)n--;this.text=this.text.substring(t,n),this.sectionIndex=this.sectionIndex.slice(t,n)},Sl.prototype.substring=function(t,e){var n=new Sl;return n.text=this.text.substring(t,e),n.sectionIndex=this.sectionIndex.slice(t,e),n.sections=this.sections,n},Sl.prototype.toString=function(){return this.text},Sl.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,n){return Math.max(e,t.sections[n].scale)}),0)},Sl.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(Ml.forText(t.scale,t.fontStack||e));for(var n=this.sections.length-1,r=0;r<t.text.length;++r)this.sectionIndex.push(n)},Sl.prototype.addImageSection=function(t){var e=t.image?t.image.name:"";if(0!==e.length){var n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(Ml.forImage(e)),this.sectionIndex.push(this.sections.length-1)):M("Reached maximum number of images 6401")}else M("Can't add FormattedSection with an empty image.")},Sl.prototype.getNextImageSectionCharCode=function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var El={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Al={};function Cl(t,e,n,r,i,o){if(e.imageName){var a=r[e.imageName];return a?a.displaySize[0]*e.scale*24/o+i:0}var s=n[e.fontStack],l=s&&s[t];return l?l.metrics.advance*e.scale+i:0}function Ll(t,e,n,r){var i=Math.pow(t-e,2);return r?t<e?i/2:2*i:i+Math.abs(n)*n}function Pl(t,e,n){var r=0;return 10===t&&(r-=1e4),n&&(r+=150),40!==t&&65288!==t||(r+=50),41!==e&&65289!==e||(r+=50),r}function Il(t,e,n,r,i,o){for(var a=null,s=Ll(e,n,i,o),l=0,c=r;l<c.length;l+=1){var u=c[l],p=Ll(e-u.x,n,i,o)+u.badness;p<=s&&(a=u,s=p)}return{index:t,x:e,priorBreak:a,badness:s}}function Rl(t,e,n,r,i,o,a){if("point"!==o)return[];if(!t)return[];for(var s,l=[],c=function(t,e,n,r,i,o){for(var a=0,s=0;s<t.length();s++){var l=t.getSection(s);a+=Cl(t.getCharCode(s),l,r,i,e,o)}return a/Math.max(1,Math.ceil(a/n))}(t,e,n,r,i,a),u=t.text.indexOf("")>=0,p=0,h=0;h<t.length();h++){var d=t.getSection(h),f=t.getCharCode(h);if(El[f]||(p+=Cl(f,d,r,i,e,a)),h<t.length()-1){var m=!((s=f)<11904||!(qr["Bopomofo Extended"](s)||qr.Bopomofo(s)||qr["CJK Compatibility Forms"](s)||qr["CJK Compatibility Ideographs"](s)||qr["CJK Compatibility"](s)||qr["CJK Radicals Supplement"](s)||qr["CJK Strokes"](s)||qr["CJK Symbols and Punctuation"](s)||qr["CJK Unified Ideographs Extension A"](s)||qr["CJK Unified Ideographs"](s)||qr["Enclosed CJK Letters and Months"](s)||qr["Halfwidth and Fullwidth Forms"](s)||qr.Hiragana(s)||qr["Ideographic Description Characters"](s)||qr["Kangxi Radicals"](s)||qr["Katakana Phonetic Extensions"](s)||qr.Katakana(s)||qr["Vertical Forms"](s)||qr["Yi Radicals"](s)||qr["Yi Syllables"](s)));(Al[f]||m||d.imageName)&&l.push(Il(h+1,p,c,l,Pl(f,t.getCharCode(h+1),m&&u),!1))}}return function t(e){return e?t(e.priorBreak).concat(e.index):[]}(Il(t.length(),p,c,l,0,!0))}function kl(t){var e=.5,n=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:e,verticalAlign:n}}function zl(t,e,n,r,i){if(r||i)for(var o=t[n],a=(t[n].x+o.metrics.advance*o.scale)*r,s=e;s<=n;s++)t[s].x-=a,t[s].y+=i}function Dl(t,e,n,r,i,o){var a,s=t.image;if(s.content){var l=s.content,c=s.pixelRatio||1;a=[l[0]/c,l[1]/c,s.displaySize[0]-l[2]/c,s.displaySize[1]-l[3]/c]}var u,p,h,d,f=e.left*o,m=e.right*o;"width"===n||"both"===n?(d=i[0]+f-r[3],p=i[0]+m+r[1]):p=(d=i[0]+(f+m-s.displaySize[0])/2)+s.displaySize[0];var g=e.top*o,y=e.bottom*o;return"height"===n||"both"===n?(u=i[1]+g-r[0],h=i[1]+y+r[2]):h=(u=i[1]+(g+y-s.displaySize[1])/2)+s.displaySize[1],{image:s,top:u,right:p,bottom:h,left:d,collisionPadding:a}}Al[10]=!0,Al[32]=!0,Al[38]=!0,Al[40]=!0,Al[41]=!0,Al[43]=!0,Al[45]=!0,Al[47]=!0,Al[173]=!0,Al[183]=!0,Al[8203]=!0,Al[8208]=!0,Al[8211]=!0,Al[8231]=!0;var Ol=function(t){function e(e,n,r,i){t.call(this,e,n),this.angle=r,void 0!==i&&(this.segment=i)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(i);function Fl(t,e){var n=e.expression;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new li(t+1))};if("source"===n.kind)return{kind:"source"};for(var r=n.zoomStops,i=n.interpolationType,o=0;o<r.length&&r[o]<=t;)o++;for(var a=o=Math.max(0,o-1);a<r.length&&r[a]<t+1;)a++;a=Math.min(r.length-1,a);var s=r[o],l=r[a];return"composite"===n.kind?{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i}:{kind:"camera",minZoom:s,maxZoom:l,minSize:n.evaluate(new li(s)),maxSize:n.evaluate(new li(l)),interpolationType:i}}function Bl(t,e,n){var r=e.uSize,i=n.lowerSize;return"source"===t.kind?i/128:"composite"===t.kind?We(i/128,n.upperSize/128,e.uSizeT):r}function Nl(t,e){var n=0,r=0;if("constant"===t.kind)r=t.layoutSize;else if("source"!==t.kind){var i=t.interpolationType,o=i?u(sn.interpolationFactor(i,e,t.minZoom,t.maxZoom),0,1):0;"camera"===t.kind?r=We(t.minSize,t.maxSize,o):n=o}return{uSizeT:n,uSize:r}}Nr("Anchor",Ol);var Ul=Object.freeze({__proto__:null,getSizeData:Fl,evaluateSizeForFeature:Bl,evaluateSizeForZoom:Nl,SIZE_PACK_FACTOR:128});function jl(t,e,n,r,i){if(void 0===e.segment)return!0;for(var o=e,a=e.segment+1,s=0;s>-n/2;){if(--a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],c=0;s<n/2;){var u=t[a],p=t[a+1];if(!p)return!1;var h=t[a-1].angleTo(u)-u.angleTo(p);for(h=Math.abs((h+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:h}),c+=h;s-l[0].distance>r;)c-=l.shift().angleDelta;if(c>i)return!1;a++,s+=u.dist(p)}return!0}function Vl(t){for(var e=0,n=0;n<t.length-1;n++)e+=t[n].dist(t[n+1]);return e}function Gl(t,e,n){return t?.6*e*n:0}function Hl(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Wl(t,e,n,r,i,o){for(var a=Gl(n,i,o),s=Hl(n,r)*o,l=0,c=Vl(t)/2,u=0;u<t.length-1;u++){var p=t[u],h=t[u+1],d=p.dist(h);if(l+d>c){var f=(c-l)/d,m=We(p.x,h.x,f),g=We(p.y,h.y,f),y=new Ol(m,g,h.angleTo(p),u);return y._round(),!a||jl(t,y,s,a,e)?y:void 0}l+=d}}function ql(t,e,n,r,i,o,a,s,l){var c=Gl(r,o,a),u=Hl(r,i),p=u*a,h=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-p<e/4&&(e=p+e/4),function t(e,n,r,i,o,a,s,l,c){for(var u=a/2,p=Vl(e),h=0,d=n-r,f=[],m=0;m<e.length-1;m++){for(var g=e[m],y=e[m+1],v=g.dist(y),_=y.angleTo(g);d+r<h+v;){var x=((d+=r)-h)/v,b=We(g.x,y.x,x),w=We(g.y,y.y,x);if(b>=0&&b<c&&w>=0&&w<c&&d-u>=0&&d+u<=p){var M=new Ol(b,w,_,m);M._round(),i&&!jl(e,M,a,i,o)||f.push(M)}}h+=v}return l||f.length||s||(f=t(e,h/2,r,i,o,a,s,!0,c)),f}(t,h?e/2*s%e:(u/2+2*o)*a*s%e,e,c,n,p,h,!1,l)}function Zl(t,e,n,r,o){for(var a=[],s=0;s<t.length;s++)for(var l=t[s],c=void 0,u=0;u<l.length-1;u++){var p=l[u],h=l[u+1];p.x<e&&h.x<e||(p.x<e?p=new i(e,p.y+(e-p.x)/(h.x-p.x)*(h.y-p.y))._round():h.x<e&&(h=new i(e,p.y+(e-p.x)/(h.x-p.x)*(h.y-p.y))._round()),p.y<n&&h.y<n||(p.y<n?p=new i(p.x+(n-p.y)/(h.y-p.y)*(h.x-p.x),n)._round():h.y<n&&(h=new i(p.x+(n-p.y)/(h.y-p.y)*(h.x-p.x),n)._round()),p.x>=r&&h.x>=r||(p.x>=r?p=new i(r,p.y+(r-p.x)/(h.x-p.x)*(h.y-p.y))._round():h.x>=r&&(h=new i(r,p.y+(r-p.x)/(h.x-p.x)*(h.y-p.y))._round()),p.y>=o&&h.y>=o||(p.y>=o?p=new i(p.x+(o-p.y)/(h.y-p.y)*(h.x-p.x),o)._round():h.y>=o&&(h=new i(p.x+(o-p.y)/(h.y-p.y)*(h.x-p.x),o)._round()),c&&p.equals(c[c.length-1])||a.push(c=[p]),c.push(h)))))}return a}function Xl(t,e,n,r){var o=[],a=t.image,s=a.pixelRatio,l=a.paddedRect.w-2,c=a.paddedRect.h-2,u=t.right-t.left,p=t.bottom-t.top,h=a.stretchX||[[0,l]],d=a.stretchY||[[0,c]],f=function(t,e){return t+e[1]-e[0]},m=h.reduce(f,0),g=d.reduce(f,0),y=l-m,v=c-g,_=0,x=m,b=0,w=g,M=0,S=y,T=0,E=v;if(a.content&&r){var A=a.content;_=$l(h,0,A[0]),b=$l(d,0,A[1]),x=$l(h,A[0],A[2]),w=$l(d,A[1],A[3]),M=A[0]-_,T=A[1]-b,S=A[2]-A[0]-x,E=A[3]-A[1]-w}var C=function(r,o,l,c){var h=Yl(r.stretch-_,x,u,t.left),d=Ql(r.fixed-M,S,r.stretch,m),f=Yl(o.stretch-b,w,p,t.top),y=Ql(o.fixed-T,E,o.stretch,g),v=Yl(l.stretch-_,x,u,t.left),A=Ql(l.fixed-M,S,l.stretch,m),C=Yl(c.stretch-b,w,p,t.top),L=Ql(c.fixed-T,E,c.stretch,g),P=new i(h,f),I=new i(v,f),R=new i(v,C),k=new i(h,C),z=new i(d/s,y/s),D=new i(A/s,L/s),O=e*Math.PI/180;if(O){var F=Math.sin(O),B=Math.cos(O),N=[B,-F,F,B];P._matMult(N),I._matMult(N),k._matMult(N),R._matMult(N)}var U=r.stretch+r.fixed,j=o.stretch+o.fixed;return{tl:P,tr:I,bl:k,br:R,tex:{x:a.paddedRect.x+1+U,y:a.paddedRect.y+1+j,w:l.stretch+l.fixed-U,h:c.stretch+c.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:z,pixelOffsetBR:D,minFontScaleX:S/s/u,minFontScaleY:E/s/p,isSDF:n}};if(r&&(a.stretchX||a.stretchY))for(var L=Jl(h,y,m),P=Jl(d,v,g),I=0;I<L.length-1;I++)for(var R=L[I],k=L[I+1],z=0;z<P.length-1;z++)o.push(C(R,P[z],k,P[z+1]));else o.push(C({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}function $l(t,e,n){for(var r=0,i=0,o=t;i<o.length;i+=1){var a=o[i];r+=Math.max(e,Math.min(n,a[1]))-Math.max(e,Math.min(n,a[0]))}return r}function Jl(t,e,n){for(var r=[{fixed:-1,stretch:0}],i=0,o=t;i<o.length;i+=1){var a=o[i],s=a[0],l=a[1],c=r[r.length-1];r.push({fixed:s-c.stretch,stretch:c.stretch}),r.push({fixed:s-c.stretch,stretch:c.stretch+(l-s)})}return r.push({fixed:e+1,stretch:n}),r}function Yl(t,e,n,r){return t/e*n+r}function Ql(t,e,n,r){return t-e*n/r}var Kl=function(t,e,n,r,o,a,s,l,c,u){if(this.boxStartIndex=t.length,c){var p=a.top,h=a.bottom,d=a.collisionPadding;d&&(p-=d[1],h+=d[3]);var f=h-p;f>0&&(f=Math.max(10,f),this.circleDiameter=f)}else{var m=a.top*s-l,g=a.bottom*s+l,y=a.left*s-l,v=a.right*s+l,_=a.collisionPadding;if(_&&(y-=_[0]*s,m-=_[1]*s,v+=_[2]*s,g+=_[3]*s),u){var x=new i(y,m),b=new i(v,m),w=new i(y,g),M=new i(v,g),S=u*Math.PI/180;x._rotate(S),b._rotate(S),w._rotate(S),M._rotate(S),y=Math.min(x.x,b.x,w.x,M.x),v=Math.max(x.x,b.x,w.x,M.x),m=Math.min(x.y,b.y,w.y,M.y),g=Math.max(x.y,b.y,w.y,M.y)}t.emplaceBack(e.x,e.y,y,m,v,g,n,r,o)}this.boxEndIndex=t.length},tc=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=ec),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var n=(this.length>>1)-1;n>=0;n--)this._down(n)};function ec(t,e){return t<e?-1:t>e?1:0}function nc(t,e,n){void 0===e&&(e=1),void 0===n&&(n=!1);for(var r=1/0,o=1/0,a=-1/0,s=-1/0,l=t[0],c=0;c<l.length;c++){var u=l[c];(!c||u.x<r)&&(r=u.x),(!c||u.y<o)&&(o=u.y),(!c||u.x>a)&&(a=u.x),(!c||u.y>s)&&(s=u.y)}var p=Math.min(a-r,s-o),h=p/2,d=new tc([],rc);if(0===p)return new i(r,o);for(var f=r;f<a;f+=p)for(var m=o;m<s;m+=p)d.push(new ic(f+h,m+h,h,t));for(var g=function(t){for(var e=0,n=0,r=0,i=t[0],o=0,a=i.length,s=a-1;o<a;s=o++){var l=i[o],c=i[s],u=l.x*c.y-c.x*l.y;n+=(l.x+c.x)*u,r+=(l.y+c.y)*u,e+=3*u}return new ic(n/e,r/e,0,t)}(t),y=d.length;d.length;){var v=d.pop();(v.d>g.d||!g.d)&&(g=v,n&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,y)),v.max-g.d<=e||(d.push(new ic(v.p.x-(h=v.h/2),v.p.y-h,h,t)),d.push(new ic(v.p.x+h,v.p.y-h,h,t)),d.push(new ic(v.p.x-h,v.p.y+h,h,t)),d.push(new ic(v.p.x+h,v.p.y+h,h,t)),y+=4)}return n&&(console.log("num probes: "+y),console.log("best distance: "+g.d)),g.p}function rc(t,e){return e.max-t.max}function ic(t,e,n,r){this.p=new i(t,e),this.h=n,this.d=function(t,e){for(var n=!1,r=1/0,i=0;i<e.length;i++)for(var o=e[i],a=0,s=o.length,l=s-1;a<s;l=a++){var c=o[a],u=o[l];c.y>t.y!=u.y>t.y&&t.x<(u.x-c.x)*(t.y-c.y)/(u.y-c.y)+c.x&&(n=!n),r=Math.min(r,Qo(t,c,u))}return(n?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}tc.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},tc.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},tc.prototype.peek=function(){return this.data[0]},tc.prototype._up=function(t){for(var e=this.data,n=this.compare,r=e[t];t>0;){var i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r},tc.prototype._down=function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t<r;){var o=1+(t<<1),a=e[o],s=o+1;if(s<this.length&&n(e[s],a)<0&&(o=s,a=e[s]),n(a,i)>=0)break;e[t]=a,t=o}e[t]=i};var oc=Number.POSITIVE_INFINITY;function ac(t,e){return e[1]!==oc?function(t,e,n){var r=0,i=0;switch(e=Math.abs(e),n=Math.abs(n),t){case"top-right":case"top-left":case"top":i=n-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-n}switch(t){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}return[r,i]}(t,e[0],e[1]):function(t,e){var n=0,r=0;e<0&&(e=0);var i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":r=i-7;break;case"bottom-right":case"bottom-left":r=7-i;break;case"bottom":r=7-e;break;case"top":r=e-7}switch(t){case"top-right":case"bottom-right":n=-i;break;case"top-left":case"bottom-left":n=i;break;case"left":n=e;break;case"right":n=-e}return[n,r]}(t,e[0])}function sc(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function lc(t,e,n,r,o,a,s,l,c,u,p,h,d,f,m){var g=function(t,e,n,r,o,a,s,l){for(var c=r.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[],p=0,h=e.positionedLines;p<h.length;p+=1)for(var d=h[p],f=0,m=d.positionedGlyphs;f<m.length;f+=1){var g=m[f];if(g.rect){var y=g.rect||{},v=4,_=!0,x=1,b=0,w=(o||l)&&g.vertical,M=g.metrics.advance*g.scale/2;if(l&&e.verticalizable&&(b=d.lineOffset/2-(g.imageName?-(24-g.metrics.width*g.scale)/2:24*(g.scale-1))),g.imageName){var S=s[g.imageName];_=S.sdf,v=1/(x=S.pixelRatio)}var T=o?[g.x+M,g.y]:[0,0],E=o?[0,0]:[g.x+M+n[0],g.y+n[1]-b],A=[0,0];w&&(A=E,E=[0,0]);var C=(g.metrics.left-v)*g.scale-M+E[0],L=(-g.metrics.top-v)*g.scale+E[1],P=C+y.w*g.scale/x,I=L+y.h*g.scale/x,R=new i(C,L),k=new i(P,L),z=new i(C,I),D=new i(P,I);if(w){var O=new i(-M,M- -17),F=-Math.PI/2,B=12-M,N=new i(22-B,-(g.imageName?B:0)),U=new(Function.prototype.bind.apply(i,[null].concat(A)));R._rotateAround(F,O)._add(N)._add(U),k._rotateAround(F,O)._add(N)._add(U),z._rotateAround(F,O)._add(N)._add(U),D._rotateAround(F,O)._add(N)._add(U)}if(c){var j=Math.sin(c),V=Math.cos(c),G=[V,-j,j,V];R._matMult(G),k._matMult(G),z._matMult(G),D._matMult(G)}var H=new i(0,0),W=new i(0,0);u.push({tl:R,tr:k,bl:z,br:D,tex:y,writingMode:e.writingMode,glyphOffset:T,sectionIndex:g.sectionIndex,isSDF:_,pixelOffsetTL:H,pixelOffsetBR:W,minFontScaleX:0,minFontScaleY:0})}}return u}(0,n,l,o,a,s,r,t.allowVerticalPlacement),y=t.textSizeData,v=null;"source"===y.kind?(v=[128*o.layout.get("text-size").evaluate(s,{})])[0]>32640&&M(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===y.kind&&((v=[128*f.compositeTextSizes[0].evaluate(s,{},m),128*f.compositeTextSizes[1].evaluate(s,{},m)])[0]>32640||v[1]>32640)&&M(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,g,v,l,a,s,u,e,c.lineStartIndex,c.lineLength,d,m);for(var _=0,x=p;_<x.length;_+=1)h[x[_]]=t.text.placedSymbolArray.length-1;return 4*g.length}function cc(t){for(var e in t)return t[e];return null}function uc(t,e,n,r){var i=t.compareText;if(e in i){for(var o=i[e],a=o.length-1;a>=0;a--)if(r.dist(o[a])<n)return!0}else i[e]=[];return i[e].push(r),!1}var pc=bs.VectorTileFeature.types,hc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function dc(t,e,n,r,i,o,a,s,l,c,u,p,h){var d=s?Math.min(32640,Math.round(s[0])):0,f=s?Math.min(32640,Math.round(s[1])):0;t.emplaceBack(e,n,Math.round(32*r),Math.round(32*i),o,a,(d<<1)+(l?1:0),f,16*c,16*u,256*p,256*h)}function fc(t,e,n){t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n)}function mc(t){for(var e=0,n=t.sections;e<n.length;e+=1)if(Qr(n[e].text))return!0;return!1}var gc=function(t){this.layoutVertexArray=new Di,this.indexArray=new Vi,this.programConfigurations=t,this.segments=new lo,this.dynamicLayoutVertexArray=new Oi,this.opacityVertexArray=new Fi,this.placedSymbolArray=new to};gc.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length},gc.prototype.upload=function(t,e,n,r){this.isEmpty()||(n&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Vs.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Gs.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,hc,!0),this.opacityVertexBuffer.itemSize=1),(n||r)&&this.programConfigurations.upload(t))},gc.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},Nr("SymbolBuffers",gc);var yc=function(t,e,n){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new n,this.segments=new lo,this.collisionVertexArray=new ji};yc.prototype.upload=function(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Hs.members,!0)},yc.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},Nr("CollisionBuffers",yc);var vc=function(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=la([]),this.placementViewportMatrix=la([]);var e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Fl(this.zoom,e["text-size"]),this.iconSizeData=Fl(this.zoom,e["icon-size"]);var n=this.layers[0].layout,r=n.get("symbol-sort-key"),i=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&!r.isConstant(),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===n.get("symbol-placement")&&(this.writingModes=n.get("text-writing-mode").map((function(t){return wl[t]}))),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id})),this.sourceID=t.sourceID};vc.prototype.createArrays=function(){this.text=new gc(new Oo(this.layers,this.zoom,(function(t){return/^text/.test(t)}))),this.icon=new gc(new Oo(this.layers,this.zoom,(function(t){return/^icon/.test(t)}))),this.glyphOffsetArray=new ro,this.lineVertexArray=new io,this.symbolInstances=new no},vc.prototype.calculateGlyphDependencies=function(t,e,n,r,i){for(var o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(n||r)&&i){var a=Xs[t.charAt(o)];a&&(e[a.charCodeAt(0)]=!0)}},vc.prototype.populate=function(t,e,n){var r=this.layers[0],i=r.layout,o=i.get("text-font"),a=i.get("text-field"),s=i.get("icon-image"),l=("constant"!==a.value.kind||a.value.value instanceof ie&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),c="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,u=i.get("symbol-sort-key");if(this.features=[],l||c){for(var p=e.iconDependencies,h=e.glyphDependencies,d=e.availableImages,f=new li(this.zoom),m=0,g=t;m<g.length;m+=1){var y=g[m],v=y.feature,_=y.id,x=y.index,b=y.sourceLayerIndex,w=r._featureFilter.needGeometry,M=Vo(v,w);if(r._featureFilter.filter(f,M,n)){w||(M.geometry=jo(v));var S=void 0;if(l){var T=r.getValueAndResolveTokens("text-field",M,n,d),E=ie.factory(T);mc(E)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===oi()||this.hasRTLText&&si.isParsed())&&(S=Zs(E,r,M))}var A=void 0;if(c){var C=r.getValueAndResolveTokens("icon-image",M,n,d);A=C instanceof oe?C:oe.fromString(C)}if(S||A){var L=this.sortFeaturesByKey?u.evaluate(M,{},n):void 0;if(this.features.push({id:_,text:S,icon:A,index:x,sourceLayerIndex:b,geometry:M.geometry,properties:v.properties,type:pc[v.type],sortKey:L}),A&&(p[A.name]=!0),S){var P=o.evaluate(M,{},n).join(","),I="map"===i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(wl.vertical)>=0;for(var R=0,k=S.sections;R<k.length;R+=1){var z=k[R];if(z.image)p[z.image.name]=!0;else{var D=Zr(S.toString()),O=z.fontStack||P,F=h[O]=h[O]||{};this.calculateGlyphDependencies(z.text,F,I,this.allowVerticalPlacement,D)}}}}}}"line"===i.get("symbol-placement")&&(this.features=function(t){var e={},n={},r=[],i=0;function o(e){r.push(t[e]),i++}function a(t,e,i){var o=n[t];return delete n[t],n[e]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(i[0]),o}function s(t,n,i){var o=e[n];return delete e[n],e[t]=o,r[o].geometry[0].shift(),r[o].geometry[0]=i[0].concat(r[o].geometry[0]),o}function l(t,e,n){var r=n?e[0][e[0].length-1]:e[0][0];return t+":"+r.x+":"+r.y}for(var c=0;c<t.length;c++){var u=t[c],p=u.geometry,h=u.text?u.text.toString():null;if(h){var d=l(h,p),f=l(h,p,!0);if(d in n&&f in e&&n[d]!==e[f]){var m=s(d,f,p),g=a(d,f,r[m].geometry);delete e[d],delete n[f],n[l(h,r[g].geometry,!0)]=g,r[m].geometry=null}else d in n?a(d,f,p):f in e?s(d,f,p):(o(c),e[d]=i-1,n[f]=i-1)}else o(c)}return r.filter((function(t){return t.geometry}))}(this.features)),this.sortFeaturesByKey&&this.features.sort((function(t,e){return t.sortKey-e.sortKey}))}},vc.prototype.update=function(t,e,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,n),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,n))},vc.prototype.isEmpty=function(){return 0===this.symbolInstances.length&&!this.hasRTLText},vc.prototype.uploadPending=function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload},vc.prototype.upload=function(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0},vc.prototype.destroyDebugData=function(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()},vc.prototype.destroy=function(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()},vc.prototype.addToLineVertexArray=function(t,e){var n=this.lineVertexArray.length;if(void 0!==t.segment){for(var r=t.dist(e[t.segment+1]),i=t.dist(e[t.segment]),o={},a=t.segment+1;a<e.length;a++)o[a]={x:e[a].x,y:e[a].y,tileUnitDistanceFromAnchor:r},a<e.length-1&&(r+=e[a+1].dist(e[a]));for(var s=t.segment||0;s>=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var l=0;l<e.length;l++){var c=o[l];this.lineVertexArray.emplaceBack(c.x,c.y,c.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}},vc.prototype.addSymbols=function(t,e,n,r,i,o,a,s,l,c,u,p){for(var h=t.indexArray,d=t.layoutVertexArray,f=t.segments.prepareSegment(4*e.length,d,h,this.canOverlap?o.sortKey:void 0),m=this.glyphOffsetArray.length,g=f.vertexLength,y=this.allowVerticalPlacement&&a===wl.vertical?Math.PI/2:0,v=o.text&&o.text.sections,_=0;_<e.length;_++){var x=e[_],b=x.tl,w=x.tr,M=x.bl,S=x.br,T=x.tex,E=x.pixelOffsetTL,A=x.pixelOffsetBR,C=x.minFontScaleX,L=x.minFontScaleY,P=x.glyphOffset,I=x.isSDF,R=x.sectionIndex,k=f.vertexLength,z=P[1];dc(d,s.x,s.y,b.x,z+b.y,T.x,T.y,n,I,E.x,E.y,C,L),dc(d,s.x,s.y,w.x,z+w.y,T.x+T.w,T.y,n,I,A.x,E.y,C,L),dc(d,s.x,s.y,M.x,z+M.y,T.x,T.y+T.h,n,I,E.x,A.y,C,L),dc(d,s.x,s.y,S.x,z+S.y,T.x+T.w,T.y+T.h,n,I,A.x,A.y,C,L),fc(t.dynamicLayoutVertexArray,s,y),h.emplaceBack(k,k+1,k+2),h.emplaceBack(k+1,k+2,k+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(P[0]),_!==e.length-1&&R===e[_+1].sectionIndex||t.programConfigurations.populatePaintArrays(d.length,o,o.index,{},p,v&&v[R])}t.placedSymbolArray.emplaceBack(s.x,s.y,m,this.glyphOffsetArray.length-m,g,l,c,s.segment,n?n[0]:0,n?n[1]:0,r[0],r[1],a,0,!1,0,u)},vc.prototype._addCollisionDebugVertex=function(t,e,n,r,i,o){return e.emplaceBack(0,0),t.emplaceBack(n.x,n.y,r,i,Math.round(o.x),Math.round(o.y))},vc.prototype.addCollisionDebugVertices=function(t,e,n,r,o,a,s){var l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=l.vertexLength,u=o.layoutVertexArray,p=o.collisionVertexArray,h=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(u,p,a,h,d,new i(t,e)),this._addCollisionDebugVertex(u,p,a,h,d,new i(n,e)),this._addCollisionDebugVertex(u,p,a,h,d,new i(n,r)),this._addCollisionDebugVertex(u,p,a,h,d,new i(t,r)),l.vertexLength+=4;var f=o.indexArray;f.emplaceBack(c,c+1),f.emplaceBack(c+1,c+2),f.emplaceBack(c+2,c+3),f.emplaceBack(c+3,c),l.primitiveLength+=4},vc.prototype.addDebugCollisionBoxes=function(t,e,n,r){for(var i=t;i<e;i++){var o=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(o.x1,o.y1,o.x2,o.y2,r?this.textCollisionBox:this.iconCollisionBox,o.anchorPoint,n)}},vc.prototype.generateCollisionDebugBuffers=function(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new yc(Ni,Ws.members,Xi),this.iconCollisionBox=new yc(Ni,Ws.members,Xi);for(var t=0;t<this.symbolInstances.length;t++){var e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}},vc.prototype._deserializeCollisionBoxesForSymbol=function(t,e,n,r,i,o,a,s,l){for(var c={},u=e;u<n;u++){var p=t.get(u);c.textBox={x1:p.x1,y1:p.y1,x2:p.x2,y2:p.y2,anchorPointX:p.anchorPointX,anchorPointY:p.anchorPointY},c.textFeatureIndex=p.featureIndex;break}for(var h=r;h<i;h++){var d=t.get(h);c.verticalTextBox={x1:d.x1,y1:d.y1,x2:d.x2,y2:d.y2,anchorPointX:d.anchorPointX,anchorPointY:d.anchorPointY},c.verticalTextFeatureIndex=d.featureIndex;break}for(var f=o;f<a;f++){var m=t.get(f);c.iconBox={x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2,anchorPointX:m.anchorPointX,anchorPointY:m.anchorPointY},c.iconFeatureIndex=m.featureIndex;break}for(var g=s;g<l;g++){var y=t.get(g);c.verticalIconBox={x1:y.x1,y1:y.y1,x2:y.x2,y2:y.y2,anchorPointX:y.anchorPointX,anchorPointY:y.anchorPointY},c.verticalIconFeatureIndex=y.featureIndex;break}return c},vc.prototype.deserializeCollisionBoxes=function(t){this.collisionArrays=[];for(var e=0;e<this.symbolInstances.length;e++){var n=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}},vc.prototype.hasTextData=function(){return this.text.segments.get().length>0},vc.prototype.hasIconData=function(){return this.icon.segments.get().length>0},vc.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},vc.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},vc.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},vc.prototype.addIndicesForPlacedSymbol=function(t,e){for(var n=t.placedSymbolArray.get(e),r=n.vertexStartIndex+4*n.numGlyphs,i=n.vertexStartIndex;i<r;i+=4)t.indexArray.emplaceBack(i,i+1,i+2),t.indexArray.emplaceBack(i+1,i+2,i+3)},vc.prototype.getSortedSymbolIndexes=function(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;for(var e=Math.sin(t),n=Math.cos(t),r=[],i=[],o=[],a=0;a<this.symbolInstances.length;++a){o.push(a);var s=this.symbolInstances.get(a);r.push(0|Math.round(e*s.anchorX+n*s.anchorY)),i.push(s.featureIndex)}return o.sort((function(t,e){return r[t]-r[e]||i[e]-i[t]})),o},vc.prototype.addToSortKeyRanges=function(t,e){var n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===e?n.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})},vc.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var n=0,r=this.symbolInstanceIndexes;n<r.length;n+=1){var i=this.symbolInstances.get(r[n]);this.featureSortOrder.push(i.featureIndex),[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((function(t,n,r){t>=0&&r.indexOf(t)===n&&e.addIndicesForPlacedSymbol(e.text,t)})),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},Nr("SymbolBucket",vc,{omit:["layers","collisionBoxArray","features","compareText"]}),vc.MAX_GLYPHS=65535,vc.addDynamicAttributes=fc;var _c=new wi({"symbol-placement":new yi(Pt.layout_symbol["symbol-placement"]),"symbol-spacing":new yi(Pt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new yi(Pt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new vi(Pt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new yi(Pt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new yi(Pt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new yi(Pt.layout_symbol["icon-ignore-placement"]),"icon-optional":new yi(Pt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new yi(Pt.layout_symbol["icon-rotation-alignment"]),"icon-size":new vi(Pt.layout_symbol["icon-size"]),"icon-text-fit":new yi(Pt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new yi(Pt.layout_symbol["icon-text-fit-padding"]),"icon-image":new vi(Pt.layout_symbol["icon-image"]),"icon-rotate":new vi(Pt.layout_symbol["icon-rotate"]),"icon-padding":new yi(Pt.layout_symbol["icon-padding"]),"icon-keep-upright":new yi(Pt.layout_symbol["icon-keep-upright"]),"icon-offset":new vi(Pt.layout_symbol["icon-offset"]),"icon-anchor":new vi(Pt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new yi(Pt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new yi(Pt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new yi(Pt.layout_symbol["text-rotation-alignment"]),"text-field":new vi(Pt.layout_symbol["text-field"]),"text-font":new vi(Pt.layout_symbol["text-font"]),"text-size":new vi(Pt.layout_symbol["text-size"]),"text-max-width":new vi(Pt.layout_symbol["text-max-width"]),"text-line-height":new yi(Pt.layout_symbol["text-line-height"]),"text-letter-spacing":new vi(Pt.layout_symbol["text-letter-spacing"]),"text-justify":new vi(Pt.layout_symbol["text-justify"]),"text-radial-offset":new vi(Pt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new yi(Pt.layout_symbol["text-variable-anchor"]),"text-anchor":new vi(Pt.layout_symbol["text-anchor"]),"text-max-angle":new yi(Pt.layout_symbol["text-max-angle"]),"text-writing-mode":new yi(Pt.layout_symbol["text-writing-mode"]),"text-rotate":new vi(Pt.layout_symbol["text-rotate"]),"text-padding":new yi(Pt.layout_symbol["text-padding"]),"text-keep-upright":new yi(Pt.layout_symbol["text-keep-upright"]),"text-transform":new vi(Pt.layout_symbol["text-transform"]),"text-offset":new vi(Pt.layout_symbol["text-offset"]),"text-allow-overlap":new yi(Pt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new yi(Pt.layout_symbol["text-ignore-placement"]),"text-optional":new yi(Pt.layout_symbol["text-optional"])}),xc={paint:new wi({"icon-opacity":new vi(Pt.paint_symbol["icon-opacity"]),"icon-color":new vi(Pt.paint_symbol["icon-color"]),"icon-halo-color":new vi(Pt.paint_symbol["icon-halo-color"]),"icon-halo-width":new vi(Pt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new vi(Pt.paint_symbol["icon-halo-blur"]),"icon-translate":new yi(Pt.paint_symbol["icon-translate"]),"icon-translate-anchor":new yi(Pt.paint_symbol["icon-translate-anchor"]),"text-opacity":new vi(Pt.paint_symbol["text-opacity"]),"text-color":new vi(Pt.paint_symbol["text-color"],{runtimeType:Vt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new vi(Pt.paint_symbol["text-halo-color"]),"text-halo-width":new vi(Pt.paint_symbol["text-halo-width"]),"text-halo-blur":new vi(Pt.paint_symbol["text-halo-blur"]),"text-translate":new yi(Pt.paint_symbol["text-translate"]),"text-translate-anchor":new yi(Pt.paint_symbol["text-translate-anchor"])}),layout:_c},bc=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Bt,this.defaultValue=t};bc.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},bc.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},bc.prototype.outputDefined=function(){return!1},bc.prototype.serialize=function(){return null},Nr("FormatSectionOverride",bc,{omit:["defaultValue"]});var wc=function(t){function e(e){t.call(this,e,xc)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,n){if(t.prototype.recalculate.call(this,e,n),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var r=this.layout.get("text-writing-mode");if(r){for(var i=[],o=0,a=r;o<a.length;o+=1){var s=a[o];i.indexOf(s)<0&&i.push(s)}this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()},e.prototype.getValueAndResolveTokens=function(t,e,n,r){var i=this.layout.get(t).evaluate(e,{},n,r),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Zn(o.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,(function(e,n){return n in t?String(t[n]):""}))}(e.properties,i)},e.prototype.createBucket=function(t){return new vc(t)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype._setPaintOverrides=function(){for(var t=0,n=xc.paint.overridableProperties;t<n.length;t+=1){var r=n[t];if(e.hasPaintOverride(this.layout,r)){var i,o=this.paint.get(r),a=new bc(o),s=new qn(a,o.property.specification);i="constant"===o.value.kind||"source"===o.value.kind?new $n("source",s):new Jn("composite",s,o.value.zoomStops,o.value._interpolationType),this.paint._values[r]=new mi(o.property,i,o.parameters)}}},e.prototype._handleOverridablePaintPropertyUpdate=function(t,n,r){return!(!this.layout||n.isDataDriven()||r.isDataDriven())&&e.hasPaintOverride(this.layout,t)},e.hasPaintOverride=function(t,e){var n=t.get("text-field"),r=xc.paint.properties[e],i=!1,o=function(t){for(var e=0,n=t;e<n.length;e+=1)if(r.overrides&&r.overrides.hasOverride(n[e]))return void(i=!0)};if("constant"===n.value.kind&&n.value.value instanceof ie)o(n.value.value.sections);else if("source"===n.value.kind){var a=function(t){i||(t instanceof ue&&le(t.value)===qt?o(t.value.sections):t instanceof fe?o(t.sections):t.eachChild(a))},s=n.value;s._styleExpression&&a(s._styleExpression.expression)}return i},e}(Mi),Mc={paint:new wi({"background-color":new yi(Pt.paint_background["background-color"]),"background-pattern":new xi(Pt.paint_background["background-pattern"]),"background-opacity":new yi(Pt.paint_background["background-opacity"])})},Sc=function(t){function e(e){t.call(this,e,Mc)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Mi),Tc={paint:new wi({"raster-opacity":new yi(Pt.paint_raster["raster-opacity"]),"raster-hue-rotate":new yi(Pt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new yi(Pt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new yi(Pt.paint_raster["raster-brightness-max"]),"raster-saturation":new yi(Pt.paint_raster["raster-saturation"]),"raster-contrast":new yi(Pt.paint_raster["raster-contrast"]),"raster-resampling":new yi(Pt.paint_raster["raster-resampling"]),"raster-fade-duration":new yi(Pt.paint_raster["raster-fade-duration"])})},Ec=function(t){function e(e){t.call(this,e,Tc)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Mi),Ac=function(t){function e(e){t.call(this,e,{}),this.implementation=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.is3D=function(){return"3d"===this.implementation.renderingMode},e.prototype.hasOffscreenPass=function(){return void 0!==this.implementation.prerender},e.prototype.recalculate=function(){},e.prototype.updateTransitions=function(){},e.prototype.hasTransition=function(){},e.prototype.serialize=function(){},e.prototype.onAdd=function(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},e.prototype.onRemove=function(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},e}(Mi),Cc={circle:da,heatmap:Ma,hillshade:Ta,fill:ps,"fill-extrusion":Cs,line:Us,symbol:wc,background:Sc,raster:Ec},Lc=a.HTMLImageElement,Pc=a.HTMLCanvasElement,Ic=a.HTMLVideoElement,Rc=a.ImageData,kc=a.ImageBitmap,zc=function(t,e,n,r){this.context=t,this.format=n,this.texture=t.gl.createTexture(),this.update(e,r)};zc.prototype.update=function(t,e,n){var r=t.width,i=t.height,o=!(this.size&&this.size[0]===r&&this.size[1]===i||n),a=this.context,s=a.gl;if(this.useMipmap=Boolean(e&&e.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!e||!1!==e.premultiply)),o)this.size=[r,i],t instanceof Lc||t instanceof Pc||t instanceof Ic||t instanceof Rc||kc&&t instanceof kc?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,t):s.texImage2D(s.TEXTURE_2D,0,this.format,r,i,0,this.format,s.UNSIGNED_BYTE,t.data);else{var l=n||{x:0,y:0},c=l.x,u=l.y;t instanceof Lc||t instanceof Pc||t instanceof Ic||t instanceof Rc||kc&&t instanceof kc?s.texSubImage2D(s.TEXTURE_2D,0,c,u,s.RGBA,s.UNSIGNED_BYTE,t):s.texSubImage2D(s.TEXTURE_2D,0,c,u,r,i,s.RGBA,s.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D)},zc.prototype.bind=function(t,e,n){var r=this.context.gl;r.bindTexture(r.TEXTURE_2D,this.texture),n!==r.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=r.LINEAR),t!==this.filter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,n||t),this.filter=t),e!==this.wrap&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,e),this.wrap=e)},zc.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},zc.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var Dc=function(t){var e=this;this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=function(){e._triggered=!1,e._callback()})};Dc.prototype.trigger=function(){var t=this;this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((function(){t._triggered=!1,t._callback()}),0))},Dc.prototype.remove=function(){delete this._channel,this._callback=function(){}};var Oc=function(t,e,n){this.target=t,this.parent=e,this.mapId=n,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},y(["receive","process"],this),this.invoker=new Dc(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=E()?t:a};function Fc(t,e,n){var r=2*Math.PI*6378137/256/Math.pow(2,n);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}Oc.prototype.send=function(t,e,n,r,i){var o=this;void 0===i&&(i=!1);var a=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(this.callbacks[a]=n);var s=L(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!n,targetMapId:r,mustQueue:i,sourceMapId:this.mapId,data:Gr(e,s)},s),{cancel:function(){n&&delete o.callbacks[a],o.target.postMessage({id:a,type:"<cancel>",targetMapId:r,sourceMapId:o.mapId})}}},Oc.prototype.receive=function(t){var e=t.data,n=e.id;if(n&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[n];var r=this.cancelCallbacks[n];delete this.cancelCallbacks[n],r&&r()}else E()||e.mustQueue?(this.tasks[n]=e,this.taskQueue.push(n),this.invoker.trigger()):this.processTask(n,e)},Oc.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}},Oc.prototype.processTask=function(t,e){var n=this;if("<response>"===e.type){var r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(Hr(e.error)):r(null,Hr(e.data)))}else{var i=!1,o=L(this.globalScope)?void 0:[],a=e.hasCallback?function(e,r){i=!0,delete n.cancelCallbacks[t],n.target.postMessage({id:t,type:"<response>",sourceMapId:n.mapId,error:e?Gr(e):null,data:Gr(r,o)},o)}:function(t){i=!0},s=null,l=Hr(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,l,a);else if(this.parent.getWorkerSource){var c=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,c[0],l.source)[c[1]](l,a)}else a(new Error("Could not find function "+e.type));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}},Oc.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var Bc=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};Bc.prototype.setNorthEast=function(t){return this._ne=t instanceof Nc?new Nc(t.lng,t.lat):Nc.convert(t),this},Bc.prototype.setSouthWest=function(t){return this._sw=t instanceof Nc?new Nc(t.lng,t.lat):Nc.convert(t),this},Bc.prototype.extend=function(t){var e,n,r=this._sw,i=this._ne;if(t instanceof Nc)e=t,n=t;else{if(!(t instanceof Bc))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Bc.convert(t)):this.extend(Nc.convert(t)):this;if(n=t._ne,!(e=t._sw)||!n)return this}return r||i?(r.lng=Math.min(e.lng,r.lng),r.lat=Math.min(e.lat,r.lat),i.lng=Math.max(n.lng,i.lng),i.lat=Math.max(n.lat,i.lat)):(this._sw=new Nc(e.lng,e.lat),this._ne=new Nc(n.lng,n.lat)),this},Bc.prototype.getCenter=function(){return new Nc((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Bc.prototype.getSouthWest=function(){return this._sw},Bc.prototype.getNorthEast=function(){return this._ne},Bc.prototype.getNorthWest=function(){return new Nc(this.getWest(),this.getNorth())},Bc.prototype.getSouthEast=function(){return new Nc(this.getEast(),this.getSouth())},Bc.prototype.getWest=function(){return this._sw.lng},Bc.prototype.getSouth=function(){return this._sw.lat},Bc.prototype.getEast=function(){return this._ne.lng},Bc.prototype.getNorth=function(){return this._ne.lat},Bc.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Bc.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Bc.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Bc.prototype.contains=function(t){var e=Nc.convert(t),n=e.lng,r=e.lat,i=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&i},Bc.convert=function(t){return!t||t instanceof Bc?t:new Bc(t)};var Nc=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};Nc.prototype.wrap=function(){return new Nc(p(this.lng,-180,180),this.lat)},Nc.prototype.toArray=function(){return[this.lng,this.lat]},Nc.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Nc.prototype.distanceTo=function(t){var e=Math.PI/180,n=this.lat*e,r=t.lat*e,i=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(i,1))},Nc.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,n=e/Math.cos(Math.PI/180*this.lat);return new Bc(new Nc(this.lng-n,this.lat-e),new Nc(this.lng+n,this.lat+e))},Nc.convert=function(t){if(t instanceof Nc)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Nc(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Nc(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")};var Uc=2*Math.PI*6371008.8;function jc(t){return Uc*Math.cos(t*Math.PI/180)}function Vc(t){return(180+t)/360}function Gc(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Hc(t,e){return t/jc(e)}function Wc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var qc=function(t,e,n){void 0===n&&(n=0),this.x=+t,this.y=+e,this.z=+n};qc.fromLngLat=function(t,e){void 0===e&&(e=0);var n=Nc.convert(t);return new qc(Vc(n.lng),Gc(n.lat),Hc(e,n.lat))},qc.prototype.toLngLat=function(){return new Nc(360*this.x-180,Wc(this.y))},qc.prototype.toAltitude=function(){return this.z*jc(Wc(this.y))},qc.prototype.meterInMercatorCoordinateUnits=function(){return 1/Uc*(t=Wc(this.y),1/Math.cos(t*Math.PI/180));var t};var Zc=function(t,e,n){this.z=t,this.x=e,this.y=n,this.key=Jc(0,t,t,e,n)};Zc.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Zc.prototype.url=function(t,e){var n,r,i,o,a,s=(r=this.y,i=this.z,o=Fc(256*(n=this.x),256*(r=Math.pow(2,i)-r-1),i),a=Fc(256*(n+1),256*(r+1),i),o[0]+","+o[1]+","+a[0]+","+a[1]),l=function(t,e,n){for(var r,i="",o=t;o>0;o--)i+=(e&(r=1<<o-1)?1:0)+(n&r?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",String(this.z)).replace("{x}",String(this.x)).replace("{y}",String("tms"===e?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",l).replace("{bbox-epsg-3857}",s)},Zc.prototype.getTilePoint=function(t){var e=Math.pow(2,this.z);return new i(8192*(t.x*e-this.x),8192*(t.y*e-this.y))},Zc.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var Xc=function(t,e){this.wrap=t,this.canonical=e,this.key=Jc(t,e.z,e.z,e.x,e.y)},$c=function(t,e,n,r,i){this.overscaledZ=t,this.wrap=e,this.canonical=new Zc(n,+r,+i),this.key=Jc(e,t,n,r,i)};function Jc(t,e,n,r,i){(t*=2)<0&&(t=-1*t-1);var o=1<<n;return(o*o*t+o*i+r).toString(36)+n.toString(36)+e.toString(36)}$c.prototype.equals=function(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)},$c.prototype.scaledTo=function(t){var e=this.canonical.z-t;return t>this.canonical.z?new $c(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new $c(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},$c.prototype.calculateScaledKey=function(t,e){var n=this.canonical.z-t;return t>this.canonical.z?Jc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Jc(this.wrap*+e,t,t,this.canonical.x>>n,this.canonical.y>>n)},$c.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e},$c.prototype.children=function(t){if(this.overscaledZ>=t)return[new $c(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,n=2*this.canonical.x,r=2*this.canonical.y;return[new $c(e,this.wrap,e,n,r),new $c(e,this.wrap,e,n+1,r),new $c(e,this.wrap,e,n,r+1),new $c(e,this.wrap,e,n+1,r+1)]},$c.prototype.isLessThan=function(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))},$c.prototype.wrapped=function(){return new $c(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},$c.prototype.unwrapTo=function(t){return new $c(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)},$c.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},$c.prototype.toUnwrapped=function(){return new Xc(this.wrap,this.canonical)},$c.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},$c.prototype.getTilePoint=function(t){return this.canonical.getTilePoint(new qc(t.x-this.wrap,t.y))},Nr("CanonicalTileID",Zc),Nr("OverscaledTileID",$c,{omit:["posMatrix"]});var Yc=function(t,e,n){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(n&&"mapbox"!==n&&"terrarium"!==n)return M('"'+n+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');this.stride=e.height;var r=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=n||"mapbox";for(var i=0;i<r;i++)this.data[this._idx(-1,i)]=this.data[this._idx(0,i)],this.data[this._idx(r,i)]=this.data[this._idx(r-1,i)],this.data[this._idx(i,-1)]=this.data[this._idx(i,0)],this.data[this._idx(i,r)]=this.data[this._idx(i,r-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(r,-1)]=this.data[this._idx(r-1,0)],this.data[this._idx(-1,r)]=this.data[this._idx(0,r-1)],this.data[this._idx(r,r)]=this.data[this._idx(r-1,r-1)]};Yc.prototype.get=function(t,e){var n=new Uint8Array(this.data.buffer),r=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(n[r],n[r+1],n[r+2])},Yc.prototype.getUnpackVector=function(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]},Yc.prototype._idx=function(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},Yc.prototype._unpackMapbox=function(t,e,n){return(256*t*256+256*e+n)/10-1e4},Yc.prototype._unpackTerrarium=function(t,e,n){return 256*t+e+n/256-32768},Yc.prototype.getPixels=function(){return new xa({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Yc.prototype.backfillBorder=function(t,e,n){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var r=e*this.dim,i=e*this.dim+this.dim,o=n*this.dim,a=n*this.dim+this.dim;switch(e){case-1:r=i-1;break;case 1:i=r+1}switch(n){case-1:o=a-1;break;case 1:a=o+1}for(var s=-e*this.dim,l=-n*this.dim,c=o;c<a;c++)for(var u=r;u<i;u++)this.data[this._idx(u,c)]=t.data[this._idx(u+s,c+l)]},Nr("DEMData",Yc);var Qc=function(t){this._stringToNumber={},this._numberToString=[];for(var e=0;e<t.length;e++){var n=t[e];this._stringToNumber[n]=e,this._numberToString[e]=n}};Qc.prototype.encode=function(t){return this._stringToNumber[t]},Qc.prototype.decode=function(t){return this._numberToString[t]};var Kc=function(t,e,n,r,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=n,t._y=r,this.properties=t.properties,this.id=i},tu={geometry:{configurable:!0}};tu.geometry.get=function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},tu.geometry.set=function(t){this._geometry=t},Kc.prototype.toJSON=function(){var t={geometry:this.geometry};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t},Object.defineProperties(Kc.prototype,tu);var eu=function(){this.state={},this.stateChanges={},this.deletedStates={}};eu.prototype.updateState=function(t,e,n){var r=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][r]=this.stateChanges[t][r]||{},h(this.stateChanges[t][r],n),null===this.deletedStates[t])for(var i in this.deletedStates[t]={},this.state[t])i!==r&&(this.deletedStates[t][i]=null);else if(this.deletedStates[t]&&null===this.deletedStates[t][r])for(var o in this.deletedStates[t][r]={},this.state[t][r])n[o]||(this.deletedStates[t][r][o]=null);else for(var a in n)this.deletedStates[t]&&this.deletedStates[t][r]&&null===this.deletedStates[t][r][a]&&delete this.deletedStates[t][r][a]},eu.prototype.removeFeatureState=function(t,e,n){if(null!==this.deletedStates[t]){var r=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},n&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]=this.deletedStates[t][r]||{},this.deletedStates[t][r][n]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][r])for(n in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][n]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}},eu.prototype.getState=function(t,e){var n=String(e),r=h({},(this.state[t]||{})[n],(this.stateChanges[t]||{})[n]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){var i=this.deletedStates[t][e];if(null===i)return{};for(var o in i)delete r[o]}return r},eu.prototype.initializeTileState=function(t,e){t.setFeatureState(this.state,e)},eu.prototype.coalesceChanges=function(t,e){var n={};for(var r in this.stateChanges){this.state[r]=this.state[r]||{};var i={};for(var o in this.stateChanges[r])this.state[r][o]||(this.state[r][o]={}),h(this.state[r][o],this.stateChanges[r][o]),i[o]=this.state[r][o];n[r]=i}for(var a in this.deletedStates){this.state[a]=this.state[a]||{};var s={};if(null===this.deletedStates[a])for(var l in this.state[a])s[l]={},this.state[a][l]={};else for(var c in this.deletedStates[a]){if(null===this.deletedStates[a][c])this.state[a][c]={};else for(var u=0,p=Object.keys(this.deletedStates[a][c]);u<p.length;u+=1)delete this.state[a][c][p[u]];s[c]=this.state[a][c]}n[a]=n[a]||{},h(n[a],s)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(var d in t)t[d].setFeatureState(n,e)};var nu=function(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new zr(8192,16,0),this.grid3D=new zr(8192,16,0),this.featureIndexArray=new ao,this.promoteId=e};function ru(t,e,n,r,i){return _(t,(function(t,o){var a=e instanceof gi?e.get(o):null;return a&&a.evaluate?a.evaluate(n,r,i):a}))}function iu(t){for(var e=1/0,n=1/0,r=-1/0,i=-1/0,o=0,a=t;o<a.length;o+=1){var s=a[o];e=Math.min(e,s.x),n=Math.min(n,s.y),r=Math.max(r,s.x),i=Math.max(i,s.y)}return{minX:e,minY:n,maxX:r,maxY:i}}function ou(t,e){return e-t}nu.prototype.insert=function(t,e,n,r,i,o){var a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,r,i);for(var s=o?this.grid3D:this.grid,l=0;l<e.length;l++){for(var c=e[l],u=[1/0,1/0,-1/0,-1/0],p=0;p<c.length;p++){var h=c[p];u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y)}u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&s.insert(a,u[0],u[1],u[2],u[3])}},nu.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new bs.VectorTile(new Ys(this.rawTileData)).layers,this.sourceLayerCoder=new Qc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},nu.prototype.query=function(t,e,n,r){var o=this;this.loadVTLayers();for(var a=t.params||{},s=8192/t.tileSize/t.scale,l=sr(a.filter),c=t.queryGeometry,u=t.queryPadding*s,p=iu(c),h=this.grid.query(p.minX-u,p.minY-u,p.maxX+u,p.maxY+u),d=iu(t.cameraQueryGeometry),f=this.grid3D.query(d.minX-u,d.minY-u,d.maxX+u,d.maxY+u,(function(e,n,r,o){return function(t,e,n,r,o){for(var a=0,s=t;a<s.length;a+=1){var l=s[a];if(e<=l.x&&n<=l.y&&r>=l.x&&o>=l.y)return!0}var c=[new i(e,n),new i(e,o),new i(r,o),new i(r,n)];if(t.length>2)for(var u=0,p=c;u<p.length;u+=1)if(ta(t,p[u]))return!0;for(var h=0;h<t.length-1;h++)if(ea(t[h],t[h+1],c))return!0;return!1}(t.cameraQueryGeometry,e-u,n-u,r+u,o+u)})),m=0,g=f;m<g.length;m+=1)h.push(g[m]);h.sort(ou);for(var y,v={},_=function(i){var u=h[i];if(u!==y){y=u;var p=o.featureIndexArray.get(u),d=null;o.loadMatchingFeature(v,p.bucketIndex,p.sourceLayerIndex,p.featureIndex,l,a.layers,a.availableImages,e,n,r,(function(e,n,r){return d||(d=jo(e)),n.queryIntersectsFeature(c,e,r,d,o.z,t.transform,s,t.pixelPosMatrix)}))}},x=0;x<h.length;x++)_(x);return v},nu.prototype.loadMatchingFeature=function(t,e,n,r,i,o,a,s,l,c,u){var p=this.bucketLayerIDs[e];if(!o||function(t,e){for(var n=0;n<t.length;n++)if(e.indexOf(t[n])>=0)return!0;return!1}(o,p)){var d=this.sourceLayerCoder.decode(n),f=this.vtLayers[d].feature(r);if(i.needGeometry){var m=Vo(f,!0);if(!i.filter(new li(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!i.filter(new li(this.tileID.overscaledZ),f))return;for(var g=this.getId(f,d),y=0;y<p.length;y++){var v=p[y];if(!(o&&o.indexOf(v)<0)){var _=s[v];if(_){var x={};void 0!==g&&c&&(x=c.getState(_.sourceLayer||"_geojsonTileLayer",g));var b=h({},l[v]);b.paint=ru(b.paint,_.paint,f,x,a),b.layout=ru(b.layout,_.layout,f,x,a);var w=!u||u(f,_,x);if(w){var M=new Kc(f,this.z,this.x,this.y,g);M.layer=b;var S=t[v];void 0===S&&(S=t[v]=[]),S.push({featureIndex:r,feature:M,intersectionZ:w})}}}}}},nu.prototype.lookupSymbolFeatures=function(t,e,n,r,i,o,a,s){var l={};this.loadVTLayers();for(var c=sr(i),u=0,p=t;u<p.length;u+=1)this.loadMatchingFeature(l,n,r,p[u],c,o,a,s,e);return l},nu.prototype.hasLayer=function(t){for(var e=0,n=this.bucketLayerIDs;e<n.length;e+=1)for(var r=0,i=n[e];r<i.length;r+=1)if(t===i[r])return!0;return!1},nu.prototype.getId=function(t,e){var n=t.id;return this.promoteId&&"boolean"==typeof(n=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]])&&(n=Number(n)),n},Nr("FeatureIndex",nu,{omit:["rawTileData","sourceLayerCoder"]});var au=function(t,e){this.tileID=t,this.uid=f(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"};au.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e<B.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)},au.prototype.wasRequested=function(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state},au.prototype.loadVectorData=function(t,e,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){for(var r in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){var n={};if(!e)return n;for(var r=function(){var t=o[i],r=t.layerIds.map((function(t){return e.getLayer(t)})).filter(Boolean);if(0!==r.length){t.layers=r,t.stateDependentLayerIds&&(t.stateDependentLayers=t.stateDependentLayerIds.map((function(t){return r.filter((function(e){return e.id===t}))[0]})));for(var a=0,s=r;a<s.length;a+=1)n[s[a].id]=t}},i=0,o=t;i<o.length;i+=1)r();return n}(t.buckets,e.style),this.hasSymbolBuckets=!1,this.buckets){var i=this.buckets[r];if(i instanceof vc){if(this.hasSymbolBuckets=!0,!n)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var o in this.buckets){var a=this.buckets[o];if(a instanceof vc&&a.hasRTLText){this.hasRTLText=!0,si.isLoading()||si.isLoaded()||"deferred"!==oi()||ai();break}}for(var s in this.queryPadding=0,this.buckets){var l=this.buckets[s];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(s).queryRadius(l))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new Qi},au.prototype.unloadVectorData=function(){for(var t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"},au.prototype.getBucket=function(t){return this.buckets[t.id]},au.prototype.upload=function(t){for(var e in this.buckets){var n=this.buckets[e];n.uploadPending()&&n.upload(t)}var r=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new zc(t,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new zc(t,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null)},au.prototype.prepare=function(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)},au.prototype.queryRenderedFeatures=function(t,e,n,r,i,o,a,s,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:i,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:a,queryPadding:this.queryPadding*l},t,e,n):{}},au.prototype.querySourceFeatures=function(t,e){var n=this.latestFeatureIndex;if(n&&n.rawTileData){var r=n.loadVTLayers(),i=e?e.sourceLayer:"",o=r._geojsonTileLayer||r[i];if(o)for(var a=sr(e&&e.filter),s=this.tileID.canonical,l=s.z,c=s.x,u=s.y,p={z:l,x:c,y:u},h=0;h<o.length;h++){var d=o.feature(h);if(a.needGeometry){var f=Vo(d,!0);if(!a.filter(new li(this.tileID.overscaledZ),f,this.tileID.canonical))continue}else if(!a.filter(new li(this.tileID.overscaledZ),d))continue;var m=n.getId(d,i),g=new Kc(d,l,c,u,m);g.tile=p,t.push(g)}}},au.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},au.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},au.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var n=A(t.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+1e3*n["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var r=Date.now(),i=!1;if(this.expirationTime>r)i=!1;else if(e)if(this.expirationTime<e)i=!0;else{var o=this.expirationTime-e;o?this.expirationTime=r+Math.max(o,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},au.prototype.getExpiryTimeout=function(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)},au.prototype.setFeatureState=function(t,e){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(t).length){var n=this.latestFeatureIndex.loadVTLayers();for(var r in this.buckets)if(e.style.hasLayer(r)){var i=this.buckets[r],o=i.layers[0].sourceLayer||"_geojsonTileLayer",a=n[o],s=t[o];if(a&&s&&0!==Object.keys(s).length){i.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});var l=e&&e.style&&e.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(i)))}}}},au.prototype.holdingForFade=function(){return void 0!==this.symbolFadeHoldUntil},au.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<B.now()},au.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},au.prototype.setHoldDuration=function(t){this.symbolFadeHoldUntil=B.now()+t},au.prototype.setDependencies=function(t,e){for(var n={},r=0,i=e;r<i.length;r+=1)n[i[r]]=!0;this.dependencies[t]=n},au.prototype.hasDependency=function(t,e){for(var n=0,r=t;n<r.length;n+=1){var i=this.dependencies[r[n]];if(i)for(var o=0,a=e;o<a.length;o+=1)if(i[a[o]])return!0}return!1};var su=a.performance,lu=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},su.mark(this._marks.start)};lu.prototype.finish=function(){su.mark(this._marks.end);var t=su.getEntriesByName(this._marks.measure);return 0===t.length&&(su.measure(this._marks.measure,this._marks.start,this._marks.end),t=su.getEntriesByName(this._marks.measure),su.clearMarks(this._marks.start),su.clearMarks(this._marks.end),su.clearMeasures(this._marks.measure)),t},t.Actor=Oc,t.AlphaImage=_a,t.CanonicalTileID=Zc,t.CollisionBoxArray=Qi,t.Color=ee,t.DEMData=Yc,t.DataConstantProperty=yi,t.DictionaryCoder=Qc,t.EXTENT=8192,t.ErrorEvent=Ct,t.EvaluationParameters=li,t.Event=At,t.Evented=Lt,t.FeatureIndex=nu,t.FillBucket=ls,t.FillExtrusionBucket=Ts,t.ImageAtlas=bl,t.ImagePosition=_l,t.LineBucket=Os,t.LngLat=Nc,t.LngLatBounds=Bc,t.MercatorCoordinate=qc,t.ONE_EM=24,t.OverscaledTileID=$c,t.Point=i,t.Point$1=i,t.Properties=wi,t.Protobuf=Ys,t.RGBAImage=xa,t.RequestManager=W,t.RequestPerformance=lu,t.ResourceType=ft,t.SegmentVector=lo,t.SourceFeatureState=eu,t.StructArrayLayout1ui2=$i,t.StructArrayLayout2f1f2i16=Ui,t.StructArrayLayout2i4=Li,t.StructArrayLayout3ui6=Vi,t.StructArrayLayout4i8=Pi,t.SymbolBucket=vc,t.Texture=zc,t.Tile=au,t.Transitionable=pi,t.Uniform1f=wo,t.Uniform1i=bo,t.Uniform2f=Mo,t.Uniform3f=So,t.Uniform4f=To,t.UniformColor=Eo,t.UniformMatrix4f=Co,t.UnwrappedTileID=Xc,t.ValidationError=It,t.WritingMode=wl,t.ZoomHistory=Wr,t.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t},t.addDynamicAttributes=fc,t.asyncAll=function(t,e,n){if(!t.length)return n(null,[]);var r=t.length,i=new Array(t.length),o=null;t.forEach((function(t,a){e(t,(function(t,e){t&&(o=t),i[a]=e,0==--r&&n(o,i)}))}))},t.bezier=l,t.bindAll=y,t.browser=B,t.cacheEntryPossiblyAdded=function(t){++ht>lt&&(t.getActor().send("enforceCacheSizeLimit",st),ht=0)},t.clamp=u,t.clearTileCache=function(t){var e=a.caches.delete("mapbox-tiles");t&&e.catch(t).then((function(){return t()}))},t.clipLine=Zl,t.clone=function(t){var e=new sa(16);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},t.clone$1=b,t.clone$2=function(t){var e=new sa(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=qs,t.config=N,t.create=function(){var t=new sa(16);return sa!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=function(){var t=new sa(9);return sa!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new sa(4);return sa!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=Xn,t.createLayout=Ai,t.createStyleLayer=function(t){return"custom"===t.type?new Ac(t):new Cc[t.type](t)},t.cross=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],l=n[2];return t[0]=i*l-o*s,t[1]=o*a-r*l,t[2]=r*s-i*a,t},t.deepEqual=function t(e,n){if(Array.isArray(e)){if(!Array.isArray(n)||e.length!==n.length)return!1;for(var r=0;r<e.length;r++)if(!t(e[r],n[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==n){if("object"!=typeof n)return!1;if(Object.keys(e).length!==Object.keys(n).length)return!1;for(var i in e)if(!t(e[i],n[i]))return!1;return!0}return e===n},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.dot$1=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.ease=c,t.emitValidationErrors=kr,t.endsWith=v,t.enforceCacheSizeLimit=function(t){ct(),tt&&tt.then((function(e){e.keys().then((function(n){for(var r=0;r<n.length-t;r++)e.delete(n[r])}))}))},t.evaluateSizeForFeature=Bl,t.evaluateSizeForZoom=Nl,t.evaluateVariableOffset=ac,t.evented=ii,t.extend=h,t.featureFilter=sr,t.filterObject=x,t.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.getAnchorAlignment=kl,t.getAnchorJustification=sc,t.getArrayBuffer=bt,t.getImage=St,t.getJSON=function(t,e){return xt(h(t,{type:"json"}),e)},t.getRTLTextPluginStatus=oi,t.getReferrer=gt,t.getVideo=function(t,e){var n,r,i=a.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(var o=0;o<t.length;o++){var s=a.document.createElement("source");n=t[o],r=void 0,(r=a.document.createElement("a")).href=n,(r.protocol!==a.document.location.protocol||r.host!==a.document.location.host)&&(i.crossOrigin="Anonymous"),s.src=t[o],i.appendChild(s)}return{cancel:function(){}}},t.identity=la,t.invert=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],p=e[9],h=e[10],d=e[11],f=e[12],m=e[13],g=e[14],y=e[15],v=n*s-r*a,_=n*l-i*a,x=n*c-o*a,b=r*l-i*s,w=r*c-o*s,M=i*c-o*l,S=u*m-p*f,T=u*g-h*f,E=u*y-d*f,A=p*g-h*m,C=p*y-d*m,L=h*y-d*g,P=v*L-_*C+x*A+b*E-w*T+M*S;return P?(t[0]=(s*L-l*C+c*A)*(P=1/P),t[1]=(i*C-r*L-o*A)*P,t[2]=(m*M-g*w+y*b)*P,t[3]=(h*w-p*M-d*b)*P,t[4]=(l*E-a*L-c*T)*P,t[5]=(n*L-i*E+o*T)*P,t[6]=(g*x-f*M-y*_)*P,t[7]=(u*M-h*x+d*_)*P,t[8]=(a*C-s*E+c*S)*P,t[9]=(r*E-n*C-o*S)*P,t[10]=(f*w-m*x+y*v)*P,t[11]=(p*x-u*w-d*v)*P,t[12]=(s*T-a*A-l*S)*P,t[13]=(n*A-r*T+i*S)*P,t[14]=(m*_-f*b-g*v)*P,t[15]=(u*b-p*_+h*v)*P,t):null},t.isChar=qr,t.isMapboxURL=q,t.keysDifference=function(t,e){var n=[];for(var r in t)r in e||n.push(r);return n},t.makeRequest=xt,t.mapObject=_,t.mercatorXfromLng=Vc,t.mercatorYfromLat=Gc,t.mercatorZfromAltitude=Hc,t.mul=pa,t.multiply=ca,t.mvt=bs,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.normalize=function(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},t.number=We,t.offscreenCanvasSupported=dt,t.ortho=function(t,e,n,r,i,o,a){var s=1/(e-n),l=1/(r-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*l,t[14]=(a+o)*c,t[15]=1,t},t.parseGlyphPBF=function(t){return new Ys(t).readFields(ml,[])},t.pbf=Ys,t.performSymbolLayout=function(t,e,n,r,i,o,a){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var s=t.layers[0].layout,l=t.layers[0]._unevaluatedLayout._values,c={};if("composite"===t.textSizeData.kind){var u=t.textSizeData,p=u.maxZoom;c.compositeTextSizes=[l["text-size"].possiblyEvaluate(new li(u.minZoom),a),l["text-size"].possiblyEvaluate(new li(p),a)]}if("composite"===t.iconSizeData.kind){var h=t.iconSizeData,d=h.maxZoom;c.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new li(h.minZoom),a),l["icon-size"].possiblyEvaluate(new li(d),a)]}c.layoutTextSize=l["text-size"].possiblyEvaluate(new li(t.zoom+1),a),c.layoutIconSize=l["icon-size"].possiblyEvaluate(new li(t.zoom+1),a),c.textMaxSize=l["text-size"].possiblyEvaluate(new li(18));for(var f=24*s.get("text-line-height"),m="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),g=s.get("text-keep-upright"),y=s.get("text-size"),v=function(){var o=x[_],l=s.get("text-font").evaluate(o,{},a).join(","),u=y.evaluate(o,{},a),p=c.layoutTextSize.evaluate(o,{},a),h=c.layoutIconSize.evaluate(o,{},a),d={horizontal:{},vertical:void 0},v=o.text,b=[0,0];if(v){var w=v.toString(),S=24*s.get("text-letter-spacing").evaluate(o,{},a),T=function(t){for(var e=0,n=t;e<n.length;e+=1)if(r=n[e].charCodeAt(0),qr.Arabic(r)||qr["Arabic Supplement"](r)||qr["Arabic Extended-A"](r)||qr["Arabic Presentation Forms-A"](r)||qr["Arabic Presentation Forms-B"](r))return!1;var r;return!0}(w)?S:0,E=s.get("text-anchor").evaluate(o,{},a),A=s.get("text-variable-anchor");if(!A){var C=s.get("text-radial-offset").evaluate(o,{},a);b=C?ac(E,[24*C,oc]):s.get("text-offset").evaluate(o,{},a).map((function(t){return 24*t}))}var L=m?"center":s.get("text-justify").evaluate(o,{},a),P=s.get("symbol-placement"),I="point"===P?24*s.get("text-max-width").evaluate(o,{},a):0,R=function(){t.allowVerticalPlacement&&Zr(w)&&(d.vertical=Tl(v,e,n,i,l,I,f,E,"left",T,b,wl.vertical,!0,P,p,u))};if(!m&&A){for(var k="auto"===L?A.map((function(t){return sc(t)})):[L],z=!1,D=0;D<k.length;D++){var O=k[D];if(!d.horizontal[O])if(z)d.horizontal[O]=d.horizontal[0];else{var F=Tl(v,e,n,i,l,I,f,"center",O,T,b,wl.horizontal,!1,P,p,u);F&&(d.horizontal[O]=F,z=1===F.positionedLines.length)}}R()}else{"auto"===L&&(L=sc(E));var B=Tl(v,e,n,i,l,I,f,E,L,T,b,wl.horizontal,!1,P,p,u);B&&(d.horizontal[L]=B),R(),Zr(w)&&m&&g&&(d.vertical=Tl(v,e,n,i,l,I,f,E,L,T,b,wl.vertical,!1,P,p,u))}}var N=void 0,U=!1;if(o.icon&&o.icon.name){var j=r[o.icon.name];j&&(N=function(t,e,n){var r=kl(n),i=e[0]-t.displaySize[0]*r.horizontalAlign,o=e[1]-t.displaySize[1]*r.verticalAlign;return{image:t,top:o,bottom:o+t.displaySize[1],left:i,right:i+t.displaySize[0]}}(i[o.icon.name],s.get("icon-offset").evaluate(o,{},a),s.get("icon-anchor").evaluate(o,{},a)),U=j.sdf,void 0===t.sdfIcons?t.sdfIcons=j.sdf:t.sdfIcons!==j.sdf&&M("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(j.pixelRatio!==t.pixelRatio||0!==s.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}var V=cc(d.horizontal)||d.vertical;t.iconsInText=!!V&&V.iconsInText,(V||N)&&function(t,e,n,r,i,o,a,s,l,c,u){var p=o.textMaxSize.evaluate(e,{});void 0===p&&(p=a);var h,d=t.layers[0].layout,f=d.get("icon-offset").evaluate(e,{},u),m=cc(n.horizontal),g=a/24,y=t.tilePixelRatio*g,v=t.tilePixelRatio*p/24,_=t.tilePixelRatio*s,x=t.tilePixelRatio*d.get("symbol-spacing"),b=d.get("text-padding")*t.tilePixelRatio,w=d.get("icon-padding")*t.tilePixelRatio,S=d.get("text-max-angle")/180*Math.PI,T="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),E="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),A=d.get("symbol-placement"),C=x/2,L=d.get("icon-text-fit");r&&"none"!==L&&(t.allowVerticalPlacement&&n.vertical&&(h=Dl(r,n.vertical,L,d.get("icon-text-fit-padding"),f,g)),m&&(r=Dl(r,m,L,d.get("icon-text-fit-padding"),f,g)));var P=function(s,p){p.x<0||p.x>=8192||p.y<0||p.y>=8192||function(t,e,n,r,i,o,a,s,l,c,u,p,h,d,f,m,g,y,v,_,x,b,w,S,T){var E,A,C,L,P,I=t.addToLineVertexArray(e,n),R=0,k=0,z=0,D=0,O=-1,F=-1,B={},N=fo(""),U=0,j=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(U=(E=s.layout.get("text-offset").evaluate(x,{},S).map((function(t){return 24*t})))[0],j=E[1]):(U=24*s.layout.get("text-radial-offset").evaluate(x,{},S),j=oc),t.allowVerticalPlacement&&r.vertical){var V=s.layout.get("text-rotate").evaluate(x,{},S)+90;L=new Kl(l,e,c,u,p,r.vertical,h,d,f,V),a&&(P=new Kl(l,e,c,u,p,a,g,y,f,V))}if(i){var G=s.layout.get("icon-rotate").evaluate(x,{}),H="none"!==s.layout.get("icon-text-fit"),W=Xl(i,G,w,H),q=a?Xl(a,G,w,H):void 0;C=new Kl(l,e,c,u,p,i,g,y,!1,G),R=4*W.length;var Z=t.iconSizeData,X=null;"source"===Z.kind?(X=[128*s.layout.get("icon-size").evaluate(x,{})])[0]>32640&&M(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===Z.kind&&((X=[128*b.compositeIconSizes[0].evaluate(x,{},S),128*b.compositeIconSizes[1].evaluate(x,{},S)])[0]>32640||X[1]>32640)&&M(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,W,X,_,v,x,!1,e,I.lineStartIndex,I.lineLength,-1,S),O=t.icon.placedSymbolArray.length-1,q&&(k=4*q.length,t.addSymbols(t.icon,q,X,_,v,x,wl.vertical,e,I.lineStartIndex,I.lineLength,-1,S),F=t.icon.placedSymbolArray.length-1)}for(var $ in r.horizontal){var J=r.horizontal[$];if(!A){N=fo(J.text);var Y=s.layout.get("text-rotate").evaluate(x,{},S);A=new Kl(l,e,c,u,p,J,h,d,f,Y)}var Q=1===J.positionedLines.length;if(z+=lc(t,e,J,o,s,f,x,m,I,r.vertical?wl.horizontal:wl.horizontalOnly,Q?Object.keys(r.horizontal):[$],B,O,b,S),Q)break}r.vertical&&(D+=lc(t,e,r.vertical,o,s,f,x,m,I,wl.vertical,["vertical"],B,F,b,S));var K=A?A.boxStartIndex:t.collisionBoxArray.length,tt=A?A.boxEndIndex:t.collisionBoxArray.length,et=L?L.boxStartIndex:t.collisionBoxArray.length,nt=L?L.boxEndIndex:t.collisionBoxArray.length,rt=C?C.boxStartIndex:t.collisionBoxArray.length,it=C?C.boxEndIndex:t.collisionBoxArray.length,ot=P?P.boxStartIndex:t.collisionBoxArray.length,at=P?P.boxEndIndex:t.collisionBoxArray.length,st=-1,lt=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};st=lt(A,st),st=lt(L,st),st=lt(C,st);var ct=(st=lt(P,st))>-1?1:0;ct&&(st*=T/24),t.glyphOffsetArray.length>=vc.MAX_GLYPHS&&M("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,O,F,N,K,tt,et,nt,rt,it,ot,at,c,z,D,R,k,ct,0,h,U,j,st)}(t,p,s,n,r,i,h,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,y,b,T,l,_,w,E,f,e,o,c,u,a)};if("line"===A)for(var I=0,R=Zl(e.geometry,0,0,8192,8192);I<R.length;I+=1)for(var k=R[I],z=0,D=ql(k,x,S,n.vertical||m,r,24,v,t.overscaling,8192);z<D.length;z+=1){var O=D[z];m&&uc(t,m.text,C,O)||P(k,O)}else if("line-center"===A)for(var F=0,B=e.geometry;F<B.length;F+=1){var N=B[F];if(N.length>1){var U=Wl(N,S,n.vertical||m,r,24,v);U&&P(N,U)}}else if("Polygon"===e.type)for(var j=0,V=is(e.geometry,0);j<V.length;j+=1){var G=V[j],H=nc(G,16);P(G[0],new Ol(H.x,H.y,0))}else if("LineString"===e.type)for(var W=0,q=e.geometry;W<q.length;W+=1){var Z=q[W];P(Z,new Ol(Z[0].x,Z[0].y,0))}else if("Point"===e.type)for(var X=0,$=e.geometry;X<$.length;X+=1)for(var J=0,Y=$[X];J<Y.length;J+=1){var Q=Y[J];P([Q],new Ol(Q.x,Q.y,0))}}(t,o,d,N,r,c,p,h,b,U,a)},_=0,x=t.features;_<x.length;_+=1)v();o&&t.generateCollisionDebugBuffers()},t.perspective=function(t,e,n,r,i){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(t[10]=(i+r)*(o=1/(r-i)),t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r),t},t.pick=function(t,e){for(var n={},r=0;r<e.length;r++){var i=e[r];i in t&&(n[i]=t[i])}return n},t.plugin=si,t.polygonIntersectsPolygon=Wo,t.postMapLoadEvent=at,t.postTurnstileEvent=it,t.potpack=vl,t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.register=Nr,t.registerForPluginStateChange=function(t){return t({pluginStatus:ti,pluginURL:ei}),ii.on("pluginStateChange",t),t},t.renderColorRamp=wa,t.rotate=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=r*l+o*s,t[1]=i*l+a*s,t[2]=r*-s+o*l,t[3]=i*-s+a*l,t},t.rotateX=function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],p=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+c*r,t[5]=a*i+u*r,t[6]=s*i+p*r,t[7]=l*i+h*r,t[8]=c*i-o*r,t[9]=u*i-a*r,t[10]=p*i-s*r,t[11]=h*i-l*r,t},t.rotateZ=function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],a=e[1],s=e[2],l=e[3],c=e[4],u=e[5],p=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+c*r,t[1]=a*i+u*r,t[2]=s*i+p*r,t[3]=l*i+h*r,t[4]=c*i-o*r,t[5]=u*i-a*r,t[6]=p*i-s*r,t[7]=h*i-l*r,t},t.scale=function(t,e,n){var r=n[0],i=n[1],o=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.scale$1=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},t.scale$2=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t},t.setCacheLimits=function(t,e){st=t,lt=e},t.setRTLTextPlugin=function(t,e,n){if(void 0===n&&(n=!1),"deferred"===ti||"loading"===ti||"loaded"===ti)throw new Error("setRTLTextPlugin cannot be called multiple times.");ei=B.resolveURL(t),ti="deferred",Kr=e,ri(),n||ai()},t.sphericalToCartesian=function(t){var e=t[0],n=t[1],r=t[2];return n+=90,n*=Math.PI/180,r*=Math.PI/180,{x:e*Math.cos(n)*Math.sin(r),y:e*Math.sin(n)*Math.sin(r),z:e*Math.cos(r)}},t.sqrLen=function(t){var e=t[0],n=t[1];return e*e+n*n},t.styleSpec=Pt,t.sub=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t},t.symbolSize=Ul,t.transformMat3=function(t,e,n){var r=e[0],i=e[1],o=e[2];return t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8],t},t.transformMat4=ha,t.translate=function(t,e,n){var r,i,o,a,s,l,c,u,p,h,d,f,m=n[0],g=n[1],y=n[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*y+e[12],t[13]=e[1]*m+e[5]*g+e[9]*y+e[13],t[14]=e[2]*m+e[6]*g+e[10]*y+e[14],t[15]=e[3]*m+e[7]*g+e[11]*y+e[15]):(i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],p=e[8],h=e[9],d=e[10],f=e[11],t[0]=r=e[0],t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=c,t[7]=u,t[8]=p,t[9]=h,t[10]=d,t[11]=f,t[12]=r*m+s*g+p*y+e[12],t[13]=i*m+l*g+h*y+e[13],t[14]=o*m+c*g+d*y+e[14],t[15]=a*m+u*g+f*y+e[15]),t},t.triggerPluginCompletionEvent=ni,t.uniqueId=f,t.validateCustomStyleLayer=function(t){var e=[],n=t.id;return void 0===n&&e.push({message:"layers."+n+': missing required property "id"'}),void 0===t.render&&e.push({message:"layers."+n+': missing required method "render"'}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:"layers."+n+': property "renderingMode" must be either "2d" or "3d"'}),e},t.validateLight=Pr,t.validateStyle=Lr,t.values=function(t){var e=[];for(var n in t)e.push(t[n]);return e},t.vectorTile=bs,t.version="1.15.2",t.warnOnce=M,t.webpSupported=U,t.window=a,t.wrap=p}));r(0,(function(t){function e(t){var n=typeof t;if("number"===n||"boolean"===n||"string"===n||null==t)return JSON.stringify(t);if(Array.isArray(t)){for(var r="[",i=0,o=t;i<o.length;i+=1)r+=e(o[i])+",";return r+"]"}for(var a=Object.keys(t).sort(),s="{",l=0;l<a.length;l++)s+=JSON.stringify(a[l])+":"+e(t[a[l]])+",";return s+"}"}function n(n){for(var r="",i=0,o=t.refProperties;i<o.length;i+=1)r+="/"+e(n[o[i]]);return r}var r=function(t){this.keyCache={},t&&this.replace(t)};r.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},r.prototype.update=function(e,r){for(var i=this,o=0,a=e;o<a.length;o+=1){var s=a[o];this._layerConfigs[s.id]=s;var l=this._layers[s.id]=t.createStyleLayer(s);l._featureFilter=t.featureFilter(l.filter),this.keyCache[s.id]&&delete this.keyCache[s.id]}for(var c=0,u=r;c<u.length;c+=1){var p=u[c];delete this.keyCache[p],delete this._layerConfigs[p],delete this._layers[p]}this.familiesBySource={};for(var h=0,d=function(t,e){for(var r={},i=0;i<t.length;i++){var o=e&&e[t[i].id]||n(t[i]);e&&(e[t[i].id]=o);var a=r[o];a||(a=r[o]=[]),a.push(t[i])}var s=[];for(var l in r)s.push(r[l]);return s}(t.values(this._layerConfigs),this.keyCache);h<d.length;h+=1){var f=d[h].map((function(t){return i._layers[t.id]})),m=f[0];if("none"!==m.visibility){var g=m.source||"",y=this.familiesBySource[g];y||(y=this.familiesBySource[g]={});var v=m.sourceLayer||"_geojsonTileLayer",_=y[v];_||(_=y[v]=[]),_.push(f)}}};var i=function(e){var n={},r=[];for(var i in e){var o=e[i],a=n[i]={};for(var s in o){var l=o[+s];if(l&&0!==l.bitmap.width&&0!==l.bitmap.height){var c={x:0,y:0,w:l.bitmap.width+2,h:l.bitmap.height+2};r.push(c),a[s]={rect:c,metrics:l.metrics}}}}var u=t.potpack(r),p=new t.AlphaImage({width:u.w||1,height:u.h||1});for(var h in e){var d=e[h];for(var f in d){var m=d[+f];if(m&&0!==m.bitmap.width&&0!==m.bitmap.height){var g=n[h][f].rect;t.AlphaImage.copy(m.bitmap,p,{x:0,y:0},{x:g.x+1,y:g.y+1},m.bitmap)}}}this.image=p,this.positions=n};t.register("GlyphAtlas",i);var o=function(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId};function a(e,n,r){for(var i=new t.EvaluationParameters(n),o=0,a=e;o<a.length;o+=1)a[o].recalculate(i,r)}function s(e,n){var r=t.getArrayBuffer(e.request,(function(e,r,i,o){e?n(e):r&&n(null,{vectorTile:new t.vectorTile.VectorTile(new t.pbf(r)),rawData:r,cacheControl:i,expires:o})}));return function(){r.cancel(),n()}}o.prototype.parse=function(e,n,r,o,s){var l=this;this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;var c=new t.DictionaryCoder(Object.keys(e.layers).sort()),u=new t.FeatureIndex(this.tileID,this.promoteId);u.bucketLayerIDs=[];var p,h,d,f,m={},g={featureIndex:u,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:r},y=n.familiesBySource[this.source];for(var v in y){var _=e.layers[v];if(_){1===_.version&&t.warnOnce('Vector tile source "'+this.source+'" layer "'+v+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var x=c.encode(v),b=[],w=0;w<_.length;w++){var M=_.feature(w),S=u.getId(M,v);b.push({feature:M,id:S,index:w,sourceLayerIndex:x})}for(var T=0,E=y[v];T<E.length;T+=1){var A=E[T],C=A[0];C.minzoom&&this.zoom<Math.floor(C.minzoom)||C.maxzoom&&this.zoom>=C.maxzoom||"none"!==C.visibility&&(a(A,this.zoom,r),(m[C.id]=C.createBucket({index:u.bucketLayerIDs.length,layers:A,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:x,sourceID:this.source})).populate(b,g,this.tileID.canonical),u.bucketLayerIDs.push(A.map((function(t){return t.id}))))}}}var L=t.mapObject(g.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(L).length?o.send("getGlyphs",{uid:this.uid,stacks:L},(function(t,e){p||(p=t,h=e,R.call(l))})):h={};var P=Object.keys(g.iconDependencies);P.length?o.send("getImages",{icons:P,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){p||(p=t,d=e,R.call(l))})):d={};var I=Object.keys(g.patternDependencies);function R(){if(p)return s(p);if(h&&d&&f){var e=new i(h),n=new t.ImageAtlas(d,f);for(var o in m){var l=m[o];l instanceof t.SymbolBucket?(a(l.layers,this.zoom,r),t.performSymbolLayout(l,h,e.positions,d,n.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):l.hasPattern&&(l instanceof t.LineBucket||l instanceof t.FillBucket||l instanceof t.FillExtrusionBucket)&&(a(l.layers,this.zoom,r),l.addFeatures(g,this.tileID.canonical,n.patternPositions))}this.status="done",s(null,{buckets:t.values(m).filter((function(t){return!t.isEmpty()})),featureIndex:u,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:n,glyphMap:this.returnDependencies?h:null,iconMap:this.returnDependencies?d:null,glyphPositions:this.returnDependencies?e.positions:null})}}I.length?o.send("getImages",{icons:I,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){p||(p=t,f=e,R.call(l))})):f={},R.call(this)};var l=function(t,e,n,r){this.actor=t,this.layerIndex=e,this.availableImages=n,this.loadVectorData=r||s,this.loading={},this.loaded={}};l.prototype.loadTile=function(e,n){var r=this,i=e.uid;this.loading||(this.loading={});var a=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),s=this.loading[i]=new o(e);s.abort=this.loadVectorData(e,(function(e,o){if(delete r.loading[i],e||!o)return s.status="done",r.loaded[i]=s,n(e);var l=o.rawData,c={};o.expires&&(c.expires=o.expires),o.cacheControl&&(c.cacheControl=o.cacheControl);var u={};if(a){var p=a.finish();p&&(u.resourceTiming=JSON.parse(JSON.stringify(p)))}s.vectorTile=o.vectorTile,s.parse(o.vectorTile,r.layerIndex,r.availableImages,r.actor,(function(e,r){if(e||!r)return n(e);n(null,t.extend({rawTileData:l.slice(0)},r,c,u))})),r.loaded=r.loaded||{},r.loaded[i]=s}))},l.prototype.reloadTile=function(t,e){var n=this,r=this.loaded,i=t.uid,o=this;if(r&&r[i]){var a=r[i];a.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,r){var i=a.reloadCallback;i&&(delete a.reloadCallback,a.parse(a.vectorTile,o.layerIndex,n.availableImages,o.actor,i)),e(t,r)};"parsing"===a.status?a.reloadCallback=s:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},l.prototype.abortTile=function(t,e){var n=this.loading,r=t.uid;n&&n[r]&&n[r].abort&&(n[r].abort(),delete n[r]),e()},l.prototype.removeTile=function(t,e){var n=this.loaded,r=t.uid;n&&n[r]&&delete n[r],e()};var c=t.window.ImageBitmap,u=function(){this.loaded={}};function p(t,e){if(0!==t.length){h(t[0],e);for(var n=1;n<t.length;n++)h(t[n],!e)}}function h(t,e){for(var n=0,r=0,i=t.length,o=i-1;r<i;o=r++)n+=(t[r][0]-t[o][0])*(t[o][1]+t[r][1]);n>=0!=!!e&&t.reverse()}u.prototype.loadTile=function(e,n){var r=e.uid,i=e.encoding,o=e.rawImageData,a=c&&o instanceof c?this.getImageData(o):o,s=new t.DEMData(r,a,i);this.loaded=this.loaded||{},this.loaded[r]=s,n(null,s)},u.prototype.getImageData=function(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var n=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:n.width,height:n.height},n.data)},u.prototype.removeTile=function(t){var e=this.loaded,n=t.uid;e&&e[n]&&delete e[n]};var d=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,f=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};f.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],n=0,r=this._feature.geometry;n<r.length;n+=1){var i=r[n];e.push([new t.Point$1(i[0],i[1])])}return e}for(var o=[],a=0,s=this._feature.geometry;a<s.length;a+=1){for(var l=[],c=0,u=s[a];c<u.length;c+=1){var p=u[c];l.push(new t.Point$1(p[0],p[1]))}o.push(l)}return o},f.prototype.toGeoJSON=function(t,e,n){return d.call(this,t,e,n)};var m=function(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e};m.prototype.feature=function(t){return new f(this._features[t])};var g=t.vectorTile.VectorTileFeature,y=v;function v(t,e){this.options=e||{},this.features=t,this.length=t.length}function _(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}v.prototype.feature=function(t){return new _(this.features[t],this.options.extent)},_.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var n=0;n<e.length;n++){for(var r=e[n],i=[],o=0;o<r.length;o++)i.push(new t.Point$1(r[o][0],r[o][1]));this.geometry.push(i)}return this.geometry},_.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,n=-1/0,r=1/0,i=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),n=Math.max(n,l.x),r=Math.min(r,l.y),i=Math.max(i,l.y)}return[e,r,n,i]},_.prototype.toGeoJSON=g.prototype.toGeoJSON;var x=w,b=y;function w(e){var n=new t.pbf;return function(t,e){for(var n in t.layers)e.writeMessage(3,M,t.layers[n])}(e,n),n.finish()}function M(t,e){var n;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(n=0;n<t.length;n++)r.feature=t.feature(n),e.writeMessage(2,S,r);var i=r.keys;for(n=0;n<i.length;n++)e.writeStringField(3,i[n]);var o=r.values;for(n=0;n<o.length;n++)e.writeMessage(4,L,o[n])}function S(t,e){var n=t.feature;void 0!==n.id&&e.writeVarintField(1,n.id),e.writeMessage(2,T,t),e.writeVarintField(3,n.type),e.writeMessage(4,C,n)}function T(t,e){var n=t.feature,r=t.keys,i=t.values,o=t.keycache,a=t.valuecache;for(var s in n.properties){var l=o[s];void 0===l&&(r.push(s),o[s]=l=r.length-1),e.writeVarint(l);var c=n.properties[s],u=typeof c;"string"!==u&&"boolean"!==u&&"number"!==u&&(c=JSON.stringify(c));var p=u+":"+c,h=a[p];void 0===h&&(i.push(c),a[p]=h=i.length-1),e.writeVarint(h)}}function E(t,e){return(e<<3)+(7&t)}function A(t){return t<<1^t>>31}function C(t,e){for(var n=t.loadGeometry(),r=t.type,i=0,o=0,a=n.length,s=0;s<a;s++){var l=n[s],c=1;1===r&&(c=l.length),e.writeVarint(E(1,c));for(var u=3===r?l.length-1:l.length,p=0;p<u;p++){1===p&&1!==r&&e.writeVarint(E(2,u-1));var h=l[p].x-i,d=l[p].y-o;e.writeVarint(A(h)),e.writeVarint(A(d)),i+=h,o+=d}3===r&&e.writeVarint(E(7,1))}}function L(t,e){var n=typeof t;"string"===n?e.writeStringField(1,t):"boolean"===n?e.writeBooleanField(7,t):"number"===n&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}function P(t,e,n,r){I(t,n,r),I(e,2*n,2*r),I(e,2*n+1,2*r+1)}function I(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function R(t,e,n,r){var i=t-n,o=e-r;return i*i+o*o}x.fromVectorTileJs=w,x.fromGeojsonVt=function(t,e){e=e||{};var n={};for(var r in t)n[r]=new y(t[r].features,e),n[r].name=r,n[r].version=e.version,n[r].extent=e.extent;return w({layers:n})},x.GeoJSONWrapper=b;var k=function(t){return t[0]},z=function(t){return t[1]},D=function(t,e,n,r,i){void 0===e&&(e=k),void 0===n&&(n=z),void 0===r&&(r=64),void 0===i&&(i=Float64Array),this.nodeSize=r,this.points=t;for(var o=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(t.length),s=this.coords=new i(2*t.length),l=0;l<t.length;l++)a[l]=l,s[2*l]=e(t[l]),s[2*l+1]=n(t[l]);!function t(e,n,r,i,o,a){if(!(o-i<=r)){var s=i+o>>1;!function t(e,n,r,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,l=r-i+1,c=Math.log(s),u=.5*Math.exp(2*c/3),p=.5*Math.sqrt(c*u*(s-u)/s)*(l-s/2<0?-1:1);t(e,n,r,Math.max(i,Math.floor(r-l*u/s+p)),Math.min(o,Math.floor(r+(s-l)*u/s+p)),a)}var h=n[2*r+a],d=i,f=o;for(P(e,n,i,r),n[2*o+a]>h&&P(e,n,i,o);d<f;){for(P(e,n,d,f),d++,f--;n[2*d+a]<h;)d++;for(;n[2*f+a]>h;)f--}n[2*i+a]===h?P(e,n,i,f):P(e,n,++f,o),f<=r&&(i=f+1),r<=f&&(o=f-1)}}(e,n,s,i,o,a%2),t(e,n,r,i,s-1,a+1),t(e,n,r,s+1,o,a+1)}}(a,s,r,0,a.length-1,0)};D.prototype.range=function(t,e,n,r){return function(t,e,n,r,i,o,a){for(var s,l,c=[0,t.length-1,0],u=[];c.length;){var p=c.pop(),h=c.pop(),d=c.pop();if(h-d<=a)for(var f=d;f<=h;f++)l=e[2*f+1],(s=e[2*f])>=n&&s<=i&&l>=r&&l<=o&&u.push(t[f]);else{var m=Math.floor((d+h)/2);l=e[2*m+1],(s=e[2*m])>=n&&s<=i&&l>=r&&l<=o&&u.push(t[m]);var g=(p+1)%2;(0===p?n<=s:r<=l)&&(c.push(d),c.push(m-1),c.push(g)),(0===p?i>=s:o>=l)&&(c.push(m+1),c.push(h),c.push(g))}}return u}(this.ids,this.coords,t,e,n,r,this.nodeSize)},D.prototype.within=function(t,e,n){return function(t,e,n,r,i,o){for(var a=[0,t.length-1,0],s=[],l=i*i;a.length;){var c=a.pop(),u=a.pop(),p=a.pop();if(u-p<=o)for(var h=p;h<=u;h++)R(e[2*h],e[2*h+1],n,r)<=l&&s.push(t[h]);else{var d=Math.floor((p+u)/2),f=e[2*d],m=e[2*d+1];R(f,m,n,r)<=l&&s.push(t[d]);var g=(c+1)%2;(0===c?n-i<=f:r-i<=m)&&(a.push(p),a.push(d-1),a.push(g)),(0===c?n+i>=f:r+i>=m)&&(a.push(d+1),a.push(u),a.push(g))}}return s}(this.ids,this.coords,t,e,n,this.nodeSize)};var O={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},F=function(t){this.options=H(Object.create(O),t),this.trees=new Array(this.options.maxZoom+1)};function B(t,e,n,r,i){return{x:t,y:e,zoom:1/0,id:n,parentId:-1,numPoints:r,properties:i}}function N(t,e){var n=t.geometry.coordinates,r=n[1];return{x:V(n[0]),y:G(r),zoom:1/0,index:e,parentId:-1}}function U(t){return{type:"Feature",id:t.id,properties:j(t),geometry:{type:"Point",coordinates:[(r=t.x,360*(r-.5)),(e=t.y,n=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(n))/Math.PI-90)]}};var e,n,r}function j(t){var e=t.numPoints,n=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return H(H({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:n})}function V(t){return t/360+.5}function G(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function H(t,e){for(var n in e)t[n]=e[n];return t}function W(t){return t.x}function q(t){return t.y}function Z(t,e,n,r,i,o){var a=i-n,s=o-r;if(0!==a||0!==s){var l=((t-n)*a+(e-r)*s)/(a*a+s*s);l>1?(n=i,r=o):l>0&&(n+=a*l,r+=s*l)}return(a=t-n)*a+(s=e-r)*s}function X(t,e,n,r){var i={id:void 0===t?null:t,type:e,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,n=t.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)$(t,e);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r<e.length;r++)$(t,e[r]);else if("MultiPolygon"===n)for(r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)$(t,e[r][i])}(i),i}function $(t,e){for(var n=0;n<e.length;n+=3)t.minX=Math.min(t.minX,e[n]),t.minY=Math.min(t.minY,e[n+1]),t.maxX=Math.max(t.maxX,e[n]),t.maxY=Math.max(t.maxY,e[n+1])}function J(t,e,n,r){if(e.geometry){var i=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),s=[],l=e.id;if(n.promoteId?l=e.properties[n.promoteId]:n.generateId&&(l=r||0),"Point"===o)Y(i,s);else if("MultiPoint"===o)for(var c=0;c<i.length;c++)Y(i[c],s);else if("LineString"===o)Q(i,s,a,!1);else if("MultiLineString"===o){if(n.lineMetrics){for(c=0;c<i.length;c++)Q(i[c],s=[],a,!1),t.push(X(l,"LineString",s,e.properties));return}K(i,s,a,!1)}else if("Polygon"===o)K(i,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(c=0;c<e.geometry.geometries.length;c++)J(t,{id:l,geometry:e.geometry.geometries[c],properties:e.properties},n,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(c=0;c<i.length;c++){var u=[];K(i[c],u,a,!0),s.push(u)}}t.push(X(l,o,s,e.properties))}}function Y(t,e){e.push(tt(t[0])),e.push(et(t[1])),e.push(0)}function Q(t,e,n,r){for(var i,o,a=0,s=0;s<t.length;s++){var l=tt(t[s][0]),c=et(t[s][1]);e.push(l),e.push(c),e.push(0),s>0&&(a+=r?(i*c-l*o)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(c-o,2))),i=l,o=c}var u=e.length-3;e[2]=1,function t(e,n,r,i){for(var o,a=i,s=r-n>>1,l=r-n,c=e[n],u=e[n+1],p=e[r],h=e[r+1],d=n+3;d<r;d+=3){var f=Z(e[d],e[d+1],c,u,p,h);if(f>a)o=d,a=f;else if(f===a){var m=Math.abs(d-s);m<l&&(o=d,l=m)}}a>i&&(o-n>3&&t(e,n,o,i),e[o+2]=a,r-o>3&&t(e,o,r,i))}(e,0,u,n),e[u+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function K(t,e,n,r){for(var i=0;i<t.length;i++){var o=[];Q(t[i],o,n,r),e.push(o)}}function tt(t){return t/360+.5}function et(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function nt(t,e,n,r,i,o,a,s){if(r/=e,o>=(n/=e)&&a<r)return t;if(a<n||o>=r)return null;for(var l=[],c=0;c<t.length;c++){var u=t[c],p=u.geometry,h=u.type,d=0===i?u.minX:u.minY,f=0===i?u.maxX:u.maxY;if(d>=n&&f<r)l.push(u);else if(!(f<n||d>=r)){var m=[];if("Point"===h||"MultiPoint"===h)rt(p,m,n,r,i);else if("LineString"===h)it(p,m,n,r,i,!1,s.lineMetrics);else if("MultiLineString"===h)at(p,m,n,r,i,!1);else if("Polygon"===h)at(p,m,n,r,i,!0);else if("MultiPolygon"===h)for(var g=0;g<p.length;g++){var y=[];at(p[g],y,n,r,i,!0),y.length&&m.push(y)}if(m.length){if(s.lineMetrics&&"LineString"===h){for(g=0;g<m.length;g++)l.push(X(u.id,h,m[g],u.tags));continue}"LineString"!==h&&"MultiLineString"!==h||(1===m.length?(h="LineString",m=m[0]):h="MultiLineString"),"Point"!==h&&"MultiPoint"!==h||(h=3===m.length?"Point":"MultiPoint"),l.push(X(u.id,h,m,u.tags))}}}return l.length?l:null}function rt(t,e,n,r,i){for(var o=0;o<t.length;o+=3){var a=t[o+i];a>=n&&a<=r&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function it(t,e,n,r,i,o,a){for(var s,l,c=ot(t),u=0===i?lt:ct,p=t.start,h=0;h<t.length-3;h+=3){var d=t[h],f=t[h+1],m=t[h+2],g=t[h+3],y=t[h+4],v=0===i?d:f,_=0===i?g:y,x=!1;a&&(s=Math.sqrt(Math.pow(d-g,2)+Math.pow(f-y,2))),v<n?_>n&&(l=u(c,d,f,g,y,n),a&&(c.start=p+s*l)):v>r?_<r&&(l=u(c,d,f,g,y,r),a&&(c.start=p+s*l)):st(c,d,f,m),_<n&&v>=n&&(l=u(c,d,f,g,y,n),x=!0),_>r&&v<=r&&(l=u(c,d,f,g,y,r),x=!0),!o&&x&&(a&&(c.end=p+s*l),e.push(c),c=ot(t)),a&&(p+=s)}var b=t.length-3;d=t[b],f=t[b+1],m=t[b+2],(v=0===i?d:f)>=n&&v<=r&&st(c,d,f,m),b=c.length-3,o&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&st(c,c[0],c[1],c[2]),c.length&&e.push(c)}function ot(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function at(t,e,n,r,i,o){for(var a=0;a<t.length;a++)it(t[a],e,n,r,i,o,!1)}function st(t,e,n,r){t.push(e),t.push(n),t.push(r)}function lt(t,e,n,r,i,o){var a=(o-e)/(r-e);return t.push(o),t.push(n+(i-n)*a),t.push(1),a}function ct(t,e,n,r,i,o){var a=(o-n)/(i-n);return t.push(e+(r-e)*a),t.push(o),t.push(1),a}function ut(t,e){for(var n=[],r=0;r<t.length;r++){var i,o=t[r],a=o.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)i=pt(o.geometry,e);else if("MultiLineString"===a||"Polygon"===a){i=[];for(var s=0;s<o.geometry.length;s++)i.push(pt(o.geometry[s],e))}else if("MultiPolygon"===a)for(i=[],s=0;s<o.geometry.length;s++){for(var l=[],c=0;c<o.geometry[s].length;c++)l.push(pt(o.geometry[s][c],e));i.push(l)}n.push(X(o.id,a,i,o.tags))}return n}function pt(t,e){var n=[];n.size=t.size,void 0!==t.start&&(n.start=t.start,n.end=t.end);for(var r=0;r<t.length;r+=3)n.push(t[r]+e,t[r+1],t[r+2]);return n}function ht(t,e){if(t.transformed)return t;var n,r,i,o=1<<t.z,a=t.x,s=t.y;for(n=0;n<t.features.length;n++){var l=t.features[n],c=l.geometry,u=l.type;if(l.geometry=[],1===u)for(r=0;r<c.length;r+=2)l.geometry.push(dt(c[r],c[r+1],e,o,a,s));else for(r=0;r<c.length;r++){var p=[];for(i=0;i<c[r].length;i+=2)p.push(dt(c[r][i],c[r][i+1],e,o,a,s));l.geometry.push(p)}}return t.transformed=!0,t}function dt(t,e,n,r,i,o){return[Math.round(n*(t*r-i)),Math.round(n*(e*r-o))]}function ft(t,e,n,r,i){for(var o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,mt(a,t[s],o,i);var l=t[s].minX,c=t[s].minY,u=t[s].maxX,p=t[s].maxY;l<a.minX&&(a.minX=l),c<a.minY&&(a.minY=c),u>a.maxX&&(a.maxX=u),p>a.maxY&&(a.maxY=p)}return a}function mt(t,e,n,r){var i=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)gt(a,i,t,n,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(s=0;s<i.length;s++)gt(a,i[s],t,n,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(var l=0;l<i.length;l++){var c=i[l];for(s=0;s<c.length;s++)gt(a,c[s],t,n,!0,0===s)}if(a.length){var u=e.tags||null;if("LineString"===o&&r.lineMetrics){for(var p in u={},e.tags)u[p]=e.tags[p];u.mapbox_clip_start=i.start/i.size,u.mapbox_clip_end=i.end/i.size}var h={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:u};null!==e.id&&(h.id=e.id),t.features.push(h)}}function gt(t,e,n,r,i,o){var a=r*r;if(r>0&&e.size<(i?a:r))n.numPoints+=e.length/3;else{for(var s=[],l=0;l<e.length;l+=3)(0===r||e[l+2]>a)&&(n.numSimplified++,s.push(e[l]),s.push(e[l+1])),n.numPoints++;i&&function(t,e){for(var n=0,r=0,i=t.length,o=i-2;r<i;o=r,r+=2)n+=(t[r]-t[o])*(t[r+1]+t[o+1]);if(n>0===e)for(r=0,i=t.length;r<i/2;r+=2){var a=t[r],s=t[r+1];t[r]=t[i-2-r],t[r+1]=t[i-1-r],t[i-2-r]=a,t[i-1-r]=s}}(s,o),t.push(s)}}function yt(t,e){var n=(e=this.options=function(t,e){for(var n in e)t[n]=e[n];return t}(Object.create(this.options),e)).debug;if(n&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(t,e){var n=[];if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)J(n,t.features[r],e,r);else J(n,"Feature"===t.type?t:{geometry:t},e);return n}(t,e);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(r=function(t,e){var n=e.buffer/e.extent,r=t,i=nt(t,1,-1-n,n,0,-1,2,e),o=nt(t,1,1-n,2+n,0,-1,2,e);return(i||o)&&(r=nt(t,1,-n,1+n,0,-1,2,e)||[],i&&(r=ut(i,1).concat(r)),o&&(r=r.concat(ut(o,-1)))),r}(r,e)).length&&this.splitTile(r,0,0,0),n&&(r.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function vt(t,e,n){return 32*((1<<t)*n+e)+t}function _t(t,e){var n=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);var r=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!r)return e(null,null);var i=new m(r.features),o=x(i);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:i,rawData:o.buffer})}F.prototype.load=function(t){var e=this.options,n=e.log,r=e.minZoom,i=e.maxZoom,o=e.nodeSize;n&&console.time("total time");var a="prepare "+t.length+" points";n&&console.time(a),this.points=t;for(var s=[],l=0;l<t.length;l++)t[l].geometry&&s.push(N(t[l],l));this.trees[i+1]=new D(s,W,q,o,Float32Array),n&&console.timeEnd(a);for(var c=i;c>=r;c--){var u=+Date.now();s=this._cluster(s,c),this.trees[c]=new D(s,W,q,o,Float32Array),n&&console.log("z%d: %d clusters in %dms",c,s.length,+Date.now()-u)}return n&&console.timeEnd("total time"),this},F.prototype.getClusters=function(t,e){var n=((t[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,t[1])),i=180===t[2]?180:((t[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,i=180;else if(n>i){var a=this.getClusters([n,r,180,o],e),s=this.getClusters([-180,r,i,o],e);return a.concat(s)}for(var l=this.trees[this._limitZoom(e)],c=[],u=0,p=l.range(V(n),G(o),V(i),G(r));u<p.length;u+=1){var h=l.points[p[u]];c.push(h.numPoints?U(h):this.points[h.index])}return c},F.prototype.getChildren=function(t){var e=this._getOriginId(t),n=this._getOriginZoom(t),r="No cluster with the specified id.",i=this.trees[n];if(!i)throw new Error(r);var o=i.points[e];if(!o)throw new Error(r);for(var a=this.options.radius/(this.options.extent*Math.pow(2,n-1)),s=[],l=0,c=i.within(o.x,o.y,a);l<c.length;l+=1){var u=i.points[c[l]];u.parentId===t&&s.push(u.numPoints?U(u):this.points[u.index])}if(0===s.length)throw new Error(r);return s},F.prototype.getLeaves=function(t,e,n){var r=[];return this._appendLeaves(r,t,e=e||10,n=n||0,0),r},F.prototype.getTile=function(t,e,n){var r=this.trees[this._limitZoom(t)],i=Math.pow(2,t),o=this.options,a=o.radius/o.extent,s=(n-a)/i,l=(n+1+a)/i,c={features:[]};return this._addTileFeatures(r.range((e-a)/i,s,(e+1+a)/i,l),r.points,e,n,i,c),0===e&&this._addTileFeatures(r.range(1-a/i,s,1,l),r.points,i,n,i,c),e===i-1&&this._addTileFeatures(r.range(0,s,a/i,l),r.points,-1,n,i,c),c.features.length?c:null},F.prototype.getClusterExpansionZoom=function(t){for(var e=this._getOriginZoom(t)-1;e<=this.options.maxZoom;){var n=this.getChildren(t);if(e++,1!==n.length)break;t=n[0].properties.cluster_id}return e},F.prototype._appendLeaves=function(t,e,n,r,i){for(var o=0,a=this.getChildren(e);o<a.length;o+=1){var s=a[o],l=s.properties;if(l&&l.cluster?i+l.point_count<=r?i+=l.point_count:i=this._appendLeaves(t,l.cluster_id,n,r,i):i<r?i++:t.push(s),t.length===n)break}return i},F.prototype._addTileFeatures=function(t,e,n,r,i,o){for(var a=0,s=t;a<s.length;a+=1){var l=e[s[a]],c=l.numPoints,u={type:1,geometry:[[Math.round(this.options.extent*(l.x*i-n)),Math.round(this.options.extent*(l.y*i-r))]],tags:c?j(l):this.points[l.index].properties},p=void 0;c?p=l.id:this.options.generateId?p=l.index:this.points[l.index].id&&(p=this.points[l.index].id),void 0!==p&&(u.id=p),o.features.push(u)}},F.prototype._limitZoom=function(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))},F.prototype._cluster=function(t,e){for(var n=[],r=this.options,i=r.reduce,o=r.minPoints,a=r.radius/(r.extent*Math.pow(2,e)),s=0;s<t.length;s++){var l=t[s];if(!(l.zoom<=e)){l.zoom=e;for(var c=this.trees[e+1],u=c.within(l.x,l.y,a),p=l.numPoints||1,h=p,d=0,f=u;d<f.length;d+=1){var m=c.points[f[d]];m.zoom>e&&(h+=m.numPoints||1)}if(h>=o){for(var g=l.x*p,y=l.y*p,v=i&&p>1?this._map(l,!0):null,_=(s<<5)+(e+1)+this.points.length,x=0,b=u;x<b.length;x+=1){var w=c.points[b[x]];if(!(w.zoom<=e)){w.zoom=e;var M=w.numPoints||1;g+=w.x*M,y+=w.y*M,w.parentId=_,i&&(v||(v=this._map(l,!0)),i(v,this._map(w)))}}l.parentId=_,n.push(B(g/h,y/h,_,h,v))}else if(n.push(l),h>1)for(var S=0,T=u;S<T.length;S+=1){var E=c.points[T[S]];E.zoom<=e||(E.zoom=e,n.push(E))}}}return n},F.prototype._getOriginId=function(t){return t-this.points.length>>5},F.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},F.prototype._map=function(t,e){if(t.numPoints)return e?H({},t.properties):t.properties;var n=this.points[t.index].properties,r=this.options.map(n);return e&&r===n?H({},r):r},yt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},yt.prototype.splitTile=function(t,e,n,r,i,o,a){for(var s=[t,e,n,r],l=this.options,c=l.debug;s.length;){r=s.pop(),n=s.pop(),e=s.pop(),t=s.pop();var u=1<<e,p=vt(e,n,r),h=this.tiles[p];if(!h&&(c>1&&console.time("creation"),h=this.tiles[p]=ft(t,e,n,r,l),this.tileCoords.push({z:e,x:n,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,n,r,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var d="z"+e;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(h.source=t,i){if(e===l.maxZoom||e===i)continue;var f=1<<i-e;if(n!==Math.floor(o/f)||r!==Math.floor(a/f))continue}else if(e===l.indexMaxZoom||h.numPoints<=l.indexMaxPoints)continue;if(h.source=null,0!==t.length){c>1&&console.time("clipping");var m,g,y,v,_,x,b=.5*l.buffer/l.extent,w=.5-b,M=.5+b,S=1+b;m=g=y=v=null,_=nt(t,u,n-b,n+M,0,h.minX,h.maxX,l),x=nt(t,u,n+w,n+S,0,h.minX,h.maxX,l),t=null,_&&(m=nt(_,u,r-b,r+M,1,h.minY,h.maxY,l),g=nt(_,u,r+w,r+S,1,h.minY,h.maxY,l),_=null),x&&(y=nt(x,u,r-b,r+M,1,h.minY,h.maxY,l),v=nt(x,u,r+w,r+S,1,h.minY,h.maxY,l),x=null),c>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*n,2*r),s.push(g||[],e+1,2*n,2*r+1),s.push(y||[],e+1,2*n+1,2*r),s.push(v||[],e+1,2*n+1,2*r+1)}}},yt.prototype.getTile=function(t,e,n){var r=this.options,i=r.extent,o=r.debug;if(t<0||t>24)return null;var a=1<<t,s=vt(t,e=(e%a+a)%a,n);if(this.tiles[s])return ht(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",t,e,n);for(var l,c=t,u=e,p=n;!l&&c>0;)c--,u=Math.floor(u/2),p=Math.floor(p/2),l=this.tiles[vt(c,u,p)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",c,u,p),o>1&&console.time("drilling down"),this.splitTile(l.source,c,u,p,t,e,n),o>1&&console.timeEnd("drilling down"),this.tiles[s]?ht(this.tiles[s],i):null):null};var xt=function(e){function n(t,n,r,i){e.call(this,t,n,r,_t),i&&(this.loadGeoJSON=i)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},n.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var n=this._pendingCallback,r=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var i=!!(r&&r.request&&r.request.collectResourceTiming)&&new t.RequestPerformance(r.request);this.loadGeoJSON(r,(function(o,a){if(o||!a)return n(o);if("object"!=typeof a)return n(new Error("Input data given to '"+r.source+"' is not a valid GeoJSON object."));!function t(e,n){var r,i=e&&e.type;if("FeatureCollection"===i)for(r=0;r<e.features.length;r++)t(e.features[r],n);else if("GeometryCollection"===i)for(r=0;r<e.geometries.length;r++)t(e.geometries[r],n);else if("Feature"===i)t(e.geometry,n);else if("Polygon"===i)p(e.coordinates,n);else if("MultiPolygon"===i)for(r=0;r<e.coordinates.length;r++)p(e.coordinates[r],n);return e}(a,!0);try{if(r.filter){var s=t.createExpression(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===s.result)throw new Error(s.value.map((function(t){return t.key+": "+t.message})).join(", "));var l=a.features.filter((function(t){return s.value.evaluate({zoom:0},t)}));a={type:"FeatureCollection",features:l}}e._geoJSONIndex=r.cluster?new F(function(e){var n=e.superclusterOptions,r=e.clusterProperties;if(!r||!n)return n;for(var i={},o={},a={accumulated:null,zoom:0},s={properties:null},l=Object.keys(r),c=0,u=l;c<u.length;c+=1){var p=u[c],h=r[p],d=h[0],f=t.createExpression(h[1]),m=t.createExpression("string"==typeof d?[d,["accumulated"],["get",p]]:d);i[p]=f.value,o[p]=m.value}return n.map=function(t){s.properties=t;for(var e={},n=0,r=l;n<r.length;n+=1){var o=r[n];e[o]=i[o].evaluate(a,s)}return e},n.reduce=function(t,e){s.properties=e;for(var n=0,r=l;n<r.length;n+=1){var i=r[n];a.accumulated=t[i],t[i]=o[i].evaluate(a,s)}},n}(r)).load(a.features):function(t,e){return new yt(t,e)}(a,r.geojsonVtOptions)}catch(o){return n(o)}e.loaded={};var c={};if(i){var u=i.finish();u&&(c.resourceTiming={},c.resourceTiming[r.source]=JSON.parse(JSON.stringify(u)))}n(null,c)}))}},n.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())},n.prototype.reloadTile=function(t,n){var r=this.loaded;return r&&r[t.uid]?e.prototype.reloadTile.call(this,t,n):this.loadTile(t,n)},n.prototype.loadGeoJSON=function(e,n){if(e.request)t.getJSON(e.request,n);else{if("string"!=typeof e.data)return n(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."));try{return n(null,JSON.parse(e.data))}catch(t){return n(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."))}}},n.prototype.removeSource=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()},n.prototype.getClusterExpansionZoom=function(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}},n.prototype.getClusterChildren=function(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}},n.prototype.getClusterLeaves=function(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}},n}(l),bt=function(e){var n=this;this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:l,geojson:xt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(t,e){if(n.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');n.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=function(e){if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}};return bt.prototype.setReferrer=function(t,e){this.referrer=e},bt.prototype.setImages=function(t,e,n){for(var r in this.availableImages[t]=e,this.workerSources[t]){var i=this.workerSources[t][r];for(var o in i)i[o].availableImages=e}n()},bt.prototype.setLayers=function(t,e,n){this.getLayerIndex(t).replace(e),n()},bt.prototype.updateLayers=function(t,e,n){this.getLayerIndex(t).update(e.layers,e.removedIds),n()},bt.prototype.loadTile=function(t,e,n){this.getWorkerSource(t,e.type,e.source).loadTile(e,n)},bt.prototype.loadDEMTile=function(t,e,n){this.getDEMWorkerSource(t,e.source).loadTile(e,n)},bt.prototype.reloadTile=function(t,e,n){this.getWorkerSource(t,e.type,e.source).reloadTile(e,n)},bt.prototype.abortTile=function(t,e,n){this.getWorkerSource(t,e.type,e.source).abortTile(e,n)},bt.prototype.removeTile=function(t,e,n){this.getWorkerSource(t,e.type,e.source).removeTile(e,n)},bt.prototype.removeDEMTile=function(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)},bt.prototype.removeSource=function(t,e,n){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var r=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==r.removeSource?r.removeSource(e,n):n()}},bt.prototype.loadWorkerSource=function(t,e,n){try{this.self.importScripts(e.url),n()}catch(t){n(t.toString())}},bt.prototype.syncRTLPluginState=function(e,n,r){try{t.plugin.setState(n);var i=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=i){this.self.importScripts(i);var o=t.plugin.isParsed();r(o?void 0:new Error("RTL Text Plugin failed to import scripts from "+i),o)}}catch(t){r(t.toString())}},bt.prototype.getAvailableImages=function(t){var e=this.availableImages[t];return e||(e=[]),e},bt.prototype.getLayerIndex=function(t){var e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new r),e},bt.prototype.getWorkerSource=function(t,e,n){var r=this;return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][n]||(this.workerSources[t][e][n]=new this.workerSourceTypes[e]({send:function(e,n,i){r.actor.send(e,n,i,t)}},this.getLayerIndex(t),this.getAvailableImages(t))),this.workerSources[t][e][n]},bt.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new u),this.demWorkerSources[t][e]},bt.prototype.enforceCacheSizeLimit=function(e,n){t.enforceCacheSizeLimit(n)},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new bt(self)),bt}));r(0,(function(t){var e=t.createCommonjsModule((function(t){function e(t){return!n(t)}function n(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,n=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(n);try{e=new Worker(r),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(r),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var n=e.getImageData(0,0,1,1);return n&&n.width===t.width}()?(void 0===r[n=t&&t.failIfMajorPerformanceCaveat]&&(r[n]=function(t){var n=function(t){var n=document.createElement("canvas"),r=Object.create(e.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,n.probablySupportsContext?n.probablySupportsContext("webgl",r)||n.probablySupportsContext("experimental-webgl",r):n.supportsContext?n.supportsContext("webgl",r)||n.supportsContext("experimental-webgl",r):n.getContext("webgl",r)||n.getContext("experimental-webgl",r)}(t);if(!n)return!1;var r=n.createShader(n.VERTEX_SHADER);return!(!r||n.isContextLost())&&(n.shaderSource(r,"void main() {}"),n.compileShader(r),!0===n.getShaderParameter(r,n.COMPILE_STATUS))}(n)),r[n]?void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e,window.mapboxgl.notSupportedReason=n);var r={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}})),n={create:function(e,n,r){var i=t.window.document.createElement(e);return void 0!==n&&(i.className=n),r&&r.appendChild(i),i},createNS:function(e,n){return t.window.document.createElementNS(e,n)}},r=t.window.document&&t.window.document.documentElement.style;function i(t){if(!r)return t[0];for(var e=0;e<t.length;e++)if(t[e]in r)return t[e];return t[0]}var o,a=i(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);n.disableDrag=function(){r&&a&&(o=r[a],r[a]="none")},n.enableDrag=function(){r&&a&&(r[a]=o)};var s=i(["transform","WebkitTransform"]);n.setTransform=function(t,e){t.style[s]=e};var l=!1;try{var c=Object.defineProperty({},"passive",{get:function(){l=!0}});t.window.addEventListener("test",c,c),t.window.removeEventListener("test",c,c)}catch(t){l=!1}n.addEventListener=function(t,e,n,r){void 0===r&&(r={}),t.addEventListener(e,n,"passive"in r&&l?r:r.capture)},n.removeEventListener=function(t,e,n,r){void 0===r&&(r={}),t.removeEventListener(e,n,"passive"in r&&l?r:r.capture)};var u=function(e){e.preventDefault(),e.stopPropagation(),t.window.removeEventListener("click",u,!0)};function p(t){var e=t.userImage;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}n.suppressClick=function(){t.window.addEventListener("click",u,!0),t.window.setTimeout((function(){t.window.removeEventListener("click",u,!0)}),0)},n.mousePos=function(e,n){var r=e.getBoundingClientRect();return new t.Point(n.clientX-r.left-e.clientLeft,n.clientY-r.top-e.clientTop)},n.touchPos=function(e,n){for(var r=e.getBoundingClientRect(),i=[],o=0;o<n.length;o++)i.push(new t.Point(n[o].clientX-r.left-e.clientLeft,n[o].clientY-r.top-e.clientTop));return i},n.mouseButton=function(e){return void 0!==t.window.InstallTrigger&&2===e.button&&e.ctrlKey&&t.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button},n.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var h=function(e){function n(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.isLoaded=function(){return this.loaded},n.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,n=this.requestors;e<n.length;e+=1){var r=n[e];this._notify(r.ids,r.callback)}this.requestors=[]}},n.prototype.getImage=function(t){return this.images[t]},n.prototype.addImage=function(t,e){this._validate(t,e)&&(this.images[t]=e)},n.prototype._validate=function(e,n){var r=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchX" value'))),r=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchY" value'))),r=!1),this._validateContent(n.content,n)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "content" value'))),r=!1),r},n.prototype._validateStretch=function(t,e){if(!t)return!0;for(var n=0,r=0,i=t;r<i.length;r+=1){var o=i[r];if(o[0]<n||o[1]<o[0]||e<o[1])return!1;n=o[1]}return!0},n.prototype._validateContent=function(t,e){return!(t&&(4!==t.length||t[0]<0||e.data.width<t[0]||t[1]<0||e.data.height<t[1]||t[2]<0||e.data.width<t[2]||t[3]<0||e.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))},n.prototype.updateImage=function(t,e){e.version=this.images[t].version+1,this.images[t]=e,this.updatedImages[t]=!0},n.prototype.removeImage=function(t){var e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()},n.prototype.listImages=function(){return Object.keys(this.images)},n.prototype.getImages=function(t,e){var n=!0;if(!this.isLoaded())for(var r=0,i=t;r<i.length;r+=1)this.images[i[r]]||(n=!1);this.isLoaded()||n?this._notify(t,e):this.requestors.push({ids:t,callback:e})},n.prototype._notify=function(e,n){for(var r={},i=0,o=e;i<o.length;i+=1){var a=o[i];this.images[a]||this.fire(new t.Event("styleimagemissing",{id:a}));var s=this.images[a];s?r[a]={data:s.data.clone(),pixelRatio:s.pixelRatio,sdf:s.sdf,version:s.version,stretchX:s.stretchX,stretchY:s.stretchY,content:s.content,hasRenderCallback:Boolean(s.userImage&&s.userImage.render)}:t.warnOnce('Image "'+a+'" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.')}n(null,r)},n.prototype.getPixelSize=function(){var t=this.atlasImage;return{width:t.width,height:t.height}},n.prototype.getPattern=function(e){var n=this.patterns[e],r=this.getImage(e);if(!r)return null;if(n&&n.position.version===r.version)return n.position;if(n)n.position.version=r.version;else{var i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},o=new t.ImagePosition(i,r);this.patterns[e]={bin:i,position:o}}return this._updatePatternAtlas(),this.patterns[e].position},n.prototype.bind=function(e){var n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.Texture(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)},n.prototype._updatePatternAtlas=function(){var e=[];for(var n in this.patterns)e.push(this.patterns[n].bin);var r=t.potpack(e),i=r.w,o=r.h,a=this.atlasImage;for(var s in a.resize({width:i||1,height:o||1}),this.patterns){var l=this.patterns[s].bin,c=l.x+1,u=l.y+1,p=this.images[s].data,h=p.width,d=p.height;t.RGBAImage.copy(p,a,{x:0,y:0},{x:c,y:u},{width:h,height:d}),t.RGBAImage.copy(p,a,{x:0,y:d-1},{x:c,y:u-1},{width:h,height:1}),t.RGBAImage.copy(p,a,{x:0,y:0},{x:c,y:u+d},{width:h,height:1}),t.RGBAImage.copy(p,a,{x:h-1,y:0},{x:c-1,y:u},{width:1,height:d}),t.RGBAImage.copy(p,a,{x:0,y:0},{x:c+h,y:u},{width:1,height:d})}this.dirty=!0},n.prototype.beginFrame=function(){this.callbackDispatchedThisFrame={}},n.prototype.dispatchRenderCallbacks=function(t){for(var e=0,n=t;e<n.length;e+=1){var r=n[e];if(!this.callbackDispatchedThisFrame[r]){this.callbackDispatchedThisFrame[r]=!0;var i=this.images[r];p(i)&&this.updateImage(r,i)}}},n}(t.Evented),d=g,f=g,m=1e20;function g(t,e,n,r,i,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=r||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=n||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.d=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Int16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function y(t,e,n,r,i,o,a){for(var s=0;s<e;s++){for(var l=0;l<n;l++)r[l]=t[l*e+s];for(v(r,i,o,a,n),l=0;l<n;l++)t[l*e+s]=i[l]}for(l=0;l<n;l++){for(s=0;s<e;s++)r[s]=t[l*e+s];for(v(r,i,o,a,e),s=0;s<e;s++)t[l*e+s]=Math.sqrt(i[s])}}function v(t,e,n,r,i){n[0]=0,r[0]=-m,r[1]=+m;for(var o=1,a=0;o<i;o++){for(var s=(t[o]+o*o-(t[n[a]]+n[a]*n[a]))/(2*o-2*n[a]);s<=r[a];)a--,s=(t[o]+o*o-(t[n[a]]+n[a]*n[a]))/(2*o-2*n[a]);n[++a]=o,r[a]=s,r[a+1]=+m}for(o=0,a=0;o<i;o++){for(;r[a+1]<o;)a++;e[o]=(o-n[a])*(o-n[a])+t[n[a]]}}g.prototype.draw=function(t){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(t,this.buffer,this.middle);for(var e=this.ctx.getImageData(0,0,this.size,this.size),n=new Uint8ClampedArray(this.size*this.size),r=0;r<this.size*this.size;r++){var i=e.data[4*r+3]/255;this.gridOuter[r]=1===i?0:0===i?m:Math.pow(Math.max(0,.5-i),2),this.gridInner[r]=1===i?m:0===i?0:Math.pow(Math.max(0,i-.5),2)}for(y(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),y(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),r=0;r<this.size*this.size;r++)n[r]=Math.max(0,Math.min(255,Math.round(255-255*((this.gridOuter[r]-this.gridInner[r])/this.radius+this.cutoff))));return n},d.default=f;var _=function(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}};_.prototype.setURL=function(t){this.url=t},_.prototype.getGlyphs=function(e,n){var r=this,i=[];for(var o in e)for(var a=0,s=e[o];a<s.length;a+=1)i.push({stack:o,id:s[a]});t.asyncAll(i,(function(t,e){var n=t.stack,i=t.id,o=r.entries[n];o||(o=r.entries[n]={glyphs:{},requests:{},ranges:{}});var a=o.glyphs[i];if(void 0===a){if(a=r._tinySDF(o,n,i))return o.glyphs[i]=a,void e(null,{stack:n,id:i,glyph:a});var s=Math.floor(i/256);if(256*s>65535)e(new Error("glyphs > 65535 not supported"));else if(o.ranges[s])e(null,{stack:n,id:i,glyph:a});else{var l=o.requests[s];l||(l=o.requests[s]=[],_.loadGlyphRange(n,s,r.url,r.requestManager,(function(t,e){if(e){for(var n in e)r._doesCharSupportLocalGlyph(+n)||(o.glyphs[+n]=e[+n]);o.ranges[s]=!0}for(var i=0,a=l;i<a.length;i+=1)(0,a[i])(t,e);delete o.requests[s]}))),l.push((function(t,r){t?e(t):r&&e(null,{stack:n,id:i,glyph:r[i]||null})}))}}else e(null,{stack:n,id:i,glyph:a})}),(function(t,e){if(t)n(t);else if(e){for(var r={},i=0,o=e;i<o.length;i+=1){var a=o[i],s=a.stack,l=a.id,c=a.glyph;(r[s]||(r[s]={}))[l]=c&&{id:c.id,bitmap:c.bitmap.clone(),metrics:c.metrics}}n(null,r)}}))},_.prototype._doesCharSupportLocalGlyph=function(e){return!!this.localIdeographFontFamily&&(t.isChar["CJK Unified Ideographs"](e)||t.isChar["Hangul Syllables"](e)||t.isChar.Hiragana(e)||t.isChar.Katakana(e))},_.prototype._tinySDF=function(e,n,r){var i=this.localIdeographFontFamily;if(i&&this._doesCharSupportLocalGlyph(r)){var o=e.tinySDF;if(!o){var a="400";/bold/i.test(n)?a="900":/medium/i.test(n)?a="500":/light/i.test(n)&&(a="200"),o=e.tinySDF=new _.TinySDF(24,3,8,.25,i,a)}return{id:r,bitmap:new t.AlphaImage({width:30,height:30},o.draw(String.fromCharCode(r))),metrics:{width:24,height:24,left:0,top:-8,advance:24}}}},_.loadGlyphRange=function(e,n,r,i,o){var a=256*n,s=a+255,l=i.transformRequest(i.normalizeGlyphsURL(r).replace("{fontstack}",e).replace("{range}",a+"-"+s),t.ResourceType.Glyphs);t.getArrayBuffer(l,(function(e,n){if(e)o(e);else if(n){for(var r={},i=0,a=t.parseGlyphPBF(n);i<a.length;i+=1){var s=a[i];r[s.id]=s}o(null,r)}}))},_.TinySDF=d;var x=function(){this.specification=t.styleSpec.light.position};x.prototype.possiblyEvaluate=function(e,n){return t.sphericalToCartesian(e.expression.evaluate(n))},x.prototype.interpolate=function(e,n,r){return{x:t.number(e.x,n.x,r),y:t.number(e.y,n.y,r),z:t.number(e.z,n.z,r)}};var b=new t.Properties({anchor:new t.DataConstantProperty(t.styleSpec.light.anchor),position:new x,color:new t.DataConstantProperty(t.styleSpec.light.color),intensity:new t.DataConstantProperty(t.styleSpec.light.intensity)}),w=function(e){function n(n){e.call(this),this._transitionable=new t.Transitionable(b),this.setLight(n),this._transitioning=this._transitionable.untransitioned()}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.getLight=function(){return this._transitionable.serialize()},n.prototype.setLight=function(e,n){if(void 0===n&&(n={}),!this._validate(t.validateLight,e,n))for(var r in e){var i=e[r];t.endsWith(r,"-transition")?this._transitionable.setTransition(r.slice(0,-"-transition".length),i):this._transitionable.setValue(r,i)}},n.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},n.prototype.hasTransition=function(){return this._transitioning.hasTransition()},n.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},n.prototype._validate=function(e,n,r){return(!r||!1!==r.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.styleSpec})))},n}(t.Evented),M=function(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}};M.prototype.getDash=function(t,e){var n=t.join(",")+String(e);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(t,e)),this.dashEntry[n]},M.prototype.getDashRanges=function(t,e,n){var r=[],i=t.length%2==1?-t[t.length-1]*n:0,o=t[0]*n,a=!0;r.push({left:i,right:o,isDash:a,zeroLength:0===t[0]});for(var s=t[0],l=1;l<t.length;l++){var c=t[l];r.push({left:i=s*n,right:o=(s+=c)*n,isDash:a=!a,zeroLength:0===c})}return r},M.prototype.addRoundDash=function(t,e,n){for(var r=e/2,i=-n;i<=n;i++)for(var o=this.width*(this.nextRow+n+i),a=0,s=t[a],l=0;l<this.width;l++){l/s.right>1&&(s=t[++a]);var c=Math.abs(l-s.left),u=Math.abs(l-s.right),p=Math.min(c,u),h=void 0,d=i/n*(r+1);if(s.isDash){var f=r-Math.abs(d);h=Math.sqrt(p*p+f*f)}else h=r-Math.sqrt(p*p+d*d);this.data[o+l]=Math.max(0,Math.min(255,h+128))}},M.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var n=t[e],r=t[e+1];n.zeroLength?t.splice(e,1):r&&r.isDash===n.isDash&&(r.left=n.left,t.splice(e,1))}var i=t[0],o=t[t.length-1];i.isDash===o.isDash&&(i.left=o.left-this.width,o.right=i.right+this.width);for(var a=this.width*this.nextRow,s=0,l=t[s],c=0;c<this.width;c++){c/l.right>1&&(l=t[++s]);var u=Math.abs(c-l.left),p=Math.abs(c-l.right),h=Math.min(u,p);this.data[a+c]=Math.max(0,Math.min(255,(l.isDash?h:-h)+128))}},M.prototype.addDash=function(e,n){var r=n?7:0,i=2*r+1;if(this.nextRow+i>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var o=0,a=0;a<e.length;a++)o+=e[a];if(0!==o){var s=this.width/o,l=this.getDashRanges(e,this.width,s);n?this.addRoundDash(l,s,r):this.addRegularDash(l)}var c={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:o};return this.nextRow+=i,this.dirty=!0,c},M.prototype.bind=function(t){var e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))};var S=function e(n,r){this.workerPool=n,this.actors=[],this.currentActor=0,this.id=t.uniqueId();for(var i=this.workerPool.acquire(this.id),o=0;o<i.length;o++){var a=new e.Actor(i[o],r,this.id);a.name="Worker "+o,this.actors.push(a)}};function T(e,n,r){var i=function(i,o){if(i)return r(i);if(o){var a=t.pick(t.extend(o,e),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(a.vectorLayers=o.vector_layers,a.vectorLayerIds=a.vectorLayers.map((function(t){return t.id}))),a.tiles=n.canonicalizeTileset(a,e.url),r(null,a)}};return e.url?t.getJSON(n.transformRequest(n.normalizeSourceURL(e.url),t.ResourceType.Source),i):t.browser.frame((function(){return i(null,e)}))}S.prototype.broadcast=function(e,n,r){t.asyncAll(this.actors,(function(t,r){t.send(e,n,r)}),r=r||function(){})},S.prototype.getActor=function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]},S.prototype.remove=function(){this.actors.forEach((function(t){t.remove()})),this.actors=[],this.workerPool.release(this.id)},S.Actor=t.Actor;var E=function(e,n,r){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=r||24};E.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},E.prototype.contains=function(e){var n=Math.pow(2,e.z),r=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*n),i=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*n),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*n),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*n);return e.x>=r&&e.x<o&&e.y>=i&&e.y<a};var A=function(e){function n(n,r,i,o){if(e.call(this),this.id=n,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(r,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=T(this._options,this.map._requestManager,(function(n,r){e._tileJSONRequest=null,e._loaded=!0,n?e.fire(new t.ErrorEvent(n)):r&&(t.extend(e,r),r.bounds&&(e.tileBounds=new E(r.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(r.tiles,e.map._requestManager._customAccessToken),t.postMapLoadEvent(r.tiles,e.map._getMapId(),e.map._requestManager._skuToken,e.map._requestManager._customAccessToken),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},n.prototype.loaded=function(){return this._loaded},n.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},n.prototype.onAdd=function(t){this.map=t,this.load()},n.prototype.setSourceProperty=function(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.map.style.sourceCaches[this.id].clearTiles(),this.load()},n.prototype.setTiles=function(t){var e=this;return this.setSourceProperty((function(){e._options.tiles=t})),this},n.prototype.setUrl=function(t){var e=this;return this.setSourceProperty((function(){e.url=t,e._options.url=t})),this},n.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},n.prototype.serialize=function(){return t.extend({},this._options)},n.prototype.loadTile=function(e,n){var r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),i={request:this.map._requestManager.transformRequest(r,t.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function o(r,i){return delete e.request,e.aborted?n(null):r&&404!==r.status?n(r):(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&i&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}i.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=n:e.request=e.actor.send("reloadTile",i,o.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",i,o.bind(this)))},n.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)},n.prototype.unloadTile=function(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)},n.prototype.hasTransition=function(){return!1},n}(t.Evented),C=function(e){function n(n,r,i,o){e.call(this),this.id=n,this.dispatcher=i,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},r),t.extend(this,t.pick(r,["url","scheme","tileSize"]))}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=T(this._options,this.map._requestManager,(function(n,r){e._tileJSONRequest=null,e._loaded=!0,n?e.fire(new t.ErrorEvent(n)):r&&(t.extend(e,r),r.bounds&&(e.tileBounds=new E(r.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(r.tiles),t.postMapLoadEvent(r.tiles,e.map._getMapId(),e.map._requestManager._skuToken),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},n.prototype.loaded=function(){return this._loaded},n.prototype.onAdd=function(t){this.map=t,this.load()},n.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},n.prototype.serialize=function(){return t.extend({},this._options)},n.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},n.prototype.loadTile=function(e,n){var r=this,i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);e.request=t.getImage(this.map._requestManager.transformRequest(i,t.ResourceType.Tile),(function(i,o){if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(i)e.state="errored",n(i);else if(o){r.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=r.map.painter.context,s=a.gl;e.texture=r.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0}):(e.texture=new t.Texture(a,o,s.RGBA,{useMipmap:!0}),e.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),a.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(r.dispatcher),n(null)}}))},n.prototype.abortTile=function(t,e){t.request&&(t.request.cancel(),delete t.request),e()},n.prototype.unloadTile=function(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()},n.prototype.hasTransition=function(){return!1},n}(t.Evented),L=function(e){function n(n,r,i,o){e.call(this,n,r,i,o),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.serialize=function(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}},n.prototype.loadTile=function(e,n){var r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);function i(t,r){t&&(e.state="errored",n(t)),r&&(e.dem=r,e.needsHillshadePrepare=!0,e.state="loaded",n(null))}e.request=t.getImage(this.map._requestManager.transformRequest(r,t.ResourceType.Tile),function(r,o){if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(r)e.state="errored",n(r);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=t.window.ImageBitmap&&o instanceof t.window.ImageBitmap&&t.offscreenCanvasSupported()?o:t.browser.getImageData(o,1),s={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:a,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",s,i.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)},n.prototype._getNeighboringTiles=function(e){var n=e.canonical,r=Math.pow(2,n.z),i=(n.x-1+r)%r,o=0===n.x?e.wrap-1:e.wrap,a=(n.x+1+r)%r,s=n.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,n.z,i,n.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,n.z,a,n.y).key]={backfilled:!1},n.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,n.z,i,n.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,n.z,a,n.y-1).key]={backfilled:!1}),n.y+1<r&&(l[new t.OverscaledTileID(e.overscaledZ,o,n.z,i,n.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,n.z,a,n.y+1).key]={backfilled:!1}),l},n.prototype.unloadTile=function(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})},n}(C),P=function(e){function n(n,r,i,o){e.call(this),this.id=n,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._loaded=!1,this.actor=i.getActor(),this.setEventedParent(o),this._data=r.data,this._options=t.extend({},r),this._collectResourceTiming=r.collectResourceTiming,this._resourceTiming=[],void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;var a=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(void 0!==r.buffer?r.buffer:128)*a,tolerance:(void 0!==r.tolerance?r.tolerance:.375)*a,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:void 0!==r.clusterMaxZoom?Math.min(r.clusterMaxZoom,this.maxzoom-1):this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:t.EXTENT,radius:(r.clusterRadius||50)*a,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.load=function(){var e=this;this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(n){if(n)e.fire(new t.ErrorEvent(n));else{var r={dataType:"source",sourceDataType:"metadata"};e._collectResourceTiming&&e._resourceTiming&&e._resourceTiming.length>0&&(r.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",r))}}))},n.prototype.onAdd=function(t){this.map=t,this.load()},n.prototype.setData=function(e){var n=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)n.fire(new t.ErrorEvent(e));else{var r={dataType:"source",sourceDataType:"content"};n._collectResourceTiming&&n._resourceTiming&&n._resourceTiming.length>0&&(r.resourceTiming=n._resourceTiming,n._resourceTiming=[]),n.fire(new t.Event("data",r))}})),this},n.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},n.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},n.prototype.getClusterLeaves=function(t,e,n,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:n},r),this},n.prototype._updateWorkerData=function(e){var n=this;this._loaded=!1;var r=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(r.request=this.map._requestManager.transformRequest(t.browser.resolveURL(i),t.ResourceType.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(i),this.actor.send(this.type+".loadData",r,(function(t,i){n._removed||i&&i.abandoned||(n._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[n.id]&&(n._resourceTiming=i.resourceTiming[n.id].slice(0)),n.actor.send(n.type+".coalesce",{source:r.source},null),e(t))}))},n.prototype.loaded=function(){return this._loaded},n.prototype.loadTile=function(e,n){var r=this,i=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(i,{type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(t,o){return delete e.request,e.unloadVectorData(),e.aborted?n(null):t?n(t):(e.loadVectorData(o,r.map.painter,"reloadTile"===i),n(null))}))},n.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},n.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},n.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},n.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},n.prototype.hasTransition=function(){return!1},n}(t.Evented),I=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),R=function(e){function n(t,n,r,i){e.call(this),this.id=t,this.dispatcher=r,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=n}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.load=function(e,n){var r=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(i,o){r._loaded=!0,i?r.fire(new t.ErrorEvent(i)):o&&(r.image=o,e&&(r.coordinates=e),n&&n(),r._finishLoading())}))},n.prototype.loaded=function(){return this._loaded},n.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null})),this):this},n.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},n.prototype.onAdd=function(t){this.map=t,this.load()},n.prototype.setCoordinates=function(e){var n=this;this.coordinates=e;var r=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var n=1/0,r=1/0,i=-1/0,o=-1/0,a=0,s=e;a<s.length;a+=1){var l=s[a];n=Math.min(n,l.x),r=Math.min(r,l.y),i=Math.max(i,l.x),o=Math.max(o,l.y)}var c=Math.max(i-n,o-r),u=Math.max(0,Math.floor(-Math.log(c)/Math.LN2)),p=Math.pow(2,u);return new t.CanonicalTileID(u,Math.floor((n+i)/2*p),Math.floor((r+o)/2*p))}(r),this.minzoom=this.maxzoom=this.tileID.z;var i=r.map((function(t){return n.tileID.getTilePoint(t)._round()}));return this._boundsArray=new t.StructArrayLayout4i8,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(i[2].x,i[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this},n.prototype.prepare=function(){if(0!==Object.keys(this.tiles).length&&this.image){var e=this.map.painter.context,n=e.gl;for(var r in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,I.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new t.Texture(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[r];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},n.prototype.loadTile=function(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))},n.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},n.prototype.hasTransition=function(){return!1},n}(t.Evented),k=function(e){function n(t,n,r,i){e.call(this,t,n,r,i),this.roundZoom=!0,this.type="video",this.options=n}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.load=function(){var e=this;this._loaded=!1;var n=this.options;this.urls=[];for(var r=0,i=n.urls;r<i.length;r+=1)this.urls.push(this.map._requestManager.transformRequest(i[r],t.ResourceType.Source).url);t.getVideo(this.urls,(function(n,r){e._loaded=!0,n?e.fire(new t.ErrorEvent(n)):r&&(e.video=r,e.video.loop=!0,e.video.addEventListener("playing",(function(){e.map.triggerRepaint()})),e.map&&e.video.play(),e._finishLoading())}))},n.prototype.pause=function(){this.video&&this.video.pause()},n.prototype.play=function(){this.video&&this.video.play()},n.prototype.seek=function(e){if(this.video){var n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+n.start(0)+" and "+n.end(0)+"-second mark."))):this.video.currentTime=e}},n.prototype.getVideo=function(){return this.video},n.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},n.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,n=e.gl;for(var r in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,I.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[r];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},n.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},n.prototype.hasTransition=function(){return this.video&&!this.video.paused},n}(R),z=function(e){function n(n,r,i,o){e.call(this,n,r,i,o),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some((function(t){return!Array.isArray(t)||2!==t.length||t.some((function(t){return"number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+n,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+n,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+n,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+n,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+n,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},n.prototype.getCanvas=function(){return this.canvas},n.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},n.prototype.onRemove=function(){this.pause()},n.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var n=this.map.painter.context,r=n.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,I.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(n,this.canvas,r.RGBA,{premultiply:!0}),this.tiles){var o=this.tiles[i];"loaded"!==o.state&&(o.state="loaded",o.texture=this.texture)}}},n.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},n.prototype.hasTransition=function(){return this._playing},n.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];t<e.length;t+=1){var n=e[t];if(isNaN(n)||n<=0)return!0}return!1},n}(R),D={vector:A,raster:C,"raster-dem":L,geojson:P,video:k,image:R,canvas:z};function O(e,n){var r=t.identity([]);return t.translate(r,r,[1,1,0]),t.scale(r,r,[.5*e.width,.5*e.height,1]),t.multiply(r,r,e.calculatePosMatrix(n.toUnwrapped()))}function F(t,e,n,r,i,o){var a=function(t,e,n){if(t)for(var r=0,i=t;r<i.length;r+=1){var o=e[i[r]];if(o&&o.source===n&&"fill-extrusion"===o.type)return!0}else for(var a in e){var s=e[a];if(s.source===n&&"fill-extrusion"===s.type)return!0}return!1}(i&&i.layers,e,t.id),s=o.maxPitchScaleFactor(),l=t.tilesIn(r,s,a);l.sort(B);for(var c=[],u=0,p=l;u<p.length;u+=1){var h=p[u];c.push({wrappedTileID:h.tileID.wrapped().key,queryResults:h.tile.queryRenderedFeatures(e,n,t._state,h.queryGeometry,h.cameraQueryGeometry,h.scale,i,o,s,O(t.transform,h.tileID))})}var d=function(t){for(var e={},n={},r=0,i=t;r<i.length;r+=1){var o=i[r],a=o.queryResults,s=o.wrappedTileID,l=n[s]=n[s]||{};for(var c in a)for(var u=a[c],p=l[c]=l[c]||{},h=e[c]=e[c]||[],d=0,f=u;d<f.length;d+=1){var m=f[d];p[m.featureIndex]||(p[m.featureIndex]=!0,h.push(m))}}return e}(c);for(var f in d)d[f].forEach((function(e){var n=e.feature,r=t.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=r}));return d}function B(t,e){var n=t.tileID,r=e.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.canonical.x}var N=function(t,e){this.max=t,this.onRemove=e,this.reset()};N.prototype.reset=function(){for(var t in this.data)for(var e=0,n=this.data[t];e<n.length;e+=1){var r=n[e];r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value)}return this.data={},this.order=[],this},N.prototype.add=function(t,e,n){var r=this,i=t.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);var o={value:e,timeout:void 0};if(void 0!==n&&(o.timeout=setTimeout((function(){r.remove(t,o)}),n)),this.data[i].push(o),this.order.push(i),this.order.length>this.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},N.prototype.has=function(t){return t.wrapped().key in this.data},N.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},N.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},N.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},N.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},N.prototype.remove=function(t,e){if(!this.has(t))return this;var n=t.wrapped().key,r=void 0===e?0:this.data[n].indexOf(e),i=this.data[n][r];return this.data[n].splice(r,1),i.timeout&&clearTimeout(i.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),1),this},N.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this},N.prototype.filter=function(t){var e=[];for(var n in this.data)for(var r=0,i=this.data[n];r<i.length;r+=1){var o=i[r];t(o.value)||e.push(o)}for(var a=0,s=e;a<s.length;a+=1){var l=s[a];this.remove(l.value.tileID,l)}};var U=function(t,e,n){this.context=t;var r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};U.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},U.prototype.updateData=function(t){var e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},U.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var j={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},V=function(t,e,n,r){this.length=e.length,this.attributes=n,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;var i=t.gl;this.buffer=i.createBuffer(),t.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};V.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},V.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},V.prototype.enableAttributes=function(t,e){for(var n=0;n<this.attributes.length;n++){var r=e.attributes[this.attributes[n].name];void 0!==r&&t.enableVertexAttribArray(r)}},V.prototype.setVertexAttribPointers=function(t,e,n){for(var r=0;r<this.attributes.length;r++){var i=this.attributes[r],o=e.attributes[i.name];void 0!==o&&t.vertexAttribPointer(o,i.components,t[j[i.type]],!1,this.itemSize,i.offset+this.itemSize*(n||0))}},V.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var G=function(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};G.prototype.get=function(){return this.current},G.prototype.set=function(t){},G.prototype.getDefault=function(){return this.default},G.prototype.setDefault=function(){this.set(this.default)};var H=function(e){function n(){e.apply(this,arguments)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.getDefault=function(){return t.Color.transparent},n.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},n}(G),W=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 1},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)},e}(G),q=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)},e}(G),Z=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return[!0,!0,!0,!0]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(G),X=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)},e}(G),$=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 255},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)},e}(G),J=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return{func:this.gl.ALWAYS,ref:0,mask:255}},e.prototype.set=function(t){var e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)},e}(G),Y=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)},e}(G),Q=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}},e}(G),K=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return[0,1]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)},e}(G),tt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}},e}(G),et=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.LESS},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)},e}(G),nt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}},e}(G),rt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[t.ONE,t.ZERO]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)},e}(G),it=function(e){function n(){e.apply(this,arguments)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.getDefault=function(){return t.Color.transparent},n.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},n}(G),ot=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.FUNC_ADD},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)},e}(G),at=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}},e}(G),st=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.BACK},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)},e}(G),lt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.CCW},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)},e}(G),ct=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)},e}(G),ut=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return this.gl.TEXTURE0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)},e}(G),pt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(G),ht=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},e}(G),dt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(G),ft=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}},e}(G),mt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},e}(G),gt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){var e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1},e}(G),yt=function(t){function e(e){t.call(this,e),this.vao=e.extVertexArrayObject}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)},e}(G),vt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return 4},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},e}(G),_t=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},e}(G),xt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},e}(G),bt=function(t){function e(e,n){t.call(this,e),this.context=e,this.parent=n}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e}(G),wt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.setDirty=function(){this.dirty=!0},e.prototype.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},e}(bt),Mt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(bt),St=function(t,e,n,r){this.context=t,this.width=e,this.height=n;var i=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new wt(t,i),r&&(this.depthAttachment=new Mt(t,i))};St.prototype.destroy=function(){var t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){var n=this.depthAttachment.get();n&&t.deleteRenderbuffer(n)}t.deleteFramebuffer(this.framebuffer)};var Tt=function(t,e,n){this.func=t,this.mask=e,this.range=n};Tt.ReadOnly=!1,Tt.ReadWrite=!0,Tt.disabled=new Tt(519,Tt.ReadOnly,[0,1]);var Et=function(t,e,n,r,i,o){this.test=t,this.ref=e,this.mask=n,this.fail=r,this.depthFail=i,this.pass=o};Et.disabled=new Et({func:519,mask:0},0,0,7680,7680,7680);var At=function(t,e,n){this.blendFunction=t,this.blendColor=e,this.mask=n};At.disabled=new At(At.Replace=[1,0],t.Color.transparent,[!1,!1,!1,!1]),At.unblended=new At(At.Replace,t.Color.transparent,[!0,!0,!0,!0]),At.alphaBlended=new At([1,771],t.Color.transparent,[!0,!0,!0,!0]);var Ct=function(t,e,n){this.enable=t,this.mode=e,this.frontFace=n};Ct.disabled=new Ct(!1,1029,2305),Ct.backCCW=new Ct(!0,1029,2305);var Lt=function(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new H(this),this.clearDepth=new W(this),this.clearStencil=new q(this),this.colorMask=new Z(this),this.depthMask=new X(this),this.stencilMask=new $(this),this.stencilFunc=new J(this),this.stencilOp=new Y(this),this.stencilTest=new Q(this),this.depthRange=new K(this),this.depthTest=new tt(this),this.depthFunc=new et(this),this.blend=new nt(this),this.blendFunc=new rt(this),this.blendColor=new it(this),this.blendEquation=new ot(this),this.cullFace=new at(this),this.cullFaceSide=new st(this),this.frontFace=new lt(this),this.program=new ct(this),this.activeTexture=new ut(this),this.viewport=new pt(this),this.bindFramebuffer=new ht(this),this.bindRenderbuffer=new dt(this),this.bindTexture=new ft(this),this.bindVertexBuffer=new mt(this),this.bindElementBuffer=new gt(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new yt(this),this.pixelStoreUnpack=new vt(this),this.pixelStoreUnpackPremultiplyAlpha=new _t(this),this.pixelStoreUnpackFlipY=new xt(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)};Lt.prototype.setDefault=function(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()},Lt.prototype.setDirty=function(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0},Lt.prototype.createIndexBuffer=function(t,e){return new U(this,t,e)},Lt.prototype.createVertexBuffer=function(t,e,n){return new V(this,t,e,n)},Lt.prototype.createRenderbuffer=function(t,e,n){var r=this.gl,i=r.createRenderbuffer();return this.bindRenderbuffer.set(i),r.renderbufferStorage(r.RENDERBUFFER,t,e,n),this.bindRenderbuffer.set(null),i},Lt.prototype.createFramebuffer=function(t,e,n){return new St(this,t,e,n)},Lt.prototype.clear=function(t){var e=t.color,n=t.depth,r=this.gl,i=0;e&&(i|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==n&&(i|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),r.clear(i)},Lt.prototype.setCullFace=function(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))},Lt.prototype.setDepthMode=function(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)},Lt.prototype.setStencilMode=function(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)},Lt.prototype.setColorMode=function(e){t.deepEqual(e.blendFunction,At.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)},Lt.prototype.unbindVAO=function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)};var Pt=function(e){function n(n,r,i){var o=this;e.call(this),this.id=n,this.dispatcher=i,this.on("data",(function(t){"source"===t.dataType&&"metadata"===t.sourceDataType&&(o._sourceLoaded=!0),o._sourceLoaded&&!o._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(o.reload(),o.transform&&o.update(o.transform))})),this.on("error",(function(){o._sourceErrored=!0})),this._source=function(e,n,r,i){var o=new D[n.type](e,n,r,i);if(o.id!==e)throw new Error("Expected Source id to be "+e+" instead of "+o.id);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o}(n,r,i,this),this._tiles={},this._cache=new N(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new t.SourceFeatureState}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.onAdd=function(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)},n.prototype.onRemove=function(t){this._source&&this._source.onRemove&&this._source.onRemove(t)},n.prototype.loaded=function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(var t in this._tiles){var e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0},n.prototype.getSource=function(){return this._source},n.prototype.pause=function(){this._paused=!0},n.prototype.resume=function(){if(this._paused){var t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}},n.prototype._loadTile=function(t,e){return this._source.loadTile(t,e)},n.prototype._unloadTile=function(t){if(this._source.unloadTile)return this._source.unloadTile(t,(function(){}))},n.prototype._abortTile=function(t){if(this._source.abortTile)return this._source.abortTile(t,(function(){}))},n.prototype.serialize=function(){return this._source.serialize()},n.prototype.prepare=function(t){for(var e in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){var n=this._tiles[e];n.upload(t),n.prepare(this.map.style.imageManager)}},n.prototype.getIds=function(){return t.values(this._tiles).map((function(t){return t.tileID})).sort(It).map((function(t){return t.key}))},n.prototype.getRenderableIds=function(e){var n=this,r=[];for(var i in this._tiles)this._isIdRenderable(i,e)&&r.push(this._tiles[i]);return e?r.sort((function(e,r){var i=e.tileID,o=r.tileID,a=new t.Point(i.canonical.x,i.canonical.y)._rotate(n.transform.angle),s=new t.Point(o.canonical.x,o.canonical.y)._rotate(n.transform.angle);return i.overscaledZ-o.overscaledZ||s.y-a.y||s.x-a.x})).map((function(t){return t.tileID.key})):r.map((function(t){return t.tileID})).sort(It).map((function(t){return t.key}))},n.prototype.hasRenderableParent=function(t){var e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)},n.prototype._isIdRenderable=function(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())},n.prototype.reload=function(){if(this._paused)this._shouldReloadOnResume=!0;else for(var t in this._cache.reset(),this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")},n.prototype._reloadTile=function(t,e){var n=this._tiles[t];n&&("loading"!==n.state&&(n.state=e),this._loadTile(n,this._tileLoaded.bind(this,n,t,e)))},n.prototype._tileLoaded=function(e,n,r,i){if(i)return e.state="errored",void(404!==i.status?this._source.fire(new t.ErrorEvent(i,{tile:e})):this.update(this.transform));e.timeAdded=t.browser.now(),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}))},n.prototype._backfillDEM=function(t){for(var e=this.getRenderableIds(),n=0;n<e.length;n++){var r=e[n];if(t.neighboringTiles&&t.neighboringTiles[r]){var i=this.getTileByID(r);o(t,i),o(i,t)}}function o(t,e){t.needsHillshadePrepare=!0;var n=e.tileID.canonical.x-t.tileID.canonical.x,r=e.tileID.canonical.y-t.tileID.canonical.y,i=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===n&&0===r||Math.abs(r)>1||(Math.abs(n)>1&&(1===Math.abs(n+i)?n+=i:1===Math.abs(n-i)&&(n-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,n,r),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}},n.prototype.getTile=function(t){return this.getTileByID(t.key)},n.prototype.getTileByID=function(t){return this._tiles[t]},n.prototype._retainLoadedChildren=function(t,e,n,r){for(var i in this._tiles){var o=this._tiles[i];if(!(r[i]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>n)){for(var a=o.tileID;o&&o.tileID.overscaledZ>e+1;){var s=o.tileID.scaledTo(o.tileID.overscaledZ-1);(o=this._tiles[s.key])&&o.hasData()&&(a=s)}for(var l=a;l.overscaledZ>e;)if(t[(l=l.scaledTo(l.overscaledZ-1)).key]){r[a.key]=a;break}}}},n.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var n=this._loadedParentTiles[t.key];return n&&n.tileID.overscaledZ>=e?n:null}for(var r=t.overscaledZ-1;r>=e;r--){var i=t.scaledTo(r),o=this._getLoadedTile(i);if(o)return o}},n.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},n.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,n=Math.ceil(t.height/this._source.tileSize)+1,r=Math.floor(e*n*5),i="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(i)},n.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var n={};for(var r in this._tiles){var i=this._tiles[r];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),n[i.tileID.key]=i}for(var o in this._tiles=n,this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(var a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}},n.prototype.update=function(e){var r=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter((function(t){return r._source.hasTile(t)})))):i=[];var o=e.coveringZoomLevel(this._source),a=Math.max(o-n.maxOverzooming,this._source.minzoom),s=Math.max(o+n.maxUnderzooming,this._source.minzoom),l=this._updateRetainedTiles(i,o);if(Rt(this._source.type)){for(var c={},u={},p=0,h=Object.keys(l);p<h.length;p+=1){var d=h[p],f=l[d],m=this._tiles[d];if(m&&!(m.fadeEndTime&&m.fadeEndTime<=t.browser.now())){var g=this.findLoadedParent(f,a);g&&(this._addTile(g.tileID),c[g.tileID.key]=g.tileID),u[d]=f}}for(var y in this._retainLoadedChildren(u,o,s,l),c)l[y]||(this._coveredTiles[y]=!0,l[y]=c[y])}for(var v in l)this._tiles[v].clearFadeHold();for(var _=0,x=t.keysDifference(this._tiles,l);_<x.length;_+=1){var b=x[_],w=this._tiles[b];w.hasSymbolBuckets&&!w.holdingForFade()?w.setHoldDuration(this.map._fadeDuration):w.hasSymbolBuckets&&!w.symbolFadeFinished()||this._removeTile(b)}this._updateLoadedParentTileCache()}},n.prototype.releaseSymbolFadeTiles=function(){for(var t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)},n.prototype._updateRetainedTiles=function(t,e){for(var r={},i={},o=Math.max(e-n.maxOverzooming,this._source.minzoom),a=Math.max(e+n.maxUnderzooming,this._source.minzoom),s={},l=0,c=t;l<c.length;l+=1){var u=c[l],p=this._addTile(u);r[u.key]=u,p.hasData()||e<this._source.maxzoom&&(s[u.key]=u)}this._retainLoadedChildren(s,e,a,r);for(var h=0,d=t;h<d.length;h+=1){var f=d[h],m=this._tiles[f.key];if(!m.hasData()){if(e+1>this._source.maxzoom){var g=f.children(this._source.maxzoom)[0],y=this.getTile(g);if(y&&y.hasData()){r[g.key]=g;continue}}else{var v=f.children(this._source.maxzoom);if(r[v[0].key]&&r[v[1].key]&&r[v[2].key]&&r[v[3].key])continue}for(var _=m.wasRequested(),x=f.overscaledZ-1;x>=o;--x){var b=f.scaledTo(x);if(i[b.key])break;if(i[b.key]=!0,!(m=this.getTile(b))&&_&&(m=this._addTile(b)),m&&(r[b.key]=b,_=m.wasRequested(),m.hasData()))break}}}return r},n.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],n=void 0,r=this._tiles[t].tileID;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){n=this._loadedParentTiles[r.key];break}e.push(r.key);var i=r.scaledTo(r.overscaledZ-1);if(n=this._getLoadedTile(i))break;r=i}for(var o=0,a=e;o<a.length;o+=1)this._loadedParentTiles[a[o]]=n}},n.prototype._addTile=function(e){var n=this._tiles[e.key];if(n)return n;(n=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));var r=Boolean(n);return r||(n=new t.Tile(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,e.key,n.state))),n?(n.uses++,this._tiles[e.key]=n,r||this._source.fire(new t.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n):null},n.prototype._setTileReloadTimer=function(t,e){var n=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var r=e.getExpiryTimeout();r&&(this._timers[t]=setTimeout((function(){n._reloadTile(t,"expired"),delete n._timers[t]}),r))},n.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},n.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},n.prototype.tilesIn=function(e,n,r){var i=this,o=[],a=this.transform;if(!a)return o;for(var s=r?a.getCameraQueryGeometry(e):e,l=e.map((function(t){return a.pointCoordinate(t)})),c=s.map((function(t){return a.pointCoordinate(t)})),u=this.getIds(),p=1/0,h=1/0,d=-1/0,f=-1/0,m=0,g=c;m<g.length;m+=1){var y=g[m];p=Math.min(p,y.x),h=Math.min(h,y.y),d=Math.max(d,y.x),f=Math.max(f,y.y)}for(var v=function(e){var r=i._tiles[u[e]];if(!r.holdingForFade()){var s=r.tileID,m=Math.pow(2,a.zoom-r.tileID.overscaledZ),g=n*r.queryPadding*t.EXTENT/r.tileSize/m,y=[s.getTilePoint(new t.MercatorCoordinate(p,h)),s.getTilePoint(new t.MercatorCoordinate(d,f))];if(y[0].x-g<t.EXTENT&&y[0].y-g<t.EXTENT&&y[1].x+g>=0&&y[1].y+g>=0){var v=l.map((function(t){return s.getTilePoint(t)})),_=c.map((function(t){return s.getTilePoint(t)}));o.push({tile:r,tileID:s,queryGeometry:v,cameraQueryGeometry:_,scale:m})}}},_=0;_<u.length;_++)v(_);return o},n.prototype.getVisibleCoordinates=function(t){for(var e=this,n=this.getRenderableIds(t).map((function(t){return e._tiles[t].tileID})),r=0,i=n;r<i.length;r+=1){var o=i[r];o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped())}return n},n.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(Rt(this._source.type))for(var e in this._tiles){var n=this._tiles[e];if(void 0!==n.fadeEndTime&&n.fadeEndTime>=t.browser.now())return!0}return!1},n.prototype.setFeatureState=function(t,e,n){this._state.updateState(t=t||"_geojsonTileLayer",e,n)},n.prototype.removeFeatureState=function(t,e,n){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,n)},n.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},n.prototype.setDependencies=function(t,e,n){var r=this._tiles[t];r&&r.setDependencies(e,n)},n.prototype.reloadTilesForDependencies=function(t,e){for(var n in this._tiles)this._tiles[n].hasDependency(t,e)&&this._reloadTile(n,"reloading");this._cache.filter((function(n){return!n.hasDependency(t,e)}))},n}(t.Evented);function It(t,e){var n=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-n||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function Rt(t){return"raster"===t||"image"===t||"video"===t}function kt(){return new t.window.Worker($i.workerUrl)}Pt.maxOverzooming=10,Pt.maxUnderzooming=3;var zt="mapboxgl_preloaded_worker_pool",Dt=function(){this.active={}};Dt.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length<Dt.workerCount;)this.workers.push(new kt);return this.active[t]=!0,this.workers.slice()},Dt.prototype.release=function(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((function(t){t.terminate()})),this.workers=null)},Dt.prototype.isPreloaded=function(){return!!this.active[zt]},Dt.prototype.numActive=function(){return Object.keys(this.active).length};var Ot,Ft=Math.floor(t.browser.hardwareConcurrency/2);function Bt(){return Ot||(Ot=new Dt),Ot}function Nt(e,n){var r={};for(var i in e)"ref"!==i&&(r[i]=e[i]);return t.refProperties.forEach((function(t){t in n&&(r[t]=n[t])})),r}function Ut(t){t=t.slice();for(var e=Object.create(null),n=0;n<t.length;n++)e[t[n].id]=t[n];for(var r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=Nt(t[r],e[t[r].ref]));return t}Dt.workerCount=Math.max(Math.min(Ft,6),1);var jt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Vt(t,e,n){n.push({command:jt.addSource,args:[t,e[t]]})}function Gt(t,e,n){e.push({command:jt.removeSource,args:[t]}),n[t]=!0}function Ht(t,e,n,r){Gt(t,n,r),Vt(t,e,n)}function Wt(e,n,r){var i;for(i in e[r])if(e[r].hasOwnProperty(i)&&"data"!==i&&!t.deepEqual(e[r][i],n[r][i]))return!1;for(i in n[r])if(n[r].hasOwnProperty(i)&&"data"!==i&&!t.deepEqual(e[r][i],n[r][i]))return!1;return!0}function qt(e,n,r,i,o,a){var s;for(s in n=n||{},e=e||{})e.hasOwnProperty(s)&&(t.deepEqual(e[s],n[s])||r.push({command:a,args:[i,s,n[s],o]}));for(s in n)n.hasOwnProperty(s)&&!e.hasOwnProperty(s)&&(t.deepEqual(e[s],n[s])||r.push({command:a,args:[i,s,n[s],o]}))}function Zt(t){return t.id}function Xt(t,e){return t[e.id]=e,t}var $t=function(t,e){this.reset(t,e)};$t.prototype.reset=function(t,e){this.points=t||[],this._distances=[0];for(var n=1;n<this.points.length;n++)this._distances[n]=this._distances[n-1]+this.points[n].dist(this.points[n-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding},$t.prototype.lerp=function(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);for(var n=1,r=this._distances[n],i=e*this.paddedLength+this.padding;r<i&&n<this._distances.length;)r=this._distances[++n];var o=n-1,a=this._distances[o],s=r-a,l=s>0?(i-a)/s:0;return this.points[o].mult(1-l).add(this.points[n].mult(l))};var Jt=function(t,e,n){var r=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(t/n),this.yCellCount=Math.ceil(e/n);for(var o=0;o<this.xCellCount*this.yCellCount;o++)r.push([]),i.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0};function Yt(e,n,r,i,o){var a=t.create();return n?(t.scale(a,a,[1/o,1/o,1]),r||t.rotateZ(a,a,i.angle)):t.multiply(a,i.labelPlaneMatrix,e),a}function Qt(e,n,r,i,o){if(n){var a=t.clone(e);return t.scale(a,a,[o,o,1]),r||t.rotateZ(a,a,-i.angle),a}return i.glCoordMatrix}function Kt(e,n){var r=[e.x,e.y,0,1];ue(r,r,n);var i=r[3];return{point:new t.Point(r[0]/i,r[1]/i),signedDistanceFromCamera:i}}function te(t,e){return.5+t/e*.5}function ee(t,e){var n=t[0]/t[3],r=t[1]/t[3];return n>=-e[0]&&n<=e[0]&&r>=-e[1]&&r<=e[1]}function ne(e,n,r,i,o,a,s,l){var c=i?e.textSizeData:e.iconSizeData,u=t.evaluateSizeForZoom(c,r.transform.zoom),p=[256/r.width*2+1,256/r.height*2+1],h=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;h.clear();for(var d=e.lineVertexArray,f=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,m=r.transform.width/r.transform.height,g=!1,y=0;y<f.length;y++){var v=f.get(y);if(v.hidden||v.writingMode===t.WritingMode.vertical&&!g)ce(v.numGlyphs,h);else{g=!1;var _=[v.anchorX,v.anchorY,0,1];if(t.transformMat4(_,_,n),ee(_,p)){var x=te(r.transform.cameraToCenterDistance,_[3]),b=t.evaluateSizeForFeature(c,u,v),w=s?b/x:b*x,M=new t.Point(v.anchorX,v.anchorY),S=Kt(M,o).point,T={},E=oe(v,w,!1,l,n,o,a,e.glyphOffsetArray,d,h,S,M,T,m);g=E.useVertical,(E.notEnoughRoom||g||E.needsFlipping&&oe(v,w,!0,l,n,o,a,e.glyphOffsetArray,d,h,S,M,T,m).notEnoughRoom)&&ce(v.numGlyphs,h)}else ce(v.numGlyphs,h)}}i?e.text.dynamicLayoutVertexBuffer.updateData(h):e.icon.dynamicLayoutVertexBuffer.updateData(h)}function re(t,e,n,r,i,o,a,s,l,c,u){var p=s.glyphStartIndex+s.numGlyphs,h=s.lineStartIndex,d=s.lineStartIndex+s.lineLength,f=e.getoffsetX(s.glyphStartIndex),m=e.getoffsetX(p-1),g=se(t*f,n,r,i,o,a,s.segment,h,d,l,c,u);if(!g)return null;var y=se(t*m,n,r,i,o,a,s.segment,h,d,l,c,u);return y?{first:g,last:y}:null}function ie(e,n,r,i){return e===t.WritingMode.horizontal&&Math.abs(r.y-n.y)>Math.abs(r.x-n.x)*i?{useVertical:!0}:(e===t.WritingMode.vertical?n.y<r.y:n.x>r.x)?{needsFlipping:!0}:null}function oe(e,n,r,i,o,a,s,l,c,u,p,h,d,f){var m,g=n/24,y=e.lineOffsetX*g,v=e.lineOffsetY*g;if(e.numGlyphs>1){var _=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=re(g,l,y,v,r,p,h,e,c,a,d);if(!w)return{notEnoughRoom:!0};var M=Kt(w.first.point,s).point,S=Kt(w.last.point,s).point;if(i&&!r){var T=ie(e.writingMode,M,S,f);if(T)return T}m=[w.first];for(var E=e.glyphStartIndex+1;E<_-1;E++)m.push(se(g*l.getoffsetX(E),y,v,r,p,h,e.segment,x,b,c,a,d));m.push(w.last)}else{if(i&&!r){var A=Kt(h,o).point,C=e.lineStartIndex+e.segment+1,L=new t.Point(c.getx(C),c.gety(C)),P=Kt(L,o),I=P.signedDistanceFromCamera>0?P.point:ae(h,L,A,1,o),R=ie(e.writingMode,A,I,f);if(R)return R}var k=se(g*l.getoffsetX(e.glyphStartIndex),y,v,r,p,h,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,a,d);if(!k)return{notEnoughRoom:!0};m=[k]}for(var z=0,D=m;z<D.length;z+=1){var O=D[z];t.addDynamicAttributes(u,O.point,O.angle)}return{}}function ae(t,e,n,r,i){var o=Kt(t.add(t.sub(e)._unit()),i).point,a=n.sub(o);return n.add(a._mult(r/a.mag()))}function se(e,n,r,i,o,a,s,l,c,u,p,h){var d=i?e-n:e+n,f=d>0?1:-1,m=0;i&&(f*=-1,m=Math.PI),f<0&&(m+=Math.PI);for(var g=f>0?l+s:l+s+1,y=o,v=o,_=0,x=0,b=Math.abs(d),w=[];_+x<=b;){if((g+=f)<l||g>=c)return null;if(v=y,w.push(y),void 0===(y=h[g])){var M=new t.Point(u.getx(g),u.gety(g)),S=Kt(M,p);if(S.signedDistanceFromCamera>0)y=h[g]=S.point;else{var T=g-f;y=ae(0===_?a:new t.Point(u.getx(T),u.gety(T)),M,v,b-_+1,p)}}_+=x,x=v.dist(y)}var E=(b-_)/x,A=y.sub(v),C=A.mult(E)._add(v);C._add(A._unit()._perp()._mult(r*f));var L=m+Math.atan2(y.y-v.y,y.x-v.x);return w.push(C),{point:C,angle:L,path:w}}Jt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Jt.prototype.insert=function(t,e,n,r,i){this._forEachCell(e,n,r,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)},Jt.prototype.insertCircle=function(t,e,n,r){this._forEachCell(e-r,n-r,e+r,n+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(n),this.circles.push(r)},Jt.prototype._insertBoxCell=function(t,e,n,r,i,o){this.boxCells[i].push(o)},Jt.prototype._insertCircleCell=function(t,e,n,r,i,o){this.circleCells[i].push(o)},Jt.prototype._query=function(t,e,n,r,i,o){if(n<0||t>this.width||r<0||e>this.height)return!i&&[];var a=[];if(t<=0&&e<=0&&this.width<=n&&this.height<=r){if(i)return!0;for(var s=0;s<this.boxKeys.length;s++)a.push({key:this.boxKeys[s],x1:this.bboxes[4*s],y1:this.bboxes[4*s+1],x2:this.bboxes[4*s+2],y2:this.bboxes[4*s+3]});for(var l=0;l<this.circleKeys.length;l++){var c=this.circles[3*l],u=this.circles[3*l+1],p=this.circles[3*l+2];a.push({key:this.circleKeys[l],x1:c-p,y1:u-p,x2:c+p,y2:u+p})}return o?a.filter(o):a}return this._forEachCell(t,e,n,r,this._queryCell,a,{hitTest:i,seenUids:{box:{},circle:{}}},o),i?a.length>0:a},Jt.prototype._queryCircle=function(t,e,n,r,i){var o=t-n,a=t+n,s=e-n,l=e+n;if(a<0||o>this.width||l<0||s>this.height)return!r&&[];var c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:r,circle:{x:t,y:e,radius:n},seenUids:{box:{},circle:{}}},i),r?c.length>0:c},Jt.prototype.query=function(t,e,n,r,i){return this._query(t,e,n,r,!1,i)},Jt.prototype.hitTest=function(t,e,n,r,i){return this._query(t,e,n,r,!0,i)},Jt.prototype.hitTestCircle=function(t,e,n,r){return this._queryCircle(t,e,n,!0,r)},Jt.prototype._queryCell=function(t,e,n,r,i,o,a,s){var l=a.seenUids,c=this.boxCells[i];if(null!==c)for(var u=this.bboxes,p=0,h=c;p<h.length;p+=1){var d=h[p];if(!l.box[d]){l.box[d]=!0;var f=4*d;if(t<=u[f+2]&&e<=u[f+3]&&n>=u[f+0]&&r>=u[f+1]&&(!s||s(this.boxKeys[d]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[d],x1:u[f],y1:u[f+1],x2:u[f+2],y2:u[f+3]})}}}var m=this.circleCells[i];if(null!==m)for(var g=this.circles,y=0,v=m;y<v.length;y+=1){var _=v[y];if(!l.circle[_]){l.circle[_]=!0;var x=3*_;if(this._circleAndRectCollide(g[x],g[x+1],g[x+2],t,e,n,r)&&(!s||s(this.circleKeys[_]))){if(a.hitTest)return o.push(!0),!0;var b=g[x],w=g[x+1],M=g[x+2];o.push({key:this.circleKeys[_],x1:b-M,y1:w-M,x2:b+M,y2:w+M})}}}},Jt.prototype._queryCellCircle=function(t,e,n,r,i,o,a,s){var l=a.circle,c=a.seenUids,u=this.boxCells[i];if(null!==u)for(var p=this.bboxes,h=0,d=u;h<d.length;h+=1){var f=d[h];if(!c.box[f]){c.box[f]=!0;var m=4*f;if(this._circleAndRectCollide(l.x,l.y,l.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!s||s(this.boxKeys[f])))return o.push(!0),!0}}var g=this.circleCells[i];if(null!==g)for(var y=this.circles,v=0,_=g;v<_.length;v+=1){var x=_[v];if(!c.circle[x]){c.circle[x]=!0;var b=3*x;if(this._circlesCollide(y[b],y[b+1],y[b+2],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[x])))return o.push(!0),!0}}},Jt.prototype._forEachCell=function(t,e,n,r,i,o,a,s){for(var l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),u=this._convertToXCellCoord(n),p=this._convertToYCellCoord(r),h=l;h<=u;h++)for(var d=c;d<=p;d++)if(i.call(this,t,e,n,r,this.xCellCount*d+h,o,a,s))return},Jt.prototype._convertToXCellCoord=function(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))},Jt.prototype._convertToYCellCoord=function(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))},Jt.prototype._circlesCollide=function(t,e,n,r,i,o){var a=r-t,s=i-e,l=n+o;return l*l>a*a+s*s},Jt.prototype._circleAndRectCollide=function(t,e,n,r,i,o,a){var s=(o-r)/2,l=Math.abs(t-(r+s));if(l>s+n)return!1;var c=(a-i)/2,u=Math.abs(e-(i+c));if(u>c+n)return!1;if(l<=s||u<=c)return!0;var p=l-s,h=u-c;return p*p+h*h<=n*n};var le=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ce(t,e){for(var n=0;n<t;n++){var r=e.length;e.resize(r+4),e.float32.set(le,3*r)}}function ue(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t[3]=n[3]*r+n[7]*i+n[15],t}var pe=function(t,e,n){void 0===e&&(e=new Jt(t.width+200,t.height+200,25)),void 0===n&&(n=new Jt(t.width+200,t.height+200,25)),this.transform=t,this.grid=e,this.ignoredGrid=n,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+100,this.screenBottomBoundary=t.height+100,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200};function he(e,n,r){return n*(t.EXTENT/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}pe.prototype.placeCollisionBox=function(t,e,n,r,i){var o=this.projectAndGetPerspectiveRatio(r,t.anchorPointX,t.anchorPointY),a=n*o.perspectiveRatio,s=t.x1*a+o.point.x,l=t.y1*a+o.point.y,c=t.x2*a+o.point.x,u=t.y2*a+o.point.y;return!this.isInsideGrid(s,l,c,u)||!e&&this.grid.hitTest(s,l,c,u,i)?{box:[],offscreen:!1}:{box:[s,l,c,u],offscreen:this.isOffscreen(s,l,c,u)}},pe.prototype.placeCollisionCircles=function(e,n,r,i,o,a,s,l,c,u,p,h,d){var f=[],m=new t.Point(n.anchorX,n.anchorY),g=Kt(m,a),y=te(this.transform.cameraToCenterDistance,g.signedDistanceFromCamera),v=(u?o/y:o*y)/t.ONE_EM,_=Kt(m,s).point,x=re(v,i,n.lineOffsetX*v,n.lineOffsetY*v,!1,_,m,n,r,s,{}),b=!1,w=!1,M=!0;if(x){for(var S=.5*h*y+d,T=new t.Point(-100,-100),E=new t.Point(this.screenRightBoundary,this.screenBottomBoundary),A=new $t,C=x.first,L=x.last,P=[],I=C.path.length-1;I>=1;I--)P.push(C.path[I]);for(var R=1;R<L.path.length;R++)P.push(L.path[R]);var k=2.5*S;if(l){var z=P.map((function(t){return Kt(t,l)}));P=z.some((function(t){return t.signedDistanceFromCamera<=0}))?[]:z.map((function(t){return t.point}))}var D=[];if(P.length>0){for(var O=P[0].clone(),F=P[0].clone(),B=1;B<P.length;B++)O.x=Math.min(O.x,P[B].x),O.y=Math.min(O.y,P[B].y),F.x=Math.max(F.x,P[B].x),F.y=Math.max(F.y,P[B].y);D=O.x>=T.x&&F.x<=E.x&&O.y>=T.y&&F.y<=E.y?[P]:F.x<T.x||O.x>E.x||F.y<T.y||O.y>E.y?[]:t.clipLine([P],T.x,T.y,E.x,E.y)}for(var N=0,U=D;N<U.length;N+=1){var j;A.reset(U[N],.25*S),j=A.length<=.5*S?1:Math.ceil(A.paddedLength/k)+1;for(var V=0;V<j;V++){var G=V/Math.max(j-1,1),H=A.lerp(G),W=H.x+100,q=H.y+100;f.push(W,q,S,0);var Z=W-S,X=q-S,$=W+S,J=q+S;if(M=M&&this.isOffscreen(Z,X,$,J),w=w||this.isInsideGrid(Z,X,$,J),!e&&this.grid.hitTestCircle(W,q,S,p)&&(b=!0,!c))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!c&&b||!w?[]:f,offscreen:M,collisionDetected:b}},pe.prototype.queryRenderedSymbols=function(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};for(var n=[],r=1/0,i=1/0,o=-1/0,a=-1/0,s=0,l=e;s<l.length;s+=1){var c=l[s],u=new t.Point(c.x+100,c.y+100);r=Math.min(r,u.x),i=Math.min(i,u.y),o=Math.max(o,u.x),a=Math.max(a,u.y),n.push(u)}for(var p={},h={},d=0,f=this.grid.query(r,i,o,a).concat(this.ignoredGrid.query(r,i,o,a));d<f.length;d+=1){var m=f[d],g=m.key;if(void 0===p[g.bucketInstanceId]&&(p[g.bucketInstanceId]={}),!p[g.bucketInstanceId][g.featureIndex]){var y=[new t.Point(m.x1,m.y1),new t.Point(m.x2,m.y1),new t.Point(m.x2,m.y2),new t.Point(m.x1,m.y2)];t.polygonIntersectsPolygon(n,y)&&(p[g.bucketInstanceId][g.featureIndex]=!0,void 0===h[g.bucketInstanceId]&&(h[g.bucketInstanceId]=[]),h[g.bucketInstanceId].push(g.featureIndex))}}return h},pe.prototype.insertCollisionBox=function(t,e,n,r,i){(e?this.ignoredGrid:this.grid).insert({bucketInstanceId:n,featureIndex:r,collisionGroupID:i},t[0],t[1],t[2],t[3])},pe.prototype.insertCollisionCircles=function(t,e,n,r,i){for(var o=e?this.ignoredGrid:this.grid,a={bucketInstanceId:n,featureIndex:r,collisionGroupID:i},s=0;s<t.length;s+=4)o.insertCircle(a,t[s],t[s+1],t[s+2])},pe.prototype.projectAndGetPerspectiveRatio=function(e,n,r){var i=[n,r,0,1];return ue(i,i,e),{point:new t.Point((i[0]/i[3]+1)/2*this.transform.width+100,(-i[1]/i[3]+1)/2*this.transform.height+100),perspectiveRatio:.5+this.transform.cameraToCenterDistance/i[3]*.5}},pe.prototype.isOffscreen=function(t,e,n,r){return n<100||t>=this.screenRightBoundary||r<100||e>this.screenBottomBoundary},pe.prototype.isInsideGrid=function(t,e,n,r){return n>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary},pe.prototype.getViewportMatrix=function(){var e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e};var de=function(t,e,n,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&n?1:0,this.placed=n};de.prototype.isHidden=function(){return 0===this.opacity&&!this.placed};var fe=function(t,e,n,r,i){this.text=new de(t?t.text:null,e,n,i),this.icon=new de(t?t.icon:null,e,r,i)};fe.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var me=function(t,e,n){this.text=t,this.icon=e,this.skipFade=n},ge=function(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]},ye=function(t,e,n,r,i){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=n,this.bucketIndex=r,this.tileID=i},ve=function(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}};function _e(e,n,r,i,o){var a=t.getAnchorAlignment(e),s=-(a.horizontalAlign-.5)*n,l=-(a.verticalAlign-.5)*r,c=t.evaluateVariableOffset(e,i);return new t.Point(s+c[0]*o,l+c[1]*o)}function xe(e,n,r,i,o,a){var s=e.x1,l=e.x2,c=e.y1,u=e.y2,p=e.anchorPointX,h=e.anchorPointY,d=new t.Point(n,r);return i&&d._rotate(o?a:-a),{x1:s+d.x,y1:c+d.y,x2:l+d.x,y2:u+d.y,anchorPointX:p,anchorPointY:h}}ve.prototype.get=function(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){var e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:function(t){return t.collisionGroupID===e}}}return this.collisionGroups[t]};var be=function(t,e,n,r){this.transform=t.clone(),this.collisionIndex=new pe(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new ve(n),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}};function we(t,e,n,r,i){t.emplaceBack(e?1:0,n?1:0,r||0,i||0),t.emplaceBack(e?1:0,n?1:0,r||0,i||0),t.emplaceBack(e?1:0,n?1:0,r||0,i||0),t.emplaceBack(e?1:0,n?1:0,r||0,i||0)}be.prototype.getBucketParts=function(e,n,r,i){var o=r.getBucket(n),a=r.latestFeatureIndex;if(o&&a&&n.id===o.layerIds[0]){var s=r.collisionBoxArray,l=o.layers[0].layout,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),u=r.tileSize/t.EXTENT,p=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),h="map"===l.get("text-pitch-alignment"),d="map"===l.get("text-rotation-alignment"),f=he(r,1,this.transform.zoom),m=Yt(p,h,d,this.transform,f),g=null;if(h){var y=Qt(p,h,d,this.transform,f);g=t.multiply([],this.transform.labelPlaneMatrix,y)}this.retainedQueryData[o.bucketInstanceId]=new ye(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,r.tileID);var v={bucket:o,layout:l,posMatrix:p,textLabelPlaneMatrix:m,labelToScreenMatrix:g,scale:c,textPixelRatio:u,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(i)for(var _=0,x=o.sortKeyRanges;_<x.length;_+=1){var b=x[_];e.push({sortKey:b.sortKey,symbolInstanceStart:b.symbolInstanceStart,symbolInstanceEnd:b.symbolInstanceEnd,parameters:v})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:v})}},be.prototype.attemptAnchorPlacement=function(t,e,n,r,i,o,a,s,l,c,u,p,h,d,f){var m,g=[p.textOffset0,p.textOffset1],y=_e(t,n,r,g,i),v=this.collisionIndex.placeCollisionBox(xe(e,y.x,y.y,o,a,this.transform.angle),u,s,l,c.predicate);if(!f||0!==this.collisionIndex.placeCollisionBox(xe(f,y.x,y.y,o,a,this.transform.angle),u,s,l,c.predicate).box.length)return v.box.length>0?(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(m=this.prevPlacement.variableOffsets[p.crossTileID].anchor),this.variableOffsets[p.crossTileID]={textOffset:g,width:n,height:r,anchor:t,textBoxScale:i,prevAnchor:m},this.markUsedJustification(h,t,p,d),h.allowVerticalPlacement&&(this.markUsedOrientation(h,d,p),this.placedOrientations[p.crossTileID]=d),{shift:y,placedGlyphBoxes:v}):void 0},be.prototype.placeLayerBucketPart=function(e,n,r){var i=this,o=e.parameters,a=o.bucket,s=o.layout,l=o.posMatrix,c=o.textLabelPlaneMatrix,u=o.labelToScreenMatrix,p=o.textPixelRatio,h=o.holdingForFade,d=o.collisionBoxArray,f=o.partiallyEvaluatedTextSize,m=o.collisionGroup,g=s.get("text-optional"),y=s.get("icon-optional"),v=s.get("text-allow-overlap"),_=s.get("icon-allow-overlap"),x="map"===s.get("text-rotation-alignment"),b="map"===s.get("text-pitch-alignment"),w="none"!==s.get("icon-text-fit"),M="viewport-y"===s.get("symbol-z-order"),S=v&&(_||!a.hasIconData()||y),T=_&&(v||!a.hasTextData()||g);!a.collisionArrays&&d&&a.deserializeCollisionBoxes(d);var E=function(e,o){if(!n[e.crossTileID])if(h)i.placements[e.crossTileID]=new me(!1,!1,!1);else{var d,M=!1,E=!1,A=!0,C=null,L={box:null,offscreen:null},P={box:null,offscreen:null},I=null,R=null,k=0,z=0,D=0;o.textFeatureIndex?k=o.textFeatureIndex:e.useRuntimeCollisionCircles&&(k=e.featureIndex),o.verticalTextFeatureIndex&&(z=o.verticalTextFeatureIndex);var O=o.textBox;if(O){var F=function(n){var r=t.WritingMode.horizontal;if(a.allowVerticalPlacement&&!n&&i.prevPlacement){var o=i.prevPlacement.placedOrientations[e.crossTileID];o&&(i.placedOrientations[e.crossTileID]=o,i.markUsedOrientation(a,r=o,e))}return r},B=function(n,r){if(a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&o.verticalTextBox)for(var i=0,s=a.writingModes;i<s.length&&(s[i]===t.WritingMode.vertical?(L=r(),P=L):L=n(),!(L&&L.box&&L.box.length));i+=1);else L=n()};if(s.get("text-variable-anchor")){var N=s.get("text-variable-anchor");if(i.prevPlacement&&i.prevPlacement.variableOffsets[e.crossTileID]){var U=i.prevPlacement.variableOffsets[e.crossTileID];N.indexOf(U.anchor)>0&&(N=N.filter((function(t){return t!==U.anchor}))).unshift(U.anchor)}var j=function(t,n,r){for(var o=t.x2-t.x1,s=t.y2-t.y1,c=e.textBoxScale,u=w&&!_?n:null,h={box:[],offscreen:!1},d=v?2*N.length:N.length,f=0;f<d;++f){var g=i.attemptAnchorPlacement(N[f%N.length],t,o,s,c,x,b,p,l,m,f>=N.length,e,a,r,u);if(g&&(h=g.placedGlyphBoxes)&&h.box&&h.box.length){M=!0,C=g.shift;break}}return h};B((function(){return j(O,o.iconBox,t.WritingMode.horizontal)}),(function(){var n=o.verticalTextBox;return a.allowVerticalPlacement&&!(L&&L.box&&L.box.length)&&e.numVerticalGlyphVertices>0&&n?j(n,o.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),L&&(M=L.box,A=L.offscreen);var V=F(L&&L.box);if(!M&&i.prevPlacement){var G=i.prevPlacement.variableOffsets[e.crossTileID];G&&(i.variableOffsets[e.crossTileID]=G,i.markUsedJustification(a,G.anchor,e,V))}}else{var H=function(t,n){var r=i.collisionIndex.placeCollisionBox(t,v,p,l,m.predicate);return r&&r.box&&r.box.length&&(i.markUsedOrientation(a,n,e),i.placedOrientations[e.crossTileID]=n),r};B((function(){return H(O,t.WritingMode.horizontal)}),(function(){var n=o.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&n?H(n,t.WritingMode.vertical):{box:null,offscreen:null}})),F(L&&L.box&&L.box.length)}}if(M=(d=L)&&d.box&&d.box.length>0,A=d&&d.offscreen,e.useRuntimeCollisionCircles){var W=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),q=t.evaluateSizeForFeature(a.textSizeData,f,W),Z=s.get("text-padding");I=i.collisionIndex.placeCollisionCircles(v,W,a.lineVertexArray,a.glyphOffsetArray,q,l,c,u,r,b,m.predicate,e.collisionCircleDiameter,Z),M=v||I.circles.length>0&&!I.collisionDetected,A=A&&I.offscreen}if(o.iconFeatureIndex&&(D=o.iconFeatureIndex),o.iconBox){var X=function(t){var e=w&&C?xe(t,C.x,C.y,x,b,i.transform.angle):t;return i.collisionIndex.placeCollisionBox(e,_,p,l,m.predicate)};E=P&&P.box&&P.box.length&&o.verticalIconBox?(R=X(o.verticalIconBox)).box.length>0:(R=X(o.iconBox)).box.length>0,A=A&&R.offscreen}var $=g||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,J=y||0===e.numIconVertices;if($||J?J?$||(E=E&&M):M=E&&M:E=M=E&&M,M&&d&&d.box&&i.collisionIndex.insertCollisionBox(d.box,s.get("text-ignore-placement"),a.bucketInstanceId,P&&P.box&&z?z:k,m.ID),E&&R&&i.collisionIndex.insertCollisionBox(R.box,s.get("icon-ignore-placement"),a.bucketInstanceId,D,m.ID),I&&(M&&i.collisionIndex.insertCollisionCircles(I.circles,s.get("text-ignore-placement"),a.bucketInstanceId,k,m.ID),r)){var Y=a.bucketInstanceId,Q=i.collisionCircleArrays[Y];void 0===Q&&(Q=i.collisionCircleArrays[Y]=new ge);for(var K=0;K<I.circles.length;K+=4)Q.circles.push(I.circles[K+0]),Q.circles.push(I.circles[K+1]),Q.circles.push(I.circles[K+2]),Q.circles.push(I.collisionDetected?1:0)}i.placements[e.crossTileID]=new me(M||S,E||T,A||a.justReloaded),n[e.crossTileID]=!0}};if(M)for(var A=a.getSortedSymbolIndexes(this.transform.angle),C=A.length-1;C>=0;--C){var L=A[C];E(a.symbolInstances.get(L),a.collisionArrays[L])}else for(var P=e.symbolInstanceStart;P<e.symbolInstanceEnd;P++)E(a.symbolInstances.get(P),a.collisionArrays[P]);if(r&&a.bucketInstanceId in this.collisionCircleArrays){var I=this.collisionCircleArrays[a.bucketInstanceId];t.invert(I.invProjMatrix,l),I.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1},be.prototype.markUsedJustification=function(e,n,r,i){var o;o=i===t.WritingMode.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(n)];for(var a=0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];a<s.length;a+=1){var l=s[a];l>=0&&(e.text.placedSymbolArray.get(l).crossTileID=o>=0&&l!==o?0:r.crossTileID)}},be.prototype.markUsedOrientation=function(e,n,r){for(var i=n===t.WritingMode.horizontal||n===t.WritingMode.horizontalOnly?n:0,o=n===t.WritingMode.vertical?n:0,a=0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];a<s.length;a+=1)e.text.placedSymbolArray.get(s[a]).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=o)},be.prototype.commit=function(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;var e=this.prevPlacement,n=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;var r=e?e.symbolFadeChange(t):1,i=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(var s in this.placements){var l=this.placements[s],c=i[s];c?(this.opacities[s]=new fe(c,r,l.text,l.icon),n=n||l.text!==c.text.placed||l.icon!==c.icon.placed):(this.opacities[s]=new fe(null,r,l.text,l.icon,l.skipFade),n=n||l.text||l.icon)}for(var u in i){var p=i[u];if(!this.opacities[u]){var h=new fe(p,r,!1,!1);h.isHidden()||(this.opacities[u]=h,n=n||p.text.placed||p.icon.placed)}}for(var d in o)this.variableOffsets[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.variableOffsets[d]=o[d]);for(var f in a)this.placedOrientations[f]||!this.opacities[f]||this.opacities[f].isHidden()||(this.placedOrientations[f]=a[f]);n?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)},be.prototype.updateLayerOpacities=function(t,e){for(var n={},r=0,i=e;r<i.length;r+=1){var o=i[r],a=o.getBucket(t);a&&o.latestFeatureIndex&&t.id===a.layerIds[0]&&this.updateBucketOpacities(a,n,o.collisionBoxArray)}},be.prototype.updateBucketOpacities=function(e,n,r){var i=this;e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();var o=e.layers[0].layout,a=new fe(null,0,!1,!1,!0),s=o.get("text-allow-overlap"),l=o.get("icon-allow-overlap"),c=o.get("text-variable-anchor"),u="map"===o.get("text-rotation-alignment"),p="map"===o.get("text-pitch-alignment"),h="none"!==o.get("icon-text-fit"),d=new fe(null,0,s&&(l||!e.hasIconData()||o.get("icon-optional")),l&&(s||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);for(var f=function(t,e,n){for(var r=0;r<e/4;r++)t.opacityVertexArray.emplaceBack(n)},m=function(r){var o=e.symbolInstances.get(r),s=o.numHorizontalGlyphVertices,l=o.numVerticalGlyphVertices,m=o.crossTileID,g=i.opacities[m];n[m]?g=a:g||(i.opacities[m]=g=d),n[m]=!0;var y=o.numIconVertices>0,v=i.placedOrientations[o.crossTileID],_=v===t.WritingMode.vertical,x=v===t.WritingMode.horizontal||v===t.WritingMode.horizontalOnly;if(s>0||l>0){var b=Pe(g.text);f(e.text,s,_?Ie:b),f(e.text,l,x?Ie:b);var w=g.text.isHidden();[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||_?1:0)})),o.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).hidden=w||x?1:0);var M=i.variableOffsets[o.crossTileID];M&&i.markUsedJustification(e,M.anchor,o,v);var S=i.placedOrientations[o.crossTileID];S&&(i.markUsedJustification(e,"left",o,S),i.markUsedOrientation(e,S,o))}if(y){var T=Pe(g.icon),E=!(h&&o.verticalPlacedIconSymbolIndex&&_);o.placedIconSymbolIndex>=0&&(f(e.icon,o.numIconVertices,E?T:Ie),e.icon.placedSymbolArray.get(o.placedIconSymbolIndex).hidden=g.icon.isHidden()),o.verticalPlacedIconSymbolIndex>=0&&(f(e.icon,o.numVerticalIconVertices,E?Ie:T),e.icon.placedSymbolArray.get(o.verticalPlacedIconSymbolIndex).hidden=g.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var A=e.collisionArrays[r];if(A){var C=new t.Point(0,0);if(A.textBox||A.verticalTextBox){var L=!0;if(c){var P=i.variableOffsets[m];P?(C=_e(P.anchor,P.width,P.height,P.textOffset,P.textBoxScale),u&&C._rotate(p?i.transform.angle:-i.transform.angle)):L=!1}A.textBox&&we(e.textCollisionBox.collisionVertexArray,g.text.placed,!L||_,C.x,C.y),A.verticalTextBox&&we(e.textCollisionBox.collisionVertexArray,g.text.placed,!L||x,C.x,C.y)}var I=Boolean(!x&&A.verticalIconBox);A.iconBox&&we(e.iconCollisionBox.collisionVertexArray,g.icon.placed,I,h?C.x:0,h?C.y:0),A.verticalIconBox&&we(e.iconCollisionBox.collisionVertexArray,g.icon.placed,!I,h?C.x:0,h?C.y:0)}}},g=0;g<e.symbolInstances.length;g++)m(g);if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){var y=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=y.invProjMatrix,e.placementViewportMatrix=y.viewportMatrix,e.collisionCircleArray=y.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}},be.prototype.symbolFadeChange=function(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment},be.prototype.zoomAdjustment=function(t){return Math.max(0,(this.transform.zoom-t)/1.5)},be.prototype.hasTransitions=function(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration},be.prototype.stillRecent=function(t,e){var n=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*n>t},be.prototype.setStale=function(){this.stale=!0};var Me=Math.pow(2,25),Se=Math.pow(2,24),Te=Math.pow(2,17),Ee=Math.pow(2,16),Ae=Math.pow(2,9),Ce=Math.pow(2,8),Le=Math.pow(2,1);function Pe(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,n=Math.floor(127*t.opacity);return n*Me+e*Se+n*Te+e*Ee+n*Ae+e*Ce+n*Le+e}var Ie=0,Re=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};Re.prototype.continuePlacement=function(t,e,n,r,i){for(var o=this._bucketParts;this._currentTileIndex<t.length;)if(e.getBucketParts(o,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,i())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((function(t,e){return t.sortKey-e.sortKey})));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,n),this._currentPartIndex++,i())return!0;return!1};var ke=function(t,e,n,r,i,o,a){this.placement=new be(t,i,o,a),this._currentPlacementIndex=e.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=r,this._done=!1};ke.prototype.isDone=function(){return this._done},ke.prototype.continuePlacement=function(e,n,r){for(var i=this,o=t.browser.now(),a=function(){var e=t.browser.now()-o;return!i._forceFullPlacement&&e>2};this._currentPlacementIndex>=0;){var s=n[e[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new Re(s)),this._inProgressLayer.continuePlacement(r[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},ke.prototype.commit=function(t){return this.placement.commit(t),this.placement};var ze=512/t.EXTENT/2,De=function(t,e,n){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(var r=0;r<e.length;r++){var i=e.get(r),o=i.key;this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:i.crossTileID,coord:this.getScaledCoordinates(i,t)})}};De.prototype.getScaledCoordinates=function(e,n){var r=ze/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*t.EXTENT+e.anchorX)*r),y:Math.floor((n.canonical.y*t.EXTENT+e.anchorY)*r)}},De.prototype.findMatches=function(t,e,n){for(var r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z),i=0;i<t.length;i++){var o=t.get(i);if(!o.crossTileID){var a=this.indexedSymbolInstances[o.key];if(a)for(var s=this.getScaledCoordinates(o,e),l=0,c=a;l<c.length;l+=1){var u=c[l];if(Math.abs(u.coord.x-s.x)<=r&&Math.abs(u.coord.y-s.y)<=r&&!n[u.crossTileID]){n[u.crossTileID]=!0,o.crossTileID=u.crossTileID;break}}}}};var Oe=function(){this.maxCrossTileID=0};Oe.prototype.generate=function(){return++this.maxCrossTileID};var Fe=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};Fe.prototype.handleWrapJump=function(t){var e=Math.round((t-this.lng)/360);if(0!==e)for(var n in this.indexes){var r=this.indexes[n],i={};for(var o in r){var a=r[o];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+e),i[a.tileID.key]=a}this.indexes[n]=i}this.lng=t},Fe.prototype.addBucket=function(t,e,n){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(var r=0;r<e.symbolInstances.length;r++)e.symbolInstances.get(r).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});var i=this.usedCrossTileIDs[t.overscaledZ];for(var o in this.indexes){var a=this.indexes[o];if(Number(o)>t.overscaledZ)for(var s in a){var l=a[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,i)}else{var c=a[t.scaledTo(Number(o)).key];c&&c.findMatches(e.symbolInstances,t,i)}}for(var u=0;u<e.symbolInstances.length;u++){var p=e.symbolInstances.get(u);p.crossTileID||(p.crossTileID=n.generate(),i[p.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new De(t,e.symbolInstances,e.bucketInstanceId),!0},Fe.prototype.removeBucketCrossTileIDs=function(t,e){for(var n in e.indexedSymbolInstances)for(var r=0,i=e.indexedSymbolInstances[n];r<i.length;r+=1)delete this.usedCrossTileIDs[t][i[r].crossTileID]},Fe.prototype.removeStaleBuckets=function(t){var e=!1;for(var n in this.indexes){var r=this.indexes[n];for(var i in r)t[r[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,r[i]),delete r[i],e=!0)}return e};var Be=function(){this.layerIndexes={},this.crossTileIDs=new Oe,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};Be.prototype.addLayer=function(t,e,n){var r=this.layerIndexes[t.id];void 0===r&&(r=this.layerIndexes[t.id]=new Fe);var i=!1,o={};r.handleWrapJump(n);for(var a=0,s=e;a<s.length;a+=1){var l=s[a],c=l.getBucket(t);c&&t.id===c.layerIds[0]&&(c.bucketInstanceId||(c.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(l.tileID,c,this.crossTileIDs)&&(i=!0),o[c.bucketInstanceId]=!0)}return r.removeStaleBuckets(o)&&(i=!0),i},Be.prototype.pruneUnusedLayers=function(t){var e={};for(var n in t.forEach((function(t){e[t]=!0})),this.layerIndexes)e[n]||delete this.layerIndexes[n]};var Ne=function(e,n){return t.emitValidationErrors(e,n&&n.filter((function(t){return"source.canvas"!==t.identifier})))},Ue=t.pick(jt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),je=t.pick(jt,["setCenter","setZoom","setBearing","setPitch"]),Ve=function(){var e={},n=t.styleSpec.$version;for(var r in t.styleSpec.$root){var i,o=t.styleSpec.$root[r];o.required&&null!=(i="version"===r?n:"array"===o.type?[]:{})&&(e[r]=i)}return e}(),Ge=function(e){function n(r,i){var o=this;void 0===i&&(i={}),e.call(this),this.map=r,this.dispatcher=new S(Bt(),this),this.imageManager=new h,this.imageManager.setEventedParent(this),this.glyphManager=new _(r._requestManager,i.localIdeographFontFamily),this.lineAtlas=new M(256,512),this.crossTileSymbolIndex=new Be,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());var a=this;this._rtlTextPluginCallback=n.registerForPluginStateChange((function(e){a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},(function(e,n){if(t.triggerPluginCompletionEvent(e),n&&n.every((function(t){return t})))for(var r in a.sourceCaches)a.sourceCaches[r].reload()}))})),this.on("data",(function(t){if("source"===t.dataType&&"metadata"===t.sourceDataType){var e=o.sourceCaches[t.sourceId];if(e){var n=e.getSource();if(n&&n.vectorLayerIds)for(var r in o._layers){var i=o._layers[r];i.source===n.id&&o._validateLayer(i)}}}}))}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.loadURL=function(e,n){var r=this;void 0===n&&(n={}),this.fire(new t.Event("dataloading",{dataType:"style"}));var i="boolean"==typeof n.validate?n.validate:!t.isMapboxURL(e);e=this.map._requestManager.normalizeStyleURL(e,n.accessToken);var o=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(o,(function(e,n){r._request=null,e?r.fire(new t.ErrorEvent(e)):n&&r._load(n,i)}))},n.prototype.loadJSON=function(e,n){var r=this;void 0===n&&(n={}),this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.browser.frame((function(){r._request=null,r._load(e,!1!==n.validate)}))},n.prototype.loadEmpty=function(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(Ve,!1)},n.prototype._load=function(e,n){if(!n||!Ne(this,t.validateStyle(e))){for(var r in this._loaded=!0,this.stylesheet=e,e.sources)this.addSource(r,e.sources[r],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var i=Ut(this.stylesheet.layers);this._order=i.map((function(t){return t.id})),this._layers={},this._serializedLayers={};for(var o=0,a=i;o<a.length;o+=1){var s=a[o];(s=t.createStyleLayer(s)).setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=s,this._serializedLayers[s.id]=s.serialize()}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new w(this.stylesheet.light),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}},n.prototype._loadSprite=function(e){var n=this;this._spriteRequest=function(e,n,r){var i,o,a,s=t.browser.devicePixelRatio>1?"@2x":"",l=t.getJSON(n.transformRequest(n.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){l=null,a||(a=t,i=e,u())})),c=t.getImage(n.transformRequest(n.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){c=null,a||(a=t,o=e,u())}));function u(){if(a)r(a);else if(i&&o){var e=t.browser.getImageData(o),n={};for(var s in i){var l=i[s],c=l.width,u=l.height,p=l.x,h=l.y,d=l.sdf,f=l.pixelRatio,m=l.stretchX,g=l.stretchY,y=l.content,v=new t.RGBAImage({width:c,height:u});t.RGBAImage.copy(e,v,{x:p,y:h},{x:0,y:0},{width:c,height:u}),n[s]={data:v,pixelRatio:f,sdf:d,stretchX:m,stretchY:g,content:y}}r(null,n)}}return{cancel:function(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(e,this.map._requestManager,(function(e,r){if(n._spriteRequest=null,e)n.fire(new t.ErrorEvent(e));else if(r)for(var i in r)n.imageManager.addImage(i,r[i]);n.imageManager.setLoaded(!0),n._availableImages=n.imageManager.listImages(),n.dispatcher.broadcast("setImages",n._availableImages),n.fire(new t.Event("data",{dataType:"style"}))}))},n.prototype._validateLayer=function(e){var n=this.sourceCaches[e.source];if(n){var r=e.sourceLayer;if(r){var i=n.getSource();("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+r+'" does not exist on source "'+i.id+'" as specified by style layer "'+e.id+'"')))}}},n.prototype.loaded=function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()},n.prototype._serializeLayers=function(t){for(var e=[],n=0,r=t;n<r.length;n+=1){var i=this._layers[r[n]];"custom"!==i.type&&e.push(i.serialize())}return e},n.prototype.hasTransitions=function(){if(this.light&&this.light.hasTransition())return!0;for(var t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(var e in this._layers)if(this._layers[e].hasTransition())return!0;return!1},n.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},n.prototype.update=function(e){if(this._loaded){var n=this._changed;if(this._changed){var r=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);for(var o in(r.length||i.length)&&this._updateWorkerLayers(r,i),this._updatedSources){var a=this._updatedSources[o];"reload"===a?this._reloadSource(o):"clear"===a&&this._clearSource(o)}for(var s in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}var l={};for(var c in this.sourceCaches){var u=this.sourceCaches[c];l[c]=u.used,u.used=!1}for(var p=0,h=this._order;p<h.length;p+=1){var d=this._layers[h[p]];d.recalculate(e,this._availableImages),!d.isHidden(e.zoom)&&d.source&&(this.sourceCaches[d.source].used=!0)}for(var f in l){var m=this.sourceCaches[f];l[f]!==m.used&&m.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:f}))}this.light.recalculate(e),this.z=e.zoom,n&&this.fire(new t.Event("data",{dataType:"style"}))}},n.prototype._updateTilesForChangedImages=function(){var t=Object.keys(this._changedImages);if(t.length){for(var e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}},n.prototype._updateWorkerLayers=function(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})},n.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}},n.prototype.setState=function(e){var n=this;if(this._checkLoaded(),Ne(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=Ut(e.layers);var r=function(e,n){if(!e)return[{command:jt.setStyle,args:[n]}];var r=[];try{if(!t.deepEqual(e.version,n.version))return[{command:jt.setStyle,args:[n]}];t.deepEqual(e.center,n.center)||r.push({command:jt.setCenter,args:[n.center]}),t.deepEqual(e.zoom,n.zoom)||r.push({command:jt.setZoom,args:[n.zoom]}),t.deepEqual(e.bearing,n.bearing)||r.push({command:jt.setBearing,args:[n.bearing]}),t.deepEqual(e.pitch,n.pitch)||r.push({command:jt.setPitch,args:[n.pitch]}),t.deepEqual(e.sprite,n.sprite)||r.push({command:jt.setSprite,args:[n.sprite]}),t.deepEqual(e.glyphs,n.glyphs)||r.push({command:jt.setGlyphs,args:[n.glyphs]}),t.deepEqual(e.transition,n.transition)||r.push({command:jt.setTransition,args:[n.transition]}),t.deepEqual(e.light,n.light)||r.push({command:jt.setLight,args:[n.light]});var i={},o=[];!function(e,n,r,i){var o;for(o in n=n||{},e=e||{})e.hasOwnProperty(o)&&(n.hasOwnProperty(o)||Gt(o,r,i));for(o in n)n.hasOwnProperty(o)&&(e.hasOwnProperty(o)?t.deepEqual(e[o],n[o])||("geojson"===e[o].type&&"geojson"===n[o].type&&Wt(e,n,o)?r.push({command:jt.setGeoJSONSourceData,args:[o,n[o].data]}):Ht(o,n,r,i)):Vt(o,n,r))}(e.sources,n.sources,o,i);var a=[];e.layers&&e.layers.forEach((function(t){i[t.source]?r.push({command:jt.removeLayer,args:[t.id]}):a.push(t)})),r=r.concat(o),function(e,n,r){n=n||[];var i,o,a,s,l,c,u,p=(e=e||[]).map(Zt),h=n.map(Zt),d=e.reduce(Xt,{}),f=n.reduce(Xt,{}),m=p.slice(),g=Object.create(null);for(i=0,o=0;i<p.length;i++)f.hasOwnProperty(a=p[i])?o++:(r.push({command:jt.removeLayer,args:[a]}),m.splice(m.indexOf(a,o),1));for(i=0,o=0;i<h.length;i++)m[m.length-1-i]!==(a=h[h.length-1-i])&&(d.hasOwnProperty(a)?(r.push({command:jt.removeLayer,args:[a]}),m.splice(m.lastIndexOf(a,m.length-o),1)):o++,r.push({command:jt.addLayer,args:[f[a],c=m[m.length-i]]}),m.splice(m.length-i,0,a),g[a]=!0);for(i=0;i<h.length;i++)if(s=d[a=h[i]],l=f[a],!g[a]&&!t.deepEqual(s,l))if(t.deepEqual(s.source,l.source)&&t.deepEqual(s["source-layer"],l["source-layer"])&&t.deepEqual(s.type,l.type)){for(u in qt(s.layout,l.layout,r,a,null,jt.setLayoutProperty),qt(s.paint,l.paint,r,a,null,jt.setPaintProperty),t.deepEqual(s.filter,l.filter)||r.push({command:jt.setFilter,args:[a,l.filter]}),t.deepEqual(s.minzoom,l.minzoom)&&t.deepEqual(s.maxzoom,l.maxzoom)||r.push({command:jt.setLayerZoomRange,args:[a,l.minzoom,l.maxzoom]}),s)s.hasOwnProperty(u)&&"layout"!==u&&"paint"!==u&&"filter"!==u&&"metadata"!==u&&"minzoom"!==u&&"maxzoom"!==u&&(0===u.indexOf("paint.")?qt(s[u],l[u],r,a,u.slice(6),jt.setPaintProperty):t.deepEqual(s[u],l[u])||r.push({command:jt.setLayerProperty,args:[a,u,l[u]]}));for(u in l)l.hasOwnProperty(u)&&!s.hasOwnProperty(u)&&"layout"!==u&&"paint"!==u&&"filter"!==u&&"metadata"!==u&&"minzoom"!==u&&"maxzoom"!==u&&(0===u.indexOf("paint.")?qt(s[u],l[u],r,a,u.slice(6),jt.setPaintProperty):t.deepEqual(s[u],l[u])||r.push({command:jt.setLayerProperty,args:[a,u,l[u]]}))}else r.push({command:jt.removeLayer,args:[a]}),c=m[m.lastIndexOf(a)+1],r.push({command:jt.addLayer,args:[l,c]})}(a,n.layers,r)}catch(t){console.warn("Unable to compute style diff:",t),r=[{command:jt.setStyle,args:[n]}]}return r}(this.serialize(),e).filter((function(t){return!(t.command in je)}));if(0===r.length)return!1;var i=r.filter((function(t){return!(t.command in Ue)}));if(i.length>0)throw new Error("Unimplemented: "+i.map((function(t){return t.command})).join(", ")+".");return r.forEach((function(t){"setTransition"!==t.command&&n[t.command].apply(n,t.args)})),this.stylesheet=e,!0},n.prototype.addImage=function(e,n){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,n),this._afterImageUpdated(e)},n.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},n.prototype.getImage=function(t){return this.imageManager.getImage(t)},n.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._afterImageUpdated(e)},n.prototype._afterImageUpdated=function(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))},n.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},n.prototype.addSource=function(e,n,r){var i=this;if(void 0===r&&(r={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!n.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(n).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,n,null,r))){this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);var o=this.sourceCaches[e]=new Pt(e,n,this.dispatcher);o.style=this,o.setEventedParent(this,(function(){return{isSourceLoaded:i.loaded(),source:o.serialize(),sourceId:e}})),o.onAdd(this.map),this._changed=!0}},n.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var n in this._layers)if(this._layers[n].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+n+'" is using it.')));var r=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],r.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),r.setEventedParent(null),r.clearTiles(),r.onRemove&&r.onRemove(this.map),this._changed=!0},n.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},n.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},n.prototype.addLayer=function(e,n,r){void 0===r&&(r={}),this._checkLoaded();var i=e.id;if(this.getLayer(i))this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" already exists on this map')));else{var o;if("custom"===e.type){if(Ne(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(i,e.source),e=t.clone$1(e),e=t.extend(e,{source:i})),this._validate(t.validateStyle.layer,"layers."+i,e,{arrayIndex:-1},r))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:i}}),this._serializedLayers[o.id]=o.serialize()}var a=n?this._order.indexOf(n):this._order.length;if(n&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+n+'" does not exist on this map.')));else{if(this._order.splice(a,0,i),this._layerOrderChanged=!0,this._layers[i]=o,this._removedLayers[i]&&o.source&&"custom"!==o.type){var s=this._removedLayers[i];delete this._removedLayers[i],s.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}},n.prototype.moveLayer=function(e,n){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==n){var r=this._order.indexOf(e);this._order.splice(r,1);var i=n?this._order.indexOf(n):this._order.length;n&&-1===i?this.fire(new t.ErrorEvent(new Error('Layer with id "'+n+'" does not exist on this map.'))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},n.prototype.removeLayer=function(e){this._checkLoaded();var n=this._layers[e];if(n){n.setEventedParent(null);var r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},n.prototype.getLayer=function(t){return this._layers[t]},n.prototype.hasLayer=function(t){return t in this._layers},n.prototype.setLayerZoomRange=function(e,n,r){this._checkLoaded();var i=this.getLayer(e);i?i.minzoom===n&&i.maxzoom===r||(null!=n&&(i.minzoom=n),null!=r&&(i.maxzoom=r),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},n.prototype.setFilter=function(e,n,r){void 0===r&&(r={}),this._checkLoaded();var i=this.getLayer(e);if(i){if(!t.deepEqual(i.filter,n))return null==n?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.validateStyle.filter,"layers."+i.id+".filter",n,null,r)||(i.filter=t.clone$1(n),this._updateLayer(i)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},n.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},n.prototype.setLayoutProperty=function(e,n,r,i){void 0===i&&(i={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getLayoutProperty(n),r)||(o.setLayoutProperty(n,r,i),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},n.prototype.getLayoutProperty=function(e,n){var r=this.getLayer(e);if(r)return r.getLayoutProperty(n);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},n.prototype.setPaintProperty=function(e,n,r,i){void 0===i&&(i={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getPaintProperty(n),r)||(o.setPaintProperty(n,r,i)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},n.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},n.prototype.setFeatureState=function(e,n){this._checkLoaded();var r=e.source,i=e.sourceLayer,o=this.sourceCaches[r];if(void 0!==o){var a=o.getSource().type;"geojson"===a&&i?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||i?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.setFeatureState(i,e.id,n)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},n.prototype.removeFeatureState=function(e,n){this._checkLoaded();var r=e.source,i=this.sourceCaches[r];if(void 0!==i){var o=i.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?n&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):i.removeFeatureState(a,e.id,n):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},n.prototype.getFeatureState=function(e){this._checkLoaded();var n=e.source,r=e.sourceLayer,i=this.sourceCaches[n];if(void 0!==i){if("vector"!==i.getSource().type||r)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),i.getFeatureState(r,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},n.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},n.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(function(t){return t.serialize()})),layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},n.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},n.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,n=function(t){return"fill-extrusion"===e._layers[t].type},r={},i=[],o=this._order.length-1;o>=0;o--){var a=this._order[o];if(n(a)){r[a]=o;for(var s=0,l=t;s<l.length;s+=1){var c=l[s][a];if(c)for(var u=0,p=c;u<p.length;u+=1)i.push(p[u])}}}i.sort((function(t,e){return e.intersectionZ-t.intersectionZ}));for(var h=[],d=this._order.length-1;d>=0;d--){var f=this._order[d];if(n(f))for(var m=i.length-1;m>=0;m--){var g=i[m].feature;if(r[g.layer.id]<d)break;h.push(g),i.pop()}else for(var y=0,v=t;y<v.length;y+=1){var _=v[y][f];if(_)for(var x=0,b=_;x<b.length;x+=1)h.push(b[x].feature)}}return h},n.prototype.queryRenderedFeatures=function(e,n,r){n&&n.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);var i={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(var o=0,a=n.layers;o<a.length;o+=1){var s=a[o],l=this._layers[s];if(!l)return this.fire(new t.ErrorEvent(new Error("The layer '"+s+"' does not exist in the map's style and cannot be queried for features."))),[];i[l.source]=!0}}var c=[];for(var u in n.availableImages=this._availableImages,this.sourceCaches)n.layers&&!i[u]||c.push(F(this.sourceCaches[u],this._layers,this._serializedLayers,e,n,r));return this.placement&&c.push(function(t,e,n,r,i,o,a){for(var s={},l=o.queryRenderedSymbols(r),c=[],u=0,p=Object.keys(l).map(Number);u<p.length;u+=1)c.push(a[p[u]]);c.sort(B);for(var h=function(){var n=f[d],r=n.featureIndex.lookupSymbolFeatures(l[n.bucketInstanceId],e,n.bucketIndex,n.sourceLayerIndex,i.filter,i.layers,i.availableImages,t);for(var o in r){var a=s[o]=s[o]||[],c=r[o];c.sort((function(t,e){var r=n.featureSortOrder;if(r){var i=r.indexOf(t.featureIndex);return r.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(var u=0,p=c;u<p.length;u+=1)a.push(p[u])}},d=0,f=c;d<f.length;d+=1)h();var m=function(e){s[e].forEach((function(r){var i=r.feature,o=n[t[e].source].getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=o}))};for(var g in s)m(g);return s}(this._layers,this._serializedLayers,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)},n.prototype.querySourceFeatures=function(e,n){n&&n.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);var r=this.sourceCaches[e];return r?function(t,e){for(var n=t.getRenderableIds().map((function(e){return t.getTileByID(e)})),r=[],i={},o=0;o<n.length;o++){var a=n[o],s=a.tileID.canonical.key;i[s]||(i[s]=!0,a.querySourceFeatures(r,e))}return r}(r,n):[]},n.prototype.addSourceType=function(t,e,r){return n.getSourceType(t)?r(new Error('A source type called "'+t+'" already exists.')):(n.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},r):r(null,null))},n.prototype.getLight=function(){return this.light.getLight()},n.prototype.setLight=function(e,n){void 0===n&&(n={}),this._checkLoaded();var r=this.light.getLight(),i=!1;for(var o in e)if(!t.deepEqual(e[o],r[o])){i=!0;break}if(i){var a={now:t.browser.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(a)}},n.prototype._validate=function(e,n,r,i,o){return void 0===o&&(o={}),(!o||!1!==o.validate)&&Ne(this,e.call(t.validateStyle,t.extend({key:n,style:this.serialize(),value:r,styleSpec:t.styleSpec},i)))},n.prototype._remove=function(){for(var e in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[e].setEventedParent(null);for(var n in this.sourceCaches)this.sourceCaches[n].clearTiles(),this.sourceCaches[n].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()},n.prototype._clearSource=function(t){this.sourceCaches[t].clearTiles()},n.prototype._reloadSource=function(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()},n.prototype._updateSources=function(t){for(var e in this.sourceCaches)this.sourceCaches[e].update(t)},n.prototype._generateCollisionBoxes=function(){for(var t in this.sourceCaches)this._reloadSource(t)},n.prototype._updatePlacement=function(e,n,r,i,o){void 0===o&&(o=!1);for(var a=!1,s=!1,l={},c=0,u=this._order;c<u.length;c+=1){var p=this._layers[u[c]];if("symbol"===p.type){if(!l[p.source]){var h=this.sourceCaches[p.source];l[p.source]=h.getRenderableIds(!0).map((function(t){return h.getTileByID(t)})).sort((function(t,e){return e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)}))}var d=this.crossTileSymbolIndex.addLayer(p,l[p.source],e.center.lng);a=a||d}}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.browser.now(),e.zoom))&&(this.pauseablePlacement=new ke(e,this._order,o,n,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.browser.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(var f=0,m=this._order;f<m.length;f+=1){var g=this._layers[m[f]];"symbol"===g.type&&this.placement.updateLayerOpacities(g,l[g.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.browser.now())},n.prototype._releaseSymbolFadeTiles=function(){for(var t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()},n.prototype.getImages=function(t,e,n){this.imageManager.getImages(e.icons,n),this._updateTilesForChangedImages();var r=this.sourceCaches[e.source];r&&r.setDependencies(e.tileID.key,e.type,e.icons)},n.prototype.getGlyphs=function(t,e,n){this.glyphManager.getGlyphs(e.stacks,n)},n.prototype.getResource=function(e,n,r){return t.makeRequest(n,r)},n}(t.Evented);Ge.getSourceType=function(t){return D[t]},Ge.setSourceType=function(t,e){D[t]=e},Ge.registerForPluginStateChange=t.registerForPluginStateChange;var He=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),We=vn("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}"),qe=vn("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Ze=vn("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),Xe=vn("varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),$e=vn("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Je=vn("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),Ye=vn("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),Qe=vn("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),Ke=vn("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),tn=vn("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),en=vn("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),nn=vn("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),rn=vn("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),on=vn("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),an=vn("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),sn=vn("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),ln=vn("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),cn=vn("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),un=vn("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),pn=vn("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),hn=vn("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),dn=vn("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),fn=vn("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),mn=vn("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),gn=vn("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),yn=vn("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}");function vn(t,e){var n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/attribute ([\w]+) ([\w]+)/g),i=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(i):i,s={};return{fragmentSource:t=t.replace(n,(function(t,e,n,r,i){return s[i]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nvarying "+n+" "+r+" "+i+";\n#else\nuniform "+n+" "+r+" u_"+i+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+i+"\n "+n+" "+r+" "+i+" = u_"+i+";\n#endif\n"})),vertexSource:e=e.replace(n,(function(t,e,n,r,i){var o="float"===r?"vec2":"vec4",a=i.match(/color/)?"color":o;return s[i]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float u_"+i+"_t;\nattribute "+n+" "+o+" a_"+i+";\nvarying "+n+" "+r+" "+i+";\n#else\nuniform "+n+" "+r+" u_"+i+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+i+" = a_"+i+";\n#else\n "+n+" "+r+" "+i+" = u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+i+" = unpack_mix_"+a+"(a_"+i+", u_"+i+"_t);\n#else\n "+n+" "+r+" "+i+" = u_"+i+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float u_"+i+"_t;\nattribute "+n+" "+o+" a_"+i+";\n#else\nuniform "+n+" "+r+" u_"+i+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+n+" "+r+" "+i+" = a_"+i+";\n#else\n "+n+" "+r+" "+i+" = u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+n+" "+r+" "+i+" = unpack_mix_"+a+"(a_"+i+", u_"+i+"_t);\n#else\n "+n+" "+r+" "+i+" = u_"+i+";\n#endif\n"})),staticAttributes:r,staticUniforms:a}}var _n=Object.freeze({__proto__:null,prelude:We,background:qe,backgroundPattern:Ze,circle:Xe,clippingMask:$e,heatmap:Je,heatmapTexture:Ye,collisionBox:Qe,collisionCircle:Ke,debug:tn,fill:en,fillOutline:nn,fillOutlinePattern:rn,fillPattern:on,fillExtrusion:an,fillExtrusionPattern:sn,hillshadePrepare:ln,hillshade:cn,line:un,lineGradient:pn,linePattern:hn,lineSDF:dn,raster:fn,symbolIcon:mn,symbolSDF:gn,symbolTextAndIcon:yn}),xn=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function bn(t){for(var e=[],n=0;n<t.length;n++)if(null!==t[n]){var r=t[n].split(" ");e.push(r.pop())}return e}xn.prototype.bind=function(t,e,n,r,i,o,a,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==r.length,c=0;!l&&c<r.length;c++)this.boundPaintVertexBuffers[c]!==r[c]&&(l=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===e&&this.boundLayoutVertexBuffer===n&&!l&&this.boundIndexBuffer===i&&this.boundVertexOffset===o&&this.boundDynamicVertexBuffer===a&&this.boundDynamicVertexBuffer2===s?(t.bindVertexArrayOES.set(this.vao),a&&a.bind(),i&&i.dynamicDraw&&i.bind(),s&&s.bind()):this.freshBind(e,n,r,i,o,a,s)},xn.prototype.freshBind=function(t,e,n,r,i,o,a){var s,l=t.numAttributes,c=this.context,u=c.gl;if(c.extVertexArrayObject)this.vao&&this.destroy(),this.vao=c.extVertexArrayObject.createVertexArrayOES(),c.bindVertexArrayOES.set(this.vao),s=0,this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=r,this.boundVertexOffset=i,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a;else{s=c.currentNumAttributes||0;for(var p=l;p<s;p++)u.disableVertexAttribArray(p)}e.enableAttributes(u,t);for(var h=0,d=n;h<d.length;h+=1)d[h].enableAttributes(u,t);o&&o.enableAttributes(u,t),a&&a.enableAttributes(u,t),e.bind(),e.setVertexAttribPointers(u,t,i);for(var f=0,m=n;f<m.length;f+=1){var g=m[f];g.bind(),g.setVertexAttribPointers(u,t,i)}o&&(o.bind(),o.setVertexAttribPointers(u,t,i)),r&&r.bind(),a&&(a.bind(),a.setVertexAttribPointers(u,t,i)),c.currentNumAttributes=l},xn.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var wn=function(t,e,n,r,i,o){var a=t.gl;this.program=a.createProgram();for(var s=bn(n.staticAttributes),l=r?r.getBinderAttributes():[],c=s.concat(l),u=n.staticUniforms?bn(n.staticUniforms):[],p=r?r.getBinderUniforms():[],h=[],d=0,f=u.concat(p);d<f.length;d+=1){var m=f[d];h.indexOf(m)<0&&h.push(m)}var g=r?r.defines():[];o&&g.push("#define OVERDRAW_INSPECTOR;");var y=g.concat(We.fragmentSource,n.fragmentSource).join("\n"),v=g.concat(We.vertexSource,n.vertexSource).join("\n"),_=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(_,y),a.compileShader(_),a.attachShader(this.program,_);var x=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(x,v),a.compileShader(x),a.attachShader(this.program,x),this.attributes={};var b={};this.numAttributes=c.length;for(var w=0;w<this.numAttributes;w++)c[w]&&(a.bindAttribLocation(this.program,w,c[w]),this.attributes[c[w]]=w);a.linkProgram(this.program),a.deleteShader(x),a.deleteShader(_);for(var M=0;M<h.length;M++){var S=h[M];if(S&&!b[S]){var T=a.getUniformLocation(this.program,S);T&&(b[S]=T)}}this.fixedUniforms=i(t,b),this.binderUniforms=r?r.getUniforms(t,b):[]}}};function Mn(t,e,n){var r=1/he(n,1,e.transform.tileZoom),i=Math.pow(2,n.tileID.overscaledZ),o=n.tileSize*Math.pow(2,e.transform.tileZoom)/i,a=o*(n.tileID.canonical.x+n.tileID.wrap*i),s=o*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[r,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}wn.prototype.draw=function(t,e,n,r,i,o,a,s,l,c,u,p,h,d,f,m){var g,y=t.gl;if(!this.failedToCreate){for(var v in t.program.set(this.program),t.setDepthMode(n),t.setStencilMode(r),t.setColorMode(i),t.setCullFace(o),this.fixedUniforms)this.fixedUniforms[v].set(a[v]);d&&d.setUniforms(t,this.binderUniforms,p,{zoom:h});for(var _=(g={},g[y.LINES]=2,g[y.TRIANGLES]=3,g[y.LINE_STRIP]=1,g)[e],x=0,b=u.get();x<b.length;x+=1){var w=b[x],M=w.vaos||(w.vaos={});(M[s]||(M[s]=new xn)).bind(t,this,l,d?d.getPaintVertexBuffers():[],c,w.vertexOffset,f,m),y.drawElements(e,w.primitiveLength*_,y.UNSIGNED_SHORT,w.primitiveOffset*_*2)}}};var Sn=function(e,n,r,i){var o=n.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=t.create$1();"viewport"===o.properties.get("anchor")&&t.fromRotation(l,-n.transform.angle),t.transformMat3(s,s,l);var c=o.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+r,u_opacity:i}},Tn=function(e,n,r,i,o,a,s){return t.extend(Sn(e,n,r,i),Mn(a,n,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8})},En=function(t){return{u_matrix:t}},An=function(e,n,r,i){return t.extend(En(e),Mn(r,n,i))},Cn=function(t,e){return{u_matrix:t,u_world:e}},Ln=function(e,n,r,i,o){return t.extend(An(e,n,r,i),{u_world:o})},Pn=function(e,n,r,i){var o,a,s=e.transform;if("map"===i.paint.get("circle-pitch-alignment")){var l=he(r,1,s.zoom);o=!0,a=[l,l]}else o=!1,a=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(n.posMatrix,r,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:t.browser.devicePixelRatio,u_extrude_scale:a}},In=function(t,e,n){var r=he(n,1,e.zoom),i=Math.pow(2,e.zoom-n.tileID.overscaledZ),o=n.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:r,u_extrude_scale:[e.pixelsToGLUnits[0]/(r*i),e.pixelsToGLUnits[1]/(r*i)],u_overscale_factor:o}},Rn=function(t,e,n){return{u_matrix:t,u_inv_matrix:e,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}},kn=function(t,e,n){return void 0===n&&(n=1),{u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:n}},zn=function(t){return{u_matrix:t}},Dn=function(t,e,n,r){return{u_matrix:t,u_extrude_scale:he(e,1,n),u_intensity:r}},On=function(e,n,r){var i=e.transform;return{u_matrix:jn(e,n,r),u_ratio:1/he(n,1,i.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},Fn=function(e,n,r,i){return t.extend(On(e,n,r),{u_image:0,u_image_height:i})},Bn=function(e,n,r,i){var o=e.transform,a=Un(n,o);return{u_matrix:jn(e,n,r),u_texsize:n.imageAtlasTexture.size,u_ratio:1/he(n,1,o.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_image:0,u_scale:[a,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Nn=function(e,n,r,i,o){var a=e.lineAtlas,s=Un(n,e.transform),l="round"===r.layout.get("line-cap"),c=a.getDash(i.from,l),u=a.getDash(i.to,l),p=c.width*o.fromScale,h=u.width*o.toScale;return t.extend(On(e,n,r),{u_patternscale_a:[s/p,-c.height/2],u_patternscale_b:[s/h,-u.height/2],u_sdfgamma:a.width/(256*Math.min(p,h)*t.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:u.y,u_mix:o.t})};function Un(t,e){return 1/he(t,1,e.tileZoom)}function jn(t,e,n){return t.translatePosMatrix(e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}var Vn=function(t,e,n,r,i){return{u_matrix:t,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:(a=i.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=i.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Gn(i.paint.get("raster-hue-rotate"))};var o,a};function Gn(t){t*=Math.PI/180;var e=Math.sin(t),n=Math.cos(t);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}var Hn,Wn=function(t,e,n,r,i,o,a,s,l,c){var u=i.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:u.cameraToCenterDistance,u_pitch:u.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:u.width/u.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+r,u_texsize:c,u_texture:0}},qn=function(e,n,r,i,o,a,s,l,c,u,p){var h=o.transform;return t.extend(Wn(e,n,r,i,o,a,s,l,c,u),{u_gamma_scale:i?Math.cos(h._pitch)*h.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+p})},Zn=function(e,n,r,i,o,a,s,l,c,u){return t.extend(qn(e,n,r,i,o,a,s,l,!0,c,!0),{u_texsize_icon:u,u_texture_icon:1})},Xn=function(t,e,n){return{u_matrix:t,u_opacity:e,u_color:n}},$n=function(e,n,r,i,o,a){return t.extend(function(t,e,n,r){var i=n.imageManager.getPattern(t.from.toString()),o=n.imageManager.getPattern(t.to.toString()),a=n.imageManager.getPixelSize(),s=a.width,l=a.height,c=Math.pow(2,r.tileID.overscaledZ),u=r.tileSize*Math.pow(2,n.transform.tileZoom)/c,p=u*(r.tileID.canonical.x+r.tileID.wrap*c),h=u*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,l],u_mix:e.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/he(r,1,n.transform.tileZoom),u_pixel_coord_upper:[p>>16,h>>16],u_pixel_coord_lower:[65535&p,65535&h]}}(i,a,r,o),{u_matrix:e,u_opacity:n})},Jn={fillExtrusion:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_lightpos:new t.Uniform3f(e,n.u_lightpos),u_lightintensity:new t.Uniform1f(e,n.u_lightintensity),u_lightcolor:new t.Uniform3f(e,n.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,n.u_vertical_gradient),u_opacity:new t.Uniform1f(e,n.u_opacity)}},fillExtrusionPattern:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_lightpos:new t.Uniform3f(e,n.u_lightpos),u_lightintensity:new t.Uniform1f(e,n.u_lightintensity),u_lightcolor:new t.Uniform3f(e,n.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,n.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,n.u_height_factor),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade),u_opacity:new t.Uniform1f(e,n.u_opacity)}},fill:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}},fillPattern:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}},fillOutline:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world)}},fillOutlinePattern:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}},circle:function(e,n){return{u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,n.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,n.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}},collisionBox:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,n.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,n.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,n.u_overscale_factor)}},collisionCircle:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,n.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,n.u_viewport_size)}},debug:function(e,n){return{u_color:new t.UniformColor(e,n.u_color),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_overlay:new t.Uniform1i(e,n.u_overlay),u_overlay_scale:new t.Uniform1f(e,n.u_overlay_scale)}},clippingMask:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}},heatmap:function(e,n){return{u_extrude_scale:new t.Uniform1f(e,n.u_extrude_scale),u_intensity:new t.Uniform1f(e,n.u_intensity),u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}},heatmapTexture:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world),u_image:new t.Uniform1i(e,n.u_image),u_color_ramp:new t.Uniform1i(e,n.u_color_ramp),u_opacity:new t.Uniform1f(e,n.u_opacity)}},hillshade:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_latrange:new t.Uniform2f(e,n.u_latrange),u_light:new t.Uniform2f(e,n.u_light),u_shadow:new t.UniformColor(e,n.u_shadow),u_highlight:new t.UniformColor(e,n.u_highlight),u_accent:new t.UniformColor(e,n.u_accent)}},hillshadePrepare:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_dimension:new t.Uniform2f(e,n.u_dimension),u_zoom:new t.Uniform1f(e,n.u_zoom),u_unpack:new t.Uniform4f(e,n.u_unpack)}},line:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels)}},lineGradient:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels),u_image:new t.Uniform1i(e,n.u_image),u_image_height:new t.Uniform1f(e,n.u_image_height)}},linePattern:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_texsize:new t.Uniform2f(e,n.u_texsize),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_image:new t.Uniform1i(e,n.u_image),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels),u_scale:new t.Uniform3f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}},lineSDF:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_ratio:new t.Uniform1f(e,n.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,n.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,n.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,n.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,n.u_sdfgamma),u_image:new t.Uniform1i(e,n.u_image),u_tex_y_a:new t.Uniform1f(e,n.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,n.u_tex_y_b),u_mix:new t.Uniform1f(e,n.u_mix)}},raster:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_tl_parent:new t.Uniform2f(e,n.u_tl_parent),u_scale_parent:new t.Uniform1f(e,n.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,n.u_buffer_scale),u_fade_t:new t.Uniform1f(e,n.u_fade_t),u_opacity:new t.Uniform1f(e,n.u_opacity),u_image0:new t.Uniform1i(e,n.u_image0),u_image1:new t.Uniform1i(e,n.u_image1),u_brightness_low:new t.Uniform1f(e,n.u_brightness_low),u_brightness_high:new t.Uniform1f(e,n.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,n.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,n.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,n.u_spin_weights)}},symbolIcon:function(e,n){return{u_is_size_zoom_constant:new t.Uniform1i(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,n.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,n.u_size_t),u_size:new t.Uniform1f(e,n.u_size),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,n.u_pitch),u_rotate_symbol:new t.Uniform1i(e,n.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,n.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,n.u_fade_change),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,n.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,n.u_coord_matrix),u_is_text:new t.Uniform1i(e,n.u_is_text),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_texsize:new t.Uniform2f(e,n.u_texsize),u_texture:new t.Uniform1i(e,n.u_texture)}},symbolSDF:function(e,n){return{u_is_size_zoom_constant:new t.Uniform1i(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,n.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,n.u_size_t),u_size:new t.Uniform1f(e,n.u_size),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,n.u_pitch),u_rotate_symbol:new t.Uniform1i(e,n.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,n.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,n.u_fade_change),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,n.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,n.u_coord_matrix),u_is_text:new t.Uniform1i(e,n.u_is_text),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_texsize:new t.Uniform2f(e,n.u_texsize),u_texture:new t.Uniform1i(e,n.u_texture),u_gamma_scale:new t.Uniform1f(e,n.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,n.u_is_halo)}},symbolTextAndIcon:function(e,n){return{u_is_size_zoom_constant:new t.Uniform1i(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,n.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,n.u_size_t),u_size:new t.Uniform1f(e,n.u_size),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,n.u_pitch),u_rotate_symbol:new t.Uniform1i(e,n.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,n.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,n.u_fade_change),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,n.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,n.u_coord_matrix),u_is_text:new t.Uniform1i(e,n.u_is_text),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_texsize:new t.Uniform2f(e,n.u_texsize),u_texsize_icon:new t.Uniform2f(e,n.u_texsize_icon),u_texture:new t.Uniform1i(e,n.u_texture),u_texture_icon:new t.Uniform1i(e,n.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,n.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,n.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,n.u_is_halo)}},background:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_opacity:new t.Uniform1f(e,n.u_opacity),u_color:new t.UniformColor(e,n.u_color)}},backgroundPattern:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_opacity:new t.Uniform1f(e,n.u_opacity),u_image:new t.Uniform1i(e,n.u_image),u_pattern_tl_a:new t.Uniform2f(e,n.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,n.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,n.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,n.u_pattern_br_b),u_texsize:new t.Uniform2f(e,n.u_texsize),u_mix:new t.Uniform1f(e,n.u_mix),u_pattern_size_a:new t.Uniform2f(e,n.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,n.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,n.u_scale_a),u_scale_b:new t.Uniform1f(e,n.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,n.u_tile_units_to_pixels)}}};function Yn(e,n,r,i,o,a,s){for(var l=e.context,c=l.gl,u=e.useProgram("collisionBox"),p=[],h=0,d=0,f=0;f<i.length;f++){var m=i[f],g=n.getTile(m),y=g.getBucket(r);if(y){var v=m.posMatrix;0===o[0]&&0===o[1]||(v=e.translatePosMatrix(m.posMatrix,g,o,a));var _=s?y.textCollisionBox:y.iconCollisionBox,x=y.collisionCircleArray;if(x.length>0){var b=t.create(),w=v;t.mul(b,y.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,y.placementViewportMatrix),p.push({circleArray:x,circleOffset:d,transform:w,invTransform:b}),d=h+=x.length/4}_&&u.draw(l,c.LINES,Tt.disabled,Et.disabled,e.colorModeForRenderPass(),Ct.disabled,In(v,e.transform,g),r.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,null,e.transform.zoom,null,null,_.collisionVertexBuffer)}}if(s&&p.length){var M=e.useProgram("collisionCircle"),S=new t.StructArrayLayout2f1f2i16;S.resize(4*h),S._trim();for(var T=0,E=0,A=p;E<A.length;E+=1)for(var C=A[E],L=0;L<C.circleArray.length/4;L++){var P=4*L,I=C.circleArray[P+0],R=C.circleArray[P+1],k=C.circleArray[P+2],z=C.circleArray[P+3];S.emplace(T++,I,R,k,z,0),S.emplace(T++,I,R,k,z,1),S.emplace(T++,I,R,k,z,2),S.emplace(T++,I,R,k,z,3)}(!Hn||Hn.length<2*h)&&(Hn=function(e){var n=2*e,r=new t.StructArrayLayout3ui6;r.resize(n),r._trim();for(var i=0;i<n;i++){var o=6*i;r.uint16[o+0]=4*i+0,r.uint16[o+1]=4*i+1,r.uint16[o+2]=4*i+2,r.uint16[o+3]=4*i+2,r.uint16[o+4]=4*i+3,r.uint16[o+5]=4*i+0}return r}(h));for(var D=l.createIndexBuffer(Hn,!0),O=l.createVertexBuffer(S,t.collisionCircleLayout.members,!0),F=0,B=p;F<B.length;F+=1){var N=B[F],U=Rn(N.transform,N.invTransform,e.transform);M.draw(l,c.TRIANGLES,Tt.disabled,Et.disabled,e.colorModeForRenderPass(),Ct.disabled,U,r.id,O,D,t.SegmentVector.simpleSegment(0,2*N.circleOffset,N.circleArray.length,N.circleArray.length/2),null,e.transform.zoom,null,null,null)}O.destroy(),D.destroy()}}var Qn=t.identity(new Float32Array(16));function Kn(e,n,r,i,o,a){var s=t.getAnchorAlignment(e),l=-(s.horizontalAlign-.5)*n,c=-(s.verticalAlign-.5)*r,u=t.evaluateVariableOffset(e,i);return new t.Point((l/o+u[0])*a,(c/o+u[1])*a)}function tr(e,n,r,i,o,a,s,l,c,u,p){var h=e.text.placedSymbolArray,d=e.text.dynamicLayoutVertexArray,f=e.icon.dynamicLayoutVertexArray,m={};d.clear();for(var g=0;g<h.length;g++){var y=h.get(g),v=y.hidden||!y.crossTileID||e.allowVerticalPlacement&&!y.placedOrientation?null:i[y.crossTileID];if(v){var _=new t.Point(y.anchorX,y.anchorY),x=Kt(_,r?l:s),b=te(a.cameraToCenterDistance,x.signedDistanceFromCamera),w=o.evaluateSizeForFeature(e.textSizeData,u,y)*b/t.ONE_EM;r&&(w*=e.tilePixelRatio/c);for(var M=Kn(v.anchor,v.width,v.height,v.textOffset,v.textBoxScale,w),S=r?Kt(_.add(M),s).point:x.point.add(n?M.rotate(-a.angle):M),T=e.allowVerticalPlacement&&y.placedOrientation===t.WritingMode.vertical?Math.PI/2:0,E=0;E<y.numGlyphs;E++)t.addDynamicAttributes(d,S,T);p&&y.associatedIconIndex>=0&&(m[y.associatedIconIndex]={shiftedAnchor:S,angle:T})}else ce(y.numGlyphs,d)}if(p){f.clear();for(var A=e.icon.placedSymbolArray,C=0;C<A.length;C++){var L=A.get(C);if(L.hidden)ce(L.numGlyphs,f);else{var P=m[C];if(P)for(var I=0;I<L.numGlyphs;I++)t.addDynamicAttributes(f,P.shiftedAnchor,P.angle);else ce(L.numGlyphs,f)}}e.icon.dynamicLayoutVertexBuffer.updateData(f)}e.text.dynamicLayoutVertexBuffer.updateData(d)}function er(t,e,n){return n.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function nr(e,n,r,i,o,a,s,l,c,u,p,h){for(var d=e.context,f=d.gl,m=e.transform,g="map"===l,y="map"===c,v=g&&"point"!==r.layout.get("symbol-placement"),_=g&&!y&&!v,x=!r.layout.get("symbol-sort-key").isConstant(),b=!1,w=e.depthModeForSublayer(0,Tt.ReadOnly),M=r.layout.get("text-variable-anchor"),S=[],T=0,E=i;T<E.length;T+=1){var A=E[T],C=n.getTile(A),L=C.getBucket(r);if(L){var P=o?L.text:L.icon;if(P&&P.segments.get().length){var I=P.programConfigurations.get(r.id),R=o||L.sdfIcons,k=o?L.textSizeData:L.iconSizeData,z=y||0!==m.pitch,D=e.useProgram(er(R,o,L),I),O=t.evaluateSizeForZoom(k,m.zoom),F=void 0,B=[0,0],N=void 0,U=void 0,j=null,V=void 0;if(o)N=C.glyphAtlasTexture,U=f.LINEAR,F=C.glyphAtlasTexture.size,L.iconsInText&&(B=C.imageAtlasTexture.size,j=C.imageAtlasTexture,V=z||e.options.rotating||e.options.zooming||"composite"===k.kind||"camera"===k.kind?f.LINEAR:f.NEAREST);else{var G=1!==r.layout.get("icon-size").constantOr(0)||L.iconsNeedLinear;N=C.imageAtlasTexture,U=R||e.options.rotating||e.options.zooming||G||z?f.LINEAR:f.NEAREST,F=C.imageAtlasTexture.size}var H=he(C,1,e.transform.zoom),W=Yt(A.posMatrix,y,g,e.transform,H),q=Qt(A.posMatrix,y,g,e.transform,H),Z=M&&L.hasTextData(),X="none"!==r.layout.get("icon-text-fit")&&Z&&L.hasIconData();v&&ne(L,A.posMatrix,e,o,W,q,y,u);var $=e.translatePosMatrix(A.posMatrix,C,a,s),J=v||o&&M||X?Qn:W,Y=e.translatePosMatrix(q,C,a,s,!0),Q=R&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1),K={program:D,buffers:P,uniformValues:R?L.iconsInText?Zn(k.kind,O,_,y,e,$,J,Y,F,B):qn(k.kind,O,_,y,e,$,J,Y,o,F,!0):Wn(k.kind,O,_,y,e,$,J,Y,o,F),atlasTexture:N,atlasTextureIcon:j,atlasInterpolation:U,atlasInterpolationIcon:V,isSDF:R,hasHalo:Q};if(x&&L.canOverlap){b=!0;for(var tt=0,et=P.segments.get();tt<et.length;tt+=1){var nt=et[tt];S.push({segments:new t.SegmentVector([nt]),sortKey:nt.sortKey,state:K})}}else S.push({segments:P.segments,sortKey:0,state:K})}}}b&&S.sort((function(t,e){return t.sortKey-e.sortKey}));for(var rt=0,it=S;rt<it.length;rt+=1){var ot=it[rt],at=ot.state;if(d.activeTexture.set(f.TEXTURE0),at.atlasTexture.bind(at.atlasInterpolation,f.CLAMP_TO_EDGE),at.atlasTextureIcon&&(d.activeTexture.set(f.TEXTURE1),at.atlasTextureIcon&&at.atlasTextureIcon.bind(at.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),at.isSDF){var st=at.uniformValues;at.hasHalo&&(st.u_is_halo=1,rr(at.buffers,ot.segments,r,e,at.program,w,p,h,st)),st.u_is_halo=0}rr(at.buffers,ot.segments,r,e,at.program,w,p,h,at.uniformValues)}}function rr(t,e,n,r,i,o,a,s,l){var c=r.context;i.draw(c,c.gl.TRIANGLES,o,a,s,Ct.disabled,l,n.id,t.layoutVertexBuffer,t.indexBuffer,e,n.paint,r.transform.zoom,t.programConfigurations.get(n.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function ir(t,e,n,r,i,o,a){var s,l,c,u,p,h=t.context.gl,d=n.paint.get("fill-pattern"),f=d&&d.constantOr(1),m=n.getCrossfadeParameters();a?(l=f&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",s=h.LINES):(l=f?"fillPattern":"fill",s=h.TRIANGLES);for(var g=0,y=r;g<y.length;g+=1){var v=y[g],_=e.getTile(v);if(!f||_.patternsLoaded()){var x=_.getBucket(n);if(x){var b=x.programConfigurations.get(n.id),w=t.useProgram(l,b);f&&(t.context.activeTexture.set(h.TEXTURE0),_.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),b.updatePaintBuffers(m));var M=d.constantOr(null);if(M&&_.imageAtlas){var S=_.imageAtlas,T=S.patternPositions[M.to.toString()],E=S.patternPositions[M.from.toString()];T&&E&&b.setConstantPatternPositions(T,E)}var A=t.translatePosMatrix(v.posMatrix,_,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(a){u=x.indexBuffer2,p=x.segments2;var C=[h.drawingBufferWidth,h.drawingBufferHeight];c="fillOutlinePattern"===l&&f?Ln(A,t,m,_,C):Cn(A,C)}else u=x.indexBuffer,p=x.segments,c=f?An(A,t,m,_):En(A);w.draw(t.context,s,i,t.stencilModeForClipping(v),o,Ct.disabled,c,n.id,x.layoutVertexBuffer,u,p,n.paint,t.transform.zoom,b)}}}}function or(t,e,n,r,i,o,a){for(var s=t.context,l=s.gl,c=n.paint.get("fill-extrusion-pattern"),u=c.constantOr(1),p=n.getCrossfadeParameters(),h=n.paint.get("fill-extrusion-opacity"),d=0,f=r;d<f.length;d+=1){var m=f[d],g=e.getTile(m),y=g.getBucket(n);if(y){var v=y.programConfigurations.get(n.id),_=t.useProgram(u?"fillExtrusionPattern":"fillExtrusion",v);u&&(t.context.activeTexture.set(l.TEXTURE0),g.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),v.updatePaintBuffers(p));var x=c.constantOr(null);if(x&&g.imageAtlas){var b=g.imageAtlas,w=b.patternPositions[x.to.toString()],M=b.patternPositions[x.from.toString()];w&&M&&v.setConstantPatternPositions(w,M)}var S=t.translatePosMatrix(m.posMatrix,g,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),T=n.paint.get("fill-extrusion-vertical-gradient"),E=u?Tn(S,t,T,h,m,p,g):Sn(S,t,T,h);_.draw(s,s.gl.TRIANGLES,i,o,a,Ct.backCCW,E,n.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,n.paint,t.transform.zoom,v)}}}function ar(e,n,r,i,o,a){var s=e.context,l=s.gl,c=n.fbo;if(c){var u=e.useProgram("hillshade");s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get());var p=function(e,n,r){var i=r.paint.get("hillshade-shadow-color"),o=r.paint.get("hillshade-highlight-color"),a=r.paint.get("hillshade-accent-color"),s=r.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===r.paint.get("hillshade-illumination-anchor")&&(s-=e.transform.angle);var l,c,u,p=!e.options.moving;return{u_matrix:e.transform.calculatePosMatrix(n.tileID.toUnwrapped(),p),u_image:0,u_latrange:(l=n.tileID,c=Math.pow(2,l.canonical.z),u=l.canonical.y,[new t.MercatorCoordinate(0,u/c).toLngLat().lat,new t.MercatorCoordinate(0,(u+1)/c).toLngLat().lat]),u_light:[r.paint.get("hillshade-exaggeration"),s],u_shadow:i,u_highlight:o,u_accent:a}}(e,n,r);u.draw(s,l.TRIANGLES,i,o,a,Ct.disabled,p,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}}function sr(e,n,r,i,o,a){var s=e.context,l=s.gl,c=n.dem;if(c&&c.data){var u=c.dim,p=c.stride,h=c.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||e.getTileTexture(p),n.demTexture){var d=n.demTexture;d.update(h,{premultiply:!1}),d.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else n.demTexture=new t.Texture(s,h,l.RGBA,{premultiply:!1}),n.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);var f=n.fbo;if(!f){var m=new t.Texture(s,{width:u,height:u,data:null},l.RGBA);m.bind(l.LINEAR,l.CLAMP_TO_EDGE),(f=n.fbo=s.createFramebuffer(u,u,!0)).colorAttachment.set(m.texture)}s.bindFramebuffer.set(f.framebuffer),s.viewport.set([0,0,u,u]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,i,o,a,Ct.disabled,function(e,n){var r=n.stride,i=t.create();return t.ortho(i,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(i,i,[0,-t.EXTENT,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:n.getUnpackVector()}}(n.tileID,c),r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),n.needsHillshadePrepare=!1}}function lr(e,n,r,i,o){var a=i.paint.get("raster-fade-duration");if(a>0){var s=t.browser.now(),l=(s-e.timeAdded)/a,c=n?(s-n.timeAdded)/a:-1,u=r.getSource(),p=o.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),h=!n||Math.abs(n.tileID.overscaledZ-p)>Math.abs(e.tileID.overscaledZ-p),d=h&&e.refreshedUponExpiration?1:t.clamp(h?l:1-c,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),n?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}var cr=new t.Color(1,0,0,1),ur=new t.Color(0,1,0,1),pr=new t.Color(0,0,1,1),hr=new t.Color(1,0,1,1),dr=new t.Color(0,1,1,1);function fr(t,e,n,r){gr(t,0,e+n/2,t.transform.width,n,r)}function mr(t,e,n,r){gr(t,e-n/2,0,n,t.transform.height,r)}function gr(e,n,r,i,o,a){var s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(n*t.browser.devicePixelRatio,r*t.browser.devicePixelRatio,i*t.browser.devicePixelRatio,o*t.browser.devicePixelRatio),s.clear({color:a}),l.disable(l.SCISSOR_TEST)}function yr(e,n,r){var i=e.context,o=i.gl,a=r.posMatrix,s=e.useProgram("debug"),l=Tt.disabled,c=Et.disabled,u=e.colorModeForRenderPass();i.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s.draw(i,o.LINE_STRIP,l,c,u,Ct.disabled,kn(a,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var p=n.getTileByID(r.key).latestRawTileData,h=Math.floor((p&&p.byteLength||0)/1024),d=n.getTile(r).tileSize,f=512/Math.min(d,512)*(r.overscaledZ/e.transform.zoom)*.5,m=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(m+=" => "+r.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var n=t.debugOverlayCanvas,r=t.context.gl,i=t.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,n.width,n.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(e,5,5),i.strokeText(e,5,5),t.debugOverlayTexture.update(n),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,m+" "+h+"kb"),s.draw(i,o.TRIANGLES,l,c,At.alphaBlended,Ct.disabled,kn(a,t.Color.transparent,f),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var vr={symbol:function(e,n,r,i,o){if("translucent"===e.renderPass){var a=Et.disabled,s=e.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(e,n,r,i,o,a,s){for(var l=n.transform,c="map"===o,u="map"===a,p=0,h=e;p<h.length;p+=1){var d=h[p],f=i.getTile(d),m=f.getBucket(r);if(m&&m.text&&m.text.segments.get().length){var g=t.evaluateSizeForZoom(m.textSizeData,l.zoom),y=he(f,1,n.transform.zoom),v=Yt(d.posMatrix,u,c,n.transform,y),_="none"!==r.layout.get("icon-text-fit")&&m.hasIconData();if(g){var x=Math.pow(2,l.zoom-f.tileID.overscaledZ);tr(m,c,u,s,t.symbolSize,l,v,d.posMatrix,x,g,_)}}}}(i,e,r,n,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&nr(e,n,r,i,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),a,s),0!==r.paint.get("text-opacity").constantOr(1)&&nr(e,n,r,i,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),a,s),n.map.showCollisionBoxes&&(Yn(e,n,r,i,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),Yn(e,n,r,i,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))}},circle:function(e,n,r,i){if("translucent"===e.renderPass){var o=r.paint.get("circle-opacity"),a=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),l=!r.layout.get("circle-sort-key").isConstant();if(0!==o.constantOr(1)||0!==a.constantOr(1)&&0!==s.constantOr(1)){for(var c=e.context,u=c.gl,p=e.depthModeForSublayer(0,Tt.ReadOnly),h=Et.disabled,d=e.colorModeForRenderPass(),f=[],m=0;m<i.length;m++){var g=i[m],y=n.getTile(g),v=y.getBucket(r);if(v){var _=v.programConfigurations.get(r.id),x={programConfiguration:_,program:e.useProgram("circle",_),layoutVertexBuffer:v.layoutVertexBuffer,indexBuffer:v.indexBuffer,uniformValues:Pn(e,g,y,r)};if(l)for(var b=0,w=v.segments.get();b<w.length;b+=1){var M=w[b];f.push({segments:new t.SegmentVector([M]),sortKey:M.sortKey,state:x})}else f.push({segments:v.segments,sortKey:0,state:x})}}l&&f.sort((function(t,e){return t.sortKey-e.sortKey}));for(var S=0,T=f;S<T.length;S+=1){var E=T[S],A=E.state;A.program.draw(c,u.TRIANGLES,p,h,d,Ct.disabled,A.uniformValues,r.id,A.layoutVertexBuffer,A.indexBuffer,E.segments,r.paint,e.transform.zoom,A.programConfiguration)}}}},heatmap:function(e,n,r,i){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){var o=e.context,a=o.gl,s=Et.disabled,l=new At([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,n){var r=t.gl;t.activeTexture.set(r.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);var i=n.heatmapFbo;if(i)r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),t.bindFramebuffer.set(i.framebuffer);else{var o=r.createTexture();r.bindTexture(r.TEXTURE_2D,o),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),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),i=n.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,n,r){var i=t.gl;i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e.width/4,e.height/4,0,i.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:i.UNSIGNED_BYTE,null),r.colorAttachment.set(n)}(t,e,o,i)}}(o,e,r),o.clear({color:t.Color.transparent});for(var c=0;c<i.length;c++){var u=i[c];if(!n.hasRenderableParent(u)){var p=n.getTile(u),h=p.getBucket(r);if(h){var d=h.programConfigurations.get(r.id);e.useProgram("heatmap",d).draw(o,a.TRIANGLES,Tt.disabled,s,l,Ct.disabled,Dn(u.posMatrix,p,e.transform.zoom,r.paint.get("heatmap-intensity")),r.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,r.paint,e.transform.zoom,d)}}}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,n){var r=e.context,i=r.gl,o=n.heatmapFbo;if(o){r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,o.colorAttachment.get()),r.activeTexture.set(i.TEXTURE1);var a=n.colorRampTexture;a||(a=n.colorRampTexture=new t.Texture(r,n.colorRamp,i.RGBA)),a.bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,i.TRIANGLES,Tt.disabled,Et.disabled,e.colorModeForRenderPass(),Ct.disabled,function(e,n,r,i){var o=t.create();t.ortho(o,0,e.width,e.height,0,0,1);var a=e.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:n.paint.get("heatmap-opacity")}}(e,n),n.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,n.paint,e.transform.zoom)}}(e,r))},line:function(e,n,r,i){if("translucent"===e.renderPass){var o=r.paint.get("line-opacity"),a=r.paint.get("line-width");if(0!==o.constantOr(1)&&0!==a.constantOr(1))for(var s=e.depthModeForSublayer(0,Tt.ReadOnly),l=e.colorModeForRenderPass(),c=r.paint.get("line-dasharray"),u=r.paint.get("line-pattern"),p=u.constantOr(1),h=r.paint.get("line-gradient"),d=r.getCrossfadeParameters(),f=p?"linePattern":c?"lineSDF":h?"lineGradient":"line",m=e.context,g=m.gl,y=!0,v=0,_=i;v<_.length;v+=1){var x=_[v],b=n.getTile(x);if(!p||b.patternsLoaded()){var w=b.getBucket(r);if(w){var M=w.programConfigurations.get(r.id),S=e.context.program.get(),T=e.useProgram(f,M),E=y||T.program!==S,A=u.constantOr(null);if(A&&b.imageAtlas){var C=b.imageAtlas,L=C.patternPositions[A.to.toString()],P=C.patternPositions[A.from.toString()];L&&P&&M.setConstantPatternPositions(L,P)}var I=p?Bn(e,b,r,d):c?Nn(e,b,r,c,d):h?Fn(e,b,r,w.lineClipsArray.length):On(e,b,r);if(p)m.activeTexture.set(g.TEXTURE0),b.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),M.updatePaintBuffers(d);else if(c&&(E||e.lineAtlas.dirty))m.activeTexture.set(g.TEXTURE0),e.lineAtlas.bind(m);else if(h){var R=w.gradients[r.id],k=R.texture;if(r.gradientVersion!==R.version){var z=256;if(r.stepInterpolant){var D=n.getSource().maxzoom,O=x.canonical.z===D?Math.ceil(1<<e.transform.maxZoom-x.canonical.z):1;z=t.clamp(t.nextPowerOfTwo(w.maxLineLength/t.EXTENT*1024*O),256,m.maxTextureSize)}R.gradient=t.renderColorRamp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:z,image:R.gradient||void 0,clips:w.lineClipsArray}),R.texture?R.texture.update(R.gradient):R.texture=new t.Texture(m,R.gradient,g.RGBA),R.version=r.gradientVersion,k=R.texture}m.activeTexture.set(g.TEXTURE0),k.bind(r.stepInterpolant?g.NEAREST:g.LINEAR,g.CLAMP_TO_EDGE)}T.draw(m,g.TRIANGLES,s,e.stencilModeForClipping(x),l,Ct.disabled,I,r.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,r.paint,e.transform.zoom,M,w.layoutVertexBuffer2),y=!1}}}}},fill:function(e,n,r,i){var o=r.paint.get("fill-color"),a=r.paint.get("fill-opacity");if(0!==a.constantOr(1)){var s=e.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(e.renderPass===c){var u=e.depthModeForSublayer(1,"opaque"===e.renderPass?Tt.ReadWrite:Tt.ReadOnly);ir(e,n,r,i,u,s,!1)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){var p=e.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,Tt.ReadOnly);ir(e,n,r,i,p,s,!0)}}},"fill-extrusion":function(t,e,n,r){var i=n.paint.get("fill-extrusion-opacity");if(0!==i&&"translucent"===t.renderPass){var o=new Tt(t.context.gl.LEQUAL,Tt.ReadWrite,t.depthRangeFor3D);if(1!==i||n.paint.get("fill-extrusion-pattern").constantOr(1))or(t,e,n,r,o,Et.disabled,At.disabled),or(t,e,n,r,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{var a=t.colorModeForRenderPass();or(t,e,n,r,o,Et.disabled,a)}}},hillshade:function(t,e,n,r){if("offscreen"===t.renderPass||"translucent"===t.renderPass){for(var i=t.context,o=t.depthModeForSublayer(0,Tt.ReadOnly),a=t.colorModeForRenderPass(),s="translucent"===t.renderPass?t.stencilConfigForOverlap(r):[{},r],l=s[0],c=0,u=s[1];c<u.length;c+=1){var p=u[c],h=e.getTile(p);h.needsHillshadePrepare&&"offscreen"===t.renderPass?sr(t,h,n,o,Et.disabled,a):"translucent"===t.renderPass&&ar(t,h,n,o,l[p.overscaledZ],a)}i.viewport.set([0,0,t.width,t.height])}},raster:function(t,e,n,r){if("translucent"===t.renderPass&&0!==n.paint.get("raster-opacity")&&r.length)for(var i=t.context,o=i.gl,a=e.getSource(),s=t.useProgram("raster"),l=t.colorModeForRenderPass(),c=a instanceof R?[{},r]:t.stencilConfigForOverlap(r),u=c[0],p=c[1],h=p[p.length-1].overscaledZ,d=!t.options.moving,f=0,m=p;f<m.length;f+=1){var g=m[f],y=t.depthModeForSublayer(g.overscaledZ-h,1===n.paint.get("raster-opacity")?Tt.ReadWrite:Tt.ReadOnly,o.LESS),v=e.getTile(g),_=t.transform.calculatePosMatrix(g.toUnwrapped(),d);v.registerFadeDuration(n.paint.get("raster-fade-duration"));var x=e.findLoadedParent(g,0),b=lr(v,x,e,n,t.transform),w=void 0,M=void 0,S="nearest"===n.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;i.activeTexture.set(o.TEXTURE0),v.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.activeTexture.set(o.TEXTURE1),x?(x.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),w=Math.pow(2,x.tileID.overscaledZ-v.tileID.overscaledZ),M=[v.tileID.canonical.x*w%1,v.tileID.canonical.y*w%1]):v.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);var T=Vn(_,M||[0,0],w||1,b,n);a instanceof R?s.draw(i,o.TRIANGLES,y,Et.disabled,l,Ct.disabled,T,n.id,a.boundsBuffer,t.quadTriangleIndexBuffer,a.boundsSegments):s.draw(i,o.TRIANGLES,y,u[g.overscaledZ],l,Ct.disabled,T,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}},background:function(t,e,n){var r=n.paint.get("background-color"),i=n.paint.get("background-opacity");if(0!==i){var o=t.context,a=o.gl,s=t.transform,l=s.tileSize,c=n.paint.get("background-pattern");if(!t.isPatternMissing(c)){var u=!c&&1===r.a&&1===i&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass===u){var p=Et.disabled,h=t.depthModeForSublayer(0,"opaque"===u?Tt.ReadWrite:Tt.ReadOnly),d=t.colorModeForRenderPass(),f=t.useProgram(c?"backgroundPattern":"background"),m=s.coveringTiles({tileSize:l});c&&(o.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));for(var g=n.getCrossfadeParameters(),y=0,v=m;y<v.length;y+=1){var _=v[y],x=t.transform.calculatePosMatrix(_.toUnwrapped()),b=c?$n(x,i,t,c,{tileID:_,tileSize:l},g):Xn(x,i,r);f.draw(o,a.TRIANGLES,h,p,d,Ct.disabled,b,n.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}}}},debug:function(t,e,n){for(var r=0;r<n.length;r++)yr(t,e,n[r])},custom:function(t,e,n){var r=t.context,i=n.implementation;if("offscreen"===t.renderPass){var o=i.prerender;o&&(t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),o.call(i,r.gl,t.transform.customLayerMatrix()),r.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),r.setStencilMode(Et.disabled);var a="3d"===i.renderingMode?new Tt(t.context.gl.LEQUAL,Tt.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Tt.ReadOnly);r.setDepthMode(a),i.render(r.gl,t.transform.customLayerMatrix()),r.setDirty(),t.setBaseState(),r.bindFramebuffer.set(null)}}},_r=function(t,e){this.context=new Lt(t),this.transform=e,this._tileTextures={},this.setup(),this.numSublayers=Pt.maxUnderzooming+Pt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Be,this.gpuTimers={}};_r.prototype.resize=function(e,n){if(this.width=e*t.browser.devicePixelRatio,this.height=n*t.browser.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var r=0,i=this.style._order;r<i.length;r+=1)this.style._layers[i[r]].resize()},_r.prototype.setup=function(){var e=this.context,n=new t.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(t.EXTENT,0),n.emplaceBack(0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(n,He.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);var r=new t.StructArrayLayout2i4;r.emplaceBack(0,0),r.emplaceBack(t.EXTENT,0),r.emplaceBack(0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(r,He.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);var i=new t.StructArrayLayout4i8;i.emplaceBack(0,0,0,0),i.emplaceBack(t.EXTENT,0,t.EXTENT,0),i.emplaceBack(0,t.EXTENT,0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(i,I.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);var o=new t.StructArrayLayout2i4;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,He.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);var a=new t.StructArrayLayout1ui2;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);var s=new t.StructArrayLayout3ui6;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s),this.emptyTexture=new t.Texture(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA);var l=this.context.gl;this.stencilClearMode=new Et({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)},_r.prototype.clearStencil=function(){var e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;var r=t.create();t.ortho(r,0,this.width,this.height,0,0,1),t.scale(r,r,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,n.TRIANGLES,Tt.disabled,this.stencilClearMode,At.disabled,Ct.disabled,zn(r),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},_r.prototype._renderTileClippingMasks=function(t,e){if(this.currentStencilSource!==t.source&&t.isTileClipped()&&e&&e.length){this.currentStencilSource=t.source;var n=this.context,r=n.gl;this.nextStencilID+e.length>256&&this.clearStencil(),n.setColorMode(At.disabled),n.setDepthMode(Tt.disabled);var i=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var o=0,a=e;o<a.length;o+=1){var s=a[o],l=this._tileClippingMaskIDs[s.key]=this.nextStencilID++;i.draw(n,r.TRIANGLES,Tt.disabled,new Et({func:r.ALWAYS,mask:0},l,255,r.KEEP,r.KEEP,r.REPLACE),At.disabled,Ct.disabled,zn(s.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}},_r.prototype.stencilModeFor3D=function(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();var t=this.nextStencilID++,e=this.context.gl;return new Et({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)},_r.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new Et({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},_r.prototype.stencilConfigForOverlap=function(t){var e,n=this.context.gl,r=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),i=r[r.length-1].overscaledZ,o=r[0].overscaledZ-i+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();for(var a={},s=0;s<o;s++)a[s+i]=new Et({func:n.GEQUAL,mask:255},s+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=o,[a,r]}return[(e={},e[i]=Et.disabled,e),r]},_r.prototype.colorModeForRenderPass=function(){var e=this.context.gl;return this._showOverdrawInspector?new At([e.CONSTANT_COLOR,e.ONE],new t.Color(1/8,1/8,1/8,0),[!0,!0,!0,!0]):"opaque"===this.renderPass?At.unblended:At.alphaBlended},_r.prototype.depthModeForSublayer=function(t,e,n){if(!this.opaquePassEnabledForLayer())return Tt.disabled;var r=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Tt(n||this.context.gl.LEQUAL,e,[r,r])},_r.prototype.opaquePassEnabledForLayer=function(){return this.currentLayer<this.opaquePassCutoff},_r.prototype.render=function(e,n){var r=this;this.style=e,this.options=n,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.browser.now()),this.imageManager.beginFrame();var i=this.style._order,o=this.style.sourceCaches;for(var a in o){var s=o[a];s.used&&s.prepare(this.context)}var l,c,u={},p={},h={};for(var d in o){var f=o[d];u[d]=f.getVisibleCoordinates(),p[d]=u[d].slice().reverse(),h[d]=f.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(var m=0;m<i.length;m++)if(this.style._layers[i[m]].is3D()){this.opaquePassCutoff=m;break}this.renderPass="offscreen";for(var g=0,y=i;g<y.length;g+=1){var v=this.style._layers[y[g]];if(v.hasOffscreenPass()&&!v.isHidden(this.transform.zoom)){var _=p[v.source];("custom"===v.type||_.length)&&this.renderLayer(this,o[v.source],v,_)}}for(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){var x=this.style._layers[i[this.currentLayer]],b=o[x.source],w=u[x.source];this._renderTileClippingMasks(x,w),this.renderLayer(this,b,x,w)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){var M=this.style._layers[i[this.currentLayer]],S=o[M.source],T=("symbol"===M.type?h:p)[M.source];this._renderTileClippingMasks(M,u[M.source]),this.renderLayer(this,S,M,T)}this.options.showTileBoundaries&&(t.values(this.style._layers).forEach((function(t){t.source&&!t.isHidden(r.transform.zoom)&&(t.source!==(c&&c.id)&&(c=r.style.sourceCaches[t.source]),(!l||l.getSource().maxzoom<c.getSource().maxzoom)&&(l=c))})),l&&vr.debug(this,l,l.getVisibleCoordinates())),this.options.showPadding&&function(t){var e=t.transform.padding;fr(t,t.transform.height-(e.top||0),3,cr),fr(t,e.bottom||0,3,ur),mr(t,e.left||0,3,pr),mr(t,t.transform.width-(e.right||0),3,hr);var n=t.transform.centerPoint;!function(t,e,n,r){gr(t,e-1,n-10,2,20,r),gr(t,e-10,n-1,20,2,r)}(t,n.x,t.transform.height-n.y,dr)}(this),this.context.setDefault()},_r.prototype.renderLayer=function(t,e,n,r){n.isHidden(this.transform.zoom)||("background"===n.type||"custom"===n.type||r.length)&&(this.id=n.id,this.gpuTimingStart(n),vr[n.type](t,e,n,r,this.style.placement.variableOffsets),this.gpuTimingEnd())},_r.prototype.gpuTimingStart=function(t){if(this.options.gpuTiming){var e=this.context.extTimerQuery,n=this.gpuTimers[t.id];n||(n=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:e.createQueryEXT()}),n.calls++,e.beginQueryEXT(e.TIME_ELAPSED_EXT,n.query)}},_r.prototype.gpuTimingEnd=function(){if(this.options.gpuTiming){var t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}},_r.prototype.collectGpuTimers=function(){var t=this.gpuTimers;return this.gpuTimers={},t},_r.prototype.queryGpuTimers=function(t){var e={};for(var n in t){var r=t[n],i=this.context.extTimerQuery,o=i.getQueryObjectEXT(r.query,i.QUERY_RESULT_EXT)/1e6;i.deleteQueryEXT(r.query),e[n]=o}return e},_r.prototype.translatePosMatrix=function(e,n,r,i,o){if(!r[0]&&!r[1])return e;var a=o?"map"===i?this.transform.angle:0:"viewport"===i?-this.transform.angle:0;if(a){var s=Math.sin(a),l=Math.cos(a);r=[r[0]*l-r[1]*s,r[0]*s+r[1]*l]}var c=[o?r[0]:he(n,r[0],this.transform.zoom),o?r[1]:he(n,r[1],this.transform.zoom),0],u=new Float32Array(16);return t.translate(u,e,c),u},_r.prototype.saveTileTexture=function(t){var e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]},_r.prototype.getTileTexture=function(t){var e=this._tileTextures[t];return e&&e.length>0?e.pop():null},_r.prototype.isPatternMissing=function(t){if(!t)return!1;if(!t.from||!t.to)return!0;var e=this.imageManager.getPattern(t.from.toString()),n=this.imageManager.getPattern(t.to.toString());return!e||!n},_r.prototype.useProgram=function(t,e){this.cache=this.cache||{};var n=""+t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[n]||(this.cache[n]=new wn(this.context,t,_n[t],e,Jn[t],this._showOverdrawInspector)),this.cache[n]},_r.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},_r.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)},_r.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},_r.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var xr=function(t,e){this.points=t,this.planes=e};xr.fromInvProjectionMatrix=function(e,n,r){var i=Math.pow(2,r),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(n){return t.transformMat4([],n,e)})).map((function(e){return t.scale$1([],e,1/e[3]/n*i)})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var n=t.sub([],o[e[0]],o[e[1]]),r=t.sub([],o[e[2]],o[e[1]]),i=t.normalize([],t.cross([],n,r)),a=-t.dot(i,o[e[1]]);return i.concat(a)}));return new xr(o,a)};var br=function(e,n){this.min=e,this.max=n,this.center=t.scale$2([],t.add([],this.min,this.max),.5)};br.prototype.quadrant=function(e){for(var n=[e%2==0,e<2],r=t.clone$2(this.min),i=t.clone$2(this.max),o=0;o<n.length;o++)r[o]=n[o]?this.min[o]:this.center[o],i[o]=n[o]?this.center[o]:this.max[o];return i[2]=this.max[2],new br(r,i)},br.prototype.distanceX=function(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]},br.prototype.distanceY=function(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]},br.prototype.intersects=function(e){for(var n=[[this.min[0],this.min[1],0,1],[this.max[0],this.min[1],0,1],[this.max[0],this.max[1],0,1],[this.min[0],this.max[1],0,1]],r=!0,i=0;i<e.planes.length;i++){for(var o=e.planes[i],a=0,s=0;s<n.length;s++)a+=t.dot$1(o,n[s])>=0;if(0===a)return 0;a!==n.length&&(r=!1)}if(r)return 2;for(var l=0;l<3;l++){for(var c=Number.MAX_VALUE,u=-Number.MAX_VALUE,p=0;p<e.points.length;p++){var h=e.points[p][l]-this.min[l];c=Math.min(c,h),u=Math.max(u,h)}if(u<0||c>this.max[l]-this.min[l])return 0}return 1};var wr=function(t,e,n,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(n)||n<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=n,this.right=r};wr.prototype.interpolate=function(e,n,r){return null!=n.top&&null!=e.top&&(this.top=t.number(e.top,n.top,r)),null!=n.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,n.bottom,r)),null!=n.left&&null!=e.left&&(this.left=t.number(e.left,n.left,r)),null!=n.right&&null!=e.right&&(this.right=t.number(e.right,n.right,r)),this},wr.prototype.getCenter=function(e,n){var r=t.clamp((this.left+e-this.right)/2,0,e),i=t.clamp((this.top+n-this.bottom)/2,0,n);return new t.Point(r,i)},wr.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},wr.prototype.clone=function(){return new wr(this.top,this.bottom,this.left,this.right)},wr.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var Mr=function(e,n,r,i,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||o,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=null==r?0:r,this._maxPitch=null==i?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new wr,this._posMatrixCache={},this._alignedPosMatrixCache={}},Sr={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};Mr.prototype.clone=function(){var t=new Mr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t},Sr.minZoom.get=function(){return this._minZoom},Sr.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},Sr.maxZoom.get=function(){return this._maxZoom},Sr.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},Sr.minPitch.get=function(){return this._minPitch},Sr.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},Sr.maxPitch.get=function(){return this._maxPitch},Sr.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},Sr.renderWorldCopies.get=function(){return this._renderWorldCopies},Sr.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},Sr.worldSize.get=function(){return this.tileSize*this.scale},Sr.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},Sr.size.get=function(){return new t.Point(this.width,this.height)},Sr.bearing.get=function(){return-this.angle/Math.PI*180},Sr.bearing.set=function(e){var n=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},Sr.pitch.get=function(){return this._pitch/Math.PI*180},Sr.pitch.set=function(e){var n=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())},Sr.fov.get=function(){return this._fov/Math.PI*180},Sr.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},Sr.zoom.get=function(){return this._zoom},Sr.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},Sr.center.get=function(){return this._center},Sr.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},Sr.padding.get=function(){return this._edgeInsets.toJSON()},Sr.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())},Sr.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},Mr.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},Mr.prototype.interpolatePadding=function(t,e,n){this._unmodified=!1,this._edgeInsets.interpolate(t,e,n),this._constrain(),this._calcMatrices()},Mr.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},Mr.prototype.getVisibleUnwrappedCoordinates=function(e){var n=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var r=this.pointCoordinate(new t.Point(0,0)),i=this.pointCoordinate(new t.Point(this.width,0)),o=this.pointCoordinate(new t.Point(this.width,this.height)),a=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(r.x,i.x,o.x,a.x)),l=Math.floor(Math.max(r.x,i.x,o.x,a.x)),c=s-1;c<=l+1;c++)0!==c&&n.push(new t.UnwrappedTileID(c,e));return n},Mr.prototype.coveringTiles=function(e){var n=this.coveringZoomLevel(e),r=n;if(void 0!==e.minzoom&&n<e.minzoom)return[];void 0!==e.maxzoom&&n>e.maxzoom&&(n=e.maxzoom);var i=t.MercatorCoordinate.fromLngLat(this.center),o=Math.pow(2,n),a=[o*i.x,o*i.y,0],s=xr.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n),l=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(l=n);var c=function(t){return{aabb:new br([t*o,0,0],[(t+1)*o,o,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},u=[],p=[],h=n,d=e.reparseOverscaled?r:n;if(this._renderWorldCopies)for(var f=1;f<=3;f++)u.push(c(-f)),u.push(c(f));for(u.push(c(0));u.length>0;){var m=u.pop(),g=m.x,y=m.y,v=m.fullyVisible;if(!v){var _=m.aabb.intersects(s);if(0===_)continue;v=2===_}var x=m.aabb.distanceX(a),b=m.aabb.distanceY(a),w=Math.max(Math.abs(x),Math.abs(b));if(m.zoom===h||w>3+(1<<h-m.zoom)-2&&m.zoom>=l)p.push({tileID:new t.OverscaledTileID(m.zoom===h?d:m.zoom,m.wrap,m.zoom,g,y),distanceSq:t.sqrLen([a[0]-.5-g,a[1]-.5-y])});else for(var M=0;M<4;M++){var S=(g<<1)+M%2,T=(y<<1)+(M>>1);u.push({aabb:m.aabb.quadrant(M),zoom:m.zoom+1,x:S,y:T,wrap:m.wrap,fullyVisible:v})}}return p.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},Mr.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},Sr.unmodified.get=function(){return this._unmodified},Mr.prototype.zoomScale=function(t){return Math.pow(2,t)},Mr.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},Mr.prototype.project=function(e){var n=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(n)*this.worldSize)},Mr.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},Sr.point.get=function(){return this.project(this.center)},Mr.prototype.setLocationAtPoint=function(e,n){var r=this.pointCoordinate(n),i=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(r.x-i.x),o.y-(r.y-i.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())},Mr.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},Mr.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},Mr.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},Mr.prototype.coordinateLocation=function(t){return t.toLngLat()},Mr.prototype.pointCoordinate=function(e){var n=[e.x,e.y,0,1],r=[e.x,e.y,1,1];t.transformMat4(n,n,this.pixelMatrixInverse),t.transformMat4(r,r,this.pixelMatrixInverse);var i=n[3],o=r[3],a=n[1]/i,s=r[1]/o,l=n[2]/i,c=r[2]/o,u=l===c?0:(0-l)/(c-l);return new t.MercatorCoordinate(t.number(n[0]/i,r[0]/o,u)/this.worldSize,t.number(a,s,u)/this.worldSize)},Mr.prototype.coordinatePoint=function(e){var n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(n,n,this.pixelMatrix),new t.Point(n[0]/n[3],n[1]/n[3])},Mr.prototype.getBounds=function(){return(new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},Mr.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},Mr.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},Mr.prototype.calculatePosMatrix=function(e,n){void 0===n&&(n=!1);var r=e.key,i=n?this._alignedPosMatrixCache:this._posMatrixCache;if(i[r])return i[r];var o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*a,o.y*a,0]),t.scale(l,l,[a/t.EXTENT,a/t.EXTENT,1]),t.multiply(l,n?this.alignedProjMatrix:this.projMatrix,l),i[r]=new Float32Array(l),i[r]},Mr.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},Mr.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,n,r,i,o=-90,a=90,s=-180,l=180,c=this.size,u=this._unmodified;if(this.latRange){var p=this.latRange;o=t.mercatorYfromLat(p[1])*this.worldSize,e=(a=t.mercatorYfromLat(p[0])*this.worldSize)-o<c.y?c.y/(a-o):0}if(this.lngRange){var h=this.lngRange;s=t.mercatorXfromLng(h[0])*this.worldSize,n=(l=t.mercatorXfromLng(h[1])*this.worldSize)-s<c.x?c.x/(l-s):0}var d=this.point,f=Math.max(n||0,e||0);if(f)return this.center=this.unproject(new t.Point(n?(l+s)/2:d.x,e?(a+o)/2:d.y)),this.zoom+=this.scaleZoom(f),this._unmodified=u,void(this._constraining=!1);if(this.latRange){var m=d.y,g=c.y/2;m-g<o&&(i=o+g),m+g>a&&(i=a-g)}if(this.lngRange){var y=d.x,v=c.x/2;y-v<s&&(r=s+v),y+v>l&&(r=l-v)}void 0===r&&void 0===i||(this.center=this.unproject(new t.Point(void 0!==r?r:d.x,void 0!==i?i:d.y))),this._unmodified=u,this._constraining=!1}},Mr.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var n=Math.PI/2+this._pitch,r=this._fov*(.5+e.y/this.height),i=Math.sin(r)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-n-r,.01,Math.PI-.01)),o=this.point,a=o.x,s=o.y,l=1.01*(Math.cos(Math.PI/2-this._pitch)*i+this.cameraToCenterDistance),c=this.height/50,u=new Float64Array(16);t.perspective(u,this._fov,this.width/this.height,c,l),u[8]=2*-e.x/this.width,u[9]=2*e.y/this.height,t.scale(u,u,[1,-1,1]),t.translate(u,u,[0,0,-this.cameraToCenterDistance]),t.rotateX(u,u,this._pitch),t.rotateZ(u,u,this.angle),t.translate(u,u,[-a,-s,0]),this.mercatorMatrix=t.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),t.scale(u,u,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=u,this.invProjMatrix=t.invert([],this.projMatrix);var p=this.width%2/2,h=this.height%2/2,d=Math.cos(this.angle),f=Math.sin(this.angle),m=a-Math.round(a)+d*p+f*h,g=s-Math.round(s)+d*h+f*p,y=new Float64Array(u);if(t.translate(y,y,[m>.5?m-1:m,g>.5?g-1:g,0]),this.alignedProjMatrix=y,u=t.create(),t.scale(u,u,[this.width/2,-this.height/2,1]),t.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=t.create(),t.scale(u,u,[1,-1,1]),t.translate(u,u,[-1,-1,0]),t.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(u=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={}}},Mr.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance},Mr.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))},Mr.prototype.getCameraQueryGeometry=function(e){var n=this.getCameraPoint();if(1===e.length)return[e[0],n];for(var r=n.x,i=n.y,o=n.x,a=n.y,s=0,l=e;s<l.length;s+=1){var c=l[s];r=Math.min(r,c.x),i=Math.min(i,c.y),o=Math.max(o,c.x),a=Math.max(a,c.y)}return[new t.Point(r,i),new t.Point(o,i),new t.Point(o,a),new t.Point(r,a),new t.Point(r,i)]},Object.defineProperties(Mr.prototype,Sr);var Tr=function(e){var n,r,i,o;this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=(n=this._updateHashUnthrottled.bind(this),r=!1,i=null,o=function(){i=null,r&&(n(),i=setTimeout(o,300),r=!1)},function(){return r=!0,i||o(),i})};Tr.prototype.addTo=function(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Tr.prototype.remove=function(){return t.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Tr.prototype.getHashString=function(e){var n=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,i),a=Math.round(n.lng*o)/o,s=Math.round(n.lat*o)/o,l=this._map.getBearing(),c=this._map.getPitch(),u="";if(u+=e?"/"+a+"/"+s+"/"+r:r+"/"+s+"/"+a,(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+="/"+Math.round(c)),this._hashName){var p=this._hashName,h=!1,d=t.window.location.hash.slice(1).split("&").map((function(t){var e=t.split("=")[0];return e===p?(h=!0,e+"="+u):t})).filter((function(t){return t}));return h||d.push(p+"="+u),"#"+d.join("&")}return"#"+u},Tr.prototype._getCurrentHash=function(){var e,n=this,r=t.window.location.hash.replace("#","");return this._hashName?(r.split("&").map((function(t){return t.split("=")})).forEach((function(t){t[0]===n._hashName&&(e=t)})),(e&&e[1]||"").split("/")):r.split("/")},Tr.prototype._onHashChange=function(){var t=this._getCurrentHash();if(t.length>=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},Tr.prototype._updateHashUnthrottled=function(){var e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());try{t.window.history.replaceState(t.window.history.state,null,e)}catch(t){}};var Er={linearity:.3,easing:t.bezier(0,0,.3,1)},Ar=t.extend({deceleration:2500,maxSpeed:1400},Er),Cr=t.extend({deceleration:20,maxSpeed:1400},Er),Lr=t.extend({deceleration:1e3,maxSpeed:360},Er),Pr=t.extend({deceleration:1e3,maxSpeed:90},Er),Ir=function(t){this._map=t,this.clear()};function Rr(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function kr(e,n,r){var i=r.maxSpeed,o=r.linearity,a=r.deceleration,s=t.clamp(e*o/(n/1e3),-i,i),l=Math.abs(s)/(a*o);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}Ir.prototype.clear=function(){this._inertiaBuffer=[]},Ir.prototype.record=function(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.browser.now(),settings:e})},Ir.prototype._drainInertiaBuffer=function(){for(var e=this._inertiaBuffer,n=t.browser.now();e.length>0&&n-e[0].time>160;)e.shift()},Ir.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var n={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},r=0,i=this._inertiaBuffer;r<i.length;r+=1){var o=i[r].settings;n.zoom+=o.zoomDelta||0,n.bearing+=o.bearingDelta||0,n.pitch+=o.pitchDelta||0,o.panDelta&&n.pan._add(o.panDelta),o.around&&(n.around=o.around),o.pinchAround&&(n.pinchAround=o.pinchAround)}var a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(n.pan.mag()){var l=kr(n.pan.mag(),a,t.extend({},Ar,e||{}));s.offset=n.pan.mult(l.amount/n.pan.mag()),s.center=this._map.transform.center,Rr(s,l)}if(n.zoom){var c=kr(n.zoom,a,Cr);s.zoom=this._map.transform.zoom+c.amount,Rr(s,c)}if(n.bearing){var u=kr(n.bearing,a,Lr);s.bearing=this._map.transform.bearing+t.clamp(u.amount,-179,179),Rr(s,u)}if(n.pitch){var p=kr(n.pitch,a,Pr);s.pitch=this._map.transform.pitch+p.amount,Rr(s,p)}if(s.zoom||s.bearing){var h=void 0===n.pinchAround?n.around:n.pinchAround;s.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),t.extend(s,{noMoveStart:!0})}};var zr=function(e){function r(r,i,o,a){void 0===a&&(a={});var s=n.mousePos(i.getCanvasContainer(),o),l=i.unproject(s);e.call(this,r,t.extend({point:s,lngLat:l,originalEvent:o},a)),this._defaultPrevented=!1,this.target=i}e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r;var i={defaultPrevented:{configurable:!0}};return r.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(r.prototype,i),r}(t.Event),Dr=function(e){function r(r,i,o){var a="touchend"===r?o.changedTouches:o.touches,s=n.touchPos(i.getCanvasContainer(),a),l=s.map((function(t){return i.unproject(t)})),c=s.reduce((function(t,e,n,r){return t.add(e.div(r.length))}),new t.Point(0,0)),u=i.unproject(c);e.call(this,r,{points:s,point:c,lngLats:l,lngLat:u,originalEvent:o}),this._defaultPrevented=!1}e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r;var i={defaultPrevented:{configurable:!0}};return r.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(r.prototype,i),r}(t.Event),Or=function(t){function e(e,n,r){t.call(this,e,{originalEvent:r}),this._defaultPrevented=!1}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,n),e}(t.Event),Fr=function(t,e){this._map=t,this._clickTolerance=e.clickTolerance};Fr.prototype.reset=function(){delete this._mousedownPos},Fr.prototype.wheel=function(t){return this._firePreventable(new Or(t.type,this._map,t))},Fr.prototype.mousedown=function(t,e){return this._mousedownPos=e,this._firePreventable(new zr(t.type,this._map,t))},Fr.prototype.mouseup=function(t){this._map.fire(new zr(t.type,this._map,t))},Fr.prototype.click=function(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new zr(t.type,this._map,t))},Fr.prototype.dblclick=function(t){return this._firePreventable(new zr(t.type,this._map,t))},Fr.prototype.mouseover=function(t){this._map.fire(new zr(t.type,this._map,t))},Fr.prototype.mouseout=function(t){this._map.fire(new zr(t.type,this._map,t))},Fr.prototype.touchstart=function(t){return this._firePreventable(new Dr(t.type,this._map,t))},Fr.prototype.touchmove=function(t){this._map.fire(new Dr(t.type,this._map,t))},Fr.prototype.touchend=function(t){this._map.fire(new Dr(t.type,this._map,t))},Fr.prototype.touchcancel=function(t){this._map.fire(new Dr(t.type,this._map,t))},Fr.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},Fr.prototype.isEnabled=function(){return!0},Fr.prototype.isActive=function(){return!1},Fr.prototype.enable=function(){},Fr.prototype.disable=function(){};var Br=function(t){this._map=t};Br.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Br.prototype.mousemove=function(t){this._map.fire(new zr(t.type,this._map,t))},Br.prototype.mousedown=function(){this._delayContextMenu=!0},Br.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new zr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Br.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new zr(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},Br.prototype.isEnabled=function(){return!0},Br.prototype.isActive=function(){return!1},Br.prototype.enable=function(){},Br.prototype.disable=function(){};var Nr=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function Ur(t,e){for(var n={},r=0;r<t.length;r++)n[t[r].identifier]=e[r];return n}Nr.prototype.isEnabled=function(){return!!this._enabled},Nr.prototype.isActive=function(){return!!this._active},Nr.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Nr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Nr.prototype.mousedown=function(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(n.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)},Nr.prototype.mousemoveWindow=function(t,e){if(this._active){var r=e;if(!(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)){var i=this._startPos;this._lastPos=r,this._box||(this._box=n.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var o=Math.min(i.x,r.x),a=Math.max(i.x,r.x),s=Math.min(i.y,r.y),l=Math.max(i.y,r.y);n.setTransform(this._box,"translate("+o+"px,"+s+"px)"),this._box.style.width=a-o+"px",this._box.style.height=l-s+"px"}}},Nr.prototype.mouseupWindow=function(e,r){var i=this;if(this._active&&0===e.button){var o=this._startPos,a=r;if(this.reset(),n.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:function(t){return t.fitScreenCoordinates(o,a,i._map.getBearing(),{linear:!0})}};this._fireEvent("boxzoomcancel",e)}},Nr.prototype.keydown=function(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))},Nr.prototype.reset=function(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(n.remove(this._box),this._box=null),n.enableDrag(),delete this._startPos,delete this._lastPos},Nr.prototype._fireEvent=function(e,n){return this._map.fire(new t.Event(e,{originalEvent:n}))};var jr=function(t){this.reset(),this.numTouches=t.numTouches};jr.prototype.reset=function(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1},jr.prototype.touchstart=function(e,n,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){for(var n=new t.Point(0,0),r=0,i=e;r<i.length;r+=1)n._add(i[r]);return n.div(e.length)}(n),this.touches=Ur(r,n)))},jr.prototype.touchmove=function(t,e,n){if(!this.aborted&&this.centroid){var r=Ur(n,e);for(var i in this.touches){var o=r[i];(!o||o.dist(this.touches[i])>30)&&(this.aborted=!0)}}},jr.prototype.touchend=function(t,e,n){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){var r=!this.aborted&&this.centroid;if(this.reset(),r)return r}};var Vr=function(t){this.singleTap=new jr(t),this.numTaps=t.numTaps,this.reset()};Vr.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},Vr.prototype.touchstart=function(t,e,n){this.singleTap.touchstart(t,e,n)},Vr.prototype.touchmove=function(t,e,n){this.singleTap.touchmove(t,e,n)},Vr.prototype.touchend=function(t,e,n){var r=this.singleTap.touchend(t,e,n);if(r){var i=t.timeStamp-this.lastTime<500,o=!this.lastTap||this.lastTap.dist(r)<30;if(i&&o||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}};var Gr=function(){this._zoomIn=new Vr({numTouches:1,numTaps:2}),this._zoomOut=new Vr({numTouches:2,numTaps:1}),this.reset()};Gr.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},Gr.prototype.touchstart=function(t,e,n){this._zoomIn.touchstart(t,e,n),this._zoomOut.touchstart(t,e,n)},Gr.prototype.touchmove=function(t,e,n){this._zoomIn.touchmove(t,e,n),this._zoomOut.touchmove(t,e,n)},Gr.prototype.touchend=function(t,e,n){var r=this,i=this._zoomIn.touchend(t,e,n),o=this._zoomOut.touchend(t,e,n);return i?(this._active=!0,t.preventDefault(),setTimeout((function(){return r.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(i)},{originalEvent:t})}}):o?(this._active=!0,t.preventDefault(),setTimeout((function(){return r.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(o)},{originalEvent:t})}}):void 0},Gr.prototype.touchcancel=function(){this.reset()},Gr.prototype.enable=function(){this._enabled=!0},Gr.prototype.disable=function(){this._enabled=!1,this.reset()},Gr.prototype.isEnabled=function(){return this._enabled},Gr.prototype.isActive=function(){return this._active};var Hr={0:1,2:2},Wr=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};Wr.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},Wr.prototype._correctButton=function(t,e){return!1},Wr.prototype._move=function(t,e){return{}},Wr.prototype.mousedown=function(t,e){if(!this._lastPoint){var r=n.mouseButton(t);this._correctButton(t,r)&&(this._lastPoint=e,this._eventButton=r)}},Wr.prototype.mousemoveWindow=function(t,e){var n=this._lastPoint;if(n)if(t.preventDefault(),function(t,e){var n=Hr[e];return void 0===t.buttons||(t.buttons&n)!==n}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(n)<this._clickTolerance))return this._moved=!0,this._lastPoint=e,this._move(n,e)},Wr.prototype.mouseupWindow=function(t){this._lastPoint&&n.mouseButton(t)===this._eventButton&&(this._moved&&n.suppressClick(),this.reset())},Wr.prototype.enable=function(){this._enabled=!0},Wr.prototype.disable=function(){this._enabled=!1,this.reset()},Wr.prototype.isEnabled=function(){return this._enabled},Wr.prototype.isActive=function(){return this._active};var qr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.mousedown=function(e,n){t.prototype.mousedown.call(this,e,n),this._lastPoint&&(this._active=!0)},e.prototype._correctButton=function(t,e){return 0===e&&!t.ctrlKey},e.prototype._move=function(t,e){return{around:e,panDelta:e.sub(t)}},e}(Wr),Zr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._correctButton=function(t,e){return 0===e&&t.ctrlKey||2===e},e.prototype._move=function(t,e){var n=.8*(e.x-t.x);if(n)return this._active=!0,{bearingDelta:n}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(Wr),Xr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._correctButton=function(t,e){return 0===e&&t.ctrlKey||2===e},e.prototype._move=function(t,e){var n=-.5*(e.y-t.y);if(n)return this._active=!0,{pitchDelta:n}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(Wr),$r=function(t){this._minTouches=1,this._clickTolerance=t.clickTolerance||1,this.reset()};$r.prototype.reset=function(){this._active=!1,this._touches={},this._sum=new t.Point(0,0)},$r.prototype.touchstart=function(t,e,n){return this._calculateTransform(t,e,n)},$r.prototype.touchmove=function(t,e,n){if(this._active&&!(n.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,n)},$r.prototype.touchend=function(t,e,n){this._calculateTransform(t,e,n),this._active&&n.length<this._minTouches&&this.reset()},$r.prototype.touchcancel=function(){this.reset()},$r.prototype._calculateTransform=function(e,n,r){r.length>0&&(this._active=!0);var i=Ur(r,n),o=new t.Point(0,0),a=new t.Point(0,0),s=0;for(var l in i){var c=i[l],u=this._touches[l];u&&(o._add(c),a._add(c.sub(u)),s++,i[l]=c)}if(this._touches=i,!(s<this._minTouches)&&a.mag()){var p=a.div(s);if(this._sum._add(p),!(this._sum.mag()<this._clickTolerance))return{around:o.div(s),panDelta:p}}},$r.prototype.enable=function(){this._enabled=!0},$r.prototype.disable=function(){this._enabled=!1,this.reset()},$r.prototype.isEnabled=function(){return this._enabled},$r.prototype.isActive=function(){return this._active};var Jr=function(){this.reset()};function Yr(t,e,n){for(var r=0;r<t.length;r++)if(t[r].identifier===n)return e[r]}function Qr(t,e){return Math.log(t/e)/Math.LN2}Jr.prototype.reset=function(){this._active=!1,delete this._firstTwoTouches},Jr.prototype._start=function(t){},Jr.prototype._move=function(t,e,n){return{}},Jr.prototype.touchstart=function(t,e,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([e[0],e[1]]))},Jr.prototype.touchmove=function(t,e,n){if(this._firstTwoTouches){t.preventDefault();var r=this._firstTwoTouches,i=r[1],o=Yr(n,e,r[0]),a=Yr(n,e,i);if(o&&a){var s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}}},Jr.prototype.touchend=function(t,e,r){if(this._firstTwoTouches){var i=this._firstTwoTouches,o=i[1],a=Yr(r,e,i[0]),s=Yr(r,e,o);a&&s||(this._active&&n.suppressClick(),this.reset())}},Jr.prototype.touchcancel=function(){this.reset()},Jr.prototype.enable=function(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around},Jr.prototype.disable=function(){this._enabled=!1,this.reset()},Jr.prototype.isEnabled=function(){return this._enabled},Jr.prototype.isActive=function(){return this._active};var Kr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),delete this._distance,delete this._startDistance},e.prototype._start=function(t){this._startDistance=this._distance=t[0].dist(t[1])},e.prototype._move=function(t,e){var n=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Qr(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Qr(this._distance,n),pinchAround:e}},e}(Jr);function ti(t,e){return 180*t.angleWith(e)/Math.PI}var ei=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),delete this._minDiameter,delete this._startVector,delete this._vector},e.prototype._start=function(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])},e.prototype._move=function(t,e){var n=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ti(this._vector,n),pinchAround:e}},e.prototype._isBelowThreshold=function(t){this._minDiameter=Math.min(this._minDiameter,t.mag());var e=25/(Math.PI*this._minDiameter)*360,n=ti(t,this._startVector);return Math.abs(n)<e},e}(Jr);function ni(t){return Math.abs(t.y)>Math.abs(t.x)}var ri=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},e.prototype._start=function(t){this._lastPoints=t,ni(t[0].sub(t[1]))&&(this._valid=!1)},e.prototype._move=function(t,e,n){var r=t[0].sub(this._lastPoints[0]),i=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(r,i,n.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+i.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,n){if(void 0!==this._valid)return this._valid;var r=t.mag()>=2,i=e.mag()>=2;if(r||i){if(!r||!i)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;var o=t.y>0==e.y>0;return ni(t)&&ni(e)&&o}},e}(Jr),ii={panStep:100,bearingStep:15,pitchStep:10},oi=function(){var t=ii;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1};function ai(t){return t*(2-t)}oi.prototype.reset=function(){this._active=!1},oi.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var n=0,r=0,i=0,o=0,a=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),o=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),o=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),a=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:ai,zoom:n?Math.round(l)+n*(t.shiftKey?2:1):l,bearing:s.getBearing()+r*e._bearingStep,pitch:s.getPitch()+i*e._pitchStep,offset:[-o*e._panStep,-a*e._panStep],center:s.getCenter()},{originalEvent:t})}}}},oi.prototype.enable=function(){this._enabled=!0},oi.prototype.disable=function(){this._enabled=!1,this.reset()},oi.prototype.isEnabled=function(){return this._enabled},oi.prototype.isActive=function(){return this._active},oi.prototype.disableRotation=function(){this._rotationDisabled=!0},oi.prototype.enableRotation=function(){this._rotationDisabled=!1};var si=function(e,n){this._map=e,this._el=e.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onTimeout"],this)};si.prototype.setZoomRate=function(t){this._defaultZoomRate=t},si.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},si.prototype.isEnabled=function(){return!!this._enabled},si.prototype.isActive=function(){return!!this._active||void 0!==this._finishTimeout},si.prototype.isZooming=function(){return!!this._zooming},si.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},si.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},si.prototype.wheel=function(e){if(this.isEnabled()){var n=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,r=t.browser.now(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==n&&n%4.000244140625==0?this._type="wheel":0!==n&&Math.abs(n)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}},si.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},si.prototype._start=function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var r=n.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(r)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},si.prototype.renderFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var n=this._map.transform;if(0!==this._delta){var r="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==i&&(i=1/i);var o="number"==typeof this._targetZoom?n.zoomScale(this._targetZoom):n.scale;this._targetZoom=Math.min(n.maxZoom,Math.max(n.minZoom,n.scaleZoom(o*i))),"wheel"===this._type&&(this._startZoom=n.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var a,s="number"==typeof this._targetZoom?this._targetZoom:n.zoom,l=this._startZoom,c=this._easing,u=!1;if("wheel"===this._type&&l&&c){var p=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),h=c(p);a=t.number(l,s,h),p<1?this._frameId||(this._frameId=!0):u=!0}else a=s,u=!0;return this._active=!0,u&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!u,zoomDelta:a-n.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},si.prototype._smoothOutEasing=function(e){var n=t.ease;if(this._prevEase){var r=this._prevEase,i=(t.browser.now()-r.start)/r.duration,o=r.easing(i+.01)-r.easing(i),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-a*a);n=t.bezier(a,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:n},n},si.prototype.reset=function(){this._active=!1};var li=function(t,e){this._clickZoom=t,this._tapZoom=e};li.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},li.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},li.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},li.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var ci=function(){this.reset()};ci.prototype.reset=function(){this._active=!1},ci.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(n){n.easeTo({duration:300,zoom:n.getZoom()+(t.shiftKey?-1:1),around:n.unproject(e)},{originalEvent:t})}}},ci.prototype.enable=function(){this._enabled=!0},ci.prototype.disable=function(){this._enabled=!1,this.reset()},ci.prototype.isEnabled=function(){return this._enabled},ci.prototype.isActive=function(){return this._active};var ui=function(){this._tap=new Vr({numTouches:1,numTaps:1}),this.reset()};ui.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},ui.prototype.touchstart=function(t,e,n){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=e[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(t,e,n))},ui.prototype.touchmove=function(t,e,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;var r=e[0],i=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:i/128}}}else this._tap.touchmove(t,e,n)},ui.prototype.touchend=function(t,e,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(t,e,n)&&(this._tapTime=t.timeStamp)},ui.prototype.touchcancel=function(){this.reset()},ui.prototype.enable=function(){this._enabled=!0},ui.prototype.disable=function(){this._enabled=!1,this.reset()},ui.prototype.isEnabled=function(){return this._enabled},ui.prototype.isActive=function(){return this._active};var pi=function(t,e,n){this._el=t,this._mousePan=e,this._touchPan=n};pi.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")},pi.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")},pi.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},pi.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var hi=function(t,e,n){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=n};hi.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},hi.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},hi.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},hi.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var di=function(t,e,n,r){this._el=t,this._touchZoom=e,this._touchRotate=n,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0};di.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")},di.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")},di.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},di.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},di.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},di.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var fi=function(t){return t.zoom||t.drag||t.pitch||t.rotate},mi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event);function gi(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}var yi=function(e,r){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ir(e),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r),t.bindAll(["handleEvent","handleWindowEvent"],this);var i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[t.window,"blur",void 0]];for(var o=0,a=this._listeners;o<a.length;o+=1){var s=a[o],l=s[0];n.addEventListener(l,s[1],l===t.window.document?this.handleWindowEvent:this.handleEvent,s[2])}};yi.prototype.destroy=function(){for(var e=0,r=this._listeners;e<r.length;e+=1){var i=r[e],o=i[0];n.removeEventListener(o,i[1],o===t.window.document?this.handleWindowEvent:this.handleEvent,i[2])}},yi.prototype._addDefaultHandlers=function(t){var e=this._map,n=e.getCanvasContainer();this._add("mapEvent",new Fr(e,t));var r=e.boxZoom=new Nr(e,t);this._add("boxZoom",r);var i=new Gr,o=new ci;e.doubleClickZoom=new li(o,i),this._add("tapZoom",i),this._add("clickZoom",o);var a=new ui;this._add("tapDragZoom",a);var s=e.touchPitch=new ri;this._add("touchPitch",s);var l=new Zr(t),c=new Xr(t);e.dragRotate=new hi(t,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);var u=new qr(t),p=new $r(t);e.dragPan=new pi(n,u,p),this._add("mousePan",u),this._add("touchPan",p,["touchZoom","touchRotate"]);var h=new ei,d=new Kr;e.touchZoomRotate=new di(n,d,h,a),this._add("touchRotate",h,["touchPan","touchZoom"]),this._add("touchZoom",d,["touchPan","touchRotate"]);var f=e.scrollZoom=new si(e,this);this._add("scrollZoom",f,["mousePan"]);var m=e.keyboard=new oi;this._add("keyboard",m),this._add("blockableMapEvent",new Br(e));for(var g=0,y=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];g<y.length;g+=1){var v=y[g];t.interactive&&t[v]&&e[v].enable(t[v])}},yi.prototype._add=function(t,e,n){this._handlers.push({handlerName:t,handler:e,allowed:n}),this._handlersById[t]=e},yi.prototype.stop=function(t){if(!this._updatingCamera){for(var e=0,n=this._handlers;e<n.length;e+=1)n[e].handler.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}},yi.prototype.isActive=function(){for(var t=0,e=this._handlers;t<e.length;t+=1)if(e[t].handler.isActive())return!0;return!1},yi.prototype.isZooming=function(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()},yi.prototype.isRotating=function(){return!!this._eventsInProgress.rotate},yi.prototype.isMoving=function(){return Boolean(fi(this._eventsInProgress))||this.isZooming()},yi.prototype._blockedByActive=function(t,e,n){for(var r in t)if(r!==n&&(!e||e.indexOf(r)<0))return!0;return!1},yi.prototype.handleWindowEvent=function(t){this.handleEvent(t,t.type+"Window")},yi.prototype._getMapTouches=function(t){for(var e=[],n=0,r=t;n<r.length;n+=1){var i=r[n];this._el.contains(i.target)&&e.push(i)}return e},yi.prototype.handleEvent=function(t,e){if("blur"!==t.type){this._updatingCamera=!0;for(var r="renderFrame"===t.type?void 0:t,i={needsRenderFrame:!1},o={},a={},s=t.touches?this._getMapTouches(t.touches):void 0,l=s?n.touchPos(this._el,s):n.mousePos(this._el,t),c=0,u=this._handlers;c<u.length;c+=1){var p=u[c],h=p.handlerName,d=p.handler,f=p.allowed;if(d.isEnabled()){var m=void 0;this._blockedByActive(a,f,h)?d.reset():d[e||t.type]&&(m=d[e||t.type](t,l,s),this.mergeHandlerResult(i,o,m,h,r),m&&m.needsRenderFrame&&this._triggerRenderFrame()),(m||d.isActive())&&(a[h]=d)}}var g={};for(var y in this._previousActiveHandlers)a[y]||(g[y]=r);this._previousActiveHandlers=a,(Object.keys(g).length||gi(i))&&(this._changes.push([i,o,g]),this._triggerRenderFrame()),(Object.keys(a).length||gi(i))&&this._map._stop(!0),this._updatingCamera=!1;var v=i.cameraAnimation;v&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],v(this._map))}else this.stop(!0)},yi.prototype.mergeHandlerResult=function(e,n,r,i,o){if(r){t.extend(e,r);var a={handlerName:i,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(n.zoom=a),void 0!==r.panDelta&&(n.drag=a),void 0!==r.pitchDelta&&(n.pitch=a),void 0!==r.bearingDelta&&(n.rotate=a)}},yi.prototype._applyChanges=function(){for(var e={},n={},r={},i=0,o=this._changes;i<o.length;i+=1){var a=o[i],s=a[0],l=a[1],c=a[2];s.panDelta&&(e.panDelta=(e.panDelta||new t.Point(0,0))._add(s.panDelta)),s.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(e.around=s.around),void 0!==s.pinchAround&&(e.pinchAround=s.pinchAround),s.noInertia&&(e.noInertia=s.noInertia),t.extend(n,l),t.extend(r,c)}this._updateMapTransform(e,n,r),this._changes=[]},yi.prototype._updateMapTransform=function(t,e,n){var r=this._map,i=r.transform;if(!gi(t))return this._fireEvents(e,n,!0);var o=t.panDelta,a=t.zoomDelta,s=t.bearingDelta,l=t.pitchDelta,c=t.around,u=t.pinchAround;void 0!==u&&(c=u),r._stop(!0),c=c||r.transform.centerPoint;var p=i.pointLocation(o?c.sub(o):c);s&&(i.bearing+=s),l&&(i.pitch+=l),a&&(i.zoom+=a),i.setLocationAtPoint(p,c),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,n,!0)},yi.prototype._fireEvents=function(e,n,r){var i=this,o=fi(this._eventsInProgress),a=fi(e),s={};for(var l in e)this._eventsInProgress[l]||(s[l+"start"]=e[l].originalEvent),this._eventsInProgress[l]=e[l];for(var c in!o&&a&&this._fireEvent("movestart",a.originalEvent),s)this._fireEvent(c,s[c]);for(var u in a&&this._fireEvent("move",a.originalEvent),e)this._fireEvent(u,e[u].originalEvent);var p,h={};for(var d in this._eventsInProgress){var f=this._eventsInProgress[d],m=f.handlerName,g=f.originalEvent;this._handlersById[m].isActive()||(delete this._eventsInProgress[d],h[d+"end"]=p=n[m]||g)}for(var y in h)this._fireEvent(y,h[y]);var v=fi(this._eventsInProgress);if(r&&(o||a)&&!v){this._updatingCamera=!0;var _=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),x=function(t){return 0!==t&&-i._bearingSnap<t&&t<i._bearingSnap};_?(x(_.bearing||this._map.getBearing())&&(_.bearing=0),this._map.easeTo(_,{originalEvent:p})):(this._map.fire(new t.Event("moveend",{originalEvent:p})),x(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}},yi.prototype._fireEvent=function(e,n){this._map.fire(new t.Event(e,n?{originalEvent:n}:{}))},yi.prototype._requestFrame=function(){var t=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add((function(e){delete t._frameId,t.handleEvent(new mi("renderFrame",{timeStamp:e})),t._applyChanges()}))},yi.prototype._triggerRenderFrame=function(){void 0===this._frameId&&(this._frameId=this._requestFrame())};var vi=function(e){function n(n,r){e.call(this),this._moving=!1,this._zooming=!1,this.transform=n,this._bearingSnap=r.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.getCenter=function(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)},n.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},n.prototype.panBy=function(e,n,r){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},n),r)},n.prototype.panTo=function(e,n,r){return this.easeTo(t.extend({center:e},n),r)},n.prototype.getZoom=function(){return this.transform.zoom},n.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},n.prototype.zoomTo=function(e,n,r){return this.easeTo(t.extend({zoom:e},n),r)},n.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},n.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},n.prototype.getBearing=function(){return this.transform.bearing},n.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},n.prototype.getPadding=function(){return this.transform.padding},n.prototype.setPadding=function(t,e){return this.jumpTo({padding:t},e),this},n.prototype.rotateTo=function(e,n,r){return this.easeTo(t.extend({bearing:e},n),r)},n.prototype.resetNorth=function(e,n){return this.rotateTo(0,t.extend({duration:1e3},e),n),this},n.prototype.resetNorthPitch=function(e,n){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),n),this},n.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this},n.prototype.getPitch=function(){return this.transform.pitch},n.prototype.setPitch=function(t,e){return this.jumpTo({pitch:t},e),this},n.prototype.cameraForBounds=function(e,n){e=t.LngLatBounds.convert(e);var r=n&&n.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,n)},n.prototype._cameraForBoxAndBearing=function(e,n,r,i){var o={top:0,bottom:0,right:0,left:0};if("number"==typeof(i=t.extend({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding){var a=i.padding;i.padding={top:a,bottom:a,right:a,left:a}}i.padding=t.extend(o,i.padding);var s=this.transform,l=s.padding,c=s.project(t.LngLat.convert(e)),u=s.project(t.LngLat.convert(n)),p=c.rotate(-r*Math.PI/180),h=u.rotate(-r*Math.PI/180),d=new t.Point(Math.max(p.x,h.x),Math.max(p.y,h.y)),f=new t.Point(Math.min(p.x,h.x),Math.min(p.y,h.y)),m=d.sub(f),g=(s.width-(l.left+l.right+i.padding.left+i.padding.right))/m.x,y=(s.height-(l.top+l.bottom+i.padding.top+i.padding.bottom))/m.y;if(!(y<0||g<0)){var v=Math.min(s.scaleZoom(s.scale*Math.min(g,y)),i.maxZoom),_="number"==typeof i.offset.x?new t.Point(i.offset.x,i.offset.y):t.Point.convert(i.offset),x=new t.Point((i.padding.left-i.padding.right)/2,(i.padding.top-i.padding.bottom)/2).rotate(r*Math.PI/180),b=_.add(x).mult(s.scale/s.zoomScale(v));return{center:s.unproject(c.add(u).div(2).sub(b)),zoom:v,bearing:r}}t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")},n.prototype.fitBounds=function(t,e,n){return this._fitInternal(this.cameraForBounds(t,e),e,n)},n.prototype.fitScreenCoordinates=function(e,n,r,i,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(n)),r,i),i,o)},n.prototype._fitInternal=function(e,n,r){return e?(delete(n=t.extend(e,n)).padding,n.linear?this.easeTo(n,r):this.flyTo(n,r)):this},n.prototype.jumpTo=function(e,n){this.stop();var r=this.transform,i=!1,o=!1,a=!1;return"zoom"in e&&r.zoom!==+e.zoom&&(i=!0,r.zoom=+e.zoom),void 0!==e.center&&(r.center=t.LngLat.convert(e.center)),"bearing"in e&&r.bearing!==+e.bearing&&(o=!0,r.bearing=+e.bearing),"pitch"in e&&r.pitch!==+e.pitch&&(a=!0,r.pitch=+e.pitch),null==e.padding||r.isPaddingEqual(e.padding)||(r.padding=e.padding),this.fire(new t.Event("movestart",n)).fire(new t.Event("move",n)),i&&this.fire(new t.Event("zoomstart",n)).fire(new t.Event("zoom",n)).fire(new t.Event("zoomend",n)),o&&this.fire(new t.Event("rotatestart",n)).fire(new t.Event("rotate",n)).fire(new t.Event("rotateend",n)),a&&this.fire(new t.Event("pitchstart",n)).fire(new t.Event("pitch",n)).fire(new t.Event("pitchend",n)),this.fire(new t.Event("moveend",n))},n.prototype.easeTo=function(e,n){var r=this;this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.browser.prefersReducedMotion)&&(e.duration=0);var i=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),c="zoom"in e?+e.zoom:o,u="bearing"in e?this._normalizeBearing(e.bearing,a):a,p="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:i.padding,d=t.Point.convert(e.offset),f=i.centerPoint.add(d),m=i.pointLocation(f),g=t.LngLat.convert(e.center||m);this._normalizeCenter(g);var y,v,_=i.project(m),x=i.project(g).sub(_),b=i.zoomScale(c-o);e.around&&(y=t.LngLat.convert(e.around),v=i.locationPoint(y));var w={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||c!==o,this._rotating=this._rotating||a!==u,this._pitching=this._pitching||p!==s,this._padding=!i.isPaddingEqual(h),this._easeId=e.easeId,this._prepareEase(n,e.noMoveStart,w),this._ease((function(e){if(r._zooming&&(i.zoom=t.number(o,c,e)),r._rotating&&(i.bearing=t.number(a,u,e)),r._pitching&&(i.pitch=t.number(s,p,e)),r._padding&&(i.interpolatePadding(l,h,e),f=i.centerPoint.add(d)),y)i.setLocationAtPoint(y,v);else{var m=i.zoomScale(i.zoom-o),g=c>o?Math.min(2,b):Math.max(.5,b),w=Math.pow(g,1-e),M=i.unproject(_.add(x.mult(e*w)).mult(m));i.setLocationAtPoint(i.renderWorldCopies?M.wrap():M,f)}r._fireMoveEvents(n)}),(function(t){r._afterEase(n,t)}),e),this},n.prototype._prepareEase=function(e,n,r){void 0===r&&(r={}),this._moving=!0,n||r.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.Event("pitchstart",e))},n.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},n.prototype._afterEase=function(e,n){if(!this._easeId||!n||this._easeId!==n){delete this._easeId;var r=this._zooming,i=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new t.Event("zoomend",e)),i&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}},n.prototype.flyTo=function(e,n){var r=this;if(!e.essential&&t.browser.prefersReducedMotion){var i=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(i,n)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var o=this.transform,a=this.getZoom(),s=this.getBearing(),l=this.getPitch(),c=this.getPadding(),u="zoom"in e?t.clamp(+e.zoom,o.minZoom,o.maxZoom):a,p="bearing"in e?this._normalizeBearing(e.bearing,s):s,h="pitch"in e?+e.pitch:l,d="padding"in e?e.padding:o.padding,f=o.zoomScale(u-a),m=t.Point.convert(e.offset),g=o.centerPoint.add(m),y=o.pointLocation(g),v=t.LngLat.convert(e.center||y);this._normalizeCenter(v);var _=o.project(y),x=o.project(v).sub(_),b=e.curve,w=Math.max(o.width,o.height),M=w/f,S=x.mag();if("minZoom"in e){var T=t.clamp(Math.min(e.minZoom,a,u),o.minZoom,o.maxZoom),E=w/o.zoomScale(T-a);b=Math.sqrt(E/S*2)}var A=b*b;function C(t){var e=(M*M-w*w+(t?-1:1)*A*A*S*S)/(2*(t?M:w)*A*S);return Math.log(Math.sqrt(e*e+1)-e)}function L(t){return(Math.exp(t)-Math.exp(-t))/2}function P(t){return(Math.exp(t)+Math.exp(-t))/2}var I=C(0),R=function(t){return P(I)/P(I+b*t)},k=function(t){return w*((P(I)*(L(e=I+b*t)/P(e))-L(I))/A)/S;var e},z=(C(1)-I)/b;if(Math.abs(S)<1e-6||!isFinite(z)){if(Math.abs(w-M)<1e-6)return this.easeTo(e,n);var D=M<w?-1:1;z=Math.abs(Math.log(M/w))/b,k=function(){return 0},R=function(t){return Math.exp(D*b*t)}}return e.duration="duration"in e?+e.duration:1e3*z/("screenSpeed"in e?+e.screenSpeed/b:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==p,this._pitching=h!==l,this._padding=!o.isPaddingEqual(d),this._prepareEase(n,!1),this._ease((function(e){var i=e*z,f=1/R(i);o.zoom=1===e?u:a+o.scaleZoom(f),r._rotating&&(o.bearing=t.number(s,p,e)),r._pitching&&(o.pitch=t.number(l,h,e)),r._padding&&(o.interpolatePadding(c,d,e),g=o.centerPoint.add(m));var y=1===e?v:o.unproject(_.add(x.mult(k(i))).mult(f));o.setLocationAtPoint(o.renderWorldCopies?y.wrap():y,g),r._fireMoveEvents(n)}),(function(){return r._afterEase(n)}),e),this},n.prototype.isEasing=function(){return!!this._easeFrameId},n.prototype.stop=function(){return this._stop()},n.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var n=this._onEaseEnd;delete this._onEaseEnd,n.call(this,e)}if(!t){var r=this.handlers;r&&r.stop(!1)}return this},n.prototype._ease=function(e,n,r){!1===r.animate||0===r.duration?(e(1),n()):(this._easeStart=t.browser.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},n.prototype._renderFrameCallback=function(){var e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},n.prototype._normalizeBearing=function(e,n){e=t.wrap(e,-180,180);var r=Math.abs(e-n);return Math.abs(e-360-n)<r&&(e-=360),Math.abs(e+360-n)<r&&(e+=360),e},n.prototype._normalizeCenter=function(t){var e=this.transform;if(e.renderWorldCopies&&!e.lngRange){var n=t.lng-e.center.lng;t.lng+=n>180?-360:n<-180?360:0}},n}(t.Evented),_i=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};_i.prototype.getDefaultPosition=function(){return"bottom-right"},_i.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=n.create("div","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=n.create("button","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.type="button",this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=n.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),e&&this._container.classList.add("maplibregl-compact","mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},_i.prototype.onRemove=function(){n.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},_i.prototype._setElementTitle=function(t,e){var n=this._map._getUIString("AttributionControl."+e);t.title=n,t.setAttribute("aria-label",n)},_i.prototype._toggleAttribution=function(){this._container.classList.contains("maplibregl-compact-show")||this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","true"))},_i.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){var r=n.reduce((function(t,e,r){return e.value&&(t+=e.key+"="+e.value+(r<n.length-1?"&":"")),t}),"?");e.href=t.config.FEEDBACK_URL+"/"+r+(this._map._hash?this._map._hash.getHashString(!0):""),e.rel="noopener nofollow",this._setElementTitle(e,"MapFeedback")}},_i.prototype._updateData=function(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType||(this._updateAttributions(),this._updateEditLink())},_i.prototype._updateAttributions=function(){if(this._map.style){var t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((function(t){return"string"!=typeof t?"":t}))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){var e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}var n=this._map.style.sourceCaches;for(var r in n){var i=n[r];if(i.used){var o=i.getSource();o.attribution&&t.indexOf(o.attribution)<0&&t.push(o.attribution)}}t.sort((function(t,e){return t.length-e.length}));var a=(t=t.filter((function(e,n){for(var r=n+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0}))).join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._editLink=null)}},_i.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("maplibregl-compact","mapboxgl-compact"):this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show")};var xi=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};xi.prototype.onAdd=function(t){this._map=t,this._container=n.create("div","maplibregl-ctrl mapboxgl-ctrl");var e=n.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},xi.prototype.onRemove=function(){n.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},xi.prototype.getDefaultPosition=function(){return"bottom-left"},xi.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},xi.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},xi.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("maplibregl-compact","mapboxgl-compact"):e.classList.remove("maplibregl-compact","mapboxgl-compact")}};var bi=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};bi.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},bi.prototype.remove=function(t){for(var e=this._currentlyRunning,n=0,r=e?this._queue.concat(e):this._queue;n<r.length;n+=1){var i=r[n];if(i.id===t)return void(i.cancelled=!0)}},bi.prototype.run=function(t){void 0===t&&(t=0);var e=this._currentlyRunning=this._queue;this._queue=[];for(var n=0,r=e;n<r.length;n+=1){var i=r[n];if(!i.cancelled&&(i.callback(t),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},bi.prototype.clear=function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]};var wi={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},Mi=t.window.HTMLImageElement,Si=t.window.HTMLElement,Ti=t.window.ImageBitmap,Ei={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},Ai=function(r){function i(e){var n=this;if(null!=(e=t.extend({},Ei,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var i=new Mr(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(r.call(this,i,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new bi,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},wi,e.locale),this._clickTolerance=e.clickTolerance,this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken),"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else{if(!(e.container instanceof Si))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(function(){return n._update(!1)})),this.on("moveend",(function(){return n._update(!1)})),this.on("zoom",(function(){return n._update(!0)})),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1),t.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new yi(this,e),this._hash=e.hash&&new Tr("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new _i({customAttribution:e.customAttribution})),this.addControl(new xi,e.logoPosition),this.on("style.load",(function(){n.transform.unmodified&&n.jumpTo(n.style.stylesheet)})),this.on("data",(function(e){n._update("style"===e.dataType),n.fire(new t.Event(e.dataType+"data",e))})),this.on("dataloading",(function(e){n.fire(new t.Event(e.dataType+"dataloading",e))}))}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var o={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return i.prototype._getMapId=function(){return this._mapId},i.prototype.addControl=function(e,n){if(void 0===n&&(n=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var r=e.onAdd(this);this._controls.push(e);var i=this._controlPositions[n];return-1!==n.indexOf("bottom")?i.insertBefore(r,i.firstChild):i.appendChild(r),this},i.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var n=this._controls.indexOf(e);return n>-1&&this._controls.splice(n,1),e.onRemove(this),this},i.prototype.hasControl=function(t){return this._controls.indexOf(t)>-1},i.prototype.resize=function(e){var n=this._containerDimensions(),r=n[0],i=n[1];this._resizeCanvas(r,i),this.transform.resize(r,i),this.painter.resize(r,i);var o=!this._moving;return o&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),o&&this.fire(new t.Event("moveend",e)),this},i.prototype.getBounds=function(){return this.transform.getBounds()},i.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},i.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},i.prototype.setMinZoom=function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")},i.prototype.getMinZoom=function(){return this.transform.minZoom},i.prototype.setMaxZoom=function(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},i.prototype.getMaxZoom=function(){return this.transform.maxZoom},i.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")},i.prototype.getMinPitch=function(){return this.transform.minPitch},i.prototype.setMaxPitch=function(t){if((t=null==t?60:t)>60)throw new Error("maxPitch must be less than or equal to 60");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")},i.prototype.getMaxPitch=function(){return this.transform.maxPitch},i.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},i.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},i.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},i.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},i.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},i.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},i.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},i.prototype._createDelegatedListener=function(t,e,n){var r,i=this;if("mouseenter"===t||"mouseover"===t){var o=!1;return{layer:e,listener:n,delegates:{mousemove:function(r){var a=i.getLayer(e)?i.queryRenderedFeatures(r.point,{layers:[e]}):[];a.length?o||(o=!0,n.call(i,new zr(t,i,r.originalEvent,{features:a}))):o=!1},mouseout:function(){o=!1}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:n,delegates:{mousemove:function(r){(i.getLayer(e)?i.queryRenderedFeatures(r.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,n.call(i,new zr(t,i,r.originalEvent)))},mouseout:function(e){a&&(a=!1,n.call(i,new zr(t,i,e.originalEvent)))}}}}return{layer:e,listener:n,delegates:(r={},r[t]=function(t){var r=i.getLayer(e)?i.queryRenderedFeatures(t.point,{layers:[e]}):[];r.length&&(t.features=r,n.call(i,t),delete t.features)},r)}},i.prototype.on=function(t,e,n){if(void 0===n)return r.prototype.on.call(this,t,e);var i=this._createDelegatedListener(t,e,n);for(var o in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(i),i.delegates)this.on(o,i.delegates[o]);return this},i.prototype.once=function(t,e,n){if(void 0===n)return r.prototype.once.call(this,t,e);var i=this._createDelegatedListener(t,e,n);for(var o in i.delegates)this.once(o,i.delegates[o]);return this},i.prototype.off=function(t,e,n){var i=this;return void 0===n?r.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(r){for(var o=r[t],a=0;a<o.length;a++){var s=o[a];if(s.layer===e&&s.listener===n){for(var l in s.delegates)i.off(l,s.delegates[l]);return o.splice(a,1),i}}}(this._delegatedListeners),this)},i.prototype.queryRenderedFeatures=function(e,n){if(!this.style)return[];var r;if(void 0!==n||void 0===e||e instanceof t.Point||Array.isArray(e)||(n=e,e=void 0),n=n||{},(e=e||[[0,0],[this.transform.width,this.transform.height]])instanceof t.Point||"number"==typeof e[0])r=[t.Point.convert(e)];else{var i=t.Point.convert(e[0]),o=t.Point.convert(e[1]);r=[i,new t.Point(o.x,i.y),o,new t.Point(i.x,o.y),i]}return this.style.queryRenderedFeatures(r,n,this.transform)},i.prototype.querySourceFeatures=function(t,e){return this.style.querySourceFeatures(t,e)},i.prototype.setStyle=function(e,n){return!1!==(n=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},n)).diff&&n.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,n),this):(this._localIdeographFontFamily=n.localIdeographFontFamily,this._updateStyle(e,n))},i.prototype.setTransformRequest=function(t){return this._requestManager.setTransformRequest(t),this},i.prototype._getUIString=function(t){var e=this._locale[t];if(null==e)throw new Error("Missing UI string '"+t+"'");return e},i.prototype._updateStyle=function(t,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),t?(this.style=new Ge(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t):this.style.loadJSON(t),this):(delete this.style,this)},i.prototype._lazyInitEmptyStyle=function(){this.style||(this.style=new Ge(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())},i.prototype._diffStyle=function(e,n){var r=this;if("string"==typeof e){var i=this._requestManager.normalizeStyleURL(e),o=this._requestManager.transformRequest(i,t.ResourceType.Style);t.getJSON(o,(function(e,i){e?r.fire(new t.ErrorEvent(e)):i&&r._updateDiff(i,n)}))}else"object"==typeof e&&this._updateDiff(e,n)},i.prototype._updateDiff=function(e,n){try{this.style.setState(e)&&this._update(!0)}catch(r){t.warnOnce("Unable to perform style diff: "+(r.message||r.error||r)+". Rebuilding the style from scratch."),this._updateStyle(e,n)}},i.prototype.getStyle=function(){if(this.style)return this.style.serialize()},i.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")},i.prototype.addSource=function(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)},i.prototype.isSourceLoaded=function(e){var n=this.style&&this.style.sourceCaches[e];if(void 0!==n)return n.loaded();this.fire(new t.ErrorEvent(new Error("There is no source with ID '"+e+"'")))},i.prototype.areTilesLoaded=function(){var t=this.style&&this.style.sourceCaches;for(var e in t){var n=t[e]._tiles;for(var r in n){var i=n[r];if("loaded"!==i.state&&"errored"!==i.state)return!1}}return!0},i.prototype.addSourceType=function(t,e,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,n)},i.prototype.removeSource=function(t){return this.style.removeSource(t),this._update(!0)},i.prototype.getSource=function(t){return this.style.getSource(t)},i.prototype.addImage=function(e,n,r){void 0===r&&(r={});var i=r.pixelRatio;void 0===i&&(i=1);var o=r.sdf;void 0===o&&(o=!1);var a=r.stretchX,s=r.stretchY,l=r.content;if(this._lazyInitEmptyStyle(),n instanceof Mi||Ti&&n instanceof Ti){var c=t.browser.getImageData(n);this.style.addImage(e,{data:new t.RGBAImage({width:c.width,height:c.height},c.data),pixelRatio:i,stretchX:a,stretchY:s,content:l,sdf:o,version:0})}else{if(void 0===n.width||void 0===n.height)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));var u=n;this.style.addImage(e,{data:new t.RGBAImage({width:n.width,height:n.height},new Uint8Array(n.data)),pixelRatio:i,stretchX:a,stretchY:s,content:l,sdf:o,version:0,userImage:u}),u.onAdd&&u.onAdd(this,e)}},i.prototype.updateImage=function(e,n){var r=this.style.getImage(e);if(!r)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));var i=n instanceof Mi||Ti&&n instanceof Ti?t.browser.getImageData(n):n,o=i.width,a=i.height,s=i.data;return void 0===o||void 0===a?this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):o!==r.data.width||a!==r.data.height?this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image"))):(r.data.replace(s,!(n instanceof Mi||Ti&&n instanceof Ti)),void this.style.updateImage(e,r))},i.prototype.hasImage=function(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)},i.prototype.removeImage=function(t){this.style.removeImage(t)},i.prototype.loadImage=function(e,n){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),n)},i.prototype.listImages=function(){return this.style.listImages()},i.prototype.addLayer=function(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)},i.prototype.moveLayer=function(t,e){return this.style.moveLayer(t,e),this._update(!0)},i.prototype.removeLayer=function(t){return this.style.removeLayer(t),this._update(!0)},i.prototype.getLayer=function(t){return this.style.getLayer(t)},i.prototype.setLayerZoomRange=function(t,e,n){return this.style.setLayerZoomRange(t,e,n),this._update(!0)},i.prototype.setFilter=function(t,e,n){return void 0===n&&(n={}),this.style.setFilter(t,e,n),this._update(!0)},i.prototype.getFilter=function(t){return this.style.getFilter(t)},i.prototype.setPaintProperty=function(t,e,n,r){return void 0===r&&(r={}),this.style.setPaintProperty(t,e,n,r),this._update(!0)},i.prototype.getPaintProperty=function(t,e){return this.style.getPaintProperty(t,e)},i.prototype.setLayoutProperty=function(t,e,n,r){return void 0===r&&(r={}),this.style.setLayoutProperty(t,e,n,r),this._update(!0)},i.prototype.getLayoutProperty=function(t,e){return this.style.getLayoutProperty(t,e)},i.prototype.setLight=function(t,e){return void 0===e&&(e={}),this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)},i.prototype.getLight=function(){return this.style.getLight()},i.prototype.setFeatureState=function(t,e){return this.style.setFeatureState(t,e),this._update()},i.prototype.removeFeatureState=function(t,e){return this.style.removeFeatureState(t,e),this._update()},i.prototype.getFeatureState=function(t){return this.style.getFeatureState(t)},i.prototype.getContainer=function(){return this._container},i.prototype.getCanvasContainer=function(){return this._canvasContainer},i.prototype.getCanvas=function(){return this._canvas},i.prototype._containerDimensions=function(){var t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]},i.prototype._setupContainer=function(){var t=this._container;t.classList.add("maplibregl-map","mapboxgl-map");var e=this._canvasContainer=n.create("div","maplibregl-canvas-container mapboxgl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=n.create("canvas","maplibregl-canvas mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");var r=this._containerDimensions();this._resizeCanvas(r[0],r[1]);var i=this._controlContainer=n.create("div","maplibregl-control-container mapboxgl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((function(t){o[t]=n.create("div","maplibregl-ctrl-"+t+" mapboxgl-ctrl-"+t,i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)},i.prototype._resizeCanvas=function(e,n){var r=t.browser.devicePixelRatio||1;this._canvas.width=r*e,this._canvas.height=r*n,this._canvas.style.width=e+"px",this._canvas.style.height=n+"px"},i.prototype._setupPainter=function(){var n=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl",n)||this._canvas.getContext("experimental-webgl",n);r?(this.painter=new _r(r,this.transform),t.webpSupported.testSupport(r)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))},i.prototype._contextLost=function(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))},i.prototype._contextRestored=function(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))},i.prototype._onMapScroll=function(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},i.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},i.prototype._update=function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this},i.prototype._requestRenderFrame=function(t){return this._update(),this._renderTaskQueue.add(t)},i.prototype._cancelRenderFrame=function(t){this._renderTaskQueue.remove(t)},i.prototype._render=function(e){var n,r=this,i=0,o=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(n=o.createQueryEXT(),o.beginQueryEXT(o.TIME_ELAPSED_EXT,n),i=t.browser.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),!this._removed){var a=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;var s=this.transform.zoom,l=t.browser.now();this.style.zoomHistory.update(s,l);var c=new t.EvaluationParameters(s,{now:l,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),u=c.crossFadingFactor();1===u&&u===this._crossFadingFactor||(a=!0,this._crossFadingFactor=u),this.style.update(c)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){var p=t.browser.now()-i;o.endQueryEXT(o.TIME_ELAPSED_EXT,n),setTimeout((function(){var e=o.getQueryObjectEXT(n,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(n),r.fire(new t.Event("gpu-timing-frame",{cpuTime:p,gpuTime:e}))}),50)}if(this.listens("gpu-timing-layer")){var h=this.painter.collectGpuTimers();setTimeout((function(){var e=r.painter.queryGpuTimers(h);r.fire(new t.Event("gpu-timing-layer",{layerTimes:e}))}),50)}var d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0),this}},i.prototype.remove=function(){this._hash&&this._hash.remove();for(var e=0,n=this._controls;e<n.length;e+=1)n[e].onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),void 0!==t.window&&(t.window.removeEventListener("resize",this._onWindowResize,!1),t.window.removeEventListener("orientationchange",this._onWindowResize,!1),t.window.removeEventListener("online",this._onWindowOnline,!1));var r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.loseContext(),Ci(this._canvasContainer),Ci(this._controlContainer),this._container.classList.remove("maplibregl-map","mapboxgl-map"),this._removed=!0,this.fire(new t.Event("remove"))},i.prototype.triggerRepaint=function(){var e=this;this.style&&!this._frame&&(this._frame=t.browser.frame((function(t){e._frame=null,e._render(t)})))},i.prototype._onWindowOnline=function(){this._update()},i.prototype._onWindowResize=function(t){this._trackResize&&this.resize({originalEvent:t})._update()},o.showTileBoundaries.get=function(){return!!this._showTileBoundaries},o.showTileBoundaries.set=function(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},o.showPadding.get=function(){return!!this._showPadding},o.showPadding.set=function(t){this._showPadding!==t&&(this._showPadding=t,this._update())},o.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},o.showCollisionBoxes.set=function(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())},o.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},o.showOverdrawInspector.set=function(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},o.repaint.get=function(){return!!this._repaint},o.repaint.set=function(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())},o.vertices.get=function(){return!!this._vertices},o.vertices.set=function(t){this._vertices=t,this._update()},i.prototype._setCacheLimits=function(e,n){t.setCacheLimits(e,n)},o.version.get=function(){return t.version},Object.defineProperties(i.prototype,o),i}(vi);function Ci(t){t.parentNode&&t.parentNode.removeChild(t)}var Li={showCompass:!0,showZoom:!0,visualizePitch:!1},Pi=function(e){var r=this;this.options=t.extend({},Li,e),this._container=n.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",(function(t){return r._map.zoomIn({},{originalEvent:t})})),n.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",(function(t){return r._map.zoomOut({},{originalEvent:t})})),n.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",(function(t){r.options.visualizePitch?r._map.resetNorthPitch({},{originalEvent:t}):r._map.resetNorth({},{originalEvent:t})})),this._compassIcon=n.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))};Pi.prototype._updateZoomButtons=function(){var t=this._map.getZoom(),e=t===this._map.getMaxZoom(),n=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())},Pi.prototype._rotateCompassArrow=function(){var t=this.options.visualizePitch?"scale("+1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)+") rotateX("+this._map.transform.pitch+"deg) rotateZ("+this._map.transform.angle*(180/Math.PI)+"deg)":"rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassIcon.style.transform=t},Pi.prototype.onAdd=function(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Ii(this._map,this._compass,this.options.visualizePitch)),this._container},Pi.prototype.onRemove=function(){n.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map},Pi.prototype._createButton=function(t,e){var r=n.create("button",t,this._container);return r.type="button",r.addEventListener("click",e),r},Pi.prototype._setButtonTitle=function(t,e){var n=this._map._getUIString("NavigationControl."+e);t.title=n,t.setAttribute("aria-label",n)};var Ii=function(e,r,i){void 0===i&&(i=!1),this._clickTolerance=10,this.element=r,this.mouseRotate=new Zr({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,i&&(this.mousePitch=new Xr({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener(r,"mousedown",this.mousedown),n.addEventListener(r,"touchstart",this.touchstart,{passive:!1}),n.addEventListener(r,"touchmove",this.touchmove),n.addEventListener(r,"touchend",this.touchend),n.addEventListener(r,"touchcancel",this.reset)};function Ri(e,n,r){if(e=new t.LngLat(e.lng,e.lat),n){var i=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),a=r.locationPoint(e).distSqr(n);r.locationPoint(i).distSqr(n)<a?e=i:r.locationPoint(o).distSqr(n)<a&&(e=o)}for(;Math.abs(e.lng-r.center.lng)>180;){var s=r.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=r.width&&s.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e}Ii.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),n.disableDrag()},Ii.prototype.move=function(t,e){var n=this.map,r=this.mouseRotate.mousemoveWindow(t,e);if(r&&r.bearingDelta&&n.setBearing(n.getBearing()+r.bearingDelta),this.mousePitch){var i=this.mousePitch.mousemoveWindow(t,e);i&&i.pitchDelta&&n.setPitch(n.getPitch()+i.pitchDelta)}},Ii.prototype.off=function(){var t=this.element;n.removeEventListener(t,"mousedown",this.mousedown),n.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),n.removeEventListener(t,"touchmove",this.touchmove),n.removeEventListener(t,"touchend",this.touchend),n.removeEventListener(t,"touchcancel",this.reset),this.offTemp()},Ii.prototype.offTemp=function(){n.enableDrag(),n.removeEventListener(t.window,"mousemove",this.mousemove),n.removeEventListener(t.window,"mouseup",this.mouseup)},Ii.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),n.mousePos(this.element,e)),n.addEventListener(t.window,"mousemove",this.mousemove),n.addEventListener(t.window,"mouseup",this.mouseup)},Ii.prototype.mousemove=function(t){this.move(t,n.mousePos(this.element,t))},Ii.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()},Ii.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=n.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos))},Ii.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=n.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos))},Ii.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()},Ii.prototype.reset=function(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()};var ki={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function zi(t,e,n){var r=t.classList;for(var i in ki)r.remove("maplibregl-"+n+"-anchor-"+i,"mapboxgl-"+n+"-anchor-"+i);r.add("maplibregl-"+n+"-anchor-"+e,"mapboxgl-"+n+"-anchor-"+e)}var Di,Oi=function(e){function r(r,i){if(e.call(this),(r instanceof t.window.HTMLElement||i)&&(r=t.extend({element:r},i)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&"auto"!==r.pitchAlignment?r.pitchAlignment:this._rotationAlignment,r&&r.element)this._element=r.element,this._offset=t.Point.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=n.create("div"),this._element.setAttribute("aria-label","Map marker");var o=n.createNS("http://www.w3.org/2000/svg","svg");o.setAttributeNS(null,"display","block"),o.setAttributeNS(null,"height","41px"),o.setAttributeNS(null,"width","27px"),o.setAttributeNS(null,"viewBox","0 0 27 41");var a=n.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");var s=n.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");var l=n.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");for(var c=0,u=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];c<u.length;c+=1){var p=u[c],h=n.createNS("http://www.w3.org/2000/svg","ellipse");h.setAttributeNS(null,"opacity","0.04"),h.setAttributeNS(null,"cx","10.5"),h.setAttributeNS(null,"cy","5.80029008"),h.setAttributeNS(null,"rx",p.rx),h.setAttributeNS(null,"ry",p.ry),l.appendChild(h)}var d=n.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"fill",this._color);var f=n.createNS("http://www.w3.org/2000/svg","path");f.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),d.appendChild(f);var m=n.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"opacity","0.25"),m.setAttributeNS(null,"fill","#000000");var g=n.createNS("http://www.w3.org/2000/svg","path");g.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),m.appendChild(g);var y=n.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(6.0, 7.0)"),y.setAttributeNS(null,"fill","#FFFFFF");var v=n.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"transform","translate(8.0, 8.0)");var _=n.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#000000"),_.setAttributeNS(null,"opacity","0.25"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962");var x=n.createNS("http://www.w3.org/2000/svg","circle");x.setAttributeNS(null,"fill","#FFFFFF"),x.setAttributeNS(null,"cx","5.5"),x.setAttributeNS(null,"cy","5.5"),x.setAttributeNS(null,"r","5.4999962"),v.appendChild(_),v.appendChild(x),s.appendChild(l),s.appendChild(d),s.appendChild(m),s.appendChild(y),s.appendChild(v),o.appendChild(s),o.setAttributeNS(null,"height",41*this._scale+"px"),o.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(o),this._offset=t.Point.convert(r&&r.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",(function(t){t.preventDefault()})),this._element.addEventListener("mousedown",(function(t){t.preventDefault()})),zi(this._element,this._anchor,"marker"),this._popup=null}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.addTo=function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this},r.prototype.remove=function(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),n.remove(this._element),this._popup&&this._popup.remove(),this},r.prototype.getLngLat=function(){return this._lngLat},r.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},r.prototype.getElement=function(){return this._element},r.prototype.setPopup=function(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){var e=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[e,-1*(24.6+e)],"bottom-right":[-e,-1*(24.6+e)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this},r.prototype._onKeyPress=function(t){var e=t.code,n=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==n&&13!==n||this.togglePopup()},r.prototype._onMapClick=function(t){var e=t.originalEvent.target,n=this._element;this._popup&&(e===n||n.contains(e))&&this.togglePopup()},r.prototype.getPopup=function(){return this._popup},r.prototype.togglePopup=function(){var t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this},r.prototype._update=function(t){if(this._map){this._map.transform.renderWorldCopies&&(this._lngLat=Ri(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);var e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e="rotateZ("+this._rotation+"deg)":"map"===this._rotationAlignment&&(e="rotateZ("+(this._rotation-this._map.getBearing())+"deg)");var r="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?r="rotateX(0deg)":"map"===this._pitchAlignment&&(r="rotateX("+this._map.getPitch()+"deg)"),t&&"moveend"!==t.type||(this._pos=this._pos.round()),n.setTransform(this._element,ki[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px) "+r+" "+e)}},r.prototype.getOffset=function(){return this._offset},r.prototype.setOffset=function(e){return this._offset=t.Point.convert(e),this._update(),this},r.prototype._onMove=function(e){if(!this._isDragging){var n=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))},r.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"},r.prototype._addDragHandler=function(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},r.prototype.setDraggable=function(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},r.prototype.isDraggable=function(){return this._draggable},r.prototype.setRotation=function(t){return this._rotation=t||0,this._update(),this},r.prototype.getRotation=function(){return this._rotation},r.prototype.setRotationAlignment=function(t){return this._rotationAlignment=t||"auto",this._update(),this},r.prototype.getRotationAlignment=function(){return this._rotationAlignment},r.prototype.setPitchAlignment=function(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this},r.prototype.getPitchAlignment=function(){return this._pitchAlignment},r}(t.Evented),Fi={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Bi=0,Ni=!1,Ui=function(e){function r(n){e.call(this),this.options=t.extend({},Fi,n),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.onAdd=function(e){var r;return this._map=e,this._container=n.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),r=this._setupUI,void 0!==Di?r(Di):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then((function(t){r(Di="denied"!==t.state)})):r(Di=!!t.window.navigator.geolocation),this._container},r.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),n.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Bi=0,Ni=!1},r.prototype._isOutOfMapMaxBounds=function(t){var e=this._map.getMaxBounds(),n=t.coords;return e&&(n.longitude<e.getWest()||n.longitude>e.getEast()||n.latitude<e.getSouth()||n.latitude>e.getNorth())},r.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting")}},r.prototype._onSuccess=function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},r.prototype._updateCamera=function(e){var n=new t.LngLat(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,i=this._map.getBearing(),o=t.extend({bearing:i},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(r),o,{geolocateSource:!0})},r.prototype._updateMarker=function(e){if(e){var n=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},r.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),n=this._map.unproject([1,t]),r=e.distanceTo(n),i=Math.ceil(2*this._accuracy/r);this._circleElement.style.width=i+"px",this._circleElement.style.height=i+"px"},r.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},r.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Ni)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},r.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},r.prototype._setupUI=function(e){var r=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=n.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),n.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{var o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=n.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Oi(this._dotElement),this._circleElement=n.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Oi({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==r._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(r._watchState="BACKGROUND",r._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),r._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),r.fire(new t.Event("trackuserlocationend")))}))},r.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Bi--,Ni=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++Bi>1?(e={maximumAge:6e5,timeout:0},Ni=!0):(e=this.options.positionOptions,Ni=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},r.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},r}(t.Evented),ji={maxWidth:100,unit:"metric"},Vi=function(e){this.options=t.extend({},ji,e),t.bindAll(["_onMove","setUnit"],this)};function Gi(t,e,n){var r=n&&n.maxWidth||100,i=t._container.clientHeight/2,o=t.unproject([0,i]),a=t.unproject([r,i]),s=o.distanceTo(a);if(n&&"imperial"===n.unit){var l=3.2808*s;l>5280?Hi(e,r,l/5280,t._getUIString("ScaleControl.Miles")):Hi(e,r,l,t._getUIString("ScaleControl.Feet"))}else n&&"nautical"===n.unit?Hi(e,r,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?Hi(e,r,s/1e3,t._getUIString("ScaleControl.Kilometers")):Hi(e,r,s,t._getUIString("ScaleControl.Meters"))}function Hi(t,e,n,r){var i,o,a,s=(i=n,(o=Math.pow(10,(""+Math.floor(i)).length-1))*(a=(a=i/o)>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(a)));t.style.width=e*(s/n)+"px",t.innerHTML=s+"&nbsp;"+r}Vi.prototype.getDefaultPosition=function(){return"bottom-left"},Vi.prototype._onMove=function(){Gi(this._map,this._container,this.options)},Vi.prototype.onAdd=function(t){return this._map=t,this._container=n.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},Vi.prototype.onRemove=function(){n.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},Vi.prototype.setUnit=function(t){this.options.unit=t,Gi(this._map,this._container,this.options)};var Wi=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange")};Wi.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=n.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},Wi.prototype.onRemove=function(){n.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},Wi.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},Wi.prototype._setupUI=function(){var e=this._fullscreenButton=n.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);n.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},Wi.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},Wi.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},Wi.prototype._isFullscreen=function(){return this._fullscreen},Wi.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},Wi.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var qi={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Zi=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Xi=function(e){function r(n){e.call(this),this.options=t.extend(Object.create(qi),n),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.addTo=function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},r.prototype.isOpen=function(){return!!this._map},r.prototype.remove=function(){return this._content&&n.remove(this._content),this._container&&(n.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},r.prototype.getLngLat=function(){return this._lngLat},r.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this},r.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this},r.prototype.getElement=function(){return this._container},r.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},r.prototype.setHTML=function(e){var n,r=t.window.document.createDocumentFragment(),i=t.window.document.createElement("body");for(i.innerHTML=e;n=i.firstChild;)r.appendChild(n);return this.setDOMContent(r)},r.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},r.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},r.prototype.setDOMContent=function(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=n.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this},r.prototype.addClassName=function(t){this._container&&this._container.classList.add(t)},r.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t)},r.prototype.setOffset=function(t){return this.options.offset=t,this._update(),this},r.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},r.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=n.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))},r.prototype._onMouseUp=function(t){this._update(t.point)},r.prototype._onMouseMove=function(t){this._update(t.point)},r.prototype._onDrag=function(t){this._update(t.point)},r.prototype._update=function(e){var r=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=n.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=n.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return r._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ri(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var i=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),o=this.options.anchor,a=function e(n){if(n){if("number"==typeof n){var r=Math.round(Math.sqrt(.5*Math.pow(n,2)));return{center:new t.Point(0,0),top:new t.Point(0,n),"top-left":new t.Point(r,r),"top-right":new t.Point(-r,r),bottom:new t.Point(0,-n),"bottom-left":new t.Point(r,-r),"bottom-right":new t.Point(-r,-r),left:new t.Point(n,0),right:new t.Point(-n,0)}}if(n instanceof t.Point||Array.isArray(n)){var i=t.Point.convert(n);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.Point.convert(n.center||[0,0]),top:t.Point.convert(n.top||[0,0]),"top-left":t.Point.convert(n["top-left"]||[0,0]),"top-right":t.Point.convert(n["top-right"]||[0,0]),bottom:t.Point.convert(n.bottom||[0,0]),"bottom-left":t.Point.convert(n["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(n["bottom-right"]||[0,0]),left:t.Point.convert(n.left||[0,0]),right:t.Point.convert(n.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!o){var s,l=this._container.offsetWidth,c=this._container.offsetHeight;s=i.y+a.bottom.y<c?["top"]:i.y>this._map.transform.height-c?["bottom"]:[],i.x<l/2?s.push("left"):i.x>this._map.transform.width-l/2&&s.push("right"),o=0===s.length?"bottom":s.join("-")}var u=i.add(a[o]).round();n.setTransform(this._container,ki[o]+" translate("+u.x+"px,"+u.y+"px)"),zi(this._container,o,"popup")}},r.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var t=this._container.querySelector(Zi);t&&t.focus()}},r.prototype._onClose=function(){this.remove()},r}(t.Evented),$i={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:Ai,NavigationControl:Pi,GeolocateControl:Ui,AttributionControl:_i,ScaleControl:Vi,FullscreenControl:Wi,Popup:Xi,Marker:Oi,Style:Ge,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:function(){Bt().acquire(zt)},clearPrewarmedResources:function(){var t=Ot;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(zt),Ot=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return Dt.workerCount},set workerCount(t){Dt.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage:function(e){t.clearTileCache(e)},workerUrl:"",addProtocol:function(e,n){t.config.REGISTERED_PROTOCOLS[e]=n},removeProtocol:function(e){delete t.config.REGISTERED_PROTOCOLS[e]}};return $i}));return n}));!function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);throw(s=new Error("Cannot find module '"+a+"'")).code="MODULE_NOT_FOUND",s}l=n[a]={exports:{}},e[a][0].call(l.exports,(function(t){return i(e[a][1][t]||t)}),l,l.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){"use strict";var r=t("@mapbox/mapbox-gl-sync-move"),i=t("events").EventEmitter;function o(t,e,n,o){if(this.options=o||{},this._mapA=t,this._mapB=e,this._horizontal="horizontal"===this.options.orientation,this._onDown=this._onDown.bind(this),this._onMove=this._onMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._ev=new i,this._swiper=document.createElement("div"),this._swiper.className=this._horizontal?"compare-swiper-horizontal":"compare-swiper-vertical",this._controlContainer=document.createElement("div"),this._controlContainer.className=this._horizontal?"maplibregl-compare maplibregl-compare-horizontal":"maplibregl-compare",this._controlContainer.className=this._controlContainer.className,this._controlContainer.appendChild(this._swiper),"string"==typeof n&&document.body.querySelectorAll){if(!(o=document.body.querySelectorAll(n)[0]))throw new Error("Cannot find element with specified container selector.");o.appendChild(this._controlContainer)}else{if(!(n instanceof Element&&n.appendChild))throw new Error("Invalid container specified. Must be CSS selector or HTML element.");n.appendChild(this._controlContainer)}this._bounds=e.getContainer().getBoundingClientRect();o=(this._horizontal?this._bounds.height:this._bounds.width)/2;this._setPosition(o),this._clearSync=r(t,e),this._onResize=function(){this._bounds=e.getContainer().getBoundingClientRect(),this.currentPosition&&this._setPosition(this.currentPosition)}.bind(this),e.on("resize",this._onResize),this.options&&this.options.mousemove&&(t.getContainer().addEventListener("mousemove",this._onMove),e.getContainer().addEventListener("mousemove",this._onMove)),this._swiper.addEventListener("mousedown",this._onDown),this._swiper.addEventListener("touchstart",this._onDown)}o.prototype={_setPointerEvents:function(t){this._controlContainer.style.pointerEvents=t,this._swiper.style.pointerEvents=t},_onDown:function(t){t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp))},_setPosition:function(t){t=Math.min(t,this._horizontal?this._bounds.height:this._bounds.width);var e=this._horizontal?"translate(0, "+t+"px)":"translate("+t+"px, 0)",n=(e=(this._controlContainer.style.transform=e,this._controlContainer.style.WebkitTransform=e,this._horizontal?"rect(0, 999em, "+t+"px, 0)":"rect(0, "+t+"px, "+this._bounds.height+"px, 0)"),this._horizontal?"rect("+t+"px, 999em, "+this._bounds.height+"px,0)":"rect(0, 999em, "+this._bounds.height+"px,"+t+"px)");this._mapA.getContainer().style.clip=e,this._mapB.getContainer().style.clip=n,this.currentPosition=t},_onMove:function(t){this.options&&this.options.mousemove&&this._setPointerEvents(t.touches?"auto":"none"),this._horizontal?this._setPosition(this._getY(t)):this._setPosition(this._getX(t))},_onMouseUp:function(){document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp),this.fire("slideend",{currentPosition:this.currentPosition})},_onTouchEnd:function(){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd),this.fire("slideend",{currentPosition:this.currentPosition})},_getX:function(t){return(t=(t=(t=t.touches?t.touches[0]:t).clientX-this._bounds.left)<0?0:t)>this._bounds.width?this._bounds.width:t},_getY:function(t){return(t=(t=(t=t.touches?t.touches[0]:t).clientY-this._bounds.top)<0?0:t)>this._bounds.height?this._bounds.height:t},setSlider:function(t){this._setPosition(t)},on:function(t,e){return this._ev.on(t,e),this},fire:function(t,e){return this._ev.emit(t,e),this},off:function(t,e){return this._ev.removeListener(t,e),this},remove:function(){this._clearSync(),this._mapB.off("resize",this._onResize);var t;(t=((t=this._mapA.getContainer())&&(t.style.clip=null,t.removeEventListener("mousemove",this._onMove)),this._mapB.getContainer()))&&(t.style.clip=null,t.removeEventListener("mousemove",this._onMove)),this._swiper.removeEventListener("mousedown",this._onDown),this._swiper.removeEventListener("touchstart",this._onDown),this._controlContainer.remove()}},window.maplibregl?maplibregl.Compare=o:void 0!==e&&(e.exports=o)},{"@mapbox/mapbox-gl-sync-move":2,events:3}],2:[function(t,e,n){e.exports=function(){var t=arguments.length;if(1===t)e=arguments[0];else for(var e=[],n=0;n<t;n++)e.push(arguments[n]);var r=[];function i(){e.forEach((function(t,e){t.on("move",r[e])}))}function o(){e.forEach((function(t,e){t.off("move",r[e])}))}return e.forEach((function(t,n){r[n]=function(t,e){o(),function(t,e){var n=t.getCenter(),r=t.getZoom(),i=t.getBearing(),o=t.getPitch();e.forEach((function(t){t.jumpTo({center:n,zoom:r,bearing:i,pitch:o})}))}(t,e),i()}.bind(null,t,e.filter((function(t,e){return e!==n})))})),i(),function(){o(),r=[]}}},{}],3:[function(t,e,n){"use strict";var r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)},o=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)},a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}var a,s,l;g(t,e,o,{once:!0}),"error"!==e&&(s=i,l={once:!0},"function"==typeof(a=t).on&&g(a,"error",s,l))}))},(s.EventEmitter=s).prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function p(t,e,n,r){var i,o;return c(n),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,n.listener||n),i=t._events),o=i[e]),void 0===o?(o=i[e]=n,++t._eventsCount):("function"==typeof o?o=i[e]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),0<(i=u(t))&&o.length>i&&!o.warned&&(o.warned=!0,(r=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",r.emitter=t,r.type=e,r.count=o.length,n=r,console&&console.warn&&console.warn(n))),t}function h(t,e,n){e=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(t={fired:!1,wrapFn:void 0,target:t,type:e,listener:n});return e.listener=n,t.wrapFn=e}function d(t,e,n){if(void 0===(t=t._events))return[];if(void 0===(t=t[e]))return[];if("function"==typeof t)return n?[t.listener||t]:[t];if(n){for(var r=t,i=new Array(r.length),o=0;o<i.length;++o)i[o]=r[o].listener||r[o];return i}return m(t,t.length)}function f(t){var e=this._events;if(void 0!==e){if("function"==typeof(e=e[t]))return 1;if(void 0!==e)return e.length}return 0}function m(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function g(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){r.once&&t.removeEventListener(e,i),n(o)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");l=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){if((a=0<e.length?e[0]:a)instanceof Error)throw a;throw(r=new Error("Unhandled error."+(a?" ("+a.message+")":""))).context=a,r}var a=o[t];if(void 0===a)return!1;if("function"==typeof a)i(a,this,e);else{var s=a.length,l=m(a,s);for(n=0;n<s;++n)i(l[n],this,e)}return!0},s.prototype.on=s.prototype.addListener=function(t,e){return p(this,t,e,!1)},s.prototype.prependListener=function(t,e){return p(this,t,e,!0)},s.prototype.once=function(t,e){return c(e),this.on(t,h(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,h(this,t,e)),this},s.prototype.off=s.prototype.removeListener=function(t,e){var n,r,i,o,a;if(c(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;0<=o;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;if(0===i)n.shift();else{for(var s=n,l=i;l+1<s.length;l++)s[l]=s[l+1];s.pop()}1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,a||e)}return this},s.prototype.removeAllListeners=function(t){var e,n=this._events;if(void 0===n)return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(o=e.length-1;0<=o;o--)this.removeListener(t,e[o]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return 0<this._eventsCount?o(this._events):[]}},{}]},{},[1]);!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MapboxDirections=t()}}((function(){return function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};e[a][0].call(u.exports,(function(t){return i(e[a][1][t]||t)}),u,u.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){"use strict";var r={};function i(t){return Math.floor(Math.abs(t)+.5)*(t>=0?1:-1)}function o(t,e,n){var r=(t=i(t*n))-(e=i(e*n));r<<=1;t-e<0&&(r=~r);for(var o="";r>=32;){o+=String.fromCharCode(63+(32|31&r));r>>=5}return o+=String.fromCharCode(r+63)}r.decode=function(t,e){for(var n,r=0,i=0,o=0,a=[],s=0,l=0,c=null,u=Math.pow(10,Number.isInteger(e)?e:5);r<t.length;){c=null;s=0;l=0;do{l|=(31&(c=t.charCodeAt(r++)-63))<<s;s+=5}while(c>=32);n=1&l?~(l>>1):l>>1;s=l=0;do{l|=(31&(c=t.charCodeAt(r++)-63))<<s;s+=5}while(c>=32);i+=n;o+=1&l?~(l>>1):l>>1;a.push([i/u,o/u])}return a};r.encode=function(t,e){if(!t.length)return"";for(var n=Math.pow(10,Number.isInteger(e)?e:5),r=o(t[0][0],0,n)+o(t[0][1],0,n),i=1;i<t.length;i++){var a=t[i],s=t[i-1];r+=o(a[0],s[0],n);r+=o(a[1],s[1],n)}return r};function a(t){for(var e=[],n=0;n<t.length;n++){var r=t[n].slice();e.push([r[1],r[0]])}return e}r.fromGeoJSON=function(t,e){t&&"Feature"===t.type&&(t=t.geometry);if(!t||"LineString"!==t.type)throw new Error("Input must be a GeoJSON LineString");return r.encode(a(t.coordinates),e)};r.toGeoJSON=function(t,e){return{type:"LineString",coordinates:a(r.decode(t,e))}};"object"==typeof e&&e.exports&&(e.exports=r)},{}],2:[function(t,e,n){"use strict";var r=t("is-obj"),i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(t,e,n){var o=e[n];if(null!=o){if(i.call(t,n)&&(void 0===t[n]||null===t[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");i.call(t,n)&&r(o)?t[n]=s(Object(t[n]),e[n]):t[n]=o}}function s(t,e){if(t===e)return t;e=Object(e);for(var n in e)i.call(e,n)&&a(t,e,n);if(Object.getOwnPropertySymbols)for(var r=Object.getOwnPropertySymbols(e),s=0;s<r.length;s++)o.call(e,r[s])&&a(t,e,r[s]);return t}e.exports=function(t){t=function(t){if(null==t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}(t);for(var e=1;e<arguments.length;e++)s(t,arguments[e]);return t}},{"is-obj":5}],3:[function(t,e,n){function r(){this._events=this._events||{};this._maxListeners=this._maxListeners||void 0}e.exports=r;r.EventEmitter=r;r.prototype._events=void 0;r.prototype._maxListeners=void 0;r.defaultMaxListeners=10;r.prototype.setMaxListeners=function(t){if(!(e=t,"number"==typeof e)||t<0||isNaN(t))throw TypeError("n must be a positive number");var e;this._maxListeners=t;return this};r.prototype.emit=function(t){var e,n,r,s,l,c;this._events||(this._events={});if("error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");u.context=e;throw u}if(a(n=this._events[t]))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1);n.apply(this,s)}else if(o(n)){s=Array.prototype.slice.call(arguments,1);r=(c=n.slice()).length;for(l=0;l<r;l++)c[l].apply(this,s)}return!0};r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");this._events||(this._events={});this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e);this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e;if(o(this._events[t])&&!this._events[t].warned&&(n=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[t].length>n){this._events[t].warned=!0;console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length);"function"==typeof console.trace&&console.trace()}return this};r.prototype.on=r.prototype.addListener;r.prototype.once=function(t,e){if(!i(e))throw TypeError("listener must be a function");var n=!1;function r(){this.removeListener(t,r);if(!n){n=!0;e.apply(this,arguments)}}r.listener=e;this.on(t,r);return this};r.prototype.removeListener=function(t,e){var n,r,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;a=(n=this._events[t]).length;r=-1;if(n===e||i(n.listener)&&n.listener===e){delete this._events[t];this._events.removeListener&&this.emit("removeListener",t,e)}else if(o(n)){for(s=a;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){r=s;break}if(r<0)return this;if(1===n.length){n.length=0;delete this._events[t]}else n.splice(r,1);this._events.removeListener&&this.emit("removeListener",t,e)}return this};r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener){0===arguments.length?this._events={}:this._events[t]&&delete this._events[t];return this}if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);this.removeAllListeners("removeListener");this._events={};return this}if(i(n=this._events[t]))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);delete this._events[t];return this};r.prototype.listeners=function(t){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]};r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0};r.listenerCount=function(t,e){return t.listenerCount(e)};function i(t){return"function"==typeof t}function o(t){return"object"==typeof t&&null!==t}function a(t){return void 0===t}},{}],4:[function(t,e,n){!function(){var t={};void 0!==n?e.exports=t:this.fuzzy=t;t.simpleFilter=function(e,n){return n.filter((function(n){return t.test(e,n)}))};t.test=function(e,n){return null!==t.match(e,n)};t.match=function(t,e,n){n=n||{};var r,i=0,o=[],a=e.length,s=0,l=0,c=n.pre||"",u=n.post||"",p=n.caseSensitive&&e||e.toLowerCase();t=n.caseSensitive&&t||t.toLowerCase();for(var h=0;h<a;h++){r=e[h];if(p[h]===t[i]){r=c+r+u;i+=1;l+=1+l}else l=0;s+=l;o[o.length]=r}if(i===t.length){s=p===t?1/0:s;return{rendered:o.join(""),score:s}}return null};t.filter=function(e,n,r){if(!n||0===n.length)return[];if("string"!=typeof e)return n;r=r||{};return n.reduce((function(n,i,o,a){var s=i;r.extract&&(s=r.extract(i));var l=t.match(e,s,r);null!=l&&(n[n.length]={string:l.rendered,score:l.score,index:o,original:i});return n}),[]).sort((function(t,e){var n=e.score-t.score;return n||t.index-e.index}))}}()},{}],5:[function(t,e,n){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],6:[function(t,e,n){e.exports=/<%=([\s\S]+?)%>/g},{}],7:[function(t,e,n){(function(t){var n=NaN,r="[object Symbol]",i=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt,c="object"==typeof t&&t&&t.Object===Object&&t,u="object"==typeof self&&self&&self.Object===Object&&self,p=c||u||Function("return this")(),h=Object.prototype.toString,d=Math.max,f=Math.min,m=function(){return p.Date.now()};function g(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function y(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&h.call(t)==r}(t))return n;if(g(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=g(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(i,"");var c=a.test(t);return c||s.test(t)?l(t.slice(2),c?2:8):o.test(t)?n:+t}e.exports=function(t,e,n){var r,i,o,a,s,l,c=0,u=!1,p=!1,h=!0;if("function"!=typeof t)throw new TypeError("Expected a function");e=y(e)||0;if(g(n)){u=!!n.leading;o=(p="maxWait"in n)?d(y(n.maxWait)||0,e):o;h="trailing"in n?!!n.trailing:h}function v(e){var n=r,o=i;r=i=void 0;c=e;return a=t.apply(o,n)}function _(t){var n=t-l;return void 0===l||n>=e||n<0||p&&t-c>=o}function x(){var t=m();if(_(t))return b(t);s=setTimeout(x,function(t){var n=e-(t-l);return p?f(n,o-(t-c)):n}(t))}function b(t){s=void 0;if(h&&r)return v(t);r=i=void 0;return a}function w(){var t=m(),n=_(t);r=arguments;i=this;l=t;if(n){if(void 0===s)return function(t){c=t;s=setTimeout(x,e);return u?v(t):a}(l);if(p){s=setTimeout(x,e);return v(l)}}void 0===s&&(s=setTimeout(x,e));return a}w.cancel=function(){void 0!==s&&clearTimeout(s);c=0;r=l=i=s=void 0};w.flush=function(){return void 0===s?a:b(m())};return w}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(t,e,n){(function(t){var r="__lodash_hash_undefined__",i=1,o=2,a=9007199254740991,s="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",p="[object Date]",h="[object Error]",d="[object Function]",f="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Null]",v="[object Object]",_="[object Promise]",x="[object Proxy]",b="[object RegExp]",w="[object Set]",M="[object String]",S="[object Symbol]",T="[object Undefined]",E="[object WeakMap]",A="[object ArrayBuffer]",C="[object DataView]",L=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,I={};I["[object Float32Array]"]=I["[object Float64Array]"]=I["[object Int8Array]"]=I["[object Int16Array]"]=I["[object Int32Array]"]=I["[object Uint8Array]"]=I["[object Uint8ClampedArray]"]=I["[object Uint16Array]"]=I["[object Uint32Array]"]=!0;I[s]=I[l]=I[A]=I[u]=I[C]=I[p]=I[h]=I[d]=I[m]=I[g]=I[v]=I[b]=I[w]=I[M]=I[E]=!1;var R="object"==typeof t&&t&&t.Object===Object&&t,k="object"==typeof self&&self&&self.Object===Object&&self,z=R||k||Function("return this")(),D="object"==typeof n&&n&&!n.nodeType&&n,O=D&&"object"==typeof e&&e&&!e.nodeType&&e,F=O&&O.exports===D,B=F&&R.process,N=function(){try{return B&&B.binding&&B.binding("util")}catch(t){}}(),U=N&&N.isTypedArray;function j(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function V(t){var e=-1,n=Array(t.size);t.forEach((function(t,r){n[++e]=[r,t]}));return n}function G(t){var e=-1,n=Array(t.size);t.forEach((function(t){n[++e]=t}));return n}var H,W,q,Z=Array.prototype,X=Function.prototype,$=Object.prototype,J=z["__core-js_shared__"],Y=X.toString,Q=$.hasOwnProperty,K=(H=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||""))?"Symbol(src)_1."+H:"",tt=$.toString,et=RegExp("^"+Y.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=F?z.Buffer:void 0,rt=z.Symbol,it=z.Uint8Array,ot=$.propertyIsEnumerable,at=Z.splice,st=rt?rt.toStringTag:void 0,lt=Object.getOwnPropertySymbols,ct=nt?nt.isBuffer:void 0,ut=(W=Object.keys,q=Object,function(t){return W(q(t))}),pt=Nt(z,"DataView"),ht=Nt(z,"Map"),dt=Nt(z,"Promise"),ft=Nt(z,"Set"),mt=Nt(z,"WeakMap"),gt=Nt(Object,"create"),yt=Gt(pt),vt=Gt(ht),_t=Gt(dt),xt=Gt(ft),bt=Gt(mt),wt=rt?rt.prototype:void 0,Mt=wt?wt.valueOf:void 0;function St(t){var e=-1,n=null==t?0:t.length;this.clear();for(;++e<n;){var r=t[e];this.set(r[0],r[1])}}St.prototype.clear=function(){this.__data__=gt?gt(null):{};this.size=0};St.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];this.size-=e?1:0;return e};St.prototype.get=function(t){var e=this.__data__;if(gt){var n=e[t];return n===r?void 0:n}return Q.call(e,t)?e[t]:void 0};St.prototype.has=function(t){var e=this.__data__;return gt?void 0!==e[t]:Q.call(e,t)};St.prototype.set=function(t,e){var n=this.__data__;this.size+=this.has(t)?0:1;n[t]=gt&&void 0===e?r:e;return this};function Tt(t){var e=-1,n=null==t?0:t.length;this.clear();for(;++e<n;){var r=t[e];this.set(r[0],r[1])}}Tt.prototype.clear=function(){this.__data__=[];this.size=0};Tt.prototype.delete=function(t){var e=this.__data__,n=Pt(e,t);if(n<0)return!1;n==e.length-1?e.pop():at.call(e,n,1);--this.size;return!0};Tt.prototype.get=function(t){var e=this.__data__,n=Pt(e,t);return n<0?void 0:e[n][1]};Tt.prototype.has=function(t){return Pt(this.__data__,t)>-1};Tt.prototype.set=function(t,e){var n=this.__data__,r=Pt(n,t);if(r<0){++this.size;n.push([t,e])}else n[r][1]=e;return this};function Et(t){var e=-1,n=null==t?0:t.length;this.clear();for(;++e<n;){var r=t[e];this.set(r[0],r[1])}}Et.prototype.clear=function(){this.size=0;this.__data__={hash:new St,map:new(ht||Tt),string:new St}};Et.prototype.delete=function(t){var e=Bt(this,t).delete(t);this.size-=e?1:0;return e};Et.prototype.get=function(t){return Bt(this,t).get(t)};Et.prototype.has=function(t){return Bt(this,t).has(t)};Et.prototype.set=function(t,e){var n=Bt(this,t),r=n.size;n.set(t,e);this.size+=n.size==r?0:1;return this};function At(t){var e=-1,n=null==t?0:t.length;this.__data__=new Et;for(;++e<n;)this.add(t[e])}At.prototype.add=At.prototype.push=function(t){this.__data__.set(t,r);return this};At.prototype.has=function(t){return this.__data__.has(t)};function Ct(t){var e=this.__data__=new Tt(t);this.size=e.size}Ct.prototype.clear=function(){this.__data__=new Tt;this.size=0};Ct.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);this.size=e.size;return n};Ct.prototype.get=function(t){return this.__data__.get(t)};Ct.prototype.has=function(t){return this.__data__.has(t)};Ct.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Tt){var r=n.__data__;if(!ht||r.length<199){r.push([t,e]);this.size=++n.size;return this}n=this.__data__=new Et(r)}n.set(t,e);this.size=n.size;return this};function Lt(t,e){var n=qt(t),r=!n&&Wt(t),i=!n&&!r&&Zt(t),o=!n&&!r&&!i&&Qt(t),a=n||r||i||o,s=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],l=s.length;for(var c in t)!e&&!Q.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Vt(c,l))||s.push(c);return s}function Pt(t,e){for(var n=t.length;n--;)if(Ht(t[n][0],e))return n;return-1}function It(t){return null==t?void 0===t?T:y:st&&st in Object(t)?function(t){var e=Q.call(t,st),n=t[st];try{t[st]=void 0;var r=!0}catch(t){}var i=tt.call(t);r&&(e?t[st]=n:delete t[st]);return i}(t):function(t){return tt.call(t)}(t)}function Rt(t){return Yt(t)&&It(t)==s}function kt(t,e,n,r,a){return t===e||(null==t||null==e||!Yt(t)&&!Yt(e)?t!=t&&e!=e:function(t,e,n,r,a,c){var d=qt(t),f=qt(e),y=d?l:jt(t),_=f?l:jt(e),x=(y=y==s?v:y)==v,T=(_=_==s?v:_)==v,E=y==_;if(E&&Zt(t)){if(!Zt(e))return!1;d=!0;x=!1}if(E&&!x){c||(c=new Ct);return d||Qt(t)?Ot(t,e,n,r,a,c):function(t,e,n,r,a,s,l){switch(n){case C:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer;e=e.buffer;case A:return!(t.byteLength!=e.byteLength||!s(new it(t),new it(e)));case u:case p:case g:return Ht(+t,+e);case h:return t.name==e.name&&t.message==e.message;case b:case M:return t==e+"";case m:var c=V;case w:var d=r&i;c||(c=G);if(t.size!=e.size&&!d)return!1;var f=l.get(t);if(f)return f==e;r|=o;l.set(t,e);var y=Ot(c(t),c(e),r,a,s,l);l.delete(t);return y;case S:if(Mt)return Mt.call(t)==Mt.call(e)}return!1}(t,e,y,n,r,a,c)}if(!(n&i)){var L=x&&Q.call(t,"__wrapped__"),P=T&&Q.call(e,"__wrapped__");if(L||P){var I=L?t.value():t,R=P?e.value():e;c||(c=new Ct);return a(I,R,n,r,c)}}if(!E)return!1;c||(c=new Ct);return function(t,e,n,r,o,a){var s=n&i,l=Ft(t),c=l.length,u=Ft(e),p=u.length;if(c!=p&&!s)return!1;var h=c;for(;h--;){var d=l[h];if(!(s?d in e:Q.call(e,d)))return!1}var f=a.get(t);if(f&&a.get(e))return f==e;var m=!0;a.set(t,e);a.set(e,t);var g=s;for(;++h<c;){var y=t[d=l[h]],v=e[d];if(r)var _=s?r(v,y,d,e,t,a):r(y,v,d,t,e,a);if(!(void 0===_?y===v||o(y,v,n,r,a):_)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var x=t.constructor,b=e.constructor;x==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(m=!1)}a.delete(t);a.delete(e);return m}(t,e,n,r,a,c)}(t,e,n,r,kt,a))}function zt(t){return!(!Jt(t)||function(t){return!!K&&K in t}(t))&&(Xt(t)?et:L).test(Gt(t))}function Dt(t){if(!(e=t,n=e&&e.constructor,r="function"==typeof n&&n.prototype||$,e===r))return ut(t);var e,n,r,i=[];for(var o in Object(t))Q.call(t,o)&&"constructor"!=o&&i.push(o);return i}function Ot(t,e,n,r,a,s){var l=n&i,c=t.length,u=e.length;if(c!=u&&!(l&&u>c))return!1;var p=s.get(t);if(p&&s.get(e))return p==e;var h=-1,d=!0,f=n&o?new At:void 0;s.set(t,e);s.set(e,t);for(;++h<c;){var m=t[h],g=e[h];if(r)var y=l?r(g,m,h,e,t,s):r(m,g,h,t,e,s);if(void 0!==y){if(y)continue;d=!1;break}if(f){if(!j(e,(function(t,e){if(!(i=f,o=e,i.has(o))&&(m===t||a(m,t,n,r,s)))return f.push(e);var i,o}))){d=!1;break}}else if(m!==g&&!a(m,g,n,r,s)){d=!1;break}}s.delete(t);s.delete(e);return d}function Ft(t){return function(t,e,n){var r=e(t);return qt(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,Kt,Ut)}function Bt(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function Nt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return zt(n)?n:void 0}var Ut=lt?function(t){if(null==t)return[];t=Object(t);return function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}(lt(t),(function(e){return ot.call(t,e)}))}:function(){return[]},jt=It;(pt&&jt(new pt(new ArrayBuffer(1)))!=C||ht&&jt(new ht)!=m||dt&&jt(dt.resolve())!=_||ft&&jt(new ft)!=w||mt&&jt(new mt)!=E)&&(jt=function(t){var e=It(t),n=e==v?t.constructor:void 0,r=n?Gt(n):"";if(r)switch(r){case yt:return C;case vt:return m;case _t:return _;case xt:return w;case bt:return E}return e});function Vt(t,e){return!!(e=null==e?a:e)&&("number"==typeof t||P.test(t))&&t>-1&&t%1==0&&t<e}function Gt(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ht(t,e){return t===e||t!=t&&e!=e}var Wt=Rt(function(){return arguments}())?Rt:function(t){return Yt(t)&&Q.call(t,"callee")&&!ot.call(t,"callee")},qt=Array.isArray;var Zt=ct||function(){return!1};function Xt(t){if(!Jt(t))return!1;var e=It(t);return e==d||e==f||e==c||e==x}function $t(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=a}function Jt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Yt(t){return null!=t&&"object"==typeof t}var Qt=U?function(t){return function(e){return t(e)}}(U):function(t){return Yt(t)&&$t(t.length)&&!!I[It(t)]};function Kt(t){return null!=(e=t)&&$t(e.length)&&!Xt(e)?Lt(t):Dt(t);var e}e.exports=function(t,e){return kt(t,e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(t,e,n){(function(r){var i=t("lodash._reinterpolate"),o=t("lodash.templatesettings"),a=1/0,s=9007199254740991,l="[object Arguments]",c="[object AsyncFunction]",u="[object DOMException]",p="[object Error]",h="[object Function]",d="[object GeneratorFunction]",f="[object Null]",m="[object Object]",g="[object Proxy]",y="[object Symbol]",v="[object Undefined]",_=/\b__p \+= '';/g,x=/\b(__p \+=) '' \+/g,b=/(__e\(.*?\)|\b__t\)) \+\n'';/g,w=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,M=/^\[object .+?Constructor\]$/,S=/^(?:0|[1-9]\d*)$/,T=/($^)/,E=/['\n\r\u2028\u2029\\]/g,A={};A["[object Float32Array]"]=A["[object Float64Array]"]=A["[object Int8Array]"]=A["[object Int16Array]"]=A["[object Int32Array]"]=A["[object Uint8Array]"]=A["[object Uint8ClampedArray]"]=A["[object Uint16Array]"]=A["[object Uint32Array]"]=!0;A[l]=A["[object Array]"]=A["[object ArrayBuffer]"]=A["[object Boolean]"]=A["[object DataView]"]=A["[object Date]"]=A[p]=A[h]=A["[object Map]"]=A["[object Number]"]=A[m]=A["[object RegExp]"]=A["[object Set]"]=A["[object String]"]=A["[object WeakMap]"]=!1;var C={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},L="object"==typeof r&&r&&r.Object===Object&&r,P="object"==typeof self&&self&&self.Object===Object&&self,I=L||P||Function("return this")(),R="object"==typeof n&&n&&!n.nodeType&&n,k=R&&"object"==typeof e&&e&&!e.nodeType&&e,z=k&&k.exports===R,D=z&&L.process,O=function(){try{var t=k&&k.require&&k.require("util").types;return t||D&&D.binding&&D.binding("util")}catch(t){}}(),F=O&&O.isTypedArray;function B(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function N(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function U(t){return"\\"+C[t]}function j(t,e){return function(n){return t(e(n))}}var V,G=Function.prototype,H=Object.prototype,W=I["__core-js_shared__"],q=G.toString,Z=H.hasOwnProperty,X=(V=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",$=H.toString,J=q.call(Object),Y=RegExp("^"+q.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Q=z?I.Buffer:void 0,K=I.Symbol,tt=j(Object.getPrototypeOf,Object),et=H.propertyIsEnumerable,nt=K?K.toStringTag:void 0,rt=function(){try{var t=function(t){if(!Dt(t)||function(t){return!!X&&X in t}(t))return!1;var e=kt(t)?Y:M;return e.test(function(t){if(null!=t){try{return q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(e=function(t,e){return null==t?void 0:t[e]}(Object,"defineProperty"))?e:void 0;t({},"",{});return t}catch(t){}var e}(),it=Q?Q.isBuffer:void 0,ot=j(Object.keys,Object),at=Math.max,st=Date.now,lt=K?K.prototype:void 0,ct=lt?lt.toString:void 0;function ut(t,e){var n=Lt(t),r=!n&&Ct(t),i=!n&&!r&&It(t),o=!n&&!r&&!i&&Ft(t),a=n||r||i||o,s=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],l=s.length;for(var c in t)!e&&!Z.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||xt(c,l))||s.push(c);return s}function pt(t,e,n){var r=t[e];Z.call(t,e)&&At(r,n)&&(void 0!==n||e in t)||ht(t,e,n)}function ht(t,e,n){"__proto__"==e&&rt?rt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function dt(t){return null==t?void 0===t?v:f:nt&&nt in Object(t)?function(t){var e=Z.call(t,nt),n=t[nt];try{t[nt]=void 0;var r=!0}catch(t){}var i=$.call(t);r&&(e?t[nt]=n:delete t[nt]);return i}(t):function(t){return $.call(t)}(t)}function ft(t){return Ot(t)&&dt(t)==l}function mt(t){if(!Dt(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=wt(t),n=[];for(var r in t)("constructor"!=r||!e&&Z.call(t,r))&&n.push(r);return n}function gt(t,e){return Et(function(t,e,n){e=at(void 0===e?t.length-1:e,0);return function(){for(var r=arguments,i=-1,o=at(r.length-e,0),a=Array(o);++i<o;)a[i]=r[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=r[i];s[e]=n(a);return B(t,this,s)}}(t,e,Vt),t+"")}var yt=rt?function(t,e){return rt(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Vt;function vt(t){if("string"==typeof t)return t;if(Lt(t))return N(t,vt)+"";if(function(t){return"symbol"==typeof t||Ot(t)&&dt(t)==y}(t))return ct?ct.call(t):"";var e=t+"";return"0"==e&&1/t==-a?"-0":e}function _t(t,e,n,r){return void 0===t||At(t,H[n])&&!Z.call(r,n)?e:t}function xt(t,e){var n=typeof t;return!!(e=null==e?s:e)&&("number"==n||"symbol"!=n&&S.test(t))&&t>-1&&t%1==0&&t<e}function bt(t,e,n){if(!Dt(n))return!1;var r=typeof e;return!!("number"==r?Pt(n)&&xt(e,n.length):"string"==r&&e in n)&&At(n[e],t)}function wt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||H)}var Mt,St,Tt,Et=(Mt=yt,St=0,Tt=0,function(){var t=st(),e=16-(t-Tt);Tt=t;if(e>0){if(++St>=800)return arguments[0]}else St=0;return Mt.apply(void 0,arguments)});function At(t,e){return t===e||t!=t&&e!=e}var Ct=ft(function(){return arguments}())?ft:function(t){return Ot(t)&&Z.call(t,"callee")&&!et.call(t,"callee")},Lt=Array.isArray;function Pt(t){return null!=t&&zt(t.length)&&!kt(t)}var It=it||function(){return!1};function Rt(t){if(!Ot(t))return!1;var e=dt(t);return e==p||e==u||"string"==typeof t.message&&"string"==typeof t.name&&!function(t){if(!Ot(t)||dt(t)!=m)return!1;var e=tt(t);if(null===e)return!0;var n=Z.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&q.call(n)==J}(t)}function kt(t){if(!Dt(t))return!1;var e=dt(t);return e==h||e==d||e==c||e==g}function zt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=s}function Dt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ot(t){return null!=t&&"object"==typeof t}var Ft=F?function(t){return function(e){return t(e)}}(F):function(t){return Ot(t)&&zt(t.length)&&!!A[dt(t)]};var Bt,Nt=(Bt=function(t,e,n,r){!function(t,e,n,r){var i=!n;n||(n={});for(var o=-1,a=e.length;++o<a;){var s=e[o],l=r?r(n[s],t[s],s,n,t):void 0;void 0===l&&(l=t[s]);i?ht(n,s,l):pt(n,s,l)}}(e,function(t){return Pt(t)?ut(t,!0):mt(t)}(e),t,r)},gt((function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,o=r>2?e[2]:void 0;i=Bt.length>3&&"function"==typeof i?(r--,i):void 0;if(o&&bt(e[0],e[1],o)){i=r<3?void 0:i;r=1}t=Object(t);for(;++n<r;){var a=e[n];a&&Bt(t,a,n,i)}return t})));function Ut(t){return Pt(t)?ut(t):function(t){if(!wt(t))return ot(t);var e=[];for(var n in Object(t))Z.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}var jt=gt((function(t,e){try{return B(t,void 0,e)}catch(t){return Rt(t)?t:new Error(t)}}));function Vt(t){return t}e.exports=function(t,e,n){var r,a=o.imports._.templateSettings||o;n&&bt(t,e,n)&&(e=void 0);t=null==(r=t)?"":vt(r);e=Nt({},e,a,_t);var s,l,c,u=Nt({},e.imports,a.imports,_t),p=Ut(u),h=(s=u,N(p,(function(t){return s[t]}))),d=0,f=e.interpolate||T,m="__p += '",g=RegExp((e.escape||T).source+"|"+f.source+"|"+(f===i?w:T).source+"|"+(e.evaluate||T).source+"|$","g"),y=Z.call(e,"sourceURL")?"//# sourceURL="+(e.sourceURL+"").replace(/[\r\n]/g," ")+"\n":"";t.replace(g,(function(e,n,r,i,o,a){r||(r=i);m+=t.slice(d,a).replace(E,U);if(n){l=!0;m+="' +\n__e("+n+") +\n'"}if(o){c=!0;m+="';\n"+o+";\n__p += '"}r&&(m+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'");d=a+e.length;return e}));m+="';\n";var v=Z.call(e,"variable")&&e.variable;v||(m="with (obj) {\n"+m+"\n}\n");m=(c?m.replace(_,""):m).replace(x,"$1").replace(b,"$1;");m="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(l?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+m+"return __p\n}";var M=jt((function(){return Function(p,y+"return "+m).apply(void 0,h)}));M.source=m;if(Rt(M))throw M;return M}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._reinterpolate":6,"lodash.templatesettings":10}],10:[function(t,e,n){(function(n){var r=t("lodash._reinterpolate"),i=1/0,o="[object Null]",a="[object Symbol]",s="[object Undefined]",l=/[&<>"']/g,c=RegExp(l.source),u="object"==typeof n&&n&&n.Object===Object&&n,p="object"==typeof self&&self&&self.Object===Object&&self,h=u||p||Function("return this")();var d,f=(d={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},function(t){return null==d?void 0:d[t]}),m=Object.prototype,g=m.hasOwnProperty,y=m.toString,v=h.Symbol,_=v?v.toStringTag:void 0,x=v?v.prototype:void 0,b=x?x.toString:void 0,w={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:r,variable:"",imports:{_:{escape:function(t){return(t=(e=t,null==e?"":S(e)))&&c.test(t)?t.replace(l,f):t;var e}}}};function M(t){return null==t?void 0===t?s:o:_&&_ in Object(t)?function(t){var e=g.call(t,_),n=t[_];try{t[_]=void 0;var r=!0}catch(t){}var i=y.call(t);r&&(e?t[_]=n:delete t[_]);return i}(t):function(t){return y.call(t)}(t)}function S(t){if("string"==typeof t)return t;if(T(t))return function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}(t,S)+"";if(function(t){return"symbol"==typeof t||function(t){return null!=t&&"object"==typeof t}(t)&&M(t)==a}(t))return b?b.call(t):"";var e=t+"";return"0"==e&&1/t==-i?"-0":e}var T=Array.isArray;e.exports=w}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._reinterpolate":6}],11:[function(t,e,n){var r=t("./_root").Symbol;e.exports=r},{"./_root":18}],12:[function(t,e,n){var r=t("./_Symbol"),i=t("./_getRawTag"),o=t("./_objectToString"),a=r?r.toStringTag:void 0;e.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?i(t):o(t)}},{"./_Symbol":11,"./_getRawTag":15,"./_objectToString":16}],13:[function(t,e,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,e,n){var r=t("./_overArg")(Object.getPrototypeOf,Object);e.exports=r},{"./_overArg":17}],15:[function(t,e,n){var r=t("./_Symbol"),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=r?r.toStringTag:void 0;e.exports=function(t){var e=o.call(t,s),n=t[s];try{t[s]=void 0;var r=!0}catch(t){}var i=a.call(t);r&&(e?t[s]=n:delete t[s]);return i}},{"./_Symbol":11}],16:[function(t,e,n){var r=Object.prototype.toString;e.exports=function(t){return r.call(t)}},{}],17:[function(t,e,n){e.exports=function(t,e){return function(n){return t(e(n))}}},{}],18:[function(t,e,n){var r=t("./_freeGlobal"),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},{"./_freeGlobal":13}],19:[function(t,e,n){e.exports=function(t){return null!=t&&"object"==typeof t}},{}],20:[function(t,e,n){var r=t("./_baseGetTag"),i=t("./_getPrototype"),o=t("./isObjectLike"),a=Function.prototype,s=Object.prototype,l=a.toString,c=s.hasOwnProperty,u=l.call(Object);e.exports=function(t){if(!o(t)||"[object Object]"!=r(t))return!1;var e=i(t);if(null===e)return!0;var n=c.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&l.call(n)==u}},{"./_baseGetTag":12,"./_getPrototype":14,"./isObjectLike":19}],21:[function(t,e,n){var r,i,o=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(t){r=a}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();function l(t){if(r===setTimeout)return setTimeout(t,0);if((r===a||!r)&&setTimeout){r=setTimeout;return setTimeout(t,0)}try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}var c,u=[],p=!1,h=-1;function d(){if(p&&c){p=!1;c.length?u=c.concat(u):h=-1;u.length&&f()}}function f(){if(!p){var t=l(d);p=!0;for(var e=u.length;e;){c=u;u=[];for(;++h<e;)c&&c[h].run();h=-1;e=u.length}c=null;p=!1;!function(t){if(i===clearTimeout)return clearTimeout(t);if((i===s||!i)&&clearTimeout){i=clearTimeout;return clearTimeout(t)}try{return i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new m(t,e));1!==u.length||p||l(f)};function m(t,e){this.fun=t;this.array=e}m.prototype.run=function(){this.fun.apply(null,this.array)};o.title="browser";o.browser=!0;o.env={};o.argv=[];o.version="";o.versions={};function g(){}o.on=g;o.addListener=g;o.once=g;o.off=g;o.removeListener=g;o.removeAllListeners=g;o.emit=g;o.prependListener=g;o.prependOnceListener=g;o.listeners=function(t){return[]};o.binding=function(t){throw new Error("process.binding is not supported")};o.cwd=function(){return"/"};o.chdir=function(t){throw new Error("process.chdir is not supported")};o.umask=function(){return 0}},{}],22:[function(t,e,n){"use strict";n.__esModule=!0;function r(t){return function(e){var n=e.dispatch,r=e.getState;return function(e){return function(i){return"function"==typeof i?i(n,r,t):e(i)}}}}var i=r();i.withExtraArgument=r;n.default=i},{}],23:[function(t,e,n){"use strict";n.__esModule=!0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};n.default=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){return function(n,i,o){var s,l=t(n,i,o),c=l.dispatch,u={getState:l.getState,dispatch:function(t){return c(t)}};s=e.map((function(t){return t(u)}));c=a.default.apply(void 0,s)(l.dispatch);return r({},l,{dispatch:c})}}};var i,o=t("./compose"),a=(i=o)&&i.__esModule?i:{default:i}},{"./compose":26}],24:[function(t,e,n){"use strict";n.__esModule=!0;n.default=function(t,e){if("function"==typeof t)return r(t,e);if("object"!=typeof t||null===t)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===t?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(t),i={},o=0;o<n.length;o++){var a=n[o],s=t[a];"function"==typeof s&&(i[a]=r(s,e))}return i};function r(t,e){return function(){return e(t.apply(void 0,arguments))}}},{}],25:[function(t,e,n){(function(e){"use strict";n.__esModule=!0;n.default=function(t){for(var n=Object.keys(t),a={},l=0;l<n.length;l++){var c=n[l];"production"!==e.env.NODE_ENV&&void 0===t[c]&&(0,o.default)('No reducer provided for key "'+c+'"');"function"==typeof t[c]&&(a[c]=t[c])}var u=Object.keys(a),p=void 0;"production"!==e.env.NODE_ENV&&(p={});var h=void 0;try{!function(t){Object.keys(t).forEach((function(e){var n=t[e];if(void 0===n(void 0,{type:r.ActionTypes.INIT}))throw new Error('Reducer "'+e+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===n(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw new Error('Reducer "'+e+"\" returned undefined when probed with a random type. Don't try to handle "+r.ActionTypes.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(a)}catch(t){h=t}return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1];if(h)throw h;if("production"!==e.env.NODE_ENV){var l=function(t,e,n,o){var a=Object.keys(e),s=n&&n.type===r.ActionTypes.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===a.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!(0,i.default)(t))return"The "+s+' has unexpected type of "'+{}.toString.call(t).match(/\s([a-z|A-Z]+)/)[1]+'". Expected argument to be an object with the following keys: "'+a.join('", "')+'"';var l=Object.keys(t).filter((function(t){return!e.hasOwnProperty(t)&&!o[t]}));l.forEach((function(t){o[t]=!0}));if(l.length>0)return"Unexpected "+(l.length>1?"keys":"key")+' "'+l.join('", "')+'" found in '+s+'. Expected to find one of the known reducer keys instead: "'+a.join('", "')+'". Unexpected keys will be ignored.'}(t,a,n,p);l&&(0,o.default)(l)}for(var c=!1,d={},f=0;f<u.length;f++){var m=u[f],g=a[m],y=t[m],v=g(y,n);if(void 0===v){var _=s(m,n);throw new Error(_)}d[m]=v;c=c||v!==y}return c?d:t}};var r=t("./createStore"),i=a(t("lodash/isPlainObject")),o=a(t("./utils/warning"));function a(t){return t&&t.__esModule?t:{default:t}}function s(t,e){var n=e&&e.type;return"Given action "+(n&&'"'+n.toString()+'"'||"an action")+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}}).call(this,t("_process"))},{"./createStore":27,"./utils/warning":29,_process:21,"lodash/isPlainObject":20}],26:[function(t,e,n){"use strict";n.__esModule=!0;n.default=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];if(0===e.length)return function(t){return t};if(1===e.length)return e[0];return e.reduce((function(t,e){return function(){return t(e.apply(void 0,arguments))}}))}},{}],27:[function(t,e,n){"use strict";n.__esModule=!0;n.ActionTypes=void 0;n.default=function t(e,n,o){var s;if("function"==typeof n&&void 0===o){o=n;n=void 0}if(void 0!==o){if("function"!=typeof o)throw new Error("Expected the enhancer to be a function.");return o(t)(e,n)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var l=e,c=n,u=[],p=u,h=!1;function d(){p===u&&(p=u.slice())}function f(){return c}function m(t){if("function"!=typeof t)throw new Error("Expected listener to be a function.");var e=!0;d();p.push(t);return function(){if(e){e=!1;d();var n=p.indexOf(t);p.splice(n,1)}}}function g(t){if(!(0,r.default)(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(h)throw new Error("Reducers may not dispatch actions.");try{h=!0;c=l(c,t)}finally{h=!1}for(var e=u=p,n=0;n<e.length;n++){(0,e[n])()}return t}g({type:a.INIT});return(s={dispatch:g,subscribe:m,getState:f,replaceReducer:function(t){if("function"!=typeof t)throw new Error("Expected the nextReducer to be a function.");l=t;g({type:a.INIT})}})[i.default]=function(){var t,e=m;return(t={subscribe:function(t){if("object"!=typeof t)throw new TypeError("Expected the observer to be an object.");function n(){t.next&&t.next(f())}n();return{unsubscribe:e(n)}}})[i.default]=function(){return this},t},s};var r=o(t("lodash/isPlainObject")),i=o(t("symbol-observable"));function o(t){return t&&t.__esModule?t:{default:t}}var a=n.ActionTypes={INIT:"@@redux/INIT"}},{"lodash/isPlainObject":20,"symbol-observable":33}],28:[function(t,e,n){(function(e){"use strict";n.__esModule=!0;n.compose=n.applyMiddleware=n.bindActionCreators=n.combineReducers=n.createStore=void 0;var r=l(t("./createStore")),i=l(t("./combineReducers")),o=l(t("./bindActionCreators")),a=l(t("./applyMiddleware")),s=l(t("./compose"));l(t("./utils/warning"));function l(t){return t&&t.__esModule?t:{default:t}}function c(){}"production"!==e.env.NODE_ENV&&"string"==typeof c.name&&c.name;n.createStore=r.default;n.combineReducers=i.default;n.bindActionCreators=o.default;n.applyMiddleware=a.default;n.compose=s.default}).call(this,t("_process"))},{"./applyMiddleware":23,"./bindActionCreators":24,"./combineReducers":25,"./compose":26,"./createStore":27,"./utils/warning":29,_process:21}],29:[function(t,e,n){"use strict";n.__esModule=!0;n.default=function(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t);try{throw new Error(t)}catch(t){}}},{}],30:[function(t,e,n){"use strict";var r=t("./src/suggestions");window.Suggestions=e.exports=r},{"./src/suggestions":32}],31:[function(t,e,n){var r=function(t){this.component=t;this.items=[];this.active=0;this.element=document.createElement("ul");this.element.className="suggestions";this.selectingListItem=!1;t.el.parentNode.insertBefore(this.element,t.el.nextSibling);return this};r.prototype.show=function(){this.element.style.display="block"};r.prototype.hide=function(){this.element.style.display="none"};r.prototype.add=function(t){this.items.push(t)};r.prototype.clear=function(){this.items=[];this.active=0};r.prototype.isEmpty=function(){return!this.items.length};r.prototype.draw=function(){this.element.innerHTML="";if(0!==this.items.length){for(var t=0;t<this.items.length;t++)this.drawItem(this.items[t],this.active===t);this.show()}else this.hide()};r.prototype.drawItem=function(t,e){var n=document.createElement("li"),r=document.createElement("a");e&&(n.className+=" active");r.innerHTML=t.string;n.appendChild(r);this.element.appendChild(n);n.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this));n.addEventListener("mouseup",function(){this.handleMouseUp.call(this,t)}.bind(this))};r.prototype.handleMouseUp=function(t){this.selectingListItem=!1;this.component.value(t.original);this.clear();this.draw()};r.prototype.move=function(t){this.active=t;this.draw()};r.prototype.previous=function(){this.move(0===this.active?this.items.length-1:this.active-1)};r.prototype.next=function(){this.move(this.active===this.items.length-1?0:this.active+1)};e.exports=r},{}],32:[function(t,e,n){"use strict";var r=t("xtend"),i=t("fuzzy"),o=t("./list"),a=function(t,e,n){n=n||{};this.options=r({minLength:2,limit:5,filter:!0},n);this.el=t;this.data=e||[];this.list=new o(this);this.query="";this.selected=null;this.list.draw();this.el.addEventListener("keyup",function(t){this.handleKeyUp(t.keyCode)}.bind(this),!1);this.el.addEventListener("keydown",function(t){this.handleKeyDown(t)}.bind(this));this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this));this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this));this.el.addEventListener("paste",function(t){this.handlePaste(t)}.bind(this));return this};a.prototype.handleKeyUp=function(t){40!==t&&38!==t&&27!==t&&13!==t&&9!==t&&this.handleInputChange(this.el.value)};a.prototype.handleKeyDown=function(t){switch(t.keyCode){case 13:case 9:t.preventDefault();if(!this.list.isEmpty()){this.value(this.list.items[this.list.active].original);this.list.hide()}break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}};a.prototype.handleBlur=function(){this.list.selectingListItem||this.list.hide()};a.prototype.handlePaste=function(t){if(t.clipboardData)this.handleInputChange(t.clipboardData.getData("Text"));else{var e=this;setTimeout((function(){e.handleInputChange(t.target.value)}),100)}};a.prototype.handleInputChange=function(t){this.query=this.normalize(t);this.list.clear();this.query.length<this.options.minLength?this.list.draw():this.getCandidates(function(t){for(var e=0;e<t.length;e++){this.list.add(t[e]);if(e===this.options.limit-1)break}this.list.draw()}.bind(this))};a.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show();this.list.selectingListItem=!1};a.prototype.update=function(t){this.data=t;this.handleKeyUp()};a.prototype.clear=function(){this.data=[];this.list.clear()};a.prototype.normalize=function(t){return t=t.toLowerCase()};a.prototype.match=function(t,e){return t.indexOf(e)>-1};a.prototype.value=function(t){this.selected=t;this.el.value=this.getItemValue(t);if(document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1);this.el.dispatchEvent(e)}else this.el.fireEvent("onchange")};a.prototype.getCandidates=function(t){var e={pre:"<strong>",post:"</strong>",extract:function(t){return this.getItemValue(t)}.bind(this)};t(this.options.filter?i.filter(this.query,this.data,e):this.data.map(function(t){for(var e=this.getItemValue(t),n=this.normalize(e),r=n.lastIndexOf(this.query);r>-1;){var i=r+this.query.length;e=e.slice(0,r)+"<strong>"+e.slice(r,i)+"</strong>"+e.slice(i);r=n.slice(0,r).lastIndexOf(this.query)}return{original:t,string:e}}.bind(this)))};a.prototype.getItemValue=function(t){return t};e.exports=a},{"./list":31,fuzzy:4,xtend:37}],33:[function(t,e,n){(function(r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,o,a=t("./ponyfill.js"),s=(i=a)&&i.__esModule?i:{default:i};o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:void 0!==e?e:Function("return this")();var l=(0,s.default)(o);n.default=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ponyfill.js":34}],34:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.default=function(t){var e,n=t.Symbol;if("function"==typeof n)if(n.observable)e=n.observable;else{e=n("observable");n.observable=e}else e="@@observable";return e}},{}],35:[function(t,e,n){var r=t("turf-meta").coordEach;e.exports=function(t){var e=[1/0,1/0,-1/0,-1/0];r(t,(function(t){e[0]>t[0]&&(e[0]=t[0]);e[1]>t[1]&&(e[1]=t[1]);e[2]<t[0]&&(e[2]=t[0]);e[3]<t[1]&&(e[3]=t[1])}));return e}},{"turf-meta":36}],36:[function(t,e,n){function r(t,e,n){var r,i,o,a,s,c,u,p,h,d=0,f="FeatureCollection"===t.type,m="Feature"===t.type,g=f?t.features.length:1;for(r=0;r<g;r++){c=(h="GeometryCollection"===(p=f?t.features[r].geometry:m?t.geometry:t).type)?p.geometries.length:1;for(a=0;a<c;a++){u=(s=h?p.geometries[a]:p).coordinates;d=!n||"Polygon"!==s.type&&"MultiPolygon"!==s.type?0:1;if("Point"===s.type)e(u);else if("LineString"===s.type||"MultiPoint"===s.type)for(i=0;i<u.length;i++)e(u[i]);else if("Polygon"===s.type||"MultiLineString"===s.type)for(i=0;i<u.length;i++)for(o=0;o<u[i].length-d;o++)e(u[i][o]);else{if("MultiPolygon"!==s.type)throw new Error("Unknown Geometry Type");for(i=0;i<u.length;i++)for(o=0;o<u[i].length;o++)for(l=0;l<u[i][o].length-d;l++)e(u[i][o][l])}}}}e.exports.coordEach=r;e.exports.coordReduce=function(t,e,n,i){r(t,(function(t){n=e(n,t)}),i);return n};function i(t,e){var n;switch(t.type){case"FeatureCollection":features=t.features;for(n=0;n<t.features.length;n++)e(t.features[n].properties);break;case"Feature":e(t.properties)}}e.exports.propEach=i;e.exports.propReduce=function(t,e,n){i(t,(function(t){n=e(n,t)}));return n}},{}],37:[function(t,e,n){e.exports=function(){for(var t={},e=0;e<arguments.length;e++){var n=arguments[e];for(var i in n)r.call(n,i)&&(t[i]=n[i])}return t};var r=Object.prototype.hasOwnProperty},{}],38:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.queryOrigin=function(t){return{type:i.ORIGIN_QUERY,query:t}};n.queryDestination=function(t){return{type:i.DESTINATION_QUERY,query:t}};n.queryOriginCoordinates=m;n.queryDestinationCoordinates=g;n.clearOrigin=function(){return function(t){t({type:i.ORIGIN_CLEAR});t(x("clear",{type:"origin"}));t(f(null))}};n.clearDestination=function(){return function(t){t({type:i.DESTINATION_CLEAR});t(x("clear",{type:"destination"}));t(f(null))}};n.setOptions=function(t){return{type:i.SET_OPTIONS,options:t}};n.hoverMarker=function(t){return function(e){e(function(t){return{type:i.HOVER_MARKER,hoverMarker:t}}(t?a.default.createPoint(t,{id:"hover"}):{}))}};n.setRouteIndex=y;n.createOrigin=v;n.createDestination=_;n.setProfile=function(t){return function(e,n){var r=n(),o=r.origin,a=r.destination;e({type:i.DIRECTIONS_PROFILE,profile:t});e(x("profile",{profile:t}));o.geometry&&a.geometry&&e(h())}};n.reverse=function(){return function(t,e){var n=e();n.destination.geometry&&t(l(n.destination.geometry.coordinates));n.origin.geometry&&t(c(n.origin.geometry.coordinates));n.origin.geometry&&n.destination.geometry&&t(h());for(var r=document.getElementsByClassName("suggestions"),i=0;i<r.length;i++)r[i].style.visibility="hidden"}};n.setOriginFromCoordinates=function(t){return function(e){a.default.validCoords(t)||(t=[a.default.wrap(t[0]),a.default.wrap(t[1])]);if(isNaN(t[0])&&isNaN(t[1]))return e(f(new Error("Coordinates are not valid")));e(m(t));e(v(t))}};n.setDestinationFromCoordinates=function(t){return function(e){a.default.validCoords(t)||(t=[a.default.wrap(t[0]),a.default.wrap(t[1])]);if(isNaN(t[0])&&isNaN(t[1]))return e(f(new Error("Coordinates are not valid")));e(_(t));e(g(t))}};n.addWaypoint=function(t,e){return function(n,r){var i=r(),o=i.destination,a=i.waypoints;a.splice(t,0,d(e));n(p(a));o.geometry&&n(h())}};n.setWaypoint=function(t,e){return function(n,r){var i=r(),o=i.destination,a=i.waypoints;a[t]=d(e);n(p(a));o.geometry&&n(h())}};n.removeWaypoint=function(t){return function(e,n){var r=n(),i=r.destination,o=r.waypoints;e(p(o=o.filter((function(e){return!a.default.coordinateMatch(e,t)}))));i.geometry&&e(h())}};n.eventSubscribe=function(t,e){return function(n,r){var o=r().events;o[t]=o[t]||[];o[t].push(e);return{type:i.EVENTS,events:o}}};n.eventEmit=x;var r,i=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);e.default=t;return e}(t("../constants/action_types")),o=t("../utils"),a=(r=o)&&r.__esModule?r:{default:r};var s=new XMLHttpRequest;function l(t){return function(e){var n=a.default.createPoint(t,{id:"origin","marker-symbol":"A"});e({type:i.ORIGIN,origin:n});e(x("origin",{feature:n}))}}function c(t){return function(e){var n=a.default.createPoint(t,{id:"destination","marker-symbol":"B"});e({type:i.DESTINATION,destination:n});e(x("destination",{feature:n}))}}function u(t){return function(e){e({type:i.DIRECTIONS,directions:t});e(x("route",{route:t}))}}function p(t){return{type:i.WAYPOINTS,waypoints:t}}function h(){return function(t,e){var n=e(),r=n.api,i=n.accessToken,o=n.routeIndex,a=n.profile,p=n.alternatives,h=n.congestion,d=n.destination,m=n.language,g=n.exclude;if(d&&d.geometry){var v=function(t){var e=t(),n=e.origin,r=e.destination,i=e.waypoints,o=[];o.push(n.geometry.coordinates.join(","));o.push(";");i.length&&i.forEach((function(t){o.push(t.geometry.coordinates.join(","));o.push(";")}));o.push(r.geometry.coordinates.join(","));return encodeURIComponent(o.join(""))}(e),_=[];_.push("geometries=polyline");p&&_.push("alternatives=true");h&&_.push("annotations=congestion");_.push("steps=true");_.push("overview=full");m&&_.push("language="+m);g&&_.push("exclude="+g);i&&_.push("access_token="+i);s.abort();s.open("GET",""+r+a+"/"+v+".json?"+_.join("&"),!0);s.onload=function(){if(!(s.status>=200&&s.status<400)){t(u([]));return t(f(JSON.parse(s.responseText).message))}var e=JSON.parse(s.responseText);if(e.error){t(u([]));return t(f(e.error))}t(f(null));e.routes[o]||t(y(0));t(u(e.routes));t(l(e.waypoints[0].location));t(c(e.waypoints[e.waypoints.length-1].location))};s.onerror=function(){t(u([]));return t(f(JSON.parse(s.responseText).message))};s.send()}}}function d(t){var e={id:"waypoint"};return Object.assign(t,{properties:t.properties?Object.assign(t.properties,e):e})}function f(t){return function(e){e({type:"ERROR",error:t});t&&e(x("error",{error:t}))}}function m(t){return{type:i.ORIGIN_FROM_COORDINATES,coordinates:t}}function g(t){return{type:i.DESTINATION_FROM_COORDINATES,coordinates:t}}function y(t){return{type:i.ROUTE_INDEX,routeIndex:t}}function v(t){return function(e,n){var r=n().destination;e(l(t));r.geometry&&e(h())}}function _(t){return function(e,n){var r=n().origin;e(c(t));r.geometry&&e(h())}}function x(t,e){var n=this;return function(r,o){var a=o().events;if(!a[t])return{type:i.EVENTS,events:a};for(var s=a[t].slice(),l=0;l<s.length;l++)s[l].call(n,e)}}},{"../constants/action_types":39,"../utils":47}],39:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.DESTINATION="DESTINATION",n.DESTINATION_CLEAR="DESTINATION_CLEAR",n.DESTINATION_QUERY="DESTINATION_QUERY",n.DESTINATION_FROM_COORDINATES="DESTINATION_FROM_COORDINATES",n.DIRECTIONS="DIRECTIONS",n.DIRECTIONS_PROFILE="DIRECTIONS_PROFILE",n.EVENTS="EVENTS",n.ERROR="ERROR",n.HOVER_MARKER="HOVER_MARKER",n.ORIGIN="ORIGIN",n.ORIGIN_CLEAR="ORIGIN_CLEAR",n.ORIGIN_QUERY="ORIGIN_QUERY",n.ORIGIN_FROM_COORDINATES="ORIGIN_FROM_COORDINATES",n.ROUTE_INDEX="ROUTE_INDEX",n.SET_OPTIONS="SET_OPTIONS",n.WAYPOINTS="WAYPOINTS"},{}],40:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1;r.configurable=!0;"value"in r&&(r.writable=!0);Object.defineProperty(t,r.key,r)}}return function(e,n,r){n&&t(e.prototype,n);r&&t(e,r);return e}}(),o=c(t("suggestions")),a=c(t("lodash.debounce")),s=t("events"),l=c(t("../utils"));function c(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);this._ev=new s.EventEmitter;this.options=e;this.api=e&&e.api||"https://api.mapbox.com/geocoding/v5/mapbox.places/"}i(t,[{key:"onAdd",value:function(t){this._map=t;this.request=new XMLHttpRequest;var e=document.createElement("div");e.className="mapboxgl-ctrl-geocoder";var n=document.createElement("span");n.className="geocoder-icon geocoder-icon-search";var r=this._inputEl=document.createElement("input");r.type="text";r.placeholder=this.options.placeholder;r.addEventListener("keydown",(0,a.default)(function(t){if(!t.target.value)return this._clearEl.classList.remove("active");t.metaKey||-1!==[9,27,37,39,13,38,40].indexOf(t.keyCode)||this._queryFromInput(t.target.value)}.bind(this)),200);r.addEventListener("change",function(e){e.target.value&&this._clearEl.classList.add("active");var n=this._typeahead.selected;if(n){if(this.options.flyTo)if(n.bbox&&n.context&&n.context.length<=3||n.bbox&&!n.context){var r=n.bbox;t.fitBounds([[r[0],r[1]],[r[2],r[3]]])}else t.flyTo({center:n.center,zoom:this.options.zoom});this._input=n;this.fire("result",{result:n})}}.bind(this));var i=document.createElement("div");i.classList.add("geocoder-pin-right");var s=this._clearEl=document.createElement("button");s.className="geocoder-icon geocoder-icon-close";s.addEventListener("click",this._clear.bind(this));var l=this._loadingEl=document.createElement("span");l.className="geocoder-icon geocoder-icon-loading";i.appendChild(s);i.appendChild(l);e.appendChild(n);e.appendChild(r);e.appendChild(i);this.options.container&&(this.options.position=!1);this._typeahead=new o.default(r,[],{filter:!1});this._typeahead.getItemValue=function(t){return t.place_name};return e}},{key:"_geocode",value:function(t,e){this._loadingEl.classList.add("active");this.fire("loading");var n=this.options,r=["placeholder","zoom","flyTo","accessToken"],i=Object.keys(this.options).filter((function(t){return-1===r.indexOf(t)})).map((function(t){return t+"="+n[t]})),o=this.options.accessToken?this.options.accessToken:mapboxgl.accessToken;i.push("access_token="+o);this.request.abort();this.request.open("GET",this.api+encodeURIComponent(t.trim())+".json?"+i.join("&"),!0);this.request.onload=function(){this._loadingEl.classList.remove("active");if(this.request.status>=200&&this.request.status<400){var t=JSON.parse(this.request.responseText);if(t.features.length)this._clearEl.classList.add("active");else{this._clearEl.classList.remove("active");this._typeahead.selected=null}this.fire("results",{results:t.features});this._typeahead.update(t.features);return e(t.features)}this.fire("error",{error:JSON.parse(this.request.responseText).message})}.bind(this);this.request.onerror=function(){this._loadingEl.classList.remove("active");this.fire("error",{error:JSON.parse(this.request.responseText).message})}.bind(this);this.request.send()}},{key:"_queryFromInput",value:function(t){(t=t.trim())||this._clear();t.length>2&&this._geocode(t,function(t){this._results=t}.bind(this))}},{key:"_change",value:function(){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1);this._inputEl.dispatchEvent(t)}},{key:"_query",value:function(t){if(t){"object"===(void 0===t?"undefined":r(t))&&t.length&&(t=[l.default.wrap(t[0]),l.default.wrap(t[1])].join());this._geocode(t,function(t){if(t.length){var e=t[0];this._results=t;this._typeahead.selected=e;this._inputEl.value=e.place_name;this._change()}}.bind(this))}}},{key:"_setInput",value:function(t){if(t){"object"===(void 0===t?"undefined":r(t))&&t.length&&(t=[l.default.roundWithOriginalPrecision(l.default.wrap(t[0]),t[0]),l.default.roundWithOriginalPrecision(l.default.wrap(t[1]),t[1])].join());this._inputEl.value=t;this._input=null;this._typeahead.selected=null;this._typeahead.clear();this._change()}}},{key:"_clear",value:function(){this._input=null;this._inputEl.value="";this._typeahead.selected=null;this._typeahead.clear();this._change();this._inputEl.focus();this._clearEl.classList.remove("active");this.fire("clear")}},{key:"getResult",value:function(){return this._input}},{key:"query",value:function(t){this._query(t);return this}},{key:"setInput",value:function(t){this._setInput(t);return this}},{key:"on",value:function(t,e){this._ev.on(t,e);this._ev.on("error",(function(t){console.log(t)}));return this}},{key:"fire",value:function(t,e){this._ev.emit(t,e);return this}},{key:"off",value:function(t,e){this._ev.removeListener(t,e);return this}}]);return t}();n.default=u},{"../utils":47,events:3,"lodash.debounce":7,suggestions:30}],41:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1;r.configurable=!0;"value"in r&&(r.writable=!0);Object.defineProperty(t,r.key,r)}}return function(e,n,r){n&&t(e.prototype,n);r&&t(e,r);return e}}(),i=l(t("./geocoder")),o=l(t("lodash.template")),a=l(t("lodash.isequal")),s=l(t("turf-extent"));function l(t){return t&&t.__esModule?t:{default:t}}var c=(0,o.default)("<div class='mapbox-directions-component mapbox-directions-inputs'>\n <div class='mapbox-directions-component-keyline'>\n <div class='mapbox-directions-origin'>\n <label class='mapbox-form-label'>\n <span class='directions-icon directions-icon-depart'></span>\n </label>\n <div id='mapbox-directions-origin-input'></div>\n </div>\n\n <button\n class='directions-icon directions-icon-reverse directions-reverse js-reverse-inputs'\n title='Reverse origin &amp; destination'>\n </button>\n\n <div class='mapbox-directions-destination'>\n <label class='mapbox-form-label'>\n <span class='directions-icon directions-icon-arrive'></span>\n </label>\n <div id='mapbox-directions-destination-input'></div>\n </div>\n </div>\n\n <% if (controls.profileSwitcher) { %>\n <div class='mapbox-directions-profile mapbox-directions-component-keyline mapbox-directions-clearfix'><input\n id='mapbox-directions-profile-driving-traffic'\n type='radio'\n name='profile'\n value='mapbox/driving-traffic'\n <% if (profile === 'mapbox/driving-traffic') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-driving-traffic'>Traffic</label>\n <input\n id='mapbox-directions-profile-driving'\n type='radio'\n name='profile'\n value='mapbox/driving'\n <% if (profile === 'mapbox/driving') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-driving'>Driving</label>\n <input\n id='mapbox-directions-profile-walking'\n type='radio'\n name='profile'\n value='mapbox/walking'\n <% if (profile === 'mapbox/walking') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-walking'>Walking</label>\n <input\n id='mapbox-directions-profile-cycling'\n type='radio'\n name='profile'\n value='mapbox/cycling'\n <% if (profile === 'mapbox/cycling') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-cycling'>Cycling</label>\n </div>\n <% } %>\n</div>\n"),u=function(){function t(e,n,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var o=n.getState(),a=o.originQuery,s=o.destinationQuery,l=o.profile,u=o.controls;e.innerHTML=c({originQuery:a,destinationQuery:s,profile:l,controls:u});this.container=e;this.actions=r;this.store=n;this._map=i;this.onAdd();this.render()}r(t,[{key:"animateToCoordinates",value:function(t,e){var n=this.store.getState(),r=n.origin,i=n.destination,o=n.routePadding;if(r.geometry&&i.geometry&&!(0,a.default)(r.geometry,i.geometry)){var l=(0,s.default)({type:"FeatureCollection",features:[r,i]});this._map.fitBounds([[l[0],l[1]],[l[2],l[3]]],{padding:o})}else this._map.flyTo({center:e})}},{key:"onAdd",value:function(){var t=this,e=this.actions,n=e.clearOrigin,r=e.clearDestination,o=e.createOrigin,a=e.createDestination,s=e.setProfile,l=e.reverse,c=this.store.getState(),u=c.geocoder,p=c.accessToken,h=c.flyTo,d=c.placeholderOrigin,f=c.placeholderDestination,m=c.zoom;this.originInput=new i.default(Object.assign({},{accessToken:p},u,{flyTo:h,placeholder:d,zoom:m}));var g=this.originInput.onAdd(this._map);this.container.querySelector("#mapbox-directions-origin-input").appendChild(g);this.destinationInput=new i.default(Object.assign({},{accessToken:p},u,{flyTo:h,placeholder:f,zoom:m}));var y=this.destinationInput.onAdd(this._map);this.container.querySelector("#mapbox-directions-destination-input").appendChild(y);this.originInput.on("result",(function(e){var n=e.result.center;o(n);t.animateToCoordinates("origin",n)}));this.originInput.on("clear",n);this.destinationInput.on("result",(function(e){var n=e.result.center;a(n);t.animateToCoordinates("destination",n)}));this.destinationInput.on("clear",r);var v=this.container.querySelectorAll('input[type="radio"]');Array.prototype.forEach.call(v,(function(t){t.addEventListener("change",(function(){s(t.value)}))}));this.container.querySelector(".js-reverse-inputs").addEventListener("click",(function(){var e=t.store.getState(),n=e.origin,r=e.destination;n&&t.actions.queryDestination(n.geometry.coordinates);r&&t.actions.queryOrigin(r.geometry.coordinates);l()}))}},{key:"render",value:function(){var t=this;this.store.subscribe((function(){var e=t.store.getState(),n=e.originQuery,r=e.destinationQuery,i=e.originQueryCoordinates,o=e.destinationQueryCoordinates;if(n){t.originInput.query(n);t.actions.queryOrigin(null)}if(r){t.destinationInput.query(r);t.actions.queryDestination(null)}if(i){t.originInput.setInput(i);t.animateToCoordinates("origin",i);t.actions.queryOriginCoordinates(null)}if(o){t.destinationInput.setInput(o);t.animateToCoordinates("destination",o);t.actions.queryDestinationCoordinates(null)}}))}}]);return t}();n.default=u},{"./geocoder":40,"lodash.isequal":8,"lodash.template":9,"turf-extent":35}],42:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1;r.configurable=!0;"value"in r&&(r.writable=!0);Object.defineProperty(t,r.key,r)}}return function(e,n,r){n&&t(e.prototype,n);r&&t(e,r);return e}}(),i=s(t("../utils")),o=s(t("lodash.template")),a=s(t("lodash.isequal"));function s(t){return t&&t.__esModule?t:{default:t}}var l=(0,o.default)("<div class='directions-control directions-control-directions'>\n <div class='mapbox-directions-component mapbox-directions-route-summary<% if (routes > 1) { %> mapbox-directions-multiple<% } %>'>\n <% if (routes > 1) { %>\n <div class='mapbox-directions-routes mapbox-directions-clearfix'>\n <% for (var i = 0; i < routes; i++) { %>\n <input type='radio' name='routes' id='<%= i %>' <% if (i === routeIndex) { %>checked<% } %>>\n <label for='<%= i %>' class='mapbox-directions-route'><%= i + 1 %></label>\n <% } %>\n </div>\n <% } %>\n <h1><%- duration %></h1>\n <span><%- distance %></span>\n </div>\n\n <div class='mapbox-directions-instructions'>\n <div class='mapbox-directions-instructions-wrapper'>\n <ol class='mapbox-directions-steps'>\n <% steps.forEach(function(step) { %>\n <%\n var distance = step.distance ? format(step.distance) : false;\n var icon = step.maneuver.modifier ? step.maneuver.modifier.replace(/\\s+/g, '-').toLowerCase() : step.maneuver.type.replace(/\\s+/g, '-').toLowerCase();\n\n if (step.maneuver.type === 'arrive' || step.maneuver.type === 'depart') {\n icon = step.maneuver.type;\n }\n\n if (step.maneuver.type === 'roundabout' || step.maneuver.type === 'rotary') {\n icon= 'roundabout';\n }\n\n var lng = step.maneuver.location[0];\n var lat = step.maneuver.location[1];\n %>\n <li\n data-lat='<%= lat %>'\n data-lng='<%= lng %>'\n class='mapbox-directions-step'>\n <span class='directions-icon directions-icon-<%= icon %>'></span>\n <div class='mapbox-directions-step-maneuver'>\n <%= step.maneuver.instruction %>\n </div>\n <% if (distance) { %>\n <div class='mapbox-directions-step-distance'>\n <%= distance %>\n </div>\n <% } %>\n </li>\n <% }); %>\n </ol>\n </div>\n </div>\n</div>\n"),c=(0,o.default)("<div class='directions-control directions-control-directions'>\n <div class='mapbox-directions-error'>\n <%= error %>\n </div>\n</div>\n"),u=function(){function t(e,n,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);this.container=e;this.actions=r;this.store=n;this._map=i;this.directions={};this.render()}r(t,[{key:"render",value:function(){var t=this;this.store.subscribe((function(){var e=t.actions,n=e.hoverMarker,r=e.setRouteIndex,o=t.store.getState(),s=o.routeIndex,u=o.unit,p=o.directions,h=o.error,d=o.compile,f=!(0,a.default)(p[s],t.directions);if(h)t.container.innerHTML=c({error:h});else if(p.length&&f){var m=t.directions=p[s];d&&m.legs.forEach((function(t){t.steps.forEach((function(t){t.maneuver.instruction=d("en",t)}))}));t.container.innerHTML=l({routeIndex:s,routes:p.length,steps:m.legs[0].steps,format:i.default.format[u],duration:i.default.format[u](m.distance),distance:i.default.format.duration(m.duration)});var g=t.container.querySelectorAll(".mapbox-directions-step");Array.prototype.forEach.call(g,(function(e){var r=e.getAttribute("data-lng"),i=e.getAttribute("data-lat");e.addEventListener("mouseover",(function(){n([r,i])}));e.addEventListener("mouseout",(function(){n(null)}));e.addEventListener("click",(function(){t._map.flyTo({center:[r,i],zoom:16})}))}));var y=t.container.querySelectorAll('input[type="radio"]');Array.prototype.forEach.call(y,(function(t){t.addEventListener("change",(function(t){r(parseInt(t.target.id,10))}))}))}else t.container.innerHTML&&f&&(t.container.innerHTML="")}))}}]);return t}();n.default=u},{"../utils":47,"lodash.isequal":8,"lodash.template":9}],43:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1;r.configurable=!0;"value"in r&&(r.writable=!0);Object.defineProperty(t,r.key,r)}}return function(e,n,r){n&&t(e.prototype,n);r&&t(e,r);return e}}(),i=t("redux"),o=d(t("redux-thunk")),a=t("@mapbox/polyline"),s=d(t("./utils")),l=d(t("./reducers")),c=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);e.default=t;return e}(t("./actions")),u=d(t("./directions_style")),p=d(t("./controls/inputs")),h=d(t("./controls/instructions"));function d(t){return t&&t.__esModule?t:{default:t}}var f=(0,i.applyMiddleware)(o.default)(i.createStore)(l.default),m=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);this.actions=(0,i.bindActionCreators)(c,f.dispatch);this.actions.setOptions(e||{});this.options=e||{};this.onDragDown=this._onDragDown.bind(this);this.onDragMove=this._onDragMove.bind(this);this.onDragUp=this._onDragUp.bind(this);this.move=this._move.bind(this);this.onClick=this._clickHandler().bind(this)}r(t,[{key:"onAdd",value:function(t){var e=this;this._map=t;var n=f.getState().controls,r=this.container=document.createElement("div");r.className="mapboxgl-ctrl-directions mapboxgl-ctrl";var i=document.createElement("div");i.className="directions-control directions-control-inputs";new p.default(i,f,this.actions,this._map);var o=document.createElement("div");o.className="directions-control directions-control-instructions";new h.default(o,f,{hoverMarker:this.actions.hoverMarker,setRouteIndex:this.actions.setRouteIndex},this._map);n.inputs&&r.appendChild(i);n.instructions&&r.appendChild(o);this.subscribedActions();this._map.loaded()?this.mapState():this._map.on("load",(function(){return e.mapState()}));return r}},{key:"onRemove",value:function(t){this.container.parentNode.removeChild(this.container);this.removeRoutes();t.off("mousedown",this.onDragDown);t.off("mousemove",this.move);t.off("touchstart",this.onDragDown);t.off("touchstart",this.move);t.off("click",this.onClick);if(this.storeUnsubscribe){this.storeUnsubscribe();delete this.storeUnsubscribe}u.default.forEach((function(e){t.getLayer(e.id)&&t.removeLayer(e.id)}));t.getSource("directions")&&t.removeSource("directions");this._map=null;return this}},{key:"mapState",value:function(){var t=this,e=f.getState(),n=e.profile,r=(e.alternatives,e.congestion,e.styles),i=e.interactive;e.compile;this.actions.eventEmit("profile",{profile:n});this._map.addSource("directions",{type:"geojson",data:{type:"FeatureCollection",features:[]}});r&&r.length&&r.forEach((function(e){return t._map.addLayer(e)}));u.default.forEach((function(e){t._map.getLayer(e.id)||t._map.addLayer(e)}));if(i){this._map.on("mousedown",this.onDragDown);this._map.on("mousemove",this.move);this._map.on("click",this.onClick);this._map.on("touchstart",this.move);this._map.on("touchstart",this.onDragDown)}}},{key:"subscribedActions",value:function(){var t=this;this.storeUnsubscribe=f.subscribe((function(){var e=f.getState(),n=e.origin,r=e.destination,i=e.hoverMarker,o=e.directions,s=e.routeIndex,l={type:"FeatureCollection",features:[n,r,i].filter((function(t){return t.geometry}))};o.length&&o.forEach((function(t,e){var n=[];(0,a.decode)(t.geometry,5).map((function(t){return t.reverse()})).forEach((function(r,i){var o=n[n.length-1],a=t.legs[0].annotation&&t.legs[0].annotation.congestion&&t.legs[0].annotation.congestion[i-1];if(!o||a&&o.properties.congestion!==a){var l={geometry:{type:"LineString",coordinates:[]},properties:{"route-index":e,route:e===s?"selected":"alternate"}};o&&l.geometry.coordinates.push(o.geometry.coordinates[o.geometry.coordinates.length-1]);l.geometry.coordinates.push(r);a&&(l.properties.congestion=t.legs[0].annotation.congestion[i-1]);n.push(l)}else o.geometry.coordinates.push(r)}));l.features=l.features.concat(n);e===s&&t.legs[0].steps.forEach((function(t){"waypoint"===t.maneuver.type&&l.features.push({type:"Feature",geometry:t.maneuver.location,properties:{id:"waypoint"}})}))}));t._map.style&&t._map.getSource("directions")&&t._map.getSource("directions").setData(l)}))}},{key:"_clickHandler",value:function(){var t=null;return function(e){if(t){clearTimeout(t);t=null;this._map.zoomIn()}else{var n=this._onSingleClick.bind(this);t=setTimeout((function(){n(e);t=null}),250)}}}},{key:"_onSingleClick",value:function(t){var e=this,n=f.getState().origin,r=[t.lngLat.lng,t.lngLat.lat];if(n.geometry){var i=this._map.queryRenderedFeatures(t.point,{layers:["directions-origin-point","directions-destination-point","directions-waypoint-point","directions-route-line-alt"]});if(i.length){i.forEach((function(t){"directions-waypoint-point"===t.layer.id&&e.actions.removeWaypoint(t)}));if("alternate"===i[0].properties.route){var o=i[0].properties["route-index"];this.actions.setRouteIndex(o)}}else{this.actions.setDestinationFromCoordinates(r);this._map.flyTo({center:r})}}else this.actions.setOriginFromCoordinates(r)}},{key:"_move",value:function(t){var e=this,n=f.getState().hoverMarker,r=this._map.queryRenderedFeatures(t.point,{layers:["directions-route-line-alt","directions-route-line","directions-origin-point","directions-destination-point","directions-hover-point"]});this._map.getCanvas().style.cursor=r.length?"pointer":"";if(r.length){this.isCursorOverPoint=r[0];this._map.dragPan.disable();r.forEach((function(r){"directions-route-line"===r.layer.id?e.actions.hoverMarker([t.lngLat.lng,t.lngLat.lat]):n.geometry&&e.actions.hoverMarker(null)}))}else if(this.isCursorOverPoint){this.isCursorOverPoint=!1;this._map.dragPan.enable()}}},{key:"_onDragDown",value:function(){if(this.isCursorOverPoint){this.isDragging=this.isCursorOverPoint;this._map.getCanvas().style.cursor="grab";this._map.on("mousemove",this.onDragMove);this._map.on("mouseup",this.onDragUp);this._map.on("touchmove",this.onDragMove);this._map.on("touchend",this.onDragUp)}}},{key:"_onDragMove",value:function(t){if(this.isDragging){var e=[t.lngLat.lng,t.lngLat.lat];switch(this.isDragging.layer.id){case"directions-origin-point":this.actions.createOrigin(e);break;case"directions-destination-point":this.actions.createDestination(e);break;case"directions-hover-point":this.actions.hoverMarker(e)}}}},{key:"_onDragUp",value:function(){if(this.isDragging){var t=f.getState(),e=t.hoverMarker,n=t.origin,r=t.destination;switch(this.isDragging.layer.id){case"directions-origin-point":this.actions.setOriginFromCoordinates(n.geometry.coordinates);break;case"directions-destination-point":this.actions.setDestinationFromCoordinates(r.geometry.coordinates);break;case"directions-hover-point":e.geometry&&!s.default.coordinateMatch(this.isDragging,e)&&this.actions.addWaypoint(0,e)}this.isDragging=!1;this._map.getCanvas().style.cursor="";this._map.off("touchmove",this.onDragMove);this._map.off("touchend",this.onDragUp);this._map.off("mousemove",this.onDragMove);this._map.off("mouseup",this.onDragUp)}}},{key:"interactive",value:function(t){if(t){this._map.on("touchstart",this.move);this._map.on("touchstart",this.onDragDown);this._map.on("mousedown",this.onDragDown);this._map.on("mousemove",this.move);this._map.on("click",this.onClick)}else{this._map.off("touchstart",this.move);this._map.off("touchstart",this.onDragDown);this._map.off("mousedown",this.onDragDown);this._map.off("mousemove",this.move);this._map.off("click",this.onClick)}return this}},{key:"getOrigin",value:function(){return f.getState().origin}},{key:"setOrigin",value:function(t){"string"==typeof t?this.actions.queryOrigin(t):this.actions.setOriginFromCoordinates(t);return this}},{key:"getDestination",value:function(){return f.getState().destination}},{key:"setDestination",value:function(t){"string"==typeof t?this.actions.queryDestination(t):this.actions.setDestinationFromCoordinates(t);return this}},{key:"reverse",value:function(){this.actions.reverse();return this}},{key:"addWaypoint",value:function(t,e){e.type||(e=s.default.createPoint(e,{id:"waypoint"}));this.actions.addWaypoint(t,e);return this}},{key:"setWaypoint",value:function(t,e){e.type||(e=s.default.createPoint(e,{id:"waypoint"}));this.actions.setWaypoint(t,e);return this}},{key:"removeWaypoint",value:function(t){var e=f.getState().waypoints;this.actions.removeWaypoint(e[t]);return this}},{key:"getWaypoints",value:function(){return f.getState().waypoints}},{key:"removeRoutes",value:function(){this.actions.clearOrigin();this.actions.clearDestination();return this}},{key:"on",value:function(t,e){this.actions.eventSubscribe(t,e);return this}}]);return t}();n.default=m},{"./actions":38,"./controls/inputs":41,"./controls/instructions":42,"./directions_style":44,"./reducers":46,"./utils":47,"@mapbox/polyline":1,redux:28,"redux-thunk":22}],44:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.default=[{id:"directions-route-line-alt",type:"line",source:"directions",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#bbb","line-width":4},filter:["all",["in","$type","LineString"],["in","route","alternate"]]},{id:"directions-route-line-casing",type:"line",source:"directions",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2d5f99","line-width":12},filter:["all",["in","$type","LineString"],["in","route","selected"]]},{id:"directions-route-line",type:"line",source:"directions",layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":{property:"congestion",type:"categorical",default:"#4882c5",stops:[["unknown","#4882c5"],["low","#4882c5"],["moderate","#f09a46"],["heavy","#e34341"],["severe","#8b2342"]]},"line-width":7},filter:["all",["in","$type","LineString"],["in","route","selected"]]},{id:"directions-hover-point-casing",type:"circle",source:"directions",paint:{"circle-radius":8,"circle-color":"#fff"},filter:["all",["in","$type","Point"],["in","id","hover"]]},{id:"directions-hover-point",type:"circle",source:"directions",paint:{"circle-radius":6,"circle-color":"#3bb2d0"},filter:["all",["in","$type","Point"],["in","id","hover"]]},{id:"directions-waypoint-point-casing",type:"circle",source:"directions",paint:{"circle-radius":8,"circle-color":"#fff"},filter:["all",["in","$type","Point"],["in","id","waypoint"]]},{id:"directions-waypoint-point",type:"circle",source:"directions",paint:{"circle-radius":6,"circle-color":"#8a8bc9"},filter:["all",["in","$type","Point"],["in","id","waypoint"]]},{id:"directions-origin-point",type:"circle",source:"directions",paint:{"circle-radius":18,"circle-color":"#3bb2d0"},filter:["all",["in","$type","Point"],["in","marker-symbol","A"]]},{id:"directions-origin-label",type:"symbol",source:"directions",layout:{"text-field":"A","text-font":["Open Sans Bold","Arial Unicode MS Bold"],"text-size":12},paint:{"text-color":"#fff"},filter:["all",["in","$type","Point"],["in","marker-symbol","A"]]},{id:"directions-destination-point",type:"circle",source:"directions",paint:{"circle-radius":18,"circle-color":"#8a8bc9"},filter:["all",["in","$type","Point"],["in","marker-symbol","B"]]},{id:"directions-destination-label",type:"symbol",source:"directions",layout:{"text-field":"B","text-font":["Open Sans Bold","Arial Unicode MS Bold"],"text-size":12},paint:{"text-color":"#fff"},filter:["all",["in","$type","Point"],["in","marker-symbol","B"]]}]},{}],45:[function(t,e,n){"use strict";var r,i=t("./directions"),o=(r=i)&&r.__esModule?r:{default:r};e.exports=o.default},{"./directions":43}],46:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,i=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);e.default=t;return e}(t("../constants/action_types.js")),o=t("deep-assign"),a=(r=o)&&r.__esModule?r:{default:r};var s={api:"https://api.mapbox.com/directions/v5/",profile:"mapbox/driving-traffic",alternatives:!1,congestion:!1,unit:"imperial",flyTo:!0,placeholderOrigin:"Choose a starting place",placeholderDestination:"Choose destination",zoom:16,language:"en",compile:null,proximity:!1,styles:[],controls:{profileSwitcher:!0,inputs:!0,instructions:!0},geocoder:{},interactive:!0,events:{},origin:{},destination:{},hoverMarker:{},waypoints:[],originQuery:null,destinationQuery:null,originQueryCoordinates:null,destinationQueryCoordinates:null,directions:[],routeIndex:0,routePadding:80};n.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,e=arguments[1];switch(e.type){case i.SET_OPTIONS:return(0,a.default)({},t,e.options);case i.DIRECTIONS_PROFILE:return Object.assign({},t,{profile:e.profile});case i.ORIGIN:return Object.assign({},t,{origin:e.origin,hoverMarker:{}});case i.DESTINATION:return Object.assign({},t,{destination:e.destination,hoverMarker:{}});case i.HOVER_MARKER:return Object.assign({},t,{hoverMarker:e.hoverMarker});case i.WAYPOINTS:return Object.assign({},t,{waypoints:e.waypoints});case i.ORIGIN_QUERY:return Object.assign({},t,{originQuery:e.query});case i.DESTINATION_QUERY:return Object.assign({},t,{destinationQuery:e.query});case i.ORIGIN_FROM_COORDINATES:return Object.assign({},t,{originQueryCoordinates:e.coordinates});case i.DESTINATION_FROM_COORDINATES:return Object.assign({},t,{destinationQueryCoordinates:e.coordinates});case i.ORIGIN_CLEAR:return Object.assign({},t,{origin:{},originQuery:"",waypoints:[],directions:[]});case i.DESTINATION_CLEAR:return Object.assign({},t,{destination:{},destinationQuery:"",waypoints:[],directions:[]});case i.DIRECTIONS:return Object.assign({},t,{directions:e.directions});case i.ROUTE_INDEX:return Object.assign({},t,{routeIndex:e.routeIndex});case i.ERROR:return Object.assign({},t,{error:e.error});default:return t}}},{"../constants/action_types.js":39,"deep-assign":2}],47:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={duration:function(t){var e=Math.floor(t/60),n=Math.floor(e/60);t%=60;e%=60;return 0===n&&0===e?t+"s":0===n?e+"min":n+"h "+e+"min"},imperial:function(t){var e=t/1609.344;return e>=100?e.toFixed(0)+"mi":e>=10?e.toFixed(1)+"mi":e>=.1?e.toFixed(2)+"mi":(5280*e).toFixed(0)+"ft"},metric:function(t){return t>=1e5?(t/1e3).toFixed(0)+"km":t>=1e4?(t/1e3).toFixed(1)+"km":t>=100?(t/1e3).toFixed(2)+"km":t.toFixed(0)+"m"}};n.default={format:r,coordinateMatch:function(t,e){t=t.geometry.coordinates;e=e.geometry.coordinates;return t.join()===e.join()||t[0].toFixed(3)===e[0].toFixed(3)&&t[1].toFixed(3)===e[1].toFixed(3)},createPoint:function(t,e){return{type:"Feature",geometry:{type:"Point",coordinates:t},properties:e||{}}},validCoords:function(t){return t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90},wrap:function(t){var e=((t- -180)%360+360)%360-180;return-180===e?180:e},roundWithOriginalPrecision:function(t,e){var n=0;Math.floor(e)!==e&&(n=e.toString().split(".")[1].length);return t.toFixed(Math.min(n,5))}}},{}]},{},[45])(45)}));!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MapboxGeocoder=t()}}((function(){return function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};e[a][0].call(u.exports,(function(t){return i(e[a][1][t]||t)}),u,u.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){"use strict";function r(t){this.origin=t.origin||"https://api.mapbox.com",this.endpoint="events/v2",this.access_token=t.accessToken,this.version="0.2.0",this.sessionID=this.generateSessionID(),this.userAgent=this.getUserAgent(),this.options=t,this.send=this.send.bind(this),this.countries=t.countries?t.countries.split(","):null,this.types=t.types?t.types.split(","):null,this.bbox=t.bbox?t.bbox:null,this.language=t.language?t.language.split(","):null,this.limit=t.limit?+t.limit:null,this.locale=navigator.language||null,this.enableEventLogging=this.shouldEnableLogging(t),this.eventQueue=new Array,this.flushInterval=t.flushInterval||1e3,this.maxQueueSize=t.maxQueueSize||100,this.timer=this.flushInterval?setTimeout(this.flush.bind(this),this.flushInterval):null,this.lastSentInput="",this.lastSentIndex=0}var i=t("nanoid");r.prototype={select:function(t,e){var n=this.getSelectedIndex(t,e),r=this.getEventPayload("search.select",e);if(r.resultIndex=n,r.resultPlaceName=t.place_name,r.resultId=t.id,(n!==this.lastSentIndex||r.queryString!==this.lastSentInput)&&-1!=n&&(this.lastSentIndex=n,this.lastSentInput=r.queryString,r.queryString))return this.push(r)},start:function(t){var e=this.getEventPayload("search.start",t);if(e.queryString)return this.push(e)},keyevent:function(t,e){if(t.key&&!t.metaKey&&-1===[9,27,37,39,13,38,40].indexOf(t.keyCode)){var n=this.getEventPayload("search.keystroke",e);if(n.lastAction=t.key,n.queryString)return this.push(n)}},send:function(t,e){if(this.enableEventLogging){var n=this.getRequestOptions(t);this.request(n,function(t){return t?this.handleError(t,e):e?e():void 0}.bind(this))}else if(e)return e()},getRequestOptions:function(t){return Array.isArray(t)||(t=[t]),{method:"POST",host:this.origin,path:this.endpoint+"?access_token="+this.access_token,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}},getEventPayload:function(t,e){var n;n=e.options.proximity?[e.options.proximity.longitude,e.options.proximity.latitude]:null;var r=e._map?e._map.getZoom():void 0,i={event:t,created:+new Date,sessionIdentifier:this.sessionID,country:this.countries,userAgent:this.userAgent,language:this.language,bbox:this.bbox,types:this.types,endpoint:"mapbox.places",proximity:n,limit:e.options.limit,mapZoom:r,keyboardLocale:this.locale};return"search.select"===t?i.queryString=e.inputString:"search.select"!=t&&e._inputEl?i.queryString=e._inputEl.value:i.queryString=e.inputString,i},request:function(t,e){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4==this.readyState)return e(204==this.status?null:this.statusText)},n.open(t.method,t.host+"/"+t.path,!0);for(var r in t.headers){var i=t.headers[r];n.setRequestHeader(r,i)}n.send(t.body)},handleError:function(t,e){if(e)return e(t)},generateSessionID:function(){return i()},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(t,e){if(e._typeahead){var n=e._typeahead.data,r=t.id;return n.map((function(t){return t.id})).indexOf(r)}},shouldEnableLogging:function(t){return!(!1===t.enableEventLogging||t.origin&&-1==t.origin.indexOf("api.mapbox.com")||t.localGeocoder||t.filter)},flush:function(){this.eventQueue.length>0&&(this.send(this.eventQueue),this.eventQueue=new Array),this.timer&&clearTimeout(this.timer),this.flushInterval&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))},push:function(t,e){this.eventQueue.push(t),(this.eventQueue.length>=this.maxQueueSize||e)&&this.flush()},remove:function(){this.flush()}},e.exports=r},{nanoid:30}],2:[function(t,e,n){e.exports={fr:{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},us:{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},ru:{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},ca:{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}}},{}],3:[function(t,e,n){"use strict";function r(t){this._eventEmitter=new s,this.options=a({},this.options,t),this.inputString="",this.fresh=!0,this.lastSelected=null}var i=t("suggestions"),o=t("lodash.debounce"),a=t("xtend"),s=t("events").EventEmitter,l=t("./exceptions"),c=t("@mapbox/mapbox-sdk"),u=t("@mapbox/mapbox-sdk/services/geocoding"),p=t("./events"),h=t("./localization"),d=t("subtag");const f=0,m=1,g=2;r.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,minLength:2,reverseGeocode:!1,limit:5,origin:"https://api.mapbox.com",enableEventLogging:!0,marker:!0,mapboxgl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,getItemValue:function(t){return t.place_name},render:function(t){var e=t.place_name.split(",");return'<div class="mapboxgl-ctrl-geocoder--suggestion"><div class="mapboxgl-ctrl-geocoder--suggestion-title">'+e[0]+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address">'+e.splice(1,e.length).join(",")+"</div></div>"}},addTo:function(t){function e(t,e){if(!document.body.contains(e))throw new Error("Element provided to #addTo() exists, but is not in the DOM");const n=t.onAdd();e.appendChild(n)}if(t._controlContainer)t.addControl(this);else if(t instanceof HTMLElement)e(this,t);else{if("string"!=typeof t)throw new Error("Error: addTo must be a mapbox-gl-js map, an html element, or a CSS selector query for a single html element");const n=document.querySelectorAll(t);if(0===n.length)throw new Error("Element ",t,"not found.");if(n.length>1)throw new Error("Geocoder can only be added to a single html element");e(this,n[0])}},onAdd:function(t){if(t&&"string"!=typeof t&&(this._map=t),this.setLanguage(),this.options.localGeocoderOnly||(this.geocoderService=u(c({accessToken:this.options.accessToken,origin:this.options.origin}))),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this.eventManager=new p(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this);var e=this.container=document.createElement("div");e.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var n=this.createIcon("search",'<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",o(this._onKeyDown,200)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keyup",function(t){this.eventManager.keyevent(t,this)}.bind(this));var r=document.createElement("div");r.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var a=this.createIcon("close",'<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');return this._clearEl.appendChild(a),this._loadingEl=this.createIcon("loading",'<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/>'),r.appendChild(this._clearEl),r.appendChild(this._loadingEl),e.appendChild(n),e.appendChild(this._inputEl),e.appendChild(r),this._typeahead=new i(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit}),this.setRenderFunction(this.options.render),this._typeahead.getItemValue=this.options.getItemValue,this.mapMarker=null,this._handleMarker=this._handleMarker.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._mapboxgl=this.options.mapboxgl,!this._mapboxgl&&this.options.marker&&(console.error("No mapboxgl detected in options. Map markers are disabled. Please set options.mapboxgl."),this.options.marker=!1)),e},createIcon:function(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");if(n.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+t),n.setAttribute("viewBox","0 0 18 18"),n.setAttribute("xml:space","preserve"),n.setAttribute("width",18),n.setAttribute("height",18),"innerHTML"in n)n.innerHTML=e;else{var r=document.createElement("div");r.innerHTML="<svg>"+e.valueOf().toString()+"</svg>";var i=r.firstChild.firstChild;n.appendChild(i)}return n},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_onPaste:function(t){var e=(t.clipboardData||window.clipboardData).getData("text");e.length>=this.options.minLength&&this._geocode(e)},_onKeyDown:function(t){if(27===t.keyCode&&this.options.clearAndBlurOnEsc)return this._clear(t),this._inputEl.blur();var e=t.target&&t.target.shadowRoot?t.target.shadowRoot.activeElement:t.target;if(!e||!e.value)return this.fresh=!0,9!==t.keyCode&&this.clear(t),this._clearEl.style.display="none";t.metaKey||-1!==[9,27,37,39,13,38,40].indexOf(t.keyCode)||e.value.length>=this.options.minLength&&this._geocode(e.value)},_showButton:function(){this._typeahead.selected&&(this._clearEl.style.display="block")},_hideButton:function(){this._typeahead.selected&&(this._clearEl.style.display="none")},_onBlur:function(t){this.options.clearOnBlur&&this._clearOnBlur(t),this.options.collapsed&&this._collapse()},_onChange:function(){var t=this._typeahead.selected;if(t&&JSON.stringify(t)!==this.lastSelected){if(this._clearEl.style.display="none",this.options.flyTo){var e;if(t.properties&&l[t.properties.short_code])e=a({},this.options.flyTo),this._map&&this._map.fitBounds(l[t.properties.short_code].bbox,e);else if(t.bbox){var n=t.bbox;e=a({},this.options.flyTo),this._map&&this._map.fitBounds([[n[0],n[1]],[n[2],n[3]]],e)}else{var r={zoom:this.options.zoom};e=a({},r,this.options.flyTo),t.center?e.center=t.center:t.geometry&&t.geometry.type&&"Point"===t.geometry.type&&t.geometry.coordinates&&(e.center=t.geometry.coordinates),this._map&&this._map.flyTo(e)}}this.options.marker&&this._mapboxgl&&this._handleMarker(t),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(t),this._eventEmitter.emit("result",{result:t}),this.eventManager.select(t,this)}},_requestType:function(t,e){return t.localGeocoderOnly?m:t.reverseGeocode&&/^[ ]*(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/.test(e)?g:f},_setupConfig:function(t,e){const n=/[\s,]+/;var r=this,i=["bbox","limit","proximity","countries","types","language","reverseMode","mode"].reduce((function(t,e){if(!r.options[e])return t;["countries","types","language"].indexOf(e)>-1?t[e]=r.options[e].split(n):t[e]=r.options[e];const i="number"==typeof r.options[e].longitude&&"number"==typeof r.options[e].latitude;if("proximity"===e&&i){const n=r.options[e].longitude,i=r.options[e].latitude;t[e]=[n,i]}return t}),{});switch(t){case g:var o=e.split(n).map((function(t){return parseFloat(t,10)})).reverse();i.types&&i.types[0],"proximity"in(i=a(i,{query:o,limit:1}))&&delete i.proximity;break;case f:/^[ ]*(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)*[ ]*$/.test(e)&&(e=e.replace(/,/g," ")),i=a(i,{query:e})}return i},_geocode:function(t){this.inputString=t,this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:t});const e=this._requestType(this.options,t),n=this._setupConfig(e,t);var r;switch(e){case m:r=Promise.resolve();break;case f:r=this.geocoderService.forwardGeocode(n).send();break;case g:r=this.geocoderService.reverseGeocode(n).send()}var i=this.options.localGeocoder&&this.options.localGeocoder(t)||[],o=[],a=null;return r.catch(function(t){a=t}.bind(this)).then(function(e){this._loadingEl.style.display="none";var r={};return e?"200"==e.statusCode&&((r=e.body).request=e.request,r.headers=e.headers):r={type:"FeatureCollection",features:[]},r.config=n,this.fresh&&(this.eventManager.start(this),this.fresh=!1),r.features=r.features?i.concat(r.features):i,this.options.externalGeocoder?(o=this.options.externalGeocoder(t,r.features)||[]).then((function(t){return r.features=r.features?t.concat(r.features):t,r}),(function(){return r})):r}.bind(this)).then(function(t){if(a)throw a;this.options.filter&&t.features.length&&(t.features=t.features.filter(this.options.filter)),t.features.length?(this._clearEl.style.display="block",this._eventEmitter.emit("results",t),this._typeahead.update(t.features)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",t))}.bind(this)).catch(function(t){this._loadingEl.style.display="none",i.length&&this.options.localGeocoder||o.length&&this.options.externalGeocoder?(this._clearEl.style.display="block",this._typeahead.update(i)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:i}),this._eventEmitter.emit("error",{error:t})}.bind(this)),r},_clear:function(t){t&&t.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._clearEl.style.display="none",this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(t){this._clear(t),this._inputEl.focus()},_clearOnBlur:function(t){t.relatedTarget&&this._clear(t)},_onQueryResult:function(t){var e=t.body;if(e.features.length){var n=e.features[0];this._typeahead.selected=n,this._inputEl.value=n.place_name,this._onChange()}},_updateProximity:function(){if(this._map)if(this._map.getZoom()>9){var t=this._map.getCenter().wrap();this.setProximity({longitude:t.lng,latitude:t.lat})}else this.setProximity(null)},_collapse:function(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed")},query:function(t){return this._geocode(t).then(this._onQueryResult),this},_renderError:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error'>There was an error reaching the server</div>")},_renderNoResults:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error mapbox-gl-geocoder--no-results'>No results found</div>")},_renderMessage:function(t){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(t)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var t=this.options.language.split(",")[0],e=d.language(t),n=h.placeholder[e];if(n)return n}return"Search"},setInput:function(t){return this._inputEl.value=t,this._typeahead.selected=null,this._typeahead.clear(),t.length>=this.options.minLength&&this._geocode(t),this},setProximity:function(t){return this.options.proximity=t,this},getProximity:function(){return this.options.proximity},setRenderFunction:function(t){return t&&"function"==typeof t&&(this._typeahead.render=t),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(t){var e=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=t||this.options.language||e,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(t){return this.options.zoom=t,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(t){return this.options.flyTo=t,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(t){return this.placeholder=t||this._getPlaceholderText(),this._inputEl.placeholder=this.placeholder,this._inputEl.setAttribute("aria-label",this.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(t){return this.options.bbox=t,this},getCountries:function(){return this.options.countries},setCountries:function(t){return this.options.countries=t,this},getTypes:function(){return this.options.types},setTypes:function(t){return this.options.types=t,this},getMinLength:function(){return this.options.minLength},setMinLength:function(t){return this.options.minLength=t,this._typeahead&&(this._typeahead.options.minLength=t),this},getLimit:function(){return this.options.limit},setLimit:function(t){return this.options.limit=t,this._typeahead&&(this._typeahead.options.limit=t),this},getFilter:function(){return this.options.filter},setFilter:function(t){return this.options.filter=t,this},setOrigin:function(t){return this.options.origin=t,this.geocoderService=u(c({accessToken:this.options.accessToken,origin:this.options.origin})),this},getOrigin:function(){return this.options.origin},_handleMarker:function(t){if(this._map){this._removeMarker();var e=a({},{color:"#4668F2"},this.options.marker);return this.mapMarker=new this._mapboxgl.Marker(e),t.center?this.mapMarker.setLngLat(t.center).addTo(this._map):t.geometry&&t.geometry.type&&"Point"===t.geometry.type&&t.geometry.coordinates&&this.mapMarker.setLngLat(t.geometry.coordinates).addTo(this._map),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},on:function(t,e){return this._eventEmitter.on(t,e),this},off:function(t,e){return this._eventEmitter.removeListener(t,e),this.eventManager.remove(),this}},e.exports=r},{"./events":1,"./exceptions":2,"./localization":4,"@mapbox/mapbox-sdk":6,"@mapbox/mapbox-sdk/services/geocoding":17,events:25,"lodash.debounce":29,subtag:32,suggestions:33,xtend:36}],4:[function(t,e,n){"use strict";e.exports={placeholder:{de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"לחפש",ja:"サーチ",lv:"Meklēt",pt:"Procurar",sr:"Претрага",zh:"搜索",cs:"Vyhledávání",hu:"Keresés",ka:"ძიება",nb:"Søke",sk:"Vyhľadávanie",th:"ค้นหา",fi:"Hae",is:"Leita",ko:"수색",pl:"Szukaj",sl:"Iskanje",fa:"جستجو",ru:"Поиск"}}},{}],5:[function(t,e,n){"use strict";function r(t){var e=Array.isArray(t),n=function(n){return e?t[n]:t};return function(r){var o=i(p.plainArray,r);if(o)return o;if(e&&r.length!==t.length)return"an array with "+t.length+" items";for(var a=0;a<r.length;a++)if(o=i(n(a),r[a]))return[a].concat(o)}}function i(t,e){if(null!=e||t.hasOwnProperty("__required")){var n=t(e);return n?Array.isArray(n)?n:[n]:void 0}}function o(t,e){var n=t.length,r=t[n-1],i=t.slice(0,n-1);return 0===i.length&&(i=[u]),e=c(e,{path:i}),"function"==typeof r?r(e):a(e,function(t){return"must be "+function(t){return/^an? /.test(t)?t:/^[aeiou]/i.test(t)?"an "+t:/^[a-z]/i.test(t)?"a "+t:t}(t)+"."}(r))}function a(t,e){return(s(t.path)?"Item at position ":"")+(t.path.join(".")+" "+e)}function s(t){return"number"==typeof t[t.length-1]||"number"==typeof t[0]}var l=t("is-plain-obj"),c=t("xtend"),u="value",p={assert:function(t,e){return e=e||{},function(n){var r=i(t,n);if(r){var a=o(r,e);throw e.apiName&&(a=e.apiName+": "+a),new Error(a)}}}};p.shape=function(t){var e=function(t){return Object.keys(t||{}).map((function(e){return{key:e,value:t[e]}}))}(t);return function(t){var n=i(p.plainObject,t);if(n)return n;for(var r,a=[],s=0;s<e.length;s++)r=e[s].key,(n=i(e[s].value,t[r]))&&a.push([r].concat(n));return a.length<2?a[0]:function(t){a=a.map((function(e){return"- "+e[0]+": "+o(e,t).split("\n").join("\n ")}));var e=t.path.join(".");return"The following properties"+(e===u?"":" of "+e)+" have invalid values:\n "+a.join("\n ")}}},p.strictShape=function(t){var e=p.shape(t);return function(n){var r=e(n);if(r)return r;var i=Object.keys(n).reduce((function(e,n){return void 0===t[n]&&e.push(n),e}),[]);return 0!==i.length?function(){return"The following keys are invalid: "+i.join(", ")}:void 0}},p.arrayOf=function(t){return r(t)},p.tuple=function(){return r(Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments))},p.required=function(t){function e(e){return null==e?function(t){return a(t,s(t.path)?"cannot be undefined/null.":"is required.")}:t.apply(this,arguments)}return e.__required=!0,e},p.oneOfType=function(){var t=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments);return function(e){var n=t.map((function(t){return i(t,e)})).filter(Boolean);if(n.length===t.length)return n.every((function(t){return 1===t.length&&"string"==typeof t[0]}))?function(t){return t.length<2?t[0]:2===t.length?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t.slice(-1)}(n.map((function(t){return t[0]}))):n.reduce((function(t,e){return e.length>t.length?e:t}))}},p.equal=function(t){return function(e){if(e!==t)return JSON.stringify(t)}},p.oneOf=function(){var t=(Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments)).map((function(t){return p.equal(t)}));return p.oneOfType.apply(this,t)},p.range=function(t){var e=t[0],n=t[1];return function(t){if(i(p.number,t)||t<e||t>n)return"number between "+e+" & "+n+" (inclusive)"}},p.any=function(){},p.boolean=function(t){if("boolean"!=typeof t)return"boolean"},p.number=function(t){if("number"!=typeof t)return"number"},p.plainArray=function(t){if(!Array.isArray(t))return"array"},p.plainObject=function(t){if(!l(t))return"object"},p.string=function(t){if("string"!=typeof t)return"string"},p.func=function(t){if("function"!=typeof t)return"function"},p.validate=i,p.processMessage=o,e.exports=p},{"is-plain-obj":28,xtend:36}],6:[function(t,e,n){"use strict";var r=t("./lib/client");e.exports=r},{"./lib/client":7}],7:[function(t,e,n){"use strict";function r(t){o.call(this,t)}var i=t("./browser-layer"),o=t("../classes/mapi-client");r.prototype=Object.create(o.prototype),r.prototype.constructor=r,r.prototype.sendRequest=i.browserSend,r.prototype.abortRequest=i.browserAbort,e.exports=function(t){return new r(t)}},{"../classes/mapi-client":9,"./browser-layer":8}],8:[function(t,e,n){"use strict";function r(t){var e=t.total,n=t.loaded;return{total:e,transferred:n,percent:100*n/e}}function i(t,e){return new Promise((function(n,i){e.onprogress=function(e){t.emitter.emit(l.EVENT_PROGRESS_DOWNLOAD,r(e))};var o=t.file;o&&(e.upload.onprogress=function(e){t.emitter.emit(l.EVENT_PROGRESS_UPLOAD,r(e))}),e.onerror=function(t){i(t)},e.onabort=function(){var e=new s({request:t,type:l.ERROR_REQUEST_ABORTED});i(e)},e.onload=function(){if(delete u[t.id],e.status<200||e.status>=400){var r=new s({request:t,body:e.response,statusCode:e.status});i(r)}else n(e)};var a=t.body;"string"==typeof a?e.send(a):a?e.send(JSON.stringify(a)):o?e.send(o):e.send(),u[t.id]=e})).then((function(e){return function(t,e){return new a(t,{body:e.response,headers:c(e.getAllResponseHeaders()),statusCode:e.status})}(t,e)}))}function o(t,e){var n=t.url(e),r=new window.XMLHttpRequest;return r.open(t.method,n),Object.keys(t.headers).forEach((function(e){r.setRequestHeader(e,t.headers[e])})),r}var a=t("../classes/mapi-response"),s=t("../classes/mapi-error"),l=t("../constants"),c=t("../helpers/parse-headers"),u={};e.exports={browserAbort:function(t){var e=u[t.id];e&&(e.abort(),delete u[t.id])},sendRequestXhr:i,browserSend:function(t){return Promise.resolve().then((function(){var e=o(t,t.client.accessToken);return i(t,e)}))},createRequestXhr:o}},{"../classes/mapi-error":10,"../classes/mapi-response":12,"../constants":13,"../helpers/parse-headers":14}],9:[function(t,e,n){"use strict";function r(t){if(!t||!t.accessToken)throw new Error("Cannot create a client without an access token");i(t.accessToken),this.accessToken=t.accessToken,this.origin=t.origin||a.API_ORIGIN}var i=t("@mapbox/parse-mapbox-token"),o=t("./mapi-request"),a=t("../constants");r.prototype.createRequest=function(t){return new o(this,t)},e.exports=r},{"../constants":13,"./mapi-request":11,"@mapbox/parse-mapbox-token":23}],10:[function(t,e,n){"use strict";var r=t("../constants");e.exports=function(t){var e,n=t.type||r.ERROR_HTTP;if(t.body)try{e=JSON.parse(t.body)}catch(n){e=t.body}else e=null;var i=t.message||null;i||("string"==typeof e?i=e:e&&"string"==typeof e.message?i=e.message:n===r.ERROR_REQUEST_ABORTED&&(i="Request aborted")),this.message=i,this.type=n,this.statusCode=t.statusCode||null,this.request=t.request,this.body=e}},{"../constants":13}],11:[function(t,e,n){"use strict";function r(t,e){if(!t)throw new Error("MapiRequest requires a client");if(!e||!e.path||!e.method)throw new Error("MapiRequest requires an options object with path and method properties");var n={};e.body&&(n["content-type"]="application/json");var r=o(n,e.headers),i=Object.keys(r).reduce((function(t,e){return t[e.toLowerCase()]=r[e],t}),{});this.id=c++,this._options=e,this.emitter=new a,this.client=t,this.response=null,this.error=null,this.sent=!1,this.aborted=!1,this.path=e.path,this.method=e.method,this.origin=e.origin||t.origin,this.query=e.query||{},this.params=e.params||{},this.body=e.body||null,this.file=e.file||null,this.encoding=e.encoding||"utf8",this.sendFileAs=e.sendFileAs||null,this.headers=i}var i=t("@mapbox/parse-mapbox-token"),o=t("xtend"),a=t("eventemitter3"),s=t("../helpers/url-utils"),l=t("../constants"),c=1;r.prototype.url=function(t){var e=s.prependOrigin(this.path,this.origin);e=s.appendQueryObject(e,this.query);var n=this.params,r=null==t?this.client.accessToken:t;if(r){e=s.appendQueryParam(e,"access_token",r);var a=i(r).user;n=o({ownerId:a},n)}return e=s.interpolateRouteParams(e,n)},r.prototype.send=function(){var t=this;if(t.sent)throw new Error("This request has already been sent. Check the response and error properties. Create a new request with clone().");return t.sent=!0,t.client.sendRequest(t).then((function(e){return t.response=e,t.emitter.emit(l.EVENT_RESPONSE,e),e}),(function(e){throw t.error=e,t.emitter.emit(l.EVENT_ERROR,e),e}))},r.prototype.abort=function(){this._nextPageRequest&&(this._nextPageRequest.abort(),delete this._nextPageRequest),this.response||this.error||this.aborted||(this.aborted=!0,this.client.abortRequest(this))},r.prototype.eachPage=function(t){function e(e){t(null,e,(function(){delete i._nextPageRequest;var t=e.nextPage();t&&(i._nextPageRequest=t,r(t))}))}function n(e){t(e,null,(function(){}))}function r(t){t.send().then(e,n)}var i=this;r(this)},r.prototype.clone=function(){return this._extend()},r.prototype._extend=function(t){var e=o(this._options,t);return new r(this.client,e)},e.exports=r},{"../constants":13,"../helpers/url-utils":16,"@mapbox/parse-mapbox-token":23,eventemitter3:26,xtend:36}],12:[function(t,e,n){"use strict";function r(t,e){this.request=t,this.headers=e.headers,this.rawBody=e.body,this.statusCode=e.statusCode;try{this.body=JSON.parse(e.body||"{}")}catch(t){this.body=e.body}this.links=i(this.headers.link)}var i=t("../helpers/parse-link-header");r.prototype.hasNextPage=function(){return!!this.links.next},r.prototype.nextPage=function(){return this.hasNextPage()?this.request._extend({path:this.links.next.url}):null},e.exports=r},{"../helpers/parse-link-header":15}],13:[function(t,e,n){"use strict";e.exports={API_ORIGIN:"https://api.mapbox.com",EVENT_PROGRESS_DOWNLOAD:"downloadProgress",EVENT_PROGRESS_UPLOAD:"uploadProgress",EVENT_ERROR:"error",EVENT_RESPONSE:"response",ERROR_HTTP:"HttpError",ERROR_REQUEST_ABORTED:"RequestAbortedError"}},{}],14:[function(t,e,n){"use strict";e.exports=function(t){var e={};return t?(t.trim().split(/[\r|\n]+/).forEach((function(t){var n=function(t){var e=t.indexOf(":");return{name:t.substring(0,e).trim().toLowerCase(),value:t.substring(e+1).trim()}}(t);e[n.name]=n.value})),e):e}},{}],15:[function(t,e,n){"use strict";e.exports=function(t){return t?t.split(/,\s*</).reduce((function(t,e){var n=function(t){var e=t.match(/<?([^>]*)>(.*)/);if(!e)return null;var n=e[1],r=e[2].split(";"),i=null,o=r.reduce((function(t,e){var n=function(t){var e=t.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);return e?{key:e[1],value:e[2]}:null}(e);return n?"rel"===n.key?(i||(i=n.value),t):(t[n.key]=n.value,t):t}),{});return i?{url:n,rel:i,params:o}:null}(e);return n?(n.rel.split(/\s+/).forEach((function(e){t[e]||(t[e]={url:n.url,params:n.params})})),t):t}),{}):{}}},{}],16:[function(t,e,n){"use strict";function r(t){return Array.isArray(t)?function(t){return t.map(encodeURIComponent).join(",")}(t):encodeURIComponent(String(t))}function i(t,e,n){if(!1===n||null===n)return t;var i=/\?/.test(t)?"&":"?",o=encodeURIComponent(e);return void 0!==n&&""!==n&&!0!==n&&(o+="="+r(n)),""+t+i+o}e.exports={appendQueryObject:function(t,e){if(!e)return t;var n=t;return Object.keys(e).forEach((function(t){var r=e[t];void 0!==r&&(Array.isArray(r)&&(r=r.filter((function(t){return null!=t})).join(",")),n=i(n,t,r))})),n},appendQueryParam:i,prependOrigin:function(t,e){if(!e)return t;if("http"===t.slice(0,4))return t;var n="/"===t[0]?"":"/";return""+e.replace(/\/$/,"")+n+t},interpolateRouteParams:function(t,e){return e?t.replace(/\/:([a-zA-Z0-9]+)/g,(function(t,n){var i=e[n];if(void 0===i)throw new Error("Unspecified route parameter "+n);return"/"+r(i)})):t}}},{}],17:[function(t,e,n){"use strict";var r=t("xtend"),i=t("./service-helpers/validator"),o=t("./service-helpers/pick"),a=t("./service-helpers/stringify-booleans"),s=t("./service-helpers/create-service-factory"),l={},c=["country","region","postcode","district","place","locality","neighborhood","address","poi","poi.landmark"];l.forwardGeocode=function(t){i.assertShape({query:i.required(i.string),mode:i.oneOf("mapbox.places","mapbox.places-permanent"),countries:i.arrayOf(i.string),proximity:i.coordinates,types:i.arrayOf(i.oneOf(c)),autocomplete:i.boolean,bbox:i.arrayOf(i.number),limit:i.number,language:i.arrayOf(i.string),routing:i.boolean})(t),t.mode=t.mode||"mapbox.places";var e=a(r({country:t.countries},o(t,["proximity","types","autocomplete","bbox","limit","language","routing"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:o(t,["mode","query"]),query:e})},l.reverseGeocode=function(t){i.assertShape({query:i.required(i.coordinates),mode:i.oneOf("mapbox.places","mapbox.places-permanent"),countries:i.arrayOf(i.string),types:i.arrayOf(i.oneOf(c)),bbox:i.arrayOf(i.number),limit:i.number,language:i.arrayOf(i.string),reverseMode:i.oneOf("distance","score"),routing:i.boolean})(t),t.mode=t.mode||"mapbox.places";var e=a(r({country:t.countries},o(t,["country","types","bbox","limit","language","reverseMode","routing"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:o(t,["mode","query"]),query:e})},e.exports=s(l)},{"./service-helpers/create-service-factory":18,"./service-helpers/pick":20,"./service-helpers/stringify-booleans":21,"./service-helpers/validator":22,xtend:36}],18:[function(t,e,n){"use strict";var r=t("../../lib/classes/mapi-client"),i=t("../../lib/client");e.exports=function(t){return function(e){var n;n=r.prototype.isPrototypeOf(e)?e:i(e);var o=Object.create(t);return o.client=n,o}}},{"../../lib/classes/mapi-client":9,"../../lib/client":7}],19:[function(t,e,n){"use strict";e.exports=function(t,e){return Object.keys(t).reduce((function(n,r){return n[r]=e(r,t[r]),n}),{})}},{}],20:[function(t,e,n){"use strict";e.exports=function(t,e){var n=function(t,n){return-1!==e.indexOf(t)&&void 0!==n};return"function"==typeof e&&(n=e),Object.keys(t).filter((function(e){return n(e,t[e])})).reduce((function(e,n){return e[n]=t[n],e}),{})}},{}],21:[function(t,e,n){"use strict";var r=t("./object-map");e.exports=function(t){return r(t,(function(t,e){return"boolean"==typeof e?JSON.stringify(e):e}))}},{"./object-map":19}],22:[function(t,e,n){(function(n){"use strict";var r=t("xtend"),i=t("@mapbox/fusspot");e.exports=r(i,{file:function(t){if("undefined"!=typeof window){if(t instanceof n.Blob||t instanceof n.ArrayBuffer)return;return"Blob or ArrayBuffer"}if("string"!=typeof t&&void 0===t.pipe)return"Filename or Readable stream"},date:function(t){if("boolean"==typeof t)return"date";try{var e=new Date(t);if(e.getTime&&isNaN(e.getTime()))return"date"}catch(t){return"date"}},coordinates:function(t){return i.tuple(i.number,i.number)(t)},assertShape:function(t,e){return i.assert(i.strictShape(t),e)}})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"@mapbox/fusspot":5,xtend:36}],23:[function(t,e,n){"use strict";function r(t){try{return JSON.parse(o.decode(t))}catch(t){throw new Error("Invalid token")}}function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var o=t("base-64"),a={};e.exports=function(t){if(a[t])return a[t];var e=t.split("."),n=e[0],o=e[1];if(!o)throw new Error("Invalid token");var s=r(o),l={usage:n,user:s.u};return i(s,"a")&&(l.authorization=s.a),i(s,"exp")&&(l.expires=1e3*s.exp),i(s,"iat")&&(l.created=1e3*s.iat),i(s,"scopes")&&(l.scopes=s.scopes),i(s,"client")&&(l.client=s.client),i(s,"ll")&&(l.lastLogin=s.ll),i(s,"iu")&&(l.impersonator=s.iu),a[t]=l,l}},{"base-64":24}],24:[function(t,e,n){(function(t){!function(r){var i="object"==typeof n&&n,o="object"==typeof e&&e&&e.exports==i&&e,a="object"==typeof t&&t;a.global!==a&&a.window!==a||(r=a);var s=function(t){this.message=t};(s.prototype=new Error).name="InvalidCharacterError";var l=function(t){throw new s(t)},c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=/[\t\n\f\r ]/g,p={encode:function(t){t=String(t),/[^\0-\xFF]/.test(t)&&l("The string to be encoded contains characters outside of the Latin1 range.");for(var e,n,r,i,o=t.length%3,a="",s=-1,u=t.length-o;++s<u;)e=t.charCodeAt(s)<<16,n=t.charCodeAt(++s)<<8,r=t.charCodeAt(++s),a+=c.charAt((i=e+n+r)>>18&63)+c.charAt(i>>12&63)+c.charAt(i>>6&63)+c.charAt(63&i);return 2==o?(e=t.charCodeAt(s)<<8,n=t.charCodeAt(++s),a+=c.charAt((i=e+n)>>10)+c.charAt(i>>4&63)+c.charAt(i<<2&63)+"="):1==o&&(i=t.charCodeAt(s),a+=c.charAt(i>>2)+c.charAt(i<<4&63)+"=="),a},decode:function(t){var e=(t=String(t).replace(u,"")).length;e%4==0&&(e=(t=t.replace(/==?$/,"")).length),(e%4==1||/[^+a-zA-Z0-9/]/.test(t))&&l("Invalid character: the string to be decoded is not correctly encoded.");for(var n,r,i=0,o="",a=-1;++a<e;)r=c.indexOf(t.charAt(a)),n=i%4?64*n+r:r,i++%4&&(o+=String.fromCharCode(255&n>>(-2*i&6)));return o},version:"0.1.0"};if(i&&!i.nodeType)if(o)o.exports=p;else for(var h in p)p.hasOwnProperty(h)&&(i[h]=p[h]);else r.base64=p}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],25:[function(t,e,n){function r(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=p(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}function i(t){return void 0===t._maxListeners?r.defaultMaxListeners:t._maxListeners}function o(t,e,n,r){var o,a,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((a=t._events)?(a.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),a=t._events),s=a[e]):(a=t._events=p(null),t._eventsCount=0),s){if("function"==typeof s?s=a[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),!s.warned&&(o=i(t))&&o>0&&s.length>o){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",l.name,l.message)}}else s=a[e]=n,++t._eventsCount;return t}function a(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e<t.length;++e)t[e]=arguments[e];this.listener.apply(this.target,t)}}function s(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=d.call(a,r);return i.listener=n,r.wrapFn=i,i}function l(t,e,n){var r=t._events;if(!r)return[];var i=r[e];return i?"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):u(i,i.length):[]}function c(t){var e=this._events;if(e){var n=e[t];if("function"==typeof n)return 1;if(n)return n.length}return 0}function u(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var p=Object.create||function(t){var e=function(){};return e.prototype=t,new e},h=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return n},d=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0;var f,m=10;try{var g={};Object.defineProperty&&Object.defineProperty(g,"x",{value:0}),f=0===g.x}catch(t){f=!1}f?Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return m},set:function(t){if("number"!=typeof t||t<0||t!=t)throw new TypeError('"defaultMaxListeners" must be a positive number');m=t}}):r.defaultMaxListeners=m,r.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},r.prototype.getMaxListeners=function(){return i(this)},r.prototype.emit=function(t){var e,n,r,i,o,a,s="error"===t;if(a=this._events)s=s&&null==a.error;else if(!s)return!1;if(s){if(arguments.length>1&&(e=arguments[1]),e instanceof Error)throw e;var l=new Error('Unhandled "error" event. ('+e+")");throw l.context=e,l}if(!(n=a[t]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(t,e,n){if(e)t.call(n);else for(var r=t.length,i=u(t,r),o=0;o<r;++o)i[o].call(n)}(n,c,this);break;case 2:!function(t,e,n,r){if(e)t.call(n,r);else for(var i=t.length,o=u(t,i),a=0;a<i;++a)o[a].call(n,r)}(n,c,this,arguments[1]);break;case 3:!function(t,e,n,r,i){if(e)t.call(n,r,i);else for(var o=t.length,a=u(t,o),s=0;s<o;++s)a[s].call(n,r,i)}(n,c,this,arguments[1],arguments[2]);break;case 4:!function(t,e,n,r,i,o){if(e)t.call(n,r,i,o);else for(var a=t.length,s=u(t,a),l=0;l<a;++l)s[l].call(n,r,i,o)}(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(t,e,n,r){if(e)t.apply(n,r);else for(var i=t.length,o=u(t,i),a=0;a<i;++a)o[a].apply(n,r)}(n,c,this,i)}return!0},r.prototype.addListener=function(t,e){return o(this,t,e,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(t,e){return o(this,t,e,!0)},r.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.on(t,s(this,t,e)),this},r.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.prependListener(t,s(this,t,e)),this},r.prototype.removeListener=function(t,e){var n,r,i,o,a;if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=p(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(var n=e,r=n+1,i=t.length;r<i;n+=1,r+=1)t[n]=t[r];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),r.removeListener&&this.emit("removeListener",t,a||e)}return this},r.prototype.removeAllListeners=function(t){var e,n,r;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=p(null),this._eventsCount=0):n[t]&&(0==--this._eventsCount?this._events=p(null):delete n[t]),this;if(0===arguments.length){var i,o=h(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=p(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},r.prototype.listeners=function(t){return l(this,t,!0)},r.prototype.rawListeners=function(t){return l(this,t,!1)},r.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):c.call(t,e)},r.prototype.listenerCount=c,r.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],26:[function(t,e,n){"use strict";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new i(n,r||t,o),s=c?c+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],a]:t._events[s].push(a):(t._events[s]=a,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}var l=Object.prototype.hasOwnProperty,c="~";Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(c=!1)),s.prototype.eventNames=function(){var t,e,n=[];if(0===this._eventsCount)return n;for(e in t=this._events)l.call(t,e)&&n.push(c?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},s.prototype.listeners=function(t){var e=c?c+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,o=new Array(i);r<i;r++)o[r]=n[r].fn;return o},s.prototype.listenerCount=function(t){var e=c?c+t:t,n=this._events[e];return n?n.fn?1:n.length:0},s.prototype.emit=function(t,e,n,r,i,o){var a=c?c+t:t;if(!this._events[a])return!1;var s,l,u=this._events[a],p=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),p){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,n),!0;case 4:return u.fn.call(u.context,e,n,r),!0;case 5:return u.fn.call(u.context,e,n,r,i),!0;case 6:return u.fn.call(u.context,e,n,r,i,o),!0}for(l=1,s=new Array(p-1);l<p;l++)s[l-1]=arguments[l];u.fn.apply(u.context,s)}else{var h,d=u.length;for(l=0;l<d;l++)switch(u[l].once&&this.removeListener(t,u[l].fn,void 0,!0),p){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,e);break;case 3:u[l].fn.call(u[l].context,e,n);break;case 4:u[l].fn.call(u[l].context,e,n,r);break;default:if(!s)for(h=1,s=new Array(p-1);h<p;h++)s[h-1]=arguments[h];u[l].fn.apply(u[l].context,s)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,n,r){var i=c?c+t:t;if(!this._events[i])return this;if(!e)return a(this,i),this;var o=this._events[i];if(o.fn)o.fn!==e||r&&!o.once||n&&o.context!==n||a(this,i);else{for(var s=0,l=[],u=o.length;s<u;s++)(o[s].fn!==e||r&&!o[s].once||n&&o[s].context!==n)&&l.push(o[s]);l.length?this._events[i]=1===l.length?l[0]:l:a(this,i)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=c?c+t:t,this._events[e]&&a(this,e)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=c,s.EventEmitter=s,void 0!==e&&(e.exports=s)},{}],27:[function(t,e,n){!function(){var t={};void 0!==n?e.exports=t:this.fuzzy=t,t.simpleFilter=function(e,n){return n.filter((function(n){return t.test(e,n)}))},t.test=function(e,n){return null!==t.match(e,n)},t.match=function(t,e,n){n=n||{};var r,i=0,o=[],a=e.length,s=0,l=0,c=n.pre||"",u=n.post||"",p=n.caseSensitive&&e||e.toLowerCase();t=n.caseSensitive&&t||t.toLowerCase();for(var h=0;h<a;h++)r=e[h],p[h]===t[i]?(r=c+r+u,i+=1,l+=1+l):l=0,s+=l,o[o.length]=r;return i===t.length?(s=p===t?1/0:s,{rendered:o.join(""),score:s}):null},t.filter=function(e,n,r){return n&&0!==n.length?"string"!=typeof e?n:(r=r||{},n.reduce((function(n,i,o,a){var s=i;r.extract&&(s=r.extract(i));var l=t.match(e,s,r);return null!=l&&(n[n.length]={string:l.rendered,score:l.score,index:o,original:i}),n}),[]).sort((function(t,e){return e.score-t.score||t.index-e.index}))):[]}}()},{}],28:[function(t,e,n){"use strict";var r=Object.prototype.toString;e.exports=function(t){var e;return"[object Object]"===r.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],29:[function(t,e,n){(function(t){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function r(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&m.call(t)==a}(t))return o;if(n(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=n(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(s,"");var r=c.test(t);return r||u.test(t)?p(t.slice(2),r?2:8):l.test(t)?o:+t}var i="Expected a function",o=NaN,a="[object Symbol]",s=/^\s+|\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,u=/^0o[0-7]+$/i,p=parseInt,h="object"==typeof t&&t&&t.Object===Object&&t,d="object"==typeof self&&self&&self.Object===Object&&self,f=h||d||Function("return this")(),m=Object.prototype.toString,g=Math.max,y=Math.min,v=function(){return f.Date.now()};e.exports=function(t,e,o){function a(e){var n=p,r=h;return p=h=void 0,x=e,f=t.apply(r,n)}function s(t){var n=t-_;return void 0===_||n>=e||n<0||w&&t-x>=d}function l(){var t=v();if(s(t))return c(t);m=setTimeout(l,function(t){var n=e-(t-_);return w?y(n,d-(t-x)):n}(t))}function c(t){return m=void 0,M&&p?a(t):(p=h=void 0,f)}function u(){var t=v(),n=s(t);if(p=arguments,h=this,_=t,n){if(void 0===m)return function(t){return x=t,m=setTimeout(l,e),b?a(t):f}(_);if(w)return m=setTimeout(l,e),a(_)}return void 0===m&&(m=setTimeout(l,e)),f}var p,h,d,f,m,_,x=0,b=!1,w=!1,M=!0;if("function"!=typeof t)throw new TypeError(i);return e=r(e)||0,n(o)&&(b=!!o.leading,d=(w="maxWait"in o)?g(r(o.maxWait)||0,e):d,M="trailing"in o?!!o.trailing:M),u.cancel=function(){void 0!==m&&clearTimeout(m),x=0,p=_=h=m=void 0},u.flush=function(){return void 0===m?f:c(v())},u}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],30:[function(t,e,n){(function(t){if("production"!==t.env.NODE_ENV&&("undefined"==typeof self||!self.crypto&&!self.msCrypto))throw new Error("Your browser does not have secure random generator. If you dont need unpredictable IDs, you can use nanoid/non-secure.");var n=self.crypto||self.msCrypto;e.exports=function(t){t=t||21;for(var e="",r=n.getRandomValues(new Uint8Array(t));0<t--;)e+="Uint8ArdomValuesObj012345679BCDEFGHIJKLMNPQRSTWXYZ_cfghkpqvwxyz-"[63&r[t]];return e}}).call(this,t("_process"))},{_process:31}],31:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(t){if(u===setTimeout)return setTimeout(t,0);if((u===r||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function a(){m&&d&&(m=!1,d.length?f=d.concat(f):g=-1,f.length&&s())}function s(){if(!m){var t=o(a);m=!0;for(var e=f.length;e;){for(d=f,f=[];++g<e;)d&&d[g].run();g=-1,e=f.length}d=null,m=!1,function(t){if(p===clearTimeout)return clearTimeout(t);if((p===i||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}(t)}}function l(t,e){this.fun=t,this.array=e}function c(){}var u,p,h=e.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:r}catch(t){u=r}try{p="function"==typeof clearTimeout?clearTimeout:i}catch(t){p=i}}();var d,f=[],m=!1,g=-1;h.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];f.push(new l(t,e)),1!==f.length||m||o(s)},l.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=c,h.addListener=c,h.once=c,h.off=c,h.removeListener=c,h.removeAllListeners=c,h.emit=c,h.prependListener=c,h.prependOnceListener=c,h.listeners=function(t){return[]},h.binding=function(t){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(t){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],32:[function(t,e,n){!function(t,n,r){void 0!==e&&e.exports?e.exports=r():t.subtag=r()}(this,0,(function(){function t(t){return t.match(o)||[]}function e(e){return{language:(e=t(e))[1]||i,extlang:e[2]||i,script:e[3]||i,region:e[4]||i}}function n(t,e,n){Object.defineProperty(t,e,{value:n,enumerable:!0})}function r(r,o,a){function s(e){return t(e)[r]||i}n(s,"pattern",o),n(e,a,s)}var i="",o=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;return r(1,/^[a-zA-Z]{2,3}$/,"language"),r(2,/^[a-zA-Z]{3}$/,"extlang"),r(3,/^[a-zA-Z]{4}$/,"script"),r(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),n(e,"split",(function(e){return t(e).filter((function(t,e){return t&&e}))})),e}))},{}],33:[function(t,e,n){"use strict";var r=t("./src/suggestions");window.Suggestions=e.exports=r},{"./src/suggestions":35}],34:[function(t,e,n){var r=function(t){return this.component=t,this.items=[],this.active=0,this.wrapper=document.createElement("div"),this.wrapper.className="suggestions-wrapper",this.element=document.createElement("ul"),this.element.className="suggestions",this.wrapper.appendChild(this.element),this.selectingListItem=!1,t.el.parentNode.insertBefore(this.wrapper,t.el.nextSibling),this};r.prototype.show=function(){this.element.style.display="block"},r.prototype.hide=function(){this.element.style.display="none"},r.prototype.add=function(t){this.items.push(t)},r.prototype.clear=function(){this.items=[],this.active=0},r.prototype.isEmpty=function(){return!this.items.length},r.prototype.isVisible=function(){return"block"===this.element.style.display},r.prototype.draw=function(){if(this.element.innerHTML="",0!==this.items.length){for(var t=0;t<this.items.length;t++)this.drawItem(this.items[t],this.active===t);this.show()}else this.hide()},r.prototype.drawItem=function(t,e){var n=document.createElement("li"),r=document.createElement("a");e&&(n.className+=" active"),r.innerHTML=t.string,n.appendChild(r),this.element.appendChild(n),n.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),n.addEventListener("mouseup",function(){this.handleMouseUp.call(this,t)}.bind(this))},r.prototype.handleMouseUp=function(t){this.selectingListItem=!1,this.component.value(t.original),this.clear(),this.draw()},r.prototype.move=function(t){this.active=t,this.draw()},r.prototype.previous=function(){this.move(0===this.active?this.items.length-1:this.active-1)},r.prototype.next=function(){this.move(this.active===this.items.length-1?0:this.active+1)},r.prototype.drawError=function(t){var e=document.createElement("li");e.innerHTML=t,this.element.appendChild(e),this.show()},e.exports=r},{}],35:[function(t,e,n){"use strict";var r=t("xtend"),i=t("fuzzy"),o=t("./list"),a=function(t,e,n){return n=n||{},this.options=r({minLength:2,limit:5,filter:!0},n),this.el=t,this.data=e||[],this.list=new o(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(t){this.handleKeyUp(t.keyCode)}.bind(this),!1),this.el.addEventListener("keydown",function(t){this.handleKeyDown(t)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(t){this.handlePaste(t)}.bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemValue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};a.prototype.handleKeyUp=function(t){40!==t&&38!==t&&27!==t&&13!==t&&9!==t&&this.handleInputChange(this.el.value)},a.prototype.handleKeyDown=function(t){switch(t.keyCode){case 13:case 9:this.list.isEmpty()||(this.list.isVisible()&&t.preventDefault(),this.value(this.list.items[this.list.active].original),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},a.prototype.handleBlur=function(){this.list.selectingListItem||this.list.hide()},a.prototype.handlePaste=function(t){if(t.clipboardData)this.handleInputChange(t.clipboardData.getData("Text"));else{var e=this;setTimeout((function(){e.handleInputChange(t.target.value)}),100)}},a.prototype.handleInputChange=function(t){this.query=this.normalize(t),this.list.clear(),this.query.length<this.options.minLength?this.list.draw():this.getCandidates(function(t){for(var e=0;e<t.length&&(this.list.add(t[e]),e!==this.options.limit-1);e++);this.list.draw()}.bind(this))},a.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},a.prototype.update=function(t){this.data=t,this.handleKeyUp()},a.prototype.clear=function(){this.data=[],this.list.clear()},a.prototype.normalize=function(t){return t.toLowerCase()},a.prototype.match=function(t,e){return t.indexOf(e)>-1},a.prototype.value=function(t){if(this.selected=t,this.el.value=this.getItemValue(t),document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.el.dispatchEvent(e)}else this.el.fireEvent("onchange")},a.prototype.getCandidates=function(t){var e,n={pre:"<strong>",post:"</strong>",extract:function(t){return this.getItemValue(t)}.bind(this)};this.options.filter?e=(e=i.filter(this.query,this.data,n)).map(function(t){return{original:t.original,string:this.render(t.original,t.string)}}.bind(this)):e=this.data.map(function(t){return{original:t,string:this.render(t)}}.bind(this)),t(e)},a.prototype.getItemValue=function(t){return t},a.prototype.render=function(t,e){if(e)return e;for(var n=t.original?this.getItemValue(t.original):this.getItemValue(t),r=this.normalize(n),i=r.lastIndexOf(this.query);i>-1;){var o=i+this.query.length;n=n.slice(0,i)+"<strong>"+n.slice(i,o)+"</strong>"+n.slice(o),i=r.slice(0,i).lastIndexOf(this.query)}return n},a.prototype.renderError=function(t){this.list.drawError(t)},e.exports=a},{"./list":34,fuzzy:27,xtend:36}],36:[function(t,e,n){e.exports=function(){for(var t={},e=0;e<arguments.length;e++){var n=arguments[e];for(var i in n)r.call(n,i)&&(t[i]=n[i])}return t};var r=Object.prototype.hasOwnProperty},{}]},{},[3])(3)}));!function(){var t,e,n=function(t){var e;return function(n){return e||t(e={exports:{},parent:n},e.exports),e.exports}}((function(t,e){(function(t,n){(function(){var r=z.nextTick,i=(Function.prototype.apply,Array.prototype.slice),o={},a=0;function s(t,e){this._id=t,this._clearFn=e}s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(window,this._id)},e.setImmediate="function"==typeof t?t:function(t){var n=a++,s=!(arguments.length<2)&&i.call(arguments,1);return o[n]=!0,r((function(){o[n]&&(s?t.apply(null,s):t.call(null),e.clearImmediate(n))})),n},e.clearImmediate="function"==typeof n?n:function(t){delete o[t]}}).call(this)}).call(this,n({}).setImmediate,n({}).clearImmediate)})),r={exports:{}};t=this,e=function(t){"use strict";const e="132",n=100,r=300,i=301,o=302,a=303,s=304,l=306,c=307,u=1e3,p=1001,h=1002,d=1003,f=1004,m=1005,g=1006,y=1007,v=1008,_=1009,x=1012,b=1014,w=1015,M=1016,S=1020,T=1022,E=1023,A=1026,C=1027,L=33776,P=33777,I=33778,R=33779,k=35840,z=35841,D=35842,O=35843,F=37492,B=37496,N=2300,U=2301,j=2302,V=2400,G=2401,H=2402,W=2500,q=2501,Z=3e3,X=3001,$=3007,J=3002,Y=3004,Q=3005,K=3006,tt=35044,et=35048,nt="300 es";class rt{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,r=n.length;e<r;e++)n[e].call(this,t);t.target=null}}}const it=[];for(let t=0;t<256;t++)it[t]=(t<16?"0":"")+t.toString(16);let ot=1234567;const at=Math.PI/180,st=180/Math.PI;function lt(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(it[255&t]+it[t>>8&255]+it[t>>16&255]+it[t>>24&255]+"-"+it[255&e]+it[e>>8&255]+"-"+it[e>>16&15|64]+it[e>>24&255]+"-"+it[63&n|128]+it[n>>8&255]+"-"+it[n>>16&255]+it[n>>24&255]+it[255&r]+it[r>>8&255]+it[r>>16&255]+it[r>>24&255]).toUpperCase()}function ct(t,e,n){return Math.max(e,Math.min(n,t))}function ut(t,e){return(t%e+e)%e}function pt(t,e,n){return(1-n)*t+n*e}function ht(t){return 0==(t&t-1)&&0!==t}function dt(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function ft(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var mt=Object.freeze({__proto__:null,DEG2RAD:at,RAD2DEG:st,generateUUID:lt,clamp:ct,euclideanModulo:ut,mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:pt,damp:function(t,e,n,r){return pt(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(ut(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(ot=t%2147483647),((ot=16807*ot%2147483647)-1)/2147483646},degToRad:function(t){return t*at},radToDeg:function(t){return t*st},isPowerOfTwo:ht,ceilPowerOfTwo:dt,floorPowerOfTwo:ft,setQuaternionFromProperEuler:function(t,e,n,r,i){const o=Math.cos,a=Math.sin,s=o(n/2),l=a(n/2),c=o((e+r)/2),u=a((e+r)/2),p=o((e-r)/2),h=a((e-r)/2),d=o((r-e)/2),f=a((r-e)/2);switch(i){case"XYX":t.set(s*u,l*p,l*h,s*c);break;case"YZY":t.set(l*h,s*u,l*p,s*c);break;case"ZXZ":t.set(l*p,l*h,s*u,s*c);break;case"XZX":t.set(s*u,l*f,l*d,s*c);break;case"YXY":t.set(l*d,s*u,l*f,s*c);break;case"ZYZ":t.set(l*f,l*d,s*u,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}});class gt{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*n-o*r+t.x,this.y=i*r+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}gt.prototype.isVector2=!0;class yt{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,o,a,s,l){const c=this.elements;return c[0]=t,c[1]=r,c[2]=a,c[3]=e,c[4]=i,c[5]=s,c[6]=n,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[3],s=n[6],l=n[1],c=n[4],u=n[7],p=n[2],h=n[5],d=n[8],f=r[0],m=r[3],g=r[6],y=r[1],v=r[4],_=r[7],x=r[2],b=r[5],w=r[8];return i[0]=o*f+a*y+s*x,i[3]=o*m+a*v+s*b,i[6]=o*g+a*_+s*w,i[1]=l*f+c*y+u*x,i[4]=l*m+c*v+u*b,i[7]=l*g+c*_+u*w,i[2]=p*f+h*y+d*x,i[5]=p*m+h*v+d*b,i[8]=p*g+h*_+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8];return e*o*c-e*a*l-n*i*c+n*a*s+r*i*l-r*o*s}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=c*o-a*l,p=a*s-c*i,h=l*i-o*s,d=e*u+n*p+r*h;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const f=1/d;return t[0]=u*f,t[1]=(r*l-c*n)*f,t[2]=(a*n-r*o)*f,t[3]=p*f,t[4]=(c*e-r*s)*f,t[5]=(r*i-a*e)*f,t[6]=h*f,t[7]=(n*s-l*e)*f,t[8]=(o*e-n*i)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,i,o,a){const s=Math.cos(i),l=Math.sin(i);return this.set(n*s,n*l,-n*(s*o+l*a)+o+t,-r*l,r*s,-r*(-l*o+s*a)+a+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],o=r[3],a=r[6],s=r[1],l=r[4],c=r[7];return r[0]=e*i+n*s,r[3]=e*o+n*l,r[6]=e*a+n*c,r[1]=-n*i+e*s,r[4]=-n*o+e*l,r[7]=-n*a+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let vt;yt.prototype.isMatrix3=!0;class _t{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===vt&&(vt=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),vt.width=t.width,vt.height=t.height;const n=vt.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=vt}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let xt=0;class bt extends rt{constructor(t=bt.DEFAULT_IMAGE,e=bt.DEFAULT_MAPPING,n=1001,r=1001,i=1006,o=1008,a=1023,s=1009,l=1,c=3e3){super(),Object.defineProperty(this,"id",{value:xt++}),this.uuid=lt(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=s,this.offset=new gt(0,0),this.repeat=new gt(1,1),this.center=new gt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new yt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=lt()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(wt(r[t].image)):e.push(wt(r[t]))}else e=wt(r);t.images[r.uuid]={uuid:r.uuid,url:e}}n.image=r.uuid}return e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==r)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case u:t.x=t.x-Math.floor(t.x);break;case p:t.x=t.x<0?0:1;break;case h:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case u:t.y=t.y-Math.floor(t.y);break;case p:t.y=t.y<0?0:1;break;case h:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function wt(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?_t.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}bt.DEFAULT_IMAGE=void 0,bt.DEFAULT_MAPPING=r,bt.prototype.isTexture=!0;class Mt{constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*i,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,i;const o=.01,a=t.elements,s=a[0],l=a[4],c=a[8],u=a[1],p=a[5],h=a[9],d=a[2],f=a[6],m=a[10];if(Math.abs(l-u)<o&&Math.abs(c-d)<o&&Math.abs(h-f)<o){if(Math.abs(l+u)<.1&&Math.abs(c+d)<.1&&Math.abs(h+f)<.1&&Math.abs(s+p+m-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,a=(p+1)/2,g=(m+1)/2,y=(l+u)/4,v=(c+d)/4,_=(h+f)/4;return t>a&&t>g?t<o?(n=0,r=.707106781,i=.707106781):(r=y/(n=Math.sqrt(t)),i=v/n):a>g?a<o?(n=.707106781,r=0,i=.707106781):(n=y/(r=Math.sqrt(a)),i=_/r):g<o?(n=.707106781,r=.707106781,i=0):(n=v/(i=Math.sqrt(g)),r=_/i),this.set(n,r,i,e),this}let g=Math.sqrt((f-h)*(f-h)+(c-d)*(c-d)+(u-l)*(u-l));return Math.abs(g)<.001&&(g=1),this.x=(f-h)/g,this.y=(c-d)/g,this.z=(u-l)/g,this.w=Math.acos((s+p+m-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}Mt.prototype.isVector4=!0;class St extends rt{constructor(t,e,n={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Mt(0,0,t,e),this.scissorTest=!1,this.viewport=new Mt(0,0,t,e),this.texture=new bt(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:t,height:e,depth:1},this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:g,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}St.prototype.isWebGLRenderTarget=!0;class Tt extends St{constructor(t,e,n){super(t,e);const r=this.texture;this.texture=[];for(let t=0;t<n;t++)this.texture[t]=r.clone()}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let r=0,i=this.texture.length;r<i;r++)this.texture[r].image.width=t,this.texture[r].image.height=e,this.texture[r].image.depth=n;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this.texture.length=0;for(let e=0,n=t.texture.length;e<n;e++)this.texture[e]=t.texture[e].clone();return this}}Tt.prototype.isWebGLMultipleRenderTargets=!0;class Et extends St{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}Et.prototype.isWebGLMultisampleRenderTarget=!0;class At{constructor(t=0,e=0,n=0,r=1){this._x=t,this._y=e,this._z=n,this._w=r}static slerp(t,e,n,r){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(t,e,r)}static slerpFlat(t,e,n,r,i,o,a){let s=n[r+0],l=n[r+1],c=n[r+2],u=n[r+3];const p=i[o+0],h=i[o+1],d=i[o+2],f=i[o+3];if(0===a)return t[e+0]=s,t[e+1]=l,t[e+2]=c,void(t[e+3]=u);if(1===a)return t[e+0]=p,t[e+1]=h,t[e+2]=d,void(t[e+3]=f);if(u!==f||s!==p||l!==h||c!==d){let t=1-a;const e=s*p+l*h+c*d+u*f,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),o=Math.atan2(i,e*n);t=Math.sin(t*o)/i,a=Math.sin(a*o)/i}const i=a*n;if(s=s*t+p*i,l=l*t+h*i,c=c*t+d*i,u=u*t+f*i,t===1-a){const t=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=t,l*=t,c*=t,u*=t}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,r,i,o){const a=n[r],s=n[r+1],l=n[r+2],c=n[r+3],u=i[o],p=i[o+1],h=i[o+2],d=i[o+3];return t[e]=a*d+c*u+s*h-l*p,t[e+1]=s*d+c*p+l*u-a*h,t[e+2]=l*d+c*h+a*p-s*u,t[e+3]=c*d-a*u-s*p-l*h,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,r=t._y,i=t._z,o=t._order,a=Math.cos,s=Math.sin,l=a(n/2),c=a(r/2),u=a(i/2),p=s(n/2),h=s(r/2),d=s(i/2);switch(o){case"XYZ":this._x=p*c*u+l*h*d,this._y=l*h*u-p*c*d,this._z=l*c*d+p*h*u,this._w=l*c*u-p*h*d;break;case"YXZ":this._x=p*c*u+l*h*d,this._y=l*h*u-p*c*d,this._z=l*c*d-p*h*u,this._w=l*c*u+p*h*d;break;case"ZXY":this._x=p*c*u-l*h*d,this._y=l*h*u+p*c*d,this._z=l*c*d+p*h*u,this._w=l*c*u-p*h*d;break;case"ZYX":this._x=p*c*u-l*h*d,this._y=l*h*u+p*c*d,this._z=l*c*d-p*h*u,this._w=l*c*u+p*h*d;break;case"YZX":this._x=p*c*u+l*h*d,this._y=l*h*u+p*c*d,this._z=l*c*d-p*h*u,this._w=l*c*u-p*h*d;break;case"XZY":this._x=p*c*u-l*h*d,this._y=l*h*u-p*c*d,this._z=l*c*d+p*h*u,this._w=l*c*u+p*h*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],o=e[1],a=e[5],s=e[9],l=e[2],c=e[6],u=e[10],p=n+a+u;if(p>0){const t=.5/Math.sqrt(p+1);this._w=.25/t,this._x=(c-s)*t,this._y=(i-l)*t,this._z=(o-r)*t}else if(n>a&&n>u){const t=2*Math.sqrt(1+n-a-u);this._w=(c-s)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(i+l)/t}else if(a>u){const t=2*Math.sqrt(1+a-n-u);this._w=(i-l)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(s+c)/t}else{const t=2*Math.sqrt(1+u-n-a);this._w=(o-r)/t,this._x=(i+l)/t,this._y=(s+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ct(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,i=t._z,o=t._w,a=e._x,s=e._y,l=e._z,c=e._w;return this._x=n*c+o*a+r*l-i*s,this._y=r*c+o*s+i*a-n*l,this._z=i*c+o*l+n*s-r*a,this._w=o*c-n*a-r*s-i*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,o=this._w;let a=o*t._w+n*t._x+r*t._y+i*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;const s=1-a*a;if(s<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(s),c=Math.atan2(l,a),u=Math.sin((1-e)*c)/l,p=Math.sin(e*c)/l;return this._w=o*u+this._w*p,this._x=n*u+this._x*p,this._y=r*u+this._y*p,this._z=i*u+this._z*p,this._onChangeCallback(),this}slerpQuaternions(t,e,n){this.copy(t).slerp(e,n)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}At.prototype.isQuaternion=!0;class Ct{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Pt.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Pt.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,o=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*o,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=t.w,l=s*e+o*r-a*n,c=s*n+a*e-i*r,u=s*r+i*n-o*e,p=-i*e-o*n-a*r;return this.x=l*s+p*-i+c*-a-u*-o,this.y=c*s+p*-o+u*-i-l*-a,this.z=u*s+p*-a+l*-o-c*-i,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Lt.copy(this).projectOnVector(t),this.sub(Lt)}reflect(t){return this.sub(Lt.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(ct(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}Ct.prototype.isVector3=!0;const Lt=new Ct,Pt=new At;class It{constructor(t=new Ct(1/0,1/0,1/0),e=new Ct(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0;for(let s=0,l=t.length;s<l;s+=3){const l=t[s],c=t[s+1],u=t[s+2];l<e&&(e=l),c<n&&(n=c),u<r&&(r=u),l>i&&(i=l),c>o&&(o=c),u>a&&(a=u)}return this.min.set(e,n,r),this.max.set(i,o,a),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0;for(let s=0,l=t.count;s<l;s++){const l=t.getX(s),c=t.getY(s),u=t.getZ(s);l<e&&(e=l),c<n&&(n=c),u<r&&(r=u),l>i&&(i=l),c>o&&(o=c),u>a&&(a=u)}return this.min.set(e,n,r),this.max.set(i,o,a),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=kt.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),zt.copy(e.boundingBox),zt.applyMatrix4(t.matrixWorld),this.union(zt));const n=t.children;for(let t=0,e=n.length;t<e;t++)this.expandByObject(n[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,kt),kt.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(jt),Vt.subVectors(this.max,jt),Dt.subVectors(t.a,jt),Ot.subVectors(t.b,jt),Ft.subVectors(t.c,jt),Bt.subVectors(Ot,Dt),Nt.subVectors(Ft,Ot),Ut.subVectors(Dt,Ft);let e=[0,-Bt.z,Bt.y,0,-Nt.z,Nt.y,0,-Ut.z,Ut.y,Bt.z,0,-Bt.x,Nt.z,0,-Nt.x,Ut.z,0,-Ut.x,-Bt.y,Bt.x,0,-Nt.y,Nt.x,0,-Ut.y,Ut.x,0];return!!Wt(e,Dt,Ot,Ft,Vt)&&!!Wt(e=[1,0,0,0,1,0,0,0,1],Dt,Ot,Ft,Vt)&&(Gt.crossVectors(Bt,Nt),Wt(e=[Gt.x,Gt.y,Gt.z],Dt,Ot,Ft,Vt))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return kt.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(kt).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Rt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Rt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Rt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Rt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Rt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Rt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Rt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Rt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Rt)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}It.prototype.isBox3=!0;const Rt=[new Ct,new Ct,new Ct,new Ct,new Ct,new Ct,new Ct,new Ct],kt=new Ct,zt=new It,Dt=new Ct,Ot=new Ct,Ft=new Ct,Bt=new Ct,Nt=new Ct,Ut=new Ct,jt=new Ct,Vt=new Ct,Gt=new Ct,Ht=new Ct;function Wt(t,e,n,r,i){for(let o=0,a=t.length-3;o<=a;o+=3){Ht.fromArray(t,o);const a=i.x*Math.abs(Ht.x)+i.y*Math.abs(Ht.y)+i.z*Math.abs(Ht.z),s=e.dot(Ht),l=n.dot(Ht),c=r.dot(Ht);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>a)return!1}return!0}const qt=new It,Zt=new Ct,Xt=new Ct,$t=new Ct;class Jt{constructor(t=new Ct,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):qt.setFromPoints(t).getCenter(n);let r=0;for(let e=0,i=t.length;e<i;e++)r=Math.max(r,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){$t.subVectors(t,this.center);const e=$t.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add($t.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return Xt.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(Zt.copy(t.center).add(Xt)),this.expandByPoint(Zt.copy(t.center).sub(Xt)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Yt=new Ct,Qt=new Ct,Kt=new Ct,te=new Ct,ee=new Ct,ne=new Ct,re=new Ct;class ie{constructor(t=new Ct,e=new Ct(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Yt)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Yt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Yt.copy(this.direction).multiplyScalar(e).add(this.origin),Yt.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){Qt.copy(t).add(e).multiplyScalar(.5),Kt.copy(e).sub(t).normalize(),te.copy(this.origin).sub(Qt);const i=.5*t.distanceTo(e),o=-this.direction.dot(Kt),a=te.dot(this.direction),s=-te.dot(Kt),l=te.lengthSq(),c=Math.abs(1-o*o);let u,p,h,d;if(c>0)if(p=o*a-s,d=i*c,(u=o*s-a)>=0)if(p>=-d)if(p<=d){const t=1/c;h=(u*=t)*(u+o*(p*=t)+2*a)+p*(o*u+p+2*s)+l}else p=i,h=-(u=Math.max(0,-(o*p+a)))*u+p*(p+2*s)+l;else p=-i,h=-(u=Math.max(0,-(o*p+a)))*u+p*(p+2*s)+l;else p<=-d?h=-(u=Math.max(0,-(-o*i+a)))*u+(p=u>0?-i:Math.min(Math.max(-i,-s),i))*(p+2*s)+l:p<=d?(u=0,h=(p=Math.min(Math.max(-i,-s),i))*(p+2*s)+l):h=-(u=Math.max(0,-(o*i+a)))*u+(p=u>0?i:Math.min(Math.max(-i,-s),i))*(p+2*s)+l;else p=o>0?-i:i,h=-(u=Math.max(0,-(o*p+a)))*u+p*(p+2*s)+l;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(Kt).multiplyScalar(p).add(Qt),h}intersectSphere(t,e){Yt.subVectors(t.center,this.origin);const n=Yt.dot(this.direction),r=Yt.dot(Yt)-n*n,i=t.radius*t.radius;if(r>i)return null;const o=Math.sqrt(i-r),a=n-o,s=n+o;return a<0&&s<0?null:a<0?this.at(s,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,i,o,a,s;const l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,p=this.origin;return l>=0?(n=(t.min.x-p.x)*l,r=(t.max.x-p.x)*l):(n=(t.max.x-p.x)*l,r=(t.min.x-p.x)*l),c>=0?(i=(t.min.y-p.y)*c,o=(t.max.y-p.y)*c):(i=(t.max.y-p.y)*c,o=(t.min.y-p.y)*c),n>o||i>r?null:((i>n||n!=n)&&(n=i),(o<r||r!=r)&&(r=o),u>=0?(a=(t.min.z-p.z)*u,s=(t.max.z-p.z)*u):(a=(t.max.z-p.z)*u,s=(t.min.z-p.z)*u),n>s||a>r?null:((a>n||n!=n)&&(n=a),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,Yt)}intersectTriangle(t,e,n,r,i){ee.subVectors(e,t),ne.subVectors(n,t),re.crossVectors(ee,ne);let o,a=this.direction.dot(re);if(a>0){if(r)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}te.subVectors(this.origin,t);const s=o*this.direction.dot(ne.crossVectors(te,ne));if(s<0)return null;const l=o*this.direction.dot(ee.cross(te));if(l<0)return null;if(s+l>a)return null;const c=-o*te.dot(re);return c<0?null:this.at(c/a,i)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class oe{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,o,a,s,l,c,u,p,h,d,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=s,g[2]=l,g[6]=c,g[10]=u,g[14]=p,g[3]=h,g[7]=d,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new oe).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/ae.setFromMatrixColumn(t,0).length(),i=1/ae.setFromMatrixColumn(t,1).length(),o=1/ae.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),l=Math.sin(r),c=Math.cos(i),u=Math.sin(i);if("XYZ"===t.order){const t=o*c,n=o*u,r=a*c,i=a*u;e[0]=s*c,e[4]=-s*u,e[8]=l,e[1]=n+r*l,e[5]=t-i*l,e[9]=-a*s,e[2]=i-t*l,e[6]=r+n*l,e[10]=o*s}else if("YXZ"===t.order){const t=s*c,n=s*u,r=l*c,i=l*u;e[0]=t+i*a,e[4]=r*a-n,e[8]=o*l,e[1]=o*u,e[5]=o*c,e[9]=-a,e[2]=n*a-r,e[6]=i+t*a,e[10]=o*s}else if("ZXY"===t.order){const t=s*c,n=s*u,r=l*c,i=l*u;e[0]=t-i*a,e[4]=-o*u,e[8]=r+n*a,e[1]=n+r*a,e[5]=o*c,e[9]=i-t*a,e[2]=-o*l,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){const t=o*c,n=o*u,r=a*c,i=a*u;e[0]=s*c,e[4]=r*l-n,e[8]=t*l+i,e[1]=s*u,e[5]=i*l+t,e[9]=n*l-r,e[2]=-l,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){const t=o*s,n=o*l,r=a*s,i=a*l;e[0]=s*c,e[4]=i-t*u,e[8]=r*u+n,e[1]=u,e[5]=o*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*u+r,e[10]=t-i*u}else if("XZY"===t.order){const t=o*s,n=o*l,r=a*s,i=a*l;e[0]=s*c,e[4]=-u,e[8]=l*c,e[1]=t*u+i,e[5]=o*c,e[9]=n*u-r,e[2]=r*u-n,e[6]=a*c,e[10]=i*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(le,t,ce)}lookAt(t,e,n){const r=this.elements;return he.subVectors(t,e),0===he.lengthSq()&&(he.z=1),he.normalize(),ue.crossVectors(n,he),0===ue.lengthSq()&&(1===Math.abs(n.z)?he.x+=1e-4:he.z+=1e-4,he.normalize(),ue.crossVectors(n,he)),ue.normalize(),pe.crossVectors(he,ue),r[0]=ue.x,r[4]=pe.x,r[8]=he.x,r[1]=ue.y,r[5]=pe.y,r[9]=he.y,r[2]=ue.z,r[6]=pe.z,r[10]=he.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],c=n[1],u=n[5],p=n[9],h=n[13],d=n[2],f=n[6],m=n[10],g=n[14],y=n[3],v=n[7],_=n[11],x=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],C=r[13],L=r[2],P=r[6],I=r[10],R=r[14],k=r[3],z=r[7],D=r[11],O=r[15];return i[0]=o*b+a*T+s*L+l*k,i[4]=o*w+a*E+s*P+l*z,i[8]=o*M+a*A+s*I+l*D,i[12]=o*S+a*C+s*R+l*O,i[1]=c*b+u*T+p*L+h*k,i[5]=c*w+u*E+p*P+h*z,i[9]=c*M+u*A+p*I+h*D,i[13]=c*S+u*C+p*R+h*O,i[2]=d*b+f*T+m*L+g*k,i[6]=d*w+f*E+m*P+g*z,i[10]=d*M+f*A+m*I+g*D,i[14]=d*S+f*C+m*R+g*O,i[3]=y*b+v*T+_*L+x*k,i[7]=y*w+v*E+_*P+x*z,i[11]=y*M+v*A+_*I+x*D,i[15]=y*S+v*C+_*R+x*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],o=t[1],a=t[5],s=t[9],l=t[13],c=t[2],u=t[6],p=t[10],h=t[14];return t[3]*(+i*s*u-r*l*u-i*a*p+n*l*p+r*a*h-n*s*h)+t[7]*(+e*s*h-e*l*p+i*o*p-r*o*h+r*l*c-i*s*c)+t[11]*(+e*l*u-e*a*h-i*o*u+n*o*h+i*a*c-n*l*c)+t[15]*(-r*a*c-e*s*u+e*a*p+r*o*u-n*o*p+n*s*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],p=t[10],h=t[11],d=t[12],f=t[13],m=t[14],g=t[15],y=u*m*l-f*p*l+f*s*h-a*m*h-u*s*g+a*p*g,v=d*p*l-c*m*l-d*s*h+o*m*h+c*s*g-o*p*g,_=c*f*l-d*u*l+d*a*h-o*f*h-c*a*g+o*u*g,x=d*u*s-c*f*s-d*a*p+o*f*p+c*a*m-o*u*m,b=e*y+n*v+r*_+i*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=y*w,t[1]=(f*p*i-u*m*i-f*r*h+n*m*h+u*r*g-n*p*g)*w,t[2]=(a*m*i-f*s*i+f*r*l-n*m*l-a*r*g+n*s*g)*w,t[3]=(u*s*i-a*p*i-u*r*l+n*p*l+a*r*h-n*s*h)*w,t[4]=v*w,t[5]=(c*m*i-d*p*i+d*r*h-e*m*h-c*r*g+e*p*g)*w,t[6]=(d*s*i-o*m*i-d*r*l+e*m*l+o*r*g-e*s*g)*w,t[7]=(o*p*i-c*s*i+c*r*l-e*p*l-o*r*h+e*s*h)*w,t[8]=_*w,t[9]=(d*u*i-c*f*i-d*n*h+e*f*h+c*n*g-e*u*g)*w,t[10]=(o*f*i-d*a*i+d*n*l-e*f*l-o*n*g+e*a*g)*w,t[11]=(c*a*i-o*u*i-c*n*l+e*u*l+o*n*h-e*a*h)*w,t[12]=x*w,t[13]=(c*f*r-d*u*r+d*n*p-e*f*p-c*n*m+e*u*m)*w,t[14]=(d*a*r-o*f*r-d*n*s+e*f*s+o*n*m-e*a*m)*w,t[15]=(o*u*r-c*a*r+c*n*s-e*u*s-o*n*p+e*a*p)*w,this}scale(t){const e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),i=1-n,o=t.x,a=t.y,s=t.z,l=i*o,c=i*a;return this.set(l*o+n,l*a-r*s,l*s+r*a,0,l*a+r*s,c*a+n,c*s-r*o,0,l*s-r*a,c*s+r*o,i*s*s+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,r,i,o){return this.set(1,n,i,0,t,1,o,0,e,r,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,o=e._y,a=e._z,s=e._w,l=i+i,c=o+o,u=a+a,p=i*l,h=i*c,d=i*u,f=o*c,m=o*u,g=a*u,y=s*l,v=s*c,_=s*u,x=n.x,b=n.y,w=n.z;return r[0]=(1-(f+g))*x,r[1]=(h+_)*x,r[2]=(d-v)*x,r[3]=0,r[4]=(h-_)*b,r[5]=(1-(p+g))*b,r[6]=(m+y)*b,r[7]=0,r[8]=(d+v)*w,r[9]=(m-y)*w,r[10]=(1-(p+f))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=ae.set(r[0],r[1],r[2]).length();const o=ae.set(r[4],r[5],r[6]).length(),a=ae.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],se.copy(this);const s=1/i,l=1/o,c=1/a;return se.elements[0]*=s,se.elements[1]*=s,se.elements[2]*=s,se.elements[4]*=l,se.elements[5]*=l,se.elements[6]*=l,se.elements[8]*=c,se.elements[9]*=c,se.elements[10]*=c,e.setFromRotationMatrix(se),n.x=i,n.y=o,n.z=a,this}makePerspective(t,e,n,r,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,s=2*i/(e-t),l=2*i/(n-r),c=(e+t)/(e-t),u=(n+r)/(n-r),p=-(o+i)/(o-i),h=-2*o*i/(o-i);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=p,a[14]=h,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,n,r,i,o){const a=this.elements,s=1/(e-t),l=1/(n-r),c=1/(o-i),u=(e+t)*s,p=(n+r)*l,h=(o+i)*c;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-p,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-h,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}oe.prototype.isMatrix4=!0;const ae=new Ct,se=new oe,le=new Ct(0,0,0),ce=new Ct(1,1,1),ue=new Ct,pe=new Ct,he=new Ct,de=new oe,fe=new At;class me{constructor(t=0,e=0,n=0,r=me.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r=this._order){return this._x=t,this._y=e,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const r=t.elements,i=r[0],o=r[4],a=r[8],s=r[1],l=r[5],c=r[9],u=r[2],p=r[6],h=r[10];switch(e){case"XYZ":this._y=Math.asin(ct(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,h),this._z=Math.atan2(-o,i)):(this._x=Math.atan2(p,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ct(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-u,i),this._z=0);break;case"ZXY":this._x=Math.asin(ct(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-ct(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,h),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(ct(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-ct(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,l),this._y=Math.atan2(a,i)):(this._x=Math.atan2(-c,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return de.makeRotationFromQuaternion(t),this.setFromRotationMatrix(de,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return fe.setFromEuler(this),this.setFromQuaternion(fe,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Ct(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}me.prototype.isEuler=!0,me.DefaultOrder="XYZ",me.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class ge{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let ye=0;const ve=new Ct,_e=new At,xe=new oe,be=new Ct,we=new Ct,Me=new Ct,Se=new At,Te=new Ct(1,0,0),Ee=new Ct(0,1,0),Ae=new Ct(0,0,1),Ce={type:"added"},Le={type:"removed"};class Pe extends rt{constructor(){super(),Object.defineProperty(this,"id",{value:ye++}),this.uuid=lt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Pe.DefaultUp.clone();const t=new Ct,e=new me,n=new At,r=new Ct(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new oe},normalMatrix:{value:new yt}}),this.matrix=new oe,this.matrixWorld=new oe,this.matrixAutoUpdate=Pe.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ge,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return _e.setFromAxisAngle(t,e),this.quaternion.multiply(_e),this}rotateOnWorldAxis(t,e){return _e.setFromAxisAngle(t,e),this.quaternion.premultiply(_e),this}rotateX(t){return this.rotateOnAxis(Te,t)}rotateY(t){return this.rotateOnAxis(Ee,t)}rotateZ(t){return this.rotateOnAxis(Ae,t)}translateOnAxis(t,e){return ve.copy(t).applyQuaternion(this.quaternion),this.position.add(ve.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Te,t)}translateY(t){return this.translateOnAxis(Ee,t)}translateZ(t){return this.translateOnAxis(Ae,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(xe.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?be.copy(t):be.set(t,e,n);const r=this.parent;this.updateWorldMatrix(!0,!1),we.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?xe.lookAt(we,be,this.up):xe.lookAt(be,we,this.up),this.quaternion.setFromRotationMatrix(xe),r&&(xe.extractRotation(r.matrixWorld),_e.setFromRotationMatrix(xe),this.quaternion.premultiply(_e.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Ce)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Le)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(Le)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),xe.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),xe.multiply(t.parent.matrixWorld)),t.applyMatrix4(xe),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,r=this.children.length;n<r;n++){const r=this.children[n].getObjectByProperty(t,e);if(void 0!==r)return r}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(we,t,Me),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(we,Se,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};function i(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,r=n.length;e<r;e++){const r=n[e];i(t.shapes,r)}else i(t.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,r=this.material.length;n<r;n++)e.push(i(t.materials,this.material[n]));r.material=e}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(let e=0;e<this.children.length;e++)r.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];r.animations.push(i(t.animations,n))}}if(e){const e=o(t.geometries),r=o(t.materials),i=o(t.textures),a=o(t.images),s=o(t.shapes),l=o(t.skeletons),c=o(t.animations);e.length>0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),a.length>0&&(n.images=a),s.length>0&&(n.shapes=s),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=r,n;function o(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}Pe.DefaultUp=new Ct(0,1,0),Pe.DefaultMatrixAutoUpdate=!0,Pe.prototype.isObject3D=!0;const Ie=new Ct,Re=new Ct,ke=new Ct,ze=new Ct,De=new Ct,Oe=new Ct,Fe=new Ct,Be=new Ct,Ne=new Ct,Ue=new Ct;class je{constructor(t=new Ct,e=new Ct,n=new Ct){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){r.subVectors(n,e),Ie.subVectors(t,e),r.cross(Ie);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){Ie.subVectors(r,e),Re.subVectors(n,e),ke.subVectors(t,e);const o=Ie.dot(Ie),a=Ie.dot(Re),s=Ie.dot(ke),l=Re.dot(Re),c=Re.dot(ke),u=o*l-a*a;if(0===u)return i.set(-2,-1,-1);const p=1/u,h=(l*s-a*c)*p,d=(o*c-a*s)*p;return i.set(1-h-d,d,h)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,ze),ze.x>=0&&ze.y>=0&&ze.x+ze.y<=1}static getUV(t,e,n,r,i,o,a,s){return this.getBarycoord(t,e,n,r,ze),s.set(0,0),s.addScaledVector(i,ze.x),s.addScaledVector(o,ze.y),s.addScaledVector(a,ze.z),s}static isFrontFacing(t,e,n,r){return Ie.subVectors(n,e),Re.subVectors(t,e),Ie.cross(Re).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Ie.subVectors(this.c,this.b),Re.subVectors(this.a,this.b),.5*Ie.cross(Re).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return je.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return je.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return je.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return je.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return je.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,r=this.b,i=this.c;let o,a;De.subVectors(r,n),Oe.subVectors(i,n),Be.subVectors(t,n);const s=De.dot(Be),l=Oe.dot(Be);if(s<=0&&l<=0)return e.copy(n);Ne.subVectors(t,r);const c=De.dot(Ne),u=Oe.dot(Ne);if(c>=0&&u<=c)return e.copy(r);const p=s*u-c*l;if(p<=0&&s>=0&&c<=0)return o=s/(s-c),e.copy(n).addScaledVector(De,o);Ue.subVectors(t,i);const h=De.dot(Ue),d=Oe.dot(Ue);if(d>=0&&h<=d)return e.copy(i);const f=h*l-s*d;if(f<=0&&l>=0&&d<=0)return a=l/(l-d),e.copy(n).addScaledVector(Oe,a);const m=c*d-h*u;if(m<=0&&u-c>=0&&h-d>=0)return Fe.subVectors(i,r),a=(u-c)/(u-c+(h-d)),e.copy(r).addScaledVector(Fe,a);const g=1/(m+f+p);return o=f*g,a=p*g,e.copy(n).addScaledVector(De,o).addScaledVector(Oe,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Ve=0;class Ge extends rt{constructor(){super(),Object.defineProperty(this,"id",{value:Ve++}),this.uuid=lt(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.format=E,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=n,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheenTint&&this.sheenTint.isColor&&(n.sheenTint=this.sheenTint.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularTint&&this.specularTint.isColor&&(n.specularTint=this.specularTint.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularTintMap&&this.specularTintMap.isTexture&&(n.specularTintMap=this.specularTintMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationTint&&(n.attenuationTint=this.attenuationTint.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.format!==E&&(n.format=this.format),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.format=t.format,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let r=0;r!==t;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}Ge.prototype.isMaterial=!0;const He={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},We={h:0,s:0,l:0},qe={h:0,s:0,l:0};function Ze(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function Xe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function $e(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Je{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=ut(t,1),e=ct(e,0,1),n=ct(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=Ze(i,r,t+1/3),this.g=Ze(i,r,t),this.b=Ze(i,r,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,i=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=He[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=Xe(t.r),this.g=Xe(t.g),this.b=Xe(t.b),this}copyLinearToSRGB(t){return this.r=$e(t.r),this.g=$e(t.g),this.b=$e(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,n=this.g,r=this.b,i=Math.max(e,n,r),o=Math.min(e,n,r);let a,s;const l=(o+i)/2;if(o===i)a=0,s=0;else{const t=i-o;switch(s=l<=.5?t/(i+o):t/(2-i-o),i){case e:a=(n-r)/t+(n<r?6:0);break;case n:a=(r-e)/t+2;break;case r:a=(e-n)/t+4}a/=6}return t.h=a,t.s=s,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,n){return this.getHSL(We),We.h+=t,We.s+=e,We.l+=n,this.setHSL(We.h,We.s,We.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(We),t.getHSL(qe);const n=pt(We.h,qe.h,e),r=pt(We.s,qe.s,e),i=pt(We.l,qe.l,e);return this.setHSL(n,r,i),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Je.NAMES=He,Je.prototype.isColor=!0,Je.prototype.r=1,Je.prototype.g=1,Je.prototype.b=1;class Ye extends Ge{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Je(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Ye.prototype.isMeshBasicMaterial=!0;const Qe=new Ct,Ke=new gt;class tn{constructor(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=tt,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),i=new Je),e[n++]=i.r,e[n++]=i.g,e[n++]=i.b}return this}copyVector2sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),i=new gt),e[n++]=i.x,e[n++]=i.y}return this}copyVector3sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),i=new Ct),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z}return this}copyVector4sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),i=new Mt),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z,e[n++]=i.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Ke.fromBufferAttribute(this,e),Ke.applyMatrix3(t),this.setXY(e,Ke.x,Ke.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)Qe.fromBufferAttribute(this,e),Qe.applyMatrix3(t),this.setXYZ(e,Qe.x,Qe.y,Qe.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)Qe.x=this.getX(e),Qe.y=this.getY(e),Qe.z=this.getZ(e),Qe.applyMatrix4(t),this.setXYZ(e,Qe.x,Qe.y,Qe.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Qe.x=this.getX(e),Qe.y=this.getY(e),Qe.z=this.getZ(e),Qe.applyNormalMatrix(t),this.setXYZ(e,Qe.x,Qe.y,Qe.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Qe.x=this.getX(e),Qe.y=this.getY(e),Qe.z=this.getZ(e),Qe.transformDirection(t),this.setXYZ(e,Qe.x,Qe.y,Qe.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this}setXYZW(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==tt&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}tn.prototype.isBufferAttribute=!0;class en extends tn{constructor(t,e,n){super(new Int8Array(t),e,n)}}class nn extends tn{constructor(t,e,n){super(new Uint8Array(t),e,n)}}class rn extends tn{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}}class on extends tn{constructor(t,e,n){super(new Int16Array(t),e,n)}}class an extends tn{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class sn extends tn{constructor(t,e,n){super(new Int32Array(t),e,n)}}class ln extends tn{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class cn extends tn{constructor(t,e,n){super(new Uint16Array(t),e,n)}}cn.prototype.isFloat16BufferAttribute=!0;class un extends tn{constructor(t,e,n){super(new Float32Array(t),e,n)}}class pn extends tn{constructor(t,e,n){super(new Float64Array(t),e,n)}}function hn(t){if(0===t.length)return-1/0;let e=t[0];for(let n=1,r=t.length;n<r;++n)t[n]>e&&(e=t[n]);return e}const dn={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function fn(t,e){return new dn[t](e)}let mn=0;const gn=new oe,yn=new Pe,vn=new Ct,_n=new It,xn=new It,bn=new Ct;class wn extends rt{constructor(){super(),Object.defineProperty(this,"id",{value:mn++}),this.uuid=lt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(hn(t)>65535?ln:an)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new yt).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return gn.makeRotationFromQuaternion(t),this.applyMatrix4(gn),this}rotateX(t){return gn.makeRotationX(t),this.applyMatrix4(gn),this}rotateY(t){return gn.makeRotationY(t),this.applyMatrix4(gn),this}rotateZ(t){return gn.makeRotationZ(t),this.applyMatrix4(gn),this}translate(t,e,n){return gn.makeTranslation(t,e,n),this.applyMatrix4(gn),this}scale(t,e,n){return gn.makeScale(t,e,n),this.applyMatrix4(gn),this}lookAt(t){return yn.lookAt(t),yn.updateMatrix(),this.applyMatrix4(yn.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(vn).negate(),this.translate(vn.x,vn.y,vn.z),this}setFromPoints(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];e.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new un(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new It);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Ct(-1/0,-1/0,-1/0),new Ct(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];_n.setFromBufferAttribute(n),this.morphTargetsRelative?(bn.addVectors(this.boundingBox.min,_n.min),this.boundingBox.expandByPoint(bn),bn.addVectors(this.boundingBox.max,_n.max),this.boundingBox.expandByPoint(bn)):(this.boundingBox.expandByPoint(_n.min),this.boundingBox.expandByPoint(_n.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Jt);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Ct,1/0);if(t){const n=this.boundingSphere.center;if(_n.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];xn.setFromBufferAttribute(n),this.morphTargetsRelative?(bn.addVectors(_n.min,xn.min),_n.expandByPoint(bn),bn.addVectors(_n.max,xn.max),_n.expandByPoint(bn)):(_n.expandByPoint(xn.min),_n.expandByPoint(xn.max))}_n.getCenter(n);let r=0;for(let e=0,i=t.count;e<i;e++)bn.fromBufferAttribute(t,e),r=Math.max(r,n.distanceToSquared(bn));if(e)for(let i=0,o=e.length;i<o;i++){const o=e[i],a=this.morphTargetsRelative;for(let e=0,i=o.count;e<i;e++)bn.fromBufferAttribute(o,e),a&&(vn.fromBufferAttribute(t,e),bn.add(vn)),r=Math.max(r,n.distanceToSquared(bn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.array,r=e.position.array,i=e.normal.array,o=e.uv.array,a=r.length/3;void 0===e.tangent&&this.setAttribute("tangent",new tn(new Float32Array(4*a),4));const s=e.tangent.array,l=[],c=[];for(let t=0;t<a;t++)l[t]=new Ct,c[t]=new Ct;const u=new Ct,p=new Ct,h=new Ct,d=new gt,f=new gt,m=new gt,g=new Ct,y=new Ct;function v(t,e,n){u.fromArray(r,3*t),p.fromArray(r,3*e),h.fromArray(r,3*n),d.fromArray(o,2*t),f.fromArray(o,2*e),m.fromArray(o,2*n),p.sub(u),h.sub(u),f.sub(d),m.sub(d);const i=1/(f.x*m.y-m.x*f.y);isFinite(i)&&(g.copy(p).multiplyScalar(m.y).addScaledVector(h,-f.y).multiplyScalar(i),y.copy(h).multiplyScalar(f.x).addScaledVector(p,-m.x).multiplyScalar(i),l[t].add(g),l[e].add(g),l[n].add(g),c[t].add(y),c[e].add(y),c[n].add(y))}let _=this.groups;0===_.length&&(_=[{start:0,count:n.length}]);for(let t=0,e=_.length;t<e;++t){const e=_[t],r=e.start;for(let t=r,i=r+e.count;t<i;t+=3)v(n[t+0],n[t+1],n[t+2])}const x=new Ct,b=new Ct,w=new Ct,M=new Ct;function S(t){w.fromArray(i,3*t),M.copy(w);const e=l[t];x.copy(e),x.sub(w.multiplyScalar(w.dot(e))).normalize(),b.crossVectors(M,e);const n=b.dot(c[t])<0?-1:1;s[4*t]=x.x,s[4*t+1]=x.y,s[4*t+2]=x.z,s[4*t+3]=n}for(let t=0,e=_.length;t<e;++t){const e=_[t],r=e.start;for(let t=r,i=r+e.count;t<i;t+=3)S(n[t+0]),S(n[t+1]),S(n[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new tn(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const r=new Ct,i=new Ct,o=new Ct,a=new Ct,s=new Ct,l=new Ct,c=new Ct,u=new Ct;if(t)for(let p=0,h=t.count;p<h;p+=3){const h=t.getX(p+0),d=t.getX(p+1),f=t.getX(p+2);r.fromBufferAttribute(e,h),i.fromBufferAttribute(e,d),o.fromBufferAttribute(e,f),c.subVectors(o,i),u.subVectors(r,i),c.cross(u),a.fromBufferAttribute(n,h),s.fromBufferAttribute(n,d),l.fromBufferAttribute(n,f),a.add(c),s.add(c),l.add(c),n.setXYZ(h,a.x,a.y,a.z),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,a=e.count;t<a;t+=3)r.fromBufferAttribute(e,t+0),i.fromBufferAttribute(e,t+1),o.fromBufferAttribute(e,t+2),c.subVectors(o,i),u.subVectors(r,i),c.cross(u),n.setXYZ(t+0,c.x,c.y,c.z),n.setXYZ(t+1,c.x,c.y,c.z),n.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const r in n){if(void 0===t.attributes[r])continue;const i=n[r].array,o=t.attributes[r],a=o.array,s=o.itemSize*e,l=Math.min(a.length,i.length-s);for(let t=0,e=s;t<l;t++,e++)i[e]=a[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)bn.fromBufferAttribute(t,e),bn.normalize(),t.setXYZ(e,bn.x,bn.y,bn.z)}toNonIndexed(){function t(t,e){const n=t.array,r=t.itemSize,i=t.normalized,o=new n.constructor(e.length*r);let a=0,s=0;for(let i=0,l=e.length;i<l;i++){a=t.isInterleavedBufferAttribute?e[i]*t.data.stride+t.offset:e[i]*r;for(let t=0;t<r;t++)o[s++]=n[a++]}return new tn(o,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new wn,n=this.index.array,r=this.attributes;for(const i in r){const o=t(r[i],n);e.setAttribute(i,o)}const i=this.morphAttributes;for(const r in i){const o=[],a=i[r];for(let e=0,r=a.length;e<r;e++){const r=t(a[e],n);o.push(r)}e.morphAttributes[r]=o}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let t=0,n=o.length;t<n;t++){const n=o[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const r=n[e];t.data.attributes[e]=r.toJSON(t.data)}const r={};let i=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],o=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];o.push(r.toJSON(t.data))}o.length>0&&(r[e]=o,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new wn).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const r=t.attributes;for(const t in r){const n=r[t];this.setAttribute(t,n.clone(e))}const i=t.morphAttributes;for(const t in i){const n=[],r=i[t];for(let t=0,i=r.length;t<i;t++)n.push(r[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let t=0,e=o.length;t<e;t++){const e=o[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const s=t.boundingSphere;return null!==s&&(this.boundingSphere=s.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}wn.prototype.isBufferGeometry=!0;const Mn=new oe,Sn=new ie,Tn=new Jt,En=new Ct,An=new Ct,Cn=new Ct,Ln=new Ct,Pn=new Ct,In=new Ct,Rn=new Ct,kn=new Ct,zn=new Ct,Dn=new gt,On=new gt,Fn=new gt,Bn=new Ct,Nn=new Ct;class Un extends Pe{constructor(t=new wn,e=new Ye){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),Tn.copy(n.boundingSphere),Tn.applyMatrix4(i),!1===t.ray.intersectsSphere(Tn))return;if(Mn.copy(i).invert(),Sn.copy(t.ray).applyMatrix4(Mn),null!==n.boundingBox&&!1===Sn.intersectsBox(n.boundingBox))return;let o;if(n.isBufferGeometry){const i=n.index,a=n.attributes.position,s=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,u=n.attributes.uv2,p=n.groups,h=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,d=p.length;n<d;n++){const d=p[n],f=r[d.materialIndex];for(let n=Math.max(d.start,h.start),r=Math.min(d.start+d.count,h.start+h.count);n<r;n+=3){const r=i.getX(n),p=i.getX(n+1),h=i.getX(n+2);(o=jn(this,f,t,Sn,a,s,l,c,u,r,p,h))&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=d.materialIndex,e.push(o))}}else for(let n=Math.max(0,h.start),p=Math.min(i.count,h.start+h.count);n<p;n+=3){const p=i.getX(n),h=i.getX(n+1),d=i.getX(n+2);(o=jn(this,r,t,Sn,a,s,l,c,u,p,h,d))&&(o.faceIndex=Math.floor(n/3),e.push(o))}else if(void 0!==a)if(Array.isArray(r))for(let n=0,i=p.length;n<i;n++){const i=p[n],d=r[i.materialIndex];for(let n=Math.max(i.start,h.start),r=Math.min(i.start+i.count,h.start+h.count);n<r;n+=3)(o=jn(this,d,t,Sn,a,s,l,c,u,n,n+1,n+2))&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=i.materialIndex,e.push(o))}else for(let n=Math.max(0,h.start),i=Math.min(a.count,h.start+h.count);n<i;n+=3)(o=jn(this,r,t,Sn,a,s,l,c,u,n,n+1,n+2))&&(o.faceIndex=Math.floor(n/3),e.push(o))}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function jn(t,e,n,r,i,o,a,s,l,c,u,p){En.fromBufferAttribute(i,c),An.fromBufferAttribute(i,u),Cn.fromBufferAttribute(i,p);const h=t.morphTargetInfluences;if(o&&h){Rn.set(0,0,0),kn.set(0,0,0),zn.set(0,0,0);for(let t=0,e=o.length;t<e;t++){const e=h[t],n=o[t];0!==e&&(Ln.fromBufferAttribute(n,c),Pn.fromBufferAttribute(n,u),In.fromBufferAttribute(n,p),a?(Rn.addScaledVector(Ln,e),kn.addScaledVector(Pn,e),zn.addScaledVector(In,e)):(Rn.addScaledVector(Ln.sub(En),e),kn.addScaledVector(Pn.sub(An),e),zn.addScaledVector(In.sub(Cn),e)))}En.add(Rn),An.add(kn),Cn.add(zn)}t.isSkinnedMesh&&(t.boneTransform(c,En),t.boneTransform(u,An),t.boneTransform(p,Cn));const d=function(t,e,n,r,i,o,a,s){let l;if(null===(l=1===e.side?r.intersectTriangle(a,o,i,!0,s):r.intersectTriangle(i,o,a,2!==e.side,s)))return null;Nn.copy(s),Nn.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(Nn);return c<n.near||c>n.far?null:{distance:c,point:Nn.clone(),object:t}}(t,e,n,r,En,An,Cn,Bn);if(d){s&&(Dn.fromBufferAttribute(s,c),On.fromBufferAttribute(s,u),Fn.fromBufferAttribute(s,p),d.uv=je.getUV(Bn,En,An,Cn,Dn,On,Fn,new gt)),l&&(Dn.fromBufferAttribute(l,c),On.fromBufferAttribute(l,u),Fn.fromBufferAttribute(l,p),d.uv2=je.getUV(Bn,En,An,Cn,Dn,On,Fn,new gt));const t={a:c,b:u,c:p,normal:new Ct,materialIndex:0};je.getNormal(En,An,Cn,t.normal),d.face=t}return d}Un.prototype.isMesh=!0;class Vn extends wn{constructor(t=1,e=1,n=1,r=1,i=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};const a=this;r=Math.floor(r),i=Math.floor(i),o=Math.floor(o);const s=[],l=[],c=[],u=[];let p=0,h=0;function d(t,e,n,r,i,o,d,f,m,g,y){const v=o/m,_=d/g,x=o/2,b=d/2,w=f/2,M=m+1,S=g+1;let T=0,E=0;const A=new Ct;for(let o=0;o<S;o++){const a=o*_-b;for(let s=0;s<M;s++){const p=s*v-x;A[t]=p*r,A[e]=a*i,A[n]=w,l.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=f>0?1:-1,c.push(A.x,A.y,A.z),u.push(s/m),u.push(1-o/g),T+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const n=p+e+M*t,r=p+e+M*(t+1),i=p+(e+1)+M*(t+1),o=p+(e+1)+M*t;s.push(n,r,o),s.push(r,i,o),E+=6}a.addGroup(h,E,y),h+=E,p+=T}d("z","y","x",-1,-1,n,e,t,o,i,0),d("z","y","x",1,-1,n,e,-t,o,i,1),d("x","z","y",1,1,t,n,e,r,o,2),d("x","z","y",1,-1,t,n,-e,r,o,3),d("x","y","z",1,-1,t,e,n,r,i,4),d("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(s),this.setAttribute("position",new un(l,3)),this.setAttribute("normal",new un(c,3)),this.setAttribute("uv",new un(u,2))}static fromJSON(t){return new Vn(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Gn(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function Hn(t){const e={};for(let n=0;n<t.length;n++){const r=Gn(t[n]);for(const t in r)e[t]=r[t]}return e}const Wn={clone:Gn,merge:Hn};class qn extends Ge{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Gn(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const r=this.uniforms[n].value;r&&r.isTexture?e.uniforms[n]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[n]={type:"m4",value:r.toArray()}:e.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}qn.prototype.isShaderMaterial=!0;class Zn extends Pe{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new oe,this.projectionMatrix=new oe,this.projectionMatrixInverse=new oe}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}Zn.prototype.isCamera=!0;class Xn extends Zn{constructor(t=50,e=1,n=.1,r=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*st*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*at*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*st*Math.atan(Math.tan(.5*at*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,r,i,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*at*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,a=o.fullHeight;i+=o.offsetX*r/t,e-=o.offsetY*n/a,r*=o.width/t,n*=o.height/a}const a=this.filmOffset;0!==a&&(i+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}Xn.prototype.isPerspectiveCamera=!0;class $n extends Pe{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const r=new Xn(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Ct(1,0,0)),this.add(r);const i=new Xn(90,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Ct(-1,0,0)),this.add(i);const o=new Xn(90,1,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new Ct(0,1,0)),this.add(o);const a=new Xn(90,1,t,e);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new Ct(0,-1,0)),this.add(a);const s=new Xn(90,1,t,e);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new Ct(0,0,1)),this.add(s);const l=new Xn(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Ct(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,o,a,s,l]=this.children,c=t.xr.enabled,u=t.getRenderTarget();t.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,a),t.setRenderTarget(n,4),t.render(e,s),n.texture.generateMipmaps=p,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(u),t.xr.enabled=c}}class Jn extends bt{constructor(t,e,n,r,o,a,s,l,c,u){super(t=void 0!==t?t:[],e=void 0!==e?e:i,n,r,o,a,s=void 0!==s?s:T,l,c,u),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}Jn.prototype.isCubeTexture=!0;class Yn extends St{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new Jn(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:g,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=E,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n=new Vn(5,5,5),r=new qn({name:"CubemapFromEquirect",uniforms:Gn({tEquirect:{value:null}}),vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",side:1,blending:0});r.uniforms.tEquirect.value=e;const i=new Un(n,r),o=e.minFilter;return e.minFilter===v&&(e.minFilter=g),new $n(1,10,this).update(t,i),e.minFilter=o,i.geometry.dispose(),i.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let i=0;i<6;i++)t.setRenderTarget(this,i),t.clear(e,n,r);t.setRenderTarget(i)}}Yn.prototype.isWebGLCubeRenderTarget=!0;const Qn=new Ct,Kn=new Ct,tr=new yt;class er{constructor(t=new Ct(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const r=Qn.subVectors(n,e).cross(Kn.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(Qn),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const i=-(t.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:e.copy(n).multiplyScalar(i).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||tr.getNormalMatrix(t),r=this.coplanarPoint(Qn).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}er.prototype.isPlane=!0;const nr=new Jt,rr=new Ct;class ir{constructor(t=new er,e=new er,n=new er,r=new er,i=new er,o=new er){this.planes=[t,e,n,r,i,o]}set(t,e,n,r,i,o){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],l=n[5],c=n[6],u=n[7],p=n[8],h=n[9],d=n[10],f=n[11],m=n[12],g=n[13],y=n[14],v=n[15];return e[0].setComponents(a-r,u-s,f-p,v-m).normalize(),e[1].setComponents(a+r,u+s,f+p,v+m).normalize(),e[2].setComponents(a+i,u+l,f+h,v+g).normalize(),e[3].setComponents(a-i,u-l,f-h,v-g).normalize(),e[4].setComponents(a-o,u-c,f-d,v-y).normalize(),e[5].setComponents(a+o,u+c,f+d,v+y).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),nr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(nr)}intersectsSprite(t){return nr.center.set(0,0,0),nr.radius=.7071067811865476,nr.applyMatrix4(t.matrixWorld),this.intersectsSphere(nr)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(n)<r)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const r=e[n];if(rr.x=r.normal.x>0?t.max.x:t.min.x,rr.y=r.normal.y>0?t.max.y:t.min.y,rr.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(rr)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function or(){let t=null,e=!1,n=null,r=null;function i(e,o){n(e,o),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function ar(t,e){const n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){const t=r.get(e);return void((!t||t.version<e.version)&&r.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const o=r.get(e);void 0===o?r.set(e,function(e,r){const i=e.array,o=e.usage,a=t.createBuffer();t.bindBuffer(r,a),t.bufferData(r,i,o),e.onUploadCallback();let s=5126;return i instanceof Float32Array?s=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?e.isFloat16BufferAttribute?n?s=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):s=5123:i instanceof Int16Array?s=5122:i instanceof Uint32Array?s=5125:i instanceof Int32Array?s=5124:i instanceof Int8Array?s=5120:(i instanceof Uint8Array||i instanceof Uint8ClampedArray)&&(s=5121),{buffer:a,type:s,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}(e,i)):o.version<e.version&&(function(e,r,i){const o=r.array,a=r.updateRange;t.bindBuffer(i,e),-1===a.count?t.bufferSubData(i,0,o):(n?t.bufferSubData(i,a.offset*o.BYTES_PER_ELEMENT,o,a.offset,a.count):t.bufferSubData(i,a.offset*o.BYTES_PER_ELEMENT,o.subarray(a.offset,a.offset+a.count)),a.count=-1)}(o.buffer,e,i),o.version=e.version)}}}class sr extends wn{constructor(t=1,e=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};const i=t/2,o=e/2,a=Math.floor(n),s=Math.floor(r),l=a+1,c=s+1,u=t/a,p=e/s,h=[],d=[],f=[],m=[];for(let t=0;t<c;t++){const e=t*p-o;for(let n=0;n<l;n++){const r=n*u-i;d.push(r,-e,0),f.push(0,0,1),m.push(n/a),m.push(1-t/s)}}for(let t=0;t<s;t++)for(let e=0;e<a;e++){const n=e+l*t,r=e+l*(t+1),i=e+1+l*(t+1),o=e+1+l*t;h.push(n,r,o),h.push(r,i,o)}this.setIndex(h),this.setAttribute("position",new un(d,3)),this.setAttribute("normal",new un(f,3)),this.setAttribute("uv",new un(m,2))}static fromJSON(t){return new sr(t.width,t.height,t.widthSegments,t.heightSegments)}}const lr={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotVH = saturate( dot( geometry.viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float NoH ) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float NoV, float NoL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) ) );\n}\nvec3 BRDF_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getIBLIrradiance( const in GeometricContext geometry ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec;\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\t#else\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\t\t\t#endif\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularTintFactor = specularTint;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARTINTMAP\n\t\t\tspecularTintFactor *= specularTintMapTexelToLinear( texture2D( specularTintMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularTintFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularTintFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenTint = sheenTint;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenTint;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(\t\t0, 1,\t\t0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += irradiance * BRDF_Sheen( material.roughness, directLight.direction, geometry, material.sheenTint );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(\t1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,\t1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,\t1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationTint, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = transmission.a;\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationTint;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( float roughness, float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularTint;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARTINTMAP\n\t\tuniform sampler2D specularTintMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenTint;\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - clearcoat * Fcc ) + clearcoatSpecular * clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},cr={common:{diffuse:{value:new Je(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new yt},uv2Transform:{value:new yt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new gt(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Je(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Je(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new yt}},sprite:{diffuse:{value:new Je(16777215)},opacity:{value:1},center:{value:new gt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new yt}}},ur={basic:{uniforms:Hn([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.fog]),vertexShader:lr.meshbasic_vert,fragmentShader:lr.meshbasic_frag},lambert:{uniforms:Hn([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.fog,cr.lights,{emissive:{value:new Je(0)}}]),vertexShader:lr.meshlambert_vert,fragmentShader:lr.meshlambert_frag},phong:{uniforms:Hn([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.fog,cr.lights,{emissive:{value:new Je(0)},specular:{value:new Je(1118481)},shininess:{value:30}}]),vertexShader:lr.meshphong_vert,fragmentShader:lr.meshphong_frag},standard:{uniforms:Hn([cr.common,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.roughnessmap,cr.metalnessmap,cr.fog,cr.lights,{emissive:{value:new Je(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lr.meshphysical_vert,fragmentShader:lr.meshphysical_frag},toon:{uniforms:Hn([cr.common,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.gradientmap,cr.fog,cr.lights,{emissive:{value:new Je(0)}}]),vertexShader:lr.meshtoon_vert,fragmentShader:lr.meshtoon_frag},matcap:{uniforms:Hn([cr.common,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.fog,{matcap:{value:null}}]),vertexShader:lr.meshmatcap_vert,fragmentShader:lr.meshmatcap_frag},points:{uniforms:Hn([cr.points,cr.fog]),vertexShader:lr.points_vert,fragmentShader:lr.points_frag},dashed:{uniforms:Hn([cr.common,cr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lr.linedashed_vert,fragmentShader:lr.linedashed_frag},depth:{uniforms:Hn([cr.common,cr.displacementmap]),vertexShader:lr.depth_vert,fragmentShader:lr.depth_frag},normal:{uniforms:Hn([cr.common,cr.bumpmap,cr.normalmap,cr.displacementmap,{opacity:{value:1}}]),vertexShader:lr.meshnormal_vert,fragmentShader:lr.meshnormal_frag},sprite:{uniforms:Hn([cr.sprite,cr.fog]),vertexShader:lr.sprite_vert,fragmentShader:lr.sprite_frag},background:{uniforms:{uvTransform:{value:new yt},t2D:{value:null}},vertexShader:lr.background_vert,fragmentShader:lr.background_frag},cube:{uniforms:Hn([cr.envmap,{opacity:{value:1}}]),vertexShader:lr.cube_vert,fragmentShader:lr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lr.equirect_vert,fragmentShader:lr.equirect_frag},distanceRGBA:{uniforms:Hn([cr.common,cr.displacementmap,{referencePosition:{value:new Ct},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lr.distanceRGBA_vert,fragmentShader:lr.distanceRGBA_frag},shadow:{uniforms:Hn([cr.lights,cr.fog,{color:{value:new Je(0)},opacity:{value:1}}]),vertexShader:lr.shadow_vert,fragmentShader:lr.shadow_frag}};function pr(t,e,n,r,i){const o=new Je(0);let a,s,c=0,u=null,p=0,h=null;function d(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),d(o,c=e)},getClearAlpha:function(){return c},setClearAlpha:function(t){d(o,c=t)},render:function(n,i){let f=!1,m=!0===i.isScene?i.background:null;m&&m.isTexture&&(m=e.get(m));const g=t.xr,y=g.getSession&&g.getSession();y&&"additive"===y.environmentBlendMode&&(m=null),null===m?d(o,c):m&&m.isColor&&(d(m,1),f=!0),(t.autoClear||f)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),m&&(m.isCubeTexture||m.mapping===l)?(void 0===s&&((s=new Un(new Vn(1,1,1),new qn({name:"BackgroundCubeMaterial",uniforms:Gn(ur.cube.uniforms),vertexShader:ur.cube.vertexShader,fragmentShader:ur.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(s)),s.material.uniforms.envMap.value=m,s.material.uniforms.flipEnvMap.value=m.isCubeTexture&&!1===m.isRenderTargetTexture?-1:1,u===m&&p===m.version&&h===t.toneMapping||(s.material.needsUpdate=!0,u=m,p=m.version,h=t.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null)):m&&m.isTexture&&(void 0===a&&((a=new Un(new sr(2,2),new qn({name:"BackgroundMaterial",uniforms:Gn(ur.background.uniforms),vertexShader:ur.background.vertexShader,fragmentShader:ur.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(a)),a.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),a.material.uniforms.uvTransform.value.copy(m.matrix),u===m&&p===m.version&&h===t.toneMapping||(a.material.needsUpdate=!0,u=m,p=m.version,h=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function hr(t,e,n,r){const i=t.getParameter(34921),o=r.isWebGL2?null:e.get("OES_vertex_array_object"),a=r.isWebGL2||null!==o,s={},l=h(null);let c=l;function u(e){return r.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)}function p(e){return r.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)}function h(t){const e=[],n=[],r=[];for(let t=0;t<i;t++)e[t]=0,n[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:r,object:t,attributes:{},index:null}}function d(){const t=c.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function f(t){m(t,0)}function m(n,i){const o=c.newAttributes,a=c.enabledAttributes,s=c.attributeDivisors;o[n]=1,0===a[n]&&(t.enableVertexAttribArray(n),a[n]=1),s[n]!==i&&((r.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i)}function g(){const e=c.newAttributes,n=c.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==e[r]&&(t.disableVertexAttribArray(r),n[r]=0)}function y(e,n,i,o,a,s){!0!==r.isWebGL2||5124!==i&&5125!==i?t.vertexAttribPointer(e,n,i,o,a,s):t.vertexAttribIPointer(e,n,i,a,s)}function v(){_(),c!==l&&u((c=l).object)}function _(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,p,v,_){let x=!1;if(a){const e=function(e,n,i){const a=!0===i.wireframe;let l=s[e.id];void 0===l&&(l={},s[e.id]=l);let c=l[n.id];void 0===c&&(c={},l[n.id]=c);let u=c[a];return void 0===u&&(u=h(r.isWebGL2?t.createVertexArray():o.createVertexArrayOES()),c[a]=u),u}(v,p,l);c!==e&&u((c=e).object),(x=function(t,e){const n=c.attributes,r=t.attributes;let i=0;for(const t in r){const e=n[t],o=r[t];if(void 0===e)return!0;if(e.attribute!==o)return!0;if(e.data!==o.data)return!0;i++}return c.attributesNum!==i||c.index!==e}(v,_))&&function(t,e){const n={},r=v.attributes;let i=0;for(const t in r){const e=r[t],o={};o.attribute=e,e.data&&(o.data=e.data),n[t]=o,i++}c.attributes=n,c.attributesNum=i,c.index=e}(0,_)}else{const t=!0===l.wireframe;c.geometry===v.id&&c.program===p.id&&c.wireframe===t||(c.geometry=v.id,c.program=p.id,c.wireframe=t,x=!0)}!0===i.isInstancedMesh&&(x=!0),null!==_&&n.update(_,34963),x&&(function(i,o,a,s){if(!1===r.isWebGL2&&(i.isInstancedMesh||s.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;d();const l=s.attributes,c=a.getAttributes(),u=o.defaultAttributeValues;for(const e in c){const r=c[e];if(r.location>=0){let o=l[e];if(void 0===o&&("instanceMatrix"===e&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===e&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){const e=o.normalized,a=o.itemSize,l=n.get(o);if(void 0===l)continue;const c=l.buffer,u=l.type,p=l.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,l=n.stride,h=o.offset;if(n&&n.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)m(r.location+t,n.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=n.meshPerAttribute*n.count)}else for(let t=0;t<r.locationSize;t++)f(r.location+t);t.bindBuffer(34962,c);for(let t=0;t<r.locationSize;t++)y(r.location+t,a/r.locationSize,u,e,l*p,(h+a/r.locationSize*t)*p)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)m(r.location+t,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<r.locationSize;t++)f(r.location+t);t.bindBuffer(34962,c);for(let t=0;t<r.locationSize;t++)y(r.location+t,a/r.locationSize,u,e,a*p,a/r.locationSize*t*p)}}else if(void 0!==u){const n=u[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r.location,n);break;case 3:t.vertexAttrib3fv(r.location,n);break;case 4:t.vertexAttrib4fv(r.location,n);break;default:t.vertexAttrib1fv(r.location,n)}}}}g()}(i,l,p,v),null!==_&&t.bindBuffer(34963,n.get(_).buffer))},reset:v,resetDefaultState:_,dispose:function(){v();for(const t in s){const e=s[t];for(const t in e){const n=e[t];for(const t in n)p(n[t].object),delete n[t];delete e[t]}delete s[t]}},releaseStatesOfGeometry:function(t){if(void 0===s[t.id])return;const e=s[t.id];for(const t in e){const n=e[t];for(const t in n)p(n[t].object),delete n[t];delete e[t]}delete s[t.id]},releaseStatesOfProgram:function(t){for(const e in s){const n=s[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)p(r[t].object),delete r[t];delete n[t.id]}},initAttributes:d,enableAttribute:f,disableUnusedAttributes:g}}function dr(t,e,n,r){const i=r.isWebGL2;let o;this.setMode=function(t){o=t},this.render=function(e,r){t.drawArrays(o,e,r),n.update(r,o,1)},this.renderInstances=function(r,a,s){if(0===s)return;let l,c;if(i)l=t,c="drawArraysInstanced";else if(c="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](o,r,a,s),n.update(a,o,s)}}function fr(t,e,n){let r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let a=void 0!==n.precision?n.precision:"highp";const s=i(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);const l=o||e.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,u=t.getParameter(34930),p=t.getParameter(35660),h=t.getParameter(3379),d=t.getParameter(34076),f=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),y=t.getParameter(36349),v=p>0,_=o||e.has("OES_texture_float");return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:p,maxTextureSize:h,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:y,vertexTextures:v,floatFragmentTextures:_,floatVertexTextures:v&&_,maxSamples:o?t.getParameter(36183):0}}function mr(t){const e=this;let n=null,r=0,i=!1,o=!1;const a=new er,s=new yt,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(t,n,r,i){const o=null!==t?t.length:0;let c=null;if(0!==o){if(c=l.value,!0!==i||null===c){const e=r+4*o,i=n.matrixWorldInverse;s.getNormalMatrix(i),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,n=r;e!==o;++e,n+=4)a.copy(t[e]).applyMatrix4(i,s),a.normal.toArray(c,n),c[n+3]=a.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=o,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,o){const a=0!==t.length||e||0!==r||i;return i=e,n=u(t,o,0),r=t.length,a},this.beginShadows=function(){o=!0,u(null)},this.endShadows=function(){o=!1,c()},this.setState=function(e,a,s){const p=e.clippingPlanes,h=e.clipIntersection,d=e.clipShadows,f=t.get(e);if(!i||null===p||0===p.length||o&&!d)o?u(null):c();else{const t=o?0:r,e=4*t;let i=f.clippingState||null;l.value=i,i=u(p,a,e,s);for(let t=0;t!==e;++t)i[t]=n[t];f.clippingState=i,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=t}}}function gr(t){let e=new WeakMap;function n(t,e){return e===a?t.mapping=i:e===s&&(t.mapping=o),t}function r(t){const n=t.target;n.removeEventListener("dispose",r);const i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){const o=i.mapping;if(o===a||o===s){if(e.has(i))return n(e.get(i).texture,i.mapping);{const o=i.image;if(o&&o.height>0){const a=t.getRenderTarget(),s=new Yn(o.height/2);return s.fromEquirectangularTexture(t,i),e.set(i,s),t.setRenderTarget(a),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}}return i},dispose:function(){e=new WeakMap}}}ur.physical={uniforms:Hn([ur.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new gt(1,1)},clearcoatNormalMap:{value:null},sheenTint:{value:new Je(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new gt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationTint:{value:new Je(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularTint:{value:new Je(1,1,1)},specularTintMap:{value:null}}]),vertexShader:lr.meshphysical_vert,fragmentShader:lr.meshphysical_frag};class yr extends Zn{constructor(t=-1,e=1,n=1,r=-1,i=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=i,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,r,i,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=n-t,o=n+t,a=r+e,s=r-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o=(i+=t*this.view.offsetX)+t*this.view.width,s=(a-=e*this.view.offsetY)-e*this.view.height}this.projectionMatrix.makeOrthographic(i,o,a,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}yr.prototype.isOrthographicCamera=!0;class vr extends qn{constructor(t){super(t),this.type="RawShaderMaterial"}}vr.prototype.isRawShaderMaterial=!0;const _r=Math.pow(2,8),xr=[.125,.215,.35,.446,.526,.582],br=5+xr.length,wr={[Z]:0,[X]:1,[J]:2,[Y]:3,[Q]:4,[K]:5,[$]:6},Mr=new yr,{_lodPlanes:Sr,_sizeLods:Tr,_sigmas:Er}=function(){const t=[],e=[],n=[];let r=8;for(let i=0;i<br;i++){const o=Math.pow(2,r);e.push(o);let a=1/o;i>4?a=xr[i-8+4-1]:0==i&&(a=0),n.push(a);const s=1/(o-1),l=-s/2,c=1+s/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],p=6,h=6,d=3,f=2,m=1,g=new Float32Array(d*h*p),y=new Float32Array(f*h*p),v=new Float32Array(m*h*p);for(let t=0;t<p;t++){const e=t%3*2/3-1,n=t>2?0:-1,r=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(r,d*h*t),y.set(u,f*h*t);const i=[t,t,t,t,t,t];v.set(i,m*h*t)}const _=new wn;_.setAttribute("position",new tn(g,d)),_.setAttribute("uv",new tn(y,f)),_.setAttribute("faceIndex",new tn(v,m)),t.push(_),r>4&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}(),Ar=new Je;let Cr=null;const Lr=(1+Math.sqrt(5))/2,Pr=1/Lr,Ir=[new Ct(1,1,1),new Ct(-1,1,1),new Ct(1,1,-1),new Ct(-1,1,-1),new Ct(0,Lr,Pr),new Ct(0,Lr,-Pr),new Ct(Pr,0,Lr),new Ct(-Pr,0,Lr),new Ct(Lr,Pr,0),new Ct(-Lr,Pr,0)];class Rr{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(t){const e=new Float32Array(20),n=new Ct(0,1,0);return new vr({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:wr[3e3]},outputEncoding:{value:wr[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){Cr=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Fr(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Or(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<Sr.length;t++)Sr[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Cr),t.scissorTest=!1,Dr(t,0,0,t.width,t.height)}_fromTexture(t){Cr=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:d,minFilter:d,generateMipmaps:!1,type:_,format:1023,encoding:kr(t)?t.encoding:J,depthBuffer:!1},n=zr(e);return n.depthBuffer=!t,this._pingPongRenderTarget=zr(e),n}_compileMaterial(t){const e=new Un(Sr[0],t);this._renderer.compile(e,Mr)}_sceneToCubeUV(t,e,n,r){const i=new Xn(90,1,e,n),o=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,c=s.outputEncoding,u=s.toneMapping;s.getClearColor(Ar),s.toneMapping=0,s.outputEncoding=Z,s.autoClear=!1;const p=new Ye({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),h=new Un(new Vn,p);let d=!1;const f=t.background;f?f.isColor&&(p.color.copy(f),t.background=null,d=!0):(p.color.copy(Ar),d=!0);for(let e=0;e<6;e++){const n=e%3;0==n?(i.up.set(0,o[e],0),i.lookAt(a[e],0,0)):1==n?(i.up.set(0,0,o[e]),i.lookAt(0,a[e],0)):(i.up.set(0,o[e],0),i.lookAt(0,0,a[e])),Dr(r,n*_r,e>2?_r:0,_r,_r),s.setRenderTarget(r),d&&s.render(h,i),s.render(t,i)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=u,s.outputEncoding=c,s.autoClear=l,t.background=f}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Fr()):null==this._equirectShader&&(this._equirectShader=Or());const r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new Un(Sr[0],r),o=r.uniforms;o.envMap.value=t,t.isCubeTexture||o.texelSize.value.set(1/t.image.width,1/t.image.height),o.inputEncoding.value=wr[t.encoding],o.outputEncoding.value=wr[e.texture.encoding],Dr(e,0,0,3*_r,2*_r),n.setRenderTarget(e),n.render(i,Mr)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;e<br;e++){const n=Math.sqrt(Er[e]*Er[e]-Er[e-1]*Er[e-1]),r=Ir[(e-1)%Ir.length];this._blur(t,e-1,e,n,r)}e.autoClear=n}_blur(t,e,n,r,i){const o=this._pingPongRenderTarget;this._halfBlur(t,o,e,n,r,"latitudinal",i),this._halfBlur(o,t,n,n,r,"longitudinal",i)}_halfBlur(t,e,n,r,i,o,a){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Un(Sr[r],l),u=l.uniforms,p=Tr[n]-1,h=isFinite(i)?Math.PI/(2*p):2*Math.PI/39,d=i/h,f=isFinite(i)?1+Math.floor(3*d):20;f>20&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t<20;++t){const e=t/d,n=Math.exp(-e*e/2);m.push(n),0==t?g+=n:t<f&&(g+=2*n)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;u.envMap.value=t.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===o,a&&(u.poleAxis.value=a),u.dTheta.value=h,u.mipInt.value=8-n,u.inputEncoding.value=wr[t.texture.encoding],u.outputEncoding.value=wr[t.texture.encoding];const y=Tr[r];Dr(e,3*Math.max(0,_r-2*y),(0===r?0:2*_r)+2*y*(r>4?r-8+4:0),3*y,2*y),s.setRenderTarget(e),s.render(c,Mr)}}function kr(t){return void 0!==t&&t.type===_&&(t.encoding===Z||t.encoding===X||t.encoding===$)}function zr(t){const e=new St(3*_r,3*_r,t);return e.texture.mapping=l,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Dr(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Or(){const t=new gt(1,1);return new vr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:wr[3e3]},outputEncoding:{value:wr[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Fr(){return new vr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:wr[3e3]},outputEncoding:{value:wr[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Br(t){let e=new WeakMap,n=null;function r(t){const n=t.target;n.removeEventListener("dispose",r);const i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(l){if(l&&l.isTexture&&!1===l.isRenderTargetTexture){const c=l.mapping,u=c===a||c===s,p=c===i||c===o;if(u||p){if(e.has(l))return e.get(l).texture;{const i=l.image;if(u&&i&&i.height>0||p&&i&&function(t){let e=0;for(let n=0;n<6;n++)void 0!==t[n]&&e++;return 6===e}(i)){const i=t.getRenderTarget();null===n&&(n=new Rr(t));const o=u?n.fromEquirectangular(l):n.fromCubemap(l);return e.set(l,o),t.setRenderTarget(i),l.addEventListener("dispose",r),o.texture}return null}}}return l},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Nr(t){const e={};function n(n){if(void 0!==e[n])return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function Ur(t,e,n,r){const i={},o=new WeakMap;function a(t){const s=t.target;null!==s.index&&e.remove(s.index);for(const t in s.attributes)e.remove(s.attributes[t]);s.removeEventListener("dispose",a),delete i[s.id];const l=o.get(s);l&&(e.remove(l),o.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(t){const n=[],r=t.index,i=t.attributes.position;let a=0;if(null!==r){const t=r.array;a=r.version;for(let e=0,r=t.length;e<r;e+=3){const r=t[e+0],i=t[e+1],o=t[e+2];n.push(r,i,i,o,o,r)}}else{const t=i.array;a=i.version;for(let e=0,r=t.length/3-1;e<r;e+=3){const t=e+0,r=e+1,i=e+2;n.push(t,r,r,i,i,t)}}const s=new(hn(n)>65535?ln:an)(n,1);s.version=a;const l=o.get(t);l&&e.remove(l),o.set(t,s)}return{get:function(t,e){return!0===i[e.id]||(e.addEventListener("dispose",a),i[e.id]=!0,n.memory.geometries++),e},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const r=t.morphAttributes;for(const t in r){const n=r[t];for(let t=0,r=n.length;t<r;t++)e.update(n[t],34962)}},getWireframeAttribute:function(t){const e=o.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&s(t)}else s(t);return o.get(t)}}}function jr(t,e,n,r){const i=r.isWebGL2;let o,a,s;this.setMode=function(t){o=t},this.setIndex=function(t){a=t.type,s=t.bytesPerElement},this.render=function(e,r){t.drawElements(o,r,a,e*s),n.update(r,o,1)},this.renderInstances=function(r,l,c){if(0===c)return;let u,p;if(i)u=t,p="drawElementsInstanced";else if(p="drawElementsInstancedANGLE",null===(u=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[p](o,l,a,r*s,c),n.update(l,o,c)}}function Vr(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,r){switch(e.calls++,n){case 4:e.triangles+=r*(t/3);break;case 1:e.lines+=r*(t/2);break;case 3:e.lines+=r*(t-1);break;case 2:e.lines+=r*t;break;case 0:e.points+=r*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function Gr(t,e){return t[0]-e[0]}function Hr(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Wr(t){const e={},n=new Float32Array(8),r=[];for(let t=0;t<8;t++)r[t]=[t,0];return{update:function(i,o,a,s){const l=i.morphTargetInfluences,c=void 0===l?0:l.length;let u=e[o.id];if(void 0===u||u.length!==c){u=[];for(let t=0;t<c;t++)u[t]=[t,0];e[o.id]=u}for(let t=0;t<c;t++){const e=u[t];e[0]=t,e[1]=l[t]}u.sort(Hr);for(let t=0;t<8;t++)t<c&&u[t][1]?(r[t][0]=u[t][0],r[t][1]=u[t][1]):(r[t][0]=Number.MAX_SAFE_INTEGER,r[t][1]=0);r.sort(Gr);const p=o.morphAttributes.position,h=o.morphAttributes.normal;let d=0;for(let t=0;t<8;t++){const e=r[t],i=e[0],a=e[1];i!==Number.MAX_SAFE_INTEGER&&a?(p&&o.getAttribute("morphTarget"+t)!==p[i]&&o.setAttribute("morphTarget"+t,p[i]),h&&o.getAttribute("morphNormal"+t)!==h[i]&&o.setAttribute("morphNormal"+t,h[i]),n[t]=a,d+=a):(p&&!0===o.hasAttribute("morphTarget"+t)&&o.deleteAttribute("morphTarget"+t),h&&!0===o.hasAttribute("morphNormal"+t)&&o.deleteAttribute("morphNormal"+t),n[t]=0)}const f=o.morphTargetsRelative?1:1-d;s.getUniforms().setValue(t,"morphTargetBaseInfluence",f),s.getUniforms().setValue(t,"morphTargetInfluences",n)}}}function qr(t,e,n,r){let i=new WeakMap;function o(t){const e=t.target;e.removeEventListener("dispose",o),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){const a=r.render.frame,s=t.geometry,l=e.get(t,s);return i.get(l)!==a&&(e.update(l),i.set(l,a)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",o)&&t.addEventListener("dispose",o),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),l},dispose:function(){i=new WeakMap}}}class Zr extends bt{constructor(t=null,e=1,n=1,r=1){super(null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=d,this.minFilter=d,this.wrapR=p,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Zr.prototype.isDataTexture2DArray=!0;class Xr extends bt{constructor(t=null,e=1,n=1,r=1){super(null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=d,this.minFilter=d,this.wrapR=p,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Xr.prototype.isDataTexture3D=!0;const $r=new bt,Jr=new Zr,Yr=new Xr,Qr=new Jn,Kr=[],ti=[],ei=new Float32Array(16),ni=new Float32Array(9),ri=new Float32Array(4);function ii(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let o=Kr[i];if(void 0===o&&(o=new Float32Array(i),Kr[i]=o),0!==e){r.toArray(o,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(o,i)}return o}function oi(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function ai(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function si(t,e){let n=ti[e];void 0===n&&(n=new Int32Array(e),ti[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function li(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function ci(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(oi(n,e))return;t.uniform2fv(this.addr,e),ai(n,e)}}function ui(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(oi(n,e))return;t.uniform3fv(this.addr,e),ai(n,e)}}function pi(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(oi(n,e))return;t.uniform4fv(this.addr,e),ai(n,e)}}function hi(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(oi(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),ai(n,e)}else{if(oi(n,r))return;ri.set(r),t.uniformMatrix2fv(this.addr,!1,ri),ai(n,r)}}function di(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(oi(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),ai(n,e)}else{if(oi(n,r))return;ni.set(r),t.uniformMatrix3fv(this.addr,!1,ni),ai(n,r)}}function fi(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(oi(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),ai(n,e)}else{if(oi(n,r))return;ei.set(r),t.uniformMatrix4fv(this.addr,!1,ei),ai(n,r)}}function mi(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function gi(t,e){const n=this.cache;oi(n,e)||(t.uniform2iv(this.addr,e),ai(n,e))}function yi(t,e){const n=this.cache;oi(n,e)||(t.uniform3iv(this.addr,e),ai(n,e))}function vi(t,e){const n=this.cache;oi(n,e)||(t.uniform4iv(this.addr,e),ai(n,e))}function _i(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function xi(t,e){const n=this.cache;oi(n,e)||(t.uniform2uiv(this.addr,e),ai(n,e))}function bi(t,e){const n=this.cache;oi(n,e)||(t.uniform3uiv(this.addr,e),ai(n,e))}function wi(t,e){const n=this.cache;oi(n,e)||(t.uniform4uiv(this.addr,e),ai(n,e))}function Mi(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(e||$r,i)}function Si(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||Yr,i)}function Ti(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(e||Qr,i)}function Ei(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||Jr,i)}function Ai(t,e){t.uniform1fv(this.addr,e)}function Ci(t,e){const n=ii(e,this.size,2);t.uniform2fv(this.addr,n)}function Li(t,e){const n=ii(e,this.size,3);t.uniform3fv(this.addr,n)}function Pi(t,e){const n=ii(e,this.size,4);t.uniform4fv(this.addr,n)}function Ii(t,e){const n=ii(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Ri(t,e){const n=ii(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function ki(t,e){const n=ii(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function zi(t,e){t.uniform1iv(this.addr,e)}function Di(t,e){t.uniform2iv(this.addr,e)}function Oi(t,e){t.uniform3iv(this.addr,e)}function Fi(t,e){t.uniform4iv(this.addr,e)}function Bi(t,e){t.uniform1uiv(this.addr,e)}function Ni(t,e){t.uniform2uiv(this.addr,e)}function Ui(t,e){t.uniform3uiv(this.addr,e)}function ji(t,e){t.uniform4uiv(this.addr,e)}function Vi(t,e,n){const r=e.length,i=si(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.safeSetTexture2D(e[t]||$r,i[t])}function Gi(t,e,n){const r=e.length,i=si(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.safeSetTextureCube(e[t]||Qr,i[t])}function Hi(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(e.type){case 5126:return li;case 35664:return ci;case 35665:return ui;case 35666:return pi;case 35674:return hi;case 35675:return di;case 35676:return fi;case 5124:case 35670:return mi;case 35667:case 35671:return gi;case 35668:case 35672:return yi;case 35669:case 35673:return vi;case 5125:return _i;case 36294:return xi;case 36295:return bi;case 36296:return wi;case 35678:case 36198:case 36298:case 36306:case 35682:return Mi;case 35679:case 36299:case 36307:return Si;case 35680:case 36300:case 36308:case 36293:return Ti;case 36289:case 36303:case 36311:case 36292:return Ei}}()}function Wi(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(e.type){case 5126:return Ai;case 35664:return Ci;case 35665:return Li;case 35666:return Pi;case 35674:return Ii;case 35675:return Ri;case 35676:return ki;case 5124:case 35670:return zi;case 35667:case 35671:return Di;case 35668:case 35672:return Oi;case 35669:case 35673:return Fi;case 5125:return Bi;case 36294:return Ni;case 36295:return Ui;case 36296:return ji;case 35678:case 36198:case 36298:case 36306:case 35682:return Vi;case 35680:case 36300:case 36308:case 36293:return Gi}}()}function qi(t){this.id=t,this.seq=[],this.map={}}Wi.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),ai(e,t)},qi.prototype.setValue=function(t,e,n){const r=this.seq;for(let i=0,o=r.length;i!==o;++i){const o=r[i];o.setValue(t,e[o.id],n)}};const Zi=/(\w+)(\])?(\[|\.)?/g;function Xi(t,e){t.seq.push(e),t.map[e.id]=e}function $i(t,e,n){const r=t.name,i=r.length;for(Zi.lastIndex=0;;){const o=Zi.exec(r),a=Zi.lastIndex;let s=o[1];const l="]"===o[2],c=o[3];if(l&&(s|=0),void 0===c||"["===c&&a+2===i){Xi(n,void 0===c?new Hi(s,t,e):new Wi(s,t,e));break}{let t=n.map[s];void 0===t&&Xi(n,t=new qi(s)),n=t}}}function Ji(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let r=0;r<n;++r){const n=t.getActiveUniform(e,r);$i(n,t.getUniformLocation(e,n.name),this)}}function Yi(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}Ji.prototype.setValue=function(t,e,n,r){const i=this.map[e];void 0!==i&&i.setValue(t,n,r)},Ji.prototype.setOptional=function(t,e,n){const r=e[n];void 0!==r&&this.setValue(t,n,r)},Ji.upload=function(t,e,n,r){for(let i=0,o=e.length;i!==o;++i){const o=e[i],a=n[o.id];!1!==a.needsUpdate&&o.setValue(t,a.value,r)}},Ji.seqWithValue=function(t,e){const n=[];for(let r=0,i=t.length;r!==i;++r){const i=t[r];i.id in e&&n.push(i)}return n};let Qi=0;function Ki(t){switch(t){case Z:return["Linear","( value )"];case X:return["sRGB","( value )"];case J:return["RGBE","( value )"];case Y:return["RGBM","( value, 7.0 )"];case Q:return["RGBM","( value, 16.0 )"];case K:return["RGBD","( value, 256.0 )"];case $:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function to(t,e,n){const r=t.getShaderParameter(e,35713),i=t.getShaderInfoLog(e).trim();return r&&""===i?"":n.toUpperCase()+"\n\n"+i+"\n\n"+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function eo(t,e){const n=Ki(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function no(t,e){const n=Ki(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function ro(t,e){let n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function io(t){return""!==t}function oo(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function ao(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const so=/^[ \t]*#include +<([\w\d./]+)>/gm;function lo(t){return t.replace(so,co)}function co(t,e){const n=lr[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return lo(n)}const uo=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,po=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function ho(t){return t.replace(po,mo).replace(uo,fo)}function fo(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),mo(t,e,n,r)}function mo(t,e,n,r){let i="";for(let t=parseInt(e);t<parseInt(n);t++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return i}function go(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function yo(t,e,n,r){const a=t.getContext(),s=n.defines;let u=n.vertexShader,p=n.fragmentShader;const h=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(n),d=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case i:case o:e="ENVMAP_TYPE_CUBE";break;case l:case c:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),f=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case o:case c:e="ENVMAP_MODE_REFRACTION"}return e}(n),m=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(n),g=t.gammaFactor>0?t.gammaFactor:1,y=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(io).join("\n")}(n),v=function(t){const e=[];for(const n in t){const r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}(s),_=a.createProgram();let x,b,w=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((x=[v].filter(io).join("\n")).length>0&&(x+="\n"),(b=[y,v].filter(io).join("\n")).length>0&&(b+="\n")):(x=[go(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularTintMap?"#define USE_SPECULARTINTMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(io).join("\n"),b=[y,go(n),"#define SHADER_NAME "+n.shaderName,v,"#define GAMMA_FACTOR "+g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",n.envMap?"#define "+m:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularTintMap?"#define USE_SPECULARTINTMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheenTint?"#define USE_SHEEN":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?lr.tonemapping_pars_fragment:"",0!==n.toneMapping?ro("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.format===T?"#define OPAQUE":"",lr.encodings_pars_fragment,n.map?eo("mapTexelToLinear",n.mapEncoding):"",n.matcap?eo("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?eo("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?eo("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.specularTintMap?eo("specularTintMapTexelToLinear",n.specularTintMapEncoding):"",n.lightMap?eo("lightMapTexelToLinear",n.lightMapEncoding):"",no("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(io).join("\n")),u=ao(u=oo(u=lo(u),n),n),p=ao(p=oo(p=lo(p),n),n),u=ho(u),p=ho(p),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(w="#version 300 es\n",x=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+x,b=["#define varying in",n.glslVersion===nt?"":"out highp vec4 pc_fragColor;",n.glslVersion===nt?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+b);const M=w+b+p,S=Yi(a,35633,w+x+u),E=Yi(a,35632,M);if(a.attachShader(_,S),a.attachShader(_,E),void 0!==n.index0AttributeName?a.bindAttribLocation(_,0,n.index0AttributeName):!0===n.morphTargets&&a.bindAttribLocation(_,0,"position"),a.linkProgram(_),t.debug.checkShaderErrors){const t=a.getProgramInfoLog(_).trim(),e=a.getShaderInfoLog(S).trim(),n=a.getShaderInfoLog(E).trim();let r=!0,i=!0;if(!1===a.getProgramParameter(_,35714)){r=!1;const e=to(a,S,"vertex"),n=to(a,E,"fragment");console.error("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(_,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(i=!1);i&&(this.diagnostics={runnable:r,programLog:t,vertexShader:{log:e,prefix:x},fragmentShader:{log:n,prefix:b}})}let A,C;return a.deleteShader(S),a.deleteShader(E),this.getUniforms=function(){return void 0===A&&(A=new Ji(a,_)),A},this.getAttributes=function(){return void 0===C&&(C=function(t,e){const n={},r=t.getProgramParameter(e,35721);for(let i=0;i<r;i++){const r=t.getActiveAttrib(e,i),o=r.name;let a=1;35674===r.type&&(a=2),35675===r.type&&(a=3),35676===r.type&&(a=4),n[o]={type:r.type,location:t.getAttribLocation(e,o),locationSize:a}}return n}(a,_)),C},this.destroy=function(){r.releaseStatesOfProgram(this),a.deleteProgram(_),this.program=void 0},this.name=n.shaderName,this.id=Qi++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=S,this.fragmentShader=E,this}function vo(t,e,n,r,i,o,a){const s=[],u=i.isWebGL2,p=i.logarithmicDepthBuffer,h=i.floatVertexTextures,d=i.maxVertexUniforms,f=i.vertexTextures;let m=i.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},y=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoat","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","specularIntensityMap","specularTintMap","specularTintMapEncoding","roughnessMap","metalnessMap","gradientMap","alphaMap","alphaTest","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","format","sheenTint","transmission","transmissionMap","thicknessMap"];function v(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Z,e}return{getParameters:function(o,s,y,_,x){const b=_.fog,w=o.isMeshStandardMaterial?_.environment:null,M=(o.isMeshStandardMaterial?n:e).get(o.envMap||w),S=g[o.type],T=x.isSkinnedMesh?function(t){const e=x.skeleton.bones;if(h)return 1024;{const t=d,n=Math.floor((t-20)/4),r=Math.min(n,e.length);return r<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+r+"."),0):r}}():0;let E,A;if(null!==o.precision&&(m=i.getMaxPrecision(o.precision))!==o.precision&&console.warn("THREE.WebGLProgram.getParameters:",o.precision,"not supported, using",m,"instead."),S){const t=ur[S];E=t.vertexShader,A=t.fragmentShader}else E=o.vertexShader,A=o.fragmentShader;const C=t.getRenderTarget(),L=o.alphaTest>0,P=o.clearcoat>0;return{isWebGL2:u,shaderID:S,shaderName:o.type,vertexShader:E,fragmentShader:A,defines:o.defines,isRawShaderMaterial:!0===o.isRawShaderMaterial,glslVersion:o.glslVersion,precision:m,instancing:!0===x.isInstancedMesh,instancingColor:!0===x.isInstancedMesh&&null!==x.instanceColor,supportsVertexTextures:f,outputEncoding:null!==C?v(C.texture):t.outputEncoding,map:!!o.map,mapEncoding:v(o.map),matcap:!!o.matcap,matcapEncoding:v(o.matcap),envMap:!!M,envMapMode:M&&M.mapping,envMapEncoding:v(M),envMapCubeUV:!!M&&(M.mapping===l||M.mapping===c),lightMap:!!o.lightMap,lightMapEncoding:v(o.lightMap),aoMap:!!o.aoMap,emissiveMap:!!o.emissiveMap,emissiveMapEncoding:v(o.emissiveMap),bumpMap:!!o.bumpMap,normalMap:!!o.normalMap,objectSpaceNormalMap:1===o.normalMapType,tangentSpaceNormalMap:0===o.normalMapType,clearcoat:P,clearcoatMap:P&&!!o.clearcoatMap,clearcoatRoughnessMap:P&&!!o.clearcoatRoughnessMap,clearcoatNormalMap:P&&!!o.clearcoatNormalMap,displacementMap:!!o.displacementMap,roughnessMap:!!o.roughnessMap,metalnessMap:!!o.metalnessMap,specularMap:!!o.specularMap,specularIntensityMap:!!o.specularIntensityMap,specularTintMap:!!o.specularTintMap,specularTintMapEncoding:v(o.specularTintMap),alphaMap:!!o.alphaMap,alphaTest:L,gradientMap:!!o.gradientMap,sheenTint:!!o.sheenTint&&(o.sheenTint.r>0||o.sheenTint.g>0||o.sheenTint.b>0),transmission:o.transmission>0,transmissionMap:!!o.transmissionMap,thicknessMap:!!o.thicknessMap,combine:o.combine,vertexTangents:!!o.normalMap&&!!x.geometry&&!!x.geometry.attributes.tangent,vertexColors:o.vertexColors,vertexAlphas:!0===o.vertexColors&&!!x.geometry&&!!x.geometry.attributes.color&&4===x.geometry.attributes.color.itemSize,vertexUvs:!!(o.map||o.bumpMap||o.normalMap||o.specularMap||o.alphaMap||o.emissiveMap||o.roughnessMap||o.metalnessMap||o.clearcoatMap||o.clearcoatRoughnessMap||o.clearcoatNormalMap||o.displacementMap||o.transmissionMap||o.thicknessMap||o.specularIntensityMap||o.specularTintMap),uvsVertexOnly:!(o.map||o.bumpMap||o.normalMap||o.specularMap||o.alphaMap||o.emissiveMap||o.roughnessMap||o.metalnessMap||o.clearcoatNormalMap||o.transmission>0||o.transmissionMap||o.thicknessMap||o.specularIntensityMap||o.specularTintMap||!o.displacementMap),fog:!!b,useFog:o.fog,fogExp2:b&&b.isFogExp2,flatShading:!!o.flatShading,sizeAttenuation:o.sizeAttenuation,logarithmicDepthBuffer:p,skinning:!0===x.isSkinnedMesh&&T>0,maxBones:T,useVertexTexture:h,morphTargets:!!x.geometry&&!!x.geometry.morphAttributes.position,morphNormals:!!x.geometry&&!!x.geometry.morphAttributes.normal,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,format:o.format,dithering:o.dithering,shadowMapEnabled:t.shadowMap.enabled&&y.length>0,shadowMapType:t.shadowMap.type,toneMapping:o.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:o.premultipliedAlpha,doubleSided:2===o.side,flipSided:1===o.side,depthPacking:void 0!==o.depthPacking&&o.depthPacking,index0AttributeName:o.index0AttributeName,extensionDerivatives:o.extensions&&o.extensions.derivatives,extensionFragDepth:o.extensions&&o.extensions.fragDepth,extensionDrawBuffers:o.extensions&&o.extensions.drawBuffers,extensionShaderTextureLOD:o.extensions&&o.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||r.has("EXT_shader_texture_lod"),customProgramCacheKey:o.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<y.length;t++)n.push(e[y[t]]);n.push(t.outputEncoding),n.push(t.gammaFactor)}return n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=g[t.type];let n;if(e){const t=ur[e];n=Wn.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let r;for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e.cacheKey===n){++(r=e).usedTimes;break}}return void 0===r&&(r=new yo(t,n,e,o),s.push(r)),r},releaseProgram:function(t){if(0==--t.usedTimes){const e=s.indexOf(t);s[e]=s[s.length-1],s.pop(),t.destroy()}},programs:s}}function _o(){let t=new WeakMap;return{get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,r){t.get(e)[n]=r},dispose:function(){t=new WeakMap}}}function xo(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function bo(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function wo(t){const e=[];let n=0;const r=[],i=[],o=[],a={id:-1};function s(r,i,o,s,l,c){let u=e[n];const p=t.get(o);return void 0===u?(u={id:r.id,object:r,geometry:i,material:o,program:p.program||a,groupOrder:s,renderOrder:r.renderOrder,z:l,group:c},e[n]=u):(u.id=r.id,u.object=r,u.geometry=i,u.material=o,u.program=p.program||a,u.groupOrder=s,u.renderOrder=r.renderOrder,u.z=l,u.group=c),n++,u}return{opaque:r,transmissive:i,transparent:o,init:function(){n=0,r.length=0,i.length=0,o.length=0},push:function(t,e,n,a,l,c){const u=s(t,e,n,a,l,c);n.transmission>0?i.push(u):!0===n.transparent?o.push(u):r.push(u)},unshift:function(t,e,n,a,l,c){const u=s(t,e,n,a,l,c);n.transmission>0?i.unshift(u):!0===n.transparent?o.unshift(u):r.unshift(u)},finish:function(){for(let t=n,r=e.length;t<r;t++){const n=e[t];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}},sort:function(t,e){r.length>1&&r.sort(t||xo),i.length>1&&i.sort(e||bo),o.length>1&&o.sort(e||bo)}}}function Mo(t){let e=new WeakMap;return{get:function(n,r){let i;return!1===e.has(n)?(i=new wo(t),e.set(n,[i])):r>=e.get(n).length?(i=new wo(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function So(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Ct,color:new Je};break;case"SpotLight":n={position:new Ct,direction:new Ct,color:new Je,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ct,color:new Je,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ct,skyColor:new Je,groundColor:new Je};break;case"RectAreaLight":n={color:new Je,position:new Ct,halfWidth:new Ct,halfHeight:new Ct}}return t[e.id]=n,n}}}let To=0;function Eo(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Ao(t,e){const n=new So,r=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new gt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new gt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)i.probe.push(new Ct);const o=new Ct,a=new oe,s=new oe;return{setup:function(o,a){let s=0,l=0,c=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let u=0,p=0,h=0,d=0,f=0,m=0,g=0,y=0;o.sort(Eo);const v=!0!==a?Math.PI:1;for(let t=0,e=o.length;t<e;t++){const e=o[t],a=e.color,_=e.intensity,x=e.distance,b=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)s+=a.r*_*v,l+=a.g*_*v,c+=a.b*_*v;else if(e.isLightProbe)for(let t=0;t<9;t++)i.probe[t].addScaledVector(e.sh.coefficients[t],_);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*v),e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.directionalShadow[u]=n,i.directionalShadowMap[u]=b,i.directionalShadowMatrix[u]=e.shadow.matrix,m++}i.directional[u]=t,u++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(a).multiplyScalar(_*v),t.distance=x,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.spotShadow[h]=n,i.spotShadowMap[h]=b,i.spotShadowMatrix[h]=e.shadow.matrix,y++}i.spot[h]=t,h++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(a).multiplyScalar(_),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),i.rectArea[d]=t,d++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*v),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,i.pointShadow[p]=n,i.pointShadowMap[p]=b,i.pointShadowMatrix[p]=e.shadow.matrix,g++}i.point[p]=t,p++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(_*v),t.groundColor.copy(e.groundColor).multiplyScalar(_*v),i.hemi[f]=t,f++}}d>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=cr.LTC_FLOAT_1,i.rectAreaLTC2=cr.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=cr.LTC_HALF_1,i.rectAreaLTC2=cr.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=s,i.ambient[1]=l,i.ambient[2]=c;const _=i.hash;_.directionalLength===u&&_.pointLength===p&&_.spotLength===h&&_.rectAreaLength===d&&_.hemiLength===f&&_.numDirectionalShadows===m&&_.numPointShadows===g&&_.numSpotShadows===y||(i.directional.length=u,i.spot.length=h,i.rectArea.length=d,i.point.length=p,i.hemi.length=f,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=g,i.pointShadowMap.length=g,i.spotShadow.length=y,i.spotShadowMap.length=y,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=g,i.spotShadowMatrix.length=y,_.directionalLength=u,_.pointLength=p,_.spotLength=h,_.rectAreaLength=d,_.hemiLength=f,_.numDirectionalShadows=m,_.numPointShadows=g,_.numSpotShadows=y,i.version=To++)},setupView:function(t,e){let n=0,r=0,l=0,c=0,u=0;const p=e.matrixWorldInverse;for(let e=0,h=t.length;e<h;e++){const h=t[e];if(h.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(h.matrixWorld),o.setFromMatrixPosition(h.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(p),n++}else if(h.isSpotLight){const t=i.spot[l];t.position.setFromMatrixPosition(h.matrixWorld),t.position.applyMatrix4(p),t.direction.setFromMatrixPosition(h.matrixWorld),o.setFromMatrixPosition(h.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(p),l++}else if(h.isRectAreaLight){const t=i.rectArea[c];t.position.setFromMatrixPosition(h.matrixWorld),t.position.applyMatrix4(p),s.identity(),a.copy(h.matrixWorld),a.premultiply(p),s.extractRotation(a),t.halfWidth.set(.5*h.width,0,0),t.halfHeight.set(0,.5*h.height,0),t.halfWidth.applyMatrix4(s),t.halfHeight.applyMatrix4(s),c++}else if(h.isPointLight){const t=i.point[r];t.position.setFromMatrixPosition(h.matrixWorld),t.position.applyMatrix4(p),r++}else if(h.isHemisphereLight){const t=i.hemi[u];t.direction.setFromMatrixPosition(h.matrixWorld),t.direction.transformDirection(p),t.direction.normalize(),u++}}},state:i}}function Co(t,e){const n=new Ao(t,e),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(t){n.setup(r,t)},setupLightsView:function(t){n.setupView(r,t)},pushLight:function(t){r.push(t)},pushShadow:function(t){i.push(t)}}}function Lo(t,e){let n=new WeakMap;return{get:function(r,i=0){let o;return!1===n.has(r)?(o=new Co(t,e),n.set(r,[o])):i>=n.get(r).length?(o=new Co(t,e),n.get(r).push(o)):o=n.get(r)[i],o},dispose:function(){n=new WeakMap}}}class Po extends Ge{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Po.prototype.isMeshDepthMaterial=!0;class Io extends Ge{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Ct,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function Ro(t,e,n){let r=new ir;const i=new gt,o=new gt,a=new Mt,s=new Po({depthPacking:3201}),l=new Io,c={},u=n.maxTextureSize,p={0:1,1:0,2:2},h=new qn({uniforms:{shadow_pass:{value:null},resolution:{value:new gt},radius:{value:4},samples:{value:8}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nuniform float samples;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const m=new wn;m.setAttribute("position",new tn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Un(m,h),v=this;function _(n,r){const i=e.update(y);h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,h.uniforms.samples.value=n.blurSamples,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,h,y,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,f.uniforms.samples.value=n.blurSamples,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,f,y,null)}function x(e,n,r,i,o,a,u){let h=null;const d=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(h=void 0!==d?d:!0===i.isPointLight?l:s,t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length||r.displacementMap&&0!==r.displacementScale||r.alphaMap&&r.alphaTest>0){const t=h.uuid,e=r.uuid;let n=c[t];void 0===n&&(n={},c[t]=n);let i=n[e];void 0===i&&(i=h.clone(),n[e]=i),h=i}return h.visible=r.visible,h.wireframe=r.wireframe,h.side=3===u?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:p[r.side],h.alphaMap=r.alphaMap,h.alphaTest=r.alphaTest,h.clipShadows=r.clipShadows,h.clippingPlanes=r.clippingPlanes,h.clipIntersection=r.clipIntersection,h.displacementMap=r.displacementMap,h.displacementScale=r.displacementScale,h.displacementBias=r.displacementBias,h.wireframeLinewidth=r.wireframeLinewidth,h.linewidth=r.linewidth,!0===i.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(i.matrixWorld),h.nearDistance=o,h.farDistance=a),h}function b(n,i,o,a,s){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let l=0,c=e.length;l<c;l++){const c=e[l],u=i[c.materialIndex];if(u&&u.visible){const e=x(n,0,u,a,o.near,o.far,s);t.renderBufferDirect(o,null,r,e,n,c)}}}else if(i.visible){const e=x(n,0,i,a,o.near,o.far,s);t.renderBufferDirect(o,null,r,e,n,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)b(l[t],i,o,a,s)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,n,s){if(!1===v.enabled)return;if(!1===v.autoUpdate&&!1===v.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),c=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),h=t.state;h.setBlending(0),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);for(let l=0,c=e.length;l<c;l++){const c=e[l],p=c.shadow;if(void 0===p){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===p.autoUpdate&&!1===p.needsUpdate)continue;i.copy(p.mapSize);const f=p.getFrameExtents();if(i.multiply(f),o.copy(p.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(o.x=Math.floor(u/f.x),i.x=o.x*f.x,p.mapSize.x=o.x),i.y>u&&(o.y=Math.floor(u/f.y),i.y=o.y*f.y,p.mapSize.y=o.y)),null===p.map&&!p.isPointLightShadow&&3===this.type){const t={minFilter:g,magFilter:g,format:E};p.map=new St(i.x,i.y,t),p.map.texture.name=c.name+".shadowMap",p.mapPass=new St(i.x,i.y,t),p.camera.updateProjectionMatrix()}if(null===p.map){const t={minFilter:d,magFilter:d,format:E};p.map=new St(i.x,i.y,t),p.map.texture.name=c.name+".shadowMap",p.camera.updateProjectionMatrix()}t.setRenderTarget(p.map),t.clear();const m=p.getViewportCount();for(let t=0;t<m;t++){const e=p.getViewport(t);a.set(o.x*e.x,o.y*e.y,o.x*e.z,o.y*e.w),h.viewport(a),p.updateMatrices(c,t),r=p.getFrustum(),b(n,s,p.camera,c,this.type)}p.isPointLightShadow||3!==this.type||_(p,s),p.needsUpdate=!1}v.needsUpdate=!1,t.setRenderTarget(l,c,p)}}function ko(t,e,r){const i=r.isWebGL2,o=new function(){let e=!1;const n=new Mt;let r=null;const i=new Mt(0,0,0,0);return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,o,a,s){!0===s&&(e*=a,r*=a,o*=a),n.set(e,r,o,a),!1===i.equals(n)&&(t.clearColor(e,r,o,a),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}},a=new function(){let e=!1,n=null,r=null,i=null;return{setTest:function(t){t?B(2929):N(2929)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:default:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517)}else t.depthFunc(515);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}},s=new function(){let e=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,c=null;return{setTest:function(t){e||(t?B(2960):N(2960))},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,a){r===e&&i===n&&o===a||(t.stencilFunc(e,n,a),r=e,i=n,o=a)},setOp:function(e,n,r){a===e&&s===n&&l===r||(t.stencilOp(e,n,r),a=e,s=n,l=r)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,c=null}}};let l={},c=null,u={},p=null,h=!1,d=null,f=null,m=null,g=null,y=null,v=null,_=null,x=!1,b=null,w=null,M=null,S=null,T=null;const E=t.getParameter(35661);let A=!1,C=0;const L=t.getParameter(7938);-1!==L.indexOf("WebGL")?(C=parseFloat(/^WebGL (\d)/.exec(L)[1]),A=C>=1):-1!==L.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),A=C>=2);let P=null,I={};const R=t.getParameter(3088),k=t.getParameter(2978),z=(new Mt).fromArray(R),D=(new Mt).fromArray(k);function O(e,n,r){const i=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<r;e++)t.texImage2D(n+e,0,6408,1,1,0,6408,5121,i);return o}const F={};function B(e){!0!==l[e]&&(t.enable(e),l[e]=!0)}function N(e){!1!==l[e]&&(t.disable(e),l[e]=!1)}F[3553]=O(3553,3553,1),F[34067]=O(34067,34069,6),o.setClear(0,0,0,1),a.setClear(1),s.setClear(0),B(2929),a.setFunc(3),G(!1),H(1),B(2884),V(0);const U={[n]:32774,101:32778,102:32779};if(i)U[103]=32775,U[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(U[103]=t.MIN_EXT,U[104]=t.MAX_EXT)}const j={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function V(e,r,i,o,a,s,l,c){if(0!==e){if(!1===h&&(B(3042),h=!0),5===e)a=a||r,s=s||i,l=l||o,r===f&&a===y||(t.blendEquationSeparate(U[r],U[a]),f=r,y=a),i===m&&o===g&&s===v&&l===_||(t.blendFuncSeparate(j[i],j[o],j[s],j[l]),m=i,g=o,v=s,_=l),d=e,x=null;else if(e!==d||c!==x){if(f===n&&y===n||(t.blendEquation(32774),f=n,y=n),c)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}m=null,g=null,v=null,_=null,d=e,x=c}}else!0===h&&(N(3042),h=!1)}function G(e){b!==e&&(e?t.frontFace(2304):t.frontFace(2305),b=e)}function H(e){0!==e?(B(2884),e!==w&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):N(2884),w=e}function W(e,n,r){e?(B(32823),S===n&&T===r||(t.polygonOffset(n,r),S=n,T=r)):N(32823)}function q(e){void 0===e&&(e=33984+E-1),P!==e&&(t.activeTexture(e),P=e)}return{buffers:{color:o,depth:a,stencil:s},enable:B,disable:N,bindFramebuffer:function(e,n){return null===n&&null!==c&&(n=c),u[e]!==n&&(t.bindFramebuffer(e,n),u[e]=n,i&&(36009===e&&(u[36160]=n),36160===e&&(u[36009]=n)),!0)},bindXRFramebuffer:function(e){e!==c&&(t.bindFramebuffer(36160,e),c=e)},useProgram:function(e){return p!==e&&(t.useProgram(e),p=e,!0)},setBlending:V,setMaterial:function(t,e){2===t.side?N(2884):B(2884);let n=1===t.side;e&&(n=!n),G(n),1===t.blending&&!1===t.transparent?V(0):V(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),a.setFunc(t.depthFunc),a.setTest(t.depthTest),a.setMask(t.depthWrite),o.setMask(t.colorWrite);const r=t.stencilWrite;s.setTest(r),r&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),W(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?B(32926):N(32926)},setFlipSided:G,setCullFace:H,setLineWidth:function(e){e!==M&&(A&&t.lineWidth(e),M=e)},setPolygonOffset:W,setScissorTest:function(t){t?B(3089):N(3089)},activeTexture:q,bindTexture:function(e,n){null===P&&q();let r=I[P];void 0===r&&(r={type:void 0,texture:void 0},I[P]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||F[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=I[P];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===z.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),z.copy(e))},viewport:function(e){!1===D.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),D.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===i&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),l={},P=null,I={},c=null,u={},p=null,h=!1,d=null,f=null,m=null,g=null,y=null,v=null,_=null,x=!1,b=null,w=null,M=null,S=null,T=null,z.set(0,0,t.canvas.width,t.canvas.height),D.set(0,0,t.canvas.width,t.canvas.height),o.reset(),a.reset(),s.reset()}}}function zo(t,e,n,r,i,o,a){const s=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,_=i.maxTextureSize,L=i.maxSamples,P=new WeakMap;let I,R=!1;try{R="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function k(t,e){return R?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function z(t,e,n,r){let i=1;if((t.width>r||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?ft:Math.floor,o=r(i*t.width),a=r(i*t.height);void 0===I&&(I=k(o,a));const s=n?k(o,a):I;return s.width=o,s.height=a,s.getContext("2d").drawImage(t,0,0,o,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+a+")."),s}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function D(t){return ht(t.width)&&ht(t.height)}function O(t,e){return t.generateMipmaps&&e&&t.minFilter!==d&&t.minFilter!==g}function F(e,n,i,o,a=1){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log2(Math.max(i,o,a))}function B(n,r,i){if(!1===s)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=r;return 6403===r&&(5126===i&&(o=33326),5131===i&&(o=33325),5121===i&&(o=33321)),6407===r&&(5126===i&&(o=34837),5131===i&&(o=34843),5121===i&&(o=32849)),6408===r&&(5126===i&&(o=34836),5131===i&&(o=34842),5121===i&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||e.get("EXT_color_buffer_float"),o}function N(t){return t===d||t===f||t===m?9728:9729}function U(e){const n=e.target;n.removeEventListener("dispose",U),function(e){const n=r.get(e);void 0!==n.__webglInit&&(t.deleteTexture(n.__webglTexture),r.remove(e))}(n),n.isVideoTexture&&P.delete(n),a.memory.textures--}function j(e){const n=e.target;n.removeEventListener("dispose",j),function(e){const n=e.texture,i=r.get(e),o=r.get(n);if(e){if(void 0!==o.__webglTexture&&(t.deleteTexture(o.__webglTexture),a.memory.textures--),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,i=n.length;e<i;e++){const i=r.get(n[e]);i.__webglTexture&&(t.deleteTexture(i.__webglTexture),a.memory.textures--),r.remove(n[e])}r.remove(n),r.remove(e)}}(n)}let V=0;function G(t,e){const i=r.get(t);if(t.isVideoTexture&&function(t){const e=a.render.frame;P.get(t)!==e&&(P.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void $(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function H(e,i){const a=r.get(e);e.version>0&&a.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;X(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const a=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),l=r.image[0]&&r.image[0].isDataTexture,u=[];for(let t=0;t<6;t++)u[t]=a||l?l?r.image[t].image:r.image[t]:z(r.image[t],!1,!0,c);const p=u[0],h=D(p)||s,d=o.convert(r.format),f=o.convert(r.type),m=B(r.internalFormat,d,f);let g;if(Z(34067,r,h),a){for(let t=0;t<6;t++){g=u[t].mipmaps;for(let e=0;e<g.length;e++){const i=g[e];r.format!==E&&r.format!==T?null!==d?n.compressedTexImage2D(34069+t,e,m,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+t,e,m,i.width,i.height,0,d,f,i.data)}}e.__maxMipLevel=g.length-1}else{g=r.mipmaps;for(let t=0;t<6;t++)if(l){n.texImage2D(34069+t,0,m,u[t].width,u[t].height,0,d,f,u[t].data);for(let e=0;e<g.length;e++){const r=g[e].image[t].image;n.texImage2D(34069+t,e+1,m,r.width,r.height,0,d,f,r.data)}}else{n.texImage2D(34069+t,0,m,d,f,u[t]);for(let e=0;e<g.length;e++){const r=g[e];n.texImage2D(34069+t,e+1,m,d,f,r.image[t])}}e.__maxMipLevel=g.length}O(r,h)&&F(34067,r,p.width,p.height),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}(a,e,i):(n.activeTexture(33984+i),n.bindTexture(34067,a.__webglTexture))}const W={[u]:10497,[p]:33071,[h]:33648},q={[d]:9728,[f]:9984,[m]:9986,[g]:9729,[y]:9985,[v]:9987};function Z(n,o,a){if(a?(t.texParameteri(n,10242,W[o.wrapS]),t.texParameteri(n,10243,W[o.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,W[o.wrapR]),t.texParameteri(n,10240,q[o.magFilter]),t.texParameteri(n,10241,q[o.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),o.wrapS===p&&o.wrapT===p||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,N(o.magFilter)),t.texParameteri(n,10241,N(o.minFilter)),o.minFilter!==d&&o.minFilter!==g&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const a=e.get("EXT_texture_filter_anisotropic");if(o.type===w&&!1===e.has("OES_texture_float_linear"))return;if(!1===s&&o.type===M&&!1===e.has("OES_texture_half_float_linear"))return;(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(t.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function X(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",U),e.__webglTexture=t.createTexture(),a.memory.textures++)}function $(e,r,i){let a=3553;r.isDataTexture2DArray&&(a=35866),r.isDataTexture3D&&(a=32879),X(e,r),n.activeTexture(33984+i),n.bindTexture(a,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!s&&(t.wrapS!==p||t.wrapT!==p||t.minFilter!==d&&t.minFilter!==g)}(r)&&!1===D(r.image),c=z(r.image,l,!1,_),u=D(c)||s,h=o.convert(r.format);let f,m=o.convert(r.type),y=B(r.internalFormat,h,m);Z(a,r,u);const v=r.mipmaps;if(r.isDepthTexture)y=6402,s?y=r.type===w?36012:r.type===b?33190:r.type===S?35056:33189:r.type===w&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===A&&6402===y&&r.type!==x&&r.type!==b&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=x,m=o.convert(r.type)),r.format===C&&6402===y&&(y=34041,r.type!==S&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=S,m=o.convert(r.type))),n.texImage2D(3553,0,y,c.width,c.height,0,h,m,null);else if(r.isDataTexture)if(v.length>0&&u){for(let t=0,e=v.length;t<e;t++)f=v[t],n.texImage2D(3553,t,y,f.width,f.height,0,h,m,f.data);r.generateMipmaps=!1,e.__maxMipLevel=v.length-1}else n.texImage2D(3553,0,y,c.width,c.height,0,h,m,c.data),e.__maxMipLevel=0;else if(r.isCompressedTexture){for(let t=0,e=v.length;t<e;t++)f=v[t],r.format!==E&&r.format!==T?null!==h?n.compressedTexImage2D(3553,t,y,f.width,f.height,0,f.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,t,y,f.width,f.height,0,h,m,f.data);e.__maxMipLevel=v.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,y,c.width,c.height,c.depth,0,h,m,c.data),e.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,y,c.width,c.height,c.depth,0,h,m,c.data),e.__maxMipLevel=0;else if(v.length>0&&u){for(let t=0,e=v.length;t<e;t++)f=v[t],n.texImage2D(3553,t,y,h,m,f);r.generateMipmaps=!1,e.__maxMipLevel=v.length-1}else n.texImage2D(3553,0,y,h,m,c),e.__maxMipLevel=0;O(r,u)&&F(a,r,c.width,c.height),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function J(e,i,a,s,l){const c=o.convert(a.format),u=o.convert(a.type),p=B(a.internalFormat,c,u);32879===l||35866===l?n.texImage3D(l,0,p,i.width,i.height,i.depth,0,c,u,null):n.texImage2D(l,0,p,i.width,i.height,0,c,u,null),n.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,s,l,r.get(a).__webglTexture,0),n.bindFramebuffer(36160,null)}function Y(e,n,r){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let i=33189;if(r){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===w?i=36012:e.type===b&&(i=33190));const r=Q(n);t.renderbufferStorageMultisample(36161,r,i,n.width,n.height)}else t.renderbufferStorage(36161,i,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){if(r){const e=Q(n);t.renderbufferStorageMultisample(36161,e,35056,n.width,n.height)}else t.renderbufferStorage(36161,34041,n.width,n.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture[0]:n.texture,i=o.convert(e.format),a=o.convert(e.type),s=B(e.internalFormat,i,a);if(r){const e=Q(n);t.renderbufferStorageMultisample(36161,e,s,n.width,n.height)}else t.renderbufferStorage(36161,s,n.width,n.height)}t.bindRenderbuffer(36161,null)}function Q(t){return s&&t.isWebGLMultisampleRenderTarget?Math.min(L,t.samples):0}let K=!1,tt=!1;this.allocateTextureUnit=function(){const t=V;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),V+=1,t},this.resetTextureUnits=function(){V=0},this.setTexture2D=G,this.setTexture2DArray=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?$(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?$(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=H,this.setupRenderTarget=function(e){const l=e.texture,c=r.get(e),u=r.get(l);e.addEventListener("dispose",j),!0!==e.isWebGLMultipleRenderTargets&&(u.__webglTexture=t.createTexture(),u.__version=l.version,a.memory.textures++);const p=!0===e.isWebGLCubeRenderTarget,h=!0===e.isWebGLMultipleRenderTargets,d=!0===e.isWebGLMultisampleRenderTarget,f=l.isDataTexture3D||l.isDataTexture2DArray,m=D(e)||s;if(!s||l.format!==T||l.type!==w&&l.type!==M||(l.format=E,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),p){c.__webglFramebuffer=[];for(let e=0;e<6;e++)c.__webglFramebuffer[e]=t.createFramebuffer()}else if(c.__webglFramebuffer=t.createFramebuffer(),h)if(i.drawBuffers){const n=e.texture;for(let e=0,i=n.length;e<i;e++){const i=r.get(n[e]);void 0===i.__webglTexture&&(i.__webglTexture=t.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(d)if(s){c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,c.__webglColorRenderbuffer);const r=o.convert(l.format),i=o.convert(l.type),a=B(l.internalFormat,r,i),s=Q(e);t.renderbufferStorageMultisample(36161,s,a,e.width,e.height),n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,c.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),Y(c.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(p){n.bindTexture(34067,u.__webglTexture),Z(34067,l,m);for(let t=0;t<6;t++)J(c.__webglFramebuffer[t],e,l,36064,34069+t);O(l,m)&&F(34067,l,e.width,e.height),n.unbindTexture()}else if(h){const t=e.texture;for(let i=0,o=t.length;i<o;i++){const o=t[i],a=r.get(o);n.bindTexture(3553,a.__webglTexture),Z(3553,o,m),J(c.__webglFramebuffer,e,o,36064+i,3553),O(o,m)&&F(3553,o,e.width,e.height)}n.unbindTexture()}else{let t=3553;f&&(s?t=l.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),n.bindTexture(t,u.__webglTexture),Z(t,l,m),J(c.__webglFramebuffer,e,l,36064,t),O(l,m)&&F(t,l,e.width,e.height,e.depth),n.unbindTexture()}e.depthBuffer&&function(e){const i=r.get(e),o=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(o)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),G(i.depthTexture,0);const o=r.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===A)t.framebufferTexture2D(36160,36096,3553,o,0);else{if(i.depthTexture.format!==C)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,o,0)}}(i.__webglFramebuffer,e)}else if(o){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)n.bindFramebuffer(36160,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]=t.createRenderbuffer(),Y(i.__webglDepthbuffer[r],e,!1)}else n.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),Y(i.__webglDepthbuffer,e,!1);n.bindFramebuffer(36160,null)}(e)},this.updateRenderTargetMipmap=function(t){const e=D(t)||s,i=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let o=0,a=i.length;o<a;o++){const a=i[o];if(O(a,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,i=r.get(a).__webglTexture;n.bindTexture(e,i),F(e,a,t.width,t.height),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(s){const i=e.width,o=e.height;let a=16384;e.depthBuffer&&(a|=256),e.stencilBuffer&&(a|=1024);const s=r.get(e);n.bindFramebuffer(36008,s.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,s.__webglFramebuffer),t.blitFramebuffer(0,0,i,o,0,0,i,o,a,9728),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,s.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===K&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),K=!0),t=t.texture),G(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===tt&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),tt=!0),t=t.texture),H(t,e)}}function Do(t,e,n){const r=n.isWebGL2;return{convert:function(t){let n;if(t===_)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(t===x)return 5123;if(1013===t)return 5124;if(t===b)return 5125;if(t===w)return 5126;if(t===M)return r?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(1021===t)return 6406;if(t===T)return 6407;if(t===E)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===A)return 6402;if(t===C)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(t===L||t===P||t===I||t===R){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===L)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===P)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===I)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===R)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===k||t===z||t===D||t===O){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===k)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===z)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===D)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===O)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===F||t===B)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===F)return n.COMPRESSED_RGB8_ETC2;if(t===B)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:36492===t?null!==(n=e.get("EXT_texture_compression_bptc"))?t:null:t===S?r?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}Io.prototype.isMeshDistanceMaterial=!0;class Oo extends Xn{constructor(t=[]){super(),this.cameras=t}}Oo.prototype.isArrayCamera=!0;class Fo extends Pe{constructor(){super(),this.type="Group"}}Fo.prototype.isGroup=!0;const Bo={type:"move"};class No{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Fo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Fo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ct,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ct),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Fo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ct,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ct),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let r=null,i=null,o=null;const a=this._targetRay,s=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==a&&null!==(r=e.getPose(t.targetRaySpace,n))&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Bo)),l&&t.hand){o=!0;for(const r of t.hand.values()){const t=e.getJointPose(r,n);if(void 0===l.joints[r.jointName]){const t=new Fo;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[r.jointName]=t,l.add(t)}const i=l.joints[r.jointName];null!==t&&(i.matrix.fromArray(t.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=t.radius),i.visible=null!==t}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],a=r.position.distanceTo(i.position),s=.02,c=.005;l.inputState.pinching&&a>s+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=s-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==s&&t.gripSpace&&null!==(i=e.getPose(t.gripSpace,n))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1);return null!==a&&(a.visible=null!==r),null!==s&&(s.visible=null!==i),null!==l&&(l.visible=null!==o),this}}class Uo extends rt{constructor(t,e){super();const n=this,r=t.state;let i=null,o=1,a=null,s="local-floor",l=null,c=null,u=null,p=null,h=null,d=!1,f=null,m=null,g=null,y=null,v=null,_=null;const x=[],b=new Map,w=new Xn;w.layers.enable(1),w.viewport=new Mt;const M=new Xn;M.layers.enable(2),M.viewport=new Mt;const S=[w,M],T=new Oo;T.layers.enable(1),T.layers.enable(2);let E=null,A=null;function C(t){const e=b.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function L(){b.forEach((function(t,e){t.disconnect(e)})),b.clear(),E=null,A=null,r.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),u&&e.deleteFramebuffer(u),f&&e.deleteFramebuffer(f),m&&e.deleteRenderbuffer(m),g&&e.deleteRenderbuffer(g),u=null,f=null,m=null,g=null,h=null,p=null,c=null,i=null,D.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function P(t){const e=i.inputSources;for(let t=0;t<x.length;t++)b.set(e[t],x[t]);for(let e=0;e<t.removed.length;e++){const n=t.removed[e],r=b.get(n);r&&(r.dispatchEvent({type:"disconnected",data:n}),b.delete(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e],r=b.get(n);r&&r.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=x[t];return void 0===e&&(e=new No,x[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=x[t];return void 0===e&&(e=new No,x[t]=e),e.getGripSpace()},this.getHand=function(t){let e=x[t];return void 0===e&&(e=new No,x[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){o=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){s=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getBaseLayer=function(){return null!==p?p:h},this.getBinding=function(){return c},this.getFrame=function(){return y},this.getSession=function(){return i},this.setSession=async function(t){if(null!==(i=t)){i.addEventListener("select",C),i.addEventListener("selectstart",C),i.addEventListener("selectend",C),i.addEventListener("squeeze",C),i.addEventListener("squeezestart",C),i.addEventListener("squeezeend",C),i.addEventListener("end",L),i.addEventListener("inputsourceschange",P);const t=e.getContextAttributes();if(!0!==t.xrCompatible&&await e.makeXRCompatible(),void 0===i.renderState.layers){const n={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:o};h=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:h})}else if(e instanceof WebGLRenderingContext){const n={antialias:!0,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:o};h=new XRWebGLLayer(i,e,n),i.updateRenderState({layers:[h]})}else{d=t.antialias;let n=null;t.depth&&(_=256,t.stencil&&(_|=1024),v=t.stencil?33306:36096,n=t.stencil?35056:33190);const a={colorFormat:t.alpha?32856:32849,depthFormat:n,scaleFactor:o};c=new XRWebGLBinding(i,e),p=c.createProjectionLayer(a),u=e.createFramebuffer(),i.updateRenderState({layers:[p]}),d&&(f=e.createFramebuffer(),m=e.createRenderbuffer(),e.bindRenderbuffer(36161,m),e.renderbufferStorageMultisample(36161,4,32856,p.textureWidth,p.textureHeight),r.bindFramebuffer(36160,f),e.framebufferRenderbuffer(36160,36064,36161,m),e.bindRenderbuffer(36161,null),null!==n&&(g=e.createRenderbuffer(),e.bindRenderbuffer(36161,g),e.renderbufferStorageMultisample(36161,4,n,p.textureWidth,p.textureHeight),e.framebufferRenderbuffer(36160,v,36161,g),e.bindRenderbuffer(36161,null)),r.bindFramebuffer(36160,null))}a=await i.requestReferenceSpace(s),D.setContext(i),D.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const I=new Ct,R=new Ct;function k(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;T.near=M.near=w.near=t.near,T.far=M.far=w.far=t.far,E===T.near&&A===T.far||(i.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,A=T.far);const e=t.parent,n=T.cameras;k(T,e);for(let t=0;t<n.length;t++)k(n[t],e);T.matrixWorld.decompose(T.position,T.quaternion,T.scale),t.position.copy(T.position),t.quaternion.copy(T.quaternion),t.scale.copy(T.scale),t.matrix.copy(T.matrix),t.matrixWorld.copy(T.matrixWorld);const r=t.children;for(let t=0,e=r.length;t<e;t++)r[t].updateMatrixWorld(!0);2===n.length?function(t,e,n){I.setFromMatrixPosition(e.matrixWorld),R.setFromMatrixPosition(n.matrixWorld);const r=I.distanceTo(R),i=e.projectionMatrix.elements,o=n.projectionMatrix.elements,a=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],u=(i[8]-1)/i[0],p=(o[8]+1)/o[0],h=a*u,d=a*p,f=r/(-u+p),m=f*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=a+f,y=s+f,v=h-m,_=d+(r-m),x=l*s/y*g,b=c*s/y*g;t.projectionMatrix.makePerspective(v,_,x,b,g,y)}(T,w,M):T.projectionMatrix.copy(w.projectionMatrix)},this.getCamera=function(){return T},this.getFoveation=function(){return null!==p?p.fixedFoveation:null!==h?h.fixedFoveation:void 0},this.setFoveation=function(t){null!==p&&(p.fixedFoveation=t),null!==h&&void 0!==h.fixedFoveation&&(h.fixedFoveation=t)};let z=null;const D=new or;D.setAnimationLoop((function(t,n){if(l=n.getViewerPose(a),y=n,null!==l){const t=l.views;null!==h&&r.bindXRFramebuffer(h.framebuffer);let n=!1;t.length!==T.cameras.length&&(T.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){const o=t[i];let a=null;if(null!==h)a=h.getViewport(o);else{const t=c.getViewSubImage(p,o);r.bindXRFramebuffer(u),void 0!==t.depthStencilTexture&&e.framebufferTexture2D(36160,v,3553,t.depthStencilTexture,0),e.framebufferTexture2D(36160,36064,3553,t.colorTexture,0),a=t.viewport}const s=S[i];s.matrix.fromArray(o.transform.matrix),s.projectionMatrix.fromArray(o.projectionMatrix),s.viewport.set(a.x,a.y,a.width,a.height),0===i&&T.matrix.copy(s.matrix),!0===n&&T.cameras.push(s)}d&&(r.bindXRFramebuffer(f),null!==_&&e.clear(_))}const o=i.inputSources;for(let t=0;t<x.length;t++){const e=x[t],r=o[t];e.update(r,n,a)}if(z&&z(t,n),d){const t=p.textureWidth,n=p.textureHeight;r.bindFramebuffer(36008,f),r.bindFramebuffer(36009,u),e.invalidateFramebuffer(36008,[v]),e.invalidateFramebuffer(36009,[v]),e.blitFramebuffer(0,0,t,n,0,0,t,n,16384,9728),e.invalidateFramebuffer(36008,[36064]),r.bindFramebuffer(36008,null),r.bindFramebuffer(36009,null),r.bindFramebuffer(36160,f)}y=null})),this.setAnimationLoop=function(t){z=t},this.dispose=function(){}}}function jo(t){function e(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map),n.alphaMap&&(e.alphaMap.value=n.alphaMap),n.specularMap&&(e.specularMap.value=n.specularMap),n.alphaTest>0&&(e.alphaTest.value=n.alphaTest);const r=t.get(n).envMap;if(r){e.envMap.value=r,e.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.refractionRatio.value=n.refractionRatio;const i=t.get(r).__maxMipLevel;void 0!==i&&(e.maxMipLevel.value=i)}let i,o;n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?i=n.map:n.specularMap?i=n.specularMap:n.displacementMap?i=n.displacementMap:n.normalMap?i=n.normalMap:n.bumpMap?i=n.bumpMap:n.roughnessMap?i=n.roughnessMap:n.metalnessMap?i=n.metalnessMap:n.alphaMap?i=n.alphaMap:n.emissiveMap?i=n.emissiveMap:n.clearcoatMap?i=n.clearcoatMap:n.clearcoatNormalMap?i=n.clearcoatNormalMap:n.clearcoatRoughnessMap?i=n.clearcoatRoughnessMap:n.specularIntensityMap?i=n.specularIntensityMap:n.specularTintMap?i=n.specularTintMap:n.transmissionMap?i=n.transmissionMap:n.thicknessMap&&(i=n.thicknessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix)),n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uv2Transform.value.copy(o.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,1===n.side&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),1===n.side&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,r,i,o,a){r.isMeshBasicMaterial?e(t,r):r.isMeshLambertMaterial?(e(t,r),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,r)):r.isMeshToonMaterial?(e(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshPhongMaterial?(e(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshStandardMaterial?(e(t,r),r.isMeshPhysicalMaterial?function(t,e,r){n(t,e),t.ior.value=e.ior,e.sheenTint&&t.sheenTint.value.copy(e.sheenTint),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate())),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=r.texture,t.transmissionSamplerSize.value.set(r.width,r.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationTint.value.copy(e.attenuationTint)),t.specularIntensity.value=e.specularIntensity,t.specularTint.value.copy(e.specularTint),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap),e.specularTintMap&&(t.specularTintMap.value=e.specularTintMap)}(t,r,a):n(t,r)):r.isMeshMatcapMaterial?(e(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshDepthMaterial?(e(t,r),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshDistanceMaterial?(e(t,r),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,r)):r.isMeshNormalMaterial?(e(t,r),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){let i;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest),e.map?i=e.map:e.alphaMap&&(i=e.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,r,i,o):r.isSpriteMaterial?function(t,e){let n;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest),e.map?n=e.map:e.alphaMap&&(n=e.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Vo(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,r=void 0!==t.alpha&&t.alpha,i=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,c=void 0!==t.powerPreference?t.powerPreference:"default",u=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let h=null,f=null;const m=[],g=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Z,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const y=this;let x=!1,b=0,S=0,T=null,A=-1,C=null;const L=new Mt,P=new Mt;let I=null,R=e.width,k=e.height,z=1,D=null,O=null;const F=new Mt(0,0,R,k),B=new Mt(0,0,R,k);let N=!1;const U=[],j=new ir;let V=!1,G=!1,H=null;const W=new oe,q=new Ct,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function $(){return null===T?z:1}let J,Y,Q,K,tt,et,nt,rt,it,ot,at,st,lt,ct,ut,pt,ht,dt,ft,mt,gt,yt,vt,_t=n;function xt(t,n){for(let r=0;r<t.length;r++){const i=t[r],o=e.getContext(i,n);if(null!==o)return o}return null}try{const t={alpha:r,depth:i,stencil:o,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if(e.addEventListener("webglcontextlost",Tt,!1),e.addEventListener("webglcontextrestored",At,!1),null===_t){const e=["webgl2","webgl","experimental-webgl"];if(!0===y.isWebGL1Renderer&&e.shift(),null===(_t=xt(e,t)))throw xt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===_t.getShaderPrecisionFormat&&(_t.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function bt(){J=new Nr(_t),Y=new fr(_t,J,t),J.init(Y),yt=new Do(_t,J,Y),Q=new ko(_t,J,Y),U[0]=1029,K=new Vr(_t),tt=new _o,et=new zo(_t,J,Q,tt,Y,yt,K),nt=new gr(y),rt=new Br(y),it=new ar(_t,Y),vt=new hr(_t,J,it,Y),ot=new Ur(_t,it,K,vt),at=new qr(_t,ot,it,K),ft=new Wr(_t),pt=new mr(tt),st=new vo(y,nt,rt,J,Y,vt,pt),lt=new jo(tt),ct=new Mo(tt),ut=new Lo(J,Y),dt=new pr(y,nt,Q,at,s),ht=new Ro(y,at,Y),mt=new dr(_t,J,K,Y),gt=new jr(_t,J,K,Y),K.programs=st.programs,y.capabilities=Y,y.extensions=J,y.properties=tt,y.renderLists=ct,y.shadowMap=ht,y.state=Q,y.info=K}bt();const wt=new Uo(y,_t);function Tt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function At(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;const t=K.autoReset,e=ht.enabled,n=ht.autoUpdate,r=ht.needsUpdate,i=ht.type;bt(),K.autoReset=t,ht.enabled=e,ht.autoUpdate=n,ht.needsUpdate=r,ht.type=i}function Lt(t){const e=t.target;e.removeEventListener("dispose",Lt),function(t){(function(t){const e=tt.get(t).programs;void 0!==e&&e.forEach((function(t){st.releaseProgram(t)}))})(t),tt.remove(t)}(e)}this.xr=wt,this.getContext=function(){return _t},this.getContextAttributes=function(){return _t.getContextAttributes()},this.forceContextLoss=function(){const t=J.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=J.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return z},this.setPixelRatio=function(t){void 0!==t&&(z=t,this.setSize(R,k,!1))},this.getSize=function(t){return t.set(R,k)},this.setSize=function(t,n,r){wt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(R=t,k=n,e.width=Math.floor(t*z),e.height=Math.floor(n*z),!1!==r&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(R*z,k*z).floor()},this.setDrawingBufferSize=function(t,n,r){R=t,k=n,z=r,e.width=Math.floor(t*r),e.height=Math.floor(n*r),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(L)},this.getViewport=function(t){return t.copy(F)},this.setViewport=function(t,e,n,r){t.isVector4?F.set(t.x,t.y,t.z,t.w):F.set(t,e,n,r),Q.viewport(L.copy(F).multiplyScalar(z).floor())},this.getScissor=function(t){return t.copy(B)},this.setScissor=function(t,e,n,r){t.isVector4?B.set(t.x,t.y,t.z,t.w):B.set(t,e,n,r),Q.scissor(P.copy(B).multiplyScalar(z).floor())},this.getScissorTest=function(){return N},this.setScissorTest=function(t){Q.setScissorTest(N=t)},this.setOpaqueSort=function(t){D=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return t.copy(dt.getClearColor())},this.setClearColor=function(){dt.setClearColor.apply(dt,arguments)},this.getClearAlpha=function(){return dt.getClearAlpha()},this.setClearAlpha=function(){dt.setClearAlpha.apply(dt,arguments)},this.clear=function(t,e,n){let r=0;(void 0===t||t)&&(r|=16384),(void 0===e||e)&&(r|=256),(void 0===n||n)&&(r|=1024),_t.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Tt,!1),e.removeEventListener("webglcontextrestored",At,!1),ct.dispose(),ut.dispose(),tt.dispose(),nt.dispose(),rt.dispose(),at.dispose(),vt.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",It),wt.removeEventListener("sessionend",Rt),H&&(H.dispose(),H=null),kt.stop()},this.renderBufferImmediate=function(t,e){vt.initAttributes();const n=tt.get(t);t.hasPositions&&!n.position&&(n.position=_t.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=_t.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=_t.createBuffer()),t.hasColors&&!n.color&&(n.color=_t.createBuffer());const r=e.getAttributes();t.hasPositions&&(_t.bindBuffer(34962,n.position),_t.bufferData(34962,t.positionArray,35048),vt.enableAttribute(r.position.location),_t.vertexAttribPointer(r.position.location,3,5126,!1,0,0)),t.hasNormals&&(_t.bindBuffer(34962,n.normal),_t.bufferData(34962,t.normalArray,35048),vt.enableAttribute(r.normal.location),_t.vertexAttribPointer(r.normal.location,3,5126,!1,0,0)),t.hasUvs&&(_t.bindBuffer(34962,n.uv),_t.bufferData(34962,t.uvArray,35048),vt.enableAttribute(r.uv.location),_t.vertexAttribPointer(r.uv.location,2,5126,!1,0,0)),t.hasColors&&(_t.bindBuffer(34962,n.color),_t.bufferData(34962,t.colorArray,35048),vt.enableAttribute(r.color.location),_t.vertexAttribPointer(r.color.location,3,5126,!1,0,0)),vt.disableUnusedAttributes(),_t.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,r,i,o){null===e&&(e=X);const a=i.isMesh&&i.matrixWorld.determinant()<0,s=Nt(t,e,r,i);Q.setMaterial(r,a);let l=n.index;const c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let u,p=1;!0===r.wireframe&&(l=ot.getWireframeAttribute(n),p=2),void 0===n.morphAttributes.position&&void 0===n.morphAttributes.normal||ft.update(i,n,r,s),vt.setup(i,r,s,n,l);let h=mt;null!==l&&(u=it.get(l),(h=gt).setIndex(u));const d=null!==l?l.count:c.count,f=n.drawRange.start*p,m=n.drawRange.count*p,g=null!==o?o.start*p:0,y=null!==o?o.count*p:1/0,v=Math.max(f,g),_=Math.min(d,f+m,g+y)-1,x=Math.max(0,_-v+1);if(0!==x){if(i.isMesh)!0===r.wireframe?(Q.setLineWidth(r.wireframeLinewidth*$()),h.setMode(1)):h.setMode(4);else if(i.isLine){let t=r.linewidth;void 0===t&&(t=1),Q.setLineWidth(t*$()),i.isLineSegments?h.setMode(1):i.isLineLoop?h.setMode(2):h.setMode(3)}else i.isPoints?h.setMode(0):i.isSprite&&h.setMode(4);if(i.isInstancedMesh)h.renderInstances(v,x,i.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);h.renderInstances(v,x,t)}else h.render(v,x)}},this.compile=function(t,e){(f=ut.get(t)).init(),g.push(f),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(f.pushLight(t),t.castShadow&&f.pushShadow(t))})),f.setupLights(y.physicallyCorrectLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++)Ft(n[r],t,e);else Ft(n,t,e)})),g.pop(),f=null};let Pt=null;function It(){kt.stop()}function Rt(){kt.start()}const kt=new or;function zt(t,e,n,r){const i=t.opaque,o=t.transmissive,s=t.transparent;f.setupLightsView(n),o.length>0&&function(t,e,n){if(null===H){const t=!0===a&&!0===Y.isWebGL2;H=new(t?Et:St)(1024,1024,{generateMipmaps:!0,type:null!==yt.convert(M)?M:_,minFilter:v,magFilter:d,wrapS:p,wrapT:p})}const r=y.getRenderTarget();y.setRenderTarget(H),y.clear();const i=y.toneMapping;y.toneMapping=0,Dt(t,e,n),y.toneMapping=i,et.updateMultisampleRenderTarget(H),et.updateRenderTargetMipmap(H),y.setRenderTarget(r)}(i,e,n),r&&Q.viewport(L.copy(r)),i.length>0&&Dt(i,e,n),o.length>0&&Dt(o,e,n),s.length>0&&Dt(s,e,n)}function Dt(t,e,n){const r=!0===e.isScene?e.overrideMaterial:null;for(let i=0,o=t.length;i<o;i++){const o=t[i],a=o.object,s=o.geometry,l=null===r?o.material:r,c=o.group;a.layers.test(n.layers)&&Ot(a,e,n,s,l,c)}}function Ot(t,e,n,r,i,o){if(t.onBeforeRender(y,e,n,r,i,o),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const r=Nt(n,e,i,t);Q.setMaterial(i),vt.reset(),function(t,e){t.render((function(t){y.renderBufferImmediate(t,e)}))}(t,r)}else!0===i.transparent&&2===i.side?(i.side=1,i.needsUpdate=!0,y.renderBufferDirect(n,e,r,i,t,o),i.side=0,i.needsUpdate=!0,y.renderBufferDirect(n,e,r,i,t,o),i.side=2):y.renderBufferDirect(n,e,r,i,t,o);t.onAfterRender(y,e,n,r,i,o)}function Ft(t,e,n){!0!==e.isScene&&(e=X);const r=tt.get(t),i=f.state.lights,o=f.state.shadowsArray,a=i.state.version,s=st.getParameters(t,i.state,o,e,n),l=st.getProgramCacheKey(s);let c=r.programs;r.environment=t.isMeshStandardMaterial?e.environment:null,r.fog=e.fog,r.envMap=(t.isMeshStandardMaterial?rt:nt).get(t.envMap||r.environment),void 0===c&&(t.addEventListener("dispose",Lt),c=new Map,r.programs=c);let u=c.get(l);if(void 0!==u){if(r.currentProgram===u&&r.lightsStateVersion===a)return Bt(t,s),u}else s.uniforms=st.getUniforms(t),t.onBuild(s,y),t.onBeforeCompile(s,y),u=st.acquireProgram(s,l),c.set(l,u),r.uniforms=s.uniforms;const p=r.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(p.clippingPlanes=pt.uniform),Bt(t,s),r.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),r.lightsStateVersion=a,r.needsLights&&(p.ambientLightColor.value=i.state.ambient,p.lightProbe.value=i.state.probe,p.directionalLights.value=i.state.directional,p.directionalLightShadows.value=i.state.directionalShadow,p.spotLights.value=i.state.spot,p.spotLightShadows.value=i.state.spotShadow,p.rectAreaLights.value=i.state.rectArea,p.ltc_1.value=i.state.rectAreaLTC1,p.ltc_2.value=i.state.rectAreaLTC2,p.pointLights.value=i.state.point,p.pointLightShadows.value=i.state.pointShadow,p.hemisphereLights.value=i.state.hemi,p.directionalShadowMap.value=i.state.directionalShadowMap,p.directionalShadowMatrix.value=i.state.directionalShadowMatrix,p.spotShadowMap.value=i.state.spotShadowMap,p.spotShadowMatrix.value=i.state.spotShadowMatrix,p.pointShadowMap.value=i.state.pointShadowMap,p.pointShadowMatrix.value=i.state.pointShadowMatrix);const h=u.getUniforms(),d=Ji.seqWithValue(h.seq,p);return r.currentProgram=u,r.uniformsList=d,u}function Bt(t,e){const n=tt.get(t);n.outputEncoding=e.outputEncoding,n.instancing=e.instancing,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents}function Nt(t,e,n,r){!0!==e.isScene&&(e=X),et.resetTextureUnits();const i=e.fog,o=n.isMeshStandardMaterial?e.environment:null,a=null===T?y.outputEncoding:T.texture.encoding,s=(n.isMeshStandardMaterial?rt:nt).get(n.envMap||o),l=!0===n.vertexColors&&!!r.geometry&&!!r.geometry.attributes.color&&4===r.geometry.attributes.color.itemSize,c=!!r.geometry&&!!r.geometry.attributes.tangent,u=!!r.geometry&&!!r.geometry.morphAttributes.position,p=!!r.geometry&&!!r.geometry.morphAttributes.normal,h=tt.get(n),d=f.state.lights;if(!0===V&&(!0===G||t!==C)){const e=t===C&&n.id===A;pt.setState(n,t,e)}let m=!1;n.version===h.__version?h.needsLights&&h.lightsStateVersion!==d.state.version||h.outputEncoding!==a||r.isInstancedMesh&&!1===h.instancing?m=!0:r.isInstancedMesh||!0!==h.instancing?r.isSkinnedMesh&&!1===h.skinning?m=!0:r.isSkinnedMesh||!0!==h.skinning?h.envMap!==s||n.fog&&h.fog!==i?m=!0:void 0===h.numClippingPlanes||h.numClippingPlanes===pt.numPlanes&&h.numIntersection===pt.numIntersection?(h.vertexAlphas!==l||h.vertexTangents!==c||h.morphTargets!==u||h.morphNormals!==p)&&(m=!0):m=!0:m=!0:m=!0:(m=!0,h.__version=n.version);let g=h.currentProgram;!0===m&&(g=Ft(n,e,r));let v=!1,_=!1,x=!1;const b=g.getUniforms(),w=h.uniforms;if(Q.useProgram(g.program)&&(v=!0,_=!0,x=!0),n.id!==A&&(A=n.id,_=!0),v||C!==t){if(b.setValue(_t,"projectionMatrix",t.projectionMatrix),Y.logarithmicDepthBuffer&&b.setValue(_t,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),C!==t&&(C=t,_=!0,x=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const e=b.map.cameraPosition;void 0!==e&&e.setValue(_t,q.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&b.setValue(_t,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||r.isSkinnedMesh)&&b.setValue(_t,"viewMatrix",t.matrixWorldInverse)}if(r.isSkinnedMesh){b.setOptional(_t,r,"bindMatrix"),b.setOptional(_t,r,"bindMatrixInverse");const t=r.skeleton;t&&(Y.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),b.setValue(_t,"boneTexture",t.boneTexture,et),b.setValue(_t,"boneTextureSize",t.boneTextureSize)):b.setOptional(_t,t,"boneMatrices"))}var M,S;return(_||h.receiveShadow!==r.receiveShadow)&&(h.receiveShadow=r.receiveShadow,b.setValue(_t,"receiveShadow",r.receiveShadow)),_&&(b.setValue(_t,"toneMappingExposure",y.toneMappingExposure),h.needsLights&&(S=x,(M=w).ambientLightColor.needsUpdate=S,M.lightProbe.needsUpdate=S,M.directionalLights.needsUpdate=S,M.directionalLightShadows.needsUpdate=S,M.pointLights.needsUpdate=S,M.pointLightShadows.needsUpdate=S,M.spotLights.needsUpdate=S,M.spotLightShadows.needsUpdate=S,M.rectAreaLights.needsUpdate=S,M.hemisphereLights.needsUpdate=S),i&&n.fog&&lt.refreshFogUniforms(w,i),lt.refreshMaterialUniforms(w,n,z,k,H),Ji.upload(_t,h.uniformsList,w,et)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Ji.upload(_t,h.uniformsList,w,et),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&b.setValue(_t,"center",r.center),b.setValue(_t,"modelViewMatrix",r.modelViewMatrix),b.setValue(_t,"normalMatrix",r.normalMatrix),b.setValue(_t,"modelMatrix",r.matrixWorld),g}kt.setAnimationLoop((function(t){Pt&&Pt(t)})),"undefined"!=typeof window&&kt.setContext(window),this.setAnimationLoop=function(t){Pt=t,wt.setAnimationLoop(t),null===t?kt.stop():kt.start()},wt.addEventListener("sessionstart",It),wt.addEventListener("sessionend",Rt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===x)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===wt.enabled&&!0===wt.isPresenting&&(!0===wt.cameraAutoUpdate&&wt.updateCamera(e),e=wt.getCamera()),!0===t.isScene&&t.onBeforeRender(y,t,e,T),(f=ut.get(t,g.length)).init(),g.push(f),W.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),j.setFromProjectionMatrix(W),G=this.localClippingEnabled,V=pt.init(this.clippingPlanes,G,e),(h=ct.get(t,m.length)).init(),m.push(h),function t(e,n,r,i){if(!1===e.visible)return;if(e.layers.test(n.layers))if(e.isGroup)r=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(n);else if(e.isLight)f.pushLight(e),e.castShadow&&f.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||j.intersectsSprite(e)){i&&q.setFromMatrixPosition(e.matrixWorld).applyMatrix4(W);const t=at.update(e),n=e.material;n.visible&&h.push(e,t,n,r,q.z,null)}}else if(e.isImmediateRenderObject)i&&q.setFromMatrixPosition(e.matrixWorld).applyMatrix4(W),h.push(e,null,e.material,r,q.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==K.render.frame&&(e.skeleton.update(),e.skeleton.frame=K.render.frame),!e.frustumCulled||j.intersectsObject(e))){i&&q.setFromMatrixPosition(e.matrixWorld).applyMatrix4(W);const t=at.update(e),n=e.material;if(Array.isArray(n)){const i=t.groups;for(let o=0,a=i.length;o<a;o++){const a=i[o],s=n[a.materialIndex];s&&s.visible&&h.push(e,t,s,r,q.z,a)}}else n.visible&&h.push(e,t,n,r,q.z,null)}const o=e.children;for(let e=0,a=o.length;e<a;e++)t(o[e],n,r,i)}(t,e,0,y.sortObjects),h.finish(),!0===y.sortObjects&&h.sort(D,O),!0===V&&pt.beginShadows();const n=f.state.shadowsArray;if(ht.render(n,t,e),!0===V&&pt.endShadows(),!0===this.info.autoReset&&this.info.reset(),dt.render(h,t),f.setupLights(y.physicallyCorrectLights),e.isArrayCamera){const n=e.cameras;for(let e=0,r=n.length;e<r;e++){const r=n[e];zt(h,t,r,r.viewport)}}else zt(h,t,e);null!==T&&(et.updateMultisampleRenderTarget(T),et.updateRenderTargetMipmap(T)),!0===t.isScene&&t.onAfterRender(y,t,e),Q.buffers.depth.setTest(!0),Q.buffers.depth.setMask(!0),Q.buffers.color.setMask(!0),Q.setPolygonOffset(!1),vt.resetDefaultState(),A=-1,C=null,g.pop(),f=g.length>0?g[g.length-1]:null,m.pop(),h=m.length>0?m[m.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return T},this.setRenderTarget=function(t,e=0,n=0){T=t,b=e,S=n,t&&void 0===tt.get(t).__webglFramebuffer&&et.setupRenderTarget(t);let r=null,i=!1,o=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(o=!0);const a=tt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=a[e],i=!0):r=t.isWebGLMultisampleRenderTarget?tt.get(t).__webglMultisampledFramebuffer:a,L.copy(t.viewport),P.copy(t.scissor),I=t.scissorTest}else L.copy(F).multiplyScalar(z).floor(),P.copy(B).multiplyScalar(z).floor(),I=N;if(Q.bindFramebuffer(36160,r)&&Y.drawBuffers){let e=!1;if(t)if(t.isWebGLMultipleRenderTargets){const n=t.texture;if(U.length!==n.length||36064!==U[0]){for(let t=0,e=n.length;t<e;t++)U[t]=36064+t;U.length=n.length,e=!0}}else 1===U.length&&36064===U[0]||(U[0]=36064,U.length=1,e=!0);else 1===U.length&&1029===U[0]||(U[0]=1029,U.length=1,e=!0);e&&(Y.isWebGL2?_t.drawBuffers(U):J.get("WEBGL_draw_buffers").drawBuffersWEBGL(U))}if(Q.viewport(L),Q.scissor(P),Q.setScissorTest(I),i){const r=tt.get(t.texture);_t.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(o){const r=tt.get(t.texture),i=e||0;_t.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}A=-1},this.readRenderTargetPixels=function(t,e,n,r,i,o,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=tt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(s=s[a]),s){Q.bindFramebuffer(36160,s);try{const a=t.texture,s=a.format,l=a.type;if(s!==E&&yt.convert(s)!==_t.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===M&&(J.has("EXT_color_buffer_half_float")||Y.isWebGL2&&J.has("EXT_color_buffer_float"));if(!(l===_||yt.convert(l)===_t.getParameter(35738)||l===w&&(Y.isWebGL2||J.has("OES_texture_float")||J.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===_t.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&_t.readPixels(e,n,r,i,yt.convert(s),yt.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==T?tt.get(T).__webglFramebuffer:null;Q.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),o=Math.floor(e.image.height*r);let a=yt.convert(e.format);Y.isWebGL2&&(6407===a&&(a=32849),6408===a&&(a=32856)),et.setTexture2D(e,0),_t.copyTexImage2D(3553,n,a,t.x,t.y,i,o,0),Q.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,o=e.image.height,a=yt.convert(n.format),s=yt.convert(n.type);et.setTexture2D(n,0),_t.pixelStorei(37440,n.flipY),_t.pixelStorei(37441,n.premultiplyAlpha),_t.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?_t.texSubImage2D(3553,r,t.x,t.y,i,o,a,s,e.image.data):e.isCompressedTexture?_t.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):_t.texSubImage2D(3553,r,t.x,t.y,a,s,e.image),0===r&&n.generateMipmaps&&_t.generateMipmap(3553),Q.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(y.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const o=t.max.x-t.min.x+1,a=t.max.y-t.min.y+1,s=t.max.z-t.min.z+1,l=yt.convert(r.format),c=yt.convert(r.type);let u;if(r.isDataTexture3D)et.setTexture3D(r,0),u=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");et.setTexture2DArray(r,0),u=35866}_t.pixelStorei(37440,r.flipY),_t.pixelStorei(37441,r.premultiplyAlpha),_t.pixelStorei(3317,r.unpackAlignment);const p=_t.getParameter(3314),h=_t.getParameter(32878),d=_t.getParameter(3316),f=_t.getParameter(3315),m=_t.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;_t.pixelStorei(3314,g.width),_t.pixelStorei(32878,g.height),_t.pixelStorei(3316,t.min.x),_t.pixelStorei(3315,t.min.y),_t.pixelStorei(32877,t.min.z),n.isDataTexture||n.isDataTexture3D?_t.texSubImage3D(u,i,e.x,e.y,e.z,o,a,s,l,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),_t.compressedTexSubImage3D(u,i,e.x,e.y,e.z,o,a,s,l,g.data)):_t.texSubImage3D(u,i,e.x,e.y,e.z,o,a,s,l,c,g),_t.pixelStorei(3314,p),_t.pixelStorei(32878,h),_t.pixelStorei(3316,d),_t.pixelStorei(3315,f),_t.pixelStorei(32877,m),0===i&&r.generateMipmaps&&_t.generateMipmap(u),Q.unbindTexture()},this.initTexture=function(t){et.setTexture2D(t,0),Q.unbindTexture()},this.resetState=function(){b=0,S=0,T=null,Q.reset(),vt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class Go extends Vo{}Go.prototype.isWebGL1Renderer=!0;class Ho{constructor(t,e=25e-5){this.name="",this.color=new Je(t),this.density=e}clone(){return new Ho(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Ho.prototype.isFogExp2=!0;class Wo{constructor(t,e=1,n=1e3){this.name="",this.color=new Je(t),this.near=e,this.far=n}clone(){return new Wo(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}Wo.prototype.isFog=!0;class qo extends Pe{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}qo.prototype.isScene=!0;class Zo{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=tt,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=lt()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=lt()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=lt()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}Zo.prototype.isInterleavedBuffer=!0;const Xo=new Ct;class $o{constructor(t,e,n,r=!1){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Xo.x=this.getX(e),Xo.y=this.getY(e),Xo.z=this.getZ(e),Xo.applyMatrix4(t),this.setXYZ(e,Xo.x,Xo.y,Xo.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Xo.x=this.getX(e),Xo.y=this.getY(e),Xo.z=this.getZ(e),Xo.applyNormalMatrix(t),this.setXYZ(e,Xo.x,Xo.y,Xo.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Xo.x=this.getX(e),Xo.y=this.getY(e),Xo.z=this.getZ(e),Xo.transformDirection(t),this.setXYZ(e,Xo.x,Xo.y,Xo.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this}setXYZW(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new tn(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new $o(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}$o.prototype.isInterleavedBufferAttribute=!0;class Jo extends Ge{constructor(t){super(),this.type="SpriteMaterial",this.color=new Je(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let Yo;Jo.prototype.isSpriteMaterial=!0;const Qo=new Ct,Ko=new Ct,ta=new Ct,ea=new gt,na=new gt,ra=new oe,ia=new Ct,oa=new Ct,aa=new Ct,sa=new gt,la=new gt,ca=new gt;class ua extends Pe{constructor(t){if(super(),this.type="Sprite",void 0===Yo){Yo=new wn;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Zo(t,5);Yo.setIndex([0,1,2,0,2,3]),Yo.setAttribute("position",new $o(e,3,0,!1)),Yo.setAttribute("uv",new $o(e,2,3,!1))}this.geometry=Yo,this.material=void 0!==t?t:new Jo,this.center=new gt(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ko.setFromMatrixScale(this.matrixWorld),ra.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),ta.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Ko.multiplyScalar(-ta.z);const n=this.material.rotation;let r,i;0!==n&&(i=Math.cos(n),r=Math.sin(n));const o=this.center;pa(ia.set(-.5,-.5,0),ta,o,Ko,r,i),pa(oa.set(.5,-.5,0),ta,o,Ko,r,i),pa(aa.set(.5,.5,0),ta,o,Ko,r,i),sa.set(0,0),la.set(1,0),ca.set(1,1);let a=t.ray.intersectTriangle(ia,oa,aa,!1,Qo);if(null===a&&(pa(oa.set(-.5,.5,0),ta,o,Ko,r,i),la.set(0,1),null===(a=t.ray.intersectTriangle(ia,aa,oa,!1,Qo))))return;const s=t.ray.origin.distanceTo(Qo);s<t.near||s>t.far||e.push({distance:s,point:Qo.clone(),uv:je.getUV(Qo,ia,oa,aa,sa,la,ca,new gt),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function pa(t,e,n,r,i,o){ea.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(na.x=o*ea.x-i*ea.y,na.y=i*ea.x+o*ea.y):na.copy(ea),t.copy(e),t.x+=na.x,t.y+=na.y,t.applyMatrix4(ra)}ua.prototype.isSprite=!0;const ha=new Ct,da=new Ct;class fa extends Pe{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.addLevel(n.object.clone(),n.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0){e=Math.abs(e);const n=this.levels;let r;for(r=0;r<n.length&&!(e<n[r].distance);r++);return n.splice(r,0,{distance:e,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,r;for(n=1,r=e.length;n<r&&!(t<e[n].distance);n++);return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){ha.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(ha);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){ha.setFromMatrixPosition(t.matrixWorld),da.setFromMatrixPosition(this.matrixWorld);const n=ha.distanceTo(da)/t.zoom;let r,i;for(e[0].object.visible=!0,r=1,i=e.length;r<i&&n>=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)e[r].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let t=0,r=n.length;t<r;t++){const r=n[t];e.object.levels.push({object:r.object.uuid,distance:r.distance})}return e}}const ma=new Ct,ga=new Mt,ya=new Mt,va=new Ct,_a=new oe;class xa extends Un{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new oe,this.bindMatrixInverse=new oe}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Mt,e=this.geometry.attributes.skinWeight;for(let n=0,r=e.count;n<r;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);const r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,e){const n=this.skeleton,r=this.geometry;ga.fromBufferAttribute(r.attributes.skinIndex,t),ya.fromBufferAttribute(r.attributes.skinWeight,t),ma.fromBufferAttribute(r.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const r=ya.getComponent(t);if(0!==r){const i=ga.getComponent(t);_a.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),e.addScaledVector(va.copy(ma).applyMatrix4(_a),r)}}return e.applyMatrix4(this.bindMatrixInverse)}}xa.prototype.isSkinnedMesh=!0;class ba extends Pe{constructor(){super(),this.type="Bone"}}ba.prototype.isBone=!0;class wa extends bt{constructor(t=null,e=1,n=1,r,i,o,a,s,l=1003,c=1003,u,p){super(null,o,a,s,l,c,r,i,u,p),this.image={data:t,width:e,height:n},this.magFilter=l,this.minFilter=c,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}wa.prototype.isDataTexture=!0;const Ma=new oe,Sa=new oe;class Ta{constructor(t=[],e=[]){this.uuid=lt(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new oe)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new oe;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=t.length;r<i;r++){const i=t[r]?t[r].matrixWorld:Sa;Ma.multiplyMatrices(i,e[r]),Ma.toArray(n,16*r)}null!==r&&(r.needsUpdate=!0)}clone(){return new Ta(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=dt(t),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new wa(e,t,t,E,w);return this.boneMatrices=e,this.boneTexture=n,this.boneTextureSize=t,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,r=t.bones.length;n<r;n++){const r=t.bones[n];let i=e[r];void 0===i&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),i=new ba),this.bones.push(i),this.boneInverses.push((new oe).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let r=0,i=e.length;r<i;r++){const i=e[r];t.bones.push(i.uuid);const o=n[r];t.boneInverses.push(o.toArray())}return t}}class Ea extends tn{constructor(t,e,n,r=1){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,n),this.meshPerAttribute=r}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}Ea.prototype.isInstancedBufferAttribute=!0;const Aa=new oe,Ca=new oe,La=[],Pa=new Un;class Ia extends Un{constructor(t,e,n){super(t,e),this.instanceMatrix=new Ea(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const n=this.matrixWorld,r=this.count;if(Pa.geometry=this.geometry,Pa.material=this.material,void 0!==Pa.material)for(let i=0;i<r;i++){this.getMatrixAt(i,Aa),Ca.multiplyMatrices(n,Aa),Pa.matrixWorld=Ca,Pa.raycast(t,La);for(let t=0,n=La.length;t<n;t++){const n=La[t];n.instanceId=i,n.object=this,e.push(n)}La.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new Ea(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Ia.prototype.isInstancedMesh=!0;class Ra extends Ge{constructor(t){super(),this.type="LineBasicMaterial",this.color=new Je(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this}}Ra.prototype.isLineBasicMaterial=!0;const ka=new Ct,za=new Ct,Da=new oe,Oa=new ie,Fa=new Jt;class Ba extends Pe{constructor(t=new wn,e=new Ra){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,r=e.count;t<r;t++)ka.fromBufferAttribute(e,t-1),za.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=ka.distanceTo(za);t.setAttribute("lineDistance",new un(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Line.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Fa.copy(n.boundingSphere),Fa.applyMatrix4(r),Fa.radius+=i,!1===t.ray.intersectsSphere(Fa))return;Da.copy(r).invert(),Oa.copy(t.ray).applyMatrix4(Da);const a=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=a*a,l=new Ct,c=new Ct,u=new Ct,p=new Ct,h=this.isLineSegments?2:1;if(n.isBufferGeometry){const r=n.index,i=n.attributes.position;if(null!==r)for(let n=Math.max(0,o.start),a=Math.min(r.count,o.start+o.count)-1;n<a;n+=h){const o=r.getX(n),a=r.getX(n+1);if(l.fromBufferAttribute(i,o),c.fromBufferAttribute(i,a),Oa.distanceSqToSegment(l,c,p,u)>s)continue;p.applyMatrix4(this.matrixWorld);const h=t.ray.origin.distanceTo(p);h<t.near||h>t.far||e.push({distance:h,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}else for(let n=Math.max(0,o.start),r=Math.min(i.count,o.start+o.count)-1;n<r;n+=h){if(l.fromBufferAttribute(i,n),c.fromBufferAttribute(i,n+1),Oa.distanceSqToSegment(l,c,p,u)>s)continue;p.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(p);r<t.near||r>t.far||e.push({distance:r,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Ba.prototype.isLine=!0;const Na=new Ct,Ua=new Ct;class ja extends Ba{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,r=e.count;t<r;t+=2)Na.fromBufferAttribute(e,t),Ua.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+Na.distanceTo(Ua);t.setAttribute("lineDistance",new un(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}ja.prototype.isLineSegments=!0;class Va extends Ba{constructor(t,e){super(t,e),this.type="LineLoop"}}Va.prototype.isLineLoop=!0;class Ga extends Ge{constructor(t){super(),this.type="PointsMaterial",this.color=new Je(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this}}Ga.prototype.isPointsMaterial=!0;const Ha=new oe,Wa=new ie,qa=new Jt,Za=new Ct;class Xa extends Pe{constructor(t=new wn,e=new Ga){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),qa.copy(n.boundingSphere),qa.applyMatrix4(r),qa.radius+=i,!1===t.ray.intersectsSphere(qa))return;Ha.copy(r).invert(),Wa.copy(t.ray).applyMatrix4(Ha);const a=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=a*a;if(n.isBufferGeometry){const i=n.index,a=n.attributes.position;if(null!==i)for(let n=Math.max(0,o.start),l=Math.min(i.count,o.start+o.count);n<l;n++){const o=i.getX(n);Za.fromBufferAttribute(a,o),$a(Za,o,s,r,t,e,this)}else for(let n=Math.max(0,o.start),i=Math.min(a.count,o.start+o.count);n<i;n++)Za.fromBufferAttribute(a,n),$a(Za,n,s,r,t,e,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function $a(t,e,n,r,i,o,a){const s=Wa.distanceSqToPoint(t);if(s<n){const n=new Ct;Wa.closestPointToPoint(t,n),n.applyMatrix4(r);const l=i.ray.origin.distanceTo(n);if(l<i.near||l>i.far)return;o.push({distance:l,distanceToRay:Math.sqrt(s),point:n,index:e,face:null,object:a})}}Xa.prototype.isPoints=!0;class Ja extends bt{constructor(t,e,n,r,i,o,a,s,l){super(t,e,n,r,i,o,a,s,l),this.format=void 0!==a?a:T,this.minFilter=void 0!==o?o:g,this.magFilter=void 0!==i?i:g,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;0=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}Ja.prototype.isVideoTexture=!0;class Ya extends bt{constructor(t,e,n,r,i,o,a,s,l,c,u,p){super(null,o,a,s,l,c,r,i,u,p),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}Ya.prototype.isCompressedTexture=!0;class Qa extends bt{constructor(t,e,n,r,i,o,a,s,l){super(t,e,n,r,i,o,a,s,l),this.needsUpdate=!0}}Qa.prototype.isCanvasTexture=!0;class Ka extends bt{constructor(t,e,n,r,i,o,a,s,l,c){if((c=void 0!==c?c:A)!==A&&c!==C)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===A&&(n=x),void 0===n&&c===C&&(n=S),super(null,r,i,o,a,s,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==a?a:d,this.minFilter=void 0!==s?s:d,this.flipY=!1,this.generateMipmaps=!1}}Ka.prototype.isDepthTexture=!0;class ts extends wn{constructor(t=1,e=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},e=Math.max(3,e);const i=[],o=[],a=[],s=[],l=new Ct,c=new gt;o.push(0,0,0),a.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=e;i++,u+=3){const p=n+i/e*r;l.x=t*Math.cos(p),l.y=t*Math.sin(p),o.push(l.x,l.y,l.z),a.push(0,0,1),c.x=(o[u]/t+1)/2,c.y=(o[u+1]/t+1)/2,s.push(c.x,c.y)}for(let t=1;t<=e;t++)i.push(t,t+1,0);this.setIndex(i),this.setAttribute("position",new un(o,3)),this.setAttribute("normal",new un(a,3)),this.setAttribute("uv",new un(s,2))}static fromJSON(t){return new ts(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class es extends wn{constructor(t=1,e=1,n=1,r=8,i=1,o=!1,a=0,s=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s};const l=this;r=Math.floor(r),i=Math.floor(i);const c=[],u=[],p=[],h=[];let d=0;const f=[],m=n/2;let g=0;function y(n){const i=d,o=new gt,f=new Ct;let y=0;const v=!0===n?t:e,_=!0===n?1:-1;for(let t=1;t<=r;t++)u.push(0,m*_,0),p.push(0,_,0),h.push(.5,.5),d++;const x=d;for(let t=0;t<=r;t++){const e=t/r*s+a,n=Math.cos(e),i=Math.sin(e);f.x=v*i,f.y=m*_,f.z=v*n,u.push(f.x,f.y,f.z),p.push(0,_,0),o.x=.5*n+.5,o.y=.5*i*_+.5,h.push(o.x,o.y),d++}for(let t=0;t<r;t++){const e=i+t,r=x+t;!0===n?c.push(r,r+1,e):c.push(r+1,r,e),y+=3}l.addGroup(g,y,!0===n?1:2),g+=y}!function(){const o=new Ct,y=new Ct;let v=0;const _=(e-t)/n;for(let l=0;l<=i;l++){const c=[],g=l/i,v=g*(e-t)+t;for(let t=0;t<=r;t++){const e=t/r,i=e*s+a,l=Math.sin(i),f=Math.cos(i);y.x=v*l,y.y=-g*n+m,y.z=v*f,u.push(y.x,y.y,y.z),o.set(l,_,f).normalize(),p.push(o.x,o.y,o.z),h.push(e,1-g),c.push(d++)}f.push(c)}for(let t=0;t<r;t++)for(let e=0;e<i;e++){const n=f[e][t],r=f[e+1][t],i=f[e+1][t+1],o=f[e][t+1];c.push(n,r,o),c.push(r,i,o),v+=6}l.addGroup(g,v,0),g+=v}(),!1===o&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(c),this.setAttribute("position",new un(u,3)),this.setAttribute("normal",new un(p,3)),this.setAttribute("uv",new un(h,2))}static fromJSON(t){return new es(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ns extends es{constructor(t=1,e=1,n=8,r=1,i=!1,o=0,a=2*Math.PI){super(0,t,e,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}static fromJSON(t){return new ns(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rs extends wn{constructor(t,e,n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r};const i=[],o=[];function a(t,e,n,r){const i=r+1,o=[];for(let r=0;r<=i;r++){o[r]=[];const a=t.clone().lerp(n,r/i),s=e.clone().lerp(n,r/i),l=i-r;for(let t=0;t<=l;t++)o[r][t]=0===t&&r===i?a:a.clone().lerp(s,t/l)}for(let t=0;t<i;t++)for(let e=0;e<2*(i-t)-1;e++){const n=Math.floor(e/2);e%2==0?(s(o[t][n+1]),s(o[t+1][n]),s(o[t][n])):(s(o[t][n+1]),s(o[t+1][n+1]),s(o[t+1][n]))}}function s(t){i.push(t.x,t.y,t.z)}function l(e,n){const r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function c(t,e,n,r){r<0&&1===t.x&&(o[e]=t.x-1),0===n.x&&0===n.z&&(o[e]=r/2/Math.PI+.5)}function u(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new Ct,r=new Ct,i=new Ct;for(let o=0;o<e.length;o+=3)l(e[o+0],n),l(e[o+1],r),l(e[o+2],i),a(n,r,i,t)}(r),function(t){const e=new Ct;for(let n=0;n<i.length;n+=3)e.x=i[n+0],e.y=i[n+1],e.z=i[n+2],e.normalize().multiplyScalar(t),i[n+0]=e.x,i[n+1]=e.y,i[n+2]=e.z}(n),function(){const t=new Ct;for(let n=0;n<i.length;n+=3){t.x=i[n+0],t.y=i[n+1],t.z=i[n+2];const r=u(t)/2/Math.PI+.5,a=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);o.push(r,1-a)}var e;(function(){const t=new Ct,e=new Ct,n=new Ct,r=new Ct,a=new gt,s=new gt,l=new gt;for(let p=0,h=0;p<i.length;p+=9,h+=6){t.set(i[p+0],i[p+1],i[p+2]),e.set(i[p+3],i[p+4],i[p+5]),n.set(i[p+6],i[p+7],i[p+8]),a.set(o[h+0],o[h+1]),s.set(o[h+2],o[h+3]),l.set(o[h+4],o[h+5]),r.copy(t).add(e).add(n).divideScalar(3);const d=u(r);c(a,h+0,t,d),c(s,h+2,e,d),c(l,h+4,n,d)}})(),function(){for(let t=0;t<o.length;t+=6){const e=o[t+0],n=o[t+2],r=o[t+4],i=Math.max(e,n,r),a=Math.min(e,n,r);i>.9&&a<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),r<.2&&(o[t+4]+=1))}}()}(),this.setAttribute("position",new un(i,3)),this.setAttribute("normal",new un(i.slice(),3)),this.setAttribute("uv",new un(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new rs(t.vertices,t.indices,t.radius,t.details)}}class is extends rs{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new is(t.radius,t.detail)}}const os=new Ct,as=new Ct,ss=new Ct,ls=new je;class cs extends wn{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),r=Math.cos(at*e),i=t.getIndex(),o=t.getAttribute("position"),a=i?i.count:o.count,s=[0,0,0],l=["a","b","c"],c=new Array(3),u={},p=[];for(let t=0;t<a;t+=3){i?(s[0]=i.getX(t),s[1]=i.getX(t+1),s[2]=i.getX(t+2)):(s[0]=t,s[1]=t+1,s[2]=t+2);const{a:e,b:a,c:h}=ls;if(e.fromBufferAttribute(o,s[0]),a.fromBufferAttribute(o,s[1]),h.fromBufferAttribute(o,s[2]),ls.getNormal(ss),c[0]=`${Math.round(e.x*n)},${Math.round(e.y*n)},${Math.round(e.z*n)}`,c[1]=`${Math.round(a.x*n)},${Math.round(a.y*n)},${Math.round(a.z*n)}`,c[2]=`${Math.round(h.x*n)},${Math.round(h.y*n)},${Math.round(h.z*n)}`,c[0]!==c[1]&&c[1]!==c[2]&&c[2]!==c[0])for(let t=0;t<3;t++){const e=(t+1)%3,n=c[t],i=c[e],o=ls[l[t]],a=ls[l[e]],h=`${n}_${i}`,d=`${i}_${n}`;d in u&&u[d]?(ss.dot(u[d].normal)<=r&&(p.push(o.x,o.y,o.z),p.push(a.x,a.y,a.z)),u[d]=null):h in u||(u[h]={index0:s[t],index1:s[e],normal:ss.clone()})}}for(const t in u)if(u[t]){const{index0:e,index1:n}=u[t];os.fromBufferAttribute(o,e),as.fromBufferAttribute(o,n),p.push(os.x,os.y,os.z),p.push(as.x,as.y,as.z)}this.setAttribute("position",new un(p,3))}}class us{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),i=0;e.push(0);for(let o=1;o<=t;o++)i+=(n=this.getPoint(o/t)).distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const i=n.length;let o;o=e||t*n[i-1];let a,s=0,l=i-1;for(;s<=l;)if((a=n[r=Math.floor(s+(l-s)/2)]-o)<0)s=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(n[r=l]===o)return r/(i-1);const c=n[r];return(r+(o-c)/(n[r+1]-c))/(i-1)}getTangent(t,e){let n=t-1e-4,r=t+1e-4;n<0&&(n=0),r>1&&(r=1);const i=this.getPoint(n),o=this.getPoint(r),a=e||(i.isVector2?new gt:new Ct);return a.copy(o).sub(i).normalize(),a}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new Ct,r=[],i=[],o=[],a=new Ct,s=new oe;for(let e=0;e<=t;e++){const n=e/t;r[e]=this.getTangentAt(n,new Ct),r[e].normalize()}i[0]=new Ct,o[0]=new Ct;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),u=Math.abs(r[0].y),p=Math.abs(r[0].z);c<=l&&(l=c,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),p<=l&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],a),o[0].crossVectors(r[0],i[0]);for(let e=1;e<=t;e++){if(i[e]=i[e-1].clone(),o[e]=o[e-1].clone(),a.crossVectors(r[e-1],r[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(ct(r[e-1].dot(r[e]),-1,1));i[e].applyMatrix4(s.makeRotationAxis(a,t))}o[e].crossVectors(r[e],i[e])}if(!0===e){let e=Math.acos(ct(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(a.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],e*n)),o[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:o}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class ps extends us{constructor(t=0,e=0,n=1,r=1,i=0,o=2*Math.PI,a=!1,s=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s}getPoint(t,e){const n=e||new gt,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const o=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=o?0:r),!0!==this.aClockwise||o||(i===r?i=-r:i-=r);const a=this.aStartAngle+t*i;let s=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=s-this.aX,r=l-this.aY;s=n*t-r*e+this.aX,l=n*e+r*t+this.aY}return n.set(s,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}ps.prototype.isEllipseCurve=!0;class hs extends ps{constructor(t,e,n,r,i,o){super(t,e,n,n,r,i,o),this.type="ArcCurve"}}function ds(){let t=0,e=0,n=0,r=0;function i(i,o,a,s){t=i,e=a,n=-3*i+3*o-2*a-s,r=2*i-2*o+a+s}return{initCatmullRom:function(t,e,n,r,o){i(e,n,o*(n-t),o*(r-e))},initNonuniformCatmullRom:function(t,e,n,r,o,a,s){let l=(e-t)/o-(n-t)/(o+a)+(n-e)/a,c=(n-e)/a-(r-e)/(a+s)+(r-n)/s;i(e,n,l*=a,c*=a)},calc:function(i){const o=i*i;return t+e*i+n*o+r*(o*i)}}}hs.prototype.isArcCurve=!0;const fs=new Ct,ms=new ds,gs=new ds,ys=new ds;class vs extends us{constructor(t=[],e=!1,n="centripetal",r=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=r}getPoint(t,e=new Ct){const n=e,r=this.points,i=r.length,o=(i-(this.closed?0:1))*t;let a,s,l=Math.floor(o),c=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?a=r[(l-1)%i]:(fs.subVectors(r[0],r[1]).add(r[0]),a=fs);const u=r[l%i],p=r[(l+1)%i];if(this.closed||l+2<i?s=r[(l+2)%i]:(fs.subVectors(r[i-1],r[i-2]).add(r[i-1]),s=fs),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(p),t),r=Math.pow(p.distanceToSquared(s),t);n<1e-4&&(n=1),e<1e-4&&(e=n),r<1e-4&&(r=n),ms.initNonuniformCatmullRom(a.x,u.x,p.x,s.x,e,n,r),gs.initNonuniformCatmullRom(a.y,u.y,p.y,s.y,e,n,r),ys.initNonuniformCatmullRom(a.z,u.z,p.z,s.z,e,n,r)}else"catmullrom"===this.curveType&&(ms.initCatmullRom(a.x,u.x,p.x,s.x,this.tension),gs.initCatmullRom(a.y,u.y,p.y,s.y,this.tension),ys.initCatmullRom(a.z,u.z,p.z,s.z,this.tension));return n.set(ms.calc(c),gs.calc(c),ys.calc(c)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Ct).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function _s(t,e,n,r,i){const o=.5*(r-e),a=.5*(i-n),s=t*t;return(2*n-2*r+o+a)*(t*s)+(-3*n+3*r-2*o-a)*s+o*t+n}function xs(t,e,n,r){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*n}(t)+function(t,e){return t*t*r}(t)}function bs(t,e,n,r,i){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*r}(t)+function(t,e){return t*t*t*i}(t)}vs.prototype.isCatmullRomCurve3=!0;class ws extends us{constructor(t=new gt,e=new gt,n=new gt,r=new gt){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new gt){const n=e,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set(bs(t,r.x,i.x,o.x,a.x),bs(t,r.y,i.y,o.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}ws.prototype.isCubicBezierCurve=!0;class Ms extends us{constructor(t=new Ct,e=new Ct,n=new Ct,r=new Ct){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new Ct){const n=e,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set(bs(t,r.x,i.x,o.x,a.x),bs(t,r.y,i.y,o.y,a.y),bs(t,r.z,i.z,o.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Ms.prototype.isCubicBezierCurve3=!0;class Ss extends us{constructor(t=new gt,e=new gt){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new gt){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new gt;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Ss.prototype.isLineCurve=!0;class Ts extends us{constructor(t=new Ct,e=new Ct){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new Ct){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Es extends us{constructor(t=new gt,e=new gt,n=new gt){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new gt){const n=e,r=this.v0,i=this.v1,o=this.v2;return n.set(xs(t,r.x,i.x,o.x),xs(t,r.y,i.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Es.prototype.isQuadraticBezierCurve=!0;class As extends us{constructor(t=new Ct,e=new Ct,n=new Ct){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Ct){const n=e,r=this.v0,i=this.v1,o=this.v2;return n.set(xs(t,r.x,i.x,o.x),xs(t,r.y,i.y,o.y),xs(t,r.z,i.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}As.prototype.isQuadraticBezierCurve3=!0;class Cs extends us{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new gt){const n=e,r=this.points,i=(r.length-1)*t,o=Math.floor(i),a=i-o,s=r[0===o?o:o-1],l=r[o],c=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return n.set(_s(a,s.x,l.x,c.x,u.x),_s(a,s.y,l.y,c.y,u.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new gt).fromArray(n))}return this}}Cs.prototype.isSplineCurve=!0;var Ls=Object.freeze({__proto__:null,ArcCurve:hs,CatmullRomCurve3:vs,CubicBezierCurve:ws,CubicBezierCurve3:Ms,EllipseCurve:ps,LineCurve:Ss,LineCurve3:Ts,QuadraticBezierCurve:Es,QuadraticBezierCurve3:As,SplineCurve:Cs});function Ps(t,e,n,r,i){let o,a;if(i===function(t,e,n,r){let i=0;for(let o=e,a=n-r;o<n;o+=r)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}(t,e,n,r)>0)for(o=e;o<n;o+=r)a=Ys(o,t[o],t[o+1],a);else for(o=n-r;o>=e;o-=r)a=Ys(o,t[o],t[o+1],a);return a&&Ws(a,a.next)&&(Qs(a),a=a.next),a}function Is(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!Ws(r,r.next)&&0!==Hs(r.prev,r,r.next))r=r.next;else{if(Qs(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Rs(t,e,n,r,i,o,a){if(!t)return;!a&&o&&function(t,e,n,r){let i=t;do{null===i.z&&(i.z=Us(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n,r,i,o,a,s,l,c=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,r=n,s=0,e=0;e<c&&(s++,r=r.nextZ);e++);for(l=c;s>0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(a>1)}(i)}(t,r,i,o);let s,l,c=t;for(;t.prev!==t.next;)if(s=t.prev,l=t.next,o?zs(t,r,i,o):ks(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),Qs(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?Rs(t=Ds(Is(t),e,n),e,n,r,i,o,2):2===a&&Os(t,e,n,r,i,o):Rs(Is(t),e,n,r,i,o,1);break}}function ks(t){const e=t.prev,n=t,r=t.next;if(Hs(e,n,r)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(Vs(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Hs(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function zs(t,e,n,r){const i=t.prev,o=t,a=t.next;if(Hs(i,o,a)>=0)return!1;const s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,l=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,c=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,u=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,p=Us(s,l,e,n,r),h=Us(c,u,e,n,r);let d=t.prevZ,f=t.nextZ;for(;d&&d.z>=p&&f&&f.z<=h;){if(d!==t.prev&&d!==t.next&&Vs(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Hs(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==t.prev&&f!==t.next&&Vs(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Hs(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=p;){if(d!==t.prev&&d!==t.next&&Vs(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Hs(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=h;){if(f!==t.prev&&f!==t.next&&Vs(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Hs(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Ds(t,e,n){let r=t;do{const i=r.prev,o=r.next.next;!Ws(i,o)&&qs(i,r,r.next,o)&&$s(i,o)&&$s(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),Qs(r),Qs(r.next),r=t=o),r=r.next}while(r!==t);return Is(r)}function Os(t,e,n,r,i,o){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Gs(a,t)){let s=Js(a,t);return a=Is(a,a.next),s=Is(s,s.next),Rs(a,e,n,r,i,o),void Rs(s,e,n,r,i,o)}t=t.next}a=a.next}while(a!==t)}function Fs(t,e){return t.x-e.x}function Bs(t,e){if(e=function(t,e){let n=e;const r=t.x,i=t.y;let o,a=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>a){if(a=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!o)return null;if(r===a)return o;const s=o,l=o.x,c=o.y;let u,p=1/0;n=o;do{r>=n.x&&n.x>=l&&r!==n.x&&Vs(i<c?r:a,i,l,c,i<c?a:r,i,n.x,n.y)&&(u=Math.abs(i-n.y)/(r-n.x),$s(n,t)&&(u<p||u===p&&(n.x>o.x||n.x===o.x&&Ns(o,n)))&&(o=n,p=u)),n=n.next}while(n!==s);return o}(t,e)){const n=Js(e,t);Is(e,e.next),Is(n,n.next)}}function Ns(t,e){return Hs(t.prev,t,e.prev)<0&&Hs(e.next,t,t.next)<0}function Us(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function js(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Vs(t,e,n,r,i,o,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(r-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function Gs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&qs(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&($s(t,e)&&$s(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(Hs(t.prev,t,e.prev)||Hs(t,e.prev,e))||Ws(t,e)&&Hs(t.prev,t,t.next)>0&&Hs(e.prev,e,e.next)>0)}function Hs(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Ws(t,e){return t.x===e.x&&t.y===e.y}function qs(t,e,n,r){const i=Xs(Hs(t,e,n)),o=Xs(Hs(t,e,r)),a=Xs(Hs(n,r,t)),s=Xs(Hs(n,r,e));return i!==o&&a!==s||!(0!==i||!Zs(t,n,e))||!(0!==o||!Zs(t,r,e))||!(0!==a||!Zs(n,t,r))||!(0!==s||!Zs(n,e,r))}function Zs(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Xs(t){return t>0?1:t<0?-1:0}function $s(t,e){return Hs(t.prev,t,t.next)<0?Hs(t,e,t.next)>=0&&Hs(t,t.prev,e)>=0:Hs(t,e,t.prev)<0||Hs(t,t.next,e)<0}function Js(t,e){const n=new Ks(t.i,t.x,t.y),r=new Ks(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Ys(t,e,n,r){const i=new Ks(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Qs(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ks(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class tl{static area(t){const e=t.length;let n=0;for(let r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n}static isClockWise(t){return tl.area(t)<0}static triangulateShape(t,e){const n=[],r=[],i=[];el(t),nl(n,t);let o=t.length;e.forEach(el);for(let t=0;t<e.length;t++)r.push(o),o+=e[t].length,nl(n,e[t]);const a=function(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let o=Ps(t,0,i,n,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c,u,p,h,d;if(r&&(o=function(t,e,n,r){const i=[];let o,a,s,l,c;for(o=0,a=e.length;o<a;o++)(c=Ps(t,s=e[o]*r,l=o<a-1?e[o+1]*r:t.length,r,!1))===c.next&&(c.steiner=!0),i.push(js(c));for(i.sort(Fs),o=0;o<i.length;o++)Bs(i[o],n),n=Is(n,n.next);return n}(t,e,o,n)),t.length>80*n){s=c=t[0],l=u=t[1];for(let e=n;e<i;e+=n)(p=t[e])<s&&(s=p),(h=t[e+1])<l&&(l=h),p>c&&(c=p),h>u&&(u=h);d=0!==(d=Math.max(c-s,u-l))?1/d:0}return Rs(o,a,n,s,l,d),a}(n,r);for(let t=0;t<a.length;t+=3)i.push(a.slice(t,t+3));return i}}function el(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function nl(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class rl extends wn{constructor(t,e){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,r=[],i=[];for(let e=0,n=t.length;e<n;e++)o(t[e]);function o(t){const o=[],a=void 0!==e.curveSegments?e.curveSegments:12,s=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:100,c=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:6,p=void 0!==e.bevelSize?e.bevelSize:u-2,h=void 0!==e.bevelOffset?e.bevelOffset:0,d=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:il;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let g,y,v,_,x,b=!1;f&&(g=f.getSpacedPoints(s),b=!0,c=!1,y=f.computeFrenetFrames(s,!1),v=new Ct,_=new Ct,x=new Ct),c||(d=0,u=0,p=0,h=0);const w=t.extractPoints(a);let M=w.shape;const S=w.holes;if(!tl.isClockWise(M)){M=M.reverse();for(let t=0,e=S.length;t<e;t++){const e=S[t];tl.isClockWise(e)&&(S[t]=e.reverse())}}const T=tl.triangulateShape(M,S),E=M;for(let t=0,e=S.length;t<e;t++){const e=S[t];M=M.concat(e)}function A(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const C=M.length,L=T.length;function P(t,e,n){let r,i,o;const a=t.x-e.x,s=t.y-e.y,l=n.x-t.x,c=n.y-t.y,u=a*a+s*s,p=a*c-s*l;if(Math.abs(p)>Number.EPSILON){const p=Math.sqrt(u),h=Math.sqrt(l*l+c*c),d=e.x-s/p,f=e.y+a/p,m=((n.x-c/h-d)*c-(n.y+l/h-f)*l)/(a*c-s*l),g=(r=d+a*m-t.x)*r+(i=f+s*m-t.y)*i;if(g<=2)return new gt(r,i);o=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(s)===Math.sign(c)&&(t=!0),t?(r=-s,i=a,o=Math.sqrt(u)):(r=a,i=s,o=Math.sqrt(u/2))}return new gt(r/o,i/o)}const I=[];for(let t=0,e=E.length,n=e-1,r=t+1;t<e;t++,n++,r++)n===e&&(n=0),r===e&&(r=0),I[t]=P(E[t],E[n],E[r]);const R=[];let k,z=I.concat();for(let t=0,e=S.length;t<e;t++){const e=S[t];k=[];for(let t=0,n=e.length,r=n-1,i=t+1;t<n;t++,r++,i++)r===n&&(r=0),i===n&&(i=0),k[t]=P(e[t],e[r],e[i]);R.push(k),z=z.concat(k)}for(let t=0;t<d;t++){const e=t/d,n=u*Math.cos(e*Math.PI/2),r=p*Math.sin(e*Math.PI/2)+h;for(let t=0,e=E.length;t<e;t++){const e=A(E[t],I[t],r);F(e.x,e.y,-n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];k=R[t];for(let t=0,i=e.length;t<i;t++){const i=A(e[t],k[t],r);F(i.x,i.y,-n)}}}const D=p+h;for(let t=0;t<C;t++){const e=c?A(M[t],z[t],D):M[t];b?(_.copy(y.normals[0]).multiplyScalar(e.x),v.copy(y.binormals[0]).multiplyScalar(e.y),x.copy(g[0]).add(_).add(v),F(x.x,x.y,x.z)):F(e.x,e.y,0)}for(let t=1;t<=s;t++)for(let e=0;e<C;e++){const n=c?A(M[e],z[e],D):M[e];b?(_.copy(y.normals[t]).multiplyScalar(n.x),v.copy(y.binormals[t]).multiplyScalar(n.y),x.copy(g[t]).add(_).add(v),F(x.x,x.y,x.z)):F(n.x,n.y,l/s*t)}for(let t=d-1;t>=0;t--){const e=t/d,n=u*Math.cos(e*Math.PI/2),r=p*Math.sin(e*Math.PI/2)+h;for(let t=0,e=E.length;t<e;t++){const e=A(E[t],I[t],r);F(e.x,e.y,l+n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];k=R[t];for(let t=0,i=e.length;t<i;t++){const i=A(e[t],k[t],r);b?F(i.x,i.y+g[s-1].y,g[s-1].x+n):F(i.x,i.y,l+n)}}}function O(t,e){let n=t.length;for(;--n>=0;){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=s+2*d;t<n;t++){const n=C*t,o=C*(t+1);N(e+r+n,e+i+n,e+i+o,e+r+o)}}}function F(t,e,n){o.push(t),o.push(e),o.push(n)}function B(t,e,i){U(t),U(e),U(i);const o=r.length/3,a=m.generateTopUV(n,r,o-3,o-2,o-1);j(a[0]),j(a[1]),j(a[2])}function N(t,e,i,o){U(t),U(e),U(o),U(e),U(i),U(o);const a=r.length/3,s=m.generateSideWallUV(n,r,a-6,a-3,a-2,a-1);j(s[0]),j(s[1]),j(s[3]),j(s[1]),j(s[2]),j(s[3])}function U(t){r.push(o[3*t+0]),r.push(o[3*t+1]),r.push(o[3*t+2])}function j(t){i.push(t.x),i.push(t.y)}!function(){const t=r.length/3;if(c){let t=0,e=C*t;for(let t=0;t<L;t++){const n=T[t];B(n[2]+e,n[1]+e,n[0]+e)}e=C*(t=s+2*d);for(let t=0;t<L;t++){const n=T[t];B(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<L;t++){const e=T[t];B(e[2],e[1],e[0])}for(let t=0;t<L;t++){const e=T[t];B(e[0]+C*s,e[1]+C*s,e[2]+C*s)}}n.addGroup(t,r.length/3-t,0)}(),function(){const t=r.length/3;let e=0;O(E,e),e+=E.length;for(let t=0,n=S.length;t<n;t++){const n=S[t];O(n,e),e+=n.length}n.addGroup(t,r.length/3-t,1)}()}this.setAttribute("position",new un(r,3)),this.setAttribute("uv",new un(i,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,r=t.length;e<r;e++){const r=t[e];n.shapes.push(r.uuid)}else n.shapes.push(t.uuid);return void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let r=0,i=t.shapes.length;r<i;r++){const i=e[t.shapes[r]];n.push(i)}const r=t.options.extrudePath;return void 0!==r&&(t.options.extrudePath=(new Ls[r.type]).fromJSON(r)),new rl(n,t.options)}}const il={generateTopUV:function(t,e,n,r,i){const o=e[3*n],a=e[3*n+1],s=e[3*r],l=e[3*r+1],c=e[3*i],u=e[3*i+1];return[new gt(o,a),new gt(s,l),new gt(c,u)]},generateSideWallUV:function(t,e,n,r,i,o){const a=e[3*n],s=e[3*n+1],l=e[3*n+2],c=e[3*r],u=e[3*r+1],p=e[3*r+2],h=e[3*i],d=e[3*i+1],f=e[3*i+2],m=e[3*o],g=e[3*o+1],y=e[3*o+2];return Math.abs(s-u)<Math.abs(a-c)?[new gt(a,1-l),new gt(c,1-p),new gt(h,1-f),new gt(m,1-y)]:[new gt(s,1-l),new gt(u,1-p),new gt(d,1-f),new gt(g,1-y)]}};class ol extends rs{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new ol(t.radius,t.detail)}}class al extends wn{constructor(t,e=12,n=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},e=Math.floor(e),r=ct(r,0,2*Math.PI);const i=[],o=[],a=[],s=1/e,l=new Ct,c=new gt;for(let i=0;i<=e;i++){const u=n+i*s*r,p=Math.sin(u),h=Math.cos(u);for(let n=0;n<=t.length-1;n++)l.x=t[n].x*p,l.y=t[n].y,l.z=t[n].x*h,o.push(l.x,l.y,l.z),c.x=i/e,c.y=n/(t.length-1),a.push(c.x,c.y)}for(let n=0;n<e;n++)for(let e=0;e<t.length-1;e++){const r=e+n*t.length,o=r,a=r+t.length,s=r+t.length+1,l=r+1;i.push(o,a,l),i.push(a,s,l)}if(this.setIndex(i),this.setAttribute("position",new un(o,3)),this.setAttribute("uv",new un(a,2)),this.computeVertexNormals(),r===2*Math.PI){const n=this.attributes.normal.array,r=new Ct,i=new Ct,o=new Ct,a=e*t.length*3;for(let e=0,s=0;e<t.length;e++,s+=3)r.x=n[s+0],r.y=n[s+1],r.z=n[s+2],i.x=n[a+s+0],i.y=n[a+s+1],i.z=n[a+s+2],o.addVectors(r,i).normalize(),n[s+0]=n[a+s+0]=o.x,n[s+1]=n[a+s+1]=o.y,n[s+2]=n[a+s+2]=o.z}}static fromJSON(t){return new al(t.points,t.segments,t.phiStart,t.phiLength)}}class sl extends rs{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new sl(t.radius,t.detail)}}class ll extends wn{constructor(t,e,n){super(),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n};const r=[],i=[],o=[],a=[],s=1e-5,l=new Ct,c=new Ct,u=new Ct,p=new Ct,h=new Ct;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const d=e+1;for(let r=0;r<=n;r++){const d=r/n;for(let n=0;n<=e;n++){const r=n/e;t(r,d,c),i.push(c.x,c.y,c.z),r-s>=0?(t(r-s,d,u),p.subVectors(c,u)):(t(r+s,d,u),p.subVectors(u,c)),d-s>=0?(t(r,d-s,u),h.subVectors(c,u)):(t(r,d+s,u),h.subVectors(u,c)),l.crossVectors(p,h).normalize(),o.push(l.x,l.y,l.z),a.push(r,d)}}for(let t=0;t<n;t++)for(let n=0;n<e;n++){const e=t*d+n,i=t*d+n+1,o=(t+1)*d+n+1,a=(t+1)*d+n;r.push(e,i,a),r.push(i,o,a)}this.setIndex(r),this.setAttribute("position",new un(i,3)),this.setAttribute("normal",new un(o,3)),this.setAttribute("uv",new un(a,2))}}class cl extends wn{constructor(t=.5,e=1,n=8,r=1,i=0,o=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},n=Math.max(3,n);const a=[],s=[],l=[],c=[];let u=t;const p=(e-t)/(r=Math.max(1,r)),h=new Ct,d=new gt;for(let t=0;t<=r;t++){for(let t=0;t<=n;t++){const r=i+t/n*o;h.x=u*Math.cos(r),h.y=u*Math.sin(r),s.push(h.x,h.y,h.z),l.push(0,0,1),d.x=(h.x/e+1)/2,d.y=(h.y/e+1)/2,c.push(d.x,d.y)}u+=p}for(let t=0;t<r;t++){const e=t*(n+1);for(let t=0;t<n;t++){const r=t+e,i=r,o=r+n+1,s=r+n+2,l=r+1;a.push(i,o,l),a.push(o,s,l)}}this.setIndex(a),this.setAttribute("position",new un(s,3)),this.setAttribute("normal",new un(l,3)),this.setAttribute("uv",new un(c,2))}static fromJSON(t){return new cl(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class ul extends wn{constructor(t,e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],r=[],i=[],o=[];let a=0,s=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(a,s,e),a+=s,s=0;function l(t){const a=r.length/3,l=t.extractPoints(e);let c=l.shape;const u=l.holes;!1===tl.isClockWise(c)&&(c=c.reverse());for(let t=0,e=u.length;t<e;t++){const e=u[t];!0===tl.isClockWise(e)&&(u[t]=e.reverse())}const p=tl.triangulateShape(c,u);for(let t=0,e=u.length;t<e;t++){const e=u[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];r.push(e.x,e.y,0),i.push(0,0,1),o.push(e.x,e.y)}for(let t=0,e=p.length;t<e;t++){const e=p[t],r=e[0]+a,i=e[1]+a,o=e[2]+a;n.push(r,i,o),s+=3}}this.setIndex(n),this.setAttribute("position",new un(r,3)),this.setAttribute("normal",new un(i,3)),this.setAttribute("uv",new un(o,2))}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,r=t.length;n<r;n++){const r=t[n];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let r=0,i=t.shapes.length;r<i;r++){const i=e[t.shapes[r]];n.push(i)}return new ul(n,t.curveSegments)}}class pl extends wn{constructor(t=1,e=32,n=16,r=0,i=2*Math.PI,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const s=Math.min(o+a,Math.PI);let l=0;const c=[],u=new Ct,p=new Ct,h=[],d=[],f=[],m=[];for(let h=0;h<=n;h++){const g=[],y=h/n;let v=0;0==h&&0==o?v=.5/e:h==n&&s==Math.PI&&(v=-.5/e);for(let n=0;n<=e;n++){const s=n/e;u.x=-t*Math.cos(r+s*i)*Math.sin(o+y*a),u.y=t*Math.cos(o+y*a),u.z=t*Math.sin(r+s*i)*Math.sin(o+y*a),d.push(u.x,u.y,u.z),p.copy(u).normalize(),f.push(p.x,p.y,p.z),m.push(s+v,1-y),g.push(l++)}c.push(g)}for(let t=0;t<n;t++)for(let r=0;r<e;r++){const e=c[t][r+1],i=c[t][r],a=c[t+1][r],l=c[t+1][r+1];(0!==t||o>0)&&h.push(e,i,l),(t!==n-1||s<Math.PI)&&h.push(i,a,l)}this.setIndex(h),this.setAttribute("position",new un(d,3)),this.setAttribute("normal",new un(f,3)),this.setAttribute("uv",new un(m,2))}static fromJSON(t){return new pl(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class hl extends rs{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new hl(t.radius,t.detail)}}class dl extends rl{constructor(t,e={}){const n=e.font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new wn;const r=n.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),super(r,e),this.type="TextGeometry"}}class fl extends wn{constructor(t=1,e=.4,n=8,r=6,i=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},n=Math.floor(n),r=Math.floor(r);const o=[],a=[],s=[],l=[],c=new Ct,u=new Ct,p=new Ct;for(let o=0;o<=n;o++)for(let h=0;h<=r;h++){const d=h/r*i,f=o/n*Math.PI*2;u.x=(t+e*Math.cos(f))*Math.cos(d),u.y=(t+e*Math.cos(f))*Math.sin(d),u.z=e*Math.sin(f),a.push(u.x,u.y,u.z),c.x=t*Math.cos(d),c.y=t*Math.sin(d),p.subVectors(u,c).normalize(),s.push(p.x,p.y,p.z),l.push(h/r),l.push(o/n)}for(let t=1;t<=n;t++)for(let e=1;e<=r;e++){const n=(r+1)*t+e-1,i=(r+1)*(t-1)+e-1,a=(r+1)*(t-1)+e,s=(r+1)*t+e;o.push(n,i,s),o.push(i,a,s)}this.setIndex(o),this.setAttribute("position",new un(a,3)),this.setAttribute("normal",new un(s,3)),this.setAttribute("uv",new un(l,2))}static fromJSON(t){return new fl(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class ml extends wn{constructor(t=1,e=.4,n=64,r=8,i=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:o},n=Math.floor(n),r=Math.floor(r);const a=[],s=[],l=[],c=[],u=new Ct,p=new Ct,h=new Ct,d=new Ct,f=new Ct,m=new Ct,g=new Ct;for(let a=0;a<=n;++a){const v=a/n*i*Math.PI*2;y(v,i,o,t,h),y(v+.01,i,o,t,d),m.subVectors(d,h),g.addVectors(d,h),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let t=0;t<=r;++t){const i=t/r*Math.PI*2,o=-e*Math.cos(i),d=e*Math.sin(i);u.x=h.x+(o*g.x+d*f.x),u.y=h.y+(o*g.y+d*f.y),u.z=h.z+(o*g.z+d*f.z),s.push(u.x,u.y,u.z),p.subVectors(u,h).normalize(),l.push(p.x,p.y,p.z),c.push(a/n),c.push(t/r)}}for(let t=1;t<=n;t++)for(let e=1;e<=r;e++){const n=(r+1)*(t-1)+(e-1),i=(r+1)*t+(e-1),o=(r+1)*t+e,s=(r+1)*(t-1)+e;a.push(n,i,s),a.push(i,o,s)}function y(t,e,n,r,i){const o=Math.cos(t),a=Math.sin(t),s=n/e*t,l=Math.cos(s);i.x=r*(2+l)*.5*o,i.y=r*(2+l)*a*.5,i.z=r*Math.sin(s)*.5}this.setIndex(a),this.setAttribute("position",new un(s,3)),this.setAttribute("normal",new un(l,3)),this.setAttribute("uv",new un(c,2))}static fromJSON(t){return new ml(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class gl extends wn{constructor(t,e=64,n=1,r=8,i=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i};const o=t.computeFrenetFrames(e,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new Ct,s=new Ct,l=new gt;let c=new Ct;const u=[],p=[],h=[],d=[];function f(i){c=t.getPointAt(i/e,c);const l=o.normals[i],h=o.binormals[i];for(let t=0;t<=r;t++){const e=t/r*Math.PI*2,i=Math.sin(e),o=-Math.cos(e);s.x=o*l.x+i*h.x,s.y=o*l.y+i*h.y,s.z=o*l.z+i*h.z,s.normalize(),p.push(s.x,s.y,s.z),a.x=c.x+n*s.x,a.y=c.y+n*s.y,a.z=c.z+n*s.z,u.push(a.x,a.y,a.z)}}!function(){for(let t=0;t<e;t++)f(t);f(!1===i?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=r;n++)l.x=t/e,l.y=n/r,h.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=r;e++){const n=(r+1)*(t-1)+(e-1),i=(r+1)*t+(e-1),o=(r+1)*t+e,a=(r+1)*(t-1)+e;d.push(n,i,a),d.push(i,o,a)}}()}(),this.setIndex(d),this.setAttribute("position",new un(u,3)),this.setAttribute("normal",new un(p,3)),this.setAttribute("uv",new un(h,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new gl((new Ls[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class yl extends wn{constructor(t){if(super(),this.type="WireframeGeometry",!0===t.isGeometry)return void console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const e=[],n=new Set,r=new Ct,i=new Ct;if(null!==t.index){const o=t.attributes.position,a=t.index;let s=t.groups;0===s.length&&(s=[{start:0,count:a.count,materialIndex:0}]);for(let t=0,l=s.length;t<l;++t){const l=s[t],c=l.start;for(let t=c,s=c+l.count;t<s;t+=3)for(let s=0;s<3;s++){const l=a.getX(t+s),c=a.getX(t+(s+1)%3);r.fromBufferAttribute(o,l),i.fromBufferAttribute(o,c),!0===vl(r,i,n)&&(e.push(r.x,r.y,r.z),e.push(i.x,i.y,i.z))}}}else{const o=t.attributes.position;for(let t=0,a=o.count/3;t<a;t++)for(let a=0;a<3;a++){const s=3*t+a,l=3*t+(a+1)%3;r.fromBufferAttribute(o,s),i.fromBufferAttribute(o,l),!0===vl(r,i,n)&&(e.push(r.x,r.y,r.z),e.push(i.x,i.y,i.z))}}this.setAttribute("position",new un(e,3))}}function vl(t,e,n){const r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==n.has(r)&&!0!==n.has(i)&&(n.add(r,i),!0)}var _l=Object.freeze({__proto__:null,BoxGeometry:Vn,BoxBufferGeometry:Vn,CircleGeometry:ts,CircleBufferGeometry:ts,ConeGeometry:ns,ConeBufferGeometry:ns,CylinderGeometry:es,CylinderBufferGeometry:es,DodecahedronGeometry:is,DodecahedronBufferGeometry:is,EdgesGeometry:cs,ExtrudeGeometry:rl,ExtrudeBufferGeometry:rl,IcosahedronGeometry:ol,IcosahedronBufferGeometry:ol,LatheGeometry:al,LatheBufferGeometry:al,OctahedronGeometry:sl,OctahedronBufferGeometry:sl,ParametricGeometry:ll,ParametricBufferGeometry:ll,PlaneGeometry:sr,PlaneBufferGeometry:sr,PolyhedronGeometry:rs,PolyhedronBufferGeometry:rs,RingGeometry:cl,RingBufferGeometry:cl,ShapeGeometry:ul,ShapeBufferGeometry:ul,SphereGeometry:pl,SphereBufferGeometry:pl,TetrahedronGeometry:hl,TetrahedronBufferGeometry:hl,TextGeometry:dl,TextBufferGeometry:dl,TorusGeometry:fl,TorusBufferGeometry:fl,TorusKnotGeometry:ml,TorusKnotBufferGeometry:ml,TubeGeometry:gl,TubeBufferGeometry:gl,WireframeGeometry:yl});class xl extends Ge{constructor(t){super(),this.type="ShadowMaterial",this.color=new Je(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}xl.prototype.isShadowMaterial=!0;class bl extends Ge{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Je(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new gt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}bl.prototype.isMeshStandardMaterial=!0;class wl extends bl{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new gt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return ct(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenTint=new Je(0),this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationTint=new Je(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularTint=new Je(1,1,1),this.specularTintMap=null,this._clearcoat=0,this._transmission=0,this.setValues(t)}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheenTint.copy(t.sheenTint),this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationTint.copy(t.attenuationTint),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularTint.copy(t.specularTint),this.specularTintMap=t.specularTintMap,this}}wl.prototype.isMeshPhysicalMaterial=!0;class Ml extends Ge{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Je(16777215),this.specular=new Je(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new gt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Ml.prototype.isMeshPhongMaterial=!0;class Sl extends Ge{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Je(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new gt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Sl.prototype.isMeshToonMaterial=!0;class Tl extends Ge{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new gt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}Tl.prototype.isMeshNormalMaterial=!0;class El extends Ge{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Je(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Je(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}El.prototype.isMeshLambertMaterial=!0;class Al extends Ge{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Je(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new gt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this}}Al.prototype.isMeshMatcapMaterial=!0;class Cl extends Ra{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Cl.prototype.isLineDashedMaterial=!0;var Ll=Object.freeze({__proto__:null,ShadowMaterial:xl,SpriteMaterial:Jo,RawShaderMaterial:vr,ShaderMaterial:qn,PointsMaterial:Ga,MeshPhysicalMaterial:wl,MeshStandardMaterial:bl,MeshPhongMaterial:Ml,MeshToonMaterial:Sl,MeshNormalMaterial:Tl,MeshLambertMaterial:El,MeshDepthMaterial:Po,MeshDistanceMaterial:Io,MeshBasicMaterial:Ye,MeshMatcapMaterial:Al,LineDashedMaterial:Cl,LineBasicMaterial:Ra,Material:Ge});const Pl={arraySlice:function(t,e,n){return Pl.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){const r=t.length,i=new t.constructor(r);for(let o=0,a=0;a!==r;++o){const r=n[o]*e;for(let n=0;n!==e;++n)i[a++]=t[r+n]}return i},flattenJSON:function(t,e,n,r){let i=1,o=t[0];for(;void 0!==o&&void 0===o[r];)o=t[i++];if(void 0===o)return;let a=o[r];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[r])&&(e.push(o.time),n.push.apply(n,a)),o=t[i++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[r])&&(e.push(o.time),a.toArray(n,n.length)),o=t[i++]}while(void 0!==o);else do{void 0!==(a=o[r])&&(e.push(o.time),n.push(a)),o=t[i++]}while(void 0!==o)},subclip:function(t,e,n,r,i=30){const o=t.clone();o.name=e;const a=[];for(let t=0;t<o.tracks.length;++t){const e=o.tracks[t],s=e.getValueSize(),l=[],c=[];for(let t=0;t<e.times.length;++t){const o=e.times[t]*i;if(!(o<n||o>=r)){l.push(e.times[t]);for(let n=0;n<s;++n)c.push(e.values[t*s+n])}}0!==l.length&&(e.times=Pl.convertArray(l,e.times.constructor),e.values=Pl.convertArray(c,e.values.constructor),a.push(e))}o.tracks=a;let s=1/0;for(let t=0;t<o.tracks.length;++t)s>o.tracks[t].times[0]&&(s=o.tracks[t].times[0]);for(let t=0;t<o.tracks.length;++t)o.tracks[t].shift(-1*s);return o.resetDuration(),o},makeClipAdditive:function(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,o=e/r;for(let e=0;e<i;++e){const r=n.tracks[e],i=r.ValueTypeName;if("bool"===i||"string"===i)continue;const a=t.tracks.find((function(t){return t.name===r.name&&t.ValueTypeName===i}));if(void 0===a)continue;let s=0;const l=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);let c=0;const u=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=u/3);const p=r.times.length-1;let h;if(o<=r.times[0]){const t=s,e=l-s;h=Pl.arraySlice(r.values,t,e)}else if(o>=r.times[p]){const t=p*l+s,e=t+l-s;h=Pl.arraySlice(r.values,t,e)}else{const t=r.createInterpolant(),e=s,n=l-s;t.evaluate(o),h=Pl.arraySlice(t.resultBuffer,e,n)}"quaternion"===i&&(new At).fromArray(h).normalize().conjugate().toArray(h);const d=a.times.length;for(let t=0;t<d;++t){const e=t*u+c;if("quaternion"===i)At.multiplyQuaternionsFlat(a.values,e,h,0,a.values,e);else{const t=u-2*c;for(let n=0;n<t;++n)a.values[e+n]-=h[n]}}}return t.blendMode=q,t}};class Il{constructor(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{let o;n:{r:if(!(t<r)){for(let o=n+2;;){if(void 0===r){if(t<i)break r;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,i)}if(n===o)break;if(i=r,t<(r=e[++n]))break e}o=e.length;break n}if(t>=i)break t;{const a=e[1];t<a&&(n=2,i=a);for(let o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===o)break;if(r=i,t>=(i=e[--n-1]))break e}o=n,n=0}}for(;n<o;){const r=n+o>>>1;t<e[r]?o=r:n=r+1}if(r=e[n],void 0===(i=e[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,r);if(void 0===r)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,i,t)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,t,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r;for(let t=0;t!==r;++t)e[t]=n[i+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Il.prototype.beforeStart_=Il.prototype.copySampleValue_,Il.prototype.afterEnd_=Il.prototype.copySampleValue_;class Rl extends Il{constructor(t,e,n,r){super(t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:V,endingEnd:V}}intervalChanged_(t,e,n){const r=this.parameterPositions;let i=t-2,o=t+1,a=r[i],s=r[o];if(void 0===a)switch(this.getSettings_().endingStart){case G:i=t,a=2*e-n;break;case H:a=e+r[i=r.length-2]-r[i+1];break;default:i=t,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case G:o=t,s=2*n-e;break;case H:o=1,s=n+r[1]-r[0];break;default:o=t-1,s=e}const l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-a),this._weightNext=l/(s-n),this._offsetPrev=i*c,this._offsetNext=o*c}interpolate_(t,e,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,l=s-a,c=this._offsetPrev,u=this._offsetNext,p=this._weightPrev,h=this._weightNext,d=(n-e)/(r-e),f=d*d,m=f*d,g=-p*m+2*p*f-p*d,y=(1+p)*m+(-1.5-2*p)*f+(-.5+p)*d+1,v=(-1-h)*m+(1.5+h)*f+.5*d,_=h*m-h*f;for(let t=0;t!==a;++t)i[t]=g*o[c+t]+y*o[l+t]+v*o[s+t]+_*o[u+t];return i}}class kl extends Il{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t,e,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,l=s-a,c=(n-e)/(r-e),u=1-c;for(let t=0;t!==a;++t)i[t]=o[l+t]*u+o[s+t]*c;return i}}class zl extends Il{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t){return this.copySampleValue_(t-1)}}class Dl{constructor(t,e,n,r){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Pl.convertArray(e,this.TimeBufferType),this.values=Pl.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Pl.convertArray(t.times,Array),values:Pl.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new zl(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new kl(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Rl(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case N:e=this.InterpolantFactoryMethodDiscrete;break;case U:e=this.InterpolantFactoryMethodLinear;break;case j:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return N;case this.InterpolantFactoryMethodLinear:return U;case this.InterpolantFactoryMethodSmooth:return j}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]*=t}return this}trim(t,e){const n=this.times,r=n.length;let i=0,o=r-1;for(;i!==r&&n[i]<t;)++i;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==i||o!==r){i>=o&&(i=(o=Math.max(o,1))-1);const t=this.getValueSize();this.times=Pl.arraySlice(n,i,o),this.values=Pl.arraySlice(this.values,i*t,o*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let e=0;e!==i;e++){const r=n[e];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,r),t=!1;break}if(null!==o&&o>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,r,o),t=!1;break}o=r}if(void 0!==r&&Pl.isTypedArray(r))for(let e=0,n=r.length;e!==n;++e){const n=r[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=Pl.arraySlice(this.times),e=Pl.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===j,i=t.length-1;let o=1;for(let a=1;a<i;++a){let i=!1;const s=t[a];if(s!==t[a+1]&&(1!==a||s!==t[0]))if(r)i=!0;else{const t=a*n,r=t-n,o=t+n;for(let a=0;a!==n;++a){const n=e[t+a];if(n!==e[r+a]||n!==e[o+a]){i=!0;break}}}if(i){if(a!==o){t[o]=t[a];const r=a*n,i=o*n;for(let t=0;t!==n;++t)e[i+t]=e[r+t]}++o}}if(i>0){t[o]=t[i];for(let t=i*n,r=o*n,a=0;a!==n;++a)e[r+a]=e[t+a];++o}return o!==t.length?(this.times=Pl.arraySlice(t,0,o),this.values=Pl.arraySlice(e,0,o*n)):(this.times=t,this.values=e),this}clone(){const t=Pl.arraySlice(this.times,0),e=Pl.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Dl.prototype.TimeBufferType=Float32Array,Dl.prototype.ValueBufferType=Float32Array,Dl.prototype.DefaultInterpolation=U;class Ol extends Dl{}Ol.prototype.ValueTypeName="bool",Ol.prototype.ValueBufferType=Array,Ol.prototype.DefaultInterpolation=N,Ol.prototype.InterpolantFactoryMethodLinear=void 0,Ol.prototype.InterpolantFactoryMethodSmooth=void 0;class Fl extends Dl{}Fl.prototype.ValueTypeName="color";class Bl extends Dl{}Bl.prototype.ValueTypeName="number";class Nl extends Il{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t,e,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(n-e)/(r-e);let l=t*a;for(let t=l+a;l!==t;l+=4)At.slerpFlat(i,0,o,l-a,o,l,s);return i}}class Ul extends Dl{InterpolantFactoryMethodLinear(t){return new Nl(this.times,this.values,this.getValueSize(),t)}}Ul.prototype.ValueTypeName="quaternion",Ul.prototype.DefaultInterpolation=U,Ul.prototype.InterpolantFactoryMethodSmooth=void 0;class jl extends Dl{}jl.prototype.ValueTypeName="string",jl.prototype.ValueBufferType=Array,jl.prototype.DefaultInterpolation=N,jl.prototype.InterpolantFactoryMethodLinear=void 0,jl.prototype.InterpolantFactoryMethodSmooth=void 0;class Vl extends Dl{}Vl.prototype.ValueTypeName="vector";class Gl{constructor(t,e=-1,n,r=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=lt(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,r=1/(t.fps||1);for(let t=0,i=n.length;t!==i;++t)e.push(Hl(n[t]).scale(r));const i=new this(t.name,t.duration,e,t.blendMode);return i.uuid=t.uuid,i}static toJSON(t){const e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,r=n.length;t!==r;++t)e.push(Dl.toJSON(n[t]));return r}static CreateFromMorphTargetSequence(t,e,n,r){const i=e.length,o=[];for(let t=0;t<i;t++){let a=[],s=[];a.push((t+i-1)%i,t,(t+1)%i),s.push(0,1,0);const l=Pl.getKeyframeOrder(a);a=Pl.sortedArray(a,1,l),s=Pl.sortedArray(s,1,l),r||0!==a[0]||(a.push(i),s.push(s[0])),o.push(new Bl(".morphTargetInfluences["+e[t].name+"]",a,s).scale(1/n))}return new this(t,-1,o)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const r={},i=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],o=n.name.match(i);if(o&&o.length>1){const t=o[1];let e=r[t];e||(r[t]=e=[]),e.push(n)}}const o=[];for(const t in r)o.push(this.CreateFromMorphTargetSequence(t,r[t],e,n));return o}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,r,i){if(0!==n.length){const o=[],a=[];Pl.flattenJSON(n,o,a,r),0!==o.length&&i.push(new t(e,o,a))}},r=[],i=t.name||"default",o=t.fps||30,a=t.blendMode;let s=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const i=l[t].keys;if(i&&0!==i.length)if(i[0].morphTargets){const t={};let e;for(e=0;e<i.length;e++)if(i[e].morphTargets)for(let n=0;n<i[e].morphTargets.length;n++)t[i[e].morphTargets[n]]=-1;for(const n in t){const t=[],o=[];for(let r=0;r!==i[e].morphTargets.length;++r){const r=i[e];t.push(r.time),o.push(r.morphTarget===n?1:0)}r.push(new Bl(".morphTargetInfluence["+n+"]",t,o))}s=t.length*(o||1)}else{const o=".bones["+e[t].name+"]";n(Vl,o+".position",i,"pos",r),n(Ul,o+".quaternion",i,"rot",r),n(Vl,o+".scale",i,"scl",r)}}return 0===r.length?null:new this(i,s,r,a)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Hl(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Bl;case"vector":case"vector2":case"vector3":case"vector4":return Vl;case"color":return Fl;case"quaternion":return Ul;case"bool":case"boolean":return Ol;case"string":return jl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];Pl.flattenJSON(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Wl={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class ql{constructor(t,e,n){const r=this;let i,o=!1,a=0,s=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){s++,!1===o&&void 0!==r.onStart&&r.onStart(t,a,s),o=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,s),a===s&&(o=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return i?i(t):t},this.setURLModifier=function(t){return i=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],r=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}}}const Zl=new ql;class Xl{constructor(t){this.manager=void 0!==t?t:Zl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(r,i){n.load(t,r,e,i)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const $l={};class Jl extends Xl{constructor(t){super(t)}load(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,o=Wl.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout((function(){e&&e(o),i.manager.itemEnd(t)}),0),o;if(void 0!==$l[t])return void $l[t].push({onLoad:e,onProgress:n,onError:r});const a=t.match(/^data:(.*?)(;base64)?,(.*)$/);let s;if(a){const n=a[1],o=!!a[2];let s=a[3];s=decodeURIComponent(s),o&&(s=atob(s));try{let r;const o=(this.responseType||"").toLowerCase();switch(o){case"arraybuffer":case"blob":const t=new Uint8Array(s.length);for(let e=0;e<s.length;e++)t[e]=s.charCodeAt(e);r="blob"===o?new Blob([t.buffer],{type:n}):t.buffer;break;case"document":const e=new DOMParser;r=e.parseFromString(s,n);break;case"json":r=JSON.parse(s);break;default:r=s}setTimeout((function(){e&&e(r),i.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}),0)}}else{$l[t]=[],$l[t].push({onLoad:e,onProgress:n,onError:r}),(s=new XMLHttpRequest).open("GET",t,!0),s.addEventListener("load",(function(e){const n=this.response,r=$l[t];if(delete $l[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Wl.add(t,n);for(let t=0,e=r.length;t<e;t++){const e=r[t];e.onLoad&&e.onLoad(n)}i.manager.itemEnd(t)}else{for(let t=0,n=r.length;t<n;t++){const n=r[t];n.onError&&n.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}}),!1),s.addEventListener("progress",(function(e){const n=$l[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onProgress&&r.onProgress(e)}}),!1),s.addEventListener("error",(function(e){const n=$l[t];delete $l[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onError&&r.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}),!1),s.addEventListener("abort",(function(e){const n=$l[t];delete $l[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onError&&r.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.overrideMimeType&&s.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)s.setRequestHeader(t,this.requestHeader[t]);s.send(null)}return i.manager.itemStart(t),s}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Yl extends Xl{constructor(t){super(t)}load(t,e,n,r){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,o=Wl.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout((function(){e&&e(o),i.manager.itemEnd(t)}),0),o;const a=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){a.removeEventListener("load",s,!1),a.removeEventListener("error",l,!1),Wl.add(t,this),e&&e(this),i.manager.itemEnd(t)}function l(e){a.removeEventListener("load",s,!1),a.removeEventListener("error",l,!1),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}return a.addEventListener("load",s,!1),a.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),i.manager.itemStart(t),a.src=t,a}}class Ql extends Xl{constructor(t){super(t)}load(t,e,n,r){const i=new Jn,o=new Yl(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function s(n){o.load(t[n],(function(t){i.images[n]=t,6==++a&&(i.needsUpdate=!0,e&&e(i))}),void 0,r)}for(let e=0;e<t.length;++e)s(e);return i}}class Kl extends Xl{constructor(t){super(t)}load(t,e,n,r){const i=this,o=new wa,a=new Jl(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(i.withCredentials),a.load(t,(function(t){const n=i.parse(t);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:p,o.wrapT=void 0!==n.wrapT?n.wrapT:p,o.magFilter=void 0!==n.magFilter?n.magFilter:g,o.minFilter=void 0!==n.minFilter?n.minFilter:g,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(o.encoding=n.encoding),void 0!==n.flipY&&(o.flipY=n.flipY),void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=v),1===n.mipmapCount&&(o.minFilter=g),void 0!==n.generateMipmaps&&(o.generateMipmaps=n.generateMipmaps),o.needsUpdate=!0,e&&e(o,n))}),n,r),o}}class tc extends Xl{constructor(t){super(t)}load(t,e,n,r){const i=new bt,o=new Yl(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,(function(n){i.image=n;const r=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);i.format=r?T:E,i.needsUpdate=!0,void 0!==e&&e(i)}),n,r),i}}class ec extends us{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ss(e,t))}getPoint(t){const e=t*this.getLength(),n=this.getCurveLengths();let r=0;for(;r<n.length;){if(n[r]>=e){const t=n[r]-e,i=this.curves[r],o=i.getLength(),a=0===o?0:1-t/o;return i.getPointAt(a)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,i=this.curves;r<i.length;r++){const o=i[r],a=o&&o.isEllipseCurve?2*t:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?t*o.points.length:t,s=o.getPoints(a);for(let t=0;t<s.length;t++){const r=s[t];n&&n.equals(r)||(e.push(r),n=r)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new Ls[n.type]).fromJSON(n))}return this}}class nc extends ec{constructor(t){super(),this.type="Path",this.currentPoint=new gt,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new Ss(this.currentPoint.clone(),new gt(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){const i=new Es(this.currentPoint.clone(),new gt(t,e),new gt(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(t,e,n,r,i,o){const a=new ws(this.currentPoint.clone(),new gt(t,e),new gt(n,r),new gt(i,o));return this.curves.push(a),this.currentPoint.set(i,o),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Cs(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,i,o){const a=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+a,e+s,n,r,i,o),this}absarc(t,e,n,r,i,o){return this.absellipse(t,e,n,n,r,i,o),this}ellipse(t,e,n,r,i,o,a,s){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,r,i,o,a,s),this}absellipse(t,e,n,r,i,o,a,s){const l=new ps(t,e,n,r,i,o,a,s);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class rc extends nc{constructor(t){super(t),this.uuid=lt(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new nc).fromJSON(n))}return this}}class ic extends Pe{constructor(t,e=1){super(),this.type="Light",this.color=new Je(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}ic.prototype.isLight=!0;class oc extends ic{constructor(t,e,n){super(t,n),this.type="HemisphereLight",this.position.copy(Pe.DefaultUp),this.updateMatrix(),this.groundColor=new Je(e)}copy(t){return ic.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}oc.prototype.isHemisphereLight=!0;const ac=new oe,sc=new Ct,lc=new Ct;class cc{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new gt(512,512),this.map=null,this.mapPass=null,this.matrix=new oe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ir,this._frameExtents=new gt(1,1),this._viewportCount=1,this._viewports=[new Mt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;sc.setFromMatrixPosition(t.matrixWorld),e.position.copy(sc),lc.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(lc),e.updateMatrixWorld(),ac.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ac),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class uc extends cc{constructor(){super(new Xn(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,n=2*st*t.angle*this.focus,r=this.mapSize.width/this.mapSize.height,i=t.distance||e.far;n===e.fov&&r===e.aspect&&i===e.far||(e.fov=n,e.aspect=r,e.far=i,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}uc.prototype.isSpotLightShadow=!0;class pc extends ic{constructor(t,e,n=0,r=Math.PI/3,i=0,o=1){super(t,e),this.type="SpotLight",this.position.copy(Pe.DefaultUp),this.updateMatrix(),this.target=new Pe,this.distance=n,this.angle=r,this.penumbra=i,this.decay=o,this.shadow=new uc}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}pc.prototype.isSpotLight=!0;const hc=new oe,dc=new Ct,fc=new Ct;class mc extends cc{constructor(){super(new Xn(90,1,.5,500)),this._frameExtents=new gt(4,2),this._viewportCount=6,this._viewports=[new Mt(2,1,1,1),new Mt(0,1,1,1),new Mt(3,1,1,1),new Mt(1,1,1,1),new Mt(3,0,1,1),new Mt(1,0,1,1)],this._cubeDirections=[new Ct(1,0,0),new Ct(-1,0,0),new Ct(0,0,1),new Ct(0,0,-1),new Ct(0,1,0),new Ct(0,-1,0)],this._cubeUps=[new Ct(0,1,0),new Ct(0,1,0),new Ct(0,1,0),new Ct(0,1,0),new Ct(0,0,1),new Ct(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,r=this.matrix,i=t.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),dc.setFromMatrixPosition(t.matrixWorld),n.position.copy(dc),fc.copy(n.position),fc.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(fc),n.updateMatrixWorld(),r.makeTranslation(-dc.x,-dc.y,-dc.z),hc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(hc)}}mc.prototype.isPointLightShadow=!0;class gc extends ic{constructor(t,e,n=0,r=1){super(t,e),this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new mc}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}gc.prototype.isPointLight=!0;class yc extends cc{constructor(){super(new yr(-5,5,5,-5,.5,500))}}yc.prototype.isDirectionalLightShadow=!0;class vc extends ic{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(Pe.DefaultUp),this.updateMatrix(),this.target=new Pe,this.shadow=new yc}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}vc.prototype.isDirectionalLight=!0;class _c extends ic{constructor(t,e){super(t,e),this.type="AmbientLight"}}_c.prototype.isAmbientLight=!0;class xc extends ic{constructor(t,e,n=10,r=10){super(t,e),this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}xc.prototype.isRectAreaLight=!0;class bc{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new Ct)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,r=t.y,i=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScaledVector(o[1],.488603*r),e.addScaledVector(o[2],.488603*i),e.addScaledVector(o[3],.488603*n),e.addScaledVector(o[4],n*r*1.092548),e.addScaledVector(o[5],r*i*1.092548),e.addScaledVector(o[6],.315392*(3*i*i-1)),e.addScaledVector(o[7],n*i*1.092548),e.addScaledVector(o[8],.546274*(n*n-r*r)),e}getIrradianceAt(t,e){const n=t.x,r=t.y,i=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScaledVector(o[1],1.023328*r),e.addScaledVector(o[2],1.023328*i),e.addScaledVector(o[3],1.023328*n),e.addScaledVector(o[4],.858086*n*r),e.addScaledVector(o[5],.858086*r*i),e.addScaledVector(o[6],.743125*i*i-.247708),e.addScaledVector(o[7],.858086*n*i),e.addScaledVector(o[8],.429043*(n*n-r*r)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(t,e+3*r);return this}toArray(t=[],e=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(t,e+3*r);return t}static getBasisAt(t,e){const n=t.x,r=t.y,i=t.z;e[0]=.282095,e[1]=.488603*r,e[2]=.488603*i,e[3]=.488603*n,e[4]=1.092548*n*r,e[5]=1.092548*r*i,e[6]=.315392*(3*i*i-1),e[7]=1.092548*n*i,e[8]=.546274*(n*n-r*r)}}bc.prototype.isSphericalHarmonics3=!0;class wc extends ic{constructor(t=new bc,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}wc.prototype.isLightProbe=!0;class Mc extends Xl{constructor(t){super(t),this.textures={}}load(t,e,n,r){const i=this,o=new Jl(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(t,(function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const r=new Ll[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&void 0!==r.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.sheenTint&&(r.sheenTint=(new Je).setHex(t.sheenTint)),void 0!==t.emissive&&void 0!==r.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==r.specular&&r.specular.setHex(t.specular),void 0!==t.specularIntensity&&(r.specularIntensity=t.specularIntensity),void 0!==t.specularTint&&void 0!==r.specularTint&&r.specularTint.setHex(t.specularTint),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearcoat&&(r.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(r.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.thickness&&(r.thickness=t.thickness),void 0!==t.attenuationDistance&&(r.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationTint&&void 0!==r.attenuationTint&&r.attenuationTint.setHex(t.attenuationTint),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.flatShading&&(r.flatShading=t.flatShading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.combine&&(r.combine=t.combine),void 0!==t.side&&(r.side=t.side),void 0!==t.shadowSide&&(r.shadowSide=t.shadowSide),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.format&&(r.format=t.format),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(r.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(r.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(r.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(r.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(r.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(r.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(r.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(r.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(r.rotation=t.rotation),1!==t.linewidth&&(r.linewidth=t.linewidth),void 0!==t.dashSize&&(r.dashSize=t.dashSize),void 0!==t.gapSize&&(r.gapSize=t.gapSize),void 0!==t.scale&&(r.scale=t.scale),void 0!==t.polygonOffset&&(r.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(r.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(r.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(r.dithering=t.dithering),void 0!==t.alphaToCoverage&&(r.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(r.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.toneMapped&&(r.toneMapped=t.toneMapped),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?r.vertexColors=t.vertexColors>0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const i=t.uniforms[e];switch(r.uniforms[e]={},i.type){case"t":r.uniforms[e].value=n(i.value);break;case"c":r.uniforms[e].value=(new Je).setHex(i.value);break;case"v2":r.uniforms[e].value=(new gt).fromArray(i.value);break;case"v3":r.uniforms[e].value=(new Ct).fromArray(i.value);break;case"v4":r.uniforms[e].value=(new Mt).fromArray(i.value);break;case"m3":r.uniforms[e].value=(new yt).fromArray(i.value);break;case"m4":r.uniforms[e].value=(new oe).fromArray(i.value);break;default:r.uniforms[e].value=i.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const e in t.extensions)r.extensions[e]=t.extensions[e];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.matcap&&(r.matcap=n(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),r.normalScale=(new gt).fromArray(e)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.specularIntensityMap&&(r.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularTintMap&&(r.specularTintMap=n(t.specularTintMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new gt).fromArray(t.clearcoatNormalScale)),void 0!==t.transmissionMap&&(r.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(r.thicknessMap=n(t.thicknessMap)),r}setTextures(t){return this.textures=t,this}}class Sc{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,r=t.length;n<r;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}}class Tc extends wn{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}Tc.prototype.isInstancedBufferGeometry=!0;class Ec extends Xl{constructor(t){super(t)}load(t,e,n,r){const i=this,o=new Jl(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(t,(function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)}parse(t){const e={},n={};function r(t,r){if(void 0!==e[r])return e[r];const i=t.interleavedBuffers[r],o=function(t,e){if(void 0!==n[e])return n[e];const r=t.arrayBuffers[e],i=new Uint32Array(r).buffer;return n[e]=i,i}(t,i.buffer),a=fn(i.type,o),s=new Zo(a,i.stride);return s.uuid=i.uuid,e[r]=s,s}const i=t.isInstancedBufferGeometry?new Tc:new wn,o=t.data.index;if(void 0!==o){const t=fn(o.type,o.array);i.setIndex(new tn(t,1))}const a=t.data.attributes;for(const e in a){const n=a[e];let o;if(n.isInterleavedBufferAttribute){const e=r(t.data,n.data);o=new $o(e,n.itemSize,n.offset,n.normalized)}else{const t=fn(n.type,n.array);o=new(n.isInstancedBufferAttribute?Ea:tn)(t,n.itemSize,n.normalized)}void 0!==n.name&&(o.name=n.name),void 0!==n.usage&&o.setUsage(n.usage),void 0!==n.updateRange&&(o.updateRange.offset=n.updateRange.offset,o.updateRange.count=n.updateRange.count),i.setAttribute(e,o)}const s=t.data.morphAttributes;if(s)for(const e in s){const n=s[e],o=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];let a;if(i.isInterleavedBufferAttribute){const e=r(t.data,i.data);a=new $o(e,i.itemSize,i.offset,i.normalized)}else{const t=fn(i.type,i.array);a=new tn(t,i.itemSize,i.normalized)}void 0!==i.name&&(a.name=i.name),o.push(a)}i.morphAttributes[e]=o}t.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);const l=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==l)for(let t=0,e=l.length;t!==e;++t){const e=l[t];i.addGroup(e.start,e.count,e.materialIndex)}const c=t.data.boundingSphere;if(void 0!==c){const t=new Ct;void 0!==c.center&&t.fromArray(c.center),i.boundingSphere=new Jt(t,c.radius)}return t.name&&(i.name=t.name),t.userData&&(i.userData=t.userData),i}}const Ac={UVMapping:r,CubeReflectionMapping:i,CubeRefractionMapping:o,EquirectangularReflectionMapping:a,EquirectangularRefractionMapping:s,CubeUVReflectionMapping:l,CubeUVRefractionMapping:c},Cc={RepeatWrapping:u,ClampToEdgeWrapping:p,MirroredRepeatWrapping:h},Lc={NearestFilter:d,NearestMipmapNearestFilter:f,NearestMipmapLinearFilter:m,LinearFilter:g,LinearMipmapNearestFilter:y,LinearMipmapLinearFilter:v};class Pc extends Xl{constructor(t){super(t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,o=Wl.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout((function(){e&&e(o),i.manager.itemEnd(t)}),0),o;const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,fetch(t,a).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){Wl.add(t,n),e&&e(n),i.manager.itemEnd(t)})).catch((function(e){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)})),i.manager.itemStart(t)}}Pc.prototype.isImageBitmapLoader=!0;class Ic{constructor(){this.type="ShapePath",this.color=new Je,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new nc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}bezierCurveTo(t,e,n,r,i,o){return this.currentPath.bezierCurveTo(t,e,n,r,i,o),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function n(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n],i=new rc;i.curves=r.curves,e.push(i)}return e}function r(t,e){const n=e.length;let r=!1;for(let i=n-1,o=0;o<n;i=o++){let n=e[i],a=e[o],s=a.x-n.x,l=a.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=e[o],s=-s,a=e[i],l=-l),t.y<n.y||t.y>a.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-s*(t.y-n.y);if(0===e)return!0;if(e<0)continue;r=!r}}else{if(t.y!==n.y)continue;if(a.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=a.x)return!0}}return r}const i=tl.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);let a,s,l;const c=[];if(1===o.length)return s=o[0],(l=new rc).curves=s.curves,c.push(l),c;let u=!i(o[0].getPoints());u=t?!u:u;const p=[],h=[];let d,f,m=[],g=0;h[g]=void 0,m[g]=[];for(let e=0,n=o.length;e<n;e++)a=i(d=(s=o[e]).getPoints()),(a=t?!a:a)?(!u&&h[g]&&g++,h[g]={s:new rc,p:d},h[g].s.curves=s.curves,u&&g++,m[g]=[]):m[g].push({h:s,p:d[0]});if(!h[0])return n(o);if(h.length>1){let t=!1;const e=[];for(let t=0,e=h.length;t<e;t++)p[t]=[];for(let n=0,i=h.length;n<i;n++){const i=m[n];for(let o=0;o<i.length;o++){const a=i[o];let s=!0;for(let i=0;i<h.length;i++)r(a.p,h[i].p)&&(n!==i&&e.push({froms:n,tos:i,hole:o}),s?(s=!1,p[i].push(a)):t=!0);s&&p[n].push(a)}}e.length>0&&(t||(m=p))}for(let t=0,e=h.length;t<e;t++){l=h[t].s,c.push(l),f=m[t];for(let t=0,e=f.length;t<e;t++)l.holes.push(f[t].h)}return c}}class Rc{constructor(t){this.type="Font",this.data=t}generateShapes(t,e=100){const n=[],r=function(t,e,n){const r=Array.from(t),i=e/n.resolution,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,a=[];let s=0,l=0;for(let t=0;t<r.length;t++){const e=r[t];if("\n"===e)s=0,l-=o;else{const t=kc(e,i,s,l,n);s+=t.offsetX,a.push(t.path)}}return a}(t,e,this.data);for(let t=0,e=r.length;t<e;t++)Array.prototype.push.apply(n,r[t].toShapes());return n}}function kc(t,e,n,r,i){const o=i.glyphs[t]||i.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+i.familyName+".");const a=new Ic;let s,l,c,u,p,h,d,f;if(o.o){const t=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let i=0,o=t.length;i<o;)switch(t[i++]){case"m":s=t[i++]*e+n,l=t[i++]*e+r,a.moveTo(s,l);break;case"l":s=t[i++]*e+n,l=t[i++]*e+r,a.lineTo(s,l);break;case"q":c=t[i++]*e+n,u=t[i++]*e+r,p=t[i++]*e+n,h=t[i++]*e+r,a.quadraticCurveTo(p,h,c,u);break;case"b":c=t[i++]*e+n,u=t[i++]*e+r,p=t[i++]*e+n,h=t[i++]*e+r,d=t[i++]*e+n,f=t[i++]*e+r,a.bezierCurveTo(p,h,d,f,c,u)}}return{offsetX:o.ha*e,path:a}}let zc;Rc.prototype.isFont=!0;const Dc={getContext:function(){return void 0===zc&&(zc=new(window.AudioContext||window.webkitAudioContext)),zc},setContext:function(t){zc=t}};class Oc extends Xl{constructor(t){super(t)}load(t,e,n,r){const i=this,o=new Jl(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{const t=n.slice(0);Dc.getContext().decodeAudioData(t,(function(t){e(t)}))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)}}class Fc extends wc{constructor(t,e,n=1){super(void 0,n);const r=(new Je).set(t),i=(new Je).set(e),o=new Ct(r.r,r.g,r.b),a=new Ct(i.r,i.g,i.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(s),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(l)}}Fc.prototype.isHemisphereLightProbe=!0;class Bc extends wc{constructor(t,e=1){super(void 0,e);const n=(new Je).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}Bc.prototype.isAmbientLightProbe=!0;const Nc=new oe,Uc=new oe;class jc{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Vc(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Vc();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Vc(){return("undefined"==typeof performance?Date:performance).now()}const Gc=new Ct,Hc=new At,Wc=new Ct,qc=new Ct;class Zc extends Pe{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}const Xc=new Ct,$c=new At,Jc=new Ct,Yc=new Ct;class Qc{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class Kc{constructor(t,e,n){let r,i,o;switch(this.binding=t,this.valueSize=n,e){case"quaternion":r=this._slerp,i=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,r=this.valueSize,i=t*r+r;let o=this.cumulativeWeight;if(0===o){for(let t=0;t!==r;++t)n[i+t]=n[t];o=e}else{const t=e/(o+=e);this._mixBufferRegion(n,i,0,t,r)}this.cumulativeWeight=o}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,r,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,r=t*e+e,i=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){const t=e*this._origIndex;this._mixBufferRegion(n,r,t,1-i,e)}o>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(let t=e,i=e+e;t!==i;++t)if(n[t]!==n[t+e]){a.setValue(n,r);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(let t=n,i=r;t!==i;++t)e[t]=e[r+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,r,i){if(r>=.5)for(let r=0;r!==i;++r)t[e+r]=t[n+r]}_slerp(t,e,n,r){At.slerpFlat(t,e,t,e,t,n,r)}_slerpAdditive(t,e,n,r,i){const o=this._workIndex*i;At.multiplyQuaternionsFlat(t,o,t,e,t,n),At.slerpFlat(t,e,t,e,t,o,r)}_lerp(t,e,n,r,i){const o=1-r;for(let a=0;a!==i;++a){const i=e+a;t[i]=t[i]*o+t[n+a]*r}}_lerpAdditive(t,e,n,r,i){for(let o=0;o!==i;++o){const i=e+o;t[i]=t[i]+t[n+o]*r}}}const tu=new RegExp("[\\[\\]\\.:\\/]","g"),eu="[^\\[\\]\\.:\\/]",nu="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",ru=/((?:WC+[\/:])*)/.source.replace("WC",eu),iu=/(WCOD+)?/.source.replace("WCOD",nu),ou=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",eu),au=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",eu),su=new RegExp("^"+ru+iu+ou+au+"$"),lu=["material","materials","bones"];class cu{constructor(t,e,n){this.path=e,this.parsedPath=n||cu.parseTrackName(e),this.node=cu.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new cu.Composite(t,e,n):new cu(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(tu,"")}static parseTrackName(t){const e=su.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const t=n.nodeName.substring(r+1);-1!==lu.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let r=0;r<t.length;r++){const i=t[r];if(i.name===e||i.uuid===e)return i;const o=n(i.children);if(o)return o}return null},r=n(t.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)t[e++]=n[r]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,r=e.propertyName;let i=e.propertyIndex;if(t||(t=cu.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let r=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===r){r=e;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==r){if(void 0===t[r])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[r]}}const o=t[r];if(void 0===o){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+r+" but it wasn't found.",t)}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let s=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[i]&&(i=t.morphTargetDictionary[i])}s=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=i}else void 0!==o.fromArray&&void 0!==o.toArray?(s=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(s=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[s],this.setValue=this.SetterByBindingTypeAndVersioning[s][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}cu.Composite=class{constructor(t,e,n){const r=n||cu.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},cu.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},cu.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},cu.prototype.GetterByBindingType=[cu.prototype._getValue_direct,cu.prototype._getValue_array,cu.prototype._getValue_arrayElement,cu.prototype._getValue_toArray],cu.prototype.SetterByBindingTypeAndVersioning=[[cu.prototype._setValue_direct,cu.prototype._setValue_direct_setNeedsUpdate,cu.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[cu.prototype._setValue_array,cu.prototype._setValue_array_setNeedsUpdate,cu.prototype._setValue_array_setMatrixWorldNeedsUpdate],[cu.prototype._setValue_arrayElement,cu.prototype._setValue_arrayElement_setNeedsUpdate,cu.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[cu.prototype._setValue_fromArray,cu.prototype._setValue_fromArray_setNeedsUpdate,cu.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class uu{constructor(){this.uuid=lt(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,o=i.length;let a,s=t.length,l=this.nCachedObjects_;for(let c=0,u=arguments.length;c!==u;++c){const u=arguments[c],p=u.uuid;let h=e[p];if(void 0===h){h=s++,e[p]=h,t.push(u);for(let t=0,e=o;t!==e;++t)i[t].push(new cu(u,n[t],r[t]))}else if(h<l){a=t[h];const s=--l,c=t[s];e[c.uuid]=h,t[h]=c,e[p]=s,t[s]=u;for(let t=0,e=o;t!==e;++t){const e=i[t],o=e[s];let a=e[h];e[h]=o,void 0===a&&(a=new cu(u,n[t],r[t])),e[s]=a}}else t[h]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o],s=a.uuid,l=e[s];if(void 0!==l&&l>=i){const o=i++,c=t[o];e[c.uuid]=l,t[l]=c,e[s]=o,t[o]=a;for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[o],i=e[l];e[l]=r,e[o]=i}}}this.nCachedObjects_=i}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,o=t.length;for(let a=0,s=arguments.length;a!==s;++a){const s=arguments[a].uuid,l=e[s];if(void 0!==l)if(delete e[s],l<i){const a=--i,s=t[a],c=--o,u=t[c];e[s.uuid]=l,t[l]=s,e[u.uuid]=a,t[a]=u,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[a],i=e[c];e[l]=r,e[a]=i,e.pop()}}else{const i=--o,a=t[i];i>0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t];e[l]=e[i],e.pop()}}}this.nCachedObjects_=i}subscribe_(t,e){const n=this._bindingsIndicesByPath;let r=n[t];const i=this._bindings;if(void 0!==r)return i[r];const o=this._paths,a=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,u=new Array(l);r=i.length,n[t]=r,o.push(t),a.push(e),i.push(u);for(let n=c,r=s.length;n!==r;++n){const r=s[n];u[n]=new cu(r,t,e)}return u}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const r=this._paths,i=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=n,o[n]=s,o.pop(),i[n]=i[a],i.pop(),r[n]=r[a],r.pop()}}}uu.prototype.isAnimationObjectGroup=!0;class pu{constructor(t,e,n=null,r=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;const i=e.tracks,o=i.length,a=new Array(o),s={endingStart:V,endingEnd:V};for(let t=0;t!==o;++t){const e=i[t].createInterpolant(null);a[t]=e,e.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,r=t._clip.duration,i=r/n,o=n/r;t.warp(1,i,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const r=this._mixer,i=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const s=a.parameterPositions,l=a.sampleValues;return s[0]=i,s[1]=i+n,l[0]=t/o,l[1]=e/o,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,r){if(!this.enabled)return void this._updateWeight(t);const i=this._startTime;if(null!==i){const r=(t-i)*n;if(r<0||0===n)return;this._startTime=null,e=n*r}e*=this._updateTimeScale(t);const o=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===q)for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(o),e[n].accumulateAdditive(a);else for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(o),e[n].accumulate(r,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let r=this.time+t,i=this._loopCount;const o=2202===n;if(0===t)return-1===i?r:o&&1==(1&i)?e-r:r;if(2200===n){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),r>=e||r<0){const n=Math.floor(r/e);r-=e*n,i+=Math.abs(n);const a=this.repetitions-i;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(o&&1==(1&i))return e-r}return r}_setEndings(t,e,n){const r=this._interpolantSettings;n?(r.endingStart=G,r.endingEnd=G):(r.endingStart=t?this.zeroSlopeAtStart?G:V:H,r.endingEnd=e?this.zeroSlopeAtEnd?G:V:H)}_scheduleFading(t,e,n){const r=this._mixer,i=r.time;let o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=e,a[1]=i+t,s[1]=n,this}}class hu extends rt{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,l=this._bindingsByRootAndName;let c=l[s];void 0===c&&(c={},l[s]=c);for(let t=0;t!==i;++t){const i=r[t],l=i.name;let u=c[l];if(void 0!==u)o[t]=u;else{if(void 0!==(u=o[t])){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,s,l));continue}const r=e&&e._propertyBindings[t].binding.parsedPath;++(u=new Kc(cu.create(n,l,r),i.ValueTypeName,i.getValueSize())).referenceCount,this._addInactiveBinding(u,s,l),o[t]=u}a[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const r=this._actions,i=this._actionsByClip;let o=i[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=o;else{const e=o.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=r.length,r.push(t),o.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],r=t._cacheIndex;n._cacheIndex=r,e[r]=n,e.pop(),t._cacheIndex=null;const i=t._clip.uuid,o=this._actionsByClip,a=o[i],s=a.knownActions,l=s[s.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),t._byClipCacheIndex=null,delete a.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete o[i],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,r=this._nActiveActions++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,r=--this._nActiveActions,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_addInactiveBinding(t,e,n){const r=this._bindingsByRootAndName,i=this._bindings;let o=r[e];void 0===o&&(o={},r[e]=o),o[n]=t,t._cacheIndex=i.length,i.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,r=n.rootNode.uuid,i=n.path,o=this._bindingsByRootAndName,a=o[r],s=e[e.length-1],l=t._cacheIndex;s._cacheIndex=l,e[l]=s,e.pop(),delete a[i],0===Object.keys(a).length&&delete o[r]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,r=this._nActiveBindings++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,r=--this._nActiveBindings,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&((n=new kl(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,r=--this._nActiveControlInterpolants,i=e[r];t.__cacheIndex=r,e[r]=t,i.__cacheIndex=n,e[n]=i}clipAction(t,e,n){const r=e||this._root,i=r.uuid;let o="string"==typeof t?Gl.findByName(r,t):t;const a=null!==o?o.uuid:t,s=this._actionsByClip[a];let l=null;if(void 0===n&&(n=null!==o?o.blendMode:W),void 0!==s){const t=s.actionByRoot[i];if(void 0!==t&&t.blendMode===n)return t;l=s.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const c=new pu(this,o,e,n);return this._bindAction(c,l),this._addInactiveAction(c,a,i),c}existingAction(t,e){const n=e||this._root,r=n.uuid,i="string"==typeof t?Gl.findByName(n,t):t,o=i?i.uuid:t,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[r]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),o=this._accuIndex^=1;for(let a=0;a!==n;++a)e[a]._update(r,t,i,o);const a=this._bindings,s=this._nActiveBindings;for(let t=0;t!==s;++t)a[t].apply(o);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){const t=i.knownActions;for(let n=0,r=t.length;n!==r;++n){const r=t[n];this._deactivateAction(r);const i=r._cacheIndex,o=e[e.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,o._cacheIndex=i,e[i]=o,e.pop(),this._removeInactiveBindingsForAction(r)}delete r[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const r=n[t].actionByRoot[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}const r=this._bindingsByRootAndName[e];if(void 0!==r)for(const t in r){const e=r[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}hu.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class du{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new du(void 0===this.value.clone?this.value:this.value.clone())}}class fu extends Zo{constructor(t,e,n=1){super(t,e),this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}fu.prototype.isInstancedInterleavedBuffer=!0;class mu{constructor(t,e,n,r,i){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=r,this.count=i,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}function gu(t,e){return t.distance-e.distance}function yu(t,e,n,r){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===r){const r=t.children;for(let t=0,i=r.length;t<i;t++)yu(r[t],e,n,!0)}}mu.prototype.isGLBufferAttribute=!0;const vu=new gt;class _u{constructor(t=new gt(1/0,1/0),e=new gt(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=vu.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return vu.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}_u.prototype.isBox2=!0;const xu=new Ct,bu=new Ct;class wu{constructor(t=new Ct,e=new Ct){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){xu.subVectors(t,this.start),bu.subVectors(this.end,this.start);const n=bu.dot(bu);let r=bu.dot(xu)/n;return e&&(r=ct(r,0,1)),r}closestPointToPoint(t,e,n){const r=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}class Mu extends Pe{constructor(t){super(),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}Mu.prototype.isImmediateRenderObject=!0;const Su=new Ct,Tu=new Ct,Eu=new oe,Au=new oe;class Cu extends ja{constructor(t){const e=function t(e){const n=[];e&&e.isBone&&n.push(e);for(let r=0;r<e.children.length;r++)n.push.apply(n,t(e.children[r]));return n}(t),n=new wn,r=[],i=[],o=new Je(0,0,1),a=new Je(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(o.r,o.g,o.b),i.push(a.r,a.g,a.b))}n.setAttribute("position",new un(r,3)),n.setAttribute("color",new un(i,3)),super(n,new Ra({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,r=n.getAttribute("position");Au.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(Eu.multiplyMatrices(Au,i.matrixWorld),Tu.setFromMatrixPosition(Eu),r.setXYZ(n,Tu.x,Tu.y,Tu.z),Eu.multiplyMatrices(Au,i.parent.matrixWorld),Tu.setFromMatrixPosition(Eu),r.setXYZ(n+1,Tu.x,Tu.y,Tu.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}const Lu=new Ct,Pu=new Je,Iu=new Je;class Ru extends ja{constructor(t=10,e=10,n=4473924,r=8947848){n=new Je(n),r=new Je(r);const i=e/2,o=t/e,a=t/2,s=[],l=[];for(let t=0,c=0,u=-a;t<=e;t++,u+=o){s.push(-a,0,u,a,0,u),s.push(u,0,-a,u,0,a);const e=t===i?n:r;e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3}const c=new wn;c.setAttribute("position",new un(s,3)),c.setAttribute("color",new un(l,3)),super(c,new Ra({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}const ku=new Ct,zu=new Ct,Du=new Ct,Ou=new Ct,Fu=new Zn;function Bu(t,e,n,r,i,o,a){Ou.set(i,o,a).unproject(r);const s=e[t];if(void 0!==s){const t=n.getAttribute("position");for(let e=0,n=s.length;e<n;e++)t.setXYZ(s[e],Ou.x,Ou.y,Ou.z)}}const Nu=new It;class Uu extends ja{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new wn;i.setIndex(new tn(n,1)),i.setAttribute("position",new tn(r,3)),super(i,new Ra({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Nu.setFromObject(this.object),Nu.isEmpty())return;const e=Nu.min,n=Nu.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=e.x,i[4]=n.y,i[5]=n.z,i[6]=e.x,i[7]=e.y,i[8]=n.z,i[9]=n.x,i[10]=e.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=e.z,i[15]=e.x,i[16]=n.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=n.x,i[22]=e.y,i[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t){return ja.prototype.copy.call(this,t),this.object=t.object,this}}const ju=new Ct;let Vu,Gu;class Hu extends ja{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new wn;n.setAttribute("position",new un(e,3)),n.setAttribute("color",new un([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new Ra({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,n){const r=new Je,i=this.geometry.attributes.color.array;return r.set(t),r.toArray(i,0),r.toArray(i,3),r.set(e),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}const Wu=new Float32Array(1),qu=new Int32Array(Wu.buffer);us.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(us.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},nc.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},Ru.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Cu.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Xl.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Sc.extractUrlBase(t)},Xl.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},_u.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},_u.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},_u.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},_u.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},It.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},It.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},It.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},It.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},It.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Jt.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ir.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},wu.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},yt.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},yt.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},yt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},yt.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},yt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},yt.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},oe.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},oe.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},oe.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Ct).setFromMatrixColumn(this,3)},oe.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},oe.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},oe.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},oe.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},oe.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},oe.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},oe.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},oe.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},oe.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},oe.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},oe.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},oe.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},oe.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},oe.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},oe.prototype.makeFrustum=function(t,e,n,r,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,o)},oe.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},er.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},At.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},At.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},ie.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},ie.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},ie.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},je.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},je.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},je.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},je.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},je.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},je.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),je.getBarycoord(t,e,n,r,i)},je.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),je.getNormal(t,e,n,r)},rc.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},rc.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new rl(this,t)},rc.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ul(this,t)},gt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},gt.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},gt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Ct.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Ct.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Ct.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},Ct.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},Ct.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},Ct.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},Ct.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Ct.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Ct.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Mt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Mt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Pe.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Pe.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Pe.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Pe.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Pe.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Pe.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Un.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Un.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),xa.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Xn.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(ic.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(tn.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===et},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(et)}}}),tn.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?et:tt),this},tn.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},tn.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},wn.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},wn.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new tn(arguments[1],arguments[2])))},wn.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},wn.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},wn.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},wn.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},wn.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(wn.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Zo.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?et:tt),this},Zo.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},rl.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},rl.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},rl.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},qo.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},du.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(Ge.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Je}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(qn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Vo.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},Vo.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},Vo.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Vo.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Vo.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Vo.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Vo.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Vo.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Vo.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Vo.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Vo.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Vo.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Vo.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Vo.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Vo.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},Vo.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Vo.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Vo.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Vo.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Vo.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Vo.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Vo.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Vo.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Vo.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Vo.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Vo.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?X:Z}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Ro.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(St.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Zc.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Oc).load(t,(function(t){e.setBuffer(t)})),this},Qc.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},$n.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},$n.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},_t.crossOrigin=void 0,_t.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new tc;i.setCrossOrigin(this.crossOrigin);const o=i.load(t,n,void 0,r);return e&&(o.mapping=e),o},_t.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new Ql;i.setCrossOrigin(this.crossOrigin);const o=i.load(t,n,void 0,r);return e&&(o.mapping=e),o},_t.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},_t.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const Zu={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:e}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=e),t.ACESFilmicToneMapping=4,t.AddEquation=n,t.AddOperation=2,t.AdditiveAnimationBlendMode=q,t.AdditiveBlending=2,t.AlphaFormat=1021,t.AlwaysDepth=1,t.AlwaysStencilFunc=519,t.AmbientLight=_c,t.AmbientLightProbe=Bc,t.AnimationClip=Gl,t.AnimationLoader=class extends Xl{constructor(t){super(t)}load(t,e,n,r){const i=this,o=new Jl(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)}parse(t){const e=[];for(let n=0;n<t.length;n++){const r=Gl.parse(t[n]);e.push(r)}return e}},t.AnimationMixer=hu,t.AnimationObjectGroup=uu,t.AnimationUtils=Pl,t.ArcCurve=hs,t.ArrayCamera=Oo,t.ArrowHelper=class extends Pe{constructor(t=new Ct(0,0,1),e=new Ct(0,0,0),n=1,r=16776960,i=.2*n,o=.2*i){super(),this.type="ArrowHelper",void 0===Vu&&((Vu=new wn).setAttribute("position",new un([0,0,0,0,1,0],3)),(Gu=new es(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new Ba(Vu,new Ra({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Un(Gu,new Ye({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,i,o)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{ju.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(ju,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}},t.Audio=Zc,t.AudioAnalyser=Qc,t.AudioContext=Dc,t.AudioListener=class extends Pe{constructor(){super(),this.type="AudioListener",this.context=Dc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new jc}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Gc,Hc,Wc),qc.set(0,0,-1).applyQuaternion(Hc),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Gc.x,t),e.positionY.linearRampToValueAtTime(Gc.y,t),e.positionZ.linearRampToValueAtTime(Gc.z,t),e.forwardX.linearRampToValueAtTime(qc.x,t),e.forwardY.linearRampToValueAtTime(qc.y,t),e.forwardZ.linearRampToValueAtTime(qc.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(Gc.x,Gc.y,Gc.z),e.setOrientation(qc.x,qc.y,qc.z,n.x,n.y,n.z)}},t.AudioLoader=Oc,t.AxesHelper=Hu,t.AxisHelper=function(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Hu(t)},t.BackSide=1,t.BasicDepthPacking=3200,t.BasicShadowMap=0,t.BinaryTextureLoader=function(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Kl(t)},t.Bone=ba,t.BooleanKeyframeTrack=Ol,t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Uu(t,e)},t.Box2=_u,t.Box3=It,t.Box3Helper=class extends ja{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new wn;r.setIndex(new tn(n,1)),r.setAttribute("position",new un([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(r,new Ra({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}},t.BoxBufferGeometry=Vn,t.BoxGeometry=Vn,t.BoxHelper=Uu,t.BufferAttribute=tn,t.BufferGeometry=wn,t.BufferGeometryLoader=Ec,t.ByteType=1010,t.Cache=Wl,t.Camera=Zn,t.CameraHelper=class extends ja{constructor(t){const e=new wn,n=new Ra({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],o={},a=new Je(16755200),s=new Je(16711680),l=new Je(43775),c=new Je(16777215),u=new Je(3355443);function p(t,e,n){h(t,n),h(e,n)}function h(t,e){r.push(0,0,0),i.push(e.r,e.g,e.b),void 0===o[t]&&(o[t]=[]),o[t].push(r.length/3-1)}p("n1","n2",a),p("n2","n4",a),p("n4","n3",a),p("n3","n1",a),p("f1","f2",a),p("f2","f4",a),p("f4","f3",a),p("f3","f1",a),p("n1","f1",a),p("n2","f2",a),p("n3","f3",a),p("n4","f4",a),p("p","n1",s),p("p","n2",s),p("p","n3",s),p("p","n4",s),p("u1","u2",l),p("u2","u3",l),p("u3","u1",l),p("c","t",c),p("p","c",u),p("cn1","cn2",u),p("cn3","cn4",u),p("cf1","cf2",u),p("cf3","cf4",u),e.setAttribute("position",new un(r,3)),e.setAttribute("color",new un(i,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){const t=this.geometry,e=this.pointMap;Fu.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Bu("c",e,t,Fu,0,0,-1),Bu("t",e,t,Fu,0,0,1),Bu("n1",e,t,Fu,-1,-1,-1),Bu("n2",e,t,Fu,1,-1,-1),Bu("n3",e,t,Fu,-1,1,-1),Bu("n4",e,t,Fu,1,1,-1),Bu("f1",e,t,Fu,-1,-1,1),Bu("f2",e,t,Fu,1,-1,1),Bu("f3",e,t,Fu,-1,1,1),Bu("f4",e,t,Fu,1,1,1),Bu("u1",e,t,Fu,.7,1.1,-1),Bu("u2",e,t,Fu,-.7,1.1,-1),Bu("u3",e,t,Fu,0,2,-1),Bu("cf1",e,t,Fu,-1,0,1),Bu("cf2",e,t,Fu,1,0,1),Bu("cf3",e,t,Fu,0,-1,1),Bu("cf4",e,t,Fu,0,1,1),Bu("cn1",e,t,Fu,-1,0,-1),Bu("cn2",e,t,Fu,1,0,-1),Bu("cn3",e,t,Fu,0,-1,-1),Bu("cn4",e,t,Fu,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},t.CanvasTexture=Qa,t.CatmullRomCurve3=vs,t.CineonToneMapping=3,t.CircleBufferGeometry=ts,t.CircleGeometry=ts,t.ClampToEdgeWrapping=p,t.Clock=jc,t.Color=Je,t.ColorKeyframeTrack=Fl,t.CompressedTexture=Ya,t.CompressedTextureLoader=class extends Xl{constructor(t){super(t)}load(t,e,n,r){const i=this,o=[],a=new Ya,s=new Jl(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials);let l=0;function c(c){s.load(t[c],(function(t){const n=i.parse(t,!0);o[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(a.minFilter=g),a.image=o,a.format=n.format,a.needsUpdate=!0,e&&e(a))}),n,r)}if(Array.isArray(t))for(let e=0,n=t.length;e<n;++e)c(e);else s.load(t,(function(t){const n=i.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){o[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)o[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),o[e].format=n.format,o[e].width=n.width,o[e].height=n.height}a.image=o}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=g),a.format=n.format,a.needsUpdate=!0,e&&e(a)}),n,r);return a}},t.ConeBufferGeometry=ns,t.ConeGeometry=ns,t.CubeCamera=$n,t.CubeReflectionMapping=i,t.CubeRefractionMapping=o,t.CubeTexture=Jn,t.CubeTextureLoader=Ql,t.CubeUVReflectionMapping=l,t.CubeUVRefractionMapping=c,t.CubicBezierCurve=ws,t.CubicBezierCurve3=Ms,t.CubicInterpolant=Rl,t.CullFaceBack=1,t.CullFaceFront=2,t.CullFaceFrontBack=3,t.CullFaceNone=0,t.Curve=us,t.CurvePath=ec,t.CustomBlending=5,t.CustomToneMapping=5,t.CylinderBufferGeometry=es,t.CylinderGeometry=es,t.Cylindrical=class{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return(new this.constructor).copy(this)}},t.DataTexture=wa,t.DataTexture2DArray=Zr,t.DataTexture3D=Xr,t.DataTextureLoader=Kl,t.DataUtils=class{static toHalfFloat(t){Wu[0]=t;const e=qu[0];let n=e>>16&32768,r=e>>12&2047;const i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&e):i<113?n|=((r|=2048)>>114-i)+(r>>113-i&1):(n|=i-112<<10|r>>1,n+=1&r)}},t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=Zl,t.DepthFormat=A,t.DepthStencilFormat=C,t.DepthTexture=Ka,t.DirectionalLight=vc,t.DirectionalLightHelper=class extends Pe{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1);let r=new wn;r.setAttribute("position",new un([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const i=new Ra({fog:!1,toneMapped:!1});this.lightPlane=new Ba(r,i),this.add(this.lightPlane),(r=new wn).setAttribute("position",new un([0,0,0,0,0,1],3)),this.targetLine=new Ba(r,i),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){ku.setFromMatrixPosition(this.light.matrixWorld),zu.setFromMatrixPosition(this.light.target.matrixWorld),Du.subVectors(zu,ku),this.lightPlane.lookAt(zu),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(zu),this.targetLine.scale.z=Du.length()}},t.DiscreteInterpolant=zl,t.DodecahedronBufferGeometry=is,t.DodecahedronGeometry=is,t.DoubleSide=2,t.DstAlphaFactor=206,t.DstColorFactor=208,t.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new tn(t,e).setUsage(et)},t.DynamicCopyUsage=35050,t.DynamicDrawUsage=et,t.DynamicReadUsage=35049,t.EdgesGeometry=cs,t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new ja(new cs(t.geometry),new Ra({color:void 0!==e?e:16777215}))},t.EllipseCurve=ps,t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=a,t.EquirectangularRefractionMapping=s,t.Euler=me,t.EventDispatcher=rt,t.ExtrudeBufferGeometry=rl,t.ExtrudeGeometry=rl,t.FaceColors=1,t.FileLoader=Jl,t.FlatShading=1,t.Float16BufferAttribute=cn,t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new un(t,e)},t.Float32BufferAttribute=un,t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new pn(t,e)},t.Float64BufferAttribute=pn,t.FloatType=w,t.Fog=Wo,t.FogExp2=Ho,t.Font=Rc,t.FontLoader=class extends Xl{constructor(t){super(t)}load(t,e,n,r){const i=this,o=new Jl(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(i.withCredentials),o.load(t,(function(t){let n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}const r=i.parse(n);e&&e(r)}),n,r)}parse(t){return new Rc(t)}},t.FrontSide=0,t.Frustum=ir,t.GLBufferAttribute=mu,t.GLSL1="100",t.GLSL3=nt,t.GammaEncoding=$,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=Ru,t.Group=Fo,t.HalfFloatType=M,t.HemisphereLight=oc,t.HemisphereLightHelper=class extends Pe{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const r=new sl(e);r.rotateY(.5*Math.PI),this.material=new Ye({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const i=r.getAttribute("position"),o=new Float32Array(3*i.count);r.setAttribute("color",new tn(o,3)),this.add(new Un(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");Pu.copy(this.light.color),Iu.copy(this.light.groundColor);for(let t=0,n=e.count;t<n;t++){const r=t<n/2?Pu:Iu;e.setXYZ(t,r.r,r.g,r.b)}e.needsUpdate=!0}t.lookAt(Lu.setFromMatrixPosition(this.light.matrixWorld).negate())}},t.HemisphereLightProbe=Fc,t.IcosahedronBufferGeometry=ol,t.IcosahedronGeometry=ol,t.ImageBitmapLoader=Pc,t.ImageLoader=Yl,t.ImageUtils=_t,t.ImmediateRenderObject=Mu,t.IncrementStencilOp=7682,t.IncrementWrapStencilOp=34055,t.InstancedBufferAttribute=Ea,t.InstancedBufferGeometry=Tc,t.InstancedInterleavedBuffer=fu,t.InstancedMesh=Ia,t.Int16Attribute=function(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new on(t,e)},t.Int16BufferAttribute=on,t.Int32Attribute=function(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new sn(t,e)},t.Int32BufferAttribute=sn,t.Int8Attribute=function(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new en(t,e)},t.Int8BufferAttribute=en,t.IntType=1013,t.InterleavedBuffer=Zo,t.InterleavedBufferAttribute=$o,t.Interpolant=Il,t.InterpolateDiscrete=N,t.InterpolateLinear=U,t.InterpolateSmooth=j,t.InvertStencilOp=5386,t.JSONLoader=function(){console.error("THREE.JSONLoader has been removed.")},t.KeepStencilOp=7680,t.KeyframeTrack=Dl,t.LOD=fa,t.LatheBufferGeometry=al,t.LatheGeometry=al,t.Layers=ge,t.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")},t.LessDepth=2,t.LessEqualDepth=3,t.LessEqualStencilFunc=515,t.LessStencilFunc=513,t.Light=ic,t.LightProbe=wc,t.Line=Ba,t.Line3=wu,t.LineBasicMaterial=Ra,t.LineCurve=Ss,t.LineCurve3=Ts,t.LineDashedMaterial=Cl,t.LineLoop=Va,t.LinePieces=1,t.LineSegments=ja,t.LineStrip=0,t.LinearEncoding=Z,t.LinearFilter=g,t.LinearInterpolant=kl,t.LinearMipMapLinearFilter=1008,t.LinearMipMapNearestFilter=1007,t.LinearMipmapLinearFilter=v,t.LinearMipmapNearestFilter=y,t.LinearToneMapping=1,t.Loader=Xl,t.LoaderUtils=Sc,t.LoadingManager=ql,t.LogLuvEncoding=3003,t.LoopOnce=2200,t.LoopPingPong=2202,t.LoopRepeat=2201,t.LuminanceAlphaFormat=1025,t.LuminanceFormat=1024,t.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},t.Material=Ge,t.MaterialLoader=Mc,t.Math=mt,t.MathUtils=mt,t.Matrix3=yt,t.Matrix4=oe,t.MaxEquation=104,t.Mesh=Un,t.MeshBasicMaterial=Ye,t.MeshDepthMaterial=Po,t.MeshDistanceMaterial=Io,t.MeshFaceMaterial=function(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t},t.MeshLambertMaterial=El,t.MeshMatcapMaterial=Al,t.MeshNormalMaterial=Tl,t.MeshPhongMaterial=Ml,t.MeshPhysicalMaterial=wl,t.MeshStandardMaterial=bl,t.MeshToonMaterial=Sl,t.MinEquation=103,t.MirroredRepeatWrapping=h,t.MixOperation=1,t.MultiMaterial=function(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t},t.MultiplyBlending=4,t.MultiplyOperation=0,t.NearestFilter=d,t.NearestMipMapLinearFilter=1005,t.NearestMipMapNearestFilter=1004,t.NearestMipmapLinearFilter=m,t.NearestMipmapNearestFilter=f,t.NeverDepth=0,t.NeverStencilFunc=512,t.NoBlending=0,t.NoColors=0,t.NoToneMapping=0,t.NormalAnimationBlendMode=W,t.NormalBlending=1,t.NotEqualDepth=7,t.NotEqualStencilFunc=517,t.NumberKeyframeTrack=Bl,t.Object3D=Pe,t.ObjectLoader=class extends Xl{constructor(t){super(t)}load(t,e,n,r){const i=this,o=""===this.path?Sc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||o;const a=new Jl(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){let o=null;try{o=JSON.parse(n)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?i.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t)}),n,r)}async loadAsync(t,e){const n=""===this.path?Sc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||n;const r=new Jl(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const i=await r.loadAsync(t,e),o=JSON.parse(i),a=o.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(o)}parse(t,e){const n=this.parseAnimations(t.animations),r=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,r),o=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),a=this.parseTextures(t.textures,o),s=this.parseMaterials(t.materials,a),l=this.parseObject(t.object,i,s,a,n),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),void 0!==e){let t=!1;for(const e in o)if(o[e]instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,n),i=await this.parseImagesAsync(t.images),o=this.parseTextures(t.textures,i),a=this.parseMaterials(t.materials,o),s=this.parseObject(t.object,r,a,o,e),l=this.parseSkeletons(t.skeletons,s);return this.bindSkeletons(s,l),s}parseShapes(t){const e={};if(void 0!==t)for(let n=0,r=t.length;n<r;n++){const r=(new rc).fromJSON(t[n]);e[r.uuid]=r}return e}parseSkeletons(t,e){const n={},r={};if(e.traverse((function(t){t.isBone&&(r[t.uuid]=t)})),void 0!==t)for(let e=0,i=t.length;e<i;e++){const i=(new Ta).fromJSON(t[e],r);n[i.uuid]=i}return n}parseGeometries(t,e){const n={};if(void 0!==t){const r=new Ec;for(let i=0,o=t.length;i<o;i++){let o;const a=t[i];switch(a.type){case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(a);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:a.type in _l?o=_l[a.type].fromJSON(a,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${a.type}"`)}o.uuid=a.uuid,void 0!==a.name&&(o.name=a.name),!0===o.isBufferGeometry&&void 0!==a.userData&&(o.userData=a.userData),n[a.uuid]=o}}return n}parseMaterials(t,e){const n={},r={};if(void 0!==t){const i=new Mc;i.setTextures(e);for(let e=0,o=t.length;e<o;e++){const o=t[e];if("MultiMaterial"===o.type){const t=[];for(let e=0;e<o.materials.length;e++){const r=o.materials[e];void 0===n[r.uuid]&&(n[r.uuid]=i.parse(r)),t.push(n[r.uuid])}r[o.uuid]=t}else void 0===n[o.uuid]&&(n[o.uuid]=i.parse(o)),r[o.uuid]=n[o.uuid]}}return r}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const r=t[n],i=Gl.parse(r);e[i.uuid]=i}return e}parseImages(t,e){const n=this,r={};let i;function o(t){if("string"==typeof t){const e=t;return function(t){return n.manager.itemStart(t),i.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e)}return t.data?{data:fn(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new ql(e);(i=new Yl(n)).setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],i=n.url;if(Array.isArray(i)){r[n.uuid]=[];for(let t=0,e=i.length;t<e;t++){const e=o(i[t]);null!==e&&(e instanceof HTMLImageElement?r[n.uuid].push(e):r[n.uuid].push(new wa(e.data,e.width,e.height)))}}else{const t=o(n.url);null!==t&&(r[n.uuid]=t)}}}return r}async parseImagesAsync(t){const e=this,n={};let r;async function i(t){if("string"==typeof t){const n=t,i=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:e.resourcePath+n;return await r.loadAsync(i)}return t.data?{data:fn(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){(r=new Yl(this.manager)).setCrossOrigin(this.crossOrigin);for(let e=0,r=t.length;e<r;e++){const r=t[e],o=r.url;if(Array.isArray(o)){n[r.uuid]=[];for(let t=0,e=o.length;t<e;t++){const e=o[t],a=await i(e);null!==a&&(a instanceof HTMLImageElement?n[r.uuid].push(a):n[r.uuid].push(new wa(a.data,a.width,a.height)))}}else{const t=await i(r.url);null!==t&&(n[r.uuid]=t)}}}return n}parseTextures(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const r={};if(void 0!==t)for(let i=0,o=t.length;i<o;i++){const o=t[i];let a;void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===e[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const s=e[o.image];Array.isArray(s)?(a=new Jn(s),6===s.length&&(a.needsUpdate=!0)):(a=s&&s.data?new wa(s.data,s.width,s.height):new bt(s),s&&(a.needsUpdate=!0)),a.uuid=o.uuid,void 0!==o.name&&(a.name=o.name),void 0!==o.mapping&&(a.mapping=n(o.mapping,Ac)),void 0!==o.offset&&a.offset.fromArray(o.offset),void 0!==o.repeat&&a.repeat.fromArray(o.repeat),void 0!==o.center&&a.center.fromArray(o.center),void 0!==o.rotation&&(a.rotation=o.rotation),void 0!==o.wrap&&(a.wrapS=n(o.wrap[0],Cc),a.wrapT=n(o.wrap[1],Cc)),void 0!==o.format&&(a.format=o.format),void 0!==o.type&&(a.type=o.type),void 0!==o.encoding&&(a.encoding=o.encoding),void 0!==o.minFilter&&(a.minFilter=n(o.minFilter,Lc)),void 0!==o.magFilter&&(a.magFilter=n(o.magFilter,Lc)),void 0!==o.anisotropy&&(a.anisotropy=o.anisotropy),void 0!==o.flipY&&(a.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(a.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(a.unpackAlignment=o.unpackAlignment),r[o.uuid]=a}return r}parseObject(t,e,n,r,i){let o,a,s;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function c(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];void 0===n[i]&&console.warn("THREE.ObjectLoader: Undefined material",i),e.push(n[i])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}function u(t){return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),r[t]}switch(t.type){case"Scene":o=new qo,void 0!==t.background&&(Number.isInteger(t.background)?o.background=new Je(t.background):o.background=u(t.background)),void 0!==t.environment&&(o.environment=u(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?o.fog=new Wo(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(o.fog=new Ho(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":o=new Xn(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(o.focus=t.focus),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.filmGauge&&(o.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(o.filmOffset=t.filmOffset),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"OrthographicCamera":o=new yr(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"AmbientLight":o=new _c(t.color,t.intensity);break;case"DirectionalLight":o=new vc(t.color,t.intensity);break;case"PointLight":o=new gc(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":o=new xc(t.color,t.intensity,t.width,t.height);break;case"SpotLight":o=new pc(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":o=new oc(t.color,t.groundColor,t.intensity);break;case"LightProbe":o=(new wc).fromJSON(t);break;case"SkinnedMesh":a=l(t.geometry),s=c(t.material),o=new xa(a,s),void 0!==t.bindMode&&(o.bindMode=t.bindMode),void 0!==t.bindMatrix&&o.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(o.skeleton=t.skeleton);break;case"Mesh":a=l(t.geometry),s=c(t.material),o=new Un(a,s);break;case"InstancedMesh":a=l(t.geometry),s=c(t.material);const e=t.count,n=t.instanceMatrix,r=t.instanceColor;(o=new Ia(a,s,e)).instanceMatrix=new Ea(new Float32Array(n.array),16),void 0!==r&&(o.instanceColor=new Ea(new Float32Array(r.array),r.itemSize));break;case"LOD":o=new fa;break;case"Line":o=new Ba(l(t.geometry),c(t.material));break;case"LineLoop":o=new Va(l(t.geometry),c(t.material));break;case"LineSegments":o=new ja(l(t.geometry),c(t.material));break;case"PointCloud":case"Points":o=new Xa(l(t.geometry),c(t.material));break;case"Sprite":o=new ua(c(t.material));break;case"Group":o=new Fo;break;case"Bone":o=new ba;break;default:o=new Pe}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(o.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(o.matrixAutoUpdate=t.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.quaternion&&o.quaternion.fromArray(t.quaternion),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.castShadow&&(o.castShadow=t.castShadow),void 0!==t.receiveShadow&&(o.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(o.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(o.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(o.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&o.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(o.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.frustumCulled&&(o.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(o.renderOrder=t.renderOrder),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.layers&&(o.layers.mask=t.layers),void 0!==t.children){const a=t.children;for(let t=0;t<a.length;t++)o.add(this.parseObject(a[t],e,n,r,i))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];o.animations.push(i[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(o.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],r=o.getObjectByProperty("uuid",n.object);void 0!==r&&o.addLevel(r,n.distance)}}return o}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}}))}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}},t.ObjectSpaceNormalMap=1,t.OctahedronBufferGeometry=sl,t.OctahedronGeometry=sl,t.OneFactor=201,t.OneMinusDstAlphaFactor=207,t.OneMinusDstColorFactor=209,t.OneMinusSrcAlphaFactor=205,t.OneMinusSrcColorFactor=203,t.OrthographicCamera=yr,t.PCFShadowMap=1,t.PCFSoftShadowMap=2,t.PMREMGenerator=Rr,t.ParametricBufferGeometry=ll,t.ParametricGeometry=ll,t.Particle=function(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new ua(t)},t.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Ga(t)},t.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Xa(t,e)},t.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Ga(t)},t.Path=nc,t.PerspectiveCamera=Xn,t.Plane=er,t.PlaneBufferGeometry=sr,t.PlaneGeometry=sr,t.PlaneHelper=class extends Ba{constructor(t,e=1,n=16776960){const r=n,i=new wn;i.setAttribute("position",new un([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),i.computeBoundingSphere(),super(i,new Ra({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const o=new wn;o.setAttribute("position",new un([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.add(new Un(o,new Ye({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){let e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?1:0,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}},t.PointCloud=function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Xa(t,e)},t.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Ga(t)},t.PointLight=gc,t.PointLightHelper=class extends Un{constructor(t,e,n){super(new pl(e,4,2),new Ye({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},t.Points=Xa,t.PointsMaterial=Ga,t.PolarGridHelper=class extends ja{constructor(t=10,e=16,n=8,r=64,i=4473924,o=8947848){i=new Je(i),o=new Je(o);const a=[],s=[];for(let n=0;n<=e;n++){const r=n/e*(2*Math.PI),l=Math.sin(r)*t,c=Math.cos(r)*t;a.push(0,0,0),a.push(l,0,c);const u=1&n?i:o;s.push(u.r,u.g,u.b),s.push(u.r,u.g,u.b)}for(let e=0;e<=n;e++){const l=1&e?i:o,c=t-t/n*e;for(let t=0;t<r;t++){let e=t/r*(2*Math.PI),n=Math.sin(e)*c,i=Math.cos(e)*c;a.push(n,0,i),s.push(l.r,l.g,l.b),e=(t+1)/r*(2*Math.PI),n=Math.sin(e)*c,i=Math.cos(e)*c,a.push(n,0,i),s.push(l.r,l.g,l.b)}}const l=new wn;l.setAttribute("position",new un(a,3)),l.setAttribute("color",new un(s,3)),super(l,new Ra({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}},t.PolyhedronBufferGeometry=rs,t.PolyhedronGeometry=rs,t.PositionalAudio=class extends Zc{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Xc,$c,Jc),Yc.set(0,0,1).applyQuaternion($c);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Xc.x,t),e.positionY.linearRampToValueAtTime(Xc.y,t),e.positionZ.linearRampToValueAtTime(Xc.z,t),e.orientationX.linearRampToValueAtTime(Yc.x,t),e.orientationY.linearRampToValueAtTime(Yc.y,t),e.orientationZ.linearRampToValueAtTime(Yc.z,t)}else e.setPosition(Xc.x,Xc.y,Xc.z),e.setOrientation(Yc.x,Yc.y,Yc.z)}},t.PropertyBinding=cu,t.PropertyMixer=Kc,t.QuadraticBezierCurve=Es,t.QuadraticBezierCurve3=As,t.Quaternion=At,t.QuaternionKeyframeTrack=Ul,t.QuaternionLinearInterpolant=Nl,t.REVISION=e,t.RGBADepthPacking=3201,t.RGBAFormat=E,t.RGBAIntegerFormat=1033,t.RGBA_ASTC_10x10_Format=37819,t.RGBA_ASTC_10x5_Format=37816,t.RGBA_ASTC_10x6_Format=37817,t.RGBA_ASTC_10x8_Format=37818,t.RGBA_ASTC_12x10_Format=37820,t.RGBA_ASTC_12x12_Format=37821,t.RGBA_ASTC_4x4_Format=37808,t.RGBA_ASTC_5x4_Format=37809,t.RGBA_ASTC_5x5_Format=37810,t.RGBA_ASTC_6x5_Format=37811,t.RGBA_ASTC_6x6_Format=37812,t.RGBA_ASTC_8x5_Format=37813,t.RGBA_ASTC_8x6_Format=37814,t.RGBA_ASTC_8x8_Format=37815,t.RGBA_BPTC_Format=36492,t.RGBA_ETC2_EAC_Format=B,t.RGBA_PVRTC_2BPPV1_Format=O,t.RGBA_PVRTC_4BPPV1_Format=D,t.RGBA_S3TC_DXT1_Format=P,t.RGBA_S3TC_DXT3_Format=I,t.RGBA_S3TC_DXT5_Format=R,t.RGBDEncoding=K,t.RGBEEncoding=J,t.RGBEFormat=1023,t.RGBFormat=T,t.RGBIntegerFormat=1032,t.RGBM16Encoding=Q,t.RGBM7Encoding=Y,t.RGB_ETC1_Format=36196,t.RGB_ETC2_Format=F,t.RGB_PVRTC_2BPPV1_Format=z,t.RGB_PVRTC_4BPPV1_Format=k,t.RGB_S3TC_DXT1_Format=L,t.RGFormat=1030,t.RGIntegerFormat=1031,t.RawShaderMaterial=vr,t.Ray=ie,t.Raycaster=class{constructor(t,e,n=0,r=1/0){this.ray=new ie(t,e),this.near=n,this.far=r,this.camera=null,this.layers=new ge,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}intersectObject(t,e=!1,n=[]){return yu(t,this,n,e),n.sort(gu),n}intersectObjects(t,e=!1,n=[]){for(let r=0,i=t.length;r<i;r++)yu(t[r],this,n,e);return n.sort(gu),n}},t.RectAreaLight=xc,t.RedFormat=1028,t.RedIntegerFormat=1029,t.ReinhardToneMapping=2,t.RepeatWrapping=u,t.ReplaceStencilOp=7681,t.ReverseSubtractEquation=102,t.RingBufferGeometry=cl,t.RingGeometry=cl,t.SRGB8_ALPHA8_ASTC_10x10_Format=37851,t.SRGB8_ALPHA8_ASTC_10x5_Format=37848,t.SRGB8_ALPHA8_ASTC_10x6_Format=37849,t.SRGB8_ALPHA8_ASTC_10x8_Format=37850,t.SRGB8_ALPHA8_ASTC_12x10_Format=37852,t.SRGB8_ALPHA8_ASTC_12x12_Format=37853,t.SRGB8_ALPHA8_ASTC_4x4_Format=37840,t.SRGB8_ALPHA8_ASTC_5x4_Format=37841,t.SRGB8_ALPHA8_ASTC_5x5_Format=37842,t.SRGB8_ALPHA8_ASTC_6x5_Format=37843,t.SRGB8_ALPHA8_ASTC_6x6_Format=37844,t.SRGB8_ALPHA8_ASTC_8x5_Format=37845,t.SRGB8_ALPHA8_ASTC_8x6_Format=37846,t.SRGB8_ALPHA8_ASTC_8x8_Format=37847,t.Scene=qo,t.SceneUtils=Zu,t.ShaderChunk=lr,t.ShaderLib=ur,t.ShaderMaterial=qn,t.ShadowMaterial=xl,t.Shape=rc,t.ShapeBufferGeometry=ul,t.ShapeGeometry=ul,t.ShapePath=Ic,t.ShapeUtils=tl,t.ShortType=1011,t.Skeleton=Ta,t.SkeletonHelper=Cu,t.SkinnedMesh=xa,t.SmoothShading=2,t.Sphere=Jt,t.SphereBufferGeometry=pl,t.SphereGeometry=pl,t.Spherical=class{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(ct(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}},t.SphericalHarmonics3=bc,t.SplineCurve=Cs,t.SpotLight=pc,t.SpotLightHelper=class extends Pe{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new wn,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,n=32;t<n;t++,e++){const i=t/n*Math.PI*2,o=e/n*Math.PI*2;r.push(Math.cos(i),Math.sin(i),1,Math.cos(o),Math.sin(o),1)}n.setAttribute("position",new un(r,3));const i=new Ra({fog:!1,toneMapped:!1});this.cone=new ja(n,i),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Su.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Su),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},t.Sprite=ua,t.SpriteMaterial=Jo,t.SrcAlphaFactor=204,t.SrcAlphaSaturateFactor=210,t.SrcColorFactor=202,t.StaticCopyUsage=35046,t.StaticDrawUsage=tt,t.StaticReadUsage=35045,t.StereoCamera=class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Xn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Xn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep;const n=t.projectionMatrix.clone(),r=e.eyeSep/2,i=r*e.near/e.focus,o=e.near*Math.tan(at*e.fov*.5)/e.zoom;let a,s;Uc.elements[12]=-r,Nc.elements[12]=r,a=-o*e.aspect+i,s=o*e.aspect+i,n.elements[0]=2*e.near/(s-a),n.elements[8]=(s+a)/(s-a),this.cameraL.projectionMatrix.copy(n),a=-o*e.aspect-i,s=o*e.aspect-i,n.elements[0]=2*e.near/(s-a),n.elements[8]=(s+a)/(s-a),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Uc),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Nc)}},t.StreamCopyUsage=35042,t.StreamDrawUsage=35040,t.StreamReadUsage=35041,t.StringKeyframeTrack=jl,t.SubtractEquation=101,t.SubtractiveBlending=3,t.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},t.TangentSpaceNormalMap=0,t.TetrahedronBufferGeometry=hl,t.TetrahedronGeometry=hl,t.TextBufferGeometry=dl,t.TextGeometry=dl,t.Texture=bt,t.TextureLoader=tc,t.TorusBufferGeometry=fl,t.TorusGeometry=fl,t.TorusKnotBufferGeometry=ml,t.TorusKnotGeometry=ml,t.Triangle=je,t.TriangleFanDrawMode=2,t.TriangleStripDrawMode=1,t.TrianglesDrawMode=0,t.TubeBufferGeometry=gl,t.TubeGeometry=gl,t.UVMapping=r,t.Uint16Attribute=function(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new an(t,e)},t.Uint16BufferAttribute=an,t.Uint32Attribute=function(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new ln(t,e)},t.Uint32BufferAttribute=ln,t.Uint8Attribute=function(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new nn(t,e)},t.Uint8BufferAttribute=nn,t.Uint8ClampedAttribute=function(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new rn(t,e)},t.Uint8ClampedBufferAttribute=rn,t.Uniform=du,t.UniformsLib=cr,t.UniformsUtils=Wn,t.UnsignedByteType=_,t.UnsignedInt248Type=S,t.UnsignedIntType=b,t.UnsignedShort4444Type=1017,t.UnsignedShort5551Type=1018,t.UnsignedShort565Type=1019,t.UnsignedShortType=x,t.VSMShadowMap=3,t.Vector2=gt,t.Vector3=Ct,t.Vector4=Mt,t.VectorKeyframeTrack=Vl,t.Vertex=function(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Ct(t,e,n)},t.VertexColors=2,t.VideoTexture=Ja,t.WebGL1Renderer=Go,t.WebGLCubeRenderTarget=Yn,t.WebGLMultipleRenderTargets=Tt,t.WebGLMultisampleRenderTarget=Et,t.WebGLRenderTarget=St,t.WebGLRenderTargetCube=function(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Yn(t,n)},t.WebGLRenderer=Vo,t.WebGLUtils=Do,t.WireframeGeometry=yl,t.WireframeHelper=function(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new ja(new yl(t.geometry),new Ra({color:void 0!==e?e:16777215}))},t.WrapAroundEnding=H,t.XHRLoader=function(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Jl(t)},t.ZeroCurvatureEnding=V,t.ZeroFactor=200,t.ZeroSlopeEnding=G,t.ZeroStencilOp=0,t.sRGBEncoding=X,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof r.exports?e(r.exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).THREE={}),r=r.exports;var i={};const a=.1/180*Math.PI,s=Math.atan(.75);i=i={WORLD_SIZE:1024e3,PROJECTION_WORLD_SIZE:1024e3/(6371008.8*Math.PI*2),MERCATOR_A:6371008.8,DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,EARTH_RADIUS:6371008.8,EARTH_CIRCUMFERENCE:2*Math.PI*6371008.8,EARTH_CIRCUMFERENCE_EQUATOR:40075017,FOV_ORTHO:a,FOV:s,FOV_DEGREES:180*s/Math.PI,TILE_SIZE:512};var l={};function c(){}c.prototype={Coords:function(t){if(t.constructor===Array)if(t.length<2)console.error("Coords length must be at least 2");else{for(const e of t)if(e.constructor!==Number)return void console.error("Coords values must be numbers");if(!(Math.abs(t[1])>90))return t;console.error("Latitude must be between -90 and 90")}else console.error("Coords must be an array")},Line:function(t){if(t.constructor===Array){for(const e of t)if(!this.Coords(e))return void console.error("Each coordinate in a line must be a valid Coords type");return t}console.error("Line must be an array")},Rotation:function(t){if(t.constructor===Number)t={z:t};else{if(t.constructor!==Object)return void console.error("Rotation must be an object or a number");for(const e of Object.keys(t)){if(!["x","y","z"].includes(e))return void console.error("Rotation parameters must be x, y, or z");if(t[e].constructor!==Number)return void console.error("Individual rotation values must be numbers")}}return t},Scale:function(t){if(t.constructor===Number)t={x:t,y:t,z:t};else{if(t.constructor!==Object)return void console.error("Scale must be an object or a number");for(const e of Object.keys(t)){if(!["x","y","z"].includes(e))return void console.error("Scale parameters must be x, y, or z");if(t[e].constructor!==Number)return void console.error("Individual scale values must be numbers")}}return t}},l=l=c;var u={},p={prettyPrintMatrix:function(t){for(var e=0;e<4;e++){var n=[t[e],t[e+4],t[e+8],t[e+12]];console.log(n.map((function(t){return t.toFixed(4)})))}},makePerspectiveMatrix:function(t,e,n,i){var o=new r.Matrix4,a=1/Math.tan(t/2),s=1/(n-i),l=[a/e,0,0,0,0,a,0,0,0,0,(i+n)*s,-1,0,0,2*i*n*s,0];return o.elements=l,o},makeOrthographicMatrix:function(t,e,n,i,o,a){var s=new r.Matrix4;const l=1/(e-t),c=1/(n-i),u=1/(a-o);var p=[2*l,0,0,0,0,2*c,0,0,0,0,-1*u,0,-(e+t)*l,-(n+i)*c,-o*u,1];return s.elements=p,s},radify:function(t){function e(t){return t=t||0,2*Math.PI*t/360}return"object"==typeof t?t.length>0?t.map((function(t){return e(t)})):[e(t.x),e(t.y),e(t.z)]:e(t)},degreeify:function(t){function e(t){return 360*(t=t||0)/(2*Math.PI)}return"object"==typeof t?[e(t.x),e(t.y),e(t.z)]:e(t)},projectToWorld:function(t){var e=[-i.MERCATOR_A*i.DEG2RAD*t[0]*i.PROJECTION_WORLD_SIZE,-i.MERCATOR_A*Math.log(Math.tan(.25*Math.PI+.5*i.DEG2RAD*t[1]))*i.PROJECTION_WORLD_SIZE];if(t[2]){var n=this.projectedUnitsPerMeter(t[1]);e.push(t[2]*n)}else e.push(0);return new r.Vector3(e[0],e[1],e[2])},projectedUnitsPerMeter:function(t){return Math.abs(i.WORLD_SIZE/Math.cos(i.DEG2RAD*t)/i.EARTH_CIRCUMFERENCE)},_circumferenceAtLatitude:function(t){return i.EARTH_CIRCUMFERENCE*Math.cos(t*Math.PI/180)},mercatorZfromAltitude:function(t,e){return t/this._circumferenceAtLatitude(e)},_scaleVerticesToMeters:function(t,e){for(var n=this.projectedUnitsPerMeter(t[1]),r=(this.projectToWorld(t),0);r<e.length;r++)e[r].multiplyScalar(n);return e},projectToScreen:function(t){console.log("WARNING: Projecting to screen coordinates is not yet implemented")},unprojectFromScreen:function(t){console.log("WARNING: unproject is not yet implemented")},unprojectFromWorld:function(t){var e=[-t.x/(i.MERCATOR_A*i.DEG2RAD*i.PROJECTION_WORLD_SIZE),2*(Math.atan(Math.exp(t.y/(i.PROJECTION_WORLD_SIZE*-i.MERCATOR_A)))-Math.PI/4)/i.DEG2RAD],n=this.projectedUnitsPerMeter(e[1]),r=t.z||0;return e.push(r/n),e},toScreenPosition:function(t,e){var n=new r.Vector3,i=.5*renderer.context.canvas.width,o=.5*renderer.context.canvas.height;return t.updateMatrixWorld(),n.setFromMatrixPosition(t.matrixWorld),n.project(e),n.x=n.x*i+i,n.y=-n.y*o+o,{x:n.x,y:n.y}},getFeatureCenter:function(t,e,n){let r=[],i=0,o=0,a=0,s=[...t.geometry.coordinates[0]];return"Point"===t.geometry.type?r=[...s[0]]:("MultiPolygon"===t.geometry.type&&(s=s[0]),s.splice(-1,1),s.forEach((function(t){i+=t[0],o+=t[1]})),r=[i/s.length,o/s.length]),a=this.getObjectHeightOnFloor(t,e,n),r.length<3?r.push(a):r[2]=a,r},getObjectHeightOnFloor:function(t,e,n=t.properties.level||0){let r=n*(t.properties.levelHeight||0),i=t.properties.base_height||t.properties.min_height||0;return r+((e&&e.model?0:t.properties.height-i)+i)},_flipMaterialSides:function(t){},normalizeVertices(t){let e=new r.BufferGeometry,n=[];for(var i=0;i<t.length;i++){let e=t[i];n.push(e.x,e.y,e.z),n.push(e.x,e.y,e.z)}e.setAttribute("position",new r.BufferAttribute(new Float32Array(n),3)),e.computeBoundingSphere();var o=e.boundingSphere.center;return{vertices:t.map((function(t){return t.sub(o)})),position:o}},flattenVectors(t){var e=[];for(let n of t)e.push(n.x,n.y,n.z);return e},lnglatsToWorld:function(t){return t.map((function(t){var e=p.projectToWorld(t);return new r.Vector3(e.x,e.y,e.z)}))},extend:function(t,e){for(let n in e)t[n]=e[n]},clone:function(t){var e={};for(let n in t)e[n]=t[n];return e},clamp:function(t,e,n){return Math.min(n,Math.max(e,t))},types:{rotation:function(t,e){t||(t=0),"number"==typeof t&&(t={z:t});var n=this.applyDefault([t.x,t.y,t.z],e);return p.radify(n)},scale:function(t,e){return t||(t=1),"number"==typeof t?[t,t,t]:this.applyDefault([t.x,t.y,t.z],e)},applyDefault:function(t,e){return t.map((function(t,n){return t||e[n]}))}},toDecimal:function(t,e){return Number(t.toFixed(e))},equal:function(t,e){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;if(0==n.length&&0==r.length&&n!==r)return!1;for(const r of n){const n=t[r],i=e[r],o=this.isObject(n)&&this.isObject(i);if(o&&!equal(n,i)||!o&&n!==i)return!1}return!0},isObject:function(t){return null!=t&&"object"==typeof t},curveToLine:(t,e)=>{let{width:n,color:i}=e,o=(new r.BufferGeometry).setFromPoints(t.getPoints(100)),a=new r.LineBasicMaterial({color:i,linewidth:n});return new r.Line(o,a)},curvesToLines:t=>{var e=[16711680,2031360,2490623];return t.map(((t,n)=>curveToLine(t,{width:3,color:e[n]||"purple"})))},_validate:function(t,e){t=t||{};var n={};p.extend(n,t);for(let r of Object.keys(e))if(void 0===t[r]){if(null===e[r])return void console.error(r+" is required");n[r]=e[r]}else n[r]=t[r];return n},Validator:new l,exposedMethods:["projectToWorld","projectedUnitsPerMeter","extend","unprojectFromWorld"]};u=u=p;var h={};function d(t,e,n){this.map=t,this.camera=e,this.active=!0,this.camera.matrixAutoUpdate=!1,this.world=n||new r.Group,this.world.position.x=this.world.position.y=i.WORLD_SIZE/2,this.world.matrixAutoUpdate=!1,this.state={translateCenter:(new r.Matrix4).makeTranslation(i.WORLD_SIZE/2,-i.WORLD_SIZE/2,0),worldSizeRatio:i.TILE_SIZE/i.WORLD_SIZE,worldSize:i.TILE_SIZE*this.map.transform.scale};let o=this;this.map.on("move",(function(){o.updateCamera()})).on("resize",(function(){o.setupCamera()})),this.setupCamera()}d.prototype={setupCamera:function(){const t=this.map.transform;this.camera.aspect=t.width/t.height,this.halfFov=t._fov/2,this.cameraToCenterDistance=.5/Math.tan(this.halfFov)*t.height;const e=t._maxPitch*Math.PI/180;this.acuteAngle=Math.PI/2-e,this.updateCamera()},updateCamera:function(t){if(!this.camera)return void console.log("nocamera");const e=this.map.transform;this.camera.aspect=e.width/e.height;const n=e.centerOffset||new r.Vector3;let i=0,o=0;this.halfFov=e._fov/2;const a=Math.PI/2+e._pitch,s=Math.cos(Math.PI/2-e._pitch);this.cameraToCenterDistance=.5/Math.tan(this.halfFov)*e.height;let l=1;const c=this.worldSize();if(this.map.tb.mapboxVersion>=2){l=this.mercatorZfromAltitude(1,e.center.lat)*c;const t=e._fov*(.5+e.centerOffset.y/e.height),n=e.elevation?e.elevation.getMinElevationBelowMSL()*l:0,r=(e._camera.position[2]*c-n)/Math.cos(e._pitch);o=s*(Math.sin(t)*r/Math.sin(u.clamp(Math.PI-a-t,.01,Math.PI-.01)))+r;const p=r*(1/e._horizonShift);i=Math.min(1.01*o,p)}else i=1.01*(o=s*(Math.sin(this.halfFov)*this.cameraToCenterDistance/Math.sin(Math.PI-a-this.halfFov))+this.cameraToCenterDistance);this.cameraTranslateZ=(new r.Matrix4).makeTranslation(0,0,this.cameraToCenterDistance);const p=e.height/50,h=Math.max(p*s,p),f=e.height,m=e.width;this.camera instanceof r.OrthographicCamera?this.camera.projectionMatrix=u.makeOrthographicMatrix(m/-2,m/2,f/2,f/-2,h,i):this.camera.projectionMatrix=u.makePerspectiveMatrix(e._fov,m/f,h,i),this.camera.projectionMatrix.elements[8]=2*-n.x/e.width,this.camera.projectionMatrix.elements[9]=2*n.y/e.height;let g=this.calcCameraMatrix(e._pitch,e.angle);e.elevation&&(g.elements[14]=e._camera.position[2]*c),this.camera.matrixWorld.copy(g);let y=e.scale*this.state.worldSizeRatio,v=new r.Matrix4,_=new r.Matrix4,x=new r.Matrix4;v.makeScale(y,y,y);let b=e.x||e.point.x,w=e.y||e.point.y;_.makeTranslation(-b,w,0),x.makeRotationZ(Math.PI),this.world.matrix=(new r.Matrix4).premultiply(x).premultiply(this.state.translateCenter).premultiply(v).premultiply(_),this.map.fire("CameraSynced",{detail:{nearZ:h,farZ:i,pitch:e._pitch,angle:e.angle,furthestDistance:o,cameraToCenterDistance:this.cameraToCenterDistance,t:this.map.transform,tbProjMatrix:this.camera.projectionMatrix.elements,tbWorldMatrix:this.world.matrix.elements,cameraSyn:d}})},worldSize(){let t=this.map.transform;return t.tileSize*t.scale},worldSizeFromZoom(){let t=this.map.transform;return Math.pow(2,t.zoom)*t.tileSize},mercatorZfromAltitude(t,e){return t/this.circumferenceAtLatitude(e)},mercatorZfromZoom(){return this.cameraToCenterDistance/this.worldSizeFromZoom()},circumferenceAtLatitude:t=>i.EARTH_CIRCUMFERENCE*Math.cos(t*Math.PI/180),calcCameraMatrix(t,e,n){const i=this.map.transform,o=void 0===t?i._pitch:t,a=void 0===e?i.angle:e,s=void 0===n?this.cameraTranslateZ:n;return(new r.Matrix4).premultiply(s).premultiply((new r.Matrix4).makeRotationX(o)).premultiply((new r.Matrix4).makeRotationZ(a))},updateCameraState(){let t=this.map.transform;if(!t.height)return;const e=t._camera.forward(),n=t.cameraToCenterDistance,r=t.point,i=(t._cameraZoom?t._cameraZoom:t._zoom,this.mercatorZfromZoom(t)-this.mercatorZfromAltitude(t._centerAltitude,t.center.lat)),o=t.cameraToCenterDistance/i;return[r.x/this.worldSize()-e[0]*n/o,r.y/this.worldSize()-e[1]*n/o,this.mercatorZfromAltitude(t._centerAltitude,t._center.lat)+-e[2]*n/o]},getWorldToCamera(t,e){let n=this.map.transform;const i=new r.Matrix4,o=new r.Matrix4,a=n._camera._orientation,s=n._camera.position,l=new r.Vector3(s[0],s[1],s[2]),c=new r.Quaternion;c.set(a[0],a[1],a[2],a[3]);const u=c.conjugate();return l.multiplyScalar(-t),o.makeTranslation(l.x,l.y,l.z),i.makeRotationFromQuaternion(u).premultiply(o),i.elements[1]*=-1,i.elements[5]*=-1,i.elements[9]*=-1,i.elements[13]*=-1,i.elements[8]*=e,i.elements[9]*=e,i.elements[10]*=e,i.elements[11]*=e,i},translate(t,e,n){let r,i,o,a,s,l,c,u,p,h,d,f,m=n[0]||n.x,g=n[1]||n.y,y=n[2]||n.z;return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*y+e[12],t[13]=e[1]*m+e[5]*g+e[9]*y+e[13],t[14]=e[2]*m+e[6]*g+e[10]*y+e[14],t[15]=e[3]*m+e[7]*g+e[11]*y+e[15]):(r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],p=e[8],h=e[9],d=e[10],f=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=c,t[7]=u,t[8]=p,t[9]=h,t[10]=d,t[11]=f,t[12]=r*m+s*g+p*y+e[12],t[13]=i*m+l*g+h*y+e[13],t[14]=o*m+c*g+d*y+e[14],t[15]=a*m+u*g+f*y+e[15]),t}},h=h=d;var f={};!function(){"use strict";var t=Math.PI,e=Math.sin,n=Math.cos,r=Math.tan,i=Math.asin,o=Math.atan2,a=Math.acos,s=t/180;function l(t){return t.valueOf()/864e5-.5+2440588}function c(t){return new Date(864e5*(t+.5-2440588))}function u(t){return l(t)-2451545}var p=23.4397*s;function h(t,i){return o(e(t)*n(p)-r(i)*e(p),n(t))}function d(t,r){return i(e(r)*n(p)+n(r)*e(p)*e(t))}function m(t,i,a){return o(e(t),n(t)*e(i)-r(a)*n(i))}function g(t,r,o){return i(e(r)*e(o)+n(r)*n(o)*n(t))}function y(t,e){return s*(280.16+360.9856235*t)-e}function v(t){return s*(357.5291+.98560028*t)}function _(n){return n+s*(1.9148*e(n)+.02*e(2*n)+3e-4*e(3*n))+102.9372*s+t}function x(t){var e=_(v(t));return{dec:d(e,0),ra:h(e,0)}}var b={getPosition:function(t,e,n){var r=s*-n,i=s*e,o=u(t),a=x(o),l=y(o,r)-a.ra;return{azimuth:m(l,i,a.dec),altitude:g(l,i,a.dec)}},toJulian:function(t){return l(t)}},w=b.times=[[-.833,"sunrise","sunset"],[-.3,"sunriseEnd","sunsetStart"],[-6,"dawn","dusk"],[-12,"nauticalDawn","nauticalDusk"],[-18,"nightEnd","night"],[6,"goldenHourEnd","goldenHour"]];b.addTime=function(t,e,n){w.push([t,e,n])};function M(e,n,r){return 9e-4+(e+n)/(2*t)+r}function S(t,n,r){return 2451545+t+.0053*e(n)-.0069*e(2*r)}function T(t,r,i,o,s,l,c){return S(M(function(t,r,i){return a((e(t)-e(r)*e(i))/(n(r)*n(i)))}(t,i,o),r,s),l,c)}function E(t){var r=s*(134.963+13.064993*t),i=s*(93.272+13.22935*t),o=s*(218.316+13.176396*t)+6.289*s*e(r),a=5.128*s*e(i),l=385001-20905*n(r);return{ra:h(o,a),dec:d(o,a),dist:l}}function A(t,e){return new Date(t.valueOf()+864e5*e/24)}b.getTimes=function(e,n,r,i){var o,a,l,p,h,f=s*-r,m=s*n,g=function(t){return-2.076*Math.sqrt(t)/60}(i=i||0),y=function(e,n){return Math.round(e-9e-4-n/(2*t))}(u(e),f),x=M(0,f,y),b=v(x),E=_(b),A=d(E,0),C=S(x,b,E),L={solarNoon:c(C),nadir:c(C-.5)};for(o=0,a=w.length;o<a;o+=1)h=C-((p=T(((l=w[o])[0]+g)*s,f,m,A,y,b,E))-C),L[l[1]]=c(h),L[l[2]]=c(p);return L},b.getMoonPosition=function(t,i,a){var l=s*-a,c=s*i,p=u(t),h=E(p),d=y(p,l)-h.ra,f=g(d,c,h.dec),v=o(e(d),r(c)*n(h.dec)-e(h.dec)*n(d));return f+=function(t){return t<0&&(t=0),2967e-7/Math.tan(t+.00312536/(t+.08901179))}(f),{azimuth:m(d,c,h.dec),altitude:f,distance:h.dist,parallacticAngle:v}},b.getMoonIllumination=function(t){var r=u(t||new Date),i=x(r),s=E(r),l=a(e(i.dec)*e(s.dec)+n(i.dec)*n(s.dec)*n(i.ra-s.ra)),c=o(149598e3*e(l),s.dist-149598e3*n(l)),p=o(n(i.dec)*e(i.ra-s.ra),e(i.dec)*n(s.dec)-n(i.dec)*e(s.dec)*n(i.ra-s.ra));return{fraction:(1+n(c))/2,phase:.5+.5*c*(p<0?-1:1)/Math.PI,angle:p}},b.getMoonTimes=function(t,e,n,r){var i=new Date(t);r?i.setUTCHours(0,0,0,0):i.setHours(0,0,0,0);for(var o,a,l,c,u,p,h,d,f,m,g,y,v,_=.133*s,x=b.getMoonPosition(i,e,n).altitude-_,w=1;w<=24&&(o=b.getMoonPosition(A(i,w),e,n).altitude-_,d=((u=(x+(a=b.getMoonPosition(A(i,w+1),e,n).altitude-_))/2-o)*(h=-(p=(a-x)/2)/(2*u))+p)*h+o,m=0,(f=p*p-4*u*o)>=0&&(g=h-(v=Math.sqrt(f)/(2*Math.abs(u))),y=h+v,Math.abs(g)<=1&&m++,Math.abs(y)<=1&&m++,g<-1&&(g=y)),1===m?x<0?l=w+g:c=w+g:2===m&&(l=w+(d<0?y:g),c=w+(d<0?g:y)),!l||!c);w+=2)x=a;var M={};return l&&(M.rise=A(i,l)),c&&(M.set=A(i,c)),l||c||(M[d>0?"alwaysUp":"alwaysDown"]=!0),M},f=f=b}();var m={},g={material:"MeshBasicMaterial",color:"black",opacity:1};m=m=function(t){var e;function n(){return new r[g.material]({color:g.color})}return t?((e=(t=u._validate(t,g)).material&&t.material.isMaterial?t.material:t.material||t.color||t.opacity?new r[t.material]({color:t.color,transparent:t.opacity<1}):n()).opacity=t.opacity,t.side&&(e.side=t.side)):e=n(),e};var y={};function v(t){this.map=t,this.enrolledObjects=[],this.previousFrameTime}v.prototype={unenroll:function(t){this.enrolledObjects.splice(this.enrolledObjects.indexOf(t),1)},enroll:function(t){if(t.clock=new r.Clock,t.hasDefaultAnimation=!1,t.defaultAction,t.actions=[],t.mixer,t.animations&&t.animations.length>0){t.hasDefaultAnimation=!0;let n=t.userData.defaultAnimation?t.userData.defaultAnimation:0;t.mixer=new r.AnimationMixer(t),e(n)}function e(e){for(let n=0;n<t.animations.length;n++){e>t.animations.length&&console.log("The animation index "+e+" doesn't exist for this object");let r=t.animations[n],i=t.mixer.clipAction(r);t.actions.push(i),e===n?(t.defaultAction=i,i.setEffectiveWeight(1)):i.setEffectiveWeight(0),i.play()}}let n=!1;Object.defineProperty(t,"isPlaying",{get:()=>n,set(e){n!=e&&(n=e,t.dispatchEvent({type:"IsPlayingChanged",detail:t}))}}),this.enrolledObjects.push(t),t.animationQueue=[],t.set=function(e){if(e.duration>0){let n={start:Date.now(),expiration:Date.now()+e.duration,endState:{}};u.extend(e,n);let i=e.coords,o=e.rotation,a=e.scale||e.scaleX||e.scaleY||e.scaleZ;if(o){let n=t.rotation;e.startRotation=[n.x,n.y,n.z],e.endState.rotation=u.types.rotation(e.rotation,e.startRotation),e.rotationPerMs=e.endState.rotation.map((function(t,n){return(t-e.startRotation[n])/e.duration}))}if(a){let n=t.scale;e.startScale=[n.x,n.y,n.z],e.endState.scale=u.types.scale(e.scale,e.startScale),e.scalePerMs=e.endState.scale.map((function(t,n){return(t-e.startScale[n])/e.duration}))}i&&(e.pathCurve=new r.CatmullRomCurve3(u.lnglatsToWorld([t.coordinates,e.coords])));let s={type:"set",parameters:e};this.animationQueue.push(s),tb.map.repaint=!0}else this.stop(),e.rotation=u.radify(e.rotation),this._setObject(e);return this},t.animationMethod=null,t.stop=function(e){return t.mixer&&(t.isPlaying=!1,cancelAnimationFrame(t.animationMethod)),this.animationQueue=[],this},t.followPath=function(t,e){let n={type:"followPath",parameters:u._validate(t,_.followPath)};return u.extend(n.parameters,{pathCurve:new r.CatmullRomCurve3(u.lnglatsToWorld(t.path)),start:Date.now(),expiration:Date.now()+n.parameters.duration,cb:e}),this.animationQueue.push(n),tb.map.repaint=!0,this},t._setObject=function(e){t.setScale();let n=e.position,i=e.rotation,o=e.scale,a=e.worldCoordinates,s=e.quaternion,l=e.translate,c=e.worldTranslate;if(n){this.coordinates=n;let t=u.projectToWorld(n);this.position.copy(t)}if(l){this.coordinates=[this.coordinates[0]+l[0],this.coordinates[1]+l[1],this.coordinates[2]+l[2]];let t=u.projectToWorld(l);this.position.copy(t),e.position=this.coordinates}if(c){this.translateX(c.x),this.translateY(c.y),this.translateZ(c.z);let t=u.unprojectFromWorld(this.position);this.coordinates=e.position=t}if(i&&(this.rotation.set(i[0],i[1],i[2]),e.rotation=new r.Vector3(i[0],i[1],i[2])),o&&(this.scale.set(o[0],o[1],o[2]),e.scale=this.scale),s&&(this.quaternion.setFromAxisAngle(s[0],s[1]),e.rotation=s[0].multiplyScalar(s[1])),a){this.position.copy(a);let t=u.unprojectFromWorld(a);this.coordinates=e.position=t}this.setBoundingBoxShadowFloor(),this.setReceiveShadowFloor(),this.updateMatrixWorld(),tb.map.repaint=!0;let p={type:"ObjectChanged",detail:{object:this,action:{position:e.position,rotation:e.rotation,scale:e.scale}}};this.dispatchEvent(p)},t.playDefault=function(e){if(t.mixer&&t.hasDefaultAnimation){let n={start:Date.now(),expiration:Date.now()+e.duration,endState:{}};u.extend(e,n),t.mixer.timeScale=e.speed||1;let r={type:"playDefault",parameters:e};return this.animationQueue.push(r),tb.map.repaint=!0,this}},t.playAnimation=function(n){t.mixer&&(n.animation&&e(n.animation),t.playDefault(n))},t.pauseAllActions=function(){t.mixer&&t.actions.forEach((function(t){t.paused=!0}))},t.unPauseAllActions=function(){t.mixer&&t.actions.forEach((function(t){t.paused=!1}))},t.deactivateAllActions=function(){t.mixer&&t.actions.forEach((function(t){t.stop()}))},t.activateAllActions=function(){t.mixer&&t.actions.forEach((function(t){t.play()}))},t.idle=function(){return t.mixer&&t.mixer.update(.01),tb.map.repaint=!0,this}},update:function(t){if(void 0===this.previousFrameTime&&(this.previousFrameTime=t),!this.enrolledObjects)return!1;for(let e=this.enrolledObjects.length-1;e>=0;e--){let n=this.enrolledObjects[e];if(n.animationQueue&&0!==n.animationQueue.length)for(let e=n.animationQueue.length-1;e>=0;e--){let i=n.animationQueue[e];if(!i)continue;let o=i.parameters;if(!o.expiration)return n.animationQueue.splice(e,1),void(n.animationQueue[e]&&(n.animationQueue[e].parameters.start=t));if(t>=o.expiration)o.expiration=!1,"playDefault"===i.type?n.stop():(o.endState&&n._setObject(o.endState),void 0!==o.cb&&o.cb());else{let e=(t-o.start)/o.duration;if("set"===i.type){let t={};o.pathCurve&&(t.worldCoordinates=o.pathCurve.getPoint(e)),o.rotationPerMs&&(t.rotation=o.startRotation.map((function(t,n){return t+o.rotationPerMs[n]*e*o.duration}))),o.scalePerMs&&(t.scale=o.startScale.map((function(t,n){return t+o.scalePerMs[n]*e*o.duration}))),n._setObject(t)}if("followPath"===i.type){let t={worldCoordinates:o.pathCurve.getPointAt(e)};if(o.trackHeading){let n=o.pathCurve.getTangentAt(e).normalize(),i=new r.Vector3(0,0,0),a=new r.Vector3(0,1,0);i.crossVectors(a,n).normalize();let s=Math.acos(a.dot(n));t.quaternion=[i,s]}n._setObject(t)}"playDefault"===i.type&&(n.activateAllActions(),n.isPlaying=!0,n.animationMethod=requestAnimationFrame(this.update),n.mixer.update(n.clock.getDelta()),tb.map.repaint=!0)}}}this.previousFrameTime=t}};const _={followPath:{path:null,duration:1e3,trackHeading:!0}};y=y=v;var x={};!function(){class t extends r.Object3D{constructor(t){super(),this.element=t||document.createElement("div"),this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.alwaysVisible=!1,Object.defineProperty(this,"layer",{get(){return this.parent&&this.parent.parent?this.parent.parent.layer:null}}),this.dispose=function(){this.remove(),this.element=null},this.remove=function(){this.element instanceof Element&&null!==this.element.parentNode&&this.element.parentNode.removeChild(this.element)},this.addEventListener("removed",(function(){this.remove()}))}copy(t,e){return super.copy(t,e),this.element=t.element.cloneNode(!0),this}}t.prototype.isCSS2DObject=!0;const e=new r.Vector3,n=new r.Matrix4,i=new r.Matrix4,o=new r.Vector3,a=new r.Vector3;r.CSS2DObject=t,r.CSS2DRenderer=class{constructor(){const t=this;let r,s,l,c;const u={objects:new WeakMap,list:new Map};this.cacheList=u.list;const p=document.createElement("div");p.style.overflow="hidden",this.domElement=p,this.getSize=function(){return{width:r,height:s}},this.render=function(r,s){!0===r.autoUpdate&&r.updateMatrixWorld(),null===s.parent&&s.updateMatrixWorld(),n.copy(s.matrixWorldInverse),i.multiplyMatrices(s.projectionMatrix,n),function n(r,s,h){if(r.isCSS2DObject)if(r.visible){r.onBeforeRender(t,s,h),e.setFromMatrixPosition(r.matrixWorld),e.applyMatrix4(i);const n=r.element;var d;d=/apple/i.test(navigator.vendor)?"translate(-50%,-50%) translate("+Math.round(e.x*l+l)+"px,"+Math.round(-e.y*c+c)+"px)":"translate(-50%,-50%) translate("+(e.x*l+l)+"px,"+(-e.y*c+c)+"px)",n.style.WebkitTransform=d,n.style.MozTransform=d,n.style.oTransform=d,n.style.transform=d,n.style.display=r.visible&&e.z>=-1&&e.z<=1?"":"none";const g={distanceToCameraSquared:(f=h,m=r,o.setFromMatrixPosition(f.matrixWorld),a.setFromMatrixPosition(m.matrixWorld),o.distanceToSquared(a))};u.objects.set({key:r.uuid},g),u.list.set(r.uuid,r),n.parentNode!==p&&p.appendChild(n),r.onAfterRender(t,s,h)}else u.objects.delete({key:r.uuid}),u.list.delete(r.uuid),r.remove();var f,m;for(let t=0,e=r.children.length;t<e;t++)n(r.children[t],s,h)}(r,r,s),function(t){const e=function(t){const e=[];return t.traverse((function(t){t.isCSS2DObject&&e.push(t)})),e}(t).sort((function(t,e){let n=u.objects.get({key:t.uuid}),r=u.objects.get({key:e.uuid});if(n&&r)return n.distanceToCameraSquared-r.distanceToCameraSquared})),n=e.length;for(let t=0,r=e.length;t<r;t++)e[t].element.style.zIndex=n-t}(r)},this.setSize=function(t,e){l=(r=t)/2,c=(s=e)/2,p.style.width=t+"px",p.style.height=e+"px"}}}}(),x=x={CSS2DRenderer:r.CSS2DRenderer,CSS2DObject:r.CSS2DObject};var b={};const w=r;function M(){}M.prototype={line:function(t){t=u._validate(t,this._defaults.line);var e=u.lnglatsToWorld(t.geometry),n=u.normalizeVertices(e),r=u.flattenVectors(n.vertices),i=new Float32Array(r),o=new w.BufferGeometry;o.setAttribute("position",new w.BufferAttribute(i,3));var a=new w.LineBasicMaterial({color:16711680,linewidth:21}),s=new w.Line(o,a);return s.options=options||{},s.position.copy(n.position),s},extrusion:function(t){},unenroll:function(t,e){e||this.animationManager.unenroll(t)},_addMethods:function(t,e){var n=this;if(e);else{function r(t,e,n,r){let i=u.radify(r);t.position.sub(e),t.position.applyAxisAngle(n,i),t.position.add(e),t.rotateOnAxis(n,i),tb.map.repaint=!0}t.coordinates||(t.coordinates=[0,0,0]),Object.defineProperty(t,"model",{get:()=>t.getObjectByName("model")}),Object.defineProperty(t,"animations",{get(){const e=t.model;return e?e.animations:null}}),n.animationManager.enroll(t),t.setCoords=function(e){return t.userData.topMargin&&t.userData.feature&&(e[2]+=((t.userData.feature.properties.height||0)-(t.userData.feature.properties.base_height||t.userData.feature.properties.min_height||0))*(t.userData.topMargin||0)),t.coordinates=e,t.set({position:e}),t},t.setTranslate=function(e){return t.set({translate:e}),t},t.setRotation=function(e){"number"==typeof e&&(e={z:e});var n={x:u.radify(e.x)||t.rotation.x,y:u.radify(e.y)||t.rotation.y,z:u.radify(e.z)||t.rotation.z};t._setObject({rotation:[n.x,n.y,n.z]})},t.calculateAdjustedPosition=function(e,n,r){let i=e.slice(),o=u.unprojectFromWorld(t.modelSize);return r?(i[0]-=0!=n.x?o[0]/n.x:0,i[1]-=0!=n.y?o[1]/n.y:0,i[2]-=0!=n.z?o[2]/n.z:0):(i[0]+=0!=n.x?o[0]/n.x:0,i[1]+=0!=n.y?o[1]/n.y:0,i[2]+=0!=n.z?o[2]/n.z:0),i},t.setRotationAxis=function(e){"number"==typeof e&&(e={z:e});let n=t.modelBox(),i=new w.Vector3(n.max.x,n.max.y,n.min.z);0!=e.x&&r(t,i,new w.Vector3(0,0,1),e.x),0!=e.y&&r(t,i,new w.Vector3(0,0,1),e.y),0!=e.z&&r(t,i,new w.Vector3(0,0,1),e.z)},Object.defineProperty(t,"scaleGroup",{get:()=>t.getObjectByName("scaleGroup")}),Object.defineProperty(t,"boxGroup",{get:()=>t.getObjectByName("boxGroup")}),Object.defineProperty(t,"boundingBox",{get:()=>t.getObjectByName("boxModel")}),Object.defineProperty(t,"boundingBoxShadow",{get:()=>t.getObjectByName("boxShadow")}),t.drawBoundingBox=function(){let e=t.box3(),n=new w.Group;n.name="boxGroup",n.updateMatrixWorld(!0);let r=new w.Box3Helper(e,M.prototype._defaults.colors.yellow);r.name="boxModel",n.add(r),r.layers.disable(0);let i=e.clone();i.max.z=i.min.z;let o=new w.Box3Helper(i,M.prototype._defaults.colors.black);o.name="boxShadow",n.add(o),o.layers.disable(0),n.visible=!1,t.scaleGroup.add(n),t.setBoundingBoxShadowFloor()},t.setBoundingBoxShadowFloor=function(){if(t.boundingBoxShadow){let e=-t.modelHeight,n=t.rotation,r=t.boundingBoxShadow;r.box.max.z=r.box.min.z=e,r.rotation.y=n.y,r.rotation.x=-n.x}},t.setAnchor=function(e){const n=t.box3(),r=n.getCenter(new w.Vector3);switch(t.none={x:0,y:0,z:0},t.center={x:r.x,y:r.y,z:n.min.z},t.bottom={x:r.x,y:n.max.y,z:n.min.z},t.bottomLeft={x:n.max.x,y:n.max.y,z:n.min.z},t.bottomRight={x:n.min.x,y:n.max.y,z:n.min.z},t.top={x:r.x,y:n.min.y,z:n.min.z},t.topLeft={x:n.max.x,y:n.min.y,z:n.min.z},t.topRight={x:n.min.x,y:n.min.y,z:n.min.z},t.left={x:n.max.x,y:r.y,z:n.min.z},t.right={x:n.min.x,y:r.y,z:n.min.z},e){case"center":t.anchor=t.center;break;case"top":t.anchor=t.top;break;case"top-left":t.anchor=t.topLeft;break;case"top-right":t.anchor=t.topRight;break;case"left":t.anchor=t.left;break;case"right":t.anchor=t.right;break;case"bottom":t.anchor=t.bottom;break;case"bottom-left":default:t.anchor=t.bottomLeft;break;case"bottom-right":t.anchor=t.bottomRight;break;case"auto":case"none":t.anchor=t.none}t.model.position.set(-t.anchor.x,-t.anchor.y,-t.anchor.z)},t.setCenter=function(e){if(e&&(0!=e.x||0!=e.y||0!=e.z)){let n=t.getSize();t.anchor={x:t.anchor.x-n.x*e.x,y:t.anchor.y-n.y*e.y,z:t.anchor.z-n.z*e.z},t.model.position.set(-t.anchor.x,-t.anchor.y,-t.anchor.z)}},Object.defineProperty(t,"label",{get:()=>t.getObjectByName("label")}),Object.defineProperty(t,"tooltip",{get:()=>t.getObjectByName("tooltip")}),Object.defineProperty(t,"help",{get:()=>t.getObjectByName("help")});let o=!1;Object.defineProperty(t,"hidden",{get:()=>o,set(e){o!=e&&(o=e,t.visibility=!o)}}),Object.defineProperty(t,"visibility",{get:()=>t.visible,set(e){let n=e;if("visible"==e||1==e)n=!0,t.label&&(t.label.visible=n);else{if("none"!=e&&0!=e)return;n=!1,t.label&&t.label.alwaysVisible&&(t.label.visible=n),t.tooltip&&(t.tooltip.visible=n)}if(t.visible!=n){if(t.hidden&&n)return;t.visible=n,t.model&&t.model.traverse((function(e){"Mesh"!=e.type&&"SkinnedMesh"!=e.type||(n&&t.raycasted?e.layers.enable(0):e.layers.disable(0)),"LineSegments"==e.type&&e.layers.disableAll()}))}}}),t.addLabel=function(e,n,r,i){e&&t.drawLabelHTML(e,n,r,i)},t.removeLabel=function(){t.removeCSS2D("label")},t.drawLabelHTML=function(e,r=!1,i=t.anchor,o=.5){let a=n.drawLabelHTML(e,M.prototype._defaults.label.cssClass),s=t.addCSS2D(a,"label",i,o);return s.alwaysVisible=r,s.visible=r,s},t.addTooltip=function(e,n,r,i=!0,o=1){let a=t.addHelp(e,"tooltip",n,r,o);a.visible=!1,a.custom=i},t.removeTooltip=function(){t.removeCSS2D("tooltip")},t.addHelp=function(e,r="help",i=!1,o=t.anchor,a=0){let s=n.drawTooltip(e,i),l=t.addCSS2D(s,r,o,a);return l.visible=!0,l},t.removeHelp=function(){t.removeCSS2D("help")},t.addCSS2D=function(e,n,r=t.anchor,i=1){if(e){const o=t.box3(),a=o.getSize(new w.Vector3);let s={x:o.max.x,y:o.max.y,z:o.min.z};t.removeCSS2D(n);let l=new x.CSS2DObject(e);return l.name=n,l.position.set(.5*-a.x-t.model.position.x-r.x+s.x,.5*-a.y-t.model.position.y-r.y+s.y,a.z*i),l.visible=!1,t.scaleGroup.add(l),l}},t.removeCSS2D=function(e){let n=t.getObjectByName(e);if(n){n.dispose();let e=t.scaleGroup.children;e.splice(e.indexOf(n),1)}},Object.defineProperty(t,"shadowPlane",{get:()=>t.getObjectByName("shadowPlane")});let a=!1;Object.defineProperty(t,"castShadow",{get:()=>a,set(e){if(t.model&&a!==e){if(t.model.traverse((function(t){t.isMesh&&(t.castShadow=!0)})),e){const n=t.modelSize,r=[n.x,n.y,n.z,t.modelHeight],i=10*Math.max(...r),o=new w.PlaneBufferGeometry(i,i),a=new w.ShadowMaterial;a.opacity=.5;let s=new w.Mesh(o,a);s.name="shadowPlane",s.layers.enable(1),s.layers.disable(0),s.receiveShadow=e,t.add(s)}else t.traverse((function(e){e.isMesh&&e.material instanceof w.ShadowMaterial&&t.remove(e)}));a=e}}}),t.setReceiveShadowFloor=function(){if(t.castShadow){let e=t.shadowPlane,n=e.position,r=e.rotation;if(n.z=-t.modelHeight,r.y=t.rotation.y,r.x=-t.rotation.x,"meters"===t.userData.units){const r=t.modelSize,i=[r.x,r.y,r.z,-n.z],o=10*Math.max(...i)/e.geometry.parameters.width;e.scale.set(o,o,o)}}};let s=!1;Object.defineProperty(t,"receiveShadow",{get:()=>s,set(e){t.model&&s!==e&&(t.model.traverse((function(t){t.isMesh&&(t.receiveShadow=!0)})),s=e)}});let l=!1;Object.defineProperty(t,"wireframe",{get:()=>l,set(e){t.model&&l!==e&&(t.model.traverse((function(t){if("Mesh"==t.type||"SkinnedMesh"==t.type){let n=[];Array.isArray(t.material)?n=t.material:n.push(t.material);let r=n[0];e?(t.userData.materials=r,t.material=r.clone(),t.material.wireframe=t.material.transparent=e,t.material.opacity=.3):(t.material.dispose(),t.material=t.userData.materials,t.userData.materials.dispose(),t.userData.materials=null),e?(t.layers.disable(0),t.layers.enable(1)):(t.layers.disable(1),t.layers.enable(0))}"LineSegments"==t.type&&t.layers.disableAll()})),l=e,t.dispatchEvent({type:"Wireframed",detail:t}))}});let c=null;Object.defineProperty(t,"color",{get:()=>c,set(e){t.model&&c!==e&&(t.model.traverse((function(t){if("Mesh"==t.type||"SkinnedMesh"==t.type){let n=[];Array.isArray(t.material)?n=t.material:n.push(t.material);let r=n[0];e?(t.userData.materials=r,t.material=new w.MeshStandardMaterial,t.material.color.setHex(e)):(t.material.dispose(),t.material=t.userData.materials,t.userData.materials.dispose(),t.userData.materials=null)}})),c=e)}});let p=!1;Object.defineProperty(t,"selected",{get:()=>p,set(e){e?(t.userData.bbox&&!t.boundingBox&&t.drawBoundingBox(),t.boxGroup&&(t.boundingBox.material=M.prototype._defaults.materials.boxSelectedMaterial,t.boundingBox.parent.visible=!0,t.boundingBox.layers.enable(1),t.boundingBoxShadow.layers.enable(1)),t.label&&!t.label.alwaysVisible&&(t.label.visible=!0)):(t.boxGroup&&t.remove(t.boxGroup),t.label&&!t.label.alwaysVisible&&(t.label.visible=!1),t.removeHelp()),t.tooltip&&(t.tooltip.visible=e),p!=e&&(p=e,t.dispatchEvent({type:"SelectedChange",detail:t}))}});let h=!0;Object.defineProperty(t,"raycasted",{get:()=>h,set(e){t.model&&h!==e&&(t.model.traverse((function(t){"Mesh"!=t.type&&"SkinnedMesh"!=t.type||(e?(t.layers.disable(1),t.layers.enable(0)):(t.layers.disable(0),t.layers.enable(1)))})),h=e)}});let d=!1;Object.defineProperty(t,"over",{get:()=>d,set(e){e?(t.selected||(t.userData.bbox&&!t.boundingBox&&t.drawBoundingBox(),t.userData.tooltip&&!t.tooltip&&t.addTooltip(t.uuid,!0,t.anchor,!1),t.boxGroup&&(t.boundingBox.material=M.prototype._defaults.materials.boxOverMaterial,t.boundingBox.parent.visible=!0,t.boundingBox.layers.enable(1),t.boundingBoxShadow.layers.enable(1))),t.label&&!t.label.alwaysVisible&&(t.label.visible=!0),t.dispatchEvent({type:"ObjectMouseOver",detail:t})):(t.selected||(t.boxGroup&&(t.remove(t.boxGroup),t.tooltip&&!t.tooltip.custom&&t.removeTooltip()),t.label&&!t.label.alwaysVisible&&(t.label.visible=!1)),t.dispatchEvent({type:"ObjectMouseOut",detail:t})),t.tooltip&&(t.tooltip.visible=e||t.selected),d=e}}),t.box3=function(){let e;if(t.updateMatrix(),t.updateMatrixWorld(!0,!0),t.model){let n=t.clone(!0),r=t.model.clone();if(e=(new w.Box3).setFromObject(r),t.parent){let i=new w.Matrix4,o=new w.Matrix4;t.matrix.extractRotation(i),o.copy(i).invert(),n.setRotationFromMatrix(o),e=(new w.Box3).setFromObject(r)}}return e},t.modelBox=function(){return t.box3()},t.getSize=function(){return t.box3().getSize(new w.Vector3(0,0,0))};let f=!1;Object.defineProperty(t,"modelSize",{get:()=>f=t.getSize(),set(t){f!=t&&(f=t)}}),Object.defineProperty(t,"modelHeight",{get(){let e=t.coordinates[2]||0;return"scene"===t.userData.units&&(e*=t.unitsPerMeter/t.scale.x),e}}),Object.defineProperty(t,"unitsPerMeter",{get:()=>Number(u.projectedUnitsPerMeter(t.coordinates[1]).toFixed(7))}),Object.defineProperty(t,"fixedZoom",{get:()=>t.userData.fixedZoom,set(e){t.userData.fixedZoom!==e&&(t.userData.fixedZoom=e,t.userData.units=e?"scene":"meters")}}),t.setFixedZoom=function(e){if(null!=t.fixedZoom&&0!=t.fixedZoom){e||(e=t.userData.mapScale);let r=(n=t.fixedZoom,Math.pow(2,n));if(r>e){let n=r/e;t.scale.set(n,n,n)}else t.scale.set(1,1,1)}var n},t.setScale=function(e){if("scene"!=t.userData.units){let e=t.unitsPerMeter;t.scale.set(e,e,e)}else t.fixedZoom?(e&&(t.userData.mapScale=e),t.setFixedZoom(t.userData.mapScale)):t.scale.set(1,1,1)},t.setObjectScale=function(e){t.setScale(e),t.setBoundingBoxShadowFloor(),t.setReceiveShadowFloor()}}t.add=function(e){return t.scaleGroup.add(e),e.position.z=t.coordinates[2]?-t.coordinates[2]:0,e},t.remove=function(e){e&&(e.traverse((t=>{if(t.geometry&&t.geometry.dispose(),t.material)if(t.material.isMaterial)i(t.material);else for(const e of t.material)i(e);t.dispose&&t.dispose()})),t.scaleGroup.remove(e),tb.map.repaint=!0)},t.duplicate=function(e){let r=t.clone(!0);if(r.getObjectByName("model").animations=t.animations,r.userData.feature&&(e&&e.feature&&(r.userData.feature=e.feature),r.userData.feature.properties.uuid=r.uuid),n._addMethods(r),!e||u.equal(e.scale,t.userData.scale))return r.copyAnchor(t),r;{r.userData=e,r.userData.isGeoGroup=!0,r.remove(r.boxGroup);const t=u.types.rotation(e.rotation,[0,0,0]),n=u.types.scale(e.scale,[1,1,1]);return r.model.position.set(0,0,0),r.model.rotation.set(t[0],t[1],t[2]),r.model.scale.set(n[0],n[1],n[2]),r.setAnchor(e.anchor),r.setCenter(e.adjustment),r}},t.copyAnchor=function(e){t.anchor=e.anchor,t.none={x:0,y:0,z:0},t.center=e.center,t.bottom=e.bottom,t.bottomLeft=e.bottomLeft,t.bottomRight=e.bottomRight,t.top=e.top,t.topLeft=e.topLeft,t.topRight=e.topRight,t.left=e.left,t.right=e.right},t.dispose=function(){M.prototype.unenroll(t),t.traverse((t=>{if((!t.parent||"world"!=t.parent.name)&&"threeboxObject"!==t.name){if(t.geometry&&t.geometry.dispose(),t.material)if(t.material.isMaterial)i(t.material);else for(const e of t.material)i(e);t.dispose&&t.dispose()}})),t.children=[]};const i=t=>{t.dispose();for(const e of Object.keys(t)){const n=t[e];n&&"object"==typeof n&&"minFilter"in n&&n.dispose()}let e=t;(e.map||e.alphaMap||e.aoMap||e.bumpMap||e.displacementMap||e.emissiveMap||e.envMap||e.lightMap||e.metalnessMap||e.normalMap||e.roughnessMap)&&(e.map&&e.map.dispose(),e.alphaMap&&e.alphaMap.dispose(),e.aoMap&&e.aoMap.dispose(),e.bumpMap&&e.bumpMap.dispose(),e.displacementMap&&e.displacementMap.dispose(),e.emissiveMap&&e.emissiveMap.dispose(),e.envMap&&e.envMap.dispose(),e.lightMap&&e.lightMap.dispose(),e.metalnessMap&&e.metalnessMap.dispose(),e.normalMap&&e.normalMap.dispose(),e.roughnessMap&&e.roughnessMap.dispose())};return t},_makeGroup:function(t,e){let n=new w.Group;n.name="scaleGroup",n.add(t);var r=new w.Group;if(r.userData=e||{},r.userData.isGeoGroup=!0,r.userData.feature&&(r.userData.feature.properties.uuid=r.uuid),n.length)for(o of n)r.add(o);else r.add(n);return r.name="threeboxObject",r},animationManager:new y,drawTooltip:function(t,e=!1){if(t){let n;if(e){let e=document.createElement("div");e.className="mapboxgl-popup-content";let r=document.createElement("strong");r.innerHTML=t,e.appendChild(r);let i=document.createElement("div");i.className="mapboxgl-popup-tip";let o=document.createElement("div");o.className="marker mapboxgl-popup-anchor-bottom",o.appendChild(i),o.appendChild(e),(n=document.createElement("div")).className+="label3D",n.appendChild(o)}else(n=document.createElement("span")).className=this._defaults.tooltip.cssClass,n.innerHTML=t;return n}},drawLabelHTML:function(t,e){let n=document.createElement("div");return n.className+=e,n.innerHTML="string"==typeof t?t:t.outerHTML,n},_defaults:{colors:{red:new w.Color(16711680),yellow:new w.Color(16776960),green:new w.Color(65280),black:new w.Color(0)},materials:{boxNormalMaterial:new w.LineBasicMaterial({color:new w.Color(16711680)}),boxOverMaterial:new w.LineBasicMaterial({color:new w.Color(16776960)}),boxSelectedMaterial:new w.LineBasicMaterial({color:new w.Color(65280)})},line:{geometry:null,color:"black",width:1,opacity:1},label:{htmlElement:null,cssClass:" label3D",alwaysVisible:!1,topMargin:-.5},tooltip:{text:"",cssClass:"toolTip text-xs",mapboxStyle:!1,topMargin:0},sphere:{position:[0,0,0],radius:1,sides:20,units:"scene",material:"MeshBasicMaterial",anchor:"bottom-left",bbox:!0,tooltip:!0,raycasted:!0},tube:{geometry:null,radius:1,sides:6,units:"scene",material:"MeshBasicMaterial",anchor:"center",bbox:!0,tooltip:!0,raycasted:!0},loadObj:{type:null,obj:null,units:"scene",scale:1,rotation:0,defaultAnimation:0,anchor:"bottom-left",bbox:!0,tooltip:!0,raycasted:!0,clone:!0},Object3D:{obj:null,units:"scene",anchor:"bottom-left",bbox:!0,tooltip:!0,raycasted:!0},extrusion:{coordinates:[[[]]],geometryOptions:{},height:100,materials:new w.MeshPhongMaterial({color:6684672,side:w.DoubleSide}),scale:1,rotation:0,units:"scene",anchor:"center",bbox:!0,tooltip:!0,raycasted:!0}},geometries:{line:["LineString"],tube:["LineString"],sphere:["Point"]}},b=b=M;var S={};S=S=function(t){let e=(t=u._validate(t,b.prototype._defaults.Object3D)).obj;const n=u.types.rotation(t.rotation,[0,0,0]),r=u.types.scale(t.scale,[1,1,1]);e.rotation.set(n[0],n[1],n[2]),e.scale.set(r[0],r[1],r[2]),e.name="model";let i=b.prototype._makeGroup(e,t);return t.obj.name="model",b.prototype._addMethods(i),i.setAnchor(t.anchor),i.setCenter(t.adjustment),i.raycasted=t.raycasted,i.visibility=!0,i};var T={};T=T=function(t){t=u._validate(t,b.prototype._defaults.sphere);let e=new r.SphereBufferGeometry(t.radius,t.sides,t.sides),n=m(t),i=new r.Mesh(e,n);return new S({obj:i,units:t.units,anchor:t.anchor,adjustment:t.adjustment,bbox:t.bbox,tooltip:t.tooltip,raycasted:t.raycasted})};var E={};function A(t){t=u._validate(t,b.prototype._defaults.extrusion);let e=A.prototype.buildShape(t.coordinates),n=A.prototype.buildGeometry(e,t.geometryOptions),i=new r.Mesh(n,t.materials);return t.obj=i,new S(t)}A.prototype={buildShape:function(t){if(t[0]instanceof(r.Vector2||r.Vector3))return new r.Shape(t);let e=new r.Shape;for(let n=0;n<t.length;n++)0===n?e=new r.Shape(this.buildPoints(t[0],t[0])):e.holes.push(new r.Path(this.buildPoints(t[n],t[0])));return e},buildPoints:function(t,e){const n=[];let i=u.projectToWorld([e[0][0],e[0][1],0]);for(let e=0;e<t.length;e++){let o=u.projectToWorld([t[e][0],t[e][1],0]);n.push(new r.Vector2(u.toDecimal(o.x-i.x,9),u.toDecimal(o.y-i.y,9)))}return n},buildGeometry:function(t,e){let n=new r.ExtrudeBufferGeometry(t,e);return n.computeBoundingBox(),n}},E=E=A;var C={};C=C=function(t){t=u._validate(t,b.prototype._defaults.label);let e=b.prototype.drawLabelHTML(t.htmlElement,t.cssClass),n=new x.CSS2DObject(e);n.name="label",n.visible=t.alwaysVisible,n.alwaysVisible=t.alwaysVisible;var r=b.prototype._makeGroup(n,t);return b.prototype._addMethods(r),r.visibility=t.alwaysVisible,r};var L={};L=L=function(t){if((t=u._validate(t,b.prototype._defaults.tooltip)).text){let n=b.prototype.drawTooltip(t.text,t.mapboxStyle),r=new x.CSS2DObject(n);r.visible=!1,r.name="tooltip";var e=b.prototype._makeGroup(r,t);return b.prototype._addMethods(e),e}};var P={};!function(){const t=/^[og]\s*(.+)?/,e=/^mtllib /,n=/^usemtl /,i=/^usemap /,o=new r.Vector3,a=new r.Vector3,s=new r.Vector3,l=new r.Vector3,c=new r.Vector3;function u(){const t={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);const n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:!1!==e,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(t,e){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const r={index:this.materials.length,name:t||"",mtllib:Array.isArray(e)&&e.length>0?e[e.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(t){const e={index:"number"==typeof t?t:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return e.clone=this.clone.bind(e),e}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(t){const e=this.currentMaterial();if(e&&-1===e.groupEnd&&(e.groupEnd=this.geometry.vertices.length/3,e.groupCount=e.groupEnd-e.groupStart,e.inherited=!1),t&&this.materials.length>1)for(let t=this.materials.length-1;t>=0;t--)this.materials[t].groupCount<=0&&this.materials.splice(t,1);return t&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),e}},n&&n.name&&"function"==typeof n.clone){const t=n.clone(0);t.inherited=!0,this.object.materials.push(t)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(t,e){const n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},parseNormalIndex:function(t,e){const n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},parseUVIndex:function(t,e){const n=parseInt(t,10);return 2*(n>=0?n-1:n+e/2)},addVertex:function(t,e,n){const r=this.vertices,i=this.object.geometry.vertices;i.push(r[t+0],r[t+1],r[t+2]),i.push(r[e+0],r[e+1],r[e+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addVertexLine:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addNormal:function(t,e,n){const r=this.normals,i=this.object.geometry.normals;i.push(r[t+0],r[t+1],r[t+2]),i.push(r[e+0],r[e+1],r[e+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(t,e,n){const r=this.vertices,i=this.object.geometry.normals;o.fromArray(r,t),a.fromArray(r,e),s.fromArray(r,n),c.subVectors(s,a),l.subVectors(o,a),c.cross(l),c.normalize(),i.push(c.x,c.y,c.z),i.push(c.x,c.y,c.z),i.push(c.x,c.y,c.z)},addColor:function(t,e,n){const r=this.colors,i=this.object.geometry.colors;void 0!==r[t]&&i.push(r[t+0],r[t+1],r[t+2]),void 0!==r[e]&&i.push(r[e+0],r[e+1],r[e+2]),void 0!==r[n]&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(t,e,n){const r=this.uvs,i=this.object.geometry.uvs;i.push(r[t+0],r[t+1]),i.push(r[e+0],r[e+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){const t=this.object.geometry.uvs;t.push(0,0),t.push(0,0),t.push(0,0)},addUVLine:function(t){const e=this.uvs;this.object.geometry.uvs.push(e[t+0],e[t+1])},addFace:function(t,e,n,r,i,o,a,s,l){const c=this.vertices.length;let u=this.parseVertexIndex(t,c),p=this.parseVertexIndex(e,c),h=this.parseVertexIndex(n,c);if(this.addVertex(u,p,h),this.addColor(u,p,h),void 0!==a&&""!==a){const t=this.normals.length;u=this.parseNormalIndex(a,t),p=this.parseNormalIndex(s,t),h=this.parseNormalIndex(l,t),this.addNormal(u,p,h)}else this.addFaceNormal(u,p,h);if(void 0!==r&&""!==r){const t=this.uvs.length;u=this.parseUVIndex(r,t),p=this.parseUVIndex(i,t),h=this.parseUVIndex(o,t),this.addUV(u,p,h),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(t){this.object.geometry.type="Points";const e=this.vertices.length;for(let n=0,r=t.length;n<r;n++){const r=this.parseVertexIndex(t[n],e);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(t,e){this.object.geometry.type="Line";const n=this.vertices.length,r=this.uvs.length;for(let e=0,r=t.length;e<r;e++)this.addVertexLine(this.parseVertexIndex(t[e],n));for(let t=0,n=e.length;t<n;t++)this.addUVLine(this.parseUVIndex(e[t],r))}};return t.startObject("",!1),t}r.OBJLoader=class extends r.Loader{constructor(t){super(t),this.materials=null}load(t,e,n,i){const o=this,a=new r.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{e(o.parse(n))}catch(e){i?i(e):console.error(e),o.manager.itemError(t)}}),n,i)}setMaterials(t){return this.materials=t,this}parse(o){const a=new u;-1!==o.indexOf("\r\n")&&(o=o.replace(/\r\n/g,"\n")),-1!==o.indexOf("\\\n")&&(o=o.replace(/\\\n/g,""));const s=o.split("\n");let l="",c="",p=0,h=[];const d="function"==typeof"".trimLeft;for(let r=0,o=s.length;r<o;r++)if(l=s[r],0!==(p=(l=d?l.trimLeft():l.trim()).length)&&"#"!==(c=l.charAt(0)))if("v"===c){const t=l.split(/\s+/);switch(t[0]){case"v":a.vertices.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),t.length>=7?a.colors.push(parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6])):a.colors.push(void 0,void 0,void 0);break;case"vn":a.normals.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]));break;case"vt":a.uvs.push(parseFloat(t[1]),parseFloat(t[2]))}}else if("f"===c){const t=l.substr(1).trim().split(/\s+/),e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(r.length>0){const t=r.split("/");e.push(t)}}const n=e[0];for(let t=1,r=e.length-1;t<r;t++){const r=e[t],i=e[t+1];a.addFace(n[0],r[0],i[0],n[1],r[1],i[1],n[2],r[2],i[2])}}else if("l"===c){const t=l.substring(1).trim().split(" ");let e=[];const n=[];if(-1===l.indexOf("/"))e=t;else for(let r=0,i=t.length;r<i;r++){const i=t[r].split("/");""!==i[0]&&e.push(i[0]),""!==i[1]&&n.push(i[1])}a.addLineGeometry(e,n)}else if("p"===c){const t=l.substr(1).trim().split(" ");a.addPointGeometry(t)}else if(null!==(h=t.exec(l))){const t=(" "+h[0].substr(1).trim()).substr(1);a.startObject(t)}else if(n.test(l))a.object.startMaterial(l.substring(7).trim(),a.materialLibraries);else if(e.test(l))a.materialLibraries.push(l.substring(7).trim());else if(i.test(l))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===c){if((h=l.split(" ")).length>1){const t=h[1].trim().toLowerCase();a.object.smooth="0"!==t&&"off"!==t}else a.object.smooth=!0;const t=a.object.currentMaterial();t&&(t.smooth=a.object.smooth)}else{if("\0"===l)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+l+'"')}a.finalize();const f=new r.Group;if(f.materialLibraries=[].concat(a.materialLibraries),1==!(1===a.objects.length&&0===a.objects[0].geometry.vertices.length))for(let t=0,e=a.objects.length;t<e;t++){const e=a.objects[t],n=e.geometry,i=e.materials,o="Line"===n.type,s="Points"===n.type;let l=!1;if(0===n.vertices.length)continue;const c=new r.BufferGeometry;c.setAttribute("position",new r.Float32BufferAttribute(n.vertices,3)),n.normals.length>0&&c.setAttribute("normal",new r.Float32BufferAttribute(n.normals,3)),n.colors.length>0&&(l=!0,c.setAttribute("color",new r.Float32BufferAttribute(n.colors,3))),!0===n.hasUVIndices&&c.setAttribute("uv",new r.Float32BufferAttribute(n.uvs,2));const u=[];for(let t=0,e=i.length;t<e;t++){const e=i[t],n=e.name+"_"+e.smooth+"_"+l;let c=a.materials[n];if(null!==this.materials)if(c=this.materials.create(e.name),!o||!c||c instanceof r.LineBasicMaterial){if(s&&c&&!(c instanceof r.PointsMaterial)){const t=new r.PointsMaterial({size:10,sizeAttenuation:!1});r.Material.prototype.copy.call(t,c),t.color.copy(c.color),t.map=c.map,c=t}}else{const t=new r.LineBasicMaterial;r.Material.prototype.copy.call(t,c),t.color.copy(c.color),c=t}void 0===c&&((c=o?new r.LineBasicMaterial:s?new r.PointsMaterial({size:1,sizeAttenuation:!1}):new r.MeshPhongMaterial).name=e.name,c.flatShading=!e.smooth,c.vertexColors=l,a.materials[n]=c),u.push(c)}let p;if(u.length>1){for(let t=0,e=i.length;t<e;t++){const e=i[t];c.addGroup(e.groupStart,e.groupCount,t)}p=o?new r.LineSegments(c,u):s?new r.Points(c,u):new r.Mesh(c,u)}else p=o?new r.LineSegments(c,u[0]):s?new r.Points(c,u[0]):new r.Mesh(c,u[0]);p.name=e.name,f.add(p)}else if(a.vertices.length>0){const t=new r.PointsMaterial({size:1,sizeAttenuation:!1}),e=new r.BufferGeometry;e.setAttribute("position",new r.Float32BufferAttribute(a.vertices,3)),a.colors.length>0&&void 0!==a.colors[0]&&(e.setAttribute("color",new r.Float32BufferAttribute(a.colors,3)),t.vertexColors=!0);const n=new r.Points(e,t);f.add(n)}return f}}}(),P=P=r.OBJLoader;var I={};!function(){class t{constructor(t="",e={}){this.baseUrl=t,this.options=e,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:r.FrontSide,this.wrap=void 0!==this.options.wrap?this.options.wrap:r.RepeatWrapping}setCrossOrigin(t){return this.crossOrigin=t,this}setManager(t){this.manager=t}setMaterials(t){this.materialsInfo=this.convert(t),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(t){if(!this.options)return t;const e={};for(const n in t){const r=t[n],i={};e[n]=i;for(const t in r){let e=!0,n=r[t];const o=t.toLowerCase();switch(o){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===n[0]&&0===n[1]&&0===n[2]&&(e=!1)}e&&(i[o]=n)}}return e}preload(){for(const t in this.materialsInfo)this.create(t)}getIndex(t){return this.nameLookup[t]}getAsArray(){let t=0;for(const e in this.materialsInfo)this.materialsArray[t]=this.create(e),this.nameLookup[e]=t,t++;return this.materialsArray}create(t){return void 0===this.materials[t]&&this.createMaterial_(t),this.materials[t]}createMaterial_(t){const e=this,n=this.materialsInfo[t],i={name:t,side:this.side};function o(t,n){if(i[t])return;const r=e.getTextureParams(n,i),o=e.loadTexture((a=e.baseUrl,"string"!=typeof(s=r.url)||""===s?"":/^https?:\/\//i.test(s)?s:a+s));var a,s;o.repeat.copy(r.scale),o.offset.copy(r.offset),o.wrapS=e.wrap,o.wrapT=e.wrap,i[t]=o}for(const t in n){const e=n[t];let a;if(""!==e)switch(t.toLowerCase()){case"kd":i.color=(new r.Color).fromArray(e);break;case"ks":i.specular=(new r.Color).fromArray(e);break;case"ke":i.emissive=(new r.Color).fromArray(e);break;case"map_kd":o("map",e);break;case"map_ks":o("specularMap",e);break;case"map_ke":o("emissiveMap",e);break;case"norm":o("normalMap",e);break;case"map_bump":case"bump":o("bumpMap",e);break;case"map_d":o("alphaMap",e),i.transparent=!0;break;case"ns":i.shininess=parseFloat(e);break;case"d":(a=parseFloat(e))<1&&(i.opacity=a,i.transparent=!0);break;case"tr":a=parseFloat(e),this.options&&this.options.invertTrProperty&&(a=1-a),a>0&&(i.opacity=1-a,i.transparent=!0)}}return this.materials[t]=new r.MeshPhongMaterial(i),this.materials[t]}getTextureParams(t,e){const n={scale:new r.Vector2(1,1),offset:new r.Vector2(0,0)},i=t.split(/\s+/);let o;return(o=i.indexOf("-bm"))>=0&&(e.bumpScale=parseFloat(i[o+1]),i.splice(o,2)),(o=i.indexOf("-s"))>=0&&(n.scale.set(parseFloat(i[o+1]),parseFloat(i[o+2])),i.splice(o,4)),(o=i.indexOf("-o"))>=0&&(n.offset.set(parseFloat(i[o+1]),parseFloat(i[o+2])),i.splice(o,4)),n.url=i.join(" ").trim(),n}loadTexture(t,e,n,i,o){const a=void 0!==this.manager?this.manager:r.DefaultLoadingManager;let s=a.getHandler(t);null===s&&(s=new r.TextureLoader(a)),s.setCrossOrigin&&s.setCrossOrigin(this.crossOrigin);const l=s.load(t,n,i,o);return void 0!==e&&(l.mapping=e),l}}r.MTLLoader=class extends r.Loader{constructor(t){super(t)}load(t,e,n,i){const o=this,a=""===this.path?r.LoaderUtils.extractUrlBase(t||""):this.path,s=new r.FileLoader(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(o.parse(n,a))}catch(e){i?i(e):console.error(e),o.manager.itemError(t)}}),n,i)}setMaterialOptions(t){return this.materialOptions=t,this}parse(e,n){const r=e.split("\n");let i={};const o=/\s+/,a={};for(let t=0;t<r.length;t++){let e=r[t];if(0===(e=e.trim()).length||"#"===e.charAt(0))continue;const n=e.indexOf(" ");let s=n>=0?e.substring(0,n):e;s=s.toLowerCase();let l=n>=0?e.substring(n+1):"";if(l=l.trim(),"newmtl"===s)i={name:l},a[l]=i;else if("ka"===s||"kd"===s||"ks"===s||"ke"===s){const t=l.split(o,3);i[s]=[parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2])]}else i[s]=l}const s=new t(this.resourcePath||n,this.materialOptions);return s.setCrossOrigin(this.crossOrigin),s.setManager(this.manager),s.setMaterials(a),s}}}(),I=I=r.MTLLoader;var R,k,z={},D=z={};function O(){throw new Error("setTimeout has not been defined")}function F(){throw new Error("clearTimeout has not been defined")}function B(t){if(R===setTimeout)return setTimeout(t,0);if((R===O||!R)&&setTimeout)return R=setTimeout,setTimeout(t,0);try{return R(t,0)}catch(e){try{return R.call(null,t,0)}catch(e){return R.call(this,t,0)}}}!function(){try{R="function"==typeof setTimeout?setTimeout:O}catch(t){R=O}try{k="function"==typeof clearTimeout?clearTimeout:F}catch(t){k=F}}();var N,U=[],j=!1,V=-1;function G(){j&&N&&(j=!1,N.length?U=N.concat(U):V=-1,U.length&&H())}function H(){if(!j){var t=B(G);j=!0;for(var e=U.length;e;){for(N=U,U=[];++V<e;)N&&N[V].run();V=-1,e=U.length}N=null,j=!1,function(t){if(k===clearTimeout)return clearTimeout(t);if((k===F||!k)&&clearTimeout)return k=clearTimeout,clearTimeout(t);try{k(t)}catch(e){try{return k.call(null,t)}catch(e){return k.call(this,t)}}}(t)}}function W(t,e){this.fun=t,this.array=e}function q(){}D.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];U.push(new W(t,e)),1!==U.length||j||B(H)},W.prototype.run=function(){this.fun.apply(null,this.array)},D.title="browser",D.browser=!0,D.env={},D.argv=[],D.version="",D.versions={},D.on=q,D.addListener=q,D.once=q,D.off=q,D.removeListener=q,D.removeAllListeners=q,D.emit=q,D.prependListener=q,D.prependOnceListener=q,D.listeners=function(t){return[]},D.binding=function(t){throw new Error("process.binding is not supported")},D.cwd=function(){return"/"},D.chdir=function(t){throw new Error("process.chdir is not supported")},D.umask=function(){return 0};var Z={exports:{}};(function(t){(function(){!function(t){"object"==typeof Z.exports?Z.exports=t():"undefined"!=typeof define&&define.amd?define(["fflate",t]):("undefined"!=typeof self?self:this).fflate=t()}((function(){var e={__esModule:!0},n=("object"==typeof Z.exports?function(e){"use strict";try{(void 0)("require('worker_threads')").Worker}catch(t){}return Z.exports.default=function(e,n,r,i,o){t((function(){return o(Error("async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"),null)}));var a=function(){};return{terminate:a,postMessage:a}},e}:function(t){"use strict";var e=eval;return t.default=function(t,n,r,i,o){var a=e[n]||(e[n]=URL.createObjectURL(new Blob([t],{type:"text/javascript"}))),s=new Worker(a);return s.onerror=function(t){return o(t.error,null)},s.onmessage=function(t){return o(null,t.data)},s.postMessage(r,i),s},t})({}),r=Uint8Array,i=Uint16Array,o=Uint32Array,a=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),l=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=function(t,e){for(var n=new i(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];var a=new o(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)a[s]=s-n[r]<<5|r;return[n,a]},u=c(a,2),p=u[0],h=u[1];p[28]=258,h[258]=28;for(var d=c(s,0),f=d[0],m=d[1],g=new i(32768),y=0;y<32768;++y){var v=(43690&y)>>>1|(21845&y)<<1;g[y]=((65280&(v=(61680&(v=(52428&v)>>>2|(13107&v)<<2))>>>4|(3855&v)<<4))>>>8|(255&v)<<8)>>>1}var _=function(t,e,n){for(var r=t.length,o=0,a=new i(e);o<r;++o)++a[t[o]-1];var s,l=new i(e);for(o=0;o<e;++o)l[o]=l[o-1]+a[o-1]<<1;if(n){s=new i(1<<e);var c=15-e;for(o=0;o<r;++o)if(t[o])for(var u=o<<4|t[o],p=e-t[o],h=l[t[o]-1]++<<p,d=h|(1<<p)-1;h<=d;++h)s[g[h]>>>c]=u}else for(s=new i(r),o=0;o<r;++o)t[o]&&(s[o]=g[l[t[o]-1]++]>>>15-t[o]);return s},x=new r(288);for(y=0;y<144;++y)x[y]=8;for(y=144;y<256;++y)x[y]=9;for(y=256;y<280;++y)x[y]=7;for(y=280;y<288;++y)x[y]=8;var b=new r(32);for(y=0;y<32;++y)b[y]=5;var w=_(x,9,0),M=_(x,9,1),S=_(b,5,0),T=_(b,5,1),E=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},A=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&n},C=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},L=function(t){return(t/8|0)+(7&t&&1)},P=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var a=new(t instanceof i?i:t instanceof o?o:r)(n-e);return a.set(t.subarray(e,n)),a},I=function(t,e,n){var i=t.length;if(!i||n&&!n.l&&i<5)return e||new r(0);var o=!e||n,c=!n||n.i;n||(n={}),e||(e=new r(3*i));var u=function(t){var n=e.length;if(t>n){var i=new r(Math.max(2*n,t));i.set(e),e=i}},h=n.f||0,d=n.p||0,m=n.b||0,g=n.l,y=n.d,v=n.m,x=n.n,b=8*i;do{if(!g){n.f=h=A(t,d,1);var w=A(t,d+1,3);if(d+=3,!w){var S=t[(j=L(d)+4)-4]|t[j-3]<<8,I=j+S;if(I>i){if(c)throw"unexpected EOF";break}o&&u(m+S),e.set(t.subarray(j,I),m),n.b=m+=S,n.p=d=8*I;continue}if(1==w)g=M,y=T,v=9,x=5;else{if(2!=w)throw"invalid block type";var R=A(t,d,31)+257,k=A(t,d+10,15)+4,z=R+A(t,d+5,31)+1;d+=14;for(var D=new r(z),O=new r(19),F=0;F<k;++F)O[l[F]]=A(t,d+3*F,7);d+=3*k;var B=E(O),N=(1<<B)-1;if(!c&&d+z*(B+7)>b)break;var U=_(O,B,1);for(F=0;F<z;){var j,V=U[A(t,d,N)];if(d+=15&V,(j=V>>>4)<16)D[F++]=j;else{var G=0,H=0;for(16==j?(H=3+A(t,d,3),d+=2,G=D[F-1]):17==j?(H=3+A(t,d,7),d+=3):18==j&&(H=11+A(t,d,127),d+=7);H--;)D[F++]=G}}var W=D.subarray(0,R),q=D.subarray(R);v=E(W),x=E(q),g=_(W,v,1),y=_(q,x,1)}if(d>b)throw"unexpected EOF"}o&&u(m+131072);for(var Z=(1<<v)-1,X=(1<<x)-1,$=v+x+18;c||d+$<b;){var J=(G=g[C(t,d)&Z])>>>4;if((d+=15&G)>b)throw"unexpected EOF";if(!G)throw"invalid length/literal";if(J<256)e[m++]=J;else{if(256==J){g=null;break}var Y=J-254;J>264&&(Y=A(t,d,(1<<(tt=a[F=J-257]))-1)+p[F],d+=tt);var Q=y[C(t,d)&X],K=Q>>>4;if(!Q)throw"invalid distance";if(d+=15&Q,q=f[K],K>3){var tt=s[K];q+=C(t,d)&(1<<tt)-1,d+=tt}if(d>b)throw"unexpected EOF";o&&u(m+131072);for(var et=m+Y;m<et;m+=4)e[m]=e[m-q],e[m+1]=e[m+1-q],e[m+2]=e[m+2-q],e[m+3]=e[m+3-q];m=et}}n.l=g,n.p=d,n.b=m,g&&(h=1,n.m=v,n.d=y,n.n=x)}while(!h);return m==e.length?e:P(e,0,m)},R=function(t,e,n){var r=e/8|0;t[r]|=n<<=7&e,t[r+1]|=n>>>8},k=function(t,e,n){var r=e/8|0;t[r]|=n<<=7&e,t[r+1]|=n>>>8,t[r+2]|=n>>>16},z=function(t,e){for(var n=[],o=0;o<t.length;++o)t[o]&&n.push({s:o,f:t[o]});var a=n.length,s=n.slice();if(!a)return[j,0];if(1==a){var l=new r(n[0].s+1);return l[n[0].s]=1,[l,1]}n.sort((function(t,e){return t.f-e.f})),n.push({s:-1,f:25001});var c=n[0],u=n[1],p=0,h=1,d=2;for(n[0]={s:-1,f:c.f+u.f,l:c,r:u};h!=a-1;)c=n[n[p].f<n[d].f?p++:d++],u=n[p!=h&&n[p].f<n[d].f?p++:d++],n[h++]={s:-1,f:c.f+u.f,l:c,r:u};var f=s[0].s;for(o=1;o<a;++o)s[o].s>f&&(f=s[o].s);var m=new i(f+1),g=D(n[h-1],m,0);if(g>e){o=0;var y=0,v=g-e,_=1<<v;for(s.sort((function(t,e){return m[e.s]-m[t.s]||t.f-e.f}));o<a;++o){var x=s[o].s;if(!(m[x]>e))break;y+=_-(1<<g-m[x]),m[x]=e}for(y>>>=v;y>0;){var b=s[o].s;m[b]<e?y-=1<<e-m[b]++-1:++o}for(;o>=0&&y;--o){var w=s[o].s;m[w]==e&&(--m[w],++y)}g=e}return[new r(m),g]},D=function(t,e,n){return-1==t.s?Math.max(D(t.l,e,n+1),D(t.r,e,n+1)):e[t.s]=n},O=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new i(++e),r=0,o=t[0],a=1,s=function(t){n[r++]=t},l=1;l<=e;++l)if(t[l]==o&&l!=e)++a;else{if(!o&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(o),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(o);a=1,o=t[l]}return[n.subarray(0,r),e]},F=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},B=function(t,e,n){var r=n.length,i=L(e+2);t[i]=255&r,t[i+1]=r>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var o=0;o<r;++o)t[i+o+4]=n[o];return 8*(i+4+r)},N=function(t,e,n,r,o,c,u,p,h,d,f){R(e,f++,n),++o[256];for(var m=z(o,15),g=m[0],y=m[1],v=z(c,15),M=v[0],T=v[1],E=O(g),A=E[0],C=E[1],L=O(M),P=L[0],I=L[1],D=new i(19),N=0;N<A.length;++N)D[31&A[N]]++;for(N=0;N<P.length;++N)D[31&P[N]]++;for(var U=z(D,7),j=U[0],V=U[1],G=19;G>4&&!j[l[G-1]];--G);var H,W,q,Z,X=d+5<<3,$=F(o,x)+F(c,b)+u,J=F(o,g)+F(c,M)+u+14+3*G+F(D,j)+(2*D[16]+3*D[17]+7*D[18]);if(X<=$&&X<=J)return B(e,f,t.subarray(h,h+d));if(R(e,f,1+(J<$)),f+=2,J<$){H=_(g,y,0),W=g,q=_(M,T,0),Z=M;var Y=_(j,V,0);for(R(e,f,C-257),R(e,f+5,I-1),R(e,f+10,G-4),f+=14,N=0;N<G;++N)R(e,f+3*N,j[l[N]]);f+=3*G;for(var Q=[A,P],K=0;K<2;++K){var tt=Q[K];for(N=0;N<tt.length;++N)R(e,f,Y[et=31&tt[N]]),f+=j[et],et>15&&(R(e,f,tt[N]>>>5&127),f+=tt[N]>>>12)}}else H=w,W=x,q=S,Z=b;for(N=0;N<p;++N)if(r[N]>255){var et;k(e,f,H[257+(et=r[N]>>>18&31)]),f+=W[et+257],et>7&&(R(e,f,r[N]>>>23&31),f+=a[et]);var nt=31&r[N];k(e,f,q[nt]),f+=Z[nt],nt>3&&(k(e,f,r[N]>>>5&8191),f+=s[nt])}else k(e,f,H[r[N]]),f+=W[r[N]];return k(e,f,H[256]),f+W[256]},U=new o([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),j=new r(0),V=function(t,e,n,l,c,u){var p=t.length,d=new r(l+p+5*(1+Math.ceil(p/7e3))+c),f=d.subarray(l,d.length-c),g=0;if(!e||p<8)for(var y=0;y<=p;y+=65535){var v=y+65535;v<p?g=B(f,g,t.subarray(y,v)):(f[y]=u,g=B(f,g,t.subarray(y,p)))}else{for(var _=U[e-1],x=_>>>13,b=8191&_,w=(1<<n)-1,M=new i(32768),S=new i(w+1),T=Math.ceil(n/3),E=2*T,A=function(e){return(t[e]^t[e+1]<<T^t[e+2]<<E)&w},C=new o(25e3),I=new i(288),R=new i(32),k=0,z=0,D=(y=0,0),O=0,F=0;y<p;++y){var V=A(y),G=32767&y,H=S[V];if(M[G]=H,S[V]=G,O<=y){var W=p-y;if((k>7e3||D>24576)&&W>423){g=N(t,f,0,C,I,R,z,D,F,y-F,g),D=k=z=0,F=y;for(var q=0;q<286;++q)I[q]=0;for(q=0;q<30;++q)R[q]=0}var Z=2,X=0,$=b,J=G-H&32767;if(W>2&&V==A(y-J))for(var Y=Math.min(x,W)-1,Q=Math.min(32767,y),K=Math.min(258,W);J<=Q&&--$&&G!=H;){if(t[y+Z]==t[y+Z-J]){for(var tt=0;tt<K&&t[y+tt]==t[y+tt-J];++tt);if(tt>Z){if(Z=tt,X=J,tt>Y)break;var et=Math.min(J,tt-2),nt=0;for(q=0;q<et;++q){var rt=y-J+q+32768&32767,it=rt-M[rt]+32768&32767;it>nt&&(nt=it,H=rt)}}}J+=(G=H)-(H=M[G])+32768&32767}if(X){C[D++]=268435456|h[Z]<<18|m[X];var ot=31&h[Z],at=31&m[X];z+=a[ot]+s[at],++I[257+ot],++R[at],O=y+Z,++k}else C[D++]=t[y],++I[t[y]]}}g=N(t,f,u,C,I,R,z,D,F,y-F,g),!u&&7&g&&(g=B(f,g+1,j))}return P(d,0,l+L(g)+c)},G=function(){for(var t=new o(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),H=function(){var t=-1;return{p:function(e){for(var n=t,r=0;r<e.length;++r)n=G[255&n^e[r]]^n>>>8;t=n},d:function(){return~t}}},W=function(){var t=1,e=0;return{p:function(n){for(var r=t,i=e,o=n.length,a=0;a!=o;){for(var s=Math.min(a+2655,o);a<s;++a)i+=r+=n[a];r=(65535&r)+15*(r>>16),i=(65535&i)+15*(i>>16)}t=r,e=i},d:function(){return((t%=65521)>>>8<<16|(255&(e%=65521))<<8|e>>>8)+2*((255&t)<<23)}}},q=function(t,e,n,r,i){return V(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,r,!i)},X=function(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n},$=function(t,e,n){for(var r=t(),i=""+t,o=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a<r.length;++a){var s=r[a],l=o[a];if("function"==typeof s){e+=";"+l+"=";var c=""+s;if(s.prototype)if(-1!=c.indexOf("[native code]")){var u=c.indexOf(" ",8)+1;e+=c.slice(u,c.indexOf("(",u))}else for(var p in e+=c,s.prototype)e+=";"+l+".prototype."+p+"="+s.prototype[p];else e+=c}else n[l]=s}return[e,n]},J=[],Y=function(t){var e=[];for(var n in t)(t[n]instanceof r||t[n]instanceof i||t[n]instanceof o)&&e.push((t[n]=new t[n].constructor(t[n])).buffer);return e},Q=function(t,e,r,i){var o;if(!J[r]){for(var a="",s={},l=t.length-1,c=0;c<l;++c)a=(o=$(t[c],a,s))[0],s=o[1];J[r]=$(t[l],a,s)}var u=X({},J[r][1]);return n.default(J[r][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e+"}",r,u,Y(u),i)},K=function(){return[r,i,o,a,s,l,p,f,M,T,g,_,E,A,C,L,P,I,Ct,ot,at]},tt=function(){return[r,i,o,a,s,l,h,m,w,x,S,b,g,U,j,_,R,k,z,D,O,F,B,N,L,P,V,q,St,ot]},et=function(){return[ft,yt,dt,H,G]},nt=function(){return[mt,gt]},rt=function(){return[vt,dt,W]},it=function(){return[_t]},ot=function(t){return postMessage(t,[t.buffer])},at=function(t){return t&&t.size&&new r(t.size)},st=function(t,e,n,r,i,o){var a=Q(n,r,i,(function(t,e){a.terminate(),o(t,e)}));return a.postMessage([t,e],e.consume?[t.buffer]:[]),function(){a.terminate()}},lt=function(t){return t.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(e){return t.push(e.data[0],e.data[1])}},ct=function(t,e,n,r,i){var o,a=Q(t,r,i,(function(t,n){t?(a.terminate(),e.ondata.call(e,t)):(n[1]&&a.terminate(),e.ondata.call(e,t,n[0],n[1]))}));a.postMessage(n),e.push=function(t,n){if(o)throw"stream finished";if(!e.ondata)throw"no stream handler";a.postMessage([t,o=n],[t.buffer])},e.terminate=function(){a.terminate()}},ut=function(t,e){return t[e]|t[e+1]<<8},pt=function(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+2*(t[e+3]<<23)},ht=function(t,e){return pt(t,e)|4294967296*pt(t,e)},dt=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},ft=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&dt(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var r=0;r<=n.length;++r)t[r+10]=n.charCodeAt(r)}},mt=function(t){if(31!=t[0]||139!=t[1]||8!=t[2])throw"invalid gzip data";var e=t[3],n=10;4&e&&(n+=t[10]|2+(t[11]<<8));for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!t[n++]);return n+(2&e)},gt=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16)+2*(t[e-1]<<23)},yt=function(t){return 10+(t.filename&&t.filename.length+1||0)},vt=function(t,e){var n=e.level,r=0==n?0:n<6?1:9==n?3:2;t[0]=120,t[1]=r<<6|(r?32-2*r:1)},_t=function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"};function xt(t,e){return e||"function"!=typeof t||(e=t,t={}),this.ondata=e,t}var bt=function(){function t(t,e){e||"function"!=typeof t||(e=t,t={}),this.ondata=e,this.o=t||{}}return t.prototype.p=function(t,e){this.ondata(q(t,this.o,0,0,!e),e)},t.prototype.push=function(t,e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=e,this.p(t,e||!1)},t}();e.Deflate=bt;var wt=function(t,e){ct([tt,function(){return[lt,bt]}],this,xt.call(this,t,e),(function(t){var e=new bt(t.data);onmessage=lt(e)}),6)};function Mt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return st(t,e,[tt],(function(t){return ot(St(t.data[0],t.data[1]))}),0,n)}function St(t,e){return q(t,e||{},0,0)}e.AsyncDeflate=wt,e.deflate=Mt,e.deflateSync=St;var Tt=function(){function t(t){this.s={},this.p=new r(0),this.ondata=t}return t.prototype.e=function(t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var e=this.p.length,n=new r(e+t.length);n.set(this.p),n.set(t,e),this.p=n},t.prototype.c=function(t){this.d=this.s.i=t||!1;var e=this.s.b,n=I(this.p,this.o,this.s);this.ondata(P(n,e,this.s.b),this.d),this.o=P(n,this.s.b-32768),this.s.b=this.o.length,this.p=P(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}();e.Inflate=Tt;var Et=function(t){this.ondata=t,ct([K,function(){return[lt,Tt]}],this,0,(function(){var t=new Tt;onmessage=lt(t)}),7)};function At(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return st(t,e,[K],(function(t){return ot(Ct(t.data[0],at(t.data[1])))}),1,n)}function Ct(t,e){return I(t,e)}e.AsyncInflate=Et,e.inflate=At,e.inflateSync=Ct;var Lt=function(){function t(t,e){this.c=H(),this.l=0,this.v=1,bt.call(this,t,e)}return t.prototype.push=function(t,e){bt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t),this.l+=t.length;var n=q(t,this.o,this.v&&yt(this.o),e&&8,!e);this.v&&(ft(n,this.o),this.v=0),e&&(dt(n,n.length-8,this.c.d()),dt(n,n.length-4,this.l)),this.ondata(n,e)},t}();e.Gzip=Lt,e.Compress=Lt;var Pt=function(t,e){ct([tt,et,function(){return[lt,bt,Lt]}],this,xt.call(this,t,e),(function(t){var e=new Lt(t.data);onmessage=lt(e)}),8)};function It(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return st(t,e,[tt,et,function(){return[Rt]}],(function(t){return ot(Rt(t.data[0],t.data[1]))}),2,n)}function Rt(t,e){e||(e={});var n=H(),r=t.length;n.p(t);var i=q(t,e,yt(e),8),o=i.length;return ft(i,e),dt(i,o-8,n.d()),dt(i,o-4,r),i}e.AsyncGzip=Pt,e.AsyncCompress=Pt,e.gzip=It,e.compress=It,e.gzipSync=Rt,e.compressSync=Rt;var kt=function(){function t(t){this.v=1,Tt.call(this,t)}return t.prototype.push=function(t,e){if(Tt.prototype.e.call(this,t),this.v){var n=this.p.length>3?mt(this.p):4;if(n>=this.p.length&&!e)return;this.p=this.p.subarray(n),this.v=0}if(e){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Tt.prototype.c.call(this,e)},t}();e.Gunzip=kt;var zt=function(t){this.ondata=t,ct([K,nt,function(){return[lt,Tt,kt]}],this,0,(function(){var t=new kt;onmessage=lt(t)}),9)};function Dt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return st(t,e,[K,nt,function(){return[Ot]}],(function(t){return ot(Ot(t.data[0]))}),3,n)}function Ot(t,e){return I(t.subarray(mt(t),-8),e||new r(gt(t)))}e.AsyncGunzip=zt,e.gunzip=Dt,e.gunzipSync=Ot;var Ft=function(){function t(t,e){this.c=W(),this.v=1,bt.call(this,t,e)}return t.prototype.push=function(t,e){bt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t);var n=q(t,this.o,this.v&&2,e&&4,!e);this.v&&(vt(n,this.o),this.v=0),e&&dt(n,n.length-4,this.c.d()),this.ondata(n,e)},t}();e.Zlib=Ft;function Bt(t,e){e||(e={});var n=W();n.p(t);var r=q(t,e,2,4);return vt(r,e),dt(r,r.length-4,n.d()),r}e.AsyncZlib=function(t,e){ct([tt,rt,function(){return[lt,bt,Ft]}],this,xt.call(this,t,e),(function(t){var e=new Ft(t.data);onmessage=lt(e)}),10)},e.zlib=function(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return st(t,e,[tt,rt,function(){return[Bt]}],(function(t){return ot(Bt(t.data[0],t.data[1]))}),4,n)},e.zlibSync=Bt;var Nt=function(){function t(t){this.v=1,Tt.call(this,t)}return t.prototype.push=function(t,e){if(Tt.prototype.e.call(this,t),this.v){if(this.p.length<2&&!e)return;this.p=this.p.subarray(2),this.v=0}if(e){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Tt.prototype.c.call(this,e)},t}();e.Unzlib=Nt;var Ut=function(t){this.ondata=t,ct([K,it,function(){return[lt,Tt,Nt]}],this,0,(function(){var t=new Nt;onmessage=lt(t)}),11)};function jt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return st(t,e,[K,it,function(){return[Vt]}],(function(t){return ot(Vt(t.data[0],at(t.data[1])))}),5,n)}function Vt(t,e){return I((_t(t),t.subarray(2,-4)),e)}e.AsyncUnzlib=Ut,e.unzlib=jt,e.unzlibSync=Vt;var Gt=function(){function t(t){this.G=kt,this.I=Tt,this.Z=Nt,this.ondata=t}return t.prototype.push=function(t,e){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var n=new r(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var i=this,o=function(){i.ondata.apply(i,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(o):new this.Z(o),this.s.push(this.p,e),this.p=null}}},t}();e.Decompress=Gt;var Ht=function(){function t(t){this.G=zt,this.I=Et,this.Z=Ut,this.ondata=t}return t.prototype.push=function(t,e){Gt.prototype.push.call(this,t,e)},t}();e.AsyncDecompress=Ht,e.decompress=function(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return 31==t[0]&&139==t[1]&&8==t[2]?Dt(t,e,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?At(t,e,n):jt(t,e,n)},e.decompressSync=function(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?Ot(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Ct(t,e):Vt(t,e)};var Wt=function(t,e,n,i){for(var o in t){var a=t[o],s=e+o;a instanceof r?n[s]=[a,i]:Array.isArray(a)?n[s]=[a[0],X(i,a[1])]:Wt(a,s+"/",n,i)}},qt="undefined"!=typeof TextEncoder&&new TextEncoder,Zt="undefined"!=typeof TextDecoder&&new TextDecoder,Xt=0;try{Zt.decode(j,{stream:!0}),Xt=1}catch(n){}var $t=function(t){for(var e="",n=0;;){var r=t[n++],i=(r>127)+(r>223)+(r>239);if(n+i>t.length)return[e,P(t,n-1)];i?3==i?(r=((15&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,e+=String.fromCharCode(55296|r>>10,56320|1023&r)):e+=String.fromCharCode(1&i?(31&r)<<6|63&t[n++]:(15&r)<<12|(63&t[n++])<<6|63&t[n++]):e+=String.fromCharCode(r)}},Jt=function(){function t(t){this.ondata=t,Xt?this.t=new TextDecoder:this.p=j}return t.prototype.push=function(t,e){if(!this.ondata)throw"no callback";if(e||(e=!1),this.t)return this.ondata(this.t.decode(t,{stream:!e}),e);var n=new r(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length);var i=$t(n),o=i[0],a=i[1];if(e&&a.length)throw"invalid utf-8 data";this.p=a,this.ondata(o,e)},t}();e.DecodeUTF8=Jt;var Yt=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,e){if(!this.ondata)throw"no callback";this.ondata(Qt(t),e||!1)},t}();function Qt(t,e){if(e){for(var n=new r(t.length),i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}if(qt)return qt.encode(t);var o=t.length,a=new r(t.length+(t.length>>1)),s=0,l=function(t){a[s++]=t};for(i=0;i<o;++i){if(s+5>a.length){var c=new r(s+8+(o-i<<1));c.set(a),a=c}var u=t.charCodeAt(i);u<128||e?l(u):u<2048?(l(192|u>>>6),l(128|63&u)):u>55295&&u<57344?(l(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++i))>>>18),l(128|u>>>12&63),l(128|u>>>6&63),l(128|63&u)):(l(224|u>>>12),l(128|u>>>6&63),l(128|63&u))}return P(a,0,s)}function Kt(t,e){if(e){for(var n="",r=0;r<t.length;r+=16384)n+=String.fromCharCode.apply(null,t.subarray(r,r+16384));return n}if(Zt)return Zt.decode(t);var i=$t(t);if(i[1].length)throw"invalid utf-8 data";return i[0]}e.EncodeUTF8=Yt,e.strToU8=Qt,e.strFromU8=Kt;var te=function(t){return 1==t?3:t<6?2:9==t?1:0},ee=function(t,e){return e+30+ut(t,e+26)+ut(t,e+28)},ne=function(t,e,n){var r=ut(t,e+28),i=Kt(t.subarray(e+46,e+46+r),!(2048&ut(t,e+8))),o=e+46+r,a=pt(t,e+20),s=n&&4294967295==a?re(t,o):[a,pt(t,e+24),pt(t,e+42)],l=s[0],c=s[1],u=s[2];return[ut(t,e+10),l,c,i,o+ut(t,e+30)+ut(t,e+32),u]},re=function(t,e){for(;1!=ut(t,e);e+=4+ut(t,e+2));return[ht(t,e+12),ht(t,e+4),ht(t,e+20)]},ie=function(t){var e=0;if(t)for(var n in t){var r=t[n].length;if(r>65535)throw"extra field too long";e+=r+4}return e},oe=function(t,e,n,r,i,o,a,s){var l=r.length,c=n.extra,u=s&&s.length,p=ie(c);dt(t,e,null!=a?33639248:67324752),e+=4,null!=a&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(null==o&&8),t[e++]=i&&8,t[e++]=255&n.compression,t[e++]=n.compression>>8;var h=new Date(null==n.mtime?Date.now():n.mtime),d=h.getFullYear()-1980;if(d<0||d>119)throw"date not in range 1980-2099";if(dt(t,e,2*(d<<24)|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>>1),e+=4,null!=o&&(dt(t,e,n.crc),dt(t,e+4,o),dt(t,e+8,n.size)),dt(t,e+12,l),dt(t,e+14,p),e+=16,null!=a&&(dt(t,e,u),dt(t,e+6,n.attrs),dt(t,e+10,a),e+=14),t.set(r,e),e+=l,p)for(var f in c){var m=c[f],g=m.length;dt(t,e,+f),dt(t,e+2,g),t.set(m,e+4),e+=4+g}return u&&(t.set(s,e),e+=u),e},ae=function(t,e,n,r,i){dt(t,e,101010256),dt(t,e+8,n),dt(t,e+10,n),dt(t,e+12,r),dt(t,e+16,i)},se=function(){function t(t){this.filename=t,this.c=H(),this.size=0,this.compression=0}return t.prototype.process=function(t,e){this.ondata(null,t,e)},t.prototype.push=function(t,e){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},t}();e.ZipPassThrough=se;var le=function(){function t(t,e){var n=this;e||(e={}),se.call(this,t),this.d=new bt(e,(function(t,e){n.ondata(null,t,e)})),this.compression=8,this.flag=te(e.level)}return t.prototype.process=function(t,e){try{this.d.push(t,e)}catch(t){this.ondata(t,null,e)}},t.prototype.push=function(t,e){se.prototype.push.call(this,t,e)},t}();e.ZipDeflate=le;var ce=function(){function t(t,e){var n=this;e||(e={}),se.call(this,t),this.d=new wt(e,(function(t,e,r){n.ondata(t,e,r)})),this.compression=8,this.flag=te(e.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,e){this.d.push(t,e)},t.prototype.push=function(t,e){se.prototype.push.call(this,t,e)},t}();e.AsyncZipDeflate=ce;var ue=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var e=this;if(2&this.d)throw"stream finished";var n=Qt(t.filename),i=n.length,o=t.comment,a=o&&Qt(o),s=i!=t.filename.length||a&&o.length!=a.length,l=i+ie(t.extra)+30;if(i>65535)throw"filename too long";var c=new r(l);oe(c,0,t,n,s);var u=[c],p=function(){for(var t=0,n=u;t<n.length;t++)e.ondata(null,n[t],!1);u=[]},h=this.d;this.d=0;var d=this.u.length,f=X(t,{f:n,u:s,o:a,t:function(){t.terminate&&t.terminate()},r:function(){if(p(),h){var t=e.u[d+1];t?t.r():e.d=1}h=1}}),m=0;t.ondata=function(n,i,o){if(n)e.ondata(n,i,o),e.terminate();else if(m+=i.length,u.push(i),o){var a=new r(16);dt(a,0,134695760),dt(a,4,t.crc),dt(a,8,m),dt(a,12,t.size),u.push(a),f.c=m,f.b=l+m+16,f.crc=t.crc,f.size=t.size,h&&f.r(),h=1}else h&&p()},this.u.push(f)},t.prototype.end=function(){var t=this;if(2&this.d){if(1&this.d)throw"stream finishing";throw"stream finished"}this.d?this.e():this.u.push({r:function(){1&t.d&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3},t.prototype.e=function(){for(var t=0,e=0,n=0,i=0,o=this.u;i<o.length;i++)n+=46+(c=o[i]).f.length+ie(c.extra)+(c.o?c.o.length:0);for(var a=new r(n+22),s=0,l=this.u;s<l.length;s++){var c;oe(a,t,c=l[s],c.f,c.u,c.c,e,c.o),t+=46+c.f.length+ie(c.extra)+(c.o?c.o.length:0),e+=c.b}ae(a,t,this.u.length,n,e),this.ondata(null,a,!0),this.d=2},t.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++)e[t].t();this.d=2},t}();e.Zip=ue,e.zip=function(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";var i={};Wt(t,"",i,e);var o=Object.keys(i),a=o.length,s=0,l=0,c=a,u=Array(a),p=[],h=function(){for(var t=0;t<p.length;++t)p[t]()},d=function(){var t=new r(l+22),e=s,i=l-s;l=0;for(var o=0;o<c;++o){var a=u[o];try{var p=a.c.length;oe(t,l,a,a.f,a.u,p);var h=30+a.f.length+ie(a.extra),d=l+h;t.set(a.c,d),oe(t,s,a,a.f,a.u,p,l,a.m),s+=16+h+(a.m?a.m.length:0),l=d+p}catch(t){return n(t,null)}}ae(t,s,u.length,i,e),n(null,t)};a||d();for(var f=function(t){var e=o[t],r=i[e],c=r[0],f=r[1],m=H(),g=c.length;m.p(c);var y=Qt(e),v=y.length,_=f.comment,x=_&&Qt(_),b=x&&x.length,w=ie(f.extra),M=0==f.level?0:8,S=function(r,i){if(r)h(),n(r,null);else{var o=i.length;u[t]=X(f,{size:g,crc:m.d(),c:i,f:y,m:x,u:v!=e.length||x&&_.length!=b,compression:M}),s+=30+v+w+o,l+=76+2*(v+w)+(b||0)+o,--a||d()}};if(v>65535&&S("filename too long",null),M)if(g<16e4)try{S(null,St(c,f))}catch(t){S(t,null)}else p.push(Mt(c,f,S));else S(null,c)},m=0;m<c;++m)f(m);return h},e.zipSync=function(t,e){e||(e={});var n={},i=[];Wt(t,"",n,e);var o=0,a=0;for(var s in n){var l=n[s],c=l[0],u=l[1],p=0==u.level?0:8,h=(S=Qt(s)).length,d=u.comment,f=d&&Qt(d),m=f&&f.length,g=ie(u.extra);if(h>65535)throw"filename too long";var y=p?St(c,u):c,v=y.length,_=H();_.p(c),i.push(X(u,{size:c.length,crc:_.d(),c:y,f:S,m:f,u:h!=s.length||f&&d.length!=m,o:o,compression:p})),o+=30+h+g+v,a+=76+2*(h+g)+(m||0)+v}for(var x=new r(a+22),b=o,w=a-o,M=0;M<i.length;++M){var S;oe(x,(S=i[M]).o,S,S.f,S.u,S.c.length);var T=30+S.f.length+ie(S.extra);x.set(S.c,S.o+T),oe(x,o,S,S.f,S.u,S.c.length,S.o,S.m),o+=16+T+(S.m?S.m.length:0)}return ae(x,o,i.length,w,b),x};var pe=function(){function t(){}return t.prototype.push=function(t,e){this.ondata(null,t,e)},t.compression=0,t}();e.UnzipPassThrough=pe;var he=function(){function t(){var t=this;this.i=new Tt((function(e,n){t.ondata(null,e,n)}))}return t.prototype.push=function(t,e){try{this.i.push(t,e)}catch(n){this.ondata(n,t,e)}},t.compression=8,t}();e.UnzipInflate=he;var de=function(){function t(t,e){var n=this;e<32e4?this.i=new Tt((function(t,e){n.ondata(null,t,e)})):(this.i=new Et((function(t,e,r){n.ondata(t,e,r)})),this.terminate=this.i.terminate)}return t.prototype.push=function(t,e){this.i.terminate&&(t=P(t,0)),this.i.push(t,e)},t.compression=8,t}();e.AsyncUnzipInflate=de;var fe=function(){function t(t){this.onfile=t,this.k=[],this.o={0:pe},this.p=j}return t.prototype.push=function(t,e){var n=this;if(!this.onfile)throw"no callback";if(this.c>0){var i=Math.min(this.c,t.length),o=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(o,!this.c):this.k[0].push(o),(t=t.subarray(i)).length)return this.push(t,e)}else{var a=0,s=0,l=void 0,c=void 0;this.p.length?t.length?((c=new r(this.p.length+t.length)).set(this.p),c.set(t,this.p.length)):c=this.p:c=t;for(var u=c.length,p=this.c,h=p&&this.d,d=function(){var t,e=pt(c,s);if(67324752==e){a=1,l=s,f.d=null,f.c=0;var r=ut(c,s+6),i=ut(c,s+8),o=2048&r,h=8&r,d=ut(c,s+26),m=ut(c,s+28);if(u>s+30+d+m){var g=[];f.k.unshift(g),a=2;var y=pt(c,s+18),v=pt(c,s+22),_=Kt(c.subarray(s+30,s+=30+d),!o);4294967295==y?(t=h?[-2]:re(c,s),y=t[0],v=t[1]):h&&(y=-1),s+=m,f.c=y;var x={name:_,compression:i,start:function(){if(!x.ondata)throw"no callback";if(y){var t=n.o[i];if(!t)throw"unknown compression type "+i;var e=y<0?new t(_):new t(_,y,v);e.ondata=function(t,e,n){x.ondata(t,e,n)};for(var r=0,o=g;r<o.length;r++)e.push(o[r],!1);n.k[0]==g?n.d=e:e.push(j,!0)}else x.ondata(null,j,!0)},terminate:function(){n.k[0]==g&&n.d.terminate&&n.d.terminate()}};y>=0&&(x.size=y,x.originalSize=v),f.onfile(x)}return"break"}if(p){if(134695760==e)return l=s+=12+(-2==p&&8),a=2,f.c=0,"break";if(33639248==e)return l=s-=4,a=2,f.c=0,"break"}},f=this;s<u-4&&"break"!==d();++s);if(this.p=j,p<0){var m=c.subarray(0,a?l-12-(-2==p&&8)-(134695760==pt(c,l-16)&&4):s);h?h.push(m,!!a):this.k[+(2==a)].push(m)}if(2&a)return this.push(c.subarray(s),e);this.p=c.subarray(s)}if(e&&this.c)throw"invalid zip file"},t.prototype.register=function(t){this.o[t.compression]=t},t}();return e.Unzip=fe,e.unzip=function(t,e){if("function"!=typeof e)throw"no callback";for(var n=[],i=function(){for(var t=0;t<n.length;++t)n[t]()},o={},a=t.length-22;101010256!=pt(t,a);--a)if(!a||t.length-a>65558)return void e("invalid zip file",null);var s=ut(t,a+8);s||e(null,{});var l=s,c=pt(t,a+16),u=4294967295==c;if(u){if(a=pt(t,a-12),101075792!=pt(t,a))return void e("invalid zip file",null);l=s=pt(t,a+32),c=pt(t,a+48)}for(var p=function(a){var l=ne(t,c,u),p=l[0],h=l[1],d=l[2],f=l[3],m=l[4],g=ee(t,l[5]);c=m;var y=function(t,n){t?(i(),e(t,null)):(o[f]=n,--s||e(null,o))};if(p)if(8==p){var v=t.subarray(g,g+h);if(h<32e4)try{y(null,Ct(v,new r(d)))}catch(t){y(t,null)}else n.push(At(v,{size:d},y))}else y("unknown compression type "+p,null);else y(null,P(t,g,g+h))},h=0;h<l;++h)p();return i},e.unzipSync=function(t){for(var e={},n=t.length-22;101010256!=pt(t,n);--n)if(!n||t.length-n>65558)throw"invalid zip file";var i=ut(t,n+8);if(!i)return{};var o=pt(t,n+16),a=4294967295==o;if(a){if(n=pt(t,n-12),101075792!=pt(t,n))throw"invalid zip file";i=pt(t,n+32),o=pt(t,n+48)}for(var s=0;s<i;++s){var l=ne(t,o,a),c=l[0],u=l[1],p=l[2],h=l[3],d=l[4],f=ee(t,l[5]);if(o=d,c){if(8!=c)throw"unknown compression type "+c;e[h]=Ct(t.subarray(f,f+u),new r(p))}else e[h]=P(t,f,f+u)}return e},e}))}).call(this)}).call(this,n({}).setImmediate),Z=Z.exports;var X={};!function(){let t,e,n;class i{constructor(t,e){this.textureLoader=t,this.manager=e}parse(){e=this.parseConnections();const t=this.parseImages(),r=this.parseTextures(t),i=this.parseMaterials(r),a=this.parseDeformers(),s=(new o).parse(a);return this.parseScene(a,s,i),n}parseConnections(){const e=new Map;return"Connections"in t&&t.Connections.connections.forEach((function(t){const n=t[0],r=t[1],i=t[2];e.has(n)||e.set(n,{parents:[],children:[]});const o={ID:r,relationship:i};e.get(n).parents.push(o),e.has(r)||e.set(r,{parents:[],children:[]});const a={ID:n,relationship:i};e.get(r).children.push(a)})),e}parseImages(){const e={},n={};if("Video"in t.Objects){const r=t.Objects.Video;for(const t in r){const i=r[t];if(e[parseInt(t)]=i.RelativeFilename||i.Filename,"Content"in i){const e=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,o="string"==typeof i.Content&&""!==i.Content;if(e||o){const e=this.parseImage(r[t]);n[i.RelativeFilename||i.Filename]=e}}}}for(const t in e){const r=e[t];void 0!==n[r]?e[t]=n[r]:e[t]=e[t].split("\\").pop()}return e}parseImage(t){const e=t.Content,n=t.RelativeFilename||t.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let i;switch(r){case"bmp":i="image/bmp";break;case"jpg":case"jpeg":i="image/jpeg";break;case"png":i="image/png";break;case"tif":i="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),i="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+r+'" is not supported.')}if("string"==typeof e)return"data:"+i+";base64,"+e;{const t=new Uint8Array(e);return window.URL.createObjectURL(new Blob([t],{type:i}))}}parseTextures(e){const n=new Map;if("Texture"in t.Objects){const r=t.Objects.Texture;for(const t in r){const i=this.parseTexture(r[t],e);n.set(parseInt(t),i)}}return n}parseTexture(t,e){const n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;const i=t.WrapModeU,o=t.WrapModeV,a=void 0!==i?i.value:0,s=void 0!==o?o.value:0;if(n.wrapS=0===a?r.RepeatWrapping:r.ClampToEdgeWrapping,n.wrapT=0===s?r.RepeatWrapping:r.ClampToEdgeWrapping,"Scaling"in t){const e=t.Scaling.value;n.repeat.x=e[0],n.repeat.y=e[1]}return n}loadTexture(t,n){let i;const o=this.textureLoader.path,a=e.get(t.id).children;let s;void 0!==a&&a.length>0&&void 0!==n[a[0].ID]&&(0!==(i=n[a[0].ID]).indexOf("blob:")&&0!==i.indexOf("data:")||this.textureLoader.setPath(void 0));const l=t.FileName.slice(-3).toLowerCase();if("tga"===l){const e=this.manager.getHandler(".tga");null===e?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),s=new r.Texture):(e.setPath(this.textureLoader.path),s=e.load(i))}else"psd"===l?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),s=new r.Texture):s=this.textureLoader.load(i);return this.textureLoader.setPath(o),s}parseMaterials(e){const n=new Map;if("Material"in t.Objects){const r=t.Objects.Material;for(const t in r){const i=this.parseMaterial(r[t],e);null!==i&&n.set(parseInt(t),i)}}return n}parseMaterial(t,n){const i=t.id,o=t.attrName;let a=t.ShadingModel;if("object"==typeof a&&(a=a.value),!e.has(i))return null;const s=this.parseParameters(t,n,i);let l;switch(a.toLowerCase()){case"phong":l=new r.MeshPhongMaterial;break;case"lambert":l=new r.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to THREE.MeshPhongMaterial.',a),l=new r.MeshPhongMaterial}return l.setValues(s),l.name=o,l}parseParameters(t,n,i){const o={};t.BumpFactor&&(o.bumpScale=t.BumpFactor.value),t.Diffuse?o.color=(new r.Color).fromArray(t.Diffuse.value):!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(o.color=(new r.Color).fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(o.displacementScale=t.DisplacementFactor.value),t.Emissive?o.emissive=(new r.Color).fromArray(t.Emissive.value):!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(o.emissive=(new r.Color).fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(o.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(o.opacity=parseFloat(t.Opacity.value)),o.opacity<1&&(o.transparent=!0),t.ReflectionFactor&&(o.reflectivity=t.ReflectionFactor.value),t.Shininess&&(o.shininess=t.Shininess.value),t.Specular?o.specular=(new r.Color).fromArray(t.Specular.value):t.SpecularColor&&"Color"===t.SpecularColor.type&&(o.specular=(new r.Color).fromArray(t.SpecularColor.value));const a=this;return e.get(i).children.forEach((function(t){const e=t.relationship;switch(e){case"Bump":o.bumpMap=a.getTexture(n,t.ID);break;case"Maya|TEX_ao_map":o.aoMap=a.getTexture(n,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":o.map=a.getTexture(n,t.ID),void 0!==o.map&&(o.map.encoding=r.sRGBEncoding);break;case"DisplacementColor":o.displacementMap=a.getTexture(n,t.ID);break;case"EmissiveColor":o.emissiveMap=a.getTexture(n,t.ID),void 0!==o.emissiveMap&&(o.emissiveMap.encoding=r.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":o.normalMap=a.getTexture(n,t.ID);break;case"ReflectionColor":o.envMap=a.getTexture(n,t.ID),void 0!==o.envMap&&(o.envMap.mapping=r.EquirectangularReflectionMapping,o.envMap.encoding=r.sRGBEncoding);break;case"SpecularColor":o.specularMap=a.getTexture(n,t.ID),void 0!==o.specularMap&&(o.specularMap.encoding=r.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":o.alphaMap=a.getTexture(n,t.ID),o.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",e)}})),o}getTexture(n,r){return"LayeredTexture"in t.Objects&&r in t.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=e.get(r).children[0].ID),n.get(r)}parseDeformers(){const n={},r={};if("Deformer"in t.Objects){const i=t.Objects.Deformer;for(const t in i){const o=i[t],a=e.get(parseInt(t));if("Skin"===o.attrType){const e=this.parseSkeleton(a,i);e.ID=t,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),e.geometryID=a.parents[0].ID,n[t]=e}else if("BlendShape"===o.attrType){const e={id:t};e.rawTargets=this.parseMorphTargets(a,i),e.id=t,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),r[t]=e}}}return{skeletons:n,morphTargets:r}}parseSkeleton(t,e){const n=[];return t.children.forEach((function(t){const i=e[t.ID];if("Cluster"!==i.attrType)return;const o={ID:t.ID,indices:[],weights:[],transformLink:(new r.Matrix4).fromArray(i.TransformLink.a)};"Indexes"in i&&(o.indices=i.Indexes.a,o.weights=i.Weights.a),n.push(o)})),{rawBones:n,bones:[]}}parseMorphTargets(t,n){const r=[];for(let i=0;i<t.children.length;i++){const o=t.children[i],a=n[o.ID],s={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;s.geoID=e.get(parseInt(o.ID)).children.filter((function(t){return void 0===t.relationship}))[0].ID,r.push(s)}return r}parseScene(i,o,s){n=new r.Group;const l=this.parseModels(i.skeletons,o,s),c=t.Objects.Model,u=this;l.forEach((function(t){const r=c[t.ID];u.setLookAtProperties(t,r),e.get(t.ID).parents.forEach((function(e){const n=l.get(e.ID);void 0!==n&&n.add(t)})),null===t.parent&&n.add(t)})),this.bindSkeleton(i.skeletons,o,l),this.createAmbientLight(),n.traverse((function(t){if(t.userData.transformData){t.parent&&(t.userData.transformData.parentMatrix=t.parent.matrix,t.userData.transformData.parentMatrixWorld=t.parent.matrixWorld);const e=y(t.userData.transformData);t.applyMatrix4(e),t.updateWorldMatrix()}}));const p=(new a).parse();1===n.children.length&&n.children[0].isGroup&&(n.children[0].animations=p,n=n.children[0]),n.animations=p}parseModels(n,i,o){const a=new Map,s=t.Objects.Model;for(const t in s){const l=parseInt(t),c=s[t],u=e.get(l);let p=this.buildSkeleton(u,n,l,c.attrName);if(!p){switch(c.attrType){case"Camera":p=this.createCamera(u);break;case"Light":p=this.createLight(u);break;case"Mesh":p=this.createMesh(u,i,o);break;case"NurbsCurve":p=this.createCurve(u,i);break;case"LimbNode":case"Root":p=new r.Bone;break;default:p=new r.Group}p.name=c.attrName?r.PropertyBinding.sanitizeNodeName(c.attrName):"",p.ID=l}this.getTransformData(p,c),a.set(l,p)}return a}buildSkeleton(t,e,n,i){let o=null;return t.parents.forEach((function(t){for(const a in e){const s=e[a];s.rawBones.forEach((function(e,a){if(e.ID===t.ID){const t=o;(o=new r.Bone).matrixWorld.copy(e.transformLink),o.name=i?r.PropertyBinding.sanitizeNodeName(i):"",o.ID=n,s.bones[a]=o,null!==t&&o.add(t)}}))}})),o}createCamera(e){let n,i;if(e.children.forEach((function(e){const n=t.Objects.NodeAttribute[e.ID];void 0!==n&&(i=n)})),void 0===i)n=new r.Object3D;else{let t=0;void 0!==i.CameraProjectionType&&1===i.CameraProjectionType.value&&(t=1);let e=1;void 0!==i.NearPlane&&(e=i.NearPlane.value/1e3);let o=1e3;void 0!==i.FarPlane&&(o=i.FarPlane.value/1e3);let a=window.innerWidth,s=window.innerHeight;void 0!==i.AspectWidth&&void 0!==i.AspectHeight&&(a=i.AspectWidth.value,s=i.AspectHeight.value);const l=a/s;let c=45;void 0!==i.FieldOfView&&(c=i.FieldOfView.value);const u=i.FocalLength?i.FocalLength.value:null;switch(t){case 0:n=new r.PerspectiveCamera(c,l,e,o),null!==u&&n.setFocalLength(u);break;case 1:n=new r.OrthographicCamera(-a/2,a/2,s/2,-s/2,e,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+t+"."),n=new r.Object3D}}return n}createLight(e){let n,i;if(e.children.forEach((function(e){const n=t.Objects.NodeAttribute[e.ID];void 0!==n&&(i=n)})),void 0===i)n=new r.Object3D;else{let t;t=void 0===i.LightType?0:i.LightType.value;let e=16777215;void 0!==i.Color&&(e=(new r.Color).fromArray(i.Color.value));let o=void 0===i.Intensity?1:i.Intensity.value/100;void 0!==i.CastLightOnObject&&0===i.CastLightOnObject.value&&(o=0);let a=0;void 0!==i.FarAttenuationEnd&&(a=void 0!==i.EnableFarAttenuation&&0===i.EnableFarAttenuation.value?0:i.FarAttenuationEnd.value);const s=1;switch(t){case 0:n=new r.PointLight(e,o,a,s);break;case 1:n=new r.DirectionalLight(e,o);break;case 2:let t=Math.PI/3;void 0!==i.InnerAngle&&(t=r.MathUtils.degToRad(i.InnerAngle.value));let l=0;void 0!==i.OuterAngle&&(l=r.MathUtils.degToRad(i.OuterAngle.value),l=Math.max(l,1)),n=new r.SpotLight(e,o,a,t,l,s);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a THREE.PointLight."),n=new r.PointLight(e,o)}void 0!==i.CastShadows&&1===i.CastShadows.value&&(n.castShadow=!0)}return n}createMesh(t,e,n){let i,o=null,a=null;const s=[];return t.children.forEach((function(t){e.has(t.ID)&&(o=e.get(t.ID)),n.has(t.ID)&&s.push(n.get(t.ID))})),s.length>1?a=s:s.length>0?a=s[0]:(a=new r.MeshPhongMaterial({color:13421772}),s.push(a)),"color"in o.attributes&&s.forEach((function(t){t.vertexColors=!0})),o.FBX_Deformer?(i=new r.SkinnedMesh(o,a)).normalizeSkinWeights():i=new r.Mesh(o,a),i}createCurve(t,e){const n=t.children.reduce((function(t,n){return e.has(n.ID)&&(t=e.get(n.ID)),t}),null),i=new r.LineBasicMaterial({color:3342591,linewidth:1});return new r.Line(n,i)}getTransformData(t,e){const n={};"InheritType"in e&&(n.inheritType=parseInt(e.InheritType.value)),n.eulerOrder="RotationOrder"in e?v(e.RotationOrder.value):"ZYX","Lcl_Translation"in e&&(n.translation=e.Lcl_Translation.value),"PreRotation"in e&&(n.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(n.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(n.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(n.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(n.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(n.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(n.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(n.rotationPivot=e.RotationPivot.value),t.userData.transformData=n}setLookAtProperties(i,o){"LookAtProperty"in o&&e.get(i.ID).children.forEach((function(e){if("LookAtProperty"===e.relationship){const o=t.Objects.Model[e.ID];if("Lcl_Translation"in o){const t=o.Lcl_Translation.value;void 0!==i.target?(i.target.position.fromArray(t),n.add(i.target)):i.lookAt((new r.Vector3).fromArray(t))}}}))}bindSkeleton(t,n,i){const o=this.parsePoseNodes();for(const a in t){const s=t[a];e.get(parseInt(s.ID)).parents.forEach((function(t){if(n.has(t.ID)){const n=t.ID;e.get(n).parents.forEach((function(t){i.has(t.ID)&&i.get(t.ID).bind(new r.Skeleton(s.bones),o[t.ID])}))}}))}}parsePoseNodes(){const e={};if("Pose"in t.Objects){const n=t.Objects.Pose;for(const t in n)if("BindPose"===n[t].attrType){const i=n[t].PoseNode;Array.isArray(i)?i.forEach((function(t){e[t.Node]=(new r.Matrix4).fromArray(t.Matrix.a)})):e[i.Node]=(new r.Matrix4).fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in t&&"AmbientColor"in t.GlobalSettings){const e=t.GlobalSettings.AmbientColor.value,i=e[0],o=e[1],a=e[2];if(0!==i||0!==o||0!==a){const t=new r.Color(i,o,a);n.add(new r.AmbientLight(t,1))}}}}class o{parse(n){const r=new Map;if("Geometry"in t.Objects){const i=t.Objects.Geometry;for(const t in i){const o=e.get(parseInt(t)),a=this.parseGeometry(o,i[t],n);r.set(parseInt(t),a)}}return r}parseGeometry(t,e,n){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,n);case"NurbsCurve":return this.parseNurbsGeometry(e)}}parseMeshGeometry(e,n,r){const i=r.skeletons,o=[],a=e.parents.map((function(e){return t.Objects.Model[e.ID]}));if(0===a.length)return;const s=e.children.reduce((function(t,e){return void 0!==i[e.ID]&&(t=i[e.ID]),t}),null);e.children.forEach((function(t){void 0!==r.morphTargets[t.ID]&&o.push(r.morphTargets[t.ID])}));const l=a[0],c={};"RotationOrder"in l&&(c.eulerOrder=v(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);const u=y(c);return this.genGeometry(n,s,o,u)}genGeometry(t,e,n,i){const o=new r.BufferGeometry;t.attrName&&(o.name=t.attrName);const a=this.parseGeoNode(t,e),s=this.genBuffers(a),l=new r.Float32BufferAttribute(s.vertex,3);if(l.applyMatrix4(i),o.setAttribute("position",l),s.colors.length>0&&o.setAttribute("color",new r.Float32BufferAttribute(s.colors,3)),e&&(o.setAttribute("skinIndex",new r.Uint16BufferAttribute(s.weightsIndices,4)),o.setAttribute("skinWeight",new r.Float32BufferAttribute(s.vertexWeights,4)),o.FBX_Deformer=e),s.normal.length>0){const t=(new r.Matrix3).getNormalMatrix(i),e=new r.Float32BufferAttribute(s.normal,3);e.applyNormalMatrix(t),o.setAttribute("normal",e)}if(s.uvs.forEach((function(t,e){let n="uv"+(e+1).toString();0===e&&(n="uv"),o.setAttribute(n,new r.Float32BufferAttribute(s.uvs[e],2))})),a.material&&"AllSame"!==a.material.mappingType){let t=s.materialIndex[0],e=0;if(s.materialIndex.forEach((function(n,r){n!==t&&(o.addGroup(e,r-e,t),t=n,e=r)})),o.groups.length>0){const e=o.groups[o.groups.length-1],n=e.start+e.count;n!==s.materialIndex.length&&o.addGroup(n,s.materialIndex.length-n,t)}0===o.groups.length&&o.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(o,t,n,i),o}parseGeoNode(t,e){const n={};if(n.vertexPositions=void 0!==t.Vertices?t.Vertices.a:[],n.vertexIndices=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(n.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(n.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(n.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){n.uv=[];let e=0;for(;t.LayerElementUV[e];)t.LayerElementUV[e].UV&&n.uv.push(this.parseUVs(t.LayerElementUV[e])),e++}return n.weightTable={},null!==e&&(n.skeleton=e,e.rawBones.forEach((function(t,e){t.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:e,weight:t.weights[i]})}))}))),n}genBuffers(t){const e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,i=!1,o=[],a=[],s=[],l=[],c=[],u=[];const p=this;return t.vertexIndices.forEach((function(h,d){let m,g=!1;h<0&&(h^=-1,g=!0);let y=[],v=[];if(o.push(3*h,3*h+1,3*h+2),t.color){const e=f(d,n,h,t.color);s.push(e[0],e[1],e[2])}if(t.skeleton){if(void 0!==t.weightTable[h]&&t.weightTable[h].forEach((function(t){v.push(t.weight),y.push(t.id)})),v.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);const t=[0,0,0,0],e=[0,0,0,0];v.forEach((function(n,r){let i=n,o=y[r];e.forEach((function(e,n,r){if(i>e){r[n]=i,i=e;const a=t[n];t[n]=o,o=a}}))})),y=t,v=e}for(;v.length<4;)v.push(0),y.push(0);for(let t=0;t<4;++t)c.push(v[t]),u.push(y[t])}if(t.normal){const e=f(d,n,h,t.normal);a.push(e[0],e[1],e[2])}t.material&&"AllSame"!==t.material.mappingType&&(m=f(d,n,h,t.material)[0]),t.uv&&t.uv.forEach((function(t,e){const r=f(d,n,h,t);void 0===l[e]&&(l[e]=[]),l[e].push(r[0]),l[e].push(r[1])})),r++,g&&(p.genFace(e,t,o,m,a,s,l,c,u,r),n++,r=0,o=[],a=[],s=[],l=[],c=[],u=[])})),e}genFace(t,e,n,r,i,o,a,s,l,c){for(let u=2;u<c;u++)t.vertex.push(e.vertexPositions[n[0]]),t.vertex.push(e.vertexPositions[n[1]]),t.vertex.push(e.vertexPositions[n[2]]),t.vertex.push(e.vertexPositions[n[3*(u-1)]]),t.vertex.push(e.vertexPositions[n[3*(u-1)+1]]),t.vertex.push(e.vertexPositions[n[3*(u-1)+2]]),t.vertex.push(e.vertexPositions[n[3*u]]),t.vertex.push(e.vertexPositions[n[3*u+1]]),t.vertex.push(e.vertexPositions[n[3*u+2]]),e.skeleton&&(t.vertexWeights.push(s[0]),t.vertexWeights.push(s[1]),t.vertexWeights.push(s[2]),t.vertexWeights.push(s[3]),t.vertexWeights.push(s[4*(u-1)]),t.vertexWeights.push(s[4*(u-1)+1]),t.vertexWeights.push(s[4*(u-1)+2]),t.vertexWeights.push(s[4*(u-1)+3]),t.vertexWeights.push(s[4*u]),t.vertexWeights.push(s[4*u+1]),t.vertexWeights.push(s[4*u+2]),t.vertexWeights.push(s[4*u+3]),t.weightsIndices.push(l[0]),t.weightsIndices.push(l[1]),t.weightsIndices.push(l[2]),t.weightsIndices.push(l[3]),t.weightsIndices.push(l[4*(u-1)]),t.weightsIndices.push(l[4*(u-1)+1]),t.weightsIndices.push(l[4*(u-1)+2]),t.weightsIndices.push(l[4*(u-1)+3]),t.weightsIndices.push(l[4*u]),t.weightsIndices.push(l[4*u+1]),t.weightsIndices.push(l[4*u+2]),t.weightsIndices.push(l[4*u+3])),e.color&&(t.colors.push(o[0]),t.colors.push(o[1]),t.colors.push(o[2]),t.colors.push(o[3*(u-1)]),t.colors.push(o[3*(u-1)+1]),t.colors.push(o[3*(u-1)+2]),t.colors.push(o[3*u]),t.colors.push(o[3*u+1]),t.colors.push(o[3*u+2])),e.material&&"AllSame"!==e.material.mappingType&&(t.materialIndex.push(r),t.materialIndex.push(r),t.materialIndex.push(r)),e.normal&&(t.normal.push(i[0]),t.normal.push(i[1]),t.normal.push(i[2]),t.normal.push(i[3*(u-1)]),t.normal.push(i[3*(u-1)+1]),t.normal.push(i[3*(u-1)+2]),t.normal.push(i[3*u]),t.normal.push(i[3*u+1]),t.normal.push(i[3*u+2])),e.uv&&e.uv.forEach((function(e,n){void 0===t.uvs[n]&&(t.uvs[n]=[]),t.uvs[n].push(a[n][0]),t.uvs[n].push(a[n][1]),t.uvs[n].push(a[n][2*(u-1)]),t.uvs[n].push(a[n][2*(u-1)+1]),t.uvs[n].push(a[n][2*u]),t.uvs[n].push(a[n][2*u+1])}))}addMorphTargets(e,n,r,i){if(0===r.length)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const o=this;r.forEach((function(r){r.rawTargets.forEach((function(r){const a=t.Objects.Geometry[r.geoID];void 0!==a&&o.genMorphGeometry(e,n,a,i,r.name)}))}))}genMorphGeometry(t,e,n,i,o){const a=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],s=void 0!==n.Vertices?n.Vertices.a:[],l=void 0!==n.Indexes?n.Indexes.a:[],c=3*t.attributes.position.count,u=new Float32Array(c);for(let t=0;t<l.length;t++){const e=3*l[t];u[e]=s[3*t],u[e+1]=s[3*t+1],u[e+2]=s[3*t+2]}const p={vertexIndices:a,vertexPositions:u},h=this.genBuffers(p),d=new r.Float32BufferAttribute(h.vertex,3);d.name=o||n.attrName,d.applyMatrix4(i),t.morphAttributes.position.push(d)}parseNormals(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.Normals.a;let i=[];return"IndexToDirect"===n&&("NormalIndex"in t?i=t.NormalIndex.a:"NormalsIndex"in t&&(i=t.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:e,referenceType:n}}parseUVs(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.UV.a;let i=[];return"IndexToDirect"===n&&(i=t.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:e,referenceType:n}}parseVertexColors(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.Colors.a;let i=[];return"IndexToDirect"===n&&(i=t.ColorIndex.a),{dataSize:4,buffer:r,indices:i,mappingType:e,referenceType:n}}parseMaterialIndices(t){const e=t.MappingInformationType,n=t.ReferenceInformationType;if("NoMappingInformation"===e)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const r=t.Materials.a,i=[];for(let t=0;t<r.length;++t)i.push(t);return{dataSize:1,buffer:r,indices:i,mappingType:e,referenceType:n}}parseNurbsGeometry(t){if(void 0===r.NURBSCurve)return console.error("THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new r.BufferGeometry;const e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new r.BufferGeometry;const n=e-1,i=t.KnotVector.a,o=[],a=t.Points.a;for(let t=0,e=a.length;t<e;t+=4)o.push((new r.Vector4).fromArray(a,t));let s,l;if("Closed"===t.Form)o.push(o[0]);else if("Periodic"===t.Form){s=n,l=i.length-1-s;for(let t=0;t<n;++t)o.push(o[t])}const c=new r.NURBSCurve(n,i,o,s,l).getPoints(12*o.length);return(new r.BufferGeometry).setFromPoints(c)}}class a{parse(){const t=[],e=this.parseClips();if(void 0!==e)for(const n in e){const r=e[n],i=this.addClip(r);t.push(i)}return t}parseClips(){if(void 0===t.Objects.AnimationCurve)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const n=this.parseAnimationLayers(e);return this.parseAnimStacks(n)}parseAnimationCurveNodes(){const e=t.Objects.AnimationCurveNode,n=new Map;for(const t in e){const r=e[t];if(null!==r.attrName.match(/S|R|T|DeformPercent/)){const t={id:r.id,attr:r.attrName,curves:{}};n.set(t.id,t)}}return n}parseAnimationCurves(n){const r=t.Objects.AnimationCurve;for(const t in r){const i={id:r[t].id,times:r[t].KeyTime.a.map(h),values:r[t].KeyValueFloat.a},o=e.get(i.id);if(void 0!==o){const t=o.parents[0].ID,e=o.parents[0].relationship;e.match(/X/)?n.get(t).curves.x=i:e.match(/Y/)?n.get(t).curves.y=i:e.match(/Z/)?n.get(t).curves.z=i:e.match(/d|DeformPercent/)&&n.has(t)&&(n.get(t).curves.morph=i)}}}parseAnimationLayers(i){const o=t.Objects.AnimationLayer,a=new Map;for(const s in o){const o=[],l=e.get(parseInt(s));void 0!==l&&(l.children.forEach((function(a,s){if(i.has(a.ID)){const l=i.get(a.ID);if(void 0!==l.curves.x||void 0!==l.curves.y||void 0!==l.curves.z){if(void 0===o[s]){const i=e.get(a.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID;if(void 0!==i){const e=t.Objects.Model[i.toString()];if(void 0===e)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",a);const l={modelName:e.attrName?r.PropertyBinding.sanitizeNodeName(e.attrName):"",ID:e.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};n.traverse((function(t){t.ID===e.id&&(l.transform=t.matrix,t.userData.transformData&&(l.eulerOrder=t.userData.transformData.eulerOrder))})),l.transform||(l.transform=new r.Matrix4),"PreRotation"in e&&(l.preRotation=e.PreRotation.value),"PostRotation"in e&&(l.postRotation=e.PostRotation.value),o[s]=l}}o[s]&&(o[s][l.attr]=l)}else if(void 0!==l.curves.morph){if(void 0===o[s]){const n=e.get(a.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID,i=e.get(n).parents[0].ID,l=e.get(i).parents[0].ID,c=e.get(l).parents[0].ID,u=t.Objects.Model[c],p={modelName:u.attrName?r.PropertyBinding.sanitizeNodeName(u.attrName):"",morphName:t.Objects.Deformer[n].attrName};o[s]=p}o[s][l.attr]=l}}})),a.set(parseInt(s),o))}return a}parseAnimStacks(n){const r=t.Objects.AnimationStack,i={};for(const t in r){const o=e.get(parseInt(t)).children;o.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=n.get(o[0].ID);i[t]={name:r[t].attrName,layer:a}}return i}addClip(t){let e=[];const n=this;return t.layer.forEach((function(t){e=e.concat(n.generateTracks(t))})),new r.AnimationClip(t.name,-1,e)}generateTracks(t){const e=[];let n=new r.Vector3,i=new r.Quaternion,o=new r.Vector3;if(t.transform&&t.transform.decompose(n,i,o),n=n.toArray(),i=(new r.Euler).setFromQuaternion(i,t.eulerOrder).toArray(),o=o.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){const r=this.generateVectorTrack(t.modelName,t.T.curves,n,"position");void 0!==r&&e.push(r)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){const n=this.generateRotationTrack(t.modelName,t.R.curves,i,t.preRotation,t.postRotation,t.eulerOrder);void 0!==n&&e.push(n)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){const n=this.generateVectorTrack(t.modelName,t.S.curves,o,"scale");void 0!==n&&e.push(n)}if(void 0!==t.DeformPercent){const n=this.generateMorphTrack(t);void 0!==n&&e.push(n)}return e}generateVectorTrack(t,e,n,i){const o=this.getTimesForAllAxes(e),a=this.getKeyframeTrackValues(o,e,n);return new r.VectorKeyframeTrack(t+"."+i,o,a)}generateRotationTrack(t,e,n,i,o,a){void 0!==e.x&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(r.MathUtils.degToRad)),void 0!==e.y&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(r.MathUtils.degToRad)),void 0!==e.z&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(r.MathUtils.degToRad));const s=this.getTimesForAllAxes(e),l=this.getKeyframeTrackValues(s,e,n);void 0!==i&&((i=i.map(r.MathUtils.degToRad)).push(a),i=(new r.Euler).fromArray(i),i=(new r.Quaternion).setFromEuler(i)),void 0!==o&&((o=o.map(r.MathUtils.degToRad)).push(a),o=(new r.Euler).fromArray(o),o=(new r.Quaternion).setFromEuler(o).invert());const c=new r.Quaternion,u=new r.Euler,p=[];for(let t=0;t<l.length;t+=3)u.set(l[t],l[t+1],l[t+2],a),c.setFromEuler(u),void 0!==i&&c.premultiply(i),void 0!==o&&c.multiply(o),c.toArray(p,t/3*4);return new r.QuaternionKeyframeTrack(t+".quaternion",s,p)}generateMorphTrack(t){const e=t.DeformPercent.curves.morph,i=e.values.map((function(t){return t/100})),o=n.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new r.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+o+"]",e.times,i)}getTimesForAllAxes(t){let e=[];if(void 0!==t.x&&(e=e.concat(t.x.times)),void 0!==t.y&&(e=e.concat(t.y.times)),void 0!==t.z&&(e=e.concat(t.z.times)),(e=e.sort((function(t,e){return t-e}))).length>1){let t=1,n=e[0];for(let r=1;r<e.length;r++){const i=e[r];i!==n&&(e[t]=i,n=i,t++)}e=e.slice(0,t)}return e}getKeyframeTrackValues(t,e,n){const r=n,i=[];let o=-1,a=-1,s=-1;return t.forEach((function(t){if(e.x&&(o=e.x.times.indexOf(t)),e.y&&(a=e.y.times.indexOf(t)),e.z&&(s=e.z.times.indexOf(t)),-1!==o){const t=e.x.values[o];i.push(t),r[0]=t}else i.push(r[0]);if(-1!==a){const t=e.y.values[a];i.push(t),r[1]=t}else i.push(r[1]);if(-1!==s){const t=e.z.values[s];i.push(t),r[2]=t}else i.push(r[2])})),i}interpolateRotations(t){for(let e=1;e<t.values.length;e++){const n=t.values[e-1],r=t.values[e]-n,i=Math.abs(r);if(i>=180){const o=i/180,a=r/o;let s=n+a;const l=t.times[e-1],c=(t.times[e]-l)/o;let u=l+c;const p=[],h=[];for(;u<t.times[e];)p.push(u),u+=c,h.push(s),s+=a;t.times=b(t.times,e,p),t.values=b(t.values,e,h)}}}}class s{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(t){this.nodeStack.push(t),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(t,e){this.currentProp=t,this.currentPropName=e}parse(t){this.currentIndent=0,this.allNodes=new u,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const e=this,n=t.split(/[\r\n]+/);return n.forEach((function(t,r){const i=t.match(/^[\s\t]*;/),o=t.match(/^[\s\t]*$/);if(i||o)return;const a=t.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){",""),s=t.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=t.match("^\\t{"+(e.currentIndent-1)+"}}");a?e.parseNodeBegin(t,a):s?e.parseNodeProperty(t,s,n[++r]):l?e.popStack():t.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(t)})),this.allNodes}parseNodeBegin(t,e){const n=e[1].trim().replace(/^"/,"").replace(/"$/,""),r=e[2].split(",").map((function(t){return t.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:n},o=this.parseNodeAttr(r),a=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,i):n in a?("PoseNode"===n?a.PoseNode.push(i):void 0!==a[n].id&&(a[n]={},a[n][a[n].id]=a[n]),""!==o.id&&(a[n][o.id]=i)):"number"==typeof o.id?(a[n]={},a[n][o.id]=i):"Properties70"!==n&&(a[n]="PoseNode"===n?[i]:i),"number"==typeof o.id&&(i.id=o.id),""!==o.name&&(i.attrName=o.name),""!==o.type&&(i.attrType=o.type),this.pushStack(i)}parseNodeAttr(t){let e=t[0];""!==t[0]&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));let n="",r="";return t.length>1&&(n=t[1].replace(/^(\w+)::/,""),r=t[2]),{id:e,name:n,type:r}}parseNodeProperty(t,e,n){let r=e[1].replace(/^"/,"").replace(/"$/,"").trim(),i=e[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===r){const t=i.split(",").slice(1),e=parseInt(t[0]),n=parseInt(t[1]);let a=i.split(",").slice(3);r="connections",function(t,e){for(let n=0,r=t.length,i=e.length;n<i;n++,r++)t[r]=e[n]}(i=[e,n],a=a.map((function(t){return t.trim().replace(/^"/,"")}))),void 0===o[r]&&(o[r]=[])}"Node"===r&&(o.id=i),r in o&&Array.isArray(o[r])?o[r].push(i):"a"!==r?o[r]=i:o.a=i,this.setCurrentProp(o,r),"a"===r&&","!==i.slice(-1)&&(o.a=_(i))}else this.parseNodeSpecialProperty(t,r,i)}parseNodePropertyContinued(t){const e=this.getCurrentNode();e.a+=t,","!==t.slice(-1)&&(e.a=_(e.a))}parseNodeSpecialProperty(t,e,n){const r=n.split('",').map((function(t){return t.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=r[0],o=r[1],a=r[2],s=r[3];let l=r[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=_(l)}this.getPrevNode()[i]={type:o,type2:a,flag:s,value:l},this.setCurrentProp(this.getPrevNode(),i)}}class l{parse(t){const e=new c(t);e.skip(23);const n=e.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new u;for(;!this.endOfContent(e);){const t=this.parseNode(e,n);null!==t&&r.add(t.name,t)}return r}endOfContent(t){return t.size()%16==0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()}parseNode(t,e){const n={},r=e>=7500?t.getUint64():t.getUint32(),i=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();const o=t.getUint8(),a=t.getString(o);if(0===r)return null;const s=[];for(let e=0;e<i;e++)s.push(this.parseProperty(t));const l=s.length>0?s[0]:"",c=s.length>1?s[1]:"",u=s.length>2?s[2]:"";for(n.singleProperty=1===i&&t.getOffset()===r;r>t.getOffset();){const r=this.parseNode(t,e);null!==r&&this.parseSubNode(a,n,r)}return n.propertyList=s,"number"==typeof l&&(n.id=l),""!==c&&(n.attrName=c),""!==u&&(n.attrType=u),""!==a&&(n.name=a),n}parseSubNode(t,e,n){if(!0===n.singleProperty){const t=n.propertyList[0];Array.isArray(t)?(e[n.name]=n,n.a=t):e[n.name]=t}else if("Connections"===t&&"C"===n.name){const t=[];n.propertyList.forEach((function(e,n){0!==n&&t.push(e)})),void 0===e.connections&&(e.connections=[]),e.connections.push(t)}else if("Properties70"===n.name)Object.keys(n).forEach((function(t){e[t]=n[t]}));else if("Properties70"===t&&"P"===n.name){let t=n.propertyList[0],r=n.propertyList[1];const i=n.propertyList[2],o=n.propertyList[3];let a;0===t.indexOf("Lcl ")&&(t=t.replace("Lcl ","Lcl_")),0===r.indexOf("Lcl ")&&(r=r.replace("Lcl ","Lcl_")),a="Color"===r||"ColorRGB"===r||"Vector"===r||"Vector3D"===r||0===r.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],e[t]={type:r,type2:i,flag:o,value:a}}else void 0===e[n.name]?"number"==typeof n.id?(e[n.name]={},e[n.name][n.id]=n):e[n.name]=n:"PoseNode"===n.name?(Array.isArray(e[n.name])||(e[n.name]=[e[n.name]]),e[n.name].push(n)):void 0===e[n.name][n.id]&&(e[n.name][n.id]=n)}parseProperty(t){const e=t.getString(1);let n;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return n=t.getUint32(),t.getArrayBuffer(n);case"S":return n=t.getUint32(),t.getString(n);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=t.getUint32(),i=t.getUint32(),o=t.getUint32();if(0===i)switch(e){case"b":case"c":return t.getBooleanArray(r);case"d":return t.getFloat64Array(r);case"f":return t.getFloat32Array(r);case"i":return t.getInt32Array(r);case"l":return t.getInt64Array(r)}void 0===Z&&console.error("THREE.FBXLoader: External library fflate.min.js required.");const a=Z.unzlibSync(new Uint8Array(t.getArrayBuffer(o))),s=new c(a.buffer);switch(e){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}}}class c{constructor(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===e||e}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(t){this.offset+=t}getBoolean(){return 1==(1&this.getUint8())}getBooleanArray(t){const e=[];for(let n=0;n<t;n++)e.push(this.getBoolean());return e}getUint8(){const t=this.dv.getUint8(this.offset);return this.offset+=1,t}getInt16(){const t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}getInt32(){const t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}getInt32Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getInt32());return e}getUint32(){const t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}getInt64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),2147483648&e?(e=4294967295&~e,4294967295==(t=4294967295&~t)&&(e=e+1&4294967295),-(4294967296*e+(t=t+1&4294967295))):4294967296*e+t}getInt64Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getInt64());return e}getUint64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),4294967296*e+t}getFloat32(){const t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}getFloat32Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getFloat32());return e}getFloat64(){const t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}getFloat64Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getFloat64());return e}getArrayBuffer(t){const e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}getString(t){let e=[];for(let n=0;n<t;n++)e[n]=this.getUint8();const n=e.indexOf(0);return n>=0&&(e=e.slice(0,n)),r.LoaderUtils.decodeText(new Uint8Array(e))}}class u{add(t,e){this[t]=e}}function p(t){const e=t.match(/FBXVersion: (\d+)/);if(e)return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function h(t){return t/46186158e3}const d=[];function f(t,e,n,r){let i;switch(r.mappingType){case"ByPolygonVertex":i=t;break;case"ByPolygon":i=e;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);const o=i*r.dataSize,a=o+r.dataSize;return function(t,e,n,r){for(let i=n,o=0;i<r;i++,o++)t[o]=e[i];return t}(d,r.buffer,o,a)}const m=new r.Euler,g=new r.Vector3;function y(t){const e=new r.Matrix4,n=new r.Matrix4,i=new r.Matrix4,o=new r.Matrix4,a=new r.Matrix4,s=new r.Matrix4,l=new r.Matrix4,c=new r.Matrix4,u=new r.Matrix4,p=new r.Matrix4,h=new r.Matrix4,d=new r.Matrix4,f=t.inheritType?t.inheritType:0;if(t.translation&&e.setPosition(g.fromArray(t.translation)),t.preRotation){const e=t.preRotation.map(r.MathUtils.degToRad);e.push(t.eulerOrder),n.makeRotationFromEuler(m.fromArray(e))}if(t.rotation){const e=t.rotation.map(r.MathUtils.degToRad);e.push(t.eulerOrder),i.makeRotationFromEuler(m.fromArray(e))}if(t.postRotation){const e=t.postRotation.map(r.MathUtils.degToRad);e.push(t.eulerOrder),o.makeRotationFromEuler(m.fromArray(e)),o.invert()}t.scale&&a.scale(g.fromArray(t.scale)),t.scalingOffset&&l.setPosition(g.fromArray(t.scalingOffset)),t.scalingPivot&&s.setPosition(g.fromArray(t.scalingPivot)),t.rotationOffset&&c.setPosition(g.fromArray(t.rotationOffset)),t.rotationPivot&&u.setPosition(g.fromArray(t.rotationPivot)),t.parentMatrixWorld&&(h.copy(t.parentMatrix),p.copy(t.parentMatrixWorld));const y=n.clone().multiply(i).multiply(o),v=new r.Matrix4;v.extractRotation(p);const _=new r.Matrix4;_.copyPosition(p);const x=_.clone().invert().multiply(p),b=v.clone().invert().multiply(x),w=a,M=new r.Matrix4;if(0===f)M.copy(v).multiply(y).multiply(b).multiply(w);else if(1===f)M.copy(v).multiply(b).multiply(y).multiply(w);else{const t=(new r.Matrix4).scale((new r.Vector3).setFromMatrixScale(h)).clone().invert(),e=b.clone().multiply(t);M.copy(v).multiply(y).multiply(e).multiply(w)}const S=u.clone().invert(),T=s.clone().invert();let E=e.clone().multiply(c).multiply(u).multiply(n).multiply(i).multiply(o).multiply(S).multiply(l).multiply(s).multiply(a).multiply(T);const A=(new r.Matrix4).copyPosition(E),C=p.clone().multiply(A);return d.copyPosition(C),(E=d.clone().multiply(M)).premultiply(p.invert()),E}function v(t){const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(t=t||0)?(console.warn("THREE.FBXLoader: unsupported THREE.Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[t]}function _(t){return t.split(",").map((function(t){return parseFloat(t)}))}function x(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=t.byteLength),r.LoaderUtils.decodeText(new Uint8Array(t,e,n))}function b(t,e,n){return t.slice(0,e).concat(n).concat(t.slice(e))}r.FBXLoader=class extends r.Loader{constructor(t){super(t)}load(t,e,n,i){const o=this,a=""===o.path?r.LoaderUtils.extractUrlBase(t):o.path,s=new r.FileLoader(this.manager);s.setPath(o.path),s.setResponseType("arraybuffer"),s.setRequestHeader(o.requestHeader),s.setWithCredentials(o.withCredentials),s.load(t,(function(n){try{e(o.parse(n,a))}catch(e){i?i(e):console.error(e),o.manager.itemError(t)}}),n,i)}parse(e,n){if(function(t){const e="Kaydara FBX Binary \0";return t.byteLength>=e.length&&e===x(t,0,e.length)}(e))t=(new l).parse(e);else{const n=x(e);if(!function(t){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let n=0;function r(e){const r=t[e-1];return t=t.slice(n+e),n++,r}for(let t=0;t<e.length;++t)if(r(1)===e[t])return!1;return!0}(n))throw new Error("THREE.FBXLoader: Unknown format.");if(p(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+p(n));t=(new s).parse(n)}const o=new r.TextureLoader(this.manager).setPath(this.resourcePath||n).setCrossOrigin(this.crossOrigin);return new i(o,this.manager).parse(t)}}}(),X=X=r.FBXLoader;var $={};!function(){function t(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const e="KHR_binary_glTF",n="KHR_draco_mesh_compression",i="KHR_materials_pbrSpecularGlossiness",o="KHR_materials_unlit",a="KHR_texture_transform",s="KHR_mesh_quantization";class l{constructor(t){this.parser=t,this.name="KHR_lights_punctual",this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,r=e.length;n<r;n++){const r=e[n];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&t._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let i=e.cache.get(n);if(i)return i;const o=e.json,a=((o.extensions&&o.extensions[this.name]||{}).lights||[])[t];let s;const l=new r.Color(16777215);void 0!==a.color&&l.fromArray(a.color);const c=void 0!==a.range?a.range:0;switch(a.type){case"directional":(s=new r.DirectionalLight(l)).target.position.set(0,0,-1),s.add(s.target);break;case"point":(s=new r.PointLight(l)).distance=c;break;case"spot":(s=new r.SpotLight(l)).distance=c,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,s.angle=a.spot.outerConeAngle,s.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,s.target.position.set(0,0,-1),s.add(s.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return s.position.set(0,0,0),s.decay=2,void 0!==a.intensity&&(s.intensity=a.intensity),s.name=e.createUniqueName(a.name||"light_"+t),i=Promise.resolve(s),e.cache.add(n,i),i}createNodeAttachment(t){const e=this,n=this.parser,r=n.json.nodes[t],i=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(t){return n._getNodeRef(e.cache,i,t)}))}}class c{constructor(){this.name=o}getMaterialType(){return r.MeshBasicMaterial}extendParams(t,e,n){const i=[];t.color=new r.Color(1,1,1),t.opacity=1;const o=e.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const e=o.baseColorFactor;t.color.fromArray(e),t.opacity=e[3]}void 0!==o.baseColorTexture&&i.push(n.assignTexture(t,"map",o.baseColorTexture))}return Promise.all(i)}}class u{constructor(t){this.parser=t,this.name="KHR_materials_clearcoat"}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],a=i.extensions[this.name];if(void 0!==a.clearcoatFactor&&(e.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&o.push(n.assignTexture(e,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(e.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&o.push(n.assignTexture(e,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(o.push(n.assignTexture(e,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){const t=a.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new r.Vector2(t,-t)}return Promise.all(o)}}class p{constructor(t){this.parser=t,this.name="KHR_materials_transmission"}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],o=r.extensions[this.name];return void 0!==o.transmissionFactor&&(e.transmission=o.transmissionFactor),void 0!==o.transmissionTexture&&i.push(n.assignTexture(e,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}class h{constructor(t){this.parser=t,this.name="KHR_materials_volume"}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],a=i.extensions[this.name];e.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&o.push(n.assignTexture(e,"thicknessMap",a.thicknessTexture)),e.attenuationDistance=a.attenuationDistance||0;const s=a.attenuationColor||[1,1,1];return e.attenuationTint=new r.Color(s[0],s[1],s[2]),Promise.all(o)}}class d{constructor(t){this.parser=t,this.name="KHR_materials_ior"}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return e.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}class f{constructor(t){this.parser=t,this.name="KHR_materials_specular"}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],a=i.extensions[this.name];e.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&o.push(n.assignTexture(e,"specularIntensityMap",a.specularTexture));const s=a.specularColorFactor||[1,1,1];return e.specularTint=new r.Color(s[0],s[1],s[2]),void 0!==a.specularColorTexture&&o.push(n.assignTexture(e,"specularTintMap",a.specularColorTexture).then((function(t){t.encoding=r.sRGBEncoding}))),Promise.all(o)}}class m{constructor(t){this.parser=t,this.name="KHR_texture_basisu"}loadTexture(t){const e=this.parser,n=e.json,r=n.textures[t];if(!r.extensions||!r.extensions[this.name])return null;const i=r.extensions[this.name],o=n.images[i.source],a=e.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,o,a)}}class g{constructor(t){this.parser=t,this.name="EXT_texture_webp",this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,r=n.json,i=r.textures[t];if(!i.extensions||!i.extensions[e])return null;const o=i.extensions[e],a=r.images[o.source];let s=n.textureLoader;if(a.uri){const t=n.options.manager.getHandler(a.uri);null!==t&&(s=t)}return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(t,a,s);if(r.extensionsRequired&&r.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class y{constructor(t){this.name="EXT_meshopt_compression",this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const t=n.extensions[this.name],r=this.parser.getDependency("buffer",t.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([r,i.ready]).then((function(e){const n=t.byteOffset||0,r=t.byteLength||0,o=t.count,a=t.byteStride,s=new ArrayBuffer(o*a),l=new Uint8Array(e[0],n,r);return i.decodeGltfBuffer(new Uint8Array(s),o,a,l,t.mode,t.filter),s}))}return null}}class v{constructor(t){this.name=e,this.content=null,this.body=null;const n=new DataView(t,0,12);if(this.header={magic:r.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},"glTF"!==this.header.magic)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,o=new DataView(t,12);let a=0;for(;a<i;){const e=o.getUint32(a,!0);a+=4;const n=o.getUint32(a,!0);if(a+=4,1313821514===n){const n=new Uint8Array(t,12+a,e);this.content=r.LoaderUtils.decodeText(n)}else if(5130562===n){const n=12+a;this.body=t.slice(n,n+e)}a+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class _{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,r=this.dracoLoader,i=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,a={},s={},l={};for(const t in o){const e=I[t]||t.toLowerCase();a[e]=o[t]}for(const e in t.attributes){const r=I[e]||e.toLowerCase();if(void 0!==o[e]){const i=n.accessors[t.attributes[e]],o=A[i.componentType];l[r]=o,s[r]=!0===i.normalized}}return e.getDependency("bufferView",i).then((function(t){return new Promise((function(e){r.decodeDracoFile(t,(function(t){for(const e in t.attributes){const n=t.attributes[e],r=s[e];void 0!==r&&(n.normalized=r)}e(t)}),a,l)}))}))}}class x{constructor(){this.name=a}extendTexture(t,e){return void 0!==e.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===e.offset&&void 0===e.rotation&&void 0===e.scale||(t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class b extends r.MeshStandardMaterial{constructor(t){super(),this.isGLTFSpecularGlossinessMaterial=!0;const e=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),i=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),o=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),a=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),s={specular:{value:(new r.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(t){for(const e in s)t.uniforms[e]=s[e];t.fragmentShader=t.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",e).replace("#include <metalnessmap_pars_fragment>",n).replace("#include <roughnessmap_fragment>",i).replace("#include <metalnessmap_fragment>",o).replace("#include <lights_physical_fragment>",a)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(t){s.specular.value=t}},specularMap:{get:function(){return s.specularMap.value},set:function(t){s.specularMap.value=t,t?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return s.glossiness.value},set:function(t){s.glossiness.value=t}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(t){s.glossinessMap.value=t,t?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}copy(t){return super.copy(t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class w{constructor(){this.name=i,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}getMaterialType(){return b}extendParams(t,e,n){const i=e.extensions[this.name];t.color=new r.Color(1,1,1),t.opacity=1;const o=[];if(Array.isArray(i.diffuseFactor)){const e=i.diffuseFactor;t.color.fromArray(e),t.opacity=e[3]}if(void 0!==i.diffuseTexture&&o.push(n.assignTexture(t,"map",i.diffuseTexture)),t.emissive=new r.Color(0,0,0),t.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,t.specular=new r.Color(1,1,1),Array.isArray(i.specularFactor)&&t.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){const e=i.specularGlossinessTexture;o.push(n.assignTexture(t,"glossinessMap",e)),o.push(n.assignTexture(t,"specularMap",e))}return Promise.all(o)}createMaterial(t){const e=new b(t);return e.fog=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=1,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,e.normalMapType=r.TangentSpaceNormalMap,t.normalScale&&(e.normalScale=t.normalScale),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e.refractionRatio=.98,e}}class M{constructor(){this.name=s}}class S extends r.Interpolant{constructor(t,e,n,r){super(t,e,n,r)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r*3+r;for(let t=0;t!==r;t++)e[t]=n[i+t];return e}}S.prototype.beforeStart_=S.prototype.copySampleValue_,S.prototype.afterEnd_=S.prototype.copySampleValue_,S.prototype.interpolate_=function(t,e,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,l=3*a,c=r-e,u=(n-e)/c,p=u*u,h=p*u,d=t*l,f=d-l,m=-2*h+3*p,g=h-p,y=1-m,v=g-p+u;for(let t=0;t!==a;t++){const e=o[f+t+a],n=o[f+t+s]*c,r=o[d+t+a],l=o[d+t]*c;i[t]=y*e+v*n+m*r+g*l}return i};const T=new r.Quaternion;class E extends S{interpolate_(t,e,n,r){const i=super.interpolate_(t,e,n,r);return T.fromArray(i).normalize().toArray(i),i}}const A={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},C={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},L={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},P={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},I={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},R={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},k={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete};function z(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}function D(t,e,n){for(const r in n.extensions)void 0===t[r]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=n.extensions[r])}function O(t,e){void 0!==e.extras&&("object"==typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function F(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let n=0,r=e.weights.length;n<r;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let e=0,r=n.length;e<r;e++)t.morphTargetDictionary[n[e]]=e}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function B(t){const e=t.extensions&&t.extensions[n];return e?"draco:"+e.bufferView+":"+e.indices+":"+N(e.attributes):t.indices+":"+N(t.attributes)+":"+t.mode}function N(t){let e="";const n=Object.keys(t).sort();for(let r=0,i=n.length;r<i;r++)e+=n[r]+":"+t[n[r]]+";";return e}function U(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}class j{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new t,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.textureCache={},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?this.textureLoader=new r.ImageBitmapLoader(this.options.manager):this.textureLoader=new r.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(e){const o={scene:e[0][r.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:r.asset,parser:n,userData:{}};D(i,o,r),O(o,r),Promise.all(n._invokeAll((function(t){return t.afterRoot&&t.afterRoot(o)}))).then((function(){t(o)}))})).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=e.length;n<r;n++){const r=e[n].joints;for(let e=0,n=r.length;e<n;e++)t[r[e]].isBone=!0}for(let e=0,r=t.length;e<r;e++){const r=t[e];void 0!==r.mesh&&(this._addNodeRef(this.meshCache,r.mesh),void 0!==r.skin&&(n[r.mesh].isSkinnedMesh=!0)),void 0!==r.camera&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;const r=n.clone();return r.name+="_instance_"+t.uses[e]++,r}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const r=t(e[n]);if(r)return r}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let r=0;r<e.length;r++){const i=t(e[r]);i&&n.push(i)}return n}getDependency(t,e){const n=t+":"+e;let r=this.cache.get(n);if(!r){switch(t){case"scene":r=this.loadScene(e);break;case"node":r=this.loadNode(e);break;case"mesh":r=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":r=this.loadAccessor(e);break;case"bufferView":r=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":r=this.loadBuffer(e);break;case"material":r=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":r=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":r=this.loadSkin(e);break;case"animation":r=this.loadAnimation(e);break;case"camera":r=this.loadCamera(e);break;default:throw new Error("Unknown type: "+t)}this.cache.add(n,r)}return r}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,r=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(r.map((function(e,r){return n.getDependency(t,r)}))),this.cache.add(t,e)}return e}loadBuffer(t){const n=this.json.buffers[t],r=this.fileLoader;if(n.type&&"arraybuffer"!==n.type)throw new Error("THREE.GLTFLoader: "+n.type+" buffer type is not supported.");if(void 0===n.uri&&0===t)return Promise.resolve(this.extensions[e].body);const i=this.options;return new Promise((function(t,e){r.load(z(n.uri,i.path),t,void 0,(function(){e(new Error('THREE.GLTFLoader: Failed to load buffer "'+n.uri+'".'))}))}))}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){const n=e.byteLength||0,r=e.byteOffset||0;return t.slice(r,r+n)}))}loadAccessor(t){const e=this,n=this.json,i=this.json.accessors[t];if(void 0===i.bufferView&&void 0===i.sparse)return Promise.resolve(null);const o=[];return void 0!==i.bufferView?o.push(this.getDependency("bufferView",i.bufferView)):o.push(null),void 0!==i.sparse&&(o.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(o).then((function(t){const o=t[0],a=P[i.type],s=A[i.componentType],l=s.BYTES_PER_ELEMENT,c=l*a,u=i.byteOffset||0,p=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,h=!0===i.normalized;let d,f;if(p&&p!==c){const t=Math.floor(u/p),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+t+":"+i.count;let c=e.cache.get(n);c||(d=new s(o,t*p,i.count*p/l),c=new r.InterleavedBuffer(d,p/l),e.cache.add(n,c)),f=new r.InterleavedBufferAttribute(c,a,u%p/l,h)}else d=null===o?new s(i.count*a):new s(o,u,i.count*a),f=new r.BufferAttribute(d,a,h);if(void 0!==i.sparse){const e=P.SCALAR,n=A[i.sparse.indices.componentType],l=i.sparse.indices.byteOffset||0,c=i.sparse.values.byteOffset||0,u=new n(t[1],l,i.sparse.count*e),p=new s(t[2],c,i.sparse.count*a);null!==o&&(f=new r.BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(let t=0,e=u.length;t<e;t++){const e=u[t];if(f.setX(e,p[t*a]),a>=2&&f.setY(e,p[t*a+1]),a>=3&&f.setZ(e,p[t*a+2]),a>=4&&f.setW(e,p[t*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse THREE.BufferAttribute.")}}return f}))}loadTexture(t){const e=this.json,n=this.options,r=e.textures[t],i=e.images[r.source];let o=this.textureLoader;if(i.uri){const t=n.manager.getHandler(i.uri);null!==t&&(o=t)}return this.loadTextureImage(t,i,o)}loadTextureImage(t,e,n){const i=this,o=this.json,a=this.options,s=o.textures[t],l=(e.uri||e.bufferView)+":"+s.sampler;if(this.textureCache[l])return this.textureCache[l];const c=self.URL||self.webkitURL;let u=e.uri||"",p=!1,h=!0;const d=u.search(/\.jpe?g($|\?)/i)>0||0===u.search(/^data\:image\/jpeg/);if(("image/jpeg"===e.mimeType||d)&&(h=!1),void 0!==e.bufferView)u=i.getDependency("bufferView",e.bufferView).then((function(t){if("image/png"===e.mimeType){const e=new DataView(t,25,1).getUint8(0,!1);h=6===e||4===e||3===e}p=!0;const n=new Blob([t],{type:e.mimeType});return u=c.createObjectURL(n)}));else if(void 0===e.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const f=Promise.resolve(u).then((function(t){return new Promise((function(e,i){let o=e;!0===n.isImageBitmapLoader&&(o=function(t){const n=new r.Texture(t);n.needsUpdate=!0,e(n)}),n.load(z(t,a.path),o,void 0,i)}))})).then((function(e){!0===p&&c.revokeObjectURL(u),e.flipY=!1,s.name&&(e.name=s.name),h||(e.format=r.RGBFormat);const n=(o.samplers||{})[s.sampler]||{};return e.magFilter=C[n.magFilter]||r.LinearFilter,e.minFilter=C[n.minFilter]||r.LinearMipmapLinearFilter,e.wrapS=L[n.wrapS]||r.RepeatWrapping,e.wrapT=L[n.wrapT]||r.RepeatWrapping,i.associations.set(e,{type:"textures",index:t}),e})).catch((function(){return console.error("THREE.GLTFLoader: Couldn't load texture",u),null}));return this.textureCache[l]=f,f}assignTexture(t,e,n){const r=this;return this.getDependency("texture",n.index).then((function(i){if(void 0===n.texCoord||0==n.texCoord||"aoMap"===e&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+e+" not yet supported."),r.extensions[a]){const t=void 0!==n.extensions?n.extensions[a]:void 0;if(t){const e=r.associations.get(i);i=r.extensions[a].extendTexture(i,t),r.associations.set(i,e)}}return t[e]=i,i}))}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const i=void 0!==e.attributes.tangent,o=void 0!==e.attributes.color,a=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new r.PointsMaterial,r.Material.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,e.sizeAttenuation=!1,this.cache.add(t,e)),n=e}else if(t.isLine){const t="LineBasicMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new r.LineBasicMaterial,r.Material.prototype.copy.call(e,n),e.color.copy(n.color),this.cache.add(t,e)),n=e}if(i||o||a){let t="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),i&&(t+="vertex-tangents:"),o&&(t+="vertex-colors:"),a&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=n.clone(),o&&(e.vertexColors=!0),a&&(e.flatShading=!0),i&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(n))),n=e}n.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv),t.material=n}getMaterialType(){return r.MeshStandardMaterial}loadMaterial(t){const e=this,n=this.json,a=this.extensions,s=n.materials[t];let l;const c={},u=s.extensions||{},p=[];if(u[i]){const t=a[i];l=t.getMaterialType(),p.push(t.extendParams(c,s,e))}else if(u[o]){const t=a[o];l=t.getMaterialType(),p.push(t.extendParams(c,s,e))}else{const n=s.pbrMetallicRoughness||{};if(c.color=new r.Color(1,1,1),c.opacity=1,Array.isArray(n.baseColorFactor)){const t=n.baseColorFactor;c.color.fromArray(t),c.opacity=t[3]}void 0!==n.baseColorTexture&&p.push(e.assignTexture(c,"map",n.baseColorTexture)),c.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,c.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(p.push(e.assignTexture(c,"metalnessMap",n.metallicRoughnessTexture)),p.push(e.assignTexture(c,"roughnessMap",n.metallicRoughnessTexture))),l=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),p.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,c)}))))}!0===s.doubleSided&&(c.side=r.DoubleSide);const h=s.alphaMode||"OPAQUE";return"BLEND"===h?(c.transparent=!0,c.depthWrite=!1):(c.format=r.RGBFormat,c.transparent=!1,"MASK"===h&&(c.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&l!==r.MeshBasicMaterial&&(p.push(e.assignTexture(c,"normalMap",s.normalTexture)),c.normalScale=new r.Vector2(1,-1),void 0!==s.normalTexture.scale&&c.normalScale.set(s.normalTexture.scale,-s.normalTexture.scale)),void 0!==s.occlusionTexture&&l!==r.MeshBasicMaterial&&(p.push(e.assignTexture(c,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(c.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&l!==r.MeshBasicMaterial&&(c.emissive=(new r.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&l!==r.MeshBasicMaterial&&p.push(e.assignTexture(c,"emissiveMap",s.emissiveTexture)),Promise.all(p).then((function(){let n;return n=l===b?a[i].createMaterial(c):new l(c),s.name&&(n.name=s.name),n.map&&(n.map.encoding=r.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=r.sRGBEncoding),O(n,s),e.associations.set(n,{type:"materials",index:t}),s.extensions&&D(a,n,s),n}))}createUniqueName(t){const e=r.PropertyBinding.sanitizeNodeName(t||"");let n=e;for(let t=1;this.nodeNamesUsed[n];++t)n=e+"_"+t;return this.nodeNamesUsed[n]=!0,n}loadGeometries(t){const e=this,i=this.extensions,o=this.primitiveCache;function a(t){return i[n].decodePrimitive(t,e).then((function(n){return G(n,t,e)}))}const s=[];for(let i=0,l=t.length;i<l;i++){const l=t[i],c=B(l),u=o[c];if(u)s.push(u.promise);else{let t;t=l.extensions&&l.extensions[n]?a(l):G(new r.BufferGeometry,l,e),o[c]={primitive:l,promise:t},s.push(t)}}return Promise.all(s)}loadMesh(t){const e=this,n=this.json,i=this.extensions,o=n.meshes[t],a=o.primitives,s=[];for(let t=0,e=a.length;t<e;t++){const e=void 0===a[t].material?(void 0===(l=this.cache).DefaultMaterial&&(l.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),l.DefaultMaterial):this.getDependency("material",a[t].material);s.push(e)}var l;return s.push(e.loadGeometries(a)),Promise.all(s).then((function(n){const s=n.slice(0,n.length-1),l=n[n.length-1],c=[];for(let n=0,u=l.length;n<u;n++){const u=l[n],p=a[n];let h;const d=s[n];if(4===p.mode||5===p.mode||6===p.mode||void 0===p.mode)!0!==(h=!0===o.isSkinnedMesh?new r.SkinnedMesh(u,d):new r.Mesh(u,d)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),5===p.mode?h.geometry=H(h.geometry,r.TriangleStripDrawMode):6===p.mode&&(h.geometry=H(h.geometry,r.TriangleFanDrawMode));else if(1===p.mode)h=new r.LineSegments(u,d);else if(3===p.mode)h=new r.Line(u,d);else if(2===p.mode)h=new r.LineLoop(u,d);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);h=new r.Points(u,d)}Object.keys(h.geometry.morphAttributes).length>0&&F(h,o),h.name=e.createUniqueName(o.name||"mesh_"+t),O(h,o),p.extensions&&D(i,h,p),e.assignFinalMaterial(h),c.push(h)}if(1===c.length)return c[0];const u=new r.Group;for(let t=0,e=c.length;t<e;t++)u.add(c[t]);return u}))}loadCamera(t){let e;const n=this.json.cameras[t],i=n[n.type];if(i)return"perspective"===n.type?e=new r.PerspectiveCamera(r.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(e=new r.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),O(e,n),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(t){const e=this.json.skins[t],n={joints:e.joints};return void 0===e.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",e.inverseBindMatrices).then((function(t){return n.inverseBindMatrices=t,n}))}loadAnimation(t){const e=this.json.animations[t],n=[],i=[],o=[],a=[],s=[];for(let t=0,r=e.channels.length;t<r;t++){const r=e.channels[t],l=e.samplers[r.sampler],c=r.target,u=void 0!==c.node?c.node:c.id,p=void 0!==e.parameters?e.parameters[l.input]:l.input,h=void 0!==e.parameters?e.parameters[l.output]:l.output;n.push(this.getDependency("node",u)),i.push(this.getDependency("accessor",p)),o.push(this.getDependency("accessor",h)),a.push(l),s.push(c)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(o),Promise.all(a),Promise.all(s)]).then((function(n){const i=n[0],o=n[1],a=n[2],s=n[3],l=n[4],c=[];for(let t=0,e=i.length;t<e;t++){const e=i[t],n=o[t],u=a[t],p=s[t],h=l[t];if(void 0===e)continue;let d;switch(e.updateMatrix(),e.matrixAutoUpdate=!0,R[h.path]){case R.weights:d=r.NumberKeyframeTrack;break;case R.rotation:d=r.QuaternionKeyframeTrack;break;default:d=r.VectorKeyframeTrack}const f=e.name?e.name:e.uuid,m=void 0!==p.interpolation?k[p.interpolation]:r.InterpolateLinear,g=[];R[h.path]===R.weights?e.traverse((function(t){!0===t.isMesh&&t.morphTargetInfluences&&g.push(t.name?t.name:t.uuid)})):g.push(f);let y=u.array;if(u.normalized){const t=U(y.constructor),e=new Float32Array(y.length);for(let n=0,r=y.length;n<r;n++)e[n]=y[n]*t;y=e}for(let t=0,e=g.length;t<e;t++){const e=new d(g[t]+"."+R[h.path],n.array,y,m);"CUBICSPLINE"===p.interpolation&&(e.createInterpolant=function(t){return new(this instanceof r.QuaternionKeyframeTrack?E:S)(this.times,this.values,this.getValueSize()/3,t)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(e)}}const u=e.name?e.name:"animation_"+t;return new r.AnimationClip(u,void 0,c)}))}createNodeMesh(t){const e=this.json,n=this,r=e.nodes[t];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then((function(t){const e=n._getNodeRef(n.meshCache,r.mesh,t);return void 0!==r.weights&&e.traverse((function(t){if(t.isMesh)for(let e=0,n=r.weights.length;e<n;e++)t.morphTargetInfluences[e]=r.weights[e]})),e}))}loadNode(t){const e=this.json,n=this.extensions,i=this,o=e.nodes[t],a=o.name?i.createUniqueName(o.name):"";return function(){const e=[],n=i._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));return n&&e.push(n),void 0!==o.camera&&e.push(i.getDependency("camera",o.camera).then((function(t){return i._getNodeRef(i.cameraCache,o.camera,t)}))),i._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){e.push(t)})),Promise.all(e)}().then((function(e){let s;if((s=!0===o.isBone?new r.Bone:e.length>1?new r.Group:1===e.length?e[0]:new r.Object3D)!==e[0])for(let t=0,n=e.length;t<n;t++)s.add(e[t]);if(o.name&&(s.userData.name=o.name,s.name=a),O(s,o),o.extensions&&D(n,s,o),void 0!==o.matrix){const t=new r.Matrix4;t.fromArray(o.matrix),s.applyMatrix4(t)}else void 0!==o.translation&&s.position.fromArray(o.translation),void 0!==o.rotation&&s.quaternion.fromArray(o.rotation),void 0!==o.scale&&s.scale.fromArray(o.scale);return i.associations.set(s,{type:"nodes",index:t}),s}))}loadScene(t){const e=this.json,n=this.extensions,i=this.json.scenes[t],o=this,a=new r.Group;i.name&&(a.name=o.createUniqueName(i.name)),O(a,i),i.extensions&&D(n,a,i);const s=i.nodes||[],l=[];for(let t=0,n=s.length;t<n;t++)l.push(V(s[t],a,e,o));return Promise.all(l).then((function(){return a}))}}function V(t,e,n,i){const o=n.nodes[t];return i.getDependency("node",t).then((function(t){if(void 0===o.skin)return t;let e;return i.getDependency("skin",o.skin).then((function(t){const n=[];for(let r=0,o=(e=t).joints.length;r<o;r++)n.push(i.getDependency("node",e.joints[r]));return Promise.all(n)})).then((function(n){return t.traverse((function(t){if(!t.isMesh)return;const i=[],o=[];for(let t=0,a=n.length;t<a;t++){const a=n[t];if(a){i.push(a);const n=new r.Matrix4;void 0!==e.inverseBindMatrices&&n.fromArray(e.inverseBindMatrices.array,16*t),o.push(n)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[t])}t.bind(new r.Skeleton(i,o),t.matrixWorld)})),t}))})).then((function(t){e.add(t);const r=[];if(o.children){const e=o.children;for(let o=0,a=e.length;o<a;o++){const a=e[o];r.push(V(a,t,n,i))}}return Promise.all(r)}))}function G(t,e,n){const i=e.attributes,o=[];function a(e,r){return n.getDependency("accessor",e).then((function(e){t.setAttribute(r,e)}))}for(const e in i){const n=I[e]||e.toLowerCase();n in t.attributes||o.push(a(i[e],n))}if(void 0!==e.indices&&!t.index){const r=n.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));o.push(r)}return O(t,e),function(t,e,n){const i=e.attributes,o=new r.Box3;if(void 0===i.POSITION)return;{const t=n.json.accessors[i.POSITION],e=t.min,a=t.max;if(void 0===e||void 0===a)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(o.set(new r.Vector3(e[0],e[1],e[2]),new r.Vector3(a[0],a[1],a[2])),t.normalized){const e=U(A[t.componentType]);o.min.multiplyScalar(e),o.max.multiplyScalar(e)}}const a=e.targets;if(void 0!==a){const t=new r.Vector3,e=new r.Vector3;for(let r=0,i=a.length;r<i;r++){const i=a[r];if(void 0!==i.POSITION){const r=n.json.accessors[i.POSITION],o=r.min,a=r.max;if(void 0!==o&&void 0!==a){if(e.setX(Math.max(Math.abs(o[0]),Math.abs(a[0]))),e.setY(Math.max(Math.abs(o[1]),Math.abs(a[1]))),e.setZ(Math.max(Math.abs(o[2]),Math.abs(a[2]))),r.normalized){const t=U(A[r.componentType]);e.multiplyScalar(t)}t.max(e)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}o.expandByVector(t)}t.boundingBox=o;const s=new r.Sphere;o.getCenter(s.center),s.radius=o.min.distanceTo(o.max)/2,t.boundingSphere=s}(t,e,n),Promise.all(o).then((function(){return void 0!==e.targets?function(t,e,n){let r=!1,i=!1;for(let t=0,n=e.length;t<n;t++){const n=e[t];if(void 0!==n.POSITION&&(r=!0),void 0!==n.NORMAL&&(i=!0),r&&i)break}if(!r&&!i)return Promise.resolve(t);const o=[],a=[];for(let s=0,l=e.length;s<l;s++){const l=e[s];if(r){const e=void 0!==l.POSITION?n.getDependency("accessor",l.POSITION):t.attributes.position;o.push(e)}if(i){const e=void 0!==l.NORMAL?n.getDependency("accessor",l.NORMAL):t.attributes.normal;a.push(e)}}return Promise.all([Promise.all(o),Promise.all(a)]).then((function(e){const n=e[0],o=e[1];return r&&(t.morphAttributes.position=n),i&&(t.morphAttributes.normal=o),t.morphTargetsRelative=!0,t}))}(t,e.targets,n):t}))}function H(t,e){let n=t.getIndex();if(null===n){const e=[],r=t.getAttribute("position");if(void 0===r)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<r.count;t++)e.push(t);t.setIndex(e),n=t.getIndex()}const i=n.count-2,o=[];if(e===r.TriangleFanDrawMode)for(let t=1;t<=i;t++)o.push(n.getX(0)),o.push(n.getX(t)),o.push(n.getX(t+1));else for(let t=0;t<i;t++)t%2==0?(o.push(n.getX(t)),o.push(n.getX(t+1)),o.push(n.getX(t+2))):(o.push(n.getX(t+2)),o.push(n.getX(t+1)),o.push(n.getX(t)));o.length/3!==i&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const a=t.clone();return a.setIndex(o),a}r.GLTFLoader=class extends r.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new u(t)})),this.register((function(t){return new m(t)})),this.register((function(t){return new g(t)})),this.register((function(t){return new p(t)})),this.register((function(t){return new h(t)})),this.register((function(t){return new d(t)})),this.register((function(t){return new f(t)})),this.register((function(t){return new l(t)})),this.register((function(t){return new y(t)}))}load(t,e,n,i){const o=this;let a;a=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:r.LoaderUtils.extractUrlBase(t),this.manager.itemStart(t);const s=function(e){i?i(e):console.error(e),o.manager.itemError(t),o.manager.itemEnd(t)},l=new r.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,(function(n){try{o.parse(n,a,(function(n){e(n),o.manager.itemEnd(t)}),s)}catch(t){s(t)}}),n,s)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,l,u,p){let h;const d={},f={};if("string"==typeof t)h=t;else if("glTF"===r.LoaderUtils.decodeText(new Uint8Array(t,0,4))){try{d[e]=new v(t)}catch(t){return void(p&&p(t))}h=d[e].content}else h=r.LoaderUtils.decodeText(new Uint8Array(t));const m=JSON.parse(h);if(void 0===m.asset||m.asset.version[0]<2)return void(p&&p(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const g=new j(m,{path:l||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});g.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const e=this.pluginCallbacks[t](g);f[e.name]=e,d[e.name]=!0}if(m.extensionsUsed)for(let t=0;t<m.extensionsUsed.length;++t){const e=m.extensionsUsed[t],r=m.extensionsRequired||[];switch(e){case o:d[e]=new c;break;case i:d[e]=new w;break;case n:d[e]=new _(m,this.dracoLoader);break;case a:d[e]=new x;break;case s:d[e]=new M;break;default:r.indexOf(e)>=0&&void 0===f[e]&&console.warn('THREE.GLTFLoader: Unknown extension "'+e+'".')}}g.setExtensions(d),g.setPlugins(f),g.parse(u,p)}}}(),$=$=r.GLTFLoader;var J={};r.ColladaLoader=class extends r.Loader{constructor(t){super(t)}load(t,e,n,i){const o=this,a=""===o.path?r.LoaderUtils.extractUrlBase(t):o.path,s=new r.FileLoader(o.manager);s.setPath(o.path),s.setRequestHeader(o.requestHeader),s.setWithCredentials(o.withCredentials),s.load(t,(function(n){try{e(o.parse(n,a))}catch(e){i?i(e):console.error(e),o.manager.itemError(t)}}),n,i)}parse(t,e){function n(t,e){const n=[],r=t.childNodes;for(let t=0,i=r.length;t<i;t++){const i=r[t];i.nodeName===e&&n.push(i)}return n}function i(t){if(0===t.length)return[];const e=t.trim().split(/\s+/),n=new Array(e.length);for(let t=0,r=e.length;t<r;t++)n[t]=e[t];return n}function o(t){if(0===t.length)return[];const e=t.trim().split(/\s+/),n=new Array(e.length);for(let t=0,r=e.length;t<r;t++)n[t]=parseFloat(e[t]);return n}function a(t){if(0===t.length)return[];const e=t.trim().split(/\s+/),n=new Array(e.length);for(let t=0,r=e.length;t<r;t++)n[t]=parseInt(e[t]);return n}function s(t){return t.substring(1)}function l(t){return 0===Object.keys(t).length}function c(t){return void 0!==t&&!0===t.hasAttribute("meter")?parseFloat(t.getAttribute("meter")):1}function u(t){return void 0!==t?t.textContent:"Y_UP"}function p(t,e,r,i){const o=n(t,e)[0];if(void 0!==o){const t=n(o,r);for(let e=0;e<t.length;e++)i(t[e])}}function h(t,e){for(const n in t)t[n].build=e(t[n])}function d(t,e){return void 0!==t.build||(t.build=e(t)),t.build}function f(t){const e={inputs:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"input"===r.nodeName){const t=s(r.getAttribute("source")),n=r.getAttribute("semantic");e.inputs[n]=t}}return e}function m(t){const e={};let n=t.getAttribute("target").split("/");const r=n.shift();let i=n.shift();const o=-1!==i.indexOf("("),a=-1!==i.indexOf(".");if(a)n=i.split("."),i=n.shift(),e.member=n.shift();else if(o){const t=i.split("(");i=t.shift();for(let e=0;e<t.length;e++)t[e]=parseInt(t[e].replace(/\)/,""));e.indices=t}return e.id=r,e.sid=i,e.arraySyntax=o,e.memberSyntax=a,e.sampler=s(t.getAttribute("source")),e}function g(t){const e=[],n=t.channels,r=t.samplers,i=t.sources;for(const t in n)if(n.hasOwnProperty(t)){const o=n[t],a=r[o.sampler],s=a.inputs.INPUT,l=a.inputs.OUTPUT;w(v(o,i[s],i[l]),e)}return e}function y(t){return d($t.animations[t],g)}function v(t,e,n){const r=$t.nodes[t.id],i=Ot(r.id),o=r.transforms[t.sid],a=r.matrix.clone().transpose();let s,l,c,u,p,h;const d={};switch(o){case"matrix":for(c=0,u=e.array.length;c<u;c++)if(s=e.array[c],l=c*n.stride,void 0===d[s]&&(d[s]={}),!0===t.arraySyntax){const e=n.array[l],r=t.indices[0]+4*t.indices[1];d[s][r]=e}else for(p=0,h=n.stride;p<h;p++)d[s][p]=n.array[l+p];break;case"translate":case"rotate":case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',o)}const f=function(t,e){const n=[];for(const e in t)n.push({time:parseFloat(e),value:t[e]});n.sort((function(t,e){return t.time-e.time}));for(let t=0;t<16;t++)M(n,t,e.elements[t]);return n}(d,a);return{name:i.uuid,keyframes:f}}const _=new r.Vector3,x=new r.Vector3,b=new r.Quaternion;function w(t,e){const n=t.keyframes,i=t.name,o=[],a=[],s=[],l=[];for(let t=0,e=n.length;t<e;t++){const e=n[t],r=e.time,i=e.value;Tt.fromArray(i).transpose(),Tt.decompose(_,b,x),o.push(r),a.push(_.x,_.y,_.z),s.push(b.x,b.y,b.z,b.w),l.push(x.x,x.y,x.z)}return a.length>0&&e.push(new r.VectorKeyframeTrack(i+".position",o,a)),s.length>0&&e.push(new r.QuaternionKeyframeTrack(i+".quaternion",o,s)),l.length>0&&e.push(new r.VectorKeyframeTrack(i+".scale",o,l)),e}function M(t,e,n){let r,i,o,a=!0;for(i=0,o=t.length;i<o;i++)void 0===(r=t[i]).value[e]?r.value[e]=null:a=!1;if(!0===a)for(i=0,o=t.length;i<o;i++)(r=t[i]).value[e]=n;else!function(t,e){let n,r;for(let i=0,o=t.length;i<o;i++){const o=t[i];if(null===o.value[e]){if(n=S(t,i,e),r=T(t,i,e),null===n){o.value[e]=r.value[e];continue}if(null===r){o.value[e]=n.value[e];continue}E(o,n,r,e)}}}(t,e)}function S(t,e,n){for(;e>=0;){const r=t[e];if(null!==r.value[n])return r;e--}return null}function T(t,e,n){for(;e<t.length;){const r=t[e];if(null!==r.value[n])return r;e++}return null}function E(t,e,n,r){n.time-e.time!=0?t.value[r]=(t.time-e.time)*(n.value[r]-e.value[r])/(n.time-e.time)+e.value[r]:t.value[r]=e.value[r]}function A(t){const e=[],n=t.name,i=t.end-t.start||-1,o=t.animations;for(let t=0,n=o.length;t<n;t++){const n=y(o[t]);for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return new r.AnimationClip(n,i,e)}function C(t){return d($t.clips[t],A)}function L(t){const e={sources:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"bind_shape_matrix":e.bindShapeMatrix=o(r.textContent);break;case"source":const t=r.getAttribute("id");e.sources[t]=ot(r);break;case"joints":e.joints=P(r);break;case"vertex_weights":e.vertexWeights=I(r)}}return e}function P(t){const e={inputs:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"input"===r.nodeName){const t=r.getAttribute("semantic"),n=s(r.getAttribute("source"));e.inputs[t]=n}}return e}function I(t){const e={inputs:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":const t=r.getAttribute("semantic"),n=s(r.getAttribute("source")),i=parseInt(r.getAttribute("offset"));e.inputs[t]={id:n,offset:i};break;case"vcount":e.vcount=a(r.textContent);break;case"v":e.v=a(r.textContent)}}return e}function R(t){const e={id:t.id},n=$t.geometries[e.id];return void 0!==t.skin&&(e.skin=function(t){const e={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},n=t.sources,i=t.vertexWeights,o=i.vcount,a=i.v,s=i.inputs.JOINT.offset,l=i.inputs.WEIGHT.offset,c=t.sources[t.joints.inputs.JOINT],u=t.sources[t.joints.inputs.INV_BIND_MATRIX],p=n[i.inputs.WEIGHT.id].array;let h,d,f,m=0;for(h=0,f=o.length;h<f;h++){const t=o[h],n=[];for(d=0;d<t;d++){const t=a[m+s],e=p[a[m+l]];n.push({index:t,weight:e}),m+=2}for(n.sort(g),d=0;d<4;d++){const t=n[d];void 0!==t?(e.indices.array.push(t.index),e.weights.array.push(t.weight)):(e.indices.array.push(0),e.weights.array.push(0))}}for(t.bindShapeMatrix?e.bindMatrix=(new r.Matrix4).fromArray(t.bindShapeMatrix).transpose():e.bindMatrix=(new r.Matrix4).identity(),h=0,f=c.array.length;h<f;h++){const t=c.array[h],n=(new r.Matrix4).fromArray(u.array,h*u.stride).transpose();e.joints.push({name:t,boneInverse:n})}return e;function g(t,e){return e.weight-t.weight}}(t.skin),n.sources.skinIndices=e.skin.indices,n.sources.skinWeights=e.skin.weights),e}function k(t){return void 0!==t.build?t.build:t.init_from}function z(t){const e=$t.images[t];return void 0!==e?d(e,k):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",t),null)}function D(t){const e={surfaces:{},samplers:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"newparam":O(r,e);break;case"technique":e.technique=N(r);break;case"extra":e.extra=W(r)}}return e}function O(t,e){const n=t.getAttribute("sid");for(let r=0,i=t.childNodes.length;r<i;r++){const i=t.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"surface":e.surfaces[n]=F(i);break;case"sampler2D":e.samplers[n]=B(i)}}}function F(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"init_from"===r.nodeName)e.init_from=r.textContent}return e}function B(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"source"===r.nodeName)e.source=r.textContent}return e}function N(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"constant":case"lambert":case"blinn":case"phong":e.type=r.nodeName,e.parameters=U(r)}}return e}function U(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":e[r.nodeName]=j(r);break;case"transparent":e[r.nodeName]={opaque:r.getAttribute("opaque"),data:j(r)}}}return e}function j(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"color":e[r.nodeName]=o(r.textContent);break;case"float":e[r.nodeName]=parseFloat(r.textContent);break;case"texture":e[r.nodeName]={id:r.getAttribute("texture"),extra:V(r)}}}return e}function V(t){const e={technique:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"extra"===r.nodeName)G(r,e)}return e}function G(t,e){for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"technique"===r.nodeName)H(r,e)}}function H(t,e){for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":e.technique[r.nodeName]=parseFloat(r.textContent);break;case"wrapU":case"wrapV":"TRUE"===r.textContent.toUpperCase()?e.technique[r.nodeName]=1:"FALSE"===r.textContent.toUpperCase()?e.technique[r.nodeName]=0:e.technique[r.nodeName]=parseInt(r.textContent)}}}function W(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"technique"===r.nodeName)e.technique=q(r)}return e}function q(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"double_sided"===r.nodeName)e[r.nodeName]=parseInt(r.textContent)}return e}function Z(t){return t}function X(t){const e=(n=t.url,d($t.effects[n],Z));var n;const i=e.profile.technique,o=e.profile.extra;let a;switch(i.type){case"phong":case"blinn":a=new r.MeshPhongMaterial;break;case"lambert":a=new r.MeshLambertMaterial;break;default:a=new r.MeshBasicMaterial}function s(t){const n=e.profile.samplers[t.id];let i=null;if(void 0!==n?i=z(e.profile.surfaces[n.source].init_from):(console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),i=z(t.id)),null!==i){const e=function(t){let e,n=t.slice(2+(t.lastIndexOf(".")-1>>>0));if("tga"===(n=n.toLowerCase()))e=Wt;else e=Ht;return e}(i);if(void 0!==e){const n=e.load(i),o=t.extra;if(void 0!==o&&void 0!==o.technique&&!1===l(o.technique)){const t=o.technique;n.wrapS=t.wrapU?r.RepeatWrapping:r.ClampToEdgeWrapping,n.wrapT=t.wrapV?r.RepeatWrapping:r.ClampToEdgeWrapping,n.offset.set(t.offsetU||0,t.offsetV||0),n.repeat.set(t.repeatU||1,t.repeatV||1)}else n.wrapS=r.RepeatWrapping,n.wrapT=r.RepeatWrapping;return n}return console.warn("THREE.ColladaLoader: THREE.Loader for texture %s not found.",i),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",t.id),null}a.name=t.name||"";const c=i.parameters;for(const t in c){const e=c[t];switch(t){case"diffuse":e.color&&a.color.fromArray(e.color),e.texture&&(a.map=s(e.texture));break;case"specular":e.color&&a.specular&&a.specular.fromArray(e.color),e.texture&&(a.specularMap=s(e.texture));break;case"bump":e.texture&&(a.normalMap=s(e.texture));break;case"ambient":e.texture&&(a.lightMap=s(e.texture));break;case"shininess":e.float&&a.shininess&&(a.shininess=e.float);break;case"emission":e.color&&a.emissive&&a.emissive.fromArray(e.color),e.texture&&(a.emissiveMap=s(e.texture))}}let u=c.transparent,p=c.transparency;if(void 0===p&&u&&(p={float:1}),void 0===u&&p&&(u={opaque:"A_ONE",data:{color:[1,1,1,1]}}),u&&p)if(u.data.texture)a.transparent=!0;else{const t=u.data.color;switch(u.opaque){case"A_ONE":a.opacity=t[3]*p.float;break;case"RGB_ZERO":a.opacity=1-t[0]*p.float;break;case"A_ZERO":a.opacity=1-t[3]*p.float;break;case"RGB_ONE":a.opacity=t[0]*p.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',u.opaque)}a.opacity<1&&(a.transparent=!0)}return void 0!==o&&void 0!==o.technique&&1===o.technique.double_sided&&(a.side=r.DoubleSide),a}function $(t){return d($t.materials[t],X)}function J(t){for(let e=0;e<t.childNodes.length;e++){const n=t.childNodes[e];if("technique_common"===n.nodeName)return Y(n)}return{}}function Y(t){const e={};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];switch(r.nodeName){case"perspective":case"orthographic":e.technique=r.nodeName,e.parameters=Q(r)}}return e}function Q(t){const e={};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];switch(r.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":e[r.nodeName]=parseFloat(r.textContent)}}return e}function K(t){let e;switch(t.optics.technique){case"perspective":e=new r.PerspectiveCamera(t.optics.parameters.yfov,t.optics.parameters.aspect_ratio,t.optics.parameters.znear,t.optics.parameters.zfar);break;case"orthographic":let n=t.optics.parameters.ymag,i=t.optics.parameters.xmag;const o=t.optics.parameters.aspect_ratio;i=void 0===i?n*o:i,n=void 0===n?i/o:n,i*=.5,n*=.5,e=new r.OrthographicCamera(-i,i,n,-n,t.optics.parameters.znear,t.optics.parameters.zfar);break;default:e=new r.PerspectiveCamera}return e.name=t.name||"",e}function tt(t){const e=$t.cameras[t];return void 0!==e?d(e,K):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",t),null)}function et(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"directional":case"point":case"spot":case"ambient":e.technique=r.nodeName,e.parameters=nt(r)}}return e}function nt(t){const e={};for(let n=0,i=t.childNodes.length;n<i;n++){const i=t.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"color":const t=o(i.textContent);e.color=(new r.Color).fromArray(t);break;case"falloff_angle":e.falloffAngle=parseFloat(i.textContent);break;case"quadratic_attenuation":const n=parseFloat(i.textContent);e.distance=n?Math.sqrt(1/n):0}}return e}function rt(t){let e;switch(t.technique){case"directional":e=new r.DirectionalLight;break;case"point":e=new r.PointLight;break;case"spot":e=new r.SpotLight;break;case"ambient":e=new r.AmbientLight}return t.parameters.color&&e.color.copy(t.parameters.color),t.parameters.distance&&(e.distance=t.parameters.distance),e}function it(t){const e=$t.lights[t];return void 0!==e?d(e,rt):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",t),null)}function ot(t){const e={array:[],stride:3};for(let r=0;r<t.childNodes.length;r++){const a=t.childNodes[r];if(1===a.nodeType)switch(a.nodeName){case"float_array":e.array=o(a.textContent);break;case"Name_array":e.array=i(a.textContent);break;case"technique_common":const t=n(a,"accessor")[0];void 0!==t&&(e.stride=parseInt(t.getAttribute("stride")))}}return e}function at(t){const e={};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];1===r.nodeType&&(e[r.getAttribute("semantic")]=s(r.getAttribute("source")))}return e}function st(t){const e={type:t.nodeName,material:t.getAttribute("material"),count:parseInt(t.getAttribute("count")),inputs:{},stride:0,hasUV:!1};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":const t=s(r.getAttribute("source")),n=r.getAttribute("semantic"),i=parseInt(r.getAttribute("offset")),o=parseInt(r.getAttribute("set")),l=o>0?n+o:n;e.inputs[l]={id:t,offset:i},e.stride=Math.max(e.stride,i+1),"TEXCOORD"===n&&(e.hasUV=!0);break;case"vcount":e.vcount=a(r.textContent);break;case"p":e.p=a(r.textContent)}}return e}function lt(t){let e=0;for(let n=0,r=t.length;n<r;n++)!0===t[n].hasUV&&e++;e>0&&e<t.length&&(t.uvsNeedsFix=!0)}function ct(t){const e={},n=t.sources,r=t.vertices,i=t.primitives;if(0===i.length)return{};const o=function(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];void 0===e[r.type]&&(e[r.type]=[]),e[r.type].push(r)}return e}(i);for(const t in o){const i=o[t];lt(i),e[t]=ut(i,n,r)}return e}function ut(t,e,n){const i={},o={array:[],stride:0},a={array:[],stride:0},s={array:[],stride:0},l={array:[],stride:0},c={array:[],stride:0},u=[],p=[],h=new r.BufferGeometry,d=[];let f=0;for(let r=0;r<t.length;r++){const i=t[r],m=i.inputs;let g=0;switch(i.type){case"lines":case"linestrips":g=2*i.count;break;case"triangles":g=3*i.count;break;case"polylist":for(let t=0;t<i.count;t++){const e=i.vcount[t];switch(e){case 3:g+=3;break;case 4:g+=6;break;default:g+=3*(e-2)}}break;default:console.warn("THREE.ColladaLoader: Unknow primitive type:",i.type)}h.addGroup(f,g,r),f+=g,i.material&&d.push(i.material);for(const r in m){const h=m[r];switch(r){case"VERTEX":for(const r in n){const d=n[r];switch(r){case"POSITION":const n=o.array.length;if(pt(i,e[d],h.offset,o.array),o.stride=e[d].stride,e.skinWeights&&e.skinIndices&&(pt(i,e.skinIndices,h.offset,u),pt(i,e.skinWeights,h.offset,p)),!1===i.hasUV&&!0===t.uvsNeedsFix){const t=(o.array.length-n)/o.stride;for(let e=0;e<t;e++)s.array.push(0,0)}break;case"NORMAL":pt(i,e[d],h.offset,a.array),a.stride=e[d].stride;break;case"COLOR":pt(i,e[d],h.offset,c.array),c.stride=e[d].stride;break;case"TEXCOORD":pt(i,e[d],h.offset,s.array),s.stride=e[d].stride;break;case"TEXCOORD1":pt(i,e[d],h.offset,l.array),s.stride=e[d].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',r)}}break;case"NORMAL":pt(i,e[h.id],h.offset,a.array),a.stride=e[h.id].stride;break;case"COLOR":pt(i,e[h.id],h.offset,c.array),c.stride=e[h.id].stride;break;case"TEXCOORD":pt(i,e[h.id],h.offset,s.array),s.stride=e[h.id].stride;break;case"TEXCOORD1":pt(i,e[h.id],h.offset,l.array),l.stride=e[h.id].stride}}}return o.array.length>0&&h.setAttribute("position",new r.Float32BufferAttribute(o.array,o.stride)),a.array.length>0&&h.setAttribute("normal",new r.Float32BufferAttribute(a.array,a.stride)),c.array.length>0&&h.setAttribute("color",new r.Float32BufferAttribute(c.array,c.stride)),s.array.length>0&&h.setAttribute("uv",new r.Float32BufferAttribute(s.array,s.stride)),l.array.length>0&&h.setAttribute("uv2",new r.Float32BufferAttribute(l.array,l.stride)),u.length>0&&h.setAttribute("skinIndex",new r.Float32BufferAttribute(u,4)),p.length>0&&h.setAttribute("skinWeight",new r.Float32BufferAttribute(p,4)),i.data=h,i.type=t[0].type,i.materialKeys=d,i}function pt(t,e,n,r){const i=t.p,o=t.stride,a=t.vcount;function s(t){let e=i[t+n]*c;const o=e+c;for(;e<o;e++)r.push(l[e])}const l=e.array,c=e.stride;if(void 0!==t.vcount){let t=0;for(let e=0,n=a.length;e<n;e++){const n=a[e];if(4===n){const e=t+1*o,n=t+2*o,r=t+3*o;s(t+0*o),s(e),s(r),s(e),s(n),s(r)}else if(3===n){const e=t+1*o,n=t+2*o;s(t+0*o),s(e),s(n)}else if(n>4)for(let e=1,r=n-2;e<=r;e++){const n=t+o*e,r=t+o*(e+1);s(t+0*o),s(n),s(r)}t+=o*n}}else for(let t=0,e=i.length;t<e;t+=o)s(t)}function ht(t){return d($t.geometries[t],ct)}function dt(t){return void 0!==t.build?t.build:t}function ft(t,e){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"joint":e.joints[r.getAttribute("sid")]=mt(r);break;case"link":e.links.push(yt(r))}}}function mt(t){let e;for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"prismatic":case"revolute":e=gt(r)}}return e}function gt(t){const e={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",axis:new r.Vector3,limits:{min:0,max:0},type:t.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"axis":const t=o(r.textContent);e.axis.fromArray(t);break;case"limits":const n=r.getElementsByTagName("max")[0],i=r.getElementsByTagName("min")[0];e.limits.max=parseFloat(n.textContent),e.limits.min=parseFloat(i.textContent)}}return e.limits.min>=e.limits.max&&(e.static=!0),e.middlePosition=(e.limits.min+e.limits.max)/2,e}function yt(t){const e={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",attachments:[],transforms:[]};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"attachment_full":e.attachments.push(vt(r));break;case"matrix":case"translate":case"rotate":e.transforms.push(_t(r))}}return e}function vt(t){const e={joint:t.getAttribute("joint").split("/").pop(),transforms:[],links:[]};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"link":e.links.push(yt(r));break;case"matrix":case"translate":case"rotate":e.transforms.push(_t(r))}}return e}function _t(t){const e={type:t.nodeName},n=o(t.textContent);switch(e.type){case"matrix":e.obj=new r.Matrix4,e.obj.fromArray(n).transpose();break;case"translate":e.obj=new r.Vector3,e.obj.fromArray(n);break;case"rotate":e.obj=new r.Vector3,e.obj.fromArray(n),e.angle=r.MathUtils.degToRad(n[3])}return e}function xt(t,e){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType&&"technique_common"===r.nodeName)bt(r,e)}}function bt(t,e){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"inertia":e.inertia=o(r.textContent);break;case"mass":e.mass=o(r.textContent)[0]}}}function wt(t){const e={target:t.getAttribute("target").split("/").pop()};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType&&"axis"===r.nodeName){const t=r.getElementsByTagName("param")[0];e.axis=t.textContent;const n=e.axis.split("inst_").pop().split("axis")[0];e.jointIndex=n.substr(0,n.length-1)}}return e}function Mt(t){return void 0!==t.build?t.build:t}function St(t){const e=[],n=Ut.querySelector('[id="'+t.id+'"]');for(let t=0;t<n.childNodes.length;t++){const i=n.childNodes[t];if(1!==i.nodeType)continue;let a,s;switch(i.nodeName){case"matrix":a=o(i.textContent);const t=(new r.Matrix4).fromArray(a).transpose();e.push({sid:i.getAttribute("sid"),type:i.nodeName,obj:t});break;case"translate":case"scale":a=o(i.textContent),s=(new r.Vector3).fromArray(a),e.push({sid:i.getAttribute("sid"),type:i.nodeName,obj:s});break;case"rotate":a=o(i.textContent),s=(new r.Vector3).fromArray(a);const n=r.MathUtils.degToRad(a[3]);e.push({sid:i.getAttribute("sid"),type:i.nodeName,obj:s,angle:n})}}return e}const Tt=new r.Matrix4,Et=new r.Vector3;function At(t){const e={name:t.getAttribute("name")||"",type:t.getAttribute("type"),id:t.getAttribute("id"),sid:t.getAttribute("sid"),matrix:new r.Matrix4,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}};for(let n=0;n<t.childNodes.length;n++){const i=t.childNodes[n];if(1!==i.nodeType)continue;let a;switch(i.nodeName){case"node":e.nodes.push(i.getAttribute("id")),At(i);break;case"instance_camera":e.instanceCameras.push(s(i.getAttribute("url")));break;case"instance_controller":e.instanceControllers.push(Ct(i));break;case"instance_light":e.instanceLights.push(s(i.getAttribute("url")));break;case"instance_geometry":e.instanceGeometries.push(Ct(i));break;case"instance_node":e.instanceNodes.push(s(i.getAttribute("url")));break;case"matrix":a=o(i.textContent),e.matrix.multiply(Tt.fromArray(a).transpose()),e.transforms[i.getAttribute("sid")]=i.nodeName;break;case"translate":a=o(i.textContent),Et.fromArray(a),e.matrix.multiply(Tt.makeTranslation(Et.x,Et.y,Et.z)),e.transforms[i.getAttribute("sid")]=i.nodeName;break;case"rotate":a=o(i.textContent);const t=r.MathUtils.degToRad(a[3]);e.matrix.multiply(Tt.makeRotationAxis(Et.fromArray(a),t)),e.transforms[i.getAttribute("sid")]=i.nodeName;break;case"scale":a=o(i.textContent),e.matrix.scale(Et.fromArray(a)),e.transforms[i.getAttribute("sid")]=i.nodeName;break;case"extra":break;default:console.log(i)}}return Dt(e.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",e.id):$t.nodes[e.id]=e,e}function Ct(t){const e={id:s(t.getAttribute("url")),materials:{},skeletons:[]};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];switch(r.nodeName){case"bind_material":const t=r.getElementsByTagName("instance_material");for(let n=0;n<t.length;n++){const r=t[n],i=r.getAttribute("symbol"),o=r.getAttribute("target");e.materials[i]=s(o)}break;case"skeleton":e.skeletons.push(s(r.textContent))}}return e}function Lt(t,e){const n=[],i=[];let o,a,s;for(o=0;o<t.length;o++){const r=t[o];let i;if(Dt(r))Pt(i=Ot(r),e,n);else if(l=r,void 0!==$t.visualScenes[l]){const t=$t.visualScenes[r].children;for(let r=0;r<t.length;r++){const i=t[r];"JOINT"===i.type&&Pt(Ot(i.id),e,n)}}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",r)}var l;for(o=0;o<e.length;o++)for(a=0;a<n.length;a++)if((s=n[a]).bone.name===e[o].name){i[o]=s,s.processed=!0;break}for(o=0;o<n.length;o++)!1===(s=n[o]).processed&&(i.push(s),s.processed=!0);const c=[],u=[];for(o=0;o<i.length;o++)s=i[o],c.push(s.bone),u.push(s.boneInverse);return new r.Skeleton(c,u)}function Pt(t,e,n){t.traverse((function(t){if(!0===t.isBone){let i;for(let n=0;n<e.length;n++){const r=e[n];if(r.name===t.name){i=r.boneInverse;break}}void 0===i&&(i=new r.Matrix4),n.push({bone:t,boneInverse:i,processed:!1})}}))}function It(t){const e=[],n=t.matrix,i=t.nodes,o=t.type,a=t.instanceCameras,s=t.instanceControllers,l=t.instanceLights,c=t.instanceGeometries,u=t.instanceNodes;for(let t=0,n=i.length;t<n;t++)e.push(Ot(i[t]));for(let t=0,n=a.length;t<n;t++){const n=tt(a[t]);null!==n&&e.push(n.clone())}for(let t=0,n=s.length;t<n;t++){const n=s[t],r=(p=n.id,d($t.controllers[p],R)),i=zt(ht(r.id),n.materials),o=Lt(n.skeletons,r.skin.joints);for(let t=0,n=i.length;t<n;t++){const n=i[t];n.isSkinnedMesh&&(n.bind(o,r.skin.bindMatrix),n.normalizeSkinWeights()),e.push(n)}}var p;for(let t=0,n=l.length;t<n;t++){const n=it(l[t]);null!==n&&e.push(n.clone())}for(let t=0,n=c.length;t<n;t++){const n=c[t],r=zt(ht(n.id),n.materials);for(let t=0,n=r.length;t<n;t++)e.push(r[t])}for(let t=0,n=u.length;t<n;t++)e.push(Ot(u[t]).clone());let h;if(0===i.length&&1===e.length)h=e[0];else{h="JOINT"===o?new r.Bone:new r.Group;for(let t=0;t<e.length;t++)h.add(e[t])}return h.name="JOINT"===o?t.sid:t.name,h.matrix.copy(n),h.matrix.decompose(h.position,h.quaternion,h.scale),h}const Rt=new r.MeshBasicMaterial({color:16711935});function kt(t,e){const n=[];for(let r=0,i=t.length;r<i;r++){const i=e[t[r]];void 0===i?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",t[r]),n.push(Rt)):n.push($(i))}return n}function zt(t,e){const n=[];for(const i in t){const o=t[i],a=kt(o.materialKeys,e);0===a.length&&("lines"===i||"linestrips"===i?a.push(new r.LineBasicMaterial):a.push(new r.MeshPhongMaterial));const s=void 0!==o.data.attributes.skinIndex,l=1===a.length?a[0]:a;let c;switch(i){case"lines":c=new r.LineSegments(o.data,l);break;case"linestrips":c=new r.Line(o.data,l);break;case"triangles":case"polylist":c=s?new r.SkinnedMesh(o.data,l):new r.Mesh(o.data,l)}n.push(c)}return n}function Dt(t){return void 0!==$t.nodes[t]}function Ot(t){return d($t.nodes[t],It)}function Ft(t){const e=new r.Group;e.name=t.name;const n=t.children;for(let t=0;t<n.length;t++){const r=n[t];e.add(Ot(r.id))}return e}function Bt(t){return d($t.visualScenes[t],Ft)}if(0===t.length)return{scene:new r.Scene};const Nt=(new DOMParser).parseFromString(t,"application/xml"),Ut=n(Nt,"COLLADA")[0],jt=Nt.getElementsByTagName("parsererror")[0];if(void 0!==jt){const t=n(jt,"div")[0];let e;return e=t?t.textContent:function(t){let e="";const n=[t];for(;n.length;){const t=n.shift();t.nodeType===Node.TEXT_NODE?e+=t.textContent:(e+="\n",n.push.apply(n,t.childNodes))}return e.trim()}(jt),console.error("THREE.ColladaLoader: Failed to parse collada file.\n",e),null}const Vt=Ut.getAttribute("version");console.log("THREE.ColladaLoader: File version",Vt);const Gt=function(t){return{unit:c(n(t,"unit")[0]),upAxis:u(n(t,"up_axis")[0])}}(n(Ut,"asset")[0]),Ht=new r.TextureLoader(this.manager);let Wt;Ht.setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin),r.TGALoader&&(Wt=new r.TGALoader(this.manager)).setPath(this.resourcePath||e);const qt=[];let Zt={},Xt=0;const $t={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};p(Ut,"library_animations","animation",(function t(e){const n={sources:{},samplers:{},channels:{}};let i=!1;for(let r=0,o=e.childNodes.length;r<o;r++){const o=e.childNodes[r];if(1!==o.nodeType)continue;let a;switch(o.nodeName){case"source":a=o.getAttribute("id"),n.sources[a]=ot(o);break;case"sampler":a=o.getAttribute("id"),n.samplers[a]=f(o);break;case"channel":a=o.getAttribute("target"),n.channels[a]=m(o);break;case"animation":t(o),i=!0;break;default:console.log(o)}}!1===i&&($t.animations[e.getAttribute("id")||r.MathUtils.generateUUID()]=n)})),p(Ut,"library_animation_clips","animation_clip",(function(t){const e={name:t.getAttribute("id")||"default",start:parseFloat(t.getAttribute("start")||0),end:parseFloat(t.getAttribute("end")||0),animations:[]};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"instance_animation"===r.nodeName)e.animations.push(s(r.getAttribute("url")))}$t.clips[t.getAttribute("id")]=e})),p(Ut,"library_controllers","controller",(function(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"skin":e.id=s(r.getAttribute("source")),e.skin=L(r);break;case"morph":e.id=s(r.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.")}}$t.controllers[t.getAttribute("id")]=e})),p(Ut,"library_images","image",(function(t){const e={init_from:n(t,"init_from")[0].textContent};$t.images[t.getAttribute("id")]=e})),p(Ut,"library_effects","effect",(function(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"profile_COMMON"===r.nodeName)e.profile=D(r)}$t.effects[t.getAttribute("id")]=e})),p(Ut,"library_materials","material",(function(t){const e={name:t.getAttribute("name")};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"instance_effect"===r.nodeName)e.url=s(r.getAttribute("url"))}$t.materials[t.getAttribute("id")]=e})),p(Ut,"library_cameras","camera",(function(t){const e={name:t.getAttribute("name")};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"optics"===r.nodeName)e.optics=J(r)}$t.cameras[t.getAttribute("id")]=e})),p(Ut,"library_lights","light",(function(t){let e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType&&"technique_common"===r.nodeName)e=et(r)}$t.lights[t.getAttribute("id")]=e})),p(Ut,"library_geometries","geometry",(function(t){const e={name:t.getAttribute("name"),sources:{},vertices:{},primitives:[]},r=n(t,"mesh")[0];if(void 0!==r){for(let t=0;t<r.childNodes.length;t++){const n=r.childNodes[t];if(1!==n.nodeType)continue;const i=n.getAttribute("id");switch(n.nodeName){case"source":e.sources[i]=ot(n);break;case"vertices":e.vertices=at(n);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",n.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":e.primitives.push(st(n));break;default:console.log(n)}}$t.geometries[t.getAttribute("id")]=e}})),p(Ut,"library_nodes","node",At),p(Ut,"library_visual_scenes","visual_scene",(function(t){const e={name:t.getAttribute("name"),children:[]};!function(t){const e=t.getElementsByTagName("node");for(let t=0;t<e.length;t++){const n=e[t];!1===n.hasAttribute("id")&&n.setAttribute("id","three_default_"+Xt++)}}(t);const r=n(t,"node");for(let t=0;t<r.length;t++)e.children.push(At(r[t]));$t.visualScenes[t.getAttribute("id")]=e})),p(Ut,"library_kinematics_models","kinematics_model",(function(t){const e={name:t.getAttribute("name")||"",joints:{},links:[]};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType&&"technique_common"===r.nodeName)ft(r,e)}$t.kinematicsModels[t.getAttribute("id")]=e})),p(Ut,"library_physics_models","physics_model",(function(t){const e={name:t.getAttribute("name")||"",rigidBodies:{}};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType&&"rigid_body"===r.nodeName)e.rigidBodies[r.getAttribute("name")]={},xt(r,e.rigidBodies[r.getAttribute("name")])}$t.physicsModels[t.getAttribute("id")]=e})),p(Ut,"scene","instance_kinematics_scene",(function(t){const e={bindJointAxis:[]};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType&&"bind_joint_axis"===r.nodeName)e.bindJointAxis.push(wt(r))}$t.kinematicsScenes[s(t.getAttribute("url"))]=e})),h($t.animations,g),h($t.clips,A),h($t.controllers,R),h($t.images,k),h($t.effects,Z),h($t.materials,X),h($t.cameras,K),h($t.lights,rt),h($t.geometries,ct),h($t.visualScenes,Ft),function(){const t=$t.clips;if(!0===l(t)){if(!1===l($t.animations)){const t=[];for(const e in $t.animations){const n=y(e);for(let e=0,r=n.length;e<r;e++)t.push(n[e])}qt.push(new r.AnimationClip("default",-1,t))}}else for(const e in t)qt.push(C(e))}(),function(){const t=Object.keys($t.kinematicsModels)[0],e=Object.keys($t.kinematicsScenes)[0],n=Object.keys($t.visualScenes)[0];if(void 0===t||void 0===e)return;const i=(o=t,d($t.kinematicsModels[o],dt));var o;const a=function(t){return d($t.kinematicsScenes[t],Mt)}(e),s=Bt(n),l=a.bindJointAxis,c={};for(let t=0,e=l.length;t<e;t++){const e=l[t],n=Ut.querySelector('[sid="'+e.target+'"]');if(n){const t=n.parentElement;u(e.jointIndex,t)}}function u(t,e){const n=e.getAttribute("name"),r=i.joints[t];s.traverse((function(i){i.name===n&&(c[t]={object:i,transforms:St(e),joint:r,position:r.zeroPosition})}))}const p=new r.Matrix4;Zt={joints:i&&i.joints,getJointValue:function(t){const e=c[t];if(e)return e.position;console.warn("THREE.ColladaLoader: Joint "+t+" doesn't exist.")},setJointValue:function(t,e){const n=c[t];if(n){const i=n.joint;if(e>i.limits.max||e<i.limits.min)console.warn("THREE.ColladaLoader: Joint "+t+" value "+e+" outside of limits (min: "+i.limits.min+", max: "+i.limits.max+").");else if(i.static)console.warn("THREE.ColladaLoader: Joint "+t+" is static.");else{const o=n.object,a=i.axis,s=n.transforms;Tt.identity();for(let n=0;n<s.length;n++){const o=s[n];if(o.sid&&-1!==o.sid.indexOf(t))switch(i.type){case"revolute":Tt.multiply(p.makeRotationAxis(a,r.MathUtils.degToRad(e)));break;case"prismatic":Tt.multiply(p.makeTranslation(a.x*e,a.y*e,a.z*e));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+i.type)}else switch(o.type){case"matrix":Tt.multiply(o.obj);break;case"translate":Tt.multiply(p.makeTranslation(o.obj.x,o.obj.y,o.obj.z));break;case"scale":Tt.scale(o.obj);break;case"rotate":Tt.multiply(p.makeRotationAxis(o.obj,o.angle))}}o.matrix.copy(Tt),o.matrix.decompose(o.position,o.quaternion,o.scale),c[t].position=e}}else console.log("THREE.ColladaLoader: "+t+" does not exist.")}}}();const Jt=function(t){return Bt(s(n(t,"instance_visual_scene")[0].getAttribute("url")))}(n(Ut,"scene")[0]);return Jt.animations=qt,"Z_UP"===Gt.upAxis&&Jt.quaternion.setFromEuler(new r.Euler(-Math.PI/2,0,0)),Jt.scale.multiplyScalar(Gt.unit),{get animations(){return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."),qt},kinematics:Zt,library:$t,scene:Jt}}},J=J=r.ColladaLoader;var Y={};const Q=new P,K=new I,tt=new $,et=new X,nt=new J;Y=Y=function(t,e,n){if(void 0===t)return console.error("Invalid options provided to loadObj()");let r;switch((t=u._validate(t,b.prototype._defaults.loadObj)).type||(t.type="mtl"),t.type){case"mtl":r=Q;break;case"gltf":case"glb":r=tt;break;case"fbx":r=et;break;case"dae":r=nt}K.load(t.mtl,(function(i){i&&"mtl"==t.type&&(i.preload(),r.setMaterials(i)),r.load(t.obj,(r=>{let i=[];switch(t.type){case"mtl":r=r.children[0];break;case"gltf":case"glb":case"dae":i=r.animations,r=r.scene;break;case"fbx":i=r.animations}r.animations=i;const o=u.types.rotation(t.rotation,[0,0,0]),a=u.types.scale(t.scale,[1,1,1]);r.rotation.set(o[0],o[1],o[2]),r.scale.set(a[0],a[1],a[2]),t.normalize&&r.traverse((function(t){if(t.isMesh){let e;"MeshStandardMaterial"==t.material.type?(t.material.metalness&&(t.material.metalness*=.1),t.material.glossiness&&(t.material.glossiness*=.25),e=new THREE.Color(12,12,12)):"MeshPhongMaterial"==t.material.type&&(t.material.shininess=.1,e=new THREE.Color(20,20,20)),t.material.specular&&t.material.specular.isColor&&(t.material.specular=e)}})),r.name="model";let s=b.prototype._makeGroup(r,t);b.prototype._addMethods(s),s.setAnchor(t.anchor),s.setCenter(t.adjustment),s.raycasted=t.raycasted,n(s),e(s),s.setFixedZoom(t.mapScale),s.idle()}),(()=>null),(e=>{console.error("Could not load model file: "+t.obj+" \n "+e.stack),n("Error loading the model")}))}),(()=>null),(t=>{console.warn("No material file found "+t.stack)}))};var rt={};function it(t){t=u._validate(t,b.prototype._defaults.line);var e=u.lnglatsToWorld(t.geometry),n=u.normalizeVertices(e),i=u.flattenVectors(n.vertices),o=new r.LineGeometry;o.setPositions(i);let a=new r.LineMaterial({color:t.color,linewidth:t.width,dashed:!1,opacity:t.opacity});return a.resolution.set(window.innerWidth,window.innerHeight),a.isMaterial=!0,a.transparent=!0,a.depthWrite=!1,(it=new r.Line2(o,a)).position.copy(n.position),it.computeLineDistances(),it}rt=rt=it,function(){const t=new r.Box3,e=new r.Vector3;class n extends r.InstancedBufferGeometry{constructor(){super(),this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new r.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new r.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(t){const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new r.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new r.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new r.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new r.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new r.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new r.InterleavedBufferAttribute(n,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new r.WireframeGeometry(t.geometry)),this}fromLineSegments(t){const e=t.geometry;if(!e.isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new r.Box3);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;void 0!==e&&void 0!==n&&(this.boundingBox.setFromBufferAttribute(e),t.setFromBufferAttribute(n),this.boundingBox.union(t))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere),null===this.boundingBox&&this.computeBoundingBox();const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(void 0!==t&&void 0!==n){const r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0;for(let o=0,a=t.count;o<a;o++)e.fromBufferAttribute(t,o),i=Math.max(i,r.distanceToSquared(e)),e.fromBufferAttribute(n,o),i=Math.max(i,r.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}n.prototype.isLineSegmentsGeometry=!0,r.LineSegmentsGeometry=n}(),function(){class t extends r.LineSegmentsGeometry{constructor(){super(),this.type="LineGeometry"}setPositions(t){for(var e=t.length-3,n=new Float32Array(2*e),r=0;r<e;r+=3)n[2*r]=t[r],n[2*r+1]=t[r+1],n[2*r+2]=t[r+2],n[2*r+3]=t[r+3],n[2*r+4]=t[r+4],n[2*r+5]=t[r+5];return super.setPositions(n),this}setColors(t){for(var e=t.length-3,n=new Float32Array(2*e),r=0;r<e;r+=3)n[2*r]=t[r],n[2*r+1]=t[r+1],n[2*r+2]=t[r+2],n[2*r+3]=t[r+3],n[2*r+4]=t[r+4],n[2*r+5]=t[r+5];return super.setColors(n),this}fromLine(t){var e=t.geometry;if(!e.isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}}t.prototype.isLineGeometry=!0,r.LineGeometry=t}(),function(){class t extends r.LineSegmentsGeometry{constructor(t){super(),this.type="WireframeGeometry2",this.fromWireframeGeometry(new r.WireframeGeometry(t))}}t.prototype.isWireframeGeometry2=!0,r.WireframeGeometry2=t}(),function(){r.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new r.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},r.ShaderLib.line={uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,r.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\t\tvarying vec4 worldPos;\n\t\tvarying vec3 worldStart;\n\t\tvarying vec3 worldEnd;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\tworldStart = start.xyz;\n\t\t\tworldEnd = end.xyz;\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segements overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\t\tvarying vec4 worldPos;\n\t\tvarying vec3 worldStart;\n\t\tvarying vec3 worldEnd;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class t extends r.ShaderMaterial{constructor(t){super({type:"LineMaterial",uniforms:r.UniformsUtils.clone(r.ShaderLib.line.uniforms),vertexShader:r.ShaderLib.line.vertexShader,fragmentShader:r.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===t?(this.defines.ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(t)}}t.prototype.isLineMaterial=!0,r.LineMaterial=t}(),function(){const t=new r.Vector3,e=new r.Vector3,n=new r.Vector4,i=new r.Vector4,o=new r.Vector4,a=new r.Vector3,s=new r.Matrix4,l=new r.Line3,c=new r.Vector3,u=new r.Box3,p=new r.Sphere,h=new r.Vector4;class d extends r.Mesh{constructor(t=new r.LineSegmentsGeometry,e=new r.LineMaterial({color:16777215*Math.random()})){super(t,e),this.type="LineSegments2"}computeLineDistances(){const n=this.geometry,i=n.attributes.instanceStart,o=n.attributes.instanceEnd,a=new Float32Array(2*i.count);for(let n=0,r=0,s=i.count;n<s;n++,r+=2)t.fromBufferAttribute(i,n),e.fromBufferAttribute(o,n),a[r]=0===r?0:a[r-1],a[r+1]=a[r]+t.distanceTo(e);const s=new r.InstancedInterleavedBuffer(a,2,1);return n.setAttribute("instanceDistanceStart",new r.InterleavedBufferAttribute(s,1,0)),n.setAttribute("instanceDistanceEnd",new r.InterleavedBufferAttribute(s,1,1)),this}raycast(t,e){null===t.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');const d=void 0!==t.params.Line2&&t.params.Line2.threshold||0,f=t.ray,m=t.camera,g=m.projectionMatrix,y=this.matrixWorld,v=this.geometry,_=this.material,x=_.resolution,b=_.linewidth+d,w=v.attributes.instanceStart,M=v.attributes.instanceEnd,S=-m.near,T=2*Math.max(b/x.width,b/x.height);null===v.boundingSphere&&v.computeBoundingSphere(),p.copy(v.boundingSphere).applyMatrix4(y);const E=Math.max(m.near,p.distanceToPoint(f.origin));h.set(0,0,-E,1).applyMatrix4(m.projectionMatrix),h.multiplyScalar(1/h.w),h.applyMatrix4(m.projectionMatrixInverse);const A=.5*Math.abs(T/h.w);if(p.radius+=A,!1===t.ray.intersectsSphere(p))return;null===v.boundingBox&&v.computeBoundingBox(),u.copy(v.boundingBox).applyMatrix4(y);const C=Math.max(m.near,u.distanceToPoint(f.origin));h.set(0,0,-C,1).applyMatrix4(m.projectionMatrix),h.multiplyScalar(1/h.w),h.applyMatrix4(m.projectionMatrixInverse);const L=.5*Math.abs(T/h.w);if(u.max.x+=L,u.max.y+=L,u.max.z+=L,u.min.x-=L,u.min.y-=L,u.min.z-=L,!1!==t.ray.intersectsBox(u)){f.at(1,o),o.w=1,o.applyMatrix4(m.matrixWorldInverse),o.applyMatrix4(g),o.multiplyScalar(1/o.w),o.x*=x.x/2,o.y*=x.y/2,o.z=0,a.copy(o),s.multiplyMatrices(m.matrixWorldInverse,y);for(let t=0,o=w.count;t<o;t++){if(n.fromBufferAttribute(w,t),i.fromBufferAttribute(M,t),n.w=1,i.w=1,n.applyMatrix4(s),i.applyMatrix4(s),n.z>S&&i.z>S)continue;if(n.z>S){const t=n.z-i.z,e=(n.z-S)/t;n.lerp(i,e)}else if(i.z>S){const t=i.z-n.z,e=(i.z-S)/t;i.lerp(n,e)}n.applyMatrix4(g),i.applyMatrix4(g),n.multiplyScalar(1/n.w),i.multiplyScalar(1/i.w),n.x*=x.x/2,n.y*=x.y/2,i.x*=x.x/2,i.y*=x.y/2,l.start.copy(n),l.start.z=0,l.end.copy(i),l.end.z=0;const o=l.closestPointToPointParameter(a,!0);l.at(o,c);const u=r.MathUtils.lerp(n.z,i.z,o),p=u>=-1&&u<=1,h=a.distanceTo(c)<.5*b;if(p&&h){l.start.fromBufferAttribute(w,t),l.end.fromBufferAttribute(M,t),l.start.applyMatrix4(y),l.end.applyMatrix4(y);const n=new r.Vector3,i=new r.Vector3;f.distanceSqToSegment(l.start,l.end,i,n),e.push({point:i,pointOnLine:n,distance:f.origin.distanceTo(i),object:this,face:null,faceIndex:t,uv:null,uv2:null})}}}}}d.prototype.LineSegments2=!0,r.LineSegments2=d}(),function(){class t extends r.LineSegments2{constructor(t=new r.LineGeometry,e=new r.LineMaterial({color:16777215*Math.random()})){super(t,e),this.type="Line2"}}t.prototype.isLine2=!0,r.Line2=t}(),function(){const t=new r.Vector3,e=new r.Vector3;class n extends r.Mesh{constructor(t=new r.LineSegmentsGeometry,e=new r.LineMaterial({color:16777215*Math.random()})){super(t,e),this.type="Wireframe"}computeLineDistances(){const n=this.geometry,i=n.attributes.instanceStart,o=n.attributes.instanceEnd,a=new Float32Array(2*i.count);for(let n=0,r=0,s=i.count;n<s;n++,r+=2)t.fromBufferAttribute(i,n),e.fromBufferAttribute(o,n),a[r]=0===r?0:a[r-1],a[r+1]=a[r]+t.distanceTo(e);const s=new r.InstancedInterleavedBuffer(a,2,1);return n.setAttribute("instanceDistanceStart",new r.InterleavedBufferAttribute(s,1,0)),n.setAttribute("instanceDistanceEnd",new r.InterleavedBufferAttribute(s,1,1)),this}}n.prototype.isWireframe=!0,r.Wireframe=n}();var ot={};ot=ot=function(t,e){t=u._validate(t,b.prototype._defaults.tube);let n=[];t.geometry.forEach((t=>{n.push(new r.Vector3(t[0],t[1],t[2]))}));const i=new r.CatmullRomCurve3(n);let o=new r.TubeGeometry(i,n.length,t.radius,t.sides,!1),a=m(t),s=new r.Mesh(o,a);return new S({obj:s,units:t.units,anchor:t.anchor,adjustment:t.adjustment,bbox:t.bbox,tooltip:t.tooltip,raycasted:t.raycasted})};var at={};at=at=function(t){this.map=t,this.renderer=new x.CSS2DRenderer,this.renderer.setSize(this.map.getCanvas().clientWidth,this.map.getCanvas().clientHeight),this.renderer.domElement.style.position="absolute",this.renderer.domElement.id="labelCanvas",this.renderer.domElement.style.top=0,this.renderer.domElement.style.zIndex="0",this.map.getCanvasContainer().appendChild(this.renderer.domElement),this.scene,this.camera,this.dispose=function(){this.map.getCanvasContainer().removeChild(this.renderer.domElement),this.renderer.domElement.remove(),this.renderer={}},this.setSize=function(t,e){this.renderer.setSize(t,e)},this.map.on("resize",function(){this.renderer.setSize(this.map.getCanvas().clientWidth,this.map.getCanvas().clientHeight)}.bind(this)),this.state={reset:function(){}},this.render=async function(t,e){return this.scene=t,this.camera=e,new Promise((n=>{n(this.renderer.render(t,e))}))},this.toggleLabels=async function(t,e){return new Promise((n=>{n(this.setVisibility(t,e,this.scene,this.camera,this.renderer))}))},this.setVisibility=function(t,e,n,r,i){this.renderer.cacheList.forEach((function(o){o.visible!=e&&o.layer===t&&(e&&o.alwaysVisible||!e)&&(o.visible=e,i.renderObject(o,n,r))}))}};var st={};st=st=class{constructor(t,e){this.id=t.layerId,this.type="custom",this.renderingMode="3d",this.opacity=.5,this.buildingsLayerId=t.buildingsLayerId,this.minAltitude=t.minAltitude||.1,this.tb=e}onAdd(t,e){this.map=t;const n=e.createShader(e.VERTEX_SHADER);e.shaderSource(n,"\n\t\t\tuniform mat4 u_matrix;\n\t\t\tuniform float u_height_factor;\n\t\t\tuniform float u_altitude;\n\t\t\tuniform float u_azimuth;\n\t\t\tattribute vec2 a_pos;\n\t\t\tattribute vec4 a_normal_ed;\n\t\t\tattribute lowp vec2 a_base;\n\t\t\tattribute lowp vec2 a_height;\n\t\t\tvoid main() {\n\t\t\t\tfloat base = max(0.0, a_base.x);\n\t\t\t\tfloat height = max(0.0, a_height.x);\n\t\t\t\tfloat t = mod(a_normal_ed.x, 2.0);\n\t\t\t\tvec4 pos = vec4(a_pos, t > 0.0 ? height : base, 1);\n\t\t\t\tfloat len = pos.z * u_height_factor / tan(u_altitude);\n\t\t\t\tpos.x += cos(u_azimuth) * len;\n\t\t\t\tpos.y += sin(u_azimuth) * len;\n\t\t\t\tpos.z = 0.0;\n\t\t\t\tgl_Position = u_matrix * pos;\n\t\t\t}\n\t\t\t"),e.compileShader(n);const r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(r,"\n\t\t\tvoid main() {\n\t\t\t\tgl_FragColor = vec4(0.0, 0.0, 0.0, 0.7);\n\t\t\t}\n\t\t\t"),e.compileShader(r),this.program=e.createProgram(),e.attachShader(this.program,n),e.attachShader(this.program,r),e.linkProgram(this.program),e.validateProgram(this.program),this.uMatrix=e.getUniformLocation(this.program,"u_matrix"),this.uHeightFactor=e.getUniformLocation(this.program,"u_height_factor"),this.uAltitude=e.getUniformLocation(this.program,"u_altitude"),this.uAzimuth=e.getUniformLocation(this.program,"u_azimuth"),this.aPos=e.getAttribLocation(this.program,"a_pos"),this.aNormal=e.getAttribLocation(this.program,"a_normal_ed"),this.aBase=e.getAttribLocation(this.program,"a_base"),this.aHeight=e.getAttribLocation(this.program,"a_height")}render(t,e){t.useProgram(this.program);const n=this.map.style.sourceCaches.composite,r=n.getVisibleCoordinates().reverse(),i=this.map.getLayer(this.buildingsLayerId),o=this.map.painter.context,{lng:a,lat:s}=this.map.getCenter(),l=this.tb.getSunPosition(this.tb.lightDateTime,[a,s]);t.uniform1f(this.uAltitude,l.altitude>this.minAltitude?l.altitude:0),t.uniform1f(this.uAzimuth,l.azimuth+3*Math.PI/2),t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.getExtension("EXT_blend_minmax"),t.disable(t.DEPTH_TEST);for(const e of r){const r=n.getTile(e),a=r.getBucket(i);if(!a)continue;const[s,l]=a.programConfigurations.programConfigurations[this.buildingsLayerId]._buffers;t.uniformMatrix4fv(this.uMatrix,!1,e.posMatrix),t.uniform1f(this.uHeightFactor,Math.pow(2,e.overscaledZ)/r.tileSize/8);for(const e of a.segments.get()){const n=o.currentNumAttributes||0,r=2;for(let e=r;e<n;e++)t.disableVertexAttribArray(e);const i=e.vertexOffset||0;t.enableVertexAttribArray(this.aPos),t.enableVertexAttribArray(this.aNormal),t.enableVertexAttribArray(this.aHeight),t.enableVertexAttribArray(this.aBase),a.layoutVertexBuffer.bind(),t.vertexAttribPointer(this.aPos,2,t.SHORT,!1,12,12*i),t.vertexAttribPointer(this.aNormal,4,t.SHORT,!1,12,4+12*i),s.bind(),t.vertexAttribPointer(this.aHeight,1,t.FLOAT,!1,4,4*i),l.bind(),t.vertexAttribPointer(this.aBase,1,t.FLOAT,!1,4,4*i),a.indexBuffer.bind(),o.currentNumAttributes=r,t.drawElements(t.TRIANGLES,3*e.primitiveLength,t.UNSIGNED_SHORT,3*e.primitiveOffset*2)}}}};var lt={};function ct(t,e,n){this.init(t,e,n)}ct.prototype={repaint:function(){this.map.repaint=!0},init:function(t,e,n){this.options=u._validate(n||{},ut),this.map=t,this.map.tb=this,this.objects=new b,this.mapboxVersion=parseFloat(this.map.version),this.renderer=new r.WebGLRenderer({alpha:!0,antialias:!0,preserveDrawingBuffer:n.preserveDrawingBuffer,canvas:t.getCanvas(),context:e}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.map.getCanvas().clientWidth,this.map.getCanvas().clientHeight),this.renderer.outputEncoding=r.sRGBEncoding,this.renderer.autoClear=!1,this.labelRenderer=new at(this.map),this.scene=new r.Scene,this.world=new r.Group,this.world.name="world",this.scene.add(this.world),this.objectsCache=new Map,this.zoomLayers=[],this.fov=this.options.fov,this.orthographic=this.options.orthographic||!1,this.raycaster=new r.Raycaster,this.raycaster.layers.set(0),this.mapCenter=this.map.getCenter(),this.mapCenterUnits=u.projectToWorld([this.mapCenter.lng,this.mapCenter.lat]),this.lightDateTime=new Date,this.lightLng=this.mapCenter.lng,this.lightLat=this.mapCenter.lat,this.sunPosition,this.rotationStep=5,this.gridStep=6,this.altitudeStep=.1,this.defaultCursor="default",this.lights=this.initLights,this.options.defaultLights&&this.defaultLights(),this.options.realSunlight&&this.realSunlight(this.options.realSunlightHelper),this.skyLayerName="sky-layer",this.terrainSourceName="mapbox-dem",this.terrainExaggeration=1,this.terrainLayerName="",this.enableSelectingFeatures=this.options.enableSelectingFeatures||!1,this.enableSelectingObjects=this.options.enableSelectingObjects||!1,this.enableDraggingObjects=this.options.enableDraggingObjects||!1,this.enableRotatingObjects=this.options.enableRotatingObjects||!1,this.enableTooltips=this.options.enableTooltips||!1,this.multiLayer=this.options.multiLayer||!1,this.map.on("style.load",(function(){this.tb.zoomLayers=[],this.tb.options.multiLayer&&this.addLayer({id:"threebox_layer",type:"custom",renderingMode:"3d",map:this,onAdd:function(t,e){},render:function(t,e){this.map.tb.update()}}),this.once("idle",(()=>{this.tb.setObjectsScale()})),this.tb.options.sky&&(this.tb.sky=!0),this.tb.options.terrain&&(this.tb.terrain=!0),["satellite","mapbox-mapbox-satellite","satelliteLayer"].forEach((t=>{this.getLayer(t)&&(this.tb.terrainLayerName=t)}))})),this.map.on("load",(function(){let e;this.selectedObject,this.selectedFeature,this.draggedObject,this.overedObject,this.overedFeature;let n,r=this.getCanvasContainer();this.getCanvasContainer().style.cursor=this.tb.defaultCursor;let i,o,a,s,l=[];function c(t){var e=r.getBoundingClientRect();return{x:t.originalEvent.clientX-e.left-r.clientLeft,y:t.originalEvent.clientY-e.top-r.clientTop}}this.unselectObject=function(){this.selectedObject.selected=!1,this.selectedObject=null},this.outObject=function(){this.overedObject.over=!1,this.overedObject=null},this.unselectFeature=function(t){void 0!==t.id&&(this.setFeatureState({source:t.source,sourceLayer:t.sourceLayer,id:t.id},{select:!1}),this.removeTooltip(t),(t=this.queryRenderedFeatures({layers:[t.layer.id],filter:["==",["id"],t.id]})[0])&&this.fire("SelectedFeatureChange",{detail:t}),this.selectedFeature=null)},this.selectFeature=function(t){this.selectedFeature=t,this.setFeatureState({source:this.selectedFeature.source,sourceLayer:this.selectedFeature.sourceLayer,id:this.selectedFeature.id},{select:!0}),this.selectedFeature=this.queryRenderedFeatures({layers:[this.selectedFeature.layer.id],filter:["==",["id"],this.selectedFeature.id]})[0],this.addTooltip(this.selectedFeature),this.fire("SelectedFeatureChange",{detail:this.selectedFeature})},this.outFeature=function(e){this.overedFeature&&void 0!==this.overedFeature&&this.overedFeature.id!=e&&(t.setFeatureState({source:this.overedFeature.source,sourceLayer:this.overedFeature.sourceLayer,id:this.overedFeature.id},{hover:!1}),this.removeTooltip(this.overedFeature),this.overedFeature=null)},this.addTooltip=function(t){if(!this.tb.enableTooltips)return;let e=this.tb.getFeatureCenter(t),n=this.tb.tooltip({text:t.properties.name||t.id||t.type,mapboxStyle:!0,feature:t});n.setCoords(e),this.tb.add(n,t.layer.id),t.tooltip=n,t.tooltip.tooltip.visible=!0},this.removeTooltip=function(t){t.tooltip&&(t.tooltip.visibility=!1,this.tb.remove(t.tooltip),t.tooltip=null)},t.onContextMenu=function(t){alert("contextMenu")},this.onClick=function(e){let n,r=[];if(t.tb.enableSelectingObjects&&(r=this.tb.queryRenderedFeatures(e.point)),n="object"==typeof r[0]){let t=ct.prototype.findParent3DObject(r[0]);if(t){if(this.selectedFeature&&this.unselectFeature(this.selectedFeature),this.selectedObject){if(this.selectedObject.uuid!=t.uuid)this.selectedObject.selected=!1,t.selected=!0,this.selectedObject=t;else if(this.selectedObject.uuid==t.uuid)return void this.unselectObject()}else this.selectedObject=t,this.selectedObject.selected=!0;this.selectedObject.dispatchEvent({type:"Wireframed",detail:this.selectedObject}),this.selectedObject.dispatchEvent({type:"IsPlayingChanged",detail:this.selectedObject}),this.repaint=!0,e.preventDefault()}}else{let n=[];if(t.tb.enableSelectingFeatures&&(n=this.queryRenderedFeatures(e.point)),n.length>0&&"fill-extrusion"==n[0].layer.type&&void 0!==n[0].id)if(this.selectedObject&&this.unselectObject(),this.selectedFeature){if(this.selectedFeature.id!=n[0].id)this.unselectFeature(this.selectedFeature),this.selectFeature(n[0]);else if(this.selectedFeature.id==n[0].id)return void this.unselectFeature(this.selectedFeature)}else this.selectFeature(n[0])}},this.onMouseMove=function(r){let l,u=c(r);if(this.getCanvasContainer().style.cursor=this.tb.defaultCursor,r.originalEvent.altKey&&this.draggedObject){if(!t.tb.enableRotatingObjects)return;e="rotate",this.getCanvasContainer().style.cursor="move",Math.min(n.x,u.x),Math.max(n.x,u.x),Math.min(n.y,u.y),Math.max(n.y,u.y);let r={x:0,y:0,z:Math.round(s[2]+~~((u.x-n.x)/this.tb.rotationStep)%360*this.tb.rotationStep%360)};return this.draggedObject.setRotation(r),void this.draggedObject.addHelp("rot: "+r.z+"&#176;")}if(r.originalEvent.shiftKey&&this.draggedObject){if(!t.tb.enableDraggingObjects)return;e="translate",this.getCanvasContainer().style.cursor="move";let n=r.lngLat,a=[Number((n.lng+i).toFixed(this.tb.gridStep)),Number((n.lat+o).toFixed(this.tb.gridStep)),this.draggedObject.modelHeight];return this.draggedObject.setCoords(a),void this.draggedObject.addHelp("lng: "+a[0]+"&#176;, lat: "+a[1]+"&#176;")}if(r.originalEvent.ctrlKey&&this.draggedObject){if(!t.tb.enableDraggingObjects)return;e="altitude",this.getCanvasContainer().style.cursor="move";let n=r.point.y*this.tb.altitudeStep,i=[this.draggedObject.coordinates[0],this.draggedObject.coordinates[1],Number((-n-a).toFixed(this.tb.gridStep))];return this.draggedObject.setCoords(i),void this.draggedObject.addHelp("alt: "+i[2]+"m")}let p=[];if(t.tb.enableSelectingObjects&&(p=this.tb.queryRenderedFeatures(r.point)),l="object"==typeof p[0]){let t=ct.prototype.findParent3DObject(p[0]);t&&(this.outFeature(this.overedFeature),this.getCanvasContainer().style.cursor="pointer",this.selectedObject&&t.uuid==this.selectedObject.uuid?this.selectedObject&&t.uuid==this.selectedObject.uuid&&(t.over=!0,this.overedObject=t):(this.overedObject&&this.overedObject.uuid!=t.uuid&&this.outObject(),t.over=!0,this.overedObject=t),this.repaint=!0,r.preventDefault())}else{this.overedObject&&this.outObject();let e=[];t.tb.enableSelectingFeatures&&(e=this.queryRenderedFeatures(r.point)),e.length>0&&(this.outFeature(e[0]),"fill-extrusion"==e[0].layer.type&&void 0!==e[0].id&&(this.selectedFeature&&this.selectedFeature.id==e[0].id||(this.getCanvasContainer().style.cursor="pointer",this.overedFeature=e[0],this.setFeatureState({source:this.overedFeature.source,sourceLayer:this.overedFeature.sourceLayer,id:this.overedFeature.id},{hover:!0}),this.overedFeature=t.queryRenderedFeatures({layers:[this.overedFeature.layer.id],filter:["==",["id"],this.overedFeature.id]})[0],this.addTooltip(this.overedFeature))))}},this.onMouseDown=function(e){(e.originalEvent.shiftKey||e.originalEvent.altKey||e.originalEvent.ctrlKey)&&0===e.originalEvent.button&&this.selectedObject&&(t.tb.enableDraggingObjects||t.tb.enableRotatingObjects)&&(e.preventDefault(),t.getCanvasContainer().style.cursor="move",t.once("mouseup",this.onMouseUp),this.draggedObject=this.selectedObject,n=c(e),l=this.draggedObject.coordinates,s=u.degreeify(this.draggedObject.rotation),i=l[0]-e.lngLat.lng,o=l[1]-e.lngLat.lat,a=-this.draggedObject.modelHeight-e.point.y*this.tb.altitudeStep)},this.onMouseUp=function(t){this.getCanvasContainer().style.cursor=this.tb.defaultCursor,this.off("mouseup",this.onMouseUp),this.off("mouseout",this.onMouseUp),this.dragPan.enable(),this.draggedObject&&(this.draggedObject.dispatchEvent({type:"ObjectDragged",detail:{draggedObject:this.draggedObject,draggedAction:e}}),this.draggedObject.removeHelp(),this.draggedObject=null,e=null)},this.onMouseOut=function(t){if(this.overedFeature){let e=this.queryRenderedFeatures(t.point);e.length>0&&this.overedFeature.id!=e[0].id&&(this.getCanvasContainer().style.cursor=this.tb.defaultCursor,this.outFeature(e[0]))}},this.onZoom=function(t){this.tb.zoomLayers.forEach((t=>{this.tb.toggleLayer(t)})),this.tb.setObjectsScale()};let p=!1,h=!1;this.on("click",this.onClick),this.on("mousemove",this.onMouseMove),this.on("mouseout",this.onMouseOut),this.on("mousedown",this.onMouseDown),this.on("zoom",this.onZoom),this.on("zoomend",this.onZoom),document.addEventListener("keydown",function(t){17!==t.which&&91!==t.which||(p=!0),16===t.which&&(h=!0);let e=this.selectedObject;if(h&&83===t.which&&e){let t=u.toDecimal;if(e.help)e.removeHelp();else{let n=e.modelSize,r=1;"meters"!==e.userData.units&&((r=u.projectedUnitsPerMeter(e.coordinates[1]))||(r=1),r=t(r,7)),e.addHelp("size(m): "+t(n.x/r,3)+" W, "+t(n.y/r,3)+" L, "+t(n.z/r,3)+" H"),this.repaint=!0}return!1}}.bind(this),!0),document.addEventListener("keyup",function(t){17!=t.which&&91!=t.which||(p=!1),16===t.which&&(h=!1)}.bind(this))}))},get sky(){return this.options.sky},set sky(t){t?this.createSkyLayer():this.removeLayer(this.skyLayerName),this.options.sky=t},get terrain(){return this.options.terrain},set terrain(t){if(this.terrainLayerName="",t)this.createTerrainLayer();else{if(this.mapboxVersion<2)return void console.warn("Terrain layer are only supported by Mapbox-gl-js > v2.0");this.map.getTerrain()&&(this.map.setTerrain(null),this.map.removeSource(this.terrainSourceName))}this.options.terrain=t},get fov(){return this.options.fov},set fov(t){this.camera instanceof r.PerspectiveCamera&&this.options.fov!==t&&(this.map.transform.fov=t,this.camera.fov=this.map.transform.fov,this.cameraSync.setupCamera(),this.map.repaint=!0,this.options.fov=t)},get orthographic(){return this.options.orthographic},set orthographic(t){const e=this.map.getCanvas().clientHeight,n=this.map.getCanvas().clientWidth;t?(this.map.transform.fov=0,this.camera=new r.OrthographicCamera(n/-2,n/2,e/2,e/-2,.1,1e21)):(this.map.transform.fov=this.fov,this.camera=new r.PerspectiveCamera(this.map.transform.fov,n/e,.1,1e21)),this.camera.layers.enable(0),this.camera.layers.enable(1),this.cameraSync=new h(this.map,this.camera,this.world),this.map.repaint=!0,this.options.orthographic=t},createSkyLayer:function(){if(this.mapboxVersion<2)return console.warn("Sky layer are only supported by Mapbox-gl-js > v2.0"),void(this.options.sky=!1);this.map.getLayer(this.skyLayerName)||(this.map.addLayer({id:this.skyLayerName,type:"sky",paint:{"sky-opacity":["interpolate",["linear"],["zoom"],0,0,5,.3,8,1],"sky-type":"atmosphere","sky-atmosphere-sun":this.getSunSky(this.lightDateTime),"sky-atmosphere-sun-intensity":10}}),this.map.once("idle",(()=>{this.setSunlight(),this.repaint()})))},createTerrainLayer:function(){if(this.mapboxVersion<2)return console.warn("Terrain layer are only supported by Mapbox-gl-js > v2.0"),void(this.options.terrain=!1);this.map.getTerrain()||(this.map.addSource(this.terrainSourceName,{type:"raster-dem",url:"mapbox://mapbox.mapbox-terrain-dem-v1",tileSize:512,maxzoom:14}),this.map.setTerrain({source:this.terrainSourceName,exaggeration:this.terrainExaggeration}),this.map.once("idle",(()=>{this.cameraSync.updateCamera(),this.repaint()})))},sphere:function(t){return this.setDefaultView(t,this.options),T(t,this.world)},line:rt,label:C,tooltip:L,tube:function(t){return this.setDefaultView(t,this.options),ot(t,this.world)},extrusion:function(t){return this.setDefaultView(t,this.options),E(t)},Object3D:function(t){return this.setDefaultView(t,this.options),S(t)},loadObj:async function(t,e){if(this.setDefaultView(t,this.options),!1===t.clone)return new Promise((async n=>{Y(t,e,(async t=>{n(t)}))}));{let n=this.objectsCache.get(t.obj);n?n.promise.then((n=>{e(n.duplicate(t))})).catch((e=>{this.objectsCache.delete(t.obj),console.error("Could not load model file: "+t.obj)})):this.objectsCache.set(t.obj,{promise:new Promise((async(n,r)=>{Y(t,e,(async t=>{t.duplicate?n(t.duplicate()):r(t)}))}))})}},material:function(t){return m(t)},initLights:{ambientLight:null,dirLight:null,dirLightBack:null,dirLightHelper:null,hemiLight:null,pointLight:null},utils:u,SunCalc:f,Constants:i,projectToWorld:function(t){return this.utils.projectToWorld(t)},unprojectFromWorld:function(t){return this.utils.unprojectFromWorld(t)},projectedUnitsPerMeter:function(t){return this.utils.projectedUnitsPerMeter(t)},getFeatureCenter:function(t,e,n){return u.getFeatureCenter(t,e,n)},getObjectHeightOnFloor:function(t,e,n){return u.getObjectHeightOnFloor(t,e,n)},queryRenderedFeatures:function(t){let e=new r.Vector2;return e.x=t.x/this.map.transform.width*2-1,e.y=1-t.y/this.map.transform.height*2,this.raycaster.setFromCamera(e,this.camera),this.raycaster.intersectObjects(this.world.children,!0)},findParent3DObject:function(t){var e;return t.object.traverseAncestors((function(t){t.parent&&"Group"==t.parent.type&&t.userData.obj&&(e=t)})),e},setLayoutProperty:function(t,e,n){this.map.setLayoutProperty(t,e,n),null!=n&&"visibility"===e&&this.world.children.filter((e=>e.layer===t)).forEach((t=>{t.visibility=n}))},setLayerZoomRange:function(t,e,n){this.map.getLayer(t)&&(this.map.setLayerZoomRange(t,e,n),this.zoomLayers.includes(t)||this.zoomLayers.push(t),this.toggleLayer(t))},setLayerHeigthProperty:function(t,e){let n=this.map.getLayer(t);if(n)if("fill-extrusion"==n.type){let t=this.map.getStyle().sources[n.source].data;t.features.forEach((function(t){t.properties.level=e})),this.map.getSource(n.source).setData(t)}else"custom"==n.type&&this.world.children.forEach((function(n){let r=n.userData.feature;if(r&&r.layer===t){let t=this.tb.getFeatureCenter(r,n,e);n.setCoords(t)}}))},setObjectsScale:function(){this.world.children.filter((t=>null!=t.fixedZoom)).forEach((t=>{t.setObjectScale(this.map.transform.scale)}))},setStyle:function(t,e){this.clear().then((()=>{this.map.setStyle(t,e)}))},toggleLayer:function(t,e=!0){let n=this.map.getLayer(t);if(n){if(!e)return void this.toggle(n.id,!1);let t=this.map.getZoom();if(n.minzoom&&t<n.minzoom)return void this.toggle(n.id,!1);if(n.maxzoom&&t>=n.maxzoom)return void this.toggle(n.id,!1);this.toggle(n.id,!0)}},toggle:function(t,e){this.setLayoutProperty(t,"visibility",e?"visible":"none"),this.labelRenderer.toggleLabels(t,e)},update:function(){this.map.repaint&&(this.map.repaint=!1);var t=Date.now();this.objects.animationManager.update(t),this.updateLightHelper(),this.renderer.resetState(),this.renderer.render(this.scene,this.camera),this.labelRenderer.render(this.scene,this.camera),!1===this.options.passiveRendering&&this.map.triggerRepaint()},add:function(t,e,n){if(!this.enableTooltips&&t.tooltip&&(t.tooltip.visibility=!1),this.world.add(t),e){t.layer=e,t.source=n;let r=this.map.getLayer(e);if(r){let e=r.visibility,n=void 0===e;t.visibility=!(!n&&"visible"!==e)}}},removeByName:function(t){let e=this.world.getObjectByName(t);e&&this.remove(e)},remove:function(t){this.map.selectedObject&&t.uuid==this.map.selectedObject.uuid&&this.map.unselectObject(),this.map.draggedObject&&t.uuid==this.map.draggedObject.uuid&&(this.map.draggedObject=null),t.dispose&&t.dispose(),this.world.remove(t),t=null},clear:async function(t=null,e=!1){return new Promise(((n,r)=>{let i=[];this.world.children.forEach((function(t){i.push(t)}));for(let e=0;e<i.length;e++){let n=i[e];n.layer!==t&&t||this.remove(n)}e&&this.objectsCache.forEach((t=>{t.promise.then((t=>{t.dispose(),t=null}))})),n("clear")}))},removeLayer:function(t){this.clear(t,!0).then((()=>{this.map.removeLayer(t)}))},getSunPosition:function(t,e){return f.getPosition(t||Date.now(),e[1],e[0])},getSunTimes:function(t,e){return f.getTimes(t,e[1],e[0],e[2]?e[2]:0)},setBuildingShadows:function(t){if(this.map.getLayer(t.buildingsLayerId)){let e=new st(t,this);this.map.addLayer(e,t.buildingsLayerId)}else console.warn("The layer '"+t.buildingsLayerId+"' does not exist in the map.")},setSunlight:function(t=new Date,e){if(!this.lights.dirLight||!this.options.realSunlight)return void console.warn("To use setSunlight it's required to set realSunlight : true in Threebox initial options.");var n=new Date(t.getTime());if(e?e.lng&&e.lat?this.mapCenter=e:this.mapCenter={lng:e[0],lat:e[1]}:this.mapCenter=this.map.getCenter(),this.lightDateTime&&this.lightDateTime.getTime()===n.getTime()&&this.lightLng===this.mapCenter.lng&&this.lightLat===this.mapCenter.lat)return;this.lightDateTime=n,this.lightLng=this.mapCenter.lng,this.lightLat=this.mapCenter.lat,this.sunPosition=this.getSunPosition(n,[this.mapCenter.lng,this.mapCenter.lat]);let r=this.sunPosition.altitude,o=Math.PI+this.sunPosition.azimuth,a=i.WORLD_SIZE/2,s=Math.sin(r),l=Math.cos(r),c=Math.cos(o)*l,u=Math.sin(o)*l;this.lights.dirLight.position.set(u,c,s),this.lights.dirLight.position.multiplyScalar(a),this.lights.dirLight.intensity=Math.max(s,0),this.lights.hemiLight.intensity=Math.max(1*s,.1),this.lights.dirLight.updateMatrixWorld(),this.updateLightHelper(),this.map.loaded()&&(this.updateSunGround(this.sunPosition),this.map.setLight({anchor:"map",position:[3,180+180*this.sunPosition.azimuth/Math.PI,90-180*this.sunPosition.altitude/Math.PI],intensity:Math.cos(this.sunPosition.altitude),color:`hsl(40, ${50*Math.cos(this.sunPosition.altitude)}%, ${Math.max(20,20+96*Math.sin(this.sunPosition.altitude))}%)`},{duration:0}),this.sky&&this.updateSunSky(this.getSunSky(n,this.sunPosition)))},getSunSky:function(t,e){if(!e){var n=this.map.getCenter();e=this.getSunPosition(t||Date.now(),[n.lng,n.lat])}return[180+180*e.azimuth/Math.PI,90-180*e.altitude/Math.PI]},updateSunSky:function(t){this.sky&&this.map.setPaintProperty(this.skyLayerName,"sky-atmosphere-sun",t)},updateSunGround:function(t){""!=this.terrainLayerName&&this.map.setPaintProperty(this.terrainLayerName,"raster-opacity",Math.max(Math.min(1,4*t.altitude),.25))},updateLightHelper:function(){this.lights.dirLightHelper&&(this.lights.dirLightHelper.position.setFromMatrixPosition(this.lights.dirLight.matrixWorld),this.lights.dirLightHelper.updateMatrix(),this.lights.dirLightHelper.update())},dispose:async function(){return console.log(this.memory()),new Promise((t=>{t(this.clear(null,!0).then((t=>(this.map.remove(),this.map={},this.scene.remove(this.world),this.world.children=[],this.world=null,this.objectsCache.clear(),this.labelRenderer.dispose(),console.log(this.memory()),this.renderer.dispose(),t))))}))},defaultLights:function(){this.lights.ambientLight=new r.AmbientLight(new r.Color("hsl(0, 0%, 100%)"),.75),this.scene.add(this.lights.ambientLight),this.lights.dirLightBack=new r.DirectionalLight(new r.Color("hsl(0, 0%, 100%)"),.25),this.lights.dirLightBack.position.set(30,100,100),this.scene.add(this.lights.dirLightBack),this.lights.dirLight=new r.DirectionalLight(new r.Color("hsl(0, 0%, 100%)"),.25),this.lights.dirLight.position.set(-30,100,-100),this.scene.add(this.lights.dirLight)},realSunlight:function(t=!1){this.renderer.shadowMap.enabled=!0,this.lights.dirLight=new r.DirectionalLight(16777215,1),this.scene.add(this.lights.dirLight),t&&(this.lights.dirLightHelper=new r.DirectionalLightHelper(this.lights.dirLight,5),this.scene.add(this.lights.dirLightHelper)),this.lights.dirLight.castShadow=!0,this.lights.dirLight.shadow.radius=2,this.lights.dirLight.shadow.mapSize.width=8192,this.lights.dirLight.shadow.mapSize.height=8192,this.lights.dirLight.shadow.camera.top=this.lights.dirLight.shadow.camera.right=1e3,this.lights.dirLight.shadow.camera.bottom=this.lights.dirLight.shadow.camera.left=-1e3,this.lights.dirLight.shadow.camera.near=1,this.lights.dirLight.shadow.camera.visible=!0,this.lights.dirLight.shadow.camera.far=4e8,this.lights.hemiLight=new r.HemisphereLight(new r.Color(16777215),new r.Color(16777215),.6),this.lights.hemiLight.color.setHSL(.661,.96,.12),this.lights.hemiLight.groundColor.setHSL(.11,.96,.14),this.lights.hemiLight.position.set(0,0,50),this.scene.add(this.lights.hemiLight),this.setSunlight(),this.map.once("idle",(()=>{this.setSunlight(),this.repaint()}))},setDefaultView:function(t,e){t.bbox=(t.bbox||null==t.bbox)&&e.enableSelectingObjects,t.tooltip=(t.tooltip||null==t.tooltip)&&e.enableTooltips,t.mapScale=this.map.transform.scale},memory:function(){return this.renderer.info.memory},programs:function(){return this.renderer.info.programs.length},version:"2.2.6"};var ut={defaultLights:!1,realSunlight:!1,realSunlightHelper:!1,passiveRendering:!0,preserveDrawingBuffer:!1,enableSelectingFeatures:!1,enableSelectingObjects:!1,enableDraggingObjects:!1,enableRotatingObjects:!1,enableTooltips:!1,multiLayer:!1,orthographic:!1,fov:i.FOV_DEGREES,sky:!1,terrain:!1};lt=lt=ct,window.Threebox=lt,window.THREE=r}();!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).turf=t()}}((function(){return function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};e[a][0].call(u.exports,(function(t){return i(e[a][1][t]||t)}),u,u.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){e.exports={along:t("@turf/along").default,bbox:t("@turf/bbox").default,center:t("@turf/center").default,distance:t("@turf/distance").default,destination:t("@turf/destination").default,length:t("@turf/length").default,nearestPointOnLine:t("@turf/nearest-point-on-line").default,booleanPointInPolygon:t("@turf/boolean-point-in-polygon").default,pointOnFeature:t("@turf/point-on-feature").default}},{"@turf/along":2,"@turf/bbox":3,"@turf/boolean-point-in-polygon":5,"@turf/center":6,"@turf/destination":8,"@turf/distance":9,"@turf/length":13,"@turf/nearest-point-on-line":17,"@turf/point-on-feature":19}],2:[function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("@turf/bearing")),o=r(t("@turf/destination")),a=r(t("@turf/distance")),s=t("@turf/helpers"),l=t("@turf/invariant");n.default=function(t,e,n){void 0===n&&(n={});for(var r=l.getGeom(t).coordinates,c=0,u=0;u<r.length&&!(e>=c&&u===r.length-1);u++){if(c>=e){var p=e-c;if(p){var h=i.default(r[u],r[u-1])-180;return o.default(r[u],p,h,n)}return s.point(r[u])}c+=a.default(r[u],r[u+1],n)}return s.point(r[r.length-1])}},{"@turf/bearing":4,"@turf/destination":8,"@turf/distance":9,"@turf/helpers":11,"@turf/invariant":12}],3:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("@turf/meta");function i(t){var e=[1/0,1/0,-1/0,-1/0];r.coordEach(t,(function(t){e[0]>t[0]&&(e[0]=t[0]);e[1]>t[1]&&(e[1]=t[1]);e[2]<t[0]&&(e[2]=t[0]);e[3]<t[1]&&(e[3]=t[1])}));return e}i.default=i;n.default=i},{"@turf/meta":16}],4:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("@turf/helpers"),i=t("@turf/invariant");function o(t,e,n){void 0===n&&(n={});if(!0===n.final)return function(t,e){var n=o(e,t);return(n+180)%360}(t,e);var a=i.getCoord(t),s=i.getCoord(e),l=r.degreesToRadians(a[0]),c=r.degreesToRadians(s[0]),u=r.degreesToRadians(a[1]),p=r.degreesToRadians(s[1]),h=Math.sin(c-l)*Math.cos(p),d=Math.cos(u)*Math.sin(p)-Math.sin(u)*Math.cos(p)*Math.cos(c-l);return r.radiansToDegrees(Math.atan2(h,d))}n.default=o},{"@turf/helpers":11,"@turf/invariant":12}],5:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("@turf/invariant");n.default=function(t,e,n){void 0===n&&(n={});if(!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var o=r.getCoord(t),a=r.getGeom(e),s=a.type,l=e.bbox,c=a.coordinates;if(l&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(o,l))return!1;"Polygon"===s&&(c=[c]);for(var u=!1,p=0;p<c.length&&!u;p++)if(i(o,c[p][0],n.ignoreBoundary)){for(var h=!1,d=1;d<c[p].length&&!h;){i(o,c[p][d],!n.ignoreBoundary)&&(h=!0);d++}h||(u=!0)}return u};function i(t,e,n){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var i=0,o=e.length-1;i<e.length;o=i++){var a=e[i][0],s=e[i][1],l=e[o][0],c=e[o][1];if(t[1]*(a-l)+s*(l-t[0])+c*(t[0]-a)==0&&(a-t[0])*(l-t[0])<=0&&(s-t[1])*(c-t[1])<=0)return!n;s>t[1]!=c>t[1]&&t[0]<(l-a)*(t[1]-s)/(c-s)+a&&(r=!r)}return r}},{"@turf/invariant":12}],6:[function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("@turf/bbox")),o=t("@turf/helpers");n.default=function(t,e){void 0===e&&(e={});var n=i.default(t),r=(n[0]+n[2])/2,a=(n[1]+n[3])/2;return o.point([r,a],e.properties,e)}},{"@turf/bbox":3,"@turf/helpers":11}],7:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});function r(t){var e={type:"Feature"};Object.keys(t).forEach((function(n){switch(n){case"type":case"properties":case"geometry":return;default:e[n]=t[n]}}));e.properties=i(t.properties);e.geometry=o(t.geometry);return e}function i(t){var e={};if(!t)return e;Object.keys(t).forEach((function(n){var r=t[n];"object"==typeof r?null===r?e[n]=null:Array.isArray(r)?e[n]=r.map((function(t){return t})):e[n]=i(r):e[n]=r}));return e}function o(t){var e={type:t.type};t.bbox&&(e.bbox=t.bbox);if("GeometryCollection"===t.type){e.geometries=t.geometries.map((function(t){return o(t)}));return e}e.coordinates=a(t.coordinates);return e}function a(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return a(t)}))}n.default=function(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return r(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};Object.keys(t).forEach((function(n){switch(n){case"type":case"features":return;default:e[n]=t[n]}}));e.features=t.features.map((function(t){return r(t)}));return e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return o(t);default:throw new Error("unknown GeoJSON type")}}},{}],8:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("@turf/helpers"),i=t("@turf/invariant");n.default=function(t,e,n,o){void 0===o&&(o={});var a=i.getCoord(t),s=r.degreesToRadians(a[0]),l=r.degreesToRadians(a[1]),c=r.degreesToRadians(n),u=r.lengthToRadians(e,o.units),p=Math.asin(Math.sin(l)*Math.cos(u)+Math.cos(l)*Math.sin(u)*Math.cos(c)),h=s+Math.atan2(Math.sin(c)*Math.sin(u)*Math.cos(l),Math.cos(u)-Math.sin(l)*Math.sin(p)),d=r.radiansToDegrees(h),f=r.radiansToDegrees(p);return r.point([d,f],o.properties)}},{"@turf/helpers":11,"@turf/invariant":12}],9:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("@turf/invariant"),i=t("@turf/helpers");n.default=function(t,e,n){void 0===n&&(n={});var o=r.getCoord(t),a=r.getCoord(e),s=i.degreesToRadians(a[1]-o[1]),l=i.degreesToRadians(a[0]-o[0]),c=i.degreesToRadians(o[1]),u=i.degreesToRadians(a[1]),p=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(l/2),2)*Math.cos(c)*Math.cos(u);return i.radiansToLength(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),n.units)}},{"@turf/helpers":11,"@turf/invariant":12}],10:[function(t,e,n){"use strict";var r=t("@turf/meta"),i=t("@turf/helpers");function o(t){var e=[];"FeatureCollection"===t.type?r.featureEach(t,(function(t){r.coordEach(t,(function(n){e.push(i.point(n,t.properties))}))})):r.coordEach(t,(function(n){e.push(i.point(n,t.properties))}));return i.featureCollection(e)}e.exports=o;e.exports.default=o},{"@turf/helpers":11,"@turf/meta":16}],11:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.earthRadius=6371008.8;n.factors={centimeters:100*n.earthRadius,centimetres:100*n.earthRadius,degrees:n.earthRadius/111325,feet:3.28084*n.earthRadius,inches:39.37*n.earthRadius,kilometers:n.earthRadius/1e3,kilometres:n.earthRadius/1e3,meters:n.earthRadius,metres:n.earthRadius,miles:n.earthRadius/1609.344,millimeters:1e3*n.earthRadius,millimetres:1e3*n.earthRadius,nauticalmiles:n.earthRadius/1852,radians:1,yards:1.0936*n.earthRadius};n.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/n.earthRadius,yards:1.0936133};n.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function r(t,e,n){void 0===n&&(n={});var r={type:"Feature"};(0===n.id||n.id)&&(r.id=n.id);n.bbox&&(r.bbox=n.bbox);r.properties=e||{};r.geometry=t;return r}n.feature=r;n.geometry=function(t,e,n){void 0===n&&(n={});switch(t){case"Point":return i(e).geometry;case"LineString":return a(e).geometry;case"Polygon":return o(e).geometry;case"MultiPoint":return c(e).geometry;case"MultiLineString":return l(e).geometry;case"MultiPolygon":return u(e).geometry;default:throw new Error(t+" is invalid")}};function i(t,e,n){void 0===n&&(n={});if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!f(t[0])||!f(t[1]))throw new Error("coordinates must contain numbers");return r({type:"Point",coordinates:t},e,n)}n.point=i;n.points=function(t,e,n){void 0===n&&(n={});return s(t.map((function(t){return i(t,e)})),n)};function o(t,e,n){void 0===n&&(n={});for(var i=0,o=t;i<o.length;i++){var a=o[i];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}return r({type:"Polygon",coordinates:t},e,n)}n.polygon=o;n.polygons=function(t,e,n){void 0===n&&(n={});return s(t.map((function(t){return o(t,e)})),n)};function a(t,e,n){void 0===n&&(n={});if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return r({type:"LineString",coordinates:t},e,n)}n.lineString=a;n.lineStrings=function(t,e,n){void 0===n&&(n={});return s(t.map((function(t){return a(t,e)})),n)};function s(t,e){void 0===e&&(e={});var n={type:"FeatureCollection"};e.id&&(n.id=e.id);e.bbox&&(n.bbox=e.bbox);n.features=t;return n}n.featureCollection=s;function l(t,e,n){void 0===n&&(n={});return r({type:"MultiLineString",coordinates:t},e,n)}n.multiLineString=l;function c(t,e,n){void 0===n&&(n={});return r({type:"MultiPoint",coordinates:t},e,n)}n.multiPoint=c;function u(t,e,n){void 0===n&&(n={});return r({type:"MultiPolygon",coordinates:t},e,n)}n.multiPolygon=u;n.geometryCollection=function(t,e,n){void 0===n&&(n={});return r({type:"GeometryCollection",geometries:t},e,n)};n.round=function(t,e){void 0===e&&(e=0);if(e&&!(e>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n};function p(t,e){void 0===e&&(e="kilometers");var r=n.factors[e];if(!r)throw new Error(e+" units is invalid");return t*r}n.radiansToLength=p;function h(t,e){void 0===e&&(e="kilometers");var r=n.factors[e];if(!r)throw new Error(e+" units is invalid");return t/r}n.lengthToRadians=h;n.lengthToDegrees=function(t,e){return d(h(t,e))};n.bearingToAzimuth=function(t){var e=t%360;e<0&&(e+=360);return e};function d(t){return 180*(t%(2*Math.PI))/Math.PI}n.radiansToDegrees=d;n.degreesToRadians=function(t){return t%360*Math.PI/180};n.convertLength=function(t,e,n){void 0===e&&(e="kilometers");void 0===n&&(n="kilometers");if(!(t>=0))throw new Error("length must be a positive number");return p(h(t,e),n)};n.convertArea=function(t,e,r){void 0===e&&(e="meters");void 0===r&&(r="kilometers");if(!(t>=0))throw new Error("area must be a positive number");var i=n.areaFactors[e];if(!i)throw new Error("invalid original units");var o=n.areaFactors[r];if(!o)throw new Error("invalid final units");return t/i*o};function f(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}n.isNumber=f;n.isObject=function(t){return!!t&&t.constructor===Object};n.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!f(t))throw new Error("bbox must only contain numbers")}))};n.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}},{}],12:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("@turf/helpers");n.getCoord=function(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")};n.getCoords=function(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")};n.containsNumber=function t(e){if(e.length>1&&r.isNumber(e[0])&&r.isNumber(e[1]))return!0;if(Array.isArray(e[0])&&e[0].length)return t(e[0]);throw new Error("coordinates must only contain numbers")};n.geojsonType=function(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)};n.featureOf=function(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)};n.collectionOf=function(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+n+", FeatureCollection required");for(var r=0,i=t.features;r<i.length;r++){var o=i[r];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+o.geometry.type)}};n.getGeom=function(t){return"Feature"===t.type?t.geometry:t};n.getType=function(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}},{"@turf/helpers":11}],13:[function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("@turf/distance")),o=t("@turf/meta");n.default=function(t,e){void 0===e&&(e={});return o.segmentReduce(t,(function(t,n){var r=n.geometry.coordinates;return t+i.default(r[0],r[1],e)}),0)}},{"@turf/distance":9,"@turf/meta":16}],14:[function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});var i=t("@turf/helpers"),o=t("@turf/invariant"),a=r(t("@turf/line-segment")),s=t("@turf/meta"),l=r(t("geojson-rbush"));function c(t,e){var n=o.getCoords(t),r=o.getCoords(e);if(2!==n.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==r.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var a=n[0][0],s=n[0][1],l=n[1][0],c=n[1][1],u=r[0][0],p=r[0][1],h=r[1][0],d=r[1][1],f=(d-p)*(l-a)-(h-u)*(c-s),m=(h-u)*(s-p)-(d-p)*(a-u),g=(l-a)*(s-p)-(c-s)*(a-u);if(0===f)return null;var y=m/f,v=g/f;if(y>=0&&y<=1&&v>=0&&v<=1){var _=a+y*(l-a),x=s+y*(c-s);return i.point([_,x])}return null}n.default=function(t,e){var n={},r=[];"LineString"===t.type&&(t=i.feature(t));"LineString"===e.type&&(e=i.feature(e));if("Feature"===t.type&&"Feature"===e.type&&null!==t.geometry&&null!==e.geometry&&"LineString"===t.geometry.type&&"LineString"===e.geometry.type&&2===t.geometry.coordinates.length&&2===e.geometry.coordinates.length){var u=c(t,e);u&&r.push(u);return i.featureCollection(r)}var p=l.default();p.load(a.default(e));s.featureEach(a.default(t),(function(t){s.featureEach(p.search(t),(function(e){var i=c(t,e);if(i){var a=o.getCoords(i).join(",");if(!n[a]){n[a]=!0;r.push(i)}}}))}));return i.featureCollection(r)}},{"@turf/helpers":11,"@turf/invariant":12,"@turf/line-segment":15,"@turf/meta":16,"geojson-rbush":20}],15:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("@turf/helpers"),i=t("@turf/invariant"),o=t("@turf/meta");n.default=function(t){if(!t)throw new Error("geojson is required");var e=[];o.flattenEach(t,(function(t){!function(t,e){var n=[],o=t.geometry;if(null!==o){switch(o.type){case"Polygon":n=i.getCoords(o);break;case"LineString":n=[i.getCoords(o)]}n.forEach((function(n){var i=function(t,e){var n=[];t.reduce((function(t,i){var o,a,s,l,c,u,p=r.lineString([t,i],e);p.bbox=(a=i,s=(o=t)[0],l=o[1],c=a[0],u=a[1],[s<c?s:c,l<u?l:u,s>c?s:c,l>u?l:u]);n.push(p);return i}));return n}(n,t.properties);i.forEach((function(t){t.id=e.length;e.push(t)}))}))}}(t,e)}));return r.featureCollection(e)}},{"@turf/helpers":11,"@turf/invariant":12,"@turf/meta":16}],16:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t("@turf/helpers");function i(t,e,n){if(null!==t)for(var r,o,a,s,l,c,u,p,h=0,d=0,f=t.type,m="FeatureCollection"===f,g="Feature"===f,y=m?t.features.length:1,v=0;v<y;v++){l=(p=!!(u=m?t.features[v].geometry:g?t.geometry:t)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var _=0;_<l;_++){var x=0,b=0;if(null!==(s=p?u.geometries[_]:u)){c=s.coordinates;var w=s.type;h=!n||"Polygon"!==w&&"MultiPolygon"!==w?0:1;switch(w){case null:break;case"Point":if(!1===e(c,d,v,x,b))return!1;d++;x++;break;case"LineString":case"MultiPoint":for(r=0;r<c.length;r++){if(!1===e(c[r],d,v,x,b))return!1;d++;"MultiPoint"===w&&x++}"LineString"===w&&x++;break;case"Polygon":case"MultiLineString":for(r=0;r<c.length;r++){for(o=0;o<c[r].length-h;o++){if(!1===e(c[r][o],d,v,x,b))return!1;d++}"MultiLineString"===w&&x++;"Polygon"===w&&b++}"Polygon"===w&&x++;break;case"MultiPolygon":for(r=0;r<c.length;r++){b=0;for(o=0;o<c[r].length;o++){for(a=0;a<c[r][o].length-h;a++){if(!1===e(c[r][o][a],d,v,x,b))return!1;d++}b++}x++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===i(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function o(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function a(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function s(t,e){var n,r,i,o,a,s,l,c,u,p,h=0,d="FeatureCollection"===t.type,f="Feature"===t.type,m=d?t.features.length:1;for(n=0;n<m;n++){s=d?t.features[n].geometry:f?t.geometry:t;c=d?t.features[n].properties:f?t.properties:{};u=d?t.features[n].bbox:f?t.bbox:void 0;p=d?t.features[n].id:f?t.id:void 0;a=(l=!!s&&"GeometryCollection"===s.type)?s.geometries.length:1;for(i=0;i<a;i++)if(null!==(o=l?s.geometries[i]:s))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,h,c,u,p))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===e(o.geometries[r],h,c,u,p))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,h,c,u,p))return!1;h++}}function l(t,e){s(t,(function(t,n,i,o,a){var s,l=null===t?null:t.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return!1!==e(r.feature(t,i,{bbox:o,id:a}),n,0)&&void 0}switch(l){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var c=0;c<t.coordinates.length;c++){var u={type:s,coordinates:t.coordinates[c]};if(!1===e(r.feature(u,i),n,c))return!1}}))}function c(t,e){l(t,(function(t,n,o){var a=0;if(t.geometry){var s=t.geometry.type;if("Point"!==s&&"MultiPoint"!==s){var l,c=0,u=0,p=0;return!1!==i(t,(function(i,s,h,d,f){if(void 0===l||n>c||d>u||f>p){l=i;c=n;u=d;p=f;a=0}else{var m=r.lineString([l,i],t.properties);if(!1===e(m,n,o,f,a))return!1;a++;l=i}}))&&void 0}}}))}function u(t,e){if(!t)throw new Error("geojson is required");l(t,(function(t,n,i){if(null!==t.geometry){var o=t.geometry.type,a=t.geometry.coordinates;switch(o){case"LineString":if(!1===e(t,n,i,0,0))return!1;break;case"Polygon":for(var s=0;s<a.length;s++)if(!1===e(r.lineString(a[s],t.properties),n,i,s))return!1}}}))}n.coordAll=function(t){var e=[];i(t,(function(t){e.push(t)}));return e};n.coordEach=i;n.coordReduce=function(t,e,n,r){var o=n;i(t,(function(t,r,i,a,s){o=0===r&&void 0===n?t:e(o,t,r,i,a,s)}),r);return o};n.featureEach=a;n.featureReduce=function(t,e,n){var r=n;a(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)}));return r};n.findPoint=function(t,e){e=e||{};if(!r.isObject(e))throw new Error("options is invalid");var n,i=e.featureIndex||0,o=e.multiFeatureIndex||0,a=e.geometryIndex||0,s=e.coordIndex||0,l=e.properties;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i);l=l||t.features[i].properties;n=t.features[i].geometry;break;case"Feature":l=l||t.properties;n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var c=n.coordinates;switch(n.type){case"Point":return r.point(c,l,e);case"MultiPoint":o<0&&(o=c.length+o);return r.point(c[o],l,e);case"LineString":s<0&&(s=c.length+s);return r.point(c[s],l,e);case"Polygon":a<0&&(a=c.length+a);s<0&&(s=c[a].length+s);return r.point(c[a][s],l,e);case"MultiLineString":o<0&&(o=c.length+o);s<0&&(s=c[o].length+s);return r.point(c[o][s],l,e);case"MultiPolygon":o<0&&(o=c.length+o);a<0&&(a=c[o].length+a);s<0&&(s=c[o][a].length-s);return r.point(c[o][a][s],l,e)}throw new Error("geojson is invalid")};n.findSegment=function(t,e){e=e||{};if(!r.isObject(e))throw new Error("options is invalid");var n,i=e.featureIndex||0,o=e.multiFeatureIndex||0,a=e.geometryIndex||0,s=e.segmentIndex||0,l=e.properties;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i);l=l||t.features[i].properties;n=t.features[i].geometry;break;case"Feature":l=l||t.properties;n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var c=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":s<0&&(s=c.length+s-1);return r.lineString([c[s],c[s+1]],l,e);case"Polygon":a<0&&(a=c.length+a);s<0&&(s=c[a].length+s-1);return r.lineString([c[a][s],c[a][s+1]],l,e);case"MultiLineString":o<0&&(o=c.length+o);s<0&&(s=c[o].length+s-1);return r.lineString([c[o][s],c[o][s+1]],l,e);case"MultiPolygon":o<0&&(o=c.length+o);a<0&&(a=c[o].length+a);s<0&&(s=c[o][a].length-s-1);return r.lineString([c[o][a][s],c[o][a][s+1]],l,e)}throw new Error("geojson is invalid")};n.flattenEach=l;n.flattenReduce=function(t,e,n){var r=n;l(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)}));return r};n.geomEach=s;n.geomReduce=function(t,e,n){var r=n;s(t,(function(t,i,o,a,s){r=0===i&&void 0===n?t:e(r,t,i,o,a,s)}));return r};n.lineEach=u;n.lineReduce=function(t,e,n){var r=n;u(t,(function(t,i,o,a){r=0===i&&void 0===n?t:e(r,t,i,o,a)}));return r};n.propEach=o;n.propReduce=function(t,e,n){var r=n;o(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)}));return r};n.segmentEach=c;n.segmentReduce=function(t,e,n){var r=n,i=!1;c(t,(function(t,o,a,s,l){r=!1===i&&void 0===n?t:e(r,t,o,a,s,l);i=!0}));return r}},{"@turf/helpers":11}],17:[function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("@turf/bearing")),o=r(t("@turf/distance")),a=r(t("@turf/destination")),s=r(t("@turf/line-intersect")),l=t("@turf/meta"),c=t("@turf/helpers"),u=t("@turf/invariant");n.default=function(t,e,n){void 0===n&&(n={});var r=c.point([1/0,1/0],{dist:1/0}),p=0;l.flattenEach(t,(function(t){for(var l=u.getCoords(t),h=0;h<l.length-1;h++){var d=c.point(l[h]);d.properties.dist=o.default(e,d,n);var f=c.point(l[h+1]);f.properties.dist=o.default(e,f,n);var m=o.default(d,f,n),g=Math.max(d.properties.dist,f.properties.dist),y=i.default(d,f),v=a.default(e,g,y+90,n),_=a.default(e,g,y-90,n),x=s.default(c.lineString([v.geometry.coordinates,_.geometry.coordinates]),c.lineString([d.geometry.coordinates,f.geometry.coordinates])),b=null;if(x.features.length>0){(b=x.features[0]).properties.dist=o.default(e,b,n);b.properties.location=p+o.default(d,b,n)}if(d.properties.dist<r.properties.dist){(r=d).properties.index=h;r.properties.location=p}if(f.properties.dist<r.properties.dist){(r=f).properties.index=h+1;r.properties.location=p+m}b&&b.properties.dist<r.properties.dist&&((r=b).properties.index=h);p+=m}}));return r}},{"@turf/bearing":4,"@turf/destination":8,"@turf/distance":9,"@turf/helpers":11,"@turf/invariant":12,"@turf/line-intersect":14,"@turf/meta":16}],18:[function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});var i=r(t("@turf/clone")),o=r(t("@turf/distance")),a=t("@turf/meta");n.default=function(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var n,r=1/0,s=0;a.featureEach(e,(function(e,n){var i=o.default(t,e);if(i<r){s=n;r=i}}));(n=i.default(e.features[s])).properties.featureIndex=s;n.properties.distanceToPoint=r;return n}},{"@turf/clone":7,"@turf/distance":9,"@turf/meta":16}],19:[function(t,e,n){"use strict";var r=t("@turf/explode"),i=t("@turf/center"),o=t("@turf/nearest-point"),a=t("@turf/boolean-point-in-polygon"),s=t("@turf/helpers");function l(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c=l(r),u=l(i),p=l(o),h=l(a);function d(t){for(var e=function(t){if("FeatureCollection"!==t.type)return"Feature"!==t.type?s.featureCollection([s.feature(t)]):s.featureCollection([t]);return t}(t),n=u.default(e),r=!1,i=0;!r&&i<e.features.length;){var o,a=e.features[i].geometry,l=!1;if("Point"===a.type)n.geometry.coordinates[0]===a.coordinates[0]&&n.geometry.coordinates[1]===a.coordinates[1]&&(r=!0);else if("MultiPoint"===a.type){var d=!1;o=0;for(;!d&&o<a.coordinates.length;){if(n.geometry.coordinates[0]===a.coordinates[o][0]&&n.geometry.coordinates[1]===a.coordinates[o][1]){r=!0;d=!0}o++}}else if("LineString"===a.type){o=0;for(;!l&&o<a.coordinates.length-1;){if(f(n.geometry.coordinates[0],n.geometry.coordinates[1],a.coordinates[o][0],a.coordinates[o][1],a.coordinates[o+1][0],a.coordinates[o+1][1])){l=!0;r=!0}o++}}else if("MultiLineString"===a.type)for(var m=0;m<a.coordinates.length;){l=!1;o=0;for(var g=a.coordinates[m];!l&&o<g.length-1;){if(f(n.geometry.coordinates[0],n.geometry.coordinates[1],g[o][0],g[o][1],g[o+1][0],g[o+1][1])){l=!0;r=!0}o++}m++}else"Polygon"!==a.type&&"MultiPolygon"!==a.type||h.default(n,a)&&(r=!0);i++}if(r)return n;var y=s.featureCollection([]);for(i=0;i<e.features.length;i++)y.features=y.features.concat(c.default(e.features[i]).features);return s.point(p.default(n,y).geometry.coordinates)}function f(t,e,n,r,i,o){return Math.sqrt((i-n)*(i-n)+(o-r)*(o-r))===Math.sqrt((t-n)*(t-n)+(e-r)*(e-r))+Math.sqrt((i-t)*(i-t)+(o-e)*(o-e))}e.exports=d;e.exports.default=d},{"@turf/boolean-point-in-polygon":5,"@turf/center":6,"@turf/explode":10,"@turf/helpers":11,"@turf/nearest-point":18}],20:[function(t,e,n){var r=t("rbush"),i=t("@turf/helpers"),o=t("@turf/meta"),a=t("@turf/bbox").default,s=o.featureEach,l=(o.coordEach,i.polygon,i.featureCollection);function c(t){var e=new r(t);e.insert=function(t){if("Feature"!==t.type)throw new Error("invalid feature");t.bbox=t.bbox?t.bbox:a(t);return r.prototype.insert.call(this,t)};e.load=function(t){var e=[];Array.isArray(t)?t.forEach((function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:a(t);e.push(t)})):s(t,(function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:a(t);e.push(t)}));return r.prototype.load.call(this,e)};e.remove=function(t,e){if("Feature"!==t.type)throw new Error("invalid feature");t.bbox=t.bbox?t.bbox:a(t);return r.prototype.remove.call(this,t,e)};e.clear=function(){return r.prototype.clear.call(this)};e.search=function(t){var e=r.prototype.search.call(this,this.toBBox(t));return l(e)};e.collides=function(t){return r.prototype.collides.call(this,this.toBBox(t))};e.all=function(){var t=r.prototype.all.call(this);return l(t)};e.toJSON=function(){return r.prototype.toJSON.call(this)};e.fromJSON=function(t){return r.prototype.fromJSON.call(this,t)};e.toBBox=function(t){var e;if(t.bbox)e=t.bbox;else if(Array.isArray(t)&&4===t.length)e=t;else if(Array.isArray(t)&&6===t.length)e=[t[0],t[1],t[3],t[4]];else if("Feature"===t.type)e=a(t);else{if("FeatureCollection"!==t.type)throw new Error("invalid geojson");e=a(t)}return{minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}};return e}e.exports=c;e.exports.default=c},{"@turf/bbox":3,"@turf/helpers":11,"@turf/meta":16,rbush:21}],21:[function(t,e,n){r=this,i=function(){"use strict";function t(t,r,i,o,a){!function t(n,r,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,l=r-i+1,c=Math.log(s),u=.5*Math.exp(2*c/3),p=.5*Math.sqrt(c*u*(s-u)/s)*(l-s/2<0?-1:1);t(n,r,Math.max(i,Math.floor(r-l*u/s+p)),Math.min(o,Math.floor(r+(s-l)*u/s+p)),a)}var h=n[r],d=i,f=o;for(e(n,i,r),a(n[o],h)>0&&e(n,i,o);d<f;){for(e(n,d,f),d++,f--;a(n[d],h)<0;)d++;for(;a(n[f],h)>0;)f--}0===a(n[i],h)?e(n,i,f):e(n,++f,o),f<=r&&(i=f+1),r<=f&&(o=f-1)}}(t,r,i||0,o||t.length-1,a||n)}function e(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function n(t,e){return t<e?-1:t>e?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function o(t,e){a(t,0,t.children.length,e,t)}function a(t,e,n,r,i){i||(i=f(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=e;o<n;o++){var a=t.children[o];s(i,t.leaf?r(a):a)}return i}function s(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function l(t,e){return t.minX-e.minX}function c(t,e){return t.minY-e.minY}function u(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function p(t){return t.maxX-t.minX+(t.maxY-t.minY)}function h(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function d(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function f(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function m(e,n,r,i,o){for(var a=[n,r];a.length;)if(!((r=a.pop())-(n=a.pop())<=i)){var s=n+Math.ceil((r-n)/i/2)*i;t(e,s,n,r,o),a.push(n,s,s,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var e=this.data,n=[];if(!d(t,e))return n;for(var r=this.toBBox,i=[];e;){for(var o=0;o<e.children.length;o++){var a=e.children[o],s=e.leaf?r(a):a;d(t,s)&&(e.leaf?n.push(a):h(t,s)?this._all(a,n):i.push(a))}e=i.pop()}return n},r.prototype.collides=function(t){var e=this.data;if(!d(t,e))return!1;for(var n=[];e;){for(var r=0;r<e.children.length;r++){var i=e.children[r],o=e.leaf?this.toBBox(i):i;if(d(t,o)){if(e.leaf||h(t,o))return!0;n.push(i)}}e=n.pop()}return!1},r.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},r.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},r.prototype.clear=function(){return this.data=f([]),this},r.prototype.remove=function(t,e){if(!t)return this;for(var n,r,o,a=this.data,s=this.toBBox(t),l=[],c=[];a||l.length;){if(a||(a=l.pop(),r=l[l.length-1],n=c.pop(),o=!0),a.leaf){var u=i(t,a.children,e);if(-1!==u)return a.children.splice(u,1),l.push(a),this._condense(l),this}o||a.leaf||!h(a,s)?r?(n++,a=r.children[n],o=!1):a=null:(l.push(a),c.push(n),n=0,r=a,a=a.children[0])}return this},r.prototype.toBBox=function(t){return t},r.prototype.compareMinX=function(t,e){return t.minX-e.minX},r.prototype.compareMinY=function(t,e){return t.minY-e.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(t){return this.data=t,this},r.prototype._all=function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},r.prototype._build=function(t,e,n,r){var i,a=n-e+1,s=this._maxEntries;if(a<=s)return o(i=f(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(a)/Math.log(s)),s=Math.ceil(a/Math.pow(s,r-1))),(i=f([])).leaf=!1,i.height=r;var l=Math.ceil(a/s),c=l*Math.ceil(Math.sqrt(s));m(t,e,n,c,this.compareMinX);for(var u=e;u<=n;u+=c){var p=Math.min(u+c-1,n);m(t,u,p,l,this.compareMinY);for(var h=u;h<=p;h+=l){var d=Math.min(h+l-1,p);i.children.push(this._build(t,h,d,r-1))}}return o(i,this.toBBox),i},r.prototype._chooseSubtree=function(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){for(var i=1/0,o=1/0,a=void 0,s=0;s<e.children.length;s++){var l=e.children[s],c=u(l),p=(h=t,d=l,(Math.max(d.maxX,h.maxX)-Math.min(d.minX,h.minX))*(Math.max(d.maxY,h.maxY)-Math.min(d.minY,h.minY))-c);p<o?(o=p,i=c<i?c:i,a=l):p===o&&c<i&&(i=c,a=l)}e=a||e.children[0]}var h,d;return e},r.prototype._insert=function(t,e,n){var r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),s(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)},r.prototype._split=function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var a=this._chooseSplitIndex(n,i,r),s=f(n.children.splice(a,n.children.length-a));s.height=n.height,s.leaf=n.leaf,o(n,this.toBBox),o(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},r.prototype._splitRoot=function(t,e){this.data=f([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,e,n){for(var r,i,o,s,l,c,p,h=1/0,d=1/0,f=e;f<=n-e;f++){var m=a(t,0,f,this.toBBox),g=a(t,f,n,this.toBBox),y=(i=m,o=g,s=Math.max(i.minX,o.minX),l=Math.max(i.minY,o.minY),c=Math.min(i.maxX,o.maxX),p=Math.min(i.maxY,o.maxY),Math.max(0,c-s)*Math.max(0,p-l)),v=u(m)+u(g);y<h?(h=y,r=f,d=v<d?v:d):y===h&&v<d&&(d=v,r=f)}return r||n-e},r.prototype._chooseSplitAxis=function(t,e,n){var r=t.leaf?this.compareMinX:l,i=t.leaf?this.compareMinY:c;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},r.prototype._allDistMargin=function(t,e,n,r){t.children.sort(r);for(var i=this.toBBox,o=a(t,0,e,i),l=a(t,n-e,n,i),c=p(o)+p(l),u=e;u<n-e;u++){var h=t.children[u];s(o,t.leaf?i(h):h),c+=p(o)}for(var d=n-e-1;d>=e;d--){var f=t.children[d];s(l,t.leaf?i(f):f),c+=p(l)}return c},r.prototype._adjustParentBBoxes=function(t,e,n){for(var r=n;r>=0;r--)s(e[r],t)},r.prototype._condense=function(t){for(var e=t.length-1,n=void 0;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children).splice(n.indexOf(t[e]),1):this.clear():o(t[e],this.toBBox)},r},"object"==typeof n&&void 0!==e?e.exports=i():(r=r||self).RBush=i();var r,i},{}]},{},[1])(1)}));class CustomHTMLControl{constructor(t){this.custom_html=t.custom_html}onAdd(t){this.map=t;this._container=document.createElement("div");this._container.innerHTML=this.custom_html;return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class DownloadControl{constructor(t,e,n,r){this.interact_with_filters=t.interact_with_filters;this.notify_on_download=t.notify_on_download;this.included_fields=t.included_fields;this.features=e.concat(n.concat(r))}addListeners(){jQuery(document).on("click",".mapster-data-download",(()=>{this.downloadFeatures()}))}downloadFeatures(){let t=this.processFeatures();t.length>0?this.downloadCSV(t):alert("No features selected for download.")}processFeatures(t){let e=[];this.features.forEach((t=>{if(this.interact_with_filters&&window.mapster_categories_hidden_features&&window.mapster_categories_hidden_features.indexOf(t.id)>-1)return;let n=t.data.location?t.data.location:t.data.line?t.data.line:t.data.polygon?t.data.polygon:null,r={};r.title=t.title;r.permalink=t.permalink;r.categories=t.categories.map((t=>t.name)).join(",");this.getRecursivePropertyValue(r,t.data.additional_details,"");r.geography=JSON.stringify(n);if(this.included_fields&&""!==this.included_fields){let t={};this.included_fields.split(",").forEach((e=>{let n=e.trim();r[n]&&(t[n]=r[n])}));r=t}e.push(r)}));return e}getRecursivePropertyValue(t,e,n){for(let r in e)Array.isArray(e[r])?t[n+r]=e[r].join(","):"object"==typeof e[r]?this.getRecursivePropertyValue(t,e[r],n+r+"_"):t[n+r]=JSON.stringify(e[r])}downloadCSV(t){const e=(t,e)=>null===e?"":e;let n=[];t.forEach((t=>{for(let e in t)-1===n.indexOf(e)&&n.push(e)}));t.forEach((t=>{n.forEach((e=>{t[e]||(t[e]="")}))}));let r=t.map((t=>n.map((n=>JSON.stringify(t[n],e).replace(/\\"/g,'""'))).join(",")));r.unshift(n.join(","));r=r.join("\r\n");var i=document.createElement("a"),o=new Blob(["\ufeff",r]),a=URL.createObjectURL(o);i.href=a;i.download="map-data-download.csv";document.body.appendChild(i);i.click();document.body.removeChild(i);if(this.notify_on_download){let t=[];jQuery(".mapster-category-control input").each((function(){jQuery(this).is(":checked")&&t.push(jQuery(this).closest("li").text().trim())}));fetch(`${window.mapster_params.rest_url}mapster-wp-maps/send-email`,{method:"POST",body:JSON.stringify({users:this.notify_on_download,active_filters:t})})}}onAdd(t){this.map=t;this.storedBounds=this.map.getBounds();this._container=document.createElement("div");if(window.mapster_params.public){this._container.className="mapboxgl-ctrl mapster-download-control";this._container.innerHTML='\n <div class="mapster-download-control-content">\n <button class="mapster-data-download">Download Data</button>\n </div>\n ';this.addListeners()}return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class ListControl{constructor(t,e,n,r,i,o){this.sort_by_distance=t.sort_by_distance;this.show_distance=t.show_distance;this.units=t.units;this.markers=i;this.mapLibrary=o;this.listing_type=t.listing_type;this.number_of_locations=t.number_of_locations;this.store_locator=t.store_locator_options.enable;this.sort_hours_by_day=t.store_locator_options.sort_hours_by_day;this.features=e.concat(n.concat(r));this.currentPage=1;this.storedBounds=null}storeLocatorHTML(t){return"<div>Upgrade to Mapster Pro to enable this functionality.</div>"}setHTML(t){const e=new MapsterHelpers;var n="<ul>",r=[];this.features.forEach(((t,n)=>{if(!(window.mapster_categories_hidden_features&&window.mapster_categories_hidden_features.indexOf(t.id)>-1)){var i=e.makeFeatureJSON(t.data);if(this.show_distance||this.sort_by_distance){var o=turf.distance(turf.center(i).geometry.coordinates,this.getCenter());t.distance=o*("imperial"===this.units?.621371:1)}r.push(t)}}));this.sort_by_distance&&(r=r.sort(((t,e)=>t.distance>e.distance?1:-1)));var i=[];r.forEach(((t,e)=>{"paginate"===this.listing_type?this.number_of_locations*(this.currentPage-1)<=e&&this.number_of_locations*this.currentPage>e&&i.push(t):i=r}));this.store_locator?n=this.storeLocatorHTML(n,i):i.forEach((t=>{n+=`\n <li data-id="${t.id}">\n ${t.title}\n <em>${t.distance?t.distance.toFixed(2)+("imperial"===this.units?" miles":" km"):""}</em>\n </li>\n `}));n+="</ul>";if("paginate"===this.listing_type){n+='<div class="mapster-paging">';this.currentPage>1&&(n+='<span class="mapster-back dashicons dashicons-arrow-left"></span>');this.number_of_locations*this.currentPage<this.number_of_locations.length&&(n+='<span class="mapster-next dashicons dashicons-arrow-right"></span>');n+="</div>"}if(t)return n;jQuery(".mapster-list-control-content").html(n)}getStoreHTML(t){return""}getCenter(){return[this.map.getCenter().lng,this.map.getCenter().lat]}addListeners(){var t=this;const e=new MapsterHelpers;jQuery(document).on("click",".mapster-list-control li",(function(n){if(!n.isTrigger){var r=t.features.find((t=>parseInt(t.id)==jQuery(this).data("id"))),i=e.makeFeatureJSON(r.data).features[0];if("Point"===i.geometry.type){const e=t.markers.find((t=>t.mapsterProperties.id===r.id));e&&r.data.enable_popup&&t.openPopup(e,r);!e&&r.data.enable_popup&&t.openPopupNonMarker(r);t.centerMap(i.geometry.coordinates,15)}else{var o=turf.bbox(i);t.fitBounds(o,{padding:20})}if(t.store_locator){jQuery(".mapster-list-control-content").hide();jQuery(".mapster-list-control-single-content").show();jQuery(".mapster-list-control-single-content").html(t.getStoreHTML(r))}}}));jQuery(document).on("click",".mapster-next",(()=>{this.currentPage=this.currentPage+1;this.setHTML()}));jQuery(document).on("click",".mapster-back",(()=>{this.currentPage=this.currentPage-1;this.setHTML()}));jQuery(document).on("click",".mapster-store-locator-results",(()=>{jQuery(".mapster-list-control-content").show();jQuery(".mapster-list-control-single-content").hide();jQuery(".mapster-list-control-single-content").empty();this.fitBounds(this.storedBounds)}));jQuery(document).on("change",".mapster-cat-toggle",(()=>{this.setHTML()}))}openPopup(t,e){const n=new MapsterHelpers;t.setPopup(new this.mapLibrary.Popup(n.returnPopupOptions(e.data)).setHTML(n.getPopupHTML(e.id,e.data))).togglePopup()}openPopupNonMarker(t){let e=this;const n=setInterval((()=>{if(e.map.getBounds().contains(t.data.location.coordinates)){e.map.fire("click",{lngLat:t.data.location.coordinates,originalEvent:{}});clearInterval(n)}}),100)}centerMap(t,e){this.map.flyTo({center:t,zoom:e})}fitBounds(t,e){this.map.fitBounds(t,e)}onAdd(t){this.map=t;this.storedBounds=this.map.getBounds();this._container=document.createElement("div");this._container.className="mapboxgl-ctrl mapster-list-control"+(this.store_locator?" mapster-store-locator":"")+(window.innerWidth<768?" mapster-mobile":"");this._container.innerHTML=`<div class="mapster-list-control-content" style="max-height : ${jQuery(this.map._container).height()-100}px">`+this.setHTML(!0)+`</div><div class="mapster-list-control-single-content" style="max-height : ${jQuery(this.map._container).height()}px;"></div>`;if(window.innerWidth<768&&this.store_locator){jQuery(this.map._container).css("overflow","visible");this._container.style.marginTop=`${jQuery(this.map._container).height()}px`;jQuery(this.map._container).after(`<div style="height: ${jQuery(this.map._container).height()}px"></div>`);jQuery(".maplibregl-control-container > div, .mapboxgl-control-container > div").width("100%");jQuery(".mapboxgl-ctrl-geocoder").width("100%")}this.addListeners();this.map.on("moveend",(()=>{this.setHTML()}));setTimeout((()=>{this.store_locator&&!jQuery(".mapster-store-locator .mapboxgl-ctrl-geocoder").length&&jQuery(".mapboxgl-ctrl-geocoder").prependTo(".mapster-store-locator")}),100);return this._container}onAddGoogleMap(t){this.map=t;this._container=document.createElement("div");this._container.className="mapboxgl-ctrl mapster-list-control mapster-list-control-google"+(this.store_locator?" mapster-store-locator":"")+(window.innerWidth<768?" mapster-mobile":"");this._container.innerHTML=`<div class="mapster-list-control-content" style="max-height : ${jQuery(this.map.__gm.div).height()-100}px">`+this.setHTML(!0)+`</div><div class="mapster-list-control-single-content" style="max-height : ${jQuery(this.map.__gm.div).height()}px;"></div>`;this.addListeners();this.map.addListener("dragend",(()=>{this.setHTML()}));google.maps.event.addListenerOnce(this.map,"idle",(()=>{this.store_locator&&setTimeout((()=>{jQuery(".mapster-google-geocoder-input").addClass("geocoder-google-store-locator");jQuery(".mapster-google-geocoder-input").prependTo(".mapster-store-locator")}),1e3);const t=this.map.getBounds();this.storedBounds=[t.getSouthWest().lng(),t.getSouthWest().lat(),t.getNorthEast().lng(),t.getNorthEast().lat()]}));return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}
;class PitchToggle{constructor(t=-20,e=70,n=null){this._bearing=-20;this._pitch=70;this._minpitchzoom=n}onAdd(t){this._map=t;let e=this;this._btn=document.createElement("button");this._btn.className="mapboxgl-ctrl-icon mapboxgl-ctrl-pitchtoggle-3d";this._btn.type="button";this._btn["aria-label"]="Toggle Pitch";this._btn.onclick=function(){if(0===t.getPitch()){let n={pitch:e._pitch,bearing:e._bearing};e._minpitchzoom&&t.getZoom()>e._minpitchzoom&&(n.zoom=e._minpitchzoom);t.easeTo(n);e._btn.className="mapboxgl-ctrl-icon mapboxgl-ctrl-pitchtoggle-2d"}else{t.easeTo({pitch:0,bearing:0});e._btn.className="mapboxgl-ctrl-icon mapboxgl-ctrl-pitchtoggle-3d"}};this._container=document.createElement("div");this._container.className="mapboxgl-ctrl-group mapboxgl-ctrl";this._container.appendChild(this._btn);return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class CategoryControl{constructor(t,e,n,r,i,o,a,s,l,c,u){this.displayMode=t.category_display;this.checkboxMode=t.checkbox_display;this.initialVisibility=t.initial_visibility;this.preSelectedCategories=t.pre_selected_categories;this.independentChildren=t.independent_children;this.excludedCategories=t.excluded_categories;this.functionality=t.functionality;this.additional_filters=t.additional_filters;this.accordion_layout=t.accordion_layout;this.show_number_of_features=t.show_number_of_features;this.did_one_accordion=!1;this.markers=n;this.map_provider=s;this.circle_clustering=l;this.label_icon_clustering=c;this.marker_clustering=u;this.cluster_options=e;this.features=i.concat(o.concat(a));this.dataLayers=r;this.locations=i;this.lines=o;this.polygons=a}setMarkers(t){this.markers=t}organizeCategories(){var t=[];this.features.forEach((e=>{e.categories.forEach((e=>{-1===t.findIndex((t=>t.id===e.id))&&t.push(e)}))}));return t=this.filterCategories(t)}returnHTML(){return`\n <div>\n ${this.returnCategoryHTML(this.organizeCategories())}\n </div>\n `}returnCategoryHTML(t){var e="<ul>";t.filter((t=>0===t.parent)).forEach(((n,r)=>{var i=t.filter((t=>t.parent===n.id));e+=this.returnInputHTML(n,i);e+=this.returnChildrenHTML(n,t)}));return e+="</ul>"}returnChildrenHTML(t,e){var n="<ul>",r=e.filter((e=>e.parent===t.id));r.forEach((t=>{n+=this.returnInputHTML(t,[]);n+=this.returnChildrenHTML(t,e)}));n+="</ul>";0===r.length&&(n="");return n}returnInputHTML(t,e){var n=!0;!this.initialVisibility&&this.preSelectedCategories&&-1===this.preSelectedCategories.indexOf(t.id)&&(n=!1);return this.returnAccordionHTML(`\n <li>\n ${"checkbox"===this.checkboxMode?`\n <input class="mapster-cat-toggle" id="${t.id}" data-term="${t.id}" data-parent="${t.parent}" ${n?'checked="checked"':""} type="checkbox" />\n `:`\n <label class="mapster-switch">\n <input class="mapster-cat-toggle" id="${t.id}" data-term="${t.id}" data-parent="${t.parent}" ${n?'checked="checked"':""} type="checkbox" />\n <span class="mapster-slider mapster-round"></span>\n </label>\n `}\n ${"colors"===this.displayMode?`<div class="mapster-color-swatch" style="background-color: ${t.color};"></div>`:""}\n ${"icons"===this.displayMode?`<div class="mapster-icon-swatch" style="background-image: url(${t.icon});background-size: cover;"></div>`:""}\n <label for="${t.id}">${t.name} ${this.returnNumberOfFeatures(t)?`<span class="mapster-number-of-features">(${this.returnNumberOfFeatures(t)})</span>`:""}</label>\n </li>\n `,t,e)}setToggles(t){var e=jQuery(t).data("term"),n=jQuery(t).data("parent"),r=jQuery(t).is(":checked");if(!this.independentChildren)if(0===n)r?jQuery(`.mapster-cat-toggle[data-parent="${e}"]`).prop("checked",!0):jQuery(`.mapster-cat-toggle[data-parent="${e}"]`).prop("checked",!1);else if(r)jQuery(`.mapster-cat-toggle[data-term="${n}"]`).prop("checked",!0);else{var i=!0;jQuery(`.mapster-cat-toggle[data-parent="${n}"]`).each((function(){jQuery(this).is(":checked")&&(i=!1)}));i&&jQuery(`.mapster-cat-toggle[data-term="${n}"]`).prop("checked",!1)}}returnIDsToHideFeatures(t){let e=[];this.features.forEach((n=>{if(n.categories.length>0)if("exclusive"===this.functionality)n.categories.find((e=>t.indexOf(e.id)>-1))&&e.push(n.id);else if("inclusive"===this.functionality){var r=!0;n.categories.forEach((e=>{-1===t.indexOf(e.id)&&(r=!1)}));r&&e.push(n.id)}}));return e}returnNumberOfFeatures(){return!1}adjustMarkers(t){let e=[];this.markers.forEach((n=>{const r=this.returnMarkerProperties(n);if(r.categories.length>0)if("exclusive"===this.functionality)if(r.categories.find((e=>t.indexOf(e.id)>-1))){this.changeMarker("hide",n);e.push(n.mapsterProperties.id)}else this.changeMarker("show",n);else if("inclusive"===this.functionality){var i=!0;if(r.categories.length>0){r.categories.forEach((e=>{-1===t.indexOf(e.id)&&(i=!1)}));if(i){this.changeMarker("hide",n);e.push(n.mapsterProperties.id)}else this.changeMarker("show",n)}}}));this.adjustMarkerClusters(e)}adjustMarkerClusters(t){if(this.marker_clustering){let e=["marker"];(new MapsterHelpers).makeClusters(this.map,this.map_provider,this.cluster_options,e,this.locations,[],[],t)}}returnAccordionHTML(t,e,n){return t}filterCategories(t){return t}changeMarker(t,e){"hide"===t?e.remove():"show"===t&&e.addTo(this.map)}changeLayerVisibility(){var t=[];jQuery(".mapster-cat-toggle").each((function(){jQuery(this).is(":checked")||t.push(jQuery(this).data("term"))}));var e=this.returnIDsToHideFeatures(t);this.setHiddenFeatures(e);this.adjustMarkers(t)}setHiddenFeatures(t){if(this.map.getLayer("symbol")){this.map.getLayer("symbol-clusters")&&(new MapsterHelpers).setClustering(this.map,this.map_provider,this.cluster_options,this.circle_clustering,this.label_icon_clustering,this.marker_clustering,this.markers,this.locations,this.lines,this.polygons,t);this.map.setLayoutProperty("symbol","text-size",["case",["in",["get","post_id"],["literal",t]],0,["==",!1,["get","label_label_on"]],0,["has","label_text_properties_text-size"],["to-number",["get","label_text_properties_text-size"]],16]);this.map.setLayoutProperty("symbol","icon-size",["case",["in",["get","post_id"],["literal",t]],0,["==",!1,["get","icon_icon_on"]],0,["has","icon_icon_properties_icon-size"],["/",["to-number",["get","icon_icon_properties_icon-size"]],100],1])}if(this.map.getLayer("circle")){this.map.setPaintProperty("circle","circle-radius",["case",["in",["get","post_id"],["literal",t]],0,["has","circle_radius"],["to-number",["get","circle_radius"]],0]);this.map.setPaintProperty("circle","circle-stroke-width",["case",["in",["get","post_id"],["literal",t]],0,["has","circle_radius"],["to-number",["get","circle_radius"]],0])}this.map.getLayer("line")&&this.map.setPaintProperty("line","line-width",["case",["in",["get","post_id"],["literal",t]],0,["has","width"],["to-number",["get","width"]],2]);if(this.map.getLayer("fill")){const e=new MapsterHelpers;let n=this.polygons.filter((e=>-1===t.indexOf(e.id))),r=e.createLayerGeoJSON(this.map,"polygon","fill",[],[],n);this.map.getSource("fill").setData(r)}}returnMarkerProperties(t){return t.mapsterProperties}addListeners(){var t=this;jQuery(document).on("change",".mapster-cat-toggle",(function(){t.setToggles(this);t.changeLayerVisibility()}));jQuery(document).on("click",".mapster-accordion-indicator",(function(){let t=!1;jQuery(this).parent().hasClass("mapster-accordion-indicator-open")&&(t=!0);jQuery(".mapster-accordion-indicator").each((function(){if(jQuery(this).parent().next("ul").is(":visible")){jQuery(this).parent().next("ul").slideToggle(400,(()=>jQuery(this).parent().addClass("mapster-accordion-indicator-closed")));jQuery(this).parent().removeClass("mapster-accordion-indicator-open")}}));if(t)jQuery(this).parent().addClass("mapster-accordion-indicator-closed");else{jQuery(this).parent().addClass("mapster-accordion-indicator-open");jQuery(this).parent().next("ul").slideToggle()}}))}onAdd(t){this.map=t;this._container=document.createElement("div");this._container.className="mapboxgl-ctrl mapster-category-control";this._container.innerHTML=this.returnHTML();this.initialVisibility||setTimeout((()=>{this.changeLayerVisibility()}),10);this.addListeners();return this._container}onAddGoogleMap(t){this.map=t;this._container=document.createElement("div");this._container.className="mapster-category-control mapster-google-category-control";this._container.innerHTML=this.returnHTML();this.addListeners();return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this.map=void 0}}
;class LayerControl{constructor(t){this.toggleable_layers=t.toggleable_layers;this.toggleable_layer_titles=t.toggleable_layer_titles;this.checkbox_type=t.checkbox_type}returnHTML(){let t='<ul class="mapster-layer-control-content">';const e=this.toggleable_layers.replace("\r","").split("\n"),n=this.toggleable_layer_titles.replace("\r","").split("\n");e.forEach(((e,r)=>{t+="<li>";const i=e.split(",");let o=!0,a=!0;i.forEach((t=>{if(""!==t){this.map.getLayer(t.trim())||(o=!1);"hidden"!==this.map.getLayoutProperty(t.trim(),"visibility")&&void 0===this.map.getLayoutProperty(t.trim(),"visibility")||(a=!1)}}));o?"checkbox"===this.checkbox_type?t+=`<input class="mapster-layer-toggle" data-layers="${e}" ${a?'checked="checked"':""} type="checkbox" /> ${n[r]}`:"radio"===this.checkbox_type?t+=`<input name="mapster-layer-control" class="mapster-layer-toggle" data-layers="${e}" ${a?'checked="checked"':""} type="radio" /> ${n[r]}`:"switch"===this.checkbox_type&&(t+=`<label class="mapster-switch">\n <input class="mapster-layer-toggle" data-layers="${e}" ${a?'checked="checked"':""} type="checkbox" />\n <span class="mapster-slider mapster-round"></span>\n </label> ${n[r]}`):alert("Please double check the layers you've set for the layer control: some don't exist in the style!");t+="</li>"}));t+="</ul>";return t}changeLayerVisibility(){let t=this;jQuery(".mapster-layer-toggle").each((function(){jQuery(this).data("layers").split(",").forEach((e=>{jQuery(this).is(":checked")?t.map.setLayoutProperty(e.trim(),"visibility","visible"):t.map.setLayoutProperty(e.trim(),"visibility","none")}))}))}addListeners(){var t=this;jQuery(document).on("change",".mapster-layer-toggle",(function(){t.changeLayerVisibility()}))}onAdd(t){this.map=t;this._container=document.createElement("div");this._container.className="mapboxgl-ctrl mapster-layer-control";const e=setInterval((()=>{if(this.map.isStyleLoaded()){this._container.innerHTML=this.returnHTML();clearInterval(e)}}),100);this.addListeners();return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class StyleControl{constructor(t){this.toggleable_styles=t.toggleable_styles;this.toggleable_styles_titles=t.toggleable_styles_titles;this.initial_style_title=t.initial_style_title;this.default_style=!1}returnHTML(){let t='<ul class="mapster-style-control-content">';this.default_style=this.map.getStyle();t+=`<li><input name="mapster-style-control" class="mapster-style-toggle" data-index="default" checked="checked" type="radio" /> ${this.initial_style_title}`;const e=this.toggleable_styles.replace("\r","").split("\n"),n=this.toggleable_styles_titles.replace("\r","").split("\n");e.forEach(((e,r)=>{if(""!==e){t+="<li>";t+=`<input name="mapster-style-control" class="mapster-style-toggle" data-index="${r}" type="radio" /> ${n[r]}`;t+="</li>"}}));t+="</ul>";return t}addListeners(){var t=this;new MapsterHelpers;jQuery(document).on("change",".mapster-style-toggle",(function(){const e=jQuery(this).data("index");if("default"!==e){const n=t.toggleable_styles.split("\n");n[e].indexOf("{")>-1?t.map.setStyle(JSON.parse(n[e])):t.map.setStyle(n[e]);t.map.fire("mapster_custom_style_load")}else{t.map.setStyle(t.default_style);t.map.fire("mapster_custom_style_load")}}))}onAdd(t){this.map=t;this._container=document.createElement("div");this._container.className="mapboxgl-ctrl mapster-style-control";const e=setInterval((()=>{if(this.map.isStyleLoaded()){this._container.innerHTML=this.returnHTML();clearInterval(e)}}),100);this.addListeners();return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class ElevationControl{constructor(t){this.lines=t.lines;this.post_id=t.post_id;this.single_line=t.single_line;this.open_on_load=t.open_on_load;this.profile_color=t.profile_color;this.units=t.units;this.show_line_length=t.show_line_length;this.profile_displayed=!1;this.last_line_displayed=!1}addListeners(){jQuery(document).on("click",".mapster-elevation-control-content",(()=>{if(this.profile_displayed){this.removeElevation();this.profile_displayed=!1;jQuery(".mapster-elevation-control-content").removeClass("mapster-elevation-control-active")}else{jQuery(".mapster-elevation-control-content");if(this.map.getSource("mapbox-dem"))this.addElevation(this.last_line_displayed);else{this.loadElevationData();this.map.once("idle",(()=>{this.addElevation(this.last_line_displayed)}))}this.profile_displayed=!0;jQuery(".mapster-elevation-control-content").addClass("mapster-elevation-control-active")}}));this.single_line&&this.open_on_load&&setTimeout((()=>{this.last_line_displayed=this.lines[0];jQuery(".mapster-elevation-control-content").click()}),1e3);this.single_line||this.map.on("click","line",(t=>{this.last_line_displayed=this.lines.find((e=>e.id===t.features[0].properties.post_id));this.profile_displayed&&jQuery(".mapster-elevation-control-content").click();jQuery(".mapster-elevation-control-content").click()}));this.map.on("mousemove",(()=>{this.map.getLayer("elevation-point-along-layer")&&this.map.setLayoutProperty("elevation-point-along-layer","visibility","none")}))}loadElevationData(){this.map.addSource("mapbox-dem",{type:"raster-dem",url:"mapbox://mapbox.terrain-rgb",tileSize:512,maxzoom:14});this.map.setTerrain({source:"mapbox-dem",exaggeration:1.5})}removeElevation(){document.getElementById("mapster-chartjs-container").remove()}addElevation(t){let e=[],n=turf.length(t.data.line);for(let r=0;r<n;r+=n/50){let n=turf.along(t.data.line,r),i=this.map.queryTerrainElevation(n.geometry.coordinates,{exaggerated:!1});"feet"===this.units&&(i*=3.28084);e.push(i)}let r=document.createElement("div");r.setAttribute("id","mapster-chartjs-container");let i=document.createElement("canvas");i.setAttribute("id","mapster-chartjs");document.getElementById(`mapster-wp-maps-${this.post_id}`).append(r);r.append(i);const o=new MapsterConstants;let a=e.map((t=>""));if(this.show_line_length){a=[];e.forEach(((t,e)=>{let r=n/50;"feet"===this.units&&(r*=.621371);let i=parseInt(e*r*10)/10;a.push(i)}))}new Chart(document.getElementById("mapster-chartjs"),{type:"line",data:{labels:a,datasets:[{label:"Elevation",data:e,fill:!1,borderColor:this.profile_color,pointRadius:0,tension:.2}]},options:o.returnElevationChartOptions(this.units,this.show_line_length),plugins:[o.returnElevationChartPlugin(this.map,t)]})}onAdd(t){this.map=t;this.storedBounds=this.map.getBounds();this._container=document.createElement("div");if(window.mapster_params.public){this._container.className="mapboxgl-ctrl mapster-elevation-control";this._container.innerHTML='\n <div class="mapster-elevation-control-content">\n <svg class="mapster-svg-mountain" focusable="false" viewBox="0 0 24 24" aria-hidden="true">\n <path d="M14 6l-3.75 5 2.85 3.8-1.6 1.2C9.81 13.75 7 10 7 10l-6 8h22L14 6z"></path>\n </svg>\n </div>\n ';this.addListeners()}return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class MapsterConstants{returnElevationChartPlugin(t,e){return{id:"corsair",afterInit:t=>{t.corsair={x:0,y:0}},afterEvent:(t,e)=>{const{chartArea:{top:n,bottom:r,left:i,right:o}}=t,{event:{x:a,y:s}}=e;if(a<i||a>o||s<n||s>r){t.corsair={x:a,y:s,draw:!1};t.draw()}else{t.corsair={x:a,y:s,draw:!0};t.draw()}},afterDatasetsDraw:(n,r,i)=>{const{ctx:o,chartArea:{top:a,bottom:s,left:l,right:c}}=n,{x:u,y:p,draw:h}=n.corsair;if(!h)return;o.lineWidth=i.width||0;o.setLineDash(i.dash||[]);o.strokeStyle=i.color||"black";o.save();o.beginPath();o.moveTo(u,s);o.lineTo(u,a);o.stroke();o.restore();const d=(u-l)/(c-l);let f=turf.length(e.data.line),m=turf.along(e.data.line,f*d);if(t.getSource("elevation-point-along")&&t.getLayer("elevation-point-along-layer")){t.getSource("elevation-point-along").setData(m);t.setLayoutProperty("elevation-point-along-layer","visibility","visible")}else{t.addSource("elevation-point-along",{type:"geojson",data:m});t.addLayer({id:"elevation-point-along-layer",type:"circle",source:"elevation-point-along"})}}}}returnElevationChartOptions(t,e){return{interaction:{intersect:!1,mode:"index"},scales:{x:{title:{display:!!e,text:"meters"===t?"KM":"Miles",font:{style:"italic",size:10}},grid:{display:!0},ticks:{font:{size:10}}}},maintainAspectRatio:!1,plugins:{legend:{display:!1},title:{display:!0,text:`Elevation (${"meters"===t?"m":"ft"})`},tooltip:{displayColors:!1,callbacks:{label:function(e){return parseInt(10*e.parsed.y)/10+" "+("meters"===t?"m":"ft")}}},corsair:{color:"#333",width:1}}}}returnStyleProviders(){return[{id:"streets",style:"mapbox://styles/mapbox/streets-v12"},{id:"outdoors",style:"mapbox://styles/mapbox/outdoors-v12"},{id:"light",style:"mapbox://styles/mapbox/light-v11"},{id:"dark",style:"mapbox://styles/mapbox/dark-v11"},{id:"satellite",style:"mapbox://styles/mapbox/satellite-v9"},{id:"satellite-streets",style:"mapbox://styles/mapbox/satellite-streets-v12"},{id:"custom-image",style:{version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[{id:"background",type:"background",paint:{"background-color":"rgba(255,255,255,1)"}}]}},{id:"empty",style:{version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[{id:"background",type:"background",paint:{"background-color":"rgba(255,255,255,1)"}}]}},{id:"open-street-map",style:this.returnJsonStyle("https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')},{id:"open-topo-map",style:this.returnJsonStyle("https://a.tile.opentopomap.org/{z}/{x}/{y}.png",'Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)')},{id:"cyclo-osm",style:this.returnJsonStyle("https://a.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png",'<a href="https://github.com/cyclosm/cyclosm-cartocss-style/releases" title="CyclOSM - Open Bicycle render">CyclOSM</a> | Map data: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')},{id:"toner-stamen",style:this.returnJsonStyle("https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')},{id:"watercolor-stamen",style:this.returnJsonStyle("https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png",'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')},{id:"terrain-stamen",style:this.returnJsonStyle("https://stamen-tiles.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png",'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')},{id:"esri-satellite",style:this.returnJsonStyle("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}","Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community")},{id:"blank-map",style:this.returnJsonStyle("https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')}]}returnJsonStyle(t,e){return{version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{"raster-tiles":{type:"raster",tiles:[t],tileSize:256,attribution:e}},layers:[{id:"simple-tiles",type:"raster",source:"raster-tiles",minzoom:0,maxzoom:22}]}}loaderHTML(){return'\n\t\t\t<div class="mapster-map-loader">\n\t\t\t\t<svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#333">\n\t\t\t\t\t<g fill="none" fill-rule="evenodd">\n\t\t\t\t\t\t\t<g transform="translate(1 1)" stroke-width="2">\n\t\t\t\t\t\t\t\t\t<circle stroke-opacity=".5" cx="18" cy="18" r="18"/>\n\t\t\t\t\t\t\t\t\t<path d="M36 18c0-9.94-8.06-18-18-18">\n\t\t\t\t\t\t\t\t\t\t\t<animateTransform\n\t\t\t\t\t\t\t\t\t\t\t\t\tattributeName="transform"\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype="rotate"\n\t\t\t\t\t\t\t\t\t\t\t\t\tfrom="0 18 18"\n\t\t\t\t\t\t\t\t\t\t\t\t\tto="360 18 18"\n\t\t\t\t\t\t\t\t\t\t\t\t\tdur="1s"\n\t\t\t\t\t\t\t\t\t\t\t\t\trepeatCount="indefinite"/>\n\t\t\t\t\t\t\t\t\t</path>\n\t\t\t\t\t\t\t</g>\n\t\t\t\t\t</g>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t'}markerAsSVG(t){return"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(`\n <svg display="block" height="41px" width="27px" viewBox="0 0 27 41" xmlns="http://www.w3.org/2000/svg" xmlns:xlink= "http://www.w3.org/1999/xlink">\n <g fill-rule="nonzero">\n <g transform="translate(3.0, 29.0)" fill="#000000">\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="10.5" ry="5.25002273"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="10.5" ry="5.25002273"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="9.5" ry="4.77275007"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="8.5" ry="4.29549936"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="7.5" ry="3.81822308"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="6.5" ry="3.34094679"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="5.5" ry="2.86367051"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="4.5" ry="2.38636864"></ellipse>\n </g>\n <g fill="${t}">\n <path d="M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"></path>\n </g>\n <g opacity="0.25" fill="${t}">\n <path d="M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"></path>\n </g>\n <g transform="translate(6.0, 7.0)" fill="#FFFFFF"></g>\n <g transform="translate(8.0, 8.0)">\n <circle fill="${t}" opacity="0.25" cx="5.5" cy="5.5" r="5.4999962"></circle>\n <circle fill="#FFFFFF" cx="5.5" cy="5.5" r="5.4999962"></circle>\n </g>\n </g>\n </svg>\n `)}}class MapsterHelpers{constructor(){this.queuedImages=[]}isMobile(){let t=!1;/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(t=!0);return t}changeCursor(t,e,n){e.data.enable_popup&&(t.getCanvas().style.cursor="on"===n?"pointer":"grab")}formatResponse(t){["location","line","polygon"].forEach((e=>{t[e+"s"].forEach((n=>{this.setObjectProperties(n,t[e+"_template"]);this.setPopupStyles(n,t.popup_styles)}))}));return new Promise((e=>{e(t)}))}getDefaultCenter(){let t=[0,0];"1"===window.mapster_params.activated&&window.mapster_params.mapster_default_lat&&window.mapster_params.mapster_default_lng&&(t=[parseFloat(window.mapster_params.mapster_default_lng),parseFloat(window.mapster_params.mapster_default_lat)]);return t}getDefaultZoom(){let t=2;"1"===window.mapster_params.activated&&window.mapster_params.mapster_default_zoom&&(t=parseFloat(window.mapster_params.mapster_default_zoom));return t}doHover(t,e){let n=e.data.line?"line":e.data.symbol?"symbol":e.data.circle?"circle":e.data.polygon?"fill":[],r="line"===n||"fill"===n?e.data:"circle"===n?e.data.circle:e.data.symbol;if(r.hover_effects&&r.hover_effects.hover_enabled){t.removeFeatureState({source:n});t.setFeatureState({source:n,id:e.id},{hover:!0})}}doHoverOut(t,e){let n=e.data.line?"line":e.data.symbol?"symbol":e.data.circle?"circle":e.data.polygon?"fill":[],r="line"===n||"fill"===n?e.data:"circle"===n?e.data.circle:e.data.symbol;r.hover_effects&&r.hover_effects.hover_enabled&&t.setFeatureState({source:n,id:e.id},{hover:!1})}doMarkerHover(t,e,n){let r=n.mapsterProperties.data;if(r.marker.hover_effects.hover_enabled){const i=new e.Marker({color:r.marker.hover_effects.hover_color,scale:parseFloat(r.marker.hover_effects.hover_scale)/100,rotation:parseFloat(r.marker.hover_effects.hover_rotation),anchor:r.marker.anchor});-1===i._element.className.indexOf("mapster-remove-hover")&&(i._element.className+=" mapster-remove-hover");-1===n._element.className.indexOf("mapster-hide-original")&&(n._element.className+=" mapster-hide-original");i.setLngLat([n._lngLat.lng,n._lngLat.lat]).addTo(t);return i}return!1}doMarkerHoverOut(t,e){e._element.className.indexOf("mapster-hide-original")>-1&&(e._element.className=e._element.className.replace(" mapster-hide-original",""));t.remove()}setMapCompare(t,e,n,r){
}applyProSearchFilter(t,e){
return e}setGeolocationOnLoad(t){
}setMapBreakpointSizes(t,e){
}async getImageData(t){return wp.media.attachment(t).fetch().then((t=>t))}async setCustomImageMap(t,e,n){
}loadModalSteps(t,e,n,r,i,o){const a=new MapsterConstants;let s=!1,l=[];if("create_point"===r){if(i)if(1===i.length){s=i[0].term_id;if(o.submission_interface.include_address_search){c(t);u()}else{u();p()}}else{c(t);jQuery(`#mapster-submission-modal-${t} .mapster-submission-modal-content`).html(`\n <div class="mapster-category-container">\n ${i.map((t=>`\n <div class="mapster-category-tile mapster-cat-set" data-category="${t.term_id}">\n ${t.icon?`<div class="mapster-category-image"><img src="${t.icon}" /></div>`:""}\n ${t.name?`<div class="mapster-category-name"><p>${t.name}</p></div>`:""}\n ${t.description?`<div class="mapster-category-description"><p>${t.description}</p></div>`:""}\n </div>\n `)).join("")}\n </div>\n `)}else{c(t);jQuery(`#mapster-submission-modal-${t} .mapster-submission-modal-content`).html(`\n <div class="mapster-category-container" data-category="none">\n <div class="mapster-category-tile mapster-cat-set">${o.custom_texts.add_point_text}</div>\n </div>\n `)}jQuery(document).on("click",`#mapster-submission-modal-${t} .mapster-category-tile.mapster-cat-set`,(function(){"none"!==jQuery(this).data("category")&&(s=jQuery(this).data("category"));u()}))}if("edit_point"===r){const e=window.mapster_params.user_submission_permalink;c(t);jQuery(`#mapster-submission-modal-${t} .mapster-submission-modal-content`).html(`\n ${a.loaderHTML()}\n <iframe\n onload="jQuery('.mapster-map-loader').remove();"\n class="mapster-submission-embed"\n src="${e}?pagetype=search&map_id=${t}">\n </iframe>\n `)}window.onmessage=function(t){if(t.data&&t.data.indexOf){t.data.indexOf("set_point")>-1&&u(t.data.replace("set_point-",""));if(t.data.indexOf("close_modal")>-1){jQuery(".mapster-submission-modal-overlay").fadeOut(50);jQuery(".mapster-submission-modal").fadeOut(100)}}};function c(t){jQuery(`.mapster-submit-${t} #mapster-submission-modal-overlay-${t}`).fadeIn(100);jQuery(`.mapster-submit-${t} #mapster-submission-modal-${t}`).fadeIn(150)}function u(r){o.submission_interface.include_address_search?jQuery(`#mapster-submission-modal-${t} .mapster-submission-modal-content`).html(`\n <div class="mapster-description-text"><p>${o.custom_texts.choose_how}</p></div>\n <div class="mapster-category-container">\n ${o.submission_interface.include_address_search?`<div class="mapster-category-tile mapster-method-set" data-method="address" style="max-width:none;"><p>${o.custom_texts.address_search}</p></div>`:""}\n <div class="mapster-category-tile mapster-method-set" data-method="click" style="max-width:none;"><p>${o.custom_texts.map_click}</p></div>\n </div>\n `):p();jQuery(document).on("click",`#mapster-submission-modal-${t} .mapster-category-tile.mapster-method-set`,(function(){if("address"===jQuery(this).data("method")){const r=new MapboxGeocoder({accessToken:o.submission_interface.mapbox_geocoder_access_token,mapboxgl:n,marker:!1});jQuery(`#mapster-submission-modal-${t} .mapster-submission-modal-content`).html(`<p>${o.custom_texts.search_location}</p>`);jQuery(`#mapster-submission-modal-${t} .mapster-submission-modal-content`)[0].appendChild(r.onAdd(e));r.on("result",(function(){p()}))}"click"===jQuery(this).data("method")&&p()}));jQuery(document).on("click",`#mapster-wp-maps-${t} .mapster-selection-instructions button`,(function(n){const r=e.getCenter();let i=!0;if(o.administration.allowed_area){const t=JSON.parse(o.administration.allowed_area);turf.booleanPointInPolygon([r.lng,r.lat],t.features[0])||(i=!1)}jQuery(".mapboxgl-ctrl").show();jQuery(".mapster-selection-overlay").remove();l=[r.lng,r.lat];jQuery(`#mapster-submission-modal-overlay-${t}`).fadeIn(100);jQuery(`#mapster-submission-modal-${t}`).fadeIn(150);jQuery(`#mapster-submission-modal-${t} .mapster-submission-modal-content`).html(`\n <div class="mapster-description-text"><p>${i?o.custom_texts.selection_saved:o.custom_texts.selection_error}</p></div>\n <div class="mapster-category-container">\n <div class="mapster-category-tile mapster-method-set" data-method="click" style="max-width:none;"><p>${o.custom_texts.try_again}</p></div>\n ${i?`<div class="mapster-category-tile mapster-coords-set" style="max-width:none;"><p>${o.custom_texts.confirm}</p></div>`:""}\n </div>\n `)}));jQuery(document).on("click",`#mapster-submission-modal-${t} .mapster-category-tile.mapster-coords-set`,(function(){const e=window.mapster_params.user_submission_permalink;let n=!!o.administration.template_post&&o.administration.template_post.ID;if(o.administration.multiple_templates){let t=o.submission_interface.categories.indexOf(s);n=o.administration.template_posts[t]}let i=r?"&type=edit&post_id="+r:"";jQuery(`#mapster-submission-modal-${t} .mapster-submission-modal-content`).html(`\n ${a.loaderHTML()}\n <iframe\n onload="jQuery('.mapster-map-loader').remove();"\n class="mapster-submission-embed"\n src="${e}?category=${s}&coords=${l.join(",")}&map_id=${t}${i}">\n </iframe>\n `)}))}function p(){jQuery(".mapster-submission-modal-close").trigger("click");jQuery(".mapboxgl-ctrl").hide();jQuery(e._container).append(`\n <div class="mapster-selection-overlay">\n <div class="mapster-selection-instructions">\n <p>${o.custom_texts.drag_zoom}</p>\n <button>${o.custom_texts.capture_point}</button>\n </div>\n <svg version="1.1" id="Uploaded to svgrepo.com" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n width="32px" height="32px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">\n <style type="text/css">\n .dashing_een{fill:#141414;}\n .st0{fill:#141414;}\n </style>\n <path class="dashing_een" d="M15.5,21.5v-2c0-0.276,0.224-0.5,0.5-0.5s0.5,0.224,0.5,0.5v2c0,0.276-0.224,0.5-0.5,0.5\n S15.5,21.776,15.5,21.5z M16,13c0.276,0,0.5-0.224,0.5-0.5v-2c0-0.276-0.224-0.5-0.5-0.5s-0.5,0.224-0.5,0.5v2\n C15.5,12.776,15.724,13,16,13z M16,3c0.276,0,0.5-0.224,0.5-0.5v-2C16.5,0.224,16.276,0,16,0c-0.276,0-0.5,0.224-0.5,0.5v2\n C15.5,2.776,15.724,3,16,3z M16,32c0.276,0,0.5-0.224,0.5-0.5v-2c0-0.276-0.224-0.5-0.5-0.5s-0.5,0.224-0.5,0.5v2\n C15.5,31.776,15.724,32,16,32z M22,16c0-0.276-0.224-0.5-0.5-0.5h-2c-0.276,0-0.5,0.224-0.5,0.5s0.224,0.5,0.5,0.5h2\n C21.776,16.5,22,16.276,22,16z M13,16c0-0.276-0.224-0.5-0.5-0.5h-2c-0.276,0-0.5,0.224-0.5,0.5s0.224,0.5,0.5,0.5h2\n C12.776,16.5,13,16.276,13,16z M3,16c0-0.276-0.224-0.5-0.5-0.5h-2C0.224,15.5,0,15.724,0,16c0,0.276,0.224,0.5,0.5,0.5h2\n C2.776,16.5,3,16.276,3,16z M32,16c0-0.276-0.224-0.5-0.5-0.5h-2c-0.276,0-0.5,0.224-0.5,0.5s0.224,0.5,0.5,0.5h2\n C31.776,16.5,32,16.276,32,16z M27,16c0,6.065-4.935,11-11,11S5,22.065,5,16S9.935,5,16,5S27,9.935,27,16z M26,16.5h-1.5\n c-0.276,0-0.5-0.224-0.5-0.5s0.224-0.5,0.5-0.5H26c-0.255-5.115-4.387-9.245-9.5-9.5v1.5C16.5,7.776,16.276,8,16,8\n s-0.5-0.224-0.5-0.5V6c-5.113,0.255-9.245,4.385-9.5,9.5h1.5C7.776,15.5,8,15.724,8,16s-0.224,0.5-0.5,0.5H6\n c0.255,5.115,4.387,9.245,9.5,9.5v-1.5c0-0.276,0.224-0.5,0.5-0.5s0.5,0.224,0.5,0.5V26C21.613,25.745,25.745,21.615,26,16.5z"/>\n </svg>\n </div>\n `)}}setProjectionGlobe(t,e){
}create3DModels(t,e){
}setPopupStyles(t,e){if(t.data.popup_style){let n=t.data.popup_style,r=e.find((t=>t.id===n));t.data.popup_style=r}}setObjectProperties(t,e){for(var n in e)if(this.isObject(e[n])){null==t[n]&&(t[n]={});this.setObjectProperties(t[n],e[n])}else null==t[n]&&(t[n]=e[n])}isObject(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}makeFeatureJSON(t){let e=t.line?t.line:t.location?t.location:!!t.polygon&&t.polygon;return{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:e.type,coordinates:e.coordinates}}]}}getStyle(t){const e=new MapsterConstants;if(""!==t.custom_mapbox_style)return t.custom_mapbox_style;if("custom-image"===t.map_provider)return e.returnStyleProviders().find((t=>"custom-image"===t.id)).style;if(""!==t.access_token){var n=t.map_tile_style_access_token;return e.returnStyleProviders().find((t=>t.id===n)).style}n=t.map_tile_style_no_access_token;return e.returnStyleProviders().find((t=>t.id===n)).style}addMapControl(t,e,n,r,i,o={}){e&&t.removeControl(e);if(n){const e=new i(o);t.addControl(e,r);return e}return!1}searchLocalFeatures(t,e,n,r,i){var o={type:"FeatureCollection",features:[]};n.concat(r.concat(i)).forEach((t=>{var e=this.makeFeatureJSON(t.data);o.features.push(this.makeGeocoderResult(t,e))}));let a=this.localFeaturesTextMatch(t,e,o.features);a.sort(((t,e)=>t.place_name>e.place_name?1:-1));return a}localFeaturesTextMatch(t,e,n){let r=[];const i=e.split(" ").filter((t=>""!==t));n.forEach((n=>{var o=!1;n.properties.searchableTexts.forEach((a=>{var s={type:"Feature",id:n.properties.id,place_name:jQuery("<div>").html(n.properties.place_name).text()};if(!(window.mapster_categories_hidden_features&&window.mapster_categories_hidden_features.length>0&&-1!==window.mapster_categories_hidden_features.indexOf(n.properties.id))){if("exact-match"===t&&a&&(a.toLowerCase().indexOf(e.toLowerCase())>-1||" "===e)&&!o){s.center=turf.center(n).geometry.coordinates;"Point"!==n.geometry.type&&(s.bbox=turf.bbox(n));r.push(s);o=!0}
}}))}));return r}initializeSlider(t,e){const n=t=>{jQuery("#mapster-slider ul").animate({left:jQuery("#mapster-slider ul li").width()*("right"===t?-1:1)},200,(()=>{jQuery("#mapster-slider ul li:first-child").appendTo("#mapster-slider ul");jQuery("#mapster-slider ul").css("left","")}))};if(!window.sliderClicksInitialized){jQuery(document).on("click","#mapster-slider .mapster-slider-control_prev",(function(){n("left")}));jQuery(document).on("click","#mapster-slider .mapster-slider-control_next",(function(){n("right")}));window.sliderClicksInitialized=!0}}makeHeatmap(t,e,n,r){
}createHeatmapProperties(t,e,n,r){
}fadeHeatmapFeatures(t,e){
}setClustering(t,e,n,r,i,o,a,s,l,c,u){if(i||r)return this.doSymbolClustering(t,e,n,r,i,s,l,c,u);o&&this.doMarkerClustering(t,e,n,o,a,s,u);return[]}doMarkerClustering(t,e,n,r,i,o,a){let s=n.cluster_by_category?n.categories_to_cluster.map((t=>"marker-"+t)):["marker"];this.makeClusters(t,e,n,s,o,[],[],a);t.on("render",(()=>{let e=[];s.forEach((n=>{if(!t.isSourceLoaded(n))return;const r=t.querySourceFeatures(n);e=e.concat(r.filter((t=>t.properties.id)).map((t=>t.properties.id)))}));i.forEach((n=>{-1===e.indexOf(n.mapsterProperties.id)?n.remove():(!n._popup||n._popup&&!n._popup.isOpen())&&n.addTo(t)}))}))}doSymbolClustering(t,e,n,r,i,o,a,s,l){var c=[];i&&(n.cluster_by_category?n.categories_to_cluster.forEach((t=>{c.push("symbol-"+t)})):c.push("symbol"));r&&(n.cluster_by_category?n.categories_to_cluster.forEach((t=>{c.push("circle-"+t)})):c.push("circle"));this.makeClusters(t,e,n,c,o,a,s,l);return c}makeClusters(t,e,n,r,i,o,a,s){r.forEach((e=>{t.getLayer(`${e}-cluster-count`)&&t.removeLayer(`${e}-cluster-count`);t.getLayer(`${e}-clusters`)&&t.removeLayer(`${e}-clusters`);t.getLayer(`${e}-clusters-border`)&&t.removeLayer(`${e}-clusters-border`);t.getLayer(e)&&t.removeLayer(e);if(t.getSource(e))try{t.removeSource(e)}catch(t){}}));r.forEach(((r,l)=>{let c,u=r.split("-")[0];if(t.getLayer(u)&&t.getSource(u)){t.removeLayer(u);t.removeSource(u)}c=r.indexOf("marker")>-1?this.createMarkerGeoJSON(i,r):this.createLayerGeoJSON(t,"location",r,i,o,a);s=s||[];var p=c.features.filter((t=>-1===s.indexOf(t.properties.post_id)));let h=!1;if(n.show_category_name){let t=i.concat(o.concat(a)),e=parseInt(r.split("-")[1]);t.forEach((t=>{h||(h=t.categories.find((t=>t.id===e)))}))}t.addSource(r,{type:"geojson",data:{type:"FeatureCollection",features:p},cluster:!0,clusterMaxZoom:14,clusterRadius:50});if(r.indexOf("marker")>-1)t.addLayer({id:r,source:r,type:"circle",filter:["!",["has","point_count"]],paint:{"circle-radius":0}});else{var d=this.getLayerExpressions("location",r.indexOf("symbol")>-1?"symbol":"circle",e);t.addLayer({id:r,source:r,type:r.split("-")[0],filter:["!",["has","point_count"]],paint:d.paint,layout:d.layout})}this.addIcons(t,r,c);let f="#51bbd6",m=100,g=20,y="#f1f075",v=750,_=30,x="#f28cb1",b=40;
t.addLayer({id:`${r}-clusters`,type:"circle",source:r,filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],f,m,y,v,x],"circle-radius":["step",["get","point_count"],g,m,_,v,b]}});t.addLayer({id:`${r}-cluster-count`,type:"symbol",source:r,filter:["has","point_count"],layout:{"text-field":h?h.name:"{point_count_abbreviated}","text-font":"mapbox"===e?["DIN Offc Pro Medium","Arial Unicode MS Bold"]:["Open Sans Regular"],"text-size":12}});setTimeout((()=>{t.on("click",`${r}-clusters`,(e=>{const n=t.queryRenderedFeatures(e.point,{layers:[`${r}-clusters`]}),i=n[0].properties.cluster_id;t.getSource(r).getClusterExpansionZoom(i,((e,r)=>{t.easeTo({center:n[0].geometry.coordinates,zoom:r+1})}))}))}),500)}))}makeGeocoderResult(t,e){var n=e.features[0];n.properties={searchableTexts:[t.data.popup?t.data.popup.header_text:"",t.data.popup?t.data.popup.body_text:"",t.title,t.content],id:t.id,place_name:t.title};return n}modifyDropdown(t){t.container.classList.add("mapster-maps-dropdown");jQuery(".mapster-maps-dropdown").find(".mapboxgl-ctrl-geocoder--icon.mapboxgl-ctrl-geocoder--icon-search").replaceWith('<svg viewBox="0 0 32 32" class="mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-search" viewBox="0 0 32 32" aria-hidden="true">\n <path d="M24 11.305l-7.997 11.39L8 11.305z"/>\n </svg>');jQuery(".mapster-maps-dropdown").find(".mapboxgl-ctrl-geocoder--input").wrap('<div class="input-wrapper"></div>');jQuery(".mapster-maps-dropdown").find(".mapboxgl-ctrl-geocoder--input").attr("disabled",!0);jQuery(document).on("click",".mapster-maps-dropdown .input-wrapper",(()=>{t.setInput("");jQuery(".suggestions-wrapper .suggestions li").removeClass("active")}));jQuery(document).on("click",".mapboxgl-ctrl-geocoder--icon.mapboxgl-ctrl-geocoder--icon-close",(()=>{t.clear();jQuery(".suggestions-wrapper .suggestions").hide()}))}openExternalLink(t){t&&t.data.open_link_on_click&&t.data.click_link&&t.data.click_link.url&&(t.data.click_link.open_link_in_new_tab?window.open(t.data.click_link.url):window.open(t.data.click_link.url,"_self"))}getMapBounds(t,e,n){var r={type:"FeatureCollection",features:[]};[["location",t],["line",e],["polygon",n]].forEach((t=>{t[1].forEach((t=>{var e=this.makeFeatureJSON(t.data);r.features.push(e.features[0])}))}));return r.features.length>0?turf.bbox(r):null}openStoreLocatorClick(t,e){t.enable&&jQuery(`.mapster-store-locator-list[data-id="${e}"]`).click()}openSidebarClick(t,e,n,r,i,o){!t.enable&&e&&this.setSidebarHTML(n.data,r,i,o)}openPopup(t,e,n,r,i,o,a){if(!o.enable&&!a){n&&n.remove();if(r.data.popup_style){r.data.location&&"Point"===r.data.location.type&&(i=r.data.location.coordinates);let n=new e.Popup(this.returnPopupOptions(r.data)).setLngLat(i).setHTML(this.getPopupHTML(r.id,r.data));this.centerPopup(t,n,r);n.addTo(t);return n}}}centerPopup(t,e,n){
}mouseIsNear(t,e,n){if(t&&t.offset()){var r=t.offset().left-e,i=t.offset().top-e,o=r+t.width()+2*e,a=i+t.height()+2*e,s=n.pageX,l=n.pageY;return s>r&&s<o&&l>i&&l<a}return!1}getDirectionsLatLng(t){let e="";t.location&&(e=t.location.coordinates[1].toString()+","+t.location.coordinates[0].toString());if(t.line){let n=turf.center(t.line);e=n.geometry.coordinates[1].toString()+","+n.geometry.coordinates[0].toString()}if(t.polygon){let n=turf.center(t.polygon);e=n.geometry.coordinates[1].toString()+","+n.geometry.coordinates[0].toString()}return e}getPopupHTML(t,e){var n=this.getPopupStyle(e),r=this.returnPopupCSS(e),i=this.returnPopupLayout(e),o=this.returnPopupContent(e),a=this.returnPopupHTML(e),s="";"to-directions"===o.button_action&&(s=this.getDirectionsLatLng(e));i.enable_image&&"gallery"===o.image_type&&setTimeout((()=>{this.initializeSlider(`mapster-popup-${e.popup_style.id}`,o.images.length+1)}),400);return`\n <style>${n}</style>\n ${i.use_custom_css?`<style>${r.css_editor.replace(/#mapster-popup/g,`#mapster-popup-${e.popup_style.id}`)}</style>`:""}\n ${i.use_custom_html?this.replaceHTMLValues(a.html_editor,o):`<div id="mapster-popup-${e.popup_style.id}" class="map-popup-background ${i.popup_class} mapster-feature-popup-${t}">\n ${i.enable_header?`<div class="map-popup-header">\n <h2>${o.header_text}</h2>\n </div>`:""}\n ${i.enable_image&&"feature-image"===o.image_type?'<div class="map-popup-image"></div>':""}\n ${i.enable_image&&"gallery"===o.image_type?`<div class="map-popup-gallery">\n <div id="mapster-slider" style="height : ${r.image_height}px;">\n <div class="mapster-slider-control_next">></div>\n <div class="mapster-slider-control_prev"><</div>\n <ul>\n ${o.images.map((t=>`<li style="height : ${r.image_height}px; background-image: url(${t});"> </li>`)).join(" ")}\n </ul>\n </div>\n </div>`:""}\n ${i.enable_body?`<div class="map-popup-body">\n <p>${o.body_text}</p>\n </div>`:""}\n ${i.enable_footer?`<div class="map-popup-footer">\n ${"do-nothing"===o.button_action?`<button class="map-popup-footer-button">${o.button_text}</button>`:""}\n ${"to-post"===o.button_action?`<button class="map-popup-footer-button" onclick="${o.open_link_in_new_tab?`window.open('${e.popup.permalink}', '_blank');`:`window.open('${e.popup.permalink}', '_self');`}">\n ${o.button_text}\n </button>`:""}\n ${"to-link"===o.button_action?`<button class="map-popup-footer-button" onclick="${o.open_link_in_new_tab?`window.open('${o.button_url}', '_blank');`:`window.open('${o.button_url}', '_self');`}">\n ${o.button_text}\n </button>`:""}\n ${"to-directions"===o.button_action?`<button class="map-popup-footer-button" onclick="window.open('https://www.google.com/maps/dir/?api=1&destination=${s}', '_blank');">\n ${o.button_text}\n </button>`:""}\n ${"to-modal"===o.button_action?`<button class="map-popup-footer-button mapster-button-modal-open">\n ${o.button_text}\n </button>\n <div class="mapster-modal-content-in-popup"><embed style='width: 100%; height: ${window.innerHeight-300}px;' src='http://localhost:8888/wp-content/plugins/mapster-wordpress-maps/admin/includes/mapster-modal-shortcode.php?feature_id=${t}'></embed></div>`:""}\n </div>`:""}\n </div>`}\n `}getPopupStyle(t){var e=this.returnPopupCSS(t),n=this.returnPopupLayout(t),r=this.returnPopupContent(t),i=t.popup_style.id;return`\n .mapboxgl-popup .mapboxgl-popup-content, .maplibregl-popup .maplibregl-popup-content {\n padding: 0px;\n background: none;\n border: none;\n border-radius: none;\n box-shadow: none;\n }\n #mapster-popup-${i}.map-popup-background {\n background : ${e.background};\n text-align : ${e.align};\n border-radius: 3px;\n box-shadow: 0 1px 2px rgb(0 0 0 / 10%);\n }\n #mapster-popup-${i} .map-popup-header {\n background : ${e.header};\n padding: 10px;\n }\n #mapster-popup-${i} .map-popup-header h2 {\n all : revert;\n color : ${e.header_text};\n font-weight: bold;\n margin: 0;\n padding: 0;\n }\n #mapster-popup-${i} .map-popup-image {\n background-image : url("${r.featured_image?r.featured_image.url:""}");\n background-position : center center;\n background-size: cover;\n height : ${e.image_height}px;\n width: 100%;\n }\n #mapster-popup-${i} .map-popup-body {\n margin-top: -1px;\n background : ${e.body};\n padding: 10px;\n color : ${e.body_text};\n }\n #mapster-popup-${i} .map-popup-body p {\n padding: 0px;\n margin: 0px;\n }\n #mapster-popup-${i} .map-popup-footer {\n margin-top: -1px;\n background : ${e.footer};\n padding: 10px;\n }\n #mapster-popup-${i} .map-popup-footer .map-popup-footer-button {\n all : revert;\n background : ${e.button};\n border-color: ${e.button};\n color : ${e.button_text};\n padding: 5px;\n text-decoration: none;\n text-shadow: none;\n }\n #mapster-popup-${i} .map-popup-footer .map-popup-footer-button:hover {\n cursor: pointer;\n filter: brightness(1.15);\n }\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-top .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip,\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {\n border-bottom-color : ${e.pointer};\n display : ${n.enable_pointer?"block":"none"};\n }\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-right .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip {\n\t\t\t\tborder-left-color : ${e.pointer};\n display : ${n.enable_pointer?"block":"none"};\n\t\t\t}\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-left .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip {\n\t\t\t\tborder-right-color : ${e.pointer};\n display : ${n.enable_pointer?"block":"none"};\n\t\t\t}\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {\n border-top-color : ${e.pointer};\n display : ${n.enable_pointer?"block":"none"};\n }\n `}setSidebarHTML(t,e,n,r){var i="#mapster-wp-maps-"+r;jQuery(".mapster-sidebar-popup").remove();var o=jQuery(i).height(),a=(jQuery(i).width(),this.getPopupStyle(t)),s=this.returnPopupCSS(t),l=this.returnPopupLayout(t),c=this.returnPopupContent(t);l.enable_image&&"gallery"===c.image_type&&setTimeout((()=>{this.initializeSlider(`mapster-sidebar-popup-${t.popup_style.id}`,c.images.length+1)}),400);jQuery(document).on("click",".mapster-sidebar-popup-exit",(()=>{jQuery(".mapster-sidebar-popup").remove()}));const u=parseFloat(e),p=parseFloat(n),h=`\n <style>${a.replace(/-popup/g,"-sidebar-popup")}</style>\n ${l.use_custom_css?`<style>${s.css_editor.replace(/#mapster-popup/g,`#mapster-popup-${t.popup_style.id}`)}</style>`:""}\n <div id="mapster-sidebar-popup-${t.popup_style.id}" class="mapster-sidebar-popup" style="min-width: ${u}px; min-height: ${o/2}px; max-height: ${o}px; max-width: ${p}px;">\n <div class="mapster-sidebar-popup-exit">&#10006;</div>\n ${l.enable_header?`<div class="map-sidebar-popup-header">\n <h2>${c.header_text}</h2>\n </div>`:""}\n ${l.enable_image&&"feature-image"===c.image_type?'<div class="map-sidebar-popup-image"></div>':""}\n ${l.enable_image&&"gallery"===c.image_type?`<div class="map-sidebar-popup-gallery">\n <div id="mapster-slider" style="height : ${s.image_height}px;">\n <div class="mapster-slider-control_next">></div>\n <div class="mapster-slider-control_prev"><</div>\n <ul>\n ${c.images.map((t=>`<li style="height : ${s.image_height}px; background-image: url(${t});"> </li>`)).join(" ")}\n </ul>\n </div>\n </div>`:""}\n ${l.enable_body?`<div class="map-sidebar-popup-body">\n <p>${c.body_text}</p>\n </div>`:""}\n ${l.enable_footer?`<div class="map-sidebar-popup-footer">\n ${"do-nothing"===c.button_action?`<button class="map-sidebar-popup-footer-button">${c.button_text}</button>`:""}\n ${"to-post"===c.button_action?`<button class="map-sidebar-popup-footer-button" onclick="${c.open_link_in_new_tab?`window.open('${t.popup.permalink}', '_blank');`:`window.open('${t.popup.permalink}', '_self');`}">\n ${c.button_text}\n </button>`:""}\n ${"to-link"===c.button_action?`<button class="map-sidebar-popup-footer-button" onclick="${c.open_link_in_new_tab?`window.open('${c.button_url}', '_blank');`:`window.open('${c.button_url}', '_self');`}">\n ${c.button_text}\n </button>`:""}\n ${"to-modal"===c.button_action?`<button class="map-sidebar-popup-footer-button mapster-button-modal-open">\n ${c.button_text}\n </button>\n <div class="mapster-modal-content-in-popup">${c.modal_details}</div>`:""}\n </div>`:""}\n </div>\n `;jQuery(i).append(h)}replaceHTMLValues(t,e){let n;
return n}returnPopupHTML(t){return{html_editor:t.popup_style.html_editor}}returnPopupContent(t){return{header_text:t.popup.header_text,image_type:t.popup.image_type,featured_image:t.popup.featured_image,images:t.popup.images,body_text:t.popup.body_text,button_text:t.popup.button_text,button_action:t.popup.button_action,button_url:t.popup.button_url,modal_details:t.popup.modal_details,additional_details:t.additional_details,open_link_in_new_tab:t.popup.open_link_in_new_tab}}returnPopupLayout(t){return{enable_header:t.popup_style.enable_header,enable_image:t.popup_style.enable_image,enable_body:t.popup_style.enable_body,enable_footer:t.popup_style.enable_footer,enable_pointer:t.popup_style.enable_pointer,use_custom_css:t.popup_style.use_custom_css,use_custom_html:t.popup_style.use_custom_html,popup_class:t.popup_style.popup_class}}returnPopupOptions(t){return{className:"hover"===t.interaction?"mapster-hover-popup":"",closeButton:t.popup_style.close_button,closeOnClick:t.popup_style.close_on_click,closeMapMove:t.popup_style.close_on_map_move,maxWidth:t.popup_style.max_width+"px"}}returnPopupCSS(t){return{background:t.popup_style.background,header:t.popup_style.header,image_height:t.popup_style.image_height,body:t.popup_style.body,footer:t.popup_style.footer,button:t.popup_style.button,pointer:t.popup_style.pointer,header_text:t.popup_style.header_text,body_text:t.popup_style.body_text,button_text:t.popup_style.button_text,align:t.popup_style.align,css_editor:t.popup_style.css_editor,max_width:t.popup_style.max_width}}getMarkerStyles(t){var e=t.data;return{color:e.marker.color,scale:parseFloat(e.marker.scale)/100,rotation:parseFloat(e.marker.rotation),anchor:e.marker.anchor}}getLayerExpressions(t,e,n){if("line"===t)return{layout:{},paint:{"line-color":["case",["boolean",["feature-state","hover"],!1],["get","hover_effects_hover_color"],["has","color"],["get","color"],"#000"],"line-opacity":["case",["boolean",["feature-state","hover"],!1],["/",["to-number",["get","hover_effects_hover_opacity"]],100],["has","opacity"],["/",["to-number",["get","opacity"]],100],1],"line-width":["case",["boolean",["feature-state","hover"],!1],["to-number",["get","hover_effects_hover_width"]],["has","width"],["to-number",["get","width"]],2],"line-dasharray":"mapbox"===n?["case",["==",!0,["to-boolean",["get","dashed_line"]]],["get","dash_properties_line_dash_array"],["literal",[1,0]]]:[1,0]}};if("polygon"===t){if("fill"===e)return{layout:{},paint:{"fill-color":["case",["boolean",["feature-state","hover"],!1],["get","hover_effects_hover_color"],["has","color"],["get","color"],"#000"],"fill-opacity":["case",["boolean",["feature-state","hover"],!1],["/",["to-number",["get","hover_effects_opacity"]],100],["has","opacity"],["/",["to-number",["get","opacity"]],100],1],"fill-outline-color":["case",["boolean",["feature-state","hover"],!1],["get","hover_effects_outline-color"],["has","outline-color"],["get","outline-color"],"rgba(0,0,0,0)"]}};if("fill-extrusion"===e)return"1"===window.mapster_params.activated?{layout:{},paint:{"fill-extrusion-color":["case",["boolean",["feature-state","hover"],!1],["get","hover_effects_hover_color"],["has","color"],["get","color"],"#000"],"fill-extrusion-opacity":.75,"fill-extrusion-base":["case",["boolean",["feature-state","hover"],!1],["/",["to-number",["get","3d_polygon_base"]],100],["has","3d_polygon_base"],["to-number",["get","3d_polygon_base"]],0],"fill-extrusion-height":["case",["boolean",["feature-state","hover"],!1],["to-number",["get","3d_polygon_height"]],["has","3d_polygon_height"],["to-number",["get","3d_polygon_height"]],0]}}:{layout:{},paint:{}}}if("location"===t){if("circle"===e)return{layout:{},paint:{"circle-color":["case",["boolean",["feature-state","hover"],!1],["get","circle_hover_effects_hover_color"],["has","circle_color"],["get","circle_color"],"#000"],"circle-opacity":["case",["boolean",["feature-state","hover"],!1],["/",["to-number",["get","circle_hover_effects_hover_opacity"]],100],["has","circle_opacity"],["/",["to-number",["get","circle_opacity"]],100],1],"circle-radius":["case",["boolean",["feature-state","hover"],!1],["to-number",["get","circle_hover_effects_hover_radius"]],["has","circle_radius"],["to-number",["get","circle_radius"]],0],"circle-stroke-width":["case",["boolean",["feature-state","hover"],!1],["to-number",["get","circle_hover_effects_hover_stroke-width"]],["has","circle_stroke-width"],["to-number",["get","circle_stroke-width"]],0],"circle-stroke-color":["case",["boolean",["feature-state","hover"],!1],["get","circle_hover_effects_hover_stroke-color"],["has","circle_stroke-color"],["get","circle_stroke-color"],"#000"],"circle-stroke-opacity":["case",["boolean",["feature-state","hover"],!1],["/",["to-number",["get","circle_hover_effects_hover_stroke-opacity"]],100],["has","circle_stroke-opacity"],["/",["to-number",["get","circle_stroke-opacity"]],100],1]}};if("symbol"===e)return{layout:{"text-field":["case",["has","label_text_properties_text-field"],["get","label_text_properties_text-field"],"New Text"],"text-font":["case",["==","Open Sans Regular",["get","label_text_properties_text-font"]],["literal",["Open Sans Regular"]],["==","Open Sans Bold",["get","label_text_properties_text-font"]],["literal",["Open Sans Bold"]],["==","Open Sans Italic",["get","label_text_properties_text-font"]],["literal",["Open Sans Italic"]],["==","Klokantech Noto Sans Regular",["get","label_text_properties_text-font"]],["literal",["Klokantech Noto Sans Regular"]],["==","Klokantech Noto Sans Bold",["get","label_text_properties_text-font"]],["literal",["Klokantech Noto Sans Bold"]],["==","Klokantech Noto Sans Italic",["get","label_text_properties_text-font"]],["literal",["Klokantech Noto Sans Italic"]],["==","Metropolis",["get","label_text_properties_text-font"]],["literal",["Metropolis"]],["==","Metropolis Bold",["get","label_text_properties_text-font"]],["literal",["Metropolis Bold"]],["==","Metropolis Regular Italic",["get","label_text_properties_text-font"]],["literal",["Metropolis Regular Italic"]],["literal",["Open Sans Regular"]]],"text-rotate":["case",["has","label_text_properties_text-rotate"],["to-number",["get","label_text_properties_text-rotate"]],0],"text-size":["case",["==",!1,["get","label_label_on"]],0,["has","label_text_properties_text-size"],["to-number",["get","label_text_properties_text-size"]],16],"icon-size":["case",["==",!1,["get","icon_icon_on"]],0,["has","icon_icon_properties_icon-size"],["/",["to-number",["get","icon_icon_properties_icon-size"]],100],1],"icon-rotate":["case",["has","icon_icon_properties_icon-rotate"],["to-number",["get","icon_icon_properties_icon-rotate"]],0],"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-anchor":["case",["has","icon_icon_properties_icon-anchor"],["get","icon_icon_properties_icon-anchor"],"center"],"icon-offset":["case",["has","icon_icon_properties_offset_array"],["get","icon_icon_properties_offset_array"],["literal",[0,0]]],"text-offset":["case",["has","label_text_properties_offset_array"],["get","label_text_properties_offset_array"],["literal",[0,0]]]},paint:{"text-color":["case",["has","label_text_properties_text-color"],["get","label_text_properties_text-color"],"#000000"],"text-halo-width":["case",["has","label_text_properties_text-halo-width"],["to-number",["get","label_text_properties_text-halo-width"]],1],"text-halo-color":["case",["has","label_text_properties_text-halo-color"],["get","label_text_properties_text-halo-color"],"#FFFFFF"],"text-halo-blur":["case",["has","label_text_properties_text-halo-blur"],["/",["to-number",["get","label_text_properties_text-halo-blur"]],100],1],"text-opacity":["case",["has","label_text_properties_text-opacity"],["/",["to-number",["get","label_text_properties_text-opacity"]],100],1],"icon-opacity":["case",["has","icon_icon_properties_icon-opacity"],["/",["to-number",["get","icon_icon_properties_icon-opacity"]],100],1]}}}}addIcons(t,e,n){e.indexOf("symbol")>-1&&n.features.forEach((n=>{n.properties.icon_icon_on&&n.properties["icon_icon_properties_icon-image_url"]&&this.addNewIcon(t,n.properties["icon_icon_properties_icon-image_url"],n.properties["icon_icon_properties_icon-image_id"],(()=>{t.getLayer(e)&&t.setLayoutProperty(e,"icon-image",["case",["has","icon_icon_properties_icon-image_id"],["concat","icon-image-",["get","icon_icon_properties_icon-image_id"]],"none"])}))}))}addNewIcon(t,e,n,r){if(this.queuedImages.indexOf(`icon-image-${n}`)>-1)r();else{this.queuedImages.push(`icon-image-${n}`);e||r();"https:"===window.location.protocol&&e.indexOf("http://")>-1&&(e=e.replace("http","https"));var i=new Image;i.src=e;i.crossOrigin="";i.onload=function(){if(t.loaded()){t.hasImage(`icon-image-${n}`)?t.updateImage(`icon-image-${n}`,i):t.addImage(`icon-image-${n}`,i);r()}else t.once("idle",(()=>{t.hasImage(`icon-image-${n}`)?t.updateImage(`icon-image-${n}`,i):t.addImage(`icon-image-${n}`,i);r()}))}}}createLayerGeoJSON(t,e,n,r,i,o){var a={type:"FeatureCollection",features:[]};let s="line"===e?i:"location"===e?r:"polygon"===e?o:[],l=n.indexOf("-")>-1&&n.split("-")[1],c=n.indexOf("-")>-1?n.split("-")[0]:n;if("fill-extrusion"===n){c=n;l=!1}s.forEach((r=>{if(r.data[e]&&c===this.getLayerType(e,r.data)&&(!l||r.categories.find((t=>t.id===parseFloat(l))))){var i=this.makeFeatureJSON(r.data);if(i.features[0]){var o=this.makeFeatureWithProperties(r,i.features[0]);a.features.push(o)}r.data.open_popup_on_load&&-1===n.indexOf("-")&&setTimeout((()=>{if(t){const e=turf.pointOnFeature(i);t.fire("click",{lngLat:e.geometry.coordinates})}}),500)}}));return a}createMarkerGeoJSON(t,e){let n=!!e.indexOf("-")&&e.split("-")[1];var r={type:"FeatureCollection",features:[]};r.features=t.filter((t=>!n&&"marker"===t.data.location_style||!(!n||"marker"!==t.data.location_style||!t.categories.find((t=>t.id===parseFloat(n)))))).map((t=>{t.post_id=t.id;return{type:"Feature",properties:t,geometry:t.data.location}}));return r}makeFeatureWithProperties(t,e){var n=JSON.parse(JSON.stringify(e));n.id=t.id;n.properties.post_id=t.id;for(var r in t.data)-1===["polygon","line","location","popup","popup_style"].indexOf(r)&&this.assignToProperty(n,t.data,r);n.properties.dashed_line&&n.properties.dash_properties_dash_length&&(n.properties.dash_properties_line_dash_array=[parseFloat(n.properties.dash_properties_dash_length),parseFloat(n.properties.dash_properties_gap_length)]);(n.properties["label_text_properties_text-translate-x"]||n.properties["label_text_properties_text-translate-y"])&&(n.properties.label_text_properties_offset_array=[parseFloat(n.properties["label_text_properties_text-translate-x"]),parseFloat(n.properties["label_text_properties_text-translate-y"])]);(n.properties["icon_icon_properties_icon-translate-x"]||n.properties["icon_icon_properties_icon-translate-y"])&&(n.properties.icon_icon_properties_offset_array=[parseFloat(n.properties["icon_icon_properties_icon-translate-x"]),parseFloat(n.properties["icon_icon_properties_icon-translate-y"])]);return n}assignToProperty(t,e,n,r){if("object"==typeof e[n])for(var i in e[n])this.assignToProperty(t,e[n],i,r?r+"_"+n:n);else{var o=r?r+"_"+n:n;t.properties[o]=e[n]}}getLayerType(t,e){if("line"===t)return"line";if("polygon"===t){if(!e.polygon_style||"fill"===e.polygon_style)return"fill";if("fill-extrusion"===e.polygon_style)return"fill-extrusion"}if("location"===t){if("circle"===e.location_style)return"circle";if("label"===e.location_style)return"symbol"}}}class MapsterCore{constructor(){}setDataLayers(){}getPostData({post_id:t,single_feature_id:e}){const n=new MapsterHelpers;let r=e?`&single_feature_id=${e}`:"";return fetch(`${window.mapster_params.rest_url}mapster-wp-maps/map${window.mapster_params.qd}id=${t}${r}`).then((t=>t.json())).then((t=>n.formatResponse(t)))}getFeaturesAdmin({locations_ids:t,lines_ids:e,polygons_ids:n,cats:r}){const i=t.concat(e.concat(n));return fetch(`${window.mapster_params.rest_url}mapster-wp-maps/features${window.mapster_params.qd}ids=${JSON.stringify(i)}&categories=${JSON.stringify(r)}`).then((t=>t.json()))}sortLocations({adminFeatures:t}){return t.filter((t=>t.data.location))}sortLines({adminFeatures:t}){return t.filter((t=>t.data.line))}sortPolygons({adminFeatures:t}){return t.filter((t=>t.data.polygon))}doClustering({map:t,map_provider:e,cluster_options:n,circle_clustering:r,label_icon_clustering:i,marker_clustering:o,markers:a,locations:s,lines:l,polygons:c,idsToHide:u}){return(new MapsterHelpers).setClustering(t,e,n,r,i,o,a,s,l,c,u)}loadCustomScripts({map:t,javascript:e,locations:n,lines:r,polygons:i}){e&&window[e]&&(0,window[e])(t,n.concat(r.concat(i)))}setMapStyle({map:t,map_type:e}){const n=new MapsterHelpers;"custom-image"===e.map_provider?n.setCustomImageMap(t,e,!0):e.custom_style_json&&""!==e.custom_style_json?t.setStyle(JSON.parse(e.custom_style_json)):t.setStyle(n.getStyle(e))}loadProjection({map:t,map_provider:e,projection:n}){"mapbox"===e&&t.setProjection({name:n,center:[0,30],parallels:[30,30]})}loadTerrain({map:t,map_provider:e,terrain:n}){if("mapbox"===e)if(n){if(!t.getSource("mapbox-mapster-dem")){t.addSource("mapbox-mapster-dem",{type:"raster-dem",url:"mapbox://mapbox.mapbox-terrain-dem-v1",tileSize:512,maxzoom:14});t.setTerrain({source:"mapbox-mapster-dem",exaggeration:1.5});t.addLayer({id:"sky",type:"sky",paint:{"sky-type":"atmosphere","sky-atmosphere-sun":[0,0],"sky-atmosphere-sun-intensity":15}})}}else{t.getLayer("sky")&&t.removeLayer("sky");t.setTerrain(null);t.getSource("mapbox-mapster-dem")&&t.removeSource("mapbox-mapster-dem")}}layerClick({map:t,interactivity:e,clickedEvent:n,locations:r,lines:i,polygons:o}){if(e){let e=n.point?n.point:t.project(n.lngLat);var a=t.queryRenderedFeatures(e).filter((t=>["symbol","line","fill","circle"].indexOf(t.source.split("-")[0])>-1));return!(!a[0]||"fill"===a[0].layer.id&&("fill"!==a[0].layer.id||0===a[0].layer.paint["fill-opacity"]))&&r.concat(i.concat(o)).find((t=>t.id===a[0].properties.post_id))}return!1}storeLocatorClick({clickedFeature:t,store_locator_options:e}){const n=new MapsterHelpers;t&&t.data.enable_popup&&("click"===t.data.interaction||n.isMobile()&&t.data.click_on_mobile)&&n.openStoreLocatorClick(e,t.id)}sidebarClick({post_id:t,clickedFeature:e,minimum_sidebar_width:n,maximum_sidebar_width:r,store_locator_options:i,open_popups_in_sidebar:o}){const a=new MapsterHelpers;e&&e.data.enable_popup&&("click"===e.data.interaction||a.isMobile()&&e.data.click_on_mobile)&&a.openSidebarClick(i,o,e,n,r,t)}externalClickLayer({clickedFeature:t}){(new MapsterHelpers).openExternalLink(t)}externalClickMarker({clickedMarker:t}){(new MapsterHelpers).openExternalLink(t)}popupClick({map:t,mapLibrary:e,clickedPopup:n,clickedFeature:r,clickedEvent:i,store_locator_options:o,open_popups_in_sidebar:a}){const s=new MapsterHelpers;if(r&&r.data.enable_popup&&("click"===r.data.interaction||s.isMobile()&&r.data.click_on_mobile))return s.openPopup(t,e,n,r,i.lngLat,o,a)}layerHover({map:t,interactivity:e,hoveredEvent:n,locations:r,lines:i,polygons:o}){if(e){var a=t.queryRenderedFeatures(n.point).filter((t=>["symbol","line","fill","circle"].indexOf(t.source.split("-")[0])>-1));return!(!a[0]||"fill"===a[0].layer.id&&("fill"!==a[0].layer.id||0===a[0].layer.paint["fill-opacity"]))&&r.concat(i.concat(o)).find((t=>t.id===a[0].properties.post_id))}return!1}layerHoverEffect({map:t,interactivity:e,hoveredFeature:n}){const r=new MapsterHelpers;r.changeCursor(t,n,"on");
}popupHover({map:t,mapLibrary:e,hoveredPopup:n,hoveredFeature:r,hoveredEvent:i,store_locator_options:o}){const a=new MapsterHelpers;if(r&&r.data.enable_popup&&"hover"===r.data.interaction&&(!a.isMobile()||a.isMobile()&&r.data.click_on_mobile))return a.openPopup(t,e,n,r,i.lngLat,o)}markerClick({interactivity:t,clickedMarker:e}){return!!t&&e.mapsterProperties}markerHover({interactivity:t,hoveredMarker:e}){return!!t&&e.mapsterProperties}markerHoverEffect({map:t,mapLibrary:e,interactivity:n,hoveredMarker:r}){
}openMarkerClickPopup({map:t,mapLibrary:e,clickedMarker:n,clickedFeature:r,clickedPopup:i,store_locator_options:o,open_popups_in_sidebar:a}){const s=new MapsterHelpers;if(!o.enable&&!a&&r&&r.data.enable_popup&&("click"===r.data.interaction||s.isMobile()&&r.data.click_on_mobile)&&r.data.popup_style){const i=new e.Popup(s.returnPopupOptions(r.data));i.setHTML(s.getPopupHTML(r.id,r.data));s.centerPopup(t,i,r);n.setPopup(i)}}openMarkerHoverPopup({map:t,mapLibrary:e,hoveredMarker:n,hoveredFeature:r}){const i=new MapsterHelpers;if(r&&r.data.enable_popup&&"hover"===r.data.interaction&&!i.isMobile()&&r.data.popup_style&&!n.getPopup()){const o=new e.Popup(i.returnPopupOptions(r.data));o.setHTML(i.getPopupHTML(r.id,r.data));i.centerPopup(t,o,r);n.setPopup(o).togglePopup()}}markerHoverEffectOff({tempHoverMarker:t,hoveredMarker:e}){
}removeMarkerHoverPopup({hoveredMarker:t,hoveredFeature:e}){const n=new MapsterHelpers;e&&e.data.enable_popup&&"hover"===e.data.interaction&&!n.isMobile()&&(t&&!e.data.keep_popup_open_on_hover?t.setPopup(null):t&&e.data.keep_popup_open_on_hover&&jQuery(document).on("mousemove.mapster",(function(t){let r=jQuery(`.mapster-feature-popup-${e.id}`).closest(".mapboxgl-popup");n.mouseIsNear(r,2,t)?r.one("mouseleave",(function(){jQuery(document).off("mousemove.mapster")})):jQuery(document).off("mousemove.mapster")})))}layerHoverEffectOff({map:t,interactivity:e,hoveredFeature:n}){const r=new MapsterHelpers;r.changeCursor(t,n,"off");
}removePopupHover({hoveredFeature:t,hoveredPopup:e}){e&&!t.data.keep_popup_open_on_hover?e.remove():e&&t.data.keep_popup_open_on_hover&&jQuery(document).one("mousemove",(function(n){let r=jQuery(`.mapster-feature-popup-${t.id}`).closest(".mapboxgl-popup:hover");r.length?r.one("mouseleave",(function(){e.remove()})):e.remove()}))}setInteractivity({map:t,zoom_on_scroll:e,interactivity:n,allow_rotation_and_pitch:r}){e||t.scrollZoom.disable();if(!n){t.scrollZoom.disable();t.boxZoom.disable();t.dragRotate.disable();t.dragPan.disable();t.keyboard.disable();t.doubleClickZoom.disable();t.touchZoomRotate.disable()}if(n&&!r){t.dragRotate.disable();t.touchZoomRotate.disable()}}setFeaturesToMap({map:t,map_provider:e,locations:n,lines:r,polygons:i}){const o=new MapsterHelpers;[["line","line"],["polygon","fill"],["polygon","fill-extrusion"],["location","circle"],["location","symbol"],["location","3d-model"]].forEach((a=>{var s=o.createLayerGeoJSON(t,a[0],a[1],n,r,i);if("3d-model"!==a[1])if(t.getSource(a[1])){t.getSource(a[1]).setData(s);o.addIcons(t,a[1],s)}else{t.addSource(a[1],{type:"geojson",data:s});var l=o.getLayerExpressions(a[0],a[1],e);t.addLayer({id:a[1],source:a[1],type:a[1],paint:l.paint,layout:l.layout});o.addIcons(t,a[1],s)}else o.create3DModels(t,n)}))}setMarkersToMap({map:t,markers:e,mapLibrary:n,locations:r,marker_clustering:i}){const o=new MapsterHelpers;let a=[];e.forEach((t=>{r.find((e=>e.id===t.id))?a.push(t):t.remove()}));let s=[];s=s.concat(a);const l=r.filter((t=>"marker"===t.data.location_style));let c=[];l.sort(((t,e)=>{if(t.data.location.coordinates&&e.data.location.coordinates)return t.data.location.coordinates[1]>e.data.location.coordinates[1]?-1:1;if(!t.data.location.coordinates&&-1===c.indexOf(t.title)){alert(`A point is missing coordinates. See ${t.title}.`);c.push(t.title)}if(!e.data.location.coordinates&&-1===c.indexOf(e.title)){alert(`A point is missing coordinates. See ${e.title}.`);c.push(e.title)}}));l.forEach((e=>{if(!a.find((t=>t.mapsterProperties.id===e.id))){var r=o.getMarkerStyles(e),l=o.makeFeatureJSON(e.data).features[0].geometry.coordinates,c=new n.Marker(r).setLngLat(l);c.mapsterProperties=e;i||c.addTo(t);s.push(c);e.data.open_popup_on_load&&setTimeout((()=>{jQuery(c.getElement()).click()}),100)}}));return s}setHeatmap({map:t,mapLibrary:e,markers:n,locations:r,heatmap:i}){
}setMapSize({post_id:t,layout:e}){var n="#mapster-wp-maps-"+t;const r=new MapsterHelpers;if(!e.full_page){jQuery(n).height(e.height+e.height_units);jQuery(n).width(e.width+e.width_units);r.setMapBreakpointSizes(t,e)}if(e.full_page){jQuery(n).height(window.innerHeight+e.height_units);jQuery(n).width("100%")}if(e.full_page&&e.ignore_container){jQuery(`<div id="margin-compensator" style="padding-bottom: ${window.innerHeight}px"></div>`).insertAfter(n);jQuery(n).css("marginLeft",-1*jQuery(n).offset().left+"px");jQuery(n).width(window.innerWidth+"px");jQuery(n).css("position","absolute")}}setMapMoveEndVariables({map:t}){jQuery('.acf-field[data-name="manual_pitch"]').find(".acf-label label").html(`Manual Pitch <i>(currently: ${t.getPitch()})</i>`);jQuery('.acf-field[data-name="manual_zoom"]').find(".acf-label label").html(`Manual Zoom <i>(currently: ${t.getZoom()})</i>`);jQuery('.acf-field[data-name="manual_rotation"]').find(".acf-label label").html(`Manual Rotation <i>(currently: ${t.getBearing()})</i>`);const{lng:e,lat:n}=t.getCenter();jQuery('.acf-field[data-name="manual_latitude"]').find(".acf-label label").html(`Manual Latitude <i>(currently: ${n})</i>`);jQuery('.acf-field[data-name="manual_longitude"]').find(".acf-label label").html(`Manual Longitude <i>(currently: ${e})</i>`)}setDefaultAccessToken(){""===jQuery('.acf-field[data-name="access_token"]').find(":input").val()&&jQuery('.acf-field[data-name="access_token"]').find(":input").val(window.mapster_params.mapbox_access_token)}setMapType({map_type:t}){if("mapbox"!==t.map_provider){""!==t.access_token&&(maplibregl.accessToken=t.access_token);return maplibregl}if(""!==t.access_token){mapboxgl.accessToken=t.access_token;return mapboxgl}window.alert(window.mapster_params.strings["Mapbox Token Warning"])}setSubmissionModal({post_id:t,map:e,mapLibrary:n,submission:r}){const i=new MapsterHelpers;jQuery(document).on("click",`#mapster-submit-${t}`,(function(){const o=jQuery(this).data("type"),a=jQuery(this).data("header");jQuery(`.mapster-submit-${t} .mapster-submission-modal-title`).text(a);jQuery(`.mapster-submit-${t} #mapster-submission-modal-overlay-${t}`).parent().detach().appendTo("body");jQuery(`.mapster-submit-${t} #mapster-submission-modal-${t}`).parent().detach().appendTo("body");r.submission_interface.categories.length>0?fetch(`${window.mapster_params.rest_url}mapster-wp-maps/submission-info${window.mapster_params.qd}categories=${r.submission_interface.categories.join(",")}`).then((t=>t.json())).then((a=>{i.loadModalSteps(t,e,n,o,a,r)})):i.loadModalSteps(t,e,n,o,!1,r)}));jQuery(document).on("click",".mapster-submission-modal-close",(function(){jQuery(".mapster-submission-modal-overlay").fadeOut(50);jQuery(".mapster-submission-modal").fadeOut(100)}))}setMap({post_id:t,mapLibrary:e,map:n,locations:r,lines:i,polygons:o}){var a="mapster-wp-maps-"+t;const s=new MapsterHelpers;let l=!0,c="manual"===n.view.initial_load?[parseFloat(n.view.manual_longitude),parseFloat(n.view.manual_latitude)]:s.getDefaultCenter();if(jQuery(`#${a}`).data("latitude")&&"null"!==jQuery(`#${a}`).data("latitude")&&jQuery(`#${a}`).data("longitude")&&"null"!==jQuery(`#${a}`).data("longitude")){c=[parseFloat(jQuery(`#${a}`).data("longitude")),parseFloat(jQuery(`#${a}`).data("latitude"))];l=!1}let u="manual"===n.view.initial_load?parseFloat(n.view.manual_zoom):s.getDefaultZoom();if(jQuery(`#${a}`).data("zoom")&&"null"!==jQuery(`#${a}`).data("zoom")){u=parseFloat(jQuery(`#${a}`).data("zoom"));l=!1}const p={renderWorldCopies:n.layout.duplicate_horizontally,style:s.getStyle(n.map_type),container:a,fitBoundsOptions:{padding:20,maxZoom:18},projection:{name:n.map_type.projection?n.map_type.projection:"mercator",center:[0,30],parallels:[30,30]},bounds:"fit-features"===n.view.initial_load&&l?s.getMapBounds(r,i,o):null,center:c,zoom:u,pitch:n.view.manual_pitch?parseFloat(n.view.manual_pitch):0,bearing:n.view.manual_rotation?parseFloat(n.view.manual_rotation):0,attributionControl:!1,logoPosition:n.logo_control?n.logo_control.position:"bottom-left"};if("1"===window.mapster_params.activated&&n.restricted_movement.restrict_movement){let t=n.restricted_movement.allowed_bounds.southwest_longitude,e=n.restricted_movement.allowed_bounds.southwest_latitude,r=n.restricted_movement.allowed_bounds.northeast_longitude,i=n.restricted_movement.allowed_bounds.northeast_latitude;if(""!==t&&""!==e&&""!==r&&""!==i){let n=[[parseFloat(t),parseFloat(e)],[parseFloat(r),parseFloat(i)]];p.maxBounds=n}let o=n.restricted_movement.allowed_zoom.min_zoom;""!==o&&(p.minZoom=parseFloat(o));let a=n.restricted_movement.allowed_zoom.max_zoom;""!==a&&(p.maxZoom=parseFloat(a))}const h=new e.Map(p);n.map_type.custom_style_json&&""!==n.map_type.custom_style_json&&h.setStyle(JSON.parse(n.map_type.custom_style_json));"custom-image"===n.map_type.map_provider&&s.setCustomImageMap(h,n.map_type);n.map_compare&&n.map_compare.enable_map_slider&&n.map_compare.compared_map&&s.setMapCompare(e,h,t,n.map_compare);window[`mapsterMap${t}`]=h;s.setProjectionGlobe(h,n.map_type);jQuery(".mapster-wp-maps-loader-container").hide();return h}setLoader({post_id:t}){const e=new MapsterConstants;jQuery("#mapster-wp-maps-"+t).append(e.loaderHTML())}setLoaderDone({post_id:t}){jQuery("#mapster-wp-maps-"+t+" .mapster-map-loader").fadeOut()}setMapResize({map:t}){t.resize()}setStreetViewControl(){}setMapTypeControl(){}setZoomControl({map:t,mapLibrary:e,controls:n,zoom_control:r}){return(new MapsterHelpers).addMapControl(t,n.zoomControl,r.enable,r.position,e.NavigationControl)}setAttributionControl({map:t,mapLibrary:e,controls:n,attribution_control:r,map_type:i}){}setElevationControl({map:t,mapLibrary:e,controls:n,elevation_line_chart:r,post_id:i,lines:o}){
}set3DControl(t){const{map:e,mapLibrary:n,controls:r}=t;return(new MapsterHelpers).addMapControl(e,r["3dControl"],t["3d_control"].enable,t["3d_control"].position,PitchToggle)}setScaleControl({map:t,mapLibrary:e,controls:n,scale_control:r}){return(new MapsterHelpers).addMapControl(t,n.scaleControl,r.enable,r.position,e.ScaleControl)}setGeolocationControl({map:t,mapLibrary:e,controls:n,geolocation_control:r}){const i=new MapsterHelpers,o={showAccuracyCircle:r.show_accuracy_circle,showUserHeading:r.show_user_heading,trackUserLocation:r.show_user_heading||r.track_user_location},a=i.addMapControl(t,n.geolocationControl,r.enable,r.position,e.GeolocateControl,o);i.setGeolocationOnLoad(r);return a}setFullscreenControl({map:t,mapLibrary:e,controls:n,fullscreen_control:r}){return(new MapsterHelpers).addMapControl(t,n.fullscreenControl,r.enable,r.position,e.FullscreenControl)}setGeocoderControl({map:t,mapLibrary:e,controls:n,geocoder_control:r}){const i=new MapsterHelpers;if("undefined"!=typeof MapboxGeocoder){var o={accessToken:e.accessToken,mapboxgl:e,placeholder:r.placeholder};return i.addMapControl(t,n.geocoderControl,r.enable,r.position,MapboxGeocoder,o)}}setDirectionsControl({map:t,mapLibrary:e,controls:n,directions_control:r}){if("undefined"!=typeof MapboxDirections){const o=new MapsterHelpers;var i={accessToken:e.accessToken,mapboxgl:e,unit:r.unit,profile:r.profile,placeholderOrigin:r.placeholderOrigin};return o.addMapControl(t,n.directionsControl,r.enable,r.position,MapboxDirections,i)}}setCustomSearchFilterControl({map:t,mapLibrary:e,controls:n,custom_search_filter:r,locations:i,lines:o,polygons:a,markers:s}){const l=new MapsterHelpers;if("undefined"!=typeof MapboxGeocoder){var c={mapboxgl:e,marker:!1,placeholder:r.placeholder};r.include_geocoder?c.accessToken=e.accessToken:c.localGeocoderOnly=!0;""!==r.limit_results&&(c.countries=r.limit_results);(c=l.applyProSearchFilter(r,c)).localGeocoder=t=>l.searchLocalFeatures(r.search_type,t,i,o,a);const u=l.addMapControl(t,n.customSearchControl,r.enable,r.position,MapboxGeocoder,c);if(u){u.on("result",(({result:t})=>{var n=document.createElement("div");n.innerHTML=t.place_name;jQuery(u._inputEl).val(n.innerHTML);const r=s.find((e=>e.mapsterProperties.id===t.id));r&&r.mapsterProperties.data.enable_popup&&r.setPopup(new e.Popup(l.returnPopupOptions(r.mapsterProperties.data)).setHTML(l.getPopupHTML(r.mapsterProperties.id,r.mapsterProperties.data))).togglePopup()}));return u}}}setFilterDropdownControl({map:t,mapLibrary:e,controls:n,filter_dropdown:r,locations:i,lines:o,polygons:a,markers:s}){const l=new MapsterHelpers;if("undefined"!=typeof MapboxGeocoder){var c={mapboxgl:e,localGeocoderOnly:!0,marker:!1,placeholder:r.placeholder,minLength:0,limit:1e3,localGeocoder:t=>l.searchLocalFeatures("exact-match",t,i,o,a)};const u=l.addMapControl(t,n.filterDropdownControl,r.enable,r.position,MapboxGeocoder,c);if(u){r.enable&&l.modifyDropdown(u);u.on("result",(t=>{const n=s.find((e=>e.mapsterProperties.id===t.result.id));n&&n.mapsterProperties.data.enable_popup&&n.setPopup(new e.Popup(l.returnPopupOptions(n.mapsterProperties.data)).setHTML(l.getPopupHTML(n.mapsterProperties.id,n.mapsterProperties.data))).togglePopup()}))}return u}}setCategoryFilterControl({map:t,mapLibrary:e,controls:n,cluster_options:r,category_filter:i,markers:o,dataLayers:a,locations:s,lines:l,polygons:c,map_provider:u,label_icon_clustering:p,circle_clustering:h,marker_clustering:d}){new MapsterHelpers;const f={functionality:i.functionality,independent_children:i.independent_children,initial_visibility:i.initial_visibility,category_display:i.category_display,checkbox_display:i.checkbox_display,pre_selected_categories:i.pre_selected_categories,additional_filters:i.additional_filters,accordion_layout:i.accordion_layout,excluded_categories:i.excluded_categories,show_number_of_features:i.show_number_of_features};n.categoryFilterControl&&t.removeControl(n.categoryFilterControl);if(i.enable){const e=new CategoryControl(f,r,o,a,s,l,c,u,h,p,d);""!==i.render_in_external_div&&document.getElementById(i.render_in_external_div)?document.getElementById(i.render_in_external_div).appendChild(e.onAdd(t)):t.addControl(e,i.position);return e}return!1}setListControl({map:t,mapLibrary:e,controls:n,list:r,locations:i,lines:o,polygons:a,markers:s}){new MapsterHelpers;n.listControl&&t.removeControl(n.listControl);if(r.enable){const n=new ListControl(r,i,o,a,s,e);t.addControl(n,r.position);return n}return!1}setDownloadControl({map:t,mapLibrary:e,controls:n,download_control:r,locations:i,lines:o,polygons:a}){
}setCustomHTMLControl({map:t,mapLibrary:e,controls:n,custom_html_control:r}){
}setLayerControl({map:t,mapLibrary:e,controls:n,layer_control:r}){
}setStyleControl({map:t,mapLibrary:e,controls:n,style_control:r}){
}setListingPosts({post_id:t,map:e,listing_page:n,locations:r,lines:i,polygons:o}){
}setJqueryEvents(){
}}class MapsterContainer{constructor(t,e,n){this.core={};this.MapsterMap=n;this.post_id=t;this.single_feature_id=e;this.postResponse;this.mapLibrary;this.markers=[];this.controls=[];this.clusterLayers=[];this.clickedEvent;this.clickedFeature;this.clickedPopup;this.clickedMarker;this.hoveredEvent;this.hoveredFeature;this.hoveredPopup;this.hoveredMarker;this.tempHoverMarker;this.map;this.postResponseAdmin;this.adminFeatures;this.dataLayers;this.defineCore()}defineCore(){const t=new MapsterCore;this.core.set_accesstokendefault={args:[],hook:"access_token_set",func:t.setDefaultAccessToken};this.core.define_postResponse={args:["post_id","single_feature_id"],hook:"data_fetched",func:t.getPostData,promise:!0};this.core.set_mapSize={args:["post_id","postResponse.map.layout"],hook:"map_size_set",func:t.setMapSize};this.core.define_mapLibrary={args:["postResponse.map.map_type"],hook:"map_library_set",func:t.setMapType};this.core.set_submissionModal={args:["post_id","map","mapLibrary","postResponse.map.submission"],hook:"submission_modal_initialized",func:t.setSubmissionModal};this.core.define_map={args:["post_id","mapLibrary","postResponse.map","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"map_set",func:t.setMap};this.core.set_moveendVariables={args:["map"],hook:"map_moveend",func:t.setMapMoveEndVariables};this.core.set_jquery_events={args:[],hook:"jquery_events_set",func:t.setJqueryEvents};this.core.set_loader={args:["post_id"],hook:"loading_icon_started",func:t.setLoader};this.core.set_loaderdone={args:["post_id"],hook:"loading_icon_done",func:t.setLoaderDone};this.core.set_mapresize={args:["map"],hook:"map_resize_set",func:t.setMapResize};this.core.set_listingposts={args:["post_id","map","postResponse.map.listing_page","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"map_set_listing_posts",func:t.setListingPosts};this.core.define_dataLayers={args:["map","postResponse.map.map_type.map_provider","dataLayers","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"map_datalayers_set",func:t.setDataLayers,callback:this.MapsterMap.setDataLayerEvents};this.core.set_mapfeatures={args:["map","postResponse.map.map_type.map_provider","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"map_features_set",func:t.setFeaturesToMap,callback:this.MapsterMap.setLayerEvents};this.core.define_markers={args:["map","markers","mapLibrary","postResponse.locations","postResponse.map.marker_clustering"],hook:"map_markers_set",func:t.setMarkersToMap,callback:this.MapsterMap.setMarkerEvents};this.core.set_heatmap={args:["map","markers","postResponse.locations","postResponse.map.heatmap"],hook:"map_heatmap_set",func:t.setHeatmap};this.core["define_controls.elevationControl"]={args:["map","mapLibrary","controls","postResponse.map.elevation_line_chart","post_id","postResponse.lines"],hook:"elevation_control_set",func:t.setElevationControl};this.core["define_controls.zoomControl"]={args:["map","mapLibrary","controls","postResponse.map.zoom_control"],hook:"zoom_control_set",func:t.setZoomControl};this.core["define_controls.attributionControl"]={args:["map","mapLibrary","controls","postResponse.map.attribution_control","postResponse.map.map_type"],hook:"attribution_control_set",func:t.setAttributionControl};this.core["define_controls.streetViewControl"]={args:["map","mapLibrary","controls","postResponse.map.street_view_control"],hook:"street_view_control_set",func:t.setStreetViewControl};this.core["define_controls.mapTypeControl"]={args:["map","mapLibrary","controls","postResponse.map.map_type_control"],hook:"map_type_control_set",func:t.setMapTypeControl};this.core["define_controls.geocoderControl"]={args:["map","mapLibrary","controls","postResponse.map.geocoder_control"],hook:"geocoder_control_set",func:t.setGeocoderControl};this.core["define_controls.directionsControl"]={args:["map","mapLibrary","controls","postResponse.map.directions_control"],hook:"directions_control_set",func:t.setDirectionsControl};this.core["define_controls.3dControl"]={args:["map","mapLibrary","controls","postResponse.map.3d_control"],hook:"3d_control_set",func:t.set3DControl};this.core["define_controls.scaleControl"]={args:["map","mapLibrary","controls","postResponse.map.scale_control"],hook:"scale_control_set",func:t.setScaleControl};this.core["define_controls.geolocationControl"]={args:["map","mapLibrary","controls","postResponse.map.geolocation_control"],hook:"geolocation_control_set",func:t.setGeolocationControl};this.core["define_controls.fullscreenControl"]={args:["map","mapLibrary","controls","postResponse.map.fullscreen_control"],hook:"fullscreen_control_set",func:t.setFullscreenControl};this.core["define_controls.downloadControl"]={args:["map","mapLibrary","controls","postResponse.map.download_control","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"download_control_set",func:t.setDownloadControl};this.core["define_controls.customHTMLControl"]={args:["map","mapLibrary","controls","postResponse.map.custom_html_control"],hook:"custom_html_control_set",func:t.setCustomHTMLControl};this.core["define_controls.layerControl"]={args:["map","mapLibrary","controls","postResponse.map.layer_control"],hook:"layer_control_set",func:t.setLayerControl};this.core["define_controls.styleControl"]={args:["map","mapLibrary","controls","postResponse.map.style_control"],hook:"style_control_set",func:t.setStyleControl};this.core["define_controls.customSearchControl"]={args:["map","mapLibrary","controls","postResponse.map.filter.custom_search_filter","postResponse.locations","postResponse.lines","postResponse.polygons","markers"],hook:"customSearch_control_set",func:t.setCustomSearchFilterControl};this.core["define_controls.filterDropdownControl"]={args:["map","mapLibrary","controls","postResponse.map.filter.filter_dropdown","postResponse.locations","postResponse.lines","postResponse.polygons","markers"],hook:"filterDropdown_control_set",func:t.setFilterDropdownControl};this.core["define_controls.categoryFilterControl"]={args:["map","mapLibrary","controls","postResponse.map.cluster_options","postResponse.map.filter.category_filter","markers","dataLayers","postResponse.locations","postResponse.lines","postResponse.polygons","postResponse.map.map_type.map_provider","postResponse.map.circle_clustering","postResponse.map.label_icon_clustering","postResponse.map.marker_clustering"],hook:"categoryFilter_control_set",func:t.setCategoryFilterControl};this.core["define_controls.listControl"]={args:["map","mapLibrary","controls","postResponse.map.list","postResponse.locations","postResponse.lines","postResponse.polygons","markers"],hook:"list_control_set",func:t.setListControl};this.core.define_clusterLayers={args:["map","postResponse.map.map_type.map_provider","postResponse.map.cluster_options","postResponse.map.circle_clustering","postResponse.map.label_icon_clustering","postResponse.map.marker_clustering","markers","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"map_clustering_set",func:t.doClustering,callback:this.MapsterMap.setDynamicLayerEvents};this.core.set_customscripts={args:["map","postResponse.map.javascript","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"custom_scripts_set",func:t.loadCustomScripts};this.core.set_interactivity={args:["map","postResponse.map.zoom_on_scroll","postResponse.map.interactivity","postResponse.map.allow_rotation_and_pitch"],hook:"interactivity_set",func:t.setInteractivity};this.core.set_mapstyle={args:["map","postResponse.map.map_type"],hook:"map_style_set",func:t.setMapStyle,callback:this.MapsterMap.idleReload};this.core.set_terrain={args:["map","postResponse.map.map_type.map_provider","postResponse.map.map_type.terrain"],hook:"map_terrain_set",func:t.loadTerrain};this.core.set_projection={args:["map","postResponse.map.map_type.map_provider","postResponse.map.map_type.projection"],hook:"map_projection_set",func:t.loadProjection};this.core.define_clickedFeature={args:["map","postResponse.map.interactivity","clickedEvent","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"layer_feature_clicked",func:t.layerClick};this.core.set_storelocatorclick={args:["clickedFeature","postResponse.map.list.store_locator_options"],hook:"",func:t.storeLocatorClick};this.core.set_sidebarclick={args:["post_id","clickedFeature","postResponse.map.minimum_sidebar_width","postResponse.map.maximum_sidebar_width","postResponse.map.list.store_locator_options","postResponse.map.open_popups_in_sidebar"],hook:"",func:t.sidebarClick};this.core.define_clickedPopup={args:["map","mapLibrary","clickedPopup","clickedFeature","clickedEvent","postResponse.map.list.store_locator_options","postResponse.map.open_popups_in_sidebar"],hook:"popup_opened_from_layer_click",func:t.popupClick};this.core.define_hoveredFeature={args:["map","postResponse.map.interactivity","hoveredEvent","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"layer_feature_hovered",func:t.layerHover};this.core.set_hoverEffects={args:["map","postResponse.map.interactivity","hoveredFeature","dataLayers"],hook:"",func:t.layerHoverEffect};this.core.define_hoveredPopup={args:["map","mapLibrary","hoveredPopup","hoveredFeature","hoveredEvent","postResponse.map.list.store_locator_options","postResponse.map.open_popups_in_sidebar"],hook:"popup_opened_from_layer_hover",func:t.popupHover};this.core.set_hoverEffectsOff={args:["map","postResponse.map.interactivity","hoveredFeature","dataLayers"],hook:"",func:t.layerHoverEffectOff};this.core.set_hoveredPopupOff={args:["hoveredFeature","hoveredPopup"],hook:"popup_closed_from_layer_hover",func:t.removePopupHover};this.core.set_externallink={args:["clickedFeature"],hook:"external_link_opened",func:t.externalClickLayer};this.core.define_clickedFeature_fromMarker={args:["clickedMarker","postResponse.map.interactivity"],hook:"marker_feature_clicked",func:t.markerClick};this.core.define_hoveredFeature_fromMarker={args:["hoveredMarker","postResponse.map.interactivity"],hook:"marker_feature_hovered",func:t.markerHover};this.core.define_tempHoverMarker={args:["map","mapLibrary","postResponse.map.interactivity","hoveredMarker"],hook:"",func:t.markerHoverEffect};this.core.define_clickedPopup_fromMarker={args:["map","mapLibrary","clickedMarker","clickedFeature","clickedPopup","postResponse.map.list.store_locator_options","postResponse.map.open_popups_in_sidebar"],hook:"popup_opened_from_marker_click",func:t.openMarkerClickPopup};this.core.define_hoveredPopup_fromMarker={args:["map","mapLibrary","hoveredMarker","hoveredFeature","hoveredPopup"],hook:"popup_opened_from_marker_hover",func:t.openMarkerHoverPopup};this.core.set_hoverEffectsOff_fromMarker={args:["tempHoverMarker","hoveredMarker"],hook:"",func:t.markerHoverEffectOff};this.core.set_hoveredPopupOff_fromMarker={args:["hoveredMarker","hoveredFeature","hoveredPopup"],hook:"popup_closed_from_marker_hover",func:t.removeMarkerHoverPopup};this.core.define_adminFeatures={args:["postResponseAdmin.locations_ids","postResponseAdmin.lines_ids","postResponseAdmin.polygons_ids","postResponse.cats"],hook:"",func:t.getFeaturesAdmin,promise:!0};this.core["define_postResponse.locations"]={args:["adminFeatures"],hook:"locations_fetched",func:t.sortLocations};this.core["define_postResponse.lines"]={args:["adminFeatures"],hook:"lines_fetched",func:t.sortLines};this.core["define_postResponse.polygons"]={args:["adminFeatures"],hook:"polygons_fetched",func:t.sortPolygons}}doCore(t){let e=this.core[t].args,n=this.core[t].func,r={};for(var i=0;i<e.length;i++){let t=e[i].split(".");r[t[t.length-1]]=this.getObjectProperty(this,e[i])}if(this.core[t].promise)return Promise.resolve(n(r)).then((e=>{this.defineThisObject(t,e);this.core[t].callback&&this.core[t].callback(this,this.MapsterMap);this.core[t].hook&&this.MapsterMap.runHookActions(t,e)}));{const e=n(r);this.defineThisObject(t,e);this.core[t].callback&&this.core[t].callback(this,this.MapsterMap);this.core[t].hook&&this.MapsterMap.runHookActions(t,e);return e}}registerListener(t,e,n,r){this.setStarterValue(t,e,n);jQuery(document).on("change","select"!==e?t:t.replace("select",":input"),(()=>{"check"===e&&this.setObjectProperty(this,n,jQuery(t).is(":checked"));"val"===e&&this.setObjectProperty(this,n,jQuery(t).val());"select"===e&&this.setObjectProperty(this,n,jQuery(t).select2("data").map((t=>t.id)));if(r&&r.length>0)for(var i=0;i<r.length;i++){if(this.core[r[i]].promise){this.MapsterMap.doCoreAndRunActions(r[i]).then((()=>{for(var t=i+1;t<r.length;t++)this.MapsterMap.doCoreAndRunActions(r[t])}));break}this.MapsterMap.doCoreAndRunActions(r[i])}}))}setStarterValue(t,e,n){"check"===e&&this.setObjectProperty(this,n,jQuery(t).is(":checked"));"val"===e&&this.setObjectProperty(this,n,jQuery(t).val());"select"===e&&this.setObjectProperty(this,n,jQuery(t).select2("data").map((t=>t.id)))}defineThisObject(t,e){t.indexOf("define_")>-1&&this.setObjectProperty(this,t.split("_")[1],e)}getObjectProperty(t,e){return e.split(".").reduce(((t,e)=>t?.[e]),t)}setObjectProperty(t,e,n){e.split(".").reduce(((t,r)=>{r===e.split(".")[e.split(".").length-1]&&(t[r]=n);void 0===t[r]&&(r===e.split(".")[e.split(".").length-1]?t[r]="":t[r]={});return t?.[r]}),t)}}class MapsterMap{constructor(t,e,n){this.MapsterContainer=new MapsterContainer(t,n,this);this.post_id=t;this.isPublic=e;this.dynamicLayerListenersSet=!1;this.isPublic||this.registerAdminEventListeners()}preInitMap(){return this.isPublic?this.doCoreAndRunActions("define_postResponse"):this.doCoreAndRunActions("define_adminFeatures")}init(){this.preInitMap().then((()=>{if(!this.isPublic){this.doCoreAndRunActions("set_accesstokendefault");this.doCoreAndRunActions("define_postResponse.locations");this.doCoreAndRunActions("define_postResponse.lines");this.doCoreAndRunActions("define_postResponse.polygons")}this.initMap();this.MapsterContainer.map.on("load",(()=>{this.postLoad();this.setMoveEvents(this.MapsterContainer.map)}));this.MapsterContainer.map.on("mapster_custom_style_load",(()=>{this.postStyleSwitch(this.MapsterContainer,this)}))}))}initMap(){this.isPublic&&this.doCoreAndRunActions("set_mapSize");this.doCoreAndRunActions("define_mapLibrary");this.doCoreAndRunActions("define_map");this.doCoreAndRunActions("set_jquery_events");this.doCoreAndRunActions("set_loader");if(this.isPublic){this.doCoreAndRunActions("set_submissionModal");this.doCoreAndRunActions("set_interactivity");this.doCoreAndRunActions("set_listingposts")}}postLoad(){this.doCoreAndRunActions("set_mapresize");this.doCoreAndRunActions("set_terrain");this.doCoreAndRunActions("set_mapfeatures");this.doCoreAndRunActions("define_dataLayers");this.doCoreAndRunActions("define_markers");this.doCoreAndRunActions("set_heatmap");this.setControls();this.isPublic&&this.doCoreAndRunActions("define_clusterLayers");this.doCoreAndRunActions("set_loaderdone");this.doCoreAndRunActions("set_customscripts")}setControls(){this.doCoreAndRunActions("define_controls.zoomControl");this.doCoreAndRunActions("define_controls.mapTypeControl");this.doCoreAndRunActions("define_controls.streetViewControl");this.doCoreAndRunActions("define_controls.attributionControl");this.doCoreAndRunActions("define_controls.geocoderControl");this.doCoreAndRunActions("define_controls.directionsControl");this.doCoreAndRunActions("define_controls.3dControl");this.doCoreAndRunActions("define_controls.scaleControl");this.doCoreAndRunActions("define_controls.geolocationControl");this.doCoreAndRunActions("define_controls.fullscreenControl");this.doCoreAndRunActions("define_controls.downloadControl");this.doCoreAndRunActions("define_controls.customHTMLControl");this.doCoreAndRunActions("define_controls.layerControl");this.doCoreAndRunActions("define_controls.styleControl");this.doCoreAndRunActions("define_controls.customSearchControl");this.doCoreAndRunActions("define_controls.filterDropdownControl");this.doCoreAndRunActions("define_controls.categoryFilterControl");this.doCoreAndRunActions("define_controls.elevationControl");this.doCoreAndRunActions("define_controls.listControl")}idleReload(t,e){t.map.once("idle",(()=>{e.doCoreAndRunActions("set_loader");e.doCoreAndRunActions("set_terrain");e.doCoreAndRunActions("set_mapfeatures");e.doCoreAndRunActions("define_dataLayers");e.doCoreAndRunActions("define_markers");e.doCoreAndRunActions("define_clusterLayers");e.doCoreAndRunActions("set_loaderdone")}))}postStyleSwitch(t,e){t.map.once("idle",(()=>{e.doCoreAndRunActions("set_terrain");e.doCoreAndRunActions("set_mapfeatures");e.doCoreAndRunActions("define_dataLayers");e.doCoreAndRunActions("define_markers");e.doCoreAndRunActions("define_clusterLayers")}))}setLayerEvents(t,e){["symbol","circle","line","fill"].forEach((n=>{t.map.on("click",n,(n=>{t.clickedEvent=n;e.doCoreAndRunActions("define_clickedFeature");e.doCoreAndRunActions("set_storelocatorclick");e.doCoreAndRunActions("set_sidebarclick");e.doCoreAndRunActions("set_externallink");e.doCoreAndRunActions("define_clickedPopup")}));t.map.on("mousemove",n,(n=>{t.hoveredEvent=n;e.doCoreAndRunActions("define_hoveredFeature");e.doCoreAndRunActions("set_hoverEffects");e.doCoreAndRunActions("define_hoveredPopup")}));t.map.on("mouseout",n,(t=>{e.doCoreAndRunActions("set_hoverEffectsOff");e.doCoreAndRunActions("set_hoveredPopupOff")}))}))}setDynamicLayerEvents(t,e){if(t.clusterLayers.length>0&&!this.dynamicLayerListenersSet){t.clusterLayers.forEach((n=>{if(n.indexOf("-")>-1){t.map.on("click",n,(n=>{t.clickedEvent=n;e.doCoreAndRunActions("define_clickedFeature");e.doCoreAndRunActions("set_storelocatorclick");e.doCoreAndRunActions("set_sidebarclick");e.doCoreAndRunActions("set_externallink");e.doCoreAndRunActions("define_clickedPopup")}));t.map.on("mousemove",n,(n=>{t.hoveredEvent=n;e.doCoreAndRunActions("define_hoveredFeature");e.doCoreAndRunActions("set_hoverEffects");e.doCoreAndRunActions("define_hoveredPopup")}));t.map.on("mouseout",n,(t=>{e.doCoreAndRunActions("set_hoverEffectsOff");e.doCoreAndRunActions("set_hoveredPopupOff")}))}}));this.dynamicLayerListenersSet=!0}}setDataLayerEvents(t,e){}setMarkerEvents(t,e){t.markers.forEach((n=>{n.getElement().addEventListener("click",(()=>{t.clickedMarker=n;e.doCoreAndRunActions("define_clickedFeature_fromMarker");e.doCoreAndRunActions("set_storelocatorclick");e.doCoreAndRunActions("set_sidebarclick");e.doCoreAndRunActions("set_externallink");e.doCoreAndRunActions("define_clickedPopup_fromMarker")}));n.getElement().addEventListener("mouseenter",(r=>{t.hoveredMarker=n;e.doCoreAndRunActions("define_hoveredFeature_fromMarker");e.doCoreAndRunActions("define_tempHoverMarker");e.doCoreAndRunActions("define_hoveredPopup_fromMarker")}));n.getElement().addEventListener("mouseleave",(t=>{e.doCoreAndRunActions("set_hoverEffectsOff_fromMarker");e.doCoreAndRunActions("set_hoveredPopupOff_fromMarker")}))}))}setMoveEvents(t){if(!this.isPublic){t.once("idle",(t=>{this.doCoreAndRunActions("set_moveendVariables")}));t.on("moveend",(t=>{this.doCoreAndRunActions("set_moveendVariables")}))}}doCoreAndRunActions(t){return this.MapsterContainer.doCore(t)}runHookActions(t,e){if(window.mwm){let r=this.MapsterContainer.core[t].hook;const i=`${r}/mapster-${this.isPublic?this.post_id:"admin"}`;if(window.mwm.actions[i]){window.mwm.actions[i].funcs;if(window.mwm.actions[i].funcs.length>0)for(var n=0;n<window.mwm.actions[i].funcs.length;n++)window.mwm.actions[i].funcs[n].func(e)}if(window.mwm.actions[r]){window.mwm.actions[r].funcs;if(window.mwm.actions[r].funcs.length>0)for(n=0;n<window.mwm.actions[r].funcs.length;n++)window.mwm.actions[r].funcs[n].func(e)}}}registerAdminEventListeners(){this.MapsterContainer.registerListener('.acf-field[data-name="zoom_on_scroll"] :input',"check","postResponse.map.zoom_on_scroll");this.MapsterContainer.registerListener('.acf-field[data-name="interactivity"] :input',"check","postResponse.map.interactivity");this.MapsterContainer.registerListener('.acf-field[data-name="open_popups_in_sidebar"] :input',"check","postResponse.map.open_popups_in_sidebar");this.MapsterContainer.registerListener('.acf-field[data-name="restrict_movement"] :input',"check","postResponse.map.restricted_movement.restrict_movement");this.MapsterContainer.registerListener('.acf-field[data-name="southwest_longitude"] :input',"val","postResponse.map.restricted_movement.allowed_bounds.southwest_longitude");this.MapsterContainer.registerListener('.acf-field[data-name="southwest_latitude"] :input',"val","postResponse.map.restricted_movement.allowed_bounds.southwest_latitude");this.MapsterContainer.registerListener('.acf-field[data-name="northeast_longitude"] :input',"val","postResponse.map.restricted_movement.allowed_bounds.northeast_longitude");this.MapsterContainer.registerListener('.acf-field[data-name="northeast_latitude"] :input',"val","postResponse.map.restricted_movement.allowed_bounds.northeast_latitude");this.MapsterContainer.registerListener('.acf-field[data-name="min_zoom"] :input',"val","postResponse.map.restricted_movement.allowed_zoom.min_zoom");this.MapsterContainer.registerListener('.acf-field[data-name="max_zoom"] :input',"val","postResponse.map.restricted_movement.allowed_zoom.max_zoom");this.MapsterContainer.registerListener('.acf-field[data-name="zoom_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.zoom_control.enable",["define_controls.zoomControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="zoom_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.zoom_control.position",["define_controls.zoomControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="3d_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.3d_control.enable",["define_controls.3dControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="3d_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.3d_control.position",["define_controls.3dControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="scale_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.scale_control.enable",["define_controls.scaleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="scale_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.scale_control.position",["define_controls.scaleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="attribution_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.attribution_control.position",["define_controls.attributionControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geolocation_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.geolocation_control.enable",["define_controls.geolocationControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geolocation_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.geolocation_control.position",["define_controls.geolocationControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geolocation_control"] .acf-field[data-name="set_on_load"] :input',"check","postResponse.map.geolocation_control.set_on_load",["define_controls.geolocationControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="fullscreen_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.fullscreen_control.enable",["define_controls.fullscreenControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="fullscreen_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.fullscreen_control.position",["define_controls.fullscreenControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="street_view_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.street_view_control.enable",["define_controls.streetViewControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="street_view_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.street_view_control.position",["define_controls.streetViewControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="map_type_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.map_type_control.enable",["define_controls.mapTypeControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="map_type_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.map_type_control.position",["define_controls.mapTypeControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="download_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.download_control.enable",["define_controls.downloadControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="download_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.download_control.position",["define_controls.downloadControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="download_control"] .acf-field[data-name="interact_with_filters"] :input',"check","postResponse.map.download_control.interact_with_filters",["define_controls.downloadControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="download_control"] .acf-field[data-name="notify_on_download"] :input',"val","postResponse.map.download_control.notify_on_download",["define_controls.downloadControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_html_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.custom_html_control.enable",["define_controls.customHTMLControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_html_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.custom_html_control.position",["define_controls.customHTMLControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_html_control"] .acf-field[data-name="custom_html"] :input',"val","postResponse.map.custom_html_control.custom_html",["define_controls.customHTMLControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="layer_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.layer_control.enable",["define_controls.layerControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="layer_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.layer_control.position",["define_controls.layerControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="layer_control"] .acf-field[data-name="toggleable_layers"] :input',"val","postResponse.map.layer_control.toggleable_layers",["define_controls.layerControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="layer_control"] .acf-field[data-name="toggleable_layer_titles"] :input',"val","postResponse.map.layer_control.toggleable_layer_titles",["define_controls.layerControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="layer_control"] .acf-field[data-name="checkbox_type"] :input',"val","postResponse.map.layer_control.checkbox_type",["define_controls.layerControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="style_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.style_control.enable",["define_controls.styleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="style_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.style_control.position",["define_controls.styleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="style_control"] .acf-field[data-name="toggleable_styles"] :input',"val","postResponse.map.style_control.toggleable_styles",["define_controls.styleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="style_control"] .acf-field[data-name="toggleable_styles_titles"] :input',"val","postResponse.map.style_control.toggleable_styles_titles",["define_controls.styleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="style_control"] .acf-field[data-name="initial_style_title"] :input',"val","postResponse.map.style_control.initial_style_title",["define_controls.styleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geocoder_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.geocoder_control.enable",["define_controls.geocoderControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geocoder_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.geocoder_control.position",["define_controls.geocoderControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geocoder_control"] .acf-field[data-name="limit_results"] :input',"val","postResponse.map.geocoder_control.limit_results",["define_controls.geocoderControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geocoder_control"] .acf-field[data-name="placeholder"] :input',"val","postResponse.map.geocoder_control.placeholder",["define_controls.geocoderControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="directions_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.directions_control.enable",["define_controls.directionsControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="directions_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.directions_control.position",["define_controls.directionsControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="directions_control"] .acf-field[data-name="unit"] :input',"val","postResponse.map.directions_control.unit",["define_controls.directionsControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="directions_control"] .acf-field[data-name="profile"] :input',"val","postResponse.map.directions_control.profile",["define_controls.directionsControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="directions_control"] .acf-field[data-name="placeholderOrigin"] :input',"val","postResponse.map.directions_control.placeholderOrigin",["define_controls.directionsControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="enable"] :input',"check","postResponse.map.filter.custom_search_filter.enable",["define_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="position"] :input',"val","postResponse.map.filter.custom_search_filter.position",["define_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="include_geocoder"] :input',"check","postResponse.map.filter.custom_search_filter.include_geocoder",["define_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="limit_results"] :input',"val","postResponse.map.filter.custom_search_filter.limit_results",["define_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="number_of_results"] :input',"val","postResponse.map.filter.custom_search_filter.number_of_results",["define_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="placeholder"] :input',"val","postResponse.map.filter.custom_search_filter.placeholder",["define_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="filter_dropdown"] .acf-field[data-name="enable"] :input',"check","postResponse.map.filter.filter_dropdown.enable",["define_controls.filterDropdownControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="filter_dropdown"] .acf-field[data-name="position"] :input',"val","postResponse.map.filter.filter_dropdown.position",["define_controls.filterDropdownControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="filter_dropdown"] .acf-field[data-name="placeholder"] :input',"val","postResponse.map.filter.filter_dropdown.placeholder",["define_controls.filterDropdownControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="enable"] :input',"check","postResponse.map.filter.category_filter.enable",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="position"] :input',"val","postResponse.map.filter.category_filter.position",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="initial_visibility"] :input',"check","postResponse.map.filter.category_filter.initial_visibility",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="functionality"] :input',"val","postResponse.map.filter.category_filter.functionality",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="independent_children"] :input',"check","postResponse.map.filter.category_filter.independent_children",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="category_display"] :input',"val","postResponse.map.filter.category_filter.category_display",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="checkbox_display"] :input',"val","postResponse.map.filter.category_filter.checkbox_display",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="pre_selected_categories"] :input',"val","postResponse.map.filter.category_filter.pre_selected_categories",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="enable"] :input',"check","postResponse.map.list.enable",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="position"] :input',"val","postResponse.map.list.position",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="units"] :input',"val","postResponse.map.list.units",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="show_distance"] :input',"check","postResponse.map.list.show_distance",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="sort_by_distance"] :input',"check","postResponse.map.list.sort_by_distance",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="listing_type"] :input',"val","postResponse.map.list.listing_type",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="number_of_locations"] :input',"val","postResponse.map.list.number_of_locations",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="store_locator_options"] .acf-field[data-name="enable"] :input',"check","postResponse.map.list.store_locator_options.enable",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="store_locator_options"] .acf-field[data-name="sort_hours_by_day"] :input',"check","postResponse.map.list.store_locator_options.sort_hours_by_day",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="locations"] select',"select","postResponseAdmin.locations_ids",["define_adminFeatures","define_postResponse.locations","set_mapfeatures","define_dataLayers","define_markers","define_controls.customSearchControl","define_controls.filterDropdownControl","define_controls.categoryFilterControl","define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="lines"] select',"select","postResponseAdmin.lines_ids",["define_adminFeatures","define_postResponse.lines","set_mapfeatures","define_dataLayers","define_markers","define_controls.customSearchControl","define_controls.filterDropdownControl","define_controls.categoryFilterControl","define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="polygons"] select',"select","postResponseAdmin.polygons_ids",["define_adminFeatures","define_postResponse.polygons","set_mapfeatures","define_dataLayers","define_markers","define_controls.customSearchControl","define_controls.filterDropdownControl","define_controls.categoryFilterControl","define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="add_by_category"] select',"select","postResponse.cats",["define_adminFeatures","define_postResponse.locations","define_postResponse.lines","define_postResponse.polygons","set_mapfeatures","define_dataLayers","define_markers","define_controls.customSearchControl","define_controls.filterDropdownControl","define_controls.categoryFilterControl","define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="manual_latitude"] :input',"val","postResponse.map.view.manual_latitude");this.MapsterContainer.registerListener('.acf-field[data-name="manual_longitude"] :input',"val","postResponse.map.view.manual_longitude");this.MapsterContainer.registerListener('.acf-field[data-name="manual_zoom"] :input',"val","postResponse.map.view.manual_zoom");this.MapsterContainer.registerListener('.acf-field[data-name="manual_pitch"] :input',"val","postResponse.map.view.manual_pitch");this.MapsterContainer.registerListener('.acf-field[data-name="manual_rotation"] :input',"val","postResponse.map.view.manual_rotation");this.MapsterContainer.registerListener('.acf-field[data-name="initial_load"] :input',"val","postResponse.map.view.initial_load");this.MapsterContainer.registerListener('.acf-field[data-name="circle_clustering"] :input',"check","postResponse.map.circle_clustering");this.MapsterContainer.registerListener('.acf-field[data-name="label_icon_clustering"] :input',"check","postResponse.map.label_icon_clustering");this.MapsterContainer.registerListener('.acf-field[data-name="enable_heatmap"] :input',"check","postResponse.map.heatmap.enable_heatmap",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_layer"] :input',"val","postResponse.map.heatmap.heatmap_layer",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_layer_visibility"] :input',"val","postResponse.map.heatmap.heatmap_layer_visibility",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_weighted_property"] :input',"val","postResponse.map.heatmap.heatmap_weighted_property",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_intensity"] :input',"val","postResponse.map.heatmap.heatmap_intensity",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_color_range"] :input',"val","postResponse.map.heatmap.heatmap_color_range",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_point_radius"] :input',"val","postResponse.map.heatmap.heatmap_point_radius",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_opacity"] :input',"val","postResponse.map.heatmap.heatmap_opacity",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="enable_elevation_chart"] :input',"check","postResponse.map.elevation_line_chart.enable_elevation_chart");this.MapsterContainer.registerListener('.acf-field[data-name="map_provider"] :input',"val","postResponse.map.map_type.map_provider",["define_mapLibrary"]);this.MapsterContainer.registerListener('.acf-field[data-name="map_tile_style_access_token"] :input',"val","postResponse.map.map_type.map_tile_style_access_token",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="map_tile_style_no_access_token"] :input',"val","postResponse.map.map_type.map_tile_style_no_access_token",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="access_token"] :input',"val","postResponse.map.map_type.access_token");this.MapsterContainer.registerListener('.acf-field[data-name="custom_mapbox_style"] :input',"val","postResponse.map.map_type.custom_mapbox_style",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_style_json"] :input',"val","postResponse.map.map_type.custom_style_json",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="snazzy_map_style"] :input',"val","postResponse.map.map_type.snazzy_map_style",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_image"] :input',"val","postResponse.map.map_type.custom_image",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="duplicate_horizontally"] :input',"check","postResponse.map.layout.duplicate_horizontally");this.MapsterContainer.registerListener('.acf-field[data-name="terrain"] :input',"check","postResponse.map.map_type.terrain",["set_terrain"]);this.MapsterContainer.registerListener('.acf-field[data-name="projection"] :input',"val","postResponse.map.map_type.projection",["set_projection"]);this.MapsterContainer.registerListener('.acf-field[data-name="globe"] :input',"check","postResponse.map.map_type.globe",[]);this.MapsterContainer.registerListener('.acf-field[data-name="globe_background"] :input',"val","postResponse.map.map_type.globe_background",[])}}class MapsterPublic{constructor(){this.actions={}}add_action(t,e){this.actions[t]||(this.actions[t]={funcs:[]});this.actions[t].funcs.push({func:e})}}window.mwm=new MapsterPublic;!function(t){if(window.mapster_params.public)(o=".mapster-wp-maps",new Promise((t=>{if(document.querySelector(o))return t(document.querySelector(o));const e=new MutationObserver((n=>{if(document.querySelector(o)){t(document.querySelector(o));e.disconnect()}}));e.observe(document.body,{childList:!0,subtree:!0})}))).then((e=>{t(".mapster-wp-maps").each((function(){const e=t(this).attr("id").replace("mapster-wp-maps-",""),n=""!==t(this).data("single_feature_id")&&t(this).data("single_feature_id");new MapsterMap(e,window.mapster_params.public,n).init()}))}));else{let a="Publish this post to generate an embed code.";const s=new URLSearchParams(window.location.search);if(s.has("post")){let c=window.mapster_params.directory.replace("/admin/","/admin/includes/mapster-embed-map.php");c=c+window.mapster_params.qd+"map_id="+s.get("post");a=`<embed src="${c}" />`}let l="Publish this post to generate an listing code.";s.has("post")&&(l=`[mapster_listing_posts id="${s.get("post")}"]`);if(document.body.classList.contains("block-editor-page")){t("#mapster-wp-maps-preview").prependTo("#normal-sortables");t(".acf-field-625df5ebf4ecc .acf-input").text(a);t(".acf-field-6507ba6e3053a .acf-input").text(l)}else{t("#mapster-wp-maps-preview").prependTo("#acf_after_title-sortables");t(".acf-field-625df5ebf4ecc .acf-input").text(a);t(".acf-field-6507ba6e3053a .acf-input").text(l)}if(s.has("post")){let u=`\n [mapster_wp_map_submit map_id="${s.get("post")}" type="create_point"]<br />\n [mapster_wp_map_submit map_id="${s.get("post")}" type="edit_point" button_text="Edit Point" header_text="Edit Point"]\n `;t(".acf-field-62bf86b094491 .acf-input").append(u)}var e=acf.getFields().length,n=0,r=0;function i(t){"select"!==t&&(n+=1);n===e&&4===r&&new MapsterMap("map",window.mapster_params.public,!1).init()}acf.add_action("ready_field",i);acf.addAction("select2_init",(function(t,e,n,o){r+=1;i("select")}))}var o}(jQuery);