@deck.gl-community/leaflet 9.2.0-beta.5 → 9.2.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/dist.min.js +1 -874
  2. package/package.json +2 -2
package/dist/dist.min.js CHANGED
@@ -4,879 +4,6 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['deckCommunity'] = factory();
6
6
  else root['deckCommunity'] = factory();})(globalThis, function () {
7
- var __exports__=(()=>{var XT=Object.create;var Hr=Object.defineProperty;var ZT=Object.getOwnPropertyDescriptor;var $T=Object.getOwnPropertyNames;var YT=Object.getPrototypeOf,KT=Object.prototype.hasOwnProperty;var qT=(e,t,i)=>t in e?Hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var I=(e,t)=>()=>(e&&(t=e(e=0)),t);var JT=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pi=(e,t)=>{for(var i in t)Hr(e,i,{get:t[i],enumerable:!0})},Gf=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $T(t))!KT.call(e,o)&&o!==i&&Hr(e,o,{get:()=>t[o],enumerable:!(n=ZT(t,o))||n.enumerable});return e};var QT=(e,t,i)=>(i=e!=null?XT(YT(e)):{},Gf(t||!e||!e.__esModule?Hr(i,"default",{value:e,enumerable:!0}):i,e)),GT=e=>Gf(Hr({},"__esModule",{value:!0}),e);var z=(e,t,i)=>(qT(e,typeof t!="symbol"?t+"":t,i),i);var eu=JT((bo,tu)=>{(function(e,t){typeof bo=="object"&&typeof tu<"u"?t(bo):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.leaflet={}))})(bo,function(e){"use strict";var t="1.9.4";function i(r){var s,c,f,d;for(c=1,f=arguments.length;c<f;c++){d=arguments[c];for(s in d)r[s]=d[s]}return r}var n=Object.create||function(){function r(){}return function(s){return r.prototype=s,new r}}();function o(r,s){var c=Array.prototype.slice;if(r.bind)return r.bind.apply(r,c.call(arguments,1));var f=c.call(arguments,2);return function(){return r.apply(s,f.length?f.concat(c.call(arguments)):arguments)}}var a=0;function l(r){return"_leaflet_id"in r||(r._leaflet_id=++a),r._leaflet_id}function h(r,s,c){var f,d,_,x;return x=function(){f=!1,d&&(_.apply(c,d),d=!1)},_=function(){f?d=arguments:(r.apply(c,arguments),setTimeout(x,s),f=!0)},_}function u(r,s,c){var f=s[1],d=s[0],_=f-d;return r===f&&c?r:((r-d)%_+_)%_+d}function p(){return!1}function m(r,s){if(s===!1)return r;var c=Math.pow(10,s===void 0?6:s);return Math.round(r*c)/c}function g(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function T(r){return g(r).split(/\s+/)}function y(r,s){Object.prototype.hasOwnProperty.call(r,"options")||(r.options=r.options?n(r.options):{});for(var c in s)r.options[c]=s[c];return r.options}function E(r,s,c){var f=[];for(var d in r)f.push(encodeURIComponent(c?d.toUpperCase():d)+"="+encodeURIComponent(r[d]));return(!s||s.indexOf("?")===-1?"?":"&")+f.join("&")}var S=/\{ *([\w_ -]+) *\}/g;function v(r,s){return r.replace(S,function(c,f){var d=s[f];if(d===void 0)throw new Error("No value provided for variable "+c);return typeof d=="function"&&(d=d(s)),d})}var A=Array.isArray||function(r){return Object.prototype.toString.call(r)==="[object Array]"};function P(r,s){for(var c=0;c<r.length;c++)if(r[c]===s)return c;return-1}var w="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function O(r){return window["webkit"+r]||window["moz"+r]||window["ms"+r]}var N=0;function C(r){var s=+new Date,c=Math.max(0,16-(s-N));return N=s+c,window.setTimeout(r,c)}var V=window.requestAnimationFrame||O("RequestAnimationFrame")||C,U=window.cancelAnimationFrame||O("CancelAnimationFrame")||O("CancelRequestAnimationFrame")||function(r){window.clearTimeout(r)};function D(r,s,c){if(c&&V===C)r.call(s);else return V.call(window,o(r,s))}function B(r){r&&U.call(window,r)}var j={__proto__:null,extend:i,create:n,bind:o,get lastId(){return a},stamp:l,throttle:h,wrapNum:u,falseFn:p,formatNum:m,trim:g,splitWords:T,setOptions:y,getParamString:E,template:v,isArray:A,indexOf:P,emptyImageUrl:w,requestFn:V,cancelFn:U,requestAnimFrame:D,cancelAnimFrame:B};function Z(){}Z.extend=function(r){var s=function(){y(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},c=s.__super__=this.prototype,f=n(c);f.constructor=s,s.prototype=f;for(var d in this)Object.prototype.hasOwnProperty.call(this,d)&&d!=="prototype"&&d!=="__super__"&&(s[d]=this[d]);return r.statics&&i(s,r.statics),r.includes&&(rt(r.includes),i.apply(null,[f].concat(r.includes))),i(f,r),delete f.statics,delete f.includes,f.options&&(f.options=c.options?n(c.options):{},i(f.options,r.options)),f._initHooks=[],f.callInitHooks=function(){if(!this._initHooksCalled){c.callInitHooks&&c.callInitHooks.call(this),this._initHooksCalled=!0;for(var _=0,x=f._initHooks.length;_<x;_++)f._initHooks[_].call(this)}},s},Z.include=function(r){var s=this.prototype.options;return i(this.prototype,r),r.options&&(this.prototype.options=s,this.mergeOptions(r.options)),this},Z.mergeOptions=function(r){return i(this.prototype.options,r),this},Z.addInitHook=function(r){var s=Array.prototype.slice.call(arguments,1),c=typeof r=="function"?r:function(){this[r].apply(this,s)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(c),this};function rt(r){if(!(typeof L>"u"||!L||!L.Mixin)){r=A(r)?r:[r];for(var s=0;s<r.length;s++)r[s]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var X={on:function(r,s,c){if(typeof r=="object")for(var f in r)this._on(f,r[f],s);else{r=T(r);for(var d=0,_=r.length;d<_;d++)this._on(r[d],s,c)}return this},off:function(r,s,c){if(!arguments.length)delete this._events;else if(typeof r=="object")for(var f in r)this._off(f,r[f],s);else{r=T(r);for(var d=arguments.length===1,_=0,x=r.length;_<x;_++)d?this._off(r[_]):this._off(r[_],s,c)}return this},_on:function(r,s,c,f){if(typeof s!="function"){console.warn("wrong listener type: "+typeof s);return}if(this._listens(r,s,c)===!1){c===this&&(c=void 0);var d={fn:s,ctx:c};f&&(d.once=!0),this._events=this._events||{},this._events[r]=this._events[r]||[],this._events[r].push(d)}},_off:function(r,s,c){var f,d,_;if(this._events&&(f=this._events[r],!!f)){if(arguments.length===1){if(this._firingCount)for(d=0,_=f.length;d<_;d++)f[d].fn=p;delete this._events[r];return}if(typeof s!="function"){console.warn("wrong listener type: "+typeof s);return}var x=this._listens(r,s,c);if(x!==!1){var b=f[x];this._firingCount&&(b.fn=p,this._events[r]=f=f.slice()),f.splice(x,1)}}},fire:function(r,s,c){if(!this.listens(r,c))return this;var f=i({},s,{type:r,target:this,sourceTarget:s&&s.sourceTarget||this});if(this._events){var d=this._events[r];if(d){this._firingCount=this._firingCount+1||1;for(var _=0,x=d.length;_<x;_++){var b=d[_],R=b.fn;b.once&&this.off(r,R,b.ctx),R.call(b.ctx||this,f)}this._firingCount--}}return c&&this._propagateEvent(f),this},listens:function(r,s,c,f){typeof r!="string"&&console.warn('"string" type argument expected');var d=s;typeof s!="function"&&(f=!!s,d=void 0,c=void 0);var _=this._events&&this._events[r];if(_&&_.length&&this._listens(r,d,c)!==!1)return!0;if(f){for(var x in this._eventParents)if(this._eventParents[x].listens(r,s,c,f))return!0}return!1},_listens:function(r,s,c){if(!this._events)return!1;var f=this._events[r]||[];if(!s)return!!f.length;c===this&&(c=void 0);for(var d=0,_=f.length;d<_;d++)if(f[d].fn===s&&f[d].ctx===c)return d;return!1},once:function(r,s,c){if(typeof r=="object")for(var f in r)this._on(f,r[f],s,!0);else{r=T(r);for(var d=0,_=r.length;d<_;d++)this._on(r[d],s,c,!0)}return this},addEventParent:function(r){return this._eventParents=this._eventParents||{},this._eventParents[l(r)]=r,this},removeEventParent:function(r){return this._eventParents&&delete this._eventParents[l(r)],this},_propagateEvent:function(r){for(var s in this._eventParents)this._eventParents[s].fire(r.type,i({layer:r.target,propagatedFrom:r.target},r),!0)}};X.addEventListener=X.on,X.removeEventListener=X.clearAllEventListeners=X.off,X.addOneTimeEventListener=X.once,X.fireEvent=X.fire,X.hasEventListeners=X.listens;var mt=Z.extend(X);function Y(r,s,c){this.x=c?Math.round(r):r,this.y=c?Math.round(s):s}var Ze=Math.trunc||function(r){return r>0?Math.floor(r):Math.ceil(r)};Y.prototype={clone:function(){return new Y(this.x,this.y)},add:function(r){return this.clone()._add(K(r))},_add:function(r){return this.x+=r.x,this.y+=r.y,this},subtract:function(r){return this.clone()._subtract(K(r))},_subtract:function(r){return this.x-=r.x,this.y-=r.y,this},divideBy:function(r){return this.clone()._divideBy(r)},_divideBy:function(r){return this.x/=r,this.y/=r,this},multiplyBy:function(r){return this.clone()._multiplyBy(r)},_multiplyBy:function(r){return this.x*=r,this.y*=r,this},scaleBy:function(r){return new Y(this.x*r.x,this.y*r.y)},unscaleBy:function(r){return new Y(this.x/r.x,this.y/r.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=Ze(this.x),this.y=Ze(this.y),this},distanceTo:function(r){r=K(r);var s=r.x-this.x,c=r.y-this.y;return Math.sqrt(s*s+c*c)},equals:function(r){return r=K(r),r.x===this.x&&r.y===this.y},contains:function(r){return r=K(r),Math.abs(r.x)<=Math.abs(this.x)&&Math.abs(r.y)<=Math.abs(this.y)},toString:function(){return"Point("+m(this.x)+", "+m(this.y)+")"}};function K(r,s,c){return r instanceof Y?r:A(r)?new Y(r[0],r[1]):r==null?r:typeof r=="object"&&"x"in r&&"y"in r?new Y(r.x,r.y):new Y(r,s,c)}function ht(r,s){if(r)for(var c=s?[r,s]:r,f=0,d=c.length;f<d;f++)this.extend(c[f])}ht.prototype={extend:function(r){var s,c;if(!r)return this;if(r instanceof Y||typeof r[0]=="number"||"x"in r)s=c=K(r);else if(r=Lt(r),s=r.min,c=r.max,!s||!c)return this;return!this.min&&!this.max?(this.min=s.clone(),this.max=c.clone()):(this.min.x=Math.min(s.x,this.min.x),this.max.x=Math.max(c.x,this.max.x),this.min.y=Math.min(s.y,this.min.y),this.max.y=Math.max(c.y,this.max.y)),this},getCenter:function(r){return K((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,r)},getBottomLeft:function(){return K(this.min.x,this.max.y)},getTopRight:function(){return K(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(r){var s,c;return typeof r[0]=="number"||r instanceof Y?r=K(r):r=Lt(r),r instanceof ht?(s=r.min,c=r.max):s=c=r,s.x>=this.min.x&&c.x<=this.max.x&&s.y>=this.min.y&&c.y<=this.max.y},intersects:function(r){r=Lt(r);var s=this.min,c=this.max,f=r.min,d=r.max,_=d.x>=s.x&&f.x<=c.x,x=d.y>=s.y&&f.y<=c.y;return _&&x},overlaps:function(r){r=Lt(r);var s=this.min,c=this.max,f=r.min,d=r.max,_=d.x>s.x&&f.x<c.x,x=d.y>s.y&&f.y<c.y;return _&&x},isValid:function(){return!!(this.min&&this.max)},pad:function(r){var s=this.min,c=this.max,f=Math.abs(s.x-c.x)*r,d=Math.abs(s.y-c.y)*r;return Lt(K(s.x-f,s.y-d),K(c.x+f,c.y+d))},equals:function(r){return r?(r=Lt(r),this.min.equals(r.getTopLeft())&&this.max.equals(r.getBottomRight())):!1}};function Lt(r,s){return!r||r instanceof ht?r:new ht(r,s)}function kt(r,s){if(r)for(var c=s?[r,s]:r,f=0,d=c.length;f<d;f++)this.extend(c[f])}kt.prototype={extend:function(r){var s=this._southWest,c=this._northEast,f,d;if(r instanceof st)f=r,d=r;else if(r instanceof kt){if(f=r._southWest,d=r._northEast,!f||!d)return this}else return r?this.extend(tt(r)||vt(r)):this;return!s&&!c?(this._southWest=new st(f.lat,f.lng),this._northEast=new st(d.lat,d.lng)):(s.lat=Math.min(f.lat,s.lat),s.lng=Math.min(f.lng,s.lng),c.lat=Math.max(d.lat,c.lat),c.lng=Math.max(d.lng,c.lng)),this},pad:function(r){var s=this._southWest,c=this._northEast,f=Math.abs(s.lat-c.lat)*r,d=Math.abs(s.lng-c.lng)*r;return new kt(new st(s.lat-f,s.lng-d),new st(c.lat+f,c.lng+d))},getCenter:function(){return new st((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new st(this.getNorth(),this.getWest())},getSouthEast:function(){return new st(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(r){typeof r[0]=="number"||r instanceof st||"lat"in r?r=tt(r):r=vt(r);var s=this._southWest,c=this._northEast,f,d;return r instanceof kt?(f=r.getSouthWest(),d=r.getNorthEast()):f=d=r,f.lat>=s.lat&&d.lat<=c.lat&&f.lng>=s.lng&&d.lng<=c.lng},intersects:function(r){r=vt(r);var s=this._southWest,c=this._northEast,f=r.getSouthWest(),d=r.getNorthEast(),_=d.lat>=s.lat&&f.lat<=c.lat,x=d.lng>=s.lng&&f.lng<=c.lng;return _&&x},overlaps:function(r){r=vt(r);var s=this._southWest,c=this._northEast,f=r.getSouthWest(),d=r.getNorthEast(),_=d.lat>s.lat&&f.lat<c.lat,x=d.lng>s.lng&&f.lng<c.lng;return _&&x},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(r,s){return r?(r=vt(r),this._southWest.equals(r.getSouthWest(),s)&&this._northEast.equals(r.getNorthEast(),s)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function vt(r,s){return r instanceof kt?r:new kt(r,s)}function st(r,s,c){if(isNaN(r)||isNaN(s))throw new Error("Invalid LatLng object: ("+r+", "+s+")");this.lat=+r,this.lng=+s,c!==void 0&&(this.alt=+c)}st.prototype={equals:function(r,s){if(!r)return!1;r=tt(r);var c=Math.max(Math.abs(this.lat-r.lat),Math.abs(this.lng-r.lng));return c<=(s===void 0?1e-9:s)},toString:function(r){return"LatLng("+m(this.lat,r)+", "+m(this.lng,r)+")"},distanceTo:function(r){return $e.distance(this,tt(r))},wrap:function(){return $e.wrapLatLng(this)},toBounds:function(r){var s=180*r/40075017,c=s/Math.cos(Math.PI/180*this.lat);return vt([this.lat-s,this.lng-c],[this.lat+s,this.lng+c])},clone:function(){return new st(this.lat,this.lng,this.alt)}};function tt(r,s,c){return r instanceof st?r:A(r)&&typeof r[0]!="object"?r.length===3?new st(r[0],r[1],r[2]):r.length===2?new st(r[0],r[1]):null:r==null?r:typeof r=="object"&&"lat"in r?new st(r.lat,"lng"in r?r.lng:r.lon,r.alt):s===void 0?null:new st(r,s,c)}var Pe={latLngToPoint:function(r,s){var c=this.projection.project(r),f=this.scale(s);return this.transformation._transform(c,f)},pointToLatLng:function(r,s){var c=this.scale(s),f=this.transformation.untransform(r,c);return this.projection.unproject(f)},project:function(r){return this.projection.project(r)},unproject:function(r){return this.projection.unproject(r)},scale:function(r){return 256*Math.pow(2,r)},zoom:function(r){return Math.log(r/256)/Math.LN2},getProjectedBounds:function(r){if(this.infinite)return null;var s=this.projection.bounds,c=this.scale(r),f=this.transformation.transform(s.min,c),d=this.transformation.transform(s.max,c);return new ht(f,d)},infinite:!1,wrapLatLng:function(r){var s=this.wrapLng?u(r.lng,this.wrapLng,!0):r.lng,c=this.wrapLat?u(r.lat,this.wrapLat,!0):r.lat,f=r.alt;return new st(c,s,f)},wrapLatLngBounds:function(r){var s=r.getCenter(),c=this.wrapLatLng(s),f=s.lat-c.lat,d=s.lng-c.lng;if(f===0&&d===0)return r;var _=r.getSouthWest(),x=r.getNorthEast(),b=new st(_.lat-f,_.lng-d),R=new st(x.lat-f,x.lng-d);return new kt(b,R)}},$e=i({},Pe,{wrapLng:[-180,180],R:6371e3,distance:function(r,s){var c=Math.PI/180,f=r.lat*c,d=s.lat*c,_=Math.sin((s.lat-r.lat)*c/2),x=Math.sin((s.lng-r.lng)*c/2),b=_*_+Math.cos(f)*Math.cos(d)*x*x,R=2*Math.atan2(Math.sqrt(b),Math.sqrt(1-b));return this.R*R}}),Wh=6378137,ra={R:Wh,MAX_LATITUDE:85.0511287798,project:function(r){var s=Math.PI/180,c=this.MAX_LATITUDE,f=Math.max(Math.min(c,r.lat),-c),d=Math.sin(f*s);return new Y(this.R*r.lng*s,this.R*Math.log((1+d)/(1-d))/2)},unproject:function(r){var s=180/Math.PI;return new st((2*Math.atan(Math.exp(r.y/this.R))-Math.PI/2)*s,r.x*s/this.R)},bounds:function(){var r=Wh*Math.PI;return new ht([-r,-r],[r,r])}()};function na(r,s,c,f){if(A(r)){this._a=r[0],this._b=r[1],this._c=r[2],this._d=r[3];return}this._a=r,this._b=s,this._c=c,this._d=f}na.prototype={transform:function(r,s){return this._transform(r.clone(),s)},_transform:function(r,s){return s=s||1,r.x=s*(this._a*r.x+this._b),r.y=s*(this._c*r.y+this._d),r},untransform:function(r,s){return s=s||1,new Y((r.x/s-this._b)/this._a,(r.y/s-this._d)/this._c)}};function Mr(r,s,c,f){return new na(r,s,c,f)}var oa=i({},$e,{code:"EPSG:3857",projection:ra,transformation:function(){var r=.5/(Math.PI*ra.R);return Mr(r,.5,-r,.5)}()}),vg=i({},oa,{code:"EPSG:900913"});function Hh(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function jh(r,s){var c="",f,d,_,x,b,R;for(f=0,_=r.length;f<_;f++){for(b=r[f],d=0,x=b.length;d<x;d++)R=b[d],c+=(d?"L":"M")+R.x+" "+R.y;c+=s?W.svg?"z":"x":""}return c||"M0 0"}var sa=document.documentElement.style,no="ActiveXObject"in window,Eg=no&&!document.addEventListener,Xh="msLaunchUri"in navigator&&!("documentMode"in document),aa=de("webkit"),Zh=de("android"),$h=de("android 2")||de("android 3"),Sg=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),bg=Zh&&de("Google")&&Sg<537&&!("AudioNode"in window),ca=!!window.opera,Yh=!Xh&&de("chrome"),Kh=de("gecko")&&!aa&&!ca&&!no,Ag=!Yh&&de("safari"),qh=de("phantom"),Jh="OTransition"in sa,Rg=navigator.platform.indexOf("Win")===0,Qh=no&&"transition"in sa,la="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!$h,Gh="MozPerspective"in sa,wg=!window.L_DISABLE_3D&&(Qh||la||Gh)&&!Jh&&!qh,Cr=typeof orientation<"u"||de("mobile"),Pg=Cr&&aa,Mg=Cr&&la,tf=!window.PointerEvent&&window.MSPointerEvent,ef=!!(window.PointerEvent||tf),rf="ontouchstart"in window||!!window.TouchEvent,Cg=!window.L_NO_TOUCH&&(rf||ef),Ig=Cr&&ca,Og=Cr&&Kh,Ng=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Dg=function(){var r=!1;try{var s=Object.defineProperty({},"passive",{get:function(){r=!0}});window.addEventListener("testPassiveEventSupport",p,s),window.removeEventListener("testPassiveEventSupport",p,s)}catch{}return r}(),Fg=function(){return!!document.createElement("canvas").getContext}(),ha=!!(document.createElementNS&&Hh("svg").createSVGRect),Bg=!!ha&&function(){var r=document.createElement("div");return r.innerHTML="<svg/>",(r.firstChild&&r.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),Lg=!ha&&function(){try{var r=document.createElement("div");r.innerHTML='<v:shape adj="1"/>';var s=r.firstChild;return s.style.behavior="url(#default#VML)",s&&typeof s.adj=="object"}catch{return!1}}(),kg=navigator.platform.indexOf("Mac")===0,Ug=navigator.platform.indexOf("Linux")===0;function de(r){return navigator.userAgent.toLowerCase().indexOf(r)>=0}var W={ie:no,ielt9:Eg,edge:Xh,webkit:aa,android:Zh,android23:$h,androidStock:bg,opera:ca,chrome:Yh,gecko:Kh,safari:Ag,phantom:qh,opera12:Jh,win:Rg,ie3d:Qh,webkit3d:la,gecko3d:Gh,any3d:wg,mobile:Cr,mobileWebkit:Pg,mobileWebkit3d:Mg,msPointer:tf,pointer:ef,touch:Cg,touchNative:rf,mobileOpera:Ig,mobileGecko:Og,retina:Ng,passiveEvents:Dg,canvas:Fg,svg:ha,vml:Lg,inlineSvg:Bg,mac:kg,linux:Ug},nf=W.msPointer?"MSPointerDown":"pointerdown",of=W.msPointer?"MSPointerMove":"pointermove",sf=W.msPointer?"MSPointerUp":"pointerup",af=W.msPointer?"MSPointerCancel":"pointercancel",fa={touchstart:nf,touchmove:of,touchend:sf,touchcancel:af},cf={touchstart:Xg,touchmove:oo,touchend:oo,touchcancel:oo},Di={},lf=!1;function zg(r,s,c){return s==="touchstart"&&jg(),cf[s]?(c=cf[s].bind(this,c),r.addEventListener(fa[s],c,!1),c):(console.warn("wrong event specified:",s),p)}function Vg(r,s,c){if(!fa[s]){console.warn("wrong event specified:",s);return}r.removeEventListener(fa[s],c,!1)}function Wg(r){Di[r.pointerId]=r}function Hg(r){Di[r.pointerId]&&(Di[r.pointerId]=r)}function hf(r){delete Di[r.pointerId]}function jg(){lf||(document.addEventListener(nf,Wg,!0),document.addEventListener(of,Hg,!0),document.addEventListener(sf,hf,!0),document.addEventListener(af,hf,!0),lf=!0)}function oo(r,s){if(s.pointerType!==(s.MSPOINTER_TYPE_MOUSE||"mouse")){s.touches=[];for(var c in Di)s.touches.push(Di[c]);s.changedTouches=[s],r(s)}}function Xg(r,s){s.MSPOINTER_TYPE_TOUCH&&s.pointerType===s.MSPOINTER_TYPE_TOUCH&&Mt(s),oo(r,s)}function Zg(r){var s={},c,f;for(f in r)c=r[f],s[f]=c&&c.bind?c.bind(r):c;return r=s,s.type="dblclick",s.detail=2,s.isTrusted=!1,s._simulated=!0,s}var $g=200;function Yg(r,s){r.addEventListener("dblclick",s);var c=0,f;function d(_){if(_.detail!==1){f=_.detail;return}if(!(_.pointerType==="mouse"||_.sourceCapabilities&&!_.sourceCapabilities.firesTouchEvents)){var x=_f(_);if(!(x.some(function(R){return R instanceof HTMLLabelElement&&R.attributes.for})&&!x.some(function(R){return R instanceof HTMLInputElement||R instanceof HTMLSelectElement}))){var b=Date.now();b-c<=$g?(f++,f===2&&s(Zg(_))):f=1,c=b}}}return r.addEventListener("click",d),{dblclick:s,simDblclick:d}}function Kg(r,s){r.removeEventListener("dblclick",s.dblclick),r.removeEventListener("click",s.simDblclick)}var ua=co(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Ir=co(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),ff=Ir==="webkitTransition"||Ir==="OTransition"?Ir+"End":"transitionend";function uf(r){return typeof r=="string"?document.getElementById(r):r}function Or(r,s){var c=r.style[s]||r.currentStyle&&r.currentStyle[s];if((!c||c==="auto")&&document.defaultView){var f=document.defaultView.getComputedStyle(r,null);c=f?f[s]:null}return c==="auto"?null:c}function nt(r,s,c){var f=document.createElement(r);return f.className=s||"",c&&c.appendChild(f),f}function gt(r){var s=r.parentNode;s&&s.removeChild(r)}function so(r){for(;r.firstChild;)r.removeChild(r.firstChild)}function Fi(r){var s=r.parentNode;s&&s.lastChild!==r&&s.appendChild(r)}function Bi(r){var s=r.parentNode;s&&s.firstChild!==r&&s.insertBefore(r,s.firstChild)}function da(r,s){if(r.classList!==void 0)return r.classList.contains(s);var c=ao(r);return c.length>0&&new RegExp("(^|\\s)"+s+"(\\s|$)").test(c)}function Q(r,s){if(r.classList!==void 0)for(var c=T(s),f=0,d=c.length;f<d;f++)r.classList.add(c[f]);else if(!da(r,s)){var _=ao(r);pa(r,(_?_+" ":"")+s)}}function xt(r,s){r.classList!==void 0?r.classList.remove(s):pa(r,g((" "+ao(r)+" ").replace(" "+s+" "," ")))}function pa(r,s){r.className.baseVal===void 0?r.className=s:r.className.baseVal=s}function ao(r){return r.correspondingElement&&(r=r.correspondingElement),r.className.baseVal===void 0?r.className:r.className.baseVal}function Zt(r,s){"opacity"in r.style?r.style.opacity=s:"filter"in r.style&&qg(r,s)}function qg(r,s){var c=!1,f="DXImageTransform.Microsoft.Alpha";try{c=r.filters.item(f)}catch{if(s===1)return}s=Math.round(s*100),c?(c.Enabled=s!==100,c.Opacity=s):r.style.filter+=" progid:"+f+"(opacity="+s+")"}function co(r){for(var s=document.documentElement.style,c=0;c<r.length;c++)if(r[c]in s)return r[c];return!1}function li(r,s,c){var f=s||new Y(0,0);r.style[ua]=(W.ie3d?"translate("+f.x+"px,"+f.y+"px)":"translate3d("+f.x+"px,"+f.y+"px,0)")+(c?" scale("+c+")":"")}function Et(r,s){r._leaflet_pos=s,W.any3d?li(r,s):(r.style.left=s.x+"px",r.style.top=s.y+"px")}function hi(r){return r._leaflet_pos||new Y(0,0)}var Nr,Dr,_a;if("onselectstart"in document)Nr=function(){q(window,"selectstart",Mt)},Dr=function(){ft(window,"selectstart",Mt)};else{var Fr=co(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);Nr=function(){if(Fr){var r=document.documentElement.style;_a=r[Fr],r[Fr]="none"}},Dr=function(){Fr&&(document.documentElement.style[Fr]=_a,_a=void 0)}}function ma(){q(window,"dragstart",Mt)}function ga(){ft(window,"dragstart",Mt)}var lo,Ta;function ya(r){for(;r.tabIndex===-1;)r=r.parentNode;r.style&&(ho(),lo=r,Ta=r.style.outlineStyle,r.style.outlineStyle="none",q(window,"keydown",ho))}function ho(){lo&&(lo.style.outlineStyle=Ta,lo=void 0,Ta=void 0,ft(window,"keydown",ho))}function df(r){do r=r.parentNode;while((!r.offsetWidth||!r.offsetHeight)&&r!==document.body);return r}function xa(r){var s=r.getBoundingClientRect();return{x:s.width/r.offsetWidth||1,y:s.height/r.offsetHeight||1,boundingClientRect:s}}var Jg={__proto__:null,TRANSFORM:ua,TRANSITION:Ir,TRANSITION_END:ff,get:uf,getStyle:Or,create:nt,remove:gt,empty:so,toFront:Fi,toBack:Bi,hasClass:da,addClass:Q,removeClass:xt,setClass:pa,getClass:ao,setOpacity:Zt,testProp:co,setTransform:li,setPosition:Et,getPosition:hi,get disableTextSelection(){return Nr},get enableTextSelection(){return Dr},disableImageDrag:ma,enableImageDrag:ga,preventOutline:ya,restoreOutline:ho,getSizedParentNode:df,getScale:xa};function q(r,s,c,f){if(s&&typeof s=="object")for(var d in s)Ea(r,d,s[d],c);else{s=T(s);for(var _=0,x=s.length;_<x;_++)Ea(r,s[_],c,f)}return this}var pe="_leaflet_events";function ft(r,s,c,f){if(arguments.length===1)pf(r),delete r[pe];else if(s&&typeof s=="object")for(var d in s)Sa(r,d,s[d],c);else if(s=T(s),arguments.length===2)pf(r,function(b){return P(s,b)!==-1});else for(var _=0,x=s.length;_<x;_++)Sa(r,s[_],c,f);return this}function pf(r,s){for(var c in r[pe]){var f=c.split(/\d/)[0];(!s||s(f))&&Sa(r,f,null,null,c)}}var va={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function Ea(r,s,c,f){var d=s+l(c)+(f?"_"+l(f):"");if(r[pe]&&r[pe][d])return this;var _=function(b){return c.call(f||r,b||window.event)},x=_;!W.touchNative&&W.pointer&&s.indexOf("touch")===0?_=zg(r,s,_):W.touch&&s==="dblclick"?_=Yg(r,_):"addEventListener"in r?s==="touchstart"||s==="touchmove"||s==="wheel"||s==="mousewheel"?r.addEventListener(va[s]||s,_,W.passiveEvents?{passive:!1}:!1):s==="mouseenter"||s==="mouseleave"?(_=function(b){b=b||window.event,Aa(r,b)&&x(b)},r.addEventListener(va[s],_,!1)):r.addEventListener(s,x,!1):r.attachEvent("on"+s,_),r[pe]=r[pe]||{},r[pe][d]=_}function Sa(r,s,c,f,d){d=d||s+l(c)+(f?"_"+l(f):"");var _=r[pe]&&r[pe][d];if(!_)return this;!W.touchNative&&W.pointer&&s.indexOf("touch")===0?Vg(r,s,_):W.touch&&s==="dblclick"?Kg(r,_):"removeEventListener"in r?r.removeEventListener(va[s]||s,_,!1):r.detachEvent("on"+s,_),r[pe][d]=null}function fi(r){return r.stopPropagation?r.stopPropagation():r.originalEvent?r.originalEvent._stopped=!0:r.cancelBubble=!0,this}function ba(r){return Ea(r,"wheel",fi),this}function Br(r){return q(r,"mousedown touchstart dblclick contextmenu",fi),r._leaflet_disable_click=!0,this}function Mt(r){return r.preventDefault?r.preventDefault():r.returnValue=!1,this}function ui(r){return Mt(r),fi(r),this}function _f(r){if(r.composedPath)return r.composedPath();for(var s=[],c=r.target;c;)s.push(c),c=c.parentNode;return s}function mf(r,s){if(!s)return new Y(r.clientX,r.clientY);var c=xa(s),f=c.boundingClientRect;return new Y((r.clientX-f.left)/c.x-s.clientLeft,(r.clientY-f.top)/c.y-s.clientTop)}var Qg=W.linux&&W.chrome?window.devicePixelRatio:W.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function gf(r){return W.edge?r.wheelDeltaY/2:r.deltaY&&r.deltaMode===0?-r.deltaY/Qg:r.deltaY&&r.deltaMode===1?-r.deltaY*20:r.deltaY&&r.deltaMode===2?-r.deltaY*60:r.deltaX||r.deltaZ?0:r.wheelDelta?(r.wheelDeltaY||r.wheelDelta)/2:r.detail&&Math.abs(r.detail)<32765?-r.detail*20:r.detail?r.detail/-32765*60:0}function Aa(r,s){var c=s.relatedTarget;if(!c)return!0;try{for(;c&&c!==r;)c=c.parentNode}catch{return!1}return c!==r}var Gg={__proto__:null,on:q,off:ft,stopPropagation:fi,disableScrollPropagation:ba,disableClickPropagation:Br,preventDefault:Mt,stop:ui,getPropagationPath:_f,getMousePosition:mf,getWheelDelta:gf,isExternalTarget:Aa,addListener:q,removeListener:ft},Tf=mt.extend({run:function(r,s,c,f){this.stop(),this._el=r,this._inProgress=!0,this._duration=c||.25,this._easeOutPower=1/Math.max(f||.5,.2),this._startPos=hi(r),this._offset=s.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=D(this._animate,this),this._step()},_step:function(r){var s=+new Date-this._startTime,c=this._duration*1e3;s<c?this._runFrame(this._easeOut(s/c),r):(this._runFrame(1),this._complete())},_runFrame:function(r,s){var c=this._startPos.add(this._offset.multiplyBy(r));s&&c._round(),Et(this._el,c),this.fire("step")},_complete:function(){B(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(r){return 1-Math.pow(1-r,this._easeOutPower)}}),et=mt.extend({options:{crs:oa,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(r,s){s=y(this,s),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(r),this._initLayout(),this._onResize=o(this._onResize,this),this._initEvents(),s.maxBounds&&this.setMaxBounds(s.maxBounds),s.zoom!==void 0&&(this._zoom=this._limitZoom(s.zoom)),s.center&&s.zoom!==void 0&&this.setView(tt(s.center),s.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=Ir&&W.any3d&&!W.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),q(this._proxy,ff,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(r,s,c){if(s=s===void 0?this._zoom:this._limitZoom(s),r=this._limitCenter(tt(r),s,this.options.maxBounds),c=c||{},this._stop(),this._loaded&&!c.reset&&c!==!0){c.animate!==void 0&&(c.zoom=i({animate:c.animate},c.zoom),c.pan=i({animate:c.animate,duration:c.duration},c.pan));var f=this._zoom!==s?this._tryAnimatedZoom&&this._tryAnimatedZoom(r,s,c.zoom):this._tryAnimatedPan(r,c.pan);if(f)return clearTimeout(this._sizeTimer),this}return this._resetView(r,s,c.pan&&c.pan.noMoveStart),this},setZoom:function(r,s){return this._loaded?this.setView(this.getCenter(),r,{zoom:s}):(this._zoom=r,this)},zoomIn:function(r,s){return r=r||(W.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+r,s)},zoomOut:function(r,s){return r=r||(W.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-r,s)},setZoomAround:function(r,s,c){var f=this.getZoomScale(s),d=this.getSize().divideBy(2),_=r instanceof Y?r:this.latLngToContainerPoint(r),x=_.subtract(d).multiplyBy(1-1/f),b=this.containerPointToLatLng(d.add(x));return this.setView(b,s,{zoom:c})},_getBoundsCenterZoom:function(r,s){s=s||{},r=r.getBounds?r.getBounds():vt(r);var c=K(s.paddingTopLeft||s.padding||[0,0]),f=K(s.paddingBottomRight||s.padding||[0,0]),d=this.getBoundsZoom(r,!1,c.add(f));if(d=typeof s.maxZoom=="number"?Math.min(s.maxZoom,d):d,d===1/0)return{center:r.getCenter(),zoom:d};var _=f.subtract(c).divideBy(2),x=this.project(r.getSouthWest(),d),b=this.project(r.getNorthEast(),d),R=this.unproject(x.add(b).divideBy(2).add(_),d);return{center:R,zoom:d}},fitBounds:function(r,s){if(r=vt(r),!r.isValid())throw new Error("Bounds are not valid.");var c=this._getBoundsCenterZoom(r,s);return this.setView(c.center,c.zoom,s)},fitWorld:function(r){return this.fitBounds([[-90,-180],[90,180]],r)},panTo:function(r,s){return this.setView(r,this._zoom,{pan:s})},panBy:function(r,s){if(r=K(r).round(),s=s||{},!r.x&&!r.y)return this.fire("moveend");if(s.animate!==!0&&!this.getSize().contains(r))return this._resetView(this.unproject(this.project(this.getCenter()).add(r)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new Tf,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),s.noMoveStart||this.fire("movestart"),s.animate!==!1){Q(this._mapPane,"leaflet-pan-anim");var c=this._getMapPanePos().subtract(r).round();this._panAnim.run(this._mapPane,c,s.duration||.25,s.easeLinearity)}else this._rawPanBy(r),this.fire("move").fire("moveend");return this},flyTo:function(r,s,c){if(c=c||{},c.animate===!1||!W.any3d)return this.setView(r,s,c);this._stop();var f=this.project(this.getCenter()),d=this.project(r),_=this.getSize(),x=this._zoom;r=tt(r),s=s===void 0?x:s;var b=Math.max(_.x,_.y),R=b*this.getZoomScale(x,s),M=d.distanceTo(f)||1,k=1.42,$=k*k;function G(St){var So=St?-1:1,VT=St?R:b,WT=R*R-b*b+So*$*$*M*M,HT=2*VT*$*M,Ba=WT/HT,Qf=Math.sqrt(Ba*Ba+1)-Ba,jT=Qf<1e-9?-18:Math.log(Qf);return jT}function Dt(St){return(Math.exp(St)-Math.exp(-St))/2}function Rt(St){return(Math.exp(St)+Math.exp(-St))/2}function Yt(St){return Dt(St)/Rt(St)}var Ut=G(0);function Wi(St){return b*(Rt(Ut)/Rt(Ut+k*St))}function LT(St){return b*(Rt(Ut)*Yt(Ut+k*St)-Dt(Ut))/$}function kT(St){return 1-Math.pow(1-St,1.5)}var UT=Date.now(),qf=(G(1)-Ut)/k,zT=c.duration?1e3*c.duration:1e3*qf*.8;function Jf(){var St=(Date.now()-UT)/zT,So=kT(St)*qf;St<=1?(this._flyToFrame=D(Jf,this),this._move(this.unproject(f.add(d.subtract(f).multiplyBy(LT(So)/M)),x),this.getScaleZoom(b/Wi(So),x),{flyTo:!0})):this._move(r,s)._moveEnd(!0)}return this._moveStart(!0,c.noMoveStart),Jf.call(this),this},flyToBounds:function(r,s){var c=this._getBoundsCenterZoom(r,s);return this.flyTo(c.center,c.zoom,s)},setMaxBounds:function(r){return r=vt(r),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),r.isValid()?(this.options.maxBounds=r,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(r){var s=this.options.minZoom;return this.options.minZoom=r,this._loaded&&s!==r&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(r):this},setMaxZoom:function(r){var s=this.options.maxZoom;return this.options.maxZoom=r,this._loaded&&s!==r&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(r):this},panInsideBounds:function(r,s){this._enforcingBounds=!0;var c=this.getCenter(),f=this._limitCenter(c,this._zoom,vt(r));return c.equals(f)||this.panTo(f,s),this._enforcingBounds=!1,this},panInside:function(r,s){s=s||{};var c=K(s.paddingTopLeft||s.padding||[0,0]),f=K(s.paddingBottomRight||s.padding||[0,0]),d=this.project(this.getCenter()),_=this.project(r),x=this.getPixelBounds(),b=Lt([x.min.add(c),x.max.subtract(f)]),R=b.getSize();if(!b.contains(_)){this._enforcingBounds=!0;var M=_.subtract(b.getCenter()),k=b.extend(_).getSize().subtract(R);d.x+=M.x<0?-k.x:k.x,d.y+=M.y<0?-k.y:k.y,this.panTo(this.unproject(d),s),this._enforcingBounds=!1}return this},invalidateSize:function(r){if(!this._loaded)return this;r=i({animate:!1,pan:!0},r===!0?{animate:!0}:r);var s=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var c=this.getSize(),f=s.divideBy(2).round(),d=c.divideBy(2).round(),_=f.subtract(d);return!_.x&&!_.y?this:(r.animate&&r.pan?this.panBy(_):(r.pan&&this._rawPanBy(_),this.fire("move"),r.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(o(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:s,newSize:c}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(r){if(r=this._locateOptions=i({timeout:1e4,watch:!1},r),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var s=o(this._handleGeolocationResponse,this),c=o(this._handleGeolocationError,this);return r.watch?this._locationWatchId=navigator.geolocation.watchPosition(s,c,r):navigator.geolocation.getCurrentPosition(s,c,r),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(r){if(this._container._leaflet_id){var s=r.code,c=r.message||(s===1?"permission denied":s===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:s,message:"Geolocation error: "+c+"."})}},_handleGeolocationResponse:function(r){if(this._container._leaflet_id){var s=r.coords.latitude,c=r.coords.longitude,f=new st(s,c),d=f.toBounds(r.coords.accuracy*2),_=this._locateOptions;if(_.setView){var x=this.getBoundsZoom(d);this.setView(f,_.maxZoom?Math.min(x,_.maxZoom):x)}var b={latlng:f,bounds:d,timestamp:r.timestamp};for(var R in r.coords)typeof r.coords[R]=="number"&&(b[R]=r.coords[R]);this.fire("locationfound",b)}},addHandler:function(r,s){if(!s)return this;var c=this[r]=new s(this);return this._handlers.push(c),this.options[r]&&c.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),gt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(B(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var r;for(r in this._layers)this._layers[r].remove();for(r in this._panes)gt(this._panes[r]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(r,s){var c="leaflet-pane"+(r?" leaflet-"+r.replace("Pane","")+"-pane":""),f=nt("div",c,s||this._mapPane);return r&&(this._panes[r]=f),f},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var r=this.getPixelBounds(),s=this.unproject(r.getBottomLeft()),c=this.unproject(r.getTopRight());return new kt(s,c)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(r,s,c){r=vt(r),c=K(c||[0,0]);var f=this.getZoom()||0,d=this.getMinZoom(),_=this.getMaxZoom(),x=r.getNorthWest(),b=r.getSouthEast(),R=this.getSize().subtract(c),M=Lt(this.project(b,f),this.project(x,f)).getSize(),k=W.any3d?this.options.zoomSnap:1,$=R.x/M.x,G=R.y/M.y,Dt=s?Math.max($,G):Math.min($,G);return f=this.getScaleZoom(Dt,f),k&&(f=Math.round(f/(k/100))*(k/100),f=s?Math.ceil(f/k)*k:Math.floor(f/k)*k),Math.max(d,Math.min(_,f))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new Y(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(r,s){var c=this._getTopLeftPoint(r,s);return new ht(c,c.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(r){return this.options.crs.getProjectedBounds(r===void 0?this.getZoom():r)},getPane:function(r){return typeof r=="string"?this._panes[r]:r},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(r,s){var c=this.options.crs;return s=s===void 0?this._zoom:s,c.scale(r)/c.scale(s)},getScaleZoom:function(r,s){var c=this.options.crs;s=s===void 0?this._zoom:s;var f=c.zoom(r*c.scale(s));return isNaN(f)?1/0:f},project:function(r,s){return s=s===void 0?this._zoom:s,this.options.crs.latLngToPoint(tt(r),s)},unproject:function(r,s){return s=s===void 0?this._zoom:s,this.options.crs.pointToLatLng(K(r),s)},layerPointToLatLng:function(r){var s=K(r).add(this.getPixelOrigin());return this.unproject(s)},latLngToLayerPoint:function(r){var s=this.project(tt(r))._round();return s._subtract(this.getPixelOrigin())},wrapLatLng:function(r){return this.options.crs.wrapLatLng(tt(r))},wrapLatLngBounds:function(r){return this.options.crs.wrapLatLngBounds(vt(r))},distance:function(r,s){return this.options.crs.distance(tt(r),tt(s))},containerPointToLayerPoint:function(r){return K(r).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(r){return K(r).add(this._getMapPanePos())},containerPointToLatLng:function(r){var s=this.containerPointToLayerPoint(K(r));return this.layerPointToLatLng(s)},latLngToContainerPoint:function(r){return this.layerPointToContainerPoint(this.latLngToLayerPoint(tt(r)))},mouseEventToContainerPoint:function(r){return mf(r,this._container)},mouseEventToLayerPoint:function(r){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(r))},mouseEventToLatLng:function(r){return this.layerPointToLatLng(this.mouseEventToLayerPoint(r))},_initContainer:function(r){var s=this._container=uf(r);if(s){if(s._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");q(s,"scroll",this._onScroll,this),this._containerId=l(s)},_initLayout:function(){var r=this._container;this._fadeAnimated=this.options.fadeAnimation&&W.any3d,Q(r,"leaflet-container"+(W.touch?" leaflet-touch":"")+(W.retina?" leaflet-retina":"")+(W.ielt9?" leaflet-oldie":"")+(W.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var s=Or(r,"position");s!=="absolute"&&s!=="relative"&&s!=="fixed"&&s!=="sticky"&&(r.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var r=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Et(this._mapPane,new Y(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Q(r.markerPane,"leaflet-zoom-hide"),Q(r.shadowPane,"leaflet-zoom-hide"))},_resetView:function(r,s,c){Et(this._mapPane,new Y(0,0));var f=!this._loaded;this._loaded=!0,s=this._limitZoom(s),this.fire("viewprereset");var d=this._zoom!==s;this._moveStart(d,c)._move(r,s)._moveEnd(d),this.fire("viewreset"),f&&this.fire("load")},_moveStart:function(r,s){return r&&this.fire("zoomstart"),s||this.fire("movestart"),this},_move:function(r,s,c,f){s===void 0&&(s=this._zoom);var d=this._zoom!==s;return this._zoom=s,this._lastCenter=r,this._pixelOrigin=this._getNewPixelOrigin(r),f?c&&c.pinch&&this.fire("zoom",c):((d||c&&c.pinch)&&this.fire("zoom",c),this.fire("move",c)),this},_moveEnd:function(r){return r&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return B(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(r){Et(this._mapPane,this._getMapPanePos().subtract(r))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(r){this._targets={},this._targets[l(this._container)]=this;var s=r?ft:q;s(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&s(window,"resize",this._onResize,this),W.any3d&&this.options.transform3DLimit&&(r?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){B(this._resizeRequest),this._resizeRequest=D(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var r=this._getMapPanePos();Math.max(Math.abs(r.x),Math.abs(r.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(r,s){for(var c=[],f,d=s==="mouseout"||s==="mouseover",_=r.target||r.srcElement,x=!1;_;){if(f=this._targets[l(_)],f&&(s==="click"||s==="preclick")&&this._draggableMoved(f)){x=!0;break}if(f&&f.listens(s,!0)&&(d&&!Aa(_,r)||(c.push(f),d))||_===this._container)break;_=_.parentNode}return!c.length&&!x&&!d&&this.listens(s,!0)&&(c=[this]),c},_isClickDisabled:function(r){for(;r&&r!==this._container;){if(r._leaflet_disable_click)return!0;r=r.parentNode}},_handleDOMEvent:function(r){var s=r.target||r.srcElement;if(!(!this._loaded||s._leaflet_disable_events||r.type==="click"&&this._isClickDisabled(s))){var c=r.type;c==="mousedown"&&ya(s),this._fireDOMEvent(r,c)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(r,s,c){if(r.type==="click"){var f=i({},r);f.type="preclick",this._fireDOMEvent(f,f.type,c)}var d=this._findEventTargets(r,s);if(c){for(var _=[],x=0;x<c.length;x++)c[x].listens(s,!0)&&_.push(c[x]);d=_.concat(d)}if(d.length){s==="contextmenu"&&Mt(r);var b=d[0],R={originalEvent:r};if(r.type!=="keypress"&&r.type!=="keydown"&&r.type!=="keyup"){var M=b.getLatLng&&(!b._radius||b._radius<=10);R.containerPoint=M?this.latLngToContainerPoint(b.getLatLng()):this.mouseEventToContainerPoint(r),R.layerPoint=this.containerPointToLayerPoint(R.containerPoint),R.latlng=M?b.getLatLng():this.layerPointToLatLng(R.layerPoint)}for(x=0;x<d.length;x++)if(d[x].fire(s,R,!0),R.originalEvent._stopped||d[x].options.bubblingMouseEvents===!1&&P(this._mouseEvents,s)!==-1)return}},_draggableMoved:function(r){return r=r.dragging&&r.dragging.enabled()?r:this,r.dragging&&r.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var r=0,s=this._handlers.length;r<s;r++)this._handlers[r].disable()},whenReady:function(r,s){return this._loaded?r.call(s||this,{target:this}):this.on("load",r,s),this},_getMapPanePos:function(){return hi(this._mapPane)||new Y(0,0)},_moved:function(){var r=this._getMapPanePos();return r&&!r.equals([0,0])},_getTopLeftPoint:function(r,s){var c=r&&s!==void 0?this._getNewPixelOrigin(r,s):this.getPixelOrigin();return c.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(r,s){var c=this.getSize()._divideBy(2);return this.project(r,s)._subtract(c)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(r,s,c){var f=this._getNewPixelOrigin(c,s);return this.project(r,s)._subtract(f)},_latLngBoundsToNewLayerBounds:function(r,s,c){var f=this._getNewPixelOrigin(c,s);return Lt([this.project(r.getSouthWest(),s)._subtract(f),this.project(r.getNorthWest(),s)._subtract(f),this.project(r.getSouthEast(),s)._subtract(f),this.project(r.getNorthEast(),s)._subtract(f)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(r){return this.latLngToLayerPoint(r).subtract(this._getCenterLayerPoint())},_limitCenter:function(r,s,c){if(!c)return r;var f=this.project(r,s),d=this.getSize().divideBy(2),_=new ht(f.subtract(d),f.add(d)),x=this._getBoundsOffset(_,c,s);return Math.abs(x.x)<=1&&Math.abs(x.y)<=1?r:this.unproject(f.add(x),s)},_limitOffset:function(r,s){if(!s)return r;var c=this.getPixelBounds(),f=new ht(c.min.add(r),c.max.add(r));return r.add(this._getBoundsOffset(f,s))},_getBoundsOffset:function(r,s,c){var f=Lt(this.project(s.getNorthEast(),c),this.project(s.getSouthWest(),c)),d=f.min.subtract(r.min),_=f.max.subtract(r.max),x=this._rebound(d.x,-_.x),b=this._rebound(d.y,-_.y);return new Y(x,b)},_rebound:function(r,s){return r+s>0?Math.round(r-s)/2:Math.max(0,Math.ceil(r))-Math.max(0,Math.floor(s))},_limitZoom:function(r){var s=this.getMinZoom(),c=this.getMaxZoom(),f=W.any3d?this.options.zoomSnap:1;return f&&(r=Math.round(r/f)*f),Math.max(s,Math.min(c,r))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){xt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(r,s){var c=this._getCenterOffset(r)._trunc();return(s&&s.animate)!==!0&&!this.getSize().contains(c)?!1:(this.panBy(c,s),!0)},_createAnimProxy:function(){var r=this._proxy=nt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(r),this.on("zoomanim",function(s){var c=ua,f=this._proxy.style[c];li(this._proxy,this.project(s.center,s.zoom),this.getZoomScale(s.zoom,1)),f===this._proxy.style[c]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){gt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var r=this.getCenter(),s=this.getZoom();li(this._proxy,this.project(r,s),this.getZoomScale(s,1))},_catchTransitionEnd:function(r){this._animatingZoom&&r.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(r,s,c){if(this._animatingZoom)return!0;if(c=c||{},!this._zoomAnimated||c.animate===!1||this._nothingToAnimate()||Math.abs(s-this._zoom)>this.options.zoomAnimationThreshold)return!1;var f=this.getZoomScale(s),d=this._getCenterOffset(r)._divideBy(1-1/f);return c.animate!==!0&&!this.getSize().contains(d)?!1:(D(function(){this._moveStart(!0,c.noMoveStart||!1)._animateZoom(r,s,!0)},this),!0)},_animateZoom:function(r,s,c,f){this._mapPane&&(c&&(this._animatingZoom=!0,this._animateToCenter=r,this._animateToZoom=s,Q(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:r,zoom:s,noUpdate:f}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(o(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&xt(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function tT(r,s){return new et(r,s)}var oe=Z.extend({options:{position:"topright"},initialize:function(r){y(this,r)},getPosition:function(){return this.options.position},setPosition:function(r){var s=this._map;return s&&s.removeControl(this),this.options.position=r,s&&s.addControl(this),this},getContainer:function(){return this._container},addTo:function(r){this.remove(),this._map=r;var s=this._container=this.onAdd(r),c=this.getPosition(),f=r._controlCorners[c];return Q(s,"leaflet-control"),c.indexOf("bottom")!==-1?f.insertBefore(s,f.firstChild):f.appendChild(s),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(gt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(r){this._map&&r&&r.screenX>0&&r.screenY>0&&this._map.getContainer().focus()}}),Lr=function(r){return new oe(r)};et.include({addControl:function(r){return r.addTo(this),this},removeControl:function(r){return r.remove(),this},_initControlPos:function(){var r=this._controlCorners={},s="leaflet-",c=this._controlContainer=nt("div",s+"control-container",this._container);function f(d,_){var x=s+d+" "+s+_;r[d+_]=nt("div",x,c)}f("top","left"),f("top","right"),f("bottom","left"),f("bottom","right")},_clearControlPos:function(){for(var r in this._controlCorners)gt(this._controlCorners[r]);gt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var yf=oe.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(r,s,c,f){return c<f?-1:f<c?1:0}},initialize:function(r,s,c){y(this,c),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var f in r)this._addLayer(r[f],f);for(f in s)this._addLayer(s[f],f,!0)},onAdd:function(r){this._initLayout(),this._update(),this._map=r,r.on("zoomend",this._checkDisabledLayers,this);for(var s=0;s<this._layers.length;s++)this._layers[s].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(r){return oe.prototype.addTo.call(this,r),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var r=0;r<this._layers.length;r++)this._layers[r].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(r,s){return this._addLayer(r,s),this._map?this._update():this},addOverlay:function(r,s){return this._addLayer(r,s,!0),this._map?this._update():this},removeLayer:function(r){r.off("add remove",this._onLayerChange,this);var s=this._getLayer(l(r));return s&&this._layers.splice(this._layers.indexOf(s),1),this._map?this._update():this},expand:function(){Q(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var r=this._map.getSize().y-(this._container.offsetTop+50);return r<this._section.clientHeight?(Q(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=r+"px"):xt(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return xt(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var r="leaflet-control-layers",s=this._container=nt("div",r),c=this.options.collapsed;s.setAttribute("aria-haspopup",!0),Br(s),ba(s);var f=this._section=nt("section",r+"-list");c&&(this._map.on("click",this.collapse,this),q(s,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var d=this._layersLink=nt("a",r+"-toggle",s);d.href="#",d.title="Layers",d.setAttribute("role","button"),q(d,{keydown:function(_){_.keyCode===13&&this._expandSafely()},click:function(_){Mt(_),this._expandSafely()}},this),c||this.expand(),this._baseLayersList=nt("div",r+"-base",f),this._separator=nt("div",r+"-separator",f),this._overlaysList=nt("div",r+"-overlays",f),s.appendChild(f)},_getLayer:function(r){for(var s=0;s<this._layers.length;s++)if(this._layers[s]&&l(this._layers[s].layer)===r)return this._layers[s]},_addLayer:function(r,s,c){this._map&&r.on("add remove",this._onLayerChange,this),this._layers.push({layer:r,name:s,overlay:c}),this.options.sortLayers&&this._layers.sort(o(function(f,d){return this.options.sortFunction(f.layer,d.layer,f.name,d.name)},this)),this.options.autoZIndex&&r.setZIndex&&(this._lastZIndex++,r.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;so(this._baseLayersList),so(this._overlaysList),this._layerControlInputs=[];var r,s,c,f,d=0;for(c=0;c<this._layers.length;c++)f=this._layers[c],this._addItem(f),s=s||f.overlay,r=r||!f.overlay,d+=f.overlay?0:1;return this.options.hideSingleBase&&(r=r&&d>1,this._baseLayersList.style.display=r?"":"none"),this._separator.style.display=s&&r?"":"none",this},_onLayerChange:function(r){this._handlingClick||this._update();var s=this._getLayer(l(r.target)),c=s.overlay?r.type==="add"?"overlayadd":"overlayremove":r.type==="add"?"baselayerchange":null;c&&this._map.fire(c,s)},_createRadioElement:function(r,s){var c='<input type="radio" class="leaflet-control-layers-selector" name="'+r+'"'+(s?' checked="checked"':"")+"/>",f=document.createElement("div");return f.innerHTML=c,f.firstChild},_addItem:function(r){var s=document.createElement("label"),c=this._map.hasLayer(r.layer),f;r.overlay?(f=document.createElement("input"),f.type="checkbox",f.className="leaflet-control-layers-selector",f.defaultChecked=c):f=this._createRadioElement("leaflet-base-layers_"+l(this),c),this._layerControlInputs.push(f),f.layerId=l(r.layer),q(f,"click",this._onInputClick,this);var d=document.createElement("span");d.innerHTML=" "+r.name;var _=document.createElement("span");s.appendChild(_),_.appendChild(f),_.appendChild(d);var x=r.overlay?this._overlaysList:this._baseLayersList;return x.appendChild(s),this._checkDisabledLayers(),s},_onInputClick:function(){if(!this._preventClick){var r=this._layerControlInputs,s,c,f=[],d=[];this._handlingClick=!0;for(var _=r.length-1;_>=0;_--)s=r[_],c=this._getLayer(s.layerId).layer,s.checked?f.push(c):s.checked||d.push(c);for(_=0;_<d.length;_++)this._map.hasLayer(d[_])&&this._map.removeLayer(d[_]);for(_=0;_<f.length;_++)this._map.hasLayer(f[_])||this._map.addLayer(f[_]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var r=this._layerControlInputs,s,c,f=this._map.getZoom(),d=r.length-1;d>=0;d--)s=r[d],c=this._getLayer(s.layerId).layer,s.disabled=c.options.minZoom!==void 0&&f<c.options.minZoom||c.options.maxZoom!==void 0&&f>c.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var r=this._section;this._preventClick=!0,q(r,"click",Mt),this.expand();var s=this;setTimeout(function(){ft(r,"click",Mt),s._preventClick=!1})}}),eT=function(r,s,c){return new yf(r,s,c)},Ra=oe.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"},onAdd:function(r){var s="leaflet-control-zoom",c=nt("div",s+" leaflet-bar"),f=this.options;return this._zoomInButton=this._createButton(f.zoomInText,f.zoomInTitle,s+"-in",c,this._zoomIn),this._zoomOutButton=this._createButton(f.zoomOutText,f.zoomOutTitle,s+"-out",c,this._zoomOut),this._updateDisabled(),r.on("zoomend zoomlevelschange",this._updateDisabled,this),c},onRemove:function(r){r.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(r){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(r.shiftKey?3:1))},_zoomOut:function(r){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(r.shiftKey?3:1))},_createButton:function(r,s,c,f,d){var _=nt("a",c,f);return _.innerHTML=r,_.href="#",_.title=s,_.setAttribute("role","button"),_.setAttribute("aria-label",s),Br(_),q(_,"click",ui),q(_,"click",d,this),q(_,"click",this._refocusOnMap,this),_},_updateDisabled:function(){var r=this._map,s="leaflet-disabled";xt(this._zoomInButton,s),xt(this._zoomOutButton,s),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||r._zoom===r.getMinZoom())&&(Q(this._zoomOutButton,s),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||r._zoom===r.getMaxZoom())&&(Q(this._zoomInButton,s),this._zoomInButton.setAttribute("aria-disabled","true"))}});et.mergeOptions({zoomControl:!0}),et.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ra,this.addControl(this.zoomControl))});var iT=function(r){return new Ra(r)},xf=oe.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(r){var s="leaflet-control-scale",c=nt("div",s),f=this.options;return this._addScales(f,s+"-line",c),r.on(f.updateWhenIdle?"moveend":"move",this._update,this),r.whenReady(this._update,this),c},onRemove:function(r){r.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(r,s,c){r.metric&&(this._mScale=nt("div",s,c)),r.imperial&&(this._iScale=nt("div",s,c))},_update:function(){var r=this._map,s=r.getSize().y/2,c=r.distance(r.containerPointToLatLng([0,s]),r.containerPointToLatLng([this.options.maxWidth,s]));this._updateScales(c)},_updateScales:function(r){this.options.metric&&r&&this._updateMetric(r),this.options.imperial&&r&&this._updateImperial(r)},_updateMetric:function(r){var s=this._getRoundNum(r),c=s<1e3?s+" m":s/1e3+" km";this._updateScale(this._mScale,c,s/r)},_updateImperial:function(r){var s=r*3.2808399,c,f,d;s>5280?(c=s/5280,f=this._getRoundNum(c),this._updateScale(this._iScale,f+" mi",f/c)):(d=this._getRoundNum(s),this._updateScale(this._iScale,d+" ft",d/s))},_updateScale:function(r,s,c){r.style.width=Math.round(this.options.maxWidth*c)+"px",r.innerHTML=s},_getRoundNum:function(r){var s=Math.pow(10,(Math.floor(r)+"").length-1),c=r/s;return c=c>=10?10:c>=5?5:c>=3?3:c>=2?2:1,s*c}}),rT=function(r){return new xf(r)},nT='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',wa=oe.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(W.inlineSvg?nT+" ":"")+"Leaflet</a>"},initialize:function(r){y(this,r),this._attributions={}},onAdd:function(r){r.attributionControl=this,this._container=nt("div","leaflet-control-attribution"),Br(this._container);for(var s in r._layers)r._layers[s].getAttribution&&this.addAttribution(r._layers[s].getAttribution());return this._update(),r.on("layeradd",this._addAttribution,this),this._container},onRemove:function(r){r.off("layeradd",this._addAttribution,this)},_addAttribution:function(r){r.layer.getAttribution&&(this.addAttribution(r.layer.getAttribution()),r.layer.once("remove",function(){this.removeAttribution(r.layer.getAttribution())},this))},setPrefix:function(r){return this.options.prefix=r,this._update(),this},addAttribution:function(r){return r?(this._attributions[r]||(this._attributions[r]=0),this._attributions[r]++,this._update(),this):this},removeAttribution:function(r){return r?(this._attributions[r]&&(this._attributions[r]--,this._update()),this):this},_update:function(){if(this._map){var r=[];for(var s in this._attributions)this._attributions[s]&&r.push(s);var c=[];this.options.prefix&&c.push(this.options.prefix),r.length&&c.push(r.join(", ")),this._container.innerHTML=c.join(' <span aria-hidden="true">|</span> ')}}});et.mergeOptions({attributionControl:!0}),et.addInitHook(function(){this.options.attributionControl&&new wa().addTo(this)});var oT=function(r){return new wa(r)};oe.Layers=yf,oe.Zoom=Ra,oe.Scale=xf,oe.Attribution=wa,Lr.layers=eT,Lr.zoom=iT,Lr.scale=rT,Lr.attribution=oT;var _e=Z.extend({initialize:function(r){this._map=r},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});_e.addTo=function(r,s){return r.addHandler(s,this),this};var sT={Events:X},vf=W.touch?"touchstart mousedown":"mousedown",Ye=mt.extend({options:{clickTolerance:3},initialize:function(r,s,c,f){y(this,f),this._element=r,this._dragStartTarget=s||r,this._preventOutline=c},enable:function(){this._enabled||(q(this._dragStartTarget,vf,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ye._dragging===this&&this.finishDrag(!0),ft(this._dragStartTarget,vf,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(r){if(this._enabled&&(this._moved=!1,!da(this._element,"leaflet-zoom-anim"))){if(r.touches&&r.touches.length!==1){Ye._dragging===this&&this.finishDrag();return}if(!(Ye._dragging||r.shiftKey||r.which!==1&&r.button!==1&&!r.touches)&&(Ye._dragging=this,this._preventOutline&&ya(this._element),ma(),Nr(),!this._moving)){this.fire("down");var s=r.touches?r.touches[0]:r,c=df(this._element);this._startPoint=new Y(s.clientX,s.clientY),this._startPos=hi(this._element),this._parentScale=xa(c);var f=r.type==="mousedown";q(document,f?"mousemove":"touchmove",this._onMove,this),q(document,f?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(r){if(this._enabled){if(r.touches&&r.touches.length>1){this._moved=!0;return}var s=r.touches&&r.touches.length===1?r.touches[0]:r,c=new Y(s.clientX,s.clientY)._subtract(this._startPoint);!c.x&&!c.y||Math.abs(c.x)+Math.abs(c.y)<this.options.clickTolerance||(c.x/=this._parentScale.x,c.y/=this._parentScale.y,Mt(r),this._moved||(this.fire("dragstart"),this._moved=!0,Q(document.body,"leaflet-dragging"),this._lastTarget=r.target||r.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Q(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(c),this._moving=!0,this._lastEvent=r,this._updatePosition())}},_updatePosition:function(){var r={originalEvent:this._lastEvent};this.fire("predrag",r),Et(this._element,this._newPos),this.fire("drag",r)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(r){xt(document.body,"leaflet-dragging"),this._lastTarget&&(xt(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),ft(document,"mousemove touchmove",this._onMove,this),ft(document,"mouseup touchend touchcancel",this._onUp,this),ga(),Dr();var s=this._moved&&this._moving;this._moving=!1,Ye._dragging=!1,s&&this.fire("dragend",{noInertia:r,distance:this._newPos.distanceTo(this._startPos)})}});function Ef(r,s,c){var f,d=[1,4,2,8],_,x,b,R,M,k,$,G;for(_=0,k=r.length;_<k;_++)r[_]._code=di(r[_],s);for(b=0;b<4;b++){for($=d[b],f=[],_=0,k=r.length,x=k-1;_<k;x=_++)R=r[_],M=r[x],R._code&$?M._code&$||(G=fo(M,R,$,s,c),G._code=di(G,s),f.push(G)):(M._code&$&&(G=fo(M,R,$,s,c),G._code=di(G,s),f.push(G)),f.push(R));r=f}return r}function Sf(r,s){var c,f,d,_,x,b,R,M,k;if(!r||r.length===0)throw new Error("latlngs not passed");$t(r)||(console.warn("latlngs are not flat! Only the first ring will be used"),r=r[0]);var $=tt([0,0]),G=vt(r),Dt=G.getNorthWest().distanceTo(G.getSouthWest())*G.getNorthEast().distanceTo(G.getNorthWest());Dt<1700&&($=Pa(r));var Rt=r.length,Yt=[];for(c=0;c<Rt;c++){var Ut=tt(r[c]);Yt.push(s.project(tt([Ut.lat-$.lat,Ut.lng-$.lng])))}for(b=R=M=0,c=0,f=Rt-1;c<Rt;f=c++)d=Yt[c],_=Yt[f],x=d.y*_.x-_.y*d.x,R+=(d.x+_.x)*x,M+=(d.y+_.y)*x,b+=x*3;b===0?k=Yt[0]:k=[R/b,M/b];var Wi=s.unproject(K(k));return tt([Wi.lat+$.lat,Wi.lng+$.lng])}function Pa(r){for(var s=0,c=0,f=0,d=0;d<r.length;d++){var _=tt(r[d]);s+=_.lat,c+=_.lng,f++}return tt([s/f,c/f])}var aT={__proto__:null,clipPolygon:Ef,polygonCenter:Sf,centroid:Pa};function bf(r,s){if(!s||!r.length)return r.slice();var c=s*s;return r=hT(r,c),r=lT(r,c),r}function Af(r,s,c){return Math.sqrt(kr(r,s,c,!0))}function cT(r,s,c){return kr(r,s,c)}function lT(r,s){var c=r.length,f=typeof Uint8Array!=void 0+""?Uint8Array:Array,d=new f(c);d[0]=d[c-1]=1,Ma(r,d,s,0,c-1);var _,x=[];for(_=0;_<c;_++)d[_]&&x.push(r[_]);return x}function Ma(r,s,c,f,d){var _=0,x,b,R;for(b=f+1;b<=d-1;b++)R=kr(r[b],r[f],r[d],!0),R>_&&(x=b,_=R);_>c&&(s[x]=1,Ma(r,s,c,f,x),Ma(r,s,c,x,d))}function hT(r,s){for(var c=[r[0]],f=1,d=0,_=r.length;f<_;f++)fT(r[f],r[d])>s&&(c.push(r[f]),d=f);return d<_-1&&c.push(r[_-1]),c}var Rf;function wf(r,s,c,f,d){var _=f?Rf:di(r,c),x=di(s,c),b,R,M;for(Rf=x;;){if(!(_|x))return[r,s];if(_&x)return!1;b=_||x,R=fo(r,s,b,c,d),M=di(R,c),b===_?(r=R,_=M):(s=R,x=M)}}function fo(r,s,c,f,d){var _=s.x-r.x,x=s.y-r.y,b=f.min,R=f.max,M,k;return c&8?(M=r.x+_*(R.y-r.y)/x,k=R.y):c&4?(M=r.x+_*(b.y-r.y)/x,k=b.y):c&2?(M=R.x,k=r.y+x*(R.x-r.x)/_):c&1&&(M=b.x,k=r.y+x*(b.x-r.x)/_),new Y(M,k,d)}function di(r,s){var c=0;return r.x<s.min.x?c|=1:r.x>s.max.x&&(c|=2),r.y<s.min.y?c|=4:r.y>s.max.y&&(c|=8),c}function fT(r,s){var c=s.x-r.x,f=s.y-r.y;return c*c+f*f}function kr(r,s,c,f){var d=s.x,_=s.y,x=c.x-d,b=c.y-_,R=x*x+b*b,M;return R>0&&(M=((r.x-d)*x+(r.y-_)*b)/R,M>1?(d=c.x,_=c.y):M>0&&(d+=x*M,_+=b*M)),x=r.x-d,b=r.y-_,f?x*x+b*b:new Y(d,_)}function $t(r){return!A(r[0])||typeof r[0][0]!="object"&&typeof r[0][0]<"u"}function Pf(r){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),$t(r)}function Mf(r,s){var c,f,d,_,x,b,R,M;if(!r||r.length===0)throw new Error("latlngs not passed");$t(r)||(console.warn("latlngs are not flat! Only the first ring will be used"),r=r[0]);var k=tt([0,0]),$=vt(r),G=$.getNorthWest().distanceTo($.getSouthWest())*$.getNorthEast().distanceTo($.getNorthWest());G<1700&&(k=Pa(r));var Dt=r.length,Rt=[];for(c=0;c<Dt;c++){var Yt=tt(r[c]);Rt.push(s.project(tt([Yt.lat-k.lat,Yt.lng-k.lng])))}for(c=0,f=0;c<Dt-1;c++)f+=Rt[c].distanceTo(Rt[c+1])/2;if(f===0)M=Rt[0];else for(c=0,_=0;c<Dt-1;c++)if(x=Rt[c],b=Rt[c+1],d=x.distanceTo(b),_+=d,_>f){R=(_-f)/d,M=[b.x-R*(b.x-x.x),b.y-R*(b.y-x.y)];break}var Ut=s.unproject(K(M));return tt([Ut.lat+k.lat,Ut.lng+k.lng])}var uT={__proto__:null,simplify:bf,pointToSegmentDistance:Af,closestPointOnSegment:cT,clipSegment:wf,_getEdgeIntersection:fo,_getBitCode:di,_sqClosestPointOnSegment:kr,isFlat:$t,_flat:Pf,polylineCenter:Mf},Ca={project:function(r){return new Y(r.lng,r.lat)},unproject:function(r){return new st(r.y,r.x)},bounds:new ht([-180,-90],[180,90])},Ia={R:6378137,R_MINOR:6356752314245179e-9,bounds:new ht([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(r){var s=Math.PI/180,c=this.R,f=r.lat*s,d=this.R_MINOR/c,_=Math.sqrt(1-d*d),x=_*Math.sin(f),b=Math.tan(Math.PI/4-f/2)/Math.pow((1-x)/(1+x),_/2);return f=-c*Math.log(Math.max(b,1e-10)),new Y(r.lng*s*c,f)},unproject:function(r){for(var s=180/Math.PI,c=this.R,f=this.R_MINOR/c,d=Math.sqrt(1-f*f),_=Math.exp(-r.y/c),x=Math.PI/2-2*Math.atan(_),b=0,R=.1,M;b<15&&Math.abs(R)>1e-7;b++)M=d*Math.sin(x),M=Math.pow((1-M)/(1+M),d/2),R=Math.PI/2-2*Math.atan(_*M)-x,x+=R;return new st(x*s,r.x*s/c)}},dT={__proto__:null,LonLat:Ca,Mercator:Ia,SphericalMercator:ra},pT=i({},$e,{code:"EPSG:3395",projection:Ia,transformation:function(){var r=.5/(Math.PI*Ia.R);return Mr(r,.5,-r,.5)}()}),Cf=i({},$e,{code:"EPSG:4326",projection:Ca,transformation:Mr(1/180,1,-1/180,.5)}),_T=i({},Pe,{projection:Ca,transformation:Mr(1,0,-1,0),scale:function(r){return Math.pow(2,r)},zoom:function(r){return Math.log(r)/Math.LN2},distance:function(r,s){var c=s.lng-r.lng,f=s.lat-r.lat;return Math.sqrt(c*c+f*f)},infinite:!0});Pe.Earth=$e,Pe.EPSG3395=pT,Pe.EPSG3857=oa,Pe.EPSG900913=vg,Pe.EPSG4326=Cf,Pe.Simple=_T;var se=mt.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(r){return r.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(r){return r&&r.removeLayer(this),this},getPane:function(r){return this._map.getPane(r?this.options[r]||r:this.options.pane)},addInteractiveTarget:function(r){return this._map._targets[l(r)]=this,this},removeInteractiveTarget:function(r){return delete this._map._targets[l(r)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(r){var s=r.target;if(s.hasLayer(this)){if(this._map=s,this._zoomAnimated=s._zoomAnimated,this.getEvents){var c=this.getEvents();s.on(c,this),this.once("remove",function(){s.off(c,this)},this)}this.onAdd(s),this.fire("add"),s.fire("layeradd",{layer:this})}}});et.include({addLayer:function(r){if(!r._layerAdd)throw new Error("The provided object is not a Layer.");var s=l(r);return this._layers[s]?this:(this._layers[s]=r,r._mapToAdd=this,r.beforeAdd&&r.beforeAdd(this),this.whenReady(r._layerAdd,r),this)},removeLayer:function(r){var s=l(r);return this._layers[s]?(this._loaded&&r.onRemove(this),delete this._layers[s],this._loaded&&(this.fire("layerremove",{layer:r}),r.fire("remove")),r._map=r._mapToAdd=null,this):this},hasLayer:function(r){return l(r)in this._layers},eachLayer:function(r,s){for(var c in this._layers)r.call(s,this._layers[c]);return this},_addLayers:function(r){r=r?A(r)?r:[r]:[];for(var s=0,c=r.length;s<c;s++)this.addLayer(r[s])},_addZoomLimit:function(r){(!isNaN(r.options.maxZoom)||!isNaN(r.options.minZoom))&&(this._zoomBoundLayers[l(r)]=r,this._updateZoomLevels())},_removeZoomLimit:function(r){var s=l(r);this._zoomBoundLayers[s]&&(delete this._zoomBoundLayers[s],this._updateZoomLevels())},_updateZoomLevels:function(){var r=1/0,s=-1/0,c=this._getZoomSpan();for(var f in this._zoomBoundLayers){var d=this._zoomBoundLayers[f].options;r=d.minZoom===void 0?r:Math.min(r,d.minZoom),s=d.maxZoom===void 0?s:Math.max(s,d.maxZoom)}this._layersMaxZoom=s===-1/0?void 0:s,this._layersMinZoom=r===1/0?void 0:r,c!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Li=se.extend({initialize:function(r,s){y(this,s),this._layers={};var c,f;if(r)for(c=0,f=r.length;c<f;c++)this.addLayer(r[c])},addLayer:function(r){var s=this.getLayerId(r);return this._layers[s]=r,this._map&&this._map.addLayer(r),this},removeLayer:function(r){var s=r in this._layers?r:this.getLayerId(r);return this._map&&this._layers[s]&&this._map.removeLayer(this._layers[s]),delete this._layers[s],this},hasLayer:function(r){var s=typeof r=="number"?r:this.getLayerId(r);return s in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(r){var s=Array.prototype.slice.call(arguments,1),c,f;for(c in this._layers)f=this._layers[c],f[r]&&f[r].apply(f,s);return this},onAdd:function(r){this.eachLayer(r.addLayer,r)},onRemove:function(r){this.eachLayer(r.removeLayer,r)},eachLayer:function(r,s){for(var c in this._layers)r.call(s,this._layers[c]);return this},getLayer:function(r){return this._layers[r]},getLayers:function(){var r=[];return this.eachLayer(r.push,r),r},setZIndex:function(r){return this.invoke("setZIndex",r)},getLayerId:function(r){return l(r)}}),mT=function(r,s){return new Li(r,s)},Me=Li.extend({addLayer:function(r){return this.hasLayer(r)?this:(r.addEventParent(this),Li.prototype.addLayer.call(this,r),this.fire("layeradd",{layer:r}))},removeLayer:function(r){return this.hasLayer(r)?(r in this._layers&&(r=this._layers[r]),r.removeEventParent(this),Li.prototype.removeLayer.call(this,r),this.fire("layerremove",{layer:r})):this},setStyle:function(r){return this.invoke("setStyle",r)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var r=new kt;for(var s in this._layers){var c=this._layers[s];r.extend(c.getBounds?c.getBounds():c.getLatLng())}return r}}),gT=function(r,s){return new Me(r,s)},ki=Z.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(r){y(this,r)},createIcon:function(r){return this._createIcon("icon",r)},createShadow:function(r){return this._createIcon("shadow",r)},_createIcon:function(r,s){var c=this._getIconUrl(r);if(!c){if(r==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var f=this._createImg(c,s&&s.tagName==="IMG"?s:null);return this._setIconStyles(f,r),(this.options.crossOrigin||this.options.crossOrigin==="")&&(f.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),f},_setIconStyles:function(r,s){var c=this.options,f=c[s+"Size"];typeof f=="number"&&(f=[f,f]);var d=K(f),_=K(s==="shadow"&&c.shadowAnchor||c.iconAnchor||d&&d.divideBy(2,!0));r.className="leaflet-marker-"+s+" "+(c.className||""),_&&(r.style.marginLeft=-_.x+"px",r.style.marginTop=-_.y+"px"),d&&(r.style.width=d.x+"px",r.style.height=d.y+"px")},_createImg:function(r,s){return s=s||document.createElement("img"),s.src=r,s},_getIconUrl:function(r){return W.retina&&this.options[r+"RetinaUrl"]||this.options[r+"Url"]}});function TT(r){return new ki(r)}var Ur=ki.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(r){return typeof Ur.imagePath!="string"&&(Ur.imagePath=this._detectIconPath()),(this.options.imagePath||Ur.imagePath)+ki.prototype._getIconUrl.call(this,r)},_stripUrl:function(r){var s=function(c,f,d){var _=f.exec(c);return _&&_[d]};return r=s(r,/^url\((['"])?(.+)\1\)$/,2),r&&s(r,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var r=nt("div","leaflet-default-icon-path",document.body),s=Or(r,"background-image")||Or(r,"backgroundImage");if(document.body.removeChild(r),s=this._stripUrl(s),s)return s;var c=document.querySelector('link[href$="leaflet.css"]');return c?c.href.substring(0,c.href.length-11-1):""}}),If=_e.extend({initialize:function(r){this._marker=r},addHooks:function(){var r=this._marker._icon;this._draggable||(this._draggable=new Ye(r,r,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Q(r,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&xt(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(r){var s=this._marker,c=s._map,f=this._marker.options.autoPanSpeed,d=this._marker.options.autoPanPadding,_=hi(s._icon),x=c.getPixelBounds(),b=c.getPixelOrigin(),R=Lt(x.min._subtract(b).add(d),x.max._subtract(b).subtract(d));if(!R.contains(_)){var M=K((Math.max(R.max.x,_.x)-R.max.x)/(x.max.x-R.max.x)-(Math.min(R.min.x,_.x)-R.min.x)/(x.min.x-R.min.x),(Math.max(R.max.y,_.y)-R.max.y)/(x.max.y-R.max.y)-(Math.min(R.min.y,_.y)-R.min.y)/(x.min.y-R.min.y)).multiplyBy(f);c.panBy(M,{animate:!1}),this._draggable._newPos._add(M),this._draggable._startPos._add(M),Et(s._icon,this._draggable._newPos),this._onDrag(r),this._panRequest=D(this._adjustPan.bind(this,r))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(r){this._marker.options.autoPan&&(B(this._panRequest),this._panRequest=D(this._adjustPan.bind(this,r)))},_onDrag:function(r){var s=this._marker,c=s._shadow,f=hi(s._icon),d=s._map.layerPointToLatLng(f);c&&Et(c,f),s._latlng=d,r.latlng=d,r.oldLatLng=this._oldLatLng,s.fire("move",r).fire("drag",r)},_onDragEnd:function(r){B(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",r)}}),uo=se.extend({options:{icon:new Ur,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(r,s){y(this,s),this._latlng=tt(r)},onAdd:function(r){this._zoomAnimated=this._zoomAnimated&&r.options.markerZoomAnimation,this._zoomAnimated&&r.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(r){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&r.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(r){var s=this._latlng;return this._latlng=tt(r),this.update(),this.fire("move",{oldLatLng:s,latlng:this._latlng})},setZIndexOffset:function(r){return this.options.zIndexOffset=r,this.update()},getIcon:function(){return this.options.icon},setIcon:function(r){return this.options.icon=r,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var r=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(r)}return this},_initIcon:function(){var r=this.options,s="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),c=r.icon.createIcon(this._icon),f=!1;c!==this._icon&&(this._icon&&this._removeIcon(),f=!0,r.title&&(c.title=r.title),c.tagName==="IMG"&&(c.alt=r.alt||"")),Q(c,s),r.keyboard&&(c.tabIndex="0",c.setAttribute("role","button")),this._icon=c,r.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&q(c,"focus",this._panOnFocus,this);var d=r.icon.createShadow(this._shadow),_=!1;d!==this._shadow&&(this._removeShadow(),_=!0),d&&(Q(d,s),d.alt=""),this._shadow=d,r.opacity<1&&this._updateOpacity(),f&&this.getPane().appendChild(this._icon),this._initInteraction(),d&&_&&this.getPane(r.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&ft(this._icon,"focus",this._panOnFocus,this),gt(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&gt(this._shadow),this._shadow=null},_setPos:function(r){this._icon&&Et(this._icon,r),this._shadow&&Et(this._shadow,r),this._zIndex=r.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(r){this._icon&&(this._icon.style.zIndex=this._zIndex+r)},_animateZoom:function(r){var s=this._map._latLngToNewLayerPoint(this._latlng,r.zoom,r.center).round();this._setPos(s)},_initInteraction:function(){if(this.options.interactive&&(Q(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),If)){var r=this.options.draggable;this.dragging&&(r=this.dragging.enabled(),this.dragging.disable()),this.dragging=new If(this),r&&this.dragging.enable()}},setOpacity:function(r){return this.options.opacity=r,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var r=this.options.opacity;this._icon&&Zt(this._icon,r),this._shadow&&Zt(this._shadow,r)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var r=this._map;if(r){var s=this.options.icon.options,c=s.iconSize?K(s.iconSize):K(0,0),f=s.iconAnchor?K(s.iconAnchor):K(0,0);r.panInside(this._latlng,{paddingTopLeft:f,paddingBottomRight:c.subtract(f)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function yT(r,s){return new uo(r,s)}var Ke=se.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(r){this._renderer=r.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(r){return y(this,r),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&r&&Object.prototype.hasOwnProperty.call(r,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),po=Ke.extend({options:{fill:!0,radius:10},initialize:function(r,s){y(this,s),this._latlng=tt(r),this._radius=this.options.radius},setLatLng:function(r){var s=this._latlng;return this._latlng=tt(r),this.redraw(),this.fire("move",{oldLatLng:s,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(r){return this.options.radius=this._radius=r,this.redraw()},getRadius:function(){return this._radius},setStyle:function(r){var s=r&&r.radius||this._radius;return Ke.prototype.setStyle.call(this,r),this.setRadius(s),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var r=this._radius,s=this._radiusY||r,c=this._clickTolerance(),f=[r+c,s+c];this._pxBounds=new ht(this._point.subtract(f),this._point.add(f))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(r){return r.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function xT(r,s){return new po(r,s)}var Oa=po.extend({initialize:function(r,s,c){if(typeof s=="number"&&(s=i({},c,{radius:s})),y(this,s),this._latlng=tt(r),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(r){return this._mRadius=r,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var r=[this._radius,this._radiusY||this._radius];return new kt(this._map.layerPointToLatLng(this._point.subtract(r)),this._map.layerPointToLatLng(this._point.add(r)))},setStyle:Ke.prototype.setStyle,_project:function(){var r=this._latlng.lng,s=this._latlng.lat,c=this._map,f=c.options.crs;if(f.distance===$e.distance){var d=Math.PI/180,_=this._mRadius/$e.R/d,x=c.project([s+_,r]),b=c.project([s-_,r]),R=x.add(b).divideBy(2),M=c.unproject(R).lat,k=Math.acos((Math.cos(_*d)-Math.sin(s*d)*Math.sin(M*d))/(Math.cos(s*d)*Math.cos(M*d)))/d;(isNaN(k)||k===0)&&(k=_/Math.cos(Math.PI/180*s)),this._point=R.subtract(c.getPixelOrigin()),this._radius=isNaN(k)?0:R.x-c.project([M,r-k]).x,this._radiusY=R.y-x.y}else{var $=f.unproject(f.project(this._latlng).subtract([this._mRadius,0]));this._point=c.latLngToLayerPoint(this._latlng),this._radius=this._point.x-c.latLngToLayerPoint($).x}this._updateBounds()}});function vT(r,s,c){return new Oa(r,s,c)}var Ce=Ke.extend({options:{smoothFactor:1,noClip:!1},initialize:function(r,s){y(this,s),this._setLatLngs(r)},getLatLngs:function(){return this._latlngs},setLatLngs:function(r){return this._setLatLngs(r),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(r){for(var s=1/0,c=null,f=kr,d,_,x=0,b=this._parts.length;x<b;x++)for(var R=this._parts[x],M=1,k=R.length;M<k;M++){d=R[M-1],_=R[M];var $=f(r,d,_,!0);$<s&&(s=$,c=f(r,d,_))}return c&&(c.distance=Math.sqrt(s)),c},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Mf(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(r,s){return s=s||this._defaultShape(),r=tt(r),s.push(r),this._bounds.extend(r),this.redraw()},_setLatLngs:function(r){this._bounds=new kt,this._latlngs=this._convertLatLngs(r)},_defaultShape:function(){return $t(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(r){for(var s=[],c=$t(r),f=0,d=r.length;f<d;f++)c?(s[f]=tt(r[f]),this._bounds.extend(s[f])):s[f]=this._convertLatLngs(r[f]);return s},_project:function(){var r=new ht;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,r),this._bounds.isValid()&&r.isValid()&&(this._rawPxBounds=r,this._updateBounds())},_updateBounds:function(){var r=this._clickTolerance(),s=new Y(r,r);this._rawPxBounds&&(this._pxBounds=new ht([this._rawPxBounds.min.subtract(s),this._rawPxBounds.max.add(s)]))},_projectLatlngs:function(r,s,c){var f=r[0]instanceof st,d=r.length,_,x;if(f){for(x=[],_=0;_<d;_++)x[_]=this._map.latLngToLayerPoint(r[_]),c.extend(x[_]);s.push(x)}else for(_=0;_<d;_++)this._projectLatlngs(r[_],s,c)},_clipPoints:function(){var r=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(r))){if(this.options.noClip){this._parts=this._rings;return}var s=this._parts,c,f,d,_,x,b,R;for(c=0,d=0,_=this._rings.length;c<_;c++)for(R=this._rings[c],f=0,x=R.length;f<x-1;f++)b=wf(R[f],R[f+1],r,f,!0),b&&(s[d]=s[d]||[],s[d].push(b[0]),(b[1]!==R[f+1]||f===x-2)&&(s[d].push(b[1]),d++))}},_simplifyPoints:function(){for(var r=this._parts,s=this.options.smoothFactor,c=0,f=r.length;c<f;c++)r[c]=bf(r[c],s)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(r,s){var c,f,d,_,x,b,R=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(r))return!1;for(c=0,_=this._parts.length;c<_;c++)for(b=this._parts[c],f=0,x=b.length,d=x-1;f<x;d=f++)if(!(!s&&f===0)&&Af(r,b[d],b[f])<=R)return!0;return!1}});function ET(r,s){return new Ce(r,s)}Ce._flat=Pf;var Ui=Ce.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Sf(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(r){var s=Ce.prototype._convertLatLngs.call(this,r),c=s.length;return c>=2&&s[0]instanceof st&&s[0].equals(s[c-1])&&s.pop(),s},_setLatLngs:function(r){Ce.prototype._setLatLngs.call(this,r),$t(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return $t(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var r=this._renderer._bounds,s=this.options.weight,c=new Y(s,s);if(r=new ht(r.min.subtract(c),r.max.add(c)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(r))){if(this.options.noClip){this._parts=this._rings;return}for(var f=0,d=this._rings.length,_;f<d;f++)_=Ef(this._rings[f],r,!0),_.length&&this._parts.push(_)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(r){var s=!1,c,f,d,_,x,b,R,M;if(!this._pxBounds||!this._pxBounds.contains(r))return!1;for(_=0,R=this._parts.length;_<R;_++)for(c=this._parts[_],x=0,M=c.length,b=M-1;x<M;b=x++)f=c[x],d=c[b],f.y>r.y!=d.y>r.y&&r.x<(d.x-f.x)*(r.y-f.y)/(d.y-f.y)+f.x&&(s=!s);return s||Ce.prototype._containsPoint.call(this,r,!0)}});function ST(r,s){return new Ui(r,s)}var Ie=Me.extend({initialize:function(r,s){y(this,s),this._layers={},r&&this.addData(r)},addData:function(r){var s=A(r)?r:r.features,c,f,d;if(s){for(c=0,f=s.length;c<f;c++)d=s[c],(d.geometries||d.geometry||d.features||d.coordinates)&&this.addData(d);return this}var _=this.options;if(_.filter&&!_.filter(r))return this;var x=_o(r,_);return x?(x.feature=To(r),x.defaultOptions=x.options,this.resetStyle(x),_.onEachFeature&&_.onEachFeature(r,x),this.addLayer(x)):this},resetStyle:function(r){return r===void 0?this.eachLayer(this.resetStyle,this):(r.options=i({},r.defaultOptions),this._setLayerStyle(r,this.options.style),this)},setStyle:function(r){return this.eachLayer(function(s){this._setLayerStyle(s,r)},this)},_setLayerStyle:function(r,s){r.setStyle&&(typeof s=="function"&&(s=s(r.feature)),r.setStyle(s))}});function _o(r,s){var c=r.type==="Feature"?r.geometry:r,f=c?c.coordinates:null,d=[],_=s&&s.pointToLayer,x=s&&s.coordsToLatLng||Na,b,R,M,k;if(!f&&!c)return null;switch(c.type){case"Point":return b=x(f),Of(_,r,b,s);case"MultiPoint":for(M=0,k=f.length;M<k;M++)b=x(f[M]),d.push(Of(_,r,b,s));return new Me(d);case"LineString":case"MultiLineString":return R=mo(f,c.type==="LineString"?0:1,x),new Ce(R,s);case"Polygon":case"MultiPolygon":return R=mo(f,c.type==="Polygon"?1:2,x),new Ui(R,s);case"GeometryCollection":for(M=0,k=c.geometries.length;M<k;M++){var $=_o({geometry:c.geometries[M],type:"Feature",properties:r.properties},s);$&&d.push($)}return new Me(d);case"FeatureCollection":for(M=0,k=c.features.length;M<k;M++){var G=_o(c.features[M],s);G&&d.push(G)}return new Me(d);default:throw new Error("Invalid GeoJSON object.")}}function Of(r,s,c,f){return r?r(s,c):new uo(c,f&&f.markersInheritOptions&&f)}function Na(r){return new st(r[1],r[0],r[2])}function mo(r,s,c){for(var f=[],d=0,_=r.length,x;d<_;d++)x=s?mo(r[d],s-1,c):(c||Na)(r[d]),f.push(x);return f}function Da(r,s){return r=tt(r),r.alt!==void 0?[m(r.lng,s),m(r.lat,s),m(r.alt,s)]:[m(r.lng,s),m(r.lat,s)]}function go(r,s,c,f){for(var d=[],_=0,x=r.length;_<x;_++)d.push(s?go(r[_],$t(r[_])?0:s-1,c,f):Da(r[_],f));return!s&&c&&d.length>0&&d.push(d[0].slice()),d}function zi(r,s){return r.feature?i({},r.feature,{geometry:s}):To(s)}function To(r){return r.type==="Feature"||r.type==="FeatureCollection"?r:{type:"Feature",properties:{},geometry:r}}var Fa={toGeoJSON:function(r){return zi(this,{type:"Point",coordinates:Da(this.getLatLng(),r)})}};uo.include(Fa),Oa.include(Fa),po.include(Fa),Ce.include({toGeoJSON:function(r){var s=!$t(this._latlngs),c=go(this._latlngs,s?1:0,!1,r);return zi(this,{type:(s?"Multi":"")+"LineString",coordinates:c})}}),Ui.include({toGeoJSON:function(r){var s=!$t(this._latlngs),c=s&&!$t(this._latlngs[0]),f=go(this._latlngs,c?2:s?1:0,!0,r);return s||(f=[f]),zi(this,{type:(c?"Multi":"")+"Polygon",coordinates:f})}}),Li.include({toMultiPoint:function(r){var s=[];return this.eachLayer(function(c){s.push(c.toGeoJSON(r).geometry.coordinates)}),zi(this,{type:"MultiPoint",coordinates:s})},toGeoJSON:function(r){var s=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(s==="MultiPoint")return this.toMultiPoint(r);var c=s==="GeometryCollection",f=[];return this.eachLayer(function(d){if(d.toGeoJSON){var _=d.toGeoJSON(r);if(c)f.push(_.geometry);else{var x=To(_);x.type==="FeatureCollection"?f.push.apply(f,x.features):f.push(x)}}}),c?zi(this,{geometries:f,type:"GeometryCollection"}):{type:"FeatureCollection",features:f}}});function Nf(r,s){return new Ie(r,s)}var bT=Nf,yo=se.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(r,s,c){this._url=r,this._bounds=vt(s),y(this,c)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Q(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){gt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(r){return this.options.opacity=r,this._image&&this._updateOpacity(),this},setStyle:function(r){return r.opacity&&this.setOpacity(r.opacity),this},bringToFront:function(){return this._map&&Fi(this._image),this},bringToBack:function(){return this._map&&Bi(this._image),this},setUrl:function(r){return this._url=r,this._image&&(this._image.src=r),this},setBounds:function(r){return this._bounds=vt(r),this._map&&this._reset(),this},getEvents:function(){var r={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(r.zoomanim=this._animateZoom),r},setZIndex:function(r){return this.options.zIndex=r,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var r=this._url.tagName==="IMG",s=this._image=r?this._url:nt("img");if(Q(s,"leaflet-image-layer"),this._zoomAnimated&&Q(s,"leaflet-zoom-animated"),this.options.className&&Q(s,this.options.className),s.onselectstart=p,s.onmousemove=p,s.onload=o(this.fire,this,"load"),s.onerror=o(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(s.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),r){this._url=s.src;return}s.src=this._url,s.alt=this.options.alt},_animateZoom:function(r){var s=this._map.getZoomScale(r.zoom),c=this._map._latLngBoundsToNewLayerBounds(this._bounds,r.zoom,r.center).min;li(this._image,c,s)},_reset:function(){var r=this._image,s=new ht(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),c=s.getSize();Et(r,s.min),r.style.width=c.x+"px",r.style.height=c.y+"px"},_updateOpacity:function(){Zt(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var r=this.options.errorOverlayUrl;r&&this._url!==r&&(this._url=r,this._image.src=r)},getCenter:function(){return this._bounds.getCenter()}}),AT=function(r,s,c){return new yo(r,s,c)},Df=yo.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var r=this._url.tagName==="VIDEO",s=this._image=r?this._url:nt("video");if(Q(s,"leaflet-image-layer"),this._zoomAnimated&&Q(s,"leaflet-zoom-animated"),this.options.className&&Q(s,this.options.className),s.onselectstart=p,s.onmousemove=p,s.onloadeddata=o(this.fire,this,"load"),r){for(var c=s.getElementsByTagName("source"),f=[],d=0;d<c.length;d++)f.push(c[d].src);this._url=c.length>0?f:[s.src];return}A(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(s.style,"objectFit")&&(s.style.objectFit="fill"),s.autoplay=!!this.options.autoplay,s.loop=!!this.options.loop,s.muted=!!this.options.muted,s.playsInline=!!this.options.playsInline;for(var _=0;_<this._url.length;_++){var x=nt("source");x.src=this._url[_],s.appendChild(x)}}});function RT(r,s,c){return new Df(r,s,c)}var Ff=yo.extend({_initImage:function(){var r=this._image=this._url;Q(r,"leaflet-image-layer"),this._zoomAnimated&&Q(r,"leaflet-zoom-animated"),this.options.className&&Q(r,this.options.className),r.onselectstart=p,r.onmousemove=p}});function wT(r,s,c){return new Ff(r,s,c)}var me=se.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(r,s){r&&(r instanceof st||A(r))?(this._latlng=tt(r),y(this,s)):(y(this,r),this._source=s),this.options.content&&(this._content=this.options.content)},openOn:function(r){return r=arguments.length?r:this._source._map,r.hasLayer(this)||r.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(r){return this._map?this.close():(arguments.length?this._source=r:r=this._source,this._prepareOpen(),this.openOn(r._map)),this},onAdd:function(r){this._zoomAnimated=r._zoomAnimated,this._container||this._initLayout(),r._fadeAnimated&&Zt(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),r._fadeAnimated&&Zt(this._container,1),this.bringToFront(),this.options.interactive&&(Q(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(r){r._fadeAnimated?(Zt(this._container,0),this._removeTimeout=setTimeout(o(gt,void 0,this._container),200)):gt(this._container),this.options.interactive&&(xt(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(r){return this._latlng=tt(r),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(r){return this._content=r,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var r={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(r.zoomanim=this._animateZoom),r},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&Fi(this._container),this},bringToBack:function(){return this._map&&Bi(this._container),this},_prepareOpen:function(r){var s=this._source;if(!s._map)return!1;if(s instanceof Me){s=null;var c=this._source._layers;for(var f in c)if(c[f]._map){s=c[f];break}if(!s)return!1;this._source=s}if(!r)if(s.getCenter)r=s.getCenter();else if(s.getLatLng)r=s.getLatLng();else if(s.getBounds)r=s.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(r),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var r=this._contentNode,s=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof s=="string")r.innerHTML=s;else{for(;r.hasChildNodes();)r.removeChild(r.firstChild);r.appendChild(s)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var r=this._map.latLngToLayerPoint(this._latlng),s=K(this.options.offset),c=this._getAnchor();this._zoomAnimated?Et(this._container,r.add(c)):s=s.add(r).add(c);var f=this._containerBottom=-s.y,d=this._containerLeft=-Math.round(this._containerWidth/2)+s.x;this._container.style.bottom=f+"px",this._container.style.left=d+"px"}},_getAnchor:function(){return[0,0]}});et.include({_initOverlay:function(r,s,c,f){var d=s;return d instanceof r||(d=new r(f).setContent(s)),c&&d.setLatLng(c),d}}),se.include({_initOverlay:function(r,s,c,f){var d=c;return d instanceof r?(y(d,f),d._source=this):(d=s&&!f?s:new r(f,this),d.setContent(c)),d}});var xo=me.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(r){return r=arguments.length?r:this._source._map,!r.hasLayer(this)&&r._popup&&r._popup.options.autoClose&&r.removeLayer(r._popup),r._popup=this,me.prototype.openOn.call(this,r)},onAdd:function(r){me.prototype.onAdd.call(this,r),r.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Ke||this._source.on("preclick",fi))},onRemove:function(r){me.prototype.onRemove.call(this,r),r.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Ke||this._source.off("preclick",fi))},getEvents:function(){var r=me.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(r.preclick=this.close),this.options.keepInView&&(r.moveend=this._adjustPan),r},_initLayout:function(){var r="leaflet-popup",s=this._container=nt("div",r+" "+(this.options.className||"")+" leaflet-zoom-animated"),c=this._wrapper=nt("div",r+"-content-wrapper",s);if(this._contentNode=nt("div",r+"-content",c),Br(s),ba(this._contentNode),q(s,"contextmenu",fi),this._tipContainer=nt("div",r+"-tip-container",s),this._tip=nt("div",r+"-tip",this._tipContainer),this.options.closeButton){var f=this._closeButton=nt("a",r+"-close-button",s);f.setAttribute("role","button"),f.setAttribute("aria-label","Close popup"),f.href="#close",f.innerHTML='<span aria-hidden="true">&#215;</span>',q(f,"click",function(d){Mt(d),this.close()},this)}},_updateLayout:function(){var r=this._contentNode,s=r.style;s.width="",s.whiteSpace="nowrap";var c=r.offsetWidth;c=Math.min(c,this.options.maxWidth),c=Math.max(c,this.options.minWidth),s.width=c+1+"px",s.whiteSpace="",s.height="";var f=r.offsetHeight,d=this.options.maxHeight,_="leaflet-popup-scrolled";d&&f>d?(s.height=d+"px",Q(r,_)):xt(r,_),this._containerWidth=this._container.offsetWidth},_animateZoom:function(r){var s=this._map._latLngToNewLayerPoint(this._latlng,r.zoom,r.center),c=this._getAnchor();Et(this._container,s.add(c))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var r=this._map,s=parseInt(Or(this._container,"marginBottom"),10)||0,c=this._container.offsetHeight+s,f=this._containerWidth,d=new Y(this._containerLeft,-c-this._containerBottom);d._add(hi(this._container));var _=r.layerPointToContainerPoint(d),x=K(this.options.autoPanPadding),b=K(this.options.autoPanPaddingTopLeft||x),R=K(this.options.autoPanPaddingBottomRight||x),M=r.getSize(),k=0,$=0;_.x+f+R.x>M.x&&(k=_.x+f-M.x+R.x),_.x-k-b.x<0&&(k=_.x-b.x),_.y+c+R.y>M.y&&($=_.y+c-M.y+R.y),_.y-$-b.y<0&&($=_.y-b.y),(k||$)&&(this.options.keepInView&&(this._autopanning=!0),r.fire("autopanstart").panBy([k,$]))}},_getAnchor:function(){return K(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),PT=function(r,s){return new xo(r,s)};et.mergeOptions({closePopupOnClick:!0}),et.include({openPopup:function(r,s,c){return this._initOverlay(xo,r,s,c).openOn(this),this},closePopup:function(r){return r=arguments.length?r:this._popup,r&&r.close(),this}}),se.include({bindPopup:function(r,s){return this._popup=this._initOverlay(xo,this._popup,r,s),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(r){return this._popup&&(this instanceof Me||(this._popup._source=this),this._popup._prepareOpen(r||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(r){return this._popup&&this._popup.setContent(r),this},getPopup:function(){return this._popup},_openPopup:function(r){if(!(!this._popup||!this._map)){ui(r);var s=r.layer||r.target;if(this._popup._source===s&&!(s instanceof Ke)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(r.latlng);return}this._popup._source=s,this.openPopup(r.latlng)}},_movePopup:function(r){this._popup.setLatLng(r.latlng)},_onKeyPress:function(r){r.originalEvent.keyCode===13&&this._openPopup(r)}});var vo=me.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(r){me.prototype.onAdd.call(this,r),this.setOpacity(this.options.opacity),r.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(r){me.prototype.onRemove.call(this,r),r.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var r=me.prototype.getEvents.call(this);return this.options.permanent||(r.preclick=this.close),r},_initLayout:function(){var r="leaflet-tooltip",s=r+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=nt("div",s),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+l(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(r){var s,c,f=this._map,d=this._container,_=f.latLngToContainerPoint(f.getCenter()),x=f.layerPointToContainerPoint(r),b=this.options.direction,R=d.offsetWidth,M=d.offsetHeight,k=K(this.options.offset),$=this._getAnchor();b==="top"?(s=R/2,c=M):b==="bottom"?(s=R/2,c=0):b==="center"?(s=R/2,c=M/2):b==="right"?(s=0,c=M/2):b==="left"?(s=R,c=M/2):x.x<_.x?(b="right",s=0,c=M/2):(b="left",s=R+(k.x+$.x)*2,c=M/2),r=r.subtract(K(s,c,!0)).add(k).add($),xt(d,"leaflet-tooltip-right"),xt(d,"leaflet-tooltip-left"),xt(d,"leaflet-tooltip-top"),xt(d,"leaflet-tooltip-bottom"),Q(d,"leaflet-tooltip-"+b),Et(d,r)},_updatePosition:function(){var r=this._map.latLngToLayerPoint(this._latlng);this._setPosition(r)},setOpacity:function(r){this.options.opacity=r,this._container&&Zt(this._container,r)},_animateZoom:function(r){var s=this._map._latLngToNewLayerPoint(this._latlng,r.zoom,r.center);this._setPosition(s)},_getAnchor:function(){return K(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),MT=function(r,s){return new vo(r,s)};et.include({openTooltip:function(r,s,c){return this._initOverlay(vo,r,s,c).openOn(this),this},closeTooltip:function(r){return r.close(),this}}),se.include({bindTooltip:function(r,s){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(vo,this._tooltip,r,s),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(r){if(!(!r&&this._tooltipHandlersAdded)){var s=r?"off":"on",c={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?c.add=this._openTooltip:(c.mouseover=this._openTooltip,c.mouseout=this.closeTooltip,c.click=this._openTooltip,this._map?this._addFocusListeners():c.add=this._addFocusListeners),this._tooltip.options.sticky&&(c.mousemove=this._moveTooltip),this[s](c),this._tooltipHandlersAdded=!r}},openTooltip:function(r){return this._tooltip&&(this instanceof Me||(this._tooltip._source=this),this._tooltip._prepareOpen(r)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(r){return this._tooltip&&this._tooltip.setContent(r),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(r){var s=typeof r.getElement=="function"&&r.getElement();s&&(q(s,"focus",function(){this._tooltip._source=r,this.openTooltip()},this),q(s,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(r){var s=typeof r.getElement=="function"&&r.getElement();s&&s.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(r){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var s=this;this._map.once("moveend",function(){s._openOnceFlag=!1,s._openTooltip(r)});return}this._tooltip._source=r.layer||r.target,this.openTooltip(this._tooltip.options.sticky?r.latlng:void 0)}},_moveTooltip:function(r){var s=r.latlng,c,f;this._tooltip.options.sticky&&r.originalEvent&&(c=this._map.mouseEventToContainerPoint(r.originalEvent),f=this._map.containerPointToLayerPoint(c),s=this._map.layerPointToLatLng(f)),this._tooltip.setLatLng(s)}});var Bf=ki.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(r){var s=r&&r.tagName==="DIV"?r:document.createElement("div"),c=this.options;if(c.html instanceof Element?(so(s),s.appendChild(c.html)):s.innerHTML=c.html!==!1?c.html:"",c.bgPos){var f=K(c.bgPos);s.style.backgroundPosition=-f.x+"px "+-f.y+"px"}return this._setIconStyles(s,"icon"),s},createShadow:function(){return null}});function CT(r){return new Bf(r)}ki.Default=Ur;var zr=se.extend({options:{tileSize:256,opacity:1,updateWhenIdle:W.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(r){y(this,r)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(r){r._addZoomLimit(this)},onRemove:function(r){this._removeAllTiles(),gt(this._container),r._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(Fi(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Bi(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(r){return this.options.opacity=r,this._updateOpacity(),this},setZIndex:function(r){return this.options.zIndex=r,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var r=this._clampZoom(this._map.getZoom());r!==this._tileZoom&&(this._tileZoom=r,this._updateLevels()),this._update()}return this},getEvents:function(){var r={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=h(this._onMoveEnd,this.options.updateInterval,this)),r.move=this._onMove),this._zoomAnimated&&(r.zoomanim=this._animateZoom),r},createTile:function(){return document.createElement("div")},getTileSize:function(){var r=this.options.tileSize;return r instanceof Y?r:new Y(r,r)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(r){for(var s=this.getPane().children,c=-r(-1/0,1/0),f=0,d=s.length,_;f<d;f++)_=s[f].style.zIndex,s[f]!==this._container&&_&&(c=r(c,+_));isFinite(c)&&(this.options.zIndex=c+r(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!W.ielt9){Zt(this._container,this.options.opacity);var r=+new Date,s=!1,c=!1;for(var f in this._tiles){var d=this._tiles[f];if(!(!d.current||!d.loaded)){var _=Math.min(1,(r-d.loaded)/200);Zt(d.el,_),_<1?s=!0:(d.active?c=!0:this._onOpaqueTile(d),d.active=!0)}}c&&!this._noPrune&&this._pruneTiles(),s&&(B(this._fadeFrame),this._fadeFrame=D(this._updateOpacity,this))}},_onOpaqueTile:p,_initContainer:function(){this._container||(this._container=nt("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var r=this._tileZoom,s=this.options.maxZoom;if(r!==void 0){for(var c in this._levels)c=Number(c),this._levels[c].el.children.length||c===r?(this._levels[c].el.style.zIndex=s-Math.abs(r-c),this._onUpdateLevel(c)):(gt(this._levels[c].el),this._removeTilesAtZoom(c),this._onRemoveLevel(c),delete this._levels[c]);var f=this._levels[r],d=this._map;return f||(f=this._levels[r]={},f.el=nt("div","leaflet-tile-container leaflet-zoom-animated",this._container),f.el.style.zIndex=s,f.origin=d.project(d.unproject(d.getPixelOrigin()),r).round(),f.zoom=r,this._setZoomTransform(f,d.getCenter(),d.getZoom()),p(f.el.offsetWidth),this._onCreateLevel(f)),this._level=f,f}},_onUpdateLevel:p,_onRemoveLevel:p,_onCreateLevel:p,_pruneTiles:function(){if(this._map){var r,s,c=this._map.getZoom();if(c>this.options.maxZoom||c<this.options.minZoom){this._removeAllTiles();return}for(r in this._tiles)s=this._tiles[r],s.retain=s.current;for(r in this._tiles)if(s=this._tiles[r],s.current&&!s.active){var f=s.coords;this._retainParent(f.x,f.y,f.z,f.z-5)||this._retainChildren(f.x,f.y,f.z,f.z+2)}for(r in this._tiles)this._tiles[r].retain||this._removeTile(r)}},_removeTilesAtZoom:function(r){for(var s in this._tiles)this._tiles[s].coords.z===r&&this._removeTile(s)},_removeAllTiles:function(){for(var r in this._tiles)this._removeTile(r)},_invalidateAll:function(){for(var r in this._levels)gt(this._levels[r].el),this._onRemoveLevel(Number(r)),delete this._levels[r];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(r,s,c,f){var d=Math.floor(r/2),_=Math.floor(s/2),x=c-1,b=new Y(+d,+_);b.z=+x;var R=this._tileCoordsToKey(b),M=this._tiles[R];return M&&M.active?(M.retain=!0,!0):(M&&M.loaded&&(M.retain=!0),x>f?this._retainParent(d,_,x,f):!1)},_retainChildren:function(r,s,c,f){for(var d=2*r;d<2*r+2;d++)for(var _=2*s;_<2*s+2;_++){var x=new Y(d,_);x.z=c+1;var b=this._tileCoordsToKey(x),R=this._tiles[b];if(R&&R.active){R.retain=!0;continue}else R&&R.loaded&&(R.retain=!0);c+1<f&&this._retainChildren(d,_,c+1,f)}},_resetView:function(r){var s=r&&(r.pinch||r.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),s,s)},_animateZoom:function(r){this._setView(r.center,r.zoom,!0,r.noUpdate)},_clampZoom:function(r){var s=this.options;return s.minNativeZoom!==void 0&&r<s.minNativeZoom?s.minNativeZoom:s.maxNativeZoom!==void 0&&s.maxNativeZoom<r?s.maxNativeZoom:r},_setView:function(r,s,c,f){var d=Math.round(s);this.options.maxZoom!==void 0&&d>this.options.maxZoom||this.options.minZoom!==void 0&&d<this.options.minZoom?d=void 0:d=this._clampZoom(d);var _=this.options.updateWhenZooming&&d!==this._tileZoom;(!f||_)&&(this._tileZoom=d,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),d!==void 0&&this._update(r),c||this._pruneTiles(),this._noPrune=!!c),this._setZoomTransforms(r,s)},_setZoomTransforms:function(r,s){for(var c in this._levels)this._setZoomTransform(this._levels[c],r,s)},_setZoomTransform:function(r,s,c){var f=this._map.getZoomScale(c,r.zoom),d=r.origin.multiplyBy(f).subtract(this._map._getNewPixelOrigin(s,c)).round();W.any3d?li(r.el,d,f):Et(r.el,d)},_resetGrid:function(){var r=this._map,s=r.options.crs,c=this._tileSize=this.getTileSize(),f=this._tileZoom,d=this._map.getPixelWorldBounds(this._tileZoom);d&&(this._globalTileRange=this._pxBoundsToTileRange(d)),this._wrapX=s.wrapLng&&!this.options.noWrap&&[Math.floor(r.project([0,s.wrapLng[0]],f).x/c.x),Math.ceil(r.project([0,s.wrapLng[1]],f).x/c.y)],this._wrapY=s.wrapLat&&!this.options.noWrap&&[Math.floor(r.project([s.wrapLat[0],0],f).y/c.x),Math.ceil(r.project([s.wrapLat[1],0],f).y/c.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(r){var s=this._map,c=s._animatingZoom?Math.max(s._animateToZoom,s.getZoom()):s.getZoom(),f=s.getZoomScale(c,this._tileZoom),d=s.project(r,this._tileZoom).floor(),_=s.getSize().divideBy(f*2);return new ht(d.subtract(_),d.add(_))},_update:function(r){var s=this._map;if(s){var c=this._clampZoom(s.getZoom());if(r===void 0&&(r=s.getCenter()),this._tileZoom!==void 0){var f=this._getTiledPixelBounds(r),d=this._pxBoundsToTileRange(f),_=d.getCenter(),x=[],b=this.options.keepBuffer,R=new ht(d.getBottomLeft().subtract([b,-b]),d.getTopRight().add([b,-b]));if(!(isFinite(d.min.x)&&isFinite(d.min.y)&&isFinite(d.max.x)&&isFinite(d.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var M in this._tiles){var k=this._tiles[M].coords;(k.z!==this._tileZoom||!R.contains(new Y(k.x,k.y)))&&(this._tiles[M].current=!1)}if(Math.abs(c-this._tileZoom)>1){this._setView(r,c);return}for(var $=d.min.y;$<=d.max.y;$++)for(var G=d.min.x;G<=d.max.x;G++){var Dt=new Y(G,$);if(Dt.z=this._tileZoom,!!this._isValidTile(Dt)){var Rt=this._tiles[this._tileCoordsToKey(Dt)];Rt?Rt.current=!0:x.push(Dt)}}if(x.sort(function(Ut,Wi){return Ut.distanceTo(_)-Wi.distanceTo(_)}),x.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Yt=document.createDocumentFragment();for(G=0;G<x.length;G++)this._addTile(x[G],Yt);this._level.el.appendChild(Yt)}}}},_isValidTile:function(r){var s=this._map.options.crs;if(!s.infinite){var c=this._globalTileRange;if(!s.wrapLng&&(r.x<c.min.x||r.x>c.max.x)||!s.wrapLat&&(r.y<c.min.y||r.y>c.max.y))return!1}if(!this.options.bounds)return!0;var f=this._tileCoordsToBounds(r);return vt(this.options.bounds).overlaps(f)},_keyToBounds:function(r){return this._tileCoordsToBounds(this._keyToTileCoords(r))},_tileCoordsToNwSe:function(r){var s=this._map,c=this.getTileSize(),f=r.scaleBy(c),d=f.add(c),_=s.unproject(f,r.z),x=s.unproject(d,r.z);return[_,x]},_tileCoordsToBounds:function(r){var s=this._tileCoordsToNwSe(r),c=new kt(s[0],s[1]);return this.options.noWrap||(c=this._map.wrapLatLngBounds(c)),c},_tileCoordsToKey:function(r){return r.x+":"+r.y+":"+r.z},_keyToTileCoords:function(r){var s=r.split(":"),c=new Y(+s[0],+s[1]);return c.z=+s[2],c},_removeTile:function(r){var s=this._tiles[r];s&&(gt(s.el),delete this._tiles[r],this.fire("tileunload",{tile:s.el,coords:this._keyToTileCoords(r)}))},_initTile:function(r){Q(r,"leaflet-tile");var s=this.getTileSize();r.style.width=s.x+"px",r.style.height=s.y+"px",r.onselectstart=p,r.onmousemove=p,W.ielt9&&this.options.opacity<1&&Zt(r,this.options.opacity)},_addTile:function(r,s){var c=this._getTilePos(r),f=this._tileCoordsToKey(r),d=this.createTile(this._wrapCoords(r),o(this._tileReady,this,r));this._initTile(d),this.createTile.length<2&&D(o(this._tileReady,this,r,null,d)),Et(d,c),this._tiles[f]={el:d,coords:r,current:!0},s.appendChild(d),this.fire("tileloadstart",{tile:d,coords:r})},_tileReady:function(r,s,c){s&&this.fire("tileerror",{error:s,tile:c,coords:r});var f=this._tileCoordsToKey(r);c=this._tiles[f],c&&(c.loaded=+new Date,this._map._fadeAnimated?(Zt(c.el,0),B(this._fadeFrame),this._fadeFrame=D(this._updateOpacity,this)):(c.active=!0,this._pruneTiles()),s||(Q(c.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:c.el,coords:r})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),W.ielt9||!this._map._fadeAnimated?D(this._pruneTiles,this):setTimeout(o(this._pruneTiles,this),250)))},_getTilePos:function(r){return r.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(r){var s=new Y(this._wrapX?u(r.x,this._wrapX):r.x,this._wrapY?u(r.y,this._wrapY):r.y);return s.z=r.z,s},_pxBoundsToTileRange:function(r){var s=this.getTileSize();return new ht(r.min.unscaleBy(s).floor(),r.max.unscaleBy(s).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var r in this._tiles)if(!this._tiles[r].loaded)return!1;return!0}});function IT(r){return new zr(r)}var Vi=zr.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(r,s){this._url=r,s=y(this,s),s.detectRetina&&W.retina&&s.maxZoom>0?(s.tileSize=Math.floor(s.tileSize/2),s.zoomReverse?(s.zoomOffset--,s.minZoom=Math.min(s.maxZoom,s.minZoom+1)):(s.zoomOffset++,s.maxZoom=Math.max(s.minZoom,s.maxZoom-1)),s.minZoom=Math.max(0,s.minZoom)):s.zoomReverse?s.minZoom=Math.min(s.maxZoom,s.minZoom):s.maxZoom=Math.max(s.minZoom,s.maxZoom),typeof s.subdomains=="string"&&(s.subdomains=s.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(r,s){return this._url===r&&s===void 0&&(s=!0),this._url=r,s||this.redraw(),this},createTile:function(r,s){var c=document.createElement("img");return q(c,"load",o(this._tileOnLoad,this,s,c)),q(c,"error",o(this._tileOnError,this,s,c)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(c.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(c.referrerPolicy=this.options.referrerPolicy),c.alt="",c.src=this.getTileUrl(r),c},getTileUrl:function(r){var s={r:W.retina?"@2x":"",s:this._getSubdomain(r),x:r.x,y:r.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var c=this._globalTileRange.max.y-r.y;this.options.tms&&(s.y=c),s["-y"]=c}return v(this._url,i(s,this.options))},_tileOnLoad:function(r,s){W.ielt9?setTimeout(o(r,this,null,s),0):r(null,s)},_tileOnError:function(r,s,c){var f=this.options.errorTileUrl;f&&s.getAttribute("src")!==f&&(s.src=f),r(c,s)},_onTileRemove:function(r){r.tile.onload=null},_getZoomForUrl:function(){var r=this._tileZoom,s=this.options.maxZoom,c=this.options.zoomReverse,f=this.options.zoomOffset;return c&&(r=s-r),r+f},_getSubdomain:function(r){var s=Math.abs(r.x+r.y)%this.options.subdomains.length;return this.options.subdomains[s]},_abortLoading:function(){var r,s;for(r in this._tiles)if(this._tiles[r].coords.z!==this._tileZoom&&(s=this._tiles[r].el,s.onload=p,s.onerror=p,!s.complete)){s.src=w;var c=this._tiles[r].coords;gt(s),delete this._tiles[r],this.fire("tileabort",{tile:s,coords:c})}},_removeTile:function(r){var s=this._tiles[r];if(s)return s.el.setAttribute("src",w),zr.prototype._removeTile.call(this,r)},_tileReady:function(r,s,c){if(!(!this._map||c&&c.getAttribute("src")===w))return zr.prototype._tileReady.call(this,r,s,c)}});function Lf(r,s){return new Vi(r,s)}var kf=Vi.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(r,s){this._url=r;var c=i({},this.defaultWmsParams);for(var f in s)f in this.options||(c[f]=s[f]);s=y(this,s);var d=s.detectRetina&&W.retina?2:1,_=this.getTileSize();c.width=_.x*d,c.height=_.y*d,this.wmsParams=c},onAdd:function(r){this._crs=this.options.crs||r.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var s=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[s]=this._crs.code,Vi.prototype.onAdd.call(this,r)},getTileUrl:function(r){var s=this._tileCoordsToNwSe(r),c=this._crs,f=Lt(c.project(s[0]),c.project(s[1])),d=f.min,_=f.max,x=(this._wmsVersion>=1.3&&this._crs===Cf?[d.y,d.x,_.y,_.x]:[d.x,d.y,_.x,_.y]).join(","),b=Vi.prototype.getTileUrl.call(this,r);return b+E(this.wmsParams,b,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+x},setParams:function(r,s){return i(this.wmsParams,r),s||this.redraw(),this}});function OT(r,s){return new kf(r,s)}Vi.WMS=kf,Lf.wms=OT;var Oe=se.extend({options:{padding:.1},initialize:function(r){y(this,r),l(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Q(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var r={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(r.zoomanim=this._onAnimZoom),r},_onAnimZoom:function(r){this._updateTransform(r.center,r.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(r,s){var c=this._map.getZoomScale(s,this._zoom),f=this._map.getSize().multiplyBy(.5+this.options.padding),d=this._map.project(this._center,s),_=f.multiplyBy(-c).add(d).subtract(this._map._getNewPixelOrigin(r,s));W.any3d?li(this._container,_,c):Et(this._container,_)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var r in this._layers)this._layers[r]._reset()},_onZoomEnd:function(){for(var r in this._layers)this._layers[r]._project()},_updatePaths:function(){for(var r in this._layers)this._layers[r]._update()},_update:function(){var r=this.options.padding,s=this._map.getSize(),c=this._map.containerPointToLayerPoint(s.multiplyBy(-r)).round();this._bounds=new ht(c,c.add(s.multiplyBy(1+r*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Uf=Oe.extend({options:{tolerance:0},getEvents:function(){var r=Oe.prototype.getEvents.call(this);return r.viewprereset=this._onViewPreReset,r},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Oe.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var r=this._container=document.createElement("canvas");q(r,"mousemove",this._onMouseMove,this),q(r,"click dblclick mousedown mouseup contextmenu",this._onClick,this),q(r,"mouseout",this._handleMouseOut,this),r._leaflet_disable_events=!0,this._ctx=r.getContext("2d")},_destroyContainer:function(){B(this._redrawRequest),delete this._ctx,gt(this._container),ft(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var r;this._redrawBounds=null;for(var s in this._layers)r=this._layers[s],r._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Oe.prototype._update.call(this);var r=this._bounds,s=this._container,c=r.getSize(),f=W.retina?2:1;Et(s,r.min),s.width=f*c.x,s.height=f*c.y,s.style.width=c.x+"px",s.style.height=c.y+"px",W.retina&&this._ctx.scale(2,2),this._ctx.translate(-r.min.x,-r.min.y),this.fire("update")}},_reset:function(){Oe.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(r){this._updateDashArray(r),this._layers[l(r)]=r;var s=r._order={layer:r,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=s),this._drawLast=s,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(r){this._requestRedraw(r)},_removePath:function(r){var s=r._order,c=s.next,f=s.prev;c?c.prev=f:this._drawLast=f,f?f.next=c:this._drawFirst=c,delete r._order,delete this._layers[l(r)],this._requestRedraw(r)},_updatePath:function(r){this._extendRedrawBounds(r),r._project(),r._update(),this._requestRedraw(r)},_updateStyle:function(r){this._updateDashArray(r),this._requestRedraw(r)},_updateDashArray:function(r){if(typeof r.options.dashArray=="string"){var s=r.options.dashArray.split(/[, ]+/),c=[],f,d;for(d=0;d<s.length;d++){if(f=Number(s[d]),isNaN(f))return;c.push(f)}r.options._dashArray=c}else r.options._dashArray=r.options.dashArray},_requestRedraw:function(r){this._map&&(this._extendRedrawBounds(r),this._redrawRequest=this._redrawRequest||D(this._redraw,this))},_extendRedrawBounds:function(r){if(r._pxBounds){var s=(r.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new ht,this._redrawBounds.extend(r._pxBounds.min.subtract([s,s])),this._redrawBounds.extend(r._pxBounds.max.add([s,s]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var r=this._redrawBounds;if(r){var s=r.getSize();this._ctx.clearRect(r.min.x,r.min.y,s.x,s.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var r,s=this._redrawBounds;if(this._ctx.save(),s){var c=s.getSize();this._ctx.beginPath(),this._ctx.rect(s.min.x,s.min.y,c.x,c.y),this._ctx.clip()}this._drawing=!0;for(var f=this._drawFirst;f;f=f.next)r=f.layer,(!s||r._pxBounds&&r._pxBounds.intersects(s))&&r._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(r,s){if(this._drawing){var c,f,d,_,x=r._parts,b=x.length,R=this._ctx;if(b){for(R.beginPath(),c=0;c<b;c++){for(f=0,d=x[c].length;f<d;f++)_=x[c][f],R[f?"lineTo":"moveTo"](_.x,_.y);s&&R.closePath()}this._fillStroke(R,r)}}},_updateCircle:function(r){if(!(!this._drawing||r._empty())){var s=r._point,c=this._ctx,f=Math.max(Math.round(r._radius),1),d=(Math.max(Math.round(r._radiusY),1)||f)/f;d!==1&&(c.save(),c.scale(1,d)),c.beginPath(),c.arc(s.x,s.y/d,f,0,Math.PI*2,!1),d!==1&&c.restore(),this._fillStroke(c,r)}},_fillStroke:function(r,s){var c=s.options;c.fill&&(r.globalAlpha=c.fillOpacity,r.fillStyle=c.fillColor||c.color,r.fill(c.fillRule||"evenodd")),c.stroke&&c.weight!==0&&(r.setLineDash&&r.setLineDash(s.options&&s.options._dashArray||[]),r.globalAlpha=c.opacity,r.lineWidth=c.weight,r.strokeStyle=c.color,r.lineCap=c.lineCap,r.lineJoin=c.lineJoin,r.stroke())},_onClick:function(r){for(var s=this._map.mouseEventToLayerPoint(r),c,f,d=this._drawFirst;d;d=d.next)c=d.layer,c.options.interactive&&c._containsPoint(s)&&(!(r.type==="click"||r.type==="preclick")||!this._map._draggableMoved(c))&&(f=c);this._fireEvent(f?[f]:!1,r)},_onMouseMove:function(r){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var s=this._map.mouseEventToLayerPoint(r);this._handleMouseHover(r,s)}},_handleMouseOut:function(r){var s=this._hoveredLayer;s&&(xt(this._container,"leaflet-interactive"),this._fireEvent([s],r,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(r,s){if(!this._mouseHoverThrottled){for(var c,f,d=this._drawFirst;d;d=d.next)c=d.layer,c.options.interactive&&c._containsPoint(s)&&(f=c);f!==this._hoveredLayer&&(this._handleMouseOut(r),f&&(Q(this._container,"leaflet-interactive"),this._fireEvent([f],r,"mouseover"),this._hoveredLayer=f)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,r),this._mouseHoverThrottled=!0,setTimeout(o(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(r,s,c){this._map._fireDOMEvent(s,c||s.type,r)},_bringToFront:function(r){var s=r._order;if(s){var c=s.next,f=s.prev;if(c)c.prev=f;else return;f?f.next=c:c&&(this._drawFirst=c),s.prev=this._drawLast,this._drawLast.next=s,s.next=null,this._drawLast=s,this._requestRedraw(r)}},_bringToBack:function(r){var s=r._order;if(s){var c=s.next,f=s.prev;if(f)f.next=c;else return;c?c.prev=f:f&&(this._drawLast=f),s.prev=null,s.next=this._drawFirst,this._drawFirst.prev=s,this._drawFirst=s,this._requestRedraw(r)}}});function zf(r){return W.canvas?new Uf(r):null}var Vr=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(r){return document.createElement("<lvml:"+r+' class="lvml">')}}catch{}return function(r){return document.createElement("<"+r+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),NT={_initContainer:function(){this._container=nt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Oe.prototype._update.call(this),this.fire("update"))},_initPath:function(r){var s=r._container=Vr("shape");Q(s,"leaflet-vml-shape "+(this.options.className||"")),s.coordsize="1 1",r._path=Vr("path"),s.appendChild(r._path),this._updateStyle(r),this._layers[l(r)]=r},_addPath:function(r){var s=r._container;this._container.appendChild(s),r.options.interactive&&r.addInteractiveTarget(s)},_removePath:function(r){var s=r._container;gt(s),r.removeInteractiveTarget(s),delete this._layers[l(r)]},_updateStyle:function(r){var s=r._stroke,c=r._fill,f=r.options,d=r._container;d.stroked=!!f.stroke,d.filled=!!f.fill,f.stroke?(s||(s=r._stroke=Vr("stroke")),d.appendChild(s),s.weight=f.weight+"px",s.color=f.color,s.opacity=f.opacity,f.dashArray?s.dashStyle=A(f.dashArray)?f.dashArray.join(" "):f.dashArray.replace(/( *, *)/g," "):s.dashStyle="",s.endcap=f.lineCap.replace("butt","flat"),s.joinstyle=f.lineJoin):s&&(d.removeChild(s),r._stroke=null),f.fill?(c||(c=r._fill=Vr("fill")),d.appendChild(c),c.color=f.fillColor||f.color,c.opacity=f.fillOpacity):c&&(d.removeChild(c),r._fill=null)},_updateCircle:function(r){var s=r._point.round(),c=Math.round(r._radius),f=Math.round(r._radiusY||c);this._setPath(r,r._empty()?"M0 0":"AL "+s.x+","+s.y+" "+c+","+f+" 0,"+65535*360)},_setPath:function(r,s){r._path.v=s},_bringToFront:function(r){Fi(r._container)},_bringToBack:function(r){Bi(r._container)}},Eo=W.vml?Vr:Hh,Wr=Oe.extend({_initContainer:function(){this._container=Eo("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Eo("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){gt(this._container),ft(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Oe.prototype._update.call(this);var r=this._bounds,s=r.getSize(),c=this._container;(!this._svgSize||!this._svgSize.equals(s))&&(this._svgSize=s,c.setAttribute("width",s.x),c.setAttribute("height",s.y)),Et(c,r.min),c.setAttribute("viewBox",[r.min.x,r.min.y,s.x,s.y].join(" ")),this.fire("update")}},_initPath:function(r){var s=r._path=Eo("path");r.options.className&&Q(s,r.options.className),r.options.interactive&&Q(s,"leaflet-interactive"),this._updateStyle(r),this._layers[l(r)]=r},_addPath:function(r){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(r._path),r.addInteractiveTarget(r._path)},_removePath:function(r){gt(r._path),r.removeInteractiveTarget(r._path),delete this._layers[l(r)]},_updatePath:function(r){r._project(),r._update()},_updateStyle:function(r){var s=r._path,c=r.options;s&&(c.stroke?(s.setAttribute("stroke",c.color),s.setAttribute("stroke-opacity",c.opacity),s.setAttribute("stroke-width",c.weight),s.setAttribute("stroke-linecap",c.lineCap),s.setAttribute("stroke-linejoin",c.lineJoin),c.dashArray?s.setAttribute("stroke-dasharray",c.dashArray):s.removeAttribute("stroke-dasharray"),c.dashOffset?s.setAttribute("stroke-dashoffset",c.dashOffset):s.removeAttribute("stroke-dashoffset")):s.setAttribute("stroke","none"),c.fill?(s.setAttribute("fill",c.fillColor||c.color),s.setAttribute("fill-opacity",c.fillOpacity),s.setAttribute("fill-rule",c.fillRule||"evenodd")):s.setAttribute("fill","none"))},_updatePoly:function(r,s){this._setPath(r,jh(r._parts,s))},_updateCircle:function(r){var s=r._point,c=Math.max(Math.round(r._radius),1),f=Math.max(Math.round(r._radiusY),1)||c,d="a"+c+","+f+" 0 1,0 ",_=r._empty()?"M0 0":"M"+(s.x-c)+","+s.y+d+c*2+",0 "+d+-c*2+",0 ";this._setPath(r,_)},_setPath:function(r,s){r._path.setAttribute("d",s)},_bringToFront:function(r){Fi(r._path)},_bringToBack:function(r){Bi(r._path)}});W.vml&&Wr.include(NT);function Vf(r){return W.svg||W.vml?new Wr(r):null}et.include({getRenderer:function(r){var s=r.options.renderer||this._getPaneRenderer(r.options.pane)||this.options.renderer||this._renderer;return s||(s=this._renderer=this._createRenderer()),this.hasLayer(s)||this.addLayer(s),s},_getPaneRenderer:function(r){if(r==="overlayPane"||r===void 0)return!1;var s=this._paneRenderers[r];return s===void 0&&(s=this._createRenderer({pane:r}),this._paneRenderers[r]=s),s},_createRenderer:function(r){return this.options.preferCanvas&&zf(r)||Vf(r)}});var Wf=Ui.extend({initialize:function(r,s){Ui.prototype.initialize.call(this,this._boundsToLatLngs(r),s)},setBounds:function(r){return this.setLatLngs(this._boundsToLatLngs(r))},_boundsToLatLngs:function(r){return r=vt(r),[r.getSouthWest(),r.getNorthWest(),r.getNorthEast(),r.getSouthEast()]}});function DT(r,s){return new Wf(r,s)}Wr.create=Eo,Wr.pointsToPath=jh,Ie.geometryToLayer=_o,Ie.coordsToLatLng=Na,Ie.coordsToLatLngs=mo,Ie.latLngToCoords=Da,Ie.latLngsToCoords=go,Ie.getFeature=zi,Ie.asFeature=To,et.mergeOptions({boxZoom:!0});var Hf=_e.extend({initialize:function(r){this._map=r,this._container=r._container,this._pane=r._panes.overlayPane,this._resetStateTimeout=0,r.on("unload",this._destroy,this)},addHooks:function(){q(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){ft(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){gt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(r){if(!r.shiftKey||r.which!==1&&r.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),Nr(),ma(),this._startPoint=this._map.mouseEventToContainerPoint(r),q(document,{contextmenu:ui,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(r){this._moved||(this._moved=!0,this._box=nt("div","leaflet-zoom-box",this._container),Q(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(r);var s=new ht(this._point,this._startPoint),c=s.getSize();Et(this._box,s.min),this._box.style.width=c.x+"px",this._box.style.height=c.y+"px"},_finish:function(){this._moved&&(gt(this._box),xt(this._container,"leaflet-crosshair")),Dr(),ga(),ft(document,{contextmenu:ui,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(r){if(!(r.which!==1&&r.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(o(this._resetState,this),0);var s=new kt(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(s).fire("boxzoomend",{boxZoomBounds:s})}},_onKeyDown:function(r){r.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});et.addInitHook("addHandler","boxZoom",Hf),et.mergeOptions({doubleClickZoom:!0});var jf=_e.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(r){var s=this._map,c=s.getZoom(),f=s.options.zoomDelta,d=r.originalEvent.shiftKey?c-f:c+f;s.options.doubleClickZoom==="center"?s.setZoom(d):s.setZoomAround(r.containerPoint,d)}});et.addInitHook("addHandler","doubleClickZoom",jf),et.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Xf=_e.extend({addHooks:function(){if(!this._draggable){var r=this._map;this._draggable=new Ye(r._mapPane,r._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),r.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),r.on("zoomend",this._onZoomEnd,this),r.whenReady(this._onZoomEnd,this))}Q(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){xt(this._map._container,"leaflet-grab"),xt(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var r=this._map;if(r._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var s=vt(this._map.options.maxBounds);this._offsetLimit=Lt(this._map.latLngToContainerPoint(s.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(s.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;r.fire("movestart").fire("dragstart"),r.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(r){if(this._map.options.inertia){var s=this._lastTime=+new Date,c=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(c),this._times.push(s),this._prunePositions(s)}this._map.fire("move",r).fire("drag",r)},_prunePositions:function(r){for(;this._positions.length>1&&r-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var r=this._map.getSize().divideBy(2),s=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=s.subtract(r).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(r,s){return r-(r-s)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var r=this._draggable._newPos.subtract(this._draggable._startPos),s=this._offsetLimit;r.x<s.min.x&&(r.x=this._viscousLimit(r.x,s.min.x)),r.y<s.min.y&&(r.y=this._viscousLimit(r.y,s.min.y)),r.x>s.max.x&&(r.x=this._viscousLimit(r.x,s.max.x)),r.y>s.max.y&&(r.y=this._viscousLimit(r.y,s.max.y)),this._draggable._newPos=this._draggable._startPos.add(r)}},_onPreDragWrap:function(){var r=this._worldWidth,s=Math.round(r/2),c=this._initialWorldOffset,f=this._draggable._newPos.x,d=(f-s+c)%r+s-c,_=(f+s+c)%r-s-c,x=Math.abs(d+c)<Math.abs(_+c)?d:_;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=x},_onDragEnd:function(r){var s=this._map,c=s.options,f=!c.inertia||r.noInertia||this._times.length<2;if(s.fire("dragend",r),f)s.fire("moveend");else{this._prunePositions(+new Date);var d=this._lastPos.subtract(this._positions[0]),_=(this._lastTime-this._times[0])/1e3,x=c.easeLinearity,b=d.multiplyBy(x/_),R=b.distanceTo([0,0]),M=Math.min(c.inertiaMaxSpeed,R),k=b.multiplyBy(M/R),$=M/(c.inertiaDeceleration*x),G=k.multiplyBy(-$/2).round();!G.x&&!G.y?s.fire("moveend"):(G=s._limitOffset(G,s.options.maxBounds),D(function(){s.panBy(G,{duration:$,easeLinearity:x,noMoveStart:!0,animate:!0})}))}}});et.addInitHook("addHandler","dragging",Xf),et.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Zf=_e.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(r){this._map=r,this._setPanDelta(r.options.keyboardPanDelta),this._setZoomDelta(r.options.zoomDelta)},addHooks:function(){var r=this._map._container;r.tabIndex<=0&&(r.tabIndex="0"),q(r,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),ft(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var r=document.body,s=document.documentElement,c=r.scrollTop||s.scrollTop,f=r.scrollLeft||s.scrollLeft;this._map._container.focus(),window.scrollTo(f,c)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(r){var s=this._panKeys={},c=this.keyCodes,f,d;for(f=0,d=c.left.length;f<d;f++)s[c.left[f]]=[-1*r,0];for(f=0,d=c.right.length;f<d;f++)s[c.right[f]]=[r,0];for(f=0,d=c.down.length;f<d;f++)s[c.down[f]]=[0,r];for(f=0,d=c.up.length;f<d;f++)s[c.up[f]]=[0,-1*r]},_setZoomDelta:function(r){var s=this._zoomKeys={},c=this.keyCodes,f,d;for(f=0,d=c.zoomIn.length;f<d;f++)s[c.zoomIn[f]]=r;for(f=0,d=c.zoomOut.length;f<d;f++)s[c.zoomOut[f]]=-r},_addHooks:function(){q(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){ft(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(r){if(!(r.altKey||r.ctrlKey||r.metaKey)){var s=r.keyCode,c=this._map,f;if(s in this._panKeys){if(!c._panAnim||!c._panAnim._inProgress)if(f=this._panKeys[s],r.shiftKey&&(f=K(f).multiplyBy(3)),c.options.maxBounds&&(f=c._limitOffset(K(f),c.options.maxBounds)),c.options.worldCopyJump){var d=c.wrapLatLng(c.unproject(c.project(c.getCenter()).add(f)));c.panTo(d)}else c.panBy(f)}else if(s in this._zoomKeys)c.setZoom(c.getZoom()+(r.shiftKey?3:1)*this._zoomKeys[s]);else if(s===27&&c._popup&&c._popup.options.closeOnEscapeKey)c.closePopup();else return;ui(r)}}});et.addInitHook("addHandler","keyboard",Zf),et.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var $f=_e.extend({addHooks:function(){q(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){ft(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(r){var s=gf(r),c=this._map.options.wheelDebounceTime;this._delta+=s,this._lastMousePos=this._map.mouseEventToContainerPoint(r),this._startTime||(this._startTime=+new Date);var f=Math.max(c-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(o(this._performZoom,this),f),ui(r)},_performZoom:function(){var r=this._map,s=r.getZoom(),c=this._map.options.zoomSnap||0;r._stop();var f=this._delta/(this._map.options.wheelPxPerZoomLevel*4),d=4*Math.log(2/(1+Math.exp(-Math.abs(f))))/Math.LN2,_=c?Math.ceil(d/c)*c:d,x=r._limitZoom(s+(this._delta>0?_:-_))-s;this._delta=0,this._startTime=null,x&&(r.options.scrollWheelZoom==="center"?r.setZoom(s+x):r.setZoomAround(this._lastMousePos,s+x))}});et.addInitHook("addHandler","scrollWheelZoom",$f);var FT=600;et.mergeOptions({tapHold:W.touchNative&&W.safari&&W.mobile,tapTolerance:15});var Yf=_e.extend({addHooks:function(){q(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){ft(this._map._container,"touchstart",this._onDown,this)},_onDown:function(r){if(clearTimeout(this._holdTimeout),r.touches.length===1){var s=r.touches[0];this._startPos=this._newPos=new Y(s.clientX,s.clientY),this._holdTimeout=setTimeout(o(function(){this._cancel(),this._isTapValid()&&(q(document,"touchend",Mt),q(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",s))},this),FT),q(document,"touchend touchcancel contextmenu",this._cancel,this),q(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function r(){ft(document,"touchend",Mt),ft(document,"touchend touchcancel",r)},_cancel:function(){clearTimeout(this._holdTimeout),ft(document,"touchend touchcancel contextmenu",this._cancel,this),ft(document,"touchmove",this._onMove,this)},_onMove:function(r){var s=r.touches[0];this._newPos=new Y(s.clientX,s.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(r,s){var c=new MouseEvent(r,{bubbles:!0,cancelable:!0,view:window,screenX:s.screenX,screenY:s.screenY,clientX:s.clientX,clientY:s.clientY});c._simulated=!0,s.target.dispatchEvent(c)}});et.addInitHook("addHandler","tapHold",Yf),et.mergeOptions({touchZoom:W.touch,bounceAtZoomLimits:!0});var Kf=_e.extend({addHooks:function(){Q(this._map._container,"leaflet-touch-zoom"),q(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){xt(this._map._container,"leaflet-touch-zoom"),ft(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(r){var s=this._map;if(!(!r.touches||r.touches.length!==2||s._animatingZoom||this._zooming)){var c=s.mouseEventToContainerPoint(r.touches[0]),f=s.mouseEventToContainerPoint(r.touches[1]);this._centerPoint=s.getSize()._divideBy(2),this._startLatLng=s.containerPointToLatLng(this._centerPoint),s.options.touchZoom!=="center"&&(this._pinchStartLatLng=s.containerPointToLatLng(c.add(f)._divideBy(2))),this._startDist=c.distanceTo(f),this._startZoom=s.getZoom(),this._moved=!1,this._zooming=!0,s._stop(),q(document,"touchmove",this._onTouchMove,this),q(document,"touchend touchcancel",this._onTouchEnd,this),Mt(r)}},_onTouchMove:function(r){if(!(!r.touches||r.touches.length!==2||!this._zooming)){var s=this._map,c=s.mouseEventToContainerPoint(r.touches[0]),f=s.mouseEventToContainerPoint(r.touches[1]),d=c.distanceTo(f)/this._startDist;if(this._zoom=s.getScaleZoom(d,this._startZoom),!s.options.bounceAtZoomLimits&&(this._zoom<s.getMinZoom()&&d<1||this._zoom>s.getMaxZoom()&&d>1)&&(this._zoom=s._limitZoom(this._zoom)),s.options.touchZoom==="center"){if(this._center=this._startLatLng,d===1)return}else{var _=c._add(f)._divideBy(2)._subtract(this._centerPoint);if(d===1&&_.x===0&&_.y===0)return;this._center=s.unproject(s.project(this._pinchStartLatLng,this._zoom).subtract(_),this._zoom)}this._moved||(s._moveStart(!0,!1),this._moved=!0),B(this._animRequest);var x=o(s._move,s,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=D(x,this,!0),Mt(r)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,B(this._animRequest),ft(document,"touchmove",this._onTouchMove,this),ft(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});et.addInitHook("addHandler","touchZoom",Kf),et.BoxZoom=Hf,et.DoubleClickZoom=jf,et.Drag=Xf,et.Keyboard=Zf,et.ScrollWheelZoom=$f,et.TapHold=Yf,et.TouchZoom=Kf,e.Bounds=ht,e.Browser=W,e.CRS=Pe,e.Canvas=Uf,e.Circle=Oa,e.CircleMarker=po,e.Class=Z,e.Control=oe,e.DivIcon=Bf,e.DivOverlay=me,e.DomEvent=Gg,e.DomUtil=Jg,e.Draggable=Ye,e.Evented=mt,e.FeatureGroup=Me,e.GeoJSON=Ie,e.GridLayer=zr,e.Handler=_e,e.Icon=ki,e.ImageOverlay=yo,e.LatLng=st,e.LatLngBounds=kt,e.Layer=se,e.LayerGroup=Li,e.LineUtil=uT,e.Map=et,e.Marker=uo,e.Mixin=sT,e.Path=Ke,e.Point=Y,e.PolyUtil=aT,e.Polygon=Ui,e.Polyline=Ce,e.Popup=xo,e.PosAnimation=Tf,e.Projection=dT,e.Rectangle=Wf,e.Renderer=Oe,e.SVG=Wr,e.SVGOverlay=Ff,e.TileLayer=Vi,e.Tooltip=vo,e.Transformation=na,e.Util=j,e.VideoOverlay=Df,e.bind=o,e.bounds=Lt,e.canvas=zf,e.circle=vT,e.circleMarker=xT,e.control=Lr,e.divIcon=CT,e.extend=i,e.featureGroup=gT,e.geoJSON=Nf,e.geoJson=bT,e.gridLayer=IT,e.icon=TT,e.imageOverlay=AT,e.latLng=tt,e.latLngBounds=vt,e.layerGroup=mT,e.map=tT,e.marker=yT,e.point=K,e.polygon=ST,e.polyline=ET,e.popup=PT,e.rectangle=DT,e.setOptions=y,e.stamp=l,e.svg=Vf,e.svgOverlay=wT,e.tileLayer=Lf,e.tooltip=MT,e.transformation=Mr,e.version=t,e.videoOverlay=RT;var BT=window.L;e.noConflict=function(){return window.L=BT,this},window.L=e})});var Ao,o0,Ro,s0,ru,La=I(()=>{Ao=globalThis,o0=globalThis.document||{},Ro=globalThis.process||{},s0=globalThis.console,ru=globalThis.navigator||{}});function wo(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,i=e||t;return Boolean(i&&i.indexOf("Electron")>=0)}var ka=I(()=>{});function Ft(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||wo()}var Ua=I(()=>{ka()});function za(e){return!e&&!Ft()?"Node":wo(e)?"Electron":(e||ru.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var nu=I(()=>{Ua();ka();La()});var Va,Je=I(()=>{La();Ua();nu();Va="4.1.0"});function c0(e){try{let t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch{return null}}var Po,ou=I(()=>{Po=class{constructor(t,i,n="sessionStorage"){this.storage=c0(n),this.id=t,this.config=i,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let i=JSON.stringify(this.config);this.storage.setItem(this.id,i)}}_loadConfiguration(){let t={};if(this.storage){let i=this.storage.getItem(this.id);t=i?JSON.parse(i):{}}return Object.assign(this.config,t),this}}});function su(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function au(e,t=8){let i=Math.max(t-e.length,0);return`${" ".repeat(i)}${e}`}var cu=I(()=>{});function lu(e){return typeof e!="string"?e:(e=e.toUpperCase(),Mo[e]||Mo.WHITE)}function hu(e,t,i){return!Ft&&typeof e=="string"&&(t&&(e=`\x1B[${lu(t)}m${e}\x1B[39m`),i&&(e=`\x1B[${lu(i)+l0}m${e}\x1B[49m`)),e}var Mo,l0,fu=I(()=>{Je();(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Mo||(Mo={}));l0=10});function uu(e,t=["constructor"]){let i=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(i),o=e;for(let a of n){let l=o[a];typeof l=="function"&&(t.find(h=>a===h)||(o[a]=l.bind(e)))}}var du=I(()=>{});function jr(e,t){if(!e)throw new Error(t||"Assertion failed")}var pu=I(()=>{});function mi(){let e;if(Ft()&&Ao.performance)e=Ao?.performance?.now?.();else if("hrtime"in Ro){let t=Ro?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var _u=I(()=>{Je()});function ji(){}function yu(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return jr(Number.isFinite(t)&&t>=0),t}function Tu(e){let{logLevel:t,message:i}=e;e.logLevel=yu(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==i;);switch(typeof t){case"string":case"function":i!==void 0&&n.unshift(i),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let o=typeof e.message;return jr(o==="string"||o==="object"),Object.assign(e,{args:n},e.opts)}function f0(e,t,i){if(typeof t=="string"){let n=i.time?au(su(i.total)):"";t=i.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=hu(t,i.color,i.background)}return t}function u0(e){for(let t in e)for(let i in e[t])return i||"untitled";return"empty"}var Hi,h0,mu,gu,zt,Wa=I(()=>{Je();ou();cu();fu();du();pu();_u();Hi={debug:Ft()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},h0={enabled:!0,level:0};mu={},gu={once:!0},zt=class{constructor({id:t}={id:""}){this.VERSION=Va,this._startTs=mi(),this._deltaTs=mi(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Po(`__probe-${this.id}__`,h0),this.timeStamp(`${this.id} started`),uu(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((mi()-this._startTs).toPrecision(10))}getDelta(){return Number((mi()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,i){this._storage.setConfiguration({[t]:i})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,i){if(!t)throw new Error(i||"Assertion failed")}warn(t){return this._getLogFunction(0,t,Hi.warn,arguments,gu)}error(t){return this._getLogFunction(0,t,Hi.error,arguments)}deprecated(t,i){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${i}\` instead`)}removed(t,i){return this.error(`\`${t}\` has been removed. Use \`${i}\` instead`)}probe(t,i){return this._getLogFunction(t,i,Hi.log,arguments,{time:!0,once:!0})}log(t,i){return this._getLogFunction(t,i,Hi.debug,arguments)}info(t,i){return this._getLogFunction(t,i,console.info,arguments)}once(t,i){return this._getLogFunction(t,i,Hi.debug||Hi.info,arguments,gu)}table(t,i,n){return i?this._getLogFunction(t,i,console.table||ji,n&&[n],{tag:u0(i)}):ji}time(t,i){return this._getLogFunction(t,i,console.time?console.time:console.info)}timeEnd(t,i){return this._getLogFunction(t,i,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,i){return this._getLogFunction(t,i,console.timeStamp||ji)}group(t,i,n={collapsed:!1}){let o=Tu({logLevel:t,message:i,opts:n}),{collapsed:a}=n;return o.method=(a?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,i,n={}){return this.group(t,i,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||ji)}withGroup(t,i,n){this.group(t,i)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=yu(t)}_getLogFunction(t,i,n,o,a){if(this._shouldLog(t)){a=Tu({logLevel:t,message:i,args:o,opts:a}),n=n||a.method,jr(n),a.total=this.getTotal(),a.delta=this.getDelta(),this._deltaTs=mi();let l=a.tag||a.message;if(a.once&&l)if(!mu[l])mu[l]=mi();else return ji;return i=f0(this.id,a.message,a),n.bind(console,i,...a.args)}return ji}};zt.VERSION=Va});var xu=I(()=>{globalThis.probe={}});var DA,Xr=I(()=>{Wa();Wa();xu();DA=new zt({id:"@probe.gl/log"})});function Yr(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var rc=I(()=>{});var Ti,nc=I(()=>{rc();Ti=class{constructor(t,i){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=i,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Yr(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Yr()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}});var qt,Mu=I(()=>{nc();qt=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,i="count"){return this._getOrCreate({name:t,type:i})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let i of Object.values(this.stats))t(i)}getTable(){let t={};return this.forEach(i=>{t[i.name]={time:i.time||0,count:i.count||0,average:i.getAverageTime()||0,hz:i.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(i=>this._getOrCreate(i))}_getOrCreate(t){let{name:i,type:n}=t,o=this.stats[i];return o||(t instanceof Ti?o=t:o=new Ti(i,n),this.stats[i]=o),o}}});var Kr=I(()=>{Mu();nc();rc()});var Nc,Vo,Dc=I(()=>{Kr();Nc=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new qt({id:t})),this.stats.get(t)}},Vo=new Nc});var F,Ei=I(()=>{Xr();F=new zt({id:"luma.gl"})});function ti(e="id"){Fc[e]=Fc[e]||1;let t=Fc[e]++;return`${e}-${t}`}var Fc,an=I(()=>{Fc={}});function zy(e,t){let i={...t};for(let n in e)e[n]!==void 0&&(i[n]=e[n]);return i}var J,Vt=I(()=>{an();J=class{toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,i,n){if(!t)throw new Error("no device");this._device=t,this.props=zy(i,n);let o=this.props.id!=="undefined"?this.props.id:ti(this[Symbol.toStringTag]);this.props.id=o,this.id=o,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(t){this._attachedResources.add(t)}detachResource(t){this._attachedResources.delete(t)}destroyAttachedResource(t){this._attachedResources.delete(t)&&t.destroy()}destroyAttachedResources(){for(let t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let t=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];t.get(`${i}s Active`).decrementCount()}trackAllocatedMemory(t,i=this[Symbol.toStringTag]){let n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(t),n.get(`${i} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(t=this[Symbol.toStringTag]){let i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").subtractCount(this.allocatedBytes),i.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let t=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${i}s Created`).incrementCount(),t.get(`${i}s Active`).incrementCount()}};z(J,"defaultProps",{id:"undefined",handle:void 0,userData:void 0})});var cn,ut,Bc=I(()=>{Vt();cn=class extends J{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,i){let n={...i};(i.usage||0)&cn.INDEX&&!i.indexType&&(i.data instanceof Uint32Array?n.indexType="uint32":i.data instanceof Uint16Array&&(n.indexType="uint16")),delete n.data,super(t,n,cn.defaultProps),this.usage=n.usage||0,this.indexType=n.indexType,this.updateTimestamp=t.incrementTimestamp()}clone(t){return this.device.createBuffer({...this.props,...t})}debugData=new ArrayBuffer(0);_setDebugData(t,i,n){let o=ArrayBuffer.isView(t)?t.buffer:t,a=Math.min(t?t.byteLength:n,cn.DEBUG_DATA_MAX_LENGTH);o===null?this.debugData=new ArrayBuffer(a):i===0&&n===o.byteLength?this.debugData=o.slice(0,a):this.debugData=o.slice(i,i+a)}},ut=cn;z(ut,"INDEX",16),z(ut,"VERTEX",32),z(ut,"UNIFORM",64),z(ut,"STORAGE",128),z(ut,"INDIRECT",256),z(ut,"QUERY_RESOLVE",512),z(ut,"MAP_READ",1),z(ut,"MAP_WRITE",2),z(ut,"COPY_SRC",4),z(ut,"COPY_DST",8),z(ut,"DEBUG_DATA_MAX_LENGTH",32),z(ut,"defaultProps",{...J.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0})});function ln(e){let[t,i,n]=kc[e],o=e.includes("norm"),a=!o&&!e.startsWith("float"),l=e.startsWith("s");return{signedType:t,primitiveType:i,byteLength:n,normalized:o,integer:a,signed:l}}function Wo(e){let t=ArrayBuffer.isView(e)?e.constructor:e;if(t===Uint8ClampedArray)return"uint8";let i=Object.values(kc).find(n=>t===n[4]);if(!i)throw new Error(t.name);return i[0]}function Lc(e){let[,,,,t]=kc[e];return t}var kc,Ho=I(()=>{kc={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]}});function hn(e){let t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);let[i,n]=e.split("x"),o=i,a=n?parseInt(n):1,l=ln(o),h={type:o,components:a,byteLength:l.byteLength*a,integer:l.integer,signed:l.signed,normalized:l.normalized};return t&&(h.webglOnly=!0),h}function Vd(e){let t;switch(e.primitiveType){case"f32":t="float32";break;case"i32":t="sint32";break;case"u32":t="uint32";break;case"f16":return e.components<=2?"float16x2":"float16x4"}return e.components===1?t:`${t}x${e.components}`}var Uc=I(()=>{Ho()});function jc(e){let t=Zy[e];if(!t)throw new Error(`Unsupported texture format ${e}`);return t}var Ot,at,xe,Wy,jo,zc,Xo,Vc,Hy,Wc,fn,Hc,Zo,Wd,jy,Xy,Zy,Hd=I(()=>{Ot="texture-compression-bc",at="texture-compression-astc",xe="texture-compression-etc2",Wy="texture-compression-etc1-webgl",jo="texture-compression-pvrtc-webgl",zc="texture-compression-atc-webgl",Xo="float32-renderable-webgl",Vc="float16-renderable-webgl",Hy="rgb9e5ufloat-renderable-webgl",Wc="snorm8-renderable-webgl",fn="norm16-renderable-webgl",Hc="snorm16-renderable-webgl",Zo="float32-filterable",Wd="float16-filterable-webgl";jy={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:Wc},rg8snorm:{render:Wc},"rgb8snorm-webgl":{},rgba8snorm:{render:Wc},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:fn},rg16unorm:{render:fn},"rgb16unorm-webgl":{f:fn},rgba16unorm:{render:fn},r16snorm:{f:Hc},rg16snorm:{render:Hc},"rgb16snorm-webgl":{f:fn},rgba16snorm:{render:Hc},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:Vc,filter:"float16-filterable-webgl"},rg16float:{render:Vc,filter:Wd},rgba16float:{render:Vc,filter:Wd},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:Xo,filter:Zo},rg32float:{render:!1,filter:Zo},"rgb32float-webgl":{render:Xo,filter:Zo},rgba32float:{render:Xo,filter:Zo},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},rgb9e5ufloat:{channels:"rgb",packed:!0,render:Hy},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:Xo},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},rgb10a2uint:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0}},Xy={"bc1-rgb-unorm-webgl":{f:Ot},"bc1-rgb-unorm-srgb-webgl":{f:Ot},"bc1-rgba-unorm":{f:Ot},"bc1-rgba-unorm-srgb":{f:Ot},"bc2-rgba-unorm":{f:Ot},"bc2-rgba-unorm-srgb":{f:Ot},"bc3-rgba-unorm":{f:Ot},"bc3-rgba-unorm-srgb":{f:Ot},"bc4-r-unorm":{f:Ot},"bc4-r-snorm":{f:Ot},"bc5-rg-unorm":{f:Ot},"bc5-rg-snorm":{f:Ot},"bc6h-rgb-ufloat":{f:Ot},"bc6h-rgb-float":{f:Ot},"bc7-rgba-unorm":{f:Ot},"bc7-rgba-unorm-srgb":{f:Ot},"etc2-rgb8unorm":{f:xe},"etc2-rgb8unorm-srgb":{f:xe},"etc2-rgb8a1unorm":{f:xe},"etc2-rgb8a1unorm-srgb":{f:xe},"etc2-rgba8unorm":{f:xe},"etc2-rgba8unorm-srgb":{f:xe},"eac-r11unorm":{f:xe},"eac-r11snorm":{f:xe},"eac-rg11unorm":{f:xe},"eac-rg11snorm":{f:xe},"astc-4x4-unorm":{f:at},"astc-4x4-unorm-srgb":{f:at},"astc-5x4-unorm":{f:at},"astc-5x4-unorm-srgb":{f:at},"astc-5x5-unorm":{f:at},"astc-5x5-unorm-srgb":{f:at},"astc-6x5-unorm":{f:at},"astc-6x5-unorm-srgb":{f:at},"astc-6x6-unorm":{f:at},"astc-6x6-unorm-srgb":{f:at},"astc-8x5-unorm":{f:at},"astc-8x5-unorm-srgb":{f:at},"astc-8x6-unorm":{f:at},"astc-8x6-unorm-srgb":{f:at},"astc-8x8-unorm":{f:at},"astc-8x8-unorm-srgb":{f:at},"astc-10x5-unorm":{f:at},"astc-10x5-unorm-srgb":{f:at},"astc-10x6-unorm":{f:at},"astc-10x6-unorm-srgb":{f:at},"astc-10x8-unorm":{f:at},"astc-10x8-unorm-srgb":{f:at},"astc-10x10-unorm":{f:at},"astc-10x10-unorm-srgb":{f:at},"astc-12x10-unorm":{f:at},"astc-12x10-unorm-srgb":{f:at},"astc-12x12-unorm":{f:at},"astc-12x12-unorm-srgb":{f:at},"pvrtc-rgb4unorm-webgl":{f:jo},"pvrtc-rgba4unorm-webgl":{f:jo},"pvrtc-rbg2unorm-webgl":{f:jo},"pvrtc-rgba2unorm-webgl":{f:jo},"etc1-rbg-unorm-webgl":{f:Wy},"atc-rgb-unorm-webgl":{f:zc},"atc-rgba-unorm-webgl":{f:zc},"atc-rgbai-unorm-webgl":{f:zc}},Zy={...jy,...Xy}});function jd(e){let t=Ky(e);if(Ne.isCompressed(e)){t.channels="rgb",t.components=3,t.bytesPerPixel=1,t.srgb=!1,t.compressed=!0;let n=qy(e);n&&(t.blockWidth=n.blockWidth,t.blockHeight=n.blockHeight)}let i=Yy.exec(e);if(i){let[,n,o,a,l,h]=i,u=`${a}${o}`,p=ln(u),m=p.byteLength*8,g=n.length,T=[m,g>=2?m:0,g>=3?m:0,g>=4?m:0];t={format:e,attachment:t.attachment,dataType:p.signedType,components:g,channels:n,integer:p.integer,signed:p.signed,normalized:p.normalized,bitsPerChannel:T,bytesPerPixel:p.byteLength*n.length,packed:t.packed,srgb:t.srgb},h==="-webgl"&&(t.webgl=!0),l==="-srgb"&&(t.srgb=!0)}return e.endsWith("-webgl")&&(t.webgl=!0),e.endsWith("-srgb")&&(t.srgb=!0),t}function Ky(e){let t=jc(e),i=t.bytesPerPixel||1,n=t.bitsPerChannel||[8,8,8,8];return delete t.bitsPerChannel,delete t.bytesPerPixel,delete t.f,delete t.render,delete t.filter,delete t.blend,delete t.store,{...t,format:e,attachment:t.attachment||"color",channels:t.channels||"r",components:t.components||t.channels?.length||1,bytesPerPixel:i,bitsPerChannel:n,dataType:t.dataType||"uint8",srgb:t.srgb??!1,packed:t.packed??!1,webgl:t.webgl??!1,integer:t.integer??!1,signed:t.signed??!1,normalized:t.normalized??!1,compressed:t.compressed??!1}}function qy(e){let i=/.*-(\d+)x(\d+)-.*/.exec(e);if(i){let[,n,o]=i;return{blockWidth:Number(n),blockHeight:Number(o)}}return null}var $y,Yy,$o,Ne,Xc=I(()=>{Ho();Hd();$y=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Yy=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,$o=class{getInfo(t){return jd(t)}isColor(t){return t.startsWith("rgba")||t.startsWith("bgra")||t.startsWith("rgb")}isDepthStencil(t){return t.startsWith("depth")||t.startsWith("stencil")}isCompressed(t){return $y.some(i=>t.startsWith(i))}getCapabilities(t){let i=jc(t),n={format:t,create:i.f??!0,render:i.render??!0,filter:i.filter??!0,blend:i.blend??!0,store:i.store??!0},o=jd(t),a=t.startsWith("depth")||t.startsWith("stencil"),l=o?.signed,h=o?.integer,u=o?.webgl;return n.render&&=!l,n.filter&&=!a&&!l&&!h&&!u,n}},Ne=new $o});function Xd(e){return typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement||typeof VideoFrame<"u"&&e instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}function Zd(e){if(typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)return{width:e.width,height:e.height};if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement)return{width:e.naturalWidth,height:e.naturalHeight};if(typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement)return{width:e.videoWidth,height:e.videoHeight};if(typeof VideoFrame<"u"&&e instanceof VideoFrame)return{width:e.displayWidth,height:e.displayHeight};throw new Error("Unknown image type")}var $d=I(()=>{});var un,dn,Zc,Gt,$c=I(()=>{Dc();Ei();an();Bc();Uc();Xc();$d();un=class{},dn=class{features;disabledFeatures;constructor(t=[],i){this.features=new Set(t),this.disabledFeatures=i||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures?.[t]&&this.features.has(t)}},Zc=class{get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=Vo;timestamp=0;_reused=!1;_lumaData={};_textureCaps={};constructor(t){this.props={...Zc.defaultProps,...t},this.id=this.props.id||ti(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(t){return hn(t)}isVertexFormatSupported(t){return!0}getTextureFormatInfo(t){return Ne.getInfo(t)}getTextureFormatCapabilities(t){let i=this._textureCaps[t];if(!i){let n=this._getDeviceTextureFormatCapabilities(t);i=this._getDeviceSpecificTextureFormatCapabilities(n),this._textureCaps[t]=i}return i}getMipLevelCount(t,i,n=1){let o=Math.max(t,i,n);return 1+Math.floor(Math.log2(o))}isExternalImage(t){return Xd(t)}getExternalImageSize(t){return Zd(t)}isTextureFormatSupported(t){return this.getTextureFormatCapabilities(t).create}isTextureFormatFilterable(t){return this.getTextureFormatCapabilities(t).filter}isTextureFormatRenderable(t){return this.getTextureFormatCapabilities(t).render}isTextureFormatCompressed(t){return Ne.isCompressed(t)}pushDebugGroup(t){this.commandEncoder.pushDebugGroup(t)}popDebugGroup(){this.commandEncoder?.popDebugGroup()}insertDebugMarker(t){this.commandEncoder?.insertDebugMarker(t)}loseDevice(){return!1}incrementTimestamp(){return this.timestamp++}reportError(t,i,...n){return this.props.onError(t,i)?()=>{}:F.error(t.message,i,...n)}debug(){if(this.props.debug)debugger;else{let t=`'Type luma.log.set({debug: true}) in console to enable debug breakpoints',
8
- or create a device with the 'debug: true' prop.`;F.once(0,t)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}beginRenderPass(t){return this.commandEncoder.beginRenderPass(t)}beginComputePass(t){return this.commandEncoder.beginComputePass(t)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(t,i){throw new Error("not implemented")}readPixelsToBufferWebGL(t,i){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,i){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}static _getCanvasContextProps(t){return t.createCanvasContext===!0?{}:t.createCanvasContext}_getDeviceTextureFormatCapabilities(t){let i=Ne.getCapabilities(t),n=a=>(typeof a=="string"?this.features.has(a):a)??!0,o=n(i.create);return{format:t,create:o,render:o&&n(i.render),filter:o&&n(i.filter),blend:o&&n(i.blend),store:o&&n(i.store)}}_normalizeBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let i={...t};if((t.usage||0)&ut.INDEX&&(t.indexType||(t.data instanceof Uint32Array?i.indexType="uint32":t.data instanceof Uint16Array&&(i.indexType="uint16")),!i.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return i}},Gt=Zc;z(Gt,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(t,i)=>{},onResize:(t,i)=>{let[n,o]=t.getDevicePixelSize();F.log(1,`${t} resized => ${n}x${o}px`)()},onPositionChange:(t,i)=>{let[n,o]=t.getPosition();F.log(1,`${t} repositioned => ${n},${o}`)()},onVisibilityChange:t=>F.log(1,`${t} Visibility changed ${t.isVisible}`)(),onDevicePixelRatioChange:(t,i)=>F.log(1,`${t} DPR changed ${i.oldRatio} => ${t.devicePixelRatio}`)(),debug:F.get("debug")||void 0,debugShaders:F.get("debug-shaders")||void 0,debugFramebuffers:Boolean(F.get("debug-framebuffers")),debugFactories:Boolean(F.get("debug-factories")),debugWebGL:Boolean(F.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!1,_cachePipelines:!1,_cacheDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0})});var Jy,Yd,Ko,Yo,Ji,Kd=I(()=>{$c();Dc();Ei();Jy="set luma.log.level=1 (or higher) to trace rendering",Yd="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",Ko=class{stats=Vo;log=F;VERSION="9.2.4";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw F.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),F.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");F.error("This version of luma.gl has already been initialized")()}F.log(1,`${this.VERSION} - ${Jy}`)(),globalThis.luma=this}async createDevice(t={}){let i={...Ko.defaultProps,...t},n=this.selectAdapter(i.type,i.adapters);if(!n)throw new Error(Yd);return i.waitForPageLoad&&await n.pageLoaded,await n.create(i)}async attachDevice(t,i){let n=this._getTypeFromHandle(t,i.adapters),o=n&&this.selectAdapter(n,i.adapters);if(!o)throw new Error(Yd);return await o?.attach?.(t,i)}registerAdapters(t){for(let i of t)this.preregisteredAdapters.set(i.type,i)}getSupportedAdapters(t=[]){let i=this._getAdapterMap(t);return Array.from(i).map(([,n])=>n).filter(n=>n.isSupported?.()).map(n=>n.type)}getBestAvailableAdapterType(t=[]){let i=["webgpu","webgl","null"],n=this._getAdapterMap(t);for(let o of i)if(n.get(o)?.isSupported?.())return o;return null}selectAdapter(t,i=[]){let n=t;t==="best-available"&&(n=this.getBestAvailableAdapterType(i));let o=this._getAdapterMap(i);return n&&o.get(n)||null}enforceWebGL2(t=!0,i=[]){let o=this._getAdapterMap(i).get("webgl");o||F.warn("enforceWebGL2: webgl adapter not found")(),o?.enforceWebGL2?.(t)}setDefaultDeviceProps(t){Object.assign(Ko.defaultProps,t)}_getAdapterMap(t=[]){let i=new Map(this.preregisteredAdapters);for(let n of t)i.set(n.type,n);return i}_getTypeFromHandle(t,i=[]){return t instanceof WebGL2RenderingContext?"webgl":typeof GPUDevice<"u"&&t instanceof GPUDevice||t?.queue?"webgpu":t===null?"null":(t instanceof WebGLRenderingContext?F.warn("WebGL1 is not supported",t)():F.warn("Unknown handle type",t)(),null)}},Yo=Ko;z(Yo,"defaultProps",{...Gt.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});Ji=new Yo});function tx(){return qo||(Gy()||typeof window>"u"?qo=Promise.resolve():qo=new Promise(e=>window.addEventListener("load",()=>e()))),qo}var pn,Qy,Gy,qo,qd=I(()=>{Je();pn=class{get pageLoaded(){return tx()}},Qy=Ft()&&typeof document<"u",Gy=()=>Qy&&document.readyState==="complete",qo=null});function Jd(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}var Qd=I(()=>{});function ex(e){if(typeof e=="string"){let t=document.getElementById(e);if(!t)throw new Error(`${e} is not an HTML element`);return t}return e||document.body}function ix(e){let t=document.getElementById(e);if(!Si.isHTMLCanvas(t))throw new Error("Object is not a canvas element");return t}function rx(e){let{width:t,height:i}=e,n=document.createElement("canvas");n.id=ti("lumagl-auto-created-canvas"),n.width=t||1,n.height=i||1,n.style.width=Number.isFinite(t)?`${t}px`:"100%",n.style.height=Number.isFinite(i)?`${i}px`:"100%",e?.visible||(n.style.visibility="hidden");let o=ex(e?.container||null);return o.insertBefore(n,o.firstChild),n}function nx(e,t,i,n,o){let a=e,l=Gd(a[0],t,i),h=tp(a[1],t,n,o),u=Gd(a[0]+1,t,i),p=u===i-1?u:u-1;u=tp(a[1]+1,t,n,o);let m;return o?(u=u===0?u:u+1,m=h,h=u):m=u===n-1?u:u-1,{x:l,y:h,width:Math.max(p-l+1,1),height:Math.max(m-h+1,1)}}function Gd(e,t,i){return Math.min(Math.round(e*t),i-1)}function tp(e,t,i,n){return n?Math.max(0,i-1-Math.round(e*t)):Math.min(Math.round(e*t),i-1)}var Qi,Si,ep=I(()=>{Je();an();Qd();Qi=class{static isHTMLCanvas(t){return typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement}static isOffscreenCanvas(t){return typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas}id;props;canvas;htmlCanvas;offscreenCanvas;type;initialized;isInitialized=!1;isVisible=!0;cssWidth;cssHeight;devicePixelRatio;devicePixelWidth;devicePixelHeight;drawingBufferWidth;drawingBufferHeight;_initializedResolvers=Jd();_resizeObserver;_intersectionObserver;_position;destroyed=!1;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(t){if(this.props={...Qi.defaultProps,...t},t=this.props,this.initialized=this._initializedResolvers.promise,Ft()?t.canvas?typeof t.canvas=="string"?this.canvas=ix(t.canvas):this.canvas=t.canvas:this.canvas=rx(t):this.canvas={width:t.width||1,height:t.height||1},Qi.isHTMLCanvas(this.canvas)?(this.id=t.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):Qi.isOffscreenCanvas(this.canvas)?(this.id=t.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=t.id||"node-canvas-context",this.type="node"),this.cssWidth=this.htmlCanvas?.clientWidth||this.canvas.width,this.cssHeight=this.htmlCanvas?.clientHeight||this.canvas.height,this.devicePixelWidth=this.canvas.width,this.devicePixelHeight=this.canvas.height,this.drawingBufferWidth=this.canvas.width,this.drawingBufferHeight=this.canvas.height,this.devicePixelRatio=globalThis.devicePixelRatio||1,this._position=[0,0],Qi.isHTMLCanvas(this.canvas)){this._intersectionObserver=new IntersectionObserver(i=>this._handleIntersection(i)),this._intersectionObserver.observe(this.canvas),this._resizeObserver=new ResizeObserver(i=>this._handleResize(i));try{this._resizeObserver.observe(this.canvas,{box:"device-pixel-content-box"})}catch{this._resizeObserver.observe(this.canvas,{box:"content-box"})}setTimeout(()=>this._observeDevicePixelRatio(),0),this.props.trackPosition&&this._trackPosition()}}destroy(){this.destroyed=!0}setProps(t){return"useDevicePixels"in t&&(this.props.useDevicePixels=t.useDevicePixels||!1,this._updateDrawingBufferSize()),this}getCSSSize(){return[this.cssWidth,this.cssHeight]}getPosition(){return this._position}getDevicePixelSize(){return[this.devicePixelWidth,this.devicePixelHeight]}getDrawingBufferSize(){return[this.drawingBufferWidth,this.drawingBufferHeight]}getMaxDrawingBufferSize(){let t=this.device.limits.maxTextureDimension2D;return[t,t]}setDrawingBufferSize(t,i){this.canvas.width=t,this.canvas.height=i,this.drawingBufferWidth=t,this.drawingBufferHeight=i}getDevicePixelRatio(){return typeof window<"u"&&window.devicePixelRatio||1}cssToDevicePixels(t,i=!0){let n=this.cssToDeviceRatio(),[o,a]=this.getDrawingBufferSize();return nx(t,n,o,a,i)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){let[t,i]=this.getDevicePixelSize();return t/i}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),[i]=this.getCSSSize();return i?t/i:1}catch{return 1}}resize(t){this.setDrawingBufferSize(t.width,t.height)}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}_handleIntersection(t){let i=t.find(o=>o.target===this.canvas);if(!i)return;let n=i.isIntersecting;this.isVisible!==n&&(this.isVisible=n,this.device.props.onVisibilityChange(this))}_handleResize(t){let i=t.find(u=>u.target===this.canvas);if(!i)return;this.cssWidth=i.contentBoxSize[0].inlineSize,this.cssHeight=i.contentBoxSize[0].blockSize;let n=this.getDevicePixelSize(),o=i.devicePixelContentBoxSize?.[0].inlineSize||i.contentBoxSize[0].inlineSize*devicePixelRatio,a=i.devicePixelContentBoxSize?.[0].blockSize||i.contentBoxSize[0].blockSize*devicePixelRatio,[l,h]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(o,l)),this.devicePixelHeight=Math.max(1,Math.min(a,h)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:n})}_updateDrawingBufferSize(){if(this.props.autoResize){if(typeof this.props.useDevicePixels=="number"){let t=this.props.useDevicePixels;this.setDrawingBufferSize(this.cssWidth*t,this.cssHeight*t)}else this.props.useDevicePixels?this.setDrawingBufferSize(this.devicePixelWidth,this.devicePixelHeight):this.setDrawingBufferSize(this.cssWidth,this.cssHeight);this._updateDevice()}this._initializedResolvers.resolve(),this.isInitialized=!0,this.updatePosition()}_observeDevicePixelRatio(){let t=this.devicePixelRatio;this.devicePixelRatio=window.devicePixelRatio,this.updatePosition(),this.device.props.onDevicePixelRatioChange(this,{oldRatio:t}),matchMedia(`(resolution: ${this.devicePixelRatio}dppx)`).addEventListener("change",()=>this._observeDevicePixelRatio(),{once:!0})}_trackPosition(t=100){let i=setInterval(()=>{this.destroyed?clearInterval(i):this.updatePosition()},t)}updatePosition(){let t=this.htmlCanvas?.getBoundingClientRect();if(t){let i=[t.left,t.top];if(this._position??=i,i[0]!==this._position[0]||i[1]!==this._position[1]){let o=this._position;this._position=i,this.device.props.onPositionChange?.(this,{oldPosition:o})}}}},Si=Qi;z(Si,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1})});var Jo,ei,Yc=I(()=>{Vt();Jo=class extends J{get[Symbol.toStringTag](){return"Sampler"}constructor(t,i){i=Jo.normalizeProps(t,i),super(t,i,Jo.defaultProps)}static normalizeProps(t,i){return i}},ei=Jo;z(ei,"defaultProps",{...J.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1})});var ox,De,pt,Kc=I(()=>{Vt();Yc();Ei();ox={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},De=class extends J{dimension;baseDimension;format;width;height;depth;mipLevels;updateTimestamp;get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}constructor(t,i){if(i=De.normalizeProps(t,i),super(t,i,De.defaultProps),this.dimension=this.props.dimension,this.baseDimension=ox[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.props.width===void 0||this.props.height===void 0)if(t.isExternalImage(i.data)){let n=t.getExternalImageSize(i.data);this.width=n?.width||1,this.height=n?.height||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&F.warn(`${this} created with undefined width or height. This is deprecated. Use AsyncTexture instead.`)();this.updateTimestamp=t.incrementTimestamp()}setSampler(t){this.sampler=t instanceof ei?t:this.device.createSampler(t)}clone(t){return this.device.createTexture({...this.props,...t})}static normalizeProps(t,i){let n={...i},{width:o,height:a}=n;return typeof o=="number"&&(n.width=Math.max(1,Math.ceil(o))),typeof a=="number"&&(n.height=Math.max(1,Math.ceil(a))),n}_initializeData(t){this.device.isExternalImage(t)?this.copyExternalImage({image:t,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):t&&this.copyImageData({data:t,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(t){let{width:i,height:n,depth:o}=this,a={...De.defaultCopyDataOptions,width:i,height:n,depth:o,...t},l=this.device.getTextureFormatInfo(this.format);if(!t.bytesPerRow&&!l.bytesPerPixel)throw new Error(`bytesPerRow must be provided for texture format ${this.format}`);return a.bytesPerRow=t.bytesPerRow||i*(l.bytesPerPixel||4),a.rowsPerImage=t.rowsPerImage||n,a}_normalizeCopyExternalImageOptions(t){let i=this.device.getExternalImageSize(t.image),n={...De.defaultCopyExternalImageOptions,...i,...t};return n.width=Math.min(n.width,this.width-n.x),n.height=Math.min(n.height,this.height-n.y),n}},pt=De;z(pt,"SAMPLE",4),z(pt,"STORAGE",8),z(pt,"RENDER",16),z(pt,"COPY_SRC",1),z(pt,"COPY_DST",2),z(pt,"TEXTURE",4),z(pt,"RENDER_ATTACHMENT",16),z(pt,"defaultProps",{...J.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:De.TEXTURE|De.RENDER_ATTACHMENT|De.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),z(pt,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),z(pt,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1})});var qc,Gi,ip=I(()=>{Vt();qc=class extends J{get[Symbol.toStringTag](){return"TextureView"}constructor(t,i){super(t,i,qc.defaultProps)}},Gi=qc;z(Gi,"defaultProps",{...J.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0})});function rp(e,t,i){let n="",o=t.split(/\r?\n/),a=e.slice().sort((l,h)=>l.lineNum-h.lineNum);switch(i?.showSourceCode||"no"){case"all":let l=0;for(let h=1;h<=o.length;h++)for(n+=np(o[h-1],h,i);a.length>l&&a[l].lineNum===h;){let u=a[l++];n+=Jc(u,o,u.lineNum,{...i,inlineSource:!1})}for(;a.length>l;){let h=a[l++];n+=Jc(h,[],0,{...i,inlineSource:!1})}return n;case"issues":case"no":for(let h of e)n+=Jc(h,o,h.lineNum,{inlineSource:i?.showSourceCode!=="no"});return n}}function Jc(e,t,i,n){if(n?.inlineSource){let a=sx(t,i),l=e.linePos>0?`${" ".repeat(e.linePos+5)}^^^
9
- `:"";return`
10
- ${a}${l}${e.type.toUpperCase()}: ${e.message}
11
-
12
- `}let o=e.type==="error"?"red":"#8B4000";return n?.html?`<div class='luma-compiler-log-error' style="color:${o};"><b> ${e.type.toUpperCase()}: ${e.message}</b></div>`:`${e.type.toUpperCase()}: ${e.message}`}function sx(e,t,i){let n="";for(let o=t-2;o<=t;o++){let a=e[o-1];a!==void 0&&(n+=np(a,t,i))}return n}function np(e,t,i){let n=i?.html?cx(e):e;return`${ax(String(t),4)}: ${n}${i?.html?"<br/>":`
13
- `}`}function ax(e,t){let i="";for(let n=e.length;n<t;++n)i+=" ";return i+e}function cx(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}var op=I(()=>{});function lx(e){return hx(e.source)||e.id||ti(`unnamed ${e.stage}-shader`)}function hx(e,t="unnamed"){let n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(e);return n?n[1]:t}var Qc,tr,sp=I(()=>{Vt();an();op();Qc=class extends J{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(t,i){i={...i,debugShaders:i.debugShaders||t.props.debugShaders||"errors"},super(t,{id:lx(i),...i},Qc.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){let t=this.props.debugShaders;switch(t){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let i=await this.getCompilationInfo();t==="warnings"&&i?.length===0||this._displayShaderLog(i,this.id)}_displayShaderLog(t,i){if(typeof document>"u"||!document?.createElement)return;let n=i,o=`${this.stage} shader "${n}"`,a=rp(t,this.source,{showSourceCode:"all",html:!0}),l=this.getTranslatedSource();l&&(a+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${l}</pre></code>`);let h=document.createElement("Button");h.innerHTML=`
14
- <h1>Compilation error in ${o}</h1><br /><br />
15
- <code style="user-select:text;"><pre>
16
- ${a}
17
- </pre></code>`,h.style.top="10px",h.style.left="10px",h.style.position="absolute",h.style.zIndex="9999",h.style.width="100%",h.style.textAlign="left",document.body.appendChild(h),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),h.onclick=()=>{let p=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(p)}}},tr=Qc;z(tr,"defaultProps",{...J.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0})});var Gc,ii,ap=I(()=>{Vt();Kc();Ei();Gc=class extends J{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(t,i={}){super(t,i,Gc.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(t){let i=this.colorAttachments.map(o=>o.texture.clone(t)),n=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(t);return this.device.createFramebuffer({...this.props,colorAttachments:i,depthStencilAttachment:n})}resize(t){let i=!t;if(t){let[n,o]=Array.isArray(t)?t:[t.width,t.height];i=i||o!==this.height||n!==this.width,this.width=n,this.height=o}i&&(F.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map((i,n)=>{if(typeof i=="string"){let o=this.createColorTexture(i,n);return this.attachResource(o),o.view}return i instanceof pt?i.view:i});let t=this.props.depthStencilAttachment;if(t)if(typeof t=="string"){let i=this.createDepthStencilTexture(t);this.attachResource(i),this.depthStencilAttachment=i.view}else t instanceof pt?this.depthStencilAttachment=t.view:this.depthStencilAttachment=t}createColorTexture(t,i){return this.device.createTexture({id:`${this.id}-color-attachment-${i}`,usage:pt.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(t){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:pt.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}resizeAttachments(t,i){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){let o=this.colorAttachments[n].texture.clone({width:t,height:i});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=o.view,this.attachResource(o.view)}if(this.depthStencilAttachment){let n=this.depthStencilAttachment.texture.clone({width:t,height:i});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}this.updateAttachments()}},ii=Gc;z(ii,"defaultProps",{...J.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null})});var tl,er,cp=I(()=>{Vt();tl=class extends J{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(t,i){super(t,i,tl.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}},er=tl;z(er,"defaultProps",{...J.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},bindings:{},uniforms:{}})});var bi,Fe,lp=I(()=>{Vt();bi=class extends J{get[Symbol.toStringTag](){return"RenderPass"}constructor(t,i){i=bi.normalizeProps(t,i),super(t,i,bi.defaultProps)}static normalizeProps(t,i){return i}},Fe=bi;z(Fe,"defaultClearColor",[0,0,0,1]),z(Fe,"defaultClearDepth",1),z(Fe,"defaultClearStencil",0),z(Fe,"defaultProps",{...J.defaultProps,framebuffer:null,parameters:void 0,clearColor:bi.defaultClearColor,clearColors:void 0,clearDepth:bi.defaultClearDepth,clearStencil:bi.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0})});var el,ir,hp=I(()=>{Vt();el=class extends J{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(t,i){super(t,i,el.defaultProps)}},ir=el;z(ir,"defaultProps",{...J.defaultProps,measureExecutionTime:void 0})});var il,rr,fp=I(()=>{Vt();il=class extends J{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(t,i){super(t,i,il.defaultProps)}},rr=il;z(rr,"defaultProps",{...J.defaultProps})});function rl(e){return dx[e]}function nl(e){let[t,i]=ux[e],n=t==="i32"||t==="u32",o=t!=="u32",a=fx[t]*i;return{primitiveType:t,components:i,byteLength:a,integer:n,signed:o}}var fx,ux,dx,px,x2,ol=I(()=>{fx={f32:4,f16:2,i32:4,u32:4},ux={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},dx={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<f16>":{type:"f16",components:2},"vec3<f16>":{type:"f16",components:3},"vec4<f16>":{type:"f16",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16},"mat2x2<f16>":{type:"f16",components:4},"mat2x3<f16>":{type:"f16",components:6},"mat2x4<f16>":{type:"f16",components:8},"mat3x2<f16>":{type:"f16",components:6},"mat3x3<f16>":{type:"f16",components:9},"mat3x4<f16>":{type:"f16",components:12},"mat4x2<f16>":{type:"f16",components:8},"mat4x3<f16>":{type:"f16",components:12},"mat4x4<f16>":{type:"f16",components:16},"mat2x2<i32>":{type:"i32",components:4},"mat2x3<i32>":{type:"i32",components:6},"mat2x4<i32>":{type:"i32",components:8},"mat3x2<i32>":{type:"i32",components:6},"mat3x3<i32>":{type:"i32",components:9},"mat3x4<i32>":{type:"i32",components:12},"mat4x2<i32>":{type:"i32",components:8},"mat4x3<i32>":{type:"i32",components:12},"mat4x4<i32>":{type:"i32",components:16},"mat2x2<u32>":{type:"u32",components:4},"mat2x3<u32>":{type:"u32",components:6},"mat2x4<u32>":{type:"u32",components:8},"mat3x2<u32>":{type:"u32",components:6},"mat3x3<u32>":{type:"u32",components:9},"mat3x4<u32>":{type:"u32",components:12},"mat4x2<u32>":{type:"u32",components:8},"mat4x3<u32>":{type:"u32",components:12},"mat4x4<u32>":{type:"u32",components:16}},px={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>"},x2={...px,mat2x2f:"mat2x2<f32>",mat2x3f:"mat2x3<f32>",mat2x4f:"mat2x4<f32>",mat3x2f:"mat3x2<f32>",mat3x3f:"mat3x3<f32>",mat3x4f:"mat3x4<f32>",mat4x2f:"mat4x2<f32>",mat4x3f:"mat4x3<f32>",mat4x4f:"mat4x4<f32>",mat2x2i:"mat2x2<i32>",mat2x3i:"mat2x3<i32>",mat2x4i:"mat2x4<i32>",mat3x2i:"mat3x2<i32>",mat3x3i:"mat3x3<i32>",mat3x4i:"mat3x4<i32>",mat4x2i:"mat4x2<i32>",mat4x3i:"mat4x3<i32>",mat4x4i:"mat4x4<i32>",mat2x2u:"mat2x2<u32>",mat2x3u:"mat2x3<u32>",mat2x4u:"mat2x4<u32>",mat3x2u:"mat3x2<u32>",mat3x3u:"mat3x3<u32>",mat3x4u:"mat3x4<u32>",mat4x2u:"mat4x2<u32>",mat4x3u:"mat4x3<u32>",mat4x4u:"mat4x4<u32>",mat2x2h:"mat2x2<f16>",mat2x3h:"mat2x3<f16>",mat2x4h:"mat2x4<f16>",mat3x2h:"mat3x2<f16>",mat3x3h:"mat3x3<f16>",mat3x4h:"mat3x4<f16>",mat4x2h:"mat4x2<f16>",mat4x3h:"mat4x3<f16>",mat4x4h:"mat4x4<f16>"}});function _x(e,t){let i={};for(let n of e.attributes){let o=mx(e,t,n.name);o&&(i[n.name]=o)}return i}function up(e,t,i=16){let n=_x(e,t),o=new Array(i).fill(null);for(let a of Object.values(n))o[a.location]=a;return o}function mx(e,t,i){let n=gx(e,i),o=Tx(t,i);if(!n)return null;let a=nl(n.type),l=Vd(a),h=o?.vertexFormat||l,u=hn(h);return{attributeName:o?.attributeName||n.name,bufferName:o?.bufferName||n.name,location:n.location,shaderType:n.type,primitiveType:a.primitiveType,shaderComponents:a.components,vertexFormat:h,bufferDataType:u.type,bufferComponents:u.components,normalized:u.normalized,integer:a.integer,stepMode:o?.stepMode||n.stepMode||"vertex",byteOffset:o?.byteOffset||0,byteStride:o?.byteStride||0}}function gx(e,t){let i=e.attributes.find(n=>n.name===t);return i||F.warn(`shader layout attribute "${t}" not present in shader`),i||null}function Tx(e,t){yx(e);let i=xx(e,t);return i||(i=vx(e,t),i)?i:(F.warn(`layout for attribute "${t}" not present in buffer layout`),null)}function yx(e){for(let t of e)(t.attributes&&t.format||!t.attributes&&!t.format)&&F.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function xx(e,t){for(let i of e)if(i.format&&i.name===t)return{attributeName:i.name,bufferName:t,stepMode:i.stepMode,vertexFormat:i.format,byteOffset:0,byteStride:i.byteStride||0};return null}function vx(e,t){for(let i of e){let n=i.byteStride;if(typeof i.byteStride!="number")for(let a of i.attributes||[]){let l=hn(a.format);n+=l.byteLength}let o=i.attributes?.find(a=>a.attribute===t);if(o)return{attributeName:o.attribute,bufferName:i.name,stepMode:i.stepMode,vertexFormat:o.format,byteOffset:o.byteOffset,byteStride:n}}return null}var dp=I(()=>{Ei();ol();Uc()});var sl,nr,pp=I(()=>{dp();Vt();sl=class extends J{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(t,i){super(t,i,sl.defaultProps),this.maxVertexAttributes=t.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=up(i.shaderLayout,i.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(t,i){this.device.reportError(new Error("constant attributes not supported"),this)()}},nr=sl;z(nr,"defaultProps",{...J.defaultProps,shaderLayout:void 0,bufferLayout:[]})});var al,or,_p=I(()=>{Vt();al=class extends J{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(t,i){super(t,i,al.defaultProps)}},or=al;z(or,"defaultProps",{...J.defaultProps,layout:void 0,buffers:{}})});var cl,sr,mp=I(()=>{Vt();cl=class extends J{get[Symbol.toStringTag](){return"QuerySet"}constructor(t,i){super(t,i,cl.defaultProps)}},sr=cl;z(sr,"defaultProps",{...J.defaultProps,type:void 0,count:void 0})});function Ex(e){return(!Qo||Qo.byteLength<e)&&(Qo=new ArrayBuffer(e)),Qo}function ll(e,t){let i=Ex(e.BYTES_PER_ELEMENT*t);return new e(i,0,t)}var Qo,gp=I(()=>{});var lt=I(()=>{Kd();qd();$c();ep();Bc();Kc();ip();sp();Yc();ap();cp();lp();hp();fp();pp();_p();mp();Ho();ol();Xc();Ei();gp()});var si,Y_=I(()=>{(function(e){e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.R16_EXT=33322]="R16_EXT",e[e.RG16_EXT=33324]="RG16_EXT",e[e.RGB16_EXT=32852]="RGB16_EXT",e[e.RGBA16_EXT=32859]="RGBA16_EXT",e[e.R16_SNORM_EXT=36760]="R16_SNORM_EXT",e[e.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",e[e.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",e[e.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",e[e.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",e[e.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",e[e.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",e[e.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",e[e.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",e[e.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",e[e.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",e[e.LINE_WEBGL=6913]="LINE_WEBGL",e[e.FILL_WEBGL=6914]="FILL_WEBGL",e[e.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",e[e.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",e[e.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",e[e.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",e[e.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",e[e.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",e[e.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",e[e.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",e[e.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",e[e.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",e[e.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",e[e.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",e[e.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",e[e.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",e[e.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",e[e.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",e[e.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",e[e.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",e[e.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",e[e.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",e[e.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",e[e.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",e[e.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",e[e.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(si||(si={}))});var K_=I(()=>{Y_()});function q_(e=!0){let t=HTMLCanvasElement.prototype;if(!e&&t.originalGetContext){t.getContext=t.originalGetContext,t.originalGetContext=void 0;return}t.originalGetContext=t.getContext,t.getContext=function(i,n){if(i==="webgl"||i==="experimental-webgl"){let o=this.originalGetContext("webgl2",n);return o instanceof HTMLElement&&GS(o),o}return this.originalGetContext(i,n)}}function GS(e){e.getExtension("EXT_color_buffer_float");let t={...KS,WEBGL_disjoint_timer_query:e.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:qS(e),OES_vertex_array_object:JS(e),ANGLE_instanced_arrays:QS(e)},i=e.getExtension;e.getExtension=function(o){let a=i.call(e,o);return a||(o in t?t[o]:null)};let n=e.getSupportedExtensions;e.getSupportedExtensions=function(){return(n.apply(e)||[])?.concat(Object.keys(t))}}var KS,qS,JS,QS,J_=I(()=>{KS={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},qS=e=>({drawBuffersWEBGL(t){return e.drawBuffers(t)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),JS=e=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return e.createVertexArray()},deleteVertexArrayOES(t){return e.deleteVertexArray(t)},isVertexArrayOES(t){return e.isVertexArray(t)},bindVertexArrayOES(t){return e.bindVertexArray(t)}}),QS=e=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...t){return e.drawArraysInstanced(...t)},drawElementsInstancedANGLE(...t){return e.drawElementsInstanced(...t)},vertexAttribDivisorANGLE(...t){return e.vertexAttribDivisor(...t)}})});async function Os(e,t){let i=document.getElementsByTagName("head")[0];if(!i)throw new Error("loadScript");let n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",e),t&&(n.id=t),new Promise((o,a)=>{n.onload=o,n.onerror=l=>a(new Error(`Unable to load script '${e}': ${l}`)),i.appendChild(n)})}var _h=I(()=>{});async function G_(e){if(!globalThis.SPECTOR)try{await Os(e.debugSpectorJSUrl||Ns.debugSpectorJSUrl)}catch(t){F.warn(String(t))}}function tm(e){if(e={...Ns,...e},!e.debugSpectorJS)return null;if(!jt&&globalThis.SPECTOR&&!globalThis.luma?.spector){F.probe(tb,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();let{Spector:t}=globalThis.SPECTOR;jt=new t,globalThis.luma&&(globalThis.luma.spector=jt)}if(!jt)return null;if(Q_||(Q_=!0,jt.spyCanvases(),jt?.onCaptureStarted.add(t=>F.info("Spector capture started:",t)()),jt?.onCapture.add(t=>{F.info("Spector capture complete:",t)(),jt?.getResultUI(),jt?.resultView.display(),jt?.resultView.addCapture(t)})),e.gl){let t=e.gl,i=t.device;jt?.startCapture(e.gl,500),t.device=i,new Promise(n=>setTimeout(n,2e3)).then(n=>{F.info("Spector capture stopped after 2 seconds")(),jt?.stopCapture()})}return jt}var tb,jt,Q_,Ns,mh=I(()=>{lt();_h();tb=1,jt=null,Q_=!1,Ns={debugSpectorJS:F.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",gl:void 0}});function im(e){return e.luma=e.luma||{},e.luma}async function rm(){Ft()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await Os(eb))}function nm(e,t={}){return t.debugWebGL||t.traceWebGL?rb(e,t):ib(e)}function ib(e){let t=im(e);return t.realContext?t.realContext:e}function rb(e,t){if(!globalThis.WebGLDebugUtils)return F.warn("webgl-debug not loaded")(),e;let i=im(e);if(i.debugContext)return i.debugContext;globalThis.WebGLDebugUtils.init({...si,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,nb.bind(null,t),ob.bind(null,t));for(let l in si)!(l in n)&&typeof si[l]=="number"&&(n[l]=si[l]);class o{}Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(o,n);let a=Object.create(o);return i.realContext=e,i.debugContext=a,a.debug=!0,a}function em(e,t){t=Array.from(t).map(n=>n===void 0?"undefined":n);let i=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return i=`${i.slice(0,100)}${i.length>100?"...":""}`,`gl.${e}(${i})`}function nb(e,t,i,n){n=Array.from(n).map(h=>h===void 0?"undefined":h);let o=globalThis.WebGLDebugUtils.glEnumToString(t),a=globalThis.WebGLDebugUtils.glFunctionArgsToString(i,n),l=`${o} in gl.${i}(${a})`;F.error(l)();debugger}function ob(e,t,i){let n="";F.level>=1&&(n=em(t,i),e.traceWebGL&&F.log(1,n)());for(let o of i)if(o===void 0){n=n||em(t,i);debugger}}var eb,gh=I(()=>{lt();K_();Je();_h();eb="https://unpkg.com/webgl-debug@2.0.1/index.js"});function Th(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function yt(e,t,i){return t[e]!==void 0?t[e]:i[e]}var Jn,At,om,Xt,sm,qn,am,cm,yh,Se,xh,lm,vh=I(()=>{Jn={[3042]:!1,[32773]:new Float32Array([0,0,0,0]),[32777]:32774,[34877]:32774,[32969]:1,[32968]:0,[32971]:1,[32970]:0,[3106]:new Float32Array([0,0,0,0]),[3107]:[!0,!0,!0,!0],[2884]:!1,[2885]:1029,[2929]:!1,[2931]:1,[2932]:513,[2928]:new Float32Array([0,1]),[2930]:!0,[3024]:!0,[35725]:null,[36006]:null,[36007]:null,[34229]:null,[34964]:null,[2886]:2305,[33170]:4352,[2849]:1,[32823]:!1,[32824]:0,[10752]:0,[32926]:!1,[32928]:!1,[32938]:1,[32939]:!1,[3089]:!1,[3088]:new Int32Array([0,0,1024,1024]),[2960]:!1,[2961]:0,[2968]:4294967295,[36005]:4294967295,[2962]:519,[2967]:0,[2963]:4294967295,[34816]:519,[36003]:0,[36004]:4294967295,[2964]:7680,[2965]:7680,[2966]:7680,[34817]:7680,[34818]:7680,[34819]:7680,[2978]:[0,0,1024,1024],[36389]:null,[36662]:null,[36663]:null,[35053]:null,[35055]:null,[35723]:4352,[36010]:null,[35977]:!1,[3333]:4,[3317]:4,[37440]:!1,[37441]:!1,[37443]:37444,[3330]:0,[3332]:0,[3331]:0,[3314]:0,[32878]:0,[3316]:0,[3315]:0,[32877]:0},At=(e,t,i)=>t?e.enable(i):e.disable(i),om=(e,t,i)=>e.hint(i,t),Xt=(e,t,i)=>e.pixelStorei(i,t),sm=(e,t,i)=>{let n=i===36006?36009:36008;return e.bindFramebuffer(n,t)},qn=(e,t,i)=>{let o={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[i];e.bindBuffer(o,t)};am={[3042]:At,[32773]:(e,t)=>e.blendColor(...t),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(e,t)=>e.clearColor(...t),[3107]:(e,t)=>e.colorMask(...t),[2884]:At,[2885]:(e,t)=>e.cullFace(t),[2929]:At,[2931]:(e,t)=>e.clearDepth(t),[2932]:(e,t)=>e.depthFunc(t),[2928]:(e,t)=>e.depthRange(...t),[2930]:(e,t)=>e.depthMask(t),[3024]:At,[35723]:om,[35725]:(e,t)=>e.useProgram(t),[36007]:(e,t)=>e.bindRenderbuffer(36161,t),[36389]:(e,t)=>e.bindTransformFeedback?.(36386,t),[34229]:(e,t)=>e.bindVertexArray(t),[36006]:sm,[36010]:sm,[34964]:qn,[36662]:qn,[36663]:qn,[35053]:qn,[35055]:qn,[2886]:(e,t)=>e.frontFace(t),[33170]:om,[2849]:(e,t)=>e.lineWidth(t),[32823]:At,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:At,[32926]:At,[32928]:At,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:At,[3088]:(e,t)=>e.scissor(...t),[2960]:At,[2961]:(e,t)=>e.clearStencil(t),[2968]:(e,t)=>e.stencilMaskSeparate(1028,t),[36005]:(e,t)=>e.stencilMaskSeparate(1029,t),[2962]:"stencilFuncFront",[2967]:"stencilFuncFront",[2963]:"stencilFuncFront",[34816]:"stencilFuncBack",[36003]:"stencilFuncBack",[36004]:"stencilFuncBack",[2964]:"stencilOpFront",[2965]:"stencilOpFront",[2966]:"stencilOpFront",[34817]:"stencilOpBack",[34818]:"stencilOpBack",[34819]:"stencilOpBack",[2978]:(e,t)=>e.viewport(...t),[34383]:At,[10754]:At,[12288]:At,[12289]:At,[12290]:At,[12291]:At,[12292]:At,[12293]:At,[12294]:At,[12295]:At,[3333]:Xt,[3317]:Xt,[37440]:Xt,[37441]:Xt,[37443]:Xt,[3330]:Xt,[3332]:Xt,[3331]:Xt,[3314]:Xt,[32878]:Xt,[3316]:Xt,[3315]:Xt,[32877]:Xt,framebuffer:(e,t)=>{let i=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(36160,i)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{let i=typeof t=="number"?[t,t]:t;e.blendEquationSeparate(...i)},blendFunc:(e,t)=>{let i=t?.length===2?[...t,...t]:t;e.blendFuncSeparate(...i)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(t[0],t[1]||!1),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{t=Th(t)?t:[t,t];let[i,n]=t;e.stencilMaskSeparate(1028,i),e.stencilMaskSeparate(1029,n)},stencilFunc:(e,t)=>{t=Th(t)&&t.length===3?[...t,...t]:t;let[i,n,o,a,l,h]=t;e.stencilFuncSeparate(1028,i,n,o),e.stencilFuncSeparate(1029,a,l,h)},stencilOp:(e,t)=>{t=Th(t)&&t.length===3?[...t,...t]:t;let[i,n,o,a,l,h]=t;e.stencilOpSeparate(1028,i,n,o),e.stencilOpSeparate(1029,a,l,h)},viewport:(e,t)=>e.viewport(...t)};cm={blendEquation:(e,t,i)=>e.blendEquationSeparate(yt(32777,t,i),yt(34877,t,i)),blendFunc:(e,t,i)=>e.blendFuncSeparate(yt(32969,t,i),yt(32968,t,i),yt(32971,t,i),yt(32970,t,i)),polygonOffset:(e,t,i)=>e.polygonOffset(yt(32824,t,i),yt(10752,t,i)),sampleCoverage:(e,t,i)=>e.sampleCoverage(yt(32938,t,i),yt(32939,t,i)),stencilFuncFront:(e,t,i)=>e.stencilFuncSeparate(1028,yt(2962,t,i),yt(2967,t,i),yt(2963,t,i)),stencilFuncBack:(e,t,i)=>e.stencilFuncSeparate(1029,yt(34816,t,i),yt(36003,t,i),yt(36004,t,i)),stencilOpFront:(e,t,i)=>e.stencilOpSeparate(1028,yt(2964,t,i),yt(2965,t,i),yt(2966,t,i)),stencilOpBack:(e,t,i)=>e.stencilOpSeparate(1029,yt(34817,t,i),yt(34818,t,i),yt(34819,t,i))},yh={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,i)=>e({[t]:i}),hint:(e,t,i)=>e({[t]:i}),useProgram:(e,t)=>e({[35725]:t}),bindRenderbuffer:(e,t,i)=>e({[36007]:i}),bindTransformFeedback:(e,t,i)=>e({[36389]:i}),bindVertexArray:(e,t)=>e({[34229]:t}),bindFramebuffer:(e,t,i)=>{switch(t){case 36160:return e({[36006]:i,[36010]:i});case 36009:return e({[36006]:i});case 36008:return e({[36010]:i});default:return null}},bindBuffer:(e,t,i)=>{let n={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[t];return n?e({[n]:i}):{valueChanged:!0}},blendColor:(e,t,i,n,o)=>e({[32773]:new Float32Array([t,i,n,o])}),blendEquation:(e,t)=>e({[32777]:t,[34877]:t}),blendEquationSeparate:(e,t,i)=>e({[32777]:t,[34877]:i}),blendFunc:(e,t,i)=>e({[32969]:t,[32968]:i,[32971]:t,[32970]:i}),blendFuncSeparate:(e,t,i,n,o)=>e({[32969]:t,[32968]:i,[32971]:n,[32970]:o}),clearColor:(e,t,i,n,o)=>e({[3106]:new Float32Array([t,i,n,o])}),clearDepth:(e,t)=>e({[2931]:t}),clearStencil:(e,t)=>e({[2961]:t}),colorMask:(e,t,i,n,o)=>e({[3107]:[t,i,n,o]}),cullFace:(e,t)=>e({[2885]:t}),depthFunc:(e,t)=>e({[2932]:t}),depthRange:(e,t,i)=>e({[2928]:new Float32Array([t,i])}),depthMask:(e,t)=>e({[2930]:t}),frontFace:(e,t)=>e({[2886]:t}),lineWidth:(e,t)=>e({[2849]:t}),polygonOffset:(e,t,i)=>e({[32824]:t,[10752]:i}),sampleCoverage:(e,t,i)=>e({[32938]:t,[32939]:i}),scissor:(e,t,i,n,o)=>e({[3088]:new Int32Array([t,i,n,o])}),stencilMask:(e,t)=>e({[2968]:t,[36005]:t}),stencilMaskSeparate:(e,t,i)=>e({[t===1028?2968:36005]:i}),stencilFunc:(e,t,i,n)=>e({[2962]:t,[2967]:i,[2963]:n,[34816]:t,[36003]:i,[36004]:n}),stencilFuncSeparate:(e,t,i,n,o)=>e({[t===1028?2962:34816]:i,[t===1028?2967:36003]:n,[t===1028?2963:36004]:o}),stencilOp:(e,t,i,n)=>e({[2964]:t,[2965]:i,[2966]:n,[34817]:t,[34818]:i,[34819]:n}),stencilOpSeparate:(e,t,i,n,o)=>e({[t===1028?2964:34817]:i,[t===1028?2965:34818]:n,[t===1028?2966:34819]:o}),viewport:(e,t,i,n,o)=>e({[2978]:[t,i,n,o]})},Se=(e,t)=>e.isEnabled(t),xh={[3042]:Se,[2884]:Se,[2929]:Se,[3024]:Se,[32823]:Se,[32926]:Se,[32928]:Se,[3089]:Se,[2960]:Se,[35977]:Se},lm=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068])});function he(e,t){if(sb(t))return;let i={};for(let o in t){let a=Number(o),l=am[o];l&&(typeof l=="string"?i[l]=!0:l(e,t[o],a))}let n=e.state&&e.state.cache;if(n)for(let o in i){let a=cm[o];a(e,t,n)}}function Ds(e,t=Jn){if(typeof t=="number"){let o=t,a=xh[o];return a?a(e,o):e.getParameter(o)}let i=Array.isArray(t)?t:Object.keys(t),n={};for(let o of i){let a=xh[o];n[o]=a?a(e,Number(o)):e.getParameter(Number(o))}return n}function hm(e){he(e,Jn)}function sb(e){for(let t in e)return!1;return!0}var br=I(()=>{vh()});function um(e,t){if(e===t)return!0;if(fm(e)&&fm(t)&&e.length===t.length){for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}return!1}function fm(e){return Array.isArray(e)||ArrayBuffer.isView(e)}var dm=I(()=>{});function pm(e,t){let i=e[t].bind(e);e[t]=function(o){if(o===void 0||lm.has(o))return i(o);let a=fe.get(e);return o in a.cache||(a.cache[o]=i(o)),a.enable?a.cache[o]:i(o)},Object.defineProperty(e[t],"name",{value:`${t}-from-cache`,configurable:!1})}function ab(e,t,i){if(!e[t])return;let n=e[t].bind(e);e[t]=function(...a){let l=fe.get(e),{valueChanged:h,oldValue:u}=i(l._updateCache,...a);return h&&n(...a),u},Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}function cb(e){let t=e.useProgram.bind(e);e.useProgram=function(n){let o=fe.get(e);o.program!==n&&(t(n),o.program=n)}}var fe,Eh=I(()=>{br();dm();vh();fe=class{static get(t){return t.state}gl;program=null;stateStack=[];enable=!0;cache=null;log;initialized=!1;constructor(t,i){this.gl=t,this.log=i?.log||(()=>{}),this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(t={}){this.stateStack.push({})}pop(){let t=this.stateStack[this.stateStack.length-1];he(this.gl,t),this.stateStack.pop()}trackState(t,i){if(this.cache=i?.copyState?Ds(t):Object.assign({},Jn),this.initialized)throw new Error("WebGLStateTracker");this.initialized=!0,this.gl.state=this,cb(t);for(let n in yh){let o=yh[n];ab(t,n,o)}pm(t,"getParameter"),pm(t,"isEnabled")}_updateCache(t){let i=!1,n,o=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let a in t){let l=t[a],h=this.cache[a];um(l,h)||(i=!0,n=h,o&&!(a in o)&&(o[a]=h),this.cache[a]=l)}return{valueChanged:i,oldValue:n}}}});function _m(e,t,i){let n="",o={preserveDrawingBuffer:!0,...i},a=null;if(a||=e.getContext("webgl2",o),o.failIfMajorPerformanceCaveat&&(n||="Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow."),!a&&!i.failIfMajorPerformanceCaveat&&(o.failIfMajorPerformanceCaveat=!1,a=e.getContext("webgl2",o),a.luma||={},a.luma.softwareRenderer=!0),a||(a=e.getContext("webgl",{}),a&&(a=null,n||="Your browser only supports WebGL1")),!a)throw n||="Your browser does not support WebGL",new Error(`Failed to create WebGL context: ${n}`);let{onContextLost:l,onContextRestored:h}=t;return e.addEventListener("webglcontextlost",u=>l(u),!1),e.addEventListener("webglcontextrestored",u=>h(u),!1),a.luma||={},a}var mm=I(()=>{});function be(e,t,i){return i[t]===void 0&&(i[t]=e.getExtension(t)||null),i[t]}var Qn=I(()=>{});function gm(e,t){let i=e.getParameter(7936),n=e.getParameter(7937);be(e,"WEBGL_debug_renderer_info",t);let o=t.WEBGL_debug_renderer_info,a=e.getParameter(o?o.UNMASKED_VENDOR_WEBGL:7936),l=e.getParameter(o?o.UNMASKED_RENDERER_WEBGL:7937),h=a||i,u=l||n,p=e.getParameter(7938),m=Tm(h,u),g=lb(h,u),T=hb(h,u);return{type:"webgl",gpu:m,gpuType:T,gpuBackend:g,vendor:h,renderer:u,version:p,shadingLanguage:"glsl",shadingLanguageVersion:300}}function Tm(e,t){return/NVIDIA/i.exec(e)||/NVIDIA/i.exec(t)?"nvidia":/INTEL/i.exec(e)||/INTEL/i.exec(t)?"intel":/Apple/i.exec(e)||/Apple/i.exec(t)?"apple":/AMD/i.exec(e)||/AMD/i.exec(t)||/ATI/i.exec(e)||/ATI/i.exec(t)?"amd":/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t)?"software":"unknown"}function lb(e,t){return/Metal/i.exec(e)||/Metal/i.exec(t)?"metal":/ANGLE/i.exec(e)||/ANGLE/i.exec(t)?"opengl":"unknown"}function hb(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";switch(Tm(e,t)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}var ym=I(()=>{Qn()});function Fs(e){switch(e){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(e))}var Sh=I(()=>{});function Em(e){return e in Bs}function Sm(e,t,i){return(Bs[t]||[]).every(o=>be(e,o,i))}function bm(e,t,i){let n=t.create,o=bh[t.format];return o?.gl===void 0&&(n=!1),o?.x&&(n=n&&Boolean(be(e,o.x,i))),{format:t.format,create:n&&t.create,render:n&&t.render,filter:n&&t.filter,blend:n&&t.blend,store:n&&t.store}}function Ls(e){let t=bh[e],i=Tb(e),n=Ne.getInfo(e);return n.compressed&&(t.dataFormat=i),{internalFormat:i,format:t?.dataFormat||gb(n.channels,n.integer,n.normalized,i),type:n.dataType?Fs(n.dataType):t?.types?.[0]||5121,compressed:n.compressed||!1}}function Am(e){switch(Ne.getInfo(e).attachment){case"depth":return 36096;case"stencil":return 36128;case"depth-stencil":return 33306;default:throw new Error(`Not a depth stencil format: ${e}`)}}function gb(e,t,i,n){if(n===6408||n===6407)return n;switch(e){case"r":return t&&!i?36244:6403;case"rg":return t&&!i?33320:33319;case"rgb":return t&&!i?36248:6407;case"rgba":return t&&!i?36249:6408;case"bgra":throw new Error("bgra pixels not supported by WebGL");default:return 6408}}function Tb(e){let i=bh[e]?.gl;if(i===void 0)throw new Error(`Unsupported texture format ${e}`);return i}var Gn,to,Ar,Rr,fb,ub,db,pb,_b,xm,vm,mb,Bs,bh,wr=I(()=>{lt();Qn();Sh();Gn="WEBGL_compressed_texture_s3tc",to="WEBGL_compressed_texture_s3tc_srgb",Ar="EXT_texture_compression_rgtc",Rr="EXT_texture_compression_bptc",fb="WEBGL_compressed_texture_etc",ub="WEBGL_compressed_texture_astc",db="WEBGL_compressed_texture_etc1",pb="WEBGL_compressed_texture_pvrtc",_b="WEBGL_compressed_texture_atc",xm="EXT_texture_norm16",vm="EXT_render_snorm",mb="EXT_color_buffer_float",Bs={"float32-renderable-webgl":["EXT_color_buffer_float"],"float16-renderable-webgl":["EXT_color_buffer_half_float"],"rgb9e5ufloat-renderable-webgl":["WEBGL_render_shared_exponent"],"snorm8-renderable-webgl":[vm],"norm16-renderable-webgl":[xm],"snorm16-renderable-webgl":[xm,vm],"float32-filterable":["OES_texture_float_linear"],"float16-filterable-webgl":["OES_texture_half_float_linear"],"texture-filterable-anisotropic-webgl":["EXT_texture_filter_anisotropic"],"texture-blend-float-webgl":["EXT_float_blend"],"texture-compression-bc":[Gn,to,Ar,Rr],"texture-compression-bc5-webgl":[Ar],"texture-compression-bc7-webgl":[Rr],"texture-compression-etc2":[fb],"texture-compression-astc":[ub],"texture-compression-etc1-webgl":[db],"texture-compression-pvrtc-webgl":[pb],"texture-compression-atc-webgl":[_b]};bh={r8unorm:{gl:33321,rb:!0},r8snorm:{gl:36756},r8uint:{gl:33330,rb:!0},r8sint:{gl:33329,rb:!0},rg8unorm:{gl:33323,rb:!0},rg8snorm:{gl:36757},rg8uint:{gl:33336,rb:!0},rg8sint:{gl:33335,rb:!0},r16uint:{gl:33332,rb:!0},r16sint:{gl:33331,rb:!0},r16float:{gl:33325,rb:!0},r16unorm:{gl:33322,rb:!0},r16snorm:{gl:36760},"rgba4unorm-webgl":{gl:32854,rb:!0},"rgb565unorm-webgl":{gl:36194,rb:!0},"rgb5a1unorm-webgl":{gl:32855,rb:!0},"rgb8unorm-webgl":{gl:32849},"rgb8snorm-webgl":{gl:36758},rgba8unorm:{gl:32856},"rgba8unorm-srgb":{gl:35907},rgba8snorm:{gl:36759},rgba8uint:{gl:36220},rgba8sint:{gl:36238},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{gl:33338},rg16sint:{gl:33337},rg16float:{gl:33327,rb:!0},rg16unorm:{gl:33324},rg16snorm:{gl:36761},r32uint:{gl:33334,rb:!0},r32sint:{gl:33333,rb:!0},r32float:{gl:33326},rgb9e5ufloat:{gl:35901},rg11b10ufloat:{gl:35898,rb:!0},rgb10a2unorm:{gl:32857,rb:!0},rgb10a2uint:{gl:36975,rb:!0},"rgb16unorm-webgl":{gl:32852},"rgb16snorm-webgl":{gl:36762},rg32uint:{gl:33340,rb:!0},rg32sint:{gl:33339,rb:!0},rg32float:{gl:33328,rb:!0},rgba16uint:{gl:36214,rb:!0},rgba16sint:{gl:36232,rb:!0},rgba16float:{gl:34842},rgba16unorm:{gl:32859,rb:!0},rgba16snorm:{gl:36763},"rgb32float-webgl":{gl:34837,x:mb,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,rb:!0},rgba32sint:{gl:36226,rb:!0},rgba32float:{gl:34836,rb:!0},stencil8:{gl:36168,rb:!0},depth16unorm:{gl:33189,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,dataFormat:6402,types:[5125]},depth32float:{gl:36012,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth32float-stencil8":{gl:36013,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:Gn},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:to},"bc1-rgba-unorm":{gl:33777,x:Gn},"bc1-rgba-unorm-srgb":{gl:35916,x:to},"bc2-rgba-unorm":{gl:33778,x:Gn},"bc2-rgba-unorm-srgb":{gl:35918,x:to},"bc3-rgba-unorm":{gl:33779,x:Gn},"bc3-rgba-unorm-srgb":{gl:35919,x:to},"bc4-r-unorm":{gl:36283,x:Ar},"bc4-r-snorm":{gl:36284,x:Ar},"bc5-rg-unorm":{gl:36285,x:Ar},"bc5-rg-snorm":{gl:36286,x:Ar},"bc6h-rgb-ufloat":{gl:36495,x:Rr},"bc6h-rgb-float":{gl:36494,x:Rr},"bc7-rgba-unorm":{gl:36492,x:Rr},"bc7-rgba-unorm-srgb":{gl:36493,x:Rr},"etc2-rgb8unorm":{gl:37492},"etc2-rgb8unorm-srgb":{gl:37494},"etc2-rgb8a1unorm":{gl:37496},"etc2-rgb8a1unorm-srgb":{gl:37497},"etc2-rgba8unorm":{gl:37493},"etc2-rgba8unorm-srgb":{gl:37495},"eac-r11unorm":{gl:37488},"eac-r11snorm":{gl:37489},"eac-rg11unorm":{gl:37490},"eac-rg11snorm":{gl:37491},"astc-4x4-unorm":{gl:37808},"astc-4x4-unorm-srgb":{gl:37840},"astc-5x4-unorm":{gl:37809},"astc-5x4-unorm-srgb":{gl:37841},"astc-5x5-unorm":{gl:37810},"astc-5x5-unorm-srgb":{gl:37842},"astc-6x5-unorm":{gl:37811},"astc-6x5-unorm-srgb":{gl:37843},"astc-6x6-unorm":{gl:37812},"astc-6x6-unorm-srgb":{gl:37844},"astc-8x5-unorm":{gl:37813},"astc-8x5-unorm-srgb":{gl:37845},"astc-8x6-unorm":{gl:37814},"astc-8x6-unorm-srgb":{gl:37846},"astc-8x8-unorm":{gl:37815},"astc-8x8-unorm-srgb":{gl:37847},"astc-10x5-unorm":{gl:37819},"astc-10x5-unorm-srgb":{gl:37851},"astc-10x6-unorm":{gl:37817},"astc-10x6-unorm-srgb":{gl:37849},"astc-10x8-unorm":{gl:37818},"astc-10x8-unorm-srgb":{gl:37850},"astc-10x10-unorm":{gl:37819},"astc-10x10-unorm-srgb":{gl:37851},"astc-12x10-unorm":{gl:37820},"astc-12x10-unorm-srgb":{gl:37852},"astc-12x12-unorm":{gl:37821},"astc-12x12-unorm-srgb":{gl:37853},"pvrtc-rgb4unorm-webgl":{gl:35840},"pvrtc-rgba4unorm-webgl":{gl:35842},"pvrtc-rbg2unorm-webgl":{gl:35841},"pvrtc-rgba2unorm-webgl":{gl:35843},"etc1-rbg-unorm-webgl":{gl:36196},"atc-rgb-unorm-webgl":{gl:35986},"atc-rgba-unorm-webgl":{gl:35986},"atc-rgbai-unorm-webgl":{gl:34798}}});var Rm,ks,wm=I(()=>{lt();Qn();wr();Rm={"depth-clip-control":"EXT_depth_clamp","timer-query-webgl":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"},ks=class extends dn{gl;extensions;testedFeatures=new Set;constructor(t,i,n){super([],n),this.gl=t,this.extensions=i,be(t,"EXT_color_buffer_float",i)}*[Symbol.iterator](){let t=this.getFeatures();for(let i of t)this.has(i)&&(yield i);return[]}has(t){return this.disabledFeatures?.[t]?!1:(this.testedFeatures.has(t)||(this.testedFeatures.add(t),Em(t)&&Sm(this.gl,t,this.extensions)&&this.features.add(t),this.getWebGLFeature(t)&&this.features.add(t)),this.features.has(t))}initializeFeatures(){let t=this.getFeatures().filter(i=>i!=="polygon-mode-webgl");for(let i of t)this.has(i)}getFeatures(){return[...Object.keys(Rm),...Object.keys(Bs)]}getWebGLFeature(t){let i=Rm[t];return Boolean(typeof i=="string"?be(this.gl,i,this.extensions):i)}}});var Us,Pm=I(()=>{lt();Us=class extends un{get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderVariables(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}gl;limits={};constructor(t){super(),this.gl=t}getParameter(t){return this.limits[t]===void 0&&(this.limits[t]=this.gl.getParameter(t)),this.limits[t]||0}}});function yb(e){return e<34069?e+34069:e}function xb(e){switch(e){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${e}`}}var Ae,zs=I(()=>{lt();wr();Ae=class extends ii{device;gl;handle;colorAttachments=[];depthStencilAttachment=null;constructor(t,i){super(t,i);let n=i.handle===null;this.device=t,this.gl=t.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),n||(t._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this.autoCreateAttachmentTextures(),this.updateAttachments())}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}updateAttachments(){let t=this.gl.bindFramebuffer(36160,this.handle);for(let i=0;i<this.colorAttachments.length;++i){let n=this.colorAttachments[i];if(n){let o=36064+i;this._attachTextureView(o,n)}}if(this.depthStencilAttachment){let i=Am(this.depthStencilAttachment.props.format);this._attachTextureView(i,this.depthStencilAttachment)}if(this.device.props.debug){let i=this.gl.checkFramebufferStatus(36160);if(i!==36053)throw new Error(`Framebuffer ${xb(i)}`)}this.gl.bindFramebuffer(36160,t)}_attachTextureView(t,i){let{gl:n}=this.device,{texture:o}=i,a=i.props.baseMipLevel,l=i.props.baseArrayLayer;switch(n.bindTexture(o.glTarget,o.handle),o.glTarget){case 35866:case 32879:n.framebufferTextureLayer(36160,t,o.handle,a,l);break;case 34067:let h=yb(l);n.framebufferTexture2D(36160,t,h,o.handle,a);break;case 3553:n.framebufferTexture2D(36160,t,3553,o.handle,a);break;default:throw new Error("Illegal texture type")}n.bindTexture(o.glTarget,null)}}});var Vs,Mm=I(()=>{lt();zs();Vs=class extends Si{device;handle=null;_framebuffer=null;get[Symbol.toStringTag](){return"WebGLCanvasContext"}constructor(t,i){super(i),this.device=t,this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this._updateDevice()}getCurrentFramebuffer(){return this._framebuffer=this._framebuffer||new Ae(this.device,{handle:null}),this._framebuffer}_updateDevice(){}}});function Cm(e="id"){Ah[e]=Ah[e]||1;let t=Ah[e]++;return`${e}-${t}`}var Ah,Im=I(()=>{Ah={}});function vb(e){return e&ut.INDEX?34963:e&ut.VERTEX?34962:e&ut.UNIFORM?35345:34962}function Eb(e){return e&ut.INDEX||e&ut.VERTEX?35044:e&ut.UNIFORM?35048:35044}var ue,Ws=I(()=>{lt();ue=class extends ut{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength=0;bytesUsed=0;constructor(t,i={}){super(t,i),this.device=t,this.gl=this.device.gl;let n=typeof i=="object"?i.handle:void 0;this.handle=n||this.gl.createBuffer(),t._setWebGLDebugMetadata(this.handle,this,{spector:{...this.props,data:typeof this.props.data}}),this.glTarget=vb(this.props.usage),this.glUsage=Eb(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,i.data?this._initWithData(i.data,i.byteOffset,i.byteLength):this._initWithByteLength(i.byteLength||0)}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}_initWithData(t,i=0,n=t.byteLength+i){let o=this.glTarget;this.gl.bindBuffer(o,this.handle),this.gl.bufferData(o,n,this.glUsage),this.gl.bufferSubData(o,i,t),this.gl.bindBuffer(o,null),this.bytesUsed=n,this.byteLength=n,this._setDebugData(t,i,n),this.trackAllocatedMemory(n)}_initWithByteLength(t){let i=t;t===0&&(i=new Float32Array(0));let n=this.glTarget;return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,i,this.glUsage),this.gl.bindBuffer(n,null),this.bytesUsed=t,this.byteLength=t,this._setDebugData(null,0,t),this.trackAllocatedMemory(t),this}write(t,i=0){let n=ArrayBuffer.isView(t)?t:new Uint8Array(t),o=0,a=void 0,l=36663;this.gl.bindBuffer(l,this.handle),o!==0||a!==void 0?this.gl.bufferSubData(l,i,n,o,a):this.gl.bufferSubData(l,i,n),this.gl.bindBuffer(l,null),this._setDebugData(t,i,t.byteLength)}async mapAndWriteAsync(t,i=0,n=this.byteLength-i){let o=new ArrayBuffer(n);await t(o,"copied"),this.write(o,i)}async readAsync(t=0,i){return this.readSyncWebGL(t,i)}async mapAndReadAsync(t,i=0,n){let o=await this.readAsync(i,n);return await t(o.buffer,"copied")}readSyncWebGL(t=0,i){i=i??this.byteLength-t;let n=new Uint8Array(i),o=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,t,n,o,i),this.gl.bindBuffer(36662,null),this._setDebugData(n,t,i),n}}});function Nm(e){let t=e.split(/\r?\n/),i=[];for(let n of t){if(n.length<=1)continue;let o=n.split(":");if(o.length===2){let[g,T]=o;i.push({message:T.trim(),type:Om(g),lineNum:0,linePos:0});continue}let[a,l,h,...u]=o,p=parseInt(h,10);isNaN(p)&&(p=0);let m=parseInt(l,10);isNaN(m)&&(m=0),i.push({message:u.join(":").trim(),type:Om(a),lineNum:p,linePos:m})}return i}function Om(e){let t=["warning","error","info"],i=e.toLowerCase();return t.includes(i)?i:"info"}var Dm=I(()=>{});var Hs,Fm=I(()=>{lt();Dm();Hs=class extends tr{device;handle;constructor(t,i){switch(super(t,i),this.device=t,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}t._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0,this.handle.destroyed=!0)}get asyncCompilationStatus(){return this._waitForCompilationComplete().then(()=>(this._getCompilationStatus(),this.compilationStatus))}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let t=this.device.gl.getShaderInfoLog(this.handle);return t?Nm(t):[]}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)||null}async _compile(t){t=t.startsWith("#version ")?t:`#version 300 es
18
- ${t}`;let{gl:i}=this.device;if(i.shaderSource(this.handle,t),i.compileShader(this.handle),!this.device.props.debug){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}F.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),F.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let t=async o=>await new Promise(a=>setTimeout(a,o));if(!this.device.features.has("compilation-status-async-webgl")){await t(10);return}let{gl:n}=this.device;for(;;){if(n.getShaderParameter(this.handle,37297))return;await t(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}}});function Lm(e,t,i,n){if(Rb(t))return n(e);let o=e;o.pushState();try{return Sb(e,t),he(o.gl,i),n(e)}finally{o.popState()}}function Sb(e,t){let i=e,{gl:n}=i;if(t.cullMode)switch(t.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(t.frontFace&&n.frontFace(Ni("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.unclippedDepth&&e.features.has("depth-clip-control")&&n.enable(34383),t.depthBias!==void 0&&(n.enable(32823),n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0)),t.provokingVertex&&e.features.has("provoking-vertex-webgl")){let a=i.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,l=Ni("provokingVertex",t.provokingVertex,{first:36429,last:36430});a?.provokingVertexWEBGL(l)}if((t.polygonMode||t.polygonOffsetLine)&&e.features.has("polygon-mode-webgl")){if(t.polygonMode){let a=i.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,l=Ni("polygonMode",t.polygonMode,{fill:6914,line:6913});a?.polygonModeWEBGL(1028,l),a?.polygonModeWEBGL(1029,l)}t.polygonOffsetLine&&n.enable(10754)}if(e.features.has("shader-clip-cull-distance-webgl")&&(t.clipDistance0&&n.enable(12288),t.clipDistance1&&n.enable(12289),t.clipDistance2&&n.enable(12290),t.clipDistance3&&n.enable(12291),t.clipDistance4&&n.enable(12292),t.clipDistance5&&n.enable(12293),t.clipDistance6&&n.enable(12294),t.clipDistance7&&n.enable(12295)),t.depthWriteEnabled!==void 0&&n.depthMask(Ab("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(Xs("depthCompare",t.depthCompare))),t.stencilWriteMask){let o=t.stencilWriteMask;n.stencilMaskSeparate(1028,o),n.stencilMaskSeparate(1029,o)}if(t.stencilReadMask&&F.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let o=t.stencilReadMask||4294967295,a=Xs("depthCompare",t.stencilCompare);t.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,a,0,o),n.stencilFuncSeparate(1029,a,0,o)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let o=Rh("stencilPassOperation",t.stencilPassOperation),a=Rh("stencilFailOperation",t.stencilFailOperation),l=Rh("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(1028,a,l,o),n.stencilOpSeparate(1029,a,l,o)}switch(t.blend){case!0:n.enable(3042);break;case!1:n.disable(3042);break;default:}if(t.blendColorOperation||t.blendAlphaOperation){let o=Bm("blendColorOperation",t.blendColorOperation||"add"),a=Bm("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(o,a);let l=js("blendColorSrcFactor",t.blendColorSrcFactor||"one"),h=js("blendColorDstFactor",t.blendColorDstFactor||"zero"),u=js("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),p=js("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(l,h,u,p)}}function Xs(e,t){return Ni(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function Rh(e,t){return Ni(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function Bm(e,t){return Ni(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function js(e,t,i="color"){return Ni(e,t,{one:1,zero:0,src:768,"one-minus-src":769,dst:774,"one-minus-dst":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,constant:i==="color"?32769:32771,"one-minus-constant":i==="color"?32770:32772,src1:768,"one-minus-src1":769,"src1-alpha":770,"one-minus-src1-alpha":771})}function bb(e,t){return`Illegal parameter ${t} for ${e}`}function Ni(e,t,i){if(!(t in i))throw new Error(bb(e,t));return i[t]}function Ab(e,t){return t}function Rb(e){let t=!0;for(let i in e){t=!1;break}return t}var wh=I(()=>{lt();br()});function Zs(e){let t={};return e.addressModeU&&(t[10242]=Ph(e.addressModeU)),e.addressModeV&&(t[10243]=Ph(e.addressModeV)),e.addressModeW&&(t[32882]=Ph(e.addressModeW)),e.magFilter&&(t[10240]=Mh(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=wb(e.minFilter||"linear",e.mipmapFilter)),e.lodMinClamp!==void 0&&(t[33082]=e.lodMinClamp),e.lodMaxClamp!==void 0&&(t[33083]=e.lodMaxClamp),e.type==="comparison-sampler"&&(t[34892]=34894),e.compare&&(t[34893]=Xs("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function Ph(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function Mh(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function wb(e,t="none"){if(!t)return Mh(e);switch(t){case"none":return Mh(e);case"nearest":switch(e){case"nearest":return 9984;case"linear":return 9985}break;case"linear":switch(e){case"nearest":return 9986;case"linear":return 9987}}}var Ch=I(()=>{wh()});var $s,km=I(()=>{lt();Ch();$s=class extends ei{device;handle;parameters;constructor(t,i){super(t,i),this.device=t,this.parameters=Zs(i),this.handle=i.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(t){for(let[i,n]of Object.entries(t)){let o=Number(i);switch(o){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,o,n);break;default:this.device.gl.samplerParameteri(this.handle,o,n);break}}}}});function ai(e,t,i){if(Pb(t))return i(e);let{nocatch:n=!0}=t,o=fe.get(e);o.push(),he(e,t);let a;if(n)a=i(e),o.pop();else try{a=i(e)}finally{o.pop()}return a}function Pb(e){for(let t in e)return!1;return!0}var Ys=I(()=>{br();Eh()});var Re,Ih=I(()=>{lt();Re=class extends Gi{device;gl;handle;texture;constructor(t,i){super(t,{...pt.defaultProps,...i}),this.device=t,this.gl=this.device.gl,this.handle=null,this.texture=i.texture}}});function Mb(e){switch(e){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866;case"cube-array":break}throw new Error(e)}function Um(e,t,i){return t==="cube"?34069+i:e}var we,Ks=I(()=>{lt();wr();Ch();Ys();Ih();we=class extends pt{device;gl;handle;sampler=void 0;view;glTarget;glFormat;glType;glInternalFormat;compressed;_textureUnit=0;constructor(t,i){super(t,i),this.device=t,this.gl=this.device.gl;let n=Ls(this.props.format);this.glTarget=Mb(this.props.dimension),this.glInternalFormat=n.internalFormat,this.glFormat=n.format,this.glType=n.type,this.compressed=n.compressed,this.handle=this.props.handle||this.gl.createTexture(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this.gl.bindTexture(this.glTarget,this.handle);let{dimension:o,width:a,height:l,depth:h,mipLevels:u,glTarget:p,glInternalFormat:m}=this;switch(o){case"2d":case"cube":this.gl.texStorage2D(p,u,m,a,l);break;case"2d-array":case"3d":this.gl.texStorage3D(p,u,m,a,l,h);break;default:throw new Error(o)}this.gl.bindTexture(this.glTarget,null),this._initializeData(i.data),this.setSampler(this.props.sampler),this.view=new Re(this.device,{...this.props,texture:this}),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(t){return new Re(this.device,{...t,texture:this})}setSampler(t={}){super.setSampler(t);let i=Zs(this.sampler.props);this._setSamplerParameters(i)}copyImageData(t){let i=this._normalizeCopyImageDataOptions(t),n=i.data,{width:o,height:a,depth:l}=this,{mipLevel:h=0,byteOffset:u=0,x:p=0,y:m=0,z:g=0}=i,{glFormat:T,glType:y,compressed:E}=this,S=Um(this.glTarget,this.dimension,g),v;if(!this.compressed){let{bytesPerPixel:P}=this.device.getTextureFormatInfo(this.format);if(P){if(i.bytesPerRow%P!==0)throw new Error(`bytesPerRow (${i.bytesPerRow}) must be a multiple of bytesPerPixel (${P}) for ${this.format}`);v=i.bytesPerRow/P}}let A=this.compressed?{}:{...v!==void 0?{[3314]:v}:{},[32878]:i.rowsPerImage};this.gl.bindTexture(S,this.handle),ai(this.gl,A,()=>{switch(this.dimension){case"2d":case"cube":E?this.gl.compressedTexSubImage2D(S,h,p,m,o,a,T,n,u):this.gl.texSubImage2D(S,h,p,m,o,a,T,y,n,u);break;case"2d-array":case"3d":E?this.gl.compressedTexSubImage3D(S,h,p,m,g,o,a,l,T,n,u):this.gl.texSubImage3D(S,h,p,m,g,o,a,l,T,y,n,u);break;default:}}),this.gl.bindTexture(S,null)}copyExternalImage(t){let i=this._normalizeCopyExternalImageOptions(t);if(i.sourceX||i.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");let{glFormat:n,glType:o}=this,{image:a,depth:l,mipLevel:h,x:u,y:p,z:m,width:g,height:T}=i,y=Um(this.glTarget,this.dimension,l),E=i.flipY?{[37440]:!0}:{};return this.gl.bindTexture(this.glTarget,this.handle),ai(this.gl,E,()=>{switch(this.dimension){case"2d":case"cube":this.gl.texSubImage2D(y,h,u,p,g,T,n,o,a);break;case"2d-array":case"3d":this.gl.texSubImage3D(y,h,u,p,m,g,T,l,n,o,a);break;default:}}),this.gl.bindTexture(this.glTarget,null),{width:i.width,height:i.height}}generateMipmapsWebGL(t){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(F.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!t?.force)))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(n){F.warn(`Error generating mipmap for ${this}: ${n.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}_setSamplerParameters(t){F.log(2,`${this.id} sampler parameters`,this.device.getGLKeys(t))(),this.gl.bindTexture(this.glTarget,this.handle);for(let[i,n]of Object.entries(t)){let o=Number(i),a=n;switch(o){case 33082:case 33083:this.gl.texParameterf(this.glTarget,o,a);break;case 10240:case 10241:this.gl.texParameteri(this.glTarget,o,a);break;case 10242:case 10243:case 32882:this.gl.texParameteri(this.glTarget,o,a);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,o,a);break;case 34892:case 34893:this.gl.texParameteri(this.glTarget,o,a);break}}this.gl.bindTexture(this.glTarget,null)}_getActiveUnit(){return this.gl.getParameter(34016)-33984}_bind(t){let{gl:i}=this;return t!==void 0&&(this._textureUnit=t,i.activeTexture(33984+t)),i.bindTexture(this.glTarget,this.handle),t}_unbind(t){let{gl:i}=this;return t!==void 0&&(this._textureUnit=t,i.activeTexture(33984+t)),i.bindTexture(this.glTarget,null),t}}});function zm(e){return Ib[e]}function qs(e){return Cb[e]}function Vm(e){return Boolean(Hm[e])}function Wm(e){return Hm[e]}var Cb,Hm,Ib,Oh=I(()=>{Cb={[5126]:"f32",[35664]:"vec2<f32>",[35665]:"vec3<f32>",[35666]:"vec4<f32>",[5124]:"i32",[35667]:"vec2<i32>",[35668]:"vec3<i32>",[35669]:"vec4<i32>",[5125]:"u32",[36294]:"vec2<u32>",[36295]:"vec3<u32>",[36296]:"vec4<u32>",[35670]:"f32",[35671]:"vec2<f32>",[35672]:"vec3<f32>",[35673]:"vec4<f32>",[35674]:"mat2x2<f32>",[35685]:"mat2x3<f32>",[35686]:"mat2x4<f32>",[35687]:"mat3x2<f32>",[35675]:"mat3x3<f32>",[35688]:"mat3x4<f32>",[35689]:"mat4x2<f32>",[35690]:"mat4x3<f32>",[35676]:"mat4x4<f32>"},Hm={[35678]:{viewDimension:"2d",sampleType:"float"},[35680]:{viewDimension:"cube",sampleType:"float"},[35679]:{viewDimension:"3d",sampleType:"float"},[35682]:{viewDimension:"3d",sampleType:"depth"},[36289]:{viewDimension:"2d-array",sampleType:"float"},[36292]:{viewDimension:"2d-array",sampleType:"depth"},[36293]:{viewDimension:"cube",sampleType:"float"},[36298]:{viewDimension:"2d",sampleType:"sint"},[36299]:{viewDimension:"3d",sampleType:"sint"},[36300]:{viewDimension:"cube",sampleType:"sint"},[36303]:{viewDimension:"2d-array",sampleType:"uint"},[36306]:{viewDimension:"2d",sampleType:"uint"},[36307]:{viewDimension:"3d",sampleType:"uint"},[36308]:{viewDimension:"cube",sampleType:"uint"},[36311]:{viewDimension:"2d-array",sampleType:"uint"}},Ib={uint8:5121,sint8:5120,unorm8:5121,snorm8:5120,uint16:5123,sint16:5122,unorm16:5123,snorm16:5122,uint32:5125,sint32:5124,float16:5131,float32:5126}});function jm(e,t){let i={attributes:[],bindings:[]};i.attributes=Ob(e,t);let n=Fb(e,t);for(let h of n){let u=h.uniforms.map(p=>({name:p.name,format:p.format,byteOffset:p.byteOffset,byteStride:p.byteStride,arrayLength:p.arrayLength}));i.bindings.push({type:"uniform",name:h.name,group:0,location:h.location,visibility:(h.vertex?1:0)&(h.fragment?2:0),minBindingSize:h.byteLength,uniforms:u})}let o=Db(e,t),a=0;for(let h of o)if(Vm(h.type)){let{viewDimension:u,sampleType:p}=Wm(h.type);i.bindings.push({type:"texture",name:h.name,group:0,location:a,viewDimension:u,sampleType:p}),h.textureUnit=a,a+=1}o.length&&(i.uniforms=o);let l=Nb(e,t);return l?.length&&(i.varyings=l),i}function Ob(e,t){let i=[],n=e.getProgramParameter(t,35721);for(let o=0;o<n;o++){let a=e.getActiveAttrib(t,o);if(!a)throw new Error("activeInfo");let{name:l,type:h}=a,u=e.getAttribLocation(t,l);if(u>=0){let p=qs(h),m=/instance/i.test(l)?"instance":"vertex";i.push({name:l,location:u,stepMode:m,type:p})}}return i.sort((o,a)=>o.location-a.location),i}function Nb(e,t){let i=[],n=e.getProgramParameter(t,35971);for(let o=0;o<n;o++){let a=e.getTransformFeedbackVarying(t,o);if(!a)throw new Error("activeInfo");let{name:l,type:h,size:u}=a,p=qs(h),{type:m,components:g}=rl(p);i.push({location:o,name:l,type:m,size:u*g})}return i.sort((o,a)=>o.location-a.location),i}function Db(e,t){let i=[],n=e.getProgramParameter(t,35718);for(let o=0;o<n;o++){let a=e.getActiveUniform(t,o);if(!a)throw new Error("activeInfo");let{name:l,size:h,type:u}=a,{name:p,isArray:m}=Bb(l),g=e.getUniformLocation(t,p),T={location:g,name:p,size:h,type:u,isArray:m};if(i.push(T),T.size>1)for(let y=0;y<T.size;y++){let E=`${p}[${y}]`;g=e.getUniformLocation(t,E);let S={...T,name:E,location:g};i.push(S)}}return i}function Fb(e,t){let i=(a,l)=>e.getActiveUniformBlockParameter(t,a,l),n=[],o=e.getProgramParameter(t,35382);for(let a=0;a<o;a++){let l={name:e.getActiveUniformBlockName(t,a)||"",location:i(a,35391),byteLength:i(a,35392),vertex:i(a,35396),fragment:i(a,35398),uniformCount:i(a,35394),uniforms:[]},h=i(a,35395)||[],u=e.getActiveUniforms(t,h,35383),p=e.getActiveUniforms(t,h,35384),m=e.getActiveUniforms(t,h,35387),g=e.getActiveUniforms(t,h,35388);for(let T=0;T<l.uniformCount;++T){let y=e.getActiveUniform(t,h[T]);if(!y)throw new Error("activeInfo");let E=qs(u[T]);l.uniforms.push({name:y.name,format:E,type:u[T],arrayLength:p[T],byteOffset:m[T],byteStride:g[T]})}n.push(l)}return n.sort((a,l)=>a.location-l.location),n}function Bb(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};let i=/([^[]*)(\[[0-9]+\])?/.exec(e);if(!i||i.length<2)throw new Error(`Failed to parse GLSL uniform name ${e}`);return{name:i[1],length:i[2]?1:0,isArray:Boolean(i[2])}}var Xm=I(()=>{lt();Oh()});function Zm(e,t,i,n){let o=e,a=n;a===!0&&(a=1),a===!1&&(a=0);let l=typeof a=="number"?[a]:a;switch(i){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return e.uniform1i(t,n);case 5126:return e.uniform1fv(t,l);case 35664:return e.uniform2fv(t,l);case 35665:return e.uniform3fv(t,l);case 35666:return e.uniform4fv(t,l);case 5124:return e.uniform1iv(t,l);case 35667:return e.uniform2iv(t,l);case 35668:return e.uniform3iv(t,l);case 35669:return e.uniform4iv(t,l);case 35670:return e.uniform1iv(t,l);case 35671:return e.uniform2iv(t,l);case 35672:return e.uniform3iv(t,l);case 35673:return e.uniform4iv(t,l);case 5125:return o.uniform1uiv(t,l,1);case 36294:return o.uniform2uiv(t,l,2);case 36295:return o.uniform3uiv(t,l,3);case 36296:return o.uniform4uiv(t,l,4);case 35674:return e.uniformMatrix2fv(t,!1,l);case 35675:return e.uniformMatrix3fv(t,!1,l);case 35676:return e.uniformMatrix4fv(t,!1,l);case 35685:return o.uniformMatrix2x3fv(t,!1,l);case 35686:return o.uniformMatrix2x4fv(t,!1,l);case 35687:return o.uniformMatrix3x2fv(t,!1,l);case 35688:return o.uniformMatrix3x4fv(t,!1,l);case 35689:return o.uniformMatrix4x2fv(t,!1,l);case 35690:return o.uniformMatrix4x3fv(t,!1,l)}throw new Error("Illegal uniform")}var $m=I(()=>{});function Ym(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw new Error(e)}}function Km(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;default:throw new Error(e)}}var Nh=I(()=>{});function Lb(e,t){let i={...e,attributes:e.attributes.map(n=>({...n}))};for(let n of t?.attributes||[]){let o=i.attributes.find(a=>a.name===n.name);o?(o.type=n.type||o.type,o.stepMode=n.stepMode||o.stepMode):F.warn(`shader layout attribute ${n.name} not present in shader`)}return i}var qm,Js,Jm=I(()=>{lt();Xm();wh();$m();Ws();zs();Ks();Ih();Nh();qm=4,Js=class extends er{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};get[Symbol.toStringTag](){return"WEBGLRenderPipeline"}constructor(t,i){super(t,i),this.device=t,this.handle=this.props.handle||this.device.gl.createProgram(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:{id:this.props.id}}),this.vs=i.vs,this.fs=i.fs;let{varyings:n,bufferMode:o=35981}=i;n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,o)),this._linkShaders(),F.time(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=jm(this.device.gl,this.handle),F.timeEnd(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=i.shaderLayout?Lb(this.introspectedLayout,i.shaderLayout):this.introspectedLayout}destroy(){this.handle&&(this.device.gl.useProgram(null),this.device.gl.deleteProgram(this.handle),this.destroyed=!0,this.handle.destroyed=!0,this.handle=null)}setBindings(t,i){for(let[n,o]of Object.entries(t)){let a=this.shaderLayout.bindings.find(l=>l.name===n)||this.shaderLayout.bindings.find(l=>l.name===`${n}Uniforms`);if(!a){let l=this.shaderLayout.bindings.map(h=>`"${h.name}"`).join(", ");i?.disableWarnings||F.warn(`No binding "${n}" in render pipeline "${this.id}", expected one of ${l}`,o)();continue}switch(o||F.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),a.type){case"uniform":if(!(o instanceof ue)&&!(o.buffer instanceof ue))throw new Error("buffer value");break;case"texture":if(!(o instanceof Re||o instanceof we||o instanceof Ae))throw new Error(`${this} Bad texture binding for ${n}`);break;case"sampler":F.warn(`Ignoring sampler ${n}`)();break;default:throw new Error(a.type)}this.bindings[n]=o}}draw(t){let{renderPass:i,parameters:n=this.props.parameters,topology:o=this.props.topology,vertexArray:a,vertexCount:l,instanceCount:h,isInstanced:u=!1,firstVertex:p=0,transformFeedback:m}=t,g=Ym(o),T=Boolean(a.indexBuffer),y=a.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return F.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return F.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),a.bindBeforeRender(i),m&&m.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let E=i;return Lm(this.device,n,E.glParameters,()=>{T&&u?this.device.gl.drawElementsInstanced(g,l||0,y,p,h||0):T?this.device.gl.drawElements(g,l||0,y,p):u?this.device.gl.drawArraysInstanced(g,p,l||0,h||0):this.device.gl.drawArrays(g,p,l||0),m&&m.end()}),a.unbindAfterRender(i),!0}async _linkShaders(){let{gl:t}=this.device;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),F.time(qm,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),F.timeEnd(qm,`linkProgram for ${this.id}`)(),F.level,!this.device.features.has("compilation-status-async-webgl")){let n=this._getLinkStatus();this._reportLinkStatus(n);return}F.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),F.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let i=this._getLinkStatus();this._reportLinkStatus(i)}async _reportLinkStatus(t){switch(t){case"success":return;default:let i=t==="link-error"?"Link error":"Validation error";switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`${this} ${i} during compilation of ${this.vs}`);case"pending":await this.vs.asyncCompilationStatus,this.vs.debugShader();break;case"success":break}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`${this} ${i} during compilation of ${this.fs}`);case"pending":await this.fs.asyncCompilationStatus,this.fs.debugShader();break;case"success":break}let n=this.device.gl.getProgramInfoLog(this.handle);this.device.reportError(new Error(`${i} during ${t}: ${n}`),this)(),this.device.debug()}}_getLinkStatus(){let{gl:t}=this.device;return t.getProgramParameter(this.handle,35714)?(t.validateProgram(this.handle),t.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation-error")):(this.linkStatus="error","link-error")}async _waitForLinkComplete(){let t=async o=>await new Promise(a=>setTimeout(a,o));if(!this.device.features.has("compilation-status-async-webgl")){await t(10);return}let{gl:n}=this.device;for(;;){if(n.getProgramParameter(this.handle,37297))return;await t(10)}}_areTexturesRenderable(){let t=!0;for(let i of this.shaderLayout.bindings)!this.bindings[i.name]&&!this.bindings[i.name.replace(/Uniforms$/,"")]&&(F.warn(`Binding ${i.name} not found in ${this.id}`)(),t=!1);return t}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:t}=this.device;t.useProgram(this.handle);let i=0,n=0;for(let o of this.shaderLayout.bindings){let a=this.bindings[o.name]||this.bindings[o.name.replace(/Uniforms$/,"")];if(!a)throw new Error(`No value for binding ${o.name} in ${this.id}`);switch(o.type){case"uniform":let{name:l}=o,h=t.getUniformBlockIndex(this.handle,l);if(h===4294967295)throw new Error(`Invalid uniform block name ${l}`);t.uniformBlockBinding(this.handle,n,h),a instanceof ue?t.bindBufferBase(35345,n,a.handle):t.bindBufferRange(35345,n,a.buffer.handle,a.offset||0,a.size||a.buffer.byteLength-a.offset),n+=1;break;case"texture":if(!(a instanceof Re||a instanceof we||a instanceof Ae))throw new Error("texture");let u;if(a instanceof Re)u=a.texture;else if(a instanceof we)u=a;else if(a instanceof Ae&&a.colorAttachments[0]instanceof Re)F.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),u=a.colorAttachments[0].texture;else throw new Error("No texture");t.activeTexture(33984+i),t.bindTexture(u.glTarget,u.handle),i+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${o.type}' not supported in WebGL`)}}}_applyUniforms(){for(let t of this.shaderLayout.uniforms||[]){let{name:i,location:n,type:o,textureUnit:a}=t,l=this.uniforms[i]??a;l!==void 0&&Zm(this.device.gl,n,o,l)}}}});function kb(e,t){let i=t.sourceBuffer,n=t.destinationBuffer;e.gl.bindBuffer(36662,i.handle),e.gl.bindBuffer(36663,n.handle),e.gl.copyBufferSubData(36662,36663,t.sourceOffset??0,t.destinationOffset??0,t.size),e.gl.bindBuffer(36662,null),e.gl.bindBuffer(36663,null)}function Ub(e,t){throw new Error("Not implemented")}function zb(e,t){let{sourceTexture:i,mipLevel:n=0,aspect:o="all",width:a=t.sourceTexture.width,height:l=t.sourceTexture.height,depthOrArrayLayers:h=0,origin:u=[0,0],destinationBuffer:p,byteOffset:m=0,bytesPerRow:g,rowsPerImage:T}=t;if(o!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||h!==0||g||T)throw new Error("not implemented");let{framebuffer:y,destroyFramebuffer:E}=Qm(i),S;try{let v=p,A=a||y.width,P=l||y.height,w=Ls(y.colorAttachments[0].texture.props.format),O=w.format,N=w.type;e.gl.bindBuffer(35051,v.handle),S=e.gl.bindFramebuffer(36160,y.handle),e.gl.readPixels(u[0],u[1],A,P,O,N,m)}finally{e.gl.bindBuffer(35051,null),S!==void 0&&e.gl.bindFramebuffer(36160,S),E&&y.destroy()}}function Vb(e,t){let{sourceTexture:i,destinationMipLevel:n=0,origin:o=[0,0],destinationOrigin:a=[0,0],destinationTexture:l}=t,{width:h=t.destinationTexture.width,height:u=t.destinationTexture.height}=t,{framebuffer:p,destroyFramebuffer:m}=Qm(i),[g,T]=o,[y,E,S]=a,v=e.gl.bindFramebuffer(36160,p.handle),A,P;if(l instanceof we)A=l,h=Number.isFinite(h)?h:A.width,u=Number.isFinite(u)?u:A.height,A._bind(0),P=A.glTarget;else throw new Error("invalid destination");switch(P){case 3553:case 34067:e.gl.copyTexSubImage2D(P,n,y,E,g,T,h,u);break;case 35866:case 32879:e.gl.copyTexSubImage3D(P,n,y,E,S,g,T,h,u);break;default:}A&&A._unbind(),e.gl.bindFramebuffer(36160,v),m&&p.destroy()}function Qm(e){if(e instanceof pt){let{width:t,height:i,id:n}=e;return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${n}`,width:t,height:i,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}var Qs,Gm=I(()=>{lt();Ks();wr();Qs=class extends rr{device;handle=null;commands=[];constructor(t){super(t,{}),this.device=t}_executeCommands(t=this.commands){for(let i of t)switch(i.name){case"copy-buffer-to-buffer":kb(this.device,i.options);break;case"copy-buffer-to-texture":Ub(this.device,i.options);break;case"copy-texture-to-buffer":zb(this.device,i.options);break;case"copy-texture-to-texture":Vb(this.device,i.options);break;default:throw new Error(i.name)}}}});var Wb,Gs,tg=I(()=>{lt();Ys();br();Wb=[1,2,4,8],Gs=class extends Fe{device;handle=null;glParameters={};constructor(t,i){super(t,i),this.device=t;let n;if(!i?.parameters?.viewport)if(i?.framebuffer){let{width:a,height:l}=i.framebuffer;n=[0,0,a,l]}else{let[a,l]=t.getDefaultCanvasContext().getDrawingBufferSize();n=[0,0,a,l]}this.device.pushState(),this.setParameters({viewport:n,...this.props.parameters});let o=this.props.framebuffer;if(this.props.framebuffer&&o?.handle){let a=this.props.framebuffer.colorAttachments.map((l,h)=>36064+h);this.device.gl.drawBuffers(a)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}setParameters(t={}){let i={...this.glParameters};i.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(i.depthMask=!this.props.depthReadOnly),i.stencilMask=this.props.stencilReadOnly?0:1,i[35977]=this.props.discard,t.viewport&&(t.viewport.length>=6?(i.viewport=t.viewport.slice(0,4),i.depthRange=[t.viewport[4],t.viewport[5]]):i.viewport=t.viewport),t.scissorRect&&(i.scissorTest=!0,i.scissor=t.scissorRect),t.blendConstant&&(i.blendColor=t.blendConstant),t.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),i[2967]=t.stencilReference),"colorMask"in t&&(i.colorMask=Wb.map(n=>Boolean(n&t.colorMask))),this.glParameters=i,he(this.device.gl,i)}beginOcclusionQuery(t){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let t={...this.glParameters},i=0;this.props.clearColors&&this.props.clearColors.forEach((n,o)=>{n&&this.clearColorBuffer(o,n)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(i|=16384,t.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(i|=256,t.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(i|=1024,t.clearStencil=this.props.clearStencil),i!==0&&ai(this.device.gl,t,()=>{this.device.gl.clear(i)})}clearColorBuffer(t=0,i=[0,0,0,0]){ai(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(i.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,t,i);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,t,i);break;case Float32Array:this.device.gl.clearBufferfv(6144,t,i);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}}});var eo,eg=I(()=>{lt();Gm();tg();eo=class extends ir{device;handle=null;commandBuffer;constructor(t,i){super(t,i),this.device=t,this.commandBuffer=new Qs(t)}destroy(){}finish(){return this.commandBuffer}beginRenderPass(t){return new Gs(this.device,t)}beginComputePass(t){throw new Error("ComputePass not supported in WebGL")}copyBufferToBuffer(t){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:t})}copyBufferToTexture(t){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:t})}copyTextureToBuffer(t){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:t})}copyTextureToTexture(t){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:t})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}resolveQuerySet(t,i,n){}}});function ig(e){let{target:t,source:i,start:n=0,count:o=1}=e,a=i.length,l=o*a,h=0;for(let u=n;h<a;h++)t[u++]=i[h];for(;h<l;)h<l-h?(t.copyWithin(n+h,n,n+h),h*=2):(t.copyWithin(n+h,n,n+l-h),h=l);return e.target}var rg=I(()=>{});function Hb(e){return Array.isArray(e)?new Float32Array(e):e}function jb(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}var Pr,ng=I(()=>{lt();Je();Sh();rg();Pr=class extends nr{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(t){return za()==="Chrome"}constructor(t,i){super(t,i),this.device=t,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(t){let i=t;if(i&&i.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,i?i.handle:null),this.indexBuffer=i,this.device.gl.bindVertexArray(null)}setBuffer(t,i){let n=i;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:o,type:a,stride:l,offset:h,normalized:u,integer:p,divisor:m}=this._getAccessor(t);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),p?this.device.gl.vertexAttribIPointer(t,o,a,l,h):this.device.gl.vertexAttribPointer(t,o,a,u,l,h),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(t),this.device.gl.vertexAttribDivisor(t,m||0),this.attributes[t]=n,this.device.gl.bindVertexArray(null)}setConstantWebGL(t,i){this._enable(t,!1),this.attributes[t]=i}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let t=0;t<this.maxVertexAttributes;++t){let i=this.attributes[t];ArrayBuffer.isView(i)&&this.device.setConstantAttributeWebGL(t,i)}}_getAccessor(t){let i=this.attributeInfos[t];if(!i)throw new Error(`Unknown attribute location ${t}`);let n=Fs(i.bufferDataType);return{size:i.bufferComponents,type:n,stride:i.byteStride,offset:i.byteOffset,normalized:i.normalized,integer:i.integer,divisor:i.stepMode==="instance"?1:0}}_enable(t,i=!0){let o=Pr.isConstantAttributeZeroSupported(this.device)||t!==0;(i||o)&&(t=Number(t),this.device.gl.bindVertexArray(this.handle),i?this.device.gl.enableVertexAttribArray(t):this.device.gl.disableVertexAttribArray(t),this.device.gl.bindVertexArray(null))}getConstantBuffer(t,i){let n=Hb(i),o=n.byteLength*t,a=n.length*t;if(this.buffer&&o!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${o} !== ${this.buffer.byteLength}.`);let l=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:o}),l||=!jb(n,this.bufferValue),l){let h=ll(i.constructor,a);ig({target:h,source:n,start:0,count:a}),this.buffer.write(h),this.bufferValue=i}return this.buffer}}});function og(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}var ta,sg=I(()=>{lt();Dh();Nh();ta=class extends or{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(t,i){super(t,i),this.device=t,this.gl=t.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,i.buffers&&this.setBuffers(i.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(t="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(Km(t))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(t){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let i in t)this.setBuffer(i,t[i])})}setBuffer(t,i){let n=this._getVaryingIndex(t),{buffer:o,byteLength:a,byteOffset:l}=this._getBufferRange(i);if(n<0){this.unusedBuffers[t]=o,F.warn(`${this.id} unusedBuffers varying buffer ${t}`)();return}this.buffers[n]={buffer:o,byteLength:a,byteOffset:l},this.bindOnUse||this._bindBuffer(n,o,l,a)}getBuffer(t){if(og(t))return this.buffers[t]||null;let i=this._getVaryingIndex(t);return i>=0?this.buffers[i]:null}bind(t=this.handle){if(typeof t!="function")return this.gl.bindTransformFeedback(36386,t),this;let i;return this._bound?i=t():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,i=t(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),i}unbind(){this.bind(null)}_getBufferRange(t){if(t instanceof ue)return{buffer:t,byteOffset:0,byteLength:t.byteLength};let{buffer:i,byteOffset:n=0,byteLength:o=t.buffer.byteLength}=t;return{buffer:i,byteOffset:n,byteLength:o}}_getVaryingIndex(t){if(og(t))return Number(t);for(let i of this.layout.varyings||[])if(t===i.name)return i.location;return-1}_bindBuffers(){for(let t in this.buffers){let{buffer:i,byteLength:n,byteOffset:o}=this._getBufferRange(this.buffers[t]);this._bindBuffer(Number(t),i,o,n)}}_unbindBuffers(){for(let t in this.buffers)this.gl.bindBufferBase(35982,Number(t),null)}_bindBuffer(t,i,n=0,o){let a=i&&i.handle;!a||o===void 0?this.gl.bindBufferBase(35982,t,a):this.gl.bindBufferRange(35982,t,a,n,o)}}});var ea,ag=I(()=>{lt();ea=class extends sr{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(t,i){if(super(t,i),this.device=t,i.count>1)throw new Error("WebGL QuerySet can only have one value");let n=this.device.gl.createQuery();if(!n)throw new Error("WebGL query not supported");this.handle=n,Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(t){return this._begin(t?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(t){this._queryPending||(this.target=t,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let t=this.device.gl.getQueryParameter(this.handle,34919);return t&&(this._queryPending=!1),t}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(t=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let i=0;return this._pollingPromise=new Promise((n,o)=>{let a=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):i++>t?(o("Timed out"),this._pollingPromise=null):requestAnimationFrame(a)};requestAnimationFrame(a)}),this._pollingPromise}}});function Fh(e){switch(e){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function cg(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}var lg=I(()=>{});function hg(e){return Xb[e]}var Xb,fg=I(()=>{Xb={[5124]:"sint32",[5125]:"uint32",[5122]:"sint16",[5123]:"uint16",[5120]:"sint8",[5121]:"uint8",[5126]:"float32",[5131]:"float16",[33635]:"uint16",[32819]:"uint16",[32820]:"uint16",[33640]:"uint32",[35899]:"uint32",[35902]:"uint32",[34042]:"uint32",[36269]:"uint32"}});function ug(e,t){let{sourceX:i=0,sourceY:n=0,sourceAttachment:o=0}=t||{},{target:a=null,sourceWidth:l,sourceHeight:h,sourceDepth:u,sourceFormat:p,sourceType:m}=t||{},{framebuffer:g,deleteFramebuffer:T}=pg(e),{gl:y,handle:E}=g;l||=g.width,h||=g.height;let S=g.colorAttachments[o]?.texture;if(!S)throw new Error(`Invalid framebuffer attachment ${o}`);u=S?.depth||1,p||=S?.glFormat||6408,m||=S?.glType||5121,a=$b(a,m,p,l,h,u);let v=Wo(a);m=m||zm(v);let A=y.bindFramebuffer(36160,E);return y.readBuffer(36064+o),y.readPixels(i,n,l,h,p,m,a),y.readBuffer(36064),y.bindFramebuffer(36160,A||null),T&&g.destroy(),a}function dg(e,t){let{target:i,sourceX:n=0,sourceY:o=0,sourceFormat:a=6408,targetByteOffset:l=0}=t||{},{sourceWidth:h,sourceHeight:u,sourceType:p}=t||{},{framebuffer:m,deleteFramebuffer:g}=pg(e);h=h||m.width,u=u||m.height;let T=m;p=p||5121;let y=i;if(!y){let S=Fh(a),v=cg(p),A=l+h*u*S*v;y=T.device.createBuffer({byteLength:A})}let E=e.device.createCommandEncoder();return E.copyTextureToBuffer({sourceTexture:e,width:h,height:u,origin:[n,o],destinationBuffer:y,byteOffset:l}),E.destroy(),g&&m.destroy(),y}function pg(e){return e instanceof ii?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:Zb(e),deleteFramebuffer:!0}}function Zb(e,t){let{device:i,width:n,height:o,id:a}=e;return i.createFramebuffer({...t,id:`framebuffer-for-${a}`,width:n,height:o,colorAttachments:[e]})}function $b(e,t,i,n,o,a){if(e)return e;t||=5121;let l=hg(t),h=Lc(l),u=Fh(i);return new h(n*o*u)}var _g=I(()=>{lt();Oh();lg();fg()});var Lh={};pi(Lh,{WebGLDevice:()=>Bh});function Yb(e,t,i){switch(i.length){case 1:e.gl.vertexAttrib1fv(t,i);break;case 2:e.gl.vertexAttrib2fv(t,i);break;case 3:e.gl.vertexAttrib3fv(t,i);break;case 4:e.gl.vertexAttrib4fv(t,i);break;default:}}function Kb(e,t,i){e.gl.vertexAttribI4iv(t,i)}function qb(e,t,i){e.gl.vertexAttribI4uiv(t,i)}function Jb(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}var Bh,kh=I(()=>{lt();Eh();mm();ym();wm();Pm();Mm();mh();gh();wr();Im();Ws();Fm();km();Ks();zs();Jm();eg();ng();sg();ag();_g();br();Ys();Qn();Bh=class extends Gt{type="webgl";handle;features;limits;info;canvasContext;preferredColorFormat="rgba8unorm";preferredDepthFormat="depth24plus";commandEncoder;lost;_resolveContextLost;gl;_constants;_extensions={};_polyfilled=!1;spectorJS;get[Symbol.toStringTag](){return"WebGLDevice"}toString(){return`${this[Symbol.toStringTag]}(${this.id})`}isVertexFormatSupported(t){switch(t){case"unorm8x4-bgra":return!1;default:return!0}}constructor(t){super({...t,id:t.id||Cm("webgl-device")});let i=Gt._getCanvasContextProps(t);if(!i)throw new Error("WebGLDevice requires props.createCanvasContext to be set");let n=i.canvas?.gl?.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new Vs(this,i),this.lost=new Promise(m=>{this._resolveContextLost=m});let o={...t.webgl};i.alphaMode==="premultiplied"&&(o.premultipliedAlpha=!0),t.powerPreference!==void 0&&(o.powerPreference=t.powerPreference);let l=this.props._handle||_m(this.canvasContext.canvas,{onContextLost:m=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:m=>console.log("WebGL context restored")},o);if(!l)throw new Error("WebGL context creation failed");if(n=l.device,n){if(t._reuseDevices)return F.log(1,`Not creating a new Device, instead returning a reference to Device ${n.id} already attached to WebGL context`,n)(),n._reused=!0,n;throw new Error(`WebGL context already attached to device ${n.id}`)}this.handle=l,this.gl=l,this.spectorJS=tm({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=gm(this.gl,this._extensions),this.limits=new Us(this.gl),this.features=new ks(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),new fe(this.gl,{log:(...m)=>F.log(1,...m)()}).trackState(this.gl,{copyState:!1});let u=t.debugWebGL||t.debug,p=t.debugWebGL;u&&(this.gl=nm(this.gl,{debugWebGL:u,traceWebGL:p}),F.warn("WebGL debug mode activated. Performance reduced.")(),t.debugWebGL&&(F.level=Math.max(F.level,1))),this.commandEncoder=new eo(this,{id:`${this}-command-encoder`})}destroy(){!this.props._reuseDevices&&!this._reused&&delete this.gl.device}get isLost(){return this.gl.isContextLost()}getTextureByteAlignment(){return 4}createCanvasContext(t){throw new Error("WebGL only supports a single canvas")}createBuffer(t){let i=this._normalizeBufferProps(t);return new ue(this,i)}createTexture(t){return new we(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new $s(this,t)}createShader(t){return new Hs(this,t)}createFramebuffer(t){return new Ae(this,t)}createVertexArray(t){return new Pr(this,t)}createTransformFeedback(t){return new ta(this,t)}createQuerySet(t){return new ea(this,t)}createRenderPipeline(t){return new Js(this,t)}createComputePipeline(t){throw new Error("ComputePipeline not supported in WebGL")}createCommandEncoder(t={}){return new eo(this,t)}submit(t){t||(t=this.commandEncoder.finish(),this.commandEncoder.destroy(),this.commandEncoder=this.createCommandEncoder({id:`${this.id}-default-encoder`})),t._executeCommands()}readPixelsToArrayWebGL(t,i){return ug(t,i)}readPixelsToBufferWebGL(t,i){return dg(t,i)}setParametersWebGL(t){he(this.gl,t)}getParametersWebGL(t){return Ds(this.gl,t)}withParametersWebGL(t,i){return ai(this.gl,t,i)}resetWebGL(){F.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),hm(this.gl)}_getDeviceSpecificTextureFormatCapabilities(t){return bm(this.gl,t,this._extensions)}loseDevice(){let t=!1,n=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return n&&(t=!0,n.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),t}pushState(){fe.get(this.gl).push()}popState(){fe.get(this.gl).pop()}getGLKey(t,i){let n=Number(t);for(let o in this.gl)if(this.gl[o]===n)return`GL.${o}`;return i?.emptyIfUnknown?"":String(t)}getGLKeys(t){let i={emptyIfUnknown:!0};return Object.entries(t).reduce((n,[o,a])=>(n[`${o}:${this.getGLKey(o,i)}`]=`${a}:${this.getGLKey(a,i)}`,n),{})}setConstantAttributeWebGL(t,i){let n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);let o=this._constants[t];switch(o&&Jb(o,i)&&F.info(1,`setConstantAttributeWebGL(${t}) could have been skipped, value unchanged`)(),this._constants[t]=i,i.constructor){case Float32Array:Yb(this,t,i);break;case Int32Array:Kb(this,t,i);break;case Uint32Array:qb(this,t,i);break;default:throw new Error("constant")}}getExtension(t){return be(this.gl,t,this._extensions),this._extensions}_setWebGLDebugMetadata(t,i,n){t.luma=i;let o={props:n.spector,id:n.spector.id};t.__SPECTOR_Metadata=o}}});function Qb(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}var ia,Uh,io,mg=I(()=>{lt();J_();mh();gh();ia=1,Uh=class extends pn{type="webgl";constructor(){super(),Gt.defaultProps={...Gt.defaultProps,...Ns}}enforceWebGL2(t){q_(t)}isSupported(){return typeof WebGL2RenderingContext<"u"}isDeviceHandle(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:(typeof WebGLRenderingContext<"u"&&t instanceof WebGLRenderingContext&&F.warn("WebGL1 is not supported",t)(),!1)}async attach(t,i={}){let{WebGLDevice:n}=await Promise.resolve().then(()=>(kh(),Lh));if(t instanceof n)return t;if(t?.device instanceof n)return t.device;if(!Qb(t))throw new Error("Invalid WebGL2RenderingContext");let o=i.createCanvasContext===!0?{}:i.createCanvasContext;return new n({...i,_handle:t,createCanvasContext:{canvas:t.canvas,autoResize:!1,...o}})}async create(t={}){let{WebGLDevice:i}=await Promise.resolve().then(()=>(kh(),Lh));F.groupCollapsed(ia,"WebGLDevice created")();try{let n=[];(t.debugWebGL||t.debug)&&n.push(rm()),t.debugSpectorJS&&n.push(G_(t));let o=await Promise.allSettled(n);for(let h of o)h.status==="rejected"&&F.error(`Failed to initialize debug libraries ${h.reason}`)();let a=new i(t),l=`${a._reused?"Reusing":"Created"} device with WebGL2 ${a.props.debug?"debug ":""}context: ${a.info.vendor}, ${a.info.renderer} for canvas: ${a.canvasContext.id}`;return F.probe(ia,l)(),F.table(ia,a.info)(),a}finally{F.groupEnd(ia)()}}};io=new Uh});var Dh=I(()=>{mg();Ws()});var tA={};pi(tA,{DeckLayer:()=>Vh});var ne=QT(eu(),1);function qe(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var ge={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},t0=ge.self||ge.window||ge.global||{},e0=ge.window||ge.self||ge.global||{},i0=ge.global||ge.self||ge.window||{},r0=ge.document||{};var _i=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var iu=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),n0=iu&&parseFloat(iu[1])||0;Xr();var Ha="4.3.3",d0=Ha[0]>="0"&&Ha[0]<="9"?`v${Ha}`:"";function p0(){let e=new zt({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=d0,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var ja=p0();function Xa(e,t){return vu(e||{},t)}function vu(e,t,i=0){if(i>3)return t;let n={...e};for(let[o,a]of Object.entries(t))a&&typeof a=="object"&&!Array.isArray(a)?n[o]=vu(n[o]||{},t[o],i+1):n[o]=t[o];return n}var Eu="latest";function _0(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}var Za=_0();function Bt(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Te={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},HA=Te.self||Te.window||Te.global||{},jA=Te.window||Te.self||Te.global||{},XA=Te.global||Te.self||Te.window||{},ZA=Te.document||{};var Kt=typeof process!="object"||String(process)!=="[object process]"||process.browser;var bu=typeof window<"u"&&typeof window.orientation<"u",Su=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),$A=Su&&parseFloat(Su[1])||0;var Zr=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,i){this.name=t,this.workerThread=i,this.result=new Promise((n,o)=>{this._resolve=n,this._reject=o})}postMessage(t,i){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:i})}done(t){Bt(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Bt(this.isRunning),this.isRunning=!1,this._reject(t)}};var Xi=class{terminate(){}};var $a=new Map;function Au(e){Bt(e.source&&!e.url||!e.source&&e.url);let t=$a.get(e.source||e.url);return t||(e.url&&(t=m0(e.url),$a.set(e.url,t)),e.source&&(t=Ru(e.source),$a.set(e.source,t))),Bt(t),t}function m0(e){if(!e.startsWith("http"))return e;let t=g0(e);return Ru(t)}function Ru(e){let t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function g0(e){return`try {
19
- importScripts('${e}');
20
- } catch (error) {
21
- console.error(error);
22
- throw error;
23
- }`}function Ya(e,t=!0,i){let n=i||new Set;if(e){if(wu(e))n.add(e);else if(wu(e.buffer))n.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(t&&typeof e=="object")for(let o in e)Ya(e[o],t,n)}}return i===void 0?Array.from(n):[]}function wu(e){return e?e instanceof ArrayBuffer||typeof MessagePort<"u"&&e instanceof MessagePort||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas:!1}var Ka=()=>{},Qe=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Kt||typeof Xi<"u"&&!Kt}constructor(t){let{name:i,source:n,url:o}=t;Bt(n||o),this.name=i,this.source=n,this.url=o,this.onMessage=Ka,this.onError=a=>console.log(a),this.worker=Kt?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Ka,this.onError=Ka,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,i){i=i||Ya(t),this.worker.postMessage(t,i)}_getErrorFromErrorEvent(t){let i="Failed to load ";return i+=`worker ${this.name} from ${this.url}. `,t.message&&(i+=`${t.message} in `),t.lineno&&(i+=`:${t.lineno}:${t.colno}`),new Error(i)}_createBrowserWorker(){this._loadableURL=Au({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=i=>{i.data?this.onMessage(i.data):this.onError(new Error("No data received"))},t.onerror=i=>{this.onError(this._getErrorFromErrorEvent(i)),this.terminated=!0},t.onmessageerror=i=>console.error(i),t}_createNodeWorker(){let t;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;t=new Xi(n,{eval:!1})}else if(this.source)t=new Xi(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",i=>{this.onMessage(i)}),t.on("error",i=>{this.onError(i)}),t.on("exit",i=>{}),t}};var $r=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Qe.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,i=(o,a,l)=>o.done(l),n=(o,a)=>o.error(a)){let o=new Promise(a=>(this.jobQueue.push({name:t,onMessage:i,onError:n,onStart:a}),this));return this._startQueuedJob(),await o}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let i=this.jobQueue.shift();if(i){this.onDebug({message:"Starting job",name:i.name,workerThread:t,backlog:this.jobQueue.length});let n=new Zr(i.name,t);t.onMessage=o=>i.onMessage(n,o.type,o.payload),t.onError=o=>i.onError(n,o),i.onStart(n);try{await n.result}catch(o){console.error(`Worker exception: ${o}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!Kt||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Qe({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return bu?this.maxMobileConcurrency:this.maxConcurrency}};var T0={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},gi=class{props;workerPools=new Map;static isSupported(){return Qe.isSupported()}static getWorkerFarm(t={}){return gi._workerFarm=gi._workerFarm||new gi({}),gi._workerFarm.setProps(t),gi._workerFarm}constructor(t){this.props={...T0},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let i of this.workerPools.values())i.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:i,source:n,url:o}=t,a=this.workerPools.get(i);return a||(a=new $r({name:i,source:n,url:o}),a.setProps(this._getWorkerPoolProps()),this.workerPools.set(i,a)),a}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},Ge=gi;z(Ge,"_workerFarm");function qa(e,t={}){let i=t[e.id]||{},n=Kt?`${e.id}-worker.js`:`${e.id}-worker-node.js`,o=i.workerUrl;if(!o&&e.id==="compression"&&(o=t.workerUrl),t._workerType==="test"&&(Kt?o=`modules/${e.module}/dist/${n}`:o=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!o){let a=e.version;a==="latest"&&(a=Eu);let l=a?`@${a}`:"";o=`https://unpkg.com/@loaders.gl/${e.module}${l}/dist/${n}`}return Bt(o),o}function Ja(e,t=Za){Bt(e,"no worker provided");let i=e.version;return!(!t||!i)}function Qa(e,t){return!Ge.isSupported()||!Kt&&!t?._nodeWorkers?!1:e.worker&&t?.worker}async function Ga(e,t,i,n,o){let a=e.id,l=qa(e,i),u=Ge.getWorkerFarm(i).getWorkerPool({name:a,url:l});i=JSON.parse(JSON.stringify(i)),n=JSON.parse(JSON.stringify(n||{}));let p=await u.startJob("process-on-worker",y0.bind(null,o));return p.postMessage("process",{input:t,options:i,context:n}),await(await p.result).result}async function y0(e,t,i,n){switch(i){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:o,input:a,options:l}=n;try{let h=await e(a,l);t.postMessage("done",{id:o,result:h})}catch(h){let u=h instanceof Error?h.message:"unknown error";t.postMessage("error",{id:o,error:u})}break;default:console.warn(`parse-with-worker unknown message ${i}`)}}function tc(e,t,i){if(i=i||e.byteLength,e.byteLength<i||t.byteLength<i)return!1;let n=new Uint8Array(e),o=new Uint8Array(t);for(let a=0;a<n.length;++a)if(n[a]!==o[a])return!1;return!0}function ec(...e){return Pu(e)}function Pu(e){let t=e.map(a=>a instanceof ArrayBuffer?new Uint8Array(a):a),i=t.reduce((a,l)=>a+l.byteLength,0),n=new Uint8Array(i),o=0;for(let a of t)n.set(a,o),o+=a.byteLength;return n.buffer}async function ic(e){let t=[];for await(let i of e)t.push(i);return ec(...t)}var x0="",Cu={};function oc(e){for(let t in Cu)if(e.startsWith(t)){let i=Cu[t];e=e.replace(t,i)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${x0}${e}`),e}function Iu(e){return e&&typeof e=="object"&&e.isBuffer}function Co(e){if(Iu(e))return e;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}var yi={};pi(yi,{dirname:()=>E0,filename:()=>v0,join:()=>S0,resolve:()=>b0});function Ou(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function v0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function E0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function S0(...e){let t="/";return e=e.map((i,n)=>(n&&(i=i.replace(new RegExp(`^${t}`),"")),n!==e.length-1&&(i=i.replace(new RegExp(`${t}$`),"")),i)),e.join(t)}function b0(...e){let t=[];for(let a=0;a<e.length;a++)t[a]=e[a];let i="",n=!1,o;for(let a=t.length-1;a>=-1&&!n;a--){let l;a>=0?l=t[a]:(o===void 0&&(o=Ou()),l=o),l.length!==0&&(i=`${l}/${i}`,n=l.charCodeAt(0)===qr)}return i=A0(i,!n),n?`/${i}`:i.length>0?i:"."}var qr=47,sc=46;function A0(e,t){let i="",n=-1,o=0,a,l=!1;for(let h=0;h<=e.length;++h){if(h<e.length)a=e.charCodeAt(h);else{if(a===qr)break;a=qr}if(a===qr){if(!(n===h-1||o===1))if(n!==h-1&&o===2){if(i.length<2||!l||i.charCodeAt(i.length-1)!==sc||i.charCodeAt(i.length-2)!==sc){if(i.length>2){let u=i.length-1,p=u;for(;p>=0&&i.charCodeAt(p)!==qr;--p);if(p!==u){i=p===-1?"":i.slice(0,p),n=h,o=0,l=!1;continue}}else if(i.length===2||i.length===1){i="",n=h,o=0,l=!1;continue}}t&&(i.length>0?i+="/..":i="..",l=!0)}else{let u=e.slice(n+1,h);i.length>0?i+=`/${u}`:i=u,l=!1}n=h,o=0}else a===sc&&o!==-1?++o:o=-1}return i}var R0=e=>typeof e=="boolean",Jr=e=>typeof e=="function",xi=e=>e!==null&&typeof e=="object",ac=e=>xi(e)&&e.constructor==={}.constructor;var Nu=e=>Boolean(e)&&typeof e[Symbol.iterator]=="function",Du=e=>e&&typeof e[Symbol.asyncIterator]=="function";var Jt=e=>typeof Response<"u"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var Qt=e=>typeof Blob<"u"&&e instanceof Blob,Fu=e=>e&&typeof e=="object"&&e.isBuffer;var w0=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||xi(e)&&Jr(e.tee)&&Jr(e.cancel)&&Jr(e.getReader);var P0=e=>xi(e)&&Jr(e.read)&&Jr(e.pipe)&&R0(e.readable),Io=e=>w0(e)||P0(e);var Oo=class extends Error{constructor(t,i){super(t),this.reason=i.reason,this.url=i.url,this.response=i.response}reason;url;response};var M0=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,C0=/^([-\w.]+\/[-\w.+]+)/;function cc(e,t){return e.toLowerCase()===t.toLowerCase()}function Bu(e){let t=C0.exec(e);return t?t[1]:e}function lc(e){let t=M0.exec(e);return t?t[1]:""}var Lu=/\?.*/;function ku(e){let t=e.match(Lu);return t&&t[0]}function Zi(e){return e.replace(Lu,"")}function Uu(e){if(e.length<50)return e;let t=e.slice(e.length-15);return`${e.substr(0,32)}...${t}`}function vi(e){return Jt(e)?e.url:Qt(e)?e.name||"":typeof e=="string"?e:""}function Qr(e){if(Jt(e)){let t=e,i=t.headers.get("content-type")||"",n=Zi(t.url);return Bu(i)||lc(n)}return Qt(e)?e.type||"":typeof e=="string"?lc(e):""}function zu(e){return Jt(e)?e.headers["content-length"]||-1:Qt(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function No(e){if(Jt(e))return e;let t={},i=zu(e);i>=0&&(t["content-length"]=String(i));let n=vi(e),o=Qr(e);o&&(t["content-type"]=o);let a=await O0(e);a&&(t["x-first-bytes"]=a),typeof e=="string"&&(e=new TextEncoder().encode(e));let l=new Response(e,{headers:t});return Object.defineProperty(l,"url",{value:n}),l}async function Vu(e){if(!e.ok)throw await I0(e)}async function I0(e){let t=Uu(e.url),i=`Failed to fetch resource (${e.status}) ${e.statusText}: ${t}`;i=i.length>100?`${i.slice(0,100)}...`:i;let n={reason:e.statusText,url:e.url,response:e};try{let o=e.headers.get("Content-Type");n.reason=!e.bodyUsed&&o?.includes("application/json")?await e.json():await e.text()}catch{}return new Oo(i,n)}async function O0(e){if(typeof e=="string")return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let i=e.slice(0,5);return await new Promise(n=>{let o=new FileReader;o.onload=a=>n(a?.target?.result),o.readAsDataURL(i)})}if(e instanceof ArrayBuffer){let i=e.slice(0,5);return`data:base64,${N0(i)}`}return null}function N0(e){let t="",i=new Uint8Array(e);for(let n=0;n<i.byteLength;n++)t+=String.fromCharCode(i[n]);return btoa(t)}function D0(e){return!F0(e)&&!B0(e)}function F0(e){return e.startsWith("http:")||e.startsWith("https:")}function B0(e){return e.startsWith("data:")}async function hc(e,t){if(typeof e=="string"){let i=oc(e);return D0(i)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(i,t):await fetch(i,t)}return await No(e)}Xr();var fc=new zt({id:"loaders.gl"}),Do=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},Fo=class{console;constructor(){this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}};var uc={fetch:null,mimeType:void 0,nothrow:!1,log:new Fo,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:_i,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},Wu={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function dc(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function pc(){let e=dc();return e.globalOptions=e.globalOptions||{...uc},e.globalOptions}function Xu(e,t,i,n){return i=i||[],i=Array.isArray(i)?i:[i],L0(e,i),U0(t,e,n)}function L0(e,t){Hu(e,null,uc,Wu,t);for(let i of t){let n=e&&e[i.id]||{},o=i.options&&i.options[i.id]||{},a=i.deprecatedOptions&&i.deprecatedOptions[i.id]||{};Hu(n,i.id,o,a,t)}}function Hu(e,t,i,n,o){let a=t||"Top level",l=t?`${t}.`:"";for(let h in e){let u=!t&&xi(e[h]),p=h==="baseUri"&&!t,m=h==="workerUrl"&&t;if(!(h in i)&&!p&&!m){if(h in n)fc.warn(`${a} loader option '${l}${h}' no longer supported, use '${n[h]}'`)();else if(!u){let g=k0(h,o);fc.warn(`${a} loader option '${l}${h}' not recognized. ${g}`)()}}}}function k0(e,t){let i=e.toLowerCase(),n="";for(let o of t)for(let a in o.options){if(e===a)return`Did you mean '${o.id}.${a}'?`;let l=a.toLowerCase();(i.startsWith(l)||l.startsWith(i))&&(n=n||`Did you mean '${o.id}.${a}'?`)}return n}function U0(e,t,i){let o={...e.options||{}};return z0(o,i),o.log===null&&(o.log=new Do),ju(o,pc()),ju(o,t),o}function ju(e,t){for(let i in t)if(i in t){let n=t[i];ac(n)&&ac(e[i])?e[i]={...e[i],...t[i]}:e[i]=t[i]}}function z0(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}function Gr(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e?.extensions)):!1}function tn(e){qe(e,"null loader"),qe(Gr(e),"invalid loader");let t;return Array.isArray(e)&&(t=e[1],e=e[0],e={...e,options:{...e.options,...t}}),(e?.parseTextSync||e?.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var Zu=()=>{let e=dc();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function _c(e){let t=Zu();e=Array.isArray(e)?e:[e];for(let i of e){let n=tn(i);t.find(o=>n===o)||t.unshift(n)}}function $u(){return Zu()}var V0=/\.([^.]+)$/;async function qu(e,t=[],i,n){if(!Ju(e))return null;let o=Yu(e,t,{...i,nothrow:!0},n);if(o)return o;if(Qt(e)&&(e=await e.slice(0,10).arrayBuffer(),o=Yu(e,t,i,n)),!o&&!i?.nothrow)throw new Error(Qu(e));return o}function Yu(e,t=[],i,n){if(!Ju(e))return null;if(t&&!Array.isArray(t))return tn(t);let o=[];t&&(o=o.concat(t)),i?.ignoreRegisteredLoaders||o.push(...$u()),H0(o);let a=W0(e,o,i,n);if(!a&&!i?.nothrow)throw new Error(Qu(e));return a}function W0(e,t,i,n){let o=vi(e),a=Qr(e),l=Zi(o)||n?.url,h=null,u="";return i?.mimeType&&(h=mc(t,i?.mimeType),u=`match forced by supplied MIME type ${i?.mimeType}`),h=h||j0(t,l),u=u||(h?`matched url ${l}`:""),h=h||mc(t,a),u=u||(h?`matched MIME type ${a}`:""),h=h||Z0(t,e),u=u||(h?`matched initial data ${Gu(e)}`:""),i?.fallbackMimeType&&(h=h||mc(t,i?.fallbackMimeType),u=u||(h?`matched fallback MIME type ${a}`:"")),u&&ja.log(1,`selectLoader selected ${h?.name}: ${u}.`),h}function Ju(e){return!(e instanceof Response&&e.status===204)}function Qu(e){let t=vi(e),i=Qr(e),n="No valid loader found (";n+=t?`${yi.filename(t)}, `:"no url provided, ",n+=`MIME type: ${i?`"${i}"`:"not provided"}, `;let o=e?Gu(e):"";return n+=o?` first bytes: "${o}"`:"first bytes: not available",n+=")",n}function H0(e){for(let t of e)tn(t)}function j0(e,t){let i=t&&V0.exec(t),n=i&&i[1];return n?X0(e,n):null}function X0(e,t){t=t.toLowerCase();for(let i of e)for(let n of i.extensions)if(n.toLowerCase()===t)return i;return null}function mc(e,t){for(let i of e)if(i.mimeTypes?.some(n=>cc(t,n))||cc(t,`application/x.${i.id}`))return i;return null}function Z0(e,t){if(!t)return null;for(let i of e)if(typeof t=="string"){if($0(t,i))return i}else if(ArrayBuffer.isView(t)){if(Ku(t.buffer,t.byteOffset,i))return i}else if(t instanceof ArrayBuffer&&Ku(t,0,i))return i;return null}function $0(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(n=>e.startsWith(n))}function Ku(e,t,i){return(Array.isArray(i.tests)?i.tests:[i.tests]).some(o=>Y0(e,t,i,o))}function Y0(e,t,i,n){if(n instanceof ArrayBuffer)return tc(n,e,n.byteLength);switch(typeof n){case"function":return n(e);case"string":let o=gc(e,t,n.length);return n===o;default:return!1}}function Gu(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?gc(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?gc(e,0,t):""}function gc(e,t,i){if(e.byteLength<t+i)return"";let n=new DataView(e),o="";for(let a=0;a<i;a++)o+=String.fromCharCode(n.getUint8(t+a));return o}function*td(e,t){let i=t?.chunkSize||262144,n=0,o=new TextEncoder;for(;n<e.length;){let a=Math.min(e.length-n,i),l=e.slice(n,n+a);n+=a,yield o.encode(l)}}function*ed(e,t={}){let{chunkSize:i=262144}=t,n=0;for(;n<e.byteLength;){let o=Math.min(e.byteLength-n,i),a=new ArrayBuffer(o),l=new Uint8Array(e,n,o);new Uint8Array(a).set(l),n+=o,yield a}}async function*id(e,t){let i=t?.chunkSize||1048576,n=0;for(;n<e.size;){let o=n+i,a=await e.slice(n,o).arrayBuffer();n=o,yield a}}function Tc(e,t){return _i?K0(e,t):q0(e,t)}async function*K0(e,t){let i=e.getReader(),n;try{for(;;){let o=n||i.read();t?._streamReadAhead&&(n=i.read());let{done:a,value:l}=await o;if(a)return;yield Co(l)}}catch{i.releaseLock()}}async function*q0(e,t){for await(let i of e)yield Co(i)}function rd(e,t){if(typeof e=="string")return td(e,t);if(e instanceof ArrayBuffer)return ed(e,t);if(Qt(e))return id(e,t);if(Io(e))return Tc(e,t);if(Jt(e))return Tc(e.body,t);throw new Error("makeIterator")}var nd="Cannot convert supplied data type";function J0(e,t,i){if(t.text&&typeof e=="string")return e;if(Fu(e)&&(e=e.buffer),e instanceof ArrayBuffer){let n=e;return t.text&&!t.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(e);let n=e.buffer,o=e.byteLength||e.length;return(e.byteOffset!==0||o!==n.byteLength)&&(n=n.slice(e.byteOffset,e.byteOffset+o)),n}throw new Error(nd)}async function od(e,t,i){let n=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||n)return J0(e,t,i);if(Qt(e)&&(e=await No(e)),Jt(e)){let o=e;return await Vu(o),t.binary?await o.arrayBuffer():await o.text()}if(Io(e)&&(e=rd(e,i)),Nu(e)||Du(e))return ic(e);throw new Error(nd)}function Bo(e,t){let i=pc(),n=e||i;return typeof n.fetch=="function"?n.fetch:xi(n.fetch)?o=>hc(o,n.fetch):t?.fetch?t?.fetch:hc}function sd(e,t,i){if(i)return i;let n={fetch:Bo(t,e),...e};if(n.url){let o=Zi(n.url);n.baseUrl=o,n.queryString=ku(n.url),n.filename=yi.filename(o),n.baseUrl=yi.dirname(o)}return Array.isArray(n.loaders)||(n.loaders=null),n}function ad(e,t){if(e&&!Array.isArray(e))return e;let i;if(e&&(i=Array.isArray(e)?e:[e]),t&&t.loaders){let n=Array.isArray(t.loaders)?t.loaders:[t.loaders];i=i?[...i,...n]:n}return i&&i.length?i:void 0}async function en(e,t,i,n){t&&!Array.isArray(t)&&!Gr(t)&&(n=void 0,i=t,t=void 0),e=await e,i=i||{};let o=vi(e),l=ad(t,n),h=await qu(e,l,i);return h?(i=Xu(i,h,l,o),n=sd({url:o,_parse:en,loaders:l},i,n||null),await Q0(h,e,i,n)):null}async function Q0(e,t,i,n){if(Ja(e),i=Xa(e.options,i),Jt(t)){let a=t,{ok:l,redirected:h,status:u,statusText:p,type:m,url:g}=a,T=Object.fromEntries(a.headers.entries());n.response={headers:T,ok:l,redirected:h,status:u,statusText:p,type:m,url:g}}t=await od(t,e,i);let o=e;if(o.parseTextSync&&typeof t=="string")return o.parseTextSync(t,i,n);if(Qa(e,i))return await Ga(e,t,i,n,en);if(o.parseText&&typeof t=="string")return await o.parseText(t,i,n);if(o.parse)return await o.parse(t,i,n);throw Bt(!o.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}async function yc(e,t,i,n){let o,a;!Array.isArray(t)&&!Gr(t)?(o=[],a=t,n=void 0):(o=t,a=i);let l=Bo(a),h=e;return typeof e=="string"&&(h=await l(e)),Qt(e)&&(h=await l(e)),Array.isArray(o)?await en(h,o,a):await en(h,o,a)}var cd="4.3.3";var G0=globalThis.loaders?.parseImageNode,xc=typeof Image<"u",vc=typeof ImageBitmap<"u",ty=Boolean(G0),Ec=_i?!0:ty;function ld(e){switch(e){case"auto":return vc||xc||Ec;case"imagebitmap":return vc;case"image":return xc;case"data":return Ec;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function hd(){if(vc)return"imagebitmap";if(xc)return"image";if(Ec)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function ey(e){let t=iy(e);if(!t)throw new Error("Not an image");return t}function fd(e){switch(ey(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),i=t.getContext("2d");if(!i)throw new Error("getImageData");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0),i.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function iy(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var ry=/^data:image\/svg\+xml/,ny=/\.svg((\?|#).*)?$/;function Lo(e){return e&&(ry.test(e)||ny.test(e))}function ud(e,t){if(Lo(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(a){throw new Error(a.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return Sc(e,t)}function Sc(e,t){if(Lo(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ko(e,t,i){let n=ud(e,i),o=self.URL||self.webkitURL,a=typeof n!="string"&&o.createObjectURL(n);try{return await oy(a||n,t)}finally{a&&o.revokeObjectURL(a)}}async function oy(e,t){let i=new Image;return i.src=e,t.image&&t.image.decode&&i.decode?(await i.decode(),i):await new Promise((n,o)=>{try{i.onload=()=>n(i),i.onerror=a=>{let l=a instanceof Error?a.message:"error";o(new Error(l))}}catch(a){o(a)}})}var sy={},dd=!0;async function pd(e,t,i){let n;Lo(i)?n=await ko(e,t,i):n=Sc(e,i);let o=t&&t.imagebitmap;return await ay(n,o)}async function ay(e,t=null){if((cy(t)||!dd)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(i){console.warn(i),dd=!1}return await createImageBitmap(e)}function cy(e){for(let t in e||sy)return!1;return!0}function _d(e){return!uy(e,"ftyp",4)||!(e[8]&96)?null:ly(e)}function ly(e){switch(hy(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function hy(e,t,i){return String.fromCharCode(...e.slice(t,i))}function fy(e){return[...e].map(t=>t.charCodeAt(0))}function uy(e,t,i=0){let n=fy(t);for(let o=0;o<n.length;++o)if(n[o]!==e[o+i])return!1;return!0}var ye=!1,rn=!0;function Uo(e){let t=nn(e);return py(t)||gy(t)||_y(t)||my(t)||dy(t)}function dy(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),i=_d(t);return i?{mimeType:i.mimeType,width:0,height:0}:null}function py(e){let t=nn(e);return t.byteLength>=24&&t.getUint32(0,ye)===2303741511?{mimeType:"image/png",width:t.getUint32(16,ye),height:t.getUint32(20,ye)}:null}function _y(e){let t=nn(e);return t.byteLength>=10&&t.getUint32(0,ye)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,rn),height:t.getUint16(8,rn)}:null}function my(e){let t=nn(e);return t.byteLength>=14&&t.getUint16(0,ye)===16973&&t.getUint32(2,rn)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,rn),height:t.getUint32(22,rn)}:null}function gy(e){let t=nn(e);if(!(t.byteLength>=3&&t.getUint16(0,ye)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:o}=Ty(),a=2;for(;a+9<t.byteLength;){let l=t.getUint16(a,ye);if(o.has(l))return{mimeType:"image/jpeg",height:t.getUint16(a+5,ye),width:t.getUint16(a+7,ye)};if(!n.has(l))return null;a+=2,a+=t.getUint16(a,ye)}return null}function Ty(){let e=new Set([65499,65476,65484,65501,65534]);for(let i=65504;i<65520;++i)e.add(i);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function nn(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function md(e,t){let{mimeType:i}=Uo(e)||{},n=globalThis.loaders?.parseImageNode;return qe(n),await n(e,i)}async function gd(e,t,i){t=t||{};let o=(t.image||{}).type||"auto",{url:a}=i||{},l=yy(o),h;switch(l){case"imagebitmap":h=await pd(e,t,a);break;case"image":h=await ko(e,t,a);break;case"data":h=await md(e,t);break;default:qe(!1)}return o==="data"&&(h=fd(h)),h}function yy(e){switch(e){case"auto":case"data":return hd();default:return ld(e),e}}var xy=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],vy=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Ey={image:{type:"auto",decode:!0}},bc={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:cd,mimeTypes:vy,extensions:xy,parse:gd,tests:[e=>Boolean(Uo(new DataView(e)))],options:Ey};Xr();var Sy=new zt({id:"deck"}),ct=Sy;var Ac={};function Td(e){Ac=e}function $i(e,t,i,n){ct.level>0&&Ac[e]&&Ac[e].call(null,t,i,n)}function by(e){let t=e[0],i=e[e.length-1];return t==="{"&&i==="}"||t==="["&&i==="]"}var yd={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:by,parseTextSync:JSON.parse};function Ay(){let e="9.2.2",t=globalThis.deck&&globalThis.deck.VERSION;if(t&&t!==e)throw new Error(`deck.gl - multiple versions detected: ${t} vs ${e}`);return t||(ct.log(1,`deck.gl ${e}`)(),globalThis.deck={...globalThis.deck,VERSION:e,version:e,log:ct,_registerLoggers:Td},_c([yd,[bc,{imagebitmap:{premultiplyAlpha:"none"}}]])),e}var xd=Ay();function zo(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}var Rc={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function Ed(e){let t={};for(let[i,n]of Object.entries(e))t[i]=Ry(n);return t}function Ry(e){let t=vd(e);if(t!=="object")return{value:e,...Rc[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...Rc[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=vd(e.value),{...e,...Rc[t],type:t}):{type:"object",value:null};throw new Error("props")}function vd(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var Sd=`#ifdef MODULE_LOGDEPTH
24
- logdepth_adjustPosition(gl_Position);
25
- #endif
26
- `,bd=`#ifdef MODULE_MATERIAL
27
- fragColor = material_filterColor(fragColor);
28
- #endif
29
-
30
- #ifdef MODULE_LIGHTING
31
- fragColor = lighting_filterColor(fragColor);
32
- #endif
33
-
34
- #ifdef MODULE_FOG
35
- fragColor = fog_filterColor(fragColor);
36
- #endif
37
-
38
- #ifdef MODULE_PICKING
39
- fragColor = picking_filterHighlightColor(fragColor);
40
- fragColor = picking_filterPickingColor(fragColor);
41
- #endif
42
-
43
- #ifdef MODULE_LOGDEPTH
44
- logdepth_setFragDepth();
45
- #endif
46
- `;var wy={vertex:Sd,fragment:bd},Ad=/void\s+main\s*\([^)]*\)\s*\{\n?/,Rd=/}\n?[^{}]*$/,wc=[],on="__LUMA_INJECT_DECLARATIONS__";function wd(e){let t={vertex:{},fragment:{}};for(let i in e){let n=e[i],o=Py(i);typeof n=="string"&&(n={order:0,injection:n}),t[o][i]=n}return t}function Py(e){let t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(t)}}function sn(e,t,i,n=!1){let o=t==="vertex";for(let a in i){let l=i[a];l.sort((u,p)=>u.order-p.order),wc.length=l.length;for(let u=0,p=l.length;u<p;++u)wc[u]=l[u].injection;let h=`${wc.join(`
47
- `)}
48
- `;switch(a){case"vs:#decl":o&&(e=e.replace(on,h));break;case"vs:#main-start":o&&(e=e.replace(Ad,u=>u+h));break;case"vs:#main-end":o&&(e=e.replace(Rd,u=>h+u));break;case"fs:#decl":o||(e=e.replace(on,h));break;case"fs:#main-start":o||(e=e.replace(Ad,u=>u+h));break;case"fs:#main-end":o||(e=e.replace(Rd,u=>h+u));break;default:e=e.replace(a,u=>u+h)}}return e=e.replace(on,""),n&&(e=e.replace(/\}\s*$/,a=>a+wy[t])),e}function Yi(e){e.map(t=>My(t))}function My(e){if(e.instance)return;Yi(e.dependencies||[]);let{propTypes:t={},deprecations:i=[],inject:n={}}=e,o={normalizedInjections:wd(n),parsedDeprecations:Cy(i)};t&&(o.propValidators=Ed(t)),e.instance=o;let a={};t&&(a=Object.entries(t).reduce((l,[h,u])=>{let p=u?.value;return p&&(l[h]=p),l},{})),e.defaultUniforms={...e.defaultUniforms,...a}}function Pc(e,t,i){e.deprecations?.forEach(n=>{n.regex?.test(t)&&(n.deprecated?i.deprecated(n.old,n.new)():i.removed(n.old,n.new)())})}function Cy(e){return e.forEach(t=>{switch(t.type){case"function":t.regex=new RegExp(`\\b${t.old}\\(`);break;default:t.regex=new RegExp(`${t.type} ${t.old};`)}}),e}function Mc(e){Yi(e);let t={},i={};Pd({modules:e,level:0,moduleMap:t,moduleDepth:i});let n=Object.keys(i).sort((o,a)=>i[a]-i[o]).map(o=>t[o]);return Yi(n),n}function Pd(e){let{modules:t,level:i,moduleMap:n,moduleDepth:o}=e;if(i>=5)throw new Error("Possible loop in shader dependency graph");for(let a of t)n[a.name]=a,(o[a.name]===void 0||o[a.name]<i)&&(o[a.name]=i);for(let a of t)a.dependencies&&Pd({modules:a.dependencies,level:i+1,moduleMap:n,moduleDepth:o})}function Md(e){switch(e?.gpu.toLowerCase()){case"apple":return`#define APPLE_GPU
49
- // Apple optimizes away the calculation necessary for emulated fp64
50
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
51
- #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
52
- // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
53
- #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
54
- `;case"nvidia":return`#define NVIDIA_GPU
55
- // Nvidia optimizes away the calculation necessary for emulated fp64
56
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
57
- `;case"intel":return`#define INTEL_GPU
58
- // Intel optimizes away the calculation necessary for emulated fp64
59
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
60
- // Intel's built-in 'tan' function doesn't have acceptable precision
61
- #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
62
- // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
63
- #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
64
- `;case"amd":return`#define AMD_GPU
65
- `;default:return`#define DEFAULT_GPU
66
- // Prevent driver from optimizing away the calculation necessary for emulated fp64
67
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
68
- // Headless Chrome's software shader 'tan' function doesn't have acceptable precision
69
- #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
70
- // If the GPU doesn't have full 32 bits precision, will causes overflow
71
- #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
72
- `}}function Id(e,t){if(Number(e.match(/^#version[ \t]+(\d+)/m)?.[1]||100)!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(t){case"vertex":return e=Cd(e,Iy),e;case"fragment":return e=Cd(e,Oy),e;default:throw new Error(t)}}var Od=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
73
- `],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],Iy=[...Od,[Cc("attribute"),"in $1"],[Cc("varying"),"out $1"]],Oy=[...Od,[Cc("varying"),"in $1"]];function Cd(e,t){for(let[i,n]of t)e=e.replace(i,n);return e}function Cc(e){return new RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function Ic(e,t){let i="";for(let n in e){let o=e[n];if(i+=`void ${o.signature} {
74
- `,o.header&&(i+=` ${o.header}`),t[n]){let a=t[n];a.sort((l,h)=>l.order-h.order);for(let l of a)i+=` ${l.injection}
75
- `}o.footer&&(i+=` ${o.footer}`),i+=`}
76
- `}return i}function Oc(e){let t={vertex:{},fragment:{}};for(let i of e){let n,o;typeof i!="string"?(n=i,o=n.hook):(n={},o=i),o=o.trim();let[a,l]=o.split(":"),h=o.replace(/\(.+/,""),u=Object.assign(n,{signature:l});switch(a){case"vs":t.vertex[h]=u;break;case"fs":t.fragment[h]=u;break;default:throw new Error(a)}}return t}function Nd(e,t){return{name:Ny(e,t),language:"glsl",version:Dy(e)}}function Ny(e,t="unnamed"){let n=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(e);return n?n[1]:t}function Dy(e){let t=100,i=e.match(/[^\s]+/g);if(i&&i.length>=2&&i[0]==="#version"){let n=parseInt(i[1],10);Number.isFinite(n)&&(t=n)}if(t!==100&&t!==300)throw new Error(`Invalid GLSL version ${t}`);return t}var Fd=`
77
-
78
- ${on}
79
- `,Fy=`precision highp float;
80
- `;function Bd(e){let t=Mc(e.modules||[]);return{source:By(e.platformInfo,{...e,source:e.source,stage:"vertex",modules:t}),getUniforms:kd(t)}}function Ld(e){let{vs:t,fs:i}=e,n=Mc(e.modules||[]);return{vs:Dd(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:Dd(e.platformInfo,{...e,source:i,stage:"fragment",modules:n}),getUniforms:kd(n)}}function By(e,t){let{source:i,stage:n,modules:o,hookFunctions:a=[],inject:l={},log:h}=t;zo(typeof i=="string","shader source must be a string");let u=i,p="",m=Oc(a),g={},T={},y={};for(let S in l){let v=typeof l[S]=="string"?{injection:l[S],order:0}:l[S],A=/^(v|f)s:(#)?([\w-]+)$/.exec(S);if(A){let P=A[2],w=A[3];P?w==="decl"?T[S]=[v]:y[S]=[v]:g[S]=[v]}else y[S]=[v]}let E=o;for(let S of E){h&&Pc(S,u,h);let v=Ud(S,"wgsl");p+=v;let A=S.injections?.[n]||{};for(let P in A){let w=/^(v|f)s:#([\w-]+)$/.exec(P);if(w){let N=w[2]==="decl"?T:y;N[P]=N[P]||[],N[P].push(A[P])}else g[P]=g[P]||[],g[P].push(A[P])}}return p+=Fd,p=sn(p,n,T),p+=Ic(m[n],g),p+=u,p=sn(p,n,y),p}function Dd(e,t){let{source:i,stage:n,language:o="glsl",modules:a,defines:l={},hookFunctions:h=[],inject:u={},prologue:p=!0,log:m}=t;zo(typeof i=="string","shader source must be a string");let g=o==="glsl"?Nd(i).version:-1,T=e.shaderLanguageVersion,y=g===100?"#version 100":"#version 300 es",S=i.split(`
81
- `).slice(1).join(`
82
- `),v={};a.forEach(C=>{Object.assign(v,C.defines)}),Object.assign(v,l);let A="";switch(o){case"wgsl":break;case"glsl":A=p?`${y}
83
-
84
- // ----- PROLOGUE -------------------------
85
- ${`#define SHADER_TYPE_${n.toUpperCase()}`}
86
-
87
- ${Md(e)}
88
- ${n==="fragment"?Fy:""}
89
-
90
- // ----- APPLICATION DEFINES -------------------------
91
-
92
- ${Ly(v)}
93
-
94
- `:`${y}
95
- `;break}let P=Oc(h),w={},O={},N={};for(let C in u){let V=typeof u[C]=="string"?{injection:u[C],order:0}:u[C],U=/^(v|f)s:(#)?([\w-]+)$/.exec(C);if(U){let D=U[2],B=U[3];D?B==="decl"?O[C]=[V]:N[C]=[V]:w[C]=[V]}else N[C]=[V]}for(let C of a){m&&Pc(C,S,m);let V=Ud(C,n);A+=V;let U=C.instance?.normalizedInjections[n]||{};for(let D in U){let B=/^(v|f)s:#([\w-]+)$/.exec(D);if(B){let Z=B[2]==="decl"?O:N;Z[D]=Z[D]||[],Z[D].push(U[D])}else w[D]=w[D]||[],w[D].push(U[D])}}return A+="// ----- MAIN SHADER SOURCE -------------------------",A+=Fd,A=sn(A,n,O),A+=Ic(P[n],w),A+=S,A=sn(A,n,N),o==="glsl"&&g!==T&&(A=Id(A,n)),A.trim()}function kd(e){return function(i){let n={};for(let o of e){let a=o.getUniforms?.(i,n);Object.assign(n,a)}return n}}function Ly(e={}){let t="";for(let i in e){let n=e[i];(n||Number.isFinite(n))&&(t+=`#define ${i.toUpperCase()} ${e[i]}
96
- `)}return t}function Ud(e,t){let i;switch(t){case"vertex":i=e.vs||"";break;case"fragment":i=e.fs||"";break;case"wgsl":i=e.source||"";break;default:zo(!1)}if(!e.name)throw new Error("Shader module must have a name");let n=e.name.toUpperCase().replace(/[^0-9a-z]/gi,"_"),o=`// ----- MODULE ${e.name} ---------------
97
-
98
- `;return t!=="wgsl"&&(o+=`#define MODULE_${n}
99
- `),o+=`${i}
100
- `,o}var ky=/^\s*\#\s*ifdef\s*([a-zA-Z_]+)\s*$/,Uy=/^\s*\#\s*endif\s*$/;function zd(e,t){let i=e.split(`
101
- `),n=[],o=!0,a=null;for(let l of i){let h=l.match(ky),u=l.match(Uy);h?(a=h[1],o=Boolean(t?.defines?.[a])):u?o=!0:o&&n.push(l)}return n.join(`
102
- `)}var Ki=class{_hookFunctions=[];_defaultModules=[];static getDefaultShaderAssembler(){return Ki.defaultShaderAssembler=Ki.defaultShaderAssembler||new Ki,Ki.defaultShaderAssembler}addDefaultModule(t){this._defaultModules.find(i=>i.name===(typeof t=="string"?t:t.name))||this._defaultModules.push(t)}removeDefaultModule(t){let i=typeof t=="string"?t:t.name;this._defaultModules=this._defaultModules.filter(n=>n.name!==i)}addShaderHook(t,i){i&&(t=Object.assign(i,{hook:t})),this._hookFunctions.push(t)}assembleWGSLShader(t){let i=this._getModuleList(t.modules),n=this._hookFunctions,{source:o,getUniforms:a}=Bd({...t,source:t.source,modules:i,hookFunctions:n});return{source:t.platformInfo.shaderLanguage==="wgsl"?zd(o):o,getUniforms:a,modules:i}}assembleGLSLShaderPair(t){let i=this._getModuleList(t.modules),n=this._hookFunctions;return{...Ld({...t,vs:t.vs,fs:t.fs,modules:i,hookFunctions:n}),modules:i}}_getModuleList(t=[]){let i=new Array(this._defaultModules.length+t.length),n={},o=0;for(let a=0,l=this._defaultModules.length;a<l;++a){let h=this._defaultModules[a],u=h.name;i[o++]=h,n[u]=!0}for(let a=0,l=t.length;a<l;++a){let h=t[a],u=h.name;n[u]||(i[o++]=h,n[u]=!0)}return i.length=o,Yi(i),i}},qi=Ki;z(qi,"defaultShaderAssembler");var sC=1/Math.PI*180,aC=1/180*Math.PI,Sx={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Sx}};var wt=globalThis.mathgl.config;function hl(e,{precision:t=wt.precision}={}){return e=bx(e),`${parseFloat(e.toPrecision(t))}`}function Be(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function te(e,t,i){return Rx(e,n=>Math.max(t,Math.min(i,n)))}function _n(e,t,i){return Be(e)?e.map((n,o)=>_n(n,t[o],i)):i*t+(1-i)*e}function Le(e,t,i){let n=wt.EPSILON;i&&(wt.EPSILON=i);try{if(e===t)return!0;if(Be(e)&&Be(t)){if(e.length!==t.length)return!1;for(let o=0;o<e.length;++o)if(!Le(e[o],t[o]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=wt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{wt.EPSILON=n}}function bx(e){return Math.round(e/wt.EPSILON)*wt.EPSILON}function Ax(e){return e.clone?e.clone():new Array(e.length)}function Rx(e,t,i){if(Be(e)){let n=e;i=i||Ax(n);for(let o=0;o<i.length&&o<n.length;++o){let a=typeof e=="number"?e:e[o];i[o]=t(a,o,i)}return i}return t(e)}var ar=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,i=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+i];return this.check()}toArray(t=[],i=0){for(let n=0;n<this.ELEMENTS;++n)t[i+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Be(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(wt)}formatString(t){let i="";for(let n=0;n<this.ELEMENTS;++n)i+=(n>0?", ":"")+hl(this[n],t);return`${t.printTypes?this.constructor.name:""}[${i}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let i=0;i<this.ELEMENTS;++i)if(!Le(this[i],t[i]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let i=0;i<this.ELEMENTS;++i)if(this[i]!==t[i])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,i,n){if(n===void 0)return this.lerp(this,t,i);for(let o=0;o<this.ELEMENTS;++o){let a=t[o],l=typeof i=="number"?i:i[o];this[o]=a+n*(l-a)}return this.check()}min(t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(t[i],this[i]);return this.check()}max(t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.max(t[i],this[i]);return this.check()}clamp(t,i){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),i[n]);return this.check()}add(...t){for(let i of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=i[n];return this.check()}subtract(...t){for(let i of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=i[n];return this.check()}scale(t){if(typeof t=="number")for(let i=0;i<this.ELEMENTS;++i)this[i]*=t;else for(let i=0;i<this.ELEMENTS&&i<t.length;++i)this[i]*=t[i];return this.check()}multiplyByScalar(t){for(let i=0;i<this.ELEMENTS;++i)this[i]*=t;return this.check()}check(){if(wt.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let i=0;i<this.ELEMENTS;++i)t=t&&Number.isFinite(this[i]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let i=0;i<this.ELEMENTS;++i)this[i]=t;return this.check()}addScalar(t){for(let i=0;i<this.ELEMENTS;++i)this[i]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let i=0;i<this.ELEMENTS;++i)this[i]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,i){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t),i);return this.check()}get elements(){return this}};function wx(e,t){if(e.length!==t)return!1;for(let i=0;i<e.length;++i)if(!Number.isFinite(e[i]))return!1;return!0}function Nt(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Go(e,t,i=""){if(wt.debug&&!wx(e,t))throw new Error(`math.gl: ${i} some fields set to invalid numbers'`);return e}function fl(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var ts=class extends ar{get x(){return this[0]}set x(t){this[0]=Nt(t)}get y(){return this[1]}set y(t){this[1]=Nt(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let i=0;i<this.ELEMENTS;++i)t+=this[i]*this[i];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let i=0;for(let n=0;n<this.ELEMENTS;++n){let o=this[n]-t[n];i+=o*o}return Nt(i)}dot(t){let i=0;for(let n=0;n<this.ELEMENTS;++n)i+=this[n]*t[n];return Nt(i)}normalize(){let t=this.magnitude();if(t!==0)for(let i=0;i<this.ELEMENTS;++i)this[i]/=t;return this.check()}multiply(...t){for(let i of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=i[n];return this.check()}divide(...t){for(let i of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=i[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return fl(t>=0&&t<this.ELEMENTS,"index is out of range"),Nt(this[t])}setComponent(t,i){return fl(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=i,this.check()}addVectors(t,i){return this.copy(t).add(i)}subVectors(t,i){return this.copy(t).subtract(i)}multiplyVectors(t,i){return this.copy(t).multiply(i)}addScaledVector(t,i){return this.add(new this.constructor(t).multiplyScalar(i))}};var ae={};pi(ae,{add:()=>Ox,angle:()=>Jx,ceil:()=>Nx,clone:()=>Px,copy:()=>Cx,create:()=>Tp,cross:()=>jx,dist:()=>sv,distance:()=>Ep,div:()=>ov,divide:()=>vp,dot:()=>Hx,equals:()=>ev,exactEquals:()=>tv,floor:()=>Dx,forEach:()=>lv,fromValues:()=>Mx,inverse:()=>Vx,len:()=>iv,length:()=>bp,lerp:()=>Xx,max:()=>Bx,min:()=>Fx,mul:()=>nv,multiply:()=>xp,negate:()=>zx,normalize:()=>Wx,random:()=>Zx,rotate:()=>qx,round:()=>Lx,scale:()=>kx,scaleAndAdd:()=>Ux,set:()=>Ix,sqrDist:()=>av,sqrLen:()=>cv,squaredDistance:()=>Sp,squaredLength:()=>Ap,str:()=>Gx,sub:()=>rv,subtract:()=>yp,transformMat2:()=>$x,transformMat2d:()=>Yx,transformMat3:()=>Kx,transformMat4:()=>ul,zero:()=>Qx});var Tt=typeof Float32Array<"u"?Float32Array:Array,ve=Math.random;function ee(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var TC=Math.PI/180;function Tp(){let e=new Tt(2);return Tt!=Float32Array&&(e[0]=0,e[1]=0),e}function Px(e){let t=new Tt(2);return t[0]=e[0],t[1]=e[1],t}function Mx(e,t){let i=new Tt(2);return i[0]=e,i[1]=t,i}function Cx(e,t){return e[0]=t[0],e[1]=t[1],e}function Ix(e,t,i){return e[0]=t,e[1]=i,e}function Ox(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function yp(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function xp(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e}function vp(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e}function Nx(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function Dx(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function Fx(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e}function Bx(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e}function Lx(e,t){return e[0]=ee(t[0]),e[1]=ee(t[1]),e}function kx(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function Ux(e,t,i,n){return e[0]=t[0]+i[0]*n,e[1]=t[1]+i[1]*n,e}function Ep(e,t){let i=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(i*i+n*n)}function Sp(e,t){let i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function bp(e){let t=e[0],i=e[1];return Math.sqrt(t*t+i*i)}function Ap(e){let t=e[0],i=e[1];return t*t+i*i}function zx(e,t){return e[0]=-t[0],e[1]=-t[1],e}function Vx(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function Wx(e,t){let i=t[0],n=t[1],o=i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e}function Hx(e,t){return e[0]*t[0]+e[1]*t[1]}function jx(e,t,i){let n=t[0]*i[1]-t[1]*i[0];return e[0]=e[1]=0,e[2]=n,e}function Xx(e,t,i,n){let o=t[0],a=t[1];return e[0]=o+n*(i[0]-o),e[1]=a+n*(i[1]-a),e}function Zx(e,t){t=t===void 0?1:t;let i=ve()*2*Math.PI;return e[0]=Math.cos(i)*t,e[1]=Math.sin(i)*t,e}function $x(e,t,i){let n=t[0],o=t[1];return e[0]=i[0]*n+i[2]*o,e[1]=i[1]*n+i[3]*o,e}function Yx(e,t,i){let n=t[0],o=t[1];return e[0]=i[0]*n+i[2]*o+i[4],e[1]=i[1]*n+i[3]*o+i[5],e}function Kx(e,t,i){let n=t[0],o=t[1];return e[0]=i[0]*n+i[3]*o+i[6],e[1]=i[1]*n+i[4]*o+i[7],e}function ul(e,t,i){let n=t[0],o=t[1];return e[0]=i[0]*n+i[4]*o+i[12],e[1]=i[1]*n+i[5]*o+i[13],e}function qx(e,t,i,n){let o=t[0]-i[0],a=t[1]-i[1],l=Math.sin(n),h=Math.cos(n);return e[0]=o*h-a*l+i[0],e[1]=o*l+a*h+i[1],e}function Jx(e,t){let i=e[0],n=e[1],o=t[0],a=t[1],l=Math.sqrt((i*i+n*n)*(o*o+a*a)),h=l&&(i*o+n*a)/l;return Math.acos(Math.min(Math.max(h,-1),1))}function Qx(e){return e[0]=0,e[1]=0,e}function Gx(e){return`vec2(${e[0]}, ${e[1]})`}function tv(e,t){return e[0]===t[0]&&e[1]===t[1]}function ev(e,t){let i=e[0],n=e[1],o=t[0],a=t[1];return Math.abs(i-o)<=1e-6*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-a)<=1e-6*Math.max(1,Math.abs(n),Math.abs(a))}var iv=bp,rv=yp,nv=xp,ov=vp,sv=Ep,av=Sp,cv=Ap,lv=function(){let e=Tp();return function(t,i,n,o,a,l){let h,u;for(i||(i=2),n||(n=0),o?u=Math.min(o*i+n,t.length):u=t.length,h=n;h<u;h+=i)e[0]=t[h],e[1]=t[h+1],a(e,e,l),t[h]=e[0],t[h+1]=e[1];return t}}();function Rp(e,t,i){let n=t[0],o=t[1],a=i[3]*n+i[7]*o||1;return e[0]=(i[0]*n+i[4]*o)/a,e[1]=(i[1]*n+i[5]*o)/a,e}function is(e,t,i){let n=t[0],o=t[1],a=t[2],l=i[3]*n+i[7]*o+i[11]*a||1;return e[0]=(i[0]*n+i[4]*o+i[8]*a)/l,e[1]=(i[1]*n+i[5]*o+i[9]*a)/l,e[2]=(i[2]*n+i[6]*o+i[10]*a)/l,e}function wp(e,t,i){let n=t[0],o=t[1];return e[0]=i[0]*n+i[2]*o,e[1]=i[1]*n+i[3]*o,e[2]=t[2],e}var gn={};pi(gn,{add:()=>pv,angle:()=>xl,bezier:()=>Pv,ceil:()=>_v,clone:()=>hv,copy:()=>uv,create:()=>Pp,cross:()=>pl,dist:()=>Lv,distance:()=>Np,div:()=>Bv,divide:()=>Op,dot:()=>dl,equals:()=>Nv,exactEquals:()=>Ov,floor:()=>mv,forEach:()=>Vv,fromValues:()=>fv,hermite:()=>wv,inverse:()=>Sv,len:()=>Uv,length:()=>Mp,lerp:()=>Av,max:()=>Tv,min:()=>gv,mul:()=>Fv,multiply:()=>Ip,negate:()=>Ev,normalize:()=>bv,random:()=>Mv,rotateX:()=>gl,rotateY:()=>Tl,rotateZ:()=>yl,round:()=>yv,scale:()=>xv,scaleAndAdd:()=>vv,set:()=>dv,slerp:()=>Rv,sqrDist:()=>kv,sqrLen:()=>zv,squaredDistance:()=>Dp,squaredLength:()=>Fp,str:()=>Iv,sub:()=>Dv,subtract:()=>Cp,transformMat3:()=>_l,transformMat4:()=>mn,transformQuat:()=>ml,zero:()=>Cv});function Pp(){let e=new Tt(3);return Tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function hv(e){let t=new Tt(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Mp(e){let t=e[0],i=e[1],n=e[2];return Math.sqrt(t*t+i*i+n*n)}function fv(e,t,i){let n=new Tt(3);return n[0]=e,n[1]=t,n[2]=i,n}function uv(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function dv(e,t,i,n){return e[0]=t,e[1]=i,e[2]=n,e}function pv(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function Cp(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function Ip(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function Op(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e}function _v(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function mv(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function gv(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e}function Tv(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e}function yv(e,t){return e[0]=ee(t[0]),e[1]=ee(t[1]),e[2]=ee(t[2]),e}function xv(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function vv(e,t,i,n){return e[0]=t[0]+i[0]*n,e[1]=t[1]+i[1]*n,e[2]=t[2]+i[2]*n,e}function Np(e,t){let i=t[0]-e[0],n=t[1]-e[1],o=t[2]-e[2];return Math.sqrt(i*i+n*n+o*o)}function Dp(e,t){let i=t[0]-e[0],n=t[1]-e[1],o=t[2]-e[2];return i*i+n*n+o*o}function Fp(e){let t=e[0],i=e[1],n=e[2];return t*t+i*i+n*n}function Ev(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function Sv(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function bv(e,t){let i=t[0],n=t[1],o=t[2],a=i*i+n*n+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function dl(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function pl(e,t,i){let n=t[0],o=t[1],a=t[2],l=i[0],h=i[1],u=i[2];return e[0]=o*u-a*h,e[1]=a*l-n*u,e[2]=n*h-o*l,e}function Av(e,t,i,n){let o=t[0],a=t[1],l=t[2];return e[0]=o+n*(i[0]-o),e[1]=a+n*(i[1]-a),e[2]=l+n*(i[2]-l),e}function Rv(e,t,i,n){let o=Math.acos(Math.min(Math.max(dl(t,i),-1),1)),a=Math.sin(o),l=Math.sin((1-n)*o)/a,h=Math.sin(n*o)/a;return e[0]=l*t[0]+h*i[0],e[1]=l*t[1]+h*i[1],e[2]=l*t[2]+h*i[2],e}function wv(e,t,i,n,o,a){let l=a*a,h=l*(2*a-3)+1,u=l*(a-2)+a,p=l*(a-1),m=l*(3-2*a);return e[0]=t[0]*h+i[0]*u+n[0]*p+o[0]*m,e[1]=t[1]*h+i[1]*u+n[1]*p+o[1]*m,e[2]=t[2]*h+i[2]*u+n[2]*p+o[2]*m,e}function Pv(e,t,i,n,o,a){let l=1-a,h=l*l,u=a*a,p=h*l,m=3*a*h,g=3*u*l,T=u*a;return e[0]=t[0]*p+i[0]*m+n[0]*g+o[0]*T,e[1]=t[1]*p+i[1]*m+n[1]*g+o[1]*T,e[2]=t[2]*p+i[2]*m+n[2]*g+o[2]*T,e}function Mv(e,t){t=t===void 0?1:t;let i=ve()*2*Math.PI,n=ve()*2-1,o=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(i)*o,e[1]=Math.sin(i)*o,e[2]=n*t,e}function mn(e,t,i){let n=t[0],o=t[1],a=t[2],l=i[3]*n+i[7]*o+i[11]*a+i[15];return l=l||1,e[0]=(i[0]*n+i[4]*o+i[8]*a+i[12])/l,e[1]=(i[1]*n+i[5]*o+i[9]*a+i[13])/l,e[2]=(i[2]*n+i[6]*o+i[10]*a+i[14])/l,e}function _l(e,t,i){let n=t[0],o=t[1],a=t[2];return e[0]=n*i[0]+o*i[3]+a*i[6],e[1]=n*i[1]+o*i[4]+a*i[7],e[2]=n*i[2]+o*i[5]+a*i[8],e}function ml(e,t,i){let n=i[0],o=i[1],a=i[2],l=i[3],h=t[0],u=t[1],p=t[2],m=o*p-a*u,g=a*h-n*p,T=n*u-o*h,y=o*T-a*g,E=a*m-n*T,S=n*g-o*m,v=l*2;return m*=v,g*=v,T*=v,y*=2,E*=2,S*=2,e[0]=h+m+y,e[1]=u+g+E,e[2]=p+T+S,e}function gl(e,t,i,n){let o=[],a=[];return o[0]=t[0]-i[0],o[1]=t[1]-i[1],o[2]=t[2]-i[2],a[0]=o[0],a[1]=o[1]*Math.cos(n)-o[2]*Math.sin(n),a[2]=o[1]*Math.sin(n)+o[2]*Math.cos(n),e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function Tl(e,t,i,n){let o=[],a=[];return o[0]=t[0]-i[0],o[1]=t[1]-i[1],o[2]=t[2]-i[2],a[0]=o[2]*Math.sin(n)+o[0]*Math.cos(n),a[1]=o[1],a[2]=o[2]*Math.cos(n)-o[0]*Math.sin(n),e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function yl(e,t,i,n){let o=[],a=[];return o[0]=t[0]-i[0],o[1]=t[1]-i[1],o[2]=t[2]-i[2],a[0]=o[0]*Math.cos(n)-o[1]*Math.sin(n),a[1]=o[0]*Math.sin(n)+o[1]*Math.cos(n),a[2]=o[2],e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function xl(e,t){let i=e[0],n=e[1],o=e[2],a=t[0],l=t[1],h=t[2],u=Math.sqrt((i*i+n*n+o*o)*(a*a+l*l+h*h)),p=u&&dl(e,t)/u;return Math.acos(Math.min(Math.max(p,-1),1))}function Cv(e){return e[0]=0,e[1]=0,e[2]=0,e}function Iv(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function Ov(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Nv(e,t){let i=e[0],n=e[1],o=e[2],a=t[0],l=t[1],h=t[2];return Math.abs(i-a)<=1e-6*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-l)<=1e-6*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-h)<=1e-6*Math.max(1,Math.abs(o),Math.abs(h))}var Dv=Cp,Fv=Ip,Bv=Op,Lv=Np,kv=Dp,Uv=Mp,zv=Fp,Vv=function(){let e=Pp();return function(t,i,n,o,a,l){let h,u;for(i||(i=3),n||(n=0),o?u=Math.min(o*i+n,t.length):u=t.length,h=n;h<u;h+=i)e[0]=t[h],e[1]=t[h+1],e[2]=t[h+2],a(e,e,l),t[h]=e[0],t[h+1]=e[1],t[h+2]=e[2];return t}}();var vl=[0,0,0],rs,Pt=class extends ts{static get ZERO(){return rs||(rs=new Pt(0,0,0),Object.freeze(rs)),rs}constructor(t=0,i=0,n=0){super(-0,-0,-0),arguments.length===1&&Be(t)?this.copy(t):(wt.debug&&(Nt(t),Nt(i),Nt(n)),this[0]=t,this[1]=i,this[2]=n)}set(t,i,n){return this[0]=t,this[1]=i,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return wt.debug&&(Nt(t.x),Nt(t.y),Nt(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=Nt(t)}angle(t){return xl(this,t)}cross(t){return pl(this,this,t),this.check()}rotateX({radians:t,origin:i=vl}){return gl(this,this,i,t),this.check()}rotateY({radians:t,origin:i=vl}){return Tl(this,this,i,t),this.check()}rotateZ({radians:t,origin:i=vl}){return yl(this,this,i,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return mn(this,this,t),this.check()}transformAsVector(t){return is(this,this,t),this.check()}transformByMatrix3(t){return _l(this,this,t),this.check()}transformByMatrix2(t){return wp(this,this,t),this.check()}transformByQuaternion(t){return ml(this,this,t),this.check()}};var ns=class extends ar{toString(){let t="[";if(wt.printRowMajor){t+="row-major:";for(let i=0;i<this.RANK;++i)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+i]}`}else{t+="column-major:";for(let i=0;i<this.ELEMENTS;++i)t+=` ${this[i]}`}return t+="]",t}getElementIndex(t,i){return i*this.RANK+t}getElement(t,i){return this[i*this.RANK+t]}setElement(t,i,n){return this[i*this.RANK+t]=Nt(n),this}getColumn(t,i=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let o=0;o<this.RANK;++o)i[o]=this[n+o];return i}setColumn(t,i){let n=t*this.RANK;for(let o=0;o<this.RANK;++o)this[n+o]=i[o];return this}};var bt={};pi(bt,{add:()=>u1,adjoint:()=>$v,clone:()=>Hv,copy:()=>jv,create:()=>Wv,decompose:()=>r1,determinant:()=>bl,equals:()=>m1,exactEquals:()=>_1,frob:()=>f1,fromQuat:()=>Il,fromQuat2:()=>t1,fromRotation:()=>qv,fromRotationTranslation:()=>Lp,fromRotationTranslationScale:()=>n1,fromRotationTranslationScaleOrigin:()=>o1,fromScaling:()=>Kv,fromTranslation:()=>Yv,fromValues:()=>Xv,fromXRotation:()=>Jv,fromYRotation:()=>Qv,fromZRotation:()=>Gv,frustum:()=>Ol,getRotation:()=>i1,getScaling:()=>kp,getTranslation:()=>e1,identity:()=>Bp,invert:()=>Sl,lookAt:()=>Fl,mul:()=>g1,multiply:()=>Tn,multiplyScalar:()=>d1,multiplyScalarAndAdd:()=>p1,ortho:()=>Dl,orthoNO:()=>zp,orthoZO:()=>c1,perspective:()=>Nl,perspectiveFromFieldOfView:()=>a1,perspectiveNO:()=>Up,perspectiveZO:()=>s1,rotate:()=>wl,rotateX:()=>Pl,rotateY:()=>Ml,rotateZ:()=>Cl,scale:()=>Rl,set:()=>Zv,str:()=>h1,sub:()=>T1,subtract:()=>Vp,targetTo:()=>l1,translate:()=>Al,transpose:()=>El});function Wv(){let e=new Tt(16);return Tt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Hv(e){let t=new Tt(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],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}function jv(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Xv(e,t,i,n,o,a,l,h,u,p,m,g,T,y,E,S){let v=new Tt(16);return v[0]=e,v[1]=t,v[2]=i,v[3]=n,v[4]=o,v[5]=a,v[6]=l,v[7]=h,v[8]=u,v[9]=p,v[10]=m,v[11]=g,v[12]=T,v[13]=y,v[14]=E,v[15]=S,v}function Zv(e,t,i,n,o,a,l,h,u,p,m,g,T,y,E,S,v){return e[0]=t,e[1]=i,e[2]=n,e[3]=o,e[4]=a,e[5]=l,e[6]=h,e[7]=u,e[8]=p,e[9]=m,e[10]=g,e[11]=T,e[12]=y,e[13]=E,e[14]=S,e[15]=v,e}function Bp(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function El(e,t){if(e===t){let i=t[1],n=t[2],o=t[3],a=t[6],l=t[7],h=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=a,e[11]=t[14],e[12]=o,e[13]=l,e[14]=h}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Sl(e,t){let i=t[0],n=t[1],o=t[2],a=t[3],l=t[4],h=t[5],u=t[6],p=t[7],m=t[8],g=t[9],T=t[10],y=t[11],E=t[12],S=t[13],v=t[14],A=t[15],P=i*h-n*l,w=i*u-o*l,O=i*p-a*l,N=n*u-o*h,C=n*p-a*h,V=o*p-a*u,U=m*S-g*E,D=m*v-T*E,B=m*A-y*E,j=g*v-T*S,Z=g*A-y*S,rt=T*A-y*v,X=P*rt-w*Z+O*j+N*B-C*D+V*U;return X?(X=1/X,e[0]=(h*rt-u*Z+p*j)*X,e[1]=(o*Z-n*rt-a*j)*X,e[2]=(S*V-v*C+A*N)*X,e[3]=(T*C-g*V-y*N)*X,e[4]=(u*B-l*rt-p*D)*X,e[5]=(i*rt-o*B+a*D)*X,e[6]=(v*O-E*V-A*w)*X,e[7]=(m*V-T*O+y*w)*X,e[8]=(l*Z-h*B+p*U)*X,e[9]=(n*B-i*Z-a*U)*X,e[10]=(E*C-S*O+A*P)*X,e[11]=(g*O-m*C-y*P)*X,e[12]=(h*D-l*j-u*U)*X,e[13]=(i*j-n*D+o*U)*X,e[14]=(S*w-E*N-v*P)*X,e[15]=(m*N-g*w+T*P)*X,e):null}function $v(e,t){let i=t[0],n=t[1],o=t[2],a=t[3],l=t[4],h=t[5],u=t[6],p=t[7],m=t[8],g=t[9],T=t[10],y=t[11],E=t[12],S=t[13],v=t[14],A=t[15],P=i*h-n*l,w=i*u-o*l,O=i*p-a*l,N=n*u-o*h,C=n*p-a*h,V=o*p-a*u,U=m*S-g*E,D=m*v-T*E,B=m*A-y*E,j=g*v-T*S,Z=g*A-y*S,rt=T*A-y*v;return e[0]=h*rt-u*Z+p*j,e[1]=o*Z-n*rt-a*j,e[2]=S*V-v*C+A*N,e[3]=T*C-g*V-y*N,e[4]=u*B-l*rt-p*D,e[5]=i*rt-o*B+a*D,e[6]=v*O-E*V-A*w,e[7]=m*V-T*O+y*w,e[8]=l*Z-h*B+p*U,e[9]=n*B-i*Z-a*U,e[10]=E*C-S*O+A*P,e[11]=g*O-m*C-y*P,e[12]=h*D-l*j-u*U,e[13]=i*j-n*D+o*U,e[14]=S*w-E*N-v*P,e[15]=m*N-g*w+T*P,e}function bl(e){let t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],l=e[5],h=e[6],u=e[7],p=e[8],m=e[9],g=e[10],T=e[11],y=e[12],E=e[13],S=e[14],v=e[15],A=t*l-i*a,P=t*h-n*a,w=i*h-n*l,O=p*E-m*y,N=p*S-g*y,C=m*S-g*E,V=t*C-i*N+n*O,U=a*C-l*N+h*O,D=p*w-m*P+g*A,B=y*w-E*P+S*A;return u*V-o*U+v*D-T*B}function Tn(e,t,i){let n=t[0],o=t[1],a=t[2],l=t[3],h=t[4],u=t[5],p=t[6],m=t[7],g=t[8],T=t[9],y=t[10],E=t[11],S=t[12],v=t[13],A=t[14],P=t[15],w=i[0],O=i[1],N=i[2],C=i[3];return e[0]=w*n+O*h+N*g+C*S,e[1]=w*o+O*u+N*T+C*v,e[2]=w*a+O*p+N*y+C*A,e[3]=w*l+O*m+N*E+C*P,w=i[4],O=i[5],N=i[6],C=i[7],e[4]=w*n+O*h+N*g+C*S,e[5]=w*o+O*u+N*T+C*v,e[6]=w*a+O*p+N*y+C*A,e[7]=w*l+O*m+N*E+C*P,w=i[8],O=i[9],N=i[10],C=i[11],e[8]=w*n+O*h+N*g+C*S,e[9]=w*o+O*u+N*T+C*v,e[10]=w*a+O*p+N*y+C*A,e[11]=w*l+O*m+N*E+C*P,w=i[12],O=i[13],N=i[14],C=i[15],e[12]=w*n+O*h+N*g+C*S,e[13]=w*o+O*u+N*T+C*v,e[14]=w*a+O*p+N*y+C*A,e[15]=w*l+O*m+N*E+C*P,e}function Al(e,t,i){let n=i[0],o=i[1],a=i[2],l,h,u,p,m,g,T,y,E,S,v,A;return t===e?(e[12]=t[0]*n+t[4]*o+t[8]*a+t[12],e[13]=t[1]*n+t[5]*o+t[9]*a+t[13],e[14]=t[2]*n+t[6]*o+t[10]*a+t[14],e[15]=t[3]*n+t[7]*o+t[11]*a+t[15]):(l=t[0],h=t[1],u=t[2],p=t[3],m=t[4],g=t[5],T=t[6],y=t[7],E=t[8],S=t[9],v=t[10],A=t[11],e[0]=l,e[1]=h,e[2]=u,e[3]=p,e[4]=m,e[5]=g,e[6]=T,e[7]=y,e[8]=E,e[9]=S,e[10]=v,e[11]=A,e[12]=l*n+m*o+E*a+t[12],e[13]=h*n+g*o+S*a+t[13],e[14]=u*n+T*o+v*a+t[14],e[15]=p*n+y*o+A*a+t[15]),e}function Rl(e,t,i){let n=i[0],o=i[1],a=i[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function wl(e,t,i,n){let o=n[0],a=n[1],l=n[2],h=Math.sqrt(o*o+a*a+l*l),u,p,m,g,T,y,E,S,v,A,P,w,O,N,C,V,U,D,B,j,Z,rt,X,mt;return h<1e-6?null:(h=1/h,o*=h,a*=h,l*=h,p=Math.sin(i),u=Math.cos(i),m=1-u,g=t[0],T=t[1],y=t[2],E=t[3],S=t[4],v=t[5],A=t[6],P=t[7],w=t[8],O=t[9],N=t[10],C=t[11],V=o*o*m+u,U=a*o*m+l*p,D=l*o*m-a*p,B=o*a*m-l*p,j=a*a*m+u,Z=l*a*m+o*p,rt=o*l*m+a*p,X=a*l*m-o*p,mt=l*l*m+u,e[0]=g*V+S*U+w*D,e[1]=T*V+v*U+O*D,e[2]=y*V+A*U+N*D,e[3]=E*V+P*U+C*D,e[4]=g*B+S*j+w*Z,e[5]=T*B+v*j+O*Z,e[6]=y*B+A*j+N*Z,e[7]=E*B+P*j+C*Z,e[8]=g*rt+S*X+w*mt,e[9]=T*rt+v*X+O*mt,e[10]=y*rt+A*X+N*mt,e[11]=E*rt+P*X+C*mt,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Pl(e,t,i){let n=Math.sin(i),o=Math.cos(i),a=t[4],l=t[5],h=t[6],u=t[7],p=t[8],m=t[9],g=t[10],T=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*o+p*n,e[5]=l*o+m*n,e[6]=h*o+g*n,e[7]=u*o+T*n,e[8]=p*o-a*n,e[9]=m*o-l*n,e[10]=g*o-h*n,e[11]=T*o-u*n,e}function Ml(e,t,i){let n=Math.sin(i),o=Math.cos(i),a=t[0],l=t[1],h=t[2],u=t[3],p=t[8],m=t[9],g=t[10],T=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*o-p*n,e[1]=l*o-m*n,e[2]=h*o-g*n,e[3]=u*o-T*n,e[8]=a*n+p*o,e[9]=l*n+m*o,e[10]=h*n+g*o,e[11]=u*n+T*o,e}function Cl(e,t,i){let n=Math.sin(i),o=Math.cos(i),a=t[0],l=t[1],h=t[2],u=t[3],p=t[4],m=t[5],g=t[6],T=t[7];return t!==e&&(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[0]=a*o+p*n,e[1]=l*o+m*n,e[2]=h*o+g*n,e[3]=u*o+T*n,e[4]=p*o-a*n,e[5]=m*o-l*n,e[6]=g*o-h*n,e[7]=T*o-u*n,e}function Yv(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function Kv(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function qv(e,t,i){let n=i[0],o=i[1],a=i[2],l=Math.sqrt(n*n+o*o+a*a),h,u,p;return l<1e-6?null:(l=1/l,n*=l,o*=l,a*=l,u=Math.sin(t),h=Math.cos(t),p=1-h,e[0]=n*n*p+h,e[1]=o*n*p+a*u,e[2]=a*n*p-o*u,e[3]=0,e[4]=n*o*p-a*u,e[5]=o*o*p+h,e[6]=a*o*p+n*u,e[7]=0,e[8]=n*a*p+o*u,e[9]=o*a*p-n*u,e[10]=a*a*p+h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function Jv(e,t){let i=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=i,e[7]=0,e[8]=0,e[9]=-i,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Qv(e,t){let i=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-i,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=i,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Gv(e,t){let i=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=i,e[2]=0,e[3]=0,e[4]=-i,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Lp(e,t,i){let n=t[0],o=t[1],a=t[2],l=t[3],h=n+n,u=o+o,p=a+a,m=n*h,g=n*u,T=n*p,y=o*u,E=o*p,S=a*p,v=l*h,A=l*u,P=l*p;return e[0]=1-(y+S),e[1]=g+P,e[2]=T-A,e[3]=0,e[4]=g-P,e[5]=1-(m+S),e[6]=E+v,e[7]=0,e[8]=T+A,e[9]=E-v,e[10]=1-(m+y),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function t1(e,t){let i=new Tt(3),n=-t[0],o=-t[1],a=-t[2],l=t[3],h=t[4],u=t[5],p=t[6],m=t[7],g=n*n+o*o+a*a+l*l;return g>0?(i[0]=(h*l+m*n+u*a-p*o)*2/g,i[1]=(u*l+m*o+p*n-h*a)*2/g,i[2]=(p*l+m*a+h*o-u*n)*2/g):(i[0]=(h*l+m*n+u*a-p*o)*2,i[1]=(u*l+m*o+p*n-h*a)*2,i[2]=(p*l+m*a+h*o-u*n)*2),Lp(e,t,i),e}function e1(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function kp(e,t){let i=t[0],n=t[1],o=t[2],a=t[4],l=t[5],h=t[6],u=t[8],p=t[9],m=t[10];return e[0]=Math.sqrt(i*i+n*n+o*o),e[1]=Math.sqrt(a*a+l*l+h*h),e[2]=Math.sqrt(u*u+p*p+m*m),e}function i1(e,t){let i=new Tt(3);kp(i,t);let n=1/i[0],o=1/i[1],a=1/i[2],l=t[0]*n,h=t[1]*o,u=t[2]*a,p=t[4]*n,m=t[5]*o,g=t[6]*a,T=t[8]*n,y=t[9]*o,E=t[10]*a,S=l+m+E,v=0;return S>0?(v=Math.sqrt(S+1)*2,e[3]=.25*v,e[0]=(g-y)/v,e[1]=(T-u)/v,e[2]=(h-p)/v):l>m&&l>E?(v=Math.sqrt(1+l-m-E)*2,e[3]=(g-y)/v,e[0]=.25*v,e[1]=(h+p)/v,e[2]=(T+u)/v):m>E?(v=Math.sqrt(1+m-l-E)*2,e[3]=(T-u)/v,e[0]=(h+p)/v,e[1]=.25*v,e[2]=(g+y)/v):(v=Math.sqrt(1+E-l-m)*2,e[3]=(h-p)/v,e[0]=(T+u)/v,e[1]=(g+y)/v,e[2]=.25*v),e}function r1(e,t,i,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];let o=n[0],a=n[1],l=n[2],h=n[4],u=n[5],p=n[6],m=n[8],g=n[9],T=n[10];i[0]=Math.sqrt(o*o+a*a+l*l),i[1]=Math.sqrt(h*h+u*u+p*p),i[2]=Math.sqrt(m*m+g*g+T*T);let y=1/i[0],E=1/i[1],S=1/i[2],v=o*y,A=a*E,P=l*S,w=h*y,O=u*E,N=p*S,C=m*y,V=g*E,U=T*S,D=v+O+U,B=0;return D>0?(B=Math.sqrt(D+1)*2,e[3]=.25*B,e[0]=(N-V)/B,e[1]=(C-P)/B,e[2]=(A-w)/B):v>O&&v>U?(B=Math.sqrt(1+v-O-U)*2,e[3]=(N-V)/B,e[0]=.25*B,e[1]=(A+w)/B,e[2]=(C+P)/B):O>U?(B=Math.sqrt(1+O-v-U)*2,e[3]=(C-P)/B,e[0]=(A+w)/B,e[1]=.25*B,e[2]=(N+V)/B):(B=Math.sqrt(1+U-v-O)*2,e[3]=(A-w)/B,e[0]=(C+P)/B,e[1]=(N+V)/B,e[2]=.25*B),e}function n1(e,t,i,n){let o=t[0],a=t[1],l=t[2],h=t[3],u=o+o,p=a+a,m=l+l,g=o*u,T=o*p,y=o*m,E=a*p,S=a*m,v=l*m,A=h*u,P=h*p,w=h*m,O=n[0],N=n[1],C=n[2];return e[0]=(1-(E+v))*O,e[1]=(T+w)*O,e[2]=(y-P)*O,e[3]=0,e[4]=(T-w)*N,e[5]=(1-(g+v))*N,e[6]=(S+A)*N,e[7]=0,e[8]=(y+P)*C,e[9]=(S-A)*C,e[10]=(1-(g+E))*C,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function o1(e,t,i,n,o){let a=t[0],l=t[1],h=t[2],u=t[3],p=a+a,m=l+l,g=h+h,T=a*p,y=a*m,E=a*g,S=l*m,v=l*g,A=h*g,P=u*p,w=u*m,O=u*g,N=n[0],C=n[1],V=n[2],U=o[0],D=o[1],B=o[2],j=(1-(S+A))*N,Z=(y+O)*N,rt=(E-w)*N,X=(y-O)*C,mt=(1-(T+A))*C,Y=(v+P)*C,Ze=(E+w)*V,K=(v-P)*V,ht=(1-(T+S))*V;return e[0]=j,e[1]=Z,e[2]=rt,e[3]=0,e[4]=X,e[5]=mt,e[6]=Y,e[7]=0,e[8]=Ze,e[9]=K,e[10]=ht,e[11]=0,e[12]=i[0]+U-(j*U+X*D+Ze*B),e[13]=i[1]+D-(Z*U+mt*D+K*B),e[14]=i[2]+B-(rt*U+Y*D+ht*B),e[15]=1,e}function Il(e,t){let i=t[0],n=t[1],o=t[2],a=t[3],l=i+i,h=n+n,u=o+o,p=i*l,m=n*l,g=n*h,T=o*l,y=o*h,E=o*u,S=a*l,v=a*h,A=a*u;return e[0]=1-g-E,e[1]=m+A,e[2]=T-v,e[3]=0,e[4]=m-A,e[5]=1-p-E,e[6]=y+S,e[7]=0,e[8]=T+v,e[9]=y-S,e[10]=1-p-g,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ol(e,t,i,n,o,a,l){let h=1/(i-t),u=1/(o-n),p=1/(a-l);return e[0]=a*2*h,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*u,e[6]=0,e[7]=0,e[8]=(i+t)*h,e[9]=(o+n)*u,e[10]=(l+a)*p,e[11]=-1,e[12]=0,e[13]=0,e[14]=l*a*2*p,e[15]=0,e}function Up(e,t,i,n,o){let a=1/Math.tan(t/2);if(e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,o!=null&&o!==1/0){let l=1/(n-o);e[10]=(o+n)*l,e[14]=2*o*n*l}else e[10]=-1,e[14]=-2*n;return e}var Nl=Up;function s1(e,t,i,n,o){let a=1/Math.tan(t/2);if(e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,o!=null&&o!==1/0){let l=1/(n-o);e[10]=o*l,e[14]=o*n*l}else e[10]=-1,e[14]=-n;return e}function a1(e,t,i,n){let o=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),l=Math.tan(t.leftDegrees*Math.PI/180),h=Math.tan(t.rightDegrees*Math.PI/180),u=2/(l+h),p=2/(o+a);return e[0]=u,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=p,e[6]=0,e[7]=0,e[8]=-((l-h)*u*.5),e[9]=(o-a)*p*.5,e[10]=n/(i-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*i/(i-n),e[15]=0,e}function zp(e,t,i,n,o,a,l){let h=1/(t-i),u=1/(n-o),p=1/(a-l);return e[0]=-2*h,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*p,e[11]=0,e[12]=(t+i)*h,e[13]=(o+n)*u,e[14]=(l+a)*p,e[15]=1,e}var Dl=zp;function c1(e,t,i,n,o,a,l){let h=1/(t-i),u=1/(n-o),p=1/(a-l);return e[0]=-2*h,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=p,e[11]=0,e[12]=(t+i)*h,e[13]=(o+n)*u,e[14]=a*p,e[15]=1,e}function Fl(e,t,i,n){let o,a,l,h,u,p,m,g,T,y,E=t[0],S=t[1],v=t[2],A=n[0],P=n[1],w=n[2],O=i[0],N=i[1],C=i[2];return Math.abs(E-O)<1e-6&&Math.abs(S-N)<1e-6&&Math.abs(v-C)<1e-6?Bp(e):(g=E-O,T=S-N,y=v-C,o=1/Math.sqrt(g*g+T*T+y*y),g*=o,T*=o,y*=o,a=P*y-w*T,l=w*g-A*y,h=A*T-P*g,o=Math.sqrt(a*a+l*l+h*h),o?(o=1/o,a*=o,l*=o,h*=o):(a=0,l=0,h=0),u=T*h-y*l,p=y*a-g*h,m=g*l-T*a,o=Math.sqrt(u*u+p*p+m*m),o?(o=1/o,u*=o,p*=o,m*=o):(u=0,p=0,m=0),e[0]=a,e[1]=u,e[2]=g,e[3]=0,e[4]=l,e[5]=p,e[6]=T,e[7]=0,e[8]=h,e[9]=m,e[10]=y,e[11]=0,e[12]=-(a*E+l*S+h*v),e[13]=-(u*E+p*S+m*v),e[14]=-(g*E+T*S+y*v),e[15]=1,e)}function l1(e,t,i,n){let o=t[0],a=t[1],l=t[2],h=n[0],u=n[1],p=n[2],m=o-i[0],g=a-i[1],T=l-i[2],y=m*m+g*g+T*T;y>0&&(y=1/Math.sqrt(y),m*=y,g*=y,T*=y);let E=u*T-p*g,S=p*m-h*T,v=h*g-u*m;return y=E*E+S*S+v*v,y>0&&(y=1/Math.sqrt(y),E*=y,S*=y,v*=y),e[0]=E,e[1]=S,e[2]=v,e[3]=0,e[4]=g*v-T*S,e[5]=T*E-m*v,e[6]=m*S-g*E,e[7]=0,e[8]=m,e[9]=g,e[10]=T,e[11]=0,e[12]=o,e[13]=a,e[14]=l,e[15]=1,e}function h1(e){return`mat4(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]}, ${e[4]}, ${e[5]}, ${e[6]}, ${e[7]}, ${e[8]}, ${e[9]}, ${e[10]}, ${e[11]}, ${e[12]}, ${e[13]}, ${e[14]}, ${e[15]})`}function f1(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}function u1(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e[9]=t[9]+i[9],e[10]=t[10]+i[10],e[11]=t[11]+i[11],e[12]=t[12]+i[12],e[13]=t[13]+i[13],e[14]=t[14]+i[14],e[15]=t[15]+i[15],e}function Vp(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e[9]=t[9]-i[9],e[10]=t[10]-i[10],e[11]=t[11]-i[11],e[12]=t[12]-i[12],e[13]=t[13]-i[13],e[14]=t[14]-i[14],e[15]=t[15]-i[15],e}function d1(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12]*i,e[13]=t[13]*i,e[14]=t[14]*i,e[15]=t[15]*i,e}function p1(e,t,i,n){return e[0]=t[0]+i[0]*n,e[1]=t[1]+i[1]*n,e[2]=t[2]+i[2]*n,e[3]=t[3]+i[3]*n,e[4]=t[4]+i[4]*n,e[5]=t[5]+i[5]*n,e[6]=t[6]+i[6]*n,e[7]=t[7]+i[7]*n,e[8]=t[8]+i[8]*n,e[9]=t[9]+i[9]*n,e[10]=t[10]+i[10]*n,e[11]=t[11]+i[11]*n,e[12]=t[12]+i[12]*n,e[13]=t[13]+i[13]*n,e[14]=t[14]+i[14]*n,e[15]=t[15]+i[15]*n,e}function _1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function m1(e,t){let i=e[0],n=e[1],o=e[2],a=e[3],l=e[4],h=e[5],u=e[6],p=e[7],m=e[8],g=e[9],T=e[10],y=e[11],E=e[12],S=e[13],v=e[14],A=e[15],P=t[0],w=t[1],O=t[2],N=t[3],C=t[4],V=t[5],U=t[6],D=t[7],B=t[8],j=t[9],Z=t[10],rt=t[11],X=t[12],mt=t[13],Y=t[14],Ze=t[15];return Math.abs(i-P)<=1e-6*Math.max(1,Math.abs(i),Math.abs(P))&&Math.abs(n-w)<=1e-6*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(o-O)<=1e-6*Math.max(1,Math.abs(o),Math.abs(O))&&Math.abs(a-N)<=1e-6*Math.max(1,Math.abs(a),Math.abs(N))&&Math.abs(l-C)<=1e-6*Math.max(1,Math.abs(l),Math.abs(C))&&Math.abs(h-V)<=1e-6*Math.max(1,Math.abs(h),Math.abs(V))&&Math.abs(u-U)<=1e-6*Math.max(1,Math.abs(u),Math.abs(U))&&Math.abs(p-D)<=1e-6*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(m-B)<=1e-6*Math.max(1,Math.abs(m),Math.abs(B))&&Math.abs(g-j)<=1e-6*Math.max(1,Math.abs(g),Math.abs(j))&&Math.abs(T-Z)<=1e-6*Math.max(1,Math.abs(T),Math.abs(Z))&&Math.abs(y-rt)<=1e-6*Math.max(1,Math.abs(y),Math.abs(rt))&&Math.abs(E-X)<=1e-6*Math.max(1,Math.abs(E),Math.abs(X))&&Math.abs(S-mt)<=1e-6*Math.max(1,Math.abs(S),Math.abs(mt))&&Math.abs(v-Y)<=1e-6*Math.max(1,Math.abs(v),Math.abs(Y))&&Math.abs(A-Ze)<=1e-6*Math.max(1,Math.abs(A),Math.abs(Ze))}var g1=Tn,T1=Vp;var ke={};pi(ke,{add:()=>S1,ceil:()=>b1,clone:()=>y1,copy:()=>v1,create:()=>Wp,cross:()=>F1,dist:()=>Z1,distance:()=>Zp,div:()=>X1,divide:()=>Xp,dot:()=>D1,equals:()=>W1,exactEquals:()=>V1,floor:()=>A1,forEach:()=>q1,fromValues:()=>x1,inverse:()=>O1,len:()=>Y1,length:()=>Yp,lerp:()=>B1,max:()=>w1,min:()=>R1,mul:()=>j1,multiply:()=>jp,negate:()=>I1,normalize:()=>N1,random:()=>L1,round:()=>P1,scale:()=>M1,scaleAndAdd:()=>C1,set:()=>E1,sqrDist:()=>$1,sqrLen:()=>K1,squaredDistance:()=>$p,squaredLength:()=>Kp,str:()=>z1,sub:()=>H1,subtract:()=>Hp,transformMat4:()=>Bl,transformQuat:()=>k1,zero:()=>U1});function Wp(){let e=new Tt(4);return Tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function y1(e){let t=new Tt(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function x1(e,t,i,n){let o=new Tt(4);return o[0]=e,o[1]=t,o[2]=i,o[3]=n,o}function v1(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function E1(e,t,i,n,o){return e[0]=t,e[1]=i,e[2]=n,e[3]=o,e}function S1(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e}function Hp(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function jp(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function Xp(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e[3]=t[3]/i[3],e}function b1(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function A1(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function R1(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e[3]=Math.min(t[3],i[3]),e}function w1(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e[3]=Math.max(t[3],i[3]),e}function P1(e,t){return e[0]=ee(t[0]),e[1]=ee(t[1]),e[2]=ee(t[2]),e[3]=ee(t[3]),e}function M1(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function C1(e,t,i,n){return e[0]=t[0]+i[0]*n,e[1]=t[1]+i[1]*n,e[2]=t[2]+i[2]*n,e[3]=t[3]+i[3]*n,e}function Zp(e,t){let i=t[0]-e[0],n=t[1]-e[1],o=t[2]-e[2],a=t[3]-e[3];return Math.sqrt(i*i+n*n+o*o+a*a)}function $p(e,t){let i=t[0]-e[0],n=t[1]-e[1],o=t[2]-e[2],a=t[3]-e[3];return i*i+n*n+o*o+a*a}function Yp(e){let t=e[0],i=e[1],n=e[2],o=e[3];return Math.sqrt(t*t+i*i+n*n+o*o)}function Kp(e){let t=e[0],i=e[1],n=e[2],o=e[3];return t*t+i*i+n*n+o*o}function I1(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function O1(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function N1(e,t){let i=t[0],n=t[1],o=t[2],a=t[3],l=i*i+n*n+o*o+a*a;return l>0&&(l=1/Math.sqrt(l)),e[0]=i*l,e[1]=n*l,e[2]=o*l,e[3]=a*l,e}function D1(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function F1(e,t,i,n){let o=i[0]*n[1]-i[1]*n[0],a=i[0]*n[2]-i[2]*n[0],l=i[0]*n[3]-i[3]*n[0],h=i[1]*n[2]-i[2]*n[1],u=i[1]*n[3]-i[3]*n[1],p=i[2]*n[3]-i[3]*n[2],m=t[0],g=t[1],T=t[2],y=t[3];return e[0]=g*p-T*u+y*h,e[1]=-(m*p)+T*l-y*a,e[2]=m*u-g*l+y*o,e[3]=-(m*h)+g*a-T*o,e}function B1(e,t,i,n){let o=t[0],a=t[1],l=t[2],h=t[3];return e[0]=o+n*(i[0]-o),e[1]=a+n*(i[1]-a),e[2]=l+n*(i[2]-l),e[3]=h+n*(i[3]-h),e}function L1(e,t){t=t===void 0?1:t;let i,n,o,a,l,h;do i=ve()*2-1,n=ve()*2-1,l=i*i+n*n;while(l>=1);do o=ve()*2-1,a=ve()*2-1,h=o*o+a*a;while(h>=1);let u=Math.sqrt((1-l)/h);return e[0]=t*i,e[1]=t*n,e[2]=t*o*u,e[3]=t*a*u,e}function Bl(e,t,i){let n=t[0],o=t[1],a=t[2],l=t[3];return e[0]=i[0]*n+i[4]*o+i[8]*a+i[12]*l,e[1]=i[1]*n+i[5]*o+i[9]*a+i[13]*l,e[2]=i[2]*n+i[6]*o+i[10]*a+i[14]*l,e[3]=i[3]*n+i[7]*o+i[11]*a+i[15]*l,e}function k1(e,t,i){let n=t[0],o=t[1],a=t[2],l=i[0],h=i[1],u=i[2],p=i[3],m=p*n+h*a-u*o,g=p*o+u*n-l*a,T=p*a+l*o-h*n,y=-l*n-h*o-u*a;return e[0]=m*p+y*-l+g*-u-T*-h,e[1]=g*p+y*-h+T*-l-m*-u,e[2]=T*p+y*-u+m*-h-g*-l,e[3]=t[3],e}function U1(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function z1(e){return`vec4(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]})`}function V1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function W1(e,t){let i=e[0],n=e[1],o=e[2],a=e[3],l=t[0],h=t[1],u=t[2],p=t[3];return Math.abs(i-l)<=1e-6*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(n-h)<=1e-6*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(o-u)<=1e-6*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(a-p)<=1e-6*Math.max(1,Math.abs(a),Math.abs(p))}var H1=Hp,j1=jp,X1=Xp,Z1=Zp,$1=$p,Y1=Yp,K1=Kp,q1=function(){let e=Wp();return function(t,i,n,o,a,l){let h,u;for(i||(i=4),n||(n=0),o?u=Math.min(o*i+n,t.length):u=t.length,h=n;h<u;h+=i)e[0]=t[h],e[1]=t[h+1],e[2]=t[h+2],e[3]=t[h+3],a(e,e,l),t[h]=e[0],t[h+1]=e[1],t[h+2]=e[2],t[h+3]=e[3];return t}}();var Ul;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(Ul||(Ul={}));var J1=45*Math.PI/180,Q1=1,Ll=.1,kl=500,G1=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Ct=class extends ns{static get IDENTITY(){return eE()}static get ZERO(){return tE()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Ul}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,i,n,o,a,l,h,u,p,m,g,T,y,E,S,v){return this[0]=t,this[1]=i,this[2]=n,this[3]=o,this[4]=a,this[5]=l,this[6]=h,this[7]=u,this[8]=p,this[9]=m,this[10]=g,this[11]=T,this[12]=y,this[13]=E,this[14]=S,this[15]=v,this.check()}setRowMajor(t,i,n,o,a,l,h,u,p,m,g,T,y,E,S,v){return this[0]=t,this[1]=a,this[2]=p,this[3]=y,this[4]=i,this[5]=l,this[6]=m,this[7]=E,this[8]=n,this[9]=h,this[10]=g,this[11]=S,this[12]=o,this[13]=u,this[14]=T,this[15]=v,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(G1)}fromObject(t){return this.check()}fromQuaternion(t){return Il(this,t),this.check()}frustum(t){let{left:i,right:n,bottom:o,top:a,near:l=Ll,far:h=kl}=t;return h===1/0?iE(this,i,n,o,a,l):Ol(this,i,n,o,a,l,h),this.check()}lookAt(t){let{eye:i,center:n=[0,0,0],up:o=[0,1,0]}=t;return Fl(this,i,n,o),this.check()}ortho(t){let{left:i,right:n,bottom:o,top:a,near:l=Ll,far:h=kl}=t;return Dl(this,i,n,o,a,l,h),this.check()}orthographic(t){let{fovy:i=J1,aspect:n=Q1,focalDistance:o=1,near:a=Ll,far:l=kl}=t;qp(i);let h=i/2,u=o*Math.tan(h),p=u*n;return this.ortho({left:-p,right:p,bottom:-u,top:u,near:a,far:l})}perspective(t){let{fovy:i=45*Math.PI/180,aspect:n=1,near:o=.1,far:a=500}=t;return qp(i),Nl(this,i,n,o,a),this.check()}determinant(){return bl(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,i){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],i=i||[-0,-0,-0];let n=this.getScale(i),o=1/n[0],a=1/n[1],l=1/n[2];return t[0]=this[0]*o,t[1]=this[1]*a,t[2]=this[2]*l,t[3]=0,t[4]=this[4]*o,t[5]=this[5]*a,t[6]=this[6]*l,t[7]=0,t[8]=this[8]*o,t[9]=this[9]*a,t[10]=this[10]*l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,i){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],i=i||[-0,-0,-0];let n=this.getScale(i),o=1/n[0],a=1/n[1],l=1/n[2];return t[0]=this[0]*o,t[1]=this[1]*a,t[2]=this[2]*l,t[3]=this[4]*o,t[4]=this[5]*a,t[5]=this[6]*l,t[6]=this[8]*o,t[7]=this[9]*a,t[8]=this[10]*l,t}transpose(){return El(this,this),this.check()}invert(){return Sl(this,this),this.check()}multiplyLeft(t){return Tn(this,t,this),this.check()}multiplyRight(t){return Tn(this,this,t),this.check()}rotateX(t){return Pl(this,this,t),this.check()}rotateY(t){return Ml(this,this,t),this.check()}rotateZ(t){return Cl(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,i){return wl(this,this,t,i),this.check()}scale(t){return Rl(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Al(this,this,t),this.check()}transform(t,i){return t.length===4?(i=Bl(i||[-0,-0,-0,-0],t,this),Go(i,4),i):this.transformAsPoint(t,i)}transformAsPoint(t,i){let{length:n}=t,o;switch(n){case 2:o=ul(i||[-0,-0],t,this);break;case 3:o=mn(i||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Go(o,t.length),o}transformAsVector(t,i){let n;switch(t.length){case 2:n=Rp(i||[-0,-0],t,this);break;case 3:n=is(i||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Go(n,t.length),n}transformPoint(t,i){return this.transformAsPoint(t,i)}transformVector(t,i){return this.transformAsPoint(t,i)}transformDirection(t,i){return this.transformAsVector(t,i)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,i,n){return this.identity().translate([t,i,n])}},os,ss;function tE(){return os||(os=new Ct([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(os)),os}function eE(){return ss||(ss=new Ct,Object.freeze(ss)),ss}function qp(e){if(e>Math.PI*2)throw Error("expected radians")}function iE(e,t,i,n,o,a){let l=2*a/(i-t),h=2*a/(o-n),u=(i+t)/(i-t),p=(o+n)/(o-n),m=-1,g=-1,T=-2*a;return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=h,e[6]=0,e[7]=0,e[8]=u,e[9]=p,e[10]=m,e[11]=g,e[12]=0,e[13]=0,e[14]=T,e[15]=0,e}var rE=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
103
-
104
- // All these functions are for substituting tan() function from Intel GPU only
105
- const float TWO_PI = 6.2831854820251465;
106
- const float PI_2 = 1.5707963705062866;
107
- const float PI_16 = 0.1963495463132858;
108
-
109
- const float SIN_TABLE_0 = 0.19509032368659973;
110
- const float SIN_TABLE_1 = 0.3826834261417389;
111
- const float SIN_TABLE_2 = 0.5555702447891235;
112
- const float SIN_TABLE_3 = 0.7071067690849304;
113
-
114
- const float COS_TABLE_0 = 0.9807852506637573;
115
- const float COS_TABLE_1 = 0.9238795042037964;
116
- const float COS_TABLE_2 = 0.8314695954322815;
117
- const float COS_TABLE_3 = 0.7071067690849304;
118
-
119
- const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01; // 1/3!
120
- const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03; // 1/5!
121
- const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04; // 1/7!
122
- const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06; // 1/9!
123
-
124
- float sin_taylor_fp32(float a) {
125
- float r, s, t, x;
126
-
127
- if (a == 0.0) {
128
- return 0.0;
129
- }
130
-
131
- x = -a * a;
132
- s = a;
133
- r = a;
134
-
135
- r = r * x;
136
- t = r * INVERSE_FACTORIAL_3;
137
- s = s + t;
138
-
139
- r = r * x;
140
- t = r * INVERSE_FACTORIAL_5;
141
- s = s + t;
142
-
143
- r = r * x;
144
- t = r * INVERSE_FACTORIAL_7;
145
- s = s + t;
146
-
147
- r = r * x;
148
- t = r * INVERSE_FACTORIAL_9;
149
- s = s + t;
150
-
151
- return s;
152
- }
153
-
154
- void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {
155
- if (a == 0.0) {
156
- sin_t = 0.0;
157
- cos_t = 1.0;
158
- }
159
- sin_t = sin_taylor_fp32(a);
160
- cos_t = sqrt(1.0 - sin_t * sin_t);
161
- }
162
-
163
- float tan_taylor_fp32(float a) {
164
- float sin_a;
165
- float cos_a;
166
-
167
- if (a == 0.0) {
168
- return 0.0;
169
- }
170
-
171
- // 2pi range reduction
172
- float z = floor(a / TWO_PI);
173
- float r = a - TWO_PI * z;
174
-
175
- float t;
176
- float q = floor(r / PI_2 + 0.5);
177
- int j = int(q);
178
-
179
- if (j < -2 || j > 2) {
180
- return 1.0 / 0.0;
181
- }
182
-
183
- t = r - PI_2 * q;
184
-
185
- q = floor(t / PI_16 + 0.5);
186
- int k = int(q);
187
- int abs_k = int(abs(float(k)));
188
-
189
- if (abs_k > 4) {
190
- return 1.0 / 0.0;
191
- } else {
192
- t = t - PI_16 * q;
193
- }
194
-
195
- float u = 0.0;
196
- float v = 0.0;
197
-
198
- float sin_t, cos_t;
199
- float s, c;
200
- sincos_taylor_fp32(t, sin_t, cos_t);
201
-
202
- if (k == 0) {
203
- s = sin_t;
204
- c = cos_t;
205
- } else {
206
- if (abs(float(abs_k) - 1.0) < 0.5) {
207
- u = COS_TABLE_0;
208
- v = SIN_TABLE_0;
209
- } else if (abs(float(abs_k) - 2.0) < 0.5) {
210
- u = COS_TABLE_1;
211
- v = SIN_TABLE_1;
212
- } else if (abs(float(abs_k) - 3.0) < 0.5) {
213
- u = COS_TABLE_2;
214
- v = SIN_TABLE_2;
215
- } else if (abs(float(abs_k) - 4.0) < 0.5) {
216
- u = COS_TABLE_3;
217
- v = SIN_TABLE_3;
218
- }
219
- if (k > 0) {
220
- s = u * sin_t + v * cos_t;
221
- c = u * cos_t - v * sin_t;
222
- } else {
223
- s = u * sin_t - v * cos_t;
224
- c = u * cos_t + v * sin_t;
225
- }
226
- }
227
-
228
- if (j == 0) {
229
- sin_a = s;
230
- cos_a = c;
231
- } else if (j == 1) {
232
- sin_a = c;
233
- cos_a = -s;
234
- } else if (j == -1) {
235
- sin_a = -c;
236
- cos_a = s;
237
- } else {
238
- sin_a = -s;
239
- cos_a = -c;
240
- }
241
- return sin_a / cos_a;
242
- }
243
- #endif
244
-
245
- float tan_fp32(float a) {
246
- #ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
247
- return tan_taylor_fp32(a);
248
- #else
249
- return tan(a);
250
- #endif
251
- }
252
- `,zl={name:"fp32",vs:rE};var Jp=`uniform layerUniforms {
253
- uniform float opacity;
254
- } layer;
255
- `,Vl={name:"layer",vs:Jp,fs:Jp,getUniforms:e=>({opacity:Math.pow(e.opacity,.45454545454545453)}),uniformTypes:{opacity:"f32"}};var nE=`const SMOOTH_EDGE_RADIUS: f32 = 0.5;
256
-
257
- struct VertexGeometry {
258
- position: vec4<f32>,
259
- worldPosition: vec3<f32>,
260
- worldPositionAlt: vec3<f32>,
261
- normal: vec3<f32>,
262
- uv: vec2<f32>,
263
- pickingColor: vec3<f32>,
264
- };
265
-
266
- var<private> geometry_: VertexGeometry = VertexGeometry(
267
- vec4<f32>(0.0, 0.0, 1.0, 0.0),
268
- vec3<f32>(0.0, 0.0, 0.0),
269
- vec3<f32>(0.0, 0.0, 0.0),
270
- vec3<f32>(0.0, 0.0, 0.0),
271
- vec2<f32>(0.0, 0.0),
272
- vec3<f32>(0.0, 0.0, 0.0)
273
- );
274
-
275
- struct FragmentGeometry {
276
- uv: vec2<f32>,
277
- };
278
-
279
- var<private> fragmentGeometry: FragmentGeometry;
280
-
281
- fn smoothedge(edge: f32, x: f32) -> f32 {
282
- return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);
283
- }
284
- `,Qp="#define SMOOTH_EDGE_RADIUS 0.5",oE=`${Qp}
285
-
286
- struct VertexGeometry {
287
- vec4 position;
288
- vec3 worldPosition;
289
- vec3 worldPositionAlt;
290
- vec3 normal;
291
- vec2 uv;
292
- vec3 pickingColor;
293
- } geometry = VertexGeometry(
294
- vec4(0.0, 0.0, 1.0, 0.0),
295
- vec3(0.0),
296
- vec3(0.0),
297
- vec3(0.0),
298
- vec2(0.0),
299
- vec3(0.0)
300
- );
301
- `,sE=`${Qp}
302
-
303
- struct FragmentGeometry {
304
- vec2 uv;
305
- } geometry;
306
-
307
- float smoothedge(float edge, float x) {
308
- return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);
309
- }
310
- `,as={name:"geometry",source:nE,vs:oE,fs:sE};var ot;(function(e){e[e.Start=1]="Start",e[e.Move=2]="Move",e[e.End=4]="End",e[e.Cancel=8]="Cancel"})(ot||(ot={}));var dt;(function(e){e[e.None=0]="None",e[e.Left=1]="Left",e[e.Right=2]="Right",e[e.Up=4]="Up",e[e.Down=8]="Down",e[e.Horizontal=3]="Horizontal",e[e.Vertical=12]="Vertical",e[e.All=15]="All"})(dt||(dt={}));var H;(function(e){e[e.Possible=1]="Possible",e[e.Began=2]="Began",e[e.Changed=4]="Changed",e[e.Ended=8]="Ended",e[e.Recognized=8]="Recognized",e[e.Cancelled=16]="Cancelled",e[e.Failed=32]="Failed"})(H||(H={}));var Gp="compute",Wl="auto",yn="manipulation",Ai="none",xn="pan-x",vn="pan-y";function Hl(e){if(e.includes(Ai))return Ai;let t=e.includes(xn),i=e.includes(vn);return t&&i?Ai:t||i?t?xn:vn:e.includes(yn)?yn:Wl}var En=class{constructor(t,i){this.actions="",this.manager=t,this.set(i)}set(t){t===Gp&&(t=this.compute()),this.manager.element&&(this.manager.element.style.touchAction=t,this.actions=t)}update(){this.set(this.manager.options.touchAction)}compute(){let t=[];for(let i of this.manager.recognizers)i.options.enable&&(t=t.concat(i.getTouchAction()));return Hl(t.join(" "))}};function cr(e){return e.trim().split(/\s+/g)}function cs(e,t,i){if(e)for(let n of cr(t))e.addEventListener(n,i,!1)}function ls(e,t,i){if(e)for(let n of cr(t))e.removeEventListener(n,i,!1)}function jl(e){return(e.ownerDocument||e).defaultView}function Xl(e,t){let i=e;for(;i;){if(i===t)return!0;i=i.parentNode}return!1}function hs(e){let t=e.length;if(t===1)return{x:Math.round(e[0].clientX),y:Math.round(e[0].clientY)};let i=0,n=0,o=0;for(;o<t;)i+=e[o].clientX,n+=e[o].clientY,o++;return{x:Math.round(i/t),y:Math.round(n/t)}}function Zl(e){let t=[],i=0;for(;i<e.pointers.length;)t[i]={clientX:Math.round(e.pointers[i].clientX),clientY:Math.round(e.pointers[i].clientY)},i++;return{timeStamp:Date.now(),pointers:t,center:hs(t),deltaX:e.deltaX,deltaY:e.deltaY}}function fs(e,t){let i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}function $l(e,t){let i=t.clientX-e.clientX,n=t.clientY-e.clientY;return Math.sqrt(i*i+n*n)}function t_(e,t){let i=t.x-e.x,n=t.y-e.y;return Math.atan2(n,i)*180/Math.PI}function Yl(e,t){let i=t.clientX-e.clientX,n=t.clientY-e.clientY;return Math.atan2(n,i)*180/Math.PI}function us(e,t){return e===t?dt.None:Math.abs(e)>=Math.abs(t)?e<0?dt.Left:dt.Right:t<0?dt.Up:dt.Down}function e_(e,t){let i=t.center,n=e.offsetDelta,o=e.prevDelta,a=e.prevInput;return(t.eventType===ot.Start||a?.eventType===ot.End)&&(o=e.prevDelta={x:a?.deltaX||0,y:a?.deltaY||0},n=e.offsetDelta={x:i.x,y:i.y}),{deltaX:o.x+(i.x-n.x),deltaY:o.y+(i.y-n.y)}}function ds(e,t,i){return{x:t/e||0,y:i/e||0}}function i_(e,t){return $l(t[0],t[1])/$l(e[0],e[1])}function r_(e,t){return Yl(t[1],t[0])-Yl(e[1],e[0])}function n_(e,t){let i=e.lastInterval||t,n=t.timeStamp-i.timeStamp,o,a,l,h;if(t.eventType!==ot.Cancel&&(n>25||i.velocity===void 0)){let u=t.deltaX-i.deltaX,p=t.deltaY-i.deltaY,m=ds(n,u,p);a=m.x,l=m.y,o=Math.abs(m.x)>Math.abs(m.y)?m.x:m.y,h=us(u,p),e.lastInterval=t}else o=i.velocity,a=i.velocityX,l=i.velocityY,h=i.direction;t.velocity=o,t.velocityX=a,t.velocityY=l,t.direction=h}function o_(e,t){let{session:i}=e,{pointers:n}=t,{length:o}=n;i.firstInput||(i.firstInput=Zl(t)),o>1&&!i.firstMultiple?i.firstMultiple=Zl(t):o===1&&(i.firstMultiple=!1);let{firstInput:a,firstMultiple:l}=i,h=l?l.center:a.center,u=t.center=hs(n);t.timeStamp=Date.now(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=t_(h,u),t.distance=fs(h,u);let{deltaX:p,deltaY:m}=e_(i,t);t.deltaX=p,t.deltaY=m,t.offsetDirection=us(t.deltaX,t.deltaY);let g=ds(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=g.x,t.overallVelocityY=g.y,t.overallVelocity=Math.abs(g.x)>Math.abs(g.y)?g.x:g.y,t.scale=l?i_(l.pointers,n):1,t.rotation=l?r_(l.pointers,n):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length;let T=e.element;return Xl(t.srcEvent.target,T)&&(T=t.srcEvent.target),t.target=T,n_(i,t),t}function s_(e,t,i){let n=i.pointers.length,o=i.changedPointers.length,a=t&ot.Start&&n-o===0,l=t&(ot.End|ot.Cancel)&&n-o===0;i.isFirst=Boolean(a),i.isFinal=Boolean(l),a&&(e.session={}),i.eventType=t;let h=o_(e,i);e.emit("hammer.input",h),e.recognize(h),e.session.prevInput=h}var Sn=class{constructor(t){this.evEl="",this.evWin="",this.evTarget="",this.domHandler=i=>{this.manager.options.enable&&this.handler(i)},this.manager=t,this.element=t.element,this.target=t.options.inputTarget||t.element}callback(t,i){s_(this.manager,t,i)}init(){cs(this.element,this.evEl,this.domHandler),cs(this.target,this.evTarget,this.domHandler),cs(jl(this.element),this.evWin,this.domHandler)}destroy(){ls(this.element,this.evEl,this.domHandler),ls(this.target,this.evTarget,this.domHandler),ls(jl(this.element),this.evWin,this.domHandler)}};var cE={pointerdown:ot.Start,pointermove:ot.Move,pointerup:ot.End,pointercancel:ot.Cancel,pointerout:ot.Cancel},lE="pointerdown",hE="pointermove pointerup pointercancel",bn=class extends Sn{constructor(t){super(t),this.evEl=lE,this.evWin=hE,this.store=this.manager.session.pointerEvents=[],this.init()}handler(t){let{store:i}=this,n=!1,o=cE[t.type],a=t.pointerType,l=a==="touch",h=i.findIndex(u=>u.pointerId===t.pointerId);o&ot.Start&&(t.buttons||l)?h<0&&(i.push(t),h=i.length-1):o&(ot.End|ot.Cancel)&&(n=!0),!(h<0)&&(i[h]=t,this.callback(o,{pointers:i,changedPointers:[t],eventType:o,pointerType:a,srcEvent:t}),n&&i.splice(h,1))}};var fE=["","webkit","Moz","MS","ms","o"];function a_(e,t){let i=t[0].toUpperCase()+t.slice(1);for(let n of fE){let o=n?n+i:t;if(o in e)return o}}var uE=1,c_=2,l_={touchAction:"compute",enable:!0,inputTarget:null,cssProps:{userSelect:"none",userDrag:"none",touchCallout:"none",tapHighlightColor:"rgba(0,0,0,0)"}},An=class{constructor(t,i){this.options={...l_,...i,cssProps:{...l_.cssProps,...i.cssProps},inputTarget:i.inputTarget||t},this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new bn(this),this.touchAction=new En(this,this.options.touchAction),this.toggleCssProps(!0)}set(t){return Object.assign(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this}stop(t){this.session.stopped=t?c_:uE}recognize(t){let{session:i}=this;if(i.stopped)return;this.session.prevented&&t.srcEvent.preventDefault();let n,{recognizers:o}=this,{curRecognizer:a}=i;(!a||a&&a.state&H.Recognized)&&(a=i.curRecognizer=null);let l=0;for(;l<o.length;)n=o[l],i.stopped!==c_&&(!a||n===a||n.canRecognizeWith(a))?n.recognize(t):n.reset(),!a&&n.state&(H.Began|H.Changed|H.Ended)&&(a=i.curRecognizer=n),l++}get(t){let{recognizers:i}=this;for(let n=0;n<i.length;n++)if(i[n].options.event===t)return i[n];return null}add(t){if(Array.isArray(t)){for(let n of t)this.add(n);return this}let i=this.get(t.options.event);return i&&this.remove(i),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t}remove(t){if(Array.isArray(t)){for(let n of t)this.remove(n);return this}let i=typeof t=="string"?this.get(t):t;if(i){let{recognizers:n}=this,o=n.indexOf(i);o!==-1&&(n.splice(o,1),this.touchAction.update())}return this}on(t,i){if(!t||!i)return;let{handlers:n}=this;for(let o of cr(t))n[o]=n[o]||[],n[o].push(i)}off(t,i){if(!t)return;let{handlers:n}=this;for(let o of cr(t))i?n[o]&&n[o].splice(n[o].indexOf(i),1):delete n[o]}emit(t,i){let n=this.handlers[t]&&this.handlers[t].slice();if(!n||!n.length)return;let o=i;o.type=t,o.preventDefault=function(){i.srcEvent.preventDefault()};let a=0;for(;a<n.length;)n[a](o),a++}destroy(){this.toggleCssProps(!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}toggleCssProps(t){let{element:i}=this;if(i){for(let[n,o]of Object.entries(this.options.cssProps)){let a=a_(i.style,n);t?(this.oldCssProps[a]=i.style[a],i.style[a]=o):i.style[a]=this.oldCssProps[a]||""}t||(this.oldCssProps={})}}};var dE=1;function h_(){return dE++}function Kl(e){return e&H.Cancelled?"cancel":e&H.Ended?"end":e&H.Changed?"move":e&H.Began?"start":""}var Ue=class{constructor(t){this.options=t,this.id=h_(),this.state=H.Possible,this.simultaneous={},this.requireFail=[]}set(t){return Object.assign(this.options,t),this.manager.touchAction.update(),this}recognizeWith(t){if(Array.isArray(t)){for(let o of t)this.recognizeWith(o);return this}let i;if(typeof t=="string"){if(i=this.manager.get(t),!i)throw new Error(`Cannot find recognizer ${t}`)}else i=t;let{simultaneous:n}=this;return n[i.id]||(n[i.id]=i,i.recognizeWith(this)),this}dropRecognizeWith(t){if(Array.isArray(t)){for(let n of t)this.dropRecognizeWith(n);return this}let i;return typeof t=="string"?i=this.manager.get(t):i=t,i&&delete this.simultaneous[i.id],this}requireFailure(t){if(Array.isArray(t)){for(let o of t)this.requireFailure(o);return this}let i;if(typeof t=="string"){if(i=this.manager.get(t),!i)throw new Error(`Cannot find recognizer ${t}`)}else i=t;let{requireFail:n}=this;return n.indexOf(i)===-1&&(n.push(i),i.requireFailure(this)),this}dropRequireFailure(t){if(Array.isArray(t)){for(let n of t)this.dropRequireFailure(n);return this}let i;if(typeof t=="string"?i=this.manager.get(t):i=t,i){let n=this.requireFail.indexOf(i);n>-1&&this.requireFail.splice(n,1)}return this}hasRequireFailures(){return Boolean(this.requireFail.find(t=>t.options.enable))}canRecognizeWith(t){return Boolean(this.simultaneous[t.id])}emit(t){if(!t)return;let{state:i}=this;i<H.Ended&&this.manager.emit(this.options.event+Kl(i),t),this.manager.emit(this.options.event,t),t.additionalEvent&&this.manager.emit(t.additionalEvent,t),i>=H.Ended&&this.manager.emit(this.options.event+Kl(i),t)}tryEmit(t){this.canEmit()?this.emit(t):this.state=H.Failed}canEmit(){let t=0;for(;t<this.requireFail.length;){if(!(this.requireFail[t].state&(H.Failed|H.Possible)))return!1;t++}return!0}recognize(t){let i={...t};if(!this.options.enable){this.reset(),this.state=H.Failed;return}this.state&(H.Recognized|H.Cancelled|H.Failed)&&(this.state=H.Possible),this.state=this.process(i),this.state&(H.Began|H.Changed|H.Ended|H.Cancelled)&&this.tryEmit(i)}getEventNames(){return[this.options.event]}reset(){}};var ze=class extends Ue{attrTest(t){let i=this.options.pointers;return i===0||t.pointers.length===i}process(t){let{state:i}=this,{eventType:n}=t,o=i&(H.Began|H.Changed),a=this.attrTest(t);return o&&(n&ot.Cancel||!a)?i|H.Cancelled:o||a?n&ot.End?i|H.Ended:i&H.Began?i|H.Changed:H.Began:H.Failed}};var Ri=class extends Ue{constructor(t={}){super({enable:!0,event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10,...t}),this.pTime=null,this.pCenter=null,this._timer=null,this._input=null,this.count=0}getTouchAction(){return[yn]}process(t){let{options:i}=this,n=t.pointers.length===i.pointers,o=t.distance<i.threshold,a=t.deltaTime<i.time;if(this.reset(),t.eventType&ot.Start&&this.count===0)return this.failTimeout();if(o&&a&&n){if(t.eventType!==ot.End)return this.failTimeout();let l=this.pTime?t.timeStamp-this.pTime<i.interval:!0,h=!this.pCenter||fs(this.pCenter,t.center)<i.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,!h||!l?this.count=1:this.count+=1,this._input=t,this.count%i.taps===0)return this.hasRequireFailures()?(this._timer=setTimeout(()=>{this.state=H.Recognized,this.tryEmit(this._input)},i.interval),H.Began):H.Recognized}return H.Failed}failTimeout(){return this._timer=setTimeout(()=>{this.state=H.Failed},this.options.interval),H.Failed}reset(){clearTimeout(this._timer)}emit(t){this.state===H.Recognized&&(t.tapCount=this.count,this.manager.emit(this.options.event,t))}};var pE=["","start","move","end","cancel","up","down","left","right"],ri=class extends ze{constructor(t={}){super({enable:!0,pointers:1,event:"pan",threshold:10,direction:dt.All,...t}),this.pX=null,this.pY=null}getTouchAction(){let{options:{direction:t}}=this,i=[];return t&dt.Horizontal&&i.push(vn),t&dt.Vertical&&i.push(xn),i}getEventNames(){return pE.map(t=>this.options.event+t)}directionTest(t){let{options:i}=this,n=!0,{distance:o}=t,{direction:a}=t,l=t.deltaX,h=t.deltaY;return a&i.direction||(i.direction&dt.Horizontal?(a=l===0?dt.None:l<0?dt.Left:dt.Right,n=l!==this.pX,o=Math.abs(t.deltaX)):(a=h===0?dt.None:h<0?dt.Up:dt.Down,n=h!==this.pY,o=Math.abs(t.deltaY))),t.direction=a,n&&o>i.threshold&&Boolean(a&i.direction)}attrTest(t){return super.attrTest(t)&&(Boolean(this.state&H.Began)||!(this.state&H.Began)&&this.directionTest(t))}emit(t){this.pX=t.deltaX,this.pY=t.deltaY;let i=dt[t.direction].toLowerCase();i&&(t.additionalEvent=this.options.event+i),super.emit(t)}};var _E=["","start","move","end","cancel","in","out"],lr=class extends ze{constructor(t={}){super({enable:!0,event:"pinch",threshold:0,pointers:2,...t})}getTouchAction(){return[Ai]}getEventNames(){return _E.map(t=>this.options.event+t)}attrTest(t){return super.attrTest(t)&&(Math.abs(t.scale-1)>this.options.threshold||Boolean(this.state&H.Began))}emit(t){if(t.scale!==1){let i=t.scale<1?"in":"out";t.additionalEvent=this.options.event+i}super.emit(t)}};var Ee=class{constructor(t,i,n){this.element=t,this.callback=i,this.options=n}};var f_=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",mN=typeof window<"u"?window:global;var yE=f_.indexOf("firefox")!==-1,u_=4.000244140625,xE=40,vE=.25,ps=class extends Ee{constructor(t,i,n){super(t,i,{enable:!0,...n}),this.handleEvent=o=>{if(!this.options.enable)return;let a=o.deltaY;globalThis.WheelEvent&&(yE&&o.deltaMode===globalThis.WheelEvent.DOM_DELTA_PIXEL&&(a/=globalThis.devicePixelRatio),o.deltaMode===globalThis.WheelEvent.DOM_DELTA_LINE&&(a*=xE)),a!==0&&a%u_===0&&(a=Math.floor(a/u_)),o.shiftKey&&a&&(a=a*vE),this.callback({type:"wheel",center:{x:o.clientX,y:o.clientY},delta:-a,srcEvent:o,pointerType:"mouse",target:o.target})},t.addEventListener("wheel",this.handleEvent,{passive:!1})}destroy(){this.element.removeEventListener("wheel",this.handleEvent)}enableEventType(t,i){t==="wheel"&&(this.options.enable=i)}};var d_=["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],_s=class extends Ee{constructor(t,i,n){super(t,i,{enable:!0,...n}),this.handleEvent=a=>{this.handleOverEvent(a),this.handleOutEvent(a),this.handleEnterEvent(a),this.handleLeaveEvent(a),this.handleMoveEvent(a)},this.pressed=!1;let{enable:o}=this.options;this.enableMoveEvent=o,this.enableLeaveEvent=o,this.enableEnterEvent=o,this.enableOutEvent=o,this.enableOverEvent=o,d_.forEach(a=>t.addEventListener(a,this.handleEvent))}destroy(){d_.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,i){switch(t){case"pointermove":this.enableMoveEvent=i;break;case"pointerover":this.enableOverEvent=i;break;case"pointerout":this.enableOutEvent=i;break;case"pointerenter":this.enableEnterEvent=i;break;case"pointerleave":this.enableLeaveEvent=i;break;default:}}handleOverEvent(t){this.enableOverEvent&&t.type==="mouseover"&&this._emit("pointerover",t)}handleOutEvent(t){this.enableOutEvent&&t.type==="mouseout"&&this._emit("pointerout",t)}handleEnterEvent(t){this.enableEnterEvent&&t.type==="mouseenter"&&this._emit("pointerenter",t)}handleLeaveEvent(t){this.enableLeaveEvent&&t.type==="mouseleave"&&this._emit("pointerleave",t)}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case"mousedown":t.button>=0&&(this.pressed=!0);break;case"mousemove":t.buttons===0&&(this.pressed=!1),this.pressed||this._emit("pointermove",t);break;case"mouseup":this.pressed=!1;break;default:}}_emit(t,i){this.callback({type:t,center:{x:i.clientX,y:i.clientY},srcEvent:i,pointerType:"mouse",target:i.target})}};var p_=["keydown","keyup"],ms=class extends Ee{constructor(t,i,n){super(t,i,{enable:!0,tabIndex:0,...n}),this.handleEvent=o=>{let a=o.target||o.srcElement;a.tagName==="INPUT"&&a.type==="text"||a.tagName==="TEXTAREA"||(this.enableDownEvent&&o.type==="keydown"&&this.callback({type:"keydown",srcEvent:o,key:o.key,target:o.target}),this.enableUpEvent&&o.type==="keyup"&&this.callback({type:"keyup",srcEvent:o,key:o.key,target:o.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,t.tabIndex=this.options.tabIndex,t.style.outline="none",p_.forEach(o=>t.addEventListener(o,this.handleEvent))}destroy(){p_.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,i){t==="keydown"&&(this.enableDownEvent=i),t==="keyup"&&(this.enableUpEvent=i)}};var gs=class extends Ee{constructor(t,i,n){super(t,i,n),this.handleEvent=o=>{this.options.enable&&this.callback({type:"contextmenu",center:{x:o.clientX,y:o.clientY},srcEvent:o,pointerType:"mouse",target:o.target})},t.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(t,i){t==="contextmenu"&&(this.options.enable=i)}};var EE={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},SE=0,bE=1,AE=2,RE=1,wE=2,PE=4;function __(e){let t=EE[e.srcEvent.type];if(!t)return null;let{buttons:i,button:n}=e.srcEvent,o=!1,a=!1,l=!1;return t===2?(o=Boolean(i&RE),a=Boolean(i&PE),l=Boolean(i&wE)):(o=n===SE,a=n===bE,l=n===AE),{leftButton:o,middleButton:a,rightButton:l}}function m_(e,t){let i=e.center;if(!i)return null;let n=t.getBoundingClientRect(),o=n.width/t.offsetWidth||1,a=n.height/t.offsetHeight||1,l={x:(i.x-n.left-t.clientLeft)/o,y:(i.y-n.top-t.clientTop)/a};return{center:i,offsetCenter:l}}var ME={srcElement:"root",priority:0},Ts=class{constructor(t,i){this.handleEvent=n=>{if(this.isEmpty())return;let o=this._normalizeEvent(n),a=n.srcEvent.target;for(;a&&a!==o.rootElement;){if(this._emit(o,a),o.handled)return;a=a.parentNode}this._emit(o,"root")},this.eventManager=t,this.recognizerName=i,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(t,i,n,o=!1,a=!1){let{handlers:l,handlersByElement:h}=this,u={...ME,...n},p=h.get(u.srcElement);p||(p=[],h.set(u.srcElement,p));let m={type:t,handler:i,srcElement:u.srcElement,priority:u.priority};o&&(m.once=!0),a&&(m.passive=!0),l.push(m),this._active=this._active||!m.passive;let g=p.length-1;for(;g>=0&&!(p[g].priority>=m.priority);)g--;p.splice(g+1,0,m)}remove(t,i){let{handlers:n,handlersByElement:o}=this;for(let a=n.length-1;a>=0;a--){let l=n[a];if(l.type===t&&l.handler===i){n.splice(a,1);let h=o.get(l.srcElement);h.splice(h.indexOf(l),1),h.length===0&&o.delete(l.srcElement)}}this._active=n.some(a=>!a.passive)}_emit(t,i){let n=this.handlersByElement.get(i);if(n){let o=!1,a=()=>{t.handled=!0},l=()=>{t.handled=!0,o=!0},h=[];for(let u=0;u<n.length;u++){let{type:p,handler:m,once:g}=n[u];if(m({...t,type:p,stopPropagation:a,stopImmediatePropagation:l}),g&&h.push(n[u]),o)break}for(let u=0;u<h.length;u++){let{type:p,handler:m}=h[u];this.remove(p,m)}}}_normalizeEvent(t){let i=this.eventManager.getElement();return{...t,...__(t),...m_(t,i),preventDefault:()=>{t.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:i}}};function CE(e){if("recognizer"in e)return e;let t,i=Array.isArray(e)?[...e]:[e];if(typeof i[0]=="function"){let n=i.shift(),o=i.shift()||{};t=new n(o)}else t=i.shift();return{recognizer:t,recognizeWith:typeof i[0]=="string"?[i[0]]:i[0],requireFailure:typeof i[1]=="string"?[i[1]]:i[1]}}var Rn=class{constructor(t=null,i={}){if(this._onBasicInput=n=>{this.manager.emit(n.srcEvent.type,n)},this._onOtherEvent=n=>{this.manager.emit(n.type,n)},this.options={recognizers:[],events:{},touchAction:"compute",tabIndex:0,cssProps:{},...i},this.events=new Map,this.element=t,!!t){this.manager=new An(t,this.options);for(let n of this.options.recognizers){let{recognizer:o,recognizeWith:a,requireFailure:l}=CE(n);this.manager.add(o),a&&o.recognizeWith(a),l&&o.requireFailure(l)}this.manager.on("hammer.input",this._onBasicInput),this.wheelInput=new ps(t,this._onOtherEvent,{enable:!1}),this.moveInput=new _s(t,this._onOtherEvent,{enable:!1}),this.keyInput=new ms(t,this._onOtherEvent,{enable:!1,tabIndex:i.tabIndex}),this.contextmenuInput=new gs(t,this._onOtherEvent,{enable:!1}),this.on(this.options.events)}}getElement(){return this.element}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy())}on(t,i,n){this._addEventHandler(t,i,n,!1)}once(t,i,n){this._addEventHandler(t,i,n,!0)}watch(t,i,n){this._addEventHandler(t,i,n,!1,!0)}off(t,i){this._removeEventHandler(t,i)}_toggleRecognizer(t,i){let{manager:n}=this;if(!n)return;let o=n.get(t);o&&(o.set({enable:i}),n.touchAction.update()),this.wheelInput?.enableEventType(t,i),this.moveInput?.enableEventType(t,i),this.keyInput?.enableEventType(t,i),this.contextmenuInput?.enableEventType(t,i)}_addEventHandler(t,i,n,o,a){if(typeof t!="string"){n=i;for(let[p,m]of Object.entries(t))this._addEventHandler(p,m,n,o,a);return}let{manager:l,events:h}=this;if(!l)return;let u=h.get(t);if(!u){let p=this._getRecognizerName(t)||t;u=new Ts(this,p),h.set(t,u),l&&l.on(t,u.handleEvent)}u.add(t,i,n,o,a),u.isEmpty()||this._toggleRecognizer(u.recognizerName,!0)}_removeEventHandler(t,i){if(typeof t!="string"){for(let[a,l]of Object.entries(t))this._removeEventHandler(a,l);return}let{events:n}=this,o=n.get(t);if(o&&(o.remove(t,i),o.isEmpty())){let{recognizerName:a}=o,l=!1;for(let h of n.values())if(h.recognizerName===a&&!h.isEmpty()){l=!0;break}l||this._toggleRecognizer(a,!1)}}_getRecognizerName(t){return this.manager.recognizers.find(i=>i.getEventNames().includes(t))?.options.event}};var _t={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(_t,"IDENTITY",{get:()=>(ct.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});var It={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},hr={common:0,meters:1,pixels:2},wn={click:"onClick",dblclick:"onClick",panstart:"onDragStart",panmove:"onDrag",panend:"onDragEnd"},ql={multipan:[ri,{threshold:10,direction:dt.Vertical,pointers:2}],pinch:[lr,{},null,["multipan"]],pan:[ri,{threshold:1},["pinch"],["multipan"]],dblclick:[Ri,{event:"dblclick",taps:2}],click:[Ri,{event:"click"},null,["dblclick"]]};function IE(e,t){if(e===t)return!0;if(Array.isArray(e)){let i=e.length;if(!t||t.length!==i)return!1;for(let n=0;n<i;n++)if(e[n]!==t[n])return!1;return!0}return!1}function fr(e){let t={},i;return n=>{for(let o in n)if(!IE(n[o],t[o])){i=e(n),t=n;break}return i}}var g_=[0,0,0,0],OE=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],T_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],NE=[0,0,0],y_=[0,0,0],DE=fr(LE);function FE(e,t,i=y_){i.length<3&&(i=[i[0],i[1],0]);let n=i,o,a=!0;switch(t===_t.LNGLAT_OFFSETS||t===_t.METER_OFFSETS?o=i:o=e.isGeospatial?[Math.fround(e.longitude),Math.fround(e.latitude),0]:null,e.projectionMode){case It.WEB_MERCATOR:(t===_t.LNGLAT||t===_t.CARTESIAN)&&(o=[0,0,0],a=!1);break;case It.WEB_MERCATOR_AUTO_OFFSET:t===_t.LNGLAT?n=o:t===_t.CARTESIAN&&(n=[Math.fround(e.center[0]),Math.fround(e.center[1]),0],o=e.unprojectPosition(n),n[0]-=i[0],n[1]-=i[1],n[2]-=i[2]);break;case It.IDENTITY:n=e.position.map(Math.fround),n[2]=n[2]||0;break;case It.GLOBE:a=!1,o=null;break;default:a=!1}return{geospatialOrigin:o,shaderCoordinateOrigin:n,offsetMode:a}}function BE(e,t,i){let{viewMatrixUncentered:n,projectionMatrix:o}=e,{viewMatrix:a,viewProjectionMatrix:l}=e,h=g_,u=g_,p=e.cameraPosition,{geospatialOrigin:m,shaderCoordinateOrigin:g,offsetMode:T}=FE(e,t,i);return T&&(u=e.projectPosition(m||g),p=[p[0]-u[0],p[1]-u[1],p[2]-u[2]],u[3]=1,h=ke.transformMat4([],u,l),a=n||a,l=bt.multiply([],o,a),l=bt.multiply([],l,OE)),{viewMatrix:a,viewProjectionMatrix:l,projectionCenter:h,originCommon:u,cameraPosCommon:p,shaderCoordinateOrigin:g,geospatialOrigin:m}}function x_({viewport:e,devicePixelRatio:t=1,modelMatrix:i=null,coordinateSystem:n=_t.DEFAULT,coordinateOrigin:o=y_,autoWrapLongitude:a=!1}){n===_t.DEFAULT&&(n=e.isGeospatial?_t.LNGLAT:_t.CARTESIAN);let l=DE({viewport:e,devicePixelRatio:t,coordinateSystem:n,coordinateOrigin:o});return l.wrapLongitude=a,l.modelMatrix=i||T_,l}function LE({viewport:e,devicePixelRatio:t,coordinateSystem:i,coordinateOrigin:n}){let{projectionCenter:o,viewProjectionMatrix:a,originCommon:l,cameraPosCommon:h,shaderCoordinateOrigin:u,geospatialOrigin:p}=BE(e,i,n),m=e.getDistanceScales(),g=[e.width*t,e.height*t],T=ke.transformMat4([],[0,0,-e.focalDistance,1],e.projectionMatrix)[3]||1,y={coordinateSystem:i,projectionMode:e.projectionMode,coordinateOrigin:u,commonOrigin:l.slice(0,3),center:o,pseudoMeters:Boolean(e._pseudoMeters),viewportSize:g,devicePixelRatio:t,focalDistance:T,commonUnitsPerMeter:m.unitsPerMeter,commonUnitsPerWorldUnit:m.unitsPerMeter,commonUnitsPerWorldUnit2:NE,scale:e.scale,wrapLongitude:!1,viewProjectionMatrix:a,modelMatrix:T_,cameraPosition:h};if(p){let E=e.getDistanceScales(p);switch(i){case _t.METER_OFFSETS:y.commonUnitsPerWorldUnit=E.unitsPerMeter,y.commonUnitsPerWorldUnit2=E.unitsPerMeter2;break;case _t.LNGLAT:case _t.LNGLAT_OFFSETS:e._pseudoMeters||(y.commonUnitsPerMeter=E.unitsPerMeter),y.commonUnitsPerWorldUnit=E.unitsPerDegree,y.commonUnitsPerWorldUnit2=E.unitsPerDegree2;break;case _t.CARTESIAN:y.commonUnitsPerWorldUnit=[1,1,E.unitsPerMeter[2]],y.commonUnitsPerWorldUnit2=[0,0,E.unitsPerMeter2[2]];break;default:break}}return y}var kE=Object.keys(_t).map(e=>`const COORDINATE_SYSTEM_${e}: i32 = ${_t[e]};`).join(""),UE=Object.keys(It).map(e=>`const PROJECTION_MODE_${e}: i32 = ${It[e]};`).join(""),zE=Object.keys(hr).map(e=>`const UNIT_${e.toUpperCase()}: i32 = ${hr[e]};`).join(""),VE=`${kE}
311
- ${UE}
312
- ${zE}
313
-
314
- const TILE_SIZE: f32 = 512.0;
315
- const PI: f32 = 3.1415926536;
316
- const WORLD_SCALE: f32 = TILE_SIZE / (PI * 2.0);
317
- const ZERO_64_LOW: vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
318
- const EARTH_RADIUS: f32 = 6370972.0; // meters
319
- const GLOBE_RADIUS: f32 = 256.0;
320
-
321
- // -----------------------------------------------------------------------------
322
- // Uniform block (converted from GLSL uniform block)
323
- // -----------------------------------------------------------------------------
324
- struct ProjectUniforms {
325
- wrapLongitude: i32,
326
- coordinateSystem: i32,
327
- commonUnitsPerMeter: vec3<f32>,
328
- projectionMode: i32,
329
- scale: f32,
330
- commonUnitsPerWorldUnit: vec3<f32>,
331
- commonUnitsPerWorldUnit2: vec3<f32>,
332
- center: vec4<f32>,
333
- modelMatrix: mat4x4<f32>,
334
- viewProjectionMatrix: mat4x4<f32>,
335
- viewportSize: vec2<f32>,
336
- devicePixelRatio: f32,
337
- focalDistance: f32,
338
- cameraPosition: vec3<f32>,
339
- coordinateOrigin: vec3<f32>,
340
- commonOrigin: vec3<f32>,
341
- pseudoMeters: i32,
342
- };
343
-
344
- @group(0) @binding(0)
345
- var<uniform> project: ProjectUniforms;
346
-
347
- // -----------------------------------------------------------------------------
348
- // Geometry data
349
- // (In your GLSL code, "geometry" was assumed to be available globally. In WGSL,
350
- // you might supply this via vertex attributes or a uniform. Here we define a
351
- // uniform struct for demonstration.)
352
- // -----------------------------------------------------------------------------
353
-
354
- // Structure to carry additional geometry data used by deck.gl filters.
355
- struct Geometry {
356
- worldPosition: vec3<f32>,
357
- worldPositionAlt: vec3<f32>,
358
- position: vec4<f32>,
359
- normal: vec3<f32>,
360
- uv: vec2<f32>,
361
- pickingColor: vec3<f32>,
362
- };
363
-
364
- // @group(0) @binding(1)
365
- var<private> geometry: Geometry;
366
- `,v_=`${VE}
367
-
368
- // -----------------------------------------------------------------------------
369
- // Functions
370
- // -----------------------------------------------------------------------------
371
-
372
- // Returns an adjustment factor for commonUnitsPerMeter
373
- fn _project_size_at_latitude(lat: f32) -> f32 {
374
- let y = clamp(lat, -89.9, 89.9);
375
- return 1.0 / cos(radians(y));
376
- }
377
-
378
- // Overloaded version: scales a value in meters at a given latitude.
379
- fn _project_size_at_latitude_m(meters: f32, lat: f32) -> f32 {
380
- return meters * project.commonUnitsPerMeter.z * _project_size_at_latitude(lat);
381
- }
382
-
383
- // Computes a non-linear scale factor based on geometry.
384
- // (Note: This function relies on "geometry" being provided.)
385
- fn project_size() -> f32 {
386
- if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR &&
387
- project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT &&
388
- project.pseudoMeters == 0) {
389
- if (geometry.position.w == 0.0) {
390
- return _project_size_at_latitude(geometry.worldPosition.y);
391
- }
392
- let y: f32 = geometry.position.y / TILE_SIZE * 2.0 - 1.0;
393
- let y2 = y * y;
394
- let y4 = y2 * y2;
395
- let y6 = y4 * y2;
396
- return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;
397
- }
398
- return 1.0;
399
- }
400
-
401
- // Overloads to scale offsets (meters to world units)
402
- fn project_size_float(meters: f32) -> f32 {
403
- return meters * project.commonUnitsPerMeter.z * project_size();
404
- }
405
-
406
- fn project_size_vec2(meters: vec2<f32>) -> vec2<f32> {
407
- return meters * project.commonUnitsPerMeter.xy * project_size();
408
- }
409
-
410
- fn project_size_vec3(meters: vec3<f32>) -> vec3<f32> {
411
- return meters * project.commonUnitsPerMeter * project_size();
412
- }
413
-
414
- fn project_size_vec4(meters: vec4<f32>) -> vec4<f32> {
415
- return vec4<f32>(meters.xyz * project.commonUnitsPerMeter, meters.w);
416
- }
417
-
418
- // Returns a rotation matrix aligning the z\u2011axis with the given up vector.
419
- fn project_get_orientation_matrix(up: vec3<f32>) -> mat3x3<f32> {
420
- let uz = normalize(up);
421
- let ux = select(
422
- vec3<f32>(1.0, 0.0, 0.0),
423
- normalize(vec3<f32>(uz.y, -uz.x, 0.0)),
424
- abs(uz.z) == 1.0
425
- );
426
- let uy = cross(uz, ux);
427
- return mat3x3<f32>(ux, uy, uz);
428
- }
429
-
430
- // Since WGSL does not support "out" parameters, we return a struct.
431
- struct RotationResult {
432
- needsRotation: bool,
433
- transform: mat3x3<f32>,
434
- };
435
-
436
- fn project_needs_rotation(commonPosition: vec3<f32>) -> RotationResult {
437
- if (project.projectionMode == PROJECTION_MODE_GLOBE) {
438
- return RotationResult(true, project_get_orientation_matrix(commonPosition));
439
- } else {
440
- return RotationResult(false, mat3x3<f32>()); // identity alternative if needed
441
- };
442
- }
443
-
444
- // Projects a normal vector from the current coordinate system to world space.
445
- fn project_normal(vector: vec3<f32>) -> vec3<f32> {
446
- let normal_modelspace = project.modelMatrix * vec4<f32>(vector, 0.0);
447
- var n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter);
448
- let rotResult = project_needs_rotation(geometry.position.xyz);
449
- if (rotResult.needsRotation) {
450
- n = rotResult.transform * n;
451
- }
452
- return n;
453
- }
454
-
455
- // Applies a scale offset based on y-offset (dy)
456
- fn project_offset_(offset: vec4<f32>) -> vec4<f32> {
457
- let dy: f32 = offset.y;
458
- let commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy;
459
- return vec4<f32>(offset.xyz * commonUnitsPerWorldUnit, offset.w);
460
- }
461
-
462
- // Projects lng/lat coordinates to a unit tile [0,1]
463
- fn project_mercator_(lnglat: vec2<f32>) -> vec2<f32> {
464
- var x = lnglat.x;
465
- if (project.wrapLongitude != 0) {
466
- x = ((x + 180.0) % 360.0) - 180.0;
467
- }
468
- let y = clamp(lnglat.y, -89.9, 89.9);
469
- return vec2<f32>(
470
- radians(x) + PI,
471
- PI + log(tan(PI * 0.25 + radians(y) * 0.5))
472
- ) * WORLD_SCALE;
473
- }
474
-
475
- // Projects lng/lat/z coordinates for a globe projection.
476
- fn project_globe_(lnglatz: vec3<f32>) -> vec3<f32> {
477
- let lambda = radians(lnglatz.x);
478
- let phi = radians(lnglatz.y);
479
- let cosPhi = cos(phi);
480
- let D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;
481
- return vec3<f32>(
482
- sin(lambda) * cosPhi,
483
- -cos(lambda) * cosPhi,
484
- sin(phi)
485
- ) * D;
486
- }
487
-
488
- // Projects positions (with an optional 64-bit low part) from the input
489
- // coordinate system to the common space.
490
- fn project_position_vec4_f64(position: vec4<f32>, position64Low: vec3<f32>) -> vec4<f32> {
491
- var position_world = project.modelMatrix * position;
492
-
493
- // Work around for a Mac+NVIDIA bug:
494
- if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) {
495
- if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
496
- return vec4<f32>(
497
- project_mercator_(position_world.xy),
498
- _project_size_at_latitude_m(position_world.z, position_world.y),
499
- position_world.w
500
- );
501
- }
502
- if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
503
- position_world = vec4f(position_world.xyz + project.coordinateOrigin, position_world.w);
504
- }
505
- }
506
- if (project.projectionMode == PROJECTION_MODE_GLOBE) {
507
- if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
508
- return vec4<f32>(
509
- project_globe_(position_world.xyz),
510
- position_world.w
511
- );
512
- }
513
- }
514
- if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
515
- if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
516
- if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) {
517
- return vec4<f32>(
518
- project_mercator_(position_world.xy) - project.commonOrigin.xy,
519
- project_size_float(position_world.z),
520
- position_world.w
521
- );
522
- }
523
- }
524
- }
525
- if (project.projectionMode == PROJECTION_MODE_IDENTITY ||
526
- (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&
527
- (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
528
- project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {
529
- position_world = vec4f(position_world.xyz - project.coordinateOrigin, position_world.w);
530
- }
531
-
532
- return project_offset_(position_world) +
533
- project_offset_(project.modelMatrix * vec4<f32>(position64Low, 0.0));
534
- }
535
-
536
- // Overloaded versions for different input types.
537
- fn project_position_vec4_f32(position: vec4<f32>) -> vec4<f32> {
538
- return project_position_vec4_f64(position, ZERO_64_LOW);
539
- }
540
-
541
- fn project_position_vec3_f64(position: vec3<f32>, position64Low: vec3<f32>) -> vec3<f32> {
542
- let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), position64Low);
543
- return projected_position.xyz;
544
- }
545
-
546
- fn project_position_vec3_f32(position: vec3<f32>) -> vec3<f32> {
547
- let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), ZERO_64_LOW);
548
- return projected_position.xyz;
549
- }
550
-
551
- fn project_position_vec2_f32(position: vec2<f32>) -> vec2<f32> {
552
- let projected_position = project_position_vec4_f64(vec4<f32>(position, 0.0, 1.0), ZERO_64_LOW);
553
- return projected_position.xy;
554
- }
555
-
556
- // Transforms a common space position to clip space.
557
- fn project_common_position_to_clipspace_with_projection(position: vec4<f32>, viewProjectionMatrix: mat4x4<f32>, center: vec4<f32>) -> vec4<f32> {
558
- return viewProjectionMatrix * position + center;
559
- }
560
-
561
- // Uses the project viewProjectionMatrix and center.
562
- fn project_common_position_to_clipspace(position: vec4<f32>) -> vec4<f32> {
563
- return project_common_position_to_clipspace_with_projection(position, project.viewProjectionMatrix, project.center);
564
- }
565
-
566
- // Returns a clip space offset corresponding to a given number of screen pixels.
567
- fn project_pixel_size_to_clipspace(pixels: vec2<f32>) -> vec2<f32> {
568
- let offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0;
569
- return offset * project.focalDistance;
570
- }
571
-
572
- fn project_meter_size_to_pixel(meters: f32) -> f32 {
573
- return project_size_float(meters) * project.scale;
574
- }
575
-
576
- fn project_unit_size_to_pixel(size: f32, unit: i32) -> f32 {
577
- if (unit == UNIT_METERS) {
578
- return project_meter_size_to_pixel(size);
579
- } else if (unit == UNIT_COMMON) {
580
- return size * project.scale;
581
- }
582
- // UNIT_PIXELS: no scaling applied.
583
- return size;
584
- }
585
-
586
- fn project_pixel_size_float(pixels: f32) -> f32 {
587
- return pixels / project.scale;
588
- }
589
-
590
- fn project_pixel_size_vec2(pixels: vec2<f32>) -> vec2<f32> {
591
- return pixels / project.scale;
592
- }
593
- `;var WE=Object.keys(_t).map(e=>`const int COORDINATE_SYSTEM_${e} = ${_t[e]};`).join(""),HE=Object.keys(It).map(e=>`const int PROJECTION_MODE_${e} = ${It[e]};`).join(""),jE=Object.keys(hr).map(e=>`const int UNIT_${e.toUpperCase()} = ${hr[e]};`).join(""),E_=`${WE}
594
- ${HE}
595
- ${jE}
596
- uniform projectUniforms {
597
- bool wrapLongitude;
598
- int coordinateSystem;
599
- vec3 commonUnitsPerMeter;
600
- int projectionMode;
601
- float scale;
602
- vec3 commonUnitsPerWorldUnit;
603
- vec3 commonUnitsPerWorldUnit2;
604
- vec4 center;
605
- mat4 modelMatrix;
606
- mat4 viewProjectionMatrix;
607
- vec2 viewportSize;
608
- float devicePixelRatio;
609
- float focalDistance;
610
- vec3 cameraPosition;
611
- vec3 coordinateOrigin;
612
- vec3 commonOrigin;
613
- bool pseudoMeters;
614
- } project;
615
- const float TILE_SIZE = 512.0;
616
- const float PI = 3.1415926536;
617
- const float WORLD_SCALE = TILE_SIZE / (PI * 2.0);
618
- const vec3 ZERO_64_LOW = vec3(0.0);
619
- const float EARTH_RADIUS = 6370972.0;
620
- const float GLOBE_RADIUS = 256.0;
621
- float project_size_at_latitude(float lat) {
622
- float y = clamp(lat, -89.9, 89.9);
623
- return 1.0 / cos(radians(y));
624
- }
625
- float project_size() {
626
- if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR &&
627
- project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT &&
628
- project.pseudoMeters == false) {
629
- if (geometry.position.w == 0.0) {
630
- return project_size_at_latitude(geometry.worldPosition.y);
631
- }
632
- float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;
633
- float y2 = y * y;
634
- float y4 = y2 * y2;
635
- float y6 = y4 * y2;
636
- return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;
637
- }
638
- return 1.0;
639
- }
640
- float project_size_at_latitude(float meters, float lat) {
641
- return meters * project.commonUnitsPerMeter.z * project_size_at_latitude(lat);
642
- }
643
- float project_size(float meters) {
644
- return meters * project.commonUnitsPerMeter.z * project_size();
645
- }
646
- vec2 project_size(vec2 meters) {
647
- return meters * project.commonUnitsPerMeter.xy * project_size();
648
- }
649
- vec3 project_size(vec3 meters) {
650
- return meters * project.commonUnitsPerMeter * project_size();
651
- }
652
- vec4 project_size(vec4 meters) {
653
- return vec4(meters.xyz * project.commonUnitsPerMeter, meters.w);
654
- }
655
- mat3 project_get_orientation_matrix(vec3 up) {
656
- vec3 uz = normalize(up);
657
- vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));
658
- vec3 uy = cross(uz, ux);
659
- return mat3(ux, uy, uz);
660
- }
661
- bool project_needs_rotation(vec3 commonPosition, out mat3 transform) {
662
- if (project.projectionMode == PROJECTION_MODE_GLOBE) {
663
- transform = project_get_orientation_matrix(commonPosition);
664
- return true;
665
- }
666
- return false;
667
- }
668
- vec3 project_normal(vec3 vector) {
669
- vec4 normal_modelspace = project.modelMatrix * vec4(vector, 0.0);
670
- vec3 n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter);
671
- mat3 rotation;
672
- if (project_needs_rotation(geometry.position.xyz, rotation)) {
673
- n = rotation * n;
674
- }
675
- return n;
676
- }
677
- vec4 project_offset_(vec4 offset) {
678
- float dy = offset.y;
679
- vec3 commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy;
680
- return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);
681
- }
682
- vec2 project_mercator_(vec2 lnglat) {
683
- float x = lnglat.x;
684
- if (project.wrapLongitude) {
685
- x = mod(x + 180., 360.0) - 180.;
686
- }
687
- float y = clamp(lnglat.y, -89.9, 89.9);
688
- return vec2(
689
- radians(x) + PI,
690
- PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))
691
- ) * WORLD_SCALE;
692
- }
693
- vec3 project_globe_(vec3 lnglatz) {
694
- float lambda = radians(lnglatz.x);
695
- float phi = radians(lnglatz.y);
696
- float cosPhi = cos(phi);
697
- float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;
698
- return vec3(
699
- sin(lambda) * cosPhi,
700
- -cos(lambda) * cosPhi,
701
- sin(phi)
702
- ) * D;
703
- }
704
- vec4 project_position(vec4 position, vec3 position64Low) {
705
- vec4 position_world = project.modelMatrix * position;
706
- if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) {
707
- if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
708
- return vec4(
709
- project_mercator_(position_world.xy),
710
- project_size_at_latitude(position_world.z, position_world.y),
711
- position_world.w
712
- );
713
- }
714
- if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
715
- position_world.xyz += project.coordinateOrigin;
716
- }
717
- }
718
- if (project.projectionMode == PROJECTION_MODE_GLOBE) {
719
- if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
720
- return vec4(
721
- project_globe_(position_world.xyz),
722
- position_world.w
723
- );
724
- }
725
- }
726
- if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
727
- if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
728
- if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) {
729
- return vec4(
730
- project_mercator_(position_world.xy) - project.commonOrigin.xy,
731
- project_size(position_world.z),
732
- position_world.w
733
- );
734
- }
735
- }
736
- }
737
- if (project.projectionMode == PROJECTION_MODE_IDENTITY ||
738
- (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&
739
- (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
740
- project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {
741
- position_world.xyz -= project.coordinateOrigin;
742
- }
743
- return project_offset_(position_world) + project_offset_(project.modelMatrix * vec4(position64Low, 0.0));
744
- }
745
- vec4 project_position(vec4 position) {
746
- return project_position(position, ZERO_64_LOW);
747
- }
748
- vec3 project_position(vec3 position, vec3 position64Low) {
749
- vec4 projected_position = project_position(vec4(position, 1.0), position64Low);
750
- return projected_position.xyz;
751
- }
752
- vec3 project_position(vec3 position) {
753
- vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);
754
- return projected_position.xyz;
755
- }
756
- vec2 project_position(vec2 position) {
757
- vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);
758
- return projected_position.xy;
759
- }
760
- vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {
761
- return viewProjectionMatrix * position + center;
762
- }
763
- vec4 project_common_position_to_clipspace(vec4 position) {
764
- return project_common_position_to_clipspace(position, project.viewProjectionMatrix, project.center);
765
- }
766
- vec2 project_pixel_size_to_clipspace(vec2 pixels) {
767
- vec2 offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0;
768
- return offset * project.focalDistance;
769
- }
770
- float project_size_to_pixel(float meters) {
771
- return project_size(meters) * project.scale;
772
- }
773
- float project_size_to_pixel(float size, int unit) {
774
- if (unit == UNIT_METERS) return project_size_to_pixel(size);
775
- if (unit == UNIT_COMMON) return size * project.scale;
776
- return size;
777
- }
778
- float project_pixel_size(float pixels) {
779
- return pixels / project.scale;
780
- }
781
- vec2 project_pixel_size(vec2 pixels) {
782
- return pixels / project.scale;
783
- }
784
- `;var XE={};function ZE(e=XE){return"viewport"in e?x_(e):{}}var Jl={name:"project",dependencies:[zl,as],source:v_,vs:E_,getUniforms:ZE,uniformTypes:{wrapLongitude:"f32",coordinateSystem:"i32",commonUnitsPerMeter:"vec3<f32>",projectionMode:"i32",scale:"f32",commonUnitsPerWorldUnit:"vec3<f32>",commonUnitsPerWorldUnit2:"vec3<f32>",center:"vec4<f32>",modelMatrix:"mat4x4<f32>",viewProjectionMatrix:"mat4x4<f32>",viewportSize:"vec2<f32>",devicePixelRatio:"f32",focalDistance:"f32",cameraPosition:"vec3<f32>",coordinateOrigin:"vec3<f32>",commonOrigin:"vec3<f32>",pseudoMeters:"f32"}};function Ql(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function ni(e,t){let i=ke.transformMat4([],t,e);return ke.scale(i,i,1/i[3]),i}function Gl(e,t){let i=e%t;return i<0?t+i:i}function Pn(e,t,i){return e<t?t:e>i?i:e}function $E(e){return Math.log(e)*Math.LOG2E}var ur=Math.log2||$E;function ce(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var le=Math.PI,S_=le/4,ie=le/180,th=180/le,dr=512,ys=4003e4,pr=85.051129,b_=1.5;function eh(e){return ur(e)}function Ve(e){let[t,i]=e;ce(Number.isFinite(t)),ce(Number.isFinite(i)&&i>=-90&&i<=90,"invalid latitude");let n=t*ie,o=i*ie,a=dr*(n+le)/(2*le),l=dr*(le+Math.log(Math.tan(S_+o*.5)))/(2*le);return[a,l]}function Ht(e){let[t,i]=e,n=t/dr*(2*le)-le,o=2*(Math.atan(Math.exp(i/dr*(2*le)-le))-S_);return[n*th,o*th]}function ih(e){let{latitude:t}=e;ce(Number.isFinite(t));let i=Math.cos(t*ie);return eh(ys*i)-9}function Mn(e){let t=Math.cos(e*ie);return dr/ys/t}function _r(e){let{latitude:t,longitude:i,highPrecision:n=!1}=e;ce(Number.isFinite(t)&&Number.isFinite(i));let o=dr,a=Math.cos(t*ie),l=o/360,h=l/a,u=o/ys/a,p={unitsPerMeter:[u,u,u],metersPerUnit:[1/u,1/u,1/u],unitsPerDegree:[l,h,u],degreesPerUnit:[1/l,1/h,1/u]};if(n){let m=ie*Math.tan(t*ie)/a,g=l*m/2,T=o/ys*m,y=T/h*u;p.unitsPerDegree2=[0,g,T],p.unitsPerMeter2=[y,0,y]}return p}function rh(e,t){let[i,n,o]=e,[a,l,h]=t,{unitsPerMeter:u,unitsPerMeter2:p}=_r({longitude:i,latitude:n,highPrecision:!0}),m=Ve(e);m[0]+=a*(u[0]+p[0]*l),m[1]+=l*(u[1]+p[1]*l);let g=Ht(m),T=(o||0)+(h||0);return Number.isFinite(o)||Number.isFinite(h)?[g[0],g[1],T]:g}function xs(e){let{height:t,pitch:i,bearing:n,altitude:o,scale:a,center:l}=e,h=Ql();bt.translate(h,h,[0,0,-o]),bt.rotateX(h,h,-i*ie),bt.rotateZ(h,h,n*ie);let u=a/t;return bt.scale(h,h,[u,u,u]),l&&bt.translate(h,h,gn.negate([],l)),h}function nh(e){let{width:t,height:i,altitude:n,pitch:o=0,offset:a,center:l,scale:h,nearZMultiplier:u=1,farZMultiplier:p=1}=e,{fovy:m=wi(b_)}=e;n!==void 0&&(m=wi(n));let g=m*ie,T=o*ie,y=Cn(m),E=y;l&&(E+=l[2]*h/Math.cos(T)/i);let S=g*(.5+(a?a[1]:0)/i),v=Math.sin(S)*E/Math.sin(Pn(Math.PI/2-T-S,.01,Math.PI-.01)),A=Math.sin(T)*v+E,P=E*10,w=Math.min(A*p,P);return{fov:g,aspect:t/i,focalDistance:y,near:u,far:w}}function wi(e){return 2*Math.atan(.5/e)*th}function Cn(e){return .5/Math.tan(.5*e*ie)}function vs(e,t){let[i,n,o=0]=e;return ce(Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(o)),ni(t,[i,n,o,1])}function oi(e,t,i=0){let[n,o,a]=e;if(ce(Number.isFinite(n)&&Number.isFinite(o),"invalid pixel coordinate"),Number.isFinite(a))return ni(t,[n,o,a,1]);let l=ni(t,[n,o,0,1]),h=ni(t,[n,o,1,1]),u=l[2],p=h[2],m=u===p?0:((i||0)-u)/(p-u);return ae.lerp([],l,h,m)}function Es(e){let{width:t,height:i,bounds:n,minExtent:o=0,maxZoom:a=24,offset:l=[0,0]}=e,[[h,u],[p,m]]=n,g=YE(e.padding),T=Ve([h,Pn(m,-pr,pr)]),y=Ve([p,Pn(u,-pr,pr)]),E=[Math.max(Math.abs(y[0]-T[0]),o),Math.max(Math.abs(y[1]-T[1]),o)],S=[t-g.left-g.right-Math.abs(l[0])*2,i-g.top-g.bottom-Math.abs(l[1])*2];ce(S[0]>0&&S[1]>0);let v=S[0]/E[0],A=S[1]/E[1],P=(g.right-g.left)/2/v,w=(g.top-g.bottom)/2/A,O=[(y[0]+T[0])/2+P,(y[1]+T[1])/2+w],N=Ht(O),C=Math.min(a,ur(Math.abs(Math.min(v,A))));return ce(Number.isFinite(C)),{longitude:N[0],latitude:N[1],zoom:C}}function YE(e=0){return typeof e=="number"?{top:e,bottom:e,left:e,right:e}:(ce(Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.left)&&Number.isFinite(e.right)),e)}var A_=Math.PI/180;function Ss(e,t=0){let{width:i,height:n,unproject:o}=e,a={targetZ:t},l=o([0,n],a),h=o([i,n],a),u,p,m=e.fovy?.5*e.fovy*A_:Math.atan(.5/e.altitude),g=(90-e.pitch)*A_;return m>g-.01?(u=R_(e,0,t),p=R_(e,i,t)):(u=o([0,0],a),p=o([i,0],a)),[l,h,p,u]}function R_(e,t,i){let{pixelUnprojectionMatrix:n}=e,o=ni(n,[t,0,1,1]),a=ni(n,[t,e.height,1,1]),h=(i*e.distanceScales.unitsPerMeter[2]-o[2])/(a[2]-o[2]),u=ae.lerp([],o,a,h),p=Ht(u);return p.push(i),p}var P_=512;function oh(e){let{width:t,height:i,pitch:n=0}=e,{longitude:o,latitude:a,zoom:l,bearing:h=0}=e;(o<-180||o>180)&&(o=Gl(o+180,360)-180),(h<-180||h>180)&&(h=Gl(h+180,360)-180);let u=ur(i/P_);if(l<=u)l=u,a=0;else{let p=i/2/Math.pow(2,l),m=Ht([0,p])[1];if(a<m)a=m;else{let g=Ht([0,P_-p])[1];a>g&&(a=g)}}return{width:t,height:i,longitude:o,latitude:a,zoom:l,pitch:n,bearing:h}}var M_=`
785
- uniform shadowUniforms {
786
- bool drawShadowMap;
787
- bool useShadowMap;
788
- vec4 color;
789
- highp int lightId;
790
- float lightCount;
791
- mat4 viewProjectionMatrix0;
792
- mat4 viewProjectionMatrix1;
793
- vec4 projectCenter0;
794
- vec4 projectCenter1;
795
- } shadow;
796
- `,JE=`
797
- const int max_lights = 2;
798
-
799
- out vec3 shadow_vPosition[max_lights];
800
-
801
- vec4 shadow_setVertexPosition(vec4 position_commonspace) {
802
- mat4 viewProjectionMatrices[max_lights];
803
- viewProjectionMatrices[0] = shadow.viewProjectionMatrix0;
804
- viewProjectionMatrices[1] = shadow.viewProjectionMatrix1;
805
- vec4 projectCenters[max_lights];
806
- projectCenters[0] = shadow.projectCenter0;
807
- projectCenters[1] = shadow.projectCenter1;
808
-
809
- if (shadow.drawShadowMap) {
810
- return project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[shadow.lightId], projectCenters[shadow.lightId]);
811
- }
812
- if (shadow.useShadowMap) {
813
- for (int i = 0; i < max_lights; i++) {
814
- if(i < int(shadow.lightCount)) {
815
- vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[i], projectCenters[i]);
816
- shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;
817
- }
818
- }
819
- }
820
- return gl_Position;
821
- }
822
- `,QE=`
823
- ${M_}
824
- ${JE}
825
- `,GE=`
826
- const int max_lights = 2;
827
- uniform sampler2D shadow_uShadowMap0;
828
- uniform sampler2D shadow_uShadowMap1;
829
-
830
- in vec3 shadow_vPosition[max_lights];
831
-
832
- const vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);
833
- const vec4 bitUnpackShift = 1.0 / bitPackShift;
834
- const vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);
835
-
836
- float shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {
837
- vec4 rgbaDepth = texture(shadowMap, position.xy);
838
-
839
- float z = dot(rgbaDepth, bitUnpackShift);
840
- return smoothstep(0.001, 0.01, position.z - z);
841
- }
842
-
843
- vec4 shadow_filterShadowColor(vec4 color) {
844
- if (shadow.drawShadowMap) {
845
- vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);
846
- rgbaDepth -= rgbaDepth.gbaa * bitMask;
847
- return rgbaDepth;
848
- }
849
- if (shadow.useShadowMap) {
850
- float shadowAlpha = 0.0;
851
- shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);
852
- if(shadow.lightCount > 1.0) {
853
- shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);
854
- }
855
- shadowAlpha *= shadow.color.a / shadow.lightCount;
856
- float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);
857
-
858
- return vec4(
859
- mix(color.rgb, shadow.color.rgb, shadowAlpha / blendedAlpha),
860
- blendedAlpha
861
- );
862
- }
863
- return color;
864
- }
865
- `,tS=`
866
- ${M_}
867
- ${GE}
868
- `,eS=fr(sS),iS=fr(aS),rS=[0,0,0,1],nS=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function oS(e,t){let[i,n,o]=e,a=oi([i,n,o],t);return Number.isFinite(o)?a:[a[0],a[1],0]}function sS({viewport:e,center:t}){return new Ct(e.viewProjectionMatrix).invert().transform(t)}function aS({viewport:e,shadowMatrices:t}){let i=[],n=e.pixelUnprojectionMatrix,o=e.isGeospatial?void 0:1,a=[[0,0,o],[e.width,0,o],[0,e.height,o],[e.width,e.height,o],[0,0,-1],[e.width,0,-1],[0,e.height,-1],[e.width,e.height,-1]].map(l=>oS(l,n));for(let l of t){let h=l.clone().translate(new Pt(e.center).negate()),u=a.map(m=>h.transform(m)),p=new Ct().ortho({left:Math.min(...u.map(m=>m[0])),right:Math.max(...u.map(m=>m[0])),bottom:Math.min(...u.map(m=>m[1])),top:Math.max(...u.map(m=>m[1])),near:Math.min(...u.map(m=>-m[2])),far:Math.max(...u.map(m=>-m[2]))});i.push(p.multiplyRight(l))}return i}function cS(e){let{shadowEnabled:t=!0,project:i}=e;if(!t||!i||!e.shadowMatrices||!e.shadowMatrices.length)return{drawShadowMap:!1,useShadowMap:!1,shadow_uShadowMap0:e.dummyShadowMap,shadow_uShadowMap1:e.dummyShadowMap};let n=Jl.getUniforms(i),o=eS({viewport:i.viewport,center:n.center}),a=[],l=iS({shadowMatrices:e.shadowMatrices,viewport:i.viewport}).slice();for(let u=0;u<e.shadowMatrices.length;u++){let p=l[u],m=p.clone().translate(new Pt(i.viewport.center).negate());n.coordinateSystem===_t.LNGLAT&&n.projectionMode===It.WEB_MERCATOR?(l[u]=m,a[u]=o):(l[u]=p.clone().multiplyRight(nS),a[u]=m.transform(o))}let h={drawShadowMap:Boolean(e.drawToShadowMap),useShadowMap:e.shadowMaps?e.shadowMaps.length>0:!1,color:e.shadowColor||rS,lightId:e.shadowLightId||0,lightCount:e.shadowMatrices.length,shadow_uShadowMap0:e.dummyShadowMap,shadow_uShadowMap1:e.dummyShadowMap};for(let u=0;u<l.length;u++)h[`viewProjectionMatrix${u}`]=l[u],h[`projectCenter${u}`]=a[u];for(let u=0;u<2;u++)h[`shadow_uShadowMap${u}`]=e.shadowMaps&&e.shadowMaps[u]||e.dummyShadowMap;return h}var sh={name:"shadow",dependencies:[Jl],vs:QE,fs:tS,inject:{"vs:DECKGL_FILTER_GL_POSITION":`
869
- position = shadow_setVertexPosition(geometry.position);
870
- `,"fs:DECKGL_FILTER_COLOR":`
871
- color = shadow_filterShadowColor(color);
872
- `},getUniforms:cS,uniformTypes:{drawShadowMap:"f32",useShadowMap:"f32",color:"vec4<f32>",lightId:"i32",lightCount:"f32",viewProjectionMatrix0:"mat4x4<f32>",viewProjectionMatrix1:"mat4x4<f32>",projectCenter0:"vec4<f32>",projectCenter1:"vec4<f32>"}};var lS=[as],hS=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"],fS=[];function C_(e){let t=qi.getDefaultShaderAssembler();for(let n of lS)t.addDefaultModule(n);t._hookFunctions.length=0;let i=e==="glsl"?hS:fS;for(let n of i)t.addShaderHook(n);return t}var uS=[255,255,255],dS=1,pS=0,bs=class{constructor(t={}){this.type="ambient";let{color:i=uS}=t,{intensity:n=dS}=t;this.id=t.id||`ambient-${pS++}`,this.color=i,this.intensity=n}};var _S=[255,255,255],mS=1,gS=[0,0,-1],TS=0,In=class{constructor(t={}){this.type="directional";let{color:i=_S}=t,{intensity:n=mS}=t,{direction:o=gS}=t,{_shadow:a=!1}=t;this.id=t.id||`directional-${TS++}`,this.color=i,this.intensity=n,this.type="directional",this.direction=new Pt(o).normalize().toArray(),this.shadow=a}getProjectedLight(t){return this}};var On=class{constructor(t,i={id:"pass"}){let{id:n}=i;this.id=n,this.device=t,this.props={...i}}setProps(t){Object.assign(this.props,t)}render(t){}cleanup(){}};var We=class extends On{constructor(){super(...arguments),this._lastRenderIndex=-1}render(t){let[i,n]=this.device.canvasContext.getDrawingBufferSize(),o=t.clearCanvas??!0,a=t.clearColor??(o?[0,0,0,0]:!1),l=o?1:!1,h=o?0:!1,u=t.colorMask??15,p={viewport:[0,0,i,n]};t.colorMask&&(p.colorMask=u),t.scissorRect&&(p.scissorRect=t.scissorRect);let m=this.device.beginRenderPass({framebuffer:t.target,parameters:p,clearColor:a,clearDepth:l,clearStencil:h});try{return this._drawLayers(m,t)}finally{m.end(),this.device.submit()}}_drawLayers(t,i){let{target:n,shaderModuleProps:o,viewports:a,views:l,onViewportActive:h,clearStack:u=!0}=i;i.pass=i.pass||"unknown",u&&(this._lastRenderIndex=-1);let p=[];for(let m of a){let g=l&&l[m.id];h?.(m);let T=this._getDrawLayerParams(m,i),y=m.subViewports||[m];for(let E of y){let S=this._drawLayersInViewport(t,{target:n,shaderModuleProps:o,viewport:E,view:g,pass:i.pass,layers:i.layers},T);p.push(S)}}return p}_getDrawLayerParams(t,{layers:i,pass:n,isPicking:o=!1,layerFilter:a,cullRect:l,effects:h,shaderModuleProps:u},p=!1){let m=[],g=O_(this._lastRenderIndex+1),T={layer:i[0],viewport:t,isPicking:o,renderPass:n,cullRect:l},y={};for(let E=0;E<i.length;E++){let S=i[E],v=this._shouldDrawLayer(S,T,a,y),A={shouldDrawLayer:v};v&&!p&&(A.shouldDrawLayer=!0,A.layerRenderIndex=g(S,v),A.shaderModuleProps=this._getShaderModuleProps(S,h,n,u),A.layerParameters={...S.context.deck?.props.parameters,...this.getLayerParameters(S,E,t)}),m[E]=A}return m}_drawLayersInViewport(t,{layers:i,shaderModuleProps:n,pass:o,target:a,viewport:l,view:h},u){let p=yS(this.device,{shaderModuleProps:n,target:a,viewport:l});if(h){let{clear:g,clearColor:T,clearDepth:y,clearStencil:E}=h.props;if(g){let S=[0,0,0,0],v=1,A=0;Array.isArray(T)?S=[...T.slice(0,3),T[3]||255].map(w=>w/255):T===!1&&(S=!1),y!==void 0&&(v=y),E!==void 0&&(A=E),this.device.beginRenderPass({framebuffer:a,parameters:{viewport:p,scissorRect:p},clearColor:S,clearDepth:v,clearStencil:A}).end()}}let m={totalCount:i.length,visibleCount:0,compositeCount:0,pickableCount:0};t.setParameters({viewport:p});for(let g=0;g<i.length;g++){let T=i[g],y=u[g],{shouldDrawLayer:E}=y;if(E&&T.props.pickable&&m.pickableCount++,T.isComposite&&m.compositeCount++,T.isDrawable&&y.shouldDrawLayer){let{layerRenderIndex:S,shaderModuleProps:v,layerParameters:A}=y;m.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,S),v.project&&(v.project.viewport=l),T.context.renderPass=t;try{T._drawLayer({renderPass:t,shaderModuleProps:v,uniforms:{layerIndex:S},parameters:A})}catch(P){T.raiseError(P,`drawing ${T} to ${o}`)}}}return m}shouldDrawLayer(t){return!0}getShaderModuleProps(t,i,n){return null}getLayerParameters(t,i,n){return t.props.parameters}_shouldDrawLayer(t,i,n,o){if(!(t.props.visible&&this.shouldDrawLayer(t)))return!1;i.layer=t;let l=t.parent;for(;l;){if(!l.props.visible||!l.filterSubLayer(i))return!1;i.layer=l,l=l.parent}if(n){let h=i.layer.id;if(h in o||(o[h]=n(i)),!o[h])return!1}return t.activateViewport(i.viewport),!0}_getShaderModuleProps(t,i,n,o){let a=this.device.canvasContext.cssToDeviceRatio(),l=t.internalState?.propsInTransition||t.props,h={layer:l,picking:{isActive:!1},project:{viewport:t.context.viewport,devicePixelRatio:a,modelMatrix:l.modelMatrix,coordinateSystem:l.coordinateSystem,coordinateOrigin:l.coordinateOrigin,autoWrapLongitude:t.wrapLongitude}};if(i)for(let u of i)I_(h,u.getShaderModuleProps?.(t,h));return I_(h,this.getShaderModuleProps(t,i,h),o)}};function O_(e=0,t={}){let i={},n=(o,a)=>{let l=o.props._offset,h=o.id,u=o.parent&&o.parent.id,p;if(u&&!(u in t)&&n(o.parent,!1),u in i){let m=i[u]=i[u]||O_(t[u],t);p=m(o,a),i[h]=m}else Number.isFinite(l)?(p=l+(t[u]||0),i[h]=null):p=e;return a&&p>=e&&(e=p+1),t[h]=p,p};return n}function yS(e,{shaderModuleProps:t,target:i,viewport:n}){let o=t?.project?.devicePixelRatio??e.canvasContext.cssToDeviceRatio(),[,a]=e.canvasContext.getDrawingBufferSize(),l=i?i.height:a,h=n;return[h.x*o,l-(h.y+h.height)*o,h.width*o,h.height*o]}function I_(e,...t){for(let i of t)if(i)for(let n in i)e[n]?Object.assign(e[n],i[n]):e[n]=i[n];return e}var Nn=class extends We{constructor(t,i){super(t,i);let n=t.createTexture({format:"rgba8unorm",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),o=t.createTexture({format:"depth16unorm",width:1,height:1});this.fbo=t.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[n],depthStencilAttachment:o})}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null)}getShadowMap(){return this.fbo.colorAttachments[0].texture}render(t){let i=this.fbo,n=this.device.canvasContext.cssToDeviceRatio(),o=t.viewports[0],a=o.width*n,l=o.height*n,h=[1,1,1,1];(a!==i.width||l!==i.height)&&i.resize({width:a,height:l}),super.render({...t,clearColor:h,target:i,pass:"shadow"})}getLayerParameters(t,i,n){return{...t.props.parameters,blend:!1,depthWriteEnabled:!0,depthCompare:"less-equal"}}shouldDrawLayer(t){return t.props.shadowEnabled!==!1}getShaderModuleProps(t,i,n){return{shadow:{project:n.project,drawToShadowMap:!0}}}};var xS={color:[255,255,255],intensity:1},N_=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],vS=[0,0,0,200/255],mr=class{constructor(t={}){this.id="lighting-effect",this.shadowColor=vS,this.shadow=!1,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.dummyShadowMap=null,this.setProps(t)}setup(t){this.context=t;let{device:i,deck:n}=t;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(i),n._addDefaultShaderModule(sh),this.dummyShadowMap=i.createTexture({width:1,height:1}))}setProps(t){this.ambientLight=void 0,this.directionalLights=[],this.pointLights=[];for(let i in t){let n=t[i];switch(n.type){case"ambient":this.ambientLight=n;break;case"directional":this.directionalLights.push(n);break;case"point":this.pointLights.push(n);break;default:}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(i=>i.shadow),this.context&&this.setup(this.context),this.props=t}preRender({layers:t,layerFilter:i,viewports:n,onViewportActive:o,views:a}){if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let l=0;l<this.shadowPasses.length;l++)this.shadowPasses[l].render({layers:t,layerFilter:i,viewports:n,onViewportActive:o,views:a,shaderModuleProps:{shadow:{shadowLightId:l,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}}})}}getShaderModuleProps(t,i){let n=this.shadow?{project:i.project,shadowMaps:this.shadowPasses.map(l=>l.getShadowMap()),dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{},o={enabled:!0,ambientLight:this.ambientLight,directionalLights:this.directionalLights.map(l=>l.getProjectedLight({layer:t})),pointLights:this.pointLights.map(l=>l.getProjectedLight({layer:t}))},a=t.props.material;return{shadow:n,lighting:o,phongMaterial:a,gouraudMaterial:a}}cleanup(t){for(let i of this.shadowPasses)i.delete();this.shadowPasses.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,t.deck._removeDefaultShaderModule(sh))}_calculateMatrices(){let t=[];for(let i of this.directionalLights){let n=new Ct().lookAt({eye:new Pt(i.direction).negate()});t.push(n)}return t}_createShadowPasses(t){for(let i=0;i<this.directionalLights.length;i++){let n=new Nn(t);this.shadowPasses[i]=n}}_applyDefaultLights(){let{ambientLight:t,pointLights:i,directionalLights:n}=this;!t&&i.length===0&&n.length===0&&(this.ambientLight=new bs(xS),this.directionalLights.push(new In(N_[0]),new In(N_[1])))}};var ah=class{constructor(t={}){this._pool=[],this.opts={overAlloc:2,poolSize:100},this.setOptions(t)}setOptions(t){Object.assign(this.opts,t)}allocate(t,i,{size:n=1,type:o,padding:a=0,copy:l=!1,initialize:h=!1,maxCount:u}){let p=o||t&&t.constructor||Float32Array,m=i*n+a;if(ArrayBuffer.isView(t)){if(m<=t.length)return t;if(m*t.BYTES_PER_ELEMENT<=t.buffer.byteLength)return new p(t.buffer,0,m)}let g=1/0;u&&(g=u*n+a);let T=this._allocate(p,m,h,g);return t&&l?T.set(t):h||T.fill(0,0,4),this._release(t),T}release(t){this._release(t)}_allocate(t,i,n,o){let a=Math.max(Math.ceil(i*this.opts.overAlloc),1);a>o&&(a=o);let l=this._pool,h=t.BYTES_PER_ELEMENT*a,u=l.findIndex(p=>p.byteLength>=h);if(u>=0){let p=new t(l.splice(u,1)[0],0,a);return n&&p.fill(0),p}return new t(a)}_release(t){if(!ArrayBuffer.isView(t))return;let i=this._pool,{buffer:n}=t,{byteLength:o}=n,a=i.findIndex(l=>l.byteLength>=o);a<0?i.push(n):(a>0||i.length<this.opts.poolSize)&&i.splice(a,0,n),i.length>this.opts.poolSize&&i.shift()}},D_=new ah;function Tr(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function B_(e){return[e[12],e[13],e[14]]}function L_(e){return{left:gr(e[3]+e[0],e[7]+e[4],e[11]+e[8],e[15]+e[12]),right:gr(e[3]-e[0],e[7]-e[4],e[11]-e[8],e[15]-e[12]),bottom:gr(e[3]+e[1],e[7]+e[5],e[11]+e[9],e[15]+e[13]),top:gr(e[3]-e[1],e[7]-e[5],e[11]-e[9],e[15]-e[13]),near:gr(e[3]+e[2],e[7]+e[6],e[11]+e[10],e[15]+e[14]),far:gr(e[3]-e[2],e[7]-e[6],e[11]-e[10],e[15]-e[14])}}var F_=new Pt;function gr(e,t,i,n){F_.set(e,t,i);let o=F_.len();return{distance:n/o,normal:new Pt(-e/o,-t/o,-i/o)}}var ES=Math.PI/180,SS=Tr(),k_=[0,0,0],bS={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};function AS({width:e,height:t,orthographic:i,fovyRadians:n,focalDistance:o,padding:a,near:l,far:h}){let u=e/t,p=i?new Ct().orthographic({fovy:n,aspect:u,focalDistance:o,near:l,far:h}):new Ct().perspective({fovy:n,aspect:u,near:l,far:h});if(a){let{left:m=0,right:g=0,top:T=0,bottom:y=0}=a,E=te((m+e-g)/2,0,e)-e/2,S=te((T+t-y)/2,0,t)-t/2;p[8]-=E*2/e,p[9]+=S*2/t}return p}var yr=class{constructor(t={}){this._frustumPlanes={},this.id=t.id||this.constructor.displayName||"viewport",this.x=t.x||0,this.y=t.y||0,this.width=t.width||1,this.height=t.height||1,this.zoom=t.zoom||0,this.padding=t.padding,this.distanceScales=t.distanceScales||bS,this.focalDistance=t.focalDistance||1,this.position=t.position||k_,this.modelMatrix=t.modelMatrix||null;let{longitude:i,latitude:n}=t;this.isGeospatial=Number.isFinite(n)&&Number.isFinite(i),this._initProps(t),this._initMatrices(t),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}get subViewports(){return null}get metersPerPixel(){return this.distanceScales.metersPerUnit[2]/this.scale}get projectionMode(){return this.isGeospatial?this.zoom<12?It.WEB_MERCATOR:It.WEB_MERCATOR_AUTO_OFFSET:It.IDENTITY}equals(t){return t instanceof yr?this===t?!0:t.width===this.width&&t.height===this.height&&t.scale===this.scale&&Le(t.projectionMatrix,this.projectionMatrix)&&Le(t.viewMatrix,this.viewMatrix):!1}project(t,{topLeft:i=!0}={}){let n=this.projectPosition(t),o=vs(n,this.pixelProjectionMatrix),[a,l]=o,h=i?l:this.height-l;return t.length===2?[a,h]:[a,h,o[2]]}unproject(t,{topLeft:i=!0,targetZ:n}={}){let[o,a,l]=t,h=i?a:this.height-a,u=n&&n*this.distanceScales.unitsPerMeter[2],p=oi([o,h,l],this.pixelUnprojectionMatrix,u),[m,g,T]=this.unprojectPosition(p);return Number.isFinite(l)?[m,g,T]:Number.isFinite(n)?[m,g,n]:[m,g]}projectPosition(t){let[i,n]=this.projectFlat(t),o=(t[2]||0)*this.distanceScales.unitsPerMeter[2];return[i,n,o]}unprojectPosition(t){let[i,n]=this.unprojectFlat(t),o=(t[2]||0)*this.distanceScales.metersPerUnit[2];return[i,n,o]}projectFlat(t){if(this.isGeospatial){let i=Ve(t);return i[1]=te(i[1],-318,830),i}return t}unprojectFlat(t){return this.isGeospatial?Ht(t):t}getBounds(t={}){let i={targetZ:t.z||0},n=this.unproject([0,0],i),o=this.unproject([this.width,0],i),a=this.unproject([0,this.height],i),l=this.unproject([this.width,this.height],i);return[Math.min(n[0],o[0],a[0],l[0]),Math.min(n[1],o[1],a[1],l[1]),Math.max(n[0],o[0],a[0],l[0]),Math.max(n[1],o[1],a[1],l[1])]}getDistanceScales(t){return t&&this.isGeospatial?_r({longitude:t[0],latitude:t[1],highPrecision:!0}):this.distanceScales}containsPixel({x:t,y:i,width:n=1,height:o=1}){return t<this.x+this.width&&this.x<t+n&&i<this.y+this.height&&this.y<i+o}getFrustumPlanes(){return this._frustumPlanes.near?this._frustumPlanes:(Object.assign(this._frustumPlanes,L_(this.viewProjectionMatrix)),this._frustumPlanes)}panByPosition(t,i){return null}_initProps(t){let i=t.longitude,n=t.latitude;this.isGeospatial&&(Number.isFinite(t.zoom)||(this.zoom=ih({latitude:n})+Math.log2(this.focalDistance)),this.distanceScales=t.distanceScales||_r({latitude:n,longitude:i}));let o=Math.pow(2,this.zoom);this.scale=o;let{position:a,modelMatrix:l}=t,h=k_;if(a&&(h=l?new Ct(l).transformAsVector(a,[]):a),this.isGeospatial){let u=this.projectPosition([i,n,0]);this.center=new Pt(h).scale(this.distanceScales.unitsPerMeter).add(u)}else this.center=this.projectPosition(h)}_initMatrices(t){let{viewMatrix:i=SS,projectionMatrix:n=null,orthographic:o=!1,fovyRadians:a,fovy:l=75,near:h=.1,far:u=1e3,padding:p=null,focalDistance:m=1}=t;this.viewMatrixUncentered=i,this.viewMatrix=new Ct().multiplyRight(i).translate(new Pt(this.center).negate()),this.projectionMatrix=n||AS({width:this.width,height:this.height,orthographic:o,fovyRadians:a||l*ES,focalDistance:m,padding:p,near:h,far:u});let g=Tr();bt.multiply(g,g,this.projectionMatrix),bt.multiply(g,g,this.viewMatrix),this.viewProjectionMatrix=g,this.viewMatrixInverse=bt.invert([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=B_(this.viewMatrixInverse);let T=Tr(),y=Tr();bt.scale(T,T,[this.width/2,-this.height/2,1]),bt.translate(T,T,[1,-1,0]),bt.multiply(y,T,this.viewProjectionMatrix),this.pixelProjectionMatrix=y,this.pixelUnprojectionMatrix=bt.invert(Tr(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||ct.warn("Pixel project matrix not invertible")()}};yr.displayName="Viewport";var As=yr;var Pi=class extends As{constructor(t={}){let{latitude:i=0,longitude:n=0,zoom:o=0,pitch:a=0,bearing:l=0,nearZMultiplier:h=.1,farZMultiplier:u=1.01,nearZ:p,farZ:m,orthographic:g=!1,projectionMatrix:T,repeat:y=!1,worldOffset:E=0,position:S,padding:v,legacyMeterSizes:A=!1}=t,{width:P,height:w,altitude:O=1.5}=t,N=Math.pow(2,o);P=P||1,w=w||1;let C,V=null;if(T)O=T[5]/2,C=wi(O);else{t.fovy?(C=t.fovy,O=Cn(C)):C=wi(O);let D;if(v){let{top:B=0,bottom:j=0}=v;D=[0,te((B+w-j)/2,0,w)-w/2]}V=nh({width:P,height:w,scale:N,center:S&&[0,0,S[2]*Mn(i)],offset:D,pitch:a,fovy:C,nearZMultiplier:h,farZMultiplier:u}),Number.isFinite(p)&&(V.near=p),Number.isFinite(m)&&(V.far=m)}let U=xs({height:w,pitch:a,bearing:l,scale:N,altitude:O});E&&(U=new Ct().translate([512*E,0,0]).multiplyLeft(U)),super({...t,width:P,height:w,viewMatrix:U,longitude:n,latitude:i,zoom:o,...V,fovy:C,focalDistance:O}),this.latitude=i,this.longitude=n,this.zoom=o,this.pitch=a,this.bearing=l,this.altitude=O,this.fovy=C,this.orthographic=g,this._subViewports=y?[]:null,this._pseudoMeters=A,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){let t=this.getBounds(),i=Math.floor((t[0]+180)/360),n=Math.ceil((t[2]-180)/360);for(let o=i;o<=n;o++){let a=o?new Pi({...this,worldOffset:o}):this;this._subViewports.push(a)}}return this._subViewports}projectPosition(t){if(this._pseudoMeters)return super.projectPosition(t);let[i,n]=this.projectFlat(t),o=(t[2]||0)*Mn(t[1]);return[i,n,o]}unprojectPosition(t){if(this._pseudoMeters)return super.unprojectPosition(t);let[i,n]=this.unprojectFlat(t),o=(t[2]||0)/Mn(n);return[i,n,o]}addMetersToLngLat(t,i){return rh(t,i)}panByPosition(t,i){let n=oi(i,this.pixelUnprojectionMatrix),o=this.projectFlat(t),a=ae.add([],o,ae.negate([],n)),l=ae.add([],this.center,a),[h,u]=this.unprojectFlat(l);return{longitude:h,latitude:u}}getBounds(t={}){let i=Ss(this,t.z||0);return[Math.min(i[0][0],i[1][0],i[2][0],i[3][0]),Math.min(i[0][1],i[1][1],i[2][1],i[3][1]),Math.max(i[0][0],i[1][0],i[2][0],i[3][0]),Math.max(i[0][1],i[1][1],i[2][1],i[3][1])]}fitBounds(t,i={}){let{width:n,height:o}=this,{longitude:a,latitude:l,zoom:h}=Es({width:n,height:o,bounds:t,...i});return new Pi({width:n,height:o,longitude:a,latitude:l,zoom:h})}};Pi.displayName="WebMercatorViewport";var U_=Pi;var RS=1,wS=1,Mi=class{time=0;channels=new Map;animations=new Map;playing=!1;lastEngineTime=-1;constructor(){}addChannel(t){let{delay:i=0,duration:n=Number.POSITIVE_INFINITY,rate:o=1,repeat:a=1}=t,l=RS++,h={time:0,delay:i,duration:n,rate:o,repeat:a};return this._setChannelTime(h,this.time),this.channels.set(l,h),l}removeChannel(t){this.channels.delete(t);for(let[i,n]of this.animations)n.channel===t&&this.detachAnimation(i)}isFinished(t){let i=this.channels.get(t);return i===void 0?!1:this.time>=i.delay+i.duration*i.repeat}getTime(t){if(t===void 0)return this.time;let i=this.channels.get(t);return i===void 0?-1:i.time}setTime(t){this.time=Math.max(0,t);let i=this.channels.values();for(let o of i)this._setChannelTime(o,this.time);let n=this.animations.values();for(let o of n){let{animation:a,channel:l}=o;a.setTime(this.getTime(l))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,i){let n=wS++;return this.animations.set(n,{animation:t,channel:i}),t.setTime(this.getTime(i)),n}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,i){let n=i-t.delay,o=t.duration*t.repeat;n>=o?t.time=t.duration*t.rate:(t.time=Math.max(0,n)%t.duration,t.time*=t.rate)}};lt();function z_(e){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,1e3/60)}function V_(e){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e)}Kr();var PS=0,ch=class{device=null;canvas=null;props;animationProps=null;timeline=null;stats;cpuTime;gpuTime;frameRate;display;needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;_error=null;constructor(t){if(this.props={...ch.defaultAnimationLoopProps,...t},t=this.props,!t.device)throw new Error("No device provided");this.stats=t.stats||new qt({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:t.autoResizeViewport}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null)}delete(){this.destroy()}reportError(t){this.props.onError(t),this._error=t}setNeedsRedraw(t){return this.needsRedraw=this.needsRedraw||t,this}setProps(t){return"autoResizeViewport"in t&&(this.props.autoResizeViewport=t.autoResizeViewport||!1),this}async start(){if(this._running)return this;this._running=!0;try{let t;return this._initialized||(this._initialized=!0,await this._initDevice(),this._initialize(),await this.props.onInitialize(this._getAnimationProps())),this._running?(t!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(t){let i=t instanceof Error?t:new Error("Unknown error");throw this.props.onError(i),i}}stop(){return this._running&&(this.animationProps&&!this._error&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){return this.device?.isLost||this._error?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)}attachTimeline(t){return this.timeline=t,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(t=>{this._resolveNextFrame=t})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeViewport()}_setDisplay(t){this.display&&(this.display.destroy(),this.display.animationLoop=null),t&&(t.animationLoop=this),this.display=t}_requestAnimationFrame(){this._running&&(this._animationFrameId=z_(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(V_(this._animationFrameId),this._animationFrameId=null)}_animationFrame(){this._running&&(this.redraw(),this._requestAnimationFrame())}_renderFrame(t){if(this.display){this.display._renderFrame(t);return}this.props.onRender(this._getAnimationProps()),this.device?.submit()}_clearNeedsRedraw(){this.needsRedraw=!1}_setupFrame(){this._resizeViewport()}_initializeAnimationProps(){let t=this.device?.getDefaultCanvasContext();if(!this.device||!t)throw new Error("loop");let i=t?.canvas,n=t.props.useDevicePixels;this.animationProps={animationLoop:this,device:this.device,canvasContext:t,canvas:i,useDevicePixels:n,timeline:this.timeline,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;let{width:t,height:i,aspect:n}=this._getSizeAndAspect();(t!==this.animationProps.width||i!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),n!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=t,this.animationProps.height=i,this.animationProps.aspect=n,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=this.device.getDefaultCanvasContext().canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){let t=document.createElement("div");document.body.appendChild(t),t.style.position="relative";let i=document.createElement("div");i.style.position="absolute",i.style.left="10px",i.style.bottom="10px",i.style.width="300px",i.style.background="white",this.canvas instanceof HTMLCanvasElement&&t.appendChild(this.canvas),t.appendChild(i);let n=this.props.onAddHTML(i);n&&(i.innerHTML=n)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};let[t,i]=this.device?.getDefaultCanvasContext().getDevicePixelSize()||[1,1],n=1,o=this.device?.getDefaultCanvasContext().canvas;return o&&o.clientHeight?n=o.clientWidth/o.clientHeight:t>0&&i>0&&(n=t/i),{width:t,height:i,aspect:n}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_beginFrameTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()}_endFrameTimers(){this.cpuTime.timeEnd()}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(t){t instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[t.offsetX,t.offsetY])}_onMouseleave(t){this._getAnimationProps()._mousePosition=null}},xr=ch;z(xr,"defaultAnimationLoopProps",{device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:t=>console.error(t),stats:Ji.stats.get(`animation-loop-${PS++}`),autoResizeViewport:!1});var MS={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant",blendAlphaDstFactor:"zero"},Ci=class extends We{constructor(){super(...arguments),this._colorEncoderState=null}render(t){return"pickingFBO"in t?this._drawPickingBuffer(t):super.render(t)}_drawPickingBuffer({layers:t,layerFilter:i,views:n,viewports:o,onViewportActive:a,pickingFBO:l,deviceRect:{x:h,y:u,width:p,height:m},cullRect:g,effects:T,pass:y="picking",pickZ:E,shaderModuleProps:S}){this.pickZ=E;let v=this._resetColorEncoder(E),A=[h,u,p,m],P=super.render({target:l,layers:t,layerFilter:i,views:n,viewports:o,onViewportActive:a,cullRect:g,effects:T?.filter(O=>O.useInPicking),pass:y,isPicking:!0,shaderModuleProps:S,clearColor:[0,0,0,0],colorMask:15,scissorRect:A});return this._colorEncoderState=null,{decodePickingColor:v&&IS.bind(null,v),stats:P}}shouldDrawLayer(t){let{pickable:i,operation:n}=t.props;return i&&n.includes("draw")||n.includes("terrain")||n.includes("mask")}getShaderModuleProps(t,i,n){return{picking:{isActive:1,isAttribute:this.pickZ},lighting:{enabled:!1}}}getLayerParameters(t,i,n){let o={...t.props.parameters},{pickable:a,operation:l}=t.props;return!this._colorEncoderState||l.includes("terrain")?o.blend=!1:a&&l.includes("draw")&&(Object.assign(o,MS),o.blend=!0,o.blendColor=CS(this._colorEncoderState,t,n)),o}_resetColorEncoder(t){return this._colorEncoderState=t?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function CS(e,t,i){let{byLayer:n,byAlpha:o}=e,a,l=n.get(t);return l?(l.viewports.push(i),a=l.a):(a=n.size+1,a<=255?(l={a,layer:t,viewports:[i]},n.set(t,l),o[a]=l):(ct.warn("Too many pickable layers, only picking the first 255")(),a=0)),[0,0,0,a/255]}function IS(e,t){let i=e.byAlpha[t[3]];return i&&{pickedLayer:i.layer,pickedViewports:i.viewports,pickedObjectIndex:i.layer.decodePickingColor(t)}}var vr={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},LF=Symbol.for("component"),kF=Symbol.for("propTypes"),UF=Symbol.for("deprecatedProps"),zF=Symbol.for("asyncPropDefaults"),VF=Symbol.for("asyncPropOriginal"),WF=Symbol.for("asyncPropResolved");function Rs(e,t=()=>!0){return Array.isArray(e)?W_(e,t,[]):t(e)?[e]:[]}function W_(e,t,i){let n=-1;for(;++n<e.length;){let o=e[n];Array.isArray(o)?W_(o,t,i):t(o)&&i.push(o)}return i}Kr();var Dn=class{constructor(t,i,n){this._loadCount=0,this._subscribers=new Set,this.id=t,this.context=n,this.setData(i)}subscribe(t){this._subscribers.add(t)}unsubscribe(t){this._subscribers.delete(t)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(t,i){if(t===this._data&&!i)return;this._data=t;let n=++this._loadCount,o=t;typeof t=="string"&&(o=yc(t)),o instanceof Promise?(this.isLoaded=!1,this._loader=o.then(a=>{this._loadCount===n&&(this.isLoaded=!0,this._error=void 0,this._content=a)}).catch(a=>{this._loadCount===n&&(this.isLoaded=!0,this._error=a||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=t);for(let a of this._subscribers)a.onChange(this.getData())}};var Fn=class{constructor(t){this.protocol=t.protocol||"resource://",this._context={device:t.device,gl:t.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(t){return t.startsWith(this.protocol)?!0:t in this._resources}add({resourceId:t,data:i,forceUpdate:n=!1,persistent:o=!0}){let a=this._resources[t];a?a.setData(i,n):(a=new Dn(t,i,this._context),this._resources[t]=a),a.persistent=o}remove(t){let i=this._resources[t];i&&(i.delete(),delete this._resources[t])}unsubscribe({consumerId:t}){let i=this._consumers[t];if(i){for(let n in i){let o=i[n],a=this._resources[o.resourceId];a&&a.unsubscribe(o)}delete this._consumers[t],this.prune()}}subscribe({resourceId:t,onChange:i,consumerId:n,requestId:o="default"}){let{_resources:a,protocol:l}=this;t.startsWith(l)&&(t=t.replace(l,""),a[t]||this.add({resourceId:t,data:null,persistent:!1}));let h=a[t];if(this._track(n,o,h,i),h)return h.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let t in this._resources)this._resources[t].delete()}_track(t,i,n,o){let a=this._consumers,l=a[t]=a[t]||{},h=l[i],u=h&&h.resourceId&&this._resources[h.resourceId];u&&(u.unsubscribe(h),this.prune()),n&&(h?(h.onChange=o,h.resourceId=n.id):h={onChange:o,resourceId:n.id},l[i]=h,n.subscribe(h))}_prune(){this._pruneRequest=null;for(let t of Object.keys(this._resources)){let i=this._resources[t];!i.persistent&&!i.inUse()&&(i.delete(),delete this._resources[t])}}};var OS="layerManager.setLayers",NS="layerManager.activateViewport",Bn=class{constructor(t,i){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=h=>{$i(NS,this,h),h&&(this.context.viewport=h)};let{deck:n,stats:o,viewport:a,timeline:l}=i||{};this.layers=[],this.resourceManager=new Fn({device:t,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:t,gl:t?.gl,deck:n,shaderAssembler:C_(t?.info?.shadingLanguage||"glsl"),defaultShaderModules:[Vl],renderPass:void 0,stats:o||new qt({id:"deck.gl"}),viewport:a||new As({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:l||new Mi,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let t of this.layers)this._finalizeLayer(t)}needsRedraw(t={clearRedrawFlags:!1}){let i=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);for(let n of this.layers){let o=n.getNeedsRedraw(t);i=i||o}return i}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(t){this._needsRedraw=this._needsRedraw||t}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t}getLayers({layerIds:t}={}){return t?this.layers.filter(i=>t.find(n=>i.id.indexOf(n)===0)):this.layers}setProps(t){"debug"in t&&(this._debug=t.debug),"userData"in t&&(this.context.userData=t.userData),"layers"in t&&(this._nextLayers=t.layers),"onError"in t&&(this.context.onError=t.onError)}setLayers(t,i){$i(OS,this,i,t),this._lastRenderedLayers=t;let n=Rs(t,Boolean);for(let o of n)o.context=this.context;this._updateLayers(this.layers,n)}updateLayers(){let t=this.needsUpdate();t&&(this.setNeedsRedraw(`updating layers: ${t}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,t)),this._nextLayers=null}addDefaultShaderModule(t){let{defaultShaderModules:i}=this.context;i.find(n=>n.name===t.name)||(i.push(t),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(t){let{defaultShaderModules:i}=this.context,n=i.findIndex(o=>o.name===t.name);n>=0&&(i.splice(n,1),this._defaultShaderModulesChanged=!0)}_handleError(t,i,n){n.raiseError(i,`${t} of ${n}`)}_updateLayers(t,i){let n={};for(let l of t)n[l.id]?ct.warn(`Multiple old layers with same id ${l.id}`)():n[l.id]=l;if(this._defaultShaderModulesChanged){for(let l of t)l.setNeedsUpdate(),l.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}let o=[];this._updateSublayersRecursively(i,n,o),this._finalizeOldLayers(n);let a=!1;for(let l of o)if(l.hasUniformTransition()){a=`Uniform transition in ${l}`;break}this._needsUpdate=a,this.layers=o}_updateSublayersRecursively(t,i,n){for(let o of t){o.context=this.context;let a=i[o.id];a===null&&ct.warn(`Multiple new layers with same id ${o.id}`)(),i[o.id]=null;let l=null;try{this._debug&&a!==o&&o.validateProps(),a?(this._transferLayerState(a,o),this._updateLayer(o)):this._initializeLayer(o),n.push(o),l=o.isComposite?o.getSubLayers():null}catch(h){this._handleError("matching",h,o)}l&&this._updateSublayersRecursively(l,i,n)}}_finalizeOldLayers(t){for(let i in t){let n=t[i];n&&this._finalizeLayer(n)}}_initializeLayer(t){try{t._initialize(),t.lifecycle=vr.INITIALIZED}catch(i){this._handleError("initialization",i,t)}}_transferLayerState(t,i){i._transferState(t),i.lifecycle=vr.MATCHED,i!==t&&(t.lifecycle=vr.AWAITING_GC)}_updateLayer(t){try{t._update()}catch(i){this._handleError("update",i,t)}}_finalizeLayer(t){this._needsRedraw=this._needsRedraw||`finalized ${t}`,t.lifecycle=vr.AWAITING_FINALIZATION;try{t._finalize(),t.lifecycle=vr.FINALIZED}catch(i){this._handleError("finalization",i,t)}}};function Wt(e,t,i){if(e===t)return!0;if(!i||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Wt(e[n],t[n],i-1))return!1;return!0}if(Array.isArray(t))return!1;if(typeof e=="object"&&typeof t=="object"){let n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let a of n)if(!t.hasOwnProperty(a)||!Wt(e[a],t[a],i-1))return!1;return!0}return!1}var Ln=class{constructor(t){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=t.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=t.eventManager,this._eventCallbacks={onViewStateChange:t.onViewStateChange,onInteractionStateChange:t.onInteractionStateChange},Object.seal(this),this.setProps(t)}finalize(){for(let t in this.controllers){let i=this.controllers[t];i&&i.finalize()}this.controllers={}}needsRedraw(t={clearRedrawFlags:!1}){let i=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),i}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t,this._needsRedraw=this._needsRedraw||t}updateViewStates(){for(let t in this.controllers){let i=this.controllers[t];i&&i.updateTransition()}}getViewports(t){return t?this._viewports.filter(i=>i.containsPixel(t)):this._viewports}getViews(){let t={};return this.views.forEach(i=>{t[i.id]=i}),t}getView(t){return this.views.find(i=>i.id===t)}getViewState(t){let i=typeof t=="string"?this.getView(t):t,n=i&&this.viewState[i.getViewStateId()]||this.viewState;return i?i.filterViewState(n):n}getViewport(t){return this._viewportMap[t]}unproject(t,i){let n=this.getViewports(),o={x:t[0],y:t[1]};for(let a=n.length-1;a>=0;--a){let l=n[a];if(l.containsPixel(o)){let h=t.slice();return h[0]-=l.x,h[1]-=l.y,l.unproject(h,i)}}return null}setProps(t){t.views&&this._setViews(t.views),t.viewState&&this._setViewState(t.viewState),("width"in t||"height"in t)&&this._setSize(t.width,t.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(t,i){(t!==this.width||i!==this.height)&&(this.width=t,this.height=i,this.setNeedsUpdate("Size changed"))}_setViews(t){t=Rs(t,Boolean),this._diffViews(t,this.views)&&this.setNeedsUpdate("views changed"),this.views=t}_setViewState(t){t?(!Wt(t,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=t):ct.warn("missing `viewState` or `initialViewState`")()}_createController(t,i){let n=i.type;return new n({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:a=>this.getView(t.id)?.makeViewport({viewState:a,width:this.width,height:this.height})})}_updateController(t,i,n,o){let a=t.controller;if(a&&n){let l={...i,...a,id:t.id,x:n.x,y:n.y,width:n.width,height:n.height};return(!o||o.constructor!==a.type)&&(o=this._createController(t,l)),o&&o.setProps(l),o}return null}_rebuildViewports(){let{views:t}=this,i=this.controllers;this._viewports=[],this.controllers={};let n=!1;for(let o=t.length;o--;){let a=t[o],l=this.getViewState(a),h=a.makeViewport({viewState:l,width:this.width,height:this.height}),u=i[a.id],p=Boolean(a.controller);p&&!u&&(n=!0),(n||!p)&&u&&(u.finalize(),u=null),this.controllers[a.id]=this._updateController(a,l,h,u),h&&this._viewports.unshift(h)}for(let o in i){let a=i[o];a&&!this.controllers[o]&&a.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(t=>{t.id&&(this._viewportMap[t.id]=this._viewportMap[t.id]||t)})}_diffViews(t,i){return t.length!==i.length?!0:t.some((n,o)=>!t[o].equals(i[o]))}};var DS=/([0-9]+\.?[0-9]*)(%|px)/;function He(e){switch(typeof e){case"number":return{position:e,relative:!1};case"string":let t=DS.exec(e);if(t&&t.length>=3){let i=t[2]==="%",n=parseFloat(t[1]);return{position:i?n/100:n,relative:i}}default:throw new Error(`Could not parse position string ${e}`)}}function je(e,t){return e.relative?Math.round(e.position*t):e.position}var kn=class{constructor(t){let{id:i,x:n=0,y:o=0,width:a="100%",height:l="100%",padding:h=null}=t;this.id=i||this.constructor.displayName||"view",this.props={...t,id:this.id},this._x=He(n),this._y=He(o),this._width=He(a),this._height=He(l),this._padding=h&&{left:He(h.left||0),right:He(h.right||0),top:He(h.top||0),bottom:He(h.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(t){return this===t?!0:this.constructor===t.constructor&&Wt(this.props,t.props,2)}clone(t){let i=this.constructor;return new i({...this.props,...t})}makeViewport({width:t,height:i,viewState:n}){n=this.filterViewState(n);let o=this.getDimensions({width:t,height:i});if(!o.height||!o.width)return null;let a=this.getViewportType(n);return new a({...n,...this.props,...o})}getViewStateId(){let{viewState:t}=this.props;return typeof t=="string"?t:t?.id||this.id}filterViewState(t){if(this.props.viewState&&typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;let i={...t};for(let n in this.props.viewState)n!=="id"&&(i[n]=this.props.viewState[n]);return i}return t}getDimensions({width:t,height:i}){let n={x:je(this._x,t),y:je(this._y,i),width:je(this._width,t),height:je(this._height,i)};return this._padding&&(n.padding={left:je(this._padding.left,t),top:je(this._padding.top,i),right:je(this._padding.right,t),bottom:je(this._padding.bottom,i)}),n}get controller(){let t=this.props.controller;return t?t===!0?{type:this.ControllerType}:typeof t=="function"?{type:t}:{type:this.ControllerType,...t}:null}};var Un=class{constructor(t){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=t}get inProgress(){return this._inProgress}start(t){this.cancel(),this.settings=t,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:t,settings:i}=this;this._handle=t.addChannel({delay:t.getTime(),duration:i.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var H_=()=>{},lh={BREAK:1,SNAP_TO_END:2,IGNORE:3},FS=e=>e,BS=lh.BREAK,zn=class{constructor(t){this._onTransitionUpdate=i=>{let{time:n,settings:{interpolator:o,startProps:a,endProps:l,duration:h,easing:u}}=i,p=u(n/h),m=o.interpolateProps(a,l,p);this.propsInTransition=this.getControllerState({...this.props,...m}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=t.getControllerState,this.propsInTransition=null,this.transition=new Un(t.timeline),this.onViewStateChange=t.onViewStateChange||H_,this.onStateChange=t.onStateChange||H_}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(t){let i=!1,n=this.props;if(this.props=t,!n||this._shouldIgnoreViewportChange(n,t))return!1;if(this._isTransitionEnabled(t)){let o=n;if(this.transition.inProgress){let{interruption:a,endProps:l}=this.transition.settings;o={...n,...a===lh.SNAP_TO_END?l:this.propsInTransition||n}}this._triggerTransition(o,t),i=!0}else this.transition.cancel();return i}updateTransition(){this.transition.update()}_isTransitionEnabled(t){let{transitionDuration:i,transitionInterpolator:n}=t;return(i>0||i==="auto")&&Boolean(n)}_isUpdateDueToCurrentTransition(t){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition):!1}_shouldIgnoreViewportChange(t,i){return this.transition.inProgress?this.transition.settings.interruption===lh.IGNORE||this._isUpdateDueToCurrentTransition(i):this._isTransitionEnabled(i)?i.transitionInterpolator.arePropsEqual(t,i):!0}_triggerTransition(t,i){let n=this.getControllerState(t),o=this.getControllerState(i).shortestPathFrom(n),a=i.transitionInterpolator,l=a.getDuration?a.getDuration(t,i):i.transitionDuration;if(l===0)return;let h=a.initializeProps(t,o);this.propsInTransition={};let u={duration:l,easing:i.transitionEasing||FS,interpolator:a,interruption:i.transitionInterruption||BS,startProps:h.start,endProps:h.end,onStart:i.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(i.onTransitionInterrupt),onEnd:this._onTransitionEnd(i.onTransitionEnd)};this.transition.start(u),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(t){return i=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),t?.(i)}}};function re(e,t){if(!e)throw new Error(t||"deck.gl: assertion failed.")}var Vn=class{constructor(t){let{compare:i,extract:n,required:o}=t;this._propsToCompare=i,this._propsToExtract=n||i,this._requiredProps=o}arePropsEqual(t,i){for(let n of this._propsToCompare)if(!(n in t)||!(n in i)||!Le(t[n],i[n]))return!1;return!0}initializeProps(t,i){let n={},o={};for(let a of this._propsToExtract)(a in t||a in i)&&(n[a]=t[a],o[a]=i[a]);return this._checkRequiredProps(n),this._checkRequiredProps(o),{start:n,end:o}}getDuration(t,i){return i.transitionDuration}_checkRequiredProps(t){this._requiredProps&&this._requiredProps.forEach(i=>{let n=t[i];re(Number.isFinite(n)||Array.isArray(n),`${i} is required for transition`)})}};var LS=["longitude","latitude","zoom","bearing","pitch"],kS=["longitude","latitude","zoom"],Ii=class extends Vn{constructor(t={}){let i=Array.isArray(t)?t:t.transitionProps,n=Array.isArray(t)?{}:t;n.transitionProps=Array.isArray(i)?{compare:i,required:i}:i||{compare:LS,required:kS},super(n.transitionProps),this.opts=n}initializeProps(t,i){let n=super.initializeProps(t,i),{makeViewport:o,around:a}=this.opts;if(o&&a){let l=o(t),h=o(i),u=l.unproject(a);n.start.around=a,Object.assign(n.end,{around:h.project(u),aroundPosition:u,width:i.width,height:i.height})}return n}interpolateProps(t,i,n){let o={};for(let a of this._propsToExtract)o[a]=_n(t[a]||0,i[a]||0,n);if(i.aroundPosition&&this.opts.makeViewport){let a=this.opts.makeViewport({...i,...o});Object.assign(o,a.panByPosition(i.aroundPosition,_n(t.around,i.around,n)))}return o}};var Xe={transitionDuration:0},US=300,ws=e=>1-(1-e)*(1-e),Er={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],MULTI_PAN:["multipanstart","multipanmove","multipanend"],DOUBLE_CLICK:["dblclick"],KEYBOARD:["keydown"]},Oi={},Wn=class{constructor(t){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new zn({...t,getControllerState:i=>new this.ControllerState(i),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=t.eventManager,this.onViewStateChange=t.onViewStateChange||(()=>{}),this.onStateChange=t.onStateChange||(()=>{}),this.makeViewport=t.makeViewport}set events(t){this.toggleEvents(this._customEvents,!1),this.toggleEvents(t,!0),this._customEvents=t,this.props&&this.setProps(this.props)}finalize(){for(let t in this._events)this._events[t]&&this.eventManager?.off(t,this.handleEvent);this.transitionManager.finalize()}handleEvent(t){this._controllerState=void 0;let i=this._eventStartBlocked;switch(t.type){case"panstart":return i?!1:this._onPanStart(t);case"panmove":return this._onPan(t);case"panend":return this._onPanEnd(t);case"pinchstart":return i?!1:this._onPinchStart(t);case"pinchmove":return this._onPinch(t);case"pinchend":return this._onPinchEnd(t);case"multipanstart":return i?!1:this._onMultiPanStart(t);case"multipanmove":return this._onMultiPan(t);case"multipanend":return this._onMultiPanEnd(t);case"dblclick":return this._onDoubleClick(t);case"wheel":return this._onWheel(t);case"keydown":return this._onKeyDown(t);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(t){let{x:i,y:n}=this.props,{offsetCenter:o}=t;return[o.x-i,o.y-n]}isPointInBounds(t,i){let{width:n,height:o}=this.props;if(i&&i.handled)return!1;let a=t[0]>=0&&t[0]<=n&&t[1]>=0&&t[1]<=o;return a&&i&&i.stopPropagation(),a}isFunctionKeyPressed(t){let{srcEvent:i}=t;return Boolean(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(t){let i=setTimeout(()=>{this._eventStartBlocked===i&&(this._eventStartBlocked=null)},t);this._eventStartBlocked=i}setProps(t){t.dragMode&&(this.dragMode=t.dragMode),this.props=t,"transitionInterpolator"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);let{inertia:i}=t;this.inertia=Number.isFinite(i)?i:i===!0?US:0;let{scrollZoom:n=!0,dragPan:o=!0,dragRotate:a=!0,doubleClickZoom:l=!0,touchZoom:h=!0,touchRotate:u=!1,keyboard:p=!0}=t,m=Boolean(this.onViewStateChange);this.toggleEvents(Er.WHEEL,m&&n),this.toggleEvents(Er.PAN,m),this.toggleEvents(Er.PINCH,m&&(h||u)),this.toggleEvents(Er.MULTI_PAN,m&&u),this.toggleEvents(Er.DOUBLE_CLICK,m&&l),this.toggleEvents(Er.KEYBOARD,m&&p),this.scrollZoom=n,this.dragPan=o,this.dragRotate=a,this.doubleClickZoom=l,this.touchZoom=h,this.touchRotate=u,this.keyboard=p}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(t,i){this.eventManager&&t.forEach(n=>{this._events[n]!==i&&(this._events[n]=i,i?this.eventManager.on(n,this.handleEvent):this.eventManager.off(n,this.handleEvent))})}updateViewport(t,i=null,n={}){let o={...t.getViewportProps(),...i},a=this.controllerState!==t;if(this.state=t.getState(),this._setInteractionState(n),a){let l=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:o,interactionState:this._interactionState,oldViewState:l,viewId:this.props.id})}}_onTransition(t){this.onViewStateChange({...t,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(t){Object.assign(this._interactionState,t),this.onStateChange(this._interactionState)}_onPanStart(t){let i=this.getCenter(t);if(!this.isPointInBounds(i,t))return!1;let n=this.isFunctionKeyPressed(t)||t.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(n=!n);let o=this.controllerState[n?"panStart":"rotateStart"]({pos:i});return this._panMove=n,this.updateViewport(o,Xe,{isDragging:!0}),!0}_onPan(t){return this.isDragging()?this._panMove?this._onPanMove(t):this._onPanRotate(t):!1}_onPanEnd(t){return this.isDragging()?this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t):!1}_onPanMove(t){if(!this.dragPan)return!1;let i=this.getCenter(t),n=this.controllerState.pan({pos:i});return this.updateViewport(n,Xe,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(t){let{inertia:i}=this;if(this.dragPan&&i&&t.velocity){let n=this.getCenter(t),o=[n[0]+t.velocityX*i/2,n[1]+t.velocityY*i/2],a=this.controllerState.pan({pos:o}).panEnd();this.updateViewport(a,{...this._getTransitionProps(),transitionDuration:i,transitionEasing:ws},{isDragging:!1,isPanning:!0})}else{let n=this.controllerState.panEnd();this.updateViewport(n,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(t){if(!this.dragRotate)return!1;let i=this.getCenter(t),n=this.controllerState.rotate({pos:i});return this.updateViewport(n,Xe,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(t){let{inertia:i}=this;if(this.dragRotate&&i&&t.velocity){let n=this.getCenter(t),o=[n[0]+t.velocityX*i/2,n[1]+t.velocityY*i/2],a=this.controllerState.rotate({pos:o}).rotateEnd();this.updateViewport(a,{...this._getTransitionProps(),transitionDuration:i,transitionEasing:ws},{isDragging:!1,isRotating:!0})}else{let n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(t){if(!this.scrollZoom)return!1;let i=this.getCenter(t);if(!this.isPointInBounds(i,t))return!1;t.srcEvent.preventDefault();let{speed:n=.01,smooth:o=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:a}=t,l=2/(1+Math.exp(-Math.abs(a*n)));a<0&&l!==0&&(l=1/l);let h=o?{...this._getTransitionProps({around:i}),transitionDuration:250}:Xe,u=this.controllerState.zoom({pos:i,scale:l});return this.updateViewport(u,h,{isZooming:!0,isPanning:!0}),!0}_onMultiPanStart(t){let i=this.getCenter(t);if(!this.isPointInBounds(i,t))return!1;let n=this.controllerState.rotateStart({pos:i});return this.updateViewport(n,Xe,{isDragging:!0}),!0}_onMultiPan(t){if(!this.touchRotate||!this.isDragging())return!1;let i=this.getCenter(t);i[0]-=t.deltaX;let n=this.controllerState.rotate({pos:i});return this.updateViewport(n,Xe,{isDragging:!0,isRotating:!0}),!0}_onMultiPanEnd(t){if(!this.isDragging())return!1;let{inertia:i}=this;if(this.touchRotate&&i&&t.velocityY){let n=this.getCenter(t),o=[n[0],n[1]+=t.velocityY*i/2],a=this.controllerState.rotate({pos:o});this.updateViewport(a,{...this._getTransitionProps(),transitionDuration:i,transitionEasing:ws},{isDragging:!1,isRotating:!0}),this.blockEvents(i)}else{let n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(t){let i=this.getCenter(t);if(!this.isPointInBounds(i,t))return!1;let n=this.controllerState.zoomStart({pos:i}).rotateStart({pos:i});return Oi._startPinchRotation=t.rotation,Oi._lastPinchEvent=t,this.updateViewport(n,Xe,{isDragging:!0}),!0}_onPinch(t){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let i=this.controllerState;if(this.touchZoom){let{scale:n}=t,o=this.getCenter(t);i=i.zoom({pos:o,scale:n})}if(this.touchRotate){let{rotation:n}=t;i=i.rotate({deltaAngleX:Oi._startPinchRotation-n})}return this.updateViewport(i,Xe,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),Oi._lastPinchEvent=t,!0}_onPinchEnd(t){if(!this.isDragging())return!1;let{inertia:i}=this,{_lastPinchEvent:n}=Oi;if(this.touchZoom&&i&&n&&t.scale!==n.scale){let o=this.getCenter(t),a=this.controllerState.rotateEnd(),l=Math.log2(t.scale),h=(l-Math.log2(n.scale))/(t.deltaTime-n.deltaTime),u=Math.pow(2,l+h*i/2);a=a.zoom({pos:o,scale:u}).zoomEnd(),this.updateViewport(a,{...this._getTransitionProps({around:o}),transitionDuration:i,transitionEasing:ws},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(i)}else{let o=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(o,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return Oi._startPinchRotation=null,Oi._lastPinchEvent=null,!0}_onDoubleClick(t){if(!this.doubleClickZoom)return!1;let i=this.getCenter(t);if(!this.isPointInBounds(i,t))return!1;let n=this.isFunctionKeyPressed(t),o=this.controllerState.zoom({pos:i,scale:n?.5:2});return this.updateViewport(o,this._getTransitionProps({around:i}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(t){if(!this.keyboard)return!1;let i=this.isFunctionKeyPressed(t),{zoomSpeed:n,moveSpeed:o,rotateSpeedX:a,rotateSpeedY:l}=this.keyboard===!0?{}:this.keyboard,{controllerState:h}=this,u,p={};switch(t.srcEvent.code){case"Minus":u=i?h.zoomOut(n).zoomOut(n):h.zoomOut(n),p.isZooming=!0;break;case"Equal":u=i?h.zoomIn(n).zoomIn(n):h.zoomIn(n),p.isZooming=!0;break;case"ArrowLeft":i?(u=h.rotateLeft(a),p.isRotating=!0):(u=h.moveLeft(o),p.isPanning=!0);break;case"ArrowRight":i?(u=h.rotateRight(a),p.isRotating=!0):(u=h.moveRight(o),p.isPanning=!0);break;case"ArrowUp":i?(u=h.rotateUp(l),p.isRotating=!0):(u=h.moveUp(o),p.isPanning=!0);break;case"ArrowDown":i?(u=h.rotateDown(l),p.isRotating=!0):(u=h.moveDown(o),p.isPanning=!0);break;default:return!1}return this.updateViewport(u,this._getTransitionProps(),p),!0}_getTransitionProps(t){let{transition:i}=this;return!i||!i.transitionInterpolator?Xe:t?{...i,transitionInterpolator:new Ii({...t,...i.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:i}};var Hn=class{constructor(t,i){this._viewportProps=this.applyConstraints(t),this._state=i}getViewportProps(){return this._viewportProps}getState(){return this._state}};var j_=5,zS=1.2,hh=class extends Hn{constructor(t){let{width:i,height:n,latitude:o,longitude:a,zoom:l,bearing:h=0,pitch:u=0,altitude:p=1.5,position:m=[0,0,0],maxZoom:g=20,minZoom:T=0,maxPitch:y=60,minPitch:E=0,startPanLngLat:S,startZoomLngLat:v,startRotatePos:A,startBearing:P,startPitch:w,startZoom:O,normalize:N=!0}=t;re(Number.isFinite(a)),re(Number.isFinite(o)),re(Number.isFinite(l)),super({width:i,height:n,latitude:o,longitude:a,zoom:l,bearing:h,pitch:u,altitude:p,maxZoom:g,minZoom:T,maxPitch:y,minPitch:E,normalize:N,position:m},{startPanLngLat:S,startZoomLngLat:v,startRotatePos:A,startBearing:P,startPitch:w,startZoom:O}),this.makeViewport=t.makeViewport}panStart({pos:t}){return this._getUpdatedState({startPanLngLat:this._unproject(t)})}pan({pos:t,startPos:i}){let n=this.getState().startPanLngLat||this._unproject(i);if(!n)return this;let a=this.makeViewport(this.getViewportProps()).panByPosition(n,t);return this._getUpdatedState(a)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:t}){return this._getUpdatedState({startRotatePos:t,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:t,deltaAngleX:i=0,deltaAngleY:n=0}){let{startRotatePos:o,startBearing:a,startPitch:l}=this.getState();if(!o||a===void 0||l===void 0)return this;let h;return t?h=this._getNewRotation(t,o,l,a):h={bearing:a+i,pitch:l+n},this._getUpdatedState(h)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:t}){return this._getUpdatedState({startZoomLngLat:this._unproject(t),startZoom:this.getViewportProps().zoom})}zoom({pos:t,startPos:i,scale:n}){let{startZoom:o,startZoomLngLat:a}=this.getState();if(a||(o=this.getViewportProps().zoom,a=this._unproject(i)||this._unproject(t)),!a)return this;let{maxZoom:l,minZoom:h}=this.getViewportProps(),u=o+Math.log2(n);u=te(u,h,l);let p=this.makeViewport({...this.getViewportProps(),zoom:u});return this._getUpdatedState({zoom:u,...p.panByPosition(a,t)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(t=2){return this._zoomFromCenter(t)}zoomOut(t=2){return this._zoomFromCenter(1/t)}moveLeft(t=100){return this._panFromCenter([t,0])}moveRight(t=100){return this._panFromCenter([-t,0])}moveUp(t=100){return this._panFromCenter([0,t])}moveDown(t=100){return this._panFromCenter([0,-t])}rotateLeft(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-t})}rotateRight(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+t})}rotateUp(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+t})}rotateDown(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-t})}shortestPathFrom(t){let i=t.getViewportProps(),n={...this.getViewportProps()},{bearing:o,longitude:a}=n;return Math.abs(o-i.bearing)>180&&(n.bearing=o<0?o+360:o-360),Math.abs(a-i.longitude)>180&&(n.longitude=a<0?a+360:a-360),n}applyConstraints(t){let{maxZoom:i,minZoom:n,zoom:o}=t;t.zoom=te(o,n,i);let{maxPitch:a,minPitch:l,pitch:h}=t;t.pitch=te(h,l,a);let{normalize:u=!0}=t;return u&&Object.assign(t,oh(t)),t}_zoomFromCenter(t){let{width:i,height:n}=this.getViewportProps();return this.zoom({pos:[i/2,n/2],scale:t})}_panFromCenter(t){let{width:i,height:n}=this.getViewportProps();return this.pan({startPos:[i/2,n/2],pos:[i/2+t[0],n/2+t[1]]})}_getUpdatedState(t){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...t})}_unproject(t){let i=this.makeViewport(this.getViewportProps());return t&&i.unproject(t)}_getNewRotation(t,i,n,o){let a=t[0]-i[0],l=t[1]-i[1],h=t[1],u=i[1],{width:p,height:m}=this.getViewportProps(),g=a/p,T=0;l>0?Math.abs(m-u)>j_&&(T=l/(u-m)*zS):l<0&&u>j_&&(T=1-h/u),T=te(T,-1,1);let{minPitch:y,maxPitch:E}=this.getViewportProps(),S=o+180*g,v=n;return T>0?v=n+T*(E-n):T<0&&(v=n-T*(y-n)),{pitch:v,bearing:S}}},jn=class extends Wn{constructor(){super(...arguments),this.ControllerState=hh,this.transition={transitionDuration:300,transitionInterpolator:new Ii({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(t){t.position=t.position||[0,0,0];let i=this.props;super.setProps(t),(!i||i.height!==t.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...t,...this.state}))}};var Ps=class extends kn{constructor(t={}){super(t)}getViewportType(){return U_}get ControllerType(){return jn}};Ps.displayName="MapView";var X_=Ps;var VS=new mr;function WS(e,t){let i=e.order??1/0,n=t.order??1/0;return i-n}var Xn=class{constructor(t){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=t,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(t){let i=this._defaultEffects;if(!i.find(n=>n.id===t.id)){let n=i.findIndex(o=>WS(o,t)>0);n<0?i.push(t):i.splice(n,0,t),t.setup(this._context),this._setEffects(this.effects)}}setProps(t){"effects"in t&&(Wt(t.effects,this.effects,1)||this._setEffects(t.effects))}needsRedraw(t={clearRedrawFlags:!1}){let i=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),i}getEffects(){return this._resolvedEffects}_setEffects(t){let i={};for(let o of this.effects)i[o.id]=o;let n=[];for(let o of t){let a=i[o.id],l=o;a&&a!==o?a.setProps?(a.setProps(o.props),l=a):a.cleanup(this._context):a||o.setup(this._context),n.push(l),delete i[o.id]}for(let o in i)i[o].cleanup(this._context);this.effects=n,this._resolvedEffects=n.concat(this._defaultEffects),t.some(o=>o instanceof mr)||this._resolvedEffects.push(VS),this._needsRedraw="effects changed"}finalize(){for(let t of this._resolvedEffects)t.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var Zn=class extends We{shouldDrawLayer(t){let{operation:i}=t.props;return i.includes("draw")||i.includes("terrain")}};var HS="deckRenderer.renderLayers",$n=class{constructor(t){this.device=t,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new Zn(t),this.pickLayersPass=new Ci(t),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(t){this.layerFilter!==t.layerFilter&&(this.layerFilter=t.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==t.drawPickingColors&&(this.drawPickingColors=t.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(t){if(!t.viewports.length)return;let i=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,n={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...t};n.effects&&this._preRender(n.effects,n);let o=this.lastPostProcessEffect?this.renderBuffers[0]:n.target;this.lastPostProcessEffect&&(n.clearColor=[0,0,0,0],n.clearCanvas=!0);let a=i.render({...n,target:o});n.effects&&(this.lastPostProcessEffect&&(n.clearCanvas=t.clearCanvas===void 0?!0:t.clearCanvas),this._postRender(n.effects,n)),this.renderCount++,$i(HS,this,a,t)}needsRedraw(t={clearRedrawFlags:!1}){let i=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),i}finalize(){let{renderBuffers:t}=this;for(let i of t)i.delete();t.length=0}_preRender(t,i){this.lastPostProcessEffect=null,i.preRenderStats=i.preRenderStats||{};for(let n of t)i.preRenderStats[n.id]=n.preRender(i),n.postRender&&(this.lastPostProcessEffect=n.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:t}=this,i=this.device.canvasContext.getDrawingBufferSize(),[n,o]=i;t.length===0&&[0,1].map(a=>{let l=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"},width:n,height:o});t.push(this.device.createFramebuffer({id:`deck-renderbuffer-${a}`,colorAttachments:[l]}))});for(let a of t)a.resize(i)}_postRender(t,i){let{renderBuffers:n}=this,o={...i,inputBuffer:n[0],swapBuffer:n[1]};for(let a of t)if(a.postRender){o.target=a.id===this.lastPostProcessEffect?i.target:void 0;let l=a.postRender(o);o.inputBuffer=l,o.swapBuffer=l===n[0]?n[1]:n[0]}}};var jS={pickedColor:null,pickedObjectIndex:-1};function fh({pickedColors:e,decodePickingColor:t,deviceX:i,deviceY:n,deviceRadius:o,deviceRect:a}){let{x:l,y:h,width:u,height:p}=a,m=o*o,g=-1,T=0;for(let y=0;y<p;y++){let E=y+h-n,S=E*E;if(S>m)T+=4*u;else for(let v=0;v<u;v++){if(e[T+3]-1>=0){let P=v+l-i,w=P*P+S;w<=m&&(m=w,g=T)}T+=4}}if(g>=0){let y=e.slice(g,g+4),E=t(y);if(E){let S=Math.floor(g/4/u),v=g/4-S*u;return{...E,pickedColor:y,pickedX:l+v,pickedY:h+S}}ct.error("Picked non-existent layer. Is picking buffer corrupt?")()}return jS}function uh({pickedColors:e,decodePickingColor:t}){let i=new Map;if(e){for(let n=0;n<e.length;n+=4)if(e[n+3]-1>=0){let a=e.slice(n,n+4),l=a.join(",");if(!i.has(l)){let h=t(a);h?i.set(l,{...h,color:a}):ct.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(i.values())}function Ms({pickInfo:e,viewports:t,pixelRatio:i,x:n,y:o,z:a}){let l=t[0];t.length>1&&(l=XS(e?.pickedViewports||t,{x:n,y:o}));let h;if(l){let u=[n-l.x,o-l.y];a!==void 0&&(u[2]=a),h=l.unproject(u)}return{color:null,layer:null,viewport:l,index:-1,picked:!1,x:n,y:o,pixel:[n,o],coordinate:h,devicePixel:e&&"pickedX"in e?[e.pickedX,e.pickedY]:void 0,pixelRatio:i}}function dh(e){let{pickInfo:t,lastPickedInfo:i,mode:n,layers:o}=e,{pickedColor:a,pickedLayer:l,pickedObjectIndex:h}=t,u=l?[l]:[];if(n==="hover"){let g=i.index,T=i.layerId,y=l?l.props.id:null;if(y!==T||h!==g){if(y!==T){let E=o.find(S=>S.props.id===T);E&&u.unshift(E)}i.layerId=y,i.index=h,i.info=null}}let p=Ms(e),m=new Map;return m.set(null,p),u.forEach(g=>{let T={...p};g===l&&(T.color=a,T.index=h,T.picked=!0),T=Cs({layer:g,info:T,mode:n});let y=T.layer;g===l&&n==="hover"&&(i.info=T),m.set(y.id,T),n==="hover"&&y.updateAutoHighlight(T)}),m}function Cs({layer:e,info:t,mode:i}){for(;e&&t;){let n=t.layer||null;t.sourceLayer=n,t.layer=e,t=e.getPickingInfo({info:t,mode:i,sourceLayer:n}),e=e.parent}return t}function XS(e,t){for(let i=e.length-1;i>=0;i--){let n=e[i];if(n.containsPixel(t))return n}return e[0]}var Yn=class{constructor(t){this._pickable=!0,this.device=t,this.pickLayersPass=new Ci(t),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(t){"layerFilter"in t&&(this.layerFilter=t.layerFilter),"_pickable"in t&&(this._pickable=t._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}pickObjectAsync(t){return this._pickClosestObjectAsync(t)}pickObjectsAsync(t){return this._pickVisibleObjectsAsync(t)}pickObject(t){return this._pickClosestObject(t)}pickObjects(t){return this._pickVisibleObjects(t)}getLastPickedObject({x:t,y:i,layers:n,viewports:o},a=this.lastPickedInfo.info){let l=a&&a.layer&&a.layer.id,h=a&&a.viewport&&a.viewport.id,u=l?n.find(T=>T.id===l):null,p=h&&o.find(T=>T.id===h)||o[0],m=p&&p.unproject([t-p.x,i-p.y]);return{...a,...{x:t,y:i,viewport:p,coordinate:m,layer:u}}}_resizeBuffer(){if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float"))){let i=this.device.createFramebuffer({colorAttachments:["rgba32float"],depthStencilAttachment:"depth16unorm"});this.depthFBO=i}let{canvas:t}=this.device.getDefaultCanvasContext();this.pickingFBO?.resize({width:t.width,height:t.height}),this.depthFBO?.resize({width:t.width,height:t.height})}_getPickable(t){if(this._pickable===!1)return null;let i=t.filter(n=>this.pickLayersPass.shouldDrawLayer(n)&&!n.isComposite);return i.length?i:null}async _pickClosestObjectAsync({layers:t,views:i,viewports:n,x:o,y:a,radius:l=0,depth:h=1,mode:u="query",unproject3D:p,onViewportActive:m,effects:g}){let T=this.device.canvasContext.cssToDeviceRatio(),y=this._getPickable(t);if(!y||n.length===0)return{result:[],emptyInfo:Ms({viewports:n,x:o,y:a,pixelRatio:T})};this._resizeBuffer();let E=this.device.canvasContext.cssToDevicePixels([o,a],!0),S=[E.x+Math.floor(E.width/2),E.y+Math.floor(E.height/2)],v=Math.round(l*T),{width:A,height:P}=this.pickingFBO,w=this._getPickingRect({deviceX:S[0],deviceY:S[1],deviceRadius:v,deviceWidth:A,deviceHeight:P}),O={x:o-l,y:a-l,width:l*2+1,height:l*2+1},N,C=[],V=new Set;for(let U=0;U<h;U++){let D;if(w){let j=this._drawAndSample({layers:y,views:i,viewports:n,onViewportActive:m,deviceRect:w,cullRect:O,effects:g,pass:`picking:${u}`});D=fh({...j,deviceX:S[0],deviceY:S[1],deviceRadius:v,deviceRect:w})}else D={pickedColor:null,pickedObjectIndex:-1};let B;if(D.pickedLayer&&p&&this.depthFBO){let{pickedColors:j}=this._drawAndSample({layers:[D.pickedLayer],views:i,viewports:n,onViewportActive:m,deviceRect:{x:D.pickedX,y:D.pickedY,width:1,height:1},cullRect:O,effects:g,pass:`picking:${u}:z`},!0);j[3]&&(B=j[0])}D.pickedLayer&&U+1<h&&(V.add(D.pickedLayer),D.pickedLayer.disablePickingIndex(D.pickedObjectIndex)),N=dh({pickInfo:D,lastPickedInfo:this.lastPickedInfo,mode:u,layers:y,viewports:n,x:o,y:a,z:B,pixelRatio:T});for(let j of N.values())j.layer&&C.push(j);if(!D.pickedColor)break}for(let U of V)U.restorePickingColors();return{result:C,emptyInfo:N.get(null)}}_pickClosestObject({layers:t,views:i,viewports:n,x:o,y:a,radius:l=0,depth:h=1,mode:u="query",unproject3D:p,onViewportActive:m,effects:g}){let T=this.device.canvasContext.cssToDeviceRatio(),y=this._getPickable(t);if(!y||n.length===0)return{result:[],emptyInfo:Ms({viewports:n,x:o,y:a,pixelRatio:T})};this._resizeBuffer();let E=this.device.canvasContext.cssToDevicePixels([o,a],!0),S=[E.x+Math.floor(E.width/2),E.y+Math.floor(E.height/2)],v=Math.round(l*T),{width:A,height:P}=this.pickingFBO,w=this._getPickingRect({deviceX:S[0],deviceY:S[1],deviceRadius:v,deviceWidth:A,deviceHeight:P}),O={x:o-l,y:a-l,width:l*2+1,height:l*2+1},N,C=[],V=new Set;for(let U=0;U<h;U++){let D;if(w){let j=this._drawAndSample({layers:y,views:i,viewports:n,onViewportActive:m,deviceRect:w,cullRect:O,effects:g,pass:`picking:${u}`});D=fh({...j,deviceX:S[0],deviceY:S[1],deviceRadius:v,deviceRect:w})}else D={pickedColor:null,pickedObjectIndex:-1};let B;if(D.pickedLayer&&p&&this.depthFBO){let{pickedColors:j}=this._drawAndSample({layers:[D.pickedLayer],views:i,viewports:n,onViewportActive:m,deviceRect:{x:D.pickedX,y:D.pickedY,width:1,height:1},cullRect:O,effects:g,pass:`picking:${u}:z`},!0);j[3]&&(B=j[0])}D.pickedLayer&&U+1<h&&(V.add(D.pickedLayer),D.pickedLayer.disablePickingIndex(D.pickedObjectIndex)),N=dh({pickInfo:D,lastPickedInfo:this.lastPickedInfo,mode:u,layers:y,viewports:n,x:o,y:a,z:B,pixelRatio:T});for(let j of N.values())j.layer&&C.push(j);if(!D.pickedColor)break}for(let U of V)U.restorePickingColors();return{result:C,emptyInfo:N.get(null)}}async _pickVisibleObjectsAsync({layers:t,views:i,viewports:n,x:o,y:a,width:l=1,height:h=1,mode:u="query",maxObjects:p=null,onViewportActive:m,effects:g}){let T=this._getPickable(t);if(!T||n.length===0)return[];this._resizeBuffer();let y=this.device.canvasContext.cssToDeviceRatio(),E=this.device.canvasContext.cssToDevicePixels([o,a],!0),S=E.x,v=E.y+E.height,A=this.device.canvasContext.cssToDevicePixels([o+l,a+h],!0),P=A.x+A.width,w=A.y,O={x:S,y:w,width:P-S,height:v-w},N=this._drawAndSample({layers:T,views:i,viewports:n,onViewportActive:m,deviceRect:O,cullRect:{x:o,y:a,width:l,height:h},effects:g,pass:`picking:${u}`}),C=uh(N),V=new Map,U=[],D=Number.isFinite(p);for(let B=0;B<C.length&&!(D&&U.length>=p);B++){let j=C[B],Z={color:j.pickedColor,layer:null,index:j.pickedObjectIndex,picked:!0,x:o,y:a,pixelRatio:y};Z=Cs({layer:j.pickedLayer,info:Z,mode:u});let rt=Z.layer.id;V.has(rt)||V.set(rt,new Set);let X=V.get(rt),mt=Z.object??Z.index;X.has(mt)||(X.add(mt),U.push(Z))}return U}_pickVisibleObjects({layers:t,views:i,viewports:n,x:o,y:a,width:l=1,height:h=1,mode:u="query",maxObjects:p=null,onViewportActive:m,effects:g}){let T=this._getPickable(t);if(!T||n.length===0)return[];this._resizeBuffer();let y=this.device.canvasContext.cssToDeviceRatio(),E=this.device.canvasContext.cssToDevicePixels([o,a],!0),S=E.x,v=E.y+E.height,A=this.device.canvasContext.cssToDevicePixels([o+l,a+h],!0),P=A.x+A.width,w=A.y,O={x:S,y:w,width:P-S,height:v-w},N=this._drawAndSample({layers:T,views:i,viewports:n,onViewportActive:m,deviceRect:O,cullRect:{x:o,y:a,width:l,height:h},effects:g,pass:`picking:${u}`}),C=uh(N),V=new Map,U=[],D=Number.isFinite(p);for(let B=0;B<C.length&&!(D&&U.length>=p);B++){let j=C[B],Z={color:j.pickedColor,layer:null,index:j.pickedObjectIndex,picked:!0,x:o,y:a,pixelRatio:y};Z=Cs({layer:j.pickedLayer,info:Z,mode:u});let rt=Z.layer.id;V.has(rt)||V.set(rt,new Set);let X=V.get(rt),mt=Z.object??Z.index;X.has(mt)||(X.add(mt),U.push(Z))}return U}async _drawAndSampleAsync({layers:t,views:i,viewports:n,onViewportActive:o,deviceRect:a,cullRect:l,effects:h,pass:u},p=!1){let m=p?this.depthFBO:this.pickingFBO,g={layers:t,layerFilter:this.layerFilter,views:i,viewports:n,onViewportActive:o,pickingFBO:m,deviceRect:a,cullRect:l,effects:h,pass:u,pickZ:p,preRenderStats:{},isPicking:!0};for(let P of h)P.useInPicking&&(g.preRenderStats[P.id]=P.preRender(g));let{decodePickingColor:T}=this.pickLayersPass.render(g),{x:y,y:E,width:S,height:v}=a,A=new(p?Float32Array:Uint8Array)(S*v*4);return this.device.readPixelsToArrayWebGL(m,{sourceX:y,sourceY:E,sourceWidth:S,sourceHeight:v,target:A}),{pickedColors:A,decodePickingColor:T}}_drawAndSample({layers:t,views:i,viewports:n,onViewportActive:o,deviceRect:a,cullRect:l,effects:h,pass:u},p=!1){let m=p?this.depthFBO:this.pickingFBO,g={layers:t,layerFilter:this.layerFilter,views:i,viewports:n,onViewportActive:o,pickingFBO:m,deviceRect:a,cullRect:l,effects:h,pass:u,pickZ:p,preRenderStats:{},isPicking:!0};for(let P of h)P.useInPicking&&(g.preRenderStats[P.id]=P.preRender(g));let{decodePickingColor:T}=this.pickLayersPass.render(g),{x:y,y:E,width:S,height:v}=a,A=new(p?Float32Array:Uint8Array)(S*v*4);return this.device.readPixelsToArrayWebGL(m,{sourceX:y,sourceY:E,sourceWidth:S,sourceHeight:v,target:A}),{pickedColors:A,decodePickingColor:T}}_getPickingRect({deviceX:t,deviceY:i,deviceRadius:n,deviceWidth:o,deviceHeight:a}){let l=Math.max(0,t-n),h=Math.max(0,i-n),u=Math.min(o,t+n+1)-l,p=Math.min(a,i+n+1)-h;return u<=0||p<=0?null:{x:l,y:h,width:u,height:p}}};var ZS={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},$S="top-left",Z_="__root",Is=class{constructor({deck:t,parentElement:i}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=t,i?.classList.add("deck-widget-container"),this.parentElement=i}getWidgets(){return this.resolvedWidgets}setProps(t){if(t.widgets&&!Wt(t.widgets,this.widgets,1)){let i=t.widgets.filter(Boolean);this._setWidgets(i)}}finalize(){for(let t of this.getWidgets())this._removeWidget(t);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(let t in this.containers)this.containers[t].remove()}addDefault(t){this.defaultWidgets.find(i=>i.id===t.id)||(this._addWidget(t),this.defaultWidgets.push(t),this._setWidgets(this.widgets))}onRedraw({viewports:t,layers:i}){let n=t.reduce((o,a)=>(o[a.id]=a,o),{});for(let o of this.getWidgets()){let{viewId:a}=o;if(a){let l=n[a];l&&(o.onViewportChange&&o.onViewportChange(l),o.onRedraw?.({viewports:[l],layers:i}))}else{if(o.onViewportChange)for(let l of t)o.onViewportChange(l);o.onRedraw?.({viewports:t,layers:i})}}this.lastViewports=n,this._updateContainers()}onHover(t,i){for(let n of this.getWidgets()){let{viewId:o}=n;(!o||o===t.viewport?.id)&&n.onHover?.(t,i)}}onEvent(t,i){let n=wn[i.type];if(n)for(let o of this.getWidgets()){let{viewId:a}=o;(!a||a===t.viewport?.id)&&o[n]?.(t,i)}}_setWidgets(t){let i={};for(let n of this.resolvedWidgets)i[n.id]=n;this.resolvedWidgets.length=0;for(let n of this.defaultWidgets)i[n.id]=null,this.resolvedWidgets.push(n);for(let n of t){let o=i[n.id];o?o.viewId!==n.viewId||o.placement!==n.placement?(this._removeWidget(o),this._addWidget(n)):n!==o&&(o.setProps(n.props),n=o):this._addWidget(n),i[n.id]=null,this.resolvedWidgets.push(n)}for(let n in i){let o=i[n];o&&this._removeWidget(o)}this.widgets=t}_addWidget(t){let{viewId:i=null,placement:n=$S}=t;t.widgetManager=this,t.deck=this.deck,t.rootElement=t._onAdd({deck:this.deck,viewId:i}),t.rootElement&&this._getContainer(i,n).append(t.rootElement),t.updateHTML()}_removeWidget(t){t.onRemove?.(),t.rootElement&&t.rootElement.remove(),t.rootElement=void 0,t.deck=void 0,t.widgetManager=void 0}_getContainer(t,i){let n=t||Z_,o=this.containers[n];o||(o=document.createElement("div"),o.style.pointerEvents="none",o.style.position="absolute",o.style.overflow="hidden",this.parentElement?.append(o),this.containers[n]=o);let a=o.querySelector(`.${i}`);return a||(a=globalThis.document.createElement("div"),a.className=i,a.style.position="absolute",a.style.zIndex="2",Object.assign(a.style,ZS[i]),o.append(a)),a}_updateContainers(){let t=this.deck.width,i=this.deck.height;for(let n in this.containers){let o=this.lastViewports[n]||null,a=n===Z_||o,l=this.containers[n];a?(l.style.display="block",l.style.left=`${o?o.x:0}px`,l.style.top=`${o?o.y:0}px`,l.style.width=`${o?o.width:t}px`,l.style.height=`${o?o.height:i}px`):l.style.display="none"}}};function ph(e,t){t&&Object.entries(t).map(([i,n])=>{i.startsWith("--")?e.style.setProperty(i,n):e.style[i]=n})}function $_(e,t){t&&Object.keys(t).map(i=>{i.startsWith("--")?e.style.removeProperty(i):e.style[i]=""})}var Sr=class{constructor(t){this.viewId=null,this.props={...this.constructor.defaultProps,...t},this.id=this.props.id}setProps(t){let i=this.props,n=this.rootElement;n&&i.className!==t.className&&(i.className&&n.classList.remove(i.className),t.className&&n.classList.add(t.className)),n&&!Wt(i.style,t.style,1)&&($_(n,i.style),ph(n,t.style)),Object.assign(this.props,t),this.updateHTML()}updateHTML(){this.rootElement&&this.onRenderHTML(this.rootElement)}onCreateRootElement(){let t=["deck-widget",this.className,this.props.className],i=document.createElement("div");return t.filter(n=>typeof n=="string"&&n.length>0).forEach(n=>i.classList.add(n)),ph(i,this.props.style),i}_onAdd(t){return this.onAdd(t)??this.onCreateRootElement()}onAdd(t){}onRemove(){}onViewportChange(t){}onRedraw(t){}onHover(t,i){}onClick(t,i){}onDrag(t,i){}onDragStart(t,i){}onDragEnd(t,i){}};Sr.defaultProps={id:"widget",style:{},className:""};var YS={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"},Kn=class extends Sr{constructor(t={}){super(t),this.id="default-tooltip",this.placement="fill",this.className="deck-tooltip",this.isVisible=!1,this.setProps(t)}onCreateRootElement(){let t=document.createElement("div");return t.className=this.className,Object.assign(t.style,YS),t}onRenderHTML(t){}onViewportChange(t){this.isVisible&&t.id===this.lastViewport?.id&&t!==this.lastViewport&&this.setTooltip(null)}onHover(t){let{deck:i}=this,n=i&&i.props.getTooltip;if(!n)return;let o=n(t);this.lastViewport=t.viewport,this.setTooltip(o,t.x,t.y)}setTooltip(t,i,n){let o=this.rootElement;if(o){if(typeof t=="string")o.innerText=t;else if(t)t.text&&(o.innerText=t.text),t.html&&(o.innerHTML=t.html),t.className&&(o.className=t.className);else{this.isVisible=!1,o.style.display="none";return}this.isVisible=!0,o.style.display="block",o.style.transform=`translate(${i}px, ${n}px)`,t&&typeof t=="object"&&"style"in t&&Object.assign(o.style,t.style)}}};Kn.defaultProps={...Sr.defaultProps};lt();Dh();Kr();function ci(){}var Gb=({isDragging:e})=>e?"grabbing":"grab",gg={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{},gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:ci,onWebGLInitialized:ci,onResize:ci,onViewStateChange:ci,onInteractionStateChange:ci,onBeforeRender:ci,onAfterRender:ci,onLoad:ci,onError:e=>ct.error(e.message,e.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:Gb,getTooltip:null,debug:!1,drawPickingColors:!1},ro=class{constructor(t){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new qt({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this._lastPointerDownInfo=null,this._onPointerMove=n=>{let{_pickRequest:o}=this;if(n.type==="pointerleave")o.x=-1,o.y=-1,o.radius=0;else{if(n.leftButton||n.rightButton)return;{let a=n.offsetCenter;if(!a)return;o.x=a.x,o.y=a.y,o.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:o.x,y:o.y}),o.event=n},this._onEvent=n=>{let o=wn[n.type],a=n.offsetCenter;if(!o||!a||!this.layerManager)return;let l=this.layerManager.getLayers(),h=this.deckPicker.getLastPickedObject({x:a.x,y:a.y,layers:l,viewports:this.getViewports(a)},this._lastPointerDownInfo),{layer:u}=h,p=u&&(u[o]||u.props[o]),m=this.props[o],g=!1;p&&(g=p.call(u,h,n)),g||(m?.(h,n),this.widgetManager.onEvent(h,n))},this._onPointerDown=n=>{if(this.device?.type==="webgpu")return;let o=n.offsetCenter,a=this._pick("pickObject","pickObject Time",{x:o.x,y:o.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=a.result[0]||a.emptyInfo},this.props={...gg,...t},t=this.props,t.viewState&&t.initialViewState&&ct.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,t.device&&(this.device=t.device);let i=this.device;!i&&t.gl&&(t.gl instanceof WebGLRenderingContext&&ct.error("WebGL1 context not supported.")(),i=io.attach(t.gl,this.props.deviceProps)),i||(i=this._createDevice(t)),this.animationLoop=this._createAnimationLoop(i,t),this.setProps(t),t._typedArrayManagerProps&&D_.setOptions(t._typedArrayManagerProps),this.animationLoop.start()}finalize(){this.animationLoop?.stop(),this.animationLoop?.destroy(),this.animationLoop=null,this._lastPointerDownInfo=null,this.layerManager?.finalize(),this.layerManager=null,this.viewManager?.finalize(),this.viewManager=null,this.effectManager?.finalize(),this.effectManager=null,this.deckRenderer?.finalize(),this.deckRenderer=null,this.deckPicker?.finalize(),this.deckPicker=null,this.eventManager?.destroy(),this.eventManager=null,this.widgetManager?.finalize(),this.widgetManager=null,!this.props.canvas&&!this.props.device&&!this.props.gl&&this.canvas&&(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null)}setProps(t){this.stats.get("setProps Time").timeStart(),"onLayerHover"in t&&ct.removed("onLayerHover","onHover")(),"onLayerClick"in t&&ct.removed("onLayerClick","onClick")(),t.initialViewState&&!Wt(this.props.initialViewState,t.initialViewState,3)&&(this.viewState=t.initialViewState),Object.assign(this.props,t),this._setCanvasSize(this.props);let i=Object.create(this.props);if(Object.assign(i,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),t.device&&t.device.id!==this.device?.id&&(this.animationLoop?.stop(),this.canvas!==t.device.canvasContext?.canvas&&(this.canvas?.remove(),this.eventManager?.destroy(),this.canvas=null),ct.log(`recreating animation loop for new device! id=${t.device.id}`)(),this.animationLoop=this._createAnimationLoop(t.device,t),this.animationLoop.start()),this.animationLoop?.setProps(i),t.useDevicePixels!==void 0&&this.device?.canvasContext?.canvas instanceof HTMLCanvasElement){this.device.canvasContext.props.useDevicePixels=t.useDevicePixels;let n=this.device.canvasContext.canvas,o={target:n,contentBoxSize:[{inlineSize:n.clientWidth,blockSize:n.clientHeight}],devicePixelContentBoxSize:[{inlineSize:n.clientWidth,blockSize:n.clientHeight}],borderBoxSize:[{inlineSize:n.clientWidth,blockSize:n.clientHeight}]};this.device.canvasContext._handleResize([o])}this.layerManager&&(this.viewManager.setProps(i),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(i),this.effectManager.setProps(i),this.deckRenderer.setProps(i),this.deckPicker.setProps(i),this.widgetManager.setProps(i)),this.stats.get("setProps Time").timeEnd()}needsRedraw(t={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let i=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);let n=this.viewManager.needsRedraw(t),o=this.layerManager.needsRedraw(t),a=this.effectManager.needsRedraw(t),l=this.deckRenderer.needsRedraw(t);return i=i||n||o||a||l,i}redraw(t){if(!this.layerManager)return;let i=this.needsRedraw({clearRedrawFlags:!0});i=t||i,i&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(i):this._drawLayers(i))}get isInitialized(){return this.viewManager!==null}getViews(){return re(this.viewManager),this.viewManager.views}getViewports(t){return re(this.viewManager),this.viewManager.getViewports(t)}getCanvas(){return this.canvas}pickObject(t){let i=this._pick("pickObject","pickObject Time",t).result;return i.length?i[0]:null}pickMultipleObjects(t){return t.depth=t.depth||10,this._pick("pickObject","pickMultipleObjects Time",t).result}pickObjects(t){return this._pick("pickObjects","pickObjects Time",t)}_addResources(t,i=!1){for(let n in t)this.layerManager.resourceManager.add({resourceId:n,data:t[n],forceUpdate:i})}_removeResources(t){for(let i of t)this.layerManager.resourceManager.remove(i)}_addDefaultEffect(t){this.effectManager.addDefaultEffect(t)}_addDefaultShaderModule(t){this.layerManager.addDefaultShaderModule(t)}_removeDefaultShaderModule(t){this.layerManager?.removeDefaultShaderModule(t)}_pick(t,i,n){re(this.deckPicker);let{stats:o}=this;o.get("Pick Count").incrementCount(),o.get(i).timeStart();let a=this.deckPicker[t]({layers:this.layerManager.getLayers(n),views:this.viewManager.getViews(),viewports:this.getViewports(n),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...n});return o.get(i).timeEnd(),a}_createCanvas(t){let i=t.canvas;return typeof i=="string"&&(i=document.getElementById(i),re(i)),i||(i=document.createElement("canvas"),i.id=t.id||"deckgl-overlay",t.width&&typeof t.width=="number"&&(i.width=t.width),t.height&&typeof t.height=="number"&&(i.height=t.height),(t.parent||document.body).appendChild(i)),Object.assign(i.style,t.style),i}_setCanvasSize(t){if(!this.canvas)return;let{width:i,height:n}=t;if(i||i===0){let o=Number.isFinite(i)?`${i}px`:i;this.canvas.style.width=o}if(n||n===0){let o=Number.isFinite(n)?`${n}px`:n;this.canvas.style.position=t.style?.position||"absolute",this.canvas.style.height=o}}_updateCanvasSize(){let{canvas:t}=this;if(!t)return;let i=t.clientWidth??t.width,n=t.clientHeight??t.height;(i!==this.width||n!==this.height)&&(this.width=i,this.height=n,this.viewManager?.setProps({width:i,height:n}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:i,height:n}))}_createAnimationLoop(t,i){let{gl:n,onError:o}=i;return new xr({device:t,autoResizeDrawingBuffer:!n,autoResizeViewport:!1,onInitialize:a=>this._setDevice(a.device),onRender:this._onRenderFrame.bind(this),onError:o})}_createDevice(t){let i=this.props.deviceProps?.createCanvasContext,n=typeof i=="object"?i:void 0,o={adapters:[],...t.deviceProps};o.adapters.includes(io)||o.adapters.push(io);let a={alphaMode:this.props.deviceProps?.type==="webgpu"?"premultiplied":void 0};return Ji.createDevice({_reuseDevices:!0,type:"webgl",...o,createCanvasContext:{...a,...n,canvas:this._createCanvas(t),useDevicePixels:this.props.useDevicePixels,autoResize:!0}})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let{views:t}=this.props,i=Array.isArray(t)?t:t?[t]:[new X_({id:"default-view"})];return i.length&&this.props.controller&&(i[0].props.controller=this.props.controller),i}_onContextLost(){let{onError:t}=this.props;this.animationLoop&&t&&t(new Error("WebGL context is lost"))}_pickAndCallback(){if(this.device?.type==="webgpu")return;let{_pickRequest:t}=this;if(t.event){let{result:i,emptyInfo:n}=this._pick("pickObject","pickObject Time",t);this.cursorState.isHovering=i.length>0;let o=n,a=!1;for(let l of i)o=l,a=l.layer?.onHover(l,t.event)||a;a||(this.props.onHover?.(o,t.event),this.widgetManager.onHover(o,t.event)),t.event=null}}_updateCursor(){let t=this.props.parent||this.canvas;t&&(t.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(t){if(this.device=t,!this.animationLoop)return;this.canvas||(this.canvas=this.device.canvasContext?.canvas,!this.canvas.isConnected&&this.props.parent&&this.props.parent.insertBefore(this.canvas,this.props.parent.firstChild)),this.device.type==="webgl"&&this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device.type==="webgl"&&this.props.onWebGLInitialized(this.device.gl);let i=new Mi;i.play(),this.animationLoop.attachTimeline(i),this.eventManager=new Rn(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizers:Object.keys(ql).map(o=>{let[a,l,h,u]=ql[o],p=this.props.eventRecognizerOptions?.[o],m={...l,...p,event:o};return{recognizer:new a(m),recognizeWith:h,requestFailure:u}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let o in wn)this.eventManager.on(o,this._onEvent);this.viewManager=new Ln({timeline:i,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let n=this.viewManager.getViewports()[0];this.layerManager=new Bn(this.device,{deck:this,stats:this.stats,viewport:n,timeline:i}),this.effectManager=new Xn({deck:this,device:this.device}),this.deckRenderer=new $n(this.device),this.deckPicker=new Yn(this.device),this.widgetManager=new Is({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new Kn),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(t,i){let{device:n,gl:o}=this.layerManager.context;this.props.onBeforeRender({device:n,gl:o});let a={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...i};this.deckRenderer?.renderLayers(a),a.pass==="screen"&&this.widgetManager.onRedraw({viewports:a.viewports,layers:a.layers}),this.props.onAfterRender({device:n,gl:o})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),ct.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this.device?.type!=="webgpu"&&this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(t){let i=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState={...this.viewState,[t.viewId]:i},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(t){this.cursorState.isDragging=t.isDragging||!1,this.props.onInteractionStateChange(t)}_getFrameStats(){let{stats:t}=this;t.get("frameRate").timeEnd(),t.get("frameRate").timeStart();let i=this.animationLoop.stats;t.get("GPU Time").addTime(i.get("GPU Time").lastTiming),t.get("CPU Time").addTime(i.get("CPU Time").lastTiming)}_getMetrics(){let{metrics:t,stats:i}=this;t.fps=i.get("frameRate").getHz(),t.setPropsTime=i.get("setProps Time").time,t.updateAttributesTime=i.get("Update Attributes").time,t.framesRedrawn=i.get("Redraw Count").count,t.pickTime=i.get("pickObject Time").time+i.get("pickMultipleObjects Time").time+i.get("pickObjects Time").time,t.pickCount=i.get("Pick Count").count,t.gpuTime=i.get("GPU Time").time,t.cpuTime=i.get("CPU Time").time,t.gpuTimePerFrame=i.get("GPU Time").getAverageTime(),t.cpuTimePerFrame=i.get("CPU Time").getAverageTime();let n=Ji.stats.get("Memory Usage");t.bufferMemory=n.get("Buffer Memory").count,t.textureMemory=n.get("Texture Memory").count,t.renderbufferMemory=n.get("Renderbuffer Memory").count,t.gpuMemory=n.get("GPU Memory").count}};ro.defaultProps=gg;ro.VERSION=xd;var zh=ro;function Tg(e){return{longitude:e.getCenter().lng,latitude:e.getCenter().lat,zoom:e.getZoom()-1,pitch:0,bearing:0}}function yg(e,t,i,n){if(!i){let o=Tg(e);i=new zh({...n,parent:t,controller:!1,style:{zIndex:"auto"},viewState:o})}return i}function xg(e,t){let i=Tg(t);e.setProps({viewState:i}),e.redraw()}var Vh=class extends ne.Layer{props;_container=void 0;_deck=void 0;_animate=void 0;constructor(t){super(),this.props=t}onAdd(){let t=this.getPane();return t?(this._container=ne.DomUtil.create("div"),this._container.className="leaflet-layer",this.#r()&&ne.DomUtil.addClass(this._container,"leaflet-zoom-animated"),t.appendChild(this._container),this._deck=yg(this._map,this._container,this._deck,this.props),this.#e(),this):this}onRemove(t){return!this._container||!this._deck?this:(ne.DomUtil.remove(this._container),this._container=void 0,this._deck.finalize(),this._deck=void 0,this)}getEvents(){return{viewreset:this.#s.bind(this),movestart:this.#a.bind(this),moveend:this.#c.bind(this),zoomstart:this.#l.bind(this),zoom:this.#f.bind(this),zoomend:this.#u.bind(this),...this.#r()?{zoomanim:this.#h.bind(this)}:{}}}setProps(t){Object.assign(this.props,t),this._deck&&this._deck.setProps(t)}pickObject(t){return this._deck?this._deck.pickObject(t):null}pickMultipleObjects(t){return this._deck?this._deck.pickMultipleObjects(t):[]}pickObjects(t){return this._deck?this._deck.pickObjects(t):[]}#t(){return this._map}#r(){return this._zoomAnimated}#e(){if(!this._container||!this._deck||this.#t()._animatingZoom)return;let t=this.#t().getSize();this._container.style.width=`${t.x}px`,this._container.style.height=`${t.y}px`;let i=this.#t()._getMapPanePos().multiplyBy(-1);ne.DomUtil.setPosition(this._container,i),xg(this._deck,this._map)}#n(){this._deck&&this._deck.props._animate&&(this._animate=this._deck.props._animate,this._deck.setProps({_animate:!1}))}#o(){this._deck&&this._animate&&(this._deck.setProps({_animate:this._animate}),this._animate=void 0)}#s(){this.#i(this.#t().getCenter(),this.#t().getZoom()),this.#e()}#a(){this.#n()}#c(){this.#e(),this.#o()}#l(){this.#n()}#h(t){this.#i(t.center,t.zoom)}#f(){this.#i(this.#t().getCenter(),this.#t().getZoom())}#u(){this.#o()}#i(t,i){if(!this._container)return;let n=this.#t().getZoomScale(i,this.#t().getZoom()),o=ne.DomUtil.getPosition(this._container),a=this.#t().getSize().multiplyBy(.5),l=this.#t().project(this.#t().getCenter(),i),u=this.#t().project(t,i).subtract(l),p=a.multiplyBy(-n).add(o).add(a).subtract(u);ne.Browser.any3d?ne.DomUtil.setTransform(this._container,p,n):ne.DomUtil.setPosition(this._container,p)}};return GT(tA);})();
873
- /*! Bundled license information:
874
-
875
- leaflet/dist/leaflet-src.js:
876
- (* @preserve
877
- * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
878
- * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
879
- *)
880
- */
7
+ var __exports__=(()=>{var L=Object.create;var r=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var d=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),M=(t,e)=>{for(var i in e)r(t,i,{get:e[i],enumerable:!0})},p=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of P(e))!y.call(t,n)&&n!==i&&r(t,n,{get:()=>e[n],enumerable:!(o=V(e,n))||o.enumerable});return t};var m=(t,e,i)=>(i=t!=null?L(O(t)):{},p(e||!t||!t.__esModule?r(i,"default",{value:t,enumerable:!0}):i,t)),j=t=>p(r({},"__esModule",{value:!0}),t);var u=d((C,l)=>{l.exports=globalThis.L});var k=d((S,_)=>{_.exports=globalThis.deck});var Z={};M(Z,{DeckLayer:()=>a});var s=m(u(),1);var f=m(k(),1);function w(t){return{longitude:t.getCenter().lng,latitude:t.getCenter().lat,zoom:t.getZoom()-1,pitch:0,bearing:0}}function g(t,e,i,o){if(!i){let n=w(t);i=new f.Deck({...o,parent:e,controller:!1,style:{zIndex:"auto"},viewState:n})}return i}function D(t,e){let i=w(e);t.setProps({viewState:i}),t.redraw()}var a=class extends s.Layer{props;_container=void 0;_deck=void 0;_animate=void 0;constructor(e){super(),this.props=e}onAdd(){let e=this.getPane();return e?(this._container=s.DomUtil.create("div"),this._container.className="leaflet-layer",this.#s()&&s.DomUtil.addClass(this._container,"leaflet-zoom-animated"),e.appendChild(this._container),this._deck=g(this._map,this._container,this._deck,this.props),this.#t(),this):this}onRemove(e){return!this._container||!this._deck?this:(s.DomUtil.remove(this._container),this._container=void 0,this._deck.finalize(),this._deck=void 0,this)}getEvents(){return{viewreset:this.#r.bind(this),movestart:this.#a.bind(this),moveend:this.#c.bind(this),zoomstart:this.#h.bind(this),zoom:this.#p.bind(this),zoomend:this.#m.bind(this),...this.#s()?{zoomanim:this.#d.bind(this)}:{}}}setProps(e){Object.assign(this.props,e),this._deck&&this._deck.setProps(e)}pickObject(e){return this._deck?this._deck.pickObject(e):null}pickMultipleObjects(e){return this._deck?this._deck.pickMultipleObjects(e):[]}pickObjects(e){return this._deck?this._deck.pickObjects(e):[]}#e(){return this._map}#s(){return this._zoomAnimated}#t(){if(!this._container||!this._deck||this.#e()._animatingZoom)return;let e=this.#e().getSize();this._container.style.width=`${e.x}px`,this._container.style.height=`${e.y}px`;let i=this.#e()._getMapPanePos().multiplyBy(-1);s.DomUtil.setPosition(this._container,i),D(this._deck,this._map)}#n(){this._deck&&this._deck.props._animate&&(this._animate=this._deck.props._animate,this._deck.setProps({_animate:!1}))}#o(){this._deck&&this._animate&&(this._deck.setProps({_animate:this._animate}),this._animate=void 0)}#r(){this.#i(this.#e().getCenter(),this.#e().getZoom()),this.#t()}#a(){this.#n()}#c(){this.#t(),this.#o()}#h(){this.#n()}#d(e){this.#i(e.center,e.zoom)}#p(){this.#i(this.#e().getCenter(),this.#e().getZoom())}#m(){this.#o()}#i(e,i){if(!this._container)return;let o=this.#e().getZoomScale(i,this.#e().getZoom()),n=s.DomUtil.getPosition(this._container),c=this.#e().getSize().multiplyBy(.5),b=this.#e().project(this.#e().getCenter(),i),v=this.#e().project(e,i).subtract(b),h=c.multiplyBy(-o).add(n).add(c).subtract(v);s.Browser.any3d?s.DomUtil.setTransform(this._container,h,o):s.DomUtil.setPosition(this._container,h)}};return j(Z);})();
881
8
  return __exports__;
882
9
  });