vendor: 25,448 bytes, lines 1-2
1/*! For license information please see main.c427c31d.js.LICENSE.txt */ 2(()=>{var t={392:t=>{"use strict";function e(t,e,i){i=i||2;var s,o,a,l,h,d,f,g=e&&e.length,m=g?e[0]*i:t.length,_=n(t,0,m,i,!0),y=[];if(!_||_.next===_.prev)return y;if(g&&(_=function(t,e,i,r){var s,o,a,l=[];for(s=0,o=e.length;s<o;s++)(a=n(t,e[s]*r,s<o-1?e[s+1]*r:t.length,r,!1))===a.next&&(a.steiner=!0),l.push(p(a));for(l.sort(c),s=0;s<l.length;s++)i=u(l[s],i);return i}(t,e,_,i)),t.length>80*i){s=a=t[0],o=l=t[1];for(var v=i;v<m;v+=i)(h=t[v])<s&&(s=h),(d=t[v+1])<o&&(o=d),h>a&&(a=h),d>l&&(l=d);f=0!==(f=Math.max(a-s,l-o))?32767/f:0}return r(_,y,i,s,o,f,0),y}function n(t,e,n,i,r){var s,o;if(r===C(t,e,n,i)>0)for(s=e;s<n;s+=i)o=x(s,t[s],t[s+1],o);else for(s=n-i;s>=e;s-=i)o=x(s,t[s],t[s+1],o);return o&&_(o,o.next)&&(S(o),o=o.next),o}function i(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=!1,i.steiner||!_(i,i.next)&&0!==m(i.prev,i,i.next))i=i.next;else{if(S(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function r(t,e,n,c,u,h,p){if(t){!p&&h&&function(t,e,n,i){var r=t;do{0===r.z&&(r.z=d(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,i=n,a=0,e=0;e<c&&(a++,i=i.nextZ);e++);for(l=c;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1)}(r)}(t,c,u,h);for(var f,g,m=t;t.prev!==t.next;)if(f=t.prev,g=t.next,h?o(t,c,u,h):s(t))e.push(f.i/n|0),e.push(t.i/n|0),e.push(g.i/n|0),S(t),t=g.next,m=g.next;else if((t=g)===m){p?1===p?r(t=a(i(t),e,n),e,n,c,u,h,2):2===p&&l(t,e,n,c,u,h):r(i(t),e,n,c,u,h,1);break}}}function s(t){var e=t.prev,n=t,i=t.next;if(m(e,n,i)>=0)return!1;for(var r=e.x,s=n.x,o=i.x,a=e.y,l=n.y,c=i.y,u=r<s?r<o?r:o:s<o?s:o,h=a<l?a<c?a:c:l<c?l:c,d=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c,g=i.next;g!==e;){if(g.x>=u&&g.x<=d&&g.y>=h&&g.y<=p&&f(r,a,s,l,o,c,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function o(t,e,n,i){var r=t.prev,s=t,o=t.next;if(m(r,s,o)>=0)return!1;for(var a=r.x,l=s.x,c=o.x,u=r.y,h=s.y,p=o.y,g=a<l?a<c?a:c:l<c?l:c,_=u<h?u<p?u:p:h<p?h:p,y=a>l?a>c?a:c:l>c?l:c,v=u>h?u>p?u:p:h>p?h:p,b=d(g,_,e,n,i),w=d(y,v,e,n,i),E=t.prevZ,x=t.nextZ;E&&E.z>=b&&x&&x.z<=w;){if(E.x>=g&&E.x<=y&&E.y>=_&&E.y<=v&&E!==r&&E!==o&&f(a,u,l,h,c,p,E.x,E.y)&&m(E.prev,E,E.next)>=0)return!1;if(E=E.prevZ,x.x>=g&&x.x<=y&&x.y>=_&&x.y<=v&&x!==r&&x!==o&&f(a,u,l,h,c,p,x.x,x.y)&&m(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;E&&E.z>=b;){if(E.x>=g&&E.x<=y&&E.y>=_&&E.y<=v&&E!==r&&E!==o&&f(a,u,l,h,c,p,E.x,E.y)&&m(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;x&&x.z<=w;){if(x.x>=g&&x.x<=y&&x.y>=_&&x.y<=v&&x!==r&&x!==o&&f(a,u,l,h,c,p,x.x,x.y)&&m(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function a(t,e,n){var r=t;do{var s=r.prev,o=r.next.next;!_(s,o)&&y(s,r,r.next,o)&&w(s,o)&&w(o,s)&&(e.push(s.i/n|0),e.push(r.i/n|0),e.push(o.i/n|0),S(r),S(r.next),r=t=o),r=r.next}while(r!==t);return i(r)}function l(t,e,n,s,o,a){var l=t;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&g(l,c)){var u=E(l,c);return l=i(l,l.next),u=i(u,u.next),r(l,e,n,s,o,a,0),void r(u,e,n,s,o,a,0)}c=c.next}l=l.next}while(l!==t)}function c(t,e){return t.x-e.x}function u(t,e){var n=function(t,e){var n,i=e,r=t.x,s=t.y,o=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var a=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=r&&a>o&&(o=a,n=i.x<i.next.x?i:i.next,a===r))return n}i=i.next}while(i!==e);if(!n)return null;var l,c=n,u=n.x,d=n.y,p=1/0;i=n;do{r>=i.x&&i.x>=u&&r!==i.x&&f(s<d?r:o,s,u,d,s<d?o:r,s,i.x,i.y)&&(l=Math.abs(s-i.y)/(r-i.x),w(i,t)&&(l<p||l===p&&(i.x>n.x||i.x===n.x&&h(n,i)))&&(n=i,p=l)),i=i.next}while(i!==c);return n}(t,e);if(!n)return e;var r=E(n,t);return i(r,r.next),i(n,n.next)}function h(t,e){return m(t.prev,t,e.prev)<0&&m(e.next,t,t.next)<0}function d(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function p(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function f(t,e,n,i,r,s,o,a){return(r-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(i-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(r-o)*(i-a)}function g(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&y(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(w(t,e)&&w(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!==n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(m(t.prev,t,e.prev)||m(t,e.prev,e))||_(t,e)&&m(t.prev,t,t.next)>0&&m(e.prev,e,e.next)>0)}function m(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function _(t,e){return t.x===e.x&&t.y===e.y}function y(t,e,n,i){var r=b(m(t,e,n)),s=b(m(t,e,i)),o=b(m(n,i,t)),a=b(m(n,i,e));return r!==s&&o!==a||(!(0!==r||!v(t,n,e))||(!(0!==s||!v(t,i,e))||(!(0!==o||!v(n,t,i))||!(0!==a||!v(n,e,i)))))}function v(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function b(t){return t>0?1:t<0?-1:0}function w(t,e){return m(t.prev,t,t.next)<0?m(t,e,t.next)>=0&&m(t,t.prev,e)>=0:m(t,e,t.prev)<0||m(t,t.next,e)<0}function E(t,e){var n=new T(t.i,t.x,t.y),i=new T(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function x(t,e,n,i){var r=new T(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function S(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function T(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function C(t,e,n,i){for(var r=0,s=e,o=n-i;s<n;s+=i)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}t.exports=e,t.exports.default=e,e.deviation=function(t,e,n,i){var r=e&&e.length,s=r?e[0]*n:t.length,o=Math.abs(C(t,0,s,n));if(r)for(var a=0,l=e.length;a<l;a++){var c=e[a]*n,u=a<l-1?e[a+1]*n:t.length;o-=Math.abs(C(t,c,u,n))}var h=0;for(a=0;a<i.length;a+=3){var d=i[a]*n,p=i[a+1]*n,f=i[a+2]*n;h+=Math.abs((t[d]-t[f])*(t[p+1]-t[d+1])-(t[d]-t[p])*(t[f+1]-t[d+1]))}return 0===o&&0===h?0:Math.abs((h-o)/o)},e.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},i=0,r=0;r<t.length;r++){for(var s=0;s<t[r].length;s++)for(var o=0;o<e;o++)n.vertices.push(t[r][s][o]);r>0&&(i+=t[r-1].length,n.holes.push(i))}return n}},902:(t,e,n)=>{var i;!function(r,s,o,a){"use strict";var l,c=["","webkit","Moz","MS","ms","o"],u=s.createElement("div"),h="function",d=Math.round,p=Math.abs,f=Date.now;function g(t,e,n){return setTimeout(E(t,n),e)}function m(t,e,n){return!!Array.isArray(t)&&(_(t,n[e],n),!0)}function _(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==a)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function y(t,e,n){var i="DEPRECATED METHOD: "+e+"\n"+n+" AT \n";return function(){var e=new Error("get-stack-trace"),n=e&&e.stack?e.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",s=r.console&&(r.console.warn||r.console.log);return s&&s.call(r.console,i,n),t.apply(this,arguments)}}l="function"!==typeof Object.assign?function(t){if(t===a||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==a&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign;var v=y((function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&t[i[r]]===a)&&(t[i[r]]=e[i[r]]),r++;return t}),"extend","Use `assign`."),b=y((function(t,e){return v(t,e,!0)}),"merge","Use `assign`.");function w(t,e,n){var i,r=e.prototype;(i=t.prototype=Object.create(r)).constructor=t,i._super=r,n&&l(i,n)}function E(t,e){return function(){return t.apply(e,arguments)}}function x(t,e){return typeof t==h?t.apply(e&&e[0]||a,e):t}function S(t,e){return t===a?e:t}function T(t,e,n){_(R(e),(function(e){t.addEventListener(e,n,!1)}))}function C(t,e,n){_(R(e),(function(e){t.removeEventListener(e,n,!1)}))}function A(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function P(t,e){return t.indexOf(e)>-1}function R(t){return t.trim().split(/\s+/g)}function M(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}function I(t){return Array.prototype.slice.call(t,0)}function L(t,e,n){for(var i=[],r=[],s=0;s<t.length;){var o=e?t[s][e]:t[s];M(r,o)<0&&i.push(t[s]),r[s]=o,s++}return n&&(i=e?i.sort((function(t,n){return t[e]>n[e]})):i.sort()),i}function k(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),s=0;s<c.length;){if((i=(n=c[s])?n+r:e)in t)return i;s++}return a}var N=1;function O(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||r}var D="ontouchstart"in r,F=k(r,"PointerEvent")!==a,B=D&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),U="touch",z="mouse",j=25,V=1,W=4,$=8,G=1,H=2,q=4,Z=8,X=16,K=H|q,Y=Z|X,J=K|Y,Q=["x","y"],tt=["clientX","clientY"];function et(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){x(t.options.enable,[t])&&n.handler(e)},this.init()}function nt(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,s=e&V&&i-r===0,o=e&(W|$)&&i-r===0;n.isFirst=!!s,n.isFinal=!!o,s&&(t.session={}),n.eventType=e,function(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=it(e));r>1&&!n.firstMultiple?n.firstMultiple=it(e):1===r&&(n.firstMultiple=!1);var s=n.firstInput,o=n.firstMultiple,l=o?o.center:s.center,c=e.center=rt(i);e.timeStamp=f(),e.deltaTime=e.timeStamp-s.timeStamp,e.angle=lt(l,c),e.distance=at(l,c),function(t,e){var n=e.center,i=t.offsetDelta||{},r=t.prevDelta||{},s=t.prevInput||{};e.eventType!==V&&s.eventType!==W||(r=t.prevDelta={x:s.deltaX||0,y:s.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y});e.deltaX=r.x+(n.x-i.x),e.deltaY=r.y+(n.y-i.y)}(n,e),e.offsetDirection=ot(e.deltaX,e.deltaY);var u=st(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=u.x,e.overallVelocityY=u.y,e.overallVelocity=p(u.x)>p(u.y)?u.x:u.y,e.scale=o?(h=o.pointers,d=i,at(d[0],d[1],tt)/at(h[0],h[1],tt)):1,e.rotation=o?function(t,e){return lt(e[1],e[0],tt)+lt(t[1],t[0],tt)}(o.pointers,i):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,r,s,o=t.lastInterval||e,l=e.timeStamp-o.timeStamp;if(e.eventType!=$&&(l>j||o.velocity===a)){var c=e.deltaX-o.deltaX,u=e.deltaY-o.deltaY,h=st(l,c,u);i=h.x,r=h.y,n=p(h.x)>p(h.y)?h.x:h.y,s=ot(c,u),t.lastInterval=e}else n=o.velocity,i=o.velocityX,r=o.velocityY,s=o.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=s}(n,e);var h,d;var g=t.element;A(e.srcEvent.target,g)&&(g=e.srcEvent.target);e.target=g}(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function it(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:d(t.pointers[n].clientX),clientY:d(t.pointers[n].clientY)},n++;return{timeStamp:f(),pointers:e,center:rt(e),deltaX:t.deltaX,deltaY:t.deltaY}}function rt(t){var e=t.length;if(1===e)return{x:d(t[0].clientX),y:d(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:d(n/e),y:d(i/e)}}function st(t,e,n){return{x:e/t||0,y:n/t||0}}function ot(t,e){return t===e?G:p(t)>=p(e)?t<0?H:q:e<0?Z:X}function at(t,e,n){n||(n=Q);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function lt(t,e,n){n||(n=Q);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}et.prototype={handler:function(){},init:function(){this.evEl&&T(this.element,this.evEl,this.domHandler),this.evTarget&&T(this.target,this.evTarget,this.domHandler),this.evWin&&T(O(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&C(this.element,this.evEl,this.domHandler),this.evTarget&&C(this.target,this.evTarget,this.domHandler),this.evWin&&C(O(this.element),this.evWin,this.domHandler)}};var ct={mousedown:V,mousemove:2,mouseup:W},ut="mousedown",ht="mousemove mouseup";function dt(){this.evEl=ut,this.evWin=ht,this.pressed=!1,et.apply(this,arguments)}w(dt,et,{handler:function(t){var e=ct[t.type];e&V&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=W),this.pressed&&(e&W&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:z,srcEvent:t}))}});var pt={pointerdown:V,pointermove:2,pointerup:W,pointercancel:$,pointerout:$},ft={2:U,3:"pen",4:z,5:"kinect"},gt="pointerdown",mt="pointermove pointerup pointercancel";function _t(){this.evEl=gt,this.evWin=mt,et.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}r.MSPointerEvent&&!r.PointerEvent&&(gt="MSPointerDown",mt="MSPointerMove MSPointerUp MSPointerCancel"),w(_t,et,{handler:function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=pt[i],s=ft[t.pointerType]||t.pointerType,o=s==U,a=M(e,t.pointerId,"pointerId");r&V&&(0===t.button||o)?a<0&&(e.push(t),a=e.length-1):r&(W|$)&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:s,srcEvent:t}),n&&e.splice(a,1))}});var yt={touchstart:V,touchmove:2,touchend:W,touchcancel:$};function vt(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,et.apply(this,arguments)}function bt(t,e){var n=I(t.touches),i=I(t.changedTouches);return e&(W|$)&&(n=L(n.concat(i),"identifier",!0)),[n,i]}w(vt,et,{handler:function(t){var e=yt[t.type];if(e===V&&(this.started=!0),this.started){var n=bt.call(this,t,e);e&(W|$)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:U,srcEvent:t})}}});var wt={touchstart:V,touchmove:2,touchend:W,touchcancel:$},Et="touchstart touchmove touchend touchcancel";function xt(){this.evTarget=Et,this.targetIds={},et.apply(this,arguments)}function St(t,e){var n=I(t.touches),i=this.targetIds;if(e&(2|V)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,s,o=I(t.changedTouches),a=[],l=this.target;if(s=n.filter((function(t){return A(t.target,l)})),e===V)for(r=0;r<s.length;)i[s[r].identifier]=!0,r++;for(r=0;r<o.length;)i[o[r].identifier]&&a.push(o[r]),e&(W|$)&&delete i[o[r].identifier],r++;return a.length?[L(s.concat(a),"identifier",!0),a]:void 0}w(xt,et,{handler:function(t){var e=wt[t.type],n=St.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:U,srcEvent:t})}});var Tt=2500;function Ct(){et.apply(this,arguments);var t=E(this.handler,this);this.touch=new xt(this.manager,t),this.mouse=new dt(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function At(t,e){t&V?(this.primaryTouch=e.changedPointers[0].identifier,Pt.call(this,e)):t&(W|$)&&Pt.call(this,e)}function Pt(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout((function(){var t=i.indexOf(n);t>-1&&i.splice(t,1)}),Tt)}}function Rt(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],s=Math.abs(e-r.x),o=Math.abs(n-r.y);if(s<=25&&o<=25)return!0}return!1}w(Ct,et,{handler:function(t,e,n){var i=n.pointerType==U,r=n.pointerType==z;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)At.call(this,e,n);else if(r&&Rt.call(this,n))return;this.callback(t,e,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Mt=k(u.style,"touchAction"),It=Mt!==a,Lt="compute",kt="auto",Nt="manipulation",Ot="none",Dt="pan-x",Ft="pan-y",Bt=function(){if(!It)return!1;var t={},e=r.CSS&&r.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(n){t[n]=!e||r.CSS.supports("touch-action",n)})),t}();function Ut(t,e){this.manager=t,this.set(e)}Ut.prototype={set:function(t){t==Lt&&(t=this.compute()),It&&this.manager.element.style&&Bt[t]&&(this.manager.element.style[Mt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return _(this.manager.recognizers,(function(e){x(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))})),function(t){if(P(t,Ot))return Ot;var e=P(t,Dt),n=P(t,Ft);if(e&&n)return Ot;if(e||n)return e?Dt:Ft;if(P(t,Nt))return Nt;return kt}(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var i=this.actions,r=P(i,Ot)&&!Bt[Ot],s=P(i,Ft)&&!Bt[Ft],o=P(i,Dt)&&!Bt[Dt];if(r){var a=1===t.pointers.length,l=t.distance<2,c=t.deltaTime<250;if(a&&l&&c)return}if(!o||!s)return r||s&&n&K||o&&n&Y?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var zt=1,jt=32;function Vt(t){this.options=l({},this.defaults,t||{}),this.id=N++,this.manager=null,this.options.enable=S(this.options.enable,!0),this.state=zt,this.simultaneous={},this.requireFail=[]}function Wt(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}function $t(t){return t==X?"down":t==Z?"up":t==H?"left":t==q?"right":""}function Gt(t,e){var n=e.manager;return n?n.get(t):t}function Ht(){Vt.apply(this,arguments)}function qt(){Ht.apply(this,arguments),this.pX=null,this.pY=null}function Zt(){Ht.apply(this,arguments)}function Xt(){Vt.apply(this,arguments),this._timer=null,this._input=null}function Kt(){Ht.apply(this,arguments)}function Yt(){Ht.apply(this,arguments)}function Jt(){Vt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Qt(t,e){return(e=e||{}).recognizers=S(e.recognizers,Qt.defaults.preset),new te(t,e)}Vt.prototype={defaults:{},set:function(t){return l(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(m(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=Gt(t,this)).id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return m(t,"dropRecognizeWith",this)||(t=Gt(t,this),delete this.simultaneous[t.id]),this},requireFailure:function(t){if(m(t,"requireFailure",this))return this;var e=this.requireFail;return-1===M(e,t=Gt(t,this))&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(m(t,"dropRequireFailure",this))return this;t=Gt(t,this);var e=M(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,n=this.state;function i(n){e.manager.emit(n,t)}n<8&&i(e.options.event+Wt(n)),i(e.options.event),t.additionalEvent&&i(t.additionalEvent),n>=8&&i(e.options.event+Wt(n))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=jt},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(jt|zt)))return!1;t++}return!0},recognize:function(t){var e=l({},t);if(!x(this.options.enable,[this,e]))return this.reset(),void(this.state=jt);56&this.state&&(this.state=zt),this.state=this.process(e),30&this.state&&this.tryEmit(e)},process:function(t){},getTouchAction:function(){},reset:function(){}},w(Ht,Vt,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,n=t.eventType,i=6&e,r=this.attrTest(t);return i&&(n&$||!r)?16|e:i||r?n&W?8|e:2&e?4|e:2:jt}}),w(qt,Ht,{defaults:{event:"pan",threshold:10,pointers:1,direction:J},getTouchAction:function(){var t=this.options.direction,e=[];return t&K&&e.push(Ft),t&Y&&e.push(Dt),e},directionTest:function(t){var e=this.options,n=!0,i=t.distance,r=t.direction,s=t.deltaX,o=t.deltaY;return r&e.direction||(e.direction&K?(r=0===s?G:s<0?H:q,n=s!=this.pX,i=Math.abs(t.deltaX)):(r=0===o?G:o<0?Z:X,n=o!=this.pY,i=Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},attrTest:function(t){return Ht.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=$t(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),w(Zt,Ht,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ot]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),w(Xt,Vt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[kt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,r=t.deltaTime>e.time;if(this._input=t,!i||!n||t.eventType&(W|$)&&!r)this.reset();else if(t.eventType&V)this.reset(),this._timer=g((function(){this.state=8,this.tryEmit()}),e.time,this);else if(t.eventType&W)return 8;return jt},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&t.eventType&W?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}}),w(Kt,Ht,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ot]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),w(Yt,Ht,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:K|Y,pointers:1},getTouchAction:function(){return qt.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return n&(K|Y)?e=t.overallVelocity:n&K?e=t.overallVelocityX:n&Y&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&p(e)>this.options.velocity&&t.eventType&W},emit:function(t){var e=$t(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),w(Jt,Vt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Nt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,r=t.deltaTime<e.time;if(this.reset(),t.eventType&V&&0===this.count)return this.failTimeout();if(i&&r&&n){if(t.eventType!=W)return this.failTimeout();var s=!this.pTime||t.timeStamp-this.pTime<e.interval,o=!this.pCenter||at(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,o&&s?this.count+=1:this.count=1,this._input=t,0===this.count%e.taps)return this.hasRequireFailures()?(this._timer=g((function(){this.state=8,this.tryEmit()}),e.interval,this),2):8}return jt},failTimeout:function(){return this._timer=g((function(){this.state=jt}),this.options.interval,this),jt},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Qt.VERSION="2.0.7",Qt.defaults={domEvents:!1,touchAction:Lt,enable:!0,inputTarget:null,inputClass:null,preset:[[Kt,{enable:!1}],[Zt,{enable:!1},["rotate"]],[Yt,{direction:K}],[qt,{direction:K},["swipe"]],[Jt],[Jt,{event:"doubletap",taps:2},["tap"]],[Xt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function te(t,e){var n;this.options=l({},Qt.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(F?_t:B?xt:D?Ct:dt))(n,nt),this.touchAction=new Ut(this,this.options.touchAction),ee(this,!0),_(this.options.recognizers,(function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])}),this)}function ee(t,e){var n,i=t.element;i.style&&(_(t.options.cssProps,(function(r,s){n=k(i.style,s),e?(t.oldCssProps[n]=i.style[n],i.style[n]=r):i.style[n]=t.oldCssProps[n]||""})),e||(t.oldCssProps={}))}te.prototype={set:function(t){return l(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){var n;this.touchAction.preventDefaults(t);var i=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var s=0;s<i.length;)n=i[s],2===e.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(t),!r&&14&n.state&&(r=e.curRecognizer=n),s++}},get:function(t){if(t instanceof Vt)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event==t)return e[n];return null},add:function(t){if(m(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(m(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,n=M(e,t);-1!==n&&(e.splice(n,1),this.touchAction.update())}return this},on:function(t,e){if(t!==a&&e!==a){var n=this.handlers;
2return _(R(t),(function(t){n[t]=n[t]||[],n[t].push(e)})),this}},off:function(t,e){if(t!==a){var n=this.handlers;return _(R(t),(function(t){e?n[t]&&n[t].splice(M(n[t],e),1):delete n[t]})),this}},emit:function(t,e){this.options.domEvents&&function(t,e){var n=s.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=e,e.target.dispatchEvent(n)}(t,e);var n=this.handlers[t]&&this.handlers[t].slice();if(n&&n.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var i=0;i<n.length;)n[i](e),i++}},destroy:function(){this.element&&ee(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},l(Qt,{INPUT_START:V,INPUT_MOVE:2,INPUT_END:W,INPUT_CANCEL:$,STATE_POSSIBLE:zt,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:jt,DIRECTION_NONE:G,DIRECTION_LEFT:H,DIRECTION_RIGHT:q,DIRECTION_UP:Z,DIRECTION_DOWN:X,DIRECTION_HORIZONTAL:K,DIRECTION_VERTICAL:Y,DIRECTION_ALL:J,Manager:te,Input:et,TouchAction:Ut,TouchInput:xt,MouseInput:dt,PointerEventInput:_t,TouchMouseInput:Ct,SingleTouchInput:vt,Recognizer:Vt,AttrRecognizer:Ht,Tap:Jt,Pan:qt,Swipe:Yt,Pinch:Zt,Rotate:Kt,Press:Xt,on:T,off:C,each:_,merge:b,extend:v,assign:l,inherit:w,bindFn:E,prefixed:k}),("undefined"!==typeof r?r:"undefined"!==typeof self?self:{}).Hammer=Qt,(i=function(){return Qt}.call(e,n,e,t))===a||(t.exports=i)}(window,document)},39:function(t,e){!function(t){"use strict";var e="1.9.4";function n(t){var e,n,i,r;for(n=1,i=arguments.length;n<i;n++)for(e in r=arguments[n])t[e]=r[e];return t}var i=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function r(t,e){var n=Array.prototype.slice;if(t.bind)return t.bind.apply(t,n.call(arguments,1));var i=n.call(arguments,2);return function(){return t.apply(e,i.length?i.concat(n.call(arguments)):arguments)}}var s=0;function o(t){return"_leaflet_id"in t||(t._leaflet_id=++s),t._leaflet_id}function a(t,e,n){var i,r,s,o;return o=function(){i=!1,r&&(s.apply(n,r),r=!1)},s=function(){i?r=arguments:(t.apply(n,arguments),setTimeout(o,e),i=!0)},s}function l(t,e,n){var i=e[1],r=e[0],s=i-r;return t===i&&n?t:((t-r)%s+s)%s+r}function c(){return!1}function u(t,e){if(!1===e)return t;var n=Math.pow(10,void 0===e?6:e);return Math.round(t*n)/n}function h(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function d(t){return h(t).split(/\s+/)}function p(t,e){for(var n in Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?i(t.options):{}),e)t.options[n]=e[n];return t.options}function f(t,e,n){var i=[];for(var r in t)i.push(encodeURIComponent(n?r.toUpperCase():r)+"="+encodeURIComponent(t[r]));return(e&&-1!==e.indexOf("?")?"&":"?")+i.join("&")}var g=/\{ *([\w_ -]+) *\}/g;function m(t,e){return t.replace(g,(function(t,n){var i=e[n];if(void 0===i)throw new Error("No value provided for variable "+t);return"function"===typeof i&&(i=i(e)),i}))}var _=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function y(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}var v="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function b(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var w=0;function E(t){var e=+new Date,n=Math.max(0,16-(e-w));return w=e+n,window.setTimeout(t,n)}var x=window.requestAnimationFrame||b("RequestAnimationFrame")||E,S=window.cancelAnimationFrame||b("CancelAnimationFrame")||b("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function T(t,e,n){if(!n||x!==E)return x.call(window,r(t,e));t.call(e)}function C(t){t&&S.call(window,t)}var A={__proto__:null,extend:n,create:i,bind:r,get lastId(){return s},stamp:o,throttle:a,wrapNum:l,falseFn:c,formatNum:u,trim:h,splitWords:d,setOptions:p,getParamString:f,template:m,isArray:_,indexOf:y,emptyImageUrl:v,requestFn:x,cancelFn:S,requestAnimFrame:T,cancelAnimFrame:C};function P(){}function R(t){if("undefined"!==typeof L&&L&&L.Mixin){t=_(t)?t:[t];for(var e=0;e<t.length;
vendor: 20,131 bytes, line 2
2e++)t[e]===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)}}P.extend=function(t){var e=function(){p(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},r=e.__super__=this.prototype,s=i(r);for(var o in s.constructor=e,e.prototype=s,this)Object.prototype.hasOwnProperty.call(this,o)&&"prototype"!==o&&"__super__"!==o&&(e[o]=this[o]);return t.statics&&n(e,t.statics),t.includes&&(R(t.includes),n.apply(null,[s].concat(t.includes))),n(s,t),delete s.statics,delete s.includes,s.options&&(s.options=r.options?i(r.options):{},n(s.options,t.options)),s._initHooks=[],s.callInitHooks=function(){if(!this._initHooksCalled){r.callInitHooks&&r.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=s._initHooks.length;t<e;t++)s._initHooks[t].call(this)}},e},P.include=function(t){var e=this.prototype.options;return n(this.prototype,t),t.options&&(this.prototype.options=e,this.mergeOptions(t.options)),this},P.mergeOptions=function(t){return n(this.prototype.options,t),this},P.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),n="function"===typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(n),this};var M={on:function(t,e,n){if("object"===typeof t)for(var i in t)this._on(i,t[i],e);else for(var r=0,s=(t=d(t)).length;r<s;r++)this._on(t[r],e,n);return this},off:function(t,e,n){if(arguments.length)if("object"===typeof t)for(var i in t)this._off(i,t[i],e);else{t=d(t);for(var r=1===arguments.length,s=0,o=t.length;s<o;s++)r?this._off(t[s]):this._off(t[s],e,n)}else delete this._events;return this},_on:function(t,e,n,i){if("function"===typeof e){if(!1===this._listens(t,e,n)){n===this&&(n=void 0);var r={fn:e,ctx:n};i&&(r.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(r)}}else console.warn("wrong listener type: "+typeof e)},_off:function(t,e,n){var i,r,s;if(this._events&&(i=this._events[t]))if(1!==arguments.length)if("function"===typeof e){var o=this._listens(t,e,n);if(!1!==o){var a=i[o];this._firingCount&&(a.fn=c,this._events[t]=i=i.slice()),i.splice(o,1)}}else console.warn("wrong listener type: "+typeof e);else{if(this._firingCount)for(r=0,s=i.length;r<s;r++)i[r].fn=c;delete this._events[t]}},fire:function(t,e,i){if(!this.listens(t,i))return this;var r=n({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var s=this._events[t];if(s){this._firingCount=this._firingCount+1||1;for(var o=0,a=s.length;o<a;o++){var l=s[o],c=l.fn;l.once&&this.off(t,c,l.ctx),c.call(l.ctx||this,r)}this._firingCount--}}return i&&this._propagateEvent(r),this},listens:function(t,e,n,i){"string"!==typeof t&&console.warn('"string" type argument expected');var r=e;"function"!==typeof e&&(i=!!e,r=void 0,n=void 0);var s=this._events&&this._events[t];if(s&&s.length&&!1!==this._listens(t,r,n))return!0;if(i)for(var o in this._eventParents)if(this._eventParents[o].listens(t,e,n,i))return!0;return!1},_listens:function(t,e,n){if(!this._events)return!1;var i=this._events[t]||[];if(!e)return!!i.length;n===this&&(n=void 0);for(var r=0,s=i.length;r<s;r++)if(i[r].fn===e&&i[r].ctx===n)return r;return!1},once:function(t,e,n){if("object"===typeof t)for(var i in t)this._on(i,t[i],e,!0);else for(var r=0,s=(t=d(t)).length;r<s;r++)this._on(t[r],e,n,!0);return this},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[o(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[o(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,n({layer:t.target,propagatedFrom:t.target},t),!0)}};M.addEventListener=M.on,M.removeEventListener=M.clearAllEventListeners=M.off,M.addOneTimeEventListener=M.once,M.fireEvent=M.fire,M.hasEventListeners=M.listens;var I=P.extend(M);function k(t,e,n){this.x=n?Math.round(t):t,this.y=n?Math.round(e):e}var N=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function O(t,e,n){return t instanceof k?t:_(t)?new k(t[0],t[1]):void 0===t||null===t?t:"object"===typeof t&&"x"in t&&"y"in t?new k(t.x,t.y):new k(t,e,n)}function D(t,e){if(t)for(var n=e?[t,e]:t,i=0,r=n.length;i<r;i++)this.extend(n[i])}function F(t,e){return!t||t instanceof D?t:new D(t,e)}function B(t,e){if(t)for(var n=e?[t,e]:t,i=0,r=n.length;i<r;i++)this.extend(n[i])}function U(t,e){return t instanceof B?t:new B(t,e)}function z(t,e,n){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,void 0!==n&&(this.alt=+n)}function j(t,e,n){return t instanceof z?t:_(t)&&"object"!==typeof t[0]?3===t.length?new z(t[0],t[1],t[2]):2===t.length?new z(t[0],t[1]):null:void 0===t||null===t?t:"object"===typeof t&&"lat"in t?new z(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===e?null:new z(t,e,n)}k.prototype={clone:function(){return new k(this.x,this.y)},add:function(t){return this.clone()._add(O(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(O(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new k(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new k(this.x/t.x,this.y/t.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=N(this.x),this.y=N(this.y),this},distanceTo:function(t){var e=(t=O(t)).x-this.x,n=t.y-this.y;return Math.sqrt(e*e+n*n)},equals:function(t){return(t=O(t)).x===this.x&&t.y===this.y},contains:function(t){return t=O(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+u(this.x)+", "+u(this.y)+")"}},D.prototype={extend:function(t){var e,n;if(!t)return this;if(t instanceof k||"number"===typeof t[0]||"x"in t)e=n=O(t);else if(e=(t=F(t)).min,n=t.max,!e||!n)return this;return this.min||this.max?(this.min.x=Math.min(e.x,this.min.x),this.max.x=Math.max(n.x,this.max.x),this.min.y=Math.min(e.y,this.min.y),this.max.y=Math.max(n.y,this.max.y)):(this.min=e.clone(),this.max=n.clone()),this},getCenter:function(t){return O((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return O(this.min.x,this.max.y)},getTopRight:function(){return O(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(t){var e,n;return(t="number"===typeof t[0]||t instanceof k?O(t):F(t))instanceof D?(e=t.min,n=t.max):e=n=t,e.x>=this.min.x&&n.x<=this.max.x&&e.y>=this.min.y&&n.y<=this.max.y},intersects:function(t){t=F(t);var e=this.min,n=this.max,i=t.min,r=t.max,s=r.x>=e.x&&i.x<=n.x,o=r.y>=e.y&&i.y<=n.y;return s&&o},overlaps:function(t){t=F(t);var e=this.min,n=this.max,i=t.min,r=t.max,s=r.x>e.x&&i.x<n.x,o=r.y>e.y&&i.y<n.y;return s&&o},isValid:function(){return!(!this.min||!this.max)},pad:function(t){var e=this.min,n=this.max,i=Math.abs(e.x-n.x)*t,r=Math.abs(e.y-n.y)*t;return F(O(e.x-i,e.y-r),O(n.x+i,n.y+r))},equals:function(t){return!!t&&(t=F(t),this.min.equals(t.getTopLeft())&&this.max.equals(t.getBottomRight()))}},B.prototype={extend:function(t){var e,n,i=this._southWest,r=this._northEast;if(t instanceof z)e=t,n=t;else{if(!(t instanceof B))return t?this.extend(j(t)||U(t)):this;if(e=t._southWest,n=t._northEast,!e||!n)return this}return i||r?(i.lat=Math.min(e.lat,i.lat),i.lng=Math.min(e.lng,i.lng),r.lat=Math.max(n.lat,r.lat),r.lng=Math.max(n.lng,r.lng)):(this._southWest=new z(e.lat,e.lng),this._northEast=new z(n.lat,n.lng)),this},pad:function(t){var e=this._southWest,n=this._northEast,i=Math.abs(e.lat-n.lat)*t,r=Math.abs(e.lng-n.lng)*t;return new B(new z(e.lat-i,e.lng-r),new z(n.lat+i,n.lng+r))},getCenter:function(){return new z((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 z(this.getNorth(),this.getWest())},getSouthEast:function(){return new z(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(t){t="number"===typeof t[0]||t instanceof z||"lat"in t?j(t):U(t);var e,n,i=this._southWest,r=this._northEast;return t instanceof B?(e=t.getSouthWest(),n=t.getNorthEast()):e=n=t,e.lat>=i.lat&&n.lat<=r.lat&&e.lng>=i.lng&&n.lng<=r.lng},intersects:function(t){t=U(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=t.getNorthEast(),s=r.lat>=e.lat&&i.lat<=n.lat,o=r.lng>=e.lng&&i.lng<=n.lng;return s&&o},overlaps:function(t){t=U(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=t.getNorthEast(),s=r.lat>e.lat&&i.lat<n.lat,o=r.lng>e.lng&&i.lng<n.lng;return s&&o},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return!!t&&(t=U(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},z.prototype={equals:function(t,e){return!!t&&(t=j(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===e?1e-9:e))},toString:function(t){return"LatLng("+u(this.lat,t)+", "+u(this.lng,t)+")"},distanceTo:function(t){return W.distance(this,j(t))},wrap:function(){return W.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,n=e/Math.cos(Math.PI/180*this.lat);return U([this.lat-e,this.lng-n],[this.lat+e,this.lng+n])},clone:function(){return new z(this.lat,this.lng,this.alt)}};var V={latLngToPoint:function(t,e){var n=this.projection.project(t),i=this.scale(e);return this.transformation._transform(n,i)},pointToLatLng:function(t,e){var n=this.scale(e),i=this.transformation.untransform(t,n);return this.projection.unproject(i)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,n=this.scale(t);return new D(this.transformation.transform(e.min,n),this.transformation.transform(e.max,n))},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?l(t.lng,this.wrapLng,!0):t.lng;return new z(this.wrapLat?l(t.lat,this.wrapLat,!0):t.lat,e,t.alt)},wrapLatLngBounds:function(t){var e=t.getCenter(),n=this.wrapLatLng(e),i=e.lat-n.lat,r=e.lng-n.lng;if(0===i&&0===r)return t;var s=t.getSouthWest(),o=t.getNorthEast();return new B(new z(s.lat-i,s.lng-r),new z(o.lat-i,o.lng-r))}},W=n({},V,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var n=Math.PI/180,i=t.lat*n,r=e.lat*n,s=Math.sin((e.lat-t.lat)*n/2),o=Math.sin((e.lng-t.lng)*n/2),a=s*s+Math.cos(i)*Math.cos(r)*o*o,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*l}}),$=6378137,G={R:$,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,n=this.MAX_LATITUDE,i=Math.max(Math.min(n,t.lat),-n),r=Math.sin(i*e);return new k(this.R*t.lng*e,this.R*Math.log((1+r)/(1-r))/2)},unproject:function(t){var e=180/Math.PI;return new z((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=$*Math.PI;return new D([-t,-t],[t,t])}()};function H(t,e,n,i){if(_(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=n,this._d=i}function q(t,e,n,i){return new H(t,e,n,i)}H.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new k((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var Z=n({},W,{code:"EPSG:3857",projection:G,transformation:function(){var t=.5/(Math.PI*G.R);return q(t,.5,-t,.5)}()}),X=n({},Z,{code:"EPSG:900913"});function K(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Y(t,e){var n,i,r,s,o,a,l="";for(n=0,r=t.length;n<r;n++){for(i=0,s=(o=t[n]).length;i<s;i++)l+=(i?"L":"M")+(a=o[i]).x+" "+a.y;l+=e?Dt.svg?"z":"x":""}return l||"M0 0"}var J=document.documentElement.style,Q="ActiveXObject"in window,tt=Q&&!document.addEventListener,et="msLaunchUri"in navigator&&!("documentMode"in document),nt=Ot("webkit"),it=Ot("android"),rt=Ot("android 2")||Ot("android 3"),st=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),ot=it&&Ot("Google")&&st<537&&!("AudioNode"in window),at=!!window.opera,lt=!et&&Ot("chrome"),ct=Ot("gecko")&&!nt&&!at&&!Q,ut=!lt&&Ot("safari"),ht=Ot("phantom"),dt="OTransition"in J,pt=0===navigator.platform.indexOf("Win"),ft=Q&&"transition"in J,gt="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!rt,mt="MozPerspective"in J,_t=!window.L_DISABLE_3D&&(ft||gt||mt)&&!dt&&!ht,yt="undefined"!==typeof orientation||Ot("mobile"),vt=yt&&nt,bt=yt&>,wt=!window.PointerEvent&&window.MSPointerEvent,Et=!(!window.PointerEvent&&!wt),xt="ontouchstart"in window||!!window.TouchEvent,St=!window.L_NO_TOUCH&&(xt||Et),Tt=yt&&at,Ct=yt&&ct,At=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Pt=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",c,e),window.removeEventListener("testPassiveEventSupport",c,e)}catch(n){}return t}(),Rt=!!document.createElement("canvas").getContext,Mt=!(!document.createElementNS||!K("svg").createSVGRect),It=!!Mt&&function(){var t=document.createElement("div");return t.innerHTML="<svg/>","http://www.w3.org/2000/svg"===(t.firstChild&&t.firstChild.namespaceURI)}(),Lt=!Mt&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"===typeof e.adj}catch(n){return!1}}(),kt=0===navigator.platform.indexOf("Mac"),Nt=0===navigator.platform.indexOf("Linux");function Ot(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var Dt={ie:Q,ielt9:tt,edge:et,webkit:nt,android:it,android23:rt,androidStock:ot,opera:at,chrome:lt,gecko:ct,safari:ut,phantom:ht,opera12:dt,win:pt,ie3d:ft,webkit3d:gt,gecko3d:mt,any3d:_t,mobile:yt,mobileWebkit:vt,mobileWebkit3d:bt,msPointer:wt,pointer:Et,touch:St,touchNative:xt,mobileOpera:Tt,mobileGecko:Ct,retina:At,passiveEvents:Pt,canvas:Rt,svg:Mt,vml:Lt,inlineSvg:It,mac:kt,linux:Nt},Ft=Dt.msPointer?"MSPointerDown":"pointerdown",Bt=Dt.msPointer?"MSPointerMove":"pointermove",Ut=Dt.msPointer?"MSPointerUp":"pointerup",zt=Dt.msPointer?"MSPointerCancel":"pointercancel",jt={touchstart:Ft,touchmove:Bt,touchend:Ut,touchcancel:zt},Vt={touchstart:Jt,touchmove:Yt,touchend:Yt,touchcancel:Yt},Wt={},$t=!1;function Gt(t,e,n){return"touchstart"===e&&Kt(),Vt[e]?(n=Vt[e].bind(this,n),t.addEventListener(jt[e],n,!1),n):(console.warn("wrong event specified:",e),c)}function Ht(t,e,n){jt[e]?t.removeEventListener(jt[e],n,!1):console.warn("wrong event specified:",e)}function qt(t){Wt[t.pointerId]=t}function Zt(t){Wt[t.pointerId]&&(Wt[t.pointerId]=t)}function Xt(t){delete Wt[t.pointerId]}function Kt(){$t||(document.addEventListener(Ft,qt,!0),document.addEventListener(Bt,Zt,!0),document.addEventListener(Ut,Xt,!0),document.addEventListener(zt,Xt,!0),$t=!0)}function Yt(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){for(var n in e.touches=[],Wt)e.touches.push(Wt[n]);e.changedTouches=[e],t(e)}}function Jt(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&qe(e),Yt(t,e)}function Qt(t){var e,n,i={};for(n in t)e=t[n],i[n]=e&&e.bind?e.bind(t):e;return t=i,i.type="dblclick",i.detail=2,i.isTrusted=!1,i._simulated=!0,i}var te=200;function ee(t,e){t.addEventListener("dblclick",e);var n,i=0;function r(t){if(1===t.detail){if("mouse"!==t.pointerType&&(!t.sourceCapabilities||t.sourceCapabilities.firesTouchEvents)){var r=Xe(t);if(!r.some((function(t){return t instanceof HTMLLabelElement&&t.attributes.for}))||r.some((function(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement}))){var s=Date.now();s-i<=te?2===++n&&e(Qt(t)):n=1,i=s}}}else n=t.detail}return t.addEventListener("click",r),{dblclick:e,simDblclick:r}}function ne(t,e){t.removeEventListener("dblclick",e.dblclick),t.removeEventListener("click",e.simDblclick)}var ie,re,se,oe,ae,le=Te(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ce=Te(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),ue="webkitTransition"===ce||"OTransition"===ce?ce+"End":"transitionend";function he(t){return"string"===typeof t?document.getElementById(t):t}function de(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||"auto"===n)&&document.defaultView){var i=document.defaultView.getComputedStyle(t,null);n=i?i[e]:null}return"auto"===n?null:n}function pe(t,e,n){var i=document.createElement(t);return i.className=e||"",n&&n.appendChild(i),i}function fe(t){var e=t.parentNode;e&&e.removeChild(t)}function ge(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function me(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function _e(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ye(t,e){if(void 0!==t.classList)return t.classList.contains(e);var n=Ee(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)}function ve(t,e){if(void 0!==t.classList)for(var n=d(e),i=0,r=n.length;i<r;i++)t.classList.add(n[i]);else if(!ye(t,e)){var s=Ee(t);we(t,(s?s+" ":"")+e)}}function be(t,e){void 0!==t.classList?t.classList.remove(e):we(t,h((" "+Ee(t)+" ").replace(" "+e+" "," ")))}function we(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function Ee(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function xe(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&Se(t,e)}function Se(t,e){var n=!1,i="DXImageTransform.Microsoft.Alpha";try{n=t.filters.item(i)}catch(r){if(1===e)return}e=Math.round(100*e),n?(n.Enabled=100!==e,n.Opacity=e):t.style.filter+=" progid:"+i+"(opacity="+e+")"}function Te(t){for(var e=document.documentElement.style,n=0;n<t.length;n++)if(t[n]in e)return t[n];return!1}function Ce(t,e,n){var i=e||new k(0,0);t.style[le]=(Dt.ie3d?"translate("+i.x+"px,"+i.y+"px)":"translate3d("+i.x+"px,"+i.y+"px,0)")+(n?" scale("+n+")":"")}function Ae(t,e){t._leaflet_pos=e,Dt.any3d?Ce(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Pe(t){return t._leaflet_pos||new k(0,0)}if("onselectstart"in document)ie=function(){Fe(window,"selectstart",qe)},re=function(){Ue(window,"selectstart",qe)};else{var Re=Te(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ie=function(){if(Re){var t=document.documentElement.style;se=t[Re],t[Re]="none"}},re=function(){Re&&(document.documentElement.style[Re]=se,se=void 0)}}function Me(){Fe(window,"dragstart",qe)}function Ie(){Ue(window,"dragstart",qe)}function Le(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(ke(),oe=t,ae=t.style.outlineStyle,t.style.outlineStyle="none",Fe(window,"keydown",ke))}function ke(){oe&&(oe.style.outlineStyle=ae,oe=void 0,ae=void 0,Ue(window,"keydown",ke))}function Ne(t){do{t=t.parentNode}while((!t.offsetWidth||!t.offsetHeight)&&t!==document.body);return t}function Oe(t){var e=t.getBoundingClientRect();
vendor: 1,068 bytes, line 2
2return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var De={__proto__:null,TRANSFORM:le,TRANSITION:ce,TRANSITION_END:ue,get:he,getStyle:de,create:pe,remove:fe,empty:ge,toFront:me,toBack:_e,hasClass:ye,addClass:ve,removeClass:be,setClass:we,getClass:Ee,setOpacity:xe,testProp:Te,setTransform:Ce,setPosition:Ae,getPosition:Pe,get disableTextSelection(){return ie},get enableTextSelection(){return re},disableImageDrag:Me,enableImageDrag:Ie,preventOutline:Le,restoreOutline:ke,getSizedParentNode:Ne,getScale:Oe};function Fe(t,e,n,i){if(e&&"object"===typeof e)for(var r in e)Ve(t,r,e[r],n);else for(var s=0,o=(e=d(e)).length;s<o;s++)Ve(t,e[s],n,i);return this}var Be="_leaflet_events";function Ue(t,e,n,i){if(1===arguments.length)ze(t),delete t[Be];else if(e&&"object"===typeof e)for(var r in e)We(t,r,e[r],n);else if(e=d(e),2===arguments.length)ze(t,(function(t){return-1!==y(e,t)}));else for(var s=0,o=e.length;s<o;s++)We(t,e[s],n,i);return this}function ze(t,e){for(var n in t[Be]){var i=n.split(/\d/)[0];e&&!e(i)||We(t,i,null,null,n)}}
vendor: 18,891 bytes, line 2
2var je={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function Ve(t,e,n,i){var r=e+o(n)+(i?"_"+o(i):"");if(t[Be]&&t[Be][r])return this;var s=function(e){return n.call(i||t,e||window.event)},a=s;!Dt.touchNative&&Dt.pointer&&0===e.indexOf("touch")?s=Gt(t,e,s):Dt.touch&&"dblclick"===e?s=ee(t,s):"addEventListener"in t?"touchstart"===e||"touchmove"===e||"wheel"===e||"mousewheel"===e?t.addEventListener(je[e]||e,s,!!Dt.passiveEvents&&{passive:!1}):"mouseenter"===e||"mouseleave"===e?(s=function(e){e=e||window.event,Qe(t,e)&&a(e)},t.addEventListener(je[e],s,!1)):t.addEventListener(e,a,!1):t.attachEvent("on"+e,s),t[Be]=t[Be]||{},t[Be][r]=s}function We(t,e,n,i,r){r=r||e+o(n)+(i?"_"+o(i):"");var s=t[Be]&&t[Be][r];if(!s)return this;!Dt.touchNative&&Dt.pointer&&0===e.indexOf("touch")?Ht(t,e,s):Dt.touch&&"dblclick"===e?ne(t,s):"removeEventListener"in t?t.removeEventListener(je[e]||e,s,!1):t.detachEvent("on"+e,s),t[Be][r]=null}function $e(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,this}function Ge(t){return Ve(t,"wheel",$e),this}function He(t){return Fe(t,"mousedown touchstart dblclick contextmenu",$e),t._leaflet_disable_click=!0,this}function qe(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Ze(t){return qe(t),$e(t),this}function Xe(t){if(t.composedPath)return t.composedPath();for(var e=[],n=t.target;n;)e.push(n),n=n.parentNode;return e}function Ke(t,e){if(!e)return new k(t.clientX,t.clientY);var n=Oe(e),i=n.boundingClientRect;return new k((t.clientX-i.left)/n.x-e.clientLeft,(t.clientY-i.top)/n.y-e.clientTop)}var Ye=Dt.linux&&Dt.chrome?window.devicePixelRatio:Dt.mac?3*window.devicePixelRatio:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Je(t){return Dt.edge?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/Ye:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}function Qe(t,e){var n=e.relatedTarget;if(!n)return!0;try{for(;n&&n!==t;)n=n.parentNode}catch(i){return!1}return n!==t}var tn={__proto__:null,on:Fe,off:Ue,stopPropagation:$e,disableScrollPropagation:Ge,disableClickPropagation:He,preventDefault:qe,stop:Ze,getPropagationPath:Xe,getMousePosition:Ke,getWheelDelta:Je,isExternalTarget:Qe,addListener:Fe,removeListener:Ue},en=I.extend({run:function(t,e,n,i){this.stop(),this._el=t,this._inProgress=!0,this._duration=n||.25,this._easeOutPower=1/Math.max(i||.5,.2),this._startPos=Pe(t),this._offset=e.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=T(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,n=1e3*this._duration;e<n?this._runFrame(this._easeOut(e/n),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var n=this._startPos.add(this._offset.multiplyBy(t));e&&n._round(),Ae(this._el,n),this.fire("step")},_complete:function(){C(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),nn=I.extend({options:{crs:Z,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(t,e){e=p(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=r(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(j(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ce&&Dt.any3d&&!Dt.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Fe(this._proxy,ue,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){return e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(j(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i&&(void 0!==i.animate&&(i.zoom=n({animate:i.animate},i.zoom),i.pan=n({animate:i.animate,duration:i.duration},i.pan)),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(t,e,i.pan&&i.pan.noMoveStart),this)},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(Dt.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(Dt.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,n){var i=this.getZoomScale(e),r=this.getSize().divideBy(2),s=(t instanceof k?t:this.latLngToContainerPoint(t)).subtract(r).multiplyBy(1-1/i),o=this.containerPointToLatLng(r.add(s));return this.setView(o,e,{zoom:n})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():U(t);var n=O(e.paddingTopLeft||e.padding||[0,0]),i=O(e.paddingBottomRight||e.padding||[0,0]),r=this.getBoundsZoom(t,!1,n.add(i));if((r="number"===typeof e.maxZoom?Math.min(e.maxZoom,r):r)===1/0)return{center:t.getCenter(),zoom:r};var s=i.subtract(n).divideBy(2),o=this.project(t.getSouthWest(),r),a=this.project(t.getNorthEast(),r);return{center:this.unproject(o.add(a).divideBy(2).add(s),r),zoom:r}},fitBounds:function(t,e){if(!(t=U(t)).isValid())throw new Error("Bounds are not valid.");var n=this._getBoundsCenterZoom(t,e);return this.setView(n.center,n.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(e=e||{},!(t=O(t).round()).x&&!t.y)return this.fire("moveend");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new en,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate){ve(this._mapPane,"leaflet-pan-anim");var n=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,n,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,n){if(!1===(n=n||{}).animate||!Dt.any3d)return this.setView(t,e,n);this._stop();var i=this.project(this.getCenter()),r=this.project(t),s=this.getSize(),o=this._zoom;t=j(t),e=void 0===e?o:e;var a=Math.max(s.x,s.y),l=a*this.getZoomScale(o,e),c=r.distanceTo(i)||1,u=1.42,h=u*u;function d(t){var e=(l*l-a*a+(t?-1:1)*h*h*c*c)/(2*(t?l:a)*h*c),n=Math.sqrt(e*e+1)-e;return n<1e-9?-18:Math.log(n)}function p(t){return(Math.exp(t)-Math.exp(-t))/2}function f(t){return(Math.exp(t)+Math.exp(-t))/2}function g(t){return p(t)/f(t)}var m=d(0);function _(t){return a*(f(m)/f(m+u*t))}function y(t){return a*(f(m)*g(m+u*t)-p(m))/h}function v(t){return 1-Math.pow(1-t,1.5)}var b=Date.now(),w=(d(1)-m)/u,E=n.duration?1e3*n.duration:1e3*w*.8;function x(){var n=(Date.now()-b)/E,s=v(n)*w;n<=1?(this._flyToFrame=T(x,this),this._move(this.unproject(i.add(r.subtract(i).multiplyBy(y(s)/c)),o),this.getScaleZoom(a/_(s),o),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,n.noMoveStart),x.call(this),this},flyToBounds:function(t,e){var n=this._getBoundsCenterZoom(t,e);return this.flyTo(n.center,n.zoom,e)},setMaxBounds:function(t){return t=U(t),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),t.isValid()?(this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var n=this.getCenter(),i=this._limitCenter(n,this._zoom,U(t));return n.equals(i)||this.panTo(i,e),this._enforcingBounds=!1,this},panInside:function(t,e){var n=O((e=e||{}).paddingTopLeft||e.padding||[0,0]),i=O(e.paddingBottomRight||e.padding||[0,0]),r=this.project(this.getCenter()),s=this.project(t),o=this.getPixelBounds(),a=F([o.min.add(n),o.max.subtract(i)]),l=a.getSize();if(!a.contains(s)){this._enforcingBounds=!0;var c=s.subtract(a.getCenter()),u=a.extend(s).getSize().subtract(l);r.x+=c.x<0?-u.x:u.x,r.y+=c.y<0?-u.y:u.y,this.panTo(this.unproject(r),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=n({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),s=e.divideBy(2).round(),o=i.divideBy(2).round(),a=s.subtract(o);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=n({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=r(this._handleGeolocationResponse,this),i=r(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){if(this._container._leaflet_id){var e=t.code,n=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+n+"."})}},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e=new z(t.coords.latitude,t.coords.longitude),n=e.toBounds(2*t.coords.accuracy),i=this._locateOptions;if(i.setView){var r=this.getBoundsZoom(n);this.setView(e,i.maxZoom?Math.min(r,i.maxZoom):r)}var s={latlng:e,bounds:n,timestamp:t.timestamp};for(var o in t.coords)"number"===typeof t.coords[o]&&(s[o]=t.coords[o]);this.fire("locationfound",s)}},addHandler:function(t,e){if(!e)return this;var n=this[t]=new e(this);return this._handlers.push(n),this.options[t]&&n.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(e){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),fe(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(C(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)fe(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var n=pe("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=n),n},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new B(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,n){t=U(t),n=O(n||[0,0]);var i=this.getZoom()||0,r=this.getMinZoom(),s=this.getMaxZoom(),o=t.getNorthWest(),a=t.getSouthEast(),l=this.getSize().subtract(n),c=F(this.project(a,i),this.project(o,i)).getSize(),u=Dt.any3d?this.options.zoomSnap:1,h=l.x/c.x,d=l.y/c.y,p=e?Math.max(h,d):Math.min(h,d);return i=this.getScaleZoom(p,i),u&&(i=Math.round(i/(u/100))*(u/100),i=e?Math.ceil(i/u)*u:Math.floor(i/u)*u),Math.max(r,Math.min(s,i))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new k(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var n=this._getTopLeftPoint(t,e);return new D(n,n.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"===typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,n.scale(t)/n.scale(e)},getScaleZoom:function(t,e){var n=this.options.crs;e=void 0===e?this._zoom:e;var i=n.zoom(t*n.scale(e));return isNaN(i)?1/0:i},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(j(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(O(t),e)},layerPointToLatLng:function(t){var e=O(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(j(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(j(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(U(t))},distance:function(t,e){return this.options.crs.distance(j(t),j(e))},containerPointToLayerPoint:function(t){return O(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return O(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(O(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(j(t)))},mouseEventToContainerPoint:function(t){return Ke(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=he(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");Fe(e,"scroll",this._onScroll,this),this._containerId=o(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&Dt.any3d,ve(t,"leaflet-container"+(Dt.touch?" leaflet-touch":"")+(Dt.retina?" leaflet-retina":"")+(Dt.ielt9?" leaflet-oldie":"")+(Dt.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=de(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&"sticky"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Ae(this._mapPane,new k(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ve(t.markerPane,"leaflet-zoom-hide"),ve(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,n){Ae(this._mapPane,new k(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var r=this._zoom!==e;this._moveStart(r,n)._move(t,e)._moveEnd(r),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,n,i){void 0===e&&(e=this._zoom);var r=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),i?n&&n.pinch&&this.fire("zoom",n):((r||n&&n.pinch)&&this.fire("zoom",n),this.fire("move",n)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return C(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Ae(this._mapPane,this._getMapPanePos().subtract(t))},_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(t){this._targets={},this._targets[o(this._container)]=this;var e=t?Ue:Fe;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),Dt.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){C(this._resizeRequest),this._resizeRequest=T((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var n,i=[],r="mouseout"===e||"mouseover"===e,s=t.target||t.srcElement,a=!1;s;){if((n=this._targets[o(s)])&&("click"===e||"preclick"===e)&&this._draggableMoved(n)){a=!0;break}if(n&&n.listens(e,!0)){if(r&&!Qe(s,t))break;if(i.push(n),r)break}if(s===this._container)break;s=s.parentNode}return i.length||a||r||!this.listens(e,!0)||(i=[this]),i},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e=t.target||t.srcElement;if(!(!this._loaded||e._leaflet_disable_events||"click"===t.type&&this._isCl
vendor: 1,885 bytes, line 2
2ickDisabled(e))){var n=t.type;"mousedown"===n&&Le(e),this._fireDOMEvent(t,n)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if("click"===t.type){var r=n({},t);r.type="preclick",this._fireDOMEvent(r,r.type,i)}var s=this._findEventTargets(t,e);if(i){for(var o=[],a=0;a<i.length;a++)i[a].listens(e,!0)&&o.push(i[a]);s=o.concat(s)}if(s.length){"contextmenu"===e&&qe(t);var l=s[0],c={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var u=l.getLatLng&&(!l._radius||l._radius<=10);c.containerPoint=u?this.latLngToContainerPoint(l.getLatLng()):this.mouseEventToContainerPoint(t),c.layerPoint=this.containerPointToLayerPoint(c.containerPoint),c.latlng=u?l.getLatLng():this.layerPointToLatLng(c.layerPoint)}for(a=0;a<s.length;a++)if(s[a].fire(e,c,!0),c.originalEvent._stopped||!1===s[a].options.bubblingMouseEvents&&-1!==y(this._mouseEvents,e))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this},_getMapPanePos:function(){return Pe(this._mapPane)||new k(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var n=this.getSize()._divideBy(2);return this.project(t,e)._subtract(n)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,n){var i=this._getNewPixelOrigin(n,e);return this.project(t,e)._subtract(i)},_latLngBoundsToNewLayerBounds:function(t,e,n){var i=this._getNewPixelOrigin(n,e);
vendor: 102,338 bytes, line 2
2return F([this.project(t.getSouthWest(),e)._subtract(i),this.project(t.getNorthWest(),e)._subtract(i),this.project(t.getSouthEast(),e)._subtract(i),this.project(t.getNorthEast(),e)._subtract(i)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,n){if(!n)return t;var i=this.project(t,e),r=this.getSize().divideBy(2),s=new D(i.subtract(r),i.add(r)),o=this._getBoundsOffset(s,n,e);return Math.abs(o.x)<=1&&Math.abs(o.y)<=1?t:this.unproject(i.add(o),e)},_limitOffset:function(t,e){if(!e)return t;var n=this.getPixelBounds(),i=new D(n.min.add(t),n.max.add(t));return t.add(this._getBoundsOffset(i,e))},_getBoundsOffset:function(t,e,n){var i=F(this.project(e.getNorthEast(),n),this.project(e.getSouthWest(),n)),r=i.min.subtract(t.min),s=i.max.subtract(t.max);return new k(this._rebound(r.x,-s.x),this._rebound(r.y,-s.y))},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),n=this.getMaxZoom(),i=Dt.any3d?this.options.zoomSnap:1;return i&&(t=Math.round(t/i)*i),Math.max(e,Math.min(n,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){be(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var n=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(n))&&(this.panBy(n,e),!0)},_createAnimProxy:function(){var t=this._proxy=pe("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=le,n=this._proxy.style[e];Ce(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),n===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){fe(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),e=this.getZoom();Ce(this._proxy,this.project(t,e),this.getZoomScale(e,1))},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,n){if(this._animatingZoom)return!0;if(n=n||{},!this._zoomAnimated||!1===n.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var i=this.getZoomScale(e),r=this._getCenterOffset(t)._divideBy(1-1/i);return!(!0!==n.animate&&!this.getSize().contains(r))&&(T((function(){this._moveStart(!0,n.noMoveStart||!1)._animateZoom(t,e,!0)}),this),!0)},_animateZoom:function(t,e,n,i){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,ve(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:i}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&be(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 rn(t,e){return new nn(t,e)}var sn=P.extend({options:{position:"topright"},initialize:function(t){p(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),n=this.getPosition(),i=t._controlCorners[n];return ve(e,"leaflet-control"),-1!==n.indexOf("bottom")?i.insertBefore(e,i.firstChild):i.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(fe(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),on=function(t){return new sn(t)};nn.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",n=this._controlContainer=pe("div",e+"control-container",this._container);function i(i,r){var s=e+i+" "+e+r;t[i+r]=pe("div",s,n)}i("top","left"),i("top","right"),i("bottom","left"),i("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)fe(this._controlCorners[t]);fe(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var an=sn.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,n,i){return n<i?-1:i<n?1:0}},initialize:function(t,e,n){for(var i in p(this,n),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1,t)this._addLayer(t[i],i);for(i in e)this._addLayer(e[i],i,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return sn.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var e=this._getLayer(o(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){ve(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(ve(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):be(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return be(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=pe("div",t),n=this.options.collapsed;e.setAttribute("aria-haspopup",!0),He(e),Ge(e);var i=this._section=pe("section",t+"-list");n&&(this._map.on("click",this.collapse,this),Fe(e,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var r=this._layersLink=pe("a",t+"-toggle",e);r.href="#",r.title="Layers",r.setAttribute("role","button"),Fe(r,{keydown:function(t){13===t.keyCode&&this._expandSafely()},click:function(t){qe(t),this._expandSafely()}},this),n||this.expand(),this._baseLayersList=pe("div",t+"-base",i),this._separator=pe("div",t+"-separator",i),this._overlaysList=pe("div",t+"-overlays",i),e.appendChild(i)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&o(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,n){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:n}),this.options.sortLayers&&this._layers.sort(r((function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)}),this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;ge(this._baseLayersList),ge(this._overlaysList),this._layerControlInputs=[];var t,e,n,i,r=0;for(n=0;n<this._layers.length;n++)i=this._layers[n],this._addItem(i),e=e||i.overlay,t=t||!i.overlay,r+=i.overlay?0:1;return this.options.hideSingleBase&&(t=t&&r>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(o(t.target)),n=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;n&&this._map.fire(n,e)},_createRadioElement:function(t,e){var n='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",i=document.createElement("div");return i.innerHTML=n,i.firstChild},_addItem:function(t){var e,n=document.createElement("label"),i=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=i):e=this._createRadioElement("leaflet-base-layers_"+o(this),i),this._layerControlInputs.push(e),e.layerId=o(t.layer),Fe(e,"click",this._onInputClick,this);var r=document.createElement("span");r.innerHTML=" "+t.name;var s=document.createElement("span");return n.appendChild(s),s.appendChild(e),s.appendChild(r),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){if(!this._preventClick){var t,e,n=this._layerControlInputs,i=[],r=[];this._handlingClick=!0;for(var s=n.length-1;s>=0;s--)t=n[s],e=this._getLayer(t.layerId).layer,t.checked?i.push(e):t.checked||r.push(e);for(s=0;s<r.length;s++)this._map.hasLayer(r[s])&&this._map.removeLayer(r[s]);for(s=0;s<i.length;s++)this._map.hasLayer(i[s])||this._map.addLayer(i[s]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var t,e,n=this._layerControlInputs,i=this._map.getZoom(),r=n.length-1;r>=0;r--)t=n[r],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&i<e.options.minZoom||void 0!==e.options.maxZoom&&i>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;this._preventClick=!0,Fe(t,"click",qe),this.expand();var e=this;setTimeout((function(){Ue(t,"click",qe),e._preventClick=!1}))}}),ln=function(t,e,n){return new an(t,e,n)},cn=sn.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",n=pe("div",e+" leaflet-bar"),i=this.options;return this._zoomInButton=this._createButton(i.zoomInText,i.zoomInTitle,e+"-in",n,this._zoomIn),this._zoomOutButton=this._createButton(i.zoomOutText,i.zoomOutTitle,e+"-out",n,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),n},onRemove:function(t){t.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(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,n,i,r){var s=pe("a",n,i);return s.innerHTML=t,s.href="#",s.title=e,s.setAttribute("role","button"),s.setAttribute("aria-label",e),He(s),Fe(s,"click",Ze),Fe(s,"click",r,this),Fe(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";be(this._zoomInButton,e),be(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t._zoom===t.getMinZoom())&&(ve(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t._zoom===t.getMaxZoom())&&(ve(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}});nn.mergeOptions({zoomControl:!0}),nn.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new cn,this.addControl(this.zoomControl))}));var un=function(t){return new cn(t)},hn=sn.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",n=pe("div",e),i=this.options;return this._addScales(i,e+"-line",n),t.on(i.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),n},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,n){t.metric&&(this._mScale=pe("div",e,n)),t.imperial&&(this._iScale=pe("div",e,n))},_update:function(){var t=this._map,e=t.getSize().y/2,n=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(n)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),n=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,n,e/t)},_updateImperial:function(t){var e,n,i,r=3.2808399*t;r>5280?(e=r/5280,n=this._getRoundNum(e),this._updateScale(this._iScale,n+" mi",n/e)):(i=this._getRoundNum(r),this._updateScale(this._iScale,i+" ft",i/r))},_updateScale:function(t,e,n){t.style.width=Math.round(this.options.maxWidth*n)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),n=t/e;return e*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:1)}}),dn=function(t){return new hn(t)},pn='<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>',fn=sn.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(Dt.inlineSvg?pn+" ":"")+"Leaflet</a>"},initialize:function(t){p(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=pe("div","leaflet-control-attribution"),He(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",(function(){this.removeAttribution(t.layer.getAttribution())}),this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var n=[];this.options.prefix&&n.push(this.options.prefix),t.length&&n.push(t.join(", ")),this._container.innerHTML=n.join(' <span aria-hidden="true">|</span> ')}}});nn.mergeOptions({attributionControl:!0}),nn.addInitHook((function(){this.options.attributionControl&&(new fn).addTo(this)}));var gn=function(t){return new fn(t)};sn.Layers=an,sn.Zoom=cn,sn.Scale=hn,sn.Attribution=fn,on.layers=ln,on.zoom=un,on.scale=dn,on.attribution=gn;var mn=P.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});mn.addTo=function(t,e){return t.addHandler(e,this),this};var _n={Events:M},yn=Dt.touch?"touchstart mousedown":"mousedown",vn=I.extend({options:{clickTolerance:3},initialize:function(t,e,n,i){p(this,i),this._element=t,this._dragStartTarget=e||t,this._preventOutline=n},enable:function(){this._enabled||(Fe(this._dragStartTarget,yn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(vn._dragging===this&&this.finishDrag(!0),Ue(this._dragStartTarget,yn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(this._enabled&&(this._moved=!1,!ye(this._element,"leaflet-zoom-anim")))if(t.touches&&1!==t.touches.length)vn._dragging===this&&this.finishDrag();else if(!(vn._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches)&&(vn._dragging=this,this._preventOutline&&Le(this._element),Me(),ie(),!this._moving)){this.fire("down");var e=t.touches?t.touches[0]:t,n=Ne(this._element);this._startPoint=new k(e.clientX,e.clientY),this._startPos=Pe(this._element),this._parentScale=Oe(n);var i="mousedown"===t.type;Fe(document,i?"mousemove":"touchmove",this._onMove,this),Fe(document,i?"mouseup":"touchend touchcancel",this._onUp,this)}},_onMove:function(t){if(this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,n=new k(e.clientX,e.clientY)._subtract(this._startPoint);(n.x||n.y)&&(Math.abs(n.x)+Math.abs(n.y)<this.options.clickTolerance||(n.x/=this._parentScale.x,n.y/=this._parentScale.y,qe(t),this._moved||(this.fire("dragstart"),this._moved=!0,ve(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),ve(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(n),this._moving=!0,this._lastEvent=t,this._updatePosition()))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),Ae(this._element,this._newPos),this.fire("drag",t)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(t){be(document.body,"leaflet-dragging"),this._lastTarget&&(be(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Ue(document,"mousemove touchmove",this._onMove,this),Ue(document,"mouseup touchend touchcancel",this._onUp,this),Ie(),re();var e=this._moved&&this._moving;this._moving=!1,vn._dragging=!1,e&&this.fire("dragend",{noInertia:t,distance:this._newPos.distanceTo(this._startPos)})}});function bn(t,e,n){var i,r,s,o,a,l,c,u,h,d=[1,4,2,8];for(r=0,c=t.length;r<c;r++)t[r]._code=kn(t[r],e);for(o=0;o<4;o++){for(u=d[o],i=[],r=0,s=(c=t.length)-1;r<c;s=r++)a=t[r],l=t[s],a._code&u?l._code&u||((h=Ln(l,a,u,e,n))._code=kn(h,e),i.push(h)):(l._code&u&&((h=Ln(l,a,u,e,n))._code=kn(h,e),i.push(h)),i.push(a));t=i}return t}function wn(t,e){var n,i,r,s,o,a,l,c,u;if(!t||0===t.length)throw new Error("latlngs not passed");Dn(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var h=j([0,0]),d=U(t);d.getNorthWest().distanceTo(d.getSouthWest())*d.getNorthEast().distanceTo(d.getNorthWest())<1700&&(h=En(t));var p=t.length,f=[];for(n=0;n<p;n++){var g=j(t[n]);f.push(e.project(j([g.lat-h.lat,g.lng-h.lng])))}for(a=l=c=0,n=0,i=p-1;n<p;i=n++)r=f[n],s=f[i],o=r.y*s.x-s.y*r.x,l+=(r.x+s.x)*o,c+=(r.y+s.y)*o,a+=3*o;u=0===a?f[0]:[l/a,c/a];var m=e.unproject(O(u));return j([m.lat+h.lat,m.lng+h.lng])}function En(t){for(var e=0,n=0,i=0,r=0;r<t.length;r++){var s=j(t[r]);e+=s.lat,n+=s.lng,i++}return j([e/i,n/i])}var xn,Sn={__proto__:null,clipPolygon:bn,polygonCenter:wn,centroid:En};function Tn(t,e){if(!e||!t.length)return t.slice();var n=e*e;return t=Pn(t=Mn(t,n),n)}function Cn(t,e,n){return Math.sqrt(On(t,e,n,!0))}function An(t,e,n){return On(t,e,n)}function Pn(t,e){var n=t.length,i=new(typeof Uint8Array!==void 0+""?Uint8Array:Array)(n);i[0]=i[n-1]=1,Rn(t,i,e,0,n-1);var r,s=[];for(r=0;r<n;r++)i[r]&&s.push(t[r]);return s}function Rn(t,e,n,i,r){var s,o,a,l=0;for(o=i+1;o<=r-1;o++)(a=On(t[o],t[i],t[r],!0))>l&&(s=o,l=a);l>n&&(e[s]=1,Rn(t,e,n,i,s),Rn(t,e,n,s,r))}function Mn(t,e){for(var n=[t[0]],i=1,r=0,s=t.length;i<s;i++)Nn(t[i],t[r])>e&&(n.push(t[i]),r=i);return r<s-1&&n.push(t[s-1]),n}function In(t,e,n,i,r){var s,o,a,l=i?xn:kn(t,n),c=kn(e,n);for(xn=c;;){if(!(l|c))return[t,e];if(l&c)return!1;a=kn(o=Ln(t,e,s=l||c,n,r),n),s===l?(t=o,l=a):(e=o,c=a)}}function Ln(t,e,n,i,r){var s,o,a=e.x-t.x,l=e.y-t.y,c=i.min,u=i.max;return 8&n?(s=t.x+a*(u.y-t.y)/l,o=u.y):4&n?(s=t.x+a*(c.y-t.y)/l,o=c.y):2&n?(s=u.x,o=t.y+l*(u.x-t.x)/a):1&n&&(s=c.x,o=t.y+l*(c.x-t.x)/a),new k(s,o,r)}function kn(t,e){var n=0;return t.x<e.min.x?n|=1:t.x>e.max.x&&(n|=2),t.y<e.min.y?n|=4:t.y>e.max.y&&(n|=8),n}function Nn(t,e){var n=e.x-t.x,i=e.y-t.y;return n*n+i*i}function On(t,e,n,i){var r,s=e.x,o=e.y,a=n.x-s,l=n.y-o,c=a*a+l*l;return c>0&&((r=((t.x-s)*a+(t.y-o)*l)/c)>1?(s=n.x,o=n.y):r>0&&(s+=a*r,o+=l*r)),a=t.x-s,l=t.y-o,i?a*a+l*l:new k(s,o)}function Dn(t){return!_(t[0])||"object"!==typeof t[0][0]&&"undefined"!==typeof t[0][0]}function Fn(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Dn(t)}function Bn(t,e){var n,i,r,s,o,a,l,c;if(!t||0===t.length)throw new Error("latlngs not passed");Dn(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var u=j([0,0]),h=U(t);h.getNorthWest().distanceTo(h.getSouthWest())*h.getNorthEast().distanceTo(h.getNorthWest())<1700&&(u=En(t));var d=t.length,p=[];for(n=0;n<d;n++){var f=j(t[n]);p.push(e.project(j([f.lat-u.lat,f.lng-u.lng])))}for(n=0,i=0;n<d-1;n++)i+=p[n].distanceTo(p[n+1])/2;if(0===i)c=p[0];else for(n=0,s=0;n<d-1;n++)if(o=p[n],a=p[n+1],(s+=r=o.distanceTo(a))>i){l=(s-i)/r,c=[a.x-l*(a.x-o.x),a.y-l*(a.y-o.y)];break}var g=e.unproject(O(c));return j([g.lat+u.lat,g.lng+u.lng])}var Un={__proto__:null,simplify:Tn,pointToSegmentDistance:Cn,closestPointOnSegment:An,clipSegment:In,_getEdgeIntersection:Ln,_getBitCode:kn,_sqClosestPointOnSegment:On,isFlat:Dn,_flat:Fn,polylineCenter:Bn},zn={project:function(t){return new k(t.lng,t.lat)},unproject:function(t){return new z(t.y,t.x)},bounds:new D([-180,-90],[180,90])},jn={R:6378137,R_MINOR:6356752.314245179,bounds:new D([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,n=this.R,i=t.lat*e,r=this.R_MINOR/n,s=Math.sqrt(1-r*r),o=s*Math.sin(i),a=Math.tan(Math.PI/4-i/2)/Math.pow((1-o)/(1+o),s/2);return i=-n*Math.log(Math.max(a,1e-10)),new k(t.lng*e*n,i)},unproject:function(t){for(var e,n=180/Math.PI,i=this.R,r=this.R_MINOR/i,s=Math.sqrt(1-r*r),o=Math.exp(-t.y/i),a=Math.PI/2-2*Math.atan(o),l=0,c=.1;l<15&&Math.abs(c)>1e-7;l++)e=s*Math.sin(a),e=Math.pow((1-e)/(1+e),s/2),a+=c=Math.PI/2-2*Math.atan(o*e)-a;return new z(a*n,t.x*n/i)}},Vn={__proto__:null,LonLat:zn,Mercator:jn,SphericalMercator:G},Wn=n({},W,{code:"EPSG:3395",projection:jn,transformation:function(){var t=.5/(Math.PI*jn.R);return q(t,.5,-t,.5)}()}),$n=n({},W,{code:"EPSG:4326",projection:zn,transformation:q(1/180,1,-1/180,.5)}),Gn=n({},V,{projection:zn,transformation:q(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var n=e.lng-t.lng,i=e.lat-t.lat;return Math.sqrt(n*n+i*i)},infinite:!0});V.Earth=W,V.EPSG3395=Wn,V.EPSG3857=Z,V.EPSG900913=X,V.EPSG4326=$n,V.Simple=Gn;var Hn=I.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[o(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[o(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var n=this.getEvents();e.on(n,this),this.once("remove",(function(){e.off(n,this)}),this)}this.onAdd(e),this.fire("add"),e.fire("layeradd",{layer:this})}}});nn.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=o(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=o(t);return this._layers[e]?(this._loaded&&t.onRemove(this),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return o(t)in this._layers},eachLayer:function(t,e){for(var n in this._layers)t.call(e,this._layers[n]);return this},_addLayers:function(t){for(var e=0,n=(t=t?_(t)?t:[t]:[]).length;e<n;e++)this.addLayer(t[e])},_addZoomLimit:function(t){isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[o(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=o(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,n=this._getZoomSpan();for(var i in this._zoomBoundLayers){var r=this._zoomBoundLayers[i].options;t=void 0===r.minZoom?t:Math.min(t,r.minZoom),e=void 0===r.maxZoom?e:Math.max(e,r.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,n!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var qn=Hn.extend({initialize:function(t,e){var n,i;if(p(this,e),this._layers={},t)for(n=0,i=t.length;n<i;n++)this.addLayer(t[n])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return("number"===typeof t?t:this.getLayerId(t))in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,n,i=Array.prototype.slice.call(arguments,1);for(e in this._layers)(n=this._layers[e])[t]&&n[t].apply(n,i);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var n in this._layers)t.call(e,this._layers[n]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return o(t)}}),Zn=function(t,e){return new qn(t,e)},Xn=qn.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),qn.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),qn.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new B;for(var e in this._layers){var n=this._layers[e];t.extend(n.getBounds?n.getBounds():n.getLatLng())}return t}}),Kn=function(t,e){return new Xn(t,e)},Yn=P.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(t){p(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var n=this._getIconUrl(t);if(!n){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var i=this._createImg(n,e&&"IMG"===e.tagName?e:null);return this._setIconStyles(i,t),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i},_setIconStyles:function(t,e){var n=this.options,i=n[e+"Size"];"number"===typeof i&&(i=[i,i]);var r=O(i),s=O("shadow"===e&&n.shadowAnchor||n.iconAnchor||r&&r.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(n.className||""),s&&(t.style.marginLeft=-s.x+"px",t.style.marginTop=-s.y+"px"),r&&(t.style.width=r.x+"px",t.style.height=r.y+"px")},_createImg:function(t,e){return(e=e||document.createElement("img")).src=t,e},_getIconUrl:function(t){return Dt.retina&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function Jn(t){return new Yn(t)}var Qn=Yn.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(t){return"string"!==typeof Qn.imagePath&&(Qn.imagePath=this._detectIconPath()),(this.options.imagePath||Qn.imagePath)+Yn.prototype._getIconUrl.call(this,t)},_stripUrl:function(t){var e=function(t,e,n){var i=e.exec(t);return i&&i[n]};return(t=e(t,/^url\((['"])?(.+)\1\)$/,2))&&e(t,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var t=pe("div","leaflet-default-icon-path",document.body),e=de(t,"background-image")||de(t,"backgroundImage");if(document.body.removeChild(t),e=this._stripUrl(e))return e;var n=document.querySelector('link[href$="leaflet.css"]');return n?n.href.substring(0,n.href.length-11-1):""}}),ti=mn.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new vn(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),ve(t,"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&&be(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,n=e._map,i=this._marker.options.autoPanSpeed,r=this._marker.options.autoPanPadding,s=Pe(e._icon),o=n.getPixelBounds(),a=n.getPixelOrigin(),l=F(o.min._subtract(a).add(r),o.max._subtract(a).subtract(r));if(!l.contains(s)){var c=O((Math.max(l.max.x,s.x)-l.max.x)/(o.max.x-l.max.x)-(Math.min(l.min.x,s.x)-l.min.x)/(o.min.x-l.min.x),(Math.max(l.max.y,s.y)-l.max.y)/(o.max.y-l.max.y)-(Math.min(l.min.y,s.y)-l.min.y)/(o.min.y-l.min.y)).multiplyBy(i);n.panBy(c,{animate:!1}),this._draggable._newPos._add(c),this._draggable._startPos._add(c),Ae(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=T(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(C(this._panRequest),this._panRequest=T(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,n=e._shadow,i=Pe(e._icon),r=e._map.layerPointToLatLng(i);n&&Ae(n,i),e._latlng=r,t.latlng=r,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){C(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),ei=Hn.extend({options:{icon:new Qn,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(t,e){p(this,e),this._latlng=j(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.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(t){var e=this._latlng;return this._latlng=j(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,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 t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),n=t.icon.createIcon(this._icon),i=!1;n!==this._icon&&(this._icon&&this._removeIcon(),i=!0,t.title&&(n.title=t.title),"IMG"===n.tagName&&(n.alt=t.alt||"")),ve(n,e),t.keyboard&&(n.tabIndex="0",n.setAttribute("role","button")),this._icon=n,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Fe(n,"focus",this._panOnFocus,this);var r=t.icon.createShadow(this._shadow),s=!1;r!==this._shadow&&(this._removeShadow(),s=!0),r&&(ve(r,e),r.alt=""),this._shadow=r,t.opacity<1&&this._updateOpacity(),i&&this.getPane().appendChild(this._icon),this._initInteraction(),r&&s&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Ue(this._icon,"focus",this._panOnFocus,this),fe(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&fe(this._shadow),this._shadow=null},_setPos:function(t){this._icon&&Ae(this._icon,t),this._shadow&&Ae(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon&&(this._icon.style.zIndex=this._zIndex+t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(ve(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),ti)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new ti(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&xe(this._icon,t),this._shadow&&xe(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var t=this._map;if(t){var e=this.options.icon.options,n=e.iconSize?O(e.iconSize):O(0,0),i=e.iconAnchor?O(e.iconAnchor):O(0,0);t.panInside(this._latlng,{paddingTopLeft:i,paddingBottomRight:n.subtract(i)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function ni(t,e){return new ei(t,e)}var ii=Hn.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(t){this._renderer=t.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(t){return p(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t&&Object.prototype.hasOwnProperty.call(t,"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)}}),ri=ii.extend({options:{fill:!0,radius:10},initialize:function(t,e){p(this,e),this._latlng=j(t),this._radius=this.options.radius},setLatLng:function(t){var e=this._latlng;return this._latlng=j(t),this.redraw(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return ii.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,n=this._clickTolerance(),i=[t+n,e+n];this._pxBounds=new D(this._point.subtract(i),this._point.add(i))},_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(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function si(t,e){return new ri(t,e)}var oi=ri.extend({initialize:function(t,e,i){if("number"===typeof e&&(e=n({},i,{radius:e})),p(this,e),this._latlng=j(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new B(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:ii.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,n=this._map,i=n.options.crs;if(i.distance===W.distance){var r=Math.PI/180,s=this._mRadius/W.R/r,o=n.project([e+s,t]),a=n.project([e-s,t]),l=o.add(a).divideBy(2),c=n.unproject(l).lat,u=Math.acos((Math.cos(s*r)-Math.sin(e*r)*Math.sin(c*r))/(Math.cos(e*r)*Math.cos(c*r)))/r;(isNaN(u)||0===u)&&(u=s/Math.cos(Math.PI/180*e)),this._point=l.subtract(n.getPixelOrigin()),this._radius=isNaN(u)?0:l.x-n.project([c,t-u]).x,this._radiusY=l.y-o.y}else{var h=i.unproject(i.project(this._latlng).subtract([this._mRadius,0]));this._point=n.latLngToLayerPoint(this._latlng),this._radius=this._point.x-n.latLngToLayerPoint(h).x}this._updateBounds()}});function ai(t,e,n){return new oi(t,e,n)}var li=ii.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){p(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,n,i=1/0,r=null,s=On,o=0,a=this._parts.length;o<a;o++)for(var l=this._parts[o],c=1,u=l.length;c<u;c++){var h=s(t,e=l[c-1],n=l[c],!0);h<i&&(i=h,r=s(t,e,n))}return r&&(r.distance=Math.sqrt(i)),r},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Bn(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=j(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new B,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Dn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],n=Dn(t),i=0,r=t.length;i<r;i++)n?(e[i]=j(t[i]),this._bounds.extend(e[i])):e[i]=this._convertLatLngs(t[i]);return e},_project:function(){var t=new D;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new k(t,t);this._rawPxBounds&&(this._pxBounds=new D([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)]))},_projectLatlngs:function(t,e,n){var i,r,s=t[0]instanceof z,o=t.length;if(s){for(r=[],i=0;i<o;i++)r[i]=this._map.latLngToLayerPoint(t[i]),n.extend(r[i]);e.push(r)}else for(i=0;i<o;i++)this._projectLatlngs(t[i],e,n)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,n,i,r,s,o,a,l=this._parts;for(e=0,i=0,r=this._rings.length;e<r;e++)for(n=0,s=(a=this._rings[e]).length;n<s-1;n++)(o=In(a[n],a[n+1],t,n,!0))&&(l[i]=l[i]||[],l[i].push(o[0]),o[1]===a[n+1]&&n!==s-2||(l[i].push(o[1]),i++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,n=0,i=t.length;n<i;n++)t[n]=Tn(t[n],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var n,i,r,s,o,a,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(n=0,s=this._parts.length;n<s;n++)for(i=0,r=(o=(a=this._parts[n]).length)-1;i<o;r=i++)if((e||0!==i)&&Cn(t,a[r],a[i])<=l)return!0;return!1}});function ci(t,e){return new li(t,e)}li._flat=Fn;var ui=li.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 wn(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(t){var e=li.prototype._convertLatLngs.call(this,t),n=e.length;return n>=2&&e[0]instanceof z&&e[0].equals(e[n-1])&&e.pop(),e},_setLatLngs:function(t){li.prototype._setLatLngs.call(this,t),Dn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Dn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,n=new k(e,e);if(t=new D(t.min.subtract(n),t.max.add(n)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var i,r=0,s=this._rings.length;r<s;r++)(i=bn(this._rings[r],t,!0)).length&&this._parts.push(i)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,n,i,r,s,o,a,l,c=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(r=0,a=this._parts.length;r<a;r++)for(s=0,o=(l=(e=this._parts[r]).length)-1;s<l;o=s++)n=e[s],i=e[o],n.y>t.y!==i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(c=!c);return c||li.prototype._containsPoint.call(this,t,!0)}});function hi(t,e){return new ui(t,e)}var di=Xn.extend({initialize:function(t,e){p(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,n,i,r=_(t)?t:t.features;if(r){for(e=0,n=r.length;e<n;e++)((i=r[e]).geometries||i.geometry||i.features||i.coordinates)&&this.addData(i);return this}var s=this.options;if(s.filter&&!s.filter(t))return this;var o=pi(t,s);return o?(o.feature=bi(t),o.defaultOptions=o.options,this.resetStyle(o),s.onEachFeature&&s.onEachFeature(t,o),this.addLayer(o)):this},resetStyle:function(t){return void 0===t?this.eachLayer(this.resetStyle,this):(t.options=n({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this)},setStyle:function(t){return this.eachLayer((function(e){this._setLayerStyle(e,t)}),this)},_setLayerStyle:function(t,e){t.setStyle&&("function"===typeof e&&(e=e(t.feature)),t.setStyle(e))}});function pi(t,e){var n,i,r,s,o="Feature"===t.type?t.geometry:t,a=o?o.coordinates:null,l=[],c=e&&e.pointToLayer,u=e&&e.coordsToLatLng||gi;if(!a&&!o)return null;switch(o.type){case"Point":return fi(c,t,n=u(a),e);case"MultiPoint":for(r=0,s=a.length;r<s;r++)n=u(a[r]),l.push(fi(c,t,n,e));return new Xn(l);case"LineString":case"MultiLineString":return i=mi(a,"LineString"===o.type?0:1,u),new li(i,e);case"Polygon":case"MultiPolygon":return i=mi(a,"Polygon"===o.type?1:2,u),new ui(i,e);case"GeometryCollection":for(r=0,s=o.geometries.length;r<s;r++){var h=pi({geometry:o.geometries[r],type:"Feature",properties:t.properties},e);h&&l.push(h)}return new Xn(l);case"FeatureCollection":for(r=0,s=o.features.length;r<s;r++){var d=pi(o.features[r],e);d&&l.push(d)}return new Xn(l);default:throw new Error("Invalid GeoJSON object.")}}function fi(t,e,n,i){return t?t(e,n):new ei(n,i&&i.markersInheritOptions&&i)}function gi(t){return new z(t[1],t[0],t[2])}function mi(t,e,n){for(var i,r=[],s=0,o=t.length;s<o;s++)i=e?mi(t[s],e-1,n):(n||gi)(t[s]),r.push(i);return r}function _i(t,e){return void 0!==(t=j(t)).alt?[u(t.lng,e),u(t.lat,e),u(t.alt,e)]:[u(t.lng,e),u(t.lat,e)]}function yi(t,e,n,i){for(var r=[],s=0,o=t.length;s<o;s++)r.push(e?yi(t[s],Dn(t[s])?0:e-1,n,i):_i(t[s],i));return!e&&n&&r.length>0&&r.push(r[0].slice()),r}function vi(t,e){return t.feature?n({},t.feature,{geometry:e}):bi(e)}function bi(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var wi={toGeoJSON:function(t){return vi(this,{type:"Point",coordinates:_i(this.getLatLng(),t)})}};function Ei(t,e){return new di(t,e)}ei.include(wi),oi.include(wi),ri.include(wi),li.include({toGeoJSON:function(t){var e=!Dn(this._latlngs);return vi(this,{type:(e?"Multi":"")+"LineString",coordinates:yi(this._latlngs,e?1:0,!1,t)})}}),ui.include({toGeoJSON:function(t){var e=!Dn(this._latlngs),n=e&&!Dn(this._latlngs[0]),i=yi(this._latlngs,n?2:e?1:0,!0,t);return e||(i=[i]),vi(this,{type:(n?"Multi":"")+"Polygon",coordinates:i})}}),qn.include({toMultiPoint:function(t){var e=[];return this.eachLayer((function(n){e.push(n.toGeoJSON(t).geometry.coordinates)})),vi(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this.toMultiPoint(t);var n="GeometryCollection"===e,i=[];return this.eachLayer((function(e){if(e.toGeoJSON){var r=e.toGeoJSON(t);if(n)i.push(r.geometry);else{var s=bi(r);"FeatureCollection"===s.type?i.push.apply(i,s.features):i.push(s)}}})),n?vi(this,{geometries:i,type:"GeometryCollection"}):{type:"FeatureCollection",features:i}}});var xi=Ei,Si=Hn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,n){this._url=t,this._bounds=U(e),p(this,n)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ve(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){fe(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&me(this._image),this},bringToBack:function(){return this._map&&_e(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=U(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,e=this._image=t?this._url:pe("img");ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),this.options.className&&ve(e,this.options.className),e.onselectstart=c,e.onmousemove=c,e.onload=r(this.fire,this,"load"),e.onerror=r(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),n=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Ce(this._image,n,e)},_reset:function(){var t=this._image,e=new D(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),n=e.getSize();Ae(t,e.min),t.style.width=n.x+"px",t.style.height=n.y+"px"},_updateOpacity:function(){xe(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)},getCenter:function(){return this._bounds.getCenter()}}),Ti=function(t,e,n){return new Si(t,e,n)},Ci=Si.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,e=this._image=t?this._url:pe("video");if(ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),this.options.className&&ve(e,this.options.className),e.onselectstart=c,e.onmousemove=c,e.onloadeddata=r(this.fire,this,"load"),t){for(var n=e.getElementsByTagName("source"),i=[],s=0;s<n.length;s++)i.push(n[s].src);this._url=n.length>0?i:[e.src]}else{_(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(e.style,"objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop,e.muted=!!this.options.muted,e.playsInline=!!this.options.playsInline;for(var o=0;o<this._url.length;o++){var a=pe("source");a.src=this._url[o],e.appendChild(a)}}}});function Ai(t,e,n){return new Ci(t,e,n)}var Pi=Si.extend({_initImage:function(){var t=this._image=this._url;ve(t,"leaflet-image-layer"),this._zoomAnimated&&ve(t,"leaflet-zoom-animated"),this.options.className&&ve(t,this.options.className),t.onselectstart=c,t.onmousemove=c}});function Ri(t,e,n){return new Pi(t,e,n)}var Mi=Hn.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(t,e){t&&(t instanceof z||_(t))?(this._latlng=j(t),p(this,e)):(p(this,t),this._source=e),this.options.content&&(this._content=this.options.content)},openOn:function(t){return(t=arguments.length?t:this._source._map).hasLayer(this)||t.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(t){return this._map?this.close():(arguments.length?this._source=t:t=this._source,this._prepareOpen(),this.openOn(t._map)),this},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&xe(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&xe(this._container,1),this.bringToFront(),this.options.interactive&&(ve(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(t){t._fadeAnimated?(xe(this._container,0),this._removeTimeout=setTimeout(r(fe,void 0,this._container),200)):fe(this._container),this.options.interactive&&(be(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=j(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,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 t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&me(this._container),this},bringToBack:function(){return this._map&&_e(this._container),this},_prepareOpen:function(t){var e=this._source;if(!e._map)return!1;if(e instanceof Xn){e=null;var n=this._source._layers;for(var i in n)if(n[i]._map){e=n[i];break}if(!e)return!1;this._source=e}if(!t)if(e.getCenter)t=e.getCenter();else if(e.getLatLng)t=e.getLatLng();else{if(!e.getBounds)throw new Error("Unable to get source layer LatLng.");t=e.getBounds().getCenter()}return this.setLatLng(t),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var t=this._contentNode,e="function"===typeof this._content?this._content(this._source||this):this._content;if("string"===typeof e)t.innerHTML=e;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=O(this.options.offset),n=this._getAnchor();this._zoomAnimated?Ae(this._container,t.add(n)):e=e.add(t).add(n);var i=this._containerBottom=-e.y,r=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=i+"px",this._container.style.left=r+"px"}},_getAnchor:function(){return[0,0]}});nn.include({_initOverlay:function(t,e,n,i){var r=e;return r instanceof t||(r=new t(i).setContent(e)),n&&r.setLatLng(n),r}}),Hn.include({_initOverlay:function(t,e,n,i){var r=n;return r instanceof t?(p(r,i),r._source=this):(r=e&&!i?e:new t(i,this)).setContent(n),r}});var Ii=Mi.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(t){return!(t=arguments.length?t:this._source._map).hasLayer(this)&&t._popup&&t._popup.options.autoClose&&t.removeLayer(t._popup),t._popup=this,Mi.prototype.openOn.call(this,t)},onAdd:function(t){Mi.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof ii||this._source.on("preclick",$e))},onRemove:function(t){Mi.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof ii||this._source.off("preclick",$e))},getEvents:function(){var t=Mi.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this.close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_initLayout:function(){var t="leaflet-popup",e=this._container=pe("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),n=this._wrapper=pe("div",t+"-content-wrapper",e);if(this._contentNode=pe("div",t+"-content",n),He(e),Ge(this._contentNode),Fe(e,"contextmenu",$e),this._tipContainer=pe("div",t+"-tip-container",e),this._tip=pe("div",t+"-tip",this._tipContainer),this.options.closeButton){var i=this._closeButton=pe("a",t+"-close-button",e);i.setAttribute("role","button"),i.setAttribute("aria-label","Close popup"),i.href="#close",i.innerHTML='<span aria-hidden="true">×</span>',Fe(i,"click",(function(t){qe(t),this.close()}),this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var n=t.offsetWidth;n=Math.min(n,this.options.maxWidth),n=Math.max(n,this.options.minWidth),e.width=n+1+"px",e.whiteSpace="",e.height="";var i=t.offsetHeight,r=this.options.maxHeight,s="leaflet-popup-scrolled";r&&i>r?(e.height=r+"px",ve(t,s)):be(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),n=this._getAnchor();Ae(this._container,e.add(n))},_adjustPan:function(){if(this.options.autoPan)if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning)this._autopanning=!1;else{var t=this._map,e=parseInt(de(this._container,"marginBottom"),10)||0,n=this._container.offsetHeight+e,i=this._containerWidth,r=new k(this._containerLeft,-n-this._containerBottom);r._add(Pe(this._container));var s=t.layerPointToContainerPoint(r),o=O(this.options.autoPanPadding),a=O(this.options.autoPanPaddingTopLeft||o),l=O(this.options.autoPanPaddingBottomRight||o),c=t.getSize(),u=0,h=0;s.x+i+l.x>c.x&&(u=s.x+i-c.x+l.x),s.x-u-a.x<0&&(u=s.x-a.x),s.y+n+l.y>c.y&&(h=s.y+n-c.y+l.y),s.y-h-a.y<0&&(h=s.y-a.y),(u||h)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([u,h]))}},_getAnchor:function(){return O(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Li=function(t,e){return new Ii(t,e)};nn.mergeOptions({closePopupOnClick:!0}),nn.include({openPopup:function(t,e,n){return this._initOverlay(Ii,t,e,n).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),Hn.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Ii,this._popup,t,e),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(t){return this._popup&&(this instanceof Xn||(this._popup._source=this),this._popup._prepareOpen(t||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()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(this._popup&&this._map){Ze(t);var e=t.layer||t.target;this._popup._source!==e||e instanceof ii?(this._popup._source=e,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var ki=Mi.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Mi.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Mi.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Mi.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=pe("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+o(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,n,i=this._map,r=this._container,s=i.latLngToContainerPoint(i.getCenter()),o=i.layerPointToContainerPoint(t),a=this.options.direction,l=r.offsetWidth,c=r.offsetHeight,u=O(this.options.offset),h=this._getAnchor();"top"===a?(e=l/2,n=c):"bottom"===a?(e=l/2,n=0):"center"===a?(e=l/2,n=c/2):"right"===a?(e=0,n=c/2):"left"===a?(e=l,n=c/2):o.x<s.x?(a="right",e=0,n=c/2):(a="left",e=l+2*(u.x+h.x),n=c/2),t=t.subtract(O(e,n,!0)).add(u).add(h),be(r,"leaflet-tooltip-right"),be(r,"leaflet-tooltip-left"),be(r,"leaflet-tooltip-top"),be(r,"leaflet-tooltip-bottom"),ve(r,"leaflet-tooltip-"+a),Ae(r,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&xe(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return O(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Ni=function(t,e){return new ki(t,e)};nn.include({openTooltip:function(t,e,n){return this._initOverlay(ki,t,e,n).openOn(this),this},closeTooltip:function(t){return t.close(),this}}),Hn.include({bindTooltip:function(t,e){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(ki,this._tooltip,t,e),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(t){if(t||!this._tooltipHandlersAdded){var e=t?"off":"on",n={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?n.add=this._openTooltip:(n.mouseover=this._openTooltip,n.mouseout=this.closeTooltip,n.click=this._openTooltip,this._map?this._addFocusListeners():n.add=this._addFocusListeners),this._tooltip.options.sticky&&(n.mousemove=this._moveTooltip),this[e](n),this._tooltipHandlersAdded=!t}},openTooltip:function(t){return this._tooltip&&(this instanceof Xn||(this._tooltip._source=this),this._tooltip._prepareOpen(t)&&(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(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(t){var e="function"===typeof t.getElement&&t.getElement();e&&(Fe(e,"focus",(function(){this._tooltip._source=t,this.openTooltip()}),this),Fe(e,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(t){var e="function"===typeof t.getElement&&t.getElement();e&&e.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(t){if(this._tooltip&&this._map)if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var e=this;this._map.once("moveend",(function(){e._openOnceFlag=!1,e._openTooltip(t)}))}else this._tooltip._source=t.layer||t.target,this.openTooltip(this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,n,i=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),n=this._map.containerPointToLayerPoint(e),i=this._map.layerPointToLatLng(n)),this._tooltip.setLatLng(i)}});var Oi=Yn.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&"DIV"===t.tagName?t:document.createElement("div"),n=this.options;if(n.html instanceof Element?(ge(e),e.appendChild(n.html)):e.innerHTML=!1!==n.html?n.html:"",n.bgPos){var i=O(n.bgPos);e.style.backgroundPosition=-i.x+"px "+-i.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function Di(t){return new Oi(t)}Yn.Default=Qn;var Fi=Hn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:Dt.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(t){p(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),fe(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(me(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(_e(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var t=this._clampZoom(this._map.getZoom());t!==this._tileZoom&&(this._tileZoom=t,this._updateLevels()),this._update()}return this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=a(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof k?t:new k(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,n=this.getPane().children,i=-t(-1/0,1/0),r=0,s=n.length;r<s;r++)e=n[r].style.zIndex,n[r]!==this._container&&e&&(i=t(i,+e));isFinite(i)&&(this.options.zIndex=i+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!Dt.ielt9){xe(this._container,this.options.opacity);var t=+new Date,e=!1,n=!1;for(var i in this._tiles){var r=this._tiles[i];if(r.current&&r.loaded){var s=Math.min(1,(t-r.loaded)/200);xe(r.el,s),s<1?e=!0:(r.active?n=!0:this._onOpaqueTile(r),r.active=!0)}}n&&!this._noPrune&&this._pruneTiles(),e&&(C(this._fadeFrame),this._fadeFrame=T(this._updateOpacity,this))}},_onOpaqueTile:c,_initContainer:function(){this._container||(this._container=pe("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var n in this._levels)n=Number(n),this._levels[n].el.children.length||n===t?(this._levels[n].el.style.zIndex=e-Math.abs(t-n),this._onUpdateLevel(n)):(fe(this._levels[n].el),this._removeTilesAtZoom(n),this._onRemoveLevel(n),delete this._levels[n]);var i=this._levels[t],r=this._map;return i||((i=this._levels[t]={}).el=pe("div","leaflet-tile-container leaflet-zoom-animated",this._container),i.el.style.zIndex=e,i.origin=r.project(r.unproject(r.getPixelOrigin()),t).round(),i.zoom=t,this._setZoomTransform(i,r.getCenter(),r.getZoom()),c(i.el.offsetWidth),this._onCreateLevel(i)),this._level=i,i}},_onUpdateLevel:c,_onRemoveLevel:c,_onCreateLevel:c,_pruneTiles:function(){if(this._map){var t,e,n=this._map.getZoom();if(n>this.options.maxZoom||n<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles)if((e=this._tiles[t]).current&&!e.active){var i=e.coords;this._retainParent(i.x,i.y,i.z,i.z-5)||this._retainChildren(i.x,i.y,i.z,i.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)fe(this._levels[t].el),this._onRemoveLevel(Number(t)),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,n,i){var r=Math.floor(t/2),s=Math.floor(e/2),o=n-1,a=new k(+r,+s);a.z=+o;var l=this._tileCoordsToKey(a),c=this._tiles[l];return c&&c.active?(c.retain=!0,!0):(c&&c.loaded&&(c.retain=!0),o>i&&this._retainParent(r,s,o,i))},_retainChildren:function(t,e,n,i){for(var r=2*t;r<2*t+2;r++)for(var s=2*e;s<2*e+2;s++){var o=new k(r,s);o.z=n+1;var a=this._tileCoordsToKey(o),l=this._tiles[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),n+1<i&&this._retainChildren(r,s,n+1,i))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,n,i){var r=Math.round(e);r=void 0!==this.options.maxZoom&&r>this.options.maxZoom||void 0!==this.options.minZoom&&r<this.options.minZoom?void 0:this._clampZoom(r);var s=this.options.updateWhenZooming&&r!==this._tileZoom;i&&!s||(this._tileZoom=r,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==r&&this._update(t),n||this._pruneTiles(),this._noPrune=!!n),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var n in this._levels)this._setZoomTransform(this._levels[n],t,e)},_setZoomTransform:function(t,e,n){var i=this._map.getZoomScale(n,t.zoom),r=t.origin.multiplyBy(i).subtract(this._map._getNewPixelOrigin(e,n)).round();Dt.any3d?Ce(t.el,r,i):Ae(t.el,r)},_resetGrid:function(){var t=this._map,e=t.options.crs,n=this._tileSize=this.getTileSize(),i=this._tileZoom,r=this._map.getPixelWorldBounds(this._tileZoom);r&&(this._globalTileRange=this._pxBoundsToTileRange(r)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],i).x/n.x),Math.ceil(t.project([0,e.wrapLng[1]],i).x/n.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],i).y/n.x),Math.ceil(t.project([e.wrapLat[1],0],i).y/n.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,n=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),i=e.getZoomScale(n,this._tileZoom),r=e.project(t,this._tileZoom).floor(),s=e.getSize().divideBy(2*i);return new D(r.subtract(s),r.add(s))},_update:function(t){var e=this._map;if(e){var n=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var i=this._getTiledPixelBounds(t),r=this._pxBoundsToTileRange(i),s=r.getCenter(),o=[],a=this.options.keepBuffer,l=new D(r.getBottomLeft().subtract([a,-a]),r.getTopRight().add([a,-a]));if(!(isFinite(r.min.x)&&isFinite(r.min.y)&&isFinite(r.max.x)&&isFinite(r.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var c in this._tiles){var u=this._tiles[c].coords;u.z===this._tileZoom&&l.contains(new k(u.x,u.y))||(this._tiles[c].current=!1)}if(Math.abs(n-this._tileZoom)>1)this._setView(t,n);else{for(var h=r.min.y;h<=r.max.y;h++)for(var d=r.min.x;d<=r.max.x;d++){var p=new k(d,h);if(p.z=this._tileZoom,this._isValidTile(p)){var f=this._tiles[this._tileCoordsToKey(p)];f?f.current=!0:o.push(p)}}if(o.sort((function(t,e){return t.distanceTo(s)-e.distanceTo(s)})),0!==o.length){this._loading||(this._loading=!0,this.fire("loading"));var g=document.createDocumentFragment();for(d=0;d<o.length;d++)this._addTile(o[d],g);this._level.el.appendChild(g)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var n=this._globalTileRange;if(!e.wrapLng&&(t.x<n.min.x||t.x>n.max.x)||!e.wrapLat&&(t.y<n.min.y||t.y>n.max.y))return!1}if(!this.options.bounds)return!0;var i=this._tileCoordsToBounds(t);return U(this.options.bounds).overlaps(i)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,n=this.getTileSize(),i=t.scaleBy(n),r=i.add(n);return[e.unproject(i,t.z),e.unproject(r,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),n=new B(e[0],e[1]);return this.options.noWrap||(n=this._map.wrapLatLngBounds(n)),n},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),n=new k(+e[0],+e[1]);return n.z=+e[2],n},_removeTile:function(t){var e=this._tiles[t];e&&(fe(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ve(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=c,t.onmousemove=c,Dt.ielt9&&this.options.opacity<1&&xe(t,this.options.opacity)},_addTile:function(t,e){var n=this._getTilePos(t),i=this._tileCoordsToKey(t),s=this.createTile(this._wrapCoords(t),r(this._tileReady,this,t));this._initTile(s),this.createTile.length<2&&T(r(this._tileReady,this,t,null,s)),Ae(s,n),this._tiles[i]={el:s,coords:t,current:!0},e.appendChild(s),this.fire("tileloadstart",{tile:s,coords:t})},_tileReady:function(t,e,n){e&&this.fire("tileerror",{error:e,tile:n,coords:t});var i=this._tileCoordsToKey(t);(n=this._tiles[i])&&(n.loaded=+new Date,this._map._fadeAnimated?(xe(n.el,0),C(this._fadeFrame),this._fadeFrame=T(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),e||(ve(n.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:n.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Dt.ielt9||!this._map._fadeAnimated?T(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new k(this._wrapX?l(t.x,this._wrapX):t.x,this._wrapY?l(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new D(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function Bi(t){return new Fi(t)}var Ui=Fi.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,(e=p(this,e)).detectRetina&&Dt.retina&&e.maxZoom>0?(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom=Math.min(e.maxZoom,e.minZoom+1)):(e.zoomOffset++,e.maxZoom=Math.max(e.minZoom,e.maxZoom-1)),e.minZoom=Math.max(0,e.minZoom)):e.zoomReverse?e.minZoom=Math.min(e.maxZoom,e.minZoom):e.maxZoom=Math.max(e.minZoom,e.maxZoom),"string"===typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var n=document.createElement("img");return Fe(n,"load",r(this._tileOnLoad,this,e,n)),Fe(n,"error",r(this._tileOnError,this,e,n)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(n.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),"string"===typeof this.options.referrerPolicy&&(n.referrerPolicy=this.options.referrerPolicy),n.alt="",n.src=this.getTileUrl(t),n},getTileUrl:function(t){var e={r:Dt.retina?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return m(this._url,n(e,this.options))},_tileOnLoad:function(t,e){Dt.ielt9?setTimeout(r(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,n){var i=this.options.errorTileUrl;i&&e.getAttribute("src")!==i&&(e.src=i),t(n,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)if(this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=c,e.onerror=c,!e.complete)){e.src=v;var n=this._tiles[t].coords;fe(e),delete this._tiles[t],this.fire("tileabort",{tile:e,coords:n})}},_removeTile:function(t){var e=this._tiles[t];if(e)return e.el.setAttribute("src",v),Fi.prototype._removeTile.call(this,t)},_tileReady:function(t,e,n){if(this._map&&(!n||n.getAttribute("src")!==v))return Fi.prototype._tileReady.call(this,t,e,n)}});function zi(t,e){return new Ui(t,e)}var ji=Ui.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=n({},this.defaultWmsParams);for(var r in e)r in this.options||(i[r]=e[r]);var s=(e=p(this,e)).detectRetina&&Dt.retina?2:1,o=this.getTileSize();i.width=o.x*s,i.height=o.y*s,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,Ui.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),n=this._crs,i=F(n.project(e[0]),n.project(e[1])),r=i.min,s=i.max,o=(this._wmsVersion>=1.3&&this._crs===$n?[r.y,r.x,s.y,s.x]:[r.x,r.y,s.x,s.y]).join(","),a=Ui.prototype.getTileUrl.call(this,t);return a+f(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+o},setParams:function(t,e){return n(this.wmsParams,t),e||this.redraw(),this}});function Vi(t,e){return new ji(t,e)}Ui.WMS=ji,zi.wms=Vi;var Wi=Hn.extend({options:{padding:.1},initialize:function(t){p(this,t),o(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),ve(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 t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var n=this._map.getZoomScale(e,this._zoom),i=this._map.getSize().multiplyBy(.5+this.options.padding),r=this._map.project(this._center,e),s=i.multiplyBy(-n).add(r).subtract(this._map._getNewPixelOrigin(t,e));Dt.any3d?Ce(this._container,s,n):Ae(this._container,s)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),n=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new D(n,n.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),$i=Wi.extend({options:{tolerance:0},getEvents:function(){var t=Wi.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Wi.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");Fe(t,"mousemove",this._onMouseMove,this),Fe(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Fe(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){C(this._redrawRequest),delete this._ctx,fe(this._container),Ue(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){Wi.prototype._update.call(this);var t=this._bounds,e=this._container,n=t.getSize(),i=Dt.retina?2:1;Ae(e,t.min),e.width=i*n.x,e.height=i*n.y,e.style.width=n.x+"px",e.style.height=n.y+"px",Dt.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){Wi.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[o(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,n=e.next,i=e.prev;n?n.prev=i:this._drawLast=i,i?i.next=n:this._drawFirst=n,delete t._order,delete this._layers[o(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"===typeof t.options.dashArray){var e,n,i=t.options.dashArray.split(/[, ]+/),r=[];for(n=0;n<i.length;n++){if(e=Number(i[n]),isNaN(e))return;r.push(e)}t.options._dashArray=r}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||T(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new D,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_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 t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.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 t,e=this._redrawBounds;if(this._ctx.save(),e){var n=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,n.x,n.y),this._ctx.clip()}this._drawing=!0;for(var i=this._drawFirst;i;i=i.next)t=i.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var n,i,r,s,o=t._parts,a=o.length,l=this._ctx;if(a){for(l.beginPath(),n=0;n<a;n++){for(i=0,r=o[n].length;i<r;i++)s=o[n][i],l[i?"lineTo":"moveTo"](s.x,s.y);e&&l.closePath()}this._fillStroke(l,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,n=this._ctx,i=Math.max(Math.round(t._radius),1),r=(Math.max(Math.round(t._radiusY),1)||i)/i;1!==r&&(n.save(),n.scale(1,r)),n.beginPath(),n.arc(e.x,e.y/r,i,0,2*Math.PI,!1),1!==r&&n.restore(),this._fillStroke(n,t)}},_fillStroke:function(t,e){var n=e.options;n.fill&&(t.globalAlpha=n.fillOpacity,t.fillStyle=n.fillColor||n.color,t.fill(n.fillRule||"evenodd")),n.stroke&&0!==n.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=n.opacity,t.lineWidth=n.weight,t.strokeStyle=n.color,t.lineCap=n.lineCap,t.lineJoin=n.lineJoin,t.stroke())},_onClick:function(t){for(var e,n,i=this._map.mouseEventToLayerPoint(t),r=this._drawFirst;r;r=r.next)(e=r.layer).options.interactive&&e._containsPoint(i)&&("click"!==t.type&&"preclick"!==t.type||!this._map._draggableMoved(e))&&(n=e);this._fireEvent(!!n&&[n],t)},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(be(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(t,e){if(!this._mouseHoverThrottled){for(var n,i,s=this._drawFirst;s;s=s.next)(n=s.layer).options.interactive&&n._containsPoint(e)&&(i=n);i!==this._hoveredLayer&&(this._handleMouseOut(t),i&&(ve(this._container,"leaflet-interactive"),this._fireEvent([i],t,"mouseover"),this._hoveredLayer=i)),this._fireEvent(!!this._hoveredLayer&&[this._hoveredLayer],t),this._mouseHoverThrottled=!0,setTimeout(r((function(){this._mouseHoverThrottled=!1}),this),32)}},_fireEvent:function(t,e,n){this._map._fireDOMEvent(e,n||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var n=e.next,i=e.prev;n&&(n.prev=i,i?i.next=n:n&&(this._drawFirst=n),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var n=e.next,i=e.prev;i&&(i.next=n,n?n.prev=i:i&&(this._drawLast=i),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function Gi(t){return Dt.canvas?new $i(t):null}var Hi=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),qi={_initContainer:function(){this._container=pe("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Wi.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=Hi("shape");ve(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=Hi("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[o(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;fe(e),t.removeInteractiveTarget(e),delete this._layers[o(t)]},_updateStyle:function(t){var e=t._stroke,n=t._fill,i=t.options,r=t._container;r.stroked=!!i.stroke,r.filled=!!i.fill,i.stroke?(e||(e=t._stroke=Hi("stroke")),r.appendChild(e),e.weight=i.weight+"px",e.color=i.color,e.opacity=i.opacity,i.dashArray?e.dashStyle=_(i.dashArray)?i.dashArray.join(" "):i.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=i.lineCap.replace("butt","flat"),e.joinstyle=i.lineJoin):e&&(r.removeChild(e),t._stroke=null),i.fill?(n||(n=t._fill=Hi("fill")),r.appendChild(n),n.color=i.fillColor||i.color,n.opacity=i.fillOpacity):n&&(r.removeChild(n),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),n=Math.round(t._radius),i=Math.round(t._radiusY||n);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+n+","+i+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){me(t._container)},_bringToBack:function(t){_e(t._container)}},Zi=Dt.vml?Hi:K,Xi=Wi.extend({_initContainer:function(){this._container=Zi("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Zi("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){fe(this._container),Ue(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!this._map._animatingZoom||!this._bounds){Wi.prototype._update.call(this);var t=this._bounds,e=t.getSize(),n=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,n.setAttribute("width",e.x),n.setAttribute("height",e.y)),Ae(n,t.min),n.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=Zi("path");t.options.className&&ve(e,t.options.className),t.options.interactive&&ve(e,"leaflet-interactive"),this._updateStyle(t),this._layers[o(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){fe(t._path),t.removeInteractiveTarget(t._path),delete this._layers[o(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,n=t.options;e&&(n.stroke?(e.setAttribute("stroke",n.color),e.setAttribute("stroke-opacity",n.opacity),e.setAttribute("stroke-width",n.weight),e.setAttribute("stroke-linecap",n.lineCap),e.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?e.setAttribute("stroke-dasharray",n.dashArray):e.removeAttribute("stroke-dasharray"),n.dashOffset?e.setAttribute("stroke-dashoffset",n.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),n.fill?(e.setAttribute("fill",n.fillColor||n.color),e.setAttribute("fill-opacity",n.fillOpacity),e.setAttribute("fill-rule",n.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Y(t._parts,e))},_updateCircle:function(t){var e=t._point,n=Math.max(Math.round(t._radius),1),i="a"+n+","+(Math.max(Math.round(t._radiusY),1)||n)+" 0 1,0 ",r=t._empty()?"M0 0":"M"+(e.x-n)+","+e.y+i+2*n+",0 "+i+2*-n+",0 ";this._setPath(t,r)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){me(t._path)},_bringToBack:function(t){_e(t._path)}});function Ki(t){return Dt.svg||Dt.vml?new Xi(t):null}Dt.vml&&Xi.include(qi),nn.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&Gi(t)||Ki(t)}});var Yi=ui.extend({initialize:function(t,e){ui.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=U(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function Ji(t,e){return new Yi(t,e)}Xi.create=Zi,Xi.pointsToPath=Y,di.geometryToLayer=pi,di.coordsToLatLng=gi,di.coordsToLatLngs=mi,di.latLngToCoords=_i,di.latLngsToCoords=yi,di.getFeature=vi,di.asFeature=bi,nn.mergeOptions({boxZoom:!0});var Qi=mn.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){Fe(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Ue(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){fe(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),ie(),Me(),this._startPoint=this._map.mouseEventToContainerPoint(t),Fe(document,{contextmenu:Ze,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=pe("div","leaflet-zoom-box",this._container),ve(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new D(this._point,this._startPoint),n=e.getSize();Ae(this._box,e.min),this._box.style.width=n.x+"px",this._box.style.height=n.y+"px"},_finish:function(){this._moved&&(fe(this._box),be(this._container,"leaflet-crosshair")),re(),Ie(),Ue(document,{contextmenu:Ze,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0);var e=new B(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});nn.addInitHook("addHandler","boxZoom",Qi),nn.mergeOptions({doubleClickZoom:!0});var tr=mn.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,n=e.getZoom(),i=e.options.zoomDelta,r=t.originalEvent.shiftKey?n-i:n+i;"center"===e.options.doubleClickZoom?e.setZoom(r):e.setZoomAround(t.containerPoint,r)}});nn.addInitHook("addHandler","doubleClickZoom",tr),nn.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var er=mn.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new vn(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}ve(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){be(this._map._container,"leaflet-grab"),be(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 t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=U(this._map.options.maxBounds);this._offsetLimit=F(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(n),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),n=this._initialWorldOffset,i=this._draggable._newPos.x,r=(i-e+n)%t+e-n,s=(i+e+n)%t-e-n,o=Math.abs(r+n)<Math.abs(s+n)?r:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=o},_onDragEnd:function(t){var e=this._map,n=e.options,i=!n.inertia||t.noInertia||this._times.length<2;if(e.fire("dragend",t),i)e.fire("moveend");else{this._prunePositions(+new Date);var r=this._lastPos.subtract(this._positions[0]),s=(this._lastTime-this._times[0])/1e3,o=n.easeLinearity,a=r.multiplyBy(o/s),l=a.distanceTo([0,0]),c=Math.min(n.inertiaMaxSpeed,l),u=a.multiplyBy(c/l),h=c/(n.inertiaDeceleration*o),d=u.multiplyBy(-h/2).round();d.x||d.y?(d=e._limitOffset(d,e.options.maxBounds),T((function(){e.panBy(d,{duration:h,easeLinearity:o,noMoveStart:!0,animate:!0})}))):e.fire("moveend")}}});nn.addInitHook("addHandler","dragging",er),nn.mergeOptions({keyboard:!0,keyboardPanDelta:80});var nr=mn.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),Fe(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Ue(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 t=document.body,e=document.documentElement,n=t.scrollTop||e.scrollTop,i=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(i,n)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e,n,i=this._panKeys={},r=this.keyCodes;for(e=0,n=r.left.length;e<n;e++)i[r.left[e]]=[-1*t,0];for(e=0,n=r.right.length;e<n;e++)i[r.right[e]]=[t,0];for(e=0,n=r.down.length;e<n;e++)i[r.down[e]]=[0,t];for(e=0,n=r.up.length;e<n;e++)i[r.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,n,i=this._zoomKeys={},r=this.keyCodes;for(e=0,n=r.zoomIn.length;e<n;e++)i[r.zoomIn[e]]=t;for(e=0,n=r.zoomOut.length;e<n;e++)i[r.zoomOut[e]]=-t},_addHooks:function(){Fe(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Ue(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,n=t.keyCode,i=this._map;if(n in this._panKeys){if(!i._panAnim||!i._panAnim._inProgress)if(e=this._panKeys[n],t.shiftKey&&(e=O(e).multiplyBy(3)),i.options.maxBounds&&(e=i._limitOffset(O(e),i.options.maxBounds)),i.options.worldCopyJump){var r=i.wrapLatLng(i.unproject(i.project(i.getCenter()).add(e)));i.panTo(r)}else i.panBy(e)}else if(n in this._zoomKeys)i.setZoom(i.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[n]);else{if(27!==n||!i._popup||!i._popup.options.closeOnEscapeKey)return;i.closePopup()}Ze(t)}}});nn.addInitHook("addHandler","keyboard",nr),nn.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var ir=mn.extend({addHooks:function(){Fe(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Ue(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=Je(t),n=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var i=Math.max(n-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),i),Ze(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),n=this._map.options.zoomSnap||0;t._stop();var i=this._delta/(4*this._map.options.wheelPxPerZoomLevel),r=4*Math.log(2/(1+Math.exp(-Math.abs(i))))/Math.LN2,s=n?Math.ceil(r/n)*n:r,o=t._limitZoom(e+(this._delta>0?s:-s))-e;this._delta=0,this._startTime=null,o&&("center"===t.options.scrollWheelZoom?t.setZoom(e+o):t.setZoomAround(this._lastMousePos,e+o))}});nn.addInitHook("addHandler","scrollWheelZoom",ir);var rr=600;nn.mergeOptions({tapHold:Dt.touchNative&&Dt.safari&&Dt.mobile,tapTolerance:15});var sr=mn.extend({addHooks:function(){Fe(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Ue(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),1===t.touches.length){var e=t.touches[0];this._startPos=this._newPos=new k(e.clientX,e.clientY),this._holdTimeout=setTimeout(r((function(){this._cancel(),this._isTapValid()&&(Fe(document,"touchend",qe),Fe(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",e))}),this),rr),Fe(document,"touchend touchcancel contextmenu",this._cancel,this),Fe(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){Ue(document,"touchend",qe),Ue(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),Ue(document,"touchend touchcancel contextmenu",this._cancel,this),Ue(document,"touchmove",this._onMove,this)},_onMove:function(t){var e=t.touches[0];this._newPos=new k(e.clientX,e.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,e){var n=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY});n._simulated=!0,e.target.dispatchEvent(n)}});nn.addInitHook("addHandler","tapHold",sr),nn.mergeOptions({touchZoom:Dt.touch,bounceAtZoomLimits:!0});var or=mn.extend({addHooks:function(){ve(this._map._container,"leaflet-touch-zoom"),Fe(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){be(this._map._container,"leaflet-touch-zoom"),Ue(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var n=e.mouseEventToContainerPoint(t.touches[0]),i=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(n.add(i)._divideBy(2))),this._startDist=n.distanceTo(i),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),Fe(document,"touchmove",this._onTouchMove,this),Fe(document,"touchend touchcancel",this._onTouchEnd,this),qe(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,n=e.mouseEventToContainerPoint(t.touches[0]),i=e.mouseEventToContainerPoint(t.touches[1]),s=n.distanceTo(i)/this._startDist;if(this._zoom=e.getScaleZoom(s,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMin
2Zoom()&&s<1||this._zoom>e.getMaxZoom()&&s>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===s)return}else{var o=n._add(i)._divideBy(2)._subtract(this._centerPoint);if(1===s&&0===o.x&&0===o.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(o),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),C(this._animRequest);var a=r(e._move,e,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=T(a,this,!0),qe(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,C(this._animRequest),Ue(document,"touchmove",this._onTouchMove,this),Ue(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))):this._zooming=!1}});nn.addInitHook("addHandler","touchZoom",or),nn.BoxZoom=Qi,nn.DoubleClickZoom=tr,nn.Drag=er,nn.Keyboard=nr,nn.ScrollWheelZoom=ir,nn.TapHold=sr,nn.TouchZoom=or,t.Bounds=D,t.Browser=Dt,t.CRS=V,t.Canvas=$i,t.Circle=oi,t.CircleMarker=ri,t.Class=P,t.Control=sn,t.DivIcon=Oi,t.DivOverlay=Mi,t.DomEvent=tn,t.DomUtil=De,t.Draggable=vn,t.Evented=I,t.FeatureGroup=Xn,t.GeoJSON=di,t.GridLayer=Fi,t.Handler=mn,t.Icon=Yn,t.ImageOverlay=Si,t.LatLng=z,t.LatLngBounds=B,t.Layer=Hn,t.LayerGroup=qn,t.LineUtil=Un,t.Map=nn,t.Marker=ei,t.Mixin=_n,t.Path=ii,t.Point=k,t.PolyUtil=Sn,t.Polygon=ui,t.Polyline=li,t.Popup=Ii,t.PosAnimation=en,t.Projection=Vn,t.Rectangle=Yi,t.Renderer=Wi,t.SVG=Xi,t.SVGOverlay=Pi,t.TileLayer=Ui,t.Tooltip=ki,t.Transformation=H,t.Util=A,t.VideoOverlay=Ci,t.bind=r,t.bounds=F,t.canvas=Gi,t.circle=ai,t.circleMarker=si,t.control=on,t.divIcon=Di,t.extend=n,t.featureGroup=Kn,t.geoJSON=Ei,t.geoJson=xi,t.gridLayer=Bi,t.icon=Jn,t.imageOverlay=Ti,t.latLng=j,t.latLngBounds=U,t.layerGroup=Zn,t.map=rn,t.marker=ni,t.point=O,t.polygon=hi,t.polyline=ci,t.popup=Li,t.rectangle=Ji,t.setOptions=p,t.stamp=o,t.svg=Ki,t.svgOverlay=Ri,t.tileLayer=zi,t.tooltip=Ni,t.transformation=q,t.version=e,t.videoOverlay=Ai;var ar=window.L;t.noConflict=function(){return window.L=ar,this},window.L=t}(e)},496:(t,e,n)=>{"use strict";var i=n(687);function r(){}function s(){}s.resetWarningCache=r,t.exports=function(){function t(t,e,n,r,s,o){if(o!==i){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:s,resetWarningCache:r};return n.PropTypes=n,n}},486:(t,e,n)=>{t.exports=n(496)()},687:t=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},441:(t,e,n)=>{"use strict";var i=n(94),r=n(732);function s(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,a={};function l(t,e){c(t,e),c(t+"Capture",e)}function c(t,e){for(a[t]=e,t=0;t<e.length;t++)o.add(e[t])}var u=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),h=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},f={};function g(t,e,n,i,r,s,o){this.acceptsBooleans=2===e||3===e||4===e,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var m={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(t){m[t]=new g(t,0,!1,t,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEac
vendor: 26,868 bytes, line 2
2h((function(t){var e=t[0];m[e]=new g(e,1,!1,t[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(t){m[t]=new g(t,2,!1,t.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(t){m[t]=new g(t,2,!1,t,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(t){m[t]=new g(t,3,!1,t.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(t){m[t]=new g(t,3,!0,t,null,!1,!1)})),["capture","download"].forEach((function(t){m[t]=new g(t,4,!1,t,null,!1,!1)})),["cols","rows","size","span"].forEach((function(t){m[t]=new g(t,6,!1,t,null,!1,!1)})),["rowSpan","start"].forEach((function(t){m[t]=new g(t,5,!1,t.toLowerCase(),null,!1,!1)}));var _=/[\-:]([a-z])/g;function y(t){return t[1].toUpperCase()}function v(t,e,n,i){var r=m.hasOwnProperty(e)?m[e]:null;(null!==r?0!==r.type:i||!(2<e.length)||"o"!==e[0]&&"O"!==e[0]||"n"!==e[1]&&"N"!==e[1])&&(function(t,e,n,i){if(null===e||"undefined"===typeof e||function(t,e,n,i){if(null!==n&&0===n.type)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return!i&&(null!==n?!n.acceptsBooleans:"data-"!==(t=t.toLowerCase().slice(0,5))&&"aria-"!==t);default:return!1}}(t,e,n,i))return!0;if(i)return!1;if(null!==n)switch(n.type){case 3:return!e;case 4:return!1===e;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}(e,n,r,i)&&(n=null),i||null===r?function(t){return!!h.call(f,t)||!h.call(p,t)&&(d.test(t)?f[t]=!0:(p[t]=!0,!1))}(e)&&(null===n?t.removeAttribute(e):t.setAttribute(e,""+n)):r.mustUseProperty?t[r.propertyName]=null===n?3!==r.type&&"":n:(e=r.attributeName,i=r.attributeNamespace,null===n?t.removeAttribute(e):(n=3===(r=r.type)||4===r&&!0===n?"":""+n,i?t.setAttributeNS(i,e,n):t.setAttribute(e,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(t){var e=t.replace(_,y);m[e]=new g(e,1,!1,t,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(t){var e=t.replace(_,y);m[e]=new g(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(t){var e=t.replace(_,y);m[e]=new g(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(t){m[t]=new g(t,1,!1,t.toLowerCase(),null,!1,!1)})),m.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(t){m[t]=new g(t,1,!1,t.toLowerCase(),null,!0,!0)}));var b=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for("react.element"),E=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),C=Symbol.for("react.provider"),A=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),L=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var k=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var N=Symbol.iterator;function O(t){return null===t||"object"!==typeof t?null:"function"===typeof(t=N&&t[N]||t["@@iterator"])?t:null}var D,F=Object.assign;function B(t){if(void 0===D)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);D=e&&e[1]||""}return"\n"+D+t}var U=!1;function z(t,e){if(!t||U)return"";U=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var i=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){i=c}t.call(e.prototype)}else{try{throw Error()}catch(c){i=c}t()}}catch(c){if(c&&i&&"string"===typeof c.stack){for(var r=c.stack.split("\n"),s=i.stack.split("\n"),o=r.length-1,a=s.length-1;1<=o&&0<=a&&r[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==s[a]){if(1!==o||1!==a)do{if(o--,0>--a||r[o]!==s[a]){var l="\n"+r[o].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}}while(1<=o&&0<=a);break}}}finally{U=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?B(t):""}function j(t){switch(t.tag){case 5:return B(t.type);case 16:return B("Lazy");case 13:return B("Suspense");case 19:return B("SuspenseList");case 0:case 2:case 15:return t=z(t.type,!1);case 11:return t=z(t.type.render,!1);case 1:return t=z(t.type,!0);default:return""}}function V(t){if(null==t)return null;if("function"===typeof t)return t.displayName||t.name||null;if("string"===typeof t)return t;switch(t){case x:return"Fragment";case E:return"Portal";case T:return"Profiler";case S:return"StrictMode";case R:return"Suspense";case M:return"SuspenseList"}if("object"===typeof t)switch(t.$$typeof){case A:return(t.displayName||"Context")+".Consumer";case C:return(t._context.displayName||"Context")+".Provider";case P:var e=t.render;return(t=t.displayName)||(t=""!==(t=e.displayName||e.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case I:return null!==(e=t.displayName||null)?e:V(t.type)||"Memo";case L:e=t._payload,t=t._init;try{return V(t(e))}catch(n){}}return null}function W(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=(t=e.render).displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return V(e);case 8:return e===S?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e}return null}function $(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":case"object":return t;default:return""}}function G(t){var e=t.type;return(t=t.nodeName)&&"input"===t.toLowerCase()&&("checkbox"===e||"radio"===e)}function H(t){t._valueTracker||(t._valueTracker=function(t){var e=G(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),i=""+t[e];if(!t.hasOwnProperty(e)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var r=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(t){i=""+t,s.call(this,t)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return i},setValue:function(t){i=""+t},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}(t))}function q(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=G(t)?t.checked?"true":"false":t.value),(t=i)!==n&&(e.setValue(t),!0)}function Z(t){if("undefined"===typeof(t=t||("undefined"!==typeof document?document:void 0)))return null;try{return t.activeElement||t.body}catch(e){return t.body}}function X(t,e){var n=e.checked;return F({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:t._wrapperState.initialChecked})}function K(t,e){var n=null==e.defaultValue?"":e.defaultValue,i=null!=e.checked?e.checked:e.defaultChecked;n=$(null!=e.value?e.value:n),t._wrapperState={initialChecked:i,initialValue:n,controlled:"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}}function Y(t,e){null!=(e=e.checked)&&v(t,"checked",e,!1)}function J(t,e){Y(t,e);var n=$(e.value),i=e.type;if(null!=n)"number"===i?(0===n&&""===t.value||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if("submit"===i||"reset"===i)return void t.removeAttribute("value");e.hasOwnProperty("value")?tt(t,e.type,n):e.hasOwnProperty("defaultValue")&&tt(t,e.type,$(e.defaultValue)),null==e.checked&&null!=e.defaultChecked&&(t.defaultChecked=!!e.defaultChecked)}function Q(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!("submit"!==i&&"reset"!==i||void 0!==e.value&&null!==e.value))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}""!==(n=t.name)&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,""!==n&&(t.name=n)}function tt(t,e,n){"number"===e&&Z(t.ownerDocument)===t||(null==n?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var et=Array.isArray;function nt(t,e,n,i){if(t=t.options,e){e={};for(var r=0;r<n.length;r++)e["$"+n[r]]=!0;for(n=0;n<t.length;n++)r=e.hasOwnProperty("$"+t[n].value),t[n].selected!==r&&(t[n].selected=r),r&&i&&(t[n].defaultSelected=!0)}else{for(n=""+$(n),e=null,r=0;r<t.length;r++){if(t[r].value===n)return t[r].selected=!0,void(i&&(t[r].defaultSelected=!0));null!==e||t[r].disabled||(e=t[r])}null!==e&&(e.selected=!0)}}function it(t,e){if(null!=e.dangerouslySetInnerHTML)throw Error(s(91));return F({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function rt(t,e){var n=e.value;if(null==n){if(n=e.children,e=e.defaultValue,null!=n){if(null!=e)throw Error(s(92));if(et(n)){if(1<n.length)throw Error(s(93));n=n[0]}e=n}null==e&&(e=""),n=e}t._wrapperState={initialValue:$(n)}}function st(t,e){var n=$(e.value),i=$(e.defaultValue);null!=n&&((n=""+n)!==t.value&&(t.value=n),null==e.defaultValue&&t.defaultValue!==n&&(t.defaultValue=n)),null!=i&&(t.defaultValue=""+i)}function ot(t){var e=t.textContent;e===t._wrapperState.initialValue&&""!==e&&null!==e&&(t.value=e)}function at(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function lt(t,e){return null==t||"http://www.w3.org/1999/xhtml"===t?at(e):"http://www.w3.org/2000/svg"===t&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":t}var ct,ut,ht=(ut=function(t,e){if("http://www.w3.org/2000/svg"!==t.namespaceURI||"innerHTML"in t)t.innerHTML=e;else{for((ct=ct||document.createElement("div")).innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=ct.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,e,n,i){MSApp.execUnsafeLocalFunction((function(){return ut(t,e)}))}:ut);function dt(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&3===n.nodeType)return void(n.nodeValue=e)}t.textContent=e}var pt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ft=["Webkit","ms","Moz","O"];function gt(t,e,n){return null==e||"boolean"===typeof e||""===e?"":n||"number"!==typeof e||0===e||pt.hasOwnProperty(t)&&pt[t]?(""+e).trim():e+"px"}function mt(t,e){for(var n in t=t.style,e)if(e.hasOwnProperty(n)){var i=0===n.indexOf("--"),r=gt(n,e[n],i);"float"===n&&(n="cssFloat"),i?t.setProperty(n,r):t[n]=r}}Object.keys(pt).forEach((function(t){ft.forEach((function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),pt[e]=pt[t]}))}));var _t=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function yt(t,e){if(e){if(_t[t]&&(null!=e.children||null!=e.dangerouslySetInnerHTML))throw Error(s(137,t));if(null!=e.dangerouslySetInnerHTML){if(null!=e.children)throw Error(s(60));if("object"!==typeof e.dangerouslySetInnerHTML||!("__html"in e.dangerouslySetInnerHTML))throw Error(s(61))}if(null!=e.style&&"object"!==typeof e.style)throw Error(s(62))}}function vt(t,e){if(-1===t.indexOf("-"))return"string"===typeof e.is;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bt=null;function wt(t){return(t=t.target||t.srcElement||window).correspondingUseElement&&(t=t.correspondingUseElement),3===t.nodeType?t.parentNode:t}var Et=null,xt=null,St=null;function Tt(t){if(t=vr(t)){if("function"!==typeof Et)throw Error(s(280));var e=t.stateNode;e&&(e=wr(e),Et(t.stateNode,t.type,e))}}function Ct(t){xt?St?St.push(t):St=[t]:xt=t}function At(){if(xt){var t=xt,e=St;if(St=xt=null,Tt(t),e)for(t=0;t<e.length;t++)Tt(e[t])}}function Pt(t,e){return t(e)}function Rt(){}var Mt=!1;function It(t,e,n){if(Mt)return t(e,n);Mt=!0;try{return Pt(t,e,n)}finally{Mt=!1,(null!==xt||null!==St)&&(Rt(),At())}}function Lt(t,e){var n=t.stateNode;if(null===n)return null;var i=wr(n);if(null===i)return null;n=i[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(i=!("button"===(t=t.type)||"input"===t||"select"===t||"textarea"===t)),t=!i;break t;default:t=!1}if(t)return null;if(n&&"function"!==typeof n)throw Error(s(231,e,typeof n));return n}var kt=!1;if(u)try{var Nt={};Object.defineProperty(Nt,"passive",{get:function(){kt=!0}}),window.addEventListener("test",Nt,Nt),window.removeEventListener("test",Nt,Nt)}catch(ut){kt=!1}function Ot(t,e,n,i,r,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(u){this.onError(u)}}var Dt=!1,Ft=null,Bt=!1,Ut=null,zt={onError:function(t){Dt=!0,Ft=t}};function jt(t,e,n,i,r,s,o,a,l){Dt=!1,Ft=null,Ot.apply(zt,arguments)}function Vt(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do{0!==(4098&(e=t).flags)&&(n=e.return),t=e.return}while(t)}return 3===e.tag?n:null}function Wt(t){if(13===t.tag){var e=t.memoizedState;if(null===e&&(null!==(t=t.alternate)&&(e=t.memoizedState)),null!==e)return e.dehydrated}return null}function $t(t){if(Vt(t)!==t)throw Error(s(188))}function Gt(t){return null!==(t=function(t){var e=t.alternate;if(!e){if(null===(e=Vt(t)))throw Error(s(188));return e!==t?null:t}for(var n=t,i=e;;){var r=n.return;if(null===r)break;var o=r.alternate;if(null===o){if(null!==(i=r.return)){n=i;continue}break}if(r.child===o.child){for(o=r.child;o;){if(o===n)return $t(r),t;if(o===i)return $t(r),e;o=o.sibling}throw Error(s(188))}if(n.return!==i.return)n=r,i=o;else{for(var a=!1,l=r.child;l;){if(l===n){a=!0,n=r,i=o;break}if(l===i){a=!0,i=r,n=o;break}l=l.sibling}if(!a){for(l=o.child;l;){if(l===n){a=!0,n=o,i=r;break}if(l===i){a=!0,i=o,n=r;break}l=l.sibling}if(!a)throw Error(s(189))}}if(n.alternate!==i)throw Error(s(190))}if(3!==n.tag)throw Error(s(188));return n.stateNode.current===n?t:e}(t))?Ht(t):null}function Ht(t){if(5===t.tag||6===t.tag)return t;for(t=t.child;null!==t;){var e=Ht(t);if(null!==e)return e;t=t.sibling}return null}var qt=r.unstable_scheduleCallback,Zt=r.unstable_cancelCallback,Xt=r.unstable_shouldYield,Kt=r.unstable_requestPaint,Yt=r.unstable_now,Jt=r.unstable_getCurrentPriorityLevel,Qt=r.unstable_ImmediatePriority,te=r.unstable_UserBlockingPriority,ee=r.unstable_NormalPriority,ne=r.unstable_LowPriority,ie=r.unstable_IdlePriority,re=null,se=null;var oe=Math.clz32?Math.clz32:function(t){return t>>>=0,0===t?32:31-(ae(t)/le|0)|0},ae=Math.log,le=Math.LN2;var ce=64,ue=4194304;function he(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&t;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&t;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function de(t,e){var n=t.pendingLanes;if(0===n)return 0;var i=0,r=t.suspendedLanes,s=t.pingedLanes,o=268435455&n;if(0!==o){var a=o&~r;0!==a?i=he(a):0!==(s&=o)&&(i=he(s))}else 0!==(o=n&~r)?i=he(o):0!==s&&(i=he(s));if(0===i)return 0;if(0!==e&&e!==i&&0===(e&r)&&((r=i&-i)>=(s=e&-e)||16===r&&0!==(4194240&s)))return e;if(0!==(4&i)&&(i|=16&n),0!==(e=t.entangledLanes))for(t=t.entanglements,e&=i;0<e;)r=1<<(n=31-oe(e)),i|=t[n],e&=~r;return i}function pe(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;default:return-1}}function fe(t){return 0!==(t=-1073741825&t.pendingLanes)?t:1073741824&t?1073741824:0}function ge(){var t=ce;return 0===(4194240&(ce<<=1))&&(ce=64),t}function me(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function _e(t,e,n){t.pendingLanes|=e,536870912!==e&&(t.suspendedLanes=0,t.pingedLanes=0),(t=t.eventTimes)[e=31-oe(e)]=n}function ye(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var i=31-oe(n),r=1<<i;r&e|t[i]&e&&(t[i]|=e),n&=~r}}var ve=0;function be(t){return 1<(t&=-t)?4<t?0!==(268435455&t)?16:536870912:4:1}var we,Ee,xe,Se,Te,Ce=!1,Ae=[],Pe=null,Re=null,Me=null,Ie=new Map,Le=new Map,ke=[],Ne="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Oe(t,e){switch(t){case"focusin":case"focusout":Pe=null;break;case"dragenter":case"dragleave":Re=null;break;case"mouseover":case"mouseout":Me=null;break;case"pointerover":case"pointerout":Ie.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Le.delete(e.pointerId)}}function De(t,e,n,i,r,s){return null===t||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},null!==e&&(null!==(e=vr(e))&&Ee(e)),t):(t.eventSystemFlags|=i,e=t.targetContainers,null!==r&&-1===e.indexOf(r)&&e.push(r),t)}function Fe(t){var e=yr(t.target);if(null!==e){var n=Vt(e);if(null!==n)if(13===(e=n.tag)){if(null!==(e=Wt(n)))return t.blockedOn=e,void Te(t.priority,(function(){xe(n)}))}else if(3===e&&n.stateNode.current.memoizedState.isDehydrated)return void(t.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}t.blockedOn=null}function Be(t){if(null!==t.blockedOn)return!1;for(var e=t.targetContainers;0<e.length;){var n=Xe(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(null!==n)return null!==(e=vr(n))&&Ee(e),t.blockedOn=n,!1;var i=new(n=t.nativeEvent).constructor(n.type,n);bt=i,n.target.dispatchEvent(i),bt=null,e.shift()}return!0}function Ue(t,e,n){Be(t)&&n.delete(e)}function ze(){Ce=!1,null!==Pe&&Be(Pe)&&(Pe=null),null!==Re&&Be(Re)&&(Re=null),null!==Me&&Be(Me)&&(Me=null),Ie.forEach(Ue),Le.forEach(Ue)}function je(t,e){t.blockedOn===e&&(t.blockedOn=null,Ce||(Ce=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,ze)))}function Ve(t){function e(e){return je(e,t)}if(0<Ae.length){je(Ae[0],t);for(var n=1;n<Ae.length;n++){var i=Ae[n];i.blockedOn===t&&(i.blockedOn=null)}}for(null!==Pe&&je(Pe,t),null!==Re&&je(Re,t),null!==Me&&je(Me,t),Ie.forEach(e),Le.forEach(e),n=0;n<ke.length;n++)(i=ke[n]).blockedOn===t&&(i.blockedOn=null);for(;0<ke.length&&null===(n=ke[0]).blockedOn;)Fe(n),null===n.blockedOn&&ke.shift()}var We=b.ReactCurrentBatchConfig,$e=!0;function Ge(t,e,n,i){var r=ve,s=We.transition;We.transition=null;try{ve=1,qe(t,e,n,i)}finally{ve=r,We.transition=s}}function He(t,e,n,i){var r=ve,s=We.transition;We.transition=null;try{ve=4,qe(t,e,n,i)}finally{ve=r,We.transition=s}}function qe(t,e,n,i){if($e){var r=Xe(t,e,n,i);if(null===r)$i(t,e,i,Ze,n),Oe(t,i);else if(function(t,e,n,i,r){switch(e){case"focusin":return Pe=De(Pe,t,e,n,i,r),!0;case"dragenter":return Re=De(Re,t,e,n,i,r),!0;case"mouseover":return Me=De(Me,t,e,n,i,r),!0;case"pointerover":var s=r.pointerId;return Ie.set(s,De(Ie.get(s)||null,t,e,n,i,r)),!0;case"gotpointercapture":return s=r.pointerId,Le.set(s,De(Le.get(s)||null,t,e,n,i,r)),!0}return!1}(r,t,e,n,i))i.stopPropagation();else if(Oe(t,i),4&e&&-1<Ne.indexOf(t)){for(;null!==r;){var s=vr(r);if(null!==s&&we(s),null===(s=Xe(t,e,n,i))&&$i(t,e,i,Ze,n),s===r)break;r=s}null!==r&&i.stopPropagation()}else $i(t,e,i,null,n)}}var Ze=null;function Xe(t,e,n,i){if(Ze=null,null!==(t=yr(t=wt(i))))if(null===(e=Vt(t)))t=null;else if(13===(n=e.tag)){if(null!==(t=Wt(e)))return t;t=null}else if(3===n){if(e.stateNode.current.memoizedState.isDehydrated)return 3===e.tag?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Ze=t,null}function Ke(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Jt()){case Qt:return 1;case te:return 4;case ee:case ne:return 16;case ie:return 536870912;default:return 16}default:return 16}}var Ye=null,Je=null,Qe=null;function tn(){if(Qe)return Qe;var t,e,n=Je,i=n.length,r="value"in Ye?Ye.value:Ye.textContent,s=r.length;for(t=0;t<i&&n[t]===r[t];t++);var o=i-t;for(e=1;e<=o&&n[i-e]===r[s-e];e++);return Qe=r.slice(t,1<e?1-e:void 0)}function en(t){var e=t.keyCode;return"charCode"in t?0===(t=t.charCode)&&13===e&&(t=13):t=e,10===t&&(t=13),32<=t||13===t?t:0}function nn(){return!0}function rn(){return!1}function sn(t){function e(e,n,i,r,s){for(var o in this._reactName=e,this._targetInst=i,this.type=n,this.nativeEvent=r,this.target=s,this.currentTarget=null,t)t.hasOwnProperty(o)&&(e=t[o],this[o]=e?e(r):r[o]);return this.isDefaultPrevented=(null!=r.defaultPrevented?r.defaultPrevented:!1===r.returnValue)?nn:rn,this.isPropagationStopped=rn,this}return F(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():"unknown"!==typeof t.returnValue&&(t.returnValue=!1),this.isDefaultPrevented=nn)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():"unknown"!==typeof t.cancelBubble&&(t.cancelBubble=!0),this.isPropagationStopped=nn)},persist:function(){},isPersistent:nn}),e}var on,an,ln,cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},un=sn(cn),hn=F({},cn,{view:0,detail:0}),dn=sn(hn),pn=F({},hn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tn,button:0,buttons:0,relatedTarget:function(t){return void 0===t.relatedTarget?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ln&&(ln&&"mousemove"===t.type?(on=t.screenX-ln.screenX,an=t.screenY-ln.screenY):an=on=0,ln=t),on)},movementY:function(t){return"movementY"in t?t.movementY:an}}),fn=sn(pn),gn=sn(F({},pn,{dataTransfer:0})),mn=sn(F({},hn,{relatedTarget:0})),_n=sn(F({},cn,{animationName:0,elapsedTime:0,pseudoElement:0})),yn=F({},cn,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),vn=sn(yn),bn=sn(F({},cn,{data:0})),wn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},En={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sn(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):!!(t=xn[t])&&!!e[t]}function Tn(){return Sn}var Cn=F({},hn,{key:function(t){if(t.key){var e=wn[t.key]||t.key;if("Unidentified"!==e)return e}return"keypress"===t.type?13===(t=en(t))?"Enter":String.fromCharCode(t):"keydown"===t.type||"ke
2yup"===t.type?En[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tn,charCode:function(t){return"keypress"===t.type?en(t):0},keyCode:function(t){return"keydown"===t.type||"keyup"===t.type?t.keyCode:0},which:function(t){return"keypress"===t.type?en(t):"keydown"===t.type||"keyup"===t.type?t.keyCode:0}}),An=sn(Cn),Pn=sn(F({},pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Rn=sn(F({},hn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tn})),Mn=sn(F({},cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),In=F({},pn,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Ln=sn(In),kn=[9,13,27,32],Nn=u&&"CompositionEvent"in window,On=null;u&&"documentMode"in document&&(On=document.documentMode);var Dn=u&&"TextEvent"in window&&!On,Fn=u&&(!Nn||On&&8<On&&11>=On),Bn=String.fromCharCode(32),Un=!1;function zn(t,e){switch(t){case"keyup":return-1!==kn.indexOf(e.keyCode);case"keydown":return 229!==e.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jn(t){return"object"===typeof(t=t.detail)&&"data"in t?t.data:null}var Vn=!1;var Wn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function $n(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return"input"===e?!!Wn[t.type]:"textarea"===e}function Gn(t,e,n,i){Ct(i),0<(e=Hi(e,"onChange")).length&&(n=new un("onChange","change",null,n,i),t.push({event:n,listeners:e}))}var Hn=null,qn=null;function Zn(t){Bi(t,0)}function Xn(t){if(q(br(t)))return t}function Kn(t,e){if("change"===t)return e}var Yn=!1;if(u){var Jn;if(u){var Qn="oninput"in document;if(!Qn){var ti=document.createElement("div");ti.setAttribute("oninput","return;"),Qn="function"===typeof ti.oninput}Jn=Qn}else Jn=!1;Yn=Jn&&(!document.documentMode||9<document.documentMode)}function ei(){Hn&&(Hn.detachEvent("onpropertychange",ni),qn=Hn=null)}function ni(t){if("value"===t.propertyName&&Xn(qn)){var e=[];Gn(e,qn,t,wt(t)),It(Zn,e)}}function ii(t,e,n){"focusin"===t?(ei(),qn=n,(Hn=e).attachEvent("onpropertychange",ni)):"focusout"===t&&ei()}function ri(t){if("selectionchange"===t||"keyup"===t||"keydown"===t)return Xn(qn)}function si(t,e){if("click"===t)return Xn(e)}function oi(t,e){if("input"===t||"change"===t)return Xn(e)}var ai="function"===typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t===1/e)||t!==t&&e!==e};function li(t,e){if(ai(t,e))return!0;if("object"!==typeof t||null===t||"object"!==typeof e||null===e)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var r=n[i];if(!h.call(e,r)||!ai(t[r],e[r]))return!1}return!0}function ci(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function ui(t,e){var n,i=ci(t);for(t=0;i;){if(3===i.nodeType){if(n=t+i.textContent.length,t<=e&&n>=e)return{node:i,offset:e-t};t=n}t:{for(;i;){if(i.nextSibling){i=i.nextSibling;break t}i=i.parentNode}i=void 0}i=ci(i)}}function hi(t,e){return!(!t||!e)&&(t===e||(!t||3!==t.nodeType)&&(e&&3===e.nodeType?hi(t,e.parentNode):"contains"in t?t.contains(e):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(e))))}function di(){for(var t=window,e=Z();e instanceof t.HTMLIFrameElement;){try{var n="string"===typeof e.contentWindow.location.href}catch(i){n=!1}if(!n)break;e=Z((t=e.contentWindow).document)}return e}function pi(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&("input"===e&&("text"===t.type||"search"===t.type||"tel"===t.type||"url"===t.type||"password"===t.type)||"textarea"===e||"true"===t.contentEditable)}function fi(t){var e=di(),n=t.focusedElem,i=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&hi(n.ownerDocument.documentElement,n)){if(null!==i&&pi(n))if(e=i.start,void 0===(t=i.end)&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if((t=(e=n.ownerDocument||document)&&e.defaultView||window).getSelection){t=t.getSelection();var r=n.textContent.length,s=Math.min(i.start,r);i=void 0===i.end?s:Math.min(i.end,r),!t.extend&&s>i&&(r=i,i=s,s=r),r=ui(n,s);var o=ui(n,i);r&&o&&(1!==t.rangeCount||t.anchorNode!==r.node||t.anchorOffset!==r.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&((e=e.createRange()).setStart(r.node,r.offset),t.removeAllRanges(),s>i?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}for(e=[],t=n;t=t.parentNode;)1===t.nodeType&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for("function"===typeof n.focus&&n.focus(),n=0;n<e.length;n++)(t=e[n]).element.scrollLeft=t.left,t.element.scrollTop=t.top}}var gi=u&&"documentMode"in document&&11>=document.documentMode,mi=null,_i=null,yi=null,vi=!1;function bi(t,e,n){var i=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;vi||null==mi||mi!==Z(i)||("selectionStart"in(i=mi)&&pi(i)?i={start:i.selectionStart,end:i.selectionEnd}:i={anchorNode:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:i.anchorOffset,focu
vendor: 93,642 bytes, line 2
2sNode:i.focusNode,focusOffset:i.focusOffset},yi&&li(yi,i)||(yi=i,0<(i=Hi(_i,"onSelect")).length&&(e=new un("onSelect","select",null,e,n),t.push({event:e,listeners:i}),e.target=mi)))}function wi(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Ei={animationend:wi("Animation","AnimationEnd"),animationiteration:wi("Animation","AnimationIteration"),animationstart:wi("Animation","AnimationStart"),transitionend:wi("Transition","TransitionEnd")},xi={},Si={};function Ti(t){if(xi[t])return xi[t];if(!Ei[t])return t;var e,n=Ei[t];for(e in n)if(n.hasOwnProperty(e)&&e in Si)return xi[t]=n[e];return t}u&&(Si=document.createElement("div").style,"AnimationEvent"in window||(delete Ei.animationend.animation,delete Ei.animationiteration.animation,delete Ei.animationstart.animation),"TransitionEvent"in window||delete Ei.transitionend.transition);var Ci=Ti("animationend"),Ai=Ti("animationiteration"),Pi=Ti("animationstart"),Ri=Ti("transitionend"),Mi=new Map,Ii="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Li(t,e){Mi.set(t,e),l(e,[t])}for(var ki=0;ki<Ii.length;ki++){var Ni=Ii[ki];Li(Ni.toLowerCase(),"on"+(Ni[0].toUpperCase()+Ni.slice(1)))}Li(Ci,"onAnimationEnd"),Li(Ai,"onAnimationIteration"),Li(Pi,"onAnimationStart"),Li("dblclick","onDoubleClick"),Li("focusin","onFocus"),Li("focusout","onBlur"),Li(Ri,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Di=new Set("cancel close invalid load scroll toggle".split(" ").concat(Oi));function Fi(t,e,n){var i=t.type||"unknown-event";t.currentTarget=n,function(t,e,n,i,r,o,a,l,c){if(jt.apply(this,arguments),Dt){if(!Dt)throw Error(s(198));var u=Ft;Dt=!1,Ft=null,Bt||(Bt=!0,Ut=u)}}(i,e,void 0,t),t.currentTarget=null}function Bi(t,e){e=0!==(4&e);for(var n=0;n<t.length;n++){var i=t[n],r=i.event;i=i.listeners;t:{var s=void 0;if(e)for(var o=i.length-1;0<=o;o--){var a=i[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&r.isPropagationStopped())break t;Fi(r,a,c),s=l}else for(o=0;o<i.length;o++){if(l=(a=i[o]).instance,c=a.currentTarget,a=a.listener,l!==s&&r.isPropagationStopped())break t;Fi(r,a,c),s=l}}}if(Bt)throw t=Ut,Bt=!1,Ut=null,t}function Ui(t,e){var n=e[gr];void 0===n&&(n=e[gr]=new Set);var i=t+"__bubble";n.has(i)||(Wi(e,t,2,!1),n.add(i))}function zi(t,e,n){var i=0;e&&(i|=4),Wi(n,t,i,e)}var ji="_reactListening"+Math.random().toString(36).slice(2);function Vi(t){if(!t[ji]){t[ji]=!0,o.forEach((function(e){"selectionchange"!==e&&(Di.has(e)||zi(e,!1,t),zi(e,!0,t))}));var e=9===t.nodeType?t:t.ownerDocument;null===e||e[ji]||(e[ji]=!0,zi("selectionchange",!1,e))}}function Wi(t,e,n,i){switch(Ke(e)){case 1:var r=Ge;break;case 4:r=He;break;default:r=qe}n=r.bind(null,e,n,t),r=void 0,!kt||"touchstart"!==e&&"touchmove"!==e&&"wheel"!==e||(r=!0),i?void 0!==r?t.addEventListener(e,n,{capture:!0,passive:r}):t.addEventListener(e,n,!0):void 0!==r?t.addEventListener(e,n,{passive:r}):t.addEventListener(e,n,!1)}function $i(t,e,n,i,r){var s=i;if(0===(1&e)&&0===(2&e)&&null!==i)t:for(;;){if(null===i)return;var o=i.tag;if(3===o||4===o){var a=i.stateNode.containerInfo;if(a===r||8===a.nodeType&&a.parentNode===r)break;if(4===o)for(o=i.return;null!==o;){var l=o.tag;if((3===l||4===l)&&((l=o.stateNode.containerInfo)===r||8===l.nodeType&&l.parentNode===r))return;o=o.return}for(;null!==a;){if(null===(o=yr(a)))return;if(5===(l=o.tag)||6===l){i=s=o;continue t}a=a.parentNode}}i=i.return}It((function(){var i=s,r=wt(n),o=[];t:{var a=Mi.get(t);if(void 0!==a){var l=un,c=t;switch(t){case"keypress":if(0===en(n))break t;case"keydown":case"keyup":l=An;break;case"focusin":c="focus",l=mn;break;case"focusout":c="blur",l=mn;break;case"beforeblur":case"afterblur":l=mn;break;case"click":if(2===n.button)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=fn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=gn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=Rn;break;case Ci:case Ai:case Pi:l=_n;break;case Ri:l=Mn;break;case"scroll":l=dn;break;case"wheel":l=Ln;break;case"copy":case"cut":case"paste":l=vn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=Pn}var u=0!==(4&e),h=!u&&"scroll"===t,d=u?null!==a?a+"Capture":null:a;u=[];for(var p,f=i;null!==f;){var g=(p=f).stateNode;if(5===p.tag&&null!==g&&(p=g,null!==d&&(null!=(g=Lt(f,d))&&u.push(Gi(f,g,p)))),h)break;f=f.return}0<u.length&&(a=new l(a,c,null,n,r),o.push({event:a,listeners:u}))}}if(0===(7&e)){if(l="mouseout"===t||"pointerout"===t,(!(a="mouseover"===t||"pointerover"===t)||n===bt||!(c=n.relatedTarget||n.fromElement)||!yr(c)&&!c[fr])&&(l||a)&&(a=r.window===r?r:(a=r.ownerDocument)?a.defaultView||a.parentWindow:window,l?(l=i,null!==(c=(c=n.relatedTarget||n.toElement)?yr(c):null)&&(c!==(h=Vt(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=i),l!==c)){if(u=fn,g="onMouseLeave",d="onMouseEnter",f="mouse","pointerout"!==t&&"pointerover"!==t||(u=Pn,g="onPointerLeave",d="onPointerEnter",f="pointer"),h=null==l?a:br(l),p=null==c?a:br(c),(a=new u(g,f+"leave",l,n,r)).target=h,a.relatedTarget=p,g=null,yr(r)===i&&((u=new u(d,f+"enter",c,n,r)).target=p,u.relatedTarget=h,g=u),h=g,l&&c)t:{for(d=c,f=0,p=u=l;p;p=qi(p))f++;for(p=0,g=d;g;g=qi(g))p++;for(;0<f-p;)u=qi(u),f--;for(;0<p-f;)d=qi(d),p--;for(;f--;){if(u===d||null!==d&&u===d.alternate)break t;u=qi(u),d=qi(d)}u=null}else u=null;null!==l&&Zi(o,a,l,u,!1),null!==c&&null!==h&&Zi(o,h,c,u,!0)}if("select"===(l=(a=i?br(i):window).nodeName&&a.nodeName.toLowerCase())||"input"===l&&"file"===a.type)var m=Kn;else if($n(a))if(Yn)m=oi;else{m=ri;var _=ii}else(l=a.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(m=si);switch(m&&(m=m(t,i))?Gn(o,m,n,r):(_&&_(t,a,i),"focusout"===t&&(_=a._wrapperState)&&_.controlled&&"number"===a.type&&tt(a,"number",a.value)),_=i?br(i):window,t){case"focusin":($n(_)||"true"===_.contentEditable)&&(mi=_,_i=i,yi=null);break;case"focusout":yi=_i=mi=null;break;case"mousedown":vi=!0;break;case"contextmenu":case"mouseup":case"dragend":vi=!1,bi(o,n,r);break;case"selectionchange":if(gi)break;case"keydown":case"keyup":bi(o,n,r)}var y;if(Nn)t:{switch(t){case"compositionstart":var v="onCompositionStart";break t;case"compositionend":v="onCompositionEnd";break t;case"compositionupdate":v="onCompositionUpdate";break t}v=void 0}else Vn?zn(t,n)&&(v="onCompositionEnd"):"keydown"===t&&229===n.keyCode&&(v="onCompositionStart");v&&(Fn&&"ko"!==n.locale&&(Vn||"onCompositionStart"!==v?"onCompositionEnd"===v&&Vn&&(y=tn()):(Je="value"in(Ye=r)?Ye.value:Ye.textContent,Vn=!0)),0<(_=Hi(i,v)).length&&(v=new bn(v,t,null,n,r),o.push({event:v,listeners:_}),y?v.data=y:null!==(y=jn(n))&&(v.data=y))),(y=Dn?function(t,e){switch(t){case"compositionend":return jn(e);case"keypress":return 32!==e.which?null:(Un=!0,Bn);case"textInput":return(t=e.data)===Bn&&Un?null:t;default:return null}}(t,n):function(t,e){if(Vn)return"compositionend"===t||!Nn&&zn(t,e)?(t=tn(),Qe=Je=Ye=null,Vn=!1,t):null;switch(t){case"paste":default:return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Fn&&"ko"!==e.locale?null:e.data}}(t,n))&&(0<(i=Hi(i,"onBeforeInput")).length&&(r=new bn("onBeforeInput","beforeinput",null,n,r),o.push({event:r,listeners:i}),r.data=y))}Bi(o,e)}))}function Gi(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Hi(t,e){for(var n=e+"Capture",i=[];null!==t;){var r=t,s=r.stateNode;5===r.tag&&null!==s&&(r=s,null!=(s=Lt(t,n))&&i.unshift(Gi(t,s,r)),null!=(s=Lt(t,e))&&i.push(Gi(t,s,r))),t=t.return}return i}function qi(t){if(null===t)return null;do{t=t.return}while(t&&5!==t.tag);return t||null}function Zi(t,e,n,i,r){for(var s=e._reactName,o=[];null!==n&&n!==i;){var a=n,l=a.alternate,c=a.stateNode;if(null!==l&&l===i)break;5===a.tag&&null!==c&&(a=c,r?null!=(l=Lt(n,s))&&o.unshift(Gi(n,l,a)):r||null!=(l=Lt(n,s))&&o.push(Gi(n,l,a))),n=n.return}0!==o.length&&t.push({event:e,listeners:o})}var Xi=/\r\n?/g,Ki=/\u0000|\uFFFD/g;function Yi(t){return("string"===typeof t?t:""+t).replace(Xi,"\n").replace(Ki,"")}function Ji(t,e,n){if(e=Yi(e),Yi(t)!==e&&n)throw Error(s(425))}function Qi(){}var tr=null,er=null;function nr(t,e){return"textarea"===t||"noscript"===t||"string"===typeof e.children||"number"===typeof e.children||"object"===typeof e.dangerouslySetInnerHTML&&null!==e.dangerouslySetInnerHTML&&null!=e.dangerouslySetInnerHTML.__html}var ir="function"===typeof setTimeout?setTimeout:void 0,rr="function"===typeof clearTimeout?clearTimeout:void 0,sr="function"===typeof Promise?Promise:void 0,or="function"===typeof queueMicrotask?queueMicrotask:"undefined"!==typeof sr?function(t){return sr.resolve(null).then(t).catch(ar)}:ir;function ar(t){setTimeout((function(){throw t}))}function lr(t,e){var n=e,i=0;do{var r=n.nextSibling;if(t.removeChild(n),r&&8===r.nodeType)if("/$"===(n=r.data)){if(0===i)return t.removeChild(r),void Ve(e);i--}else"$"!==n&&"$?"!==n&&"$!"!==n||i++;n=r}while(n);Ve(e)}function cr(t){for(;null!=t;t=t.nextSibling){var e=t.nodeType;if(1===e||3===e)break;if(8===e){if("$"===(e=t.data)||"$!"===e||"$?"===e)break;if("/$"===e)return null}}return t}function ur(t){t=t.previousSibling;for(var e=0;t;){if(8===t.nodeType){var n=t.data;if("$"===n||"$!"===n||"$?"===n){if(0===e)return t;e--}else"/$"===n&&e++}t=t.previousSibling}return null}var hr=Math.random().toString(36).slice(2),dr="__reactFiber$"+hr,pr="__reactProps$"+hr,fr="__reactContainer$"+hr,gr="__reactEvents$"+hr,mr="__reactListeners$"+hr,_r="__reactHandles$"+hr;function yr(t){var e=t[dr];if(e)return e;for(var n=t.parentNode;n;){if(e=n[fr]||n[dr]){if(n=e.alternate,null!==e.child||null!==n&&null!==n.child)for(t=ur(t);null!==t;){if(n=t[dr])return n;t=ur(t)}return e}n=(t=n).parentNode}return null}function vr(t){return!(t=t[dr]||t[fr])||5!==t.tag&&6!==t.tag&&13!==t.tag&&3!==t.tag?null:t}function br(t){if(5===t.tag||6===t.tag)return t.stateNode;throw Error(s(33))}function wr(t){return t[pr]||null}var Er=[],xr=-1;function Sr(t){return{current:t}}function Tr(t){0>xr||(t.current=Er[xr],Er[xr]=null,xr--)}function Cr(t,e){xr++,Er[xr]=t.current,t.current=e}var Ar={},Pr=Sr(Ar),Rr=Sr(!1),Mr=Ar;function Ir(t,e){var n=t.type.contextTypes;if(!n)return Ar;var i=t.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r,s={};for(r in n)s[r]=e[r];return i&&((t=t.stateNode).__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Lr(t){return null!==(t=t.childContextTypes)&&void 0!==t}function kr(){Tr(Rr),Tr(Pr)}function Nr(t,e,n){if(Pr.current!==Ar)throw Error(s(168));Cr(Pr,e),Cr(Rr,n)}function Or(t,e,n){var i=t.stateNode;if(e=e.childContextTypes,"function"!==typeof i.getChildContext)return n;for(var r in i=i.getChildContext())if(!(r in e))throw Error(s(108,W(t)||"Unknown",r));return F({},n,i)}function Dr(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ar,Mr=Pr.current,Cr(Pr,t),Cr(Rr,Rr.current),!0}function Fr(t,e,n){var i=t.stateNode;if(!i)throw Error(s(169));n?(t=Or(t,e,Mr),i.__reactInternalMemoizedMergedChildContext=t,Tr(Rr),Tr(Pr),Cr(Pr,t)):Tr(Rr),Cr(Rr,n)}var Br=null,Ur=!1,zr=!1;function jr(t){null===Br?Br=[t]:Br.push(t)}function Vr(){if(!zr&&null!==Br){zr=!0;var t=0,e=ve;try{var n=Br;for(ve=1;t<n.length;t++){var i=n[t];do{i=i(!0)}while(null!==i)}Br=null,Ur=!1}catch(r){throw null!==Br&&(Br=Br.slice(t+1)),qt(Qt,Vr),r}finally{ve=e,zr=!1}}return null}var Wr=[],$r=0,Gr=null,Hr=0,qr=[],Zr=0,Xr=null,Kr=1,Yr="";function Jr(t,e){Wr[$r++]=Hr,Wr[$r++]=Gr,Gr=t,Hr=e}function Qr(t,e,n){qr[Zr++]=Kr,qr[Zr++]=Yr,qr[Zr++]=Xr,Xr=t;var i=Kr;t=Yr;var r=32-oe(i)-1;i&=~(1<<r),n+=1;var s=32-oe(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,Kr=1<<32-oe(e)+r|n<<r|i,Yr=s+t}else Kr=1<<s|n<<r|i,Yr=t}function ts(t){null!==t.return&&(Jr(t,1),Qr(t,1,0))}function es(t){for(;t===Gr;)Gr=Wr[--$r],Wr[$r]=null,Hr=Wr[--$r],Wr[$r]=null;for(;t===Xr;)Xr=qr[--Zr],qr[Zr]=null,Yr=qr[--Zr],qr[Zr]=null,Kr=qr[--Zr],qr[Zr]=null}var ns=null,is=null,rs=!1,ss=null;function os(t,e){var n=Lc(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,null===(e=t.deletions)?(t.deletions=[n],t.flags|=16):e.push(n)}function as(t,e){switch(t.tag){case 5:var n=t.type;return null!==(e=1!==e.nodeType||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e)&&(t.stateNode=e,ns=t,is=cr(e.firstChild),!0);case 6:return null!==(e=""===t.pendingProps||3!==e.nodeType?null:e)&&(t.stateNode=e,ns=t,is=null,!0);case 13:return null!==(e=8!==e.nodeType?null:e)&&(n=null!==Xr?{id:Kr,overflow:Yr}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},(n=Lc(18,null,null,0)).stateNode=e,n.return=t,t.child=n,ns=t,is=null,!0);default:return!1}}function ls(t){return 0!==(1&t.mode)&&0===(128&t.flags)}function cs(t){if(rs){var e=is;if(e){var n=e;if(!as(t,e)){if(ls(t))throw Error(s(418));e=cr(n.nextSibling);var i=ns;e&&as(t,e)?os(i,n):(t.flags=-4097&t.flags|2,rs=!1,ns=t)}}else{if(ls(t))throw Error(s(418));t.flags=-4097&t.flags|2,rs=!1,ns=t}}}function us(t){for(t=t.return;null!==t&&5!==t.tag&&3!==t.tag&&13!==t.tag;)t=t.return;ns=t}function hs(t){if(t!==ns)return!1;if(!rs)return us(t),rs=!0,!1;var e;if((e=3!==t.tag)&&!(e=5!==t.tag)&&(e="head"!==(e=t.type)&&"body"!==e&&!nr(t.type,t.memoizedProps)),e&&(e=is)){if(ls(t))throw ds(),Error(s(418));for(;e;)os(t,e),e=cr(e.nextSibling)}if(us(t),13===t.tag){if(!(t=null!==(t=t.memoizedState)?t.dehydrated:null))throw Error(s(317));t:{for(t=t.nextSibling,e=0;t;){if(8===t.nodeType){var n=t.data;if("/$"===n){if(0===e){is=cr(t.nextSibling);break t}e--}else"$"!==n&&"$!"!==n&&"$?"!==n||e++}t=t.nextSibling}is=null}}else is=ns?cr(t.stateNode.nextSibling):null;return!0}function ds(){for(var t=is;t;)t=cr(t.nextSibling)}function ps(){is=ns=null,rs=!1}function fs(t){null===ss?ss=[t]:ss.push(t)}var gs=b.ReactCurrentBatchConfig;function ms(t,e){if(t&&t.defaultProps){for(var n in e=F({},e),t=t.defaultProps)void 0===e[n]&&(e[n]=t[n]);return e}return e}var _s=Sr(null),ys=null,vs=null,bs=null;function ws(){bs=vs=ys=null}function Es(t){var e=_s.current;Tr(_s),t._currentValue=e}function xs(t,e,n){for(;null!==t;){var i=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,null!==i&&(i.childLanes|=e)):null!==i&&(i.childLanes&e)!==e&&(i.childLanes|=e),t===n)break;t=t.return}}function Ss(t,e){ys=t,bs=vs=null,null!==(t=t.dependencies)&&null!==t.firstContext&&(0!==(t.lanes&e)&&(ba=!0),t.firstContext=null)}function Ts(t){var e=t._currentValue;if(bs!==t)if(t={context:t,memoizedValue:e,next:null},null===vs){if(null===ys)throw Error(s(308));vs=t,ys.dependencies={lanes:0,firstContext:t}}else vs=vs.next=t;return e}var Cs=null;function As(t){null===Cs?Cs=[t]:Cs.push(t)}function Ps(t,e,n,i){var r=e.interleaved;return null===r?(n.next=n,As(e)):(n.next=r.next,r.next=n),e.interleaved=n,Rs(t,i)}function Rs(t,e){t.lanes|=e;var n=t.alternate;for(null!==n&&(n.lanes|=e),n=t,t=t.return;null!==t;)t.childLanes|=e,null!==(n=t.alternate)&&(n.childLanes|=e),n=t,t=t.return;return 3===n.tag?n.stateNode:null}var Ms=!1;function Is(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ls(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function ks(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ns(t,e,n){var i=t.updateQueue;if(null===i)return null;if(i=i.shared,0!==(2&Rl)){var r=i.pending;return null===r?e.next=e:(e.next=r.next,r.next=e),i.pending=e,Rs(t,n)}return null===(r=i.interleaved)?(e.next=e,As(i)):(e.next=r.next,r.next=e),i.interleaved=e,Rs(t,n)}function Os(t,e,n){if(null!==(e=e.updateQueue)&&(e=e.shared,0!==(4194240&n))){var i=e.lanes;n|=i&=t.pendingLanes,e.lanes=n,ye(t,n)}}function Ds(t,e){var n=t.updateQueue,i=t.alternate;if(null!==i&&n===(i=i.updateQueue)){var r=null,s=null;if(null!==(n=n.firstBaseUpdate)){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===s?r=s=o:s=s.next=o,n=n.next}while(null!==n);null===s?r=s=e:s=s.next=e}else r=s=e;return n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},void(t.updateQueue=n)}null===(t=n.lastBaseUpdate)?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Fs(t,e,n,i){var r=t.updateQueue;Ms=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(null!==a){r.shared.pending=null;var l=a,c=l.next;l.next=null,null===o?s=c:o.next=c,o=l;var u=t.alternate;null!==u&&((a=(u=u.updateQueue).lastBaseUpdate)!==o&&(null===a?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(null!==s){var h=r.baseState;for(o=0,u=c=l=null,a=s;;){var d=a.lane,p=a.eventTime;if((i&d)===d){null!==u&&(u=u.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});t:{var f=t,g=a;switch(d=e,p=n,g.tag){case 1:if("function"===typeof(f=g.payload)){h=f.call(p,h,d);break t}h=f;break t;case 3:f.flags=-65537&f.flags|128;case 0:if(null===(d="function"===typeof(f=g.payload)?f.call(p,h,d):f)||void 0===d)break t;h=F({},h,d);break t;case 2:Ms=!0}}null!==a.callback&&0!==a.lane&&(t.flags|=64,null===(d=r.effects)?r.effects=[a]:d.push(a))}else p={eventTime:p,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===u?(c=u=p,l=h):u=u.next=p,o|=d;if(null===(a=a.next)){if(null===(a=r.shared.pending))break;a=(d=a).next,d.next=null,r.lastBaseUpdate=d,r.shared.pending=null}}if(null===u&&(l=h),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,null!==(e=r.shared.interleaved)){r=e;do{o|=r.lane,r=r.next}while(r!==e)}else null===s&&(r.shared.lanes=0);Fl|=o,t.lanes=o,t.memoizedState=h}}function Bs(t,e,n){if(t=e.effects,e.effects=null,null!==t)for(e=0;e<t.length;e++){var i=t[e],r=i.callback;if(null!==r){if(i.callback=null,i=n,"function"!==typeof r)throw Error(s(191,r));r.call(i)}}}var Us=(new i.Component).refs;function zs(t,e,n,i){n=null===(n=n(i,e=t.memoizedState))||void 0===n?e:F({},e,n),t.memoizedState=n,0===t.lanes&&(t.updateQueue.baseState=n)}var js={isMounted:function(t){return!!(t=t._reactInternals)&&Vt(t)===t},enqueueSetState:function(t,e,n){t=t._reactInternals;var i=ec(),r=nc(t),s=ks(i,r);s.payload=e,void 0!==n&&null!==n&&(s.callback=n),null!==(e=Ns(t,s,r))&&(ic(e,t,r,i),Os(e,t,r))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var i=ec(),r=nc(t),s=ks(i,r);s.tag=1,s.payload=e,void 0!==n&&null!==n&&(s.callback=n),null!==(e=Ns(t,s,r))&&(ic(e,t,r,i),Os(e,t,r))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=ec(),i=nc(t),r=ks(n,i);r.tag=2,void 0!==e&&null!==e&&(r.callback=e),null!==(e=Ns(t,r,i))&&(ic(e,t,i,n),Os(e,t,i))}};function Vs(t,e,n,i,r,s,o){return"function"===typeof(t=t.stateNode).shouldComponentUpdate?t.shouldComponentUpdate(i,s,o):!e.prototype||!e.prototype.isPureReactComponent||(!li(n,i)||!li(r,s))}function Ws(t,e,n){var i=!1,r=Ar,s=e.contextType;return"object"===typeof s&&null!==s?s=Ts(s):(r=Lr(e)?Mr:Pr.current,s=(i=null!==(i=e.contextTypes)&&void 0!==i)?Ir(t,r):Ar),e=new e(n,s),t.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,e.updater=js,t.stateNode=e,e._reactInternals=t,i&&((t=t.stateNode).__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=s),e}function $s(t,e,n,i){t=e.state,"function"===typeof e.componentWillReceiveProps&&e.componentWillReceiveProps(n,i),"function"===typeof e.UNSAFE_componentWillReceiveProps&&e.UNSAFE_componentWillReceiveProps(n,i),e.state!==t&&js.enqueueReplaceState(e,e.state,null)}function Gs(t,e,n,i){var r=t.stateNode;r.props=n,r.state=t.memoizedState,r.refs=Us,Is(t);var s=e.contextType;"object"===typeof s&&null!==s?r.context=Ts(s):(s=Lr(e)?Mr:Pr.current,r.context=Ir(t,s)),r.state=t.memoizedState,"function"===typeof(s=e.getDerivedStateFromProps)&&(zs(t,e,s,n),r.state=t.memoizedState),"function"===typeof e.getDerivedStateFromProps||"function"===typeof r.getSnapshotBeforeUpdate||"function"!==typeof r.UNSAFE_componentWillMount&&"function"!==typeof r.componentWillMount||(e=r.state,"function"===typeof r.componentWillMount&&r.componentWillMount(),"function"===typeof r.UNSAFE_componentWillMount&&r.UNSAFE_componentWillMount(),e!==r.state&&js.enqueueReplaceState(r,r.state,null),Fs(t,n,r,i),r.state=t.memoizedState),"function"===typeof r.componentDidMount&&(t.flags|=4194308)}function Hs(t,e,n){if(null!==(t=n.ref)&&"function"!==typeof t&&"object"!==typeof t){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(s(309));var i=n.stateNode}if(!i)throw Error(s(147,t));var r=i,o=""+t;return null!==e&&null!==e.ref&&"function"===typeof e.ref&&e.ref._stringRef===o?e.ref:(e=function(t){var e=r.refs;e===Us&&(e=r.refs={}),null===t?delete e[o]:e[o]=t},e._stringRef=o,e)}if("string"!==typeof t)throw Error(s(284));if(!n._owner)throw Error(s(290,t))}return t}function qs(t,e){throw t=Object.prototype.toString.call(e),Error(s(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Zs(t){return(0,t._init)(t._payload)}function Xs(t){function e(e,n){if(t){var i=e.deletions;null===i?(e.deletions=[n],e.flags|=16):i.push(n)}}function n(n,i){if(!t)return null;for(;null!==i;)e(n,i),i=i.sibling;return null}function i(t,e){for(t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function r(t,e){return(t=Nc(t,e)).index=0,t.sibling=null,t}function o(e,n,i){return e.index=i,t?null!==(i=e.alternate)?(i=i.index)<n?(e.flags|=2,n):i:(e.flags|=2,n):(e.flags|=1048576,n)}function a(e){return t&&null===e.alternate&&(e.flags|=2),e}function l(t,e,n,i){return null===e||6!==e.tag?((e=Bc(n,t.mode,i)).return=t,e):((e=r(e,n)).return=t,e)}function c(t,e,n,i){var s=n.type;return s===x?h(t,e,n.props.children,i,n.key):null!==e&&(e.elementType===s||"object"===typeof s&&null!==s&&s.$$typeof===L&&Zs(s)===e.type)?((i=r(e,n.props)).ref=Hs(t,e,n),i.return=t,i):((i=Oc(n.type,n.key,n.props,null,t.mode,i)).ref=Hs(t,e,n),i.return=t,i)}function u(t,e,n,i){return null===e||4!==e.tag||e.stateNode.containerInfo!==n.containerInfo||e.stateNode.implementation!==n.implementation?((e=Uc(n,t.mode,i)).return=t,e):((e=r(e,n.children||[])).return=t,e)}function h(t,e,n,i,s){return null===e||7!==e.tag?((e=Dc(n,t.mode,i,s)).return=t,e):((e=r(e,n)).return=t,e)}function d(t,e,n){if("string"===typeof e&&""!==e||"number"===typeof e)return(e=Bc(""+e,t.mode,n)).return=t,e;if("object"===typeof e&&null!==e){switch(e.$$typeof){case w:return(n=Oc(e.type,e.key,e.props,null,t.mode,n)).ref=Hs(t,null,e),n.return=t,n;case E:return(e=Uc(e,t.mode,n)).return=t,e;case L:return d(t,(0,e._init)(e._payload),n)}if(et(e)||O(e))return(e=Dc(e,t.mode,n,null)).return=t,e;qs(t,e)}return null}function p(t,e,n,i){var r=null!==e?e.key:null;if("string"===typeof n&&""!==n||"number"===typeof n)return null!==r?null:l(t,e,""+n,i);if("object"===typeof n&&null!==n){switch(n.$$typeof){case w:return n.key===r?c(t,e,n,i):null;case E:return n.key===r?u(t,e,n,i):null;case L:return p(t,e,(r=n._init)(n._payload),i)}if(et(n)||O(n))return null!==r?null:h(t,e,n,i,null);qs(t,n)}return null}function f(t,e,n,i,r){if("string"===typeof i&&""!==i||"number"===typeof i)return l(e,t=t.get(n)||null,""+i,r);if("object"===typeof i&&null!==i){switch(i.$$typeof){case w:return c(e,t=t.get(null===i.key?n:i.key)||null,i,r);case E:return u(e,t=t.get(null===i.key?n:i.key)||null,i,r);case L:return f(t,e,n,(0,i._init)(i._payload),r)}if(et(i)||O(i))return h(e,t=t.get(n)||null,i,r,null);qs(e,i)}return null}function g(r,s,a,l){for(var c=null,u=null,h=s,g=s=0,m=null;null!==h&&g<a.length;g++){h.index>g?(m=h,h=null):m=h.sibling;var _=p(r,h,a[g],l);if(null===_){null===h&&(h=m);break}t&&h&&null===_.alternate&&e(r,h),s=o(_,s,g),null===u?c=_:u.sibling=_,u=_,h=m}if(g===a.length)return n(r,h),rs&&Jr(r,g),c;if(null===h){for(;g<a.length;g++)null!==(h=d(r,a[g],l))&&(s=o(h,s,g),null===u?c=h:u.sibling=h,u=h);return rs&&Jr(r,g),c}for(h=i(r,h);g<a.length;g++)null!==(m=f(h,r,g,a[g],l))&&(t&&null!==m.alternate&&h.delete(null===m.key?g:m.key),s=o(m,s,g),null===u?c=m:u.sibling=m,u=m);return t&&h.forEach((function(t){return e(r,t)})),rs&&Jr(r,g),c}function m(r,a,l,c){var u=O(l);if("function"!==typeof u)throw Error(s(150));if(null==(l=u.call(l)))throw Error(s(151));for(var h=u=null,g=a,m=a=0,_=null,y=l.next();null!==g&&!y.done;m++,y=l.next()){g.index>m?(_=g,g=null):_=g.sibling;var v=p(r,g,y.value,c);if(null===v){null===g&&(g=_);break}t&&g&&null===v.alternate&&e(r,g),a=o(v,a,m),null===h?u=v:h.sibling=v,h=v,g=_}if(y.done)return n(r,g),rs&&Jr(r,m),u;if(null===g){for(;!y.done;m++,y=l.next())null!==(y=d(r,y.value,c))&&(a=o(y,a,m),null===h?u=y:h.sibling=y,h=y);return rs&&Jr(r,m),u}for(g=i(r,g);!y.done;m++,y=l.next())null!==(y=f(g,r,m,y.value,c))&&(t&&null!==y.alternate&&g.delete(null===y.key?m:y.key),a=o(y,a,m),null===h?u=y:h.sibling=y,h=y);return t&&g.forEach((function(t){return e(r,t)})),rs&&Jr(r,m),u}return function t(i,s,o,l){if("object"===typeof o&&null!==o&&o.type===x&&null===o.key&&(o=o.props.children),"object"===typeof o&&null!==o){switch(o.$$typeof){case w:t:{for(var c=o.key,u=s;null!==u;){if(u.key===c){if((c=o.type)===x){if(7===u.tag){n(i,u.sibling),(s=r(u,o.props.children)).return=i,i=s;break t}}else if(u.elementType===c||"object"===typeof c&&null!==c&&c.$$typeof===L&&Zs(c)===u.type){n(i,u.sibling),(s=r(u,o.props)).ref=Hs(i,u,o),s.return=i,i=s;break t}n(i,u);break}e(i,u),u=u.sibling}o.type===x?((s=Dc(o.props.children,i.mode,l,o.key)).return=i,i=s):((l=Oc(o.type,o.key,o.props,null,i.mode,l)).ref=Hs(i,s,o),l.return=i,i=l)}return a(i);case E:t:{for(u=o.key;null!==s;){if(s.key===u){if(4===s.tag&&s.stateNode.containerInfo===o.containerInfo&&s.stateNode.implementation===o.implementation){n(i,s.sibling),(s=r(s,o.children||[])).return=i,i=s;break t}n(i,s);break}e(i,s),s=s.sibling}(s=Uc(o,i.mode,l)).return=i,i=s}return a(i);case L:return t(i,s,(u=o._init)(o._payload),l)}if(et(o))return g(i,s,o,l);if(O(o))return m(i,s,o,l);qs(i,o)}return"string"===typeof o&&""!==o||"number"===typeof o?(o=""+o,null!==s&&6===s.tag?(n(i,s.sibling),(s=r(s,o)).return=i,i=s):(n(i,s),(s=Bc(o,i.mode,l)).return=i,i=s),a(i)):n(i,s)}}var Ks=Xs(!0),Ys=Xs(!1),Js={},Qs=Sr(Js),to=Sr(Js),eo=Sr(Js);function no(t){if(t===Js)throw Error(s(174));return t}function io(t,e){switch(Cr(eo,e),Cr(to,t),Cr(Qs,Js),t=e.nodeType){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:lt(null,"");break;default:e=lt(e=(t=8===t?e.parentNode:e).namespaceURI||null,t=t.tagName)}Tr(Qs),Cr(Qs,e)}function ro(){Tr(Qs),Tr(to),Tr(eo)}function so(t){no(eo.current);var e=no(Qs.current),n=lt(e,t.type);e!==n&&(Cr(to,t),Cr(Qs,n))}function oo(t){to.current===t&&(Tr(Qs),Tr(to))}var ao=Sr(0);function lo(t){for(var e=t;null!==e;){if(13===e.tag){var n=e.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return e}else if(19===e.tag&&void 0!==e.memoizedProps.revealOrder){if(0!==(128&e.flags))return e}else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var co=[];function uo(){for(var t=0;t<co.length;t++)co[t]._workInProgressVersionPrimary=null;co.length=0}var ho=b.ReactCurrentDispatcher,po=b.ReactCurrentBatchConfig,fo=0,go=null,mo=null,_o=null,yo=!1,vo=!1,bo=0,wo=0;function Eo(){throw Error(s(321))}function xo(t,e){if(null===e)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!ai(t[n],e[n]))return!1;return!0}function So(t,e,n,i,r,o){if(fo=o,go=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ho.current=null===t||null===t.memoizedState?aa:la,t=n(i,r),vo){o=0;do{if(vo=!1,bo=0,25<=o)throw Error(s(301));o+=1,_o=mo=null,e.updateQueue=null,ho.current=ca,t=n(i,r)}while(vo)}if(ho.current=oa,e=null!==mo&&null!==mo.next,fo=0,_o=mo=go=null,yo=!1,e)throw Error(s(300));return t}function To(){var t=0!==bo;return bo=0,t}function Co(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===_o?go.memoizedState=_o=t:_o=_o.next=t,_o}function Ao(){if(null===mo){var t=go.alternate;t=null!==t?t.memoizedState:null}else t=mo.next;var e=null===_o?go.memoizedState:_o.next;if(null!==e)_o=e,mo=t;else{if(null===t)throw Error(s(310));t={memoizedState:(mo=t).memoizedState,baseState:mo.baseState,baseQueue:mo.baseQueue,queue:mo.queue,next:null},null===_o?go.memoizedState=_o=t:_o=_o.next=t}return _o}function Po(t,e){return"function"===typeof e?e(t):e}function Ro(t){var e=Ao(),n=e.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=t;var i=mo,r=i.baseQueue,o=n.pending;if(null!==o){if(null!==r){var a=r.next;r.next=o.next,o.next=a}i.baseQueue=r=o,n.pending=null}if(null!==r){o=r.next,i=i.baseState;var l=a=null,c=null,u=o;do{var h=u.lane;if((fo&h)===h)null!==c&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:t(i,u.action);else{var d={lane:h,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===c?(l=c=d,a=i):c=c.next=d,go.lanes|=h,Fl|=h}u=u.next}while(null!==u&&u!==o);null===c?a=i:c.next=l,ai(i,e.memoizedState)||(ba=!0),e.memoizedState=i,e.baseState=a,e.baseQueue=c,n.lastRenderedState=i}if(null!==(t=n.interleaved)){r=t;do{o=r.lane,go.lanes|=o,Fl|=o,r=r.next}while(r!==t)}else null===r&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Mo(t){var e=Ao(),n=e.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=t;var i=n.dispatch,r=n.pending,o=e.memoizedState;if(null!==r){n.pending=null;var a=r=r.next;do{o=t(o,a.action),a=a.next}while(a!==r);ai(o,e.memoizedState)||(ba=!0),e.memoizedState=o,null===e.baseQueue&&(e.baseState=o),n.lastRenderedState=o}return[o,i]}function Io(){}function Lo(t,e){var n=go,i=Ao(),r=e(),o=!ai(i.memoizedState,r);if(o&&(i.memoizedState=r,ba=!0),i=i.queue,$o(Oo.bind(null,n,i,t),[t]),i.getSnapshot!==e||o||null!==_o&&1&_o.memoizedState.tag){if(n.flags|=2048,Uo(9,No.bind(null,n,i,r,e),void 0,null),null===Ml)throw Error(s(349));0!==(30&fo)||ko(n,e,r)}return r}function ko(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},null===(e=go.updateQueue)?(e={lastEffect:null,stores:null},go.updateQueue=e,e.stores=[t]):null===(n=e.stores)?e.stores=[t]:n.push(t)}function No(t,e,n,i){e.value=n,e.getSnapshot=i,Do(e)&&Fo(t)}function Oo(t,e,n){return n((function(){Do(e)&&Fo(t)}))}function Do(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!ai(t,n)}catch(i){return!0}}function Fo(t){var e=Rs(t,1);null!==e&&ic(e,t,1,-1)}function Bo(t){var e=Co();return"function"===typeof t&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:t},e.queue=t,t=t.dispatch=na.bind(null,go,t),[e.memoizedState,t]}function Uo(t,e,n,i){return t={tag:t,create:e,destroy:n,deps:i,next:null},null===(e=go.updateQueue)?(e={lastEffect:null,stores:null},go.updateQueue=e,e.lastEffect=t.next=t):null===(n=e.lastEffect)?e.lastEffect=t.next=t:(i=n.next,n.next=t,t.next=i,e.lastEffect=t),t}function zo(){return Ao().memoizedState}function jo(t,e,n,i){var r=Co();go.flags|=t,r.memoizedState=Uo(1|e,n,void 0,void 0===i?null:i)}function Vo(t,e,n,i){var r=Ao();i=void 0===i?null:i;var s=void 0;if(null!==mo){var o=mo.memoizedState;if(s=o.destroy,null!==i&&xo(i,o.deps))return void(r.memoizedState=Uo(e,n,s,i))}go.flags|=t,r.memoizedState=Uo(1|e,n,s,i)}function Wo(t,e){return jo(8390656,8,t,e)}function $o(t,e){return Vo(2048,8,t,e)}function Go(t,e){return Vo(4,2,t,e)}function Ho(t,e){return Vo(4,4,t,e)}function qo(t,e){return"function"===typeof e?(t=t(),e(t),function(){e(null)}):null!==e&&void 0!==e?(t=t(),e.current=t,function(){e.current=null}):void 0}function Zo(t,e,n){return n=null!==n&&void 0!==n?n.concat([t]):null,Vo(4,4,qo.bind(null,e,t),n)}function Xo(){}function Ko(t,e){var n=Ao();e=void 0===e?null:e;var i=n.memoizedState;return null!==i&&null!==e&&xo(e,i[1])?i[0]:(n.memoizedState=[t,e],t)}function Yo(t,e){var n=Ao();e=void 0===e?null:e;var i=n.memoizedState;return null!==i&&null!==e&&xo(e,i[1])?i[0]:(t=t(),n.memoizedState=[t,e],t)}function Jo(t,e,n){return 0===(21&fo)?(t.baseState&&(t.baseState=!1,ba=!0),t.memoizedState=n):(ai(n,e)||(n=ge(),go.lanes|=n,Fl|=n,t.baseState=!0),e)}function Qo(t,e){var n=ve;ve=0!==n&&4>n?n:4,t(!0);var i=po.transition;po.transition={};try{t(!1),e()}finally{ve=n,po.transition=i}}function ta(){return Ao().memoizedState}function ea(t,e,n){var i=nc(t);if(n={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null},ia(t))ra(e,n);else if(null!==(n=Ps(t,e,n,i))){ic(n,t,i,ec()),sa(n,e,i)}}function na(t,e,n){var i=nc(t),r={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null};if(ia(t))ra(e,r);else{var s=t.alternate;if(0===t.lanes&&(null===s||0===s.lanes)&&null!==(s=e.lastRenderedReducer))try{var o=e.lastRenderedState,a=s(o,n);if(r.hasEagerState=!0,r.eagerState=a,ai(a,o)){var l=e.interleaved;return null===l?(r.next=r,As(e)):(r.next=l.next,l.next=r),void(e.interleaved=r)}}catch(c){}null!==(n=Ps(t,e,r,i))&&(ic(n,t,i,r=ec()),sa(n,e,i))}}function ia(t){var e=t.alternate;return t===go||null!==e&&e===go}function ra(t,e){vo=yo=!0;var n=t.pending;null===n?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function sa(t,e,n){if(0!==(4194240&n)){var i=e.lanes;n|=i&=t.pendingLanes,e.lanes=n,ye(t,n)}}var oa={readContext:Ts,useCallback:Eo,useContext:Eo,useEffect:Eo,useImperativeHandle:Eo,useInsertionEffect:Eo,useLayoutEffect:Eo,useMemo:Eo,useReducer:Eo,useRef:Eo,useState:Eo,useDebugValue:Eo,useDeferredValue:Eo,useTransition:Eo,useMutableSource:Eo,useSyncExternalStore:Eo,useId:Eo,unstable_isNewReconciler:!1},aa={readContext:Ts,useCallback:function(t,e){return Co().memoizedState=[t,void 0===e?null:e],t},useContext:Ts,useEffect:Wo,useImperativeHandle:function(t,e,n){return n=null!==n&&void 0!==n?n.concat([t]):null,jo(4194308,4,qo.bind(null,e,t),n)},useLayoutEffect:function(t,e){return jo(4194308,4,t,e)},useInsertionEffect:function(t,e){return jo(4,2,t,e)},useMemo:function(t,e){var n=Co();return e=void 0===e?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var i=Co();return e=void 0!==n?n(e):e,i.memoizedState=i.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},i.queue=t,t=t.dispatch=ea.bind(null,go,t),[i.memoizedState,t]},useRef:function(t){return t={current:t},Co().memoizedState=t},useState:Bo,useDebugValue:Xo,useDeferredValue:function(t){return Co().memoizedState=t},useTransition:function(){var t=Bo(!1),e=t[0];return t=Qo.bind(null,t[1]),Co().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var i=go,r=Co();if(rs){if(void 0===n)throw Error(s(407));n=n()}else{if(n=e(),null===Ml)throw Error(s(349));0!==(30&fo)||ko(i,e,n)}r.memoizedState=n;var o={value:n,getSnapshot:e};return r.queue=o,Wo(Oo.bind(null,i,o,t),[t]),i.flags|=2048,Uo(9,No.bind(null,i,o,n,e),void 0,null),n},useId:function(){var t=Co(),e=Ml.identifierPrefix;if(rs){var n=Yr;e=":"+e+"R"+(n=(Kr&~(1<<32-oe(Kr)-1)).toString(32)+n),0<(n=bo++)&&(e+="H"+n.toString(32)),e+=":"}else e=":"+e+"r"+(n=wo++).toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},la={readContext:Ts,useCallback:Ko,useContext:Ts,useEffect:$o,useImperativeHandle:Zo,useInsertionEffect:Go,useLayoutEffect:Ho,useMemo:Yo,useReducer:Ro,useRef:zo,useState:function(){return Ro(Po)},useDebugValue:Xo,useDeferredValue:function(t){return Jo(Ao(),mo.memoizedState,t)},useTransition:function(){return[Ro(Po)[0],Ao().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:ta,unstable_isNewReconciler:!1},ca={readContext:Ts,useCallback:Ko,useContext:Ts,useEffect:$o,useImperativeHandle:Zo,useInsertionEffect:Go,useLayoutEffect:Ho,useMemo:Yo,useReducer:Mo,useRef:zo,useState:function(){return Mo(Po)},useDebugValue:Xo,useDeferredValue:function(t){var e=Ao();return null===mo?e.memoizedState=t:Jo(e,mo.memoizedState,t)},useTransition:function(){return[Mo(Po)[0],Ao().memoizedState]},useMutableSource:Io,useSyncExternalStore:Lo,useId:ta,unstable_isNewReconciler:!1};function ua(t,e){try{var n="",i=e;do{n+=j(i),i=i.return}while(i);var r=n}catch(s){r="\nError generating stack: "+s.message+"\n"+s.stack}return{value:t,source:e,stack:r,digest:null}}function ha(t,e,n){return{value:t,source:null,stack:null!=n?n:null,digest:null!=e?e:null}}function da(t,e){try{console.error(e.value)}catch(n){setTimeout((function(){throw n}))}}var pa="function"===typeof WeakMap?WeakMap:Map;function fa(t,e,n){(n=ks(-1,n)).tag=3,n.payload={element:null};var i=e.value;return n.callback=function(){Gl||(Gl=!0,Hl=i),da(0,e)},n}function ga(t,e,n){(n=ks(-1,n)).tag=3;var i=t.type.getDerivedStateFromError;if("function"===typeof i){var r=e.value;n.payload=function(){return i(r)},n.callback=function(){da(0,e)}}var s=t.stateNode;return null!==s&&"function"===typeof s.componentDidCatch&&(n.callback=function(){da(0,e),"function"!==typeof i&&(null===ql?ql=new Set([this]):ql.add(this));var t=e.stack;this.componentDidCatch(e.value,{componentStack:null!==t?t:""})}),n}function ma(t,e,n){var i=t.pingCache;if(null===i){i=t.pingCache=new pa;var r=new Set;i.set(e,r)}else void 0===(r=i.get(e))&&(r=new Set,i.set(e,r));r.has(n)||(r.add(n),t=Cc.bind(null,t,e,n),e.then(t,t))}function _a(t){do{var e;if((e=13===t.tag)&&(e=null===(e=t.memoizedState)||null!==e.dehydrated),e)return t;t=t.return}while(null!==t);return null}function ya(t,e,n,i,r){return 0===(1&t.mode)?(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((e=ks(-1,1)).tag=2,Ns(n,e,1))),n.lanes|=1),t):(t.flags|=65536,t.lanes=r,t)}var va=b.ReactCurrentOwner,ba=!1;function wa(t,e,n,i){e.child=null===t?Ys(e,null,n,i):Ks(e,t.child,n,i)}function Ea(t,e,n,i,r){n=n.render;var s=e.ref;return Ss(e,r),i=So(t,e,n,i,s,r),n=To(),null===t||ba?(rs&&n&&ts(e),e.flags|=1,wa(t,e,i,r),e.child):(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,Ga(t,e,r))}function xa(t,e,n,i,r){if(null===t){var s=n.type;return"function"!==typeof s||kc(s)||void 0!==s.defaultProps||null!==n.compare||void 0!==n.defaultProps?((t=Oc(n.type,null,i,e,e.mode,r)).ref=e.ref,t.return=e,e.child=t):(e.tag=15,e.type=s,Sa(t,e,s,i,r))}if(s=t.child,0===(t.lanes&r)){var o=s.memoizedProps;if((n=null!==(n=n.compare)?n:li)(o,i)&&t.ref===e.ref)return Ga(t,e,r)}return e.flags|=1,(t=Nc(s,i)).ref=e.ref,t.return=e,e.child=t}function Sa(t,e,n,i,r){if(null!==t){var s=t.memoizedProps;if(li(s,i)&&t.ref===e.ref){if(ba=!1,e.pendingProps=i=s,0===(t.lanes&r))return e.lanes=t.lanes,Ga(t,e,r);0!==(131072&t.flags)&&(ba=!0)}}return Aa(t,e,n,i,r)}function Ta(t,e,n){var i=e.pendingProps,r=i.children,s=null!==t?t.memoizedState:null;if("hidden"===i.mode)if(0===(1&e.mode))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Cr(Nl,kl),kl|=n;else{if(0===(1073741824&n))return t=null!==s?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Cr(Nl,kl),kl|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=null!==s?s.baseLanes:n,Cr(Nl,kl),kl|=i}else null!==s?(i=s.baseLanes|n,e.memoizedState=null):i=n,Cr(Nl,kl),kl|=i;return wa(t,e,r,n),e.child}function Ca(t,e){var n=e.ref;(null===t&&null!==n||null!==t&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Aa(t,e,n,i,r){var s=Lr(n)?Mr:Pr.current;return s=Ir(e,s),Ss(e,r),n=So(t,e,n,i,s,r),i=To(),null===t||ba?(rs&&i&&ts(e),e.flags|=1,wa(t,e,n,r),e.child):(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,Ga(t,e,r))}function Pa(t,e,n,i,r){if(Lr(n)){var s=!0;Dr(e)}else s=!1;if(Ss(e,r),null===e.stateNode)$a(t,e),Ws(e,n,i),Gs(e,n,i,r),i=!0;else if(null===t){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=n.contextType;"object"===typeof c&&null!==c?c=Ts(c):c=Ir(e,c=Lr(n)?Mr:Pr.current);var u=n.getDerivedStateFromProps,h="function"===typeof u||"function"===typeof o.getSnapshotBeforeUpdate;h||"function"!==typeof o.UNSAFE_componentWillReceiveProps&&"function"!==typeof o.componentWillReceiveProps||(a!==i||l!==c)&&$s(e,o,i,c),Ms=!1;var d=e.memoizedState;o.state=d,Fs(e,i,o,r),l=e.memoizedState,a!==i||d!==l||Rr.current||Ms?("function"===typeof u&&(zs(e,n,u,i),l=e.memoizedState),(a=Ms||Vs(e,n,a,i,d,l,c))?(h||"function"!==typeof o.UNSAFE_componentWillMount&&"function"!==typeof o.componentWillMount||("function"===typeof o.componentWillMount&&o.componentWillMount(),"function"===typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"===typeof o.componentDidMount&&(e.flags|=4194308)):("function"===typeof o.componentDidMount&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),o.props=i,o.state=l,o.context=c,i=a):("function"===typeof o.componentDidMount&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,Ls(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:ms(e.type,a),o.props=c,h=e.pendingProps,d=o.context,"object"===typeof(l=n.contextType)&&null!==l?l=Ts(l):l=Ir(e,l=Lr(n)?Mr:Pr.current);var p=n.getDerivedStateFromProps;(u="function"===typeof p||"function"===typeof o.getSnapshotBeforeUpdate)||"function"!==typeof o.UNSAFE_componentWillReceiveProps&&"function"!==typeof o.componentWillReceiveProps||(a!==h||d!==l)&&$s(e,o,i,l),Ms=!1,d=e.memoizedState,o.state=d,Fs(e,i,o,r);var f=e.memoizedState;a!==h||d!==f||Rr.current||Ms?("function"===typeof p&&(zs(e,n,p,i),f=e.memoizedState),(c=Ms||Vs(e,n,c,i,d,f,l)||!1)?(u||"function"!==typeof o.UNSAFE_componentWillUpdate&&"function"!==typeof o.componentWillUpdate||("function"===typeof o.componentWillUpdate&&o.componentWillUpdate(i,f,l),"function"===typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(i,f,l)),"function"===typeof o.componentDidUpdate&&(e.flags|=4),"function"===typeof o.getSnapshotBeforeUpdate&&(e.flags|=1024)):("function"!==typeof o.componentDidUpdate||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),"function"!==typeof o.getSnapshotBeforeUpdate||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=f),o.props=i,o.state=f,o.context=l,i=c):("function"!==typeof o.componentDidUpdate||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),"function"!==typeof o.getSnapshotBeforeUpdate||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),i=!1)}return Ra(t,e,n,i,s,r)}function Ra(t,e,n,i,r,s){Ca(t,e);var o=0!==(128&e.flags);if(!i&&!o)return r&&Fr(e,n,!1),Ga(t,e,s);i=e.stateNode,va.current=e;var a=o&&"function"!==typeof n.getDerivedStateFromError?null:i.render();return e.flags|=1,null!==t&&o?(e.child=Ks(e,t.child,null,s),e.child=Ks(e,null,a,s)):wa(t,e,a,s),e.memoizedState=i.state,r&&Fr(e,n,!0),e.child}function Ma(t){var e=t.stateNode;e.pendingContext?Nr(0,e.pendingContext,e.pendingContext!==e.context):e.context&&Nr(0,e.context,!1),io(t,e.containerInfo)}function Ia(t,e,n,i,r){return ps(),fs(r),e.flags|=256,wa(t,e,n,i),e.child}var La,ka,Na,Oa,Da={dehydrated:null,treeContext:null,retryLane:0};function Fa(t){return{baseLanes:t,cachePool:null,transitions:null}}function Ba(t,e,n){var i,r=e.pendingProps,o=ao.current,a=!1,l=0!==(128&e.flags);if((i=l)||(i=(null===t||null!==t.memoizedState)&&0!==(2&o)),i?(a=!0,e.flags&=-129):null!==t&&null===t.memoizedState||(o|=1),Cr(ao,1&o),null===t)return cs(e),null!==(t=e.memoizedState)&&null!==(t=t.dehydrated)?(0===(1&e.mode)?e.lanes=1:"$!"===t.data?e.lanes=8:e.lanes=1073741824,null):(l=r.children,t=r.fallback,a?(r=e.mode,a=e.child,l={mode:"hidden",children:l},0===(1&r)&&null!==a?(a.childLanes=0,a.pendingProps=l):a=Fc(l,r,0,null),t=Dc(t,r,n,null),a.return=e,t.return=e,a.sibling=t,e.child=a,e.child.memoizedState=Fa(n),e.memoizedState=Da,t):Ua(e,l));if(null!==(o=t.memoizedState)&&null!==(i=o.dehydrated))return function(t,e,n,i,r,o,a){if(n)return 256&e.flags?(e.flags&=-257,za(t,e,a,i=ha(Error(s(422))))):null!==e.memoizedState?(e.child=t.child,e.flags|=128,null):(o=i.fallback,r=e.mode,i=Fc({mode:"visible",children:i.children},r,0,null),(o=Dc(o,r,a,null)).flags|=2,i.return=e,o.return=e,i.sibling=o,e.child=i,0!==(1&e.mode)&&Ks(e,t.child,null,a),e.child.memoizedState=Fa(a),e.memoizedState=Da,o);if(0===(1&e.mode))return za(t,e,a,null);if("$!"===r.data){if(i=r.nextSibling&&r.nextSibling.dataset)var l=i.dgst;return i=l,za(t,e,a,i=ha(o=Error(s(419)),i,void 0))}if(l=0!==(a&t.childLanes),ba||l){if(null!==(i=Ml)){switch(a&-a){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}0!==(r=0!==(r&(i.suspendedLanes|a))?0:r)&&r!==o.retryLane&&(o.retryLane=r,Rs(t,r),ic(i,t,r,-1))}return mc(),za(t,e,a,i=ha(Error(s(421))))}return"$?"===r.data?(e.flags|=128,e.child=t.child,e=Pc.bind(null,t),r._reactRetry=e,null):(t=o.treeContext,is=cr(r.nextSibling),ns=e,rs=!0,ss=null,null!==t&&(qr[Zr++]=Kr,qr[Zr++]=Yr,qr[Zr++]=Xr,Kr=t.id,Yr=t.overflow,Xr=e),e=Ua(e,i.children),e.flags|=4096,e)}(t,e,l,r,i,o,n);if(a){a=r.fallback,l=e.mode,i=(o=t.child).sibling;var c={mode:"hidden",children:r.children};return 0===(1&l)&&e.child!==o?((r=e.child).childLanes=0,r.pendingProps=c,e.deletions=null):(r=Nc(o,c)).subtreeFlags=14680064&o.subtreeFlags,null!==i?a=Nc(i,a):(a=Dc(a,l,n,null)).flags|=2,a.return=e,r.return=e,r.sibling=a,e.child=r,r=a,a=e.child,l=null===(l=t.child.memoizedState)?Fa(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},a.memoizedState=l,a.childLanes=t.childLanes&~n,e.memoizedState=Da,r}return t=(a=t.child).sibling,r=Nc(a,{mode:"visible",children:r.children}),0===(1&e.mode)&&(r.lanes=n),r.return=e,r.sibling=null,null!==t&&(null===(n=e.deletions)?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function Ua(t,e){return(e=Fc({mode:"visible",children:e},t.mode,0,null)).return=t,t.child=e}function za(t,e,n,i){return null!==i&&fs(i),Ks(e,t.child,null,n),(t=Ua(e,e.pendingProps.children)).flags|=2,e.memoizedState=null,t}function ja(t,e,n){t.lanes|=e;var i=t.alternate;null!==i&&(i.lanes|=e),xs(t.return,e,n)}function Va(t,e,n,i,r){var s=t.memoizedState;null===s?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=n,s.tailMode=r)}function Wa(t,e,n){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(wa(t,e,i.children,n),0!==(2&(i=ao.current)))i=1&i|2,e.flags|=128;else{if(null!==t&&0!==(128&t.flags))t:for(t=e.child;null!==t;){if(13===t.tag)null!==t.memoizedState&&ja(t,n,e);else if(19===t.tag)ja(t,n,e);else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break t;for(;null===t.sibling;){if(null===t.return||t.return===e)break t;t=t.return}t.sibling.return=t.return,t=t.sibling}i&=1}if(Cr(ao,i),0===(1&e.mode))e.memoizedState=null;else switch(r){case"forwards":for(n=e.child,r=null;null!==n;)null!==(t=n.alternate)&&null===lo(t)&&(r=n),n=n.sibling;null===(n=r)?(r=e.child,e.child=null):(r=n.sibling,n.sibling=null),Va(e,!1,r,n,s);break;case"backwards":for(n=null,r=e.child,e.child=null;null!==r;){if(null!==(t=r.alternate)&&null===lo(t)){e.child=r;break}t=r.sibling,r.sibling=n,n=r,r=t}Va(e,!0,n,null,s);break;case"together":Va(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function $a(t,e){0===(1&e.mode)&&null!==t&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Ga(t,e,n){if(null!==t&&(e.dependencies=t.dependencies),Fl|=e.lanes,0===(n&e.childLanes))return null;if(null!==t&&e.child!==t.child)throw Error(s(153));if(null!==e.child){for(n=Nc(t=e.child,t.pendingProps),e.child=n,n.return=e;null!==t.sibling;)t=t.sibling,(n=n.sibling=Nc(t,t.pendingProps)).return=e;n.sibling=null}return e.child}function Ha(t,e){if(!rs)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;null!==e;)null!==e.alternate&&(n=e),e=e.sibling;null===n?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var i=null;null!==n;)null!==n.alternate&&(i=n),n=n.sibling;null===i?e||null===t.tail?t.tail=null:t.tail.sibling=null:i.sibling=null}}function qa(t){var e=null!==t.alternate&&t.alternate.child===t.child,n=0,i=0;if(e)for(var r=t.child;null!==r;)n|=r.lanes|r.childLanes,i|=14680064&r.subtreeFlags,i|=14680064&r.flags,r.return=t,r=r.sibling;else for(r=t.child;null!==r;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=t,r=r.sibling;return t.subtreeFlags|=i,t.childLanes=n,e}function Za(t,e,n){var i=e.pendingProps;switch(es(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qa(e),null;case 1:case 17:return Lr(e.type)&&kr(),qa(e),null;case 3:return i=e.stateNode,ro(),Tr(Rr),Tr(Pr),uo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),null!==t&&null!==t.child||(hs(e)?e.flags|=4:null===t||t.memoizedState.isDehydrated&&0===(256&e.flags)||(e.flags|=1024,null!==ss&&(ac(ss),ss=null))),ka(t,e),qa(e),null;case 5:oo(e);var r=no(eo.current);if(n=e.type,null!==t&&null!=e.stateNode)Na(t,e,n,i,r),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(null===e.stateNode)throw Error(s(166));return qa(e),null}if(t=no(Qs.current),hs(e)){i=e.stateNode,n=e.type;var o=e.memoizedProps;switch(i[dr]=e,i[pr]=o,t=0!==(1&e.mode),n){case"dialog":Ui("cancel",i),Ui("close",i);break;case"iframe":case"object":case"embed":Ui("load",i);break;case"video":case"audio":for(r=0;r<Oi.length;r++)Ui(Oi[r],i);break;case"source":Ui("error",i);break;case"img":case"image":case"link":Ui("error",i),Ui("load",i);break;case"details":Ui("toggle",i);break;case"input":K(i,o),Ui("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!o.multiple},Ui("invalid",i);break;case"textarea":rt(i,o),Ui("invalid",i)}for(var l in yt(n,o),r=null,o)if(o.hasOwnProperty(l)){var c=o[l];"children"===l?"string"===typeof c?i.textContent!==c&&(!0!==o.suppressHydrationWarning&&Ji(i.textContent,c,t),r=["children",c]):"number"===typeof c&&i.textContent!==""+c&&(!0!==o.suppressHydrationWarning&&Ji(i.textContent,c,t),r=["children",""+c]):a.hasOwnProperty(l)&&null!=c&&"onScroll"===l&&Ui("scroll",i)}switch(n){case"input":H(i),Q(i,o,!0);break;case"textarea":H(i),ot(i);break;case"select":case"option":break;default:"function"===typeof o.onClick&&(i.onclick=Qi)}i=r,e.updateQueue=i,null!==i&&(e.flags|=4)}else{l=9===r.nodeType?r:r.ownerDocument,"http://www.w3.org/1999/xhtml"===t&&(t=at(n)),"http://www.w3.org/1999/xhtml"===t?"script"===n?((t=l.createElement("div")).innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):"string"===typeof i.is?t=l.createElement(n,{is:i.is}):(t=l.createElement(n),"select"===n&&(l=t,i.multiple?l.multiple=!0:i.size&&(l.size=i.size))):t=l.createElementNS(t,n),t[dr]=e,t[pr]=i,La(t,e,!1,!1),e.stateNode=t;t:{switch(l=vt(n,i),n){case"dialog":Ui("cancel",t),Ui("close",t),r=i;break;case"iframe":case"object":case"embed":Ui("load",t),r=i;break;case"video":case"audio":for(r=0;r<Oi.length;r++)Ui(Oi[r],t);r=i;break;case"source":Ui("error",t),r=i;break;case"img":case"image":case"link":Ui("error",t),Ui("load",t),r=i;break;case"details":Ui("toggle",t),r=i;break;case"input":K(t,i),r=X(t,i),Ui("invalid",t);break;case"option":default:r=i;break;case"select":t._wrapperState={wasMultiple:!!i.multiple},r=F({},i,{value:void 0}),Ui("invalid",t);break;case"textarea":rt(t,i),r=it(t,i),Ui("invalid",t)}for(o in yt(n,r),c=r)if(c.hasOwnProperty(o)){var u=c[o];"style"===o?mt(t,u):"dangerouslySetInnerHTML"===o?null!=(u=u?u.__html:void 0)&&ht(t,u):"children"===o?"string"===typeof u?("textarea"!==n||""!==u)&&dt(t,u):"number"===typeof u&&dt(t,""+u):"suppressContentEditableWarning"!==o&&"suppressHydrationWarning"!==o&&"autoFocus"!==o&&(a.hasOwnProperty(o)?null!=u&&"onScroll"===o&&Ui("scroll",t):null!=u&&v(t,o,u,l))}switch(n){case"input":H(t),Q(t,i,!1);break;case"textarea":H(t),ot(t);break;case"option":null!=i.value&&t.setAttribute("value",""+$(i.value));break;case"select":t.multiple=!!i.multiple,null!=(o=i.value)?nt(t,!!i.multiple,o,!1):null!=i.defaultValue&&nt(t,!!i.multiple,i.defaultValue,!0);break;default:"function"===typeof r.onClick&&(t.onclick=Qi)}switch(n){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break t;case"img":i=!0;break t;default:i=!1}}i&&(e.flags|=4)}null!==e.ref&&(e.flags|=512,e.flags|=2097152)}return qa(e),null;case 6:if(t&&null!=e.stateNode)Oa(t,e,t.memoizedProps,i);else{if("string"!==typeof i&&null===e.stateNode)throw Error(s(166));if(n=no(eo.current),no(Qs.current),hs(e)){if(i=e.stateNode,n=e.memoizedProps,i[dr]=e,(o=i.nodeValue!==n)&&null!==(t=ns))switch(t.tag){case 3:Ji(i.nodeValue,n,0!==(1&t.mode));break;case 5:!0!==t.memoizedProps.suppressHydrationWarning&&Ji(i.nodeValue,n,0!==(1&t.mode))}o&&(e.flags|=4)}else(i=(9===n.nodeType?n:n.ownerDocument).createTextNode(i))[dr]=e,e.stateNode=i}return qa(e),null;case 13:if(Tr(ao),i=e.memoizedState,null===t||null!==t.memoizedState&&null!==t.memoizedState.dehydrated){if(rs&&null!==is&&0!==(1&e.mode)&&0===(128&e.flags))ds(),ps(),e.flags|=98560,o=!1;else if(o=hs(e),null!==i&&null!==i.dehydrated){if(null===t){if(!o)throw Error(s(318));if(!(o=null!==(o=e.memoizedState)?o.dehydrated:null))throw Error(s(317));o[dr]=e}else ps(),0===(128&e.flags)&&(e.memoizedState=null),e.flags|=4;qa(e),o=!1}else null!==ss&&(ac(ss),ss=null),o=!0;if(!o)return 65536&e.flags?e:null}return 0!==(128&e.flags)?(e.lanes=n,e):((i=null!==i)!==(null!==t&&null!==t.memoizedState)&&i&&(e.child.flags|=8192,0!==(1&e.mode)&&(null===t||0!==(1&ao.current)?0===Ol&&(Ol=3):mc())),null!==e.updateQueue&&(e.flags|=4),qa(e),null);case 4:return ro(),ka(t,e),null===t&&Vi(e.stateNode.containerInfo),qa(e),null;case 10:return Es(e.type._context),qa(e),null;case 19:if(Tr(ao),null===(o=e.memoizedState))return qa(e),null;if(i=0!==(128&e.flags),null===(l=o.rendering))if(i)Ha(o,!1);else{if(0!==Ol||null!==t&&0!==(128&t.flags))for(t=e.child;null!==t;){if(null!==(l=lo(t))){for(e.flags|=128,Ha(o,!1),null!==(i=l.updateQueue)&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=n,n=e.child;null!==n;)t=i,(o=n).flags&=14680066,null===(l=o.alternate)?(o.childLanes=0,o.lanes=t,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=l.childLanes,o.lanes=l.lanes,o.child=l.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=l.memoizedProps,o.memoizedState=l.memoizedState,o.updateQueue=l.updateQueue,o.type=l.type,t=l.dependencies,o.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Cr(ao,1&ao.current|2),e.child}t=t.sibling}null!==o.tail&&Yt()>Wl&&(e.flags|=128,i=!0,Ha(o,!1),e.lanes=4194304)}else{if(!i)if(null!==(t=lo(l))){if(e.flags|=128,i=!0,null!==(n=t.updateQueue)&&(e.updateQueue=n,e.flags|=4),Ha(o,!0),null===o.tail&&"hidden"===o.tailMode&&!l.alternate&&!rs)return qa(e),null}else 2*Yt()-o.renderingStartTime>Wl&&1073741824!==n&&(e.flags|=128,i=!0,Ha(o,!1),e.lanes=4194304);o.isBackwards?(l.sibling=e.child,e.child=l):(null!==(n=o.last)?n.sibling=l:e.child=l,o.last=l)}return null!==o.tail?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Yt(),e.sibling=null,n=ao.current,Cr(ao,i?1&n|2:1&n),e):(qa(e),null);case 22:case 23:return dc(),i=null!==e.memoizedState,null!==t&&null!==t.memoizedState!==i&&(e.flags|=8192),i&&0!==(1&e.mode)?0!==(1073741824&kl)&&(qa(e),6&e.subtreeFlags&&(e.flags|=8192)):qa(e),null;case 24:case 25:return null}throw Error(s(156,e.tag))}function Xa(t,e){switch(es(e),e.tag){case 1:return Lr(e.type)&&kr(),65536&(t=e.flags)?(e.flags=-65537&t|128,e):null;case 3:return ro(),Tr(Rr),Tr(Pr),uo(),0!==(65536&(t=e.flags))&&0===(128&t)?(e.flags=-65537&t|128,e):null;case 5:return oo(e),null;case 13:if(Tr(ao),null!==(t=e.memoizedState)&&null!==t.dehydrated){if(null===e.alternate)throw Error(s(340));ps()}return 65536&(t=e.flags)?(e.flags=-65537&t|128,e):null;case 19:return Tr(ao),null;case 4:return ro(),null;case 10:return Es(e.type._context),null;case 22:case 23:return dc(),null;default:return null}}La=function(t,e){for(var n=e.child;null!==n;){if(5===n.tag||6===n.tag)t.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ka=function(){},Na=function(t,e,n,i){var r=t.memoizedProps;if(r!==i){t=e.stateNode,no(Qs.current);var s,o=null;switch(n){case"input":r=X(t,r),i=X(t,i),o=[];break;case"select":r=F({},r,{value:void 0}),i=F({},i,{value:void 0}),o=[];break;case"textarea":r=it(t,r),i=it(t,i),o=[];break;default:"function"!==typeof r.onClick&&"function"===typeof i.onClick&&(t.onclick=Qi)}for(u in yt(n,i),n=null,r)if(!i.hasOwnProperty(u)&&r.hasOwnProperty(u)&&null!=r[u])if("style"===u){var l=r[u];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(a.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in i){var c=i[u];if(l=null!=r?r[u]:void 0,i.hasOwnProperty(u)&&c!==l&&(null!=c||null!=l))if("style"===u)if(l){for(s in l)!l.hasOwnProperty(s)||c&&c.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in c)c.hasOwnProperty(s)&&l[s]!==c[s]&&(n||(n={}),n[s]=c[s])}else n||(o||(o=[]),o.push(u,n)),n=c;else"dangerouslySetInnerHTML"===u?(c=c?c.__html:void 0,l=l?l.__html:void 0,null!=c&&l!==c&&(o=o||[]).push(u,c)):"children"===u?"string"!==typeof c&&"number"!==typeof c||(o=o||[]).push(u,""+c):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(a.hasOwnProperty(u)?(null!=c&&"onScroll"===u&&Ui("scroll",t),o||l===c||(o=[])):(o=o||[]).push(u,c))}n&&(o=o||[]).push("style",n);var u=o;(e.updateQueue=u)&&(e.flags|=4)}},Oa=function(t,e,n,i){n!==i&&(e.flags|=4)};var Ka=!1,Ya=!1,Ja="function"===typeof WeakSet?WeakSet:Set,Qa=null;function tl(t,e){var n=t.ref;if(null!==n)if("function"===typeof n)try{n(null)}catch(i){Tc(t,e,i)}else n.current=null}function el(t,e,n){try{n()}catch(i){Tc(t,e,i)}}var nl=!1;function il(t,e,n){var i=e.updateQueue;if(null!==(i=null!==i?i.lastEffect:null)){var r=i=i.next;do{if((r.tag&t)===t){var s=r.destroy;r.destroy=void 0,void 0!==s&&el(e,n,s)}r=r.next}while(r!==i)}}function rl(t,e){if(null!==(e=null!==(e=e.updateQueue)?e.lastEffect:null)){var n=e=e.next;do{if((n.tag&t)===t){var i=n.create;n.destroy=i()}n=n.next}while(n!==e)}}function sl(t){var e=t.ref;if(null!==e){var n=t.stateNode;t.tag,t=n,"function"===typeof e?e(t):e.current=t}}function ol(t){var e=t.alternate;null!==e&&(t.alternate=null,ol(e)),t.child=null,t.deletions=null,t.sibling=null,5===t.tag&&(null!==(e=t.stateNode)&&(delete e[dr],delete e[pr],delete e[gr],delete e[mr],delete e[_r])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function al(t){return 5===t.tag||3===t.tag||4===t.tag}function ll(t){t:for(;;){for(;null===t.sibling;){if(null===t.return||al(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;5!==t.tag&&6!==t.tag&&18!==t.tag;){if(2&t.flags)continue t;if(null===t.child||4===t.tag)continue t;t.child.return=t,t=t.child}if(!(2&t.flags))return t.stateNode}}function cl(t,e,n){var i=t.tag;if(5===i||6===i)t=t.stateNode,e?8===n.nodeType?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(8===n.nodeType?(e=n.parentNode).insertBefore(t,n):(e=n).appendChild(t),null!==(n=n._reactRootContainer)&&void 0!==n||null!==e.onclick||(e.onclick=Qi));else if(4!==i&&null!==(t=t.child))for(cl(t,e,n),t=t.sibling;null!==t;)cl(t,e,n),t=t.sibling}function ul(t,e,n){var i=t.tag;if(5===i||6===i)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(4!==i&&null!==(t=t.child))for(ul(t,e,n),t=t.sibling;null!==t;)ul(t,e,n),t=t.sibling}var hl=null,dl=!1;function pl(t,e,n){for(n=n.child;null!==n;)fl(t,e,n),n=n.sibling}function fl(t,e,n){if(se&&"function"===typeof se.onCommitFiberUnmount)try{se.onCommitFiberUnmount(re,n)}catch(a){}switch(n.tag){case 5:Ya||tl(n,e);case 6:var i=hl,r=dl;hl=null,pl(t,e,n),dl=r,null!==(hl=i)&&(dl?(t=hl,n=n.stateNode,8===t.nodeType?t.parentNode.removeChild(n):t.removeChild(n)):hl.removeChild(n.stateNode));break;case 18:null!==hl&&(dl?(t=hl,n=n.stateNode,8===t.nodeType?lr(t.parentNode,n):1===t.nodeType&&lr(t,n),Ve(t)):lr(hl,n.stateNode));break;case 4:i=hl,r=dl,hl=n.stateNode.containerInfo,dl=!0,pl(t,e,n),hl=i,dl=r;break;case 0:case 11:case 14:case 15:if(!Ya&&(null!==(i=n.updateQueue)&&null!==(i=i.lastEffect))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,void 0!==o&&(0!==(2&s)||0!==(4&s))&&el(n,e,o),r=r.next}while(r!==i)}pl(t,e,n);break;case 1:if(!Ya&&(tl(n,e),"function"===typeof(i=n.stateNode).componentWillUnmount))try{i.props=n.memoizedProps,i.state=n.memoizedState,i.componentWillUnmount()}catch(a){Tc(n,e,a)}pl(t,e,n);break;case 21:pl(t,e,n);break;case 22:1&n.mode?(Ya=(i=Ya)||null!==n.memoizedState,pl(t,e,n),Ya=i):pl(t,e,n);break;default:pl(t,e,n)}}function gl(t){var e=t.updateQueue;if(null!==e){t.updateQueue=null;var n=t.stateNode;null===n&&(n=t.stateNode=new Ja),e.forEach((function(e){var i=Rc.bind(null,t,e);n.has(e)||(n.add(e),e.then(i,i))}))}}function ml(t,e){var n=e.deletions;if(null!==n)for(var i=0;i<n.length;i++){var r=n[i];try{var o=t,a=e,l=a;t:for(;null!==l;){switch(l.tag){case 5:hl=l.stateNode,dl=!1;break t;case 3:case 4:hl=l.stateNode.containerInfo,dl=!0;break t}l=l.return}if(null===hl)throw Error(s(160));fl(o,a,r),hl=null,dl=!1;var c=r.alternate;null!==c&&(c.return=null),r.return=null}catch(u){Tc(r,e,u)}}if(12854&e.subtreeFlags)for(e=e.child;null!==e;)_l(e,t),e=e.sibling}function _l(t,e){var n=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(ml(e,t),yl(t),4&i){try{il(3,t,t.return),rl(3,t)}catch(m){Tc(t,t.return,m)}try{il(5,t,t.return)}catch(m){Tc(t,t.return,m)}}break;case 1:ml(e,t),yl(t),512&i&&null!==n&&tl(n,n.return);break;case 5:if(ml(e,t),yl(t),512&i&&null!==n&&tl(n,n.return),32&t.flags){var r=t.stateNode;try{dt(r,"")}catch(m){Tc(t,t.return,m)}}if(4&i&&null!=(r=t.stateNode)){var o=t.memoizedProps,a=null!==n?n.memoizedProps:o,l=t.type,c=t.updateQueue;if(t.updateQueue=null,null!==c)try{"input"===l&&"radio"===o.type&&null!=o.name&&Y(r,o),vt(l,a);var u=vt(l,o);for(a=0;a<c.length;a+=2){var h=c[a],d=c[a+1];"style"===h?mt(r,d):"dangerouslySetInnerHTML"===h?ht(r,d):"children"===h?dt(r,d):v(r,h,d,u)}switch(l){case"input":J(r,o);break;case"textarea":st(r,o);break;case"select":var p=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!o.multiple;var f=o.value;null!=f?nt(r,!!o.multiple,f,!1):p!==!!o.multiple&&(null!=o.defaultValue?nt(r,!!o.multiple,o.defaultValue,!0):nt(r,!!o.multiple,o.multiple?[]:"",!1))}r[pr]=o}catch(m){Tc(t,t.return,m)}}break;case 6:if(ml(e,t),yl(t),4&i){if(null===t.stateNode)throw Error(s(162));r=t.stateNode,o=t.memoizedProps;try{r.nodeValue=o}catch(m){Tc(t,t.return,m)}}break;case 3:if(ml(e,t),yl(t),4&i&&null!==n&&n.memoizedState.isDehydrated)try{Ve(e.containerInfo)}catch(m){Tc(t,t.return,m)}break;case 4:default:ml(e,t),yl(t);break;case 13:ml(e,t),yl(t),8192&(r=t.child).flags&&(o=null!==r.memoizedState,r.stateNode.isHidden=o,!o||null!==r.alternate&&null!==r.alternate.memoizedState||(Vl=Yt())),4&i&&gl(t);break;case 22:if(h=null!==n&&null!==n.memoizedState,1&t.mode?(Ya=(u=Ya)||h,ml(e,t),Ya=u):ml(e,t),yl(t),8192&i){if(u=null!==t.memoizedState,(t.stateNode.isHidden=u)&&!h&&0!==(1&t.mode))for(Qa=t,h=t.child;null!==h;){for(d=Qa=h;null!==Qa;){switch(f=(p=Qa).child,p.tag){case 0:case 11:case 14:case 15:il(4,p,p.return);break;case 1:tl(p,p.return);var g=p.stateNode;if("function"===typeof g.componentWillUnmount){i=p,n=p.return;try{e=i,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(m){Tc(i,n,m)}}break;case 5:tl(p,p.return);break;case 22:if(null!==p.memoizedState){El(d);continue}}null!==f?(f.return=p,Qa=f):El(d)}h=h.sibling}t:for(h=null,d=t;;){if(5===d.tag){if(null===h){h=d;try{r=d.stateNode,u?"function"===typeof(o=r.style).setProperty?o.setProperty("display","none","important"):o.display="none":(l=d.stateNode,a=void 0!==(c=d.memoizedProps.style)&&null!==c&&c.hasOwnProperty("display")?c.display:null,l.style.display=gt("display",a))}catch(m){Tc(t,t.return,m)}}}else if(6===d.tag){if(null===h)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(m){Tc(t,t.return,m)}}else if((22!==d.tag&&23!==d.tag||null===d.memoizedState||d===t)&&null!==d.child){d.child.return=d,d=d.child;continue}if(d===t)break t;for(;null===d.sibling;){if(null===d.return||d.return===t)break t;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:ml(e,t),yl(t),4&i&&gl(t);case 21:}}function yl(t){var e=t.flags;if(2&e){try{t:{for(var n=t.return;null!==n;){if(al(n)){var i=n;break t}n=n.return}throw Error(s(160))}switch(i.tag){case 5:var r=i.stateNode;32&i.flags&&(dt(r,""),i.flags&=-33),ul(t,ll(t),r);break;case 3:case 4:var o=i.stateNode.containerInfo;cl(t,ll(t),o);break;default:throw Error(s(161))}}catch(a){Tc(t,t.return,a)}t.flags&=-3}4096&e&&(t.flags&=-4097)}function vl(t,e,n){Qa=t,bl(t,e,n)}function bl(t,e,n){for(var i=0!==(1&t.mode);null!==Qa;){var r=Qa,s=r.child;if(22===r.tag&&i){var o=null!==r.memoizedState||Ka;if(!o){var a=r.alternate,l=null!==a&&null!==a.memoizedState||Ya;a=Ka;var c=Ya;if(Ka=o,(Ya=l)&&!c)for(Qa=r;null!==Qa;)l=(o=Qa).child,22===o.tag&&null!==o.memoizedState?xl(r):null!==l?(l.return=o,Qa=l):xl(r);for(;null!==s;)Qa=s,bl(s,e,n),s=s.sibling;Qa=r,Ka=a,Ya=c}wl(t)}else 0!==(8772&r.subtreeFlags)&&null!==s?(s.return=r,Qa=s):wl(t)}}function wl(t){for(;null!==Qa;){var e=Qa;if(0!==(8772&e.flags)){var n=e.alternate;try{if(0!==(8772&e.flags))switch(e.tag){case 0:case 11:case 15:Ya||rl(5,e);break;case 1:var i=e.stateNode;if(4&e.flags&&!Ya)if(null===n)i.componentDidMount();else{var r=e.elementType===e.type?n.memoizedProps:ms(e.type,n.memoizedProps);i.componentDidUpdate(r,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=e.updateQueue;null!==o&&Bs(e,o,i);break;case 3:var a=e.updateQueue;if(null!==a){if(n=null,null!==e.child)switch(e.child.tag){case 5:case 1:n=e.child.stateNode}Bs(e,a,n)}break;case 5:var l=e.stateNode;if(null===n&&4&e.flags){n=l;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===e.memoizedState){var u=e.alternate;if(null!==u){var h=u.memoizedState;if(null!==h){var d=h.dehydrated;null!==d&&Ve(d)}}}break;default:throw Error(s(163))}Ya||512&e.flags&&sl(e)}catch(p){Tc(e,e.return,p)}}if(e===t){Qa=null;break}if(null!==(n=e.sibling)){n.return=e.return,Qa=n;break}Qa=e.return}}function El(t){for(;null!==Qa;){var e=Qa;if(e===t){Qa=null;break}var n=e.sibling;if(null!==n){n.return=e.return,Qa=n;break}Qa=e.return}}function xl(t){for(;null!==Qa;){var e=Qa;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{rl(4,e)}catch(l){Tc(e,n,l)}break;case 1:var i=e.stateNode;if("function"===typeof i.componentDidMount){var r=e.return;try{i.componentDidMount()}catch(l){Tc(e,r,l)}}var s=e.return;try{sl(e)}catch(l){Tc(e,s,l)}break;case 5:var o=e.return;try{sl(e)}catch(l){Tc(e,o,l)}}}catch(l){Tc(e,e.return,l)}if(e===t){Qa=null;break}var a=e.sibling;if(null!==a){a.return=e.return,Qa=a;break}Qa=e.return}}var Sl,Tl=Math.ceil,Cl=b.ReactCurrentDispatcher,Al=b.ReactCurrentOwner,Pl=b.ReactCurrentBatchConfig,Rl=0,Ml=null,Il=null,Ll=0,kl=0,Nl=Sr(0),Ol=0,Dl=null,Fl=0,Bl=0,Ul=0,zl=null,jl=null,Vl=0,Wl=1/0,$l=null,Gl=!1,Hl=null,ql=null,Zl=!1,Xl=null,Kl=0,Yl=0,Jl=null,Ql=-1,tc=0;function ec(){return 0!==(6&Rl)?Yt():-1!==Ql?Ql:Ql=Yt()}function nc(t){return 0===(1&t.mode)?1:0!==(2&Rl)&&0!==Ll?Ll&-Ll:null!==gs.transition?(0===tc&&(tc=ge()),tc):0!==(t=ve)?t:t=void 0===(t=window.event)?16:Ke(t.type)}function ic(t,e,n,i){if(50<Yl)throw Yl=0,Jl=null,Error(s(185));_e(t,n,i),0!==(2&Rl)&&t===Ml||(t===Ml&&(0===(2&Rl)&&(Bl|=n),4===Ol&&lc(t,Ll)),rc(t,i),1===n&&0===Rl&&0===(1&e.mode)&&(Wl=Yt()+500,Ur&&Vr()))}function rc(t,e){var n=t.callbackNode;!function(t,e){for(var n=t.suspendedLanes,i=t.pingedLanes,r=t.expirationTimes,s=t.pendingLanes;0<s;){var o=31-oe(s),a=1<<o,l=r[o];-1===l?0!==(a&n)&&0===(a&i)||(r[o]=pe(a,e)):l<=e&&(t.expiredLanes|=a),s&=~a}}(t,e);var i=de(t,t===Ml?Ll:0);if(0===i)null!==n&&Zt(n),t.callbackNode=null,t.callbackPriority=0;else if(e=i&-i,t.callbackPriority!==e){if(null!=n&&Zt(n),1===e)0===t.tag?function(t){Ur=!0,jr(t)}(cc.bind(null,t)):jr(cc.bind(null,t)),or((function(){0===(6&Rl)&&Vr()})),n=null;else{switch(be(i)){case 1:n=Qt;break;case 4:n=te;break;case 16:default:n=ee;break;case 536870912:n=ie}n=Mc(n,sc.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function sc(t,e){if(Ql=-1,tc=0,0!==(6&Rl))throw Error(s(327));var n=t.callbackNode;if(xc()&&t.callbackNode!==n)return null;var i=de(t,t===Ml?Ll:0);if(0===i)return null;if(0!==(30&i)||0!==(i&t.expiredLanes)||e)e=_c(t,i);else{e=i;var r=Rl;Rl|=2;var o=gc();for(Ml===t&&Ll===e||($l=null,Wl=Yt()+500,pc(t,e));;)try{vc();break}catch(l){fc(t,l)}ws(),Cl.current=o,Rl=r,null!==Il?e=0:(Ml=null,Ll=0,e=Ol)}if(0!==e){if(2===e&&(0!==(r=fe(t))&&(i=r,e=oc(t,r))),1===e)throw n=Dl,pc(t,0),lc(t,i),rc(t,Yt()),n;if(6===e)lc(t,i);else{if(r=t.current.alternate,0===(30&i)&&!function(t){for(var e=t;;){if(16384&e.flags){var n=e.updateQueue;if(null!==n&&null!==(n=n.stores))for(var i=0;i<n.length;i++){var r=n[i],s=r.getSnapshot;r=r.value;try{if(!ai(s(),r))return!1}catch(a){return!1}}}if(n=e.child,16384&e.subtreeFlags&&null!==n)n.return=e,e=n;else{if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}(r)&&(2===(e=_c(t,i))&&(0!==(o=fe(t))&&(i=o,e=oc(t,o))),1===e))throw n=Dl,pc(t,0),lc(t,i),rc(t,Yt()),n;switch(t.finishedWork=r,t.finishedLanes=i,e){case 0:case 1:throw Error(s(345));case 2:case 5:Ec(t,jl,$l);break;case 3:if(lc(t,i),(130023424&i)===i&&10<(e=Vl+500-Yt())){if(0!==de(t,0))break;if(((r=t.suspendedLanes)&i)!==i){ec(),t.pingedLanes|=t.suspendedLanes&r;break}t.timeoutHandle=ir(Ec.bind(null,t,jl,$l),e);break}Ec(t,jl,$l);break;case 4:if(lc(t,i),(4194240&i)===i)break;for(e=t.eventTimes,r=-1;0<i;){var a=31-oe(i);o=1<<a,(a=e[a])>r&&(r=a),i&=~o}if(i=r,10<(i=(120>(i=Yt()-i)?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Tl(i/1960))-i)){t.timeoutHandle=ir(Ec.bind(null,t,jl,$l),i);break}Ec(t,jl,$l);break;default:throw Error(s(329))}}}return rc(t,Yt()),t.callbackNode===n?sc.bind(null,t):null}function oc(t,e){var n=zl;return t.current.memoizedState.isDehydrated&&(pc(t,e).flags|=256),2!==(t=_c(t,e))&&(e=jl,jl=n,null!==e&&ac(e)),t}function ac(t){null===jl?jl=t:jl.push.apply(jl,t)}function lc(t,e){for(e&=~Ul,e&=~Bl,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-oe(e),i=1<<n;t[n]=-1,e&=~i}}function cc(t){if(0!==(6&Rl))throw Error(s(327));xc();var e=de(t,0);if(0===(1&e))return rc(t,Yt()),null;var n=_c(t,e);if(0!==t.tag&&2===n){var i=fe(t);0!==i&&(e=i,n=oc(t,i))}if(1===n)throw n=Dl,pc(t,0),lc(t,e),rc(t,Yt()),n;if(6===n)throw Error(s(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Ec(t,jl,$l),rc(t,Yt()),null}function uc(t,e){var n=Rl;Rl|=1;try{return t(e)}finally{0===(Rl=n)&&(Wl=Yt()+500,Ur&&Vr())}}function hc(t){null!==Xl&&0===Xl.tag&&0===(6&Rl)&&xc();var e=Rl;Rl|=1;var n=Pl.transition,i=ve;try{if(Pl.transition=null,ve=1,t)return t()}finally{ve=i,Pl.transition=n,0===(6&(Rl=e))&&Vr()}}function dc(){kl=Nl.current,Tr(Nl)}function pc(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(-1!==n&&(t.timeoutHandle=-1,rr(n)),null!==Il)for(n=Il.return;null!==n;){var i=n;switch(es(i),i.tag){case 1:null!==(i=i.type.childContextTypes)&&void 0!==i&&kr();break;case 3:ro(),Tr(Rr),Tr(Pr),uo();break;case 5:oo(i);break;case 4:ro();break;case 13:case 19:Tr(ao);break;case 10:Es(i.type._context);break;case 22:case 23:dc()}n=n.return}if(Ml=t,Il=t=Nc(t.current,null),Ll=kl=e,Ol=0,Dl=null,Ul=Bl=Fl=0,jl=zl=null,null!==Cs){for(e=0;e<Cs.length;e++)if(null!==(i=(n=Cs[e]).interleaved)){n.interleaved=null;var r=i.next,s=n.pending;if(null!==s){var o=s.next;s.next=r,i.next=o}n.pending=i}Cs=null}return t}function fc(t,e){for(;;){var n=Il;try{if(ws(),ho.current=oa,yo){for(var i=go.memoizedState;null!==i;){var r=i.queue;null!==r&&(r.pending=null),i=i.next}yo=!1}if(fo=0,_o=mo=go=null,vo=!1,bo=0,Al.current=null,null===n||null===n.return){Ol=1,Dl=e,Il=null;break}t:{var o=t,a=n.return,l=n,c=e;if(e=Ll,l.flags|=32768,null!==c&&"object"===typeof c&&"function"===typeof c.then){var u=c,h=l,d=h.tag;if(0===(1&h.mode)&&(0===d||11===d||15===d)){var p=h.alternate;p?(h.updateQueue=p.updateQueue,h.memoizedState=p.memoizedState,h.lanes=p.lanes):(h.updateQueue=null,h.memoizedState=null)}var f=_a(a);if(null!==f){f.flags&=-257,ya(f,a,l,0,e),1&f.mode&&ma(o,u,e),c=u;var g=(e=f).updateQueue;if(null===g){var m=new Set;m.add(c),e.updateQueue=m}else g.add(c);break t}if(0===(1&e)){ma(o,u,e),mc();break t}c=Error(s(426))}else if(rs&&1&l.mode){var _=_a(a);if(null!==_){0===(65536&_.flags)&&(_.flags|=256),ya(_,a,l,0,e),fs(ua(c,l));break t}}o=c=ua(c,l),4!==Ol&&(Ol=2),null===zl?zl=[o]:zl.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,e&=-e,o.lanes|=e,Ds(o,fa(0,c,e));break t;case 1:l=c;var y=o.type,v=o.stateNode;if(0===(128&o.flags)&&("function"===typeof y.getDerivedStateFromError||null!==v&&"function"===typeof v.componentDidCatch&&(null===ql||!ql.has(v)))){o.flags|=65536,e&=-e,o.lanes|=e,Ds(o,ga(o,l,e));break t}}o=o.return}while(null!==o)}wc(n)}catch(b){e=b,Il===n&&null!==n&&(Il=n=n.return);continue}break}}function gc(){var t=Cl.current;return Cl.current=oa,null===t?oa:t}function mc(){0!==Ol&&3!==Ol&&2!==Ol||(Ol=4),null===Ml||0===(268435455&Fl)&&0===(268435455&Bl)||lc(Ml,Ll)}function _c(t,e){var n=Rl;Rl|=2;var i=gc();for(Ml===t&&Ll===e||($l=null,pc(t,e));;)try{yc();break}catch(r){fc(t,r)}if(ws(),Rl=n,Cl.current=i,null!==Il)throw Error(s(261));return Ml=null,Ll=0,Ol}function yc(){for(;null!==Il;)bc(Il)}function vc(){for(;null!==Il&&!Xt();)bc(Il)}function bc(t){var e=Sl(t.alternate,t,kl);t.memoizedProps=t.pendingProps,null===e?wc(t):Il=e,Al.current=null}function wc(t){var e=t;do{var n=e.alternate;if(t=e.return,0===(32768&e.flags)){if(null!==(n=Za(n,e,kl)))return void(Il=n)}else{if(null!==(n=Xa(n,e)))return n.flags&=32767,void(Il=n);if(null===t)return Ol=6,void(Il=null);t.flags|=32768,t.subtreeFlags=0,t.deletions=null}if(null!==(e=e.sibling))return void(Il=e);Il=e=t}while(null!==e);0===Ol&&(Ol=5)}function Ec(t,e,n){var i=ve,r=Pl.transition;try{Pl.transition=null,ve=1,function(t,e,n,i){do{xc()}while(null!==Xl);if(0!==(6&Rl))throw Error(s(327));n=t.finishedWork;var r=t.finishedLanes;if(null===n)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(s(177));t.callbackNode=null,t.callbackPriority=0;var o=n.lanes|n.childLanes;if(function(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var i=t.eventTimes;for(t=t.expirationTimes;0<n;){var r=31-oe(n),s=1<<r;e[r]=0,i[r]=-1,t[r]=-1,n&=~s}}(t,o),t===Ml&&(Il=Ml=null,Ll=0),0===(2064&n.subtreeFlags)&&0===(2064&n.flags)||Zl||(Zl=!0,Mc(ee,(function(){return xc(),null}))),o=0!==(15990&n.flags),0!==(15990&n.subtreeFlags)||o){o=Pl.transition,Pl.transition=null;var a=ve;ve=1;var l=Rl;Rl|=4,Al.current=null,function(t,e){if(tr=$e,pi(t=di())){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else t:{var i=(n=(n=t.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(i&&0!==i.rangeCount){n=i.anchorNode;var r=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch(w){n=null;break t}var a=0,l=-1,c=-1,u=0,h=0,d=t,p=null;e:for(;;){for(var f;d!==n||0!==r&&3!==d.nodeType||(l=a+r),d!==o||0!==i&&3!==d.nodeType||(c=a+i),3===d.nodeType&&(a+=d.nodeValue.length),null!==(f=d.firstChild);)p=d,d=f;for(;;){if(d===t)break e;if(p===n&&++u===r&&(l=a),p===o&&++h===i&&(c=a),null!==(f=d.nextSibling))break;p=(d=p).parentNode}d=f}n=-1===l||-1===c?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(er={focusedElem:t,selectionRange:n},$e=!1,Qa=e;null!==Qa;)if(t=(e=Qa).child,0!==(1028&e.subtreeFlags)&&null!==t)t.return=e,Qa=t;else for(;null!==Qa;){e=Qa;try{var g=e.alternate;if(0!==(1024&e.flags))switch(e.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==g){var m=g.memoizedProps,_=g.memoizedState,y=e.stateNode,v=y.getSnapshotBeforeUpdate(e.elementType===e.type?m:ms(e.type,m),_);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=e.stateNode.containerInfo;1===b.nodeType?b.textContent="":9===b.nodeType&&b.documentElement&&b.removeChild(b.documentElement);break;default:throw Error(s(163))}}catch(w){Tc(e,e.return,w)}if(null!==(t=e.sibling)){t.return=e.return,Qa=t;break}Qa=e.return}g=nl,nl=!1}(t,n),_l(n,t),fi(er),$e=!!tr,er=tr=null,t.current=n,vl(n,t,r),Kt(),Rl=l,ve=a,Pl.transition=o}else t.current=n;if(Zl&&(Zl=!1,Xl=t,Kl=r),o=t.pendingLanes,0===o&&(ql=null),function(t){if(se&&"function"===typeof se.onCommitFiberRoot)try{se.onCommitFiberRoot(re,t,void 0,128===(128&t.current.flags))}catch(e){}}(n.stateNode),rc(t,Yt()),null!==e)for(i=t.onRecoverableError,n=0;n<e.length;n++)r=e[n],i(r.value,{componentStack:r.stack,digest:r.digest});if(Gl)throw Gl=!1,t=Hl,Hl=null,t;0!==(1&Kl)&&0!==t.tag&&xc(),o=t.pendingLanes,0!==(1&o)?t===Jl?Yl++:(Yl=0,Jl=t):Yl=0,Vr()}(t,e,n,i)}finally{Pl.transition=r,ve=i}return null}function xc(){if(null!==Xl){var t=be(Kl),e=Pl.transition,n=ve;try{if(Pl.transition=null,ve=16>t?16:t,null===Xl)var i=!1;else{if(t=Xl,Xl=null,Kl=0,0!==(6&Rl))throw Error(s(331));var r=Rl;for(Rl|=4,Qa=t.current;null!==Qa;){var o=Qa,a=o.child;if(0!==(16&Qa.flags)){var l=o.deletions;if(null!==l){for(var c=0;c<l.length;c++){var u=l[c];for(Qa=u;null!==Qa;){var h=Qa;switch(h.tag){case 0:case 11:case 15:il(8,h,o)}var d=h.child;if(null!==d)d.return=h,Qa=d;else for(;null!==Qa;){var p=(h=Qa).sibling,f=h.return;if(ol(h),h===u){Qa=null;break}if(null!==p){p.return=f,Qa=p;break}Qa=f}}}var g=o.alternate;if(null!==g){var m=g.child;if(null!==m){g.child=null;do{var _=m.sibling;m.sibling=null,m=_}while(null!==m)}}Qa=o}}if(0!==(2064&o.subtreeFlags)&&null!==a)a.return=o,Qa=a;else t:for(;null!==Qa;){if(0!==(2048&(o=Qa).flags))switch(o.tag){case 0:case 11:case 15:il(9,o,o.return)}var y=o.sibling;if(null!==y){y.return=o.return,Qa=y;break t}Qa=o.return}}var v=t.current;for(Qa=v;null!==Qa;){var b=(a=Qa).child;if(0!==(2064&a.subtreeFlags)&&null!==b)b.return=a,Qa=b;else t:for(a=v;null!==Qa;){if(0!==(2048&(l=Qa).flags))try{switch(l.tag){case 0:case 11:case 15:rl(9,l)}}catch(E){Tc(l,l.return,E)}if(l===a){Qa=null;break t}var w=l.sibling;if(null!==w){w.return=l.return,Qa=w;break t}Qa=l.return}}if(Rl=r,Vr(),se&&"function"===typeof se.onPostCommitFiberRoot)try{se.onPostCommitFiberRoot(re,t)}catch(E){}i=!0}return i}finally{ve=n,Pl.transition=e}}return!1}function Sc(t,e,n){t=Ns(t,e=fa(0,e=ua(n,e),1),1),e=ec(),null!==t&&(_e(t,1,e),rc(t,e))}function Tc(t,e,n){if(3===t.tag)Sc(t,t,n);else for(;null!==e;){if(3===e.tag){Sc(e,t,n);break}if(1===e.tag){var i=e.stateNode;if("function"===typeof e.type.getDerivedStateFromError||"function"===typeof i.componentDidCatch&&(null===ql||!ql.has(i))){e=Ns(e,t=ga(e,t=ua(n,t),1),1),t=ec(),null!==e&&(_e(e,1,t),rc(e,t));break}}e=e.return}}function Cc(t,e,n){var i=t.pingCache;null!==i&&i.delete(e),e=ec(),t.pingedLanes|=t.suspendedLanes&n,Ml===t&&(Ll&n)===n&&(4===Ol||3===Ol&&(130023424&Ll)===Ll&&500>Yt()-Vl?pc(t,0):Ul|=n),rc(t,e)}function Ac(t,e){0===e&&(0===(1&t.mode)?e=1:(e=ue,0===(130023424&(ue<<=1))&&(ue=4194304)));var n=ec();null!==(t=Rs(t,e))&&(_e(t,e,n),rc(t,n))}function Pc(t){var e=t.memoizedState,n=0;null!==e&&(n=e.retryLane),Ac(t,n)}function Rc(t,e){var n=0;switch(t.tag){case 13:var i=t.stateNode,r=t.memoizedState;null!==r&&(n=r.retryLane);break;case 19:i=t.stateNode;break;default:throw Error(s(314))}null!==i&&i.delete(e),Ac(t,n)}function Mc(t,e){return qt(t,e)}function Ic(t,e,n,i){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Lc(t,e,n,i){return new Ic(t,e,n,i)}function kc(t){return!(!(t=t.prototype)||!t.isReactComponent)}function Nc(t,e){var n=t.alternate;return null===n?((n=Lc(t.tag,e,t.key,t.mode)).elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&t.flags,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Oc(t,e,n,i,r,o){var a=2;if(i=t,"function"===typeof t)kc(t)&&(a=1);else if("string"===typeof t)a=5;else t:switch(t){case x:return Dc(n.children,r,o,e);case S:a=8,r|=8;break;case T:return(t=Lc(12,n,e,2|r)).elementType=T,t.lanes=o,t;case R:return(t=Lc(13,n,e,r)).elementType=R,t.lanes=o,t;case M:return(t=Lc(19,n,e,r)).elementType=M,t.lanes=o,t;case k:return Fc(n,r,o,e);default:if("object"===typeof t&&null!==t)switch(t.$$typeof){case C:a=10;break t;case A:a=9;break t;case P:a=11;break t;case I:a=14;break t;case L:a=16,i=null;break t}throw Error(s(130,null==t?t:typeof t,""))}return(e=Lc(a,n,e,r)).elementType=t,e.type=i,e.lanes=o,e}function Dc(t,e,n,i){return(t=Lc(7,t,i,e)).lanes=n,t}function Fc(t,e,n,i){return(t=Lc(22,t,i,e)).elementType=k,t.lanes=n,t.stateNode={isHidden:!1},t}function Bc(t,e,n){return(t=Lc(6,t,null,e)).lanes=n,t}function Uc(t,e,n){return(e=Lc(4,null!==t.children?t.children:[],t.key,e)).lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function zc(t,e,n,i,r){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=me(0),this.expirationTimes=me(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=me(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function jc(t,e,n,i,r,s,o,a,l){return t=new zc(t,e,n,a,l),1===e?(e=1,!0===s&&(e|=8)):e=0,s=Lc(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:i,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Is(s),t}function Vc(t){if(!t)return Ar;t:{if(Vt(t=t._reactInternals)!==t||1!==t.tag)throw Error(s(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break t;case 1:if(Lr(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break t}}e=e.return}while(null!==e);throw Error(s(171))}if(1===t.tag){var n=t.type;if(Lr(n))return Or(t,n,e)}return e}function Wc(t,e,n,i,r,s,o,a,l){return(t=jc(n,i,!0,t,0,s,0,a,l)).context=Vc(null),n=t.current,(s=ks(i=ec(),r=nc(n))).callback=void 0!==e&&null!==e?e:null,Ns(n,s,r),t.current.lanes=r,_e(t,r,i),rc(t,i),t}function $c(t,e,n,i){var r=e.current,s=ec(),o=nc(r);return n=Vc(n),null===e.context?e.context=n:e.pendingContext=n,(e=ks(s,o)).payload={element:t},null!==(i=void 0===i?null:i)&&(e.callback=i),null!==(t=Ns(r,e,o))&&(ic(t,r,o,s),Os(t,r,o)),o}function Gc(t){return(t=t.current).child?(t.child.tag,t.child.stateNode):null}function Hc(t,e){if(null!==(t=t.memoizedState)&&null!==t.dehydrated){var n=t.retryLane;t.retryLane=0!==n&&n<e?n:e}}function qc(t,e){Hc(t,e),(t=t.alternate)&&Hc(t,e)}Sl=function(t,e,n){if(null!==t)if(t.memoizedProps!==e.pendingProps||Rr.current)ba=!0;else{if(0===(t.lanes&n)&&0===(128&e.flags))return ba=!1,function(t,e,n){switch(e.tag){case 3:Ma(e),ps();break;case 5:so(e);break;case 1:Lr(e.type)&&Dr(e);break;case 4:io(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;Cr(_s,i._currentValue),i._currentValue=r;break;case 13:if(null!==(i=e.memoizedState))return null!==i.dehydrated?(Cr(ao,1&ao.current),e.flags|=128,null):0!==(n&e.child.childLanes)?Ba(t,e,n):(Cr(ao,1&ao.current),null!==(t=Ga(t,e,n))?t.sibling:null);Cr(ao,1&ao.current);break;case 19:if(i=0!==(n&e.childLanes),0!==(128&t.flags)){if(i)return Wa(t,e,n);e.flags|=128}if(null!==(r=e.memoizedState)&&(r.rendering=null,r.tail=null,r.lastEffect=null),Cr(ao,ao.current),i)break;return null;case 22:case 23:return e.lanes=0,Ta(t,e,n)}return Ga(t,e,n)}(t,e,n);ba=0!==(131072&t.flags)}else ba=!1,rs&&0!==(1048576&e.flags)&&Qr(e,Hr,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;$a(t,e),t=e.pendingProps;var r=Ir(e,Pr.current);Ss(e,n),r=So(null,e,i,t,r,n);var o=To();return e.flags|=1,"object"===typeof r&&null!==r&&"function"===typeof r.render&&void 0===r.$$typeof?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Lr(i)?(o=!0,Dr(e)):o=!1,e.memoizedState=null!==r.state&&void 0!==r.state?r.state:null,Is(e),r.updater=js,e.stateNode=r,r._reactInternals=e,Gs(e,i,t,n),e=Ra(null,e,i,!0,o,n)):(e.tag=0,rs&&o&&ts(e),wa(null,e,r,n),e=e.child),e;case 16:i=e.elementType;t:{switch($a(t,e),t=e.pendingProps,i=(r=i._init)(i._payload),e.type=i,r=e.tag=function(t){if("function"===typeof t)return kc(t)?1:0;if(void 0!==t&&null!==t){if((t=t.$$typeof)===P)return 11;if(t===I)return 14}return 2}(i),t=ms(i,t),r){case 0:e=Aa(null,e,i,t,n);break t;case 1:e=Pa(null,e,i,t,n);break t;case 11:e=Ea(null,e,i,t,n);break t;case 14:e=xa(null,e,i,ms(i.type,t),n);break t}throw Error(s(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,Aa(t,e,i,r=e.elementType===i?r:ms(i,r),n);case 1:return i=e.type,r=e.pendingProps,Pa(t,e,i,r=e.elementType===i?r:ms(i,r),n);case 3:t:{if(Ma(e),null===t)throw Error(s(387));i=e.pendingProps,r=(o=e.memoizedState).element,Ls(t,e),Fs(e,i,null,n);var a=e.memoizedState;if(i=a.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=o,e.memoizedState=o,256&e.flags){e=Ia(t,e,i,n,r=ua(Error(s(423)),e));break t}if(i!==r){e=Ia(t,e,i,n,r=ua(Error(s(424)),e));break t}for(is=cr(e.stateNode.containerInfo.firstChild),ns=e,rs=!0,ss=null,n=Ys(e,null,i,n),e.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(ps(),i===r){e=Ga(t,e,n);break t}wa(t,e,i,n)}e=e.child}return e;case 5:return so(e),null===t&&cs(e),i=e.type,r=e.pendingProps,o=null!==t?t.memoizedProps:null,a=r.children,nr(i,r)?a=null:null!==o&&nr(i,o)&&(e.flags|=32),Ca(t,e),wa(t,e,a,n),e.child;case 6:return null===t&&cs(e),null;case 13:return Ba(t,e,n);case 4:return io(e,e.stateNode.containerInfo),i=e.pendingProps,null===t?e.child=Ks(e,null,i,n):wa(t,e,i,n),e.child;case 11:return i=e.type,r=e.pendingProps,Ea(t,e,i,r=e.elementType===i?r:ms(i,r),n);case 7:return wa(t,e,e.pendingProps,n),e.child;case 8:case 12:return wa(t,e,e.pendingProps.children,n),e.child;case 10:t:{if(i=e.type._context,r=e.pendingProps,o=e.memoizedProps,a=r.value,Cr(_s,i._currentValue),i._currentValue=a,null!==o)if(ai(o.value,a)){if(o.children===r.children&&!Rr.current){e=Ga(t,e,n);break t}}else for(null!==(o=e.child)&&(o.return=e);null!==o;){var l=o.dependencies;if(null!==l){a=o.child;for(var c=l.firstContext;null!==c;){if(c.context===i){if(1===o.tag){(c=ks(-1,n&-n)).tag=2;var u=o.updateQueue;if(null!==u){var h=(u=u.shared).pending;null===h?c.next=c:(c.next=h.next,h.next=c),u.pending=c}}o.lanes|=n,null!==(c=o.alternate)&&(c.lanes|=n),xs(o.return,n,e),l.lanes|=n;break}c=c.next}}else if(10===o.tag)a=o.type===e.type?null:o.child;else if(18===o.tag){if(null===(a=o.return))throw Error(s(341));a.lanes|=n,null!==(l=a.alternate)&&(l.lanes|=n),xs(a,n,e),a=o.sibling}else a=o.child;if(null!==a)a.return=o;else for(a=o;null!==a;){if(a===e){a=null;break}if(null!==(o=a.sibling)){o.return=a.return,a=o;break}a=a.return}o=a}wa(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Ss(e,n),i=i(r=Ts(r)),e.flags|=1,wa(t,e,i,n),e.child;case 14:return r=ms(i=e.type,e.pendingProps),xa(t,e,i,r=ms(i.type,r),n);case 15:return Sa(t,e,e.type,e.pendingProps,n);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ms(i,r),$a(t,e),e.tag=1,Lr(i)?(t=!0,Dr(e)):t=!1,Ss(e,n),Ws(e,i,r),Gs(e,i,r,n),Ra(null,e,i,!0,t,n);case 19:return Wa(t,e,n);case 22:return Ta(t,e,n)}throw Error(s(156,e.tag))};var Zc="function"===typeof reportError?reportError:function(t){console.error(t)};function Xc(t){this._internalRoot=t}function Kc(t){this._internalRoot=t}function Yc(t){return!(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)}function Jc(t){return!(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType&&(8!==t.nodeType||" react-mount-point-unstable "!==t.nodeValue))}function Qc(){}function tu(t,e,n,i,r){var s=n._reactRootContainer;if(s){var o=s;if("function"===typeof r){var a=r;r=function(){var t=Gc(o);a.call(t)}}$c(e,o,t,r)}else o=function(t,e,n,i,r){if(r){if("function"===typeof i){var s=i;i=function(){var t=Gc(o);s.call(t)}}var o=Wc(e,i,t,0,null,!1,0,"",Qc);return t._reactRootContainer=o,t[fr]=o.current,Vi(8===t.nodeType?t.parentNode:t),hc(),o}for(;r=t.lastChild;)t.removeChild(r);if("function"===typeof i){var a=i;i=function(){var t=Gc(l);a.call(t)}}var l=jc(t,0,!1,null,0,!1,0,"",Qc);return t._reactRootContainer=l,t[fr]=l.current,Vi(8===t.nodeType?t.parentNode:t),hc((function(){$c(e,l,n,i)})),l}(n,e,t,r,i);return Gc(o)}Kc.prototype.render=Xc.prototype.render=function(t){var e=this._internalRoot;if(null===e)throw Error(s(409));$c(t,e,null,null)},Kc.prototype.unmount=Xc.prototype.unmount=function(){var t=this._internalRoot;if(null!==t){this._internalRoot=null;var e=t.containerInfo;hc((function(){$c(null,t,null,null)})),e[fr]=null}},Kc.prototype.unstable_scheduleHydration=function(t){if(t){var e=Se();t={blockedOn:null,target:t,priority:e};for(var n=0;n<ke.length&&0!==e&&e<ke[n].priority;n++);ke.splice(n,0,t),0===n&&Fe(t)}},we=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=he(e.pendingLanes);0!==n&&(ye(e,1|n),rc(e,Yt()),0===(6&Rl)&&(Wl=Yt()+500,Vr()))}break;case 13:hc((function(){var e=Rs(t,1);if(null!==e){var n=ec();ic(e,t,1,n)}})),qc(t,1)}},Ee=function(t){if(13===t.tag){var e=Rs(t,134217728);if(null!==e)ic(e,t,134217728,ec());qc(t,134217728)}},xe=function(t){if(13===t.tag){var e=nc(t),n=Rs(t,e);if(null!==n)ic(n,t,e,ec());qc(t,e)}},Se=function(){return ve},Te=function(t,e){var n=ve;try{return ve=t,e()}finally{ve=n}},Et=function(t,e,n){switch(e){case"input":if(J(t,n),e=n.name,"radio"===n.type&&null!=e){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var i=n[e];if(i!==t&&i.form===t.form){var r=wr(i);if(!r)throw Error(s(90));q(i),J(i,r)}}}break;case"textarea":st(t,n);break;case"select":null!=(e=n.value)&&nt(t,!!n.multiple,e,!1)}},Pt=uc,Rt=hc;var eu={usingClientEntryPoint:!1,Events:[vr,br,wr,Ct,At,uc]},nu={findFiberByHostInstance:yr,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},iu={bundleType:nu.bundleType,version:nu.version,rendererPackageName:nu.rendererPackageName,rendererConfig:nu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:b.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return null===(t=Gt(t))?null:t.stateNode},findFiberByHostInstance:nu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ru=__REACT_DEVTOOLS_GLOBAL_HOOK__;
vendor: 4,526 bytes, line 2
2if(!ru.isDisabled&&ru.supportsFiber)try{re=ru.inject(iu),se=ru}catch(ut){}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eu,e.createPortal=function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Yc(e))throw Error(s(200));return function(t,e,n){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:E,key:null==i?null:""+i,children:t,containerInfo:e,implementation:n}}(t,e,null,n)},e.createRoot=function(t,e){if(!Yc(t))throw Error(s(299));var n=!1,i="",r=Zc;return null!==e&&void 0!==e&&(!0===e.unstable_strictMode&&(n=!0),void 0!==e.identifierPrefix&&(i=e.identifierPrefix),void 0!==e.onRecoverableError&&(r=e.onRecoverableError)),e=jc(t,1,!1,null,0,n,0,i,r),t[fr]=e.current,Vi(8===t.nodeType?t.parentNode:t),new Xc(e)},e.findDOMNode=function(t){if(null==t)return null;if(1===t.nodeType)return t;var e=t._reactInternals;if(void 0===e){if("function"===typeof t.render)throw Error(s(188));throw t=Object.keys(t).join(","),Error(s(268,t))}return t=null===(t=Gt(e))?null:t.stateNode},e.flushSync=function(t){return hc(t)},e.hydrate=function(t,e,n){if(!Jc(e))throw Error(s(200));return tu(null,t,e,!0,n)},e.hydrateRoot=function(t,e,n){if(!Yc(t))throw Error(s(405));var i=null!=n&&n.hydratedSources||null,r=!1,o="",a=Zc;if(null!==n&&void 0!==n&&(!0===n.unstable_strictMode&&(r=!0),void 0!==n.identifierPrefix&&(o=n.identifierPrefix),void 0!==n.onRecoverableError&&(a=n.onRecoverableError)),e=Wc(e,null,t,1,null!=n?n:null,r,0,o,a),t[fr]=e.current,Vi(t),i)for(t=0;t<i.length;t++)r=(r=(n=i[t])._getVersion)(n._source),null==e.mutableSourceEagerHydrationData?e.mutableSourceEagerHydrationData=[n,r]:e.mutableSourceEagerHydrationData.push(n,r);return new Kc(e)},e.render=function(t,e,n){if(!Jc(e))throw Error(s(200));return tu(null,t,e,!1,n)},e.unmountComponentAtNode=function(t){if(!Jc(t))throw Error(s(40));return!!t._reactRootContainer&&(hc((function(){tu(null,null,t,!1,(function(){t._reactRootContainer=null,t[fr]=null}))})),!0)},e.unstable_batchedUpdates=uc,e.unstable_renderSubtreeIntoContainer=function(t,e,n,i){if(!Jc(n))throw Error(s(200));if(null==t||void 0===t._reactInternals)throw Error(s(38));return tu(t,e,n,!1,i)},e.version="18.2.0-next-9e3b772b8-20220608"},128:(t,e,n)=>{"use strict";var i=n(775);e.createRoot=i.createRoot,e.hydrateRoot=i.hydrateRoot},775:(t,e,n)=>{"use strict";!function t(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}(),t.exports=n(441)},302:(t,e,n)=>{"use strict";var i=n(94),r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(t,e,n){var i,s={},c=null,u=null;for(i in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(u=e.ref),e)o.call(e,i)&&!l.hasOwnProperty(i)&&(s[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps)void 0===s[i]&&(s[i]=e[i]);return{$$typeof:r,type:t,key:c,ref:u,props:s,_owner:a.current}}e.Fragment=s,e.jsx=c,e.jsxs=c},905:(t,e)=>{"use strict";var n=Symbol.for("react.element"),i=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.iterator;var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,m={};function _(t,e,n){this.props=t,this.context=e,this.refs=m,this.updater=n||f}function y(){}function v(t,e,n){this.props=t,this.context=e,this.refs=m,this.updater=n||f}_.prototype.isReactComponent={},_.prototype.setState=function(t,e){if("object"!==typeof t&&"function"!==typeof t&&null!=t)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")},_.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")},y.prototype=_.prototype;var b=v.prototype=new y;b.constructor=v,g(b,_.prototype),b.isPureReactComponent=!0;var w=Array.isArray,E=Object.prototype.hasOwnProperty,x={current:null},S={key:!0,ref:!0,__self:!0,__source:!0};function T(t,e,i){var r,s={},o=null,a=null;
vendor: 9,031 bytes, line 2
2if(null!=e)for(r in void 0!==e.ref&&(a=e.ref),void 0!==e.key&&(o=""+e.key),e)E.call(e,r)&&!S.hasOwnProperty(r)&&(s[r]=e[r]);var l=arguments.length-2;if(1===l)s.children=i;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(t&&t.defaultProps)for(r in l=t.defaultProps)void 0===s[r]&&(s[r]=l[r]);return{$$typeof:n,type:t,key:o,ref:a,props:s,_owner:x.current}}function C(t){return"object"===typeof t&&null!==t&&t.$$typeof===n}var A=/\/+/g;function P(t,e){return"object"===typeof t&&null!==t&&null!=t.key?function(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,(function(t){return e[t]}))}(""+t.key):e.toString(36)}function R(t,e,r,s,o){var a=typeof t;"undefined"!==a&&"boolean"!==a||(t=null);var l=!1;if(null===t)l=!0;else switch(a){case"string":case"number":l=!0;break;case"object":switch(t.$$typeof){case n:case i:l=!0}}if(l)return o=o(l=t),t=""===s?"."+P(l,0):s,w(o)?(r="",null!=t&&(r=t.replace(A,"$&/")+"/"),R(o,e,r,"",(function(t){return t}))):null!=o&&(C(o)&&(o=function(t,e){return{$$typeof:n,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}(o,r+(!o.key||l&&l.key===o.key?"":(""+o.key).replace(A,"$&/")+"/")+t)),e.push(o)),1;if(l=0,s=""===s?".":s+":",w(t))for(var c=0;c<t.length;c++){var u=s+P(a=t[c],c);l+=R(a,e,r,u,o)}else if(u=function(t){return null===t||"object"!==typeof t?null:"function"===typeof(t=p&&t[p]||t["@@iterator"])?t:null}(t),"function"===typeof u)for(t=u.call(t),c=0;!(a=t.next()).done;)l+=R(a=a.value,e,r,u=s+P(a,c++),o);else if("object"===a)throw e=String(t),Error("Objects are not valid as a React child (found: "+("[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return l}function M(t,e,n){if(null==t)return t;var i=[],r=0;return R(t,i,"","",(function(t){return e.call(n,t,r++)})),i}function I(t){if(-1===t._status){var e=t._result;(e=e()).then((function(e){0!==t._status&&-1!==t._status||(t._status=1,t._result=e)}),(function(e){0!==t._status&&-1!==t._status||(t._status=2,t._result=e)})),-1===t._status&&(t._status=0,t._result=e)}if(1===t._status)return t._result.default;throw t._result}var L={current:null},k={transition:null},N={ReactCurrentDispatcher:L,ReactCurrentBatchConfig:k,ReactCurrentOwner:x};function O(){throw Error("act(...) is not supported in production builds of React.")}e.Children={map:M,forEach:function(t,e,n){M(t,(function(){e.apply(this,arguments)}),n)},count:function(t){var e=0;return M(t,(function(){e++})),e},toArray:function(t){return M(t,(function(t){return t}))||[]},only:function(t){if(!C(t))throw Error("React.Children.only expected to receive a single React element child.");return t}},e.Component=_,e.Fragment=r,e.Profiler=o,e.PureComponent=v,e.StrictMode=s,e.Suspense=u,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=N,e.act=O,e.cloneElement=function(t,e,i){if(null===t||void 0===t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=g({},t.props),s=t.key,o=t.ref,a=t._owner;if(null!=e){if(void 0!==e.ref&&(o=e.ref,a=x.current),void 0!==e.key&&(s=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(c in e)E.call(e,c)&&!S.hasOwnProperty(c)&&(r[c]=void 0===e[c]&&void 0!==l?l[c]:e[c])}var c=arguments.length-2;if(1===c)r.children=i;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:n,type:t.type,key:s,ref:o,props:r,_owner:a}},e.createContext=function(t){return(t={$$typeof:l,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:a,_context:t},t.Consumer=t},e.createElement=T,e.createFactory=function(t){var e=T.bind(null,t);return e.type=t,e},e.createRef=function(){return{current:null}},e.forwardRef=function(t){return{$$typeof:c,render:t}},e.isValidElement=C,e.lazy=function(t){return{$$typeof:d,_payload:{_status:-1,_result:t},_init:I}},e.memo=function(t,e){return{$$typeof:h,type:t,compare:void 0===e?null:e}},e.startTransition=function(t){var e=k.transition;k.transition={};try{t()}finally{k.transition=e}},e.unstable_act=O,e.useCallback=function(t,e){return L.current.useCallback(t,e)},e.useContext=function(t){return L.current.useContext(t)},e.useDebugValue=function(){},e.useDeferredValue=function(t){return L.current.useDeferredValue(t)},e.useEffect=function(t,e){return L.current.useEffect(t,e)},e.useId=function(){return L.current.useId()},e.useImperativeHandle=function(t,e,n){return L.current.useImperativeHandle(t,e,n)},e.useInsertionEffect=function(t,e){return L.current.useInsertionEffect(t,e)},e.useLayoutEffect=function(t,e){return L.current.useLayoutEffect(t,e)},e.useMemo=function(t,e){return L.current.useMemo(t,e)},e.useReducer=function(t,e,n){return L.current.useReducer(t,e,n)},e.useRef=function(t){return L.current.useRef(t)},e.useState=function(t){return L.current.useState(t)},e.useSyncExternalStore=function(t,e,n){return L.current.useSyncExternalStore(t,e,n)},e.useTransition=function(){return L.current.useTransition()},e.version="18.3.1"},94:(t,e,n)=>{"use strict";t.exports=n(905)},678:(t,e,n)=>{"use strict";t.exports=n(302)},833:(t,e)=>{"use strict";function n(t,e){var n=t.length;t.push(e);t:for(;0<n;){var i=n-1>>>1,r=t[i];if(!(0<s(r,e)))break t;t[i]=e,t[n]=r,n=i}}function i(t){return 0===t.length?null:t[0]}function r(t){if(0===t.length)return null;var e=t[0],n=t.pop();if(n!==e){t[0]=n;t:for(var i=0,r=t.length,o=r>>>1;i<o;){var a=2*(i+1)-1,l=t[a],c=a+1,u=t[c];if(0>s(l,n))c<r&&0>s(u,l)?(t[i]=u,t[c]=n,i=c):(t[i]=l,t[a]=n,i=a);else{if(!(c<r&&0>s(u,n)))break t;t[i]=u,t[c]=n,i=c}}}return e}function s(t,e){var n=t.sortIndex-e.sortIndex;return 0!==n?n:t.id-e.id}if("object"===typeof performance&&"function"===typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],h=1,d=null,p=3,f=!1,g=!1,m=!1,_="function"===typeof setTimeout?setTimeout:null,y="function"===typeof clearTimeout?clearTimeout:null,v="undefined"!==typeof setImmediate?setImmediate:null;function b(t){for(var e=i(u);null!==e;){if(null===e.callback)r(u);else{if(!(e.startTime<=t))break;r(u),e.sortIndex=e.expirationTime,n(c,e)}e=i(u)}}function w(t){if(m=!1,b(t),!g)if(null!==i(c))g=!0,k(E);else{var e=i(u);null!==e&&N(w,e.startTime-t)}}function E(t,n){g=!1,m&&(m=!1,y(C),C=-1),f=!0;var s=p;try{for(b(n),d=i(c);null!==d&&(!(d.expirationTime>n)||t&&!R());){var o=d.callback;if("function"===typeof o){d.callback=null,p=d.priorityLevel;var a=o(d.expirationTime<=n);n=e.unstable_now(),"function"===typeof a?d.callback=a:d===i(c)&&r(c),b(n)}else r(c);d=i(c)}if(null!==d)var l=!0;else{var h=i(u);null!==h&&N(w,h.startTime-n),l=!1}return l}finally{d=null,p=s,f=!1}}"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var x,S=!1,T=null,C=-1,A=5,P=-1;function R(){return!(e.unstable_now()-P<A)}function M(){if(null!==T){var t=e.unstable_now();P=t;var n=!0;try{n=T(!0,t)}finally{n?x():(S=!1,T=null)}}else S=!1}if("function"===typeof v)x=function(){v(M)};else if("undefined"!==typeof MessageChannel){var I=new MessageChannel,L=I.port2;I.port1.onmessage=M,x=function(){L.postMessage(null)}}else x=function(){_(M,0)};function k(t){T=t,S||(S=!0,x())}function N(t,n){C=_((function(){t(e.unstable_now())}),n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(t){t.callback=null},e.unstable_continueExecution=function(){g||f||(g=!0,k(E))},e.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<t?Math.floor(1e3/t):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return i(c)},e.unstable_next=function(t){switch(p){case 1:case 2:case 3:var e=3;break;default:e=p}var n=p;p=e;try{return t()}finally{p=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=p;p=t;try{return e()}finally{p=n}},e.unstable_scheduleCallback=function(t,r,s){var o=e.unstable_now();switch("object"===typeof s&&null!==s?s="number"===typeof(s=s.delay)&&0<s?o+s:o:s=o,t){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return t={id:h++,callback:r,priorityLevel:t,startTime:s,expirationTime:a=s+a,sortIndex:-1},s>o?(t.sortIndex=s,n(u,t),null===i(c)&&t===i(u)&&(m?(y(C),C=-1):m=!0,N(w,s-o))):(t.sortIndex=a,n(c,t),g||f||(g=!0,k(E))),t},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(t){var e=p;return function(){var n=p;p=e;try{return t.apply(this,arguments)}finally{p=n}}}},732:(t,e,n)=>{"use strict";
2t.exports=n(833)},81:t=>{"use strict";var e=function(){};t.exports=e},856:(t,e)=>{var n;!function(){"use strict";var i={}.hasOwnProperty;function r(){for(var t="",e=0;e<arguments.length;e++){var n=arguments[e];n&&(t=o(t,s(n)))}return t}function s(t){if("string"===typeof t||"number"===typeof t)return t;if("object"!==typeof t)return"";if(Array.isArray(t))return r.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var n in t)i.call(t,n)&&t[n]&&(e=o(e,n));return e}function o(t,e){return e?t?t+" "+e:t+e:t}t.exports?(r.default=r,t.exports=r):void 0===(n=function(){return r}.apply(e,[]))||(t.exports=n)}()}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var s=e[i]={exports:{}};return t[i].call(s.exports,s,s.exports,n),s.exports}n.m=t,n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},(()=>{var t,e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__;n.t=function(i,r){if(1&r&&(i=this(i)),8&r)return i;if("object"===typeof i&&i){if(4&r&&i.__esModule)return i;if(16&r&&"function"===typeof i.then)return i}var s=Object.create(null);n.r(s);var o={};t=t||[null,e({}),e([]),e(e)];for(var a=2&r&&i;"object"==typeof a&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach((t=>o[t]=()=>i[t]));return o.default=()=>i,n.d(s,o),s}})(),n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.f={},n.e=t=>Promise.all(Object.keys(n.f).reduce(((e,i)=>(n.f[i](t,e),e)),[])),n.u=t=>"static/js/"+t+".1e8f061d.chunk.js",n.miniCssF=t=>{},n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={},e="live-graphics-duplicate:";n.l=(i,r,s,o)=>{if(t[i])t[i].push(r);else{var a,l;if(void 0!==s)for(var c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var h=c[u];if(h.getAttribute("src")==i||h.getAttribute("data-webpack")==e+s){a=h;break}}a||(l=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,n.nc&&a.setAttribute("nonce",n.nc),a.setAttribute("data-webpack",e+s),a.src=i),t[i]=[r];var d=(e,n)=>{a.onerror=a.onload=null,clearTimeout(p);var r=t[i];if(delete t[i],a.parentNode&&a.parentNode.removeChild(a),r&&r.forEach((t=>t(n))),e)return e(n)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),l&&document.head.appendChild(a)}}})(),n.r=t=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.p="/",(()=>{var t={792:0};n.f.j=(e,i)=>{var r=n.o(t,e)?t[e]:void 0;if(0!==r)if(r)i.push(r[2]);else{var s=new Promise(((n,i)=>r=t[e]=[n,i]));i.push(r[2]=s);var o=n.p+n.u(e),a=new Error;n.l(o,(i=>{if(n.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var s=i&&("load"===i.type?"missing":i.type),o=i&&i.target&&i.target.src;a.message="Loading chunk "+e+" failed.\n("+s+": "+o+")",a.name="ChunkLoadError",a.type=s,a.request=o,r[1](a)}}),"chunk-"+e,e)}};var e=(e,i)=>{var r,s,o=i[0],a=i[1],l=i[2],c=0;if(o.some((e=>0!==t[e]))){for(r in a)n.o(a,r)&&(n.m[r]=a[r]);if(l)l(n)}for(e&&e(i);c<o.length;c++)s=o[c],n.o(t,s)&&t[s]&&t[s][0](),t[s]=0},i=self.webpackChunklive_graphics_duplicate=self.webpackChunklive_graphics_duplicate||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))})(),(()=>{"use strict";var t={};n.r(t),n.d(t,{hasBrowserEnv:()=>QW,hasStandardBrowserEnv:()=>e$,hasStandardBrowserWebWorkerEnv:()=>n$,navigator:()=>t$,origin:()=>i$});var e=n(94),i=n.t(e,2),r=n(128),s=n(678);const o=function(){return(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"align-center",children:"Testing page"}),(0,s.jsxs)("div",{className:"flex-row space-around",children:[(0,s.jsx)("a",{href:"/big-dial",children:"big dial"}),(0,s.jsx)("a",{href:"/monthly-output",children:"monthly output"}),(0,s.jsx)("a",{href:"/comparison-chart",children:"comparison chart"}),(0,s.jsx)("a",{href:"/health-damage",children:"health damage"}),(0,s.jsx)("a",{href:"/detailed-map",children:"detailed map"}),(0,s.jsx)("a",{href:"/global-map",children:"global map"}),(0,s.jsx)("a",{href:"/global-3d",children:"global 3d"}),(0,s.jsx)("a",{href:"/leaflet-map",children:"leaflet map"}),(0,s.jsx)("a",{href:"/sankey-health",children:"sankey health"}),(0,s.jsx)("a",{href:"/iframe-test",children:"iframe test"}),(0,s.jsx)("a",{href:"/map-controller",children:"Panola Map Controller"}),(0,s.jsx)("a",{href:"/dial-controller",children:"Panola Big Dial Controller"}),(0,s.jsx)("a",{href:"/monthly-controller",children:"Panola Monthly Output C
2ontroller"}),(0,s.jsx)("a",{href:"/carbon-map-controller",children:"Panola Carbon Map Controller"})]}),["jackson2","paris","whitepine","panola1","panola2","panola3"].map((t=>(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{children:t}),(0,s.jsxs)("div",{className:"flex-row space-around",children:[(0,s.jsx)("a",{href:`/tennessee/${t}/big-dial`,children:"Big Dial Component"}),(0,s.jsx)("a",{href:`/tennessee/${t}/monthly-output`,children:"Monthly Output"}),(0,s.jsx)("a",{href:"/comparison-chart",children:"comparison chart"}),(0,s.jsx)("a",{href:`/tennessee/${t}/dial-map`,children:"dial map"}),(0,s.jsx)("a",{href:`/tennessee/${t}/carbon-map`,children:"carbon map"}),(0,s.jsx)("a",{href:`/tennessee/${t}/location`,children:"google earth location"})]})]})))]})},a=t=>{let{coordinates:n}=t;const[i,r]=(0,e.useState)({data:null,loading:!0,error:null});return(0,e.useEffect)((()=>{(async()=>{if(n&&!n.loading&&!n.error&&n.lat&&n.lon)try{console.log("\ud83c\udf0d Fetching weather for:",n.lat,n.lon);const t=await fetch(`https://api.openweathermap.org/data/2.5/weather?lat=${n.lat}&lon=${n.lon}&units=imperial&appid=03c641fb2401c9014257bab115dd66ad`);if(!t.ok)throw new Error(`HTTP error: ${t.status}`);const e=await t.json();console.log("\u2705 Weather data received:",e),r({data:{temp:Math.round(e.main.temp),condition:e.weather[0].description,icon:`https://openweathermap.org/img/wn/${e.weather[0].icon}@2x.png`},loading:!1,error:null})}catch($c){console.error("\u274c Error fetching weather:",$c),r({data:null,loading:!1,error:$c.message})}else console.warn("\u23f3 Weather: Waiting for valid coordinates...")})()}),[n]),(0,s.jsx)("div",{className:"weather-container",children:null!==n&&void 0!==n&&n.loading?(0,s.jsxs)("div",{className:"weather-loading",children:[(0,s.jsx)("i",{className:"fa-solid fa-spinner fa-spin"}),"Fetching location..."]}):null!==n&&void 0!==n&&n.error?(0,s.jsxs)("div",{className:"weather-error",children:[(0,s.jsx)("i",{className:"fa-solid fa-triangle-exclamation"}),n.error]}):i.loading?(0,s.jsxs)("div",{className:"weather-loading",children:[(0,s.jsx)("i",{className:"fa-solid fa-spinner fa-spin"}),"Fetching weather..."]}):i.error?(0,s.jsxs)("div",{className:"weather-error",children:[(0,s.jsx)("i",{className:"fa-solid fa-triangle-exclamation"}),i.error]}):i.data?(0,s.jsxs)("div",{className:"weather-info",children:[(0,s.jsx)("img",{src:i.data.icon,alt:"Weather Icon",className:"weather-icon"}),(0,s.jsxs)("div",{className:"weather-details",children:[(0,s.jsxs)("span",{className:"weather-temp",children:[i.data.temp,"\xb0F"]}),(0,s.jsx)("span",{className:"weather-condition",children:i.data.condition})]})]}):null})};var l=n(856),c=n.n(l);const u=["xxl","xl","lg","md","sm","xs"],h="xs",d=e.createContext({prefixes:{},breakpoints:u,minBreakpoint:h}),{Consumer:p,Provider:f}=d;function g(t,n){const{prefixes:i}=(0,e.useContext)(d);return t||i[n]||n}const m=e.forwardRef(((t,e)=>{let{bsPrefix:n,fluid:i=!1,as:r="div",className:o,...a}=t;const l=g(n,"container"),u="string"===typeof i?`-${i}`:"-fluid";return(0,s.jsx)(r,{ref:e,...a,className:c()(o,i?`${l}${u}`:l)})}));m.displayName="Container";const _=m,y=n.p+"static/media/BigDial-DarkGlobe24.c0b920c77c58f2029e71.png",v=n.p+"static/media/BigDial-YellowGlobe24.8c4a12bf7a328cb966bc.png",b=n.p+"static/media/Half-Bright-Globe.1745e05d3dce4b69648b.png";const w=n.p+"static/media/BigDial-BrightCarbon24.d1a4b23da38f8cc7246b790e9a86d2d5.svg",E=n.p+"static/media/Half-Needle.0a02969246c410214214.png",x=n.p+"static/media/Half-Needle-Dark.9fffcd7388a310359e58.png";const S=n.p+"static/media/BigDial-MiddleNeedle02.f1c3fc88ab5f0ac695deff122e32dfe2.svg";const T=n.p+"static/media/Middle-Needle-Dark.35ef4bfd48eec0112390985cd2da9113.svg";const C=n.p+"static/media/BigDial-PowerCallout06.2aef50e484656af62e3d0b4c14907a20.svg";const A=n.p+"static/media/BigDial-CarbonCallout06.6794aa99aece62548968c79f5741ab39.svg";const P=n.p+"static/media/BigDial-Needle03.fc29783214dc6075d0de66a0816c0cd4.svg";const R=n.p+"static/media/BigDial-DarkGlobe04.28a0de2ec1eddd0f0857020d47604e11.svg";const M=n.p+"static/media/BigDial-BrightGlobe06.3f2dea80eb0bf3a86e45150a252ff281.svg";class I extends Map{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:O;if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[n,i]of t)this.set(n,i)}get(t){return super.get(L(this,t))}has(t){return super.has(L(this,t))}set(t,e){return super.set(k(this,t),e)}delete(t){return super.delete(N(this,t))}}Set;function L(t,e){let{_intern:n,_key:i}=t;const r=i(e);return n.has(r)?n.get(r):e}function k(t,e){let{_intern:n,_key:i}=t;const r=i(e);return n.has(r)?n.get(r):(n.set(r,e),e)}function N(t,e){let{_intern:n,_key:i}=t;const r=i(e);return n.has(r)&&(e=n.get(r),n.delete(r)),e}function O(t){return null!==t&&"object"===typeof t?t.valueOf():t}function D(t){return t}function F(t,e,n,i){return function t(r,s){if(s>=i.length)return n(r);const o=new I,a=i[s++];let l=-1;for(const e of r){const t=a(e,++l,r),n=o.get(t);n?n.push(e):o.set(t,[e])}for(const[e,n]of o)o.set(e,t(n,s));return e(o)}(t,0)}function B(t,e){let n;if(void 0===e)for(const i of t)null!=i&&(n<i||void 0===n&&i>=i)&&(n=i);else{let i=-1;for(let r of t)null!=(r=e(r,++i,t))&&(n<r||void 0===n&&r>=r)&&(n=r)}return n}function U(t,e){let n;if(void 0===e)for(const i of t)null!=i&&(n>i||void 0===n&&i>=i)&&(n=i);else{let i=-1;for(let r of t)null!=(r=e(r,++i,t))&&(n>r||void 0===n&&r>=r)&&(n=r)}return n}function z(t){return t}var j=1,V=2,W=3,$=4,G=1e-6;function H(t){return"translate("+t+",0)"}function q(t){return"translate(0,"+t+")"}function Z(t){return e=>+t(e)}function X(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function K(){return!this.__axis}function Y(t,e){var n=[],i=null,r=null,s=6,o=6,a=3,l="undefined"!==typeof window&&window.devicePixelRatio>1?0:.5,c=t===j||t===$?-1:1,u=t===$||t===V?"x":"y",h=t===j||t===W?H:q;function d(d){var p=null==i?e.ticks?e.ticks.apply(e,n):e.domain():i,f=null==r?e.tickFormat?e.tickFormat.apply(e,n):z:r,g=Math.max(s,0)+a,m=e.range(),_=+m[0]+l,y=+m[m.length-1]+l,v=(e.bandwidth?X:Z)(e.copy(),l),b=d.selection?d.selection():d,w=b.selectAll(".domain").data([null]),E=b.selectAll(".tick").data(p,e).order(),x=E.exit(),S=E.enter().append("g").attr("class","tick"),T=E.select("line"),C=E.select("text");
vendor: 5,130 bytes, line 2
2w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),E=E.merge(S),T=T.merge(S.append("line").attr("stroke","currentColor").attr(u+"2",c*s)),C=C.merge(S.append("text").attr("fill","currentColor").attr(u,c*g).attr("dy",t===j?"0em":t===W?"0.71em":"0.32em")),d!==b&&(w=w.transition(d),E=E.transition(d),T=T.transition(d),C=C.transition(d),x=x.transition(d).attr("opacity",G).attr("transform",(function(t){return isFinite(t=v(t))?h(t+l):this.getAttribute("transform")})),S.attr("opacity",G).attr("transform",(function(t){var e=this.parentNode.__axis;return h((e&&isFinite(e=e(t))?e:v(t))+l)}))),x.remove(),w.attr("d",t===$||t===V?o?"M"+c*o+","+_+"H"+l+"V"+y+"H"+c*o:"M"+l+","+_+"V"+y:o?"M"+_+","+c*o+"V"+l+"H"+y+"V"+c*o:"M"+_+","+l+"H"+y),E.attr("opacity",1).attr("transform",(function(t){return h(v(t)+l)})),T.attr(u+"2",c*s),C.attr(u,c*g).text(f),b.filter(K).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===V?"start":t===$?"end":"middle"),b.each((function(){this.__axis=v}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),d):n.slice()},d.tickValues=function(t){return arguments.length?(i=null==t?null:Array.from(t),d):i&&i.slice()},d.tickFormat=function(t){return arguments.length?(r=t,d):r},d.tickSize=function(t){return arguments.length?(s=o=+t,d):s},d.tickSizeInner=function(t){return arguments.length?(s=+t,d):s},d.tickSizeOuter=function(t){return arguments.length?(o=+t,d):o},d.tickPadding=function(t){return arguments.length?(a=+t,d):a},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function J(t){return Y(W,t)}function Q(t){return Y($,t)}function tt(){}function et(t){return null==t?tt:function(){return this.querySelector(t)}}function nt(){return[]}function it(t){return null==t?nt:function(){return this.querySelectorAll(t)}}function rt(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}function st(t){return function(){return this.matches(t)}}function ot(t){return function(e){return e.matches(t)}}var at=Array.prototype.find;function lt(){return this.firstElementChild}var ct=Array.prototype.filter;function ut(){return Array.from(this.children)}function ht(t){return new Array(t.length)}function dt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function pt(t,e,n,i,r,s){for(var o,a=0,l=e.length,c=s.length;a<c;++a)(o=e[a])?(o.__data__=s[a],i[a]=o):n[a]=new dt(t,s[a]);for(;a<l;++a)(o=e[a])&&(r[a]=o)}function ft(t,e,n,i,r,s,o){var a,l,c,u=new Map,h=e.length,d=s.length,p=new Array(h);for(a=0;a<h;++a)(l=e[a])&&(p[a]=c=o.call(l,l.__data__,a,e)+"",u.has(c)?r[a]=l:u.set(c,l));for(a=0;a<d;++a)c=o.call(t,s[a],a,s)+"",(l=u.get(c))?(i[a]=l,l.__data__=s[a],u.delete(c)):n[a]=new dt(t,s[a]);for(a=0;a<h;++a)(l=e[a])&&u.get(p[a])===l&&(r[a]=l)}function gt(t){return t.__data__}function mt(t){return"object"===typeof t&&"length"in t?t:Array.from(t)}function _t(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}dt.prototype={constructor:dt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var yt="http://www.w3.org/1999/xhtml";const vt={svg:"http://www.w3.org/2000/svg",xhtml:yt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function bt(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),vt.hasOwnProperty(e)?{space:vt[e],local:t}:t}function wt(t){return function(){this.removeAttribute(t)}}function Et(t){return function(){this.removeAttributeNS(t.space,t.local)}}function xt(t,e){return function(){this.setAttribute(t,e)}}function St(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Tt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function Ct(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function At(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Pt(t){return function(){this.style.removeProperty(t)}}function Rt(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Mt(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function It(t,e){return t.style.getPropertyValue(e)||At(t).getComputedStyle(t,null).getPropertyValue(e)}function Lt(t){return function(){delete this[t]}}function kt(t,e){return function(){this[t]=e}}function Nt(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function Ot(t){return t.trim().split(/^|\s+/)}function Dt(t){return t.classList||new Ft(t)}
vendor: 12,380 bytes, line 2
2function Ft(t){this._node=t,this._names=Ot(t.getAttribute("class")||"")}function Bt(t,e){for(var n=Dt(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function Ut(t,e){for(var n=Dt(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function zt(t){return function(){Bt(this,t)}}function jt(t){return function(){Ut(this,t)}}function Vt(t,e){return function(){(e.apply(this,arguments)?Bt:Ut)(this,t)}}function Wt(){this.textContent=""}function $t(t){return function(){this.textContent=t}}function Gt(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Ht(){this.innerHTML=""}function qt(t){return function(){this.innerHTML=t}}function Zt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Xt(){this.nextSibling&&this.parentNode.appendChild(this)}function Kt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Yt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===yt&&e.documentElement.namespaceURI===yt?e.createElement(t):e.createElementNS(n,t)}}function Jt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Qt(t){var e=bt(t);return(e.local?Jt:Yt)(e)}function te(){return null}function ee(){var t=this.parentNode;t&&t.removeChild(this)}function ne(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ie(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function re(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,s=e.length;i<s;++i)n=e[i],t.type&&n.type!==t.type||n.name!==t.name?e[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?e.length=r:delete this.__on}}}function se(t,e,n){return function(){var i,r=this.__on,s=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(r)for(var o=0,a=r.length;o<a;++o)if((i=r[o]).type===t.type&&i.name===t.name)return this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),void(i.value=e);this.addEventListener(t.type,s,n),i={type:t.type,name:t.name,value:e,listener:s,options:n},r?r.push(i):this.__on=[i]}}function oe(t,e,n){var i=At(t),r=i.CustomEvent;"function"===typeof r?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function ae(t,e){return function(){return oe(this,t,e)}}function le(t,e){return function(){return oe(this,t,e.apply(this,arguments))}}Ft.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var ce=[null];function ue(t,e){this._groups=t,this._parents=e}function he(){return new ue([[document.documentElement]],ce)}ue.prototype=he.prototype={constructor:ue,select:function(t){"function"!==typeof t&&(t=et(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s,o,a=e[r],l=a.length,c=i[r]=new Array(l),u=0;u<l;++u)(s=a[u])&&(o=t.call(s,s.__data__,u,a))&&("__data__"in s&&(o.__data__=s.__data__),c[u]=o);return new ue(i,this._parents)},selectAll:function(t){t="function"===typeof t?rt(t):it(t);for(var e=this._groups,n=e.length,i=[],r=[],s=0;s<n;++s)for(var o,a=e[s],l=a.length,c=0;c<l;++c)(o=a[c])&&(i.push(t.call(o,o.__data__,c,a)),r.push(o));return new ue(i,r)},selectChild:function(t){return this.select(null==t?lt:function(t){return function(){return at.call(this.children,t)}}("function"===typeof t?t:ot(t)))},selectChildren:function(t){return this.selectAll(null==t?ut:function(t){return function(){return ct.call(this.children,t)}}("function"===typeof t?t:ot(t)))},filter:function(t){"function"!==typeof t&&(t=st(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s,o=e[r],a=o.length,l=i[r]=[],c=0;c<a;++c)(s=o[c])&&t.call(s,s.__data__,c,o)&&l.push(s);return new ue(i,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,gt);var n,i=e?ft:pt,r=this._parents,s=this._groups;"function"!==typeof t&&(n=t,t=function(){return n});for(var o=s.length,a=new Array(o),l=new Array(o),c=new Array(o),u=0;u<o;++u){var h=r[u],d=s[u],p=d.length,f=mt(t.call(h,h&&h.__data__,u,r)),g=f.length,m=l[u]=new Array(g),_=a[u]=new Array(g);i(h,d,m,_,c[u]=new Array(p),f,e);for(var y,v,b=0,w=0;b<g;++b)if(y=m[b]){for(b>=w&&(w=b+1);!(v=_[w])&&++w<g;);y._next=v||null}}return(a=new ue(a,r))._enter=l,a._exit=c,a},enter:function(){return new ue(this._enter||this._groups.map(ht),this._parents)},exit:function(){return new ue(this._exit||this._groups.map(ht),this._parents)},join:function(t,e,n){var i=this.enter(),r=this,s=this.exit();return"function"===typeof t?(i=t(i))&&(i=i.selection()):i=i.append(t+""),null!=e&&(r=e(r))&&(r=r.selection()),null==n?s.remove():n(s),i&&r?i.merge(r).order():r},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,r=n.length,s=i.length,o=Math.min(r,s),a=new Array(r),l=0;l<o;++l)for(var c,u=n[l],h=i[l],d=u.length,p=a[l]=new Array(d),f=0;f<d;++f)(c=u[f]||h[f])&&(p[f]=c);for(;l<r;++l)a[l]=n[l];return new ue(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i,r=t[e],s=r.length-1,o=r[s];--s>=0;)(i=r[s])&&(o&&4^i.compareDocumentPosition(o)&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=_t);for(var n=this._groups,i=n.length,r=new Array(i),s=0;s<i;++s){for(var o,a=n[s],l=a.length,c=r[s]=new Array(l),u=0;u<l;++u)(o=a[u])&&(c[u]=o);c.sort(e)}return new ue(r,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,s=i.length;r<s;++r){var o=i[r];if(o)return o}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r,s=e[n],o=0,a=s.length;o<a;++o)(r=s[o])&&t.call(r,r.__data__,o,s);return this},attr:function(t,e){var n=bt(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==e?n.local?Et:wt:"function"===typeof e?n.local?Ct:Tt:n.local?St:xt)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?Pt:"function"===typeof e?Mt:Rt)(t,e,null==n?"":n)):It(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Lt:"function"===typeof e?Nt:kt)(t,e)):this.node()[t]},classed:function(t,e){var n=Ot(t+"");if(arguments.length<2){for(var i=Dt(this.node()),r=-1,s=n.length;++r<s;)if(!i.contains(n[r]))return!1;return!0}return this.each(("function"===typeof e?Vt:e?zt:jt)(n,e))},text:function(t){return arguments.length?this.each(null==t?Wt:("function"===typeof t?Gt:$t)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Ht:("function"===typeof t?Zt:qt)(t)):this.node().innerHTML},raise:function(){return this.each(Xt)},lower:function(){return this.each(Kt)},append:function(t){var e="function"===typeof t?t:Qt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"===typeof t?t:Qt(t),i=null==e?te:"function"===typeof e?e:et(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)}))},remove:function(){return this.each(ee)},clone:function(t){return this.select(t?ie:ne)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var i,r,s=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),o=s.length;if(!(arguments.length<2)){for(a=e?se:re,i=0;i<o;++i)this.each(a(s[i],e,n));return this}var a=this.node().__on;if(a)for(var l,c=0,u=a.length;c<u;++c)for(i=0,l=a[c];i<o;++i)if((r=s[i]).type===l.type&&r.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"===typeof e?le:ae)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i,r=t[e],s=0,o=r.length;s<o;++s)(i=r[s])&&(yield i)}};const de=he;var pe={value:()=>{}};function fe(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new ge(i)}function ge(t){this._=t}function me(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function _e(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=pe,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}ge.prototype=fe.prototype={constructor:ge,on:function(t,e){var n,i,r=this._,s=(i=r,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!i.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),o=-1,a=s.length;if(!(arguments.length<2)){if(null!=e&&"function"!==typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=s[o]).type)r[n]=_e(r[n],t.name,e);else if(null==e)for(n in r)r[n]=_e(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=s[o]).type)&&(n=me(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new ge(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),s=0;s<n;++s)r[s]=arguments[s+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=0,n=(i=this._[t]).length;s<n;++s)i[s].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,s=i.length;r<s;++r)i[r].value.apply(e,n)}};const ye=fe;var ve,be,we=0,Ee=0,xe=0,Se=1e3,Te=0,Ce=0,Ae=0,Pe="object"===typeof performance&&performance.now?performance:Date,Re="object"===typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Me(){return Ce||(Re(Ie),Ce=Pe.now()+Ae)}function Ie(){Ce=0}function Le(){this._call=this._time=this._next=null}function ke(t,e,n){var i=new Le;return i.restart(t,e,n),i}function Ne(){Ce=(Te=Pe.now())+Ae,we=Ee=0;try{!function(){Me(),++we;for(var t,e=ve;e;)(t=Ce-e._time)>=0&&e._call.call(void 0,t),e=e._next;--we}()}finally{we=0,function(){var t,e,n=ve,i=1/0;for(;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:ve=e);be=t,De(i)}(),Ce=0}}function Oe(){var t=Pe.now(),e=t-Te;e>Se&&(Ae-=e,Te=t)}function De(t){we||(Ee&&(Ee=clearTimeout(Ee)),t-Ce>24?(t<1/0&&(Ee=setTimeout(Ne,t-Pe.now()-Ae)),xe&&(xe=clearInterval(xe))):(xe||(Te=Pe.now(),xe=setInterval(Oe,Se)),we=1,Re(Ne)))}function Fe(t,e,n){var i=new Le;return e=null==e?0:+e,i.restart((n=>{i.stop(),t(n+e)}),e,n),i}Le.prototype=ke.prototype={constructor:Le,restart:function(t,e,n){if("function"!==typeof t)throw new TypeError("callback is not a function");n=(null==n?Me():+n)+(null==e?0:+e),this._next||be===this||(be?be._next=this:ve=this,be=this),this._call=t,this._time=n,De()},stop:function(){this._call&&(this._call=null,this._time=1/0,De())}};var Be=ye("start","end","cancel","interrupt"),Ue=[],ze=0,je=1,Ve=2,We=3,$e=4,Ge=5,He=6;function qe(t,e,n,i,r,s){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var i,r=t.__transition;function s(t){n.state=je,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)}function o(s){var c,u,h,d;if(n.state!==je)return l();for(c in r)if((d=r[c]).name===n.name){if(d.state===We)return Fe(o);d.state===$e?(d.state=He,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[c]):+c<e&&(d.state=He,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[c])}if(Fe((function(){n.state===We&&(n.state=$e,n.timer.restart(a,n.delay,n.time),a(s))})),n.state=Ve,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Ve){for(n.state=We,i=new Array(h=n.tween.length),c=0,u=-1;c<h;++c)(d=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(i[
vendor: 14,849 bytes, line 2
2++u]=d);i.length=u+1}}function a(e){for(var r=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=Ge,1),s=-1,o=i.length;++s<o;)i[s].call(t,r);n.state===Ge&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var i in n.state=He,n.timer.stop(),delete r[e],r)return;delete t.__transition}r[e]=n,n.timer=ke(s,0,n.time)}(t,n,{name:e,index:i,group:r,on:Be,tween:Ue,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:ze})}function Ze(t,e){var n=Ke(t,e);if(n.state>ze)throw new Error("too late; already scheduled");return n}function Xe(t,e){var n=Ke(t,e);if(n.state>We)throw new Error("too late; already running");return n}function Ke(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Ye(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Je,Qe=180/Math.PI,tn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function en(t,e,n,i,r,s){var o,a,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*n+e*i)&&(n-=t*l,i-=e*l),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,l/=a),t*i<e*n&&(t=-t,e=-e,l=-l,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(e,t)*Qe,skewX:Math.atan(l)*Qe,scaleX:o,scaleY:a}}function nn(t,e,n,i){function r(t){return t.length?t.pop()+" ":""}return function(s,o){var a=[],l=[];return s=t(s),o=t(o),function(t,i,r,s,o,a){if(t!==r||i!==s){var l=o.push("translate(",null,e,null,n);a.push({i:l-4,x:Ye(t,r)},{i:l-2,x:Ye(i,s)})}else(r||s)&&o.push("translate("+r+e+s+n)}(s.translateX,s.translateY,o.translateX,o.translateY,a,l),function(t,e,n,s){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),s.push({i:n.push(r(n)+"rotate(",null,i)-2,x:Ye(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(s.rotate,o.rotate,a,l),function(t,e,n,s){t!==e?s.push({i:n.push(r(n)+"skewX(",null,i)-2,x:Ye(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(s.skewX,o.skewX,a,l),function(t,e,n,i,s,o){if(t!==n||e!==i){var a=s.push(r(s)+"scale(",null,",",null,")");o.push({i:a-4,x:Ye(t,n)},{i:a-2,x:Ye(e,i)})}else 1===n&&1===i||s.push(r(s)+"scale("+n+","+i+")")}(s.scaleX,s.scaleY,o.scaleX,o.scaleY,a,l),s=o=null,function(t){for(var e,n=-1,i=l.length;++n<i;)a[(e=l[n]).i]=e.x(t);return a.join("")}}}var rn=nn((function(t){const e=new("function"===typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?tn:en(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),sn=nn((function(t){return null==t?tn:(Je||(Je=document.createElementNS("http://www.w3.org/2000/svg","g")),Je.setAttribute("transform",t),(t=Je.transform.baseVal.consolidate())?en((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):tn)}),", ",")",")");function on(t,e){var n,i;return function(){var r=Xe(this,t),s=r.tween;if(s!==n)for(var o=0,a=(i=n=s).length;o<a;++o)if(i[o].name===e){(i=i.slice()).splice(o,1);break}r.tween=i}}function an(t,e,n){var i,r;if("function"!==typeof n)throw new Error;return function(){var s=Xe(this,t),o=s.tween;if(o!==i){r=(i=o).slice();for(var a={name:e,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===e){r[l]=a;break}l===c&&r.push(a)}s.tween=r}}function ln(t,e,n){var i=t._id;return t.each((function(){var t=Xe(this,i);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return Ke(t,i).value[e]}}function cn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function un(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function hn(){}var dn=.7,pn=1/dn,fn="\\s*([+-]?\\d+)\\s*",gn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_n=/^#([0-9a-f]{3,8})$/,yn=new RegExp(`^rgb\\(${fn},${fn},${fn}\\)$`),vn=new RegExp(`^rgb\\(${mn},${mn},${mn}\\)$`),bn=new RegExp(`^rgba\\(${fn},${fn},${fn},${gn}\\)$`),wn=new RegExp(`^rgba\\(${mn},${mn},${mn},${gn}\\)$`),En=new RegExp(`^hsl\\(${gn},${mn},${mn}\\)$`),xn=new RegExp(`^hsla\\(${gn},${mn},${mn},${gn}\\)$`),Sn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Tn(){return this.rgb().formatHex()}function Cn(){return this.rgb().formatRgb()}function An(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=_n.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Pn(e):3===n?new In(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Rn(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Rn(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=yn.exec(t))?new In(e[1],e[2],e[3],1):(e=vn.exec(t))?new In(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=bn.exec(t))?Rn(e[1],e[2],e[3],e[4]):(e=wn.exec(t))?Rn(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=En.exec(t))?Fn(e[1],e[2]/100,e[3]/100,1):(e=xn.exec(t))?Fn(e[1],e[2]/100,e[3]/100,e[4]):Sn.hasOwnProperty(t)?Pn(Sn[t]):"transparent"===t?new In(NaN,NaN,NaN,0):null}function Pn(t){return new In(t>>16&255,t>>8&255,255&t,1)}function Rn(t,e,n,i){return i<=0&&(t=e=n=NaN),new In(t,e,n,i)}function Mn(t,e,n,i){return 1===arguments.length?((r=t)instanceof hn||(r=An(r)),r?new In((r=r.rgb()).r,r.g,r.b,r.opacity):new In):new In(t,e,n,null==i?1:i);var r}function In(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function Ln(){return`#${Dn(this.r)}${Dn(this.g)}${Dn(this.b)}`}function kn(){const t=Nn(this.opacity);return`${1===t?"rgb(":"rgba("}${On(this.r)}, ${On(this.g)}, ${On(this.b)}${1===t?")":`, ${t})`}`}function Nn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function On(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Dn(t){return((t=On(t))<16?"0":"")+t.toString(16)}function Fn(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new zn(t,e,n,i)}function Bn(t){if(t instanceof zn)return new zn(t.h,t.s,t.l,t.opacity);if(t instanceof hn||(t=An(t)),!t)return new zn;if(t instanceof zn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),s=Math.max(e,n,i),o=NaN,a=s-r,l=(s+r)/2;return a?(o=e===s?(n-i)/a+6*(n<i):n===s?(i-e)/a+2:(e-n)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new zn(o,a,l,t.opacity)}function Un(t,e,n,i){return 1===arguments.length?Bn(t):new zn(t,e,n,null==i?1:i)}function zn(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function jn(t){return(t=(t||0)%360)<0?t+360:t}function Vn(t){return Math.max(0,Math.min(1,t||0))}function Wn(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function $n(t,e,n,i,r){var s=t*t,o=s*t;return((1-3*t+3*s-o)*e+(4-6*s+3*o)*n+(1+3*t+3*s-3*o)*i+o*r)/6}cn(hn,An,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Tn,formatHex:Tn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Bn(this).formatHsl()},formatRgb:Cn,toString:Cn}),cn(In,Mn,un(hn,{brighter(t){return t=null==t?pn:Math.pow(pn,t),new In(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?dn:Math.pow(dn,t),new In(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new In(On(this.r),On(this.g),On(this.b),Nn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ln,formatHex:Ln,formatHex8:function(){return`#${Dn(this.r)}${Dn(this.g)}${Dn(this.b)}${Dn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:kn,toString:kn})),cn(zn,Un,un(hn,{brighter(t){return t=null==t?pn:Math.pow(pn,t),new zn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?dn:Math.pow(dn,t),new zn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new In(Wn(t>=240?t-240:t+120,r,i),Wn(t,r,i),Wn(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new zn(jn(this.h),Vn(this.s),Vn(this.l),Nn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Nn(this.opacity);return`${1===t?"hsl(":"hsla("}${jn(this.h)}, ${100*Vn(this.s)}%, ${100*Vn(this.l)}%${1===t?")":`, ${t})`}`}}));const Gn=t=>()=>t;function Hn(t,e){return function(n){return t+n*e}}function qn(t){return 1===(t=+t)?Zn:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):Gn(isNaN(e)?n:e)}}function Zn(t,e){var n=e-t;return n?Hn(t,n):Gn(isNaN(t)?e:t)}const Xn=function t(e){var n=qn(e);function i(t,e){var i=n((t=Mn(t)).r,(e=Mn(e)).r),r=n(t.g,e.g),s=n(t.b,e.b),o=Zn(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=s(e),t.opacity=o(e),t+""}}return i.gamma=t,i}(1);function Kn(t){return function(e){var n,i,r=e.length,s=new Array(r),o=new Array(r),a=new Array(r);for(n=0;n<r;++n)i=Mn(e[n]),s[n]=i.r||0,o[n]=i.g||0,a[n]=i.b||0;return s=t(s),o=t(o),a=t(a),i.opacity=1,function(t){return i.r=s(t),i.g=o(t),i.b=a(t),i+""}}}Kn((function(t){var e=t.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),r=t[i],s=t[i+1],o=i>0?t[i-1]:2*r-s,a=i<e-1?t[i+2]:2*s-r;return $n((n-i/e)*e,o,r,s,a)}})),Kn((function(t){var e=t.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*e),r=t[(i+e-1)%e],s=t[i%e],o=t[(i+1)%e],a=t[(i+2)%e];return $n((n-i/e)*e,r,s,o,a)}}));var Yn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jn=new RegExp(Yn.source,"g");function Qn(t,e){var n,i,r,s=Yn.lastIndex=Jn.lastIndex=0,o=-1,a=[],l=[];for(t+="",e+="";(n=Yn.exec(t))&&(i=Jn.exec(e));)(r=i.index)>s&&(r=e.slice(s,r),a[o]?a[o]+=r:a[++o]=r),(n=n[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:Ye(n,i)})),s=Jn.lastIndex;return s<e.length&&(r=e.slice(s),a[o]?a[o]+=r:a[++o]=r),a.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,i=0;i<e;++i)a[(n=l[i]).i]=n.x(t);return a.join("")})}function ti(t,e){var n;return("number"===typeof e?Ye:e instanceof An?Xn:(n=An(e))?(e=n,Xn):Qn)(t,e)}function ei(t){return function(){this.removeAttribute(t)}}function ni(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ii(t,e,n){var i,r,s=n+"";return function(){var o=this.getAttribute(t);return o===s?null:o===i?r:r=e(i=o,n)}}function ri(t,e,n){var i,r,s=n+"";return function(){var o=this.getAttributeNS(t.space,t.local);return o===s?null:o===i?r:r=e(i=o,n)}}function si(t,e,n){var i,r,s;return function(){var o,a,l=n(this);if(null!=l)return(o=this.getAttribute(t))===(a=l+"")?null:o===i&&a===r?s:(r=a,s=e(i=o,l));this.removeAttribute(t)}}function oi(t,e,n){var i,r,s;return function(){var o,a,l=n(this);if(null!=l)return(o=this.getAttributeNS(t.space,t.local))===(a=l+"")?null:o===i&&a===r?s:(r=a,s=e(i=o,l));this.removeAttributeNS(t.space,t.local)}}function ai(t,e){var n,i;function r(){var r=e.apply(this,arguments);return r!==i&&(n=(i=r)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,r)),n}return r._value=e,r}function li(t,e){var n,i;function r(){var r=e.apply(this,arguments);return r!==i&&(n=(i=r)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,r)),n}return r._value=e,r}function ci(t,e){return function(){Ze(this,t).delay=+e.apply(this,arguments)}}function ui(t,e){return e=+e,function(){Ze(this,t).delay=e}}function hi(t,e){return function(){Xe(this,t).duration=+e.apply(this,arguments)}}function di(t,e){return e=+e,function(){Xe(this,t).duration=e}}var pi=de.prototype.constructor;function fi(t){return function(){this.style.removeProperty(t)}}var gi=0;function mi(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function _i(){return++gi}var yi=de.prototype;function vi(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}mi.prototype=function(t){return de().transition(t)}.prototype={constructor:mi,select:function(t){var e=this._name,n=this._id;"function"!==typeof t&&(t=et(t));for(var i=this._groups,r=i.length,s=new Array(r),o=0;o<r;++o)for(var a,l,c=i[o],u=c.length,h=s[o]=new Array(u),d=0;d<u;++d)(a=c[d])&&(l=t.call(a,a.__data__,d,c))&&("__data__"in a&&(l.__data__=a.__data__),h[d]=l,qe(h[d],e,n,d,h,Ke(a,n)));return new mi(s,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!==typeof t&&(t=it(t));for(var i=this._groups,r=i.length,s=[],o=[],a=0;a<r;++a)for(var l,c=i[a],u=c.length,h=0;h<u;++h)if(l=c[h]){for(var d,p=t.call(l,l.__data__,h,c),f=Ke(l,n),g=0,m=p.length;g<m;++g)(d=p[g])&&qe(d,e,n,g,p,f);s.push(p),o.push(l)}
vendor: 4,855 bytes, line 2
2return new mi(s,o,e,n)},selectChild:yi.selectChild,selectChildren:yi.selectChildren,filter:function(t){"function"!==typeof t&&(t=st(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s,o=e[r],a=o.length,l=i[r]=[],c=0;c<a;++c)(s=o[c])&&t.call(s,s.__data__,c,o)&&l.push(s);return new mi(i,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,r=n.length,s=Math.min(i,r),o=new Array(i),a=0;a<s;++a)for(var l,c=e[a],u=n[a],h=c.length,d=o[a]=new Array(h),p=0;p<h;++p)(l=c[p]||u[p])&&(d[p]=l);for(;a<i;++a)o[a]=e[a];return new mi(o,this._parents,this._name,this._id)},selection:function(){return new pi(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=_i(),i=this._groups,r=i.length,s=0;s<r;++s)for(var o,a=i[s],l=a.length,c=0;c<l;++c)if(o=a[c]){var u=Ke(o,e);qe(o,t,n,c,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new mi(i,this._parents,t,n)},call:yi.call,nodes:yi.nodes,node:yi.node,size:yi.size,empty:yi.empty,each:yi.each,on:function(t,e){var n=this._id;return arguments.length<2?Ke(this.node(),n).on.on(t):this.each(function(t,e,n){var i,r,s=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Ze:Xe;return function(){var o=s(this,t),a=o.on;a!==i&&(r=(i=a).copy()).on(e,n),o.on=r}}(n,t,e))},attr:function(t,e){var n=bt(t),i="transform"===n?sn:ti;return this.attrTween(t,"function"===typeof e?(n.local?oi:si)(n,i,ln(this,"attr."+t,e)):null==e?(n.local?ni:ei)(n):(n.local?ri:ii)(n,i,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!==typeof e)throw new Error;var i=bt(t);return this.tween(n,(i.local?ai:li)(i,e))},style:function(t,e,n){var i="transform"===(t+="")?rn:ti;return null==e?this.styleTween(t,function(t,e){var n,i,r;return function(){var s=It(this,t),o=(this.style.removeProperty(t),It(this,t));return s===o?null:s===n&&o===i?r:r=e(n=s,i=o)}}(t,i)).on("end.style."+t,fi(t)):"function"===typeof e?this.styleTween(t,function(t,e,n){var i,r,s;return function(){var o=It(this,t),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(t),l=a=It(this,t)),o===l?null:o===i&&l===r?s:(r=l,s=e(i=o,a))}}(t,i,ln(this,"style."+t,e))).each(function(t,e){var n,i,r,s,o="style."+e,a="end."+o;return function(){var l=Xe(this,t),c=l.on,u=null==l.value[o]?s||(s=fi(e)):void 0;c===n&&r===u||(i=(n=c).copy()).on(a,r=u),l.on=i}}(this._id,t)):this.styleTween(t,function(t,e,n){var i,r,s=n+"";return function(){var o=It(this,t);return o===s?null:o===i?r:r=e(i=o,n)}}(t,i,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==e)return this.tween(i,null);if("function"!==typeof e)throw new Error;return this.tween(i,function(t,e,n){var i,r;function s(){var s=e.apply(this,arguments);return s!==r&&(i=(r=s)&&function(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}(t,s,n)),i}return s._value=e,s}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"===typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(ln(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!==typeof t)throw new Error;return this.tween(e,function(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&function(t){return function(e){this.textContent=t.call(this,e)}}(i)),e}return i._value=t,i}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i,r=Ke(this.node(),n).tween,s=0,o=r.length;s<o;++s)if((i=r[s]).name===t)return i.value;return null}return this.each((null==e?on:an)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"===typeof t?ci:ui)(e,t)):Ke(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"===typeof t?hi:di)(e,t)):Ke(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!==typeof e)throw new Error;return function(){Xe(this,t).ease=e}}(e,t)):Ke(this.node(),e).ease},easeVarying:function(t){if("function"!==typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!==typeof n)throw new Error;Xe(this,t).ease=n}}(this._id,t))}
2,end:function(){var t,e,n=this,i=n._id,r=n.size();return new Promise((function(s,o){var a={value:o},l={value:function(){0===--r&&s()}};n.each((function(){var n=Xe(this,i),r=n.on;r!==t&&((e=(t=r).copy())._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),n.on=e})),0===r&&s()}))},[Symbol.iterator]:yi[Symbol.iterator]};var bi={time:null,delay:0,duration:250,ease:vi};function wi(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}de.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var n,i,r,s=t.__transition,o=!0;if(s){for(r in e=null==e?null:e+"",s)(n=s[r]).name===e?(i=n.state>Ve&&n.state<Ge,n.state=He,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete s[r]):o=!1;o&&delete t.__transition}}(this,t)}))},de.prototype.transition=function(t){var e,n;t instanceof mi?(e=t._id,t=t._name):(e=_i(),(n=bi).time=Me(),t=null==t?null:t+"");for(var i=this._groups,r=i.length,s=0;s<r;++s)for(var o,a=i[s],l=a.length,c=0;c<l;++c)(o=a[c])&&qe(o,t,e,c,a,n||wi(o,e));return new mi(i,this._parents,t,e)};const{abs:Ei,max:xi,min:Si}=Math;function Ti(t){return[+t[0],+t[1]]}function Ci(t){return[Ti(t[0]),Ti(t[1])]}["w","e"].map(Ai),["n","s"].map(Ai),["n","w","e","s","nw","ne","sw","se"].map(Ai);function Ai(t){return{type:t}}var Pi={},Ri={};function Mi(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Ii(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var i in t)i in e||n.push(e[i]=i)})),n}function Li(t,e){var n=t+"",i=n.length;return i<e?new Array(e-i+1).join(0)+n:n}function ki(t){var e,n=t.getUTCHours(),i=t.getUTCMinutes(),r=t.getUTCSeconds(),s=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((e=t.getUTCFullYear())<0?"-"+Li(-e,6):e>9999?"+"+Li(e,6):Li(e,4))+"-"+Li(t.getUTCMonth()+1,2)+"-"+Li(t.getUTCDate(),2)+(s?"T"+Li(n,2)+":"+Li(i,2)+":"+Li(r,2)+"."+Li(s,3)+"Z":r?"T"+Li(n,2)+":"+Li(i,2)+":"+Li(r,2)+"Z":i||n?"T"+Li(n,2)+":"+Li(i,2)+"Z":"")}function Ni(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function i(t,e){var i,r=[],s=t.length,o=0,a=0,l=s<=0,c=!1;function u(){if(l)return Ri;if(c)return c=!1,Pi;var e,i,r=o;if(34===t.charCodeAt(r)){for(;o++<s&&34!==t.charCodeAt(o)||34===t.charCodeAt(++o););return(e=o)>=s?l=!0:10===(i=t.charCodeAt(o++))?c=!0:13===i&&(c=!0,10===t.charCodeAt(o)&&++o),t.slice(r+1,e-1).replace(/""/g,'"')}for(;o<s;){if(10===(i=t.charCodeAt(e=o++)))c=!0;else if(13===i)c=!0,10===t.charCodeAt(o)&&++o;else if(i!==n)continue;return t.slice(r,e)}return l=!0,t.slice(r,s)}for(10===t.charCodeAt(s-1)&&--s,13===t.charCodeAt(s-1)&&--s;(i=u())!==Ri;){for(var h=[];i!==Pi&&i!==Ri;)h.push(i),i=u();e&&null==(h=e(h,a++))||r.push(h)}return r}function r(e,n){return e.map((function(e){return n.map((function(t){return o(e[t])})).join(t)}))}function s(e){return e.map(o).join(t)}function o(t){return null==t?"":t instanceof Date?ki(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,r,s=i(t,(function(t,i){if(n)return n(t,i-1);r=t,n=e?function(t,e){var n=Mi(t);return function(i,r){return e(n(i),r,t)}}(t,e):Mi(t)}));return s.columns=r||[],s},parseRows:i,format:function(e,n){return null==n&&(n=Ii(e)),[n.map(o).join(t)].concat(r(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Ii(t)),r(t,e).join("\n")},formatRows:function(t){return t.map(s).join("\n")},formatRow:s,formatValue:o}}var Oi=Ni(","),Di=Oi.parse,Fi=(Oi.parseRows,Oi.format,Oi.formatBody,Oi.formatRows,Oi.formatRow,Oi.formatValue,Ni("\t")),Bi=Fi.parse;Fi.parseRows,Fi.format,Fi.formatBody,Fi.formatRows,Fi.formatRow,Fi.formatValue;function Ui(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function zi(t){return function(e,n,i){return 2===arguments.length&&"function"===typeof n&&(i=n,n=void 0),function(t,e){return fetch(t,e).then(Ui)}(e,n).then((function(e){return t(e,i)}))}}var ji=zi(Di);zi(Bi);function Vi(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function Wi(t,e){return fetch(t,e).then(Vi)}function $i(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>
vendor: 4,254 bytes, line 2
21?i[0]+i.slice(2):i,+t.slice(n+1)]}function Gi(t){return(t=$i(Math.abs(t)))?t[1]:NaN}var Hi,qi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Zi(t){if(!(e=qi.exec(t)))throw new Error("invalid format: "+t);var e;return new Xi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Xi(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Ki(t,e){var n=$i(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}Zi.prototype=Xi.prototype,Xi.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Yi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Ki(100*t,e),r:Ki,s:function(t,e){var n=$i(t,e);if(!n)return t+"";var i=n[0],r=n[1],s=r-(Hi=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+$i(t,Math.max(0,e+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ji(t){return t}var Qi,tr,er,nr=Array.prototype.map,ir=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"];function rr(t){var e,n,i=void 0===t.grouping||void 0===t.thousands?Ji:(e=nr.call(t.grouping,Number),n=t.thousands+"",function(t,i){for(var r=t.length,s=[],o=0,a=e[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>i));)a=e[o=(o+1)%e.length];return s.reverse().join(n)}),r=void 0===t.currency?"":t.currency[0]+"",s=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?Ji:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(nr.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"\u2212":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=Zi(t)).fill,n=t.align,h=t.sign,d=t.symbol,p=t.zero,f=t.width,g=t.comma,m=t.precision,_=t.trim,y=t.type;"n"===y?(g=!0,y="g"):Yi[y]||(void 0===m&&(m=12),_=!0,y="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var v="$"===d?r:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",b="$"===d?s:/[%p]/.test(y)?l:"",w=Yi[y],E=/[defgprs%]/.test(y);function x(t){var r,s,l,d=v,x=b;if("c"===y)x=w(t)+x,t="";else{var S=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:w(Math.abs(t),m),_&&(t=function(t){t:for(var e,n=t.length,i=1,r=-1;i<n;++i)switch(t[i]){case".":r=e=i;break;case"0":0===r&&(r=i),e=i;break;default:if(!+t[i])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),S&&0===+t&&"+"!==h&&(S=!1),d=(S?"("===h?h:c:"-"===h||"("===h?"":h)+d,x=("s"===y?ir[8+Hi/3]:"")+x+(S&&"("===h?")":""),E)for(r=-1,s=t.length;++r<s;)if(48>(l=t.charCodeAt(r))||l>57){x=(46===l?o+t.slice(r+1):t.slice(r))+x,t=t.slice(0,r);break}}g&&!p&&(t=i(t,1/0));var T=d.length+t.length+x.length,C=T<f?new Array(f-T+1).join(e):"";switch(g&&p&&(t=i(C+t,C.length?f-x.length:1/0),C=""),n){case"<":t=d+t+x+C;break;case"=":t=d+C+t+x;break;case"^":t=C.slice(0,T=C.length>>1)+d+t+x+C.slice(T);break;default:t=C+d+t+x}return a(t)}return m=void 0===m?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),x.toString=function(){return t+""},x}return{format:h,formatPrefix:function(t,e){var n=h(((t=Zi(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(Gi(e)/3))),r=Math.pow(10,-i),s=ir[8+i/3];return function(t){return n(r*t)+s}}}}
vendor: 16,684 bytes, line 2
2Qi=rr({thousands:",",grouping:[3],currency:["$",""]}),tr=Qi.format,er=Qi.formatPrefix;const sr=t=>t;function or(t,e){t&&lr.hasOwnProperty(t.type)&&lr[t.type](t,e)}var ar={Feature:function(t,e){or(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,r=n.length;++i<r;)or(n[i].geometry,e)}},lr={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,i=-1,r=n.length;++i<r;)t=n[i],e.point(t[0],t[1],t[2])},LineString:function(t,e){cr(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,i=-1,r=n.length;++i<r;)cr(n[i],e,0)},Polygon:function(t,e){ur(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,i=-1,r=n.length;++i<r;)ur(n[i],e)},GeometryCollection:function(t,e){for(var n=t.geometries,i=-1,r=n.length;++i<r;)or(n[i],e)}};function cr(t,e,n){var i,r=-1,s=t.length-n;for(e.lineStart();++r<s;)i=t[r],e.point(i[0],i[1],i[2]);e.lineEnd()}function ur(t,e){var n=-1,i=t.length;for(e.polygonStart();++n<i;)cr(t[n],e,1);e.polygonEnd()}function hr(t,e){t&&ar.hasOwnProperty(t.type)?ar[t.type](t,e):or(t,e)}class dr{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let i=0;i<this._n&&i<32;i++){const r=e[i],s=t+r,o=Math.abs(t)<Math.abs(r)?t-(s-r):r-(s-t);o&&(e[n++]=o),t=s}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,i,r=this._n,s=0;if(r>0){for(s=t[--r];r>0&&(e=s,n=t[--r],s=e+n,i=n-(s-e),!i););r>0&&(i<0&&t[r-1]<0||i>0&&t[r-1]>0)&&(n=2*i,e=s+n,n==e-s&&(s=e))}return s}}var pr=1e-6,fr=1e-12,gr=Math.PI,mr=gr/2,_r=gr/4,yr=2*gr,vr=180/gr,br=gr/180,wr=Math.abs,Er=Math.atan,xr=Math.atan2,Sr=Math.cos,Tr=(Math.ceil,Math.exp,Math.floor,Math.hypot,Math.log,Math.pow,Math.sin),Cr=Math.sign||function(t){return t>0?1:t<0?-1:0},Ar=Math.sqrt;Math.tan;function Pr(t){return t>1?mr:t<-1?-mr:Math.asin(t)}function Rr(){}var Mr,Ir,Lr,kr,Nr=new dr,Or=new dr,Dr={point:Rr,lineStart:Rr,lineEnd:Rr,polygonStart:function(){Dr.lineStart=Fr,Dr.lineEnd=zr},polygonEnd:function(){Dr.lineStart=Dr.lineEnd=Dr.point=Rr,Nr.add(wr(Or)),Or=new dr},result:function(){var t=Nr/2;return Nr=new dr,t}};function Fr(){Dr.point=Br}function Br(t,e){Dr.point=Ur,Mr=Lr=t,Ir=kr=e}function Ur(t,e){Or.add(kr*t-Lr*e),Lr=t,kr=e}function zr(){Ur(Mr,Ir)}const jr=Dr;var Vr=1/0,Wr=Vr,$r=-Vr,Gr=$r,Hr={point:function(t,e){t<Vr&&(Vr=t);t>$r&&($r=t);e<Wr&&(Wr=e);e>Gr&&(Gr=e)},lineStart:Rr,lineEnd:Rr,polygonStart:Rr,polygonEnd:Rr,result:function(){var t=[[Vr,Wr],[$r,Gr]];return $r=Gr=-(Wr=Vr=1/0),t}};const qr=Hr;var Zr,Xr,Kr,Yr,Jr=0,Qr=0,ts=0,es=0,ns=0,is=0,rs=0,ss=0,os=0,as={point:ls,lineStart:cs,lineEnd:ds,polygonStart:function(){as.lineStart=ps,as.lineEnd=fs},polygonEnd:function(){as.point=ls,as.lineStart=cs,as.lineEnd=ds},result:function(){var t=os?[rs/os,ss/os]:is?[es/is,ns/is]:ts?[Jr/ts,Qr/ts]:[NaN,NaN];return Jr=Qr=ts=es=ns=is=rs=ss=os=0,t}};function ls(t,e){Jr+=t,Qr+=e,++ts}function cs(){as.point=us}function us(t,e){as.point=hs,ls(Kr=t,Yr=e)}function hs(t,e){var n=t-Kr,i=e-Yr,r=Ar(n*n+i*i);es+=r*(Kr+t)/2,ns+=r*(Yr+e)/2,is+=r,ls(Kr=t,Yr=e)}function ds(){as.point=ls}function ps(){as.point=gs}function fs(){ms(Zr,Xr)}function gs(t,e){as.point=ms,ls(Zr=Kr=t,Xr=Yr=e)}function ms(t,e){var n=t-Kr,i=e-Yr,r=Ar(n*n+i*i);es+=r*(Kr+t)/2,ns+=r*(Yr+e)/2,is+=r,rs+=(r=Yr*t-Kr*e)*(Kr+t),ss+=r*(Yr+e),os+=3*r,ls(Kr=t,Yr=e)}const _s=as;function ys(t){this._context=t}ys.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,yr)}},result:Rr};var vs,bs,ws,Es,xs,Ss=new dr,Ts={point:Rr,lineStart:function(){Ts.point=Cs},lineEnd:function(){vs&&As(bs,ws),Ts.point=Rr},polygonStart:function(){vs=!0},polygonEnd:function(){vs=null},result:function(){var t=+Ss;return Ss=new dr,t}};function Cs(t,e){Ts.point=As,bs=Es=t,ws=xs=e}function As(t,e){Es-=t,xs-=e,Ss.add(Ar(Es*Es+xs*xs)),Es=t,xs=e}const Ps=Ts;let Rs,Ms,Is,Ls;class ks{constructor(t){this._append=null==t?Ns:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return Ns;if(e!==Rs){const t=10**e;Rs=e,Ms=function(e){let n=1;this._+=e[0];for(const i=e.length;n<i;++n)this._+=Math.round(arguments[n]*t)/t+e[n]}}return Ms}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,e){switch(this._point){case 0:this._append`M${t},${e}`,this._point=1;break;case 1:this._append`L${t},${e}`;break;default:if(this._append`M${t},${e}`,this._radius!==Is||this._append!==Ms){const t=this._radius,e=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,Is=t,Ms=this._append,Ls=this._,this._=e}this._+=Ls}}result(){const t=this._;return this._="",t.length?t:null}}function Ns(t){let e=1;this._+=t[0];for(const n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function Os(t,e){let n,i,r=3,s=4.5;function o(t){return t&&("function"===typeof s&&i.pointRadius(+s.apply(this,arguments)),hr(t,n(i))),i.result()}return o.area=function(t){return hr(t,n(jr)),jr.result()},o.measure=function(t){return hr(t,n(Ps)),Ps.result()},o.bounds=function(t){return hr(t,n(qr)),qr.result()},o.centroid=function(t){return hr(t,n(_s)),_s.result()},o.projection=function(e){return arguments.length?(n=null==e?(t=null,sr):(t=e).stream,o):t},o.context=function(t){return arguments.length?(i=null==t?(e=null,new ks(r)):new ys(e=t),"function"!==typeof s&&i.pointRadius(s),o):e},o.pointRadius=function(t){return arguments.length?(s="function"===typeof t?t:(i.pointRadius(+t),+t),o):s},o.digits=function(t){if(!arguments.length)return r;if(null==t)r=null;else{const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);r=e}return null===e&&(i=new ks(r)),o},o.projection(t).digits(r).context(e)}function Ds(){var t,e=[];return{point:function(e,n,i){t.push([e,n,i])},lineStart:function(){e.push(t=[])},lineEnd:Rr,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Fs(t,e){return wr(t[0]-e[0])<pr&&wr(t[1]-e[1])<pr}function Bs(t,e,n,i){this.x=t,this.z=e,this.o=n,this.e=i,this.v=!1,this.n=this.p=null}function Us(t,e,n,i,r){var s,o,a=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,i=t[0],o=t[e];if(Fs(i,o)){if(!i[2]&&!o[2]){for(r.lineStart(),s=0;s<e;++s)r.point((i=t[s])[0],i[1]);return void r.lineEnd()}o[0]+=2*pr}a.push(n=new Bs(i,t,null,!0)),l.push(n.o=new Bs(i,null,n,!1)),a.push(n=new Bs(o,t,null,!1)),l.push(n.o=new Bs(o,null,n,!0))}})),a.length){for(l.sort(e),zs(a),zs(l),s=0,o=l.length;s<o;++s)l[s].e=n=!n;for(var c,u,h=a[0];;){for(var d=h,p=!0;d.v;)if((d=d.n)===h)return;c=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(s=0,o=c.length;s<o;++s)r.point((u=c[s])[0],u[1]);else i(d.x,d.n.x,1,r);d=d.n}else{if(p)for(c=d.p.z,s=c.length-1;s>=0;--s)r.point((u=c[s])[0],u[1]);else i(d.x,d.p.x,-1,r);d=d.p}c=(d=d.o).z,p=!p}while(!d.v);r.lineEnd()}}}function zs(t){if(e=t.length){for(var e,n,i=0,r=t[0];++i<e;)r.n=n=t[i],n.p=r,r=n;r.n=n=t[0],n.p=r}}function js(t){return[xr(t[1],t[0]),Pr(t[2])]}function Vs(t){var e=t[0],n=t[1],i=Sr(n);return[i*Sr(e),i*Tr(e),Tr(n)]}function Ws(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function $s(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Gs(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Hs(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function qs(t){var e=Ar(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Zs(t){return wr(t[0])<=gr?t[0]:Cr(t[0])*((wr(t[0])+gr)%yr-gr)}function Xs(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function Ks(t,e,n,i){return function(r){var s,o,a,l=e(r),c=Ds(),u=e(c),h=!1,d={point:p,lineStart:g,lineEnd:m,polygonStart:function(){d.point=_,d.lineStart=y,d.lineEnd=v,o=[],s=[]},polygonEnd:function(){d.point=p,d.lineStart=g,d.lineEnd=m,o=Xs(o);var t=function(t,e){var n=Zs(e),i=e[1],r=Tr(i),s=[Tr(n),-Sr(n),0],o=0,a=0,l=new dr;1===r?i=mr+pr:-1===r&&(i=-mr-pr);for(var c=0,u=t.length;c<u;++c)if(d=(h=t[c]).length)for(var h,d,p=h[d-1],f=Zs(p),g=p[1]/2+_r,m=Tr(g),_=Sr(g),y=0;y<d;++y,f=b,m=E,_=x,p=v){var v=h[y],b=Zs(v),w=v[1]/2+_r,E=Tr(w),x=Sr(w),S=b-f,T=S>=0?1:-1,C=T*S,A=C>gr,P=m*E;if(l.add(xr(P*T*Tr(C),_*x+P*Sr(C))),o+=A?S+T*yr:S,A^f>=n^b>=n){var R=$s(Vs(p),Vs(v));qs(R);var M=$s(s,R);qs(M);var I=(A^S>=0?-1:1)*Pr(M[2]);(i>I||i===I&&(R[0]||R[1]))&&(a+=A^S>=0?1:-1)}}return(o<-pr||o<pr&&l<-fr)^1&a}(s,i);o.length?(h||(r.polygonStart(),h=!0),Us(o,Js,t,n,r)):t&&(h||(r.polygonStart(),h=!0),r.lineStart(),n(null,null,1,r),r.lineEnd()),h&&(r.polygonEnd(),h=!1),o=s=null},sphere:function(){r.polygonStart(),r.lineStart(),n(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function p(e,n){t(e,n)&&r.point(e,n)}function f(t,e){l.point(t,e)}function g(){d.point=f,l.lineStart()}function m(){d.point=p,l.lineEnd()}function _(t,e){a.push([t,e]),u.point(t,e)}function y(){u.lineStart(),a=[]}function v(){_(a[0][0],a[0][1]),u.lineEnd();var t,e,n,i,l=u.clean(),d=c.result(),p=d.length;if(a.pop(),s.push(a),a=null,p)if(1&l){if((e=(n=d[0]).length-1)>0){for(h||(r.polygonStart(),h=!0),r.lineStart(),t=0;t<e;++t)r.point((i=n[t])[0],i[1]);r.lineEnd()}}else p>1&&2&l&&d.push(d.pop().concat(d.shift())),o.push(d.filter(Ys))}return d}}function Ys(t){return t.length>1}function Js(t,e){return((t=t.x)[0]<0?t[1]-mr-pr:mr-t[1])-((e=e.x)[0]<0?e[1]-mr-pr:mr-e[1])}const Qs=Ks((function(){return!0}),(function(t){var e,n=NaN,i=NaN,r=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(s,o){var a=s>0?gr:-gr,l=wr(s-n);wr(l-gr)<pr?(t.point(n,i=(i+o)/2>0?mr:-mr),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(a,i),t.point(s,i),e=0):r!==a&&l>=gr&&(wr(n-r)<pr&&(n-=r*pr),wr(s-a)<pr&&(s-=a*pr),i=function(t,e,n,i){var r,s,o=Tr(t-n);return wr(o)>pr?Er((Tr(e)*(s=Sr(i))*Tr(n)-Tr(i)*(r=Sr(e))*Tr(t))/(r*s*o)):(e+i)/2}(n,i,s,o),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(a,i),e=0),t.point(n=s,i=o),r=a},lineEnd:function(){t.lineEnd(),n=i=NaN},clean:function(){return 2-e}}}),(function(t,e,n,i){var r;if(null==t)r=n*mr,i.point(-gr,r),i.point(0,r),i.point(gr,r),i.point(gr,0),i.point(gr,-r),i.point(0,-r),i.point(-gr,-r),i.point(-gr,0),i.point(-gr,r);else if(wr(t[0]-e[0])>pr){var s=t[0]<e[0]?gr:-gr;r=n*s/2,i.point(-s,r),i.point(0,r),i.point(s,r)}else i.point(e[0],e[1])}),[-gr,-mr]);function to(t,e,n,i,r,s){if(n){var o=Sr(e),a=Tr(e),l=i*n;null==r?(r=e+i*yr,s=e-l/2):(r=eo(o,r),s=eo(o,s),(i>0?r<s:r>s)&&(r+=i*yr));for(var c,u=r;i>0?u>s:u<s;u-=l)c=js([o,-a*Sr(u),-a*Tr(u)]),t.point(c[0],c[1])}}function eo(t,e){(e=Vs(e))[0]-=t,qs(e);var n,i=(n=-e[1])>1?0:n<-1?gr:Math.acos(n);return((-e[2]<0?-i:i)+yr-pr)%yr}var no=1e9,io=-no;function ro(t,e,n,i){function r(r,s){return t<=r&&r<=n&&e<=s&&s<=i}function s(r,s,a,c){var u=0,h=0;if(null==r||(u=o(r,a))!==(h=o(s,a))||l(r,s)<0^a>0)do{c.point(0===u||3===u?t:n,u>1?i:e)}while((u=(u+a+4)%4)!==h);else c.point(s[0],s[1])}function o(i,r){return wr(i[0]-t)<pr?r>0?0:3:wr(i[0]-n)<pr?r>0?2:1:wr(i[1]-e)<pr?r>0?1:0:r>0?3:2}function a(t,e){return l(t.x,e.x)}function l(t,e){var n=o(t,1),i=o(e,1);return n!==i?n-i:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(o){var l,c,u,h,d,p,f,g,m,_,y,v=o,b=Ds(),w={point:E,lineStart:function(){w.point=x,c&&c.push(u=[]);_=!0,m=!1,f=g=NaN},lineEnd:function(){l&&(x(h,d),p&&m&&b.rejoin(),l.push(b.result()));w.point=E,m&&v.lineEnd()},polygonStart:function(){v=b,l=[],c=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,r=c.length;n<r;++n)for(var s,o,a=c[n],l=1,u=a.length,h=a[0],d=h[0],p=h[1];l<u;++l)s=d,o=p,d=(h=a[l])[0],p=h[1],o<=i?p>i&&(d-s)*(i-o)>(p-o)*(t-s)&&++e:p<=i&&(d-s)*(i-o)<(p-o)*(t-s)&&--e;return e}(),n=y&&e,r=(l=Xs(l)).length;(n||r)&&(o.polygonStart(),n&&(o.lineStart(),s(null,null,1,o),o.lineEnd()),r&&Us(l,a,e,s,o),o.polygonEnd());v=o,l=c=u=null}};function E(t,e){r(t,e)&&v.point(t,e)}function x(s,o){var a=r(s,o);if(c&&u.push([s,o]),_)h=s,d=o,p=a,_=!1,a&&(v.lineStart(),v.point(s,o));else if(a&&m)v.point(s,o);else{var l=[f=Math.max(io,Math.min(no,f)),g=Math.max(io,Math.min(no,g))],b=[s=Math.max(io,Math.min(no,s)),o=Math.max(io,Math.min(no,o))];!function(t,e,n,i,r,s){var o,a=t[0],l=t[1],c=0,u=1,h=e[0]-a,d=e[1]-l;if(o=n-a,h||!(o>0)){if(o/=h,h<0){if(o<c)return;o<u&&(u=o)}else if(h>0){if(o>u)return;o>c&&(c=o)}if(o=r-a,h||!(o<0)){if(o/=h,h<0){if(o>u)return;o>c&&(c=o)}else if(h>0){if(o<c)return;o<u&&(u=o)}if(o=i-l,d||!(o>0)){if(o/=d,d<0){if(o<c)return;o<u&&(u=o)}else if(d>0){if(o>u)return;o>c&&(c=o)}if(o=s-l,d||!(o<0)){if(o/=d,d<0){if(o>u)return;o>c&&(c=o)}else if(d>0){if(o<c)return;o<u&&(u=o)}return c>0&&(t[0]=a+c*h,t[1]=l+c*d),u<1&&(e[0]=a+u*h,e[1]=l+u*d),!0}}}}}(l,b,t,e,n,i)?a&&(v.lineStart(),v.point(s,o),y=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(b[0],b[1]),a||v.lineEnd(),y=!1)}f=s,g=o,m=a}return w}}function so(t,e){function n(n,i){return n=t(n,i),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,i){return(n=e.invert(n,i))&&t.invert(n[0],n[1])}),n}function oo(t,e){return wr(t)>gr&&(t-=Math.round(t/yr)*yr),[t,e]}function ao(t,e,n){return(t%=yr)?e||n?so(co(t),uo(e,n)):co(t):e||n?uo(e,n):oo}function lo(t){return function(e,n){return wr(e+=t)>gr&&(e-=Math.round(e/yr)*yr),[e,n]}}function co(t){var e=lo(t);return e.invert=lo(-t),e}function uo(t,e){var n=Sr(t),i=Tr(t),r=Sr(e),s=Tr(e);function o(t,e){var o=Sr(e),a=Sr(t)*o,l=Tr(t)*o,c=Tr(e),u=c*n+a*i;return[xr(l*r-u*s,a*n-c*i),Pr(u*r+l*s)]}return o.invert=function(t,e){var o=Sr(e),a=Sr(t)*o,l=Tr(t)*o,c=Tr(e),u=c*r-l*s;return[xr(l*r+c*s,a*n+u*i),Pr(u*n-a*i)]},o}function ho(t){return function(e){var n=new po;for(var i in t)n[i]=t[i];return n.stream=e,n}}function po(){}function fo(t,e,n){var i=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=i&&t.clipExtent(null),hr(n,t.stream(qr)),e(qr.result()),null!=i&&t.clipExtent(i),t}function go(t,e,n){return fo(t,(function(n){var i=e[1][0]-e[0][0],r=e[1][1]-e[0][1],s=Math.min(i/(n[1][0]-n[0][0]),r/(n[1][1]-n[0][1])),o=+e[0][0]+(i-s*(n[1][0]+n[0][0]))/2,a=+e[0][1]+(r-s*(n[1][1]+n[0][1]))/2;t.scale(150*s).translate([o,a])}),n)}function mo(t,e,n){return go(t,[[0,0],e],n)}function _o(t,e,n){return fo(t,(function(n){var i=+e,r=i/(n[1][0]-n[0][0]),s=(i-r*(n[1][0]+n[0][0]))/2,o=-r*n[0][1];t.scale(150*r).translate([s,o])}),n)}function yo(t,e,n){return fo(t,(function(n){var i=+e,r=i/(n[1][1]-n[0][1]),s=-r*n[0][0],o=(i-r*(n[1][1]+n[0][1]))/2;t.scale(150*r).translate([s,o])}),n)}oo.invert=oo,po.prototype={constructor:po,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var vo=16,bo=Sr(30*br);function wo(t,e){return+e?function(t,e){function n(i,r,s,o,a,l,c,u,h,d,p,f,g,m){var _=c-i,y=u-r,v=_*_+y*y;if(v>4*e&&g--){var b=o+d,w=a+p,E=l+f,x=Ar(b*b+w*w+E*E),S=Pr(E/=x),T=wr(wr(E)-1)<pr||wr(s-h)<pr?(s+h)/2:xr(w,b),C=t(T,S),A=C[0],P=C[1],R=A-i,M=P-r,I=y*R-_*M;(I*I/v>e||wr((_*R+y*M)/v-.5)>.3||o*d+a*p+l*f<bo)&&(n(i,r,s,o,a,l,A,P,T,b/=x,w/=x,E,g,m),m.point(A,P),n(A,P,T,b,w,E,c,u,h,d,p,f,g,m))}}return function(e){var i,r,s,o,a,l,c,u,h,d,p,f,g={point:m,lineStart:_,lineEnd:v,polygonStart:function(){e.polygonStart(),g.lineStart=b},polygonEnd:function(){e.polygonEnd(),g.lineStart=_}};function m(n,i){n=t(n,i),e.point(n[0],n[1])}function _(){u=NaN,g.point=y,e.lineStart()}function y(i,r){var s=Vs([i,r]),o=t(i,r);n(u,h,c,d,p,f,u=o[0],h=o[1],c=i,d=s[0],p=s[1],f=s[2],vo,e),e.point(u,h)}function v(){g.point=m,e.lineEnd()}function b(){_(),g.point=w,g.lineEnd=E}function w(t,e){y(i=t,e),r=u,s=h,o=d,a=p,l=f,g.point=y}function E(){n(u,h,c,d,p,f,r,s,i,o,a,l,vo,e),g.lineEnd=v,v()}return g}}(t,e):function(t){return ho({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var Eo=ho({point:function(t,e){this.stream.point(t*br,e*br)}});function xo(t,e,n,i,r,s){if(!s)return function(t,e,n,i,r){function s(s,o){return[e+t*(s*=i),n-t*(o*=r)]}return s.invert=function(s,o){return[(s-e)/t*i,(n-o)/t*r]},s}(t,e,n,i,r);var o=Sr(s),a=Tr(s),l=o*t,c=a*t,u=o/t,h=a/t,d=(a*n-o*e)/t,p=(a*e+o*n)/t;function f(t,s){return[l*(t*=i)-c*(s*=r)+e,n-c*t-l*s]}return f.invert=function(t,e){return[i*(u*t-h*e+d),r*(p-h*t-u*e)]},f}
vendor: 6,071 bytes, line 2
2function So(t){var e,n,i,r,s,o,a,l,c,u,h=150,d=480,p=250,f=0,g=0,m=0,_=0,y=0,v=0,b=1,w=1,E=null,x=Qs,S=null,T=sr,C=.5;function A(t){return l(t[0]*br,t[1]*br)}function P(t){return(t=l.invert(t[0],t[1]))&&[t[0]*vr,t[1]*vr]}function R(){var t=xo(h,0,0,b,w,v).apply(null,e(f,g)),i=xo(h,d-t[0],p-t[1],b,w,v);return n=ao(m,_,y),a=so(e,i),l=so(n,a),o=wo(a,C),M()}function M(){return c=u=null,A}return A.stream=function(t){return c&&u===t?c:c=Eo(function(t){return ho({point:function(e,n){var i=t(e,n);return this.stream.point(i[0],i[1])}})}(n)(x(o(T(u=t)))))},A.preclip=function(t){return arguments.length?(x=t,E=void 0,M()):x},A.postclip=function(t){return arguments.length?(T=t,S=i=r=s=null,M()):T},A.clipAngle=function(t){return arguments.length?(x=+t?function(t){var e=Sr(t),n=2*br,i=e>0,r=wr(e)>pr;function s(t,n){return Sr(t)*Sr(n)>e}function o(t,n,i){var r=[1,0,0],s=$s(Vs(t),Vs(n)),o=Ws(s,s),a=s[0],l=o-a*a;if(!l)return!i&&t;var c=e*o/l,u=-e*a/l,h=$s(r,s),d=Hs(r,c);Gs(d,Hs(s,u));var p=h,f=Ws(d,p),g=Ws(p,p),m=f*f-g*(Ws(d,d)-1);if(!(m<0)){var _=Ar(m),y=Hs(p,(-f-_)/g);if(Gs(y,d),y=js(y),!i)return y;var v,b=t[0],w=n[0],E=t[1],x=n[1];w<b&&(v=b,b=w,w=v);var S=w-b,T=wr(S-gr)<pr;if(!T&&x<E&&(v=E,E=x,x=v),T||S<pr?T?E+x>0^y[1]<(wr(y[0]-b)<pr?E:x):E<=y[1]&&y[1]<=x:S>gr^(b<=y[0]&&y[0]<=w)){var C=Hs(p,(-f+_)/g);return Gs(C,d),[y,js(C)]}}}function a(e,n){var r=i?t:gr-t,s=0;return e<-r?s|=1:e>r&&(s|=2),n<-r?s|=4:n>r&&(s|=8),s}return Ks(s,(function(t){var e,n,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(h,d){var p,f=[h,d],g=s(h,d),m=i?g?0:a(h,d):g?a(h+(h<0?gr:-gr),d):0;if(!e&&(c=l=g)&&t.lineStart(),g!==l&&(!(p=o(e,f))||Fs(e,p)||Fs(f,p))&&(f[2]=1),g!==l)u=0,g?(t.lineStart(),p=o(f,e),t.point(p[0],p[1])):(p=o(e,f),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(r&&e&&i^g){var _;m&n||!(_=o(f,e,!0))||(u=0,i?(t.lineStart(),t.point(_[0][0],_[0][1]),t.point(_[1][0],_[1][1]),t.lineEnd()):(t.point(_[1][0],_[1][1]),t.lineEnd(),t.lineStart(),t.point(_[0][0],_[0][1],3)))}!g||e&&Fs(e,f)||t.point(f[0],f[1]),e=f,l=g,n=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}}),(function(e,i,r,s){to(s,t,n,r,e,i)}),i?[0,-t]:[-gr,t-gr])}(E=t*br):(E=null,Qs),M()):E*vr},A.clipExtent=function(t){return arguments.length?(T=null==t?(S=i=r=s=null,sr):ro(S=+t[0][0],i=+t[0][1],r=+t[1][0],s=+t[1][1]),M()):null==S?null:[[S,i],[r,s]]},A.scale=function(t){return arguments.length?(h=+t,R()):h},A.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],R()):[d,p]},A.center=function(t){return arguments.length?(f=t[0]%360*br,g=t[1]%360*br,R()):[f*vr,g*vr]},A.rotate=function(t){return arguments.length?(m=t[0]%360*br,_=t[1]%360*br,y=t.length>2?t[2]%360*br:0,R()):[m*vr,_*vr,y*vr]},A.angle=function(t){return arguments.length?(v=t%360*br,R()):v*vr},A.reflectX=function(t){return arguments.length?(b=t?-1:1,R()):b<0},A.reflectY=function(t){return arguments.length?(w=t?-1:1,R()):w<0},A.precision=function(t){return arguments.length?(o=wo(a,C=t*t),M()):Ar(C)},A.fitExtent=function(t,e){return go(A,t,e)},A.fitSize=function(t,e){return mo(A,t,e)},A.fitWidth=function(t,e){return _o(A,t,e)},A.fitHeight=function(t,e){return yo(A,t,e)},function(){return e=t.apply(this,arguments),A.invert=e.invert&&P,R()}}function To(t,e){var n=Tr(t),i=(n+Tr(e))/2;if(wr(i)<pr)return function(t){var e=Sr(t);function n(t,n){return[t*e,Tr(n)/e]}return n.invert=function(t,n){return[t/e,Pr(n*e)]},n}(t);var r=1+n*(2*i-n),s=Ar(r)/i;function o(t,e){var n=Ar(r-2*i*Tr(e))/i;return[n*Tr(t*=i),s-n*Sr(t)]}return o.invert=function(t,e){var n=s-e,o=xr(t,wr(n))*Cr(n);return n*i<0&&(o-=gr*Cr(t)*Cr(n)),[o/i,Pr((r-(t*t+n*n)*i*i)/(2*i))]},o}function Co(){return function(t){var e=0,n=gr/3,i=So(t),r=i(e,n);return r.parallels=function(t){return arguments.length?i(e=t[0]*br,n=t[1]*br):[e*vr,n*vr]},r}(To).scale(155.424).center([0,33.6442])}function Ao(){var t,e,n,i,r,s,o=Co().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7]),a=Co().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Co().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,e){s=[t,e]}};function u(t){var e=t[0],o=t[1];return s=null,n.point(e,o),s||(i.point(e,o),s)||(r.point(e,o),s)}function h(){return t=e=null,u}return u.invert=function(t){var e=o.scale(),n=o.translate(),i=(t[0]-n[0])/e,r=(t[1]-n[1])/e;return(r>=.12&&r<.234&&i>=-.425&&i<-.214?a:r>=.166&&r<.234&&i>=-.214&&i<-.115?l:o).invert(t)},u.stream=function(n){return t&&e===n?t:t=function(t){var e=t.length;return{point:function(n,i){for(var r=-1;++r<e;)t[r].point(n,i)},sphere:function(){for(var n=-1;++n<e;)t[n].sphere()},lineStart:function(){for(var n=-1;++n<e;)t[n].lineStart()},lineEnd:function(){for(var n=-1;++n<e;)t[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<e;)t[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<e;)t[n].polygonEnd()}}}([o.stream(e=n),a.stream(n),l.stream(n)])},u.precision=function(t){return arguments.length?(o.precision(t),a.precision(t),l.precision(t),h()):o.precision()},u.scale=function(t){return arguments.length?(o.scale(t),a.scale(.35*t),l.scale(t),u.translate(o.translate())):o.scale()},u.translate=function(t){if(!arguments.length)return o.translate();var e=o.scale(),s=+t[0],u=+t[1];return n=o.translate(t).clipExtent([[s-.455*e,u-.238*e],[s+.455*e,u+.238*e]]).stream(c),i=a.translate([s-.307*e,u+.201*e]).clipExtent([[s-.425*e+pr,u+.12*e+pr],[s-.214*e-pr,u+.234*e-pr]]).stream(c),r=l.translate([s-.205*e,u+.212*e]).clipExtent([[s-.214*e+pr,u+.166*e+pr],[s-.115*e-pr,u+.234*e-pr]]).stream(c),h()},u.fitExtent=function(t,e){return go(u,t,e)},u.fitSize=function(t,e){return mo(u,t,e)},u.fitWidth=function(t,e){return _o(u,t,e)},u.fitHeight=function(t,e){return yo(u,t,e)},u.scale(1070)}function Po(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ro(t,e){switch(arguments.length){case 0:break;case 1:"function"===typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"===typeof e?this.interpolator(e):this.range(e)}return this}
2const Mo=Symbol("implicit");function Io(){var t=new I,e=[],n=[],i=Mo;function r(r){let s=t.get(r);if(void 0===s){if(i!==Mo)return i;t.set(r,s=e.push(r)-1)}return n[s%n.length]}return r.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new I;for(const i of n)t.has(i)||t.set(i,e.push(i)-1);return r},r.range=function(t){return arguments.length?(n=Array.from(t),r):n.slice()},r.unknown=function(t){return arguments.length?(i=t,r):i},r.copy=function(){return Io(e,n).unknown(i)},Po.apply(r,arguments),r}function Lo(){var t,e,n=Io().unknown(void 0),i=n.domain,r=n.range,s=0,o=1,a=!1,l=0,c=0,u=.5;function h(){var n=i().length,h=o<s,d=h?o:s,p=h?s:o;t=(p-d)/Math.max(1,n-l+2*c),a&&(t=Math.floor(t)),d+=(p-d-t*(n-l))*u,e=t*(1-l),a&&(d=Math.round(d),e=Math.round(e));var f=function(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((e-t)/n)),s=new Array(r);++i<r;)s[i]=t+i*n;return s}(n).map((function(e){return d+t*e}));return r(h?f.reverse():f)}return delete n.unknown,n.domain=function(t){return arguments.length?(i(t),h()):i()},n.range=function(t){return arguments.length?([s,o]=t,s=+s,o=+o,h()):[s,o]},n.rangeRound=function(t){return[s,o]=t,s=+s,o=+o,a=!0,h()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(a=!!t,h()):a},n.padding=function(t){return arguments.length?(l=Math.min(1,c=+t),h()):l},n.paddingInner=function(t){return arguments.length?(l=Math.min(1,t),h()):l},n.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},n.align=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),h()):u},n.copy=function(){return Lo(i(),[s,o]).round(a).paddingInner(l).paddingOuter(c).align(u)},Po.apply(h(),arguments)}const ko=Math.sqrt(50),No=Math.sqrt(10),Oo=Math.sqrt(2);function Do(t,e,n){const i=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),o=s>=ko?10:s>=No?5:s>=Oo?2:1;let a,l,c;return r<0?(c=Math.pow(10,-r)/o,a=Math.round(t*c),l=Math.round(e*c),a/c<t&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*o,a=Math.round(t/c),l=Math.round(e/c),a*c<t&&++a,l*c>e&&--l),l<a&&.5<=n&&n<2?Do(t,e,2*n):[a,l,c]}function Fo(t,e,n){return Do(t=+t,e=+e,n=+n)[2]}function Bo(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Uo(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function zo(t){let e,n,i;function r(t,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length;if(r<s){if(0!==e(i,i))return s;do{const e=r+s>>>1;n(t[e],i)<0?r=e+1:s=e}while(r<s)}return r}return 2!==t.length?(e=Bo,n=(e,n)=>Bo(t(e),n),i=(e,n)=>t(e)-n):(e=t===Bo||t===Uo?t:jo,n=t,i=t),{left:r,center:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=r(t,e,n,(arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length)-1);return s>n&&i(t[s-1],e)>-i(t[s],e)?s-1:s},right:function(t,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length;if(r<s){if(0!==e(i,i))return s;do{const e=r+s>>>1;n(t[e],i)<=0?r=e+1:s=e}while(r<s)}return r}}}function jo(){return 0}const Vo=zo(Bo),Wo=Vo.right,$o=(Vo.left,zo((function(t){return null===t?NaN:+t})).center,Wo);function Go(t,e){var n,i=e?e.length:0,r=t?Math.min(i,t.length):0,s=new Array(r),o=new Array(i);for(n=0;n<r;++n)s[n]=Xo(t[n],e[n]);for(;n<i;++n)o[n]=e[n];return function(t){for(n=0;n<r;++n)o[n]=s[n](t);return o}}function Ho(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function qo(t,e){var n,i={},r={};for(n in null!==t&&"object"===typeof t||(t={}),null!==e&&"object"===typeof e||(e={}),e)n in t?i[n]=Xo(t[n],e[n]):r[n]=e[n];return function(t){for(n in i)r[n]=i[n](t);return r}}function Zo(t,e){e||(e=[]);var n,i=t?Math.min(e.length,t.length):0,r=e.slice();return function(s){for(n=0;n<i;++n)r[n]=t[n]*(1-s)+e[n]*s;return r}}function Xo(t,e){var n,i,r=typeof e;return null==e||"boolean"===r?Gn(e):("number"===r?Ye:"string"===r?(n=An(e))?(e=n,Xn):Qn:e instanceof An?Xn:e instanceof Date?Ho:(i=e,!ArrayBuffer.isView(i)||i instanceof DataView?Array.isArray(e)?Go:"function"!==typeof e.valueOf&&"function"!==typeof e.toString||isNaN(e)?qo:Ye:Zo))(t,e)}function Ko(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Yo(t){return+t}var Jo=[0,1];function Qo(t){return t}function ta(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function ea(t,e,n){var i=t[0],r=t[1],s=e[0],o=e[1];return r<i?(i=ta(r,i),s=n(o,s)):(i=ta(i,r),s=n(s,o)),function(t){return s(i(t))}}function na(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),s=new Array(i),o=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<i;
vendor: 6,690 bytes, line 2
2)r[o]=ta(t[o],t[o+1]),s[o]=n(e[o],e[o+1]);return function(e){var n=$o(t,e,1,i)-1;return s[n](r[n](e))}}function ia(){var t,e,n,i,r,s,o=Jo,a=Jo,l=Xo,c=Qo;function u(){var t=Math.min(o.length,a.length);return c!==Qo&&(c=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(o[0],o[t-1])),i=t>2?na:ea,r=s=null,h}function h(e){return null==e||isNaN(e=+e)?n:(r||(r=i(o.map(t),a,l)))(t(c(e)))}return h.invert=function(n){return c(e((s||(s=i(a,o.map(t),Ye)))(n)))},h.domain=function(t){return arguments.length?(o=Array.from(t,Yo),u()):o.slice()},h.range=function(t){return arguments.length?(a=Array.from(t),u()):a.slice()},h.rangeRound=function(t){return a=Array.from(t),l=Ko,u()},h.clamp=function(t){return arguments.length?(c=!!t||Qo,u()):c!==Qo},h.interpolate=function(t){return arguments.length?(l=t,u()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,i){return t=n,e=i,u()}}function ra(t,e,n,i){var r,s=function(t,e,n){n=+n;const i=(e=+e)<(t=+t),r=i?Fo(e,t,n):Fo(t,e,n);return(i?-1:1)*(r<0?1/-r:r)}(t,e,n);switch((i=Zi(null==i?",f":i)).type){case"s":var o=Math.max(Math.abs(t),Math.abs(e));return null!=i.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Gi(e)/3)))-Gi(Math.abs(t)))}(s,o))||(i.precision=r),er(i,o);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Gi(e)-Gi(t))+1}(s,Math.max(Math.abs(t),Math.abs(e))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=function(t){return Math.max(0,-Gi(Math.abs(t)))}(s))||(i.precision=r-2*("%"===i.type))}return tr(i)}function sa(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){if(!((n=+n)>0))return[];if((t=+t)===(e=+e))return[t];const i=e<t,[r,s,o]=i?Do(e,t,n):Do(t,e,n);if(!(s>=r))return[];const a=s-r+1,l=new Array(a);if(i)if(o<0)for(let c=0;c<a;++c)l[c]=(s-c)/-o;else for(let c=0;c<a;++c)l[c]=(s-c)*o;else if(o<0)for(let c=0;c<a;++c)l[c]=(r+c)/-o;else for(let c=0;c<a;++c)l[c]=(r+c)*o;return l}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var i=e();return ra(i[0],i[i.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var i,r,s=e(),o=0,a=s.length-1,l=s[o],c=s[a],u=10;for(c<l&&(r=l,l=c,c=r,r=o,o=a,a=r);u-- >0;){if((r=Fo(l,c,n))===i)return s[o]=l,s[a]=c,e(s);if(r>0)l=Math.floor(l/r)*r,c=Math.ceil(c/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,c=Math.floor(c*r)/r}i=r}return t},t}function oa(){var t=ia()(Qo,Qo);return t.copy=function(){return function(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}(t,oa())},Po.apply(t,arguments),sa(t)}function aa(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function la(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function ca(t){return t<0?-t*t:t*t}function ua(t){var e=t(Qo,Qo),n=1;return e.exponent=function(e){return arguments.length?1===(n=+e)?t(Qo,Qo):.5===n?t(la,ca):t(aa(n),aa(1/n)):n},sa(e)}function ha(){var t,e,n,i,r,s=0,o=1,a=Qo,l=!1;function c(e){return null==e||isNaN(e=+e)?r:a(0===n?.5:(e=(i(e)-t)*n,l?Math.max(0,Math.min(1,e)):e))}function u(t){return function(e){var n,i;return arguments.length?([n,i]=e,a=t(n,i),c):[a(0),a(1)]}}return c.domain=function(r){return arguments.length?([s,o]=r,t=i(s=+s),e=i(o=+o),n=t===e?0:1/(e-t),c):[s,o]},c.clamp=function(t){return arguments.length?(l=!!t,c):l},c.interpolator=function(t){return arguments.length?(a=t,c):a},c.range=u(Xo),c.rangeRound=u(Ko),c.unknown=function(t){return arguments.length?(r=t,c):r},function(r){return i=r,t=r(s),e=r(o),n=t===e?0:1/(e-t),c}}function da(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function pa(){var t=ua(ha());return t.copy=function(){return da(t,pa()).exponent(t.exponent())},Ro.apply(t,arguments)}function fa(){return pa.apply(null,arguments).exponent(.5)}const ga=function(t){for(var e=t.length/6|0,n=new Array(e),i=0;i<e;)n[i]="#"+t.slice(6*i,6*++i);return n}("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");function ma(t){return"string"===typeof t?new ue([[document.querySelector(t)]],[document.documentElement]):new ue([[t]],ce)}Array.prototype.slice;function _a(t){return function(){return t}}function ya(t){this._context=t}function va(t){return new ya(t)}ya.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};const ba=Math.PI,wa=2*ba,Ea=1e-6,xa=wa-Ea;function Sa(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}class Ta{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?Sa:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Sa;const n=10**e;return function(t){this._+=t[0];for(let e=1,i=t.length;e<i;++e)this._+=Math.round(arguments[e]*n)/n+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,n,i){this._append`Q${+t},${+e},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,e,n,i,r,s){this._append`C${+t},${+e},${+n},${+i},${this._x1=+r},${this._y1=+s}`}arcTo(t,e,n,i,r){if(t=+t,e=+e,n=+n,i=+i,(r=+r)<0)throw new Error(`negative radius: ${r}`);let s=this._x1,o=this._y1,a=n-t,l=i-e,c=s-t,u=o-e,h=c*c+u*u;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(h>Ea)if(Math.abs(u*a-l*c)>Ea&&r){let d=n-s,p=i-o,f=a*a+l*l,g=d*d+p*p,m=Math.sqrt(f),_=Math.sqrt(h),y=r*Math.tan((ba-Math.acos((f+h-g)/(2*m*_)))/2),v=y/_,b=y/m;Math.abs(v-1)>Ea&&this._append`L${t+v*c},${e+v*u}`,this._append`A${r},${r},0,0,${+(u*d>c*p)},${this._x1=t+b*a},${this._y1=e+b*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,i,r,s){if(t=+t,e=+e,s=!!s,(n=+n)<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(i),a=n*Math.sin(i),l=t+o,c=e+a,u=1^s,h=s?i-r:r-i;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>Ea||Math.abs(this._y1-c)>Ea)&&this._append`L${l},${c}`,n&&(h<0&&(h=h%wa+wa),h>xa?this._append`A${n},${n},0,1,${u},${t-o},${e-a}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:h>Ea&&this._append`A${n},${n},0,${+(h>=ba)},${u},${this._x1=t+n*Math.cos(r)}
2,${this._y1=e+n*Math.sin(r)}`)}rect(t,e,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Ca(t){return t[0]}function Aa(t){return t[1]}function Pa(t,e){var n=_a(!0),i=null,r=va,s=null,o=function(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Ta(e)}(a);function a(a){var l,c,u,h=(a=function(t){return"object"===typeof t&&"length"in t?t:Array.from(t)}(a)).length,d=!1;for(null==i&&(s=r(u=o())),l=0;l<=h;++l)!(l<h&&n(c=a[l],l,a))===d&&((d=!d)?s.lineStart():s.lineEnd()),d&&s.point(+t(c,l,a),+e(c,l,a));if(u)return s=null,u+""||null}return t="function"===typeof t?t:void 0===t?Ca:_a(t),e="function"===typeof e?e:void 0===e?Aa:_a(e),a.x=function(e){return arguments.length?(t="function"===typeof e?e:_a(+e),a):t},a.y=function(t){return arguments.length?(e="function"===typeof t?t:_a(+t),a):e},a.defined=function(t){return arguments.length?(n="function"===typeof t?t:_a(!!t),a):n},a.curve=function(t){return arguments.length?(r=t,null!=i&&(s=r(i)),a):r},a.context=function(t){return arguments.length?(null==t?i=s=null:s=r(i=t),a):i},a}function Ra(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Ma(t){this._context=t}function Ia(t){return new Ma(t)}function La(t,e,n){this.k=t,this.x=e,this.y=n}Ta.prototype,Ma.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ra(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ra(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},La.prototype={constructor:La,scale:function(t){return 1===t?this:new La(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new La(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};new La(1,0,0);La.prototype;const ka=!1,Na=!1,Oa="${JSCORE_VERSION}",Da=function(t,e){if(!t)throw Fa(e)},Fa=function(t){return new Error("Firebase Database ("+Oa+") INTERNAL ASSERT FAILED: "+t)},Ba=function(t){const e=[];let n=0;for(let i=0;i<t.length;i++){let r=t.charCodeAt(i);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):55296===(64512&r)&&i+1<t.length&&56320===(64512&t.charCodeAt(i+1))?(r=65536+((1023&r)<<10)+(1023&t.charCodeAt(++i)),e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128)}return e},Ua={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"===typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let r=0;r<t.length;
2r+=3){const e=t[r],s=r+1<t.length,o=s?t[r+1]:0,a=r+2<t.length,l=a?t[r+2]:0,c=e>>2,u=(3&e)<<4|o>>4;let h=(15&o)<<2|l>>6,d=63&l;a||(d=64,s||(h=64)),i.push(n[c],n[u],n[h],n[d])}return i.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Ba(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,i=0;for(;n<t.length;){const r=t[n++];if(r<128)e[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=t[n++];e[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){const s=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[i++]=String.fromCharCode(55296+(s>>10)),e[i++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[i++]=String.fromCharCode((15&r)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let r=0;r<t.length;){const e=n[t.charAt(r++)],s=r<t.length?n[t.charAt(r)]:0;++r;const o=r<t.length?n[t.charAt(r)]:64;++r;const a=r<t.length?n[t.charAt(r)]:64;if(++r,null==e||null==s||null==o||null==a)throw new za;const l=e<<2|s>>4;if(i.push(l),64!==o){const t=s<<4&240|o>>2;if(i.push(t),64!==a){const t=o<<6&192|a;i.push(t)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class za extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const ja=function(t){const e=Ba(t);return Ua.encodeByteArray(e,!0)},Va=function(t){return ja(t).replace(/\./g,"")},Wa=function(t){try{return Ua.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function $a(t){return Ga(void 0,t)}function Ga(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(const n in e)e.hasOwnProperty(n)&&"__proto__"!==n&&(t[n]=Ga(t[n],e[n]));return t}const Ha=()=>function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof n.g)return n.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,qa=()=>{try{return Ha()||(()=>{if("undefined"===typeof process)return;const t={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_FIREBASE_PASSWORD:"ClearloopData123!",REACT_APP_OPENWEATHER_API_KEY:"03c641fb2401c9014257bab115dd66ad",REACT_APP_FIREBASE_EMAIL:"[email protected]",REACT_APP_MAPBOX_TOKEN:"pk.eyJ1IjoibWFuZGFsaSIsImEiOiJjbHh0Z2I4YW0wNGtvMmlvYzZhM28wMTV2In0.maKcZ_aBF3G64JMJM2W1EQ"}.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||(()=>{if("undefined"===typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(n){return}const e=t&&Wa(t[1]);return e&&JSON.parse(e)})()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},Za=t=>{var e,n;return null===(n=null===(e=qa())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]},Xa=()=>{var t;return null===(t=qa())||void 0===t?void 0:t.config},Ka=t=>{var e;return null===(e=qa())||void 0===e?void 0:e[`_${t}`]};class Ya{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}wrapCallback(t){return(e,n)=>{e?this.reject(e):this.resolve(n),"function"===typeof t&&(this.promise.catch((()=>{})),1===t.length?t(e):t(e,n))}}}function Ja(){return"undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:""}function Qa(){return"undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Ja())}function tl(){return"object"===typeof navigator&&"ReactNative"===navigator.product}function el(){return!0===ka||!0===Na}
2class nl extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,nl.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,il.prototype.create)}}class il{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t){const e=(arguments.length<=1?void 0:arguments[1])||{},n=`${this.service}/${t}`,i=this.errors[t],r=i?function(t,e){return t.replace(rl,((t,n)=>{const i=e[n];return null!=i?String(i):`<${n}?>`}))}(i,e):"Error",s=`${this.serviceName}: ${r} (${n}).`;return new nl(n,s,e)}}const rl=/\{\$([^}]+)}/g;function sl(t){return JSON.parse(t)}function ol(t){return JSON.stringify(t)}const al=function(t){let e={},n={},i={},r="";try{const s=t.split(".");e=sl(Wa(s[0])||""),n=sl(Wa(s[1])||""),r=s[2],i=n.d||{},delete n.d}catch(s){}return{header:e,claims:n,data:i,signature:r}};function ll(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function cl(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function ul(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function hl(t,e,n){const i={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=e.call(n,t[r],r,t));return i}function dl(t,e){if(t===e)return!0;const n=Object.keys(t),i=Object.keys(e);for(const r of n){if(!i.includes(r))return!1;const n=t[r],s=e[r];if(pl(n)&&pl(s)){if(!dl(n,s))return!1}else if(n!==s)return!1}for(const r of i)if(!n.includes(r))return!1;return!0}function pl(t){return null!==t&&"object"===typeof t}function fl(t){const e=[];for(const[n,i]of Object.entries(t))Array.isArray(i)?i.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(i));return e.length?"&"+e.join("&"):""}function gl(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,i]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(i)}})),e}function ml(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class _l{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let t=1;t<this.blockSize;++t)this.pad_[t]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(t,e){e||(e=0);const n=this.W_;if("string"===typeof t)for(let u=0;u<16;u++)n[u]=t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|t.charCodeAt(e+3),e+=4;else for(let u=0;u<16;u++)n[u]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],e+=4;for(let u=16;u<80;u++){const t=n[u-3]^n[u-8]^n[u-14]^n[u-16];n[u]=4294967295&(t<<1|t>>>31)}let i,r,s=this.chain_[0],o=this.chain_[1],a=this.chain_[2],l=this.chain_[3],c=this.chain_[4];for(let u=0;u<80;u++){u<40?u<20?(i=l^o&(a^l),r=1518500249):(i=o^a^l,r=1859775393):u<60?(i=o&a|l&(o|a),r=2400959708):(i=o^a^l,r=3395469782);const t=(s<<5|s>>>27)+i+c+r+n[u]&4294967295;c=l,l=a,a=4294967295&(o<<30|o>>>2),o=s,s=t}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+o&4294967295,this.chain_[2]=this.chain_[2]+a&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+c&4294967295}update(t,e){if(null==t)return;void 0===e&&(e=t.length);const n=e-this.blockSize;let i=0;const r=this.buf_;let s=this.inbuf_;for(;i<e;){if(0===s)for(;i<=n;)this.compress_(t,i),i+=this.blockSize;if("string"===typeof t){for(;i<e;)if(r[s]=t.charCodeAt(i),++s,++i,s===this.blockSize){this.compress_(r),s=0;break}}else for(;i<e;)if(r[s]=t[i],++s,++i,s===this.blockSize){this.compress_(r),s=0;break}}this.inbuf_=s,this.total_+=e}digest(){const t=[];let e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let i=this.blockSize-1;i>=56;i--)this.buf_[i]=255&e,e/=256;this.compress_(this.buf_);let n=0;for(let i=0;i<5;i++)for(let e=24;e>=0;e-=8)t[n]=this.chain_[i]>>e&255,++n;return t}}class yl{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Prom
vendor: 1,204 bytes, line 2
2ise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let i;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");i=function(t,e){if("object"!==typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"===typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===i.next&&(i.next=vl),void 0===i.error&&(i.error=vl),void 0===i.complete&&(i.complete=vl);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(t){}})),this.observers.push(i),r}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then((()=>
2{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(n){"undefined"!==typeof console&&console.error&&console.error(n)}}))}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function vl(){}function bl(t,e){return`${t} failed: ${e} argument `}const wl=function(t){let e=0;for(let n=0;n<t.length;n++){const i=t.charCodeAt(n);i<128?e++:i<2048?e+=2:i>=55296&&i<=56319?(e+=4,n++):e+=3}return e};function El(t){return t&&t._delegate?t._delegate:t}class xl{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}const Sl="[DEFAULT]";class Tl{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new Ya;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(n){}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(null===t||void 0===t?void 0:t.identifier),i=null!==(e=null===t||void 0===t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(i)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(r){if(i)return null;throw r}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}(t))try{this.getOrInitializeService({instanceIdentifier:Sl})}catch(e){}for(const[t,n]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:i});n.resolve(t)}catch(e){}}}}clearInstance(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Sl;this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return null!=this.component}isInitialized(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Sl;return this.instances.has(t)}getOptions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Sl;return this.instancesOptions.get(t)||{}}initialize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[r,s]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(r)&&s.resolve(i)}return i}onInit(t,e){var n;const i=this.normalizeInstanceIdentifier(e),r=null!==(n=this.onInitCallbacks.get(i))&&void 0!==n?n:new Set;r.add(t),this.onInitCallbacks.set(i,r);const s=this.instances.get(i);return s&&t(s,i),()=>{r.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const i of n)try{i(t,e)}catch(vL){}}getOrInitializeService(t){let{instanceIdentifier:e,options:n={}}=t,i=this.instances.get(e);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e,r===Sl?void 0:r),options:n}),this.instances.set(e,i),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(i,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,i)}catch(vL){}var r;return i||null}normalizeInstanceIdentifier(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Sl;return this.component?this.component.multipleInstances?t:Sl:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class Cl{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new Tl(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}const Al=[];var Pl;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(Pl||(Pl={}));const Rl={debug:Pl.DEBUG,verbose:Pl.VERBOSE,info:Pl.INFO,warn:Pl.WARN,error:Pl.ERROR,silent:Pl.SILENT},Ml=Pl.INFO,Il={[Pl.DEBUG]:"log",[Pl.VERBOSE]:"log",[Pl.INFO]:"info",[Pl.WARN]:"warn",[Pl.ERROR]:"error"},Ll=function(t,e){if(e<t.logLevel)return;const n=(new Date).toISOString(),i=Il[e];if(!i)throw new Error(`Attempted to log a message with an invali
2d logType (value: ${e})`);for(var r=arguments.length,s=new Array(r>2?r-2:0),o=2;o<r;o++)s[o-2]=arguments[o];console[i](`[${n}] ${t.name}:`,...s)};class kl{constructor(t){this.name=t,this._logLevel=Ml,this._logHandler=Ll,this._userLogHandler=null,Al.push(this)}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Pl))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"===typeof t?Rl[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!==typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this._userLogHandler&&this._userLogHandler(this,Pl.DEBUG,...e),this._logHandler(this,Pl.DEBUG,...e)}log(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this._userLogHandler&&this._userLogHandler(this,Pl.VERBOSE,...e),this._logHandler(this,Pl.VERBOSE,...e)}info(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this._userLogHandler&&this._userLogHandler(this,Pl.INFO,...e),this._logHandler(this,Pl.INFO,...e)}warn(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this._userLogHandler&&this._userLogHandler(this,Pl.WARN,...e),this._logHandler(this,Pl.WARN,...e)}error(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this._userLogHandler&&this._userLogHandler(this,Pl.ERROR,...e),this._logHandler(this,Pl.ERROR,...e)}}const Nl=(t,e)=>e.some((e=>t instanceof e));let Ol,Dl;const Fl=new WeakMap,Bl=new WeakMap,Ul=new WeakMap,zl=new WeakMap,jl=new WeakMap;let Vl={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return Bl.get(t);if("objectStoreNames"===e)return t.objectStoreNames||Ul.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Gl(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function Wl(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Dl||(Dl=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return t.apply(Hl(this),n),Gl(Fl.get(this))}:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return Gl(t.apply(Hl(this),n))}:function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];const s=t.call(Hl(this),e,...i);return Ul.set(s,e.sort?e.sort():[e]),Gl(s)}}function $l(t){return"function"===typeof t?Wl(t):(t instanceof IDBTransaction&&function(t){if(Bl.has(t))return;const e=new Promise(((e,n)=>{const i=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",s),t.removeEventListener("abort",s)},r=()=>{e(),i()},s=()=>{n(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",r),t.addEventListener("error",s),t.addEventListener("abort",s)}));Bl.set(t,e)}(t),Nl(t,Ol||(Ol=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,Vl):t)}function Gl(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const i=()=>{t.removeEventListener("success",r),t.removeEventListener("error",s)},r=()=>{e(Gl(t.result)),i()},s=()=>{n(t.error),i()};t.addEventListener("success",r),t.addEventListener("error",s)}));return e.then((e=>{e instanceof IDBCursor&&Fl.set(e,t)})).catch((()=>{})),jl.set(e,t),e}(t);if(zl.has(t))return zl.get(t);const e=$l(t);return e!==t&&(zl.set(t,e),jl.set(e,t)),e}const Hl=t=>jl.get(t);const ql=["get","getKey","getAll","getAllKeys","count"],Zl=["put","add","delete","clear"],Xl=new Map;function Kl(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!==typeof e)return;if(Xl.get(e))return Xl.get(e);const n=e.replace(/FromIndex$/,""),i=e!==n,r=Zl.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!r&&!ql.includes(n))return;const s=async function(t){const e=this.transaction(t,r?"readwrite":"readonly");let s=e.store;for(var o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];
vendor: 2,608 bytes, line 2
2return i&&(s=s.index(a.shift())),(await Promise.all([s[n](...a),r&&e.done]))[0]};return Xl.set(e,s),s}Vl=(t=>({...t,get:(e,n,i)=>Kl(e,n)||t.get(e,n,i),has:(e,n)=>!!Kl(e,n)||t.has(e,n)}))(Vl);class Yl{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null===e||void 0===e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const Jl="@firebase/app",Ql="0.9.27",tc=new kl("@firebase/app"),ec="[DEFAULT]",nc={[Jl]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},ic=new Map,rc=new Map;function sc(t,e){try{t.container.addComponent(e)}catch(n){tc.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function oc(t){const e=t.name;if(rc.has(e))return tc.debug(`There were multiple attempts to register component ${e}.`),!1;rc.set(e,t);for(const n of ic.values())sc(n,t);return!0}function ac(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}const lc=new il("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invali
2d-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});class cc{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new xl("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw lc.create("app-deleted",{appName:this._name})}}const uc="10.8.0";function hc(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t;if("object"!==typeof e){e={name:e}}const i=Object.assign({name:ec,automaticDataCollectionEnabled:!1},e),r=i.name;if("string"!==typeof r||!r)throw lc.create("bad-app-name",{appName:String(r)});if(n||(n=Xa()),!n)throw lc.create("no-options");const s=ic.get(r);if(s){if(dl(n,s.options)&&dl(i,s.config))return s;throw lc.create("duplicate-app",{appName:r})}const o=new Cl(r);for(const l of rc.values())o.addComponent(l);const a=new cc(n,i,o);return ic.set(r,a),a}function dc(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ec;const e=ic.get(t);if(!e&&t===ec&&Xa())return hc();if(!e)throw lc.create("no-app",{appName:t});return e}function pc(t,e,n){var i;let r=null!==(i=nc[t])&&void 0!==i?i:t;n&&(r+=`-${n}`);const s=r.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const t=[`Unable to register library "${r}" with version "${e}":`];return s&&t.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void tc.warn(t.join(" "))}oc(new xl(`${r}-version`,(()=>({library:r,version:e})),"VERSION"))}const fc="firebase-heartbeat-database",gc=1,mc="firebase-heartbeat-store";let _c=null;function yc(){return _c||(_c=function(t,e){let{blocked:n,upgrade:i,blocking:r,terminated:s}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=indexedDB.open(t,e),a=Gl(o);return i&&o.addEventListener("upgradeneeded",(t=>{i(Gl(o.result),t.oldVersion,t.newVersion,Gl(o.transaction),t)})),n&&o.addEventListener("blocked",(t=>n(t.oldVersion,t.newVersion,t))),a.then((t=>{s&&t.addEventListener("close",(()=>s())),r&&t.addEventListener("versionchange",(t=>r(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),a}(fc,gc,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore(mc)}catch(n){console.warn(n)}}}).catch((t=>{throw lc.create("idb-open",{originalErrorMessage:t.message})}))),_c}async function vc(t,e){try{const n=(await yc()).transaction(mc,"readwrite"),i=n.objectStore(mc);await i.put(e,bc(t)),await n.done}catch(n){if(n instanceof nl)tc.warn(n.message);else{const t=lc.create("idb-set",{originalErrorMessage:null===n||void 0===n?void 0:n.message});tc.warn(t.message)}}}function bc(t){return`${t.name}!${t.options.appId}`}class wc{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new xc(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){var t,e;const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Ec();if((null!=(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)||(this._heartbeatsCache=await this._heartbeatsCachePromise,null!=(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)))&&this._heartbeatsCache.lastSentHeartbeatDate!==i&&!this._heartbeatsCache.heartbeats.some((t=>t.date===i)))return this._heartbeatsCache.heartbeats.push({date:i,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var t;if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const e=Ec(),{heartbeatsToSend:n,unsentEntries:i}=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024;const n=[];let i=t.slice();for(const r of t){const t=n.find((t=>t.agent===r.agent));if(t){if(t.dates.push(r.date),Sc(n)>e){t.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),Sc(n)>e){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),r=Va(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}}function Ec(){return(new Date).toISOString().substring(0,10)}class xc{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"===typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,e)=>{try{let n=!0;
2const i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(i),t(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var t;e((null===(t=r.error)||void 0===t?void 0:t.message)||"")}}catch($c){e($c)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=(await yc()).transaction(mc),n=await e.objectStore(mc).get(bc(t));return await e.done,n}catch(e){if(e instanceof nl)tc.warn(e.message);else{const t=lc.create("idb-get",{originalErrorMessage:null===e||void 0===e?void 0:e.message});tc.warn(t.message)}}}(this.app);return(null===t||void 0===t?void 0:t.heartbeats)?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return vc(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return vc(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function Sc(t){return Va(JSON.stringify({version:2,heartbeats:t})).length}var Tc;Tc="",oc(new xl("platform-logger",(t=>new Yl(t)),"PRIVATE")),oc(new xl("heartbeat",(t=>new wc(t)),"PRIVATE")),pc(Jl,Ql,Tc),pc(Jl,Ql,"esm2017"),pc("fire-js","");const Cc="@firebase/database",Ac="1.0.3";let Pc="";function Rc(t){Pc=t}class Mc{constructor(t){this.domStorage_=t,this.prefix_="firebase:"}set(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),ol(e))}get(t){const e=this.domStorage_.getItem(this.prefixedName_(t));return null==e?null:sl(e)}remove(t){this.domStorage_.removeItem(this.prefixedName_(t))}prefixedName_(t){return this.prefix_+t}toString(){return this.domStorage_.toString()}}class Ic{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e}get(t){return ll(this.cache_,t)?this.cache_[t]:null}remove(t){delete this.cache_[t]}}const Lc=function(t){try{if("undefined"!==typeof window&&"undefined"!==typeof window[t]){const e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new Mc(e)}}catch(e){}return new Ic},kc=Lc("localStorage"),Nc=Lc("sessionStorage"),Oc=new kl("@firebase/database"),Dc=function(){let t=1;return function(){return t++}}(),Fc=function(t){const e=function(t){const e=[];let n=0;for(let i=0;i<t.length;i++){let r=t.charCodeAt(i);if(r>=55296&&r<=56319){const e=r-55296;i++,Da(i<t.length,"Surrogate pair missing trail surrogate."),r=65536+(e<<10)+(t.charCodeAt(i)-56320)}r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):r<65536?(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128)}return e}(t),n=new _l;n.update(e);const i=n.digest();return Ua.encodeByteArray(i)},Bc=function(){let t="";for(let e=0;e<arguments.length;e++){const n=e<0||arguments.length<=e?void 0:arguments[e];Array.isArray(n)||n&&"object"===typeof n&&"number"===typeof n.length?t+=Bc.apply(null,n):t+="object"===typeof n?ol(n):n,t+=" "}return t};let Uc=null,zc=!0;const jc=function(t,e){Da(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(Oc.logLevel=Pl.VERBOSE,Uc=Oc.log.bind(Oc),e&&Nc.set("logging_enabled",!0)):"function"===typeof t?Uc=t:(Uc=null,Nc.remove("logging_enabled"))},Vc=function(){if(!0===zc&&(zc=!1,null===Uc&&!0===Nc.get("logging_enabled")&&jc(!0)),Uc){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];const i=Bc.apply(null,e);Uc(i)}},Wc=function(t){return function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];Vc(t,...n)}},$c=function(){const t="FIREBASE INTERNAL ERROR: "+Bc(...arguments);Oc.error(t)},Gc=function(){const t=`FIREBASE FATAL ERROR: ${Bc(...arguments)}`;throw Oc.error(t),new Error(t)},Hc=function(){const t="FIREBASE WARNING: "+Bc(...arguments);Oc.warn(t)}
2,qc=function(t){return"number"===typeof t&&(t!==t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)},Zc="[MIN_NAME]",Xc="[MAX_NAME]",Kc=function(t,e){if(t===e)return 0;if(t===Zc||e===Xc)return-1;if(e===Zc||t===Xc)return 1;{const n=ru(t),i=ru(e);return null!==n?null!==i?n-i===0?t.length-e.length:n-i:-1:null!==i?1:t<e?-1:1}},Yc=function(t,e){return t===e?0:t<e?-1:1},Jc=function(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+ol(e))},Qc=function(t){if("object"!==typeof t||null===t)return ol(t);const e=[];for(const i in t)e.push(i);e.sort();let n="{";for(let i=0;i<e.length;i++)0!==i&&(n+=","),n+=ol(e[i]),n+=":",n+=Qc(t[e[i]]);return n+="}",n},tu=function(t,e){const n=t.length;if(n<=e)return[t];const i=[];for(let r=0;r<n;r+=e)r+e>n?i.push(t.substring(r,n)):i.push(t.substring(r,r+e));return i};function eu(t,e){for(const n in t)t.hasOwnProperty(n)&&e(n,t[n])}const nu=function(t){Da(!qc(t),"Invalid JSON number");const e=1023;let n,i,r,s,o;0===t?(i=0,r=0,n=1/t===-1/0?1:0):(n=t<0,(t=Math.abs(t))>=Math.pow(2,-1022)?(s=Math.min(Math.floor(Math.log(t)/Math.LN2),e),i=s+e,r=Math.round(t*Math.pow(2,52-s)-Math.pow(2,52))):(i=0,r=Math.round(t/Math.pow(2,-1074))));const a=[];for(o=52;o;o-=1)a.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;o-=1)a.push(i%2?1:0),i=Math.floor(i/2);a.push(n?1:0),a.reverse();const l=a.join("");let c="";for(o=0;o<64;o+=8){let t=parseInt(l.substr(o,8),2).toString(16);1===t.length&&(t="0"+t),c+=t}return c.toLowerCase()};const iu=new RegExp("^-?(0*)\\d{1,10}$"),ru=function(t){if(iu.test(t)){const e=Number(t);if(e>=-2147483648&&e<=2147483647)return e}return null},su=function(t){try{t()}catch(e){setTimeout((()=>{const t=e.stack||"";throw Hc("Exception was thrown by user callback.",t),e}),Math.floor(0))}},ou=function(t,e){const n=setTimeout(t,e);return"number"===typeof n&&"undefined"!==typeof Deno&&Deno.unrefTimer?Deno.unrefTimer(n):"object"===typeof n&&n.unref&&n.unref(),n};class au{constructor(t,e){this.appName_=t,this.appCheckProvider=e,this.appCheck=null===e||void 0===e?void 0:e.getImmediate({optional:!0}),this.appCheck||null===e||void 0===e||e.get().then((t=>this.appCheck=t))}getToken(t){return this.appCheck?this.appCheck.getToken(t):new Promise(((e,n)=>{setTimeout((()=>{this.appCheck?this.getToken(t).then(e,n):e(null)}),0)}))}addTokenChangeListener(t){var e;null===(e=this.appCheckProvider)||void 0===e||e.get().then((e=>e.addTokenListener(t)))}notifyForInvalidToken(){Hc(`Provided AppCheck credentials for the app named "${this.appName_}" are invalid. This usually indicates your app was not initialized correctly.`)}}class lu{constructor(t,e,n){this.appName_=t,this.firebaseOptions_=e,this.authProvider_=n,this.auth_=null,this.auth_=n.getImmediate({optional:!0}),this.auth_||n.onInit((t=>this.auth_=t))}getToken(t){return this.auth_?this.auth_.getToken(t).catch((t=>t&&"auth/token-not-initialized"===t.code?(Vc("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t))):new Promise(((e,n)=>{setTimeout((()=>{this.auth_?this.getToken(t).then(e,n):e(null)}),0)}))}addTokenChangeListener(t){this.auth_?this.auth_.addAuthTokenListener(t):this.authProvider_.get().then((e=>e.addAuthTokenListener(t)))}removeTokenChangeListener(t){this.authProvider_.get().then((e=>e.removeAuthTokenListener(t)))}notifyForInvalidToken(){let t='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',Hc(t)}}class cu{constructor(t){this.accessToken=t}getToken(t){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(t){t(this.accessToken)}removeTokenChangeListener(t){}notifyForInvalidToken(){}}cu.OWNER="owner";const uu="5",hu=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,du="ac",pu="websocket",fu="long_polling";class gu{constructor(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]&&arguments[7];this.secure=e,this.namespace=n,this.webSocketOnly=i,this.nodeAdmin=r,this.persistenceKey=s,this.includeNamespaceInQueryParams=o,this.isUsingEmulator=a,this._host=t.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=kc.get("host:"+t)||this._host}isCacheableHost(){return"s-"===this.internalHost.substr(0,2)}isCustomHost(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain}get host(){return this._host}set host(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&kc.set("host:"+this._host,this.internalHost))}toString(){let t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t}toURLString(){const t=this.secure?"https://":"http://",e=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${t}${this.host}/${e}`}}function mu(t,e,n){let i;if(Da("string"===typeof e,"typeof type must == string"),Da("object"===typeof n,"typeof params must == object"),e===pu)i=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else{if(e!==fu)throw new Error("Unknown connection type: "+e);i=(t.secure?"https://":"http://")+t.internalHost+"/.lp?"}(function(t){return t.host!==t.internalHost||t.isCustomHost()||t.includeNamespaceInQueryParams})(t)&&(n.ns=t.namespace);const r=[];return eu(n,((t,e)=>{r.push(t+"="+e)}
2)),i+r.join("&")}class _u{constructor(){this.counters_={}}incrementCounter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;ll(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e}get(){return $a(this.counters_)}}const yu={},vu={};function bu(t){const e=t.toString();return yu[e]||(yu[e]=new _u),yu[e]}class wu{constructor(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(t,e){for(this.pendingResponses[t]=e;this.pendingResponses[this.currentResponseNum];){const t=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let e=0;e<t.length;++e)t[e]&&su((()=>{this.onMessage_(t[e])}));if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}const Eu="start";class xu{constructor(t,e,n,i,r,s,o){this.connId=t,this.repoInfo=e,this.applicationId=n,this.appCheckToken=i,this.authToken=r,this.transportSessionId=s,this.lastSessionId=o,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=Wc(t),this.stats_=bu(e),this.urlFn=t=>(this.appCheckToken&&(t[du]=this.appCheckToken),mu(e,fu,t))}open(t,e){var n=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new wu(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout((()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null}),Math.floor(3e4)),function(t){if(el()||"complete"===document.readyState)t();else{let e=!1;const n=function(){document.body?e||(e=!0,t()):setTimeout(n,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",(()=>{"complete"===document.readyState&&n()})),window.attachEvent("onload",n))}}((()=>{if(this.isClosed_)return;this.scriptTagHolder=new Su((function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];const[r,s,o,a,l]=e;if(n.incrementIncomingBytes_(e),n.scriptTagHolder)if(n.connectTimeoutTimer_&&(clearTimeout(n.connectTimeoutTimer_),n.connectTimeoutTimer_=null),n.everConnected_=!0,r===Eu)n.id=s,n.password=o;else{if("close"!==r)throw new Error("Unrecognized command received: "+r);s?(n.scriptTagHolder.sendNewPolls=!1,n.myPacketOrderer.closeAfter(s,(()=>{n.onClosed_()}))):n.onClosed_()}}),(function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];const[r,s]=e;n.incrementIncomingBytes_(e),n.myPacketOrderer.handleResponse(r,s)}),(()=>{this.onClosed_()}),this.urlFn);const t={};t[Eu]="t",t.ser=Math.floor(1e8*Math.random()),this.scriptTagHolder.uniqueCallbackIdentifier&&(t.cb=this.scriptTagHolder.uniqueCallbackIdentifier),t.v=uu,this.transportSessionId&&(t.s=this.transportSessionId),this.lastSessionId&&(t.ls=this.lastSessionId),this.applicationId&&(t.p=this.applicationId),this.appCheckToken&&(t[du]=this.appCheckToken),"undefined"!==typeof location&&location.hostname&&hu.test(location.hostname)&&(t.r="f");const e=this.urlFn(t);this.log_("Connecting via long-poll to "+e),this.scriptTagHolder.addTag(e,(()=>{}))}))}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){xu.forceAllow_=!0}static forceDisallow(){xu.forceDisallow_=!0}static isAvailable(){return!el()&&(!!xu.forceAllow_||!xu.forceDisallow_&&"undefined"!==typeof document&&null!=document.createElement&&!("object"===typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))&&!("object"===typeof Windows&&"object"===typeof Windows.UI))}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(t){const e=ol(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);const n=ja(e),i=tu(n,1840);for(let r=0;r<i.length;r++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,i.length,i[r]),this.curSegmentNum++}addDisconnectPingFrame(t,e){if(el())return;this.myDisconnFrame=document.createElement("iframe");const n={dframe:"t"};n.id=t,n.pw=e,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(t){const e=ol(t).length;this.bytesReceived+=e,this.stats_.incrementCounter("bytes_received",e)}}class Su{constructor(t,e,n,i){if(this.onDisconnect=n,this.urlFn=i,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0,el())this.commandCB=t,this.onMessageCB=e;else{this.uniqueCallbackIdentifier=Dc(),window["pLPCommand"+this.uniqueCallbackIdentifier]=t,window["pRTLPCB"+this.uniqueCallbackIdentifier]=e,this.myIFrame=Su.createI
2Frame_();let n="";if(this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,11)){n='<script>document.domain="'+document.domain+'";<\/script>'}const i="<html><body>"+n+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(i),this.myIFrame.doc.close()}catch(r){Vc("frame writing exception"),r.stack&&Vc(r.stack),Vc(r)}}}static createIFrame_(){const t=document.createElement("iframe");if(t.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(t);try{t.contentWindow.document||Vc("No IE domain setting required")}catch(e){const n=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+n+"';document.close();})())"}return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout((()=>{null!==this.myIFrame&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)}),Math.floor(0)));const t=this.onDisconnect;t&&(this.onDisconnect=null,t())}startLongPoll(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const t={};t.id=this.myID,t.pw=this.myPW,t.ser=this.currentSerial;let e=this.urlFn(t),n="",i=0;for(;this.pendingSegs.length>0;){if(!(this.pendingSegs[0].d.length+30+n.length<=1870))break;{const t=this.pendingSegs.shift();n=n+"&seg"+i+"="+t.seg+"&ts"+i+"="+t.ts+"&d"+i+"="+t.d,i++}}return e+=n,this.addLongPollTag_(e,this.currentSerial),!0}return!1}enqueueSegment(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()}addLongPollTag_(t,e){this.outstandingRequests.add(e);const n=()=>{this.outstandingRequests.delete(e),this.newRequest_()},i=setTimeout(n,Math.floor(25e3));this.addTag(t,(()=>{clearTimeout(i),n()}))}addTag(t,e){el()?this.doNodeLongPoll(t,e):setTimeout((()=>{try{if(!this.sendNewPolls)return;const n=this.myIFrame.doc.createElement("script");n.type="text/javascript",n.async=!0,n.src=t,n.onload=n.onreadystatechange=function(){const t=n.readyState;t&&"loaded"!==t&&"complete"!==t||(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),e())},n.onerror=()=>{Vc("Long-poll script failed to load: "+t),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(n)}catch(n){}}),Math.floor(1))}}let Tu=null;"undefined"!==typeof MozWebSocket?Tu=MozWebSocket:"undefined"!==typeof WebSocket&&(Tu=WebSocket);class Cu{constructor(t,e,n,i,r,s,o){this.connId=t,this.applicationId=n,this.appCheckToken=i,this.authToken=r,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=Wc(this.connId),this.stats_=bu(e),this.connURL=Cu.connectionURL_(e,s,o,i,n),this.nodeAdmin=e.nodeAdmin}static connectionURL_(t,e,n,i,r){const s={};return s.v=uu,!el()&&"undefined"!==typeof location&&location.hostname&&hu.test(location.hostname)&&(s.r="f"),e&&(s.s=e),n&&(s.ls=n),i&&(s[du]=i),r&&(s.p=r),mu(t,pu,s)}open(t,e){this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,kc.set("previous_websocket_failure",!0);try{let t;if(el()){const e=this.nodeAdmin?"AdminNode":"Node";t={headers:{"User-Agent":`Firebase/${uu}/${Pc}/${process.platform}/${e}`,"X-Firebase-GMPID":this.applicationId||""}},this.authToken&&(t.headers.Authorization=`Bearer ${this.authToken}`),this.appCheckToken&&(t.headers["X-Firebase-AppCheck"]=this.appCheckToken);const n={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_FIREBASE_PASSWORD:"ClearloopData123!",REACT_APP_OPENWEATHER_API_KEY:"03c641fb2401c9014257bab115dd66ad",REACT_APP_FIREBASE_EMAIL:"[email protected]",REACT_APP_MAPBOX_TOKEN:"pk.eyJ1IjoibWFuZGFsaSIsImEiOiJjbHh0Z2I4YW0wNGtvMmlvYzZhM28wMTV2In0.maKcZ_aBF3G64JMJM2W1EQ"},i=0===this.connURL.indexOf("wss://")?n.HTTPS_PROXY||n.https_proxy:n.HTTP_PROXY||n.http_proxy;i&&(t.proxy={origin:i})}this.mySock=new Tu(this.connURL,[],t)}catch(n){this.log_("Error instantiating WebSocket.");const t=n.message||n.data;return t&&this.log_(t),void this.onClosed_()}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0}
vendor: 28,241 bytes, line 2
2,this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=t=>{this.handleIncomingFrame(t)},this.mySock.onerror=t=>{this.log_("WebSocket error. Closing connection.");const e=t.message||t.data;e&&this.log_(e),this.onClosed_()}}start(){}static forceDisallow(){Cu.forceDisallow_=!0}static isAvailable(){let t=!1;if("undefined"!==typeof navigator&&navigator.userAgent){const e=/Android ([0-9]{0,}\.[0-9]{0,})/,n=navigator.userAgent.match(e);n&&n.length>1&&parseFloat(n[1])<4.4&&(t=!0)}return!t&&null!==Tu&&!Cu.forceDisallow_}static previouslyFailed(){return kc.isInMemoryStorage||!0===kc.get("previous_websocket_failure")}markConnectionHealthy(){kc.remove("previous_websocket_failure")}appendFrame_(t){if(this.frames.push(t),this.frames.length===this.totalFrames){const t=this.frames.join("");this.frames=null;const e=sl(t);this.onMessage(e)}}handleNewFrameCount_(t){this.totalFrames=t,this.frames=[]}extractFrameCount_(t){if(Da(null===this.frames,"We already have a frame buffer"),t.length<=6){const e=Number(t);if(!isNaN(e))return this.handleNewFrameCount_(e),null}return this.handleNewFrameCount_(1),t}handleIncomingFrame(t){if(null===this.mySock)return;const e=t.data;if(this.bytesReceived+=e.length,this.stats_.incrementCounter("bytes_received",e.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(e);else{const t=this.extractFrameCount_(e);null!==t&&this.appendFrame_(t)}}send(t){this.resetKeepAlive();const e=ol(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);const n=tu(e,16384);n.length>1&&this.sendString_(String(n.length));for(let i=0;i<n.length;i++)this.sendString_(n[i])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval((()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()}),Math.floor(45e3))}sendString_(t){try{this.mySock.send(t)}catch(e){this.log_("Exception thrown from WebSocket.send():",e.message||e.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}Cu.responsesRequiredToBeHealthy=2,Cu.healthyTimeout=3e4;class Au{constructor(t){this.initTransports_(t)}static get ALL_TRANSPORTS(){return[xu,Cu]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}initTransports_(t){const e=Cu&&Cu.isAvailable();let n=e&&!Cu.previouslyFailed();if(t.webSocketOnly&&(e||Hc("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),n=!0),n)this.transports_=[Cu];else{const t=this.transports_=[];for(const e of Au.ALL_TRANSPORTS)e&&e.isAvailable()&&t.push(e);Au.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}Au.globalTransportInitialized_=!1;class Pu{constructor(t,e,n,i,r,s,o,a,l,c){this.id=t,this.repoInfo_=e,this.applicationId_=n,this.appCheckToken_=i,this.authToken_=r,this.onMessage_=s,this.onReady_=o,this.onDisconnect_=a,this.onKill_=l,this.lastSessionId=c,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=Wc("c:"+this.id+":"),this.transportManager_=new Au(e),this.log_("Connection created"),this.start_()}start_(){const t=this.transportManager_.initialTransport();this.conn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;const e=this.connReceiver_(this.conn_),n=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout((()=>{this.conn_&&this.conn_.open(e,n)}),Math.floor(0));const i=t.healthyTimeout||0;i>0&&(this.healthyTimeout_=ou((()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>102400?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>10240?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))}),Math.floor(i)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(t){return e=>{t===this.conn_?this.onConnectionLost_(e):t===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(t){return e=>{2!==this.state_&&(t===this.rx_?this.onPrimaryMessageReceived_(e):t===this.secondaryConn_?this.onSecondaryMessageReceived_(e):this.log_("message on old connection"))}}sendRequest(t){const e={t:"d",d:t};this.sendData_(e)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(t){if("t"in t){const e=t.t;"a"===e?this.upgradeIfSecondaryHealthy_():"r"===e?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===e&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(t){const e=Jc("t",t),n=Jc("d",t);if("c"===e)this.onSecondaryControl_(n);else{if("d"!==e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(n)}}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:"p",d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(t){const e=Jc("t",t),n=Jc("d",t);"c"===e?this.onControl_(n):"d"===e&&this.onDataMessage_(n)}onDataMessage_(t){this.onPrimaryResponse_(),this.onMessage_(t)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(t){const e=Jc("t",t);if("d"in t){const n=t.d;if("h"===e){const t=Object.assign({},n);this.repoInfo_.isUsingEmulator&&(t.h=this.repoInfo_.host),this.onHandshake_(t)}else if("n"===e){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let t=0;t<this.pendingDataMessages.length;++t)this.onDataMessage_(this.pendingDataMessages[t]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===e?this.onConnectionShutdown_(n):"r"===e?this.onReset_(n):"e"===e?$c("Server Error: "+n):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):$c("Unknown control packet command: "+e)}}onHandshake_(t){const e=t.ts,n=t.v,i=t.h;this.sessionId=t.s,this.repoInfo_.host=i,0===this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,e),uu!==n&&Hc("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){const t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)}startUpgrade_(t){this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;const e=this.connReceiver_(this.secondaryConn_),n=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(e,n),ou((()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())}),Math.floor(6e4))}onReset_(t){this.log_("Reset packet received. New host: "+t),this.repoInfo_.host=t,1===this.state_?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(t,e){this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(e,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):ou((()=>{this.sendPingOnPrimaryIfNecessary_()}),Math.floor(5e3))}sendPingOnPrimaryIfNecessary_(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))}onSecondaryConnectionLost_(){const t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()}onConnectionLost_(t){this.conn_=null,t||0!==this.state_?1===this.state_&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(kc.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()}onConnectionShutdown_(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)}close(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}class Ru{put(t,e,n,i){}merge(t,e,n,i){}refreshAuthToken(t){}refreshAppCheckToken(t){}onDisconnectPut(t,e,n){}onDisconnectMerge(t,e,n){}onDisconnectCancel(t,e){}reportStats(t){}}class Mu{constructor(t){this.allowedEvents_=t,this.listeners_={},Da(Array.isArray(t)&&t.length>0,"Requires a non-empty array")}trigger(t){if(Array.isArray(this.listeners_[t])){const r=[...this.listeners_[t]];for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];for(let t=0;t<r.length;t++)r[t].callback.apply(r[t].context,n)}}on(t,e,n){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:e,context:n});const i=this.getInitialEvent(t);i&&e.apply(n,i)}off(t,e,n){this.validateEventType_(t);const i=this.listeners_[t]||[];for(let r=0;r<i.length;r++)if(i[r].callback===e&&(!n||n===i[r].context))return void i.splice(r,1)}validateEventType_(t){Da(this.allowedEvents_.find((e=>e===t)),"Unknown event: "+t)}}class Iu extends Mu{constructor(){super(["online"]),this.online_=!0,"undefined"===typeof window||"undefined"===typeof window.addEventListener||Qa()||(window.addEventListener("online",(()=>{this.online_||(this.online_=!0,this.trigger("online",!0))}),!1),window.addEventListener("offline",(()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))}),!1))}static getInstance(){return new Iu}getInitialEvent(t){return Da("online"===t,"Unknown event type: "+t),[this.online_]}currentlyOnline(){return this.online_}}const Lu=32,ku=768;class Nu{constructor(t,e){if(void 0===e){this.pieces_=t.split("/");let e=0;for(let t=0;t<this.pieces_.length;t++)this.pieces_[t].length>0&&(this.pieces_[e]=this.pieces_[t],e++);this.pieces_.length=e,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=e}toString(){let t="";for(let e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"}}function Ou(){return new Nu("")}function Du(t){return t.pieceNum_>=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function Fu(t){return t.pieces_.length-t.pieceNum_}function Bu(t){let e=t.pieceNum_;return e<t.pieces_.length&&e++,new Nu(t.pieces_,e)}function Uu(t){return t.pieceNum_<t.pieces_.length?t.pieces_[t.pieces_.length-1]:null}function zu(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.pieces_.slice(t.pieceNum_+e)}function ju(t){if(t.pieceNum_>=t.pieces_.length)return null;const e=[];for(let n=t.pieceNum_;n<t.pieces_.length-1;n++)e.push(t.pieces_[n]);return new Nu(e,0)}function Vu(t,e){const n=[];for(let i=t.pieceNum_;i<t.pieces_.length;i++)n.push(t.pieces_[i]);if(e instanceof Nu)for(let i=e.pieceNum_;i<e.pieces_.length;i++)n.push(e.pieces_[i]);else{const t=e.split("/");for(let e=0;e<t.length;e++)t[e].length>0&&n.push(t[e])}return new Nu(n,0)}function Wu(t){return t.pieceNum_>=t.pieces_.length}function $u(t,e){const n=Du(t),i=Du(e);if(null===n)return e;if(n===i)return $u(Bu(t),Bu(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function Gu(t,e){if(Fu(t)!==Fu(e))return!1;for(let n=t.pieceNum_,i=e.pieceNum_;n<=t.pieces_.length;n++,i++)if(t.pieces_[n]!==e.pieces_[i])return!1;return!0}function Hu(t,e){let n=t.pieceNum_,i=e.pieceNum_;if(Fu(t)>Fu(e))return!1;for(;n<t.pieces_.length;){if(t.pieces_[n]!==e.pieces_[i])return!1;++n,++i}return!0}class qu{constructor(t,e){this.errorPrefix_=e,this.parts_=zu(t,0),this.byteLength_=Math.max(1,this.parts_.length);for(let n=0;n<this.parts_.length;n++)this.byteLength_+=wl(this.parts_[n]);Zu(this)}}function Zu(t){if(t.byteLength_>ku)throw new Error(t.errorPrefix_+"has a key path longer than "+ku+" bytes ("+t.byteLength_+").");if(t.parts_.length>Lu)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Lu+") or object contains a cycle "+Xu(t))}function Xu(t){return 0===t.parts_.length?"":"in property '"+t.parts_.join(".")+"'"}class Ku extends Mu{constructor(){let t,e;super(["visible"]),"undefined"!==typeof document&&"undefined"!==typeof document.addEventListener&&("undefined"!==typeof document.hidden?(e="visibilitychange",t="hidden"):"undefined"!==typeof document.mozHidden?(e="mozvisibilitychange",t="mozHidden"):"undefined"!==typeof document.msHidden?(e="msvisibilitychange",t="msHidden"):"undefined"!==typeof document.webkitHidden&&(e="webkitvisibilitychange",t="webkitHidden")),this.visible_=!0,e&&document.addEventListener(e,(()=>{const e=!document[t];e!==this.visible_&&(this.visible_=e,this.trigger("visible",e))}),!1)}static getInstance(){return new Ku}getInitialEvent(t){return Da("visible"===t,"Unknown event type: "+t),[this.visible_]}}const Yu=1e3;class Ju extends Ru{constructor(t,e,n,i,r,s,o,a){if(super(),this.repoInfo_=t,this.applicationId_=e,this.onDataUpdate_=n,this.onConnectStatus_=i,this.onServerInfoUpdate_=r,this.authTokenProvider_=s,this.appCheckTokenProvider_=o,this.authOverride_=a,this.id=Ju.nextPersistentConnectionId_++,this.log_=Wc("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=Yu,this.maxReconnectDelay_=3e5,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,a&&!el())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");Ku.getInstance().on("visible",this.onVisible_,this),-1===t.host.indexOf("fblocal")&&Iu.getInstance().on("online",this.onOnline_,this)}sendRequest(t,e,n){const i=++this.requestNumber_,r={r:i,a:t,b:e};this.log_(ol(r)),Da(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(r),n&&(this.requestCBHash_[i]=n)}get(t){this.initConnection_();const e=new Ya,n={action:"g",request:{p:t._path.toString(),q:t._queryObject},onComplete:t=>{const n=t.d;"ok"===t.s?e.resolve(n):e.reject(n)}};this.outstandingGets_.push(n),this.outstandingGetCount_++;const i=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(i),e.promise}listen(t,e,n,i){this.initConnection_();const r=t._queryIdentifier,s=t._path.toString();this.log_("Listen called for "+s+" "+r),this.listens.has(s)||this.listens.set(s,new Map),Da(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"listen() called for non-default but complete query"),Da(!this.listens.get(s).has(r),"listen() called twice for same path/queryId.");const o={onComplete:i,hashFn:e,query:t,tag:n};this.listens.get(s).set(r,o),this.connected_&&this.sendListen_(o)}sendGet_(t){const e=this.outstandingGets_[t];this.sendRequest("g",e.request,(n=>{delete this.outstandingGets_[t],this.outstandingGetCount_--,0===this.outstandingGetCount_&&(this.outstandingGets_=[]),e.onComplete&&e.onComplete(n)}))}sendListen_(t){const e=t.query,n=e._path.toString(),i=e._queryIdentifier;this.log_("Listen on "+n+" for "+i);const r={p:n};t.tag&&(r.q=e._queryObject,r.t=t.tag),r.h=t.hashFn(),this.sendRequest("q",r,(r=>{const s=r.d,o=r.s;Ju.warnOnListenWarnings_(s,e);(this.listens.get(n)&&this.listens.get(n).get(i))===t&&(this.log_("listen response",r),"ok"!==o&&this.removeListen_(n,i),t.onComplete&&t.onComplete(o,s))}))}static warnOnListenWarnings_(t,e){if(t&&"object"===typeof t&&ll(t,"w")){const n=cl(t,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){const t='".indexOn": "'+e._queryParams.getIndex().toString()+'"',n=e._path.toString();Hc(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${t} at ${n} to your security rules for better performance.`)}}}refreshAuthToken(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},(()=>{})),this.reduceReconnectDelayIfAdminCredential_(t)}reduceReconnectDelayIfAdminCredential_(t){(t&&40===t.length||function(t){const e=al(t).claims;return"object"===typeof e&&!0===e.admin}(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=3e4)}refreshAppCheckToken(t){this.appCheckToken_=t,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},(()=>{}))}tryAuth(){if(this.connected_&&this.authToken_){const t=this.authToken_,e=function(t){const e=al(t).claims;return!!e&&"object"===typeof e&&e.hasOwnProperty("iat")}(t)?"auth":"gauth",n={cred:t};null===this.authOverride_?n.noauth=!0:"object"===typeof this.authOverride_&&(n.authvar=this.authOverride_),this.sendRequest(e,n,(e=>{const n=e.s,i=e.d||"error";this.authToken_===t&&("ok"===n?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(n,i))}))}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},(t=>{const e=t.s,n=t.d||"error";"ok"===e?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(e,n)}))}unlisten(t,e){const n=t._path.toString(),i=t._queryIdentifier;this.log_("Unlisten called for "+n+" "+i),Da(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"unlisten() called for non-default but complete query");this.removeListen_(n,i)&&this.connected_&&this.sendUnlisten_(n,i,t._queryObject,e)}sendUnlisten_(t,e,n,i){this.log_("Unlisten on "+t+" for "+e);const r={p:t};i&&(r.q=n,r.t=i),this.sendRequest("n",r)}onDisconnectPut(t,e,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:e,onComplete:n})}onDisconnectMerge(t,e,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:e,onComplete:n})}onDisconnectCancel(t,e){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})}sendOnDisconnect_(t,e,n,i){const r={p:e,d:n};this.log_("onDisconnect "+t,r),this.sendRequest(t,r,(t=>{i&&setTimeout((()=>{i(t.s,t.d)}),Math.floor(0))}))}put(t,e,n,i){this.putInternal("p",t,e,n,i)}merge(t,e,n,i){this.putInternal("m",t,e,n,i)}putInternal(t,e,n,i,r){this.initConnection_();const s={p:e,d:n};void 0!==r&&(s.h=r),this.outstandingPuts_.push({action:t,request:s,onComplete:i}),this.outstandingPutCount_++;const o=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(o):this.log_("Buffering put: "+e)}sendPut_(t){const e=this.outstandingPuts_[t].action,n=this.outstandingPuts_[t].request,i=this.outstandingPuts_[t].onComplete;this.outstandingPuts_[t].queued=this.connected_,this.sendRequest(e,n,(n=>{this.log_(e+" response",n),delete this.outstandingPuts_[t],this.outstandingPutCount_--,0===this.outstandingPutCount_&&(this.outstandingPuts_=[]),i&&i(n.s,n.d)}))}reportStats(t){if(this.connected_){const e={c:t};this.log_("reportStats",e),this.sendRequest("s",e,(t=>{if("ok"!==t.s){const e=t.d;this.log_("reportStats","Error sending stats: "+e)}}))}}onDataMessage_(t){if("r"in t){this.log_("from server: "+ol(t));const e=t.r,n=this.requestCBHash_[e];n&&(delete this.requestCBHash_[e],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}}onDataPush_(t,e){this.log_("handleServerMessage",t,e),"d"===t?this.onDataUpdate_(e.p,e.d,!1,e.t):"m"===t?this.onDataUpdate_(e.p,e.d,!0,e.t):"c"===t?this.onListenRevoked_(e.p,e.q):"ac"===t?this.onAuthRevoked_(e.s,e.d):"apc"===t?this.onAppCheckRevoked_(e.s,e.d):"sd"===t?this.onSecurityDebugPacket_(e):$c("Unrecognized action received from server: "+ol(t)+"\nAre you using the latest client?")}onReady_(t,e){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=(new Date).getTime(),this.handleTimestamp_(t),this.lastSessionId=e,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(t){Da(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout((()=>{this.establishConnectionTimer_=null,this.establishConnection_()}),Math.floor(t))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=Yu,this.realtime_||this.scheduleConnect_(0)),this.visible_=t}onOnline_(t){t?(this.log_("Browser went online."),this.reconnectDelay_=Yu,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){if(this.visible_){if(this.lastConnectionEstablishedTime_){(new Date).getTime()-this.lastConnectionEstablishedTime_>3e4&&(this.reconnectDelay_=Yu),this.lastConnectionEstablishedTime_=null}}else this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime();const t=(new Date).getTime()-this.lastConnectionAttemptTime_;let e=Math.max(0,this.reconnectDelay_-t);e=Math.random()*e,this.log_("Trying to reconnect in "+e+"ms"),this.scheduleConnect_(e),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;const t=this.onDataMessage_.bind(this),e=this.onReady_.bind(this),n=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+Ju.nextConnectionId_++,r=this.lastSessionId;let s=!1,o=null;const a=function(){o?o.close():(s=!0,n())},l=function(t){Da(o,"sendRequest call when we're not connected not allowed."),o.sendRequest(t)};this.realtime_={close:a,sendRequest:l};const c=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[a,l]=await Promise.all([this.authTokenProvider_.getToken(c),this.appCheckTokenProvider_.getToken(c)]);s?Vc("getToken() completed but was canceled"):(Vc("getToken() completed. Creating connection."),this.authToken_=a&&a.accessToken,this.appCheckToken_=l&&l.token,o=new Pu(i,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,t,e,n,(t=>{Hc(t+" ("+this.repoInfo_.toString()+")"),this.interrupt("server_kill")}),r))}catch($c){this.log_("Failed to get token: "+$c),s||(this.repoInfo_.nodeAdmin&&Hc($c),a())}}}interrupt(t){Vc("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(t){Vc("Resuming connection for reason: "+t),delete this.interruptReasons_[t],ul(this.interruptReasons_)&&(this.reconnectDelay_=Yu,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(t){const e=t-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:e})}cancelSentTransactions_(){for(let t=0;t<this.outstandingPuts_.length;t++){const e=this.outstandingPuts_[t];e&&"h"in e.request&&e.queued&&(e.onComplete&&e.onComplete("disconnect"),delete this.outstandingPuts_[t],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])}onListenRevoked_(t,e){let n;n=e?e.map((t=>Qc(t))).join("$"):"default";const i=this.removeListen_(t,n);i&&i.onComplete&&i.onComplete("permission_denied")}removeListen_(t,e){const n=new Nu(t).toString();let i;if(this.listens.has(n)){const t=this.listens.get(n);i=t.get(e),t.delete(e),0===t.size&&this.listens.delete(n)}else i=void 0;return i}onAuthRevoked_(t,e){Vc("Auth token revoked: "+t+"/"+e),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),"invalid_token"!==t&&"permission_denied"!==t||(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(t,e){Vc("App check token revoked: "+t+"/"+e),this.appCheckToken_=null,this.forceTokenRefresh_=!0,"invalid_token"!==t&&"permission_denied"!==t||(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=3&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of this.listens.values())for(const e of t.values())this.sendListen_(e);for(let t=0;t<this.outstandingPuts_.length;t++)this.outstandingPuts_[t]&&this.sendPut_(t);for(;this.onDisconnectRequestQueue_.length;){const t=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(t.action,t.pathString,t.data,t.onComplete)}for(let t=0;t<this.outstandingGets_.length;t++)this.outstandingGets_[t]&&this.sendGet_(t)}sendConnectStats_(){const t={};let e="js";el()&&(e=this.repoInfo_.nodeAdmin?"admin_node":"node"),t["sdk."+e+"."+Pc.replace(/\./g,"-")]=1,Qa()?t["framework.cordova"]=1:tl()&&(t["framework.reactnative"]=1),this.reportStats(t)}shouldReconnect_(){const t=Iu.getInstance().currentlyOnline();return ul(this.interruptReasons_)&&t}}Ju.nextPersistentConnectionId_=0,Ju.nextConnectionId_=0;class Qu{constructor(t,e){this.name=t,this.node=e}static Wrap(t,e){return new Qu(t,e)}}class th{getCompare(){return this.compare.bind(this)}indexedValueChanged(t,e){const n=new Qu(Zc,t),i=new Qu(Zc,e);return 0!==this.compare(n,i)}
vendor: 4,127 bytes, line 2
2minPost(){return Qu.MIN}}let eh;class nh extends th{static get __EMPTY_NODE(){return eh}static set __EMPTY_NODE(t){eh=t}compare(t,e){return Kc(t.name,e.name)}isDefinedOn(t){throw Fa("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(t,e){return!1}minPost(){return Qu.MIN}maxPost(){return new Qu(Xc,eh)}makePost(t,e){return Da("string"===typeof t,"KeyIndex indexValue must always be a string."),new Qu(t,eh)}toString(){return".key"}}const ih=new nh;class rh{constructor(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;this.isReverse_=i,this.resultGenerator_=r,this.nodeStack_=[];let s=1;for(;!t.isEmpty();)if(s=e?n(t.key,e):1,i&&(s*=-1),s<0)t=this.isReverse_?t.left:t.right;else{if(0===s){this.nodeStack_.push(t);break}this.nodeStack_.push(t),t=this.isReverse_?t.right:t.left}}getNext(){if(0===this.nodeStack_.length)return null;let t,e=this.nodeStack_.pop();if(t=this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value},this.isReverse_)for(e=e.left;!e.isEmpty();)this.nodeStack_.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack_.push(e),e=e.left;return t}hasNext(){return this.nodeStack_.length>0}peek(){if(0===this.nodeStack_.length)return null;const t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}}}class sh{constructor(t,e,n,i,r){this.key=t,this.value=e,this.color=null!=n?n:sh.RED,this.left=null!=i?i:oh.EMPTY_NODE,this.right=null!=r?r:oh.EMPTY_NODE}copy(t,e,n,i,r){return new sh(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=i?i:this.left,null!=r?r:this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let i=this;const r=n(t,i.key);return i=r<0?i.copy(null,null,null,i.left.insert(t,e,n),null):0===r?i.copy(null,e,null,null,null):i.copy(null,null,null,null,i.right.insert(t,e,n)),i.fixUp_()}removeMin_(){if(this.left.isEmpty())return oh.EMPTY_NODE;let t=this;return t.left.isRed_()||t.left.left.isRed_()||(t=t.moveRedLeft_()),t=t.copy(null,null,null,t.left.removeMin_(),null),t.fixUp_()}remove(t,e){let n,i;if(n=this,e(t,n.key)<0)n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===e(t,n.key)){if(n.right.isEmpty())return oh.EMPTY_NODE;i=n.right.min_(),n=n.copy(i.key,i.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.fixUp_()}isRed_(){return this.color}fixUp_(){let t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t}moveRedLeft_(){let t=this.colorFlip_();return t.right.left.isRed_()&&(t=t.copy(null,null,null,null,t.right.rotateRight_()),t=t.rotateLeft_(),t=t.colorFlip_()),t}moveRedRight_(){let t=this.colorFlip_();return t.left.left.isRed_()&&(t=t.rotateRight_(),t=t.colorFlip_()),t}rotateLeft_(){const t=this.copy(null,null,sh.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight_(){const t=this.copy(null,null,sh.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip_(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth_(){const t=this.check_();return Math.pow(2,t)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");
vendor: 13,984 bytes, line 2
2if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const t=this.left.check_();if(t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)}}sh.RED=!0,sh.BLACK=!1;class oh{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oh.EMPTY_NODE;this.comparator_=t,this.root_=e}insert(t,e){return new oh(this.comparator_,this.root_.insert(t,e,this.comparator_).copy(null,null,sh.BLACK,null,null))}remove(t){return new oh(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,sh.BLACK,null,null))}get(t){let e,n=this.root_;for(;!n.isEmpty();){if(e=this.comparator_(t,n.key),0===e)return n.value;e<0?n=n.left:e>0&&(n=n.right)}return null}getPredecessorKey(t){let e,n=this.root_,i=null;for(;!n.isEmpty();){if(e=this.comparator_(t,n.key),0===e){if(n.left.isEmpty())return i?i.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}e<0?n=n.left:e>0&&(i=n,n=n.right)}throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(t){return this.root_.inorderTraversal(t)}reverseTraversal(t){return this.root_.reverseTraversal(t)}getIterator(t){return new rh(this.root_,null,this.comparator_,!1,t)}getIteratorFrom(t,e){return new rh(this.root_,t,this.comparator_,!1,e)}getReverseIteratorFrom(t,e){return new rh(this.root_,t,this.comparator_,!0,e)}getReverseIterator(t){return new rh(this.root_,null,this.comparator_,!0,t)}}function ah(t,e){return Kc(t.name,e.name)}function lh(t,e){return Kc(t,e)}let ch;oh.EMPTY_NODE=new class{copy(t,e,n,i,r){return this}insert(t,e,n){return new sh(t,e,null)}remove(t,e){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}};const uh=function(t){return"number"===typeof t?"number:"+nu(t):"string:"+t},hh=function(t){if(t.isLeafNode()){const e=t.val();Da("string"===typeof e||"number"===typeof e||"object"===typeof e&&ll(e,".sv"),"Priority must be a string or number.")}else Da(t===ch||t.isEmpty(),"priority of unexpected type.");Da(t===ch||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};let dh,ph,fh;class gh{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gh.__childrenNodeConstructor.EMPTY_NODE;this.value_=t,this.priorityNode_=e,this.lazyHash_=null,Da(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),hh(this.priorityNode_)}static set __childrenNodeConstructor(t){dh=t}static get __childrenNodeConstructor(){return dh}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(t){return new gh(this.value_,t)}getImmediateChild(t){return".priority"===t?this.priorityNode_:gh.__childrenNodeConstructor.EMPTY_NODE}getChild(t){return Wu(t)?this:".priority"===Du(t)?this.priorityNode_:gh.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(t,e){return null}updateImmediateChild(t,e){return".priority"===t?this.updatePriority(e):e.isEmpty()&&".priority"!==t?this:gh.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,e).updatePriority(this.priorityNode_)}updateChild(t,e){const n=Du(t);return null===n?e:e.isEmpty()&&".priority"!==n?this:(Da(".priority"!==n||1===Fu(t),".priority must be the last token in a path"),this.updateImmediateChild(n,gh.__childrenNodeConstructor.EMPTY_NODE.updateChild(Bu(t),e)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(t,e){return!1}val(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(null===this.lazyHash_){let t="";this.priorityNode_.isEmpty()||(t+="priority:"+uh(this.priorityNode_.val())+":");const e=typeof this.value_;t+=e+":",t+="number"===e?nu(this.value_):this.value_,this.lazyHash_=Fc(t)}return this.lazyHash_}getValue(){return this.value_}compareTo(t){return t===gh.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof gh.__childrenNodeConstructor?-1:(Da(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))}compareToLeafNode_(t){const e=typeof t.value_,n=typeof this.value_,i=gh.VALUE_TYPE_ORDER.indexOf(e),r=gh.VALUE_TYPE_ORDER.indexOf(n);return Da(i>=0,"Unknown leaf type: "+e),Da(r>=0,"Unknown leaf type: "+n),i===r?"object"===n?0:this.value_<t.value_?-1:this.value_===t.value_?0:1:r-i}withIndex(){return this}isIndexed(){return!0}equals(t){if(t===this)return!0;if(t.isLeafNode()){const e=t;return this.value_===e.value_&&this.priorityNode_.equals(e.priorityNode_)}return!1}}gh.VALUE_TYPE_ORDER=["object","boolean","number","string"];const mh=new class extends th{compare(t,e){const n=t.node.getPriority(),i=e.node.getPriority(),r=n.compareTo(i);return 0===r?Kc(t.name,e.name):r}isDefinedOn(t){return!t.getPriority().isEmpty()}indexedValueChanged(t,e){return!t.getPriority().equals(e.getPriority())}minPost(){return Qu.MIN}maxPost(){return new Qu(Xc,new gh("[PRIORITY-POST]",fh))}makePost(t,e){const n=ph(t);return new Qu(e,new gh("[PRIORITY-POST]",n))}toString(){return".priority"}},_h=Math.log(2);class yh{constructor(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/_h,10)),this.current_=this.count-1;const n=(i=this.count,parseInt(Array(i+1).join("1"),2));var i;this.bits_=t+1&n}nextBitIsOne(){const t=!(this.bits_&1<<this.current_);return this.current_--,t}}const vh=function(t,e,n,i){t.sort(e);const r=function(e,i){const s=i-e;let o,a;if(0===s)return null;if(1===s)return o=t[e],a=n?n(o):o,new sh(a,o.node,sh.BLACK,null,null);{const l=parseInt(s/2,10)+e,c=r(e,l),u=r(l+1,i);return o=t[l],a=n?n(o):o,new sh(a,o.node,sh.BLACK,c,u)}},s=function(e){let i=null,s=null,o=t.length;const a=function(e,i){const s=o-e,a=o;o-=e;const c=r(s+1,a),u=t[s],h=n?n(u):u;l(new sh(h,u.node,i,null,c))},l=function(t){i?(i.left=t,i=t):(s=t,i=t)};for(let t=0;t<e.count;++t){const n=e.nextBitIsOne(),i=Math.pow(2,e.count-(t+1));n?a(i,sh.BLACK):(a(i,sh.BLACK),a(i,sh.RED))}return s}(new yh(t.length));return new oh(i||e,s)};let bh;const wh={};class Eh{constructor(t,e){this.indexes_=t,this.indexSet_=e}static get Default(){return Da(wh&&mh,"ChildrenNode.ts has not been loaded"),bh=bh||new Eh({".priority":wh},{".priority":mh}),bh}get(t){const e=cl(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e instanceof oh?e:null}hasIndex(t){return ll(this.indexSet_,t.toString())}addIndex(t,e){Da(t!==ih,"KeyIndex always exists and isn't meant to be added to the IndexMap.");const n=[];let i=!1;const r=e.getIterator(Qu.Wrap);let s,o=r.getNext();for(;o;)i=i||t.isDefinedOn(o.node),n.push(o),o=r.getNext();s=i?vh(n,t.getCompare()):wh;const a=t.toString(),l=Object.assign({},this.indexSet_);l[a]=t;const c=Object.assign({},this.indexes_);return c[a]=s,new Eh(c,l)}addToIndexes(t,e){const n=hl(this.indexes_,((n,i)=>{const r=cl(this.indexSet_,i);if(Da(r,"Missing index implementation for "+i),n===wh){if(r.isDefinedOn(t.node)){const n=[],i=e.getIterator(Qu.Wrap);let s=i.getNext();for(;s;)s.name!==t.name&&n.push(s),s=i.getNext();return n.push(t),vh(n,r.getCompare())}return wh}{const i=e.get(t.name);let r=n;return i&&(r=r.remove(new Qu(t.name,i))),r.insert(t,t.node)}}));return new Eh(n,this.indexSet_)}removeFromIndexes(t,e){const n=hl(this.indexes_,(n=>{if(n===wh)return n;{const i=e.get(t.name);return i?n.remove(new Qu(t.name,i)):n}}));return new Eh(n,this.indexSet_)}}let xh;class Sh{constructor(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&hh(this.priorityNode_),this.children_.isEmpty()&&Da(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}static get EMPTY_NODE(){return xh||(xh=new Sh(new oh(lh),null,Eh.Default))}isLeafNode(){return!1}getPriority(){return this.priorityNode_||xh}updatePriority(t){return this.children_.isEmpty()?this:new Sh(this.children_,t,this.indexMap_)}getImmediateChild(t){if(".priority"===t)return this.getPriority();{const e=this.children_.get(t);return null===e?xh:e}}getChild(t){const e=Du(t);return null===e?this:this.getImmediateChild(e).getChild(Bu(t))}hasChild(t){return null!==this.children_.get(t)}updateImmediateChild(t,e){if(Da(e,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(e);{const n=new Qu(t,e);let i,r;e.isEmpty()?(i=this.children_.remove(t),r=this.indexMap_.removeFromIndexes(n,this.children_)):(i=this.children_.insert(t,e),r=this.indexMap_.addToIndexes(n,this.children_));const s=i.isEmpty()?xh:this.priorityNode_;return new Sh(i,s,r)}}updateChild(t,e){const n=Du(t);if(null===n)return e;{Da(".priority"!==Du(t)||1===Fu(t),".priority must be the last token in a path");const i=this.getImmediateChild(n).updateChild(Bu(t),e);return this.updateImmediateChild(n,i)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(t){if(this.isEmpty())return null;const e={};let n=0,i=0,r=!0;if(this.forEachChild(mh,((s,o)=>{e[s]=o.val(t),n++,r&&Sh.INTEGER_REGEXP_.test(s)?i=Math.max(i,Number(s)):r=!1})),!t&&r&&i<2*n){const t=[];for(const n in e)t[n]=e[n];return t}return t&&!this.getPriority().isEmpty()&&(e[".priority"]=this.getPriority().val()),e}hash(){if(null===this.lazyHash_){let t="";this.getPriority().isEmpty()||(t+="priority:"+uh(this.getPriority().val())+":"),this.forEachChild(mh,((e,n)=>{const i=n.hash();""!==i&&(t+=":"+e+":"+i)})),this.lazyHash_=""===t?"":Fc(t)}return this.lazyHash_}getPredecessorChildName(t,e,n){const i=this.resolveIndex_(n);if(i){const n=i.getPredecessorKey(new Qu(t,e));return n?n.name:null}return this.children_.getPredecessorKey(t)}getFirstChildName(t){const e=this.resolveIndex_(t);if(e){const t=e.minKey();return t&&t.name}return this.children_.minKey()}getFirstChild(t){const e=this.getFirstChildName(t);return e?new Qu(e,this.children_.get(e)):null}getLastChildName(t){const e=this.resolveIndex_(t);if(e){const t=e.maxKey();return t&&t.name}return this.children_.maxKey()}getLastChild(t){const e=this.getLastChildName(t);return e?new Qu(e,this.children_.get(e)):null}forEachChild(t,e){const n=this.resolveIndex_(t);return n?n.inorderTraversal((t=>e(t.name,t.node))):this.children_.inorderTraversal(e)}getIterator(t){return this.getIteratorFrom(t.minPost(),t)}getIteratorFrom(t,e){const n=this.resolveIndex_(e);if(n)return n.getIteratorFrom(t,(t=>t));{const n=this.children_.getIteratorFrom(t.name,Qu.Wrap);let i=n.peek();for(;null!=i&&e.compare(i,t)<0;)n.getNext(),i=n.peek();return n}}getReverseIterator(t){return this.getReverseIteratorFrom(t.maxPost(),t)}getReverseIteratorFrom(t,e){const n=this.resolveIndex_(e);if(n)return n.getReverseIteratorFrom(t,(t=>t));{const n=this.children_.getReverseIteratorFrom(t.name,Qu.Wrap);let i=n.peek();for(;null!=i&&e.compare(i,t)>0;)n.getNext(),i=n.peek();return n}}compareTo(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===Th?-1:0}withIndex(t){if(t===ih||this.indexMap_.hasIndex(t))return this;{const e=this.indexMap_.addIndex(t,this.children_);return new Sh(this.children_,this.priorityNode_,e)}}isIndexed(t){return t===ih||this.indexMap_.hasIndex(t)}equals(t){if(t===this)return!0;if(t.isLeafNode())return!1;{const e=t;if(this.getPriority().equals(e.getPriority())){if(this.children_.count()===e.children_.count()){const t=this.getIterator(mh),n=e.getIterator(mh);let i=t.getNext(),r=n.getNext();for(;i&&r;){if(i.name!==r.name||!i.node.equals(r.node))return!1;i=t.getNext(),r=n.getNext()}return null===i&&null===r}return!1}return!1}}resolveIndex_(t){return t===ih?null:this.indexMap_.get(t.toString())}}Sh.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;const Th=new class extends Sh{constructor(){super(new oh(lh),Sh.EMPTY_NODE,Eh.Default)}compareTo(t){return t===this?0:1}equals(t){return t===this}getPriority(){return this}getImmediateChild(t){return Sh.EMPTY_NODE}isEmpty(){return!1}};Object.defineProperties(Qu,{MIN:{value:new Qu(Zc,Sh.EMPTY_NODE)},MAX:{value:new Qu(Xc,Th)}}),nh.__EMPTY_NODE=Sh.EMPTY_NODE,gh.__childrenNodeConstructor=Sh,ch=Th,function(t){fh=t}(Th);const Ch=!0;function Ah(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null===t)return Sh.EMPTY_NODE;if("object"===typeof t&&".priority"in t&&(e=t[".priority"]),Da(null===e||"string"===typeof e||"number"===typeof e||"object"===typeof e&&".sv"in e,"Invalid priority type found: "+typeof e),"object"===typeof t&&".value"in t&&null!==t[".value"]&&(t=t[".value"]),"object"!==typeof t||".sv"in t){return new gh(t,Ah(e))}if(t instanceof Array||!Ch){let n=Sh.EMPTY_NODE;return eu(t,((e,i)=>{if(ll(t,e)&&"."!==e.substring(0,1)){const t=Ah(i);!t.isLeafNode()&&t.isEmpty()||(n=n.updateImmediateChild(e,t))}})),n.updatePriority(Ah(e))}{const n=[];let i=!1;if(eu(t,((t,e)=>{if("."!==t.substring(0,1)){const r=Ah(e);r.isEmpty()||(i=i||!r.getPriority().isEmpty(),n.push(new Qu(t,r)))}})),0===n.length)return Sh.EMPTY_NODE;const r=vh(n,ah,(t=>t.name),lh);if(i){const t=vh(n,mh.getCompare());return new Sh(r,Ah(e),new Eh({".priority":t},{".priority":mh}))}return new Sh(r,Ah(e),Eh.Default)}}!function(t){ph=t}(Ah);class Ph extends th{constructor(t){super(),this.indexPath_=t,Da(!Wu(t)&&".priority"!==Du(t),"Can't create PathIndex with empty path or .priority key")}extractChild(t){return t.getChild(this.indexPath_)}isDefinedOn(t){return!t.getChild(this.indexPath_).isEmpty()}compare(t,e){const n=this.extractChild(t.node),i=this.extractChild(e.node),r=n.compareTo(i);return 0===r?Kc(t.name,e.name):r}makePost(t,e){const n=Ah(t),i=Sh.EMPTY_NODE.updateChild(this.indexPath_,n);return new Qu(e,i)}maxPost(){const t=Sh.EMPTY_NODE.updateChild(this.indexPath_,Th);return new Qu(Xc,t)}toString(){return zu(this.indexPath_,0).join("/")}}const Rh=new class extends th{compare(t,e){const n=t.node.compareTo(e.node);return 0===n?Kc(t.name,e.name):n}isDefinedOn(t){return!0}indexedValueChanged(t,e){return!t.equals(e)}
vendor: 4,560 bytes, line 2
2minPost(){return Qu.MIN}maxPost(){return Qu.MAX}makePost(t,e){const n=Ah(t);return new Qu(e,n)}toString(){return".value"}};function Mh(t){return{type:"value",snapshotNode:t}}function Ih(t,e){return{type:"child_added",snapshotNode:e,childName:t}}function Lh(t,e){return{type:"child_removed",snapshotNode:e,childName:t}}function kh(t,e,n){return{type:"child_changed",snapshotNode:e,childName:t,oldSnap:n}}class Nh{constructor(t){this.index_=t}updateChild(t,e,n,i,r,s){Da(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");const o=t.getImmediateChild(e);return o.getChild(i).equals(n.getChild(i))&&o.isEmpty()===n.isEmpty()?t:(null!=s&&(n.isEmpty()?t.hasChild(e)?s.trackChildChange(Lh(e,o)):Da(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):o.isEmpty()?s.trackChildChange(Ih(e,n)):s.trackChildChange(kh(e,n,o))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))}updateFullNode(t,e,n){return null!=n&&(t.isLeafNode()||t.forEachChild(mh,((t,i)=>{e.hasChild(t)||n.trackChildChange(Lh(t,i))})),e.isLeafNode()||e.forEachChild(mh,((e,i)=>{if(t.hasChild(e)){const r=t.getImmediateChild(e);r.equals(i)||n.trackChildChange(kh(e,i,r))}else n.trackChildChange(Ih(e,i))}))),e.withIndex(this.index_)}updatePriority(t,e){return t.isEmpty()?Sh.EMPTY_NODE:t.updatePriority(e)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}class Oh{constructor(t){this.indexedFilter_=new Nh(t.getIndex()),this.index_=t.getIndex(),this.startPost_=Oh.getStartPost_(t),this.endPost_=Oh.getEndPost_(t),this.startIsInclusive_=!t.startAfterSet_,this.endIsInclusive_=!t.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(t){const e=this.startIsInclusive_?this.index_.compare(this.getStartPost(),t)<=0:this.index_.compare(this.getStartPost(),t)<0,n=this.endIsInclusive_?this.index_.compare(t,this.getEndPost())<=0:this.index_.compare(t,this.getEndPost())<0;return e&&n}updateChild(t,e,n,i,r,s){return this.matches(new Qu(e,n))||(n=Sh.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,i,r,s)}updateFullNode(t,e,n){e.isLeafNode()&&(e=Sh.EMPTY_NODE);let i=e.withIndex(this.index_);i=i.updatePriority(Sh.EMPTY_NODE);const r=this;return e.forEachChild(mh,((t,e)=>{r.matches(new Qu(t,e))||(i=i.updateImmediateChild(t,Sh.EMPTY_NODE))})),this.indexedFilter_.updateFullNode(t,i,n)}updatePriority(t,e){return t}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(t){if(t.hasStart()){const e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()}static getEndPost_(t){if(t.hasEnd()){const e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()}}class Dh{constructor(t){this.withinDirectionalStart=t=>this.reverse_?this.withinEndPost(t):this.withinStartPost(t),this.withinDirectionalEnd=t=>this.reverse_?this.withinStartPost(t):this.withinEndPost(t),this.withinStartPost=t=>{const e=this.index_.compare(this.rangedFilter_.getStartPost(),t);return this.startIsInclusive_?e<=0:e<0},this.withinEndPost=t=>{const e=this.index_.compare(t,this.rangedFilter_.getEndPost());return this.endIsInclusive_?e<=0:e<0},this.rangedFilter_=new Oh(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft(),this.startIsInclusive_=!t.startAfterSet_,this.endIsInclusive_=!t.endBeforeSet_}updateChild(t,e,n,i,r,s){return this.rangedFilter_.matches(new Qu(e,n))||(n=Sh.EMPTY_NODE),t.getImmediateChild(e).equals(n)?t:t.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(t,e,n,i,r,s):this.fullLimitUpdateChild_(t,e,n,r,s)}updateFullNode(t,e,n){let i;if(e.isLeafNode()||e.isEmpty())i=Sh.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<e.numChildren()&&e.isIndexed(this.index_)){let t;i=Sh.EMPTY_NODE.withIndex(this.index_),t=this.reverse_?e.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):e.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let n=0;for(;t.hasNext()&&n<this.limit_;){const e=t.getNext();if(this.withinDirectionalStart(e)){if(!this.withinDirectionalEnd(e))break;i=i.updateImmediateChild(e.name,e.node),n++}}}else{let t;i=e.withIndex(this.index_),i=i.updatePriority(Sh.EMPTY_NODE),t=this.reverse_?i.getReverseIterator(this.index_):i.getIterator(this.index_);let n=0;for(;t.hasNext();){const e=t.getNext();n<this.limit_&&this.withinDirectionalStart(e)&&this.withinDirectionalEnd(e)?
vendor: 26,244 bytes, line 2
2n++:i=i.updateImmediateChild(e.name,Sh.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,i,n)}updatePriority(t,e){return t}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(t,e,n,i,r){let s;if(this.reverse_){const t=this.index_.getCompare();s=(e,n)=>t(n,e)}else s=this.index_.getCompare();const o=t;Da(o.numChildren()===this.limit_,"");const a=new Qu(e,n),l=this.reverse_?o.getFirstChild(this.index_):o.getLastChild(this.index_),c=this.rangedFilter_.matches(a);if(o.hasChild(e)){const t=o.getImmediateChild(e);let u=i.getChildAfterChild(this.index_,l,this.reverse_);for(;null!=u&&(u.name===e||o.hasChild(u.name));)u=i.getChildAfterChild(this.index_,u,this.reverse_);const h=null==u?1:s(u,a);if(c&&!n.isEmpty()&&h>=0)return null!=r&&r.trackChildChange(kh(e,n,t)),o.updateImmediateChild(e,n);{null!=r&&r.trackChildChange(Lh(e,t));const n=o.updateImmediateChild(e,Sh.EMPTY_NODE);return null!=u&&this.rangedFilter_.matches(u)?(null!=r&&r.trackChildChange(Ih(u.name,u.node)),n.updateImmediateChild(u.name,u.node)):n}}return n.isEmpty()?t:c&&s(l,a)>=0?(null!=r&&(r.trackChildChange(Lh(l.name,l.node)),r.trackChildChange(Ih(e,n))),o.updateImmediateChild(e,n).updateImmediateChild(l.name,Sh.EMPTY_NODE)):t}}class Fh{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=mh}hasStart(){return this.startSet_}isViewFromLeft(){return""===this.viewFrom_?this.startSet_:"l"===this.viewFrom_}getIndexStartValue(){return Da(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return Da(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Zc}hasEnd(){return this.endSet_}getIndexEndValue(){return Da(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return Da(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Xc}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&""!==this.viewFrom_}getLimit(){return Da(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===mh}copy(){const t=new Fh;return t.limitSet_=this.limitSet_,t.limit_=this.limit_,t.startSet_=this.startSet_,t.startAfterSet_=this.startAfterSet_,t.indexStartValue_=this.indexStartValue_,t.startNameSet_=this.startNameSet_,t.indexStartName_=this.indexStartName_,t.endSet_=this.endSet_,t.endBeforeSet_=this.endBeforeSet_,t.indexEndValue_=this.indexEndValue_,t.endNameSet_=this.endNameSet_,t.indexEndName_=this.indexEndName_,t.index_=this.index_,t.viewFrom_=this.viewFrom_,t}}function Bh(t){const e={};if(t.isDefault())return e;let n;if(t.index_===mh?n="$priority":t.index_===Rh?n="$value":t.index_===ih?n="$key":(Da(t.index_ instanceof Ph,"Unrecognized index type!"),n=t.index_.toString()),e.orderBy=ol(n),t.startSet_){const n=t.startAfterSet_?"startAfter":"startAt";e[n]=ol(t.indexStartValue_),t.startNameSet_&&(e[n]+=","+ol(t.indexStartName_))}if(t.endSet_){const n=t.endBeforeSet_?"endBefore":"endAt";e[n]=ol(t.indexEndValue_),t.endNameSet_&&(e[n]+=","+ol(t.indexEndName_))}return t.limitSet_&&(t.isViewFromLeft()?e.limitToFirst=t.limit_:e.limitToLast=t.limit_),e}function Uh(t){const e={};if(t.startSet_&&(e.sp=t.indexStartValue_,t.startNameSet_&&(e.sn=t.indexStartName_),e.sin=!t.startAfterSet_),t.endSet_&&(e.ep=t.indexEndValue_,t.endNameSet_&&(e.en=t.indexEndName_),e.ein=!t.endBeforeSet_),t.limitSet_){e.l=t.limit_;let n=t.viewFrom_;""===n&&(n=t.isViewFromLeft()?"l":"r"),e.vf=n}return t.index_!==mh&&(e.i=t.index_.toString()),e}class zh extends Ru{constructor(t,e,n,i){super(),this.repoInfo_=t,this.onDataUpdate_=e,this.authTokenProvider_=n,this.appCheckTokenProvider_=i,this.log_=Wc("p:rest:"),this.listens_={}}reportStats(t){throw new Error("Method not implemented.")}static getListenId_(t,e){return void 0!==e?"tag$"+e:(Da(t._queryParams.isDefault(),"should have a tag if it's not a default query."),t._path.toString())}listen(t,e,n,i){const r=t._path.toString();this.log_("Listen called for "+r+" "+t._queryIdentifier);const s=zh.getListenId_(t,n),o={};this.listens_[s]=o;const a=Bh(t._queryParams);this.restRequest_(r+".json",a,((t,e)=>{let a=e;if(404===t&&(a=null,t=null),null===t&&this.onDataUpdate_(r,a,!1,n),cl(this.listens_,s)===o){let e;e=t?401===t?"permission_denied":"rest_error:"+t:"ok",i(e,null)}}))}unlisten(t,e){const n=zh.getListenId_(t,e);delete this.listens_[n]}get(t){const e=Bh(t._queryParams),n=t._path.toString(),i=new Ya;return this.restRequest_(n+".json",e,((t,e)=>{let r=e;404===t&&(r=null,t=null),null===t?(this.onDataUpdate_(n,r,!1,null),i.resolve(r)):i.reject(new Error(r))})),i.promise}refreshAuthToken(t){}restRequest_(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return e.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then((i=>{let[r,s]=i;r&&r.accessToken&&(e.auth=r.accessToken),s&&s.token&&(e.ac=s.token);const o=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+t+"?ns="+this.repoInfo_.namespace+fl(e);this.log_("Sending REST request for "+o);const a=new XMLHttpRequest;a.onreadystatechange=()=>{if(n&&4===a.readyState){this.log_("REST Response for "+o+" received. status:",a.status,"response:",a.responseText);let e=null;if(a.status>=200&&a.status<300){try{e=sl(a.responseText)}catch(t){Hc("Failed to parse JSON response for "+o+": "+a.responseText)}n(null,e)}else 401!==a.status&&404!==a.status&&Hc("Got unsuccessful REST response for "+o+" Status: "+a.status),n(a.status);n=null}},a.open("GET",o,!0),a.send()}))}}class jh{constructor(){this.rootNode_=Sh.EMPTY_NODE}getNode(t){return this.rootNode_.getChild(t)}updateSnapshot(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)}}function Vh(){return{value:null,children:new Map}}function Wh(t,e,n){if(Wu(e))t.value=n,t.children.clear();else if(null!==t.value)t.value=t.value.updateChild(e,n);else{const i=Du(e);t.children.has(i)||t.children.set(i,Vh());Wh(t.children.get(i),e=Bu(e),n)}}function $h(t,e,n){null!==t.value?n(e,t.value):function(t,e){t.children.forEach(((t,n)=>{e(n,t)}))}(t,((t,i)=>{$h(i,new Nu(e.toString()+"/"+t),n)}))}class Gh{constructor(t){this.collection_=t,this.last_=null}get(){const t=this.collection_.get(),e=Object.assign({},t);return this.last_&&eu(this.last_,((t,n)=>{e[t]=e[t]-n})),this.last_=t,e}}class Hh{constructor(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new Gh(t);const n=1e4+2e4*Math.random();ou(this.reportStats_.bind(this),Math.floor(n))}reportStats_(){const t=this.statsListener_.get(),e={};let n=!1;eu(t,((t,i)=>{i>0&&ll(this.statsToReport_,t)&&(e[t]=i,n=!0)})),n&&this.server_.reportStats(e),ou(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))}}var qh;function Zh(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}!function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}(qh||(qh={}));class Xh{constructor(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=qh.ACK_USER_WRITE,this.source={fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}operationForChild(t){if(Wu(this.path)){if(null!=this.affectedTree.value)return Da(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const e=this.affectedTree.subtree(new Nu(t));return new Xh(Ou(),e,this.revert)}}return Da(Du(this.path)===t,"operationForChild called for unrelated child."),new Xh(Bu(this.path),this.affectedTree,this.revert)}}class Kh{constructor(t,e){this.source=t,this.path=e,this.type=qh.LISTEN_COMPLETE}operationForChild(t){return Wu(this.path)?new Kh(this.source,Ou()):new Kh(this.source,Bu(this.path))}}class Yh{constructor(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=qh.OVERWRITE}operationForChild(t){return Wu(this.path)?new Yh(this.source,Ou(),this.snap.getImmediateChild(t)):new Yh(this.source,Bu(this.path),this.snap)}}class Jh{constructor(t,e,n){this.source=t,this.path=e,this.children=n,this.type=qh.MERGE}operationForChild(t){if(Wu(this.path)){const e=this.children.subtree(new Nu(t));return e.isEmpty()?null:e.value?new Yh(this.source,Ou(),e.value):new Jh(this.source,Ou(),e)}return Da(Du(this.path)===t,"Can't get a merge for a child not on the path of the operation"),new Jh(this.source,Bu(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}class Qh{constructor(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(t){if(Wu(t))return this.isFullyInitialized()&&!this.filtered_;const e=Du(t);return this.isCompleteForChild(e)}isCompleteForChild(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)}getNode(){return this.node_}}class td{constructor(t){this.query_=t,this.index_=this.query_._queryParams.getIndex()}}function ed(t,e,n,i,r,s){const o=i.filter((t=>t.type===n));o.sort(((e,n)=>function(t,e,n){if(null==e.childName||null==n.childName)throw Fa("Should only compare child_ events.");const i=new Qu(e.childName,e.snapshotNode),r=new Qu(n.childName,n.snapshotNode);return t.index_.compare(i,r)}(t,e,n))),o.forEach((n=>{const i=function(t,e,n){return"value"===e.type||"child_removed"===e.type||(e.prevName=n.getPredecessorChildName(e.childName,e.snapshotNode,t.index_)),e}(t,n,s);r.forEach((r=>{r.respondsTo(n.type)&&e.push(r.createEvent(i,t.query_))}))}))}function nd(t,e){return{eventCache:t,serverCache:e}}function id(t,e,n,i){return nd(new Qh(e,n,i),t.serverCache)}function rd(t,e,n,i){return nd(t.eventCache,new Qh(e,n,i))}function sd(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function od(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}let ad;class ld{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(ad||(ad=new oh(Yc)),ad);this.value=t,this.children=e}static fromObject(t){let e=new ld(null);return eu(t,((t,n)=>{e=e.set(new Nu(t),n)})),e}isEmpty(){return null===this.value&&this.children.isEmpty()}findRootMostMatchingPathAndValue(t,e){if(null!=this.value&&e(this.value))return{path:Ou(),value:this.value};if(Wu(t))return null;{const n=Du(t),i=this.children.get(n);if(null!==i){const r=i.findRootMostMatchingPathAndValue(Bu(t),e);if(null!=r){return{path:Vu(new Nu(n),r.path),value:r.value}}return null}return null}}findRootMostValueAndPath(t){return this.findRootMostMatchingPathAndValue(t,(()=>!0))}subtree(t){if(Wu(t))return this;{const e=Du(t),n=this.children.get(e);return null!==n?n.subtree(Bu(t)):new ld(null)}}set(t,e){if(Wu(t))return new ld(e,this.children);{const n=Du(t),i=(this.children.get(n)||new ld(null)).set(Bu(t),e),r=this.children.insert(n,i);return new ld(this.value,r)}}remove(t){if(Wu(t))return this.children.isEmpty()?new ld(null):new ld(null,this.children);{const e=Du(t),n=this.children.get(e);if(n){const i=n.remove(Bu(t));let r;return r=i.isEmpty()?this.children.remove(e):this.children.insert(e,i),null===this.value&&r.isEmpty()?new ld(null):new ld(this.value,r)}return this}}get(t){if(Wu(t))return this.value;{const e=Du(t),n=this.children.get(e);return n?n.get(Bu(t)):null}}setTree(t,e){if(Wu(t))return e;{const n=Du(t),i=(this.children.get(n)||new ld(null)).setTree(Bu(t),e);let r;return r=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),new ld(this.value,r)}}fold(t){return this.fold_(Ou(),t)}fold_(t,e){const n={};return this.children.inorderTraversal(((i,r)=>{n[i]=r.fold_(Vu(t,i),e)})),e(t,this.value,n)}findOnPath(t,e){return this.findOnPath_(t,Ou(),e)}findOnPath_(t,e,n){const i=!!this.value&&n(e,this.value);if(i)return i;if(Wu(t))return null;{const i=Du(t),r=this.children.get(i);return r?r.findOnPath_(Bu(t),Vu(e,i),n):null}}foreachOnPath(t,e){return this.foreachOnPath_(t,Ou(),e)}foreachOnPath_(t,e,n){if(Wu(t))return this;{this.value&&n(e,this.value);const i=Du(t),r=this.children.get(i);return r?r.foreachOnPath_(Bu(t),Vu(e,i),n):new ld(null)}}foreach(t){this.foreach_(Ou(),t)}foreach_(t,e){this.children.inorderTraversal(((n,i)=>{i.foreach_(Vu(t,n),e)})),this.value&&e(t,this.value)}foreachChild(t){this.children.inorderTraversal(((e,n)=>{n.value&&t(e,n.value)}))}}class cd{constructor(t){this.writeTree_=t}static empty(){return new cd(new ld(null))}}function ud(t,e,n){if(Wu(e))return new cd(new ld(n));{const i=t.writeTree_.findRootMostValueAndPath(e);if(null!=i){const r=i.path;let s=i.value;const o=$u(r,e);return s=s.updateChild(o,n),new cd(t.writeTree_.set(r,s))}{const i=new ld(n),r=t.writeTree_.setTree(e,i);return new cd(r)}}}function hd(t,e,n){let i=t;return eu(n,((t,n)=>{i=ud(i,Vu(e,t),n)})),i}function dd(t,e){if(Wu(e))return cd.empty();{const n=t.writeTree_.setTree(e,new ld(null));return new cd(n)}}function pd(t,e){return null!=fd(t,e)}function fd(t,e){const n=t.writeTree_.findRootMostValueAndPath(e);return null!=n?t.writeTree_.get(n.path).getChild($u(n.path,e)):null}function gd(t){const e=[],n=t.writeTree_.value;return null!=n?n.isLeafNode()||n.forEachChild(mh,((t,n)=>{e.push(new Qu(t,n))})):t.writeTree_.children.inorderTraversal(((t,n)=>{null!=n.value&&e.push(new Qu(t,n.value))})),e}function md(t,e){if(Wu(e))return t;{const n=fd(t,e);return new cd(null!=n?new ld(n):t.writeTree_.subtree(e))}}function _d(t){return t.writeTree_.isEmpty()}function yd(t,e){return vd(Ou(),t.writeTree_,e)}function vd(t,e,n){if(null!=e.value)return n.updateChild(t,e.value);{let i=null;return e.children.inorderTraversal(((e,r)=>{".priority"===e?(Da(null!==r.value,"Priority writes must always be leaf nodes"),i=r.value):n=vd(Vu(t,e),r,n)})),n.getChild(t).isEmpty()||null===i||(n=n.updateChild(Vu(t,".priority"),i)),n}}function bd(t,e){return kd(e,t)}function wd(t,e){const n=t.allWrites.findIndex((t=>t.writeId===e));Da(n>=0,"removeWrite called with nonexistent writeId.");const i=t.allWrites[n];t.allWrites.splice(n,1);let r=i.visible,s=!1,o=t.allWrites.length-1;for(;r&&o>=0;){const e=t.allWrites[o];e.visible&&(o>=n&&Ed(e,i.path)?r=!1:Hu(i.path,e.path)&&(s=!0)),o--}if(r){if(s)return function(t){t.visibleWrites=Sd(t.allWrites,xd,Ou()),t.allWrites.length>0?t.lastWriteId=t.allWrites[t.allWrites.length-1].writeId:t.lastWriteId=-1}(t),!0;if(i.snap)t.visibleWrites=dd(t.visibleWrites,i.path);else{eu(i.children,(e=>{t.visibleWrites=dd(t.visibleWrites,Vu(i.path,e))}))}return!0}return!1}function Ed(t,e){if(t.snap)return Hu(t.path,e);for(const n in t.children)if(t.children.hasOwnProperty(n)&&Hu(Vu(t.path,n),e))return!0;return!1}function xd(t){return t.visible}function Sd(t,e,n){let i=cd.empty();for(let r=0;r<t.length;++r){const s=t[r];if(e(s)){const t=s.path;let e;if(s.snap)Hu(n,t)?(e=$u(n,t),i=ud(i,e,s.snap)):Hu(t,n)&&(e=$u(t,n),i=ud(i,Ou(),s.snap.getChild(e)));else{if(!s.children)throw Fa("WriteRecord should have .snap or .children");if(Hu(n,t))e=$u(n,t),i=hd(i,e,s.children);else if(Hu(t,n))if(e=$u(t,n),Wu(e))i=hd(i,Ou(),s.children);else{const t=cl(s.children,Du(e));if(t){const n=t.getChild(Bu(e));i=ud(i,Ou(),n)}}}}}return i}function Td(t,e,n,i,r){if(i||r){const s=md(t.visibleWrites,e);if(!r&&_d(s))return n;if(r||null!=n||pd(s,Ou())){const s=function(t){return(t.visible||r)&&(!i||!~i.indexOf(t.writeId))&&(Hu(t.path,e)||Hu(e,t.path))};return yd(Sd(t.allWrites,s,e),n||Sh.EMPTY_NODE)}return null}{const i=fd(t.visibleWrites,e);if(null!=i)return i;{const i=md(t.visibleWrites,e);if(_d(i))return n;if(null!=n||pd(i,Ou())){return yd(i,n||Sh.EMPTY_NODE)}return null}}}function Cd(t,e,n,i){return Td(t.writeTree,t.treePath,e,n,i)}function Ad(t,e){return function(t,e,n){let i=Sh.EMPTY_NODE;const r=fd(t.visibleWrites,e);if(r)return r.isLeafNode()||r.forEachChild(mh,((t,e)=>{i=i.updateImmediateChild(t,e)})),i;if(n){const r=md(t.visibleWrites,e);return n.forEachChild(mh,((t,e)=>{const n=yd(md(r,new Nu(t)),e);i=i.updateImmediateChild(t,n)})),gd(r).forEach((t=>{i=i.updateImmediateChild(t.name,t.node)})),i}return gd(md(t.visibleWrites,e)).forEach((t=>{i=i.updateImmediateChild(t.name,t.node)})),i}(t.writeTree,t.treePath,e)}function Pd(t,e,n,i){return function(t,e,n,i,r){Da(i||r,"Either existingEventSnap or existingServerSnap must exist");const s=Vu(e,n);if(pd(t.visibleWrites,s))return null;{const e=md(t.visibleWrites,s);return _d(e)?r.getChild(n):yd(e,r.getChild(n))}}(t.writeTree,t.treePath,e,n,i)}function Rd(t,e){return function(t,e){return fd(t.visibleWrites,e)}(t.writeTree,Vu(t.treePath,e))}function Md(t,e,n,i,r,s){return function(t,e,n,i,r,s,o){let a;const l=md(t.visibleWrites,e),c=fd(l,Ou());if(null!=c)a=c;else{if(null==n)return[];a=yd(l,n)}if(a=a.withIndex(o),a.isEmpty()||a.isLeafNode())return[];{const t=[],e=o.getCompare(),n=s?a.getReverseIteratorFrom(i,o):a.getIteratorFrom(i,o);let l=n.getNext();for(;l&&t.length<r;)0!==e(l,i)&&t.push(l),l=n.getNext();return t}}(t.writeTree,t.treePath,e,n,i,r,s)}function Id(t,e,n){return function(t,e,n,i){const r=Vu(e,n),s=fd(t.visibleWrites,r);if(null!=s)return s;if(i.isCompleteForChild(n))return yd(md(t.visibleWrites,r),i.getNode().getImmediateChild(n));return null}(t.writeTree,t.treePath,e,n)}function Ld(t,e){return kd(Vu(t.treePath,e),t.writeTree)}function kd(t,e){return{treePath:t,writeTree:e}}class Nd{constructor(){this.changeMap=new Map}trackChildChange(t){const e=t.type,n=t.childName;Da("child_added"===e||"child_changed"===e||"child_removed"===e,"Only child changes supported for tracking"),Da(".priority"!==n,"Only non-priority child changes can be tracked.");const i=this.changeMap.get(n);if(i){const r=i.type;if("child_added"===e&&"child_removed"===r)this.changeMap.set(n,kh(n,t.snapshotNode,i.snapshotNode));else if("child_removed"===e&&"child_added"===r)this.changeMap.delete(n);else if("child_removed"===e&&"child_changed"===r)this.changeMap.set(n,Lh(n,i.oldSnap));else if("child_changed"===e&&"child_added"===r)this.changeMap.set(n,Ih(n,t.snapshotNode));else{if("child_changed"!==e||"child_changed"!==r)throw Fa("Illegal combination of changes: "+t+" occurred after "+i);this.changeMap.set(n,kh(n,t.snapshotNode,i.oldSnap))}}else this.changeMap.set(n,t)}getChanges(){return Array.from(this.changeMap.values())}}const Od=new class{getCompleteChild(t){return null}getChildAfterChild(t,e,n){return null}};class Dd{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}getCompleteChild(t){const e=this.viewCache_.eventCache;if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);{const e=null!=this.optCompleteServerCache_?new Qh(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return Id(this.writes_,t,e)}}getChildAfterChild(t,e,n){const i=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:od(this.viewCache_),r=Md(this.writes_,i,e,1,n,t);return 0===r.length?null:r[0]}}function Fd(t,e,n,i,r){const s=new Nd;let o,a;if(n.type===qh.OVERWRITE){const l=n;l.source.fromUser?o=zd(t,e,l.path,l.snap,i,r,s):(Da(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered()&&!Wu(l.path),o=Ud(t,e,l.path,l.snap,i,r,a,s))}else if(n.type===qh.MERGE){const l=n;l.source.fromUser?o=function(t,e,n,i,r,s,o){let a=e;return i.foreach(((i,l)=>{const c=Vu(n,i);jd(e,Du(c))&&(a=zd(t,a,c,l,r,s,o))})),i.foreach(((i,l)=>{const c=Vu(n,i);jd(e,Du(c))||(a=zd(t,a,c,l,r,s,o))})),a}(t,e,l.path,l.children,i,r,s):(Da(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered(),o=Wd(t,e,l.path,l.children,i,r,a,s))}else if(n.type===qh.ACK_USER_WRITE){const a=n;o=a.revert?function(t,e,n,i,r,s){let o;if(null!=Rd(i,n))return e;{const a=new Dd(i,e,r),l=e.eventCache.getNode();let c;if(Wu(n)||".priority"===Du(n)){let n;if(e.serverCache.isFullyInitialized())n=Cd(i,od(e));else{const t=e.serverCache.getNode();Da(t instanceof Sh,"serverChildren would be complete if leaf node"),n=Ad(i,t)}c=t.filter.updateFullNode(l,n,s)}else{const r=Du(n);let u=Id(i,r,e.serverCache);null==u&&e.serverCache.isCompleteForChild(r)&&(u=l.getImmediateChild(r)),c=null!=u?t.filter.updateChild(l,r,u,Bu(n),a,s):e.eventCache.getNode().hasChild(r)?t.filter.updateChild(l,r,Sh.EMPTY_NODE,Bu(n),a,s):l,c.isEmpty()&&e.serverCache.isFullyInitialized()&&(o=Cd(i,od(e)),o.isLeafNode()&&(c=t.filter.updateFullNode(c,o,s)))}return o=e.serverCache.isFullyInitialized()||null!=Rd(i,Ou()),id(e,c,o,t.filter.filtersNodes())}}(t,e,a.path,i,r,s):function(t,e,n,i,r,s,o){if(null!=Rd(r,n))return e;const a=e.serverCache.isFiltered(),l=e.serverCache;if(null!=i.value){if(Wu(n)&&l.isFullyInitialized()||l.isCompleteForPath(n))return Ud(t,e,n,l.getNode().getChild(n),r,s,a,o);if(Wu(n)){let i=new ld(null);return l.getNode().forEachChild(ih,((t,e)=>{i=i.set(new Nu(t),e)})),Wd(t,e,n,i,r,s,a,o)}return e}{let c=new ld(null);return i.foreach(((t,e)=>{const i=Vu(n,t);l.isCompleteForPath(i)&&(c=c.set(t,l.getNode().getChild(i)))})),Wd(t,e,n,c,r,s,a,o)}}(t,e,a.path,a.affectedTree,i,r,s)}else{if(n.type!==qh.LISTEN_COMPLETE)throw Fa("Unknown operation type: "+n.type);o=function(t,e,n,i,r){const s=e.serverCache,o=rd(e,s.getNode(),s.isFullyInitialized()||Wu(n),s.isFiltered());return Bd(t,o,n,i,Od,r)}(t,e,n.path,i,s)}const l=s.getChanges();return function(t,e,n){const i=e.eventCache;if(i.isFullyInitialized()){const r=i.getNode().isLeafNode()||i.getNode().isEmpty(),s=sd(t);(n.length>0||!t.eventCache.isFullyInitialized()||r&&!i.getNode().equals(s)||!i.getNode().getPriority().equals(s.getPriority()))&&n.push(Mh(sd(e)))}}(e,o,l),{viewCache:o,changes:l}}function Bd(t,e,n,i,r,s){const o=e.eventCache;if(null!=Rd(i,n))return e;{let a,l;if(Wu(n))if(Da(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){const n=od(e),r=Ad(i,n instanceof Sh?n:Sh.EMPTY_NODE);a=t.filter.updateFullNode(e.eventCache.getNode(),r,s)}else{const n=Cd(i,od(e));a=t.filter.updateFullNode(e.eventCache.getNode(),n,s)}else{const c=Du(n);if(".priority"===c){Da(1===Fu(n),"Can't have a priority with additional path components");const r=o.getNode();l=e.serverCache.getNode();const s=Pd(i,n,r,l);a=null!=s?t.filter.updatePriority(r,s):o.getNode()}else{const u=Bu(n);let h;if(o.isCompleteForChild(c)){l=e.serverCache.getNode();const t=Pd(i,n,o.getNode(),l);h=null!=t?o.getNode().getImmediateChild(c).updateChild(u,t):o.getNode().getImmediateChild(c)}else h=Id(i,c,e.serverCache);a=null!=h?t.filter.updateChild(o.getNode(),c,h,u,r,s):o.getNode()}}return id(e,a,o.isFullyInitialized()||Wu(n),t.filter.filtersNodes())}}function Ud(t,e,n,i,r,s,o,a){const l=e.serverCache;let c;const u=o?t.filter:t.filter.getIndexedFilter();if(Wu(n))c=u.updateFullNode(l.getNode(),i,null);else if(u.filtersNodes()&&!l.isFiltered()){const t=l.getNode().updateChild(n,i);c=u.updateFullNode(l.getNode(),t,null)}else{const t=Du(n);if(!l.isCompleteForPath(n)&&Fu(n)>1)return e;const r=Bu(n),s=l.getNode().getImmediateChild(t).updateChild(r,i);c=".priority"===t?u.updatePriority(l.getNode(),s):u.updateChild(l.getNode(),t,s,r,Od,null)}const h=rd(e,c,l.isFullyInitialized()||Wu(n),u.filtersNodes());return Bd(t,h,n,r,new Dd(r,h,s),a)}function zd(t,e,n,i,r,s,o){const a=e.eventCache;let l,c;const u=new Dd(r,e,s);if(Wu(n))c=t.filter.updateFullNode(e.eventCache.getNode(),i,o),l=id(e,c,!0,t.filter.filtersNodes());else{const r=Du(n);if(".priority"===r)c=t.filter.updatePriority(e.eventCache.getNode(),i),l=id(e,c,a.isFullyInitialized(),a.isFiltered());else{const s=Bu(n),c=a.getNode().getImmediateChild(r);let h;if(Wu(s))h=i;else{const t=u.getCompleteChild(r);h=null!=t?".priority"===Uu(s)&&t.getChild(ju(s)).isEmpty()?t:t.updateChild(s,i):Sh.EMPTY_NODE}if(c.equals(h))l=e;else{l=id(e,t.filter.updateChild(a.getNode(),r,h,s,u,o),a.isFullyInitialized(),t.filter.filtersNodes())}}}return l}function jd(t,e){return t.eventCache.isCompleteForChild(e)}function Vd(t,e,n){return n.foreach(((t,n)=>{e=e.updateChild(t,n)})),e}function Wd(t,e,n,i,r,s,o,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let l,c=e;l=Wu(n)?i:new ld(null).setTree(n,i);const u=e.serverCache.getNode();return l.children.inorderTraversal(((n,i)=>{if(u.hasChild(n)){const l=Vd(0,e.serverCache.getNode().getImmediateChild(n),i);c=Ud(t,c,new Nu(n),l,r,s,o,a)}})),l.children.inorderTraversal(((n,i)=>{const l=!e.serverCache.isCompleteForChild(n)&&null===i.value;if(!u.hasChild(n)&&!l){const l=Vd(0,e.serverCache.getNode().getImmediateChild(n),i);c=Ud(t,c,new Nu(n),l,r,s,o,a)}})),c}class $d{constructor(t,e){this.query_=t,this.eventRegistrations_=[];const n=this.query_._queryParams,i=new Nh(n.getIndex()),r=(s=n).loadsAllData()?new Nh(s.getIndex()):s.hasLimit()?new Dh(s):new Oh(s);var s;this.processor_=function(t){return{filter:t}}(r);const o=e.serverCache,a=e.eventCache,l=i.updateFullNode(Sh.EMPTY_NODE,o.getNode(),null),c=r.updateFullNode(Sh.EMPTY_NODE,a.getNode(),null),u=new Qh(l,o.isFullyInitialized(),i.filtersNodes()),h=new Qh(c,a.isFullyInitialized(),r.filtersNodes());this.viewCache_=nd(h,u),this.eventGenerator_=new td(this.query_)}get query(){return this.query_}}function Gd(t,e){const n=od(t.viewCache_);return n&&(t.query._queryParams.loadsAllData()||!Wu(e)&&!n.getImmediateChild(Du(e)).isEmpty())?n.getChild(e):null}function Hd(t){return 0===t.eventRegistrations_.length}function qd(t,e,n){const i=[];if(n){Da(null==e,"A cancel should cancel all event registrations.");const r=t.query._path;t.eventRegistrations_.forEach((t=>{const e=t.createCancelEvent(n,r);e&&i.push(e)}))}if(e){let n=[];for(let i=0;i<t.eventRegistrations_.length;++i){const r=t.eventRegistrations_[i];if(r.matches(e)){if(e.hasAnyCallback()){n=n.concat(t.eventRegistrations_.slice(i+1));break}}else n.push(r)}t.eventRegistrations_=n}else t.eventRegistrations_=[];return i}function Zd(t,e,n,i){e.type===qh.MERGE&&null!==e.source.queryId&&(Da(od(t.viewCache_),"We should always have a full c
2ache before handling merges"),Da(sd(t.viewCache_),"Missing event cache, even though we have a server cache"));const r=t.viewCache_,s=Fd(t.processor_,r,e,n,i);var o,a;return o=t.processor_,a=s.viewCache,Da(a.eventCache.getNode().isIndexed(o.filter.getIndex()),"Event snap not indexed"),Da(a.serverCache.getNode().isIndexed(o.filter.getIndex()),"Server snap not indexed"),Da(s.viewCache.serverCache.isFullyInitialized()||!r.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=s.viewCache,Xd(t,s.changes,s.viewCache.eventCache.getNode(),null)}function Xd(t,e,n,i){const r=i?[i]:t.eventRegistrations_;return function(t,e,n,i){const r=[],s=[];return e.forEach((e=>{var n;"child_changed"===e.type&&t.index_.indexedValueChanged(e.oldSnap,e.snapshotNode)&&s.push((n=e.childName,{type:"child_moved",snapshotNode:e.snapshotNode,childName:n}))})),ed(t,r,"child_removed",e,i,n),ed(t,r,"child_added",e,i,n),ed(t,r,"child_moved",s,i,n),ed(t,r,"child_changed",e,i,n),ed(t,r,"value",e,i,n),r}(t.eventGenerator_,e,n,r)}let Kd,Yd;class Jd{constructor(){this.views=new Map}}function Qd(t,e,n,i){const r=e.source.queryId;if(null!==r){const s=t.views.get(r);return Da(null!=s,"SyncTree gave us an op for an invalid query."),Zd(s,e,n,i)}{let r=[];for(const s of t.views.values())r=r.concat(Zd(s,e,n,i));return r}}function tp(t,e,n,i,r){const s=e._queryIdentifier,o=t.views.get(s);if(!o){let t=Cd(n,r?i:null),s=!1;t?s=!0:i instanceof Sh?(t=Ad(n,i),s=!1):(t=Sh.EMPTY_NODE,s=!1);const o=nd(new Qh(t,s,!1),new Qh(i,r,!1));return new $d(e,o)}return o}function ep(t,e,n,i,r,s){const o=tp(t,e,i,r,s);return t.views.has(e._queryIdentifier)||t.views.set(e._queryIdentifier,o),function(t,e){t.eventRegistrations_.push(e)}(o,n),function(t,e){const n=t.viewCache_.eventCache,i=[];n.getNode().isLeafNode()||n.getNode().forEachChild(mh,((t,e)=>{i.push(Ih(t,e))}));return n.isFullyInitialized()&&i.push(Mh(n.getNode())),Xd(t,i,n.getNode(),e)}(o,n)}function np(t,e,n,i){const r=e._queryIdentifier,s=[];let o=[];const a=ap(t);if("default"===r)for(const[l,c]of t.views.entries())o=o.concat(qd(c,n,i)),Hd(c)&&(t.views.delete(l),c.query._queryParams.loadsAllData()||s.push(c.query));else{const e=t.views.get(r);e&&(o=o.concat(qd(e,n,i)),Hd(e)&&(t.views.delete(r),e.query._queryParams.loadsAllData()||s.push(e.query)))}return a&&!ap(t)&&s.push(new(Da(Kd,"Reference.ts has not been loaded"),Kd)(e._repo,e._path)),{removed:s,events:o}}function ip(t){const e=[];for(const n of t.views.values())n.query._queryParams.loadsAllData()||e.push(n);return e}function rp(t,e){let n=null;for(const i of t.views.values())n=n||Gd(i,e);return n}function sp(t,e){if(e._queryParams.loadsAllData())return lp(t);{const n=e._queryIdentifier;return t.views.get(n)}}function op(t,e){return null!=sp(t,e)}function ap(t){return null!=lp(t)}function lp(t){for(const e of t.views.values())if(e.query._queryParams.loadsAllData())return e;return null}let cp=1;class up{constructor(t){this.listenProvider_=t,this.syncPointTree_=new ld(null),this.pendingWriteTree_={visibleWrites:cd.empty(),allWrites:[],lastWriteId:-1},this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function hp(t,e,n,i,r){return function(t,e,n,i,r){Da(i>t.lastWriteId,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),t.allWrites.push({path:e,snap:n,writeId:i,visible:r}),r&&(t.visibleWrites=ud(t.visibleWrites,e,n)),t.lastWriteId=i}(t.pendingWriteTree_,e,n,i,r),r?yp(t,new Yh({fromUser:!0,fromServer:!1,queryId:null,tagged:!1},e,n)):[]}function dp(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=function(t,e){for(let n=0;n<t.allWrites.length;n++){const i=t.allWrites[n];if(i.writeId===e)return i}return null}(t.pendingWriteTree_,e);if(wd(t.pendingWriteTree_,e)){let e=new ld(null);return null!=i.snap?e=e.set(Ou(),!0):eu(i.children,(t=>{e=e.set(new Nu(t),!0)})),yp(t,new Xh(i.path,e,n))}return[]}function pp(t,e,n){return yp(t,new Yh({fromUser:!1,fromServer:!0,queryId:null,tagged:!1},e,n))}function fp(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=e._path,o=t.syncPointTree_.get(s);let a=[];if(o&&("default"===e._queryIdentifier||op(o,e))){const l=np(o,e,n,i);0===o.views.size&&(t.syncPointTree_=t.syncPointTree_.remove(s));const c=l.removed;if(a=l.events,!r){const n=-1!==c.findIndex((t=>t._queryParams.loadsAllData())),r=t.syncPointTree_.findOnPath(s,((t,e)=>ap(e)));if(n&&!r){const e=t.syncPointTree_.subtree(s);if(!e.isEmpty()){const n=function(t){return t.fold(((t,e,n)=>{if(e&&ap(e)){return[lp(e)]}{let t=[];return e&&(t=ip(e)),eu(n,((e,n)=>{t=t.concat(n)})),t}}))}(e);for(let e=0;e<n.length;++e){const i=n[e],r=i.query,s=wp(t,i);
vendor: 3,774 bytes, line 2
2t.listenProvider_.startListening(Ap(r),Ep(t,r),s.hashFn,s.onComplete)}}}if(!r&&c.length>0&&!i)if(n){const n=null;t.listenProvider_.stopListening(Ap(e),n)}else c.forEach((e=>{const n=t.queryToTagMap.get(xp(e));t.listenProvider_.stopListening(Ap(e),n)}))}!function(t,e){for(let n=0;n<e.length;++n){const i=e[n];if(!i._queryParams.loadsAllData()){const e=xp(i),n=t.queryToTagMap.get(e);t.queryToTagMap.delete(e),t.tagToQueryMap.delete(n)}}}(t,c)}return a}function gp(t,e,n,i){const r=Sp(t,i);if(null!=r){const i=Tp(r),s=i.path,o=i.queryId,a=$u(s,e);return Cp(t,s,new Yh(Zh(o),a,n))}return[]}function mp(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e._path;let s=null,o=!1;t.syncPointTree_.foreachOnPath(r,((t,e)=>{const n=$u(t,r);s=s||rp(e,n),o=o||ap(e)}));let a,l=t.syncPointTree_.get(r);if(l?(o=o||ap(l),s=s||rp(l,Ou())):(l=new Jd,t.syncPointTree_=t.syncPointTree_.set(r,l)),null!=s)a=!0;else{a=!1,s=Sh.EMPTY_NODE;t.syncPointTree_.subtree(r).foreachChild(((t,e)=>{const n=rp(e,Ou());n&&(s=s.updateImmediateChild(t,n))}))}const c=op(l,e);if(!c&&!e._queryParams.loadsAllData()){const n=xp(e);Da(!t.queryToTagMap.has(n),"View does not exist, but we have a tag");const i=cp++;t.queryToTagMap.set(n,i),t.tagToQueryMap.set(i,n)}let u=ep(l,e,n,bd(t.pendingWriteTree_,r),s,a);if(!c&&!o&&!i){const n=sp(l,e);u=u.concat(function(t,e,n){const i=e._path,r=Ep(t,e),s=wp(t,n),o=t.listenProvider_.startListening(Ap(e),r,s.hashFn,s.onComplete),a=t.syncPointTree_.subtree(i);if(r)Da(!ap(a.value),"If we're adding a query, it shouldn't be shadowed");else{const e=a.fold(((t,e,n)=>{if(!Wu(t)&&e&&ap(e))return[lp(e).query];{let t=[];return e&&(t=t.concat(ip(e).map((t=>t.query)))),eu(n,((e,n)=>{t=t.concat(n)})),t}}));for(let n=0;n<e.length;++n){const i=e[n];t.listenProvider_.stopListening(Ap(i),Ep(t,i))}}return o}(t,e,n))}return u}function _p(t,e,n){const i=t.pendingWriteTree_,r=t.syncPointTree_.findOnPath(e,((t,n)=>{const i=rp(n,$u(t,e));if(i)return i}));return Td(i,e,r,n,!0)}function yp(t,e){return vp(e,t.syncPointTree_,null,bd(t.pendingWriteTree_,Ou()))}function vp(t,e,n,i){if(Wu(t.path))return bp(t,e,n,i);{const r=e.get(Ou());null==n&&null!=r&&(n=rp(r,Ou()));let s=[];const o=Du(t.path),a=t.operationForChild(o),l=e.children.get(o);if(l&&a){const t=n?n.getImmediateChild(o):null,e=Ld(i,o);s=s.concat(vp(a,l,t,e))}return r&&(s=s.concat(Qd(r,t,i,n))),s}}function bp(t,e,n,i){const r=e.get(Ou());null==n&&null!=r&&(n=rp(r,Ou()));let s=[];return e.children.inorderTraversal(((e,r)=>{const o=n?n.getImmediateChild(e):null,a=Ld(i,e),l=t.operationForChild(e);l&&(s=s.concat(bp(l,r,o,a)))})),r&&(s=s.concat(Qd(r,t,i,n))),s}function wp(t,e){const n=e.query,i=Ep(t,n);return{hashFn:()=>{const t=function(t){return t.viewCache_.serverCache.getNode()}(e)||Sh.EMPTY_NODE;return t.hash()},onComplete:e=>{if("ok"===e)return i?function(t,e,n){const i=Sp(t,n);if(i){const n=Tp(i),r=n.path,s=n.queryId,o=$u(r,e);return Cp(t,r,new Kh(Zh(s),o))}return[]}(t,n._path,i):function(t,e){return yp(t,new Kh({fromUser:!1,fromServer:!0,queryId:null,tagged:!1},e))}(t,n._path);{const i=function(t,e){let n="Unknown Error";"too_big"===t?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"===t?n="Client doesn't have permission to access the desired data.":"unavailable"===t&&(n="The service is unavailable");const i=new Error(t+" at "+e._path.toString()+": "+n);return i.code=t.toUpperCase(),i}(e,n);return fp(t,n,null,i)}}}}function Ep(t,e){const n=xp(e);return t.queryToTagMap.get(n)}function xp(t){return t._path.toString()+"$"+t._queryIdentifier}function Sp(t,e){return t.tagToQueryMap.get(e)}function Tp(t){const e=t.indexOf("$");return Da(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new Nu(t.
2substr(0,e))}}function Cp(t,e,n){const i=t.syncPointTree_.get(e);Da(i,"Missing sync point for query tag that we're tracking");return Qd(i,n,bd(t.pendingWriteTree_,e),null)}function Ap(t){return t._queryParams.loadsAllData()&&!t._queryParams.isDefault()?new(Da(Yd,"Reference.ts has not been loaded"),Yd)(t._repo,t._path):t}class Pp{constructor(t){this.node_=t}getImmediateChild(t){const e=this.node_.getImmediateChild(t);return new Pp(e)}node(){return this.node_}}class Rp{constructor(t,e){this.syncTree_=t,this.path_=e}getImmediateChild(t){const e=Vu(this.path_,t);return new Rp(this.syncTree_,e)}node(){return _p(this.syncTree_,this.path_)}}const Mp=function(t){return(t=t||{}).timestamp=t.timestamp||(new Date).getTime(),t},Ip=function(t,e,n){return t&&"object"===typeof t?(Da(".sv"in t,"Unexpected leaf node or priority contents"),"string"===typeof t[".sv"]?Lp(t[".sv"],e,n):"object"===typeof t[".sv"]?kp(t[".sv"],e):void Da(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},Lp=function(t,e,n){if("timestamp"===t)return n.timestamp;Da(!1,"Unexpected server value: "+t)},kp=function(t,e,n){t.hasOwnProperty("increment")||Da(!1,"Unexpected server value: "+JSON.stringify(t,null,2));const i=t.increment;"number"!==typeof i&&Da(!1,"Unexpected increment value: "+i);const r=e.node();if(Da(null!==r&&"undefined"!==typeof r,"Expected ChildrenNode.EMPTY_NODE for nulls"),!r.isLeafNode())return i;const s=r.getValue();return"number"!==typeof s?i:s+i},Np=function(t,e,n,i){return Dp(e,new Rp(n,t),i)},Op=function(t,e,n){return Dp(t,new Pp(e),n)};function Dp(t,e,n){const i=t.getPriority().val(),r=Ip(i,e.getImmediateChild(".priority"),n);let s;if(t.isLeafNode()){const i=t,s=Ip(i.getValue(),e,n);return s!==i.getValue()||r!==i.getPriority().val()?new gh(s,Ah(r)):t}{const i=t;return s=i,r!==i.getPriority().val()&&(s=s.updatePriority(new gh(r))),i.forEac
2hChild(mh,((t,i)=>{const r=Dp(i,e.getImmediateChild(t),n);r!==i&&(s=s.updateImmediateChild(t,r))})),s}}class Fp{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{children:{},childCount:0};this.name=t,this.parent=e,this.node=n}}function Bp(t,e){let n=e instanceof Nu?e:new Nu(e),i=t,r=Du(n);for(;null!==r;){const t=cl(i.node.children,r)||{children:{},childCount:0};i=new Fp(r,i,t),n=Bu(n),r=Du(n)}return i}function Up(t){return t.node.value}function zp(t,e){t.node.value=e,Gp(t)}function jp(t){return t.node.childCount>0}function Vp(t,e){eu(t.node.children,((n,i)=>{e(new Fp(n,t,i))}))}function Wp(t,e,n,i){n&&!i&&e(t),Vp(t,(t=>{Wp(t,e,!0,i)})),n&&i&&e(t)}function $p(t){return new Nu(null===t.parent?t.name:$p(t.parent)+"/"+t.name)}function Gp(t){null!==t.parent&&function(t,e,n){const i=function(t){return void 0===Up(t)&&!jp(t)}(n),r=ll(t.node.children,e);i&&r?(delete t.node.children[e],t.node.childCount--,Gp(t)):i||r||(t.node.children[e]=n.node,t.node.childCount++,Gp(t))}(t.parent,t.name,t)}const Hp=/[\[\].#$\/\u0000-\u001F\u007F]/,qp=/[\[\].#$\u0000-\u001F\u007F]/,Zp=10485760,Xp=function(t){return"string"===typeof t&&0!==t.length&&!Hp.test(t)},Kp=function(t){return"string"===typeof t&&0!==t.length&&!qp.test(t)},Yp=function(t,e,n){const i=n instanceof Nu?new qu(n,t):n;if(void 0===e)throw new Error(t+"contains undefined "+Xu(i));if("function"===typeof e)throw new Error(t+"contains a function "+Xu(i)+" with contents = "+e.toString());if(qc(e))throw new Error(t+"contains "+e.toString()+" "+Xu(i));if("string"===typeof e&&e.length>Zp/3&&wl(e)>Zp)throw new Error(t+"contains a string greater than "+Zp+" utf8 bytes "+Xu(i)+" ('"+e.substring(0,50)+"...')");if(e&&"object"===typeof e){let n=!1,r=!1;if(eu(e,((e,s)=>{if(".value"===e)n=!0;else if(".priority"!==e&&".sv"!==e&&(r=!0,!Xp(e)))throw new Error(t+" contains an invalid key ("+e+") "+Xu(i)+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');!function(t,e){t.parts_.length>0&&(t.byteLength_+=1),t.parts_.push(e),t.byteLength_+=wl(e),Zu(t)}(i,e),Yp(t,s,i),function(t){const e=t.parts_.pop();t.byteLength_-=wl(e),t.parts_.length>0&&(t.byteLength_-=1)}(i)})),n&&r)throw new Error(t+' contains ".value" child '+Xu(i)+" in addition to actual children.")}},Jp=function(t,e,n,i){if((!i||void 0!==n)&&!Kp(n))throw new Error(bl(t,e)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},Qp=function(t,e,n,i){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),Jp(t,e,n,i)},tf=function(t,e){const n=e.path.toString();if("string"!==typeof e.repoInfo.host||0===e.repoInfo.host.length||!Xp(e.repoInfo.namespace)&&"localhost"!==e.repoInfo.host.split(":")[0]||0!==n.length&&!function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),Kp(t)}(n))throw new Error(bl(t,"url")+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')};class ef{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function nf(t,e){let n=null;for(let i=0;i<e.length;i++){const r=e[i],s=r.getPath();null===n||Gu(s,n.path)||(t.eventLists_.push(n),n=null),null===n&&(n={events:[],path:s}),n.events.push(r)}n&&t.eventLists_.push(n)}function rf(t,e,n){nf(t,n),of(t,(t=>Gu(t,e)))}function sf(t,e,n){nf(t,n),of(t,(t=>Hu(t,e)||Hu(e,t)))}function of(t,e){t.recursionDepth_++;let n=!0;for(let i=0;i<t.eventLists_.length;i++){const r=t.eventLists_[i];if(r){e(r.path)?(af(t.eventLists_[i]),t.eventLists_[i]=null):n=!1}}n&&(t.eventLists_=[]),t.recursionDepth_--}function af(t){for(let e=0;e<t.events.length;e++){const n=t.events[e];if(null!==n){t.events[e]=null;const i=n.getEventRunner();Uc&&Vc("event: "+n.toString()),su(i)}}}const lf="repo_interrupt",cf=25;class uf{constructor(t,e,n,i){this.repoInfo_=t,this.forceRestClient_=e,this.authTokenProvider_=n,this.appCheckProvider_=i,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new ef,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=Vh(),this.transactionQueueTree_=new Fp,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function hf(t,e,n){if(t.stats_=bu(t.repoInfo_),t.forceRestClient_||("object"===typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0)t.server_=new zh(t.repoInfo_,((e,n,i,r)=>{ff(t,e,n,i,r)}),t.authTokenProvider_,t.appCheckProvider_),setTimeout((()=>gf(t,!0)),0);else{if("undefined"!==typeof n&&null!==n){if("object"!==typeof n)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{ol(n)}catch(i){throw new Error("Invalid authOverride provided: "+i)}}t.persistentConnection_=new Ju(t.repoInfo_,e,((e,n,i,r)=>{ff(t,e,n,i,r)}),(e=>{gf(t,e)}),(e=>{!function(t,e){eu(e,((e,n)=>{mf(t,e,n)}
vendor: 4,651 bytes, line 2
2))}(t,e)}),t.authTokenProvider_,t.appCheckProvider_,n),t.server_=t.persistentConnection_}t.authTokenProvider_.addTokenChangeListener((e=>{t.server_.refreshAuthToken(e)})),t.appCheckProvider_.addTokenChangeListener((e=>{t.server_.refreshAppCheckToken(e.token)})),t.statsReporter_=function(t,e){const n=t.toString();return vu[n]||(vu[n]=e()),vu[n]}(t.repoInfo_,(()=>new Hh(t.stats_,t.server_))),t.infoData_=new jh,t.infoSyncTree_=new up({startListening:(e,n,i,r)=>{let s=[];const o=t.infoData_.getNode(e._path);return o.isEmpty()||(s=pp(t.infoSyncTree_,e._path,o),setTimeout((()=>{r("ok")}),0)),s},stopListening:()=>{}}),mf(t,"connected",!1),t.serverSyncTree_=new up({startListening:(e,n,i,r)=>(t.server_.listen(e,i,n,((n,i)=>{const s=r(n,i);sf(t.eventQueue_,e._path,s)})),[]),stopListening:(e,n)=>{t.server_.unlisten(e,n)}})}function df(t){const e=t.infoData_.getNode(new Nu(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+e}function pf(t){return Mp({timestamp:df(t)})}function ff(t,e,n,i,r){t.dataUpdateCount++;const s=new Nu(e);n=t.interceptServerDataCallback_?t.interceptServerDataCallback_(e,n):n;let o=[];if(r)if(i){const e=hl(n,(t=>Ah(t)));o=function(t,e,n,i){const r=Sp(t,i);if(r){const i=Tp(r),s=i.path,o=i.queryId,a=$u(s,e),l=ld.fromObject(n);return Cp(t,s,new Jh(Zh(o),a,l))}return[]}(t.serverSyncTree_,s,e,r)}else{const e=Ah(n);o=gp(t.serverSyncTree_,s,e,r)}else if(i){const e=hl(n,(t=>Ah(t)));o=function(t,e,n){const i=ld.fromObject(n);return yp(t,new Jh({fromUser:!1,fromServer:!0,queryId:null,tagged:!1},e,i))}(t.serverSyncTree_,s,e)}else{const e=Ah(n);o=pp(t.serverSyncTree_,s,e)}let a=s;o.length>0&&(a=xf(t,s)),sf(t.eventQueue_,a,o)}function gf(t,e){mf(t,"connected",e),!1===e&&function(t){bf(t,"onDisconnectEvents");const e=pf(t),n=Vh();$h(t.onDisconnect_,Ou(),((i,r)=>{const s=Np(i,r,t.serverSyncTree_,e);Wh(n,i,s)}));let i=[];$h(n,Ou(),((e,n)=>{i=i.concat(pp(t.serverSyncTree_,e,n));const r=Pf(t,e);xf(t,r)})),t.onDisconnect_=Vh(),sf(t.eventQueue_,Ou(),i)}(t)}function mf(t,e,n){const i=new Nu("/.info/"+e),r=Ah(n);t.infoData_.updateSnapshot(i,r);const s=pp(t.infoSyncTree_,i,r);sf(t.eventQueue_,i,s)}function _f(t){return t.nextWriteId_++}function yf(t,e,n){let i;i=".info"===Du(e._path)?fp(t.infoSyncTree_,e,n):fp(t.serverSyncTree_,e,n),rf(t.eventQueue_,e._path,i)}function vf(t){t.persistentConnection_&&t.persistentConnection_.interrupt(lf)}function bf(t){let e="";t.persistentConnection_&&(e=t.persistentConnection_.id+":");for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];Vc(e,...i)}function wf(t,e,n){return _p(t.serverSyncTree_,e,n)||Sh.EMPTY_NODE}function Ef(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.transactionQueueTree_;if(e||Af(t,e),Up(e)){const n=Tf(t,e);Da(n.length>0,"Sending zero length transaction queue");n.every((t=>0===t.status))&&function(t,e,n){const i=n.map((t=>t.currentWriteId)),r=wf(t,e,i);let s=r;const o=r.hash();for(let c=0;c<n.length;c++){const t=n[c];Da(0===t.status,"tryToSendTransactionQueue_: items in queue should all be run."),t.status=1,t.retryCount++;const i=$u(e,t.path);s=s.updateChild(i,t.currentOutputSnapshotRaw)}const a=s.val(!0),l=e;t.server_.put(l.toString(),a,(i=>{bf(t,"transaction put response",{path:l.toString(),status:i});let r=[];if("ok"===i){const i=[];for(let e=0;e<n.length;e++)n[e].status=2,r=r.concat(dp(t.serverSyncTree_,n[e].currentWriteId)),n[e].onComplete&&i.push((()=>n[e].onComplete(null,!0,n[e].currentOutputSnapshotResolved))),n[e].unwatcher();Af(t,Bp(t.transactionQueueTree_,e)),Ef(t,t.transactionQueueTree_),sf(t.eventQueue_,e,r);for(let t=0;t<i.length;t++)su(i[t])}else{if("datastale"===i)for(let t=0;t<n.length;t++)3===n[t].status?n[t].status=4:n[t].status=0;else{Hc("transaction at "+l.toString()+" failed: "+i);for(let t=0;t<n.length;t++)n[t].status=4,n[t].abortReason=i}xf(t,e)}}),o)}(t,$p(e),n)}else jp(e)&&Vp(e,(e=>{Ef(t,e)}))}function xf(t,e){const n=Sf(t,e),i=$p(n);return function(t,e,n){if(0===e.length)return;const i=[];let r=[];const s=e.filter((t=>0===t.status)),o=s.map((t=>t.currentWriteId));for(let l=0;l<e.length;l++){const s=e[l],c=$u(n,s.path);let u,h=!1;if(Da(null!==c,"rerunTransactionsUnderNode_: relativePath should not be null."),4===s.status)h=!0,u=s.abortReason,r=r.concat(dp(t.serverSyncTree_,s.currentWriteId,!0));else if(0===s.status)if(s.retryCount>=cf)h=!0,u="maxretry",r=r.concat(dp(t.serverSyncTree_,s.currentWriteId,!0));else{const n=wf(t,s.path,o);s.currentInputSnapshot=n;const i=e[l].update(n.val());if(void 0!==i){Yp("transaction failed: Data returned ",i,s.path);let e=Ah(i);"object"===typeof i&&null!=i&&ll(i,".priority")||(e=e.updatePriority(n.getPri
vendor: 11,546 bytes, line 2
2ority()));const a=s.currentWriteId,l=pf(t),c=Op(e,n,l);s.currentOutputSnapshotRaw=e,s.currentOutputSnapshotResolved=c,s.currentWriteId=_f(t),o.splice(o.indexOf(a),1),r=r.concat(hp(t.serverSyncTree_,s.path,c,s.currentWriteId,s.applyLocally)),r=r.concat(dp(t.serverSyncTree_,a,!0))}else h=!0,u="nodata",r=r.concat(dp(t.serverSyncTree_,s.currentWriteId,!0))}sf(t.eventQueue_,n,r),r=[],h&&(e[l].status=2,a=e[l].unwatcher,setTimeout(a,Math.floor(0)),e[l].onComplete&&("nodata"===u?i.push((()=>e[l].onComplete(null,!1,e[l].currentInputSnapshot))):i.push((()=>e[l].onComplete(new Error(u),!1,null)))))}var a;Af(t,t.transactionQueueTree_);for(let l=0;l<i.length;l++)su(i[l]);Ef(t,t.transactionQueueTree_)}(t,Tf(t,n),i),i}function Sf(t,e){let n,i=t.transactionQueueTree_;for(n=Du(e);null!==n&&void 0===Up(i);)i=Bp(i,n),n=Du(e=Bu(e));return i}function Tf(t,e){const n=[];return Cf(t,e,n),n.sort(((t,e)=>t.order-e.order)),n}function Cf(t,e,n){const i=Up(e);if(i)for(let r=0;r<i.length;r++)n.push(i[r]);Vp(e,(e=>{Cf(t,e,n)}))}function Af(t,e){const n=Up(e);if(n){let t=0;for(let e=0;e<n.length;e++)2!==n[e].status&&(n[t]=n[e],t++);n.length=t,zp(e,n.length>0?n:void 0)}Vp(e,(e=>{Af(t,e)}))}function Pf(t,e){const n=$p(Sf(t,e)),i=Bp(t.transactionQueueTree_,e);return function(t,e,n){let i=n?t:t.parent;for(;null!==i;){if(e(i))return!0;i=i.parent}}(i,(e=>{Rf(t,e)})),Rf(t,i),Wp(i,(e=>{Rf(t,e)})),n}function Rf(t,e){const n=Up(e);if(n){const i=[];let r=[],s=-1;for(let e=0;e<n.length;e++)3===n[e].status||(1===n[e].status?(Da(s===e-1,"All SENT items should be at beginning of queue."),s=e,n[e].status=3,n[e].abortReason="set"):(Da(0===n[e].status,"Unexpected transaction status in abort"),n[e].unwatcher(),r=r.concat(dp(t.serverSyncTree_,n[e].currentWriteId,!0)),n[e].onComplete&&i.push(n[e].onComplete.bind(null,new Error("set"),!1,null))));-1===s?zp(e,void 0):n.length=s+1,sf(t.eventQueue_,$p(e),r);for(let t=0;t<i.length;t++)su(i[t])}}const Mf=function(t,e){const n=If(t),i=n.namespace;"firebase.com"===n.domain&&Gc(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),i&&"undefined"!==i||"localhost"===n.domain||Gc("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||"undefined"!==typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&Hc("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");const r="ws"===n.scheme||"wss"===n.scheme;return{repoInfo:new gu(n.host,n.secure,i,r,e,"",i!==n.subdomain),path:new Nu(n.pathString)}},If=function(t){let e="",n="",i="",r="",s="",o=!0,a="https",l=443;if("string"===typeof t){let c=t.indexOf("//");c>=0&&(a=t.substring(0,c-1),t=t.substring(c+2));let u=t.indexOf("/");-1===u&&(u=t.length);let h=t.indexOf("?");-1===h&&(h=t.length),e=t.substring(0,Math.min(u,h)),u<h&&(r=function(t){let e="";const n=t.split("/");for(let r=0;r<n.length;r++)if(n[r].length>0){let t=n[r];try{t=decodeURIComponent(t.replace(/\+/g," "))}catch(i){}e+="/"+t}return e}(t.substring(u,h)));const d=function(t){const e={};"?"===t.charAt(0)&&(t=t.substring(1));for(const n of t.split("&")){if(0===n.length)continue;const i=n.split("=");2===i.length?e[decodeURIComponent(i[0])]=decodeURIComponent(i[1]):Hc(`Invalid query segment '${n}' in query '${t}'`)}return e}(t.substring(Math.min(t.length,h)));c=e.indexOf(":"),c>=0?(o="https"===a||"wss"===a,l=parseInt(e.substring(c+1),10)):c=e.length;const p=e.slice(0,c);if("localhost"===p.toLowerCase())n="localhost";else if(p.split(".").length<=2)n=p;else{const t=e.indexOf(".");i=e.substring(0,t).toLowerCase(),n=e.substring(t+1),s=i}"ns"in d&&(s=d.ns)}return{host:e,port:l,domain:n,subdomain:i,secure:o,scheme:a,pathString:r,namespace:s}},Lf="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";!function(){let t=0;const e=[]}();class kf{constructor(t,e,n,i){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=i}getPath(){const t=this.snapshot.ref;return"value"===this.eventType?t._path:t.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+ol(this.snapshot.exportVal())}}class Nf{constructor(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}class Of{constructor(t,e){this.snapshotCallback=t,this.cancelCallback=e}onValue(t,e){this.snapshotCallback.call(null,t,e)}onCancel(t){return Da(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,t)}get hasCancelCallback(){return!!this.cancelCallback}matches(t){return this.snapshotCallback===t.snapshotCallback||void 0!==this.snapshotCallback.userCallback&&this.snapshotCallback.userCallback===t.snapshotCallback.userCallback&&this.snapshotCallback.context===t.snapshotCallback.context}}class Df{constructor(t,e,n,i){this._repo=t,this._path=e,this._queryParams=n,this._orderByCalled=i}get key(){return Wu(this._path)?null:Uu(this._path)}get ref(){return new Ff(this._repo,this._path)}get _queryIdentifier(){const t=Uh(this._queryParams),e=Qc(t);return"{}"===e?"default":e}get _queryObject(){return Uh(this._queryParams)}isEqual(t){if(!((t=El(t))instanceof Df))return!1;const e=this._repo===t._repo,n=Gu(this._path,t._path),i=this._queryIdentifier===t._queryIdentifier;return e&&n&&i}toJSON(){return this.toString()}toString(){return this._repo.toString()+function(t){let e="";for(let n=t.pieceNum_;n<t.pieces_.length;n++)""!==t.pieces_[n]&&(e+="/"+encodeURIComponent(String(t.pieces_[n])));return e||"/"}(this._path)}}class Ff extends Df{constructor(t,e){super(t,e,new Fh,!1)}get parent(){const t=ju(this._path);return null===t?null:new Ff(this._repo,t)}get root(){let t=this;for(;null!==t.parent;)t=t.parent;return t}}class Bf{constructor(t,e,n){this._node=t,this.ref=e,this._index=n}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(t){const e=new Nu(t),n=zf(this.ref,t);return new Bf(this._node.getChild(e),n,mh)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(t){if(this._node.isLeafNode())return!1;return!!this._node.forEachChild(this._index,((e,n)=>t(new Bf(n,zf(this.ref,e),mh))))}hasChild(t){const e=new Nu(t);return!this._node.getChild(e).isEmpty()}hasChildren(){return!this._node.isLeafNode()&&!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function Uf(t,e){return(t=El(t))._checkNotDeleted("ref"),void 0!==e?zf(t._root,e):t._root}function zf(t,e){return null===Du((t=El(t))._path)?Qp("child","path",e,!1):Jp("child","path",e,!1),new Ff(t._repo,Vu(t._path,e))}class jf{constructor(t){this.callbackContext=t}respondsTo(t){return"value"===t}createEvent(t,e){const n=e._queryParams.getIndex();return new kf("value",this,new Bf(t.snapshotNode,new Ff(e._repo,e._path),n))}getEventRunner(t){return"cancel"===t.getEventType()?()=>this.callbackContext.onCancel(t.error):()=>this.callbackContext.onValue(t.snapshot,null)}createCancelEvent(t,e){return this.callbackContext.hasCancelCallback?new Nf(this,t,e):null}matches(t){return t instanceof jf&&(!t.callbackContext||!this.callbackContext||t.callbackContext.matches(this.callbackContext))}hasAnyCallback(){return null!==this.callbackContext}}class Vf{constructor(t,e){this.eventType=t,this.callbackContext=e}respondsTo(t){let e="children_added"===t?"child_added":t;return e="children_removed"===e?"child_removed":e,this.eventType===e}createCancelEvent(t,e){return this.callbackContext.hasCancelCallback?new Nf(this,t,e):null}createEvent(t,e){Da(null!=t.childName,"Child events should have a childName.");const n=zf(new Ff(e._repo,e._path),t.childName),i=e._queryParams.getIndex();return new kf(t.type,this,new Bf(t.snapshotNode,n,i),t.prevName)}getEventRunner(t){return"cancel"===t.getEventType()?()=>this.callbackContext.onCancel(t.error):()=>this.callbackContext.onValue(t.snapshot,t.prevName)}matches(t){return t instanceof Vf&&(this.eventType===t.eventType&&(!this.callbackContext||!t.callbackContext||this.callbackContext.matches(t.callbackContext)))}hasAnyCallback(){return!!this.callbackContext}}function Wf(t,e,n,i,r){let s;if("object"===typeof i&&(s=void 0,r=i),"function"===typeof i&&(s=i),r&&r.onlyOnce){const e=n,i=(n,i)=>{yf(t._repo,t,a),e(n,i)};i.userCallback=n.userCallback,i.context=n.context,n=i}const o=new Of(n,s||void 0),a="value"===e?new jf(o):new Vf(e,o);return function(t,e,n){let i;i=".info"===Du(e._path)?mp(t.infoSyncTree_,e,n):mp(t.serverSyncTree_,e,n),rf(t.eventQueue_,e._path,i)}(t._repo,t,a),()=>yf(t._repo,t,a)}function $f(t,e,n,i){return Wf(t,"value",e,n,i)}!function(t){Da(!Kd,"__referenceConstructor has already been defined"),Kd=t}(Ff),function(t){Da(!Yd,"__referenceConstructor has already been defined"),Yd=t}(Ff);const Gf="FIREBASE_DATABASE_EMULATOR_HOST",Hf={};let qf=!1;function Zf(t,e,n,i,r){let s=i||t.options.databaseURL;void 0===s&&(t.options.projectId||Gc("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),Vc("Using default host for project ",t.options.projectId),s=`${t.options.projectId}-default-rtdb.firebaseio.com`);let o,a,l=Mf(s,r),c=l.repoInfo;"undefined"!==typeof process&&(a={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_FIREBASE_PASSWORD:"ClearloopData123!",REACT_APP_OPENWEATHER_API_KEY:"03c641fb2401c9014257bab115dd66ad",REACT_APP_FIREBASE_EMAIL:"[email protected]",REACT_APP_MAPBOX_TOKEN:"pk.eyJ1IjoibWFuZGFsaSIsImEiOiJjbHh0Z2I4YW0wNGtvMmlvYzZhM28wMTV2In0.maKcZ_aBF3G64JMJM2W1EQ"}[Gf]),a?(o=!0,s=`http://${a}?ns=${c.namespace}`,l=Mf(s,r),c=l.repoInfo):o=!l.repoInfo.secure;const u=r&&o?new cu(cu.OWNER):new lu(t.name,t.options,e);tf("Invalid Firebase Database URL",l),Wu(l.path)||Gc("Database URL must point to the root of a Firebase Database (not including a child path).");const h=function(t,e,n,i){let r=Hf[e.name];r||(r={},Hf[e.name]=r);let s=r[t.toURLString()];s&&Gc("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call.");return s=new uf(t,qf,n,i),r[t.toURLString()]=s,s}(c,t,u,new au(t.name,n));return new Xf(h,t)}class Xf{constructor(t,e){this._repoInternal=t,this.app=e,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(hf(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new Ff(this._repo,Ou())),this._rootInternal}_delete(){return null!==this._rootInternal&&(!function(t,e){const n=Hf[e];n&&n[t.key]===t||Gc(`Database ${e}(${t.repoInfo_}) has already been deleted.`),vf(t),delete n[t.key]}(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(t){null===this._rootInternal&&Gc("Cannot call "+t+" on a deleted database.")}}function Kf(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dc(),e=arguments.length>1?arguments[1]:void 0;const n=ac(t,"database").getImmediate({identifier:e});if(!n._instanceStarted){const t=(t=>{const e=Za(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e}
2 with no separate hostname and port!`);const i=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),i]:[e.substring(0,n),i]})("database");t&&function(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};t=El(t),t._checkNotDeleted("useEmulator"),t._instanceStarted&&Gc("Cannot call useEmulator() after instance has already been initialized.");const r=t._repoInternal;let s;if(r.repoInfo_.nodeAdmin)i.mockUserToken&&Gc('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),s=new cu(cu.OWNER);else if(i.mockUserToken){const e="string"===typeof i.mockUserToken?i.mockUserToken:function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",i=t.iat||0,r=t.sub||t.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:i,exp:i+3600,auth_time:i,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},t);return[Va(JSON.stringify({alg:"none",type:"JWT"})),Va(JSON.stringify(s)),""].join(".")}(i.mockUserToken,t.app.options.projectId);s=new cu(e)}!function(t,e,n,i){t.repoInfo_=new gu(`${e}:${n}`,!1,t.repoInfo_.namespace,t.repoInfo_.webSocketOnly,t.repoInfo_.nodeAdmin,t.repoInfo_.persistenceKey,t.repoInfo_.includeNamespaceInQueryParams,!0),i&&(t.authTokenProvider_=i)}(r,e,n,s)}(n,...t)}return n}Ju.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},Ju.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};!function(t){Rc(uc),oc(new xl("database",((t,e)=>{let{instanceIdentifier:n}=e;return Zf(t.getProvider("app").getImmediate(),t.getProvider("auth-internal"),t.getProvider("app-check-internal"),n)}),"PUBLIC").setMultipleInstances(!0)),pc(Cc,Ac,t),pc(Cc,Ac,"esm2017")}();const Yf=n.p+"static/media/yellowCityPin.0530b598155a16eff4813063aff869b5.svg";const Jf=n.p+"static/media/yellowSelectedPin.6c43ef98e20783d2716a01ceb9630ed8.svg";pc("firebase","10.8.0","app");const Qf=hc({apiKey:"AIzaSyDBsN_R_Jd9lw2ntt0NdV-V8Nb5C6hA6Dg",authDomain:"clearloop-watttime.firebaseapp.com",databaseURL:"https://clearloop-watttime-default-rtdb.firebaseio.com",projectId:"clearloop-watttime",storageBucket:"clearloop-watttime.appspot.com",messagingSenderId:"609651615423",appId:"1:609651615423:web:05e304e30b1fd14923c80a",measurementId:"G-W6M8H396EM"}),tg=(Kf(Qf),n.p+"static/media/healthy.58fe8c5cde302204926b.png"),eg=n.p+"static/media/half_healthy.3fba7e471c0b8d0c606b.png",ng=n.p+"static/media/unhealthy.065666eb85886141ea8f.png",ig=(Kf(Qf),{mapContainer:{position:"relative",textAlign:"center",maxWidth:"800px",margin:"0 auto",cursor:"pointer",userSelect:"none"},mapImageContainer:{position:"relative",display:"inline-block"},mapImage:{width:"100%",maxWidth:"800px",height:"auto",borderRadius:"8px",border:"1px solid #ddd",display:"block"},zoomControls:{position:"absolute",top:"10px",right:"10px",backgroundColor:"rgba(255, 255, 255, 0.8)",borderRadius:"4px",padding:"5px",display:"flex",flexDirection:"column",alignItems:"center",gap:"5px",zIndex:1},zoomButton:{width:"30px",height:"30px",fontSize:"16px",fontWeight:"bold",backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},zoomLevelDisplay:{fontSize:"12px",fontWeight:"bold"},earthPrompt:{position:"absolute",bottom:"10px",left:"0",right:"0",backgroundColor:"rgba(0, 0, 0, 0.7)",color:"white",padding:"5px",fontSize:"14px",borderRadius:"4px",margin:"0 10px"},locationInfo:{backgroundColor:"#f8f9fa",padding:"10px",borderRadius:"6px",textAlign:"center",border:"1px solid #dee2e6",marginTop:"10px"}}),rg=t=>{let{mapUrl:n,selectedLocation:i,onZoomIn:r,onZoomOut:o,googleEarthUrl:a,zoomLevel:l}=t;const c=(0,e.useRef)(null);if(!n)return null;return(0,s.jsx)("div",{style:ig.mapContainer,ref:c,onWheel:t=>{t.preventDefault(),t.deltaY<0?r():o()},children:(0,s.jsxs)("div",{style:ig.mapImageContainer,onClick:()=>{window.open(a,"_blank","noopener,noreferrer")},children:[(0,s.jsx)("img",{src:n,alt:`Satellite view of ${i}`,style:ig.mapImage}),(0,s.jsxs)("div",{style:ig.zoomControls,children:[(0,s.jsx)("button",{onClick:t=>{t.stopPropagation(),r()},style:ig.zoomButton,children:"+"}),(0,s.jsxs)("div",{style:ig.zoomLevelDisplay,children:["Zoom: ",l]}),(0,s.jsx)("button",{onClick:t=>{t.stopPropagation(),o()},style:ig.zoomButton,children:"-"})]}
2),(0,s.jsx)("div",{style:ig.earthPrompt,children:"Click anywhere on the map to view in Google Earth"})]})})},sg={container:{width:"100%",maxWidth:"400px",margin:"0 auto",padding:"10px"}},og=t=>{let{plant:n}=t;const[i,r]=(0,e.useState)(""),[o,a]=(0,e.useState)(17),l={jackson2:{State:"Tennessee",County:"Jackson County",Latitude:35.609073,Longitude:-88.916015},panola1:{State:"Mississippi",County:"Panola County",Latitude:34.3041527,Longitude:-89.98631801},panola2:{State:"Mississippi",County:"Panola County",Latitude:34.34085632,Longitude:-89.91117261},panola3:{State:"Mississippi",County:"Panola County",Latitude:34.302365,Longitude:-89.987844},paris:{State:"Tennessee",County:"Henry County",Latitude:36.4463,Longitude:-88.327083},whitepine:{State:"Tennessee",County:"Jefferson County",Latitude:36.123581,Longitude:-83.284975}};(0,e.useEffect)((()=>{console.log(n,l[n]),n&&l[n]&&c(o)}),[n,o]);const c=t=>{const e=l[n],i=new URLSearchParams({center:`${e.Latitude},${e.Longitude}`,zoom:t.toString(),size:"800x600",maptype:"satellite",key:"AIzaSyAtA4uGo3XbsiWJ7v7R6df3UTezfUQ42IA",language:"en",region:"us"});r(`https://maps.googleapis.com/maps/api/staticmap?${i}`)};return(0,s.jsx)("div",{style:sg.container,children:(0,s.jsx)(rg,{mapUrl:i,selectedLocation:n,onZoomIn:()=>{o<20&&a(o+1)},onZoomOut:()=>{o>0&&a(o-1)},googleEarthUrl:(()=>{if(!n||!l[n])return"#";const t=l[n];return`https://earth.google.com/web/@${t.Latitude},${t.Longitude},200a,200d,35y,0h,0t,0r`})(),zoomLevel:o})})};function ag(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}Object.create;Object.create;"function"===typeof SuppressedError&&SuppressedError;function lg(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const cg=lg,ug=new il("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),hg=new kl("@firebase/auth");function dg(t){if(hg.logLevel<=Pl.ERROR){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];hg.error(`Auth (${uc}): ${t}`,...n)}}function pg(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];throw mg(t,...n)}function fg(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return mg(t,...n)}function gg(t,e,n){const i=Object.assign(Object.assign({},cg()),{[e]:n});return new il("auth","Firebase",i).create(e,{appName:t.name})}function mg(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];if("string"!==typeof t){const e=n[0],i=[...n.slice(1)];return i[0]&&(i[0].appName=t.name),t._errorFactory.create(e,...i)}return ug.create(t,...n)}function _g(t,e){if(!t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];throw mg(e,...i)}}function yg(t){const e="INTERNAL ASSERTION FAILED: "+t;throw dg(e),new Error(e)}function vg(t,e){t||yg(e)}function bg(){var t;return"undefined"!==typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function wg(){return"http:"===Eg()||"https:"===Eg()}function Eg(){var t;return"undefined"!==typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}function xg(){return!("undefined"!==typeof navigator&&navigator&&"onLine"in navigator&&"boolean"===typeof navigator.onLine&&(wg()||function(){const t="object"===typeof chrome?chrome.runtime:"object"===typeof browser?browser.runtime:void 0;return"object"===typeof t&&void 0!==t.id}()||"connection"in navigator))||navigator.onLine}class Sg{constructor(t,e){this.shortDelay=t,this.longDelay=e,vg(e>
2t,"Short delay should be less than long delay!"),this.isMobile=Qa()||tl()}get(){return xg()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Tg(t,e){vg(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}class Cg{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!==typeof self&&"fetch"in self?self.fetch:"undefined"!==typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!==typeof fetch?fetch:void yg("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!==typeof self&&"Headers"in self?self.Headers:"undefined"!==typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!==typeof Headers?Headers:void yg("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!==typeof self&&"Response"in self?self.Response:"undefined"!==typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!==typeof Response?Response:void yg("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Ag={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Pg=new Sg(3e4,6e4);function Rg(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Mg(t,e,n,i){return Ig(t,arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},(async()=>{let r={},s={};i&&("GET"===e?s=i:r={body:JSON.stringify(i)});const o=fl(Object.assign({key:t.config.apiKey},s)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Cg.fetch()(kg(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},r))}))}async function Ig(t,e,n){t._canInitEmulator=!1;const i=Object.assign(Object.assign({},Ag),e);try{const e=new Og(t),r=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const s=await r.json();if("needConfirmation"in s)throw Dg(t,"account-exists-with-different-credential",s);if(r.ok&&!("errorMessage"in s))return s;{const e=r.ok?s.errorMessage:s.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Dg(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Dg(t,"email-already-in-use",s);if("USER_DISABLED"===n)throw Dg(t,"user-disabled",s);const a=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw gg(t,a,o);pg(t,a)}}catch(r){if(r instanceof nl)throw r;pg(t,"network-request-failed",{message:String(r)})}}async function Lg(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=await Mg(t,e,n,i,r);return"mfaPendingCredential"in s&&pg(t,"multi-factor-auth-required",{_serverResponse:s}),s}function kg(t,e,n,i){const r=`${e}${n}?${i}`;return t.config.emulator?Tg(t.config,r):`${t.config.apiScheme}://${r}`}function Ng(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Og{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(fg(this.auth,"network-request-failed"))),Pg.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Dg(t,e,n){const i={appName:t.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);const r=fg(t,e,i);return r.customData._tokenResponse=n,r}function Fg(t){return void 0!==t&&void 0!==t.enterprise}class Bg{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return Ng(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}}async function Ug(t,e){return Mg(t,"GET","/v2/recaptchaConfig",Rg(t,e))}function zg(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(e){}}function jg(t){return 1e3*Number(t)}function Vg(t){const[e,n,i]=t.split(".");if(void 0===e||void 0===n||void 0===i)return dg("JWT malformed, contained fewer than 3 sections"),null;try{const t=Wa(n);return t?JSON.parse(t):(dg("Failed to decode base64 JWT payload"),null)}catch(r){return dg("Caught error parsing JWT payload as JSON",null===r||void 0===r?void 0:r.toString()),null}}async function Wg(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2])return e;try{return await e}catch(n){throw n instanceof nl&&function(t){let{code:e}=t;return"auth/user-disabled"===e||"auth/user-token-expired"===e}(n)&&t.auth.currentUser===t&&await t.auth.signOut(),n}}class $g{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null===t||void 0===t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}class Gg{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=zg(this.lastLoginAt),this.creationTime=zg(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function Hg(t){var e;const n=t.auth,i=await t.getIdToken(),r=await Wg(t,async function(t,e){return Mg(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:i}));_g(null===r||void 0===r?void 0:r.users.length,n,"internal-error");const s=r.users[0];t._notifyReloadListener(s);const o=(null===(e=s.providerUserInfo)||void 0===e?void 0:e.length)?s.providerUserInfo.map((t=>{var{providerId:e}
2=t,n=ag(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=(l=t.providerData,c=o,[...l.filter((t=>!c.some((e=>e.providerId===t.providerId)))),...c]);var l,c;const u=t.isAnonymous,h=!(t.email&&s.passwordHash)&&!(null===a||void 0===a?void 0:a.length),d=!!u&&h,p={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new Gg(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(t,p)}class qg{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){_g(t.idToken,"internal-error"),_g("undefined"!==typeof t.idToken,"internal-error"),_g("undefined"!==typeof t.refreshToken,"internal-error");const e="expiresIn"in t&&"undefined"!==typeof t.expiresIn?Number(t.expiresIn):function(t){const e=Vg(t);return _g(e,"internal-error"),_g("undefined"!==typeof e.exp,"internal-error"),_g("undefined"!==typeof e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}async getToken(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return _g(!this.accessToken||this.refreshToken,t,"user-token-expired"),e||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:i,expiresIn:r}=await async function(t,e){const n=await Ig(t,{},(async()=>{const n=fl({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:r}=t.config,s=kg(t,i,"/v1/token",`key=${r}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Cg.fetch()(s,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,i,Number(r))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:i,expirationTime:r}=e,s=new qg;return n&&(_g("string"===typeof n,"internal-error",{appName:t}),s.refreshToken=n),i&&(_g("string"===typeof i,"internal-error",{appName:t}),s.accessToken=i),r&&(_g("number"===typeof r,"internal-error",{appName:t}),s.expirationTime=r),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new qg,this.toJSON())}_performRefresh(){return yg("not implemented")}}function Zg(t,e){_g("string"===typeof t||"undefined"===typeof t,"internal-error",{appName:e})}class Xg{constructor(t){var{uid:e,auth:n,stsTokenManager:i}=t,r=ag(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new $g(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new Gg(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(t){const e=await Wg(this,this.stsTokenManager.getToken(this.auth,t));return _g(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=El(t),i=await n.getIdToken(e),r=Vg(i);_g(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const s="object"===typeof r.firebase?r.firebase:void 0,o=null===s||void 0===s?void 0:s.sign_in_provider;return{claims:r,token:i,authTime:zg(jg(r.auth_time)),issuedAtTime:zg(jg(r.iat)),expirationTime:zg(jg(r.exp)),signInProvider:o||null,signInSecondFactor:(null===s||void 0===s?void 0:s.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=El(t);await Hg(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(_g(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new Xg(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){_g(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await Hg(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await Wg(this,async function(t,e){return Mg(t,"POST","/v1/accounts:delete",e)}
2(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,i,r,s,o,a,l,c;const u=null!==(n=e.displayName)&&void 0!==n?n:void 0,h=null!==(i=e.email)&&void 0!==i?i:void 0,d=null!==(r=e.phoneNumber)&&void 0!==r?r:void 0,p=null!==(s=e.photoURL)&&void 0!==s?s:void 0,f=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(l=e.createdAt)&&void 0!==l?l:void 0,_=null!==(c=e.lastLoginAt)&&void 0!==c?c:void 0,{uid:y,emailVerified:v,isAnonymous:b,providerData:w,stsTokenManager:E}=e;_g(y&&E,t,"internal-error");const x=qg.fromJSON(this.name,E);_g("string"===typeof y,t,"internal-error"),Zg(u,t.name),Zg(h,t.name),_g("boolean"===typeof v,t,"internal-error"),_g("boolean"===typeof b,t,"internal-error"),Zg(d,t.name),Zg(p,t.name),Zg(f,t.name),Zg(g,t.name),Zg(m,t.name),Zg(_,t.name);const S=new Xg({uid:y,auth:t,email:h,emailVerified:v,displayName:u,isAnonymous:b,photoURL:p,phoneNumber:d,tenantId:f,stsTokenManager:x,createdAt:m,lastLoginAt:_});return w&&Array.isArray(w)&&(S.providerData=w.map((t=>Object.assign({},t)))),g&&(S._redirectEventId=g),S}static async _fromIdTokenResponse(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=new qg;i.updateFromServerResponse(e);const r=new Xg({uid:e.localId,auth:t,stsTokenManager:i,isAnonymous:n});return await Hg(r),r}}const Kg=new Map;function Yg(t){vg(t instanceof Function,"Expected a class definition");let e=Kg.get(t);return e?(vg(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Kg.set(t,e),e)}class Jg{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}Jg.type="NONE";const Qg=Jg;function tm(t,e,n){return`firebase:${t}:${e}:${n}`}class em{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:i,name:r}=this.auth;this.fullUserKey=tm(this.userKey,i.apiKey,r),this.fullPersistenceKey=tm("persistence",i.apiKey,r),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?Xg._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"authUser";if(!e.length)return new em(Yg(Qg),t,n);const i=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let r=i[0]||Yg(Qg);const s=tm(n,t.config.apiKey,t.name);let o=null;for(const l of e)try{const e=await l._get(s);if(e){const n=Xg._fromJSON(t,e);l!==r&&(o=n),r=l;break}}catch(vL){}const a=i.filter((t=>t._shouldAllowMigration));return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(s,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==r)try{await t._remove(s)}catch(vL){}}))),new em(r,t,n)):new em(r,t,n)}}function nm(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(om(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(im(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(lm(e))return"Blackberry";if(cm(e))return"Webos";if(rm(e))return"Safari";if((e.includes("chrome/")||sm(e))&&!e.includes("edge/"))return"Chrome";if(am(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null===n||void 0===n?void 0:n.length))return n[1]}return"Other"}function im(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ja();return/firefox\//i.test(t)}function rm(){const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ja()).toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function sm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ja();return/crios\//i.test(t)}function om(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ja();return/iemobile/i.test(t)}function am(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ja();return/android/i.test(t)}function lm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ja();return/blackberry/i.test(t)}function cm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ja();return/webos/i.test(t)}function um(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ja();return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function hm(){return function(){const t=Ja();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function dm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ja();return um(t)||am(t)||cm(t)||lm(t)||/windows phone/i.test(t)||om(t)}function pm(t){let e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];switch(t){case"Browser":e=nm(Ja());break;case"Worker":e=`${nm(Ja())}-${t}`;break;default:e=t}const i=n.length?n.join(","):"FirebaseCore-web";return`${e}/JsCore/${uc}/${i}`}class fm{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,i)=>{try{n(t(e))}catch(r){i(r)}}));n.onAbort=e,this.queue.push(n);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(n){e.reverse();for(const t of e)try{t()}catch(i){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===n||void 0===n?void 0:n.message})}}}class gm{constructor(t){var e,n,i,r;const s=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(e=s.minPasswordLength)&&void 0!==e?e:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(n=t.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(r=t.forceUpgradeOnSignin)&&void 0!==r&&r,this.schemaVersion=t.schemaVersion}validatePassword(t){var e,n,i,r,s,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,a),this.validatePasswordCharacterOptions(t,a),a.isValid&&
2(a.isValid=null===(e=a.meetsMinPasswordLength)||void 0===e||e),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(i=a.containsLowercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(r=a.containsUppercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsNumericCharacter)||void 0===s||s),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),i&&(e.meetsMaxPasswordLength=t.length<=i)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let i=0;i<t.length;i++)n=t.charAt(i),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,i,r){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=r))}}class mm{constructor(t,e,n,i){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new ym(this),this.idTokenSubscription=new ym(this),this.beforeStateQueue=new fm(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ug,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Yg(e)),this._initializationPromise=this.queue((async()=>{var n,i;if(!this._deleted&&(this.persistenceManager=await em.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(r){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(i=this.currentUser)||void 0===i?void 0:i.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUser(t){var e;const n=await this.assertedPersistence.getCurrentUser();let i=n,r=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,s=null===i||void 0===i?void 0:i._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==s||!(null===o||void 0===o?void 0:o.user)||(i=o.user,r=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(i)}catch(s){i=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(s)))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return _g(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(n){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await Hg(t)}catch(e){if("auth/network-request-failed"!==(null===e||void 0===e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"===typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}
2async updateCurrentUser(t){const e=t?El(t):null;return e&&_g(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this._deleted)return t&&_g(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(t){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Yg(t))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t){return Mg(t,"GET","/v2/passwordPolicy",Rg(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}(this),e=new gm(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new il("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise(((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged((()=>{n(),t()}),e)}}))}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return Mg(t,"POST","/v2/accounts:revokeToken",Rg(t,e))}(this,e)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&Yg(t)||this._popupRedirectResolver;_g(e,this,"argument-error"),this.redirectPersistenceManager=await em.create(this,[Yg(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,i){if(this._deleted)return()=>{};const r="function"===typeof e?e:e.next.bind(e);let s=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(_g(o,this,"internal-error"),o.then((()=>{s||r(this.currentUser)})),"function"===typeof e){const r=t.addObserver(e,n,i);return()=>{s=!0,r()}}{const n=t.addObserver(e);return()=>{s=!0,n()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return _g(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=pm(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const i=await this._getAppCheckToken();return i&&(e["X-Firebase-AppCheck"]=i),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null===e||void 0===e?void 0:e.error)&&function(t){if(hg.logLevel<=Pl.WARN){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];hg.warn(`Auth (${uc}): ${t}`,...n)}}(`Error while retrieving App Check token: ${e.error}`),null===e||void 0===e?void 0:e.token}}function _m(t){return El(t)}class ym{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new yl(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return _g(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let vm={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function bm(t){return vm.loadJS(t)}function wm(t){return`__${t}${Math.floor(1e6*Math.random())}`}class Em{constructor(t){this.type="recaptcha-enterprise",this.auth=_m(t)}async verify(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"verify",e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function n(e,n,i){const r=window.grecaptcha;Fg(r)?r.enterprise.ready((()=>{r.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):i(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,i)=>{(async function(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>
2{Ug(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((i=>{if(void 0!==i.recaptchaKey){const n=new Bg(i);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))})(this.auth).then((r=>{if(!e&&Fg(window.grecaptcha))n(r,t,i);else{if("undefined"===typeof window)return void i(new Error("RecaptchaVerifier is only supported in browser"));let e=vm.recaptchaEnterpriseScript;0!==e.length&&(e+=r),bm(e).then((()=>{n(r,t,i)})).catch((t=>{i(t)}))}})).catch((t=>{i(t)}))}))}}async function xm(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=new Em(t);let s;try{s=await r.verify(n)}catch($c){s=await r.verify(n,!0)}const o=Object.assign({},e);return i?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function Sm(t,e,n,i){var r;if(null===(r=t._getRecaptchaConfig())||void 0===r?void 0:r.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const r=await xm(t,e,n,"getOobCode"===n);return i(t,r)}return i(t,e).catch((async r=>{if("auth/missing-recaptcha-token"===r.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const r=await xm(t,e,n,"getOobCode"===n);return i(t,r)}return Promise.reject(r)}))}function Tm(t,e,n){const i=_m(t);_g(i._canInitEmulator,i,"emulator-config-failed"),_g(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");const r=!!(null===n||void 0===n?void 0:n.disableWarnings),s=Cm(e),{host:o,port:a}=function(t){const e=Cm(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const i=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const t=r[1];return{host:t,port:Am(i.substr(t.length+1))}}{const[t,e]=i.split(":");return{host:t,port:Am(e)}}}(e),l=null===a?"":`:${a}`;i.config.emulator={url:`${s}//${o}${l}/`},i.settings.appVerificationDisabledForTesting=!0,i.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:r})}),r||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!==typeof console&&"function"===typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!==typeof window&&"undefined"!==typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}()}function Cm(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Am(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class Pm{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return yg("not implemented")}_getIdTokenResponse(t){return yg("not implemented")}_linkToIdToken(t,e){return yg("not implemented")}_getReauthenticationResolver(t){return yg("not implemented")}}async function Rm(t,e){return Mg(t,"POST","/v1/accounts:signUp",e)}async function Mm(t,e){return Lg(t,"POST","/v1/accounts:signInWithPassword",Rg(t,e))}class Im extends Pm{constructor(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super("password",n),this._email=t,this._password=e,this._tenantId=i}static _fromEmailAndPassword(t,e){return new Im(t,e,"password")}static _fromEmailAndCode(t,e){return new Im(t,e,"emailLink",arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"===typeof t?JSON.parse(t):t;if((null===e||void 0===e?void 0:e.email)&&(null===e||void 0===e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return Sm(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",Mm);case"emailLink":return async function(t,e){return Lg(t,"POST","/v1/accounts:signInWithEmailLink",Rg(t,e))}(t,{email:this._email,oobCode:this._password});default:pg(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return Sm(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Rm);case"emailLink":return async function(t,e){return Lg(t,"POST","/v1/accounts:signInWithEmailLink",Rg(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:pg(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}async function Lm(t,e){return Lg(t,"POST","/v1/accounts:signInWithIdp",Rg(t,e))}class km extends Pm{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new km(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pen
2dingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):pg("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"===typeof t?JSON.parse(t):t,{providerId:n,signInMethod:i}=e,r=ag(e,["providerId","signInMethod"]);if(!n||!i)return null;const s=new km(n,i);return s.idToken=r.idToken||void 0,s.accessToken=r.accessToken||void 0,s.secret=r.secret,s.nonce=r.nonce,s.pendingToken=r.pendingToken||null,s}_getIdTokenResponse(t){return Lm(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Lm(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Lm(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=fl(e)}return t}}const Nm={USER_NOT_FOUND:"user-not-found"};class Om extends Pm{constructor(t){super("phone","phone"),this.params=t}static _fromVerification(t,e){return new Om({verificationId:t,verificationCode:e})}static _fromTokenResponse(t,e){return new Om({phoneNumber:t,temporaryProof:e})}_getIdTokenResponse(t){return async function(t,e){return Lg(t,"POST","/v1/accounts:signInWithPhoneNumber",Rg(t,e))}(t,this._makeVerificationRequest())}_linkToIdToken(t,e){return async function(t,e){const n=await Lg(t,"POST","/v1/accounts:signInWithPhoneNumber",Rg(t,e));if(n.temporaryProof)throw Dg(t,"account-exists-with-different-credential",n);return n}(t,Object.assign({idToken:e},this._makeVerificationRequest()))}_getReauthenticationResolver(t){return async function(t,e){return Lg(t,"POST","/v1/accounts:signInWithPhoneNumber",Rg(t,Object.assign(Object.assign({},e),{operation:"REAUTH"})),Nm)}(t,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:t,phoneNumber:e,verificationId:n,verificationCode:i}=this.params;return t&&e?{temporaryProof:t,phoneNumber:e}:{sessionInfo:n,code:i}}toJSON(){const t={providerId:this.providerId};return this.params.phoneNumber&&(t.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(t.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(t.verificationCode=this.params.verificationCode),this.params.verificationId&&(t.verificationId=this.params.verificationId),t}static fromJSON(t){"string"===typeof t&&(t=JSON.parse(t));const{verificationId:e,verificationCode:n,phoneNumber:i,temporaryProof:r}=t;return n||e||i||r?new Om({verificationId:e,verificationCode:n,phoneNumber:i,temporaryProof:r}):null}}class Dm{constructor(t){var e,n,i,r,s,o;const a=gl(ml(t)),l=null!==(e=a.apiKey)&&void 0!==e?e:null,c=null!==(n=a.oobCode)&&void 0!==n?n:null,u=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(i=a.mode)&&void 0!==i?i:null);_g(l&&c&&u,"argument-error"),this.apiKey=l,this.operation=u,this.code=c,this.continueUrl=null!==(r=a.continueUrl)&&void 0!==r?r:null,this.languageCode=null!==(s=a.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=gl(ml(t)).link,n=e?gl(ml(e)).deep_link_id:null,i=gl(ml(t)).deep_link_id;return(i?gl(ml(i)).link:null)||i||n||e||t}(t);try{return new Dm(e)}catch(vL){return null}}}class Fm{constructor(){this.providerId=Fm.PROVIDER_ID}static credential(t,e){return Im._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Dm.parseLink(e);return _g(n,"argument-error"),Im._fromEmailAndCode(t,n.code,n.tenantId)}}Fm.PROVIDER_ID="password",Fm.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Fm.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class Bm{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}class Um extends Bm{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}class zm extends Um{constructor(){super("facebook.com")}static credential(t){return km._fromParams({providerId:zm.PROVIDER_ID,signInMethod:zm.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return zm.credentialFromTaggedObject(t)}static credentialFromError(t){return zm.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject(t){let{_tokenResponse:e}=t;if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return zm.credential(e.oauthAccessToken)}catch(vL){return null}}}zm.FACEBOOK_SIGN_IN_METHOD="facebook.com",zm.PROVIDER_ID="facebook.com";class jm extends Um{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return km._fromParams({providerId:jm.PROVIDER_ID,signInMethod:jm.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return jm.credentialFromTaggedObject(t)}static credentialFromError(t){return jm.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject(t){let{_tokenResponse:e}=t;if(!e)return null;const{oauthIdToken:n,oauthAccessToken:i}=e;if(!n&&!i)return null;try{return jm.credential(n,i)}catch(vL){return null}}}jm.GOOGLE_SIGN_IN_METHOD="google.com",jm.PROVIDER_ID="google.com";class Vm extends Um{constructor(){super("github.com")}static credential(t){return km._fromParams({providerId:Vm.PROVIDER_ID,signInMethod:Vm.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Vm.credentialFromTaggedObject(t)}static credentialFromError(t){return Vm.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject(t){let{_tokenResponse:e}=t;if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return Vm.credential(e.oauthAccessToken)}catch(vL){return null}}}Vm.GITHUB_SIGN_IN_METHOD="github.com",Vm.PROVIDER_ID="github.com";class Wm extends Um{constructor(){super("twitter.com")}static credential(t,e){return km._fromParams({providerId:Wm.PROVIDER_ID,signInMethod:Wm.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return Wm.credentialFromTaggedObject(t)}static credentialFromError(t){return Wm.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject(t){let{_tokenResponse:e}=t;if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:i}
vendor: 19,318 bytes, line 2
2=e;if(!n||!i)return null;try{return Wm.credential(n,i)}catch(vL){return null}}}Wm.TWITTER_SIGN_IN_METHOD="twitter.com",Wm.PROVIDER_ID="twitter.com";class $m{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=await Xg._fromIdTokenResponse(t,n,i),s=Gm(n);return new $m({user:r,providerId:s,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const i=Gm(n);return new $m({user:t,providerId:i,_tokenResponse:n,operationType:e})}}function Gm(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}class Hm extends nl{constructor(t,e,n,i){var r;super(e.code,e.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,Hm.prototype),this.customData={appName:t.name,tenantId:null!==(r=t.tenantId)&&void 0!==r?r:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,i){return new Hm(t,e,n,i)}}function qm(t,e,n,i){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw Hm._fromErrorAndOperation(t,n,e,i);throw n}))}async function Zm(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=await Wg(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return $m._forOperation(t,"link",i)}async function Xm(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{auth:i}=t,r="reauthenticate";try{const s=await Wg(t,qm(i,r,e,t),n);_g(s.idToken,i,"internal-error");const o=Vg(s.idToken);_g(o,i,"internal-error");const{sub:a}=o;return _g(t.uid===a,i,"user-mismatch"),$m._forOperation(t,r,s)}catch(s){throw"auth/user-not-found"===(null===s||void 0===s?void 0:s.code)&&pg(i,"user-mismatch"),s}}async function Km(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i="signIn",r=await qm(t,i,e),s=await $m._fromIdTokenResponse(t,i,r);return n||await t._updateCurrentUser(s.user),s}async function Ym(t,e){return Km(_m(t),e)}async function Jm(t){const e=_m(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function Qm(t,e,n){return Ym(El(t),Fm.credential(e,n)).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&Jm(t),e}))}new WeakMap;const t_="__sak";class e_{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(t_,"1"),this.storage.removeItem(t_),Promise.resolve(!0)):Promise.resolve(!1)}catch(vL){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}class n_ extends e_{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const t=Ja();return rm(t)||um(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=dm(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),i=this.localCache[e];n!==i&&t(e,i,n)}}onStorageEvent(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;if(e?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const i=this.storage.getItem(n);if(t.newValue!==i)null!==t.newValue?this.storage.setItem(n,t.newValue):this.storage.removeItem(n);else if(this.localCache[n]===t.newValue&&!e)return}const i=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},r=this.storage.getItem(n);hm()&&r!==t.newValue&&t.newValue!==t.oldValue?setTimeout(i,10):i()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const i of Array.from(n))i(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}n_.type="LOCAL";const i_=n_;class r_ extends e_{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}r_.type="SESSION";const s_=r_;class o_{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new o_(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:i,data:r}=e.data,s=this.handlersMap[i];if(!(null===s||void 0===s?void 0:s.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:i});const o=Array.from(s).map((async t=>t(e.origin,r))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(e){return{fulfilled:!1,reason:e}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:i,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function a_(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n="";for(let i=0;i<e;i++)n+=Math.floor(10*Math.random());return t+n}o_.receivers=[];class l_{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50;const i="undefined"!==typeof MessageChannel?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let r,s;return new Promise(((o,a)=>{const l=a_("",20);i.port1.start();const c=setTimeout((()=>{a(new Error("unsupported_event"))}),n);s={messageChannel:i,onMessage(t){const e=t;if(e.data.eventId===l)switch(e.data.status){case"ack":clearTimeout(c),r=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(r),o(e.data.response);break;default:clearTimeout(c),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(s),i.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:t,eventId:l,data:e},[i.port2])})).finally((()=>{s&&this.removeMessageHandler(s)}))}}function c_(){return window}function u_(){return"undefined"!==typeof c_().WorkerGlobalScope&&"function"===typeof c_().importScripts}const h_="firebaseLocalStorageDb",d_="firebaseLocalStorage",p_="fbase_key";class f_{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function g_(t,e){return t.transaction([d_],e?"readwrite":"readonly").objectStore(d_)}function m_(){const t=indexedDB.open(h_,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(d_,{keyPath:p_})}catch(i){n(i)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(d_)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(h_);return new f_(t).toPromise()}(),e(await m_()))}))}))}async function __(t,e,n){const i=g_(t,!0).put({[p_]:e,value:n});return new f_(i).toPromise()}function y_(t,e){const n=g_(t,!0).delete(e);return new f_(n).toPromise()}class v_{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await m_()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(n){if(e++>3)throw n;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return u_()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=o_._getInstance(u_()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new l_(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(vL){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await m_();return await __(t,t_,"1"),await y_(t,t_),!0}catch(vL){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>__(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=g_(t,!1).get(e),i=await new f_(n).toPromise();return void 0===i?null:i.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>y_(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=g_(t,!1).getAll();return new f_(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:i,value:r}of t)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(r)&&(this.notifyListeners(i,r),e.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!n.has(i)&&(this.notifyListeners(i,null),e.push(i));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const i of Array.from(n))i(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}v_.type="LOCAL";const b_=v_;wm("rcb"),new Sg(3e4,6e4);const w_="recaptcha";async function E_(t,e,n){var i;const r=await n.verify();try{let s;if(_g("string"===typeof r,t,"argument-error"),_g(n.type===w_,t,"argument-error"),s="string"===typeof e?{phoneNumber:e}:e,"session"in s){const e=s.session;if("phoneNumber"in s){_g("enroll"===e.type,t,"internal-error");const n=await function(t,e){return Mg(t,"POST","/v2/accounts/mfaEnrollment:start",Rg(t,e))}(t,{idToken:e.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:r}});return n.phoneSessionInfo.sessionInfo}{_g("signin"===e.type,t,"internal-error");const n=(null===(i=s.multiFactorHint)||void 0===i?void 0:i.uid)||s.multiFactorUid;_g(n,t,"missing-multi-factor-info");const o=await function(t,e){return Mg(t,"POST","/v2/accounts/mfaSignIn:start",Rg(t,e))}(t,{mfaPendingCredential:e.credential,mfaEnrollmentId:n,phoneSignInInfo:{recaptchaToken:r}});return o.phoneResponseInfo.sessionInfo}}{const{sessionInfo:e}=await async function(t,e){return Mg(t,"POST","/v1/accounts:sendVerificationCode",Rg(t,e))}(t,{phoneNumber:s.phoneNumber,recaptchaToken:r});return e}}finally{n._reset()}}class x_{constructor(t){this.providerId=x_.PROVIDER_ID,this.auth=_m(t)}verifyPhoneNumber(t,e){return E_(this.auth,t,El(e))}static credential(t,e){return Om._fromVerification(t,e)}static credentialFromResult(t){const e=t;return x_.credentialFromTaggedObject(e)}static credentialFromError(t){return x_.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject(t){let{_tokenResponse:e}=t;if(!e)return null;const{phoneNumber:n,temporaryProof:i}=e;return n&&i?Om._fromTokenResponse(n,i):null}}function S_(t,e){return e?Yg(e):(_g(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}x_.PROVIDER_ID="phone",x_.PHONE_SIGN_IN_METHOD="phone";class T_ extends Pm{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Lm(t,this._buildIdpRequest())}_linkToIdToken(t,e){return Lm(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return Lm(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function C_(t){return Km(t.auth,new T_(t),t.bypassAuthState)}function A_(t){const{auth:e,user:n}=t;return _g(n,e,"internal-error"),Xm(n,new T_(t),t.bypassAuthState)}async function P_(t){const{auth:e,user:n}=t;return _g(n,e,"internal-error"),Zm(n,new T_(t),t.bypassAuthState)}class R_{constructor(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this.auth=t,this.resolver=n,this.user=i,this.bypassAuthState=r,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(n){this.reject(n)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:i,tenantId:r,error:s,type:o}=t;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:r||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(l){this.reject(l)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return C_;case"linkViaPopup":case"linkViaRedirect":return P_;case"reauthViaPopup":case"reauthViaRedirect":return A_;default:pg(this.auth,"internal-error")}}resolve(t){vg(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){vg(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const M_=new Sg(2e3,1e4);class I_ extends R_{constructor(t,e,n,i,r){super(t,e,i,r),this.provider=n,this.authWindow=null,this.pollId=null,I_.currentPopupAction&&I_.currentPopupAction.cancel(),I_.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return _g(t,this.auth,"internal-error"),t}async onExecution(){vg(1===this.filter.length,"Popup operations only handle one event");const t=a_();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(fg(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(fg(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,I_.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(fg(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,M_.get())};t()}}I_.currentPopupAction=null;const L_="pendingRedirect",k_=new Map;class N_ extends R_{constructor(t,e){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,arguments.length>2&&void 0!==arguments[2]&&arguments[2]),this.eventId=null}async execute(){let t=k_.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=F_(e),i=D_(t);if(!await i._isAvailable())return!1;const r="true"===await i._get(n);return await i._remove(n),r}(this.resolver,this.auth),n=e?await super.execute():null;t=()=>Promise.resolve(n)}catch(e){t=()=>Promise.reject(e)}k_.set(this.auth._key(),t)}return this.bypassAuthState||k_.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function O_(t,e){k_.set(t._key(),e)}function D_(t){return Yg(t._redirectPersistence)}function F_(t){return tm(L_,t.config.apiKey,t.name)}
2async function B_(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=_m(t),r=S_(i,e),s=new N_(i,r,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}class U_{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return j_(t);default:return!1}}(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!j_(t)){const i=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(fg(this.auth,i))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(z_(t))}saveEventToCache(t){this.cachedEventUids.add(z_(t)),this.lastProcessedEventTime=Date.now()}}function z_(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function j_(t){let{type:e,error:n}=t;return"unknown"===e&&"auth/no-auth-event"===(null===n||void 0===n?void 0:n.code)}const V_=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,W_=/^https?/;async function $_(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t){return Mg(t,"GET","/v1/projects",arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}(t);for(const n of e)try{if(G_(n))return}catch(vL){}pg(t,"unauthorized-domain")}function G_(t){const e=bg(),{protocol:n,hostname:i}=new URL(e);if(t.startsWith("chrome-extension://")){const r=new URL(t);return""===r.hostname&&""===i?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===i}if(!W_.test(n))return!1;if(V_.test(t))return i===t;const r=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}const H_=new Sg(3e4,6e4);function q_(){const t=c_().___jsl;if(null===t||void 0===t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n<t.CP.length;n++)t.CP[n]=null}function Z_(t){return new Promise(((e,n)=>{var i,r,s;function o(){q_(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{q_(),n(fg(t,"network-request-failed"))},timeout:H_.get()})}if(null===(r=null===(i=c_().gapi)||void 0===i?void 0:i.iframes)||void 0===r?void 0:r.Iframe)e(gapi.iframes.getContext());else{if(!(null===(s=c_().gapi)||void 0===s?void 0:s.load)){const e=wm("iframefcb");return c_()[e]=()=>{gapi.load?o():n(fg(t,"network-request-failed"))},bm(`${vm.gapiScript}?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw X_=null,t}))}let X_=null;const K_=new Sg(5e3,15e3),Y_="__/auth/iframe",J_="emulator/auth/iframe",Q_={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},ty=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function ey(t){const e=t.config;_g(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Tg(e,J_):`https://${t.config.authDomain}/${Y_}`,i={apiKey:e.apiKey,appName:t.name,v:uc},r=ty.get(t.config.apiHost);r&&(i.eid=r);const s=t._getFrameworks();return s.length&&(i.fw=s.join(",")),`${n}?${fl(i).slice(1)}`}async function ny(t){const e=await function(t){return X_=X_||Z_(t),X_}(t),n=c_().gapi;return _g(n,t,"internal-error"),e.open({where:document.body,url:ey(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Q_,dontclear:!0},(e=>new Promise((async(n,i)=>{await e.restyle({setHideOnLeave:!1});const r=fg(t,"network-request-failed"),s=c_().setTimeout((()=>{i(r)}),K_.get());function o(){c_().clearTimeout(s),n(e)}
2e.ping(o).then(o,(()=>{i(r)}))}))))}const iy={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class ry{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function sy(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:500,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:600;const s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const l=Object.assign(Object.assign({},iy),{width:i.toString(),height:r.toString(),top:s,left:o}),c=Ja().toLowerCase();n&&(a=sm(c)?"_blank":n),im(c)&&(e=e||"http://localhost",l.scrollbars="yes");const u=Object.entries(l).reduce(((t,e)=>{let[n,i]=e;return`${t}${n}=${i},`}),"");if(function(){var t;return um(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ja())&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(c)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}(e||"",a),new ry(null);const h=window.open(e||"",a,u);_g(h,t,"popup-blocked");try{h.focus()}catch(d){}return new ry(h)}const oy="__/auth/handler",ay="emulator/auth/handler",ly=encodeURIComponent("fac");async function cy(t,e,n,i,r,s){_g(t.config.authDomain,t,"auth-domain-config-required"),_g(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:i,v:uc,eventId:r};if(e instanceof Bm){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",ul(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(s||{}))o[t]=e}if(e instanceof Um){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const u of Object.keys(a))void 0===a[u]&&delete a[u];const l=await t._getAppCheckToken(),c=l?`#${ly}=${encodeURIComponent(l)}`:"";return`${function(t){let{config:e}=t;if(!e.emulator)return`https://${e.authDomain}/${oy}`;return Tg(e,ay)}(t)}?${fl(a).slice(1)}${c}`}const uy="webStorageSupport";const hy=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=s_,this._completeRedirectFn=B_,this._overrideRedirectResult=O_}async _openPopup(t,e,n,i){var r;vg(null===(r=this.eventManagers[t._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return sy(t,await cy(t,e,n,bg(),i),a_())}async _openRedirect(t,e,n,i){await this._originValidation(t);return function(t){c_().location.href=t}(await cy(t,e,n,bg(),i)),new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(vg(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await ny(t),n=new U_(t);return e.register("authEvent",(e=>
2{_g(null===e||void 0===e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(uy,{type:uy},(n=>{var i;const r=null===(i=null===n||void 0===n?void 0:n[0])||void 0===i?void 0:i[uy];void 0!==r&&e(!!r),pg(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=$_(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return dm()||rm()||um()}};var dy="@firebase/auth",py="1.6.0";class fy{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null===e||void 0===e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){_g(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const gy=Ka("authIdTokenMaxAge")||300;let my=null;function _y(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dc();const e=ac(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=ac(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(dl(n.getOptions(),null!==e&&void 0!==e?e:{}))return t;pg(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:hy,persistence:[b_,i_,s_]}),i=Ka("authTokenSyncURL");if(i){const t=(r=i,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>gy)return;const i=null===e||void 0===e?void 0:e.token;my!==i&&(my=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(t,e,n){El(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,i){El(t).onIdTokenChanged(e,n,i)}(n,(e=>t(e)))}var r;const s=Za("auth");return s&&Tm(n,`http://${s}`),n}var yy,vy;yy={loadJS:t=>new Promise(((e,n)=>{const i=document.createElement("script");i.setAttribute("src",t),i.onload=e,i.onerror=t=>{const e=fg("internal-error");e.customData=t,n(e)},i.type="text/javascript",i.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(i)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},vm=yy,vy="Browser",oc(new xl("auth",((t,e)=>{let{options:n}=e;const i=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),s=t.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=i.options;_g(o&&!o.includes(":"),"invalid-api-key",{appName:i.name});const l={apiKey:o,authDomain:a,clientPlatform:vy,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:pm(vy)},c=new mm(i,r,s,l);return function(t,e){const n=(null===e||void 0===e?void 0:e.persistence)||[],i=(Array.isArray(n)?n:[n]).map(Yg);(null===e||void 0===e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(i,null===e||void 0===e?void 0:e.popupRedirectResolver)}(c,n),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),oc(new xl("auth-internal",(t=>(t=>new fy(t))(_m(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),pc(dy,py,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(vy)),pc(dy,py,"esm2017");Qm(_y(Qf),"[email protected]","ClearloopData123!").then((t=>{Uf(Kf(Qf),"/realtime/")})).catch((t=>{console.error("Auth failed:",t)}));const by=Kf(Qf),wy=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];const Ey=function(t){const[n,i]=(0,e.useState)(0),[r,o]=(0,e.useState)(0),[l,c]=(0,e.useState)("0"),[u,h]=(0,e.useState)(["Loading data...",""]),[d,p]=(0,e.useState)(!0),f=t.capacity,g=1175*t.capacity,m=180*(r/f),[I,L]=(0,e.useState)(0),[k,N]=(0,e.useState)(0),[O,D]=(0,e.useState)(null),[F,B]=(0,e.useState)(null),[U,z]=(0,e.useState)(0),[j,V]=(0,e.useState)({city:"",region:"",state:""}),[W,$]=(0,e.useState)(""),G=(0,e.useRef)(null),[H,q]=((0,e.useRef)(null),(0,e.useState)(!1)),[Z,X]=(0,e.useState)({lat:null,lon:null,loading:!0,error:null}),K=()=>{p(window.innerWidth>768)};return(0,e.useEffect)((()=>{(async()=>{try{const e=await fetch("/location.json");if(!e.ok)throw new Error("Failed to fetch location data");const n=await e.json(),i=("string"===typeof t.database?t.database:"").replace("/",""),r=n[i];if(!r)throw new Error(`Location data not found for ${i}`);console.log("Found matched location:",i,r),X({lat:r[0],lon:r[1],loading:!1,error:null})}catch($c){console.error(" Location error:",$c),X((e=>({...e,loading:!1,error:$c.message})))}})()}),[t.database]),(0,e.useEffect)((()=>{const e="string"===typeof t.database?t.database:"",n=$f(Uf(by,`realtime/lastHour${e}`),(t=>{const n=t.val();if(!n)return console.warn("No data available for",e),o(0),void i(0);let r=new Date,s=`${wy[r.getMonth()]} ${r.getDate()}, ${r.getFullYear()}`,a=r.getHours(),l=a>=12?"PM":"AM";a=a%12||12;let u=r.getMinutes().toString().padStart(2,"0");h([s,`${a}:${u} ${l}`]),o(n.mwh||0),c((n.mwh||0).toFixed(2)),i(n.co2||0),n.alter&&j.region&&n.alter[j.region]&&z(n.alter[j.region].co2)}));return()=>n()}),[t.database,j.region]),(0,e.useEffect)((()=>(window.addEventListener("resize",K),()=>window.removeEventListener("resize",K)))),(0,s.jsx)("div",{className:"big-dial-container",children:d?(0,s.jsx)(_,{children:(0,s.jsxs)("div",{id:"canvas-container",className:"flex-row justify-between align-center",children:[(0,s.jsxs)("div",{id:"localization-text",children:[(0,s.jsx)("h1",{children:`${t.displayName?t.dis
2playName:"Jackson"}, ${t.location?t.location:"Tennessee"}`}),(0,s.jsx)(a,{coordinates:Z})," ",(0,s.jsx)("div",{className:"vert-div"}),(0,s.jsx)("p",{className:"time-text",children:u[0]}),(0,s.jsx)("div",{className:"circle-div"}),(0,s.jsx)("p",{className:"time-text",children:u[1]})]}),(0,s.jsxs)("div",{className:"flex-parent",children:[(()=>{var t;const e=[100,100],n=[50+50*Math.cos((180+m)*Math.PI/180),50+50*Math.sin((180+m)*Math.PI/180)],i=[50+50*Math.cos(m*Math.PI/180),50+50*Math.sin(m*Math.PI/180)];return(0,s.jsxs)("svg",{viewBox:`0 0 ${e[0]} ${e[1]}`,xmlns:"http://www.w3.org/2000/svg",id:"big-svg",children:[(0,s.jsx)("text",{x:"13",y:"56",fontSize:"3",fill:"#e0a604",children:"0"})," ",(0,s.jsx)("text",{x:"84",y:"56",fontSize:"3",fill:"#e0a604",children:f}),(0,s.jsxs)("g",{"transform-origin":"50 50",transform:"translate(0,2.5) scale(1.15)",children:[(0,s.jsx)("image",{href:v,width:"100",height:"100"}),(0,s.jsxs)("mask",{id:"bright-mask",children:[(0,s.jsx)("path",{d:`\n M ${e[0]/2} ${e[1]/2} \n L ${n[0]} ${n[1]} \n L ${e[0]/2} 0\n L 0 0\n L 0 ${e[1]/2}\n Z`,fill:"white",style:{transition:"d 1s"}}),(0,s.jsx)("path",{d:`\n M ${e[0]/2} ${e[1]/2} \n L ${i[0]} ${i[1]} \n L ${e[0]/2} ${e[1]} \n L ${e[0]} ${e[1]} \n L ${e[0]} ${e[1]/2} \n Z`,fill:"white",style:{transition:"d 1s"}})]}),(0,s.jsx)("image",{href:b,width:"100",height:"100",mask:"url(#bright-mask)"}),(0,s.jsx)("image",{href:S,width:"100",height:"100",children:" "}),(0,s.jsxs)("g",{x:"50",y:"50",width:"100",height:"100",transform:`\n rotate(${null!==m&&void 0!==m?m:0})\n translate(-30,${m<90?"-9":"9"})\n rotate(${null!==(t=-1*m)&&void 0!==t?t:0})\n `,style:{transition:"transform 1s"},children:[(0,s.jsx)("image",{href:C,width:"100",height:"100"}),(0,s.jsx)("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"2",className:"call-out-text",children:l})]}),(0,s.jsx)("image",{href:E,id:"needle",className:"globe-element",style:{transform:"rotate("+m+"deg)",transition:"transform 1s"},alt:"needle pointing at values"})]})]})})(),function(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const i=[100,100],r=180*(e?U/g:n/g),o=[50+50*Math.cos((180+r)*Math.PI/180),50+50*Math.sin((180+r)*Math.PI/180)],a=[50+50*Math.cos(r*Math.PI/180),50+50*Math.sin(r*Math.PI/180)];return(0,s.jsxs)("svg",{viewBox:`0 0 ${i[0]} ${i[1]}`,xmlns:"http://www.w3.org/2000/svg",id:"big-svg",ref:G,children:[(0,s.jsx)("text",{x:"13",y:"56",fontSize:"3",fill:"#100B32",children:"0"})," ",(0,s.jsxs)("text",{x:"82",y:"56",fontSize:"3",fill:"#100B32",children:[parseInt(g),"+"]}),(0,s.jsxs)("g",{"transform-origin":"50 50",transform:"translate(0,2.5) scale(1.15)",children:[(0,s.jsx)("image",{href:y,width:"100",height:"100"}),(0,s.jsxs)("mask",{id:"dark-mask",children:[(0,s.jsx)("path",{d:`\n M ${i[0]/2} ${i[1]/2} \n L ${o[0]} ${o[1]} \n L ${i[0]/2} 0\n L 0 0\n L 0 ${i[1]/2}\n Z`,fill:"white",style:{transition:"d 1s"}}),(0,s.jsx)("path",{d:`\n M ${i[0]/2} ${i[1]/2} \n L ${a[0]} ${a[1]} \n L ${i[0]/2} ${i[1]} \n L ${i[0]} ${i[1]} \n L ${i[0]} ${i[1]/2} \n Z`,fill:"white",style:{transition:"d 1s"}})]}),(0,s.jsx)("image",{href:w,width:"100",height:"100",mask:"url(#dark-mask)"}),(0,s.jsx)("image",{href:T,width:"100",height:"100",children:" "}),(0,s.jsxs)("g",{x:"50",y:"50",width:"100",height:"100",transform:`\n rotate(${null!==r&&void 0!==r?r:0})\n translate(-30,${r<90?"-9":"9"})\n rotate(${null!==(t=-1*r)&&void 0!==t?t:0})\n `,style:{transition:"transform 1s"},children:[(0,s.jsx)("image",{href:A,width:"100",height:"100"}),(0,s.jsx)("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"2",className:"call-out-text",children:e?Math.floor(U):Math.floor(n)})]}),(0,s.jsx)("image",{href:x,id:"needle",className:"globe-element",style:{transform:"rotate("+r+"deg)",transition:"transform 1s"},alt:"needle pointing at values"})]})]})}()]})]})}):(0,s.jsx)("div",{className:"",children:(e=>
2{const i=[100,100],r=[50+50*Math.cos((180+e)*Math.PI/180),50+50*Math.sin((180+e)*Math.PI/180)],o=[50+50*Math.cos(e*Math.PI/180),50+50*Math.sin(e*Math.PI/180)];return(0,s.jsxs)("div",{id:"canvas-container",children:[(0,s.jsxs)("div",{id:"localization-text",children:[(0,s.jsx)("h1",{id:"city-name",children:`${t.displayName||"Jackson"}, ${t.location||"Tennessee"}`}),(0,s.jsx)(a,{coordinates:Z})]}),(0,s.jsx)("svg",{viewBox:`0 0 ${i[0]} ${i[1]}`,xmlns:"http://www.w3.org/2000/svg",id:"big-svg",children:(0,s.jsxs)("g",{"transform-origin":"50 50",transform:"translate(0,2.5) scale(1.15)",children:[(0,s.jsx)("image",{href:R,width:"100",height:"100"}),(0,s.jsxs)("mask",{id:"bright-mask",children:[(0,s.jsx)("path",{d:`\n M ${i[0]/2} ${i[1]/2} \n L ${r[0]} ${r[1]} \n L ${i[0]/2} 0\n L 0 0\n L 0 ${i[1]/2}\n Z`,fill:"white",style:{transition:"d 1s"}}),(0,s.jsx)("path",{d:`\n M ${i[0]/2} ${i[1]/2} \n L ${o[0]} ${o[1]} \n L ${i[0]/2} ${i[1]} \n L ${i[0]} ${i[1]} \n L ${i[0]} ${i[1]/2} \n Z`,fill:"white",style:{transition:"d 1s"}})]}),(0,s.jsx)("image",{href:M,width:"100",height:"100",mask:"url(#bright-mask)"}),(0,s.jsx)("image",{href:S,width:"100",height:"100",children:" "}),(0,s.jsxs)("g",{x:"50",y:"50",width:"100",height:"100",transform:`\n rotate(${e})\n translate(-30,${e<90?"-9":"9"})\n rotate(${-1*e})\n `,style:{transition:"transform 1s"},children:[(0,s.jsx)("image",{href:C,width:"100",height:"100"}),(0,s.jsx)("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"2",className:"call-out-text",children:l})]}),(0,s.jsxs)("g",{x:"50",y:"50",width:"100",height:"100",transform:`\n rotate(${e})\n translate(32,${e<90?"14":"-14"})\n rotate(${-1*e})\n `,style:{transition:"transform 1s"},children:[(0,s.jsx)("image",{href:A,width:"100",height:"100"}),(0,s.jsx)("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"2",className:"call-out-text",children:Math.floor(n)})]}),(0,s.jsx)("image",{href:P,id:"needle",className:"globe-element",style:{transform:"rotate("+e+"deg)",transition:"transform 1s"},alt:"needle pointing at values"})]})})]})})(m)})})};const xy=n.p+"static/media/clearloop_logo_noOutline-01.501916922110ebe2b16d5f625fd74e54.svg";const Sy=n.p+"static/media/carbon_icon01.1b39489d7b5b07b3aa0a643013a8d661.svg";Qm(_y(Qf),"[email protected]","ClearloopData123!").then((t=>{Uf(Kf(Qf),"/realtime/")})).catch((t=>{console.error("Auth failed:",t)}));const Ty=Kf(Qf);const Cy=function(t){const n=Uf(Ty,`historical/${t.database}`);let i=new Date;const r=i.getFullYear(),o=0===i.getMonth(),a=[{mwh:0,co2:0},{mwh:0,co2:0},{mwh:0,co2:0},{mwh:0,co2:0},{mwh:0,co2:0},{mwh:0,co2:0},{mwh:0,co2:0},{mwh:0,co2:0},{mwh:0,co2:0},{mwh:0,co2:0},{mwh:0,co2:0},{mwh:0,co2:0}],[l,c]=(0,e.useState)(a),[u,h]=(0,e.useState)(o?r-1:r),[d,p]=(0,e.useState)({}),[f,g]=(0,e.useState)(0),[m,_]=(0,e.useState)(0),[y,v]=(0,e.useState)(0),[b,w]=(0,e.useState)(0),E=280*t.capacity,x=3e5*t.capacity;console.log("Max MWh:",E),(0,e.useEffect)((()=>{$f(n,(t=>{const e=t.val(),n=(new Date).getFullYear(),i=((new Date).getMonth()+1).toString().padStart(2,"0");e[n]&&e[n][i]&&delete e[n][i],JSON.stringify(e)!==JSON.stringify(d)&&p(e)})),S(),C(),T()}),[d,u]);const S=()=>{let t=0,e=0,n=a;for(let i in d[u]){let r=parseInt(i);i<=12&&(n[r-1]={mwh:d[u][i].mwh,co2:d[u][i].co2},t+=d[u][i].mwh,e+=d[u][i].co2)}c(n),g(t),_(e)},T=()=>{let t=0,e=0;for(let n in d)for(let i in d[n])"object"==typeof d[n][i]&&i<13&&(t+=d[n][i].mwh,e+=d[n][i].co2);v(t),w(e)},C=()=>{let t=[],e=new Set,n=0;for(let i in d){let r=parseInt(i.substring(0,4));r>2015&&!e.has(r)&&(t.push((0,s.jsx)("option",{value:r,selected:r===u,children:r},`year-counter-${n}`)),e.add(r)),n++}return t.reverse(),t};return(0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{id:"top-title",children:["Monthly Solar Output (up to"," ",["January","February","March","April","May","June","July","August","September","October","November","December"][0===(new Date).getMonth()?11:(new Date).getMonth()-1]," ","of ",(new Date).getFullYear()-(0===(new Date).getMonth()?1:0),")"]}),(0,s.jsxs)("h3",{id:"top-title",children:[t.displayName,", ",t.location]}),(0,s.jsxs)("div",{className:"monthly-output-page-container",children:[(0,s.jsxs)("div",{className:"top-container",children:[(0,s.jsx)("select",{className:"year-select",onChange:t=>{h(t.target.value)},children:C()}),(0,s.jsxs)("h6",{className:"label-top",children:[(0,s.jsxs)("strong",{children:[y.toLocaleStr
2ing("en-US",{minimumFractionDigits:1,maximumFractionDigits:1})," ","MWh"]})," ","produced in total ",(0,s.jsx)("br",{})," ",(0,s.jsxs)("strong",{children:[f.toLocaleString("en-US",{minimumFractionDigits:1,maximumFractionDigits:1})," ","MWh"]})," ","produced in ",u]})]}),(0,s.jsx)("div",{className:"bars-container",children:(()=>{let e=[],n=0;for(let i of l)console.log("MWh:",i.mwh,"Max MWh:",E),i.mwh>0&&n>=6?(console.log("MWh:",i.mwh,"Max MWh:",E),e.push((0,s.jsxs)("div",{className:"mwh-bar-filled",style:{height:i.mwh/E*100+"%"},children:[(0,s.jsx)("div",{className:"popup-spacer-top-left"}),(0,s.jsxs)("div",{className:"mwh-popup mwh-popup-left",children:[(0,s.jsx)("img",{src:xy,className:"small-logo",alt:"clearloop logo"}),(0,s.jsxs)("p",{className:"popup-text",children:[(0,s.jsxs)("strong",{children:[Math.round(i.mwh).toLocaleString()," MWh"]})," solar energy powered in ",t.displayName]})]})]},`top-month-${n}`))):i.mwh>0&&n<6?e.push((0,s.jsxs)("div",{className:"mwh-bar-filled",style:{height:i.mwh/E*100+"%"},children:[(0,s.jsx)("div",{className:"popup-spacer-top-right"}),(0,s.jsxs)("div",{className:"mwh-popup mwh-popup-right",children:[(0,s.jsx)("img",{src:xy,className:"small-logo",alt:"clearloop logo"}),(0,s.jsxs)("p",{className:"popup-text",children:[(0,s.jsxs)("strong",{children:[Math.round(i.mwh).toLocaleString()," MWh"]})," solar energy powered in ",t.displayName]})]})]},`top-month-${n}`)):e.push((0,s.jsx)("div",{className:"bar-empty align-btm"},`top-month-${n}`)),n++;return e})()}),(0,s.jsx)("div",{className:"months",children:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].map(((t,e)=>(0,s.jsx)("p",{className:"month",children:t},e)))}),(0,s.jsx)("div",{className:"bars-container",children:(()=>{let e=[],n=0;for(let i of l)i.co2>0&&n>=6?e.push((0,s.jsxs)("div",{className:"lbs-bar-filled",style:{height:i.co2/x*100+"%"},children:[(0,s.jsx)("div",{className:"popup-spacer-bottom-left"}),(0,s.jsxs)("div",{className:"lbs-popup lbs-popup-left",children:[(0,s.jsx)("img",{src:Sy,className:"small-logo",alt:"smoke icon"}),(0,s.jsxs)("p",{className:"popup-text",children:[(0,s.jsxs)("strong",{children:[Math.round(i.co2).toLocaleString()," lbs"]})," of carbon reclaimed from ",t.displayName," solar farm."]})]})]},`bottom-month-${n}`)):i.co2>0&&n<6?e.push((0,s.jsxs)("div",{className:"lbs-bar-filled",style:{height:i.co2/x*100+"%"},children:[(0,s.jsx)("div",{className:"popup-spacer-bottom-right"}),(0,s.jsxs)("div",{className:"lbs-popup lbs-popup-right",children:[(0,s.jsx)("img",{src:Sy,className:"small-logo",alt:"smoke icon"}),(0,s.jsxs)("p",{className:"popup-text",children:[(0,s.jsxs)("strong",{children:[Math.round(i.co2).toLocaleString()," lbs"]})," of carbon reclaimed from ",t.displayName," solar farm."]})]})]},`bottom-month-${n}`)):e.push((0,s.jsx)("div",{className:"bar-empty align-top"},`bottom-month-${n}`)),n++;return e})()}),(0,s.jsxs)("h6",{className:"label-btm",children:[(0,s.jsxs)("strong",{children:[b.toLocaleString("en-US",{maximumFractionDigits:0})," ","lbs"]})," ","avoided in total ",(0,s.jsx)("br",{}),(0,s.jsxs)("strong",{children:[m.toLocaleString("en-US",{maximumFractionDigits:0})," ","lbs"]})," ","avoided in ",u]})]}),(0,s.jsx)("h3",{id:"bottom-title",children:"Monthly Carbon Avoided"})]})};var Ay,Py=n(775),Ry=n.t(Py,2);function My(){return My=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},My.apply(this,arguments)}!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(Ay||(Ay={}));const Iy="popstate";function Ly(t,e){if(!1===t||null===t||"undefined"===typeof t)throw new Error(e)}function ky(t,e){if(!t){"undefined"!==typeof console&&console.warn(e);try{throw new Error(e)}catch(n){}}}function Ny(t,e){return{usr:t.state,key:t.key,idx:e}}function Oy(t,e,n,i){return void 0===n&&(n=null),My({pathname:"string"===typeof t?t:t.pathname,search:"",hash:""},"string"===typeof e?Fy(e):e,{state:n,key:e&&e.key||i||Math.random().toString(36).substr(2,8)})}function Dy(t){let{pathname:e="/",search:n="",hash:i=""}=t;return n&&"?"!==n&&(e+="?"===n.charAt(0)?n:"?"+n),i&&"#"!==i&&(e+="#"
2===i.charAt(0)?i:"#"+i),e}function Fy(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let i=t.indexOf("?");i>=0&&(e.search=t.substr(i),t=t.substr(0,i)),t&&(e.pathname=t)}return e}function By(t,e,n,i){void 0===i&&(i={});let{window:r=document.defaultView,v5Compat:s=!1}=i,o=r.history,a=Ay.Pop,l=null,c=u();function u(){return(o.state||{idx:null}).idx}function h(){a=Ay.Pop;let t=u(),e=null==t?null:t-c;c=t,l&&l({action:a,location:p.location,delta:e})}function d(t){let e="null"!==r.location.origin?r.location.origin:r.location.href,n="string"===typeof t?t:Dy(t);return n=n.replace(/ $/,"%20"),Ly(e,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,e)}null==c&&(c=0,o.replaceState(My({},o.state,{idx:c}),""));let p={get action(){return a},get location(){return t(r,o)},listen(t){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(Iy,h),l=t,()=>{r.removeEventListener(Iy,h),l=null}},createHref:t=>e(r,t),createURL:d,encodeLocation(t){let e=d(t);return{pathname:e.pathname,search:e.search,hash:e.hash}},push:function(t,e){a=Ay.Push;let i=Oy(p.location,t,e);n&&n(i,t),c=u()+1;let h=Ny(i,c),d=p.createHref(i);try{o.pushState(h,"",d)}catch($c){if($c instanceof DOMException&&"DataCloneError"===$c.name)throw $c;r.location.assign(d)}s&&l&&l({action:a,location:p.location,delta:1})},replace:function(t,e){a=Ay.Replace;let i=Oy(p.location,t,e);n&&n(i,t),c=u();let r=Ny(i,c),h=p.createHref(i);o.replaceState(r,"",h),s&&l&&l({action:a,location:p.location,delta:0})},go:t=>o.go(t)};return p}var Uy;!function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"}(Uy||(Uy={}));new Set(["lazy","caseSensitive","path","id","index","children"]);function zy(t,e,n){void 0===n&&(n="/");let i=tv(("string"===typeof e?Fy(e):e).pathname||"/",n);if(null==i)return null;let r=jy(t);!function(t){t.sort(((t,e)=>t.score!==e.score?e.score-t.score:function(t,e){let n=t.length===e.length&&t.slice(0,-1).every(((t,n)=>t===e[n]));return n?t[t.length-1]-e[e.length-1]:0}(t.routesMeta.map((t=>t.childrenIndex)),e.routesMeta.map((t=>t.childrenIndex)))))}(r);let s=null;for(let o=0;null==s&&o<r.length;++o){let t=Qy(i);s=Yy(r[o],t)}return s}function jy(t,e,n,i){void 0===e&&(e=[]),void 0===n&&(n=[]),void 0===i&&(i="");let r=(t,r,s)=>{let o={relativePath:void 0===s?t.path||"":s,caseSensitive:!0===t.caseSensitive,childrenIndex:r,route:t};o.relativePath.startsWith("/")&&(Ly(o.relativePath.startsWith(i),'Absolute route path "'+o.relativePath+'" nested under path "'+i+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),o.relativePath=o.relativePath.slice(i.length));let a=ev([i,o.relativePath]),l=n.concat(o);t.children&&t.children.length>0&&(Ly(!0!==t.index,'Index routes must not have child routes. Please remove all child routes from route path "'+a+'".'),jy(t.children,e,l,a)),(null!=t.path||t.index)&&e.push({path:a,score:Ky(a,t.index),routesMeta:l})};return t.forEach(((t,e)=>{var n;if(""!==t.path&&null!=(n=t.path)&&n.includes("?"))for(let i of Vy(t.path))r(t,e,i);else r(t,e)})),e}function Vy(t){let e=t.split("/");if(0===e.length)return[];let[n,...i]=e,r=n.endsWith("?"),s=n.replace(/\?$/,"");if(0===i.length)return r?[s,""]:[s];let o=Vy(i.join("/")),a=[];return a.push(...o.map((t=>""===t?s:[s,t].join("/")))),r&&a.push(...o),a.map((e=>t.startsWith("/")&&""===e?"/":e))}const Wy=/^:[\w-]+$/,$y=3,Gy=2,Hy=1,qy=10,Zy=-2,Xy=t=>"*"===t;function Ky(t,e){let n=t.split("/"),i=n.length;return n.some(Xy)&&(i+=Zy),e&&(i+=Gy),n.filter((t=>!Xy(t))).reduce(((t,e)=>t+(Wy.test(e)?$y:""===e?Hy:qy)),i)}function Yy(t,e){let{routesMeta:n}=t,i={},r="/",s=[];for(let o=0;o<n.length;++o){let t=n[o],a=o===n.length-1,l="/"===r?e:e.slice(r.length)||"/",c=Jy({path:t.relativePath,caseSensitive:t.caseSensitive,end:a},l);if(!c)return null;
2Object.assign(i,c.params);let u=t.route;s.push({params:i,pathname:ev([r,c.pathname]),pathnameBase:nv(ev([r,c.pathnameBase])),route:u}),"/"!==c.pathnameBase&&(r=ev([r,c.pathnameBase]))}return s}function Jy(t,e){"string"===typeof t&&(t={path:t,caseSensitive:!1,end:!0});let[n,i]=function(t,e,n){void 0===e&&(e=!1);void 0===n&&(n=!0);ky("*"===t||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were "'+t.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+t.replace(/\*$/,"/*")+'".');let i=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((t,e,n)=>(i.push({paramName:e,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));t.endsWith("*")?(i.push({paramName:"*"}),r+="*"===t||"/*"===t?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":""!==t&&"/"!==t&&(r+="(?:(?=\\/|$))");let s=new RegExp(r,e?void 0:"i");return[s,i]}(t.path,t.caseSensitive,t.end),r=e.match(n);if(!r)return null;let s=r[0],o=s.replace(/(.)\/+$/,"$1"),a=r.slice(1),l=i.reduce(((t,e,n)=>{let{paramName:i,isOptional:r}=e;if("*"===i){let t=a[n]||"";o=s.slice(0,s.length-t.length).replace(/(.)\/+$/,"$1")}const l=a[n];return t[i]=r&&!l?void 0:(l||"").replace(/%2F/g,"/"),t}),{});return{params:l,pathname:s,pathnameBase:o,pattern:t}}function Qy(t){try{return t.split("/").map((t=>decodeURIComponent(t).replace(/\//g,"%2F"))).join("/")}catch($c){return ky(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+$c+")."),t}}function tv(t,e){if("/"===e)return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,i=t.charAt(n);return i&&"/"!==i?null:t.slice(n)||"/"}const ev=t=>t.join("/").replace(/\/\/+/g,"/"),nv=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/");Error;function iv(t){return null!=t&&"number"===typeof t.status&&"string"===typeof t.statusText&&"boolean"===typeof t.internal&&"data"in t}const rv=["post","put","patch","delete"],sv=(new Set(rv),["get",...rv]);new Set(sv),new Set([301,302,303,307,308]),new Set([307,308]);Symbol("deferred");function ov(){return ov=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},ov.apply(this,arguments)}const av=e.createContext(null);const lv=e.createContext(null);const cv=e.createContext(null);const uv=e.createContext(null);const hv=e.createContext({outlet:null,matches:[],isDataRoute:!1});const dv=e.createContext(null);function pv(){return null!=e.useContext(uv)}function fv(){return pv()||Ly(!1),e.useContext(uv).location}function gv(t,n,i,r){pv()||Ly(!1);let{navigator:s}=e.useContext(cv),{matches:o}=e.useContext(hv),a=o[o.length-1],l=a?a.params:{},c=(a&&a.pathname,a?a.pathnameBase:"/");a&&a.route;let u,h=fv();if(n){var d;let t="string"===typeof n?Fy(n):n;"/"===c||(null==(d=t.pathname)?void 0:d.startsWith(c))||Ly(!1),u=t}else u=h;let p=u.pathname||"/",f=p;if("/"!==c){let t=c.replace(/^\//,"").split("/");f="/"+p.replace(/^\//,"").split("/").slice(t.length).join("/")}let g=zy(t,{pathname:f});let m=bv(g&&g.map((t=>Object.assign({},t,{params:Object.assign({},l,t.params),pathname:ev([c,s.encodeLocation?s.encodeLocation(t.pathname).pathname:t.pathname]),pathnameBase:"/"===t.pathnameBase?c:ev([c,s.encodeLocation?s.encodeLocation(t.pathnameBase).pathname:t.pathnameBase])}))),o,i,r);return n&&m?e.createElement(uv.Provider,{value:{location:ov({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:Ay.Pop}},m):m}function mv(){let t=function(){var t;let n=e.useContext(dv),i=Ev(wv.UseRouteError),r=xv(wv.UseRouteError);if(void 0!==n)return n;return null==(t=i.errors)?void 0:t[r]}(),n=iv(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),i=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r};return e.createElement(e.Fragment,null,e.createElement("h2",null,"Unexpected Application
2Error!"),e.createElement("h3",{style:{fontStyle:"italic"}},n),i?e.createElement("pre",{style:s},i):null,null)}const _v=e.createElement(mv,null);class yv extends e.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||"idle"!==e.revalidation&&"idle"===t.revalidation?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:void 0!==t.error?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){console.error("React Router caught the following error during render",t,e)}render(){return void 0!==this.state.error?e.createElement(hv.Provider,{value:this.props.routeContext},e.createElement(dv.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function vv(t){let{routeContext:n,match:i,children:r}=t,s=e.useContext(av);return s&&s.static&&s.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=i.route.id),e.createElement(hv.Provider,{value:n},r)}function bv(t,n,i,r){var s;if(void 0===n&&(n=[]),void 0===i&&(i=null),void 0===r&&(r=null),null==t){var o;if(null==(o=i)||!o.errors)return null;t=i.matches}let a=t,l=null==(s=i)?void 0:s.errors;if(null!=l){let t=a.findIndex((t=>t.route.id&&(null==l?void 0:l[t.route.id])));t>=0||Ly(!1),a=a.slice(0,Math.min(a.length,t+1))}let c=!1,u=-1;if(i&&r&&r.v7_partialHydration)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(u=e),t.route.id){let{loaderData:e,errors:n}=i,r=t.route.loader&&void 0===e[t.route.id]&&(!n||void 0===n[t.route.id]);if(t.route.lazy||r){c=!0,a=u>=0?a.slice(0,u+1):[a[0]];break}}}return a.reduceRight(((t,r,s)=>{let o,h=!1,d=null,p=null;var f;i&&(o=l&&r.route.id?l[r.route.id]:void 0,d=r.route.errorElement||_v,c&&(u<0&&0===s?(f="route-fallback",!1||Sv[f]||(Sv[f]=!0),h=!0,p=null):u===s&&(h=!0,p=r.route.hydrateFallbackElement||null)));let g=n.concat(a.slice(0,s+1)),m=()=>{let n;return n=o?d:h?p:r.route.Component?e.createElement(r.route.Component,null):r.route.element?r.route.element:t,e.createElement(vv,{match:r,routeContext:{outlet:t,matches:g,isDataRoute:null!=i},children:n})};return i&&(r.route.ErrorBoundary||r.route.errorElement||0===s)?e.createElement(yv,{location:i.location,revalidation:i.revalidation,component:d,error:o,children:m(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):m()}),null)}var wv=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(wv||{});function Ev(t){let n=e.useContext(lv);return n||Ly(!1),n}function xv(t){let n=function(t){let n=e.useContext(hv);return n||Ly(!1),n}(),i=n.matches[n.matches.length-1];return i.route.id||Ly(!1),i.route.id}const Sv={};i.startTransition;function Tv(t){Ly(!1)}function Cv(t){let{basename:n="/",children:i=null,location:r,navigationType:s=Ay.Pop,navigator:o,static:a=!1,future:l}=t;pv()&&Ly(!1);let c=n.replace(/^\/*/,"/"),u=e.useMemo((()=>({basename:c,navigator:o,static:a,future:ov({v7_relativeSplatPath:!1},l)})),[c,l,o,a]);"string"===typeof r&&(r=Fy(r));let{pathname:h="/",search:d="",hash:p="",state:f=null,key:g="default"}=r,m=e.useMemo((()=>{let t=tv(h,c);return null==t?null:{location:{pathname:t,search:d,hash:p,state:f,key:g},navigationType:s}}),[c,h,d,p,f,g,s]);return null==m?null:e.createElement(cv.Provider,{value:u},e.createElement(uv.Provider,{children:i,value:m}))}function Av(t){let{children:e,location:n}=t;return gv(Pv(e),n)}new Promise((()=>{}));e.Component;function Pv(t,n){void 0===n&&(n=[]);let i=[];return e.Children.forEach(t,((t,r)=>{if(!e.isValidElement(t))return;let s=[...n,r];if(t.type===e.Fragment)return void i.push.apply(i,Pv(t.props.children,s));t.type!==Tv&&Ly(!1),t.props.index&&t.props.children&&Ly(!1);let o={id:t.props.id||s.join("-"),caseSensitive:t.props.caseSensitive,element:t.props.element,Component:t.props.Component,index:t.props.index,path:t.props.path,loader:t.props.loader,action:t.props.action,errorElement:t.props.errorElement,ErrorBoundary:t.props.ErrorBoundary,hasErrorBoundary:null!=t.props.ErrorBoundary||null!=t.props.errorElement,shouldRevalidate:t.props.shouldRevalidate,handle:t.props.handle,lazy:t.props.lazy};t.props.children&&(o.children=Pv(t.props.children,s)),i.push(o)})),i}new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);try{window.__reactRouterVersion="6"}catch(_G){}new Map;const Rv=i.startTransition;Ry.flushSync,i.useId;function Mv(t){let{basename:n,children:i,future:r,window:s}=t,o=e.useRef();var a;null==o.current&&(o.current=(void 0===(a={window:s,v5Compat:!0})&&(a={}),By((function(t,e){let{pathname:n,search:i,hash:r}=t.location;return Oy("",{pathname:n,search:i,hash:r},e.state&&e.state.usr||null,e.state&&e.state.key||"default")}),(function(t,e){return"string"===typeof e?e:Dy(e)}),null,a)));let l=o.current,[c,u]=e.useState({action:l.action,location:l.location}),{v7_startTransition:h}=r||{},d=e.useCallback((t=>{h&&Rv?Rv((()=>u(t))):u(t)}),[u,h]);return e.useLayoutEffect((()=>l.listen(d)),[l,d]),e.createElement(Cv,{basename:n,children:i,location:c.location,navigationType:c.action,navigator:l,future:r})}"undefined"!==typeof window&&"undefined"!==typeof window.document&&window.document.createElement;var Iv,Lv;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Iv||(Iv={})),function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"}(Lv||(Lv={}));const kv=[{name:{plantName:"jackson2",displayName:"Jackson",databaseName:"/jackson"},capacity:1,location:"tennessee",displayLocation:"Tennessee",brightGlobe:M},{name:{plantName:"paris",displayName:"Puryear",databaseName:"/paris"},capacity:1,location:"tennessee",displayLocation:"Tennessee",brightGlobe:M},{name:{plantName:"whitepine",displayName:"White Pine",databaseName:"/whitepine"},capacity:2.8,location:"tennessee",displayLocation:"Tennessee",brightGlobe:M},{name:{plantName:"panola1",displayName:"Panola I",databaseName:"/panola1"},capacity:4.75,location:"tennessee",displayLocation:"Mississippi",brightGlobe:M},{name:{plantName:"panola2",displayName:"Panola II",databaseName:"/panola2"},capacity:4.75,location:"tennessee",displayLocation:"Mississippi",brightGlobe:M},{name:{plantName:"panola3",displayName:"Panola III",databaseName:"/panola3"},capacity:3.5,location:"tennessee",displayLocation:"Mississippi",brightGlobe:M}];
2const Nv=n.p+"static/media/Background01.b592a082798098e3d6f7418c4a582f8d.svg";const Ov=n.p+"static/media/LowImpact.b5d69a7caba39f59c97d0ac4c50069dc.svg";const Dv=n.p+"static/media/MediumImpact.7c71d85681b898477d365776502bedd7.svg";const Fv=n.p+"static/media/HighImpact.2c1cabb372189d7b6f3d8e64c86830fb.svg";const Bv=n.p+"static/media/Tennessee-state01.f744b3ca4a00307af5fa3d9637806b3c.svg";const Uv=n.p+"static/media/Texas-state01.a9c66ff61655a5a927a5ecb4c3e9fefd.svg";const zv=n.p+"static/media/California-state01.ce91a95a82363289b22fc67d4b7cee63.svg",jv=Kf(Qf),Vv=Uf(jv,"/moer"),Wv=()=>{const[t,n]=(0,e.useState)([0,0,0]),[i,r]=(0,e.useState)(),[o,a]=(0,e.useState)("hidden"),[l,c]=(0,e.useState)("hidden"),[u,h]=(0,e.useState)("hidden");return(0,e.useEffect)((()=>{["TVA","SOCO","MISO_LOWER_MS_RIVER","CAISO_NORTH"].forEach((t=>{$f(Uf(jv,`/health_damage/${t}`),(e=>{const n=e.val();let i=0;Object.values(n).forEach((t=>{i+=t.value})),console.log(`${i} ${t}`)}))}))})),(0,e.useEffect)((()=>{$f(Vv,(t=>{const e=t.val();if(JSON.stringify(e)!==JSON.stringify(i)){let t=[{location:"TVA",value:parseFloat(e.TVA),image:Bv},{location:"CAISO_NORTH",value:parseFloat(e.CAISO_NORTH),image:zv},{location:"ERCOT_NORTHCENTRAL",value:parseFloat(e.ERCOT_NORTHCENTRAL),image:Uv}];t.sort(((t,e)=>t.value-e.value)),n(t),r(e)}}))}),[t,i]),(0,s.jsx)("div",{id:"chart-container",style:{position:"fixed",top:"0",left:"0",width:"100%",height:"100%"},children:(0,s.jsxs)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)("image",{href:Nv,width:"100",height:"100",children:" "}),(0,s.jsx)("image",{href:t[0].image,width:"100",height:"100",x:"-26",children:" "}),(0,s.jsx)("image",{href:t[1].image,width:"100",height:"100",children:" "}),(0,s.jsx)("image",{href:t[2].image,width:"100",height:"100",x:"27.5",children:" "}),(0,s.jsx)("image",{href:Ov,width:"100",height:"100",className:o}),(0,s.jsx)("image",{href:Dv,width:"100",height:"100",className:l,children:" "}),(0,s.jsx)("image",{href:Fv,width:"100",height:"100",className:u,children:" "}),(0,s.jsxs)("text",{x:"87",y:"41",fill:"black",className:`carbon-text ${u}`,textAnchor:"left",children:[t[2].value," lbs"]}),(0,s.jsx)("text",{x:"87",y:"43",fill:"black",className:`carbon-text ${u}`,textAnchor:"left",children:"CO2/ MWh"}),(0,s.jsxs)("text",{x:"87",y:"57",fill:"black",className:`carbon-text ${l}`,textAnchor:"left",children:[t[1].value," lbs"]}),(0,s.jsx)("text",{x:"87",y:"59",fill:"black",className:`carbon-text ${l}`,textAnchor:"left",children:"CO2/ MWh"}),(0,s.jsxs)("text",{x:"87",y:"73.5",fill:"black",className:`carbon-text ${o}`,textAnchor:"left",children:[t[0].value," lbs"]}),(0,s.jsx)("text",{x:"87",y:"75.5",fill:"black",className:`carbon-text ${o}`,textAnchor:"left",children:"CO2/ MWh"}),(0,s.jsx)("rect",{width:"26.5",height:"100",x:"6",y:"0",fill:"red",className:"cali-trigger",onMouseEnter:()=>a("show"),onMouseLeave:()=>a("hidden")}),(0,s.jsx)("rect",{width:"26.5",height:"100",x:"32.5",y:"0",fill:"green",className:"cali-trigger",onMouseEnter:()=>{c("show"),a("show")},onMouseLeave:()=>{c("hidden"),a("hidden")}}),(0,s.jsx)("rect",{width:"26.5",height:"100",x:"59",y:"0",fill:"blue",className:"cali-trigger",onMouseEnter:()=>{c("show"),a("show"),h("show")},onMouseLeave:()=>{c("hidden"),a("hidden"),h("hidden")}})]})})},$v=1;const Gv=(0,e.createContext)(null),Hv=Gv.Provider;function qv(){const t=(0,e.useContext)(Gv);if(null==t)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return t}var Zv=n(39);function Xv(){return Xv=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Xv.apply(this,arguments)}function Kv(t,n){let{bounds:i,boundsOptions:r,center:s,children:o,className:a,id:l,placeholder:c,style:u,whenReady:h,zoom:d,...p}=t;const[f]=(0,e.useState)({className:a,id:l,style:u}),[g,m]=(0,e.useState)(null);(0,e.useImperativeHandle)(n,(()=>g?.map??null),[g]);const _=(0,e.useCallback)((t=>{if(null!==t&&null===g){const e=new Zv.Map(t,p);null!=s&&null!=d?e.setView(s,d):null!=i&&e.fitBounds(i,r),null!=h&&e.whenReady(h),m(function(t){return Object.freeze({__version:$v,map:t})}(e))}}),[]);(0,e.useEffect)((()=>()=>{g?.map.remove()}),[g]);const y=g?e.createElement(Hv,{value:g},o):c??null;return e.createElement("div",Xv({},f,{ref:_}),y)}const Yv=(0,e.forwardRef)(Kv);function Jv(t){function n(n,i){const{instance:r}=t(n).current;return(0,e.useImperativeHandle)(i,(()=>r)),null}return(0,e.forwardRef)(n)}function Qv(t,e,n){return Object.freeze({instance:t,context:e,container:n})}function tb(t,n){return null==n?function(n,i){const r=(0,e.useRef)();return r.current||(r.current=t(n,i)),r}:function(i,r){const s=(0,e.useRef)();s.current||(s.current=t(i,r));const o=(0,e.useRef)(i),{instance:a}=s.current;return(0,e.useEffect)((function(){o.current!==i&&(n(a,i,o.current),o.current=i)}),[a,i,r]),s}}function eb(t,n){const i=(0,e.useRef)(n);(0,e.useEffect)((function(){n!==i.current&&null!=t.attributionControl&&(null!=i.current&&t.attributionControl.removeAttribution(i.current),null!=n&&t.attributionControl.addAttribution(n)),i.current=n}),[t,n])}function nb(t,n){const i=(0,e.useRef)();(0,e.useEffect)((function(){return null!=n&&t.instance.on(n),i.current=n,function(){null!=i.current&&t.instance.off(i.current),i.current=null}}),[t,n])}function ib(t,e){const n=t.pane??e.pane;return n?{...t,pane:n}:t}function rb(t,n){(0,e.useEffect)((function(){return(n.layerContainer??n.map).addLayer(t.instance),function(){n.layerContainer?.removeLayer(t.instance),n.map.removeLayer(t.instance)}}),[n,t])}
2function sb(t){return function(n){const i=qv(),r=t(ib(n,i),i);return nb(r.current,n.eventHandlers),rb(r.current,i),function(t,n){const i=(0,e.useRef)();(0,e.useEffect)((function(){if(n.pathOptions!==i.current){const e=n.pathOptions??{};t.instance.setStyle(e),i.current=e}}),[t,n])}(r.current,n),r}}const ob=Jv((ab=tb((function(t,e){let{url:n,...i}=t;return Qv(new Zv.TileLayer(n,ib(i,e)),e)}),(function(t,e,n){!function(t,e,n){const{opacity:i,zIndex:r}=e;null!=i&&i!==n.opacity&&t.setOpacity(i),null!=r&&r!==n.zIndex&&t.setZIndex(r)}(t,e,n);const{url:i}=e;null!=i&&i!==n.url&&t.setUrl(i)})),function(t){const e=qv(),n=ab(ib(t,e),e);return eb(e.map,t.attribution),nb(n.current,t.eventHandlers),rb(n.current,e),n}));var ab;const lb=function(t){const n=function(t){return function(n){const i=qv(),r=t(n,i),{instance:s}=r.current,o=(0,e.useRef)(n.position),{position:a}=n;return(0,e.useEffect)((function(){return s.addTo(i.map),function(){s.remove()}}),[i.map,s]),(0,e.useEffect)((function(){null!=a&&a!==o.current&&(s.setPosition(a),o.current=a)}),[s,a]),r}}(tb((function(e,n){return Qv(t(e),n)})));return Jv(n)}((function(t){return new Zv.Control.Attribution(t)})),cb=function(t,n){return function(t){function n(n,i){const{instance:r,context:s}=t(n).current;return(0,e.useImperativeHandle)(i,(()=>r)),null==n.children?null:e.createElement(Hv,{value:s},n.children)}return(0,e.forwardRef)(n)}(sb(tb(t,n)))}((function(t,e){let{data:n,...i}=t;const r=new Zv.GeoJSON(n,i);return Qv(r,function(t,e){return Object.freeze({...t,...e})}(e,{overlayContainer:r}))}),(function(t,e,n){e.style!==n.style&&(null==e.style?t.resetStyle():t.setStyle(e.style))})),ub=function(t,n){const i=function(t,e){return function(n,i){const r=qv(),s=t(ib(n,r),r);return eb(r.map,n.attribution),nb(s.current,n.eventHandlers),e(s.current,r,n,i),s}}(tb(t),n);return function(t){function n(n,i){const[r,s]=(0,e.useState)(!1),{instance:o}=t(n,s).current;(0,e.useImperativeHandle)(i,(()=>o)),(0,e.useEffect)((function(){r&&o.update()}),[o,r,n.children]);const a=o._contentNode;return a?(0,Py.createPortal)(n.children,a):null}return(0,e.forwardRef)(n)}(i)}((function(t,e){return Qv(new Zv.Tooltip(t,e.overlayContainer),e)}),(function(t,n,i,r){let{position:s}=i;(0,e.useEffect)((function(){const e=n.overlayContainer;if(null==e)return;const{instance:i}=t,o=t=>{t.tooltip===i&&(null!=s&&i.setLatLng(s),i.update(),r(!0))},a=t=>{t.tooltip===i&&r(!1)};return e.on({tooltipopen:o,tooltipclose:a}),e.bindTooltip(i),function(){e.off({tooltipopen:o,tooltipclose:a}),null!=e._map&&e.unbindTooltip()}}),[t,n,r,s])})),hb=JSON.parse('[{"type":"Feature","properties":{"name":"Texas","abbreviation":"TX","grid_region":"ERCOT_NORTHCENTRAL"},"geometry":{"coordinates":[[[[-96.83003,28.111842],[-96.827049,28.112417],[-96.816574,28.119618],[-96.81042,28.126034],[-96.810944,28.136378],[-96.816836,28.158048],[-96.820315,28.163494],[-96.822859,28.167476],[-96.818656,28.17228],[-96.816443,28.174808],[-96.791958,28.188687],[-96.733037,28.190913],[-96.703838,28.198246],[-96.697422,28.202959],[-96.702659,28.211208],[-96.703314,28.216446],[-96.686816,28.21841],[-96.662462,28.227314],[-96.660628,28.228885],[-96.663116,28.233206],[-96.651856,28.251275],[-96.607992,28.27707],[-96.608123,28.280081],[-96.611527,28.281391],[-96.61048,28.283093],[-96.592934,28.296972],[-96.581019,28.30221],[-96.55326,28.302341],[-96.546975,28.305614],[-96.542131,28.315958],[-96.528906,28.322505],[-96.476269,28.330754],[-96.450998,28.337039],[-96.434108,28.344764],[-96.418919,28.354846],[-96.415253,28.362833],[-96.417217,28.367154],[-96.412896,28.369511],[-96.403206,28.371475],[-96.401242,28.366892],[-96.397846,28.343513],[-96.4137,28.327343],[-96.439099,28.319052],[-96.547774,28.270798],[-96.621534,28.2297],[-96.694666,28.18212],[-96.758141,28.136873],[-96.849624,28.064939],[-96.853455,28.061345],[-96.929053,27.99044],[-96.966996,27.950531],[-97.001441,27.911442],[-97.03166,27.869975],[-97.041799,27.852926],[-97.045409,27.837452],[-97.04598,27.835004],[-97.085395,27.793245],[-97.116277,27.752599],[-97.166682,27.676583],[-97.201866,27.614858],[-97.221912,27.576315],[
2-97.276091,27.472145],[-97.30447,27.407734],[-97.326523,27.347612],[-97.347438,27.277963],[-97.350398,27.268105],[-97.363401,27.210366],[-97.370941,27.161166],[-97.377001,27.101021],[-97.37913,27.047996],[-97.378362,26.992877],[-97.370731,26.909706],[-97.364726,26.871693],[-97.351413,26.808604],[-97.333028,26.736479],[-97.30069,26.635375],[-97.287885,26.600341],[-97.275119,26.565415],[-97.269392,26.554046],[-97.229844,26.433569],[-97.223728,26.411492],[-97.194644,26.306513],[-97.185844,26.267103],[-97.173265,26.192314],[-97.161471,26.088705],[-97.154271,26.066841],[-97.161462,26.06764],[-97.169842,26.077853],[-97.171781,26.102522],[-97.179532,26.146202],[-97.178746,26.177103],[-97.183983,26.214289],[-97.194458,26.27164],[-97.214885,26.353606],[-97.226931,26.385555],[-97.240286,26.405981],[-97.240849,26.411504],[-97.243167,26.434263],[-97.247619,26.456261],[-97.254166,26.471188],[-97.262546,26.482972],[-97.276425,26.521729],[-97.292399,26.528014],[-97.31073,26.556558],[-97.308112,26.571223],[-97.308635,26.576723],[-97.317015,26.597673],[-97.318458,26.60027],[-97.324872,26.611814],[-97.338489,26.647429],[-97.336394,26.666022],[-97.345822,26.700589],[-97.363105,26.71054],[-97.370438,26.723896],[-97.370961,26.736204],[-97.367557,26.740394],[-97.364153,26.758987],[-97.364646,26.767122],[-97.368866,26.774699],[-97.370438,26.781508],[-97.368343,26.795649],[-97.373056,26.808481],[-97.387459,26.820789],[-97.383531,26.875521],[-97.385626,26.888876],[-97.391649,26.90197],[-97.389554,26.945965],[-97.39034,27.052286],[-97.389816,27.067213],[-97.386412,27.083187],[-97.387459,27.090519],[-97.390602,27.094186],[-97.390078,27.156512],[-97.377508,27.199459],[-97.379865,27.202863],[-97.386674,27.204696],[-97.382222,27.229051],[-97.37489,27.250262],[-97.373318,27.27645],[-97.372861,27.278069],[-97.367033,27.298709],[-97.364676,27.302637],[-97.359963,27.304732],[-97.357606,27.307875],[-97.36232,27.32673],[-97.366771,27.333276],[-97.361796,27.359988],[-97.346607,27.390365],[-97.336132,27.402411],[-97.331157,27.412362],[-97.329585,27.418124],[-97.330895,27.425456],[-97.329847,27.43436],[-97.317277,27.46369],[-97.293709,27.497209],[-97.282972,27.521564],[-97.266474,27.542514],[-97.257832,27.556393],[-97.26176,27.563464],[-97.260451,27.567392],[-97.252071,27.578652],[-97.247877,27.581366],[-97.247619,27.581533],[-97.236882,27.598293],[-97.241072,27.602483],[-97.242643,27.607458],[-97.231383,27.632336],[-97.221955,27.63286],[-97.219075,27.630241],[-97.214099,27.631551],[-97.200743,27.650144],[-97.197339,27.664547],[-97.197601,27.678426],[-97.203474,27.684533],[-97.203089,27.688001],[-97.190007,27.692829],[-97.170628,27.720326],[-97.166176,27.732372],[-97.1612,27.734074],[-97.153606,27.733289],[-97.147321,27.735384],[-97.130823,27.75162],[-97.127942,27.75581],[-97.127681,27.76],[-97.103326,27.789068],[-97.102279,27.798233],[-97.098874,27.808447],[-97.092851,27.81447],[-97.092589,27.819183],[-97.098874,27.82285],[-97.126109,27.819707],[-97.130299,27.820493],[-97.134489,27.825206],[-97.132394,27.827301],[-97.056713,27.842294],[-97.055823,27.843404],[-97.043226,27.859119],[-97.013634,27.90678],[-97.017955,27.911494],[-97.016384,27.917255],[-96.985745,27.954048],[-96.977889,27.976439],[-96.978805,27.978272],[-96.9809,27.978272],[-96.986007,27.976177],[-96.986661,27.980759],[-96.978282,28.001709],[-96.967807,28.020041],[-96.966759,28.020368],[-96.965188,28.013297],[-96.962569,28.012381],[-96.952618,28.01644],[-96.946988,28.026522],[-96.932454,28.035426],[-96.92643,28.043413],[-96.929573,28.0514],[-96.927085,28.057292],[-96.906004,28.076147],[-96.890947,28.076802],[-96.886233,28.084396],[-96.888328,28.086622],[-96.889113,28.099454],[-96.886887,28.11713],[-96.879424,28.131402],[-96.874972,28.133236],[-96.870782,28.131271],[-96.864628,28.126296],[-96.857165,28.115559],[-96.84538,28.108881],[-96.83003,28.111842]]],[[[-100.000381,34.746461],[-100.000381,34.746358],[-100.000381,34.560509],[-99.997853,34.561485],[-99.954567,34.578195],[-99.94572,34.579273],[-99.923211,34.574552],[-99.884842,34.546953],[-99.874403,34.537095],[-99.872357,34.532096],[-99.864922,34.523018],[-99.846399,34.505045],[-99.793684,34.453894],[-99.767234,34.430502],[-99.69497,34.378333],[-99.663948,34.37368],[-99.616793,34.375391],[-99.58006,34.416653],[-99.574367,34.418281],[-99.515385,34.414333],[-99.499875,34.409608],[-99.474161,34.398052],[-99.453477,34.388756],[-99.44076,34.374123],[-99.407168,34.372605],[-99.398635,34.375832],[-99.356713,34.442144],[-99.261321,34.403499],[-99.211423,34.337897],[-99.211396,34.337688],[-99.209724,34.324935],[-99.2116,34.31397],[-99.211648,34.292232],[-99.19089,34.215251],[-99.157114,34.207414],[-99.119204,34.201747],[-99.060344,34.204761],[-98.966743,34.201185],[-98.952527,34.195621],[-98.920042,34.182908],[-98.858419,34.152732],[-98.76557,34.136376],[-98.700182,34.135995],[-98.665824,34.151617],[-98.652347,34.161029],[-98.637575,34.162284],[-98.610112,34.161039],[-98.599789,34.160571],[-98.577356,34.1491],[-98.553717,34.13366],[-98.504182,34.072371],[-98.475066,34.064269],[-98.433769,34.096116],[-98.400494,34.121778],[-98.398441,34.128456],[-98.383222,34.147806],[-98.364023,34.157109],[-98.325445,34.151025],[-98.300209,34.134579],[-98.293901,34.13302],[-98.200075,34.116783],[-98.16912,34.114171],[-98.106261,34.033696],[-98.088203,34.005481],[-98.08526,34.003259],[-98.041117,33.993456],[-98.019485,33.993804],[-97.983521,34.001559],[-97.94573,33.989839],[-97.953395,33.936445],[-97.977859,33.889929],[-97.97781,33.889894],[-97.966706,33.881949],[-97.877387,33.850236],[-97.865765,33.849393],[-97.834333,33.857671],[-97.785317,33.890701],[-97.733723,33.936392],[-97.700477,33.972246],[-97.69311,33.983699],[-97.688023,33.986607],[-97.671772,33.99137],[-97.65621,33.989488],[-97.609091,33.968093],[-97.589598,33.953554],[-97.588828,33.951882],[-97.597115,33.917868],[-97.596289,33.913769],[-97.587441,33.902479],[-97.581041,33.900396],[-97.561054,33.898006],[-97.555002,33.897282],[-97.545526,33.900396],[-97.519171,33.913638],[-97.50096,33.919643],[-97.486505,33.916994],[-97.484071,33.91568],[-97.458069,33.901635],[-97.450954,33.891398],[-97.451469,33.87093],[-97.457617,33.855126],[-97.461486,33.84956],[-97.462857,33.841772],[-97.459068,33.834581],[-97.453057,33.828536],[-97.444193,33.823773],[-97.426493,33.819398],[-97.372941,33.819454],[-97.310843,33.872461],[-97.226522,33.914642],[-97.210921,33.916064],[-97.185458,33.9007],[-97.180845,33.895204],[-97.166629,33.847311],[-97.166824,33.840395],[-97.171627,33.835335],[-97.18137,33.831375],[-97.194678,33.831192],[-97.1997,33.827322],[-97.204995,33.81887],[-97.204827,33.799908],[-97.172192,33.737545],[-97.163149,33.729322],[-97.162803,33.729127],[-97.151257,33.722608],[-97.13753,33.718664],[-97.121102,33.717174],[-97.107183,33.721119],[-97.097154,33.727809],[-97.092414,33.733214],[-97.047972,33.817931],[-97.00613,33.861884],[-96.985567,33.886522],[-96.97287,33.935698],[-96.944611,33.948994],[-96.934508,33.953748],[-96.922114,33.959579],[-96.9163,33.957798],[-96.907387,33.950025],[-96.899442,33.933728],[-96.895728,33.896414],[-96.88301,33.868019],[-96.866438,33.853149],[-96.85609,33.84749],[-96.761588,33.824406],[-96.712422,33.831633],[-96.707274,33.835398],[-96.700952,33.840748],[-96.694629,33.849988],[-96.68928,33.86166],[-96.685389,33.872846],[-96.682471,33.883059],[-96.67858,33.892786],[-96.672258,33.899595],[-96.65864,33.900081],[-96.646968,33.895218],[-96.633351,33.889382],[-96.622165,33.885977],[-96.615356,33.881114],[-96.613494,33.878321],[
2-96.611466,33.875278],[-96.612963,33.867651],[-96.615843,33.853393],[-96.61487,33.841234],[-96.612925,33.833939],[-96.500268,33.772583],[-96.448045,33.781031],[-96.436455,33.78005],[-96.423362,33.776365],[-96.378473,33.726648],[-96.36959,33.716809],[-96.304675,33.745901],[-96.229859,33.74832],[-96.220521,33.74739],[-96.1999,33.752117],[-96.181704,33.758504],[-96.170055,33.76917],[-96.1641,33.784261],[-96.156717,33.813324],[-96.14807,33.837799],[-96.097526,33.847544],[-95.949935,33.857452],[-95.846334,33.841136],[-95.82468,33.837726],[-95.763622,33.847954],[-95.757156,33.867293],[-95.599678,33.934247],[-95.567022,33.932697],[-95.559414,33.930179],[-95.549145,33.90795],[-95.549475,33.901311],[-95.552331,33.89442],[-95.552085,33.888422],[-95.548325,33.882744],[-95.544346,33.880111],[-95.445751,33.86885],[-95.407795,33.866308],[-95.339758,33.868752],[-95.310475,33.871481],[-95.287565,33.873617],[-95.260815,33.887653],[-95.255541,33.892047],[-95.249922,33.902024],[-95.2482,33.912327],[-95.249807,33.922241],[-95.253623,33.92971],[-95.252906,33.933648],[-95.231113,33.960361],[-95.226393,33.961954],[-95.219358,33.961567],[-95.155981,33.944027],[-95.129572,33.936718],[-95.067253,33.917351],[-95.063459,33.91404],[-95.062284,33.903618],[-95.039452,33.860621],[-94.8693,33.745871],[-94.822473,33.732716],[-94.760604,33.727054],[-94.746096,33.703016],[-94.735128,33.691267],[-94.660964,33.660322],[-94.52838,33.615995],[-94.524055,33.615765],[-94.490684,33.625586],[-94.487611,33.628544],[-94.485875,33.637867],[-94.478366,33.620847],[-94.470963,33.60594],[-94.464336,33.598819],[-94.409329,33.568265],[-94.355945,33.54318],[-94.257801,33.582508],[-94.252656,33.586144],[-94.181805,33.593217],[-94.085243,33.575546],[-94.066846,33.568909],[-94.04345,33.552253],[-94.043428,33.551425],[-94.043375,33.542315],[-94.043009,33.493039],[-94.043279,33.49103],[-94.043188,33.470324],[-94.042988,33.435824],[-94.042988,33.431024],[-94.042887,33.420225],[-94.043053,33.377716],[-94.042869,33.37117],[-94.043128,33.358757],[-94.043067,33.352097],[-94.043067,33.347351],[-94.043067,33.330498],[-94.04299,33.271243],[-94.04299,33.271227],[-94.04305,33.260904],[-94.043004,33.250128],[-94.04273,33.241823],[-94.042876,33.215219],[-94.042892,33.202666],[-94.042875,33.199785],[-94.043185,33.143476],[-94.043077,33.138162],[-94.043007,33.13389],[-94.04287,33.092727],[-94.043036,33.079485],[-94.042964,33.019219],[-94.043088,32.955592],[-94.043067,32.937903],[-94.043092,32.910021],[-94.042885,32.898911],[-94.042859,32.892771],[-94.042886,32.881089],[-94.042886,32.880965],[-94.043025,32.880446],[-94.042785,32.871486],[-94.043026,32.797476],[-94.042747,32.786973],[-94.042829,32.785277],[-94.042938,32.780558],[-94.043027,32.776863],[-94.042947,32.767991],[-94.043147,32.693031],[-94.043147,32.69303],[-94.042913,32.655127],[-94.04278,32.643466],[-94.042824,32.640305],[-94.042926,32.622015],[-94.042929,32.61826],[-94.042919,32.610142],[-94.043083,32.564261],[-94.043142,32.559502],[-94.043081,32.513613],[-94.042885,32.505145],[-94.042911,32.492852],[-94.043089,32.486561],[-94.043072,32.4843],[-94.042955,32.480261],[-94.042995,32.478004],[-94.042902,32.472906],[-94.042875,32.471348],[-94.042903,32.470386],[-94.042908,32.439891],[-94.042986,32.435507],[-94.042899,32.400659],[-94.042923,32.399918],[-94.042901,32.392283],[-94.042763,32.373332],[-94.042739,32.363559],[-94.042733,32.269696],[-94.042732,32.26962],[-94.042662,32.218146],[-94.042621,32.196005],[-94.042566,32.166894],[-94.042539,32.166826],[-94.042591,32.158097],[-94.042681,32.137956],[-94.042337,32.119914],[-94.0427,32.056012],[-94.04272,31.999265],[-94.01563,31.979856],[-93.975377,31.92366],[-93.932135,31.893672],[-93.92029,31.888651],[-93.889193,31.856819],[-93.878225,31.844276],[-93.840029,31.800596],[-93.812477,31.715246],[-93.817059,31.671694],[-93.82629,31.614903],[-93.834924,31.586211],[-93.834923,31.58621],[-93.818582,31.554826],[-93.798087,31.534044],[-93.729613,31.487922],[-93.695866,31.409392],[-93.670182,31.387184],[-93.640805,31.372546],[-93.671676,31.299586],[-93.644407,31.27711],[-93.620829,31.271299],[-93.614402,31.260869],[-93.608158,31.227835],[-93.607243,31.204806],[-93.602315,31.181742],[-93.599705,31.176456],[-93.598828,31.174679],[-93.588503,31.165581],[-93.579215,31.167422],[-93.552649,31.185575],[-93.55254,31.185605],[-93.548931,31.186601],[-93.535097,31.185614],[-93.531744,31.180817],[-93.527644,31.074509],[-93.540354,31.008135],[-93.530936,30.924534],[-93.554576,30.87747],[-93.55497,30.876685],[-93.558617,30.869424],[-93.558672,30.868829],[-93.563292,30.818503],[-93.578395,30.802047],[-93.727844,30.57407],[-93.740045,30.538765],[-93.710117,30.5064],[-93.697828,30.443838],[-93.698302,30.438657],[-93.702665,30.429947],[-93.741701,30.403007],[-93.751437,30.396288],[-93.757654,30.390423],[-93.765822,30.333318],[-93.735896,30.29944],[-93.723586,30.294951],[-93.720575,30.295961],[-93.716223,30.244318],[-93.712008,30.194304],[-93.695252,30.1476],[-93.695684,30.135729],[-93.712101,30.067346],[-93.721589,30.051939],[-93.722481,30.050898],[-93.752038,30.016403],[-93.75663,30.014163],[-93.789431,29.987812],[-93.840799,29.914423],[-93.890679,29.843159],[-93.89847,29.771577],[-93.892246,29.765241],[-93.837971,29.690619],[-93.852868,29.675885],[-93.866981,29.673085],[-93.88999,29.674013],[-93.931,29.679612],[-94.001406,29.681486],[-94.056506,29.671163],[-94.132577,29.646217],[-94.354163,29.561459],[-94.370866,29.55507],[-94.500807,29.505367],[-94.594853,29.467903],[-94.631084,29.451464],[-94.670389,29.43078],[-94.694158,29.415632],[-94.708473,29.403049],[-94.723959,29.383268],[-94.731047,29.369141],[-94.744834,29.3
269158],[-94.761491,29.361883],[-94.778691,29.361483],[-94.782356,29.364266],[-94.783131,29.375642],[-94.766848,29.393489],[-94.7541,29.401],[-94.723818,29.426536],[-94.706365,29.436805],[-94.686386,29.466509],[-94.681541,29.471389],[-94.6724,29.476843],[-94.665853,29.478401],[-94.656737,29.478033],[-94.645948,29.473769],[-94.628217,29.475986],[-94.608557,29.483345],[-94.594211,29.492127],[-94.59544,29.507669],[-94.591407,29.513858],[-94.580274,29.525295],[-94.566674,29.531988],[-94.55399,29.529559],[-94.546994,29.524379],[-94.532348,29.5178],[-94.511045,29.51965],[-94.495025,29.525031],[-94.503429,29.54325],[-94.509487,29.54259],[-94.511086,29.542971],[-94.522421,29.545672],[-94.523743,29.545987],[-94.526336,29.552634],[-94.532021,29.558379],[-94.541108,29.567561],[-94.542532,29.569],[-94.546385,29.572048],[-94.553988,29.573882],[-94.570006,29.572232],[-94.570593,29.571878],[-94.570867,29.571713],[-94.578211,29.567281],[-94.593518,29.561319],[-94.610147,29.556947],[-94.618028,29.554875],[-94.621819,29.553878],[-94.621953,29.553843],[-94.62589,29.552808],[-94.682706,29.539825],[-94.689353,29.538306],[-94.691625,29.537787],[-94.718276,29.533547],[-94.740699,29.525858],[-94.755514,29.524776],[-94.757689,29.524617],[-94.757788,29.524626],[-94.757883,29.524635],[-94.767246,29.525523],[-94.768676,29.525659],[-94.769418,29.525988],[-94.769573,29.526057],[-94.77084,29.526618],[-94.774571,29.528271],[-94.774798,29.528372],[-94.779674,29.530533],[-94.779708,29.530548],[-94.779831,29.530602],[-94.780938,29.531093],[-94.783296,29.535314],[-94.784034,29.536635],[-94.786512,29.541073],[-94.786649,29.541319],[-94.78954,29.546494],[-94.790605,29.548401],[-94.779439,29.549472],[-94.771053,29.548439],[-94.755237,29.562782],[-94.734626,29.584046],[-94.708741,29.625226],[-94.693154,29.694453],[-94.692434,29.70361],[-94.695317,29.723052],[-94.724616,29.774766],[-94.735271,29.785433],[-94.740919,29.787081],[-94.771512,29.773889],[-94.792238,29.767433],[-94.816085,29.75671],[-94.851108,29.721373],[-94.865007,29.695337],[-94.867438,29.678768],[-94.872551,29.67125],[-94.893107,29.661336],[-94.915413,29.656614],[-94.921318,29.658178],[-94.931154,29.673874],[-94.934167,29.678682],[-94.936089,29.692704],[-94.942681,29.697778],[-94.965963,29.70033],[-94.972666,29.68487],[-94.988924,29.672202],[-95.005398,29.659366],[-95.005648,29.658985],[-95.006381,29.657871],[-95.007623,29.65598],[-95.011025,29.650803],[-95.011683,29.649802],[-95.01272,29.647088],[-95.013777,29.644322],[-95.015636,29.639457],[-95.0156,29.639285],[-95.013623,29.62979],[-95.013499,29.629194],[-95.01166,29.627768],[-95.000781,29.619331],[-95.00046,29.619082],[-94.999481,29.618323],[-94.999082,29.618014],[-94.988871,29.610095],[-94.984831,29.604361],[-94.982936,29.60167],[-94.982706,29.601344],[-94.982855,29.601103],[-94.982923,29.600992],[-94.988993,29.591155],[-95.00767,29.574257],[-95.016145,29.559336],[-95.016353,29.55897],[-95.016627,29.558487],[-95.016672,29.558388],[-95.018253,29.554885],[-95.018198,29.554618],[-95.018191,29.554584],[-95.016889,29.548303],[-95.015165,29.539989],[-95.013378,29.537822],[-94.999581,29.521093],[-94.981916,29.511141],[-94.958443,29.505013],[-94.934876,29.501079],[-94.933483,29.500847],[-94.933039,29.500773],[-94.909898,29.49691],[-94.909465,29.496838],[-94.913385,29.487254],[-94.925914,29.469047],[-94.930861,29.450504],[-94.919401,29.448031],[-94.8908,29.433432],[-94.8873,29.415132],[-94.886536,29.366386],[-94.894234,29.338],[-94.893994,29.30817],[-94.886536,29.297826],[-94.875952,29.293015],[-94.865126,29.293977],[-94.84973,29.297345],[-94.824953,29.306005],[-94.822547,29.321882],[-94.822307,29.344254],[-94.810696,29.353435],[-94.784895,29.335535],[-94.779995,29.334935],[-94.777064,29.336811],[-94.745529,29.334235],[-94.744945,29.33641],[-94.73132,29.338066],[-94.72253,29.331446],[-94.731082,29.331833],[-94.769695,29.304936],[-94.786095,29.290737],[-94.803695,29.279237],[-95.026219,29.148064],[-95.081773,29.111222],[-95.110484,29.088224],[-95.119271,29.077844],[-95.122525,29.074],[-95.125134,29.067321],[-95.191391,29.02309],[-95.238924,28.988644],[-95.272266,28.961546],[-95.297147,28.934073],[-95.309704,28.928262],[-95.353451,28.898145],[-95.376979,28.87616],[-95.38239,28.866348],[-95.416174,28.859482],[-95.439594,28.859022],[-95.486769,28.836287],[-95.507041,28.824755],[-95.568136,28.789998],[-95.812504,28.664942],[-95.884026,28.633098],[-96.000682,28.588238],[-96.077868,28.556626],[-96.194412,28.502224],[-96.220376,28.491966],[-96.244751,28.475055],[-96.270391,28.46193],[-96.303212,28.441871],[-96.32156,28.425148],[-96.328817,28.423659],[-96.341617,28.417334],[-96.371117,28.397661],[-96.372101,28.393875],[-96.370717,28.387667],[-96.378616,28.383909],[-96.379372,28.386089],[-96.381864,28.393276],[-96.37596,28.401682],[-96.374138,28.404275],[-96.335119,28.437795],[-96.268341,28.477992],[-96.223825,28.495067],[-96.218978,28.500383],[-96.21505,28.509679],[-96.145448,28.544741],[-96.104735,28.559499],[-96.046211,28.58698],[-96.032979,28.589016],[-96.007534,28.599703],[-95.98616,28.606319],[-95.982088,28.614461],[-95.985651,28.621077],[-95.983106,28.641942],[-95.978526,28.650594],[-95.986066,28.655468],[-95.996338,28.658736],[-96.002954,28.656192],[-96.006516,28.648049],[-96.033488,28.652629],[-96.047737,28.649067],[-96.072165,28.635326],[-96.099137,28.624639],[-96.148501,28.611408],[-96.187178,28.593596],[
2-96.198374,28.58698],[-96.221784,28.580364],[-96.228909,28.580873],[-96.233998,28.596649],[-96.233998,28.601738],[-96.222293,28.607336],[-96.21415,28.613443],[-96.212624,28.622604],[-96.230944,28.641433],[-96.208552,28.662298],[-96.214659,28.665352],[-96.192267,28.687744],[-96.19125,28.69436],[-96.19583,28.69894],[-96.202446,28.700976],[-96.222802,28.698431],[-96.231453,28.696395],[-96.256899,28.68469],[-96.263515,28.683673],[-96.268604,28.688762],[-96.287942,28.683164],[-96.304227,28.671459],[-96.305245,28.660263],[-96.303718,28.644996],[-96.322921,28.64186],[-96.328655,28.640924],[-96.373439,28.626675],[-96.376492,28.620059],[-96.384635,28.615988],[-96.473694,28.57324],[-96.487943,28.569677],[-96.482854,28.580364],[-96.480309,28.596649],[-96.485907,28.607845],[-96.490488,28.610899],[-96.510844,28.61497],[-96.510335,28.617515],[-96.497612,28.625148],[-96.496595,28.630746],[-96.499648,28.635835],[-96.506264,28.63838],[-96.54545,28.645505],[-96.555119,28.646013],[-96.563262,28.644487],[-96.572931,28.667897],[-96.570386,28.674003],[-96.55919,28.687235],[-96.559699,28.691306],[-96.561226,28.696395],[-96.566824,28.697922],[-96.575141,28.702837],[-96.577727,28.704365],[-96.57802,28.704538],[-96.579639,28.712312],[-96.579669,28.712455],[-96.580564,28.716752],[-96.584091,28.722798],[-96.584127,28.722859],[-96.584196,28.722877],[-96.591647,28.724838],[-96.593796,28.725403],[-96.604921,28.72221],[-96.634419,28.713743],[-96.634912,28.713601],[-96.645867,28.710457],[-96.648758,28.709627],[-96.655528,28.704167],[-96.664534,28.696904],[-96.657918,28.687744],[-96.635018,28.668914],[-96.634,28.654665],[-96.627893,28.650085],[-96.623313,28.649576],[-96.615679,28.644487],[-96.61059,28.638889],[-96.61059,28.636344],[-96.61975,28.627693],[-96.622804,28.622095],[-96.611099,28.585962],[-96.608045,28.583418],[-96.573949,28.584436],[-96.565297,28.5824],[-96.564279,28.576293],[-96.561226,28.570695],[-96.536289,28.559499],[-96.526111,28.557972],[-96.52204,28.55441],[-96.514406,28.535071],[-96.505755,28.525911],[-96.450284,28.490796],[-96.419749,28.467387],[-96.410589,28.459244],[-96.402446,28.449066],[-96.403973,28.44245],[-96.46148,28.421585],[-96.481836,28.407844],[-96.504737,28.397666],[-96.520513,28.394104],[-96.542905,28.385452],[-96.559699,28.377819],[-96.570386,28.368658],[-96.59176,28.357462],[-96.600412,28.354409],[-96.650794,28.346775],[-96.672677,28.335579],[-96.688453,28.347284],[-96.69456,28.347284],[-96.698122,28.342704],[-96.705247,28.348811],[-96.700158,28.369676],[-96.705756,28.400211],[-96.710336,28.406827],[-96.72255,28.408862],[-96.749013,28.408862],[-96.762245,28.411916],[-96.76696,28.410737],[-96.768352,28.410389],[-96.772209,28.408074],[-96.775985,28.405809],[-96.780796,28.398421],[-96.790235,28.383926],[-96.794554,28.365688],[-96.794796,28.364668],[-96.794815,28.364587],[-96.794812,28.364515],[-96.794812,28.364503],[-96.794357,28.350865],[-96.794306,28.34932],[-96.794016,28.347249],[-96.793926,28.346606],[-96.793835,28.345959],[-96.793765,28.345453],[-96.79254,28.336705],[-96.790744,28.323874],[-96.791159,28.319095],[-96.791761,28.31217],[-96.806011,28.296902],[-96.809573,28.290287],[-96.806011,28.282144],[-96.799302,28.272716],[-96.787181,28.255681],[-96.787181,28.250083],[-96.800413,28.224128],[-96.810037,28.217086],[-96.842143,28.193594],[-96.872678,28.176291],[-96.898123,28.152881],[-96.910337,28.147283],[-96.934765,28.123873],[-96.962755,28.123365],[-97.000414,28.137614],[-97.007539,28.136087],[-97.027386,28.124382],[-97.028913,28.117258],[-97.022806,28.107588],[-97.023824,28.103517],[-97.031966,28.093848],[-97.035528,28.084688],[-97.035528,28.074],[-97.031457,28.053644],[-97.025859,28.041939],[-97.030948,28.033288],[-97.040618,28.028708],[-97.04876,28.022092],[-97.061992,27.996138],[-97.075732,27.986977],[-97.121534,27.923364],[-97.129168,27.919801],[-97.134801,27.902467],[-97.135783,27.899445],[-97.136615,27.898956],[-97.144435,27.894356],[-97.155122,27.880615],[-97.183455,27.833231],[-97.184639,27.831251],[-97.186709,27.825453],[-97.186871,27.825001],[-97.187183,27.824126],[-97.188866,27.823772],[-97.192874,27.822928],[-97.193701,27.822754],[-97.196852,27.822091],[-97.209127,27.822091],[-97.209575,27.822091],[-97.211226,27.822391],[-97.219738,27.823939],[-97.220771,27.824126],[-97.222212,27.824649],[-97.222957,27.824919],[-97.225176,27.825723],[-97.225435,27.826145],[-97.225811,27.826755],[-97.226012,27.827083],[-97.227317,27.829204],[-97.227317,27.830939],[-97.227317,27.831258],[-97.227317,27.832895],[-97.227317,27.832952],[-97.226514,27.838307],[-97.228388,27.843
2661],[-97.234512,27.849063],[-97.241127,27.857714],[-97.241393,27.858953],[-97.242654,27.864839],[-97.242922,27.865208],[-97.250797,27.876035],[-97.256394,27.877901],[-97.258305,27.878538],[-97.26301,27.880106],[-97.272253,27.881427],[-97.273698,27.881633],[-97.276632,27.881144],[-97.285466,27.879672],[-97.295072,27.878071],[-97.301455,27.875907],[-97.317892,27.870335],[-97.325097,27.867893],[-97.327494,27.866405],[-97.354614,27.849572],[-97.360212,27.85059],[-97.360547,27.850363],[-97.361246,27.849891],[-97.379042,27.837867],[-97.391764,27.813948],[-97.393291,27.782905],[-97.386166,27.76662],[-97.368355,27.741683],[-97.34698,27.725398],[-97.316446,27.712676],[-97.253955,27.696696],[-97.259957,27.679597],[-97.266064,27.678579],[-97.296598,27.613947],[-97.298634,27.604787],[-97.297616,27.59868],[-97.294054,27.5941],[-97.302196,27.585957],[-97.321535,27.571199],[-97.325118,27.560927],[-97.336802,27.527433],[-97.343418,27.517764],[-97.347489,27.503005],[-97.350543,27.478578],[-97.359194,27.458221],[-97.36581,27.450588],[-97.371917,27.425142],[-97.369881,27.41242],[-97.372935,27.401224],[-97.37955,27.390028],[-97.399398,27.344735],[-97.401942,27.335574],[-97.404996,27.329977],[-97.413138,27.321325],[-97.420263,27.317254],[-97.430441,27.313691],[-97.450798,27.313691],[-97.482859,27.297915],[-97.508304,27.275014],[-97.532223,27.278577],[-97.544437,27.284175],[-97.546981,27.290791],[-97.536803,27.289264],[-97.526625,27.291808],[-97.524589,27.297915],[-97.517465,27.30504],[-97.504742,27.30504],[-97.498126,27.308602],[-97.502706,27.322343],[-97.499144,27.327941],[-97.483877,27.338628],[-97.483877,27.351351],[-97.48693,27.358984],[-97.501688,27.366618],[-97.514411,27.361529],[-97.520518,27.352877],[-97.53833,27.335574],[-97.5709,27.315727],[-97.584132,27.30962],[-97.609068,27.285193],[-97.621791,27.287228],[-97.63146,27.28621],[-97.636549,27.282139],[-97.63668,27.281727],[-97.640111,27.270943],[-97.639094,27.253131],[-97.635022,27.247024],[-97.628916,27.242953],[-97.597363,27.242444],[-97.582605,27.240409],[-97.573953,27.238882],[-97.561231,27.232775],[-97.54291,27.229213],[-97.520009,27.231248],[-97.509831,27.23532],[-97.503215,27.2399],[-97.500162,27.24448],[-97.485149,27.250841],[-97.467083,27.25364],[-97.458431,27.259493],[-97.450289,27.262546],[-97.42408,27.264073],[-97.422299,27.257712],[-97.434767,27.202241],[-97.444945,27.144734],[-97.443673,27.116235],[-97.452324,27.115217],[-97.455887,27.110383],[-97.45665,27.099695],[-97.461739,27.095624],[-97.47548,27.098423],[-97.480569,27.102494],[-97.49151,27.101222],[-97.495836,27.094098],[-97.493291,27.078067],[-97.477515,27.066108],[-97.479042,27.0628],[-97.482257,27.061942],[-97.48693,27.057711],[-97.487693,27.053639],[-97.486676,27.03481],[-97.477515,27.03252],[-97.473953,27.029212],[-97.473444,27.02285],[-97.478533,26.999186],[-97.480569,26.997659],[-97.484131,27.000458],[-97.536803,26.999695],[-97.549271,26.995878],[-97.555378,26.99028],[-97.551053,26.980865],[-97.549526,26.965344],[-97.552325,26.952112],[-97.555378,26.947277],[-97.555378,26.93888],[-97.540874,26.90631],[-97.540111,26.900967],[-97.547999,26.895114],[-97.552325,26.888499],[-97.552325,26.867633],[-97.558432,26.864325],[-97.563266,26.842188],[-97.552579,26.827938],[-97.547745,26.824631],[-97.537566,26.824885],[-97.509831,26.803511],[-97.484385,26.763562],[-97.478024,26.7572],[-97.471663,26.758727],[-97.468609,26.740915],[-97.467337,26.710126],[-97.444945,26.633535],[-97.445708,26.609362],[-97.441206,26.599901],[-97.428151,26.572466],[-97.416955,26.553637],[-97.422299,26.520303],[-97.425861,26.516741],[-97.430696,26.506563],[-97.430696,26.494603],[-97.42637,26.484425],[-97.429169,26.478064],[-97.43553,26.470176],[-97.441383,26.466614],[-97.441383,26.455418],[-97.437566,26.44982],[-97.425861,26.446003],[-97.421026,26.446766],[-97.41721,26.44982],[-97.411612,26.447275],[-97.412884,26.433026],[-97.42179,26.417249],[-97.4195,26.413178],[-97.406014,26.409107],[-97.398126,26.410888],[-97.394309,26.41445],[-97.395072,26.417249],[-97.382485,26.411326],[-97.377769,26.409107],[-97.369627,26.394603],[-97.374461,26.380862],[-97.388965,26.36585],[-97.392019,26.339386],[-97.391001,26.332262],[-97.387947,26.330481],[-97.376242,26.336333],[-97.372171,26.339895],[-97.369372,26.348547],[-97.358176,26.356435],[-97.343418,26.359234],[-97.335275,26.355672],[-97.330441,26.350582],[-97.336802,26.331753],[-97.352833,26.318521],[-97.354359,26.313941],[-97.34698,26.311396],[-97.347489,26.292821],[
2-97.343927,26.267376],[-97.341128,26.265595],[-97.331967,26.265595],[-97.322807,26.271956],[-97.311866,26.273737],[-97.307031,26.253126],[-97.308049,26.249055],[-97.32128,26.236078],[-97.32128,26.228699],[-97.304486,26.20249],[-97.296598,26.200709],[-97.294817,26.192312],[-97.296089,26.182388],[-97.306776,26.159487],[-97.296598,26.142439],[-97.28536,26.128378],[-97.282094,26.120301],[-97.283112,26.117757],[-97.294054,26.11394],[-97.295072,26.108342],[-97.279804,26.092057],[-97.270898,26.086459],[-97.24698,26.080352],[-97.208048,26.079589],[-97.199651,26.077044],[-97.195071,26.04193],[-97.204995,26.030225],[-97.214918,26.030734],[-97.224842,26.027426],[-97.226114,26.024372],[-97.219244,25.996128],[-97.216954,25.993838],[-97.208557,25.991802],[-97.195834,25.993074],[-97.17446,26.000072],[-97.167208,26.007069],[-97.162755,26.014576],[-97.162628,26.023482],[-97.172043,26.044729],[-97.178659,26.045492],[-97.18273,26.053126],[-97.164982,26.063876],[-97.152009,26.062108],[-97.15321,26.038906],[-97.151922,26.017653],[-97.145567,25.971132],[-97.172633,25.962883],[-97.228025,25.958936],[-97.271382,25.951832],[-97.348275,25.931143],[-97.362345,25.915724],[-97.367045,25.903021],[-97.366723,25.885066],[-97.408357,25.856459],[-97.496861,25.880058],[-97.511161,25.887458],[-97.582565,25.937857],[-97.668099,26.022522],[-97.671568,26.033955],[-97.863056,26.061273],[-97.888699,26.064931],[-98.008307,26.061147],[-98.011883,26.056608],[-98.044517,26.043746],[-98.132605,26.057507],[-98.241664,26.074544],[-98.264514,26.085507],[-98.386694,26.157872],[-98.438822,26.212022],[-98.466167,26.223245],[-98.58581,26.257403],[-98.58672,26.257456],[-98.623335,26.259592],[-98.6329,26.250348],[-98.705676,26.27748],[-98.751164,26.331307],[-98.807348,26.369421],[-98.822373,26.370902],[-98.861354,26.36599],[-99.047575,26.406922],[-99.105719,26.43872],[-99.167996,26.557799],[-99.172058,26.57086],[-99.208951,26.689489],[-99.242444,26.788262],[-99.268613,26.843213],[-99.321819,26.906846],[-99.379149,26.93449],[-99.446524,27.023008],[-99.452316,27.062669],[-99.451035,27.066765],[-99.446593,27.070593],[-99.429879,27.094323],[-99.426348,27.176262],[-99.441549,27.24992],[-99.452391,27.264046],[-99.453949,27.264673],[-99.463309,27.268437],[-99.47088,27.265444],[-99.494678,27.277595],[-99.529654,27.306051],[-99.536443,27.312538],[-99.537771,27.316073],[-99.50696,27.35642],[-99.492831,27.390491],[-99.487704,27.409924],[-99.480219,27.485796],[-99.519381,27.573569],[-99.541644,27.605772],[-99.600619,27.641314],[-99.623478,27.644136],[-99.626294,27.64245],[-99.627123,27.638412],[-99.666175,27.638324],[-99.843463,27.77456],[-99.876174,27.806276],[-99.901486,27.864162],[-99.904385,27.875284],[-99.895828,27.904178],[-99.922046,27.922119],[-99.991447,27.99456],[-100.057049,28.095656],[-100.080868,28.137192],[-100.083393,28.144035],[-100.088143,28.147503],[-100.14414,28.168238],[-100.171323,28.17623],[-100.202448,28.190554],[-100.209464,28.196866],[-100.257788,28.240341],[-100.291391,28.275398],[-100.346986,28.407232],[-100.333814,28.499252],[-100.338518,28.501833],[-100.386963,28.514023],[-100.405058,28.53578],[-100.429856,28.596441],[-100.446659,28.608659],[-100.500354,28.66196],[-100.510055,28.690723],[-100.511998,28.705352],[-100.506701,28.716745],[-100.507613,28.740599],[-100.535438,28.8
205195],[-100.546804,28.825374],[-100.589854,28.861618],[-100.640092,28.915833],[-100.651512,28.943432],[-100.648104,28.98386],[-100.645894,28.986421],[-100.664065,29.073206],[-100.668356,29.08397],[-100.674656,29.099777],[-100.793662,29.242146],[-100.797671,29.246943],[-100.954042,29.347598],[-100.995607,29.363403],[-101.037642,29.414681],[-101.043364,29.42988],[-101.060151,29.458661],[-101.087149,29.469414],[-101.137503,29.473542],[-101.235275,29.524854],[-101.247319,29.618482],[-101.250383,29.624171],[-101.314135,29.659054],[-101.343743,29.662047],[-101.403926,29.757587],[-101.455007,29.770188],[-101.625958,29.771063],[-101.635128,29.758675],[-101.646418,29.754304],[-101.761839,29.777187],[-101.786353,29.782047],[-101.883655,29.796193],[-101.944913,29.801468],[-102.040539,29.790061],[-102.050044,29.78507],[-102.116076,29.792527],[-102.262466,29.853765],[-102.282247,29.863598],[-102.297331,29.875194],[-102.320819,29.875193],[-102.323389,29.875193],[-102.364647,29.843624],[-102.386677,29.76148],[-102.404422,29.765105],[-102.434063,29.7767],[-102.486819,29.786725],[-102.500741,29.781446],[-102.554915,29.748966],[-102.612879,29.748182],[-102.665194,29.737421],[-102.689738,29.722349],[-102.698347,29.695591],[-102.745494,29.592967],[-102.781807,29.542454],[-102.808692,29.522319],[-102.831938,29.437943],[-102.83332,29.408981],[-102.875813,29.353715],[-102.895886,29.284778],[-102.886308,29.24568],[-102.881135,29.246022],[-102.871347,29.241625],[-102.866846,29.225015],[-102.87802,29.214698],[-102.95089,29.176835],[-102.995688,29.161219],[-103.10443,29.03359],[-103.115328,28.98527],[-103.156646,28.972831],[-103.163865,28.972099],[-103.281903,28.990089],[-103.383508,29.024112],[-103.471037,29.075368],[-103.470518,29.085108],[-103.503236,29.11911],[-103.525471,29.137744],[-103.558679,29.154962],[-103.61007,29.165727],[-103.627067,29.163336],[-103.714867,29.184137],[-103.767814,29.224954],[-103.792005,29.262695],[-103.792705,29.262931],[-103.838303,29.278304],[-103.924976,29.293913],[-103.963076,29.298404],[-104.025488,29.314404],[-104.143692,29.383278],[-104.167506,29.402928],[-104.21341,29.462069],[-104.235847,29.496744],[-104.264155,29.514001],[-104.290728,29.519326],[-104.321603,29.527923],[-104.394351,29.560535],[-104.515512,29.641493],[-104.538569,29.677396],[-104.549773,29.716091],[-104.549117,29.728814],[-104.566055,29.771379],[-104.633275,29.870485],[-104.667301,29.910401],[-104.674932,29.911112],[-104.679877,29.920946],[-104.693592,30.019077],[-104.685793,30.092656],[-104.687296,30.179464],[-104.708916,30.235826],[-104.761634,30.301148],[-104.78102,30.314564],[-104.859521,30.390413],[-104.872808,30.500145],[-104.929778,30.59924],[-104.972071,30.61026],[-104.985365,30.623792],[-105.044407,30.683895],[-105.129328,30.750139],[-105.211234,30.799609],[-105.250028,30.799068],[-105.265479,30.802536],[-105.394627,30.85892],[-105.411833,30.893367],[-105.55679,30.989469],[-105.57765,31.019811],[-105.579756,31.036588],[-105.585323,31.057488],[-105.60333,31.082625],[-105.648834,31.115902],[-105.709491,31.136375],[-105.750519,31.16494],[-105.793719,31.201713],[-105.869353,31.288634],[-105.900315,31.300008],[-105.923131,31.312089],[-105.981027,31.375122],[-105.997658,31.386489],[-106.00693,31.392826],[-106.099393,31.41476],[-106.132782,31.425367],[-106.202851,31.464073],[-106.206018,31.466648],[-106.207524,31.467872],[-106.2092,31.469234],[-106.212918,31.473409],[-106.218538,31.47972],[-106.254062,31.547512],[-106.356938,31.70221],[-106.381039,31.73211],[-106.41794,31.752009],[-106.436743,31.756872],[-106.472514,31.751802],[-106.528543,31.783907],[-106.528543,31.784407],[-106.527997,31.786945],[-106.527623,31.789119],[-106.527738,31.789761],[-106.527943,31.790507],[-106.530515,31.792103],[-106.53248,31.791914],[-106.533,31.791829],[-106.533043,31.791907],[-106.534743,31.796107],[-106.535154,31.797089],[-106.535343,31.797507],[-106.535843,31.798607],[-106.542097,31.802146],[-106.542144,31.802107],[-106.544714,31.804287],[-106.545344,31.805007],[-106.563444,31.812606],[-106.566844,31.813306],[-106.605245,31.845905],[-106.605845,31.846305],[-106.614637,31.84649],[-106.621857,31.852854],[-106.625763,31.856276],[-106.627808,31.860593],[-106.616136,31.948439],[-106.614702,31.956],[-106.599096,32.000731],[-106.598639,32.000754],[-106.595333,32.000778],[-106.587972,32.000749],[-106.566056,32.000759],[-106.565142,32.000736],[-106.411075,32.001334],[-106.394298,32.001484],[-106.377174,32.00149],[-106.313307,32.001512],[-106.205915,32.001762],[-106.200699,32.001785],[-106.18184,32.00205],[-106.09976,32.002174],[-105.998003,32.002328],[-105.9006,32.0021],[-105.886159,32.00197],[-105.429281,32.000577],[-105.428582,32.0006],[-105.427049,32.000638],[-105.390396,32.000607],[-105.153994,32.000497],[-105.15031,32.000497],[-105.14824,32.000485],[-105.132916,32.000518],[-105.131377,32.000524],[-105.11804,32.000485],[-105.078605,32.000533],[-105.077046,32.000579],[-104.918272,32.000496],[-104.847757,32.000482],[-104.643526,32.000443],[-104.640918,32.000396],[-104.531937,32.000311],[-104.531756,32.000117],[-104.024521,32.00001],[-103.980179,32.000125],[-103.722853,32.000221],[-103.326501,32.00037],[-103.278521,32.000419],[-103.270383,32.000326],[-103.267708,32.000324],[-103.267633,32.000475],[-103.215641,32.000513],[-103.088698,32.000453],[-103.085876,32.000465],[-103.064423,32.000518],[-103.064344,32.087051],[-103.064348,32.123041],[-103.064422,32.145006],[-103.064696,32.522193],[-103.064761,32.587983],[-103.064788,32.600397],[-103.064761,32.601863],[-103.064815,32.624537],[-103.064633,32.64642],[-103.064864,32.682647],[-103.064798,32.690761],[-103.064799,32.708694],[-103.064827,32.726628],[-103.064807,32.777303],[-103.064698,32.783602],[-103.064711,32.784593],[-103.064699,32.827531],[-103.064672,32.82847],[-103.064889,32.849359],[-103.064916,32.85726],[-103.064807,32.857696],[
2-103.064862,32.868346],[-103.064701,32.879355],[-103.064569,32.900014],[-103.064657,32.959097],[-103.064679,32.964373],[-103.064625,32.999899],[-103.064452,33.01029],[-103.06398,33.038693],[-103.063905,33.042055],[-103.060103,33.219225],[-103.057856,33.315234],[-103.057487,33.329477],[-103.056655,33.388416],[-103.056655,33.388438],[-103.05261,33.570599],[-103.051664,33.629489],[-103.051363,33.64195],[-103.051535,33.650487],[-103.051087,33.658186],[-103.050532,33.672408],[-103.050148,33.701971],[-103.049096,33.74627],[-103.047346,33.824675],[-103.046907,33.8503],[-103.045644,33.901537],[-103.045698,33.906299],[-103.044893,33.945617],[-103.04395,33.974629],[-103.043617,34.003633],[-103.043531,34.018014],[-103.043555,34.032714],[-103.043746,34.037294],[-103.043771,34.041538],[-103.043721,34.04232],[-103.043767,34.043545],[-103.043744,34.049986],[-103.043686,34.063078],[-103.043516,34.079382],[-103.043569,34.087947],[-103.043644,34.256903],[-103.043719,34.289441],[-103.043936,34.302585],[-103.043979,34.312749],[-103.043979,34.312764],[-103.043946,34.379555],[-103.043944,34.37966],[-103.043919,34.380916],[-103.043693,34.383578],[-103.04363,34.38469],[-103.043614,34.384969],[-103.043613,34.388679],[-103.043613,34.390442],[-103.043585,34.393716],[-103.043611,34.397105],[-103.043583,34.400678],[-103.043538,34.405463],[-103.043582,34.455657],[-103.043588,34.459662],[-103.043589,34.459774],[-103.043594,34.46266],[-103.043072,34.619782],[-103.042827,34.671188],[-103.042769,34.747361],[-103.04277,34.792224],[-103.042781,34.850243],[-103.042521,34.899546],[-103.042521,34.954101],[-103.04252,35.135596],[-103.0426,35.142766],[-103.042711,35.144735],[-103.042568,35.159318],[-103.042395,35.178573],[-103.042339,35.181922],[-103.042366,35.182786],[-103.042377,35.183149],[-103.042377,35.183156],[-103.042497,35.211862],[-103.041554,35.622487],[-103.041357,35.739274],[-103.040824,36.055231],[-103.041674,36.317534],[-103.041745,36.318267],[-103.041669,36.478514],[-103.002434,36.500397],[-102.162463,36.500326],[-102.032339,36.500066],[-101.826565,36.499654],[-101.826498,36.499535],[-101.78811,36.499678],[-101.783359,36.499709],[-101.781987,36.499718],[-101.78061,36.499727],[-101.779435,36.499734],[-101.709314,36.499722],[-101.698685,36.499508],[-101.653708,36.499573],[-101.649966,36.499573],[-101.623915,36.499528],[-101.085156,36.499244],[-101.052418,36.499563],[-101.045331,36.49954],[-100.977088,36.499595],[-100.954153,36.499599],[-100.936058,36.499602],[-100.918513,36.499621],[-100.884174,36.499682],[-100.88408,36.499682],[-100.859657,36.499687],[-100.85084,36.4997],[-100.824236,36.499618],[-100.824218,36.499618],[-100.80619,36.499674],[-100.806172,36.499634],[-100.802909,36.499621],[-100.802886,36.499621],[-100.761811,36.499618],[-100.761811,36.49958],[-100.724362,36.49958],[-100.724361,36.499558],[-100.708626,36.499553],[-100.708628,36.499521],[-100.657763,36.499483],[-100.657763,36.4995],[-100.648343,36.499495],[-100.648344,36.499463],[-100.592614,36.499469],[-100.592556,36.499469],[-100.592551,36.499429],[-100.583539,36.499483],[-100.583379,36.499443],[-100.578114,36.499463],[-100.578114,36.499439],[-100.546145,36.499343],[-100.531215,36.499341],[-100.531215,36.49929],[-100.530478,36.49924],[-100.530314,36.499357],[-100.522227,36.499291],[-100.441065,36.49949],[-100.441064,36.499462],[-100.433959,36.499456],[-100.421328,36.499447],[-100.421301,36.499488],[-100.413634,36.499444],[-100.41355,36.499469],[-100.378634,36.499517],[-100.378592,36.499445],[-100.351852,36.499487],[-100.351842,36.499473],[-100.334464,36.49942],[-100.334441,36.49944],[-100.32415,36.499679],[-100.311245,36.499631],[-100.311018,36.499688],[-100.310643,36.499642],[-100.181221,36.499633],[-100.090021,36.499634],[-100.003762,36.499699],[-100.000406,36.499702],[-100.000399,36.055677],[-100.000396,35.880948],[-100.000392,35.619115],[-100.000389,35.422364],[-100.000385,35.182702],[-100.000384,35.030385],[-100.000381,34.746461]]]],"type":"MultiPolygon"}},{"_id":"tennessee","type":"Feature","properties":{"name":"Tennessee","abbreviation":"TN","grid_region":"TVA"},"geometry":{"coordinates":[[[-83.472108,36.597284],[-83.2763,36.598187],[-83.250304,36.593935],[-83.249899,36.593898],[-83.248933,36.593827],[-83.028357,36.593893],[-83.02725,36.593847],[-82.985087,36.593829],[-82.830433,36.593761],[-82.69578,36.593698],[-82.679879,36.593698],[-82.609176,36.594099],[-82.561074,36.5948],[-82.559774,36.5948],[-82.554294,36.594876],[-82.293814,36.595565],[-82.243274,36.595699],[-82.226653,36.595743],[-82.225716,36.595744],[-82.223445,36.595721],[-82.221713,36.595814],[-82.211005,36.59586],[-82.210497,36.595772],[-82.188491,36.595179],[-82.18074,36.594928],[-82.177247,36.594768],[-82.173982,36.594607],[-82.150727,36.594673],[-82.148569,36.594718],[-82.14607,36.594712],[-81.934144,36.594213],[-81.922644,36.616213],[-81.826742,36.614215],[-81.6469,36.611918],[-81.677535,36.588117],[-81.699962,36.539714],[-81.707963,36.536209],[-81.700553,36.51
2519],[-81.700093,36.514158],[-81.699601,36.512883],[-81.699446,36.511504],[-81.697744,36.508448],[-81.697829,36.507544],[-81.69729,36.504887],[-81.69797,36.504063],[-81.699923,36.500865],[-81.700238,36.500475],[-81.699928,36.498018],[-81.698265,36.497221],[-81.697261,36.496141],[-81.696835,36.493393],[-81.695907,36.49158],[-81.697287,36.484738],[-81.715082,36.453365],[-81.714277,36.450978],[-81.720969,36.3875],[-81.725938,36.340364],[-81.730976,36.341187],[-81.747842,36.337356],[-81.764927,36.338672],[-81.789712,36.348324],[-81.793688,36.360428],[-81.800812,36.358073],[-81.855005,36.337259],[-81.908137,36.302013],[-81.918113,36.28711],[-81.932994,36.264881],[-81.960101,36.228131],[-82.02664,36.130222],[-82.080143,36.10572],[-82.080518,36.10571],[-82.127146,36.104417],[-82.130646,36.106417],[-82.137974,36.119576],[-82.136547,36.128817],[-82.147948,36.149516],[-82.211251,36.159012],[-82.222052,36.156911],[-82.234807,36.14172],[-82.235479,36.140748],[-82.236415,36.139926],[-82.237737,36.139189],[-82.325169,36.119363],[-82.329177,36.117427],[-82.348422,36.115929],[-82.360919,36.110614],[-82.366566,36.10765],[-82.371383,36.106388],[-82.375558,36.105609],[-82.409458,36.083409],[-82.416857,36.072885],[-82.462958,36.007309],[-82.487411,35.991634],[-82.487451,35.991557],[-82.50586,35.978342],[-82.507068,35.977475],[-82.512598,35.975664],[-82.557529,35.954671],[-82.596774,35.964987],[-82.611262,35.973155],[-82.615062,36.000306],[-82.602877,36.039833],[-82.619205,36.056556],[-82.632265,36.065705],[-82.637165,36.065805],[-82.683565,36.046104],[-82.715365,36.024253],[-82.754465,36.004304],[-82.778625,35.974792],[-82.830112,35.932972],[-82.852554,35.949089],[-82.874159,35.952698],[-82.898505,35.945101],[-82.898506,35.9451],[-82.913338,35.924113],[-82.89798,35.881278],[-82.918356,35.845467],[-82.962842,35.795126],[-82.964108,35.7941],[-82.98397,35.77801],[-82.995803,35.773128],[-83.100225,35.774765],[-83.100329,35.774804],[-83.100233,35.774745],[-83.164909,35.759965],[-83.240669,35.72676],[-83.251247,35.719916],[-83.25
25489,35.714974],[-83.250695,35.709349],[-83.254231,35.695807],[-83.297154,35.65775],[-83.366941,35.638728],[-83.445802,35.611803],[-83.479082,35.583316],[-83.478523,35.579202],[-83.480617,35.576633],[-83.485527,35.568204],[-83.498335,35.562981],[-83.640498,35.566075],[-83.662957,35.569138],[-83.676268,35.570289],[-83.756917,35.563604],[-83.880074,35.518745],[-83.933876,35.472438],[-83.952676,35.460763],[-83.952882,35.460635],[-83.961053,35.464143],[-83.961056,35.463738],[-83.961054,35.462838],[-83.9614,35.459496],[-83.999906,35.425201],[-84.00225,35.422548],[-84.024756,35.353896],[-84.035343,35.350833],[-84.037494,35.34985],[-84.038081,35.348363],[-84.03245,35.32653],[-84.032479,35.325318],[-84.02141,35.301383],[-84.02351,35.295783],[-84.029033,35.291049],[-84.055712,35.268182],[-84.097508,35.247382],[-84.115048,35.249765],[-84.115279,35.250438],[-84.12115,35.250644],[-84.124915,35.24983],[-84.202879,35.255772],[-84.211818,35.266078],[-84.223718,35.269078],[-84.227818,35.267878],[-84.29024,35.225572],[-84.292321,35.206677],[-84.308437,35.093173],[-84.308576,35.092761],[-84.321869,34.988408],[-84.393935,34.988068],[-84.394903,34.98803],[-84.509052,34.988033],[-84.509886,34.98801],[-84.621483,34.988329],[-84.727434,34.98802],[-84.731022,34.988088],[-84.775852,34.9878],[-84.808127,34.987592],[-84.809184,34.987569],[-84.810477,34.987607],[-84.810742,34.987615],[-84.817279,34.987753],[-84.820478,34.987913],[-84.82401,34.987707],[-84.831799,34.988004],[-84.858032,34.987746],[-84.861314,34.987791],[-84.939306,34.987916],[-84.94442,34.987864],[-84.955623,34.98783],[-84.976973,34.987669],[-84.97986,34.987647],[-85.045052,34.986859],[-85.045183,34.986883],[-85.180553,34.986075],[-85.185905,34.985995],[-85.216554,34.985675],[-85.217854,34.985675],[-85.220554,34.985575],[-85.221854,34.985475],[-85.230354,34.985475],[-85.235555,34.985475],[-85.254955,34.985175],[-85.265055,34.985075],[-85.275856,34.984975],[-85.277556,34.984975],[-85.2945,34.984651],[-85.301488,34.984475],[-85.305457,34.984475],[-85.308257,34.984375],[-85.363919,34.983375],[-85.474472,34.983972],[-85.605165,34.984678],[-85.824411,34.988142],[-85.828724,34.988165],[-85.863935,34.988379],[-86.311274,34.991098],[-86.318761,34.991147],[-86.397203,34.99166],[-86.433927,34.991085],[-86.467798,34.990692],[-86.528485,34.990677],[-86.555864,34.990971],[-86.571217,34.991011],[-86.588962,34.991197],[-86.600039,34.99124],[-86.641212,34.99174],[-86.65961,34.991792],[-86.670853,34.992],[-86.67436,34.992001],[-86.676726,34.99207],[-86.677616,34.99207],[-86.783628,34.991925],[-86.783648,34.991925],[-86.820657,34.991764],[-86.836306,34.991764],[-86.83637,34.991764],[-86.846466,34.99186],[-86.849794,34.991924],[-86.862147,34.991956],[-86.96712,34.9944],[-86.970236,34.994546],[-86.972613,34.99461],[-86.974412,34.994513],[-87.000007,34.995121],[-87.011174,34.995162],[-87.210759,34.999024],[-87.216683,34.999148],[-87.224053,34.999327],[-87.230544,34.999484],[-87.270014,35.00039],[-87.299185,35.000915],[-87.349251,35.001662],[-87.359281,35.001823],[-87.381071,35.002118],[-87.391314,35.002374],[-87.4174,35.002669],[-87.421543,35.002679],[-87.428613,35.002795],[-87.606031,35.003343],[-87.664123,35.003523],[-87.671405,35.003537],[-87.696834,35.003852],[-87.700543,35.003988],[-87.702321,35.003945],[-87.709491,35.004089],[-87.75889,35.004711],[-87.767602,35.004783],[-87.773586,35.004946],[-87.851886,35.005656],[-87.853411,35.005576],[-87.853528,35.005541],[-87.872626,35.005571],[-87.877742,35.005512],[-87.877969,35.005468],[-87.984916,35.006256],[-88.18245,35.007712],[-88.200064,34.995634],[-88.253825,34.995553],[-88.258111,34.995463],[-88.363531,34.99559],[-88.380508,34.99561],[-88.469801,34.996052],[-88.469877,34.996033],[-88.786612,34.995252],[-88.823049,34.995157],[-89.017128,34.994649],[-89.138997,34.99433],[-89.139136,34.994307],[-89.198288,34.994484],[-89.352679,34.99442],[-89.493739,34.994361],[-89.511153,34.994755],[-89.644282,34.995293],[-89.724324,34.994763],[-89.795187,34.994293],[-89.848488,34.994193],[-89.883365,34.994261],[-89.893402,34.994356],[-90.309297,34.995694],[-90.309877,35.00975],[-90.295596,35.040093],[-90.193859,35.061646],[-90.174594,35.116682],[-90.160058,35.12883],[-90.142794,35.135091],[-90.109393,35.118891],[-90.100593,35.116691],[-90.09061,35.118287],[-90.08342,35.12167],[-90.065392,35.137691],[-90.064612,35.140621],[-90.073354,35.211004],[-90.074262,35.2183
216],[-90.07741,35.225479],[-90.097947,35.249983],[-90.105093,35.254288],[-90.116493,35.255788],[-90.140394,35.252289],[-90.152094,35.255989],[-90.158865,35.262577],[-90.166594,35.274588],[-90.168871,35.281997],[-90.163812,35.296115],[-90.158913,35.300637],[-90.153394,35.302588],[-90.114893,35.303887],[-90.086691,35.369935],[-90.089612,35.379842],[-90.093589,35.393333],[-90.13551,35.376668],[-90.143633,35.374745],[-90.166246,35.374745],[-90.178341,35.382092],[-90.179265,35.385194],[-90.169002,35.421853],[-90.152386,35.436789],[-90.107723,35.476935],[-90.07442,35.472518],[-90.072154,35.470752],[-90.067798,35.466224],[-90.059068,35.457889],[-90.04768,35.459255],[-90.034014,35.468821],[-90.034976,35.480705],[-90.039744,35.548041],[-90.032938,35.55344],[-90.02862,35.555249],[-90.017312,35.555996],[-89.957347,35.528683],[-89.933572,35.533299],[-89.909797,35.537914],[-89.884932,35.655107],[-89.89051,35.652408],[-89.906147,35.651145],[-89.922749,35.655293],[-89.937383,35.665711],[-89.955753,35.690621],[-89.958882,35.723834],[-89.956254,35.733386],[-89.950278,35.738493],[-89.909996,35.759396],[-89.905538,35.759063],[-89.889023,35.750558],[-89.865631,35.746577],[-89.821216,35.756716],[-89.703875,35.820281],[-89.701045,35.828227],[-89.702883,35.834153],[-89.709261,35.838911],[-89.729517,35.847632],[-89.749424,35.852955],[-89.769413,35.861558],[-89.772467,35.865098],[-89.773564,35.871697],[-89.771726,35.879724],[-89.765689,35.891299],[-89.756036,35.896817],[-89.73361,35.904699],[-89.714934,35.906247],[-89.688141,35.896946],[-89.687939,35.905384],[-89.686924,35.947716],[-89.71997,35.97462],[-89.733095,36.000608],[-89.706932,36.000981],[-89.690306,36.024835],[-89.687254,36.034048],[-89.684439,36.051719],[-89.624235,36.108626],[-89.601936,36.11947],[-89.594,36.12719],[-89.591605,36.144096],[-89.594397,36.155457],[-89.607004,36.171179],[-89.618228,36.179966],[-89.629452,36.185382],[-89.699817,36.248384],[-89.691308,36.252079],[-89.678046,36.248284],[-89.602374,36.238106],[-89.589561,36.239116],[-89.541621,36.247891],[-89.534745,36.252576],[-89.535529,36.270541],[-89.539487,36.277368],[-89.544797,36.280458],[-89.554289,36.277751],[-89.578492,36.288317],[-89.611819,36.309088],[-89.620255,36.323006],[-89.6198,36.329546],[-89.615841,36.336085],[-89.610689,36.340442],[-89.605668,36.342234],[-89.581636,36.342357],[-89.560439,36.337746],[-89.545006,36.336809],[-89.531822,36.339246],[-89.519,36.3486],[-89.513178,36.359897],[-89.509558,36.375065],[-89.519501,36.475419],[-89.522674,36.481305],[-89.5391,36.498201],[-89.498036,36.497887],[-89.492537,36.497775],[-89.485106,36.497692],[-89.493495,36.4787],[-89.493198,36.470124],[-89.486215,36.46162],[-89.471718,36.457001],[-89.460436,36.45814],[-89.448468,36.46442],[-89.429311,36.481875],[-89.417293,36.499033],[-89.403913,36.499141],[-89.381792,36.500062],[-89.380085,36.500416],[-89.356593,36.502195],[-89.346056,36.50321],[-89.346053,36.50321],[-89.282298,36.506782],[-89.279091,36.506511],[-89.211409,36.50563],[-89.163429,36.504526],[-89.163224,36.504522],[-89.119805,36.503647],[-89.117537,36.503603],[-89.090146,36.503392],[-89.072118,36.503249],[-89.058871,36.503157],[-89.034649,36.502964],[-89.010439,36.50271],[-89.006825,36.502684],[-89.000063,36.502633],[-88.964471,36.502191],[-88.874725,36.502446],[-88.834866,36.502911],[-88.834626,36.502914],[-88.827301,36.502852],[-88.827012,36.50285],[-88.816765,36.502815],[-88.799594,36.502757],[-88.747523,36.502834],[-88.715255,36.502662],[-88.661133,36.502243],[-88.577283,36.50194],[-88.545192,36.501814],[-88.516427,36.50143],[-88.516346,36.501431],[-88.51227,36.501506],[-88.51192,36.501457],[-88.48921,36.501068],[-88.489075,36.501068],[-88.472564,36.501028],[-88.452543,36.500872],[-88.450161,36.501101],[-88.41636,36.500756],[-88.330799,36.500531],[-88.325895,36.500483],[-88.320794,36.500432],[-88.053292,36.49713],[-88.053205,36.497129],[-88.039481,36.510408],[-88.037822,36.51385],[-88.032489,36.540662],[-88.035625,36.561736],[-88.045127,36.602939],[-88.055604,36.63571],[-88.068208,36.659747],[-88.070532,36.678118],[-88.011792,36.677025],[-87.849567,36.663701],[-87.853204,36.633247],[-87.694186,36.636838],[-87.64115,36.638036],[
2-87.641146,36.638036],[-87.564928,36.639113],[-87.563052,36.639113],[-87.436509,36.640747],[-87.425009,36.641047],[-87.414309,36.641047],[-87.347796,36.64144],[-87.344131,36.64151],[-87.33598,36.641543],[-87.281506,36.641761],[-87.278398,36.641718],[-87.247655,36.641841],[-87.231037,36.641888],[-87.23053,36.641895],[-87.114983,36.642414],[-87.114976,36.642414],[-87.060843,36.643412],[-86.906583,36.646255],[-86.906023,36.646302],[-86.854268,36.646884],[-86.833155,36.64721],[-86.818405,36.647639],[-86.816186,36.647722],[-86.813037,36.647647],[-86.763295,36.648907],[-86.75892,36.649018],[-86.606394,36.652107],[-86.605042,36.652125],[-86.564252,36.633522],[-86.564143,36.633472],[-86.473497,36.651671],[-86.473413,36.651676],[-86.47219,36.651763],[-86.468497,36.651841],[-86.411387,36.65055],[-86.333051,36.648778],[-86.222151,36.640891],[-86.219081,36.640824],[-86.21641,36.640595],[-86.216183,36.640527],[-86.205468,36.639783],[-86.204859,36.639741],[-86.197573,36.639363],[-86.081944,36.633848],[-86.080666,36.63394],[-86.038366,36.630804],[-86.033139,36.630413],[-86.03277,36.630367],[-85.976421,36.6284],[-85.788645,36.621846],[-85.788613,36.621845],[-85.552017,36.615782],[-85.551483,36.615727],[-85.508605,36.61502],[-85.471338,36.61638],[-85.436418,36.618194],[-85.29599,36.625488],[-85.276289,36.626511],[-85.276284,36.626511],[-85.096128,36.622483],[-85.086415,36.621913],[-84.974888,36.614327],[-84.859738,36.606495],[-84.859759,36.606428],[-84.785399,36.603374],[-84.785341,36.603372],[-84.778455,36.603222],[-84.261333,36.591981],[-84.227295,36.591685],[-83.987842,36.5896],[-83.987612,36.589595],[-83.930669,36.588249],[-83.690714,36.582581],[-83.677114,36.596582],[-83.675413,36.600814],[-83.670141,36.600797],[-83.670128,36.600764],[-83.472108,36.597284]]],"type":"Polygon"}},{"_id":"california","type":"Feature","properties":{"name":"California","abbreviation":"CA","grid_region":"CAISO_NORTH"},"geometry":{"coordinates":[[[[-120.248484,33.999329],[-120.247393,34.001911],[-120.238657,34.007592],[-120.230001,34.010136],[-120.221287,34.010367],[-120.208478,34.005655],[-120.19578,34.004284],[-120.167306,34.008219],[-120.151663,34.018126],[-120.147647,34.024831],[-120.140362,34.025974],[-120.135853,34.026087],[-120.115058,34.019866],[-120.090182,34.019806],[-120.073609,34.024477],[-120.062778,34.031161],[-120.061953,34.033976],[-120.057637,34.03734],[-120.055107,34.037729],[-120.043259,34.035806],[-120.044004,34.02482],[-120.047798,34.021227],[-120.050382,34.013331],[-120.048926,34.009898],[-120.046575,34.000002],[-120.041311,33.994507],[-120.025653,33.985553],[-120.011123,33.979894],[-120.003815,33.979547],[-119.984316,33.983948],[-119.978876,33.983081],[-119.979913,33.969623],[-119.976857,33.956693],[-119.971141,33.950401],[-119.97026,33.944359],[-119.973691,33.942481],[-120.00096,33.941554],[-120.017715,33.936366],[-120.046881,33.919597],[-120.048315,33.917625],[-120.048611,33.915775],[-120.049682,33.914563],[-120.077793,33.908886],[-120.098601,33.907853],[-120.105489,33.90428],[-120.109137,33.899129],[-120.121817,33.895712],[-120.168974,33.91909],[-120.179049,33.927994],[-120.18984,33.947703],[-120.192339,33.950266],[-120.198602,33.952211],[-120.200085,33.956904],[-120.209372,33.972376],[-120.224461,33.989059],[-120.248484,33.999329]]],[[[-119.789798,34.05726],[-119.770729,34.055051],[-119.766081,34.05537],[-119.763688,34.057155],[-119.755521,34.056716],[-119.739472,34.049299],[-119.726437,34.047908],[-119.712576,34.043265],[-119.704628,34.037681],[-119.686507,34.019805],[-119.637742,34.013178],[-119.619343,34.016468],[-119.612226,34.021256],[-119.604287,34.031561],[-119.608798,34.035245],[-119.609239,34.03735],[-119.59324,34.049625],[-119.57341,34.05011],[-119.5667,34.053452],[-119.529603,34.041155],[-119.52064,34.034262],[-119.52177,34.032247],[-119.532413,34.024949],[-119.538847,34.023988],[-119.542449,34.021082],[-119.54828,34.009819],[-119.547072,34.005469],[-119.554472,33.99782],[-119.560464,33.99553],[-119.575636,33.996009],[-119.5902,33.989712],[-119.596877,33.988611],[-119.619082,33.987228],[-119.621117,33.98899],[-119.64771,33.987786],[-119.662825,33.985889],[-119.69011,33.972225],[-119.706952,33.969178],[-119.712363,33.965422],[-119.714696,33.961439],[-119.721206,33.959583],[-119.742966,33.963877],[-119.750438,33.963759],[-119.758141,33.959212],[-119.795938,33.962929],[-119.842748,33.97034],[-119.873358,33.980375],[-119.877057,33.985757],[-119.883033,34.000802],[-119.884896,34.008814],[-119.882531,34.011674],[-119.876916,34.023527],[-119.876329,34.032087],[-119.892821,34.045529],[-119.916216,34.058351],[-119.923337,34.069361],[-119.919155,34.07728],[-119.912857,34.077508],[-119.89113,34.072856],[-119.857304,34.071298],[-119.825865,34.059794],[-119.818742,34.052997],[-119.807825,34.052127],[-119.789798,34.05726]]],[[[-120.46258,34.042627],[-120.440248,34.036918],[-120.418768,34.052093],[-120.415287,34.05496],[-120.411314,34.052869],[-120.403613,34.050442],[-120.396188,34.050187],[-120.390906,34.051994],[-120.374211,34.062658],[-120.368813,34.06778],[-120.368584,34.071214],[-120.370176,34.074907],[
2-120.368278,34.076465],[-120.362251,34.073056],[-120.354982,34.059256],[-120.36029,34.05582],[-120.358608,34.050235],[-120.346946,34.046576],[-120.331161,34.049097],[-120.319032,34.041979],[-120.313175,34.036576],[-120.302122,34.023574],[-120.304543,34.021171],[-120.317052,34.018837],[-120.347706,34.020114],[-120.35532,34.017914],[-120.35793,34.015029],[-120.375143,34.018775],[-120.409368,34.032198],[-120.415225,34.032245],[-120.419021,34.028949],[-120.427408,34.025425],[-120.454134,34.028081],[-120.459635,34.031537],[-120.465329,34.038448],[-120.46258,34.042627]]],[[[-119.543842,33.280329],[-119.532941,33.284728],[-119.528141,33.284929],[-119.50504,33.272829],[-119.48278,33.263973],[-119.465717,33.259239],[-119.458466,33.254661],[-119.429559,33.228167],[-119.444269,33.21919],[-119.464725,33.215432],[-119.476029,33.21552],[-119.500684,33.220569],[-119.511659,33.223027],[-119.517514,33.226737],[-119.545872,33.233406],[-119.564971,33.24744],[-119.565641,33.250029],[-119.566014,33.252639],[-119.570642,33.257729],[-119.578942,33.278628],[-119.562042,33.271129],[-119.555242,33.273429],[-119.547642,33.280328],[-119.543842,33.280329]]],[[[-119.422972,34.004368],[-119.427589,34.006445],[-119.437734,34.01],[-119.441116,34.012426],[-119.441226,34.014075],[-119.433912,34.015975],[-119.421376,34.015012],[-119.411317,34.008005],[-119.396251,34.005918],[-119.389983,34.006099],[-119.366591,34.016785],[-119.357462,34.015919],[-119.376396,34.010551],[-119.391551,34.002505],[-119.414528,34.004994],[-119.422972,34.004368]]],[[[-118.524531,32.895488],[-118.535823,32.90628],[-118.551134,32.945155],[-118.560887,32.957891],[-118.573522,32.969183],[-118.586928,33.008281],[-118.596037,33.015357],[-118.606559,33.01469],[-118.605534,33.030999],[-118.594033,33.035951],[-118.57516,33.033961],[-118.569013,33.029151],[-118.564445,33.024914],[-118.564527,33.018637],[-118.559171,33.006291],[-118.540069,32.980933],[-118.529228,32.970921],[-118.496811,32.933847],[-118.485288,32.923545],[-118.479039,32.920363],[-118.460623,32.90951],[-118.446771,32.895424],[-118.369984,32.839273],[-118.353504,32.821962],[-118.356541,32.817311],[-118.36053,32.819921],[-118.379968,32.824545],[-118.387375,32.825327],[-118.394565,32.823978],[-118.401268,32.820338],[-118.425634,32.800595],[-118.42943,32.805429],[-118.428372,32.806872],[-118.44492,32.820593],[-118.476074,32.841754],[-118.487908,32.84459],[-118.496298,32.851572],[-118.506902,32.868503],[-118.508095,32.871321],[-118.507193,32.876264],[-118.524641,32.893175],[-118.524531,32.895488]]],[[[-118.500212,33.449592],[-118.499669,33.447879],[-118.48557,33.446213],[-118.477646,33.448392],[-118.445812,33.428907],[-118.423576,33.427258],[-118.382037,33.409883],[-118.370323,33.409285],[-118.368301,33.40711],[-118.365094,33.388374],[-118.32446,33.348782],[-118.316083,33.342928],[-118.310213,33.335795],[-118.303174,33.320264],[-118.305084,33.310323],[-118.316787,33.301137],[-118.325244,33.299075],[-118.343249,33.305234],[-118.360332,33.31533],[-118.374768,33.320065],[-118.402941,33.320901],[-118.440047,33.318638],[-118.456309,33.32182],[-118.465368,33.326056],[-118.481886,33.344123],[-118.48877,33.356649],[-118.482609,33.369914],[-118.478465,33.38632],[-118.484949,33.412131],[-118.48875,33.419826],[-118.503952,33.424234],[-118.515914,33.422417],[-118.516267,33.425075],[-118.52323,33.430733],[-118.53738,33.434608],[-118.558715,33.433419],[-118.563442,33.434381],[-118.570927,33.439351],[-118.575901,33.448261],[-118.593969,33.467198],[-118.601185,33.469853],[-118.60403,33.47654],[-118.603375,33.478098],[-118.598783,33.477939],[-118.585936,33.473819],[-118.54453,33.474119],[-118.530702,33.468071],[-118.500212,33.449592]]],[[[-122.418698,37.852717],[-122.434403,37.852434],[-122.443302,37.855448],[-122.446316,37.861046],[-122.438565,37.868367],[-122.430958,37.872242],[-122.421439,37.869969],[-122.421341,37.869946],[-122.41847,37.861764],[-122.41847,37.852721],[-122.418698,37.852717]]],[[[-123.013916,37.700355],[-123.013897,37.704478],[-123.012194,37.706749],[-123.004489,37.706262],[-123.00019,37.702937],[-122.997189,37.697909],[-123.000677,37.690203],[-123.005543,37.689392],[-123.011464,37.691907],[-123.014303,37.696205],[-123.013916,37.700355]]],[[[-122.3785,37.826505],[-122.377879,37.830648],[-122.369941,37.832137],[-122.363244,37.823951],[-122.358779,37.814278],[-122.362661,37.807577],[-122.372422,37.811301],[-122.37267,37.81651],[-122.3785,37.826505]]],[[[-124.065521,41.464739],[-124.066057,41.470258],[-124.075917,41.501757],[-124.081427,41.511228],[-124.081987,41.547761],[-124.092404,41.553615],[-124.101123,41.569192],[-124.101403,41.578524],[-124.097385,41.585251],[-124.100961,41.602499],[-124.114413,41.616768],[-124.116037,41.628849],[-124.120225,41.640354],[-124.135552,41.657307],[-124.139354,41.671652],[-124.138373,41.678881],[-124.143479,41.709284],[-124.147412,41.717955],[-124.154246,41.728801],[-124.164716,41.740126],[-124.17739,41.745756],[-124.185363,41.739351],[-124.19104,41.736079],[-124.194953,41.736778],[-124.203843,41.747035],[-124.23972,41.7708],[-124.242288,41.772034],[-124.248704,41.771459],[-124.255994,41.783014],[-124.245027,41.7923],[-124.230678,41.818681],[-124.219592,41.846432],[-124.208439,41.888192],[-124.203402,41.940964],[-124.204948,41.983441],[
2-124.211605,41.99846],[-124.100921,41.996956],[-124.100216,41.996842],[-124.087827,41.996891],[-124.086661,41.996869],[-123.821472,41.995473],[-123.624554,41.999837],[-123.518075,42.000436],[-123.501997,42.000527],[-123.498896,42.000474],[-123.49883,42.000525],[-123.347562,41.999108],[-123.230764,42.003845],[-123.230762,42.003845],[-123.154908,42.008036],[-123.045254,42.003049],[-123.001152,42.003],[-122.634739,42.004858],[-122.501135,42.00846],[-122.378193,42.009518],[-122.289533,42.007764],[-122.289527,42.007764],[-122.161328,42.007637],[-122.160438,42.007637],[-122.156666,42.007384],[-122.155408,42.007429],[-122.001119,42.004017],[-121.708199,42.000815],[-121.705045,42.000766],[-121.689159,42.000584],[-121.675348,42.000351],[-121.580865,41.998668],[-121.52025,41.997983],[-121.44754,41.997169],[-121.43961,41.99708],[-121.434977,41.997022],[-121.376101,41.997026],[-121.360253,41.99668],[-121.340517,41.99622],[-121.335734,41.996518],[-121.334385,41.996655],[-121.154347,41.996352],[-121.035195,41.993323],[-120.879481,41.993781],[-120.693941,41.993676],[-120.692219,41.993677],[-120.326005,41.993122],[-120.286424,41.993058],[-119.999168,41.99454],[-119.999866,41.183974],[-119.999358,40.873101],[-119.999232,40.867454],[-119.999231,40.865899],[-119.995926,40.499901],[-119.996155,40.321838],[-119.996155,40.32125],[-119.996182,40.263532],[-119.996183,40.262461],[-119.997124,40.126363],[-119.997234,40.091591],[-119.997175,40.077245],[-119.997291,40.071803],[-120.000607,39.780779],[-120.000502,39.779956],[-120.001319,39.72242],[-120.001319,39.722416],[-120.003116,39.445113],[-120.003117,39.445045],[-120.005318,39.316479],[-120.00532,39.31635],[-120.005413,39.313848],[-120.005414,39.313345],[-120.005743,39.228664],[-120.005746,39.22521],[-120.004504,39.165599],[-120.003402,39.112687],[-120.002461,39.067489],[-120.001014,38.999574],[-119.904315,38.933324],[-119.587679,38.714734],[-119.587066,38.714345],[-119.585437,38.713212],[-119.494183,38.649852],[-119.494022,38.649734],[-119.450612,38.619964],[-119.450623,38.619965],[-119.328498,38.534648],[-119.156863,38.414743],[-119.125982,38.39317],[-118.746598,38.124926],[-118.428581,37.895613],[-118.039798,37.615273],[-118.039849,37.615245],[-117.832726,37.464929],[-117.500909,37.220282],[-117.166187,36.970862],[-117.000895,36.847694],[-116.488233,36.459097],[-116.097216,36.158346],[-116.093601,36.155805],[-115.912858,36.015359],[-115.892975,35.999967],[-115.84608,35.963596],[-115.689302,35.842003],[-115.648029,35.809629],[-115.647683,35.809358],[-115.647202,35.808995],[-115.406079,35.618613],[-115.404537,35.617605],[-115.393996,35.609344],[-115.391535,35.607271],[-115.388866,35.605171],[-115.303743,35.538207],[-115.271342,35.51266],[-115.225273,35.475907],[-115.160599,35.424313],[-115.160068,35.424129],[-115.146788,35.413662],[-115.145813,35.413182],[-114.92548,35.237054],[-114.925381,35.237039],[-114.80503,35.140284],[-114.804249,35.139689],[-114.633013,35.002085],[-114.62919,34.991887],[-114.629015,34.986148],[-114.630877,34.907263],[-114.636725,34.889107],[-114.635176,34.875003],[-114.633051,34.869971],[-114.552682,34.766871],[-114.465607,34.69226],[-114.452547,34.653494],[-114.339627,34.451435],[-114.264317,34.401329],[-114.199482,34.361373],[-114.176909,34.349306],[-114.138282,34.30323],[-114.131489,34.260387],[-114.133264,34.258462],[-114.164476,34.251667],[-114.225861,34.201774],[-114.244191,34.179625],[-114.312592,34.144453],[-114.321618,34.138093],[-114.366521,34.118575],[-114.390565,34.110084],[-114.401352,34.111652],[-114.411681,34.110031],[-114.420499,34.103466],[-114.43338,34.088413],[-114.435429,34.079727],[-114.434949,34.037784],[-114.438266,34.022609],[-114.46361,33.993431],[-114.499883,33.961789],[-114.518434,33.917518],[-114.525539,33.838614],[-114.523365,33.80612],[-114.50434,33.756381],[-114.494197,33.707922],[-114.496489,33.696901],[-114.519113,33.688473],[-114.523959,33.685879],[-114.530348,33.679245],[-114.540617,33.591412],[-114.5403,33.580615],[-114.535965,33.569154],[-114.535664,33.568788],[-114.558898,33.531819],[-114.594534,33.495059],[-114.622918,33.456561],[-114.627125,33.433554],[-114.665278,33.415358],[-114.721233,33.396912],[-114.700103,33.341045],[-114.672088,33.258499],[-114.67536,33.185489],[-114.679359,33.159519],[-114.687074,33.142196],[-114.696829,33.131209],[-114.706175,33.105335],[-114.707819,33.091102],[-114.675104,33.047532],[-114.62387,33.02872],[-114.606282,33.025703],[-114.589778,33.026228],[-114.584765,33.028231],[-114.578287,33.035375],[-114.571653,33.036624],[-114.523578,33.030961],[-114.516912,33.026871],[-114.511343,33.02345
25],[-114.468605,32.971649],[-114.46289,32.905797],[-114.465715,32.87942],[-114.465715,32.879191],[-114.496284,32.822326],[-114.496827,32.822119],[-114.615733,32.729427],[-114.615585,32.728446],[-114.65826,32.733799],[-114.65884,32.73383],[-114.677091,32.736218],[-114.678632,32.736614],[-114.719633,32.718763],[-115.465164,32.6671],[-115.875842,32.636424],[-116.106159,32.618328],[-116.390091,32.59602],[-117.118865,32.534661],[-117.124862,32.534156],[-117.133363,32.575625],[-117.132963,32.597054],[-117.136664,32.618754],[-117.139464,32.627054],[-117.159865,32.660652],[-117.168866,32.671952],[-117.180366,32.681652],[-117.192967,32.687751],[-117.196767,32.688851],[-117.213068,32.687751],[-117.223868,32.683051],[-117.236239,32.671353],[-117.246069,32.669352],[-117.255169,32.700051],[-117.25757,32.72605],[-117.25537,32.745449],[-117.25257,32.752949],[-117.25497,32.786948],[-117.26107,32.803148],[-117.280971,32.822247],[-117.28217,32.839547],[-117.28117,32.843047],[-117.27387,32.851447],[-117.26497,32.848947],[-117.26067,32.852647],[-117.25617,32.859447],[-117.25167,32.874346],[-117.25447,32.900146],[-117.26047,32.931245],[-117.262547,32.939542],[-117.28077,33.012343],[-117.29337,33.034642],[-117.309771,33.07454],[-117.315278,33.093504],[-117.328359,33.121842],[-117.359484,33.164231],[-117.362572,33.168437],[-117.39148,33.202762],[-117.401926,33.213598],[-117.445583,33.268517],[-117.469794,33.296417],[-117.50565,33.334063],[-117.547693,33.365491],[-117.571722,33.378988],[-117.59588,33.386629],[-117.607905,33.406317],[-117.631682,33.430528],[-117.645582,33.440728],[-117.645592,33.440733],[-117.684584,33.461927],[-117.689284,33.460155],[-117.691984,33.456627],[-117.691384,33.454028],[-117.715349,33.460556],[-117.726486,33.483427],[-117.761387,33.516326],[-117.784888,33.541525],[-117.801288,33.546324],[-117.814188,33.552224],[-117.840289,33.573523],[-117.87679,33.592322],[-117.89979,33.599622],[-117.927091,33.605521],[-117.940591,33.620021],[-117.957114,33.629466],[-118.000593,33.654319],[-118.029694,33.676418],[-118.064895,33.711018],[-118.088896,33.729817],[-118.101097,33.734117],[-118.116703,33.743549],[-118.132698,33.753217],[-118.1569,33.760317],[-118.1755,33.763617],[-118.180831,33.763072],[-118.187701,33.749218],[-118.1837,33.736118],[-118.181367,33.717367],[-118.207476,33.716905],[-118.258687,33.703741],[-118.277208,33.707091],[-118.297104,33.708319],[-118.317205,33.712818],[-118.354705,33.732317],[-118.360505,33.736817],[-118.385006,33.741417],[-118.396606,33.735917],[-118.411211,33.741985],[-118.428407,33.774715],[-118.423407,33.782015],[-118.405007,33.800215],[-118.394376,33.804289],[-118.394307,33.804315],[-118.391507,33.815415],[-118.392107,33.840915],[-118.412708,33.883913],[-118.44241,33.940312],[-118.460611,33.969111],[-118.482729,33.995912],[-118.484212,33.99771],[-118.502813,34.015509],[-118.519514,34.027509],[-118.543115,34.038508],[-118.569235,34.04164],[-118.603572,34.039048],[-118.609652,34.036424],[-118.668358,34.038887],[-118.67543,34.037479],[-118.679366,34.033255],[-118.706215,34.029383],[-118.732391,34.032743],[-118.744952,34.032103],[-118.783433,34.021543],[-118.787094,34.019545],[-118.805114,34.001239],[-118.821579,34.013959],[-118.84038,34.027527],[-118.854653,34.034215],[-118.896159,34.039207],[-118.928048,34.045847],[-118.938081,34.043383],[-118.944887,34.04534],[-118.954722,34.048167],[-118.977751,34.059822],[-118.99698,34.065943],[-119.004644,34.066231],[-119.037494,34.083111],[-119.069959,34.09047],[-119.088536,34.09831],[-119.098216,34.099334],[-119.109784,34.094566],[-119.130169,34.100102],[-119.159554,34.119653],[-119.18864,34.139005],[-119.20314,34.144505],[-119.211241,34.144905],[-119.216441,34.146105],[-119.227743,34.161728],[-119.237142,34.175804],[-119.257043,34.213304],[-119.265927,34.234609],[-119.270144,34.252903],[-119.278644,34.266902],[-119.290945,34.274902],[-119.302131,34.272761],[-119.313034,34.275689],[-119.337475,34.290576],[-119.349187,34.304383],[-119.370356,34.319486],[-119.37578,34.321118],[-119.388249,34.317398],[-119.390449,34.318198],[-119.42777,34.353016],[-119.431066,34.355297],[-119.435888,34.355839],[-119.461036,34.374064],[-119.472678,34.375628],[-119.478265,34.377197],[-119.510655,34.386295],[-119.536957,34.395495],[-119.559459,34.413395],[-119.616862,34.420995],[-119.638864,34.415696],[-119.648664,34.417396],[-119.671866,34.416096],[-119.688167,34.412497],[-119.684666,34.408297],[-119.691749,34.403154],[-119.709067,34.395397],[-119.729369,34.395897],[-119.74547,34.402898],[-119.785871,34.415997],[-119.794771,34.417597],[-119.835771,34.415796],[-119.853771,34.407996],[-119.873971,34.408795],[-119.925227,34.433931],[-119.956433,34.435288],[-119.971951,34.444641],[-120.008077,34.460447],[-120.038828,34.463434],[-120.050682,34.461651],[-120.088591,34.460208],[-120.097212,34.461809],[-120.118411,34.469927],[-120.141165,34.473405],[-120.183505,34.470372],[-120.225498,34.470587],[-120.238002,34.468098],[-120.25777,34.467451],[-120.283001,34.468354],[-120.295051,34.470623],[-120.299169,34.469731],[-120.301822,34.467077],[
2-120.341369,34.458789],[-120.441975,34.451512],[-120.451425,34.447094],[-120.471376,34.447846],[-120.47661,34.475131],[-120.480372,34.481059],[-120.490523,34.490075],[-120.511421,34.522953],[-120.524776,34.531291],[-120.581293,34.556959],[-120.608355,34.556656],[-120.612005,34.553564],[-120.622575,34.554017],[-120.637805,34.56622],[-120.645739,34.581035],[-120.640244,34.604406],[-120.625127,34.634489],[-120.60197,34.692095],[-120.60045,34.70464],[-120.601672,34.709721],[-120.614852,34.730709],[-120.62632,34.738072],[-120.637415,34.755895],[-120.62297,34.7933],[-120.616296,34.816308],[-120.609898,34.842751],[-120.610266,34.85818],[-120.616325,34.866739],[-120.639283,34.880413],[-120.642212,34.894145],[-120.647328,34.901133],[-120.662889,34.901183],[-120.670835,34.904115],[-120.648905,34.974393],[-120.63999,35.002963],[-120.63357,35.033085],[-120.629931,35.061515],[-120.629583,35.078362],[-120.630957,35.101941],[-120.635787,35.123805],[-120.644311,35.139616],[-120.651134,35.147768],[-120.662475,35.153357],[-120.667994,35.15203],[-120.675074,35.153061],[-120.686974,35.160708],[-120.698906,35.171192],[-120.704203,35.173206],[-120.714185,35.175998],[-120.734231,35.178472],[-120.74887,35.177795],[-120.754823,35.174701],[-120.756862,35.169208],[-120.756086,35.160459],[-120.760492,35.15971],[-120.778998,35.168897],[-120.786076,35.177666],[-120.805258,35.184973],[-120.846674,35.204429],[-120.856047,35.206487],[-120.873046,35.225688],[-120.89679,35.247877],[-120.896876,35.25399],[-120.889354,35.277819],[-120.87957,35.294184],[-120.8672,35.327154],[-120.862684,35.346776],[-120.862133,35.360763],[-120.866099,35.393045],[-120.869209,35.403276],[-120.884757,35.430196],[-120.896862,35.442243],[-120.907937,35.449069],[-120.946546,35.446715],[-120.950742,35.44802],[-120.955863,35.453743],[-120.969436,35.460197],[-120.976122,35.459028],[-121.003359,35.46071],[-121.025621,35.484598],[-121.05308,35.50753],[-121.059913,35.509671],[-121.101595,35.548814],[-121.126027,35.593058],[-121.133556,35.600455],[-121.143561,35.606046],[-121.166712,35.635399],[-121.188897,35.643138],[-121.195291,35.640734],[-121.251034,35.656641],[-121.272322,35.666711],[-121.284973,35.674109],[-121.289794,35.689428],[-121.296473,35.696824],[-121.304583,35.701794],[-121.314632,35.71331],[-121.315786,35.75252],[-121.324918,35.769347],[-121.332449,35.783106],[-121.346363,35.795183],[-121.356737,35.804187],[-121.388053,35.823483],[-121.406823,35.844623],[-121.413146,35.855316],[-121.426955,35.860103],[-121.439584,35.86695],[-121.462264,35.885618],[-121.461227,35.896906],[-121.463452,35.904416],[-121.472435,35.91989],[-121.4862,35.970348],[-121.503112,36.000299],[-121.51159,36.006598],[-121.531876,36.014368],[-121.553716,36.019798],[-121.569612,36.021539],[-121.574602,36.025156],[-121.590395,36.050363],[-121.589183,36.053775],[-121.592853,36.065062],[-121.606845,36.072065],[-121.618672,36.087767],[-121.622009,36.099695],[-121.629634,36.114452],[-121.680145,36.165818],[-121.717176,36.195146],[-121.779851,36.227407],[-121.797059,36.234211],[-121.806979,36.232907],[-121.813734,36.234235],[-121.826425,36.24186],[-121.835785,36.250748],[-121.83935,36.260478],[-121.851967,36.277831],[-121.874797,36.289064],[-121.888491,36.30281],[-121.894714,36.317806],[-121.892917,36.340428],[-121.905446,36.358269],[-121.902669,36.363901],[-121.901813,36.381879],[-121.903195,36.393603],[-121.905657,36.398206],[-121.914378,36.404344],[-121.917463,36.414809],[-121.91474,36.42589],[-121.9255,36.453918],[-121.937205,36.472488],[-121.9416,36.485602],[-121.939216,36.496896],[-121.938763,36.506423],[-121.943678,36.511802],[-121.944666,36.521861],[-121.928769,36.523147],[-121.925937,36.525173],[-121.932508,36.559935],[-121.942533,36.566435],[-121.949659,36.567602],[-121.95146,36.564009],[-121.957335,36.564482],[-121.972594,36.57337],[-121.978592,36.580488],[-121.970427,36.582754],[-121.941666,36.618059],[-121.938551,36.633908],[-121.93643,36.636746],[-121.929666,36.636959],[-121.923866,36.634559],[-121.890164,36.609259],[-121.889064,36.601759],[-121.886764,36.601459],[-121.871364,36.604559],[-121.860604,36.611136],[-121.842263,36.630059],[-121.831995,36.644856],[-121.825052,36.657207],[
2-121.814462,36.682858],[-121.807062,36.714157],[-121.805643,36.750239],[-121.788278,36.803994],[-121.791544,36.815186],[-121.809363,36.848654],[-121.810552,36.850648],[-121.827664,36.879353],[-121.862266,36.931552],[-121.880167,36.950151],[-121.894667,36.961851],[-121.906468,36.96895],[-121.930069,36.97815],[-121.93947,36.97805],[-121.95167,36.97145],[-121.972771,36.954151],[-121.975871,36.954051],[-121.983896,36.958727],[-122.012373,36.96455],[-122.023373,36.96215],[-122.027174,36.95115],[-122.050122,36.948523],[-122.066421,36.948271],[-122.079356,36.950783],[-122.105976,36.955951],[-122.140578,36.97495],[-122.155078,36.98085],[-122.186879,37.00345],[-122.20618,37.013949],[-122.252181,37.059448],[-122.260481,37.072548],[-122.284882,37.101747],[-122.292974,37.107318],[-122.306139,37.116383],[-122.313907,37.118161],[-122.322971,37.11546],[-122.330463,37.115338],[-122.337071,37.117382],[-122.338856,37.120854],[-122.337085,37.130795],[-122.337833,37.135936],[-122.344029,37.144099],[-122.359791,37.155574],[-122.36179,37.163593],[-122.367085,37.172817],[-122.37927,37.181128],[-122.390599,37.182988],[-122.397065,37.187249],[-122.405073,37.195791],[-122.407181,37.219465],[-122.408982,37.225258],[-122.415822,37.232839],[-122.419113,37.24147],[-122.418452,37.248521],[-122.411686,37.265844],[-122.401323,37.337009],[-122.40085,37.359225],[-122.409258,37.374805],[-122.423286,37.392542],[-122.443687,37.435941],[-122.445987,37.461541],[-122.452087,37.48054],[-122.467888,37.49814],[-122.472388,37.50054],[-122.476443,37.498768],[-122.482351,37.496187],[-122.485888,37.494641],[-122.486749,37.49439],[-122.487139,37.494277],[-122.493789,37.492341],[-122.494429,37.49269],[-122.499289,37.495341],[-122.516689,37.52134],[-122.519533,37.537302],[-122.516589,37.544939],[-122.514789,37.546139],[-122.513688,37.552239],[-122.518088,37.576138],[-122.517187,37.590637],[-122.501386,37.599637],[-122.496786,37.612136],[-122.494085,37.644035],[-122.496784,37.686433],[-122.502427,37.708133],[-122.506483,37.723731],[-122.509397,37.748841],[-122.511983,37.77113],[-122.514483,37.780829],[-122.50531,37.788312],[-122.492883,37.787929],[-122.485783,37.790629],[-122.478083,37.810828],[-122.470336,37.808671],[-122.463793,37.804653],[-122.425942,37.810979],[-122.407452,37.811441],[-122.398139,37.80563],[-122.385323,37.790724],[-122.375854,37.734979],[-122.370094,37.732331],[-122.367697,37.734943],[-122.365478,37.734621],[-122.356784,37.729505],[-122.361749,37.71501],[-122.370411,37.717572],[-122.391374,37.708331],[-122.39319,37.707531],[-122.387626,37.67906],[-122.374291,37.662206],[-122.3756,37.652389],[-122.37789,37.650425],[-122.387381,37.648462],[-122.386072,37.637662],[-122.365455,37.626208],[-122.35531,37.615736],[-122.358583,37.611155],[-122.370364,37.614427],[-122.373309,37.613773],[-122.378545,37.605592],[-122.360219,37.592501],[-122.317676,37.590865],[-122.315385,37.587265],[-122.315713,37.583666],[-122.305895,37.575484],[-122.262698,37.572866],[-122.251898,37.566321],[-122.244372,37.55814],[-122.242832,37.557136],[-122.236323,37.552891],[-122.225135,37.545594],[-122.214264,37.538505],[-122.196593,37.537196],[-122.194957,37.522469],[-122.168449,37.504143],[-122.155686,37.501198],[-122.149632,37.502671],[-122.140142,37.507907],[-122.130979,37.503652],[-122.127706,37.500053],[-122.116112,37.505386],[-122.111344,37.50758],[-122.111998,37.528851],[-122.128688,37.560594],[-122.133924,37.562885],[-122.137524,37.567467],[-122.144396,37.581866],[-122.147014,37.588411],[-122.145378,37.600846],[-122.14636,37.607391],[-122.152905,37.640771],[-122.163049,37.667933],[-122.170904,37.676114],[-122.179085,37.680041],[-122.197411,37.692804],[-122.203971,37.697769],[-122.213774,37.698695],[-122.221628,37.705567],[-122.246826,37.72193],[-122.255989,37.735674],[-122.257953,37.739601],[-122.257134,37.745001],[-122.252226,37.747619],[-122.244938,37.750294],[-122.242638,37.753744],[-122.253753,37.761218],[-122.264101,37.764667],[-122.275408,37.76735],[-122.286139,37.769458],[-122.293996,37.770416],[-122.304345,37.774632],[-122.318909,37.77904],[-122.329159,37.783173],[-122.33079,37.78383],[-122.330963,37.786035],[-122.331748,37.796052],[-122.33555,37.799538],[-122.335675,37.799652],[-122.333711,37.809797],[-122.323567,37.823214],[-122.317676,37.826814],[-122.306222,37.827469],[-122.303931,37.830087],[-122.301313,37.847758],[-122.310477,37.873938],[-122.309986,37.892755],[-122.313258,37.89701],[-122.313496,37.897211],[-122.32373,37.905845],[-122.33453,37.9
208791],[-122.35711,37.908791],[-122.362346,37.904209],[-122.367582,37.903882],[-122.378709,37.905191],[-122.385908,37.908136],[-122.389181,37.9101],[-122.39049,37.922535],[-122.395071,37.927117],[-122.401289,37.928426],[-122.413725,37.937262],[-122.417371,37.943513],[-122.430087,37.963115],[-122.42976,37.965405],[-122.415361,37.963115],[-122.411761,37.960497],[-122.408383,37.957544],[-122.399832,37.956009],[-122.367582,37.978168],[-122.361905,37.989991],[-122.363001,37.994375],[-122.366928,37.998458],[-122.368891,38.007948],[-122.367909,38.01253],[-122.363655,38.014166],[-122.359493,38.009941],[-122.340093,38.003694],[-122.331912,38.00533],[-122.321112,38.012857],[-122.315549,38.013511],[-122.300823,38.010893],[-122.283478,38.022674],[-122.262861,38.0446],[-122.262861,38.051473],[-122.266669,38.06007],[-122.273006,38.07438],[-122.282824,38.082889],[-122.301804,38.105142],[-122.314567,38.115287],[-122.366273,38.141467],[-122.39638,38.149976],[-122.403514,38.150624],[-122.40358,38.15063],[-122.409798,38.136231],[-122.439577,38.116923],[-122.450377,38.116269],[-122.454958,38.118887],[-122.484411,38.11496],[-122.489974,38.112014],[-122.490727,38.109755],[-122.491283,38.108087],[-122.489974,38.096961],[-122.486702,38.090088],[-122.483757,38.071762],[-122.492265,38.056381],[-122.499465,38.032165],[-122.497828,38.019402],[-122.494556,38.015148],[-122.481466,38.007621],[-122.462812,38.003367],[-122.452995,37.996167],[-122.448413,37.988313],[-122.448413,37.984713],[-122.456595,37.978823],[-122.462485,37.981441],[-122.471975,37.981768],[-122.488665,37.966714],[-122.490302,37.964751],[-122.490302,37.959188],[-122.487684,37.948716],[-122.480484,37.945443],[-122.479175,37.941516],[-122.48572,37.937589],[-122.499465,37.939225],[-122.503064,37.936607],[-122.503064,37.928753],[-122.493574,37.921881],[-122.486375,37.921881],[-122.478193,37.918608],[-122.471975,37.910427],[-122.472303,37.902573],[-122.458558,37.894064],[-122.448413,37.89341],[-122.43925,37.88392],[-122.438268,37.880974],[-122.45005,37.871157],[-122.462158,37.868866],[-122.474266,37.874429],[-122.480811,37.873448],[-122.483429,37.868866],[-122.483102,37.863957],[-122.476536,37.832812],[-122.476473,37.832513],[-122.479151,37.825428],[-122.47986,37.825641],[-122.483483,37.826728],[-122.492474,37.82484],[-122.505383,37.822128],[-122.522836,37.824717],[-122.523585,37.824828],[-122.537285,37.830328],[-122.548986,37.836227],[-122.561487,37.851827],[-122.584289,37.859227],[-122.60129,37.875126],[-122.627113,37.88608],[-122.639977,37.897349],[-122.656519,37.904519],[-122.678474,37.906604],[-122.682171,37.90645],[-122.693569,37.901171],[-122.70264,37.89382],[-122.727297,37.904626],[-122.732898,37.920225],[-122.736898,37.925825],[-122.754606,37.935527],[-122.766138,37.938004],[-122.783244,37.951334],[-122.791739,37.969422],[-122.797405,37.976657],[
2-122.821383,37.996735],[-122.856573,38.016717],[-122.882114,38.025273],[-122.939711,38.031908],[-122.956811,38.02872],[-122.972378,38.020247],[-122.981776,38.009119],[-122.982386,38.004274],[-122.980147,38.000831],[-122.976764,37.99568],[-122.97439,37.992429],[-123.024066,37.994878],[-123.020562,37.999544],[-123.016303,38.001691],[-123.011533,38.003438],[-122.99242,38.041758],[-122.960889,38.112962],[-122.952086,38.138562],[-122.949074,38.15406],[-122.949626,38.164041],[-122.953629,38.17567],[-122.965408,38.187113],[-122.96637,38.198514],[-122.968112,38.202428],[-122.991953,38.233185],[-122.993959,38.237602],[-122.993235,38.239686],[-122.987149,38.237538],[-122.968569,38.242879],[-122.967203,38.250691],[-122.977082,38.267902],[-122.986319,38.273164],[-122.994603,38.283096],[-122.997106,38.289458],[-123.002911,38.295708],[-123.004122,38.297012],[-123.024333,38.310573],[-123.038742,38.313576],[-123.051061,38.310693],[-123.053476,38.305722],[-123.052021,38.302246],[-123.053504,38.299385],[-123.058239,38.298355],[-123.063671,38.302178],[-123.074684,38.322574],[-123.068437,38.33521],[-123.068265,38.359865],[-123.085572,38.390525],[-123.103706,38.415541],[-123.122379,38.437314],[-123.128825,38.450418],[-123.145325,38.459422],[-123.166428,38.474947],[-123.202277,38.494314],[-123.249797,38.511045],[-123.287156,38.540223],[-123.297151,38.543452],[-123.331899,38.565542],[-123.343338,38.590008],[-123.349612,38.596805],[-123.371876,38.607235],[-123.379303,38.621953],[-123.398166,38.647044],[-123.40301,38.649449],[-123.405663,38.656729],[-123.43272,38.687131],[-123.441774,38.699744],[-123.461291,38.717001],[-123.490021,38.732213],[-123.514784,38.741966],[-123.525152,38.753801],[-123.533535,38.768408],[-123.541837,38.776764],[-123.571987,38.798189],[-123.579856,38.802835],[-123.58638,38.802857],[-123.600221,38.814115],[-123.601569,38.81899],[-123.605317,38.822765],[-123.638637,38.843865],[-123.642676,38.844005],[-123.647387,38.845472],[-123.652212,38.854582],[-123.654696,38.865638],[-123.659846,38.872529],[-123.688099,38.893594],[-123.71054,38.91323],[-123.725367,38.917438],[-123.72763,38.9295],[-123.726315,38.936367],[-123.738886,38.95412],[-123.732892,38.954994],[-123.729053,38.956667],[-123.721347,38.963879],[-123.711149,38.977316],[-123.6969,39.004401],[-123.69074,39.021293],[-123.690095,39.031157],[-123.693969,39.057363],[-123.713392,39.108422],[-123.721505,39.125327],[-123.735936,39.139644],[-123.737913,39.143442],[-123.742221,39.164885],[-123.76101,39.191595],[-123.765891,39.193657],[-123.774998,39.212083],[-123.777368,39.237214],[-123.787893,39.264327],[-123.798991,39.271355],[-123.803848,39.278771],[-123.801757,39.28353],[-123.803081,39.291747],[-123.811387,39.312825],[-123.808772,39.324368],[-123.817369,39.3388],[-123.822085,39.343857],[-123.825331,39.360814],[-123.826306,39.36871],[-123.822325,39.379987],[-123.821887,39.406809],[-123.81469,39.446538],[-123.795639,39.492215],[-123.78417,39.509419],[-123.778521,39.521478],[-123.766475,39.552803],[-123.76721,39.559852],[-123.787417,39.604552],[-123.78354,39.609517],[-123.782322,39.621486],[-123.78636,39.659932],[-123.792659,39.684122],[-123.808208,39.710715],[-123.824744,39.718128],[-123.829545,39.723071],[-123.831599,39.730629],[-123.835092,39.738768],[-123.838089,39.752409],[-123.83715,39.776232],[-123.839797,39.795637],[-123.851714,39.832041],[-123.853764,39.8341],[-123.881458,39.845422],[-123.907664,39.863028],[-123.915142,39.875313],[-123.915853,39.881114],[-123.930047,39.909697],[-123.954952,39.922373],[-123.962655,39.937635],[-123.980031,39.962458],[-123.99586,39.973045],[-124.023938,40.001284],[-124.035904,40.013319],[-124.056408,40.024305],[-124.065069,40.024785],[-124.068908,40.021307],[-124.072509,40.022657],[-124.079983,40.029773],[-124.080709,40.06611],[-124.087086,40.078442],[-124.110549,40.103765],[-124.139952,40.11635],[-124.170767,40.124207],[-124.187874,40.130542],[-124.214895,40.160902],[-124.231095,40.171581],[-124.258405,40.184277],[-124.296497,40.208816],[-124.320912,40.226617],[-124.327691,40.23737],[-124.34307,40.243979],[-124.352715,40.250453],[-124.363414,40.260974],[-124.363634,40.276212],[-124.347853,40.314634],[-124.353124,40.331425],[-124.356595,40.335016],[-124.362796,40.350046],[-124.365357,40.374855],[-124.373599,40.392923],[-124.379082,40.398828],[-124.391496,40.407047],[-124.402623,40.422105],[-124.409591,40.438076],[-124.408601,40.443201],[-124.396642,40.462119],[-124.38494,40.48982],[-124.383224,40.499852],[-124.387023,40.504954],[-124.382816,40.519],[-124.379096,40.522865],[-124.363545,40.548698],[-124.329404,40.61643],[-124.315141,40.639526],[-124.312558,40.641333],[-124.289119,40.67963],[-124.248406,40.735166],[-124.228244,40.76939],[-124.201921,40.805111],[-124.176715,40.843618],[-124.158322,40.876069],[-124.137066,40.925732],[-124.118147,40.989263],[-124.112165,41.028173],[-124.125448,41.048504],[-124.132946,41.052482],[-124.138217,41.054342],[-124.142867,41.054032],[-124.147216,41.052884],[-124.148939,41.051467],[
2-124.151266,41.051101],[-124.153622,41.05355],[-124.154028,41.059923],[-124.154513,41.087159],[-124.160556,41.099011],[-124.159065,41.121957],[-124.165414,41.129822],[-124.163988,41.138675],[-124.158539,41.143021],[-124.149674,41.140845],[-124.1438,41.144686],[-124.122677,41.189726],[-124.106986,41.229678],[-124.106389,41.240682],[-124.092284,41.287695],[-124.079015,41.347135],[-124.072294,41.374844],[-124.063076,41.439579],[-124.065521,41.464739]]]],"type":"MultiPolygon"}}]');Qm(_y(Qf),"[email protected]","ClearloopData123!").then((t=>{Uf(Kf(Qf),"/realtime/")})).catch((t=>{console.error("Auth failed:",t)}));const db=()=>{const t=(()=>{let t=window.innerWidth;return t<768?3:t<1024?4:5})(),n=Uf(Kf(Qf),"/moer"),[i,r]=(0,e.useState)({}),[o,a]=(0,e.useState)({}),[l,c]=(0,e.useState)(null);(0,e.useEffect)((()=>{const t=$f(n,(t=>{const e=t.val(),n=Object.keys(e).filter((t=>["TVA","CAISO_NORTH","ERCOT_NORTHCENTRAL"].includes(t))).reduce(((t,n)=>(t[n]=e[n],t)),{});r(n);const i=Object.values(n).sort(((t,e)=>t-e)),s=Object.keys(n).reduce(((t,e)=>{const r=n[e],s=i.indexOf(r);let o;return o=2===s?"#F7E15D":1===s?"#FBEF97":0===s?"#FFFCD1":"white",t[e]={fillColor:o,weight:2,opacity:1,color:o,dashArray:"3",fillOpacity:.9},t}),{});a(s)}));return t}),[n]);return(0,s.jsx)("div",{className:"comparison-map-container",children:(0,s.jsxs)(Yv,{attributionControl:!1,center:[34.5004851,-100.2261503],zoom:t,style:{height:"100%",width:"100%"},children:[(0,s.jsx)(ob,{attribution:'\xa9 <a href="https://clearloop.us">Clearloop</a>, <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>. Data from <a href="https://watttime.org/">WattTime.</a>',url:"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png"}),(0,s.jsx)(lb,{position:"bottomright",prefix:!1}),(0,s.jsx)(cb,{data:hb,style:t=>o[t.properties.grid_region]||{},eventHandlers:{mouseover:t=>{const{name:e,abbreviation:n,grid_region:r}=t.layer.feature.properties,s=i[r];c({name:n,full_name:e,value:s,grid_region:r,latlng:t.latlng})}},children:(0,s.jsx)(ub,{className:"test",children:l&&`${l.full_name}: ${l.value?l.value.toFixed(1):0} lbs of CO2 reclaimed per MWh produced.`})})]})})};let pb=1,fb=1;class gb{time=0;channels=(()=>new Map)();animations=(()=>new Map)();playing=!1;lastEngineTime=-1;constructor(){}addChannel(t){const{delay:e=0,duration:n=Number.POSITIVE_INFINITY,rate:i=1,repeat:r=1}=t,s=pb++,o={time:0,delay:e,duration:n,rate:i,repeat:r};return this._setChannelTime(o,this.time),this.channels.set(s,o),s}removeChannel(t){this.channels.delete(t);for(const[e,n]of this.animations)n.channel===t&&this.detachAnimation(e)}isFinished(t){const e=this.channels.get(t);return void 0!==e&&this.time>=e.delay+e.duration*e.repeat}getTime(t){if(void 0===t)return this.time;const e=this.channels.get(t);return void 0===e?-1:e.time}setTime(t){this.time=Math.max(0,t);const e=this.channels.values();for(const i of e)this._setChannelTime(i,this.time);const n=this.animations.values();for(const i of n){const{animation:t,channel:e}=i;t.setTime(this.getTime(e))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,e){const n=fb++;return this.animations.set(n,{animation:t,channel:e}),t.setTime(this.getTime(e)),n}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(-1===this.lastEngineTime&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,e){const n=e-t.delay;n>=t.duration*t.repeat?t.time=t.duration*t.rate:(t.time=Math.max(0,n)%t.duration,t.time*=t.rate)}}function mb(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}const _b={number:{type:"number",validate:(t,e)=>Number.isFinite(t)&&"object"===typeof e&&(void 0===e.max||t<=e.max)&&(void 0===e.min||t>=e.min)},array:{type:"array",validate:(t,e)=>Array.isArray(t)||ArrayBuffer.isView(t)}};function yb(t){let e=vb(t);if("object"!==e)return{value:t,..._b[e],type:e};if("object"===typeof t)return t?void 0!==t.type?{...t,..._b[t.type],type:t.type}:void 0===t.value?{type:"object",value:t}:(e=vb(t.value),{...t,..._b[e],type:e}):{type:"object",value:null};throw new Error("props")}function vb(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}const bb={vertex:"#ifdef MODULE_LOGDEPTH\nlogdepth_adjustPosition(gl_Position);\n#endif\n",fragment:"#ifdef MODULE_MATERIAL\ngl_FragColor = material_filterColor(gl_FragColor);\n#endif\n#ifdef MODULE_LIGHTING\ngl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n#ifdef MODULE_FOG\ngl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n#ifdef MODULE_PICKING\ngl_FragColor = picking_filterHighlightColor(gl_FragColor);\ngl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n#ifdef MODULE_LOGDEPTH\nlogdepth_setFragDepth();\n#endif\n"},wb=/void\s+main\s*\([^)]*\)\s*\{\n?/,Eb=/}\n?[^{}]*$/,xb=[],Sb="__LUMA_INJECT_DECLARATIONS__";function Tb(t){const e=t.slice(0,2);switch(e){case"vs":return"vertex";
2case"fs":return"fragment";default:throw new Error(e)}}function Cb(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r="vertex"===e;for(const s in n){const e=n[s];e.sort(((t,e)=>t.order-e.order)),xb.length=e.length;for(let t=0,n=e.length;t<n;++t)xb[t]=e[t].injection;const i=`${xb.join("\n")}\n`;switch(s){case"vs:#decl":r&&(t=t.replace(Sb,i));break;case"vs:#main-start":r&&(t=t.replace(wb,(t=>t+i)));break;case"vs:#main-end":r&&(t=t.replace(Eb,(t=>i+t)));break;case"fs:#decl":r||(t=t.replace(Sb,i));break;case"fs:#main-start":r||(t=t.replace(wb,(t=>t+i)));break;case"fs:#main-end":r||(t=t.replace(Eb,(t=>i+t)));break;default:t=t.replace(s,(t=>t+i))}}return t=t.replace(Sb,""),i&&(t=t.replace(/\}\s*$/,(t=>t+bb[e]))),t}let Ab=1;class Pb{name;vs;fs;getModuleUniforms;dependencies;deprecations;defines;injections;uniforms={};uniformTypes={};static instantiateModules(t){return t.map((t=>{if(t instanceof Pb)return t;mb("string"!==typeof t,`Shader module use by name is deprecated. Import shader module '${JSON.stringify(t)}' and use it directly.`),t.name||(console.warn("shader module has no name"),t.name="shader-module-"+Ab++);const e=new Pb(t);return e.dependencies=Pb.instantiateModules(t.dependencies||[]),e}))}constructor(t){const{name:e,vs:n,fs:i,dependencies:r=[],uniformTypes:s={},uniformPropTypes:o={},getUniforms:a,deprecations:l=[],defines:c={},inject:u={}}=t;mb("string"===typeof e),this.name=e,this.vs=n,this.fs=i,this.getModuleUniforms=a,this.dependencies=Pb.instantiateModules(r),this.deprecations=this._parseDeprecationDefinitions(l),this.defines=c,this.injections=function(t){const e={vertex:{},fragment:{}};for(const n in t){let i=t[n];"string"===typeof i&&(i={order:0,injection:i}),e[Tb(n)][n]=i}return e}(u),this.uniformTypes=s,o&&(this.uniforms=function(t){const e={};for(const[n,i]of Object.entries(t))e[n]=yb(i);return e}(o))}getModuleSource(t){let e;switch(t){case"vertex":e=this.vs||"";break;case"fragment":e=this.fs||"";break;default:mb(!1)}const n=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------\n\n#define MODULE_${n}\n${e}\n\n`}getUniforms(t,e){return this.getModuleUniforms?this.getModuleUniforms(t,e):function(t,e,n){const i={};for(const[r,s]of Object.entries(e))t&&r in t&&!s.private?(s.validate&&mb(s.validate(t[r],s),`${n}: invalid ${r}`),i[r]=t[r]):i[r]=s.value;return i}(t,this.uniforms,this.name)}getDefines(){return this.defines}checkDeprecations(t,e){this.deprecations.forEach((n=>{n.regex?.test(t)&&(n.deprecated?e.deprecated(n.old,n.new)():e.removed(n.old,n.new)())}))}_parseDeprecationDefinitions(t){return t.forEach((t=>{if("function"===t.type)t.regex=new RegExp(`\\b${t.old}\\(`);else t.regex=new RegExp(`${t.type} ${t.old};`)})),t}_defaultGetUniforms(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={},n=this.uniforms;for(const i in n){const r=n[i];i in t&&!r.private?(r.validate&&mb(r.validate(t[i],r),`${this.name}: invalid ${i}`),e[i]=t[i]):e[i]=r.value}return e}}function Rb(t){if(t.source&&"webgpu"===t.platformInfo.type){return{...t,vs:void 0,fs:void 0}}if(!t.vs)throw new Error("no vertex shader");const e=Mb(t.platformInfo,t.vs);let n;return t.fs&&(n=Mb(t.platformInfo,t.fs)),{...t,vs:e,fs:n}}function Mb(t,e){if("string"===typeof e)return e;if("webgpu"===t.type){if(e?.wgsl)return e.wgsl;throw new Error("WebGPU does not support GLSL shaders")}if(e?.glsl)return e.glsl;throw new Error("WebGL does not support WGSL shaders")}function Ib(t){return Lb(Pb.instantiateModules(t))}function Lb(t){const e={},n={};return kb({modules:t,level:0,moduleMap:e,moduleDepth:n}),Object.keys(n).sort(((t,e)=>n[e]-n[t])).map((t=>e[t]))}function kb(t){const{modules:e,level:n,moduleMap:i,moduleDepth:r}=t;if(n>=5)throw new Error("Possible loop in shader dependency graph");for(const s of e)i[s.name]=s,(void 0===r[s.name]||r[s.name]<n)&&(r[s.name]=n);for(const s of e)s.dependencies&&kb({modules:s.dependencies,level:n+1,moduleMap:i,moduleDepth:r})}const Nb=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,"#version 300 es\n"],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],Ob=[...
vendor: 18,626 bytes, line 2
2Nb,[Bb("attribute"),"in $1"],[Bb("varying"),"out $1"]],Db=[...Nb,[Bb("varying"),"in $1"]];function Fb(t,e){for(const[n,i]of e)t=t.replace(n,i);return t}function Bb(t){return new RegExp(`\\b${t}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function Ub(t,e){let n="";for(const i in t){const r=t[i];if(n+=`void ${r.signature} {\n`,r.header&&(n+=` ${r.header}`),e[i]){const t=e[i];t.sort(((t,e)=>t.order-e.order));for(const e of t)n+=` ${e.injection}\n`}r.footer&&(n+=` ${r.footer}`),n+="}\n"}return n}function zb(t){const e={vertex:{},fragment:{}};for(const n of t){let t,i;"string"!==typeof n?(t=n,i=t.hook):(t={},i=n),i=i.trim();const[r,s]=i.split(":"),o=i.replace(/\(.+/,""),a=Object.assign(t,{signature:s});switch(r){case"vs":e.vertex[o]=a;break;case"fs":e.fragment[o]=a;break;default:throw new Error(r)}}return e}function jb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unnamed";const n=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(t);return n?n[1]:e}function Vb(t){let e=100;const n=t.match(/[^\s]+/g);if(n&&n.length>=2&&"#version"===n[0]){const t=parseInt(n[1],10);Number.isFinite(t)&&(e=t)}if(100!==e&&300!==e)throw new Error(`Invalid GLSL version ${e}`);return e}const Wb=`\n\n${Sb}\n`,$b="precision highp float;\n";function Gb(t,e){const{source:n,stage:i,modules:r,hookFunctions:s=[],inject:o={},log:a}=e;mb("string"===typeof n,"shader source must be a string");const l=n;let c="";const u=zb(s),h={},d={},p={};for(const g in o){const t="string"===typeof o[g]?{injection:o[g],order:0}:o[g],e=/^(v|f)s:(#)?([\w-]+)$/.exec(g);if(e){const n=e[2],i=e[3];n?"decl"===i?d[g]=[t]:p[g]=[t]:h[g]=[t]}else p[g]=[t]}const f="webgpu"!==t.type?r:[];for(const g of f){a&&g.checkDeprecations(l,a);c+=g.getModuleSource(i,"wgsl");const t=g.injections[i];for(const e in t){const n=/^(v|f)s:#([\w-]+)$/.exec(e);if(n){const i="decl"===n[2]?d:p;i[e]=i[e]||[],i[e].push(t[e])}else h[e]=h[e]||[],h[e].push(t[e])}}return c+=Wb,c=Cb(c,i,d),c+=Ub(u[i],h),c+=l,c=Cb(c,i,p),c}function Hb(t,e){const{id:n,source:i,stage:r,language:s="glsl",modules:o,defines:a={},hookFunctions:l=[],inject:c={},prologue:u=!0,log:h}=e;mb("string"===typeof i,"shader source must be a string");const d="glsl"===s?function(t,e){return{name:jb(t,e),language:"glsl",version:Vb(t)}}(i).version:-1,p=t.shaderLanguageVersion,f=100===d?"#version 100":"#version 300 es",g=i.split("\n").slice(1).join("\n"),m={};o.forEach((t=>{Object.assign(m,t.getDefines())})),Object.assign(m,a);let _="";switch(s){case"wgsl":break;case"glsl":_=u?`${f}\n\n// ----- PROLOGUE -------------------------\n${function(t){const{id:e,source:n,stage:i}=t,r=e&&-1===n.indexOf("SHADER_NAME");return r?`\n#define SHADER_NAME ${e}_${i}\n\n`:""}({id:n,source:i,stage:r})}\n#define SHADER_TYPE_${r.toUpperCase()}\n${function(t){switch(t?.gpu.toLowerCase()){case"apple":return"#define APPLE_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n";case"nvidia":return"#define NVIDIA_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n";case"intel":return"#define INTEL_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n";case"amd":return"#define AMD_GPU\n";default:return"#define DEFAULT_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n"}}(t)}\n${"fragment"===r?$b:""}\n\n// ----- APPLICATION DEFINES -------------------------\n\n${function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="";for(const n in t){const i=t[n];(i||Number.isFinite(i))&&(e+=`#define ${n.toUpperCase()} ${t[n]}\n`)}return e}(m)}\n\n`:`${f}\n`}const y=zb(l),v={},b={},w={};for(const E in c){const t="string"===typeof c[E]?{injection:c[E],order:0}:c[E],e=/^(v|f)s:(#)?([\w-]+)$/.exec(E);if(e){const n=e[2],i=e[3];n?"decl"===i?b[E]=[t]:w[E]=[t]:v[E]=[t]}else w[E]=[t]}for(const E of o){h&&E.checkDeprecations(g,h);_+=E.getModuleSource(r);const t=E.injections[r];for(const e in t){const n=/^(v|f)s:#([\w-]+)$/.exec(e);if(n){const i="decl"===n[2]?b:w;i[e]=i[e]||[],i[e].push(t[e])}else v[e]=v[e]||[],v[e].push(t[e])}}return _+="// ----- MAIN SHADER SOURCE -------------------------",_+=Wb,_=Cb(_,r,b),_+=Ub(y[r],v),_+=g,_=Cb(_,r,w),"glsl"===s&&d!==p&&(_=function(t,e){if(300!==Number(t.match(/^#version[ \t]+(\d+)/m)?.[1]||100))throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(e){case"vertex":return Fb(t,Ob);case"fragment":return Fb(t,Db);default:throw new Error(e)}}(_,r)),_.trim()}function qb(t){return function(e){const n={};for(const i of t){const t=i.getUniforms(e,n);Object.assign(n,t)}return n}}class Zb{static defaultShaderAssembler;_hookFunctions=[];_defaultModules=[];static getDefaultShaderAssembler(){return Zb.defaultShaderAssembler=Zb.defaultShaderAssembler||new Zb,Zb.defaultShaderAssembler}addDefaultModule(t){this._defaultModules.find((e=>e.name===("string"===typeof t?t:t.name)))||this._defaultModules.push(t)}removeDefaultModule(t){const e="string"===typeof t?t:t.name;this._defaultModules=this._defaultModules.filter((t=>t.name!==e))}addShaderHook(t,e){e&&(t=Object.assign(e,{hook:t})),this._hookFunctions.push(t)}assembleShader(t){const e=this._getModuleList(t.modules),n=this._hookFunctions,i=Rb(t),r=function(t){const e=Ib(t.modules||[]);return{source:Gb(t.platformInfo,{...t,source:t.source,stage:"vertex",modules:e}),getUniforms:qb(e)}}({platformInfo:t.platformInfo,...i,modules:e,hookFunctions:n});return{...r,modules:e}}assembleShaderPair(t){const e=Rb(t),n=this._getModuleList(t.modules),i=this._hookFunctions,{platformInfo:r}=t,s="wgsl"===t.platformInfo.shaderLanguage?function(t){const e=Ib(t.modules||[]);return{vs:Gb(t.platformInfo,{...t,source:t.vs,stage:"vertex",modules:e}),fs:Gb(t.platformInfo,{...t,source:t.fs,stage:"fragment",modules:e}),getUniforms:qb(e)}}({platformInfo:r,...e,modules:n,hookFunctions:i}):function(t){const{vs:e,fs:n}=t,i=Ib(t.modules||[]);return{vs:Hb(t.platformInfo,{...t,source:e,stage:"vertex",modules:i}),fs:Hb(t.platformInfo,{...t,source:n,stage:"fragment",modules:i}),getUniforms:qb(i)}}({platformInfo:r,...e,modules:n,hookFunctions:i});return{...s,modules:n}}_getModuleList(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=new Array(this._defaultModules.length+t.length),n={};let i=0;for(let r=0,s=this._defaultModules.length;r<s;++r){const t=this._defaultModules[r],s=t.name;e[i++]=t,n[s]=!0}for(let r=0,s=t.length;r<s;++r){const s=t[r],o=s.name;n[o]||(e[i++]=s,n[o]=!0)}return e.length=i,Pb.instantiateModules(e)}}const Xb={name:"fp32",vs:"#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\nconst float TWO_PI = 6.2831854820251465;\nconst float PI_2 = 1.5707963705062866;\nconst float PI_16 = 0.1963495463132858;\nconst float SIN_TABLE_0 = 0.19509032368659973;\nconst float SIN_TABLE_1 = 0.3826834261417389;\nconst float SIN_TABLE_2 = 0.5555702447891235;\nconst float SIN_TABLE_3 = 0.7071067690849304;\nconst float COS_TABLE_0 = 0.9807852506637573;\nconst float COS_TABLE_1 = 0.9238795042037964;\nconst float COS_TABLE_2 = 0.8314695954322815;\nconst float COS_TABLE_3 = 0.7071067690849304;\nconst float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;\nconst float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;\nconst float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;\nconst float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;\nfloat sin_taylor_fp32(float a) {\nfloat r, s, t, x;\nif (a == 0.0) {\nreturn 0.0;\n}\nx = -a * a;\ns = a;\nr = a;\nr = r * x;\nt = r * INVERSE_FACTORIAL_3;\ns = s + t;\nr = r * x;\nt = r * INVERSE_FACTORIAL_5;\ns = s + t;\nr = r * x;\nt = r * INVERSE_FACTORIAL_7;\ns = s + t;\nr = r * x;\nt = r * INVERSE_FACTORIAL_9;\ns = s + t;\nreturn s;\n}\nvoid sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {\nif (a == 0.0) {\nsin_t = 0.0;\ncos_t = 1.0;\n}\nsin_t = sin_taylor_fp32(a);\ncos_t = sqrt(1.0 - sin_t * sin_t);\n}\nfloat tan_taylor_fp32(float a) {\nfloat sin_a;\nfloat cos_a;\nif (a == 0.0) {\nreturn 0.0;\n}\nfloat z = floor(a / TWO_PI);\nfloat r = a - TWO_PI * z;\nfloat t;\nfloat q = floor(r / PI_2 + 0.5);\nint j = int(q);\nif (j < -2 || j > 2) {\nreturn 1.0 / 0.0;\n}\nt = r - PI_2 * q;\nq = floor(t / PI_16 + 0.5);\nint k = int(q);\nint abs_k = int(abs(float(k)));\nif (abs_k > 4) {\nreturn 1.0 / 0.0;\n} else {\nt = t - PI_16 * q;\n}\nfloat u = 0.0;\nfloat v = 0.0;\nfloat sin_t, cos_t;\nfloat s, c;\nsincos_taylor_fp32(t, sin_t, cos_t);\nif (k == 0) {\ns = sin_t;\nc = cos_t;\n} else {\nif (abs(float(abs_k) - 1.0) < 0.5) {\nu = COS_TABLE_0;\nv = SIN_TABLE_0;\n} else if (abs(float(abs_k) - 2.0) < 0.5) {\nu = COS_TABLE_1;\nv = SIN_TABLE_1;\n} else if (abs(float(abs_k) - 3.0) < 0.5) {\nu = COS_TABLE_2;\nv = SIN_TABLE_2;\n} else if (abs(float(abs_k) - 4.0) < 0.5) {\nu = COS_TABLE_3;\nv = SIN_TABLE_3;\n}\nif (k > 0) {\ns = u * sin_t + v * cos_t;\nc = u * cos_t - v * sin_t;\n} else {\ns = u * sin_t - v * cos_t;\nc = u * cos_t + v * sin_t;\n}\n}\nif (j == 0) {\nsin_a = s;\ncos_a = c;\n} else if (j == 1) {\nsin_a = c;\ncos_a = -s;\n} else if (j == -1) {\nsin_a = -c;\ncos_a = s;\n} else {\nsin_a = -s;\ncos_a = -c;\n}\nreturn sin_a / cos_a;\n}\n#endif\nfloat tan_fp32(float a) {\n#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\nreturn tan_taylor_fp32(a);\n#else\nreturn tan(a);\n#endif\n}\n"},Kb="#define SMOOTH_EDGE_RADIUS 0.5",Yb={name:"geometry",vs:`\n${Kb}\n\nstruct VertexGeometry {\n vec4 position;\n vec3 worldPosition;\n vec3 worldPositionAlt;\n vec3 normal;\n vec2 uv;\n vec3 pickingColor;\n} geometry = VertexGeometry(\n vec4(0.0, 0.0, 1.0, 0.0),\n vec3(0.0),\n vec3(0.0),\n vec3(0.0),\n vec2(0.0),\n vec3(0.0)\n);\n`,fs:`\n${Kb}\n\nstruct FragmentGeometry {\n vec2 uv;\n} geometry;\n\nfloat smoothedge(float edge, float x) {\n return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);\n}\n`};function Jb(t){if("undefined"!==typeof window&&"renderer"===window.process?.type)return!0;if("undefined"!==typeof process&&Boolean(process.versions?.electron))return!0;const e="undefined"!==typeof navigator&&navigator.userAgent,n=t||e;return Boolean(n&&n.indexOf("Electron")>=0)}function Qb(){return!("object"===typeof process&&"[object process]"===String(process)&&!process?.browser)||Jb()}const tw="4.0.7";class ew{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";this.storage=function(t){try{const e=window[t],n="__storage_test__";return e.setItem(n,n),e.removeItem(n),e}catch(_G){return null}}(n),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let t={};if(this.storage){const e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}var nw;!function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(nw||(nw={}));const iw=10;function rw(t){return"string"!==typeof t?t:(t=t.toUpperCase(),nw[t]||nw.WHITE)}function sw(t,e){if(!t)throw new Error(e||"Assertion failed")}const ow=globalThis,aw=(globalThis.document,globalThis.process||{}),lw=(globalThis.console,globalThis.navigator||{});function cw(){let t;if(Qb()&&ow.performance)t=ow?.performance?.now?.();else if("hrtime"in aw){const e=aw?.hrtime?.();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}const uw={debug:Qb()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},hw={enabled:!0,level:0};function dw(){}const pw={},fw={once:!0};class gw{constructor(){let{id:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};this.VERSION=tw,this._startTs=cw(),this._deltaTs=cw(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new ew(`__probe-${this.id}__`,hw),this.timeStamp(`${this.id} started`),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const n=Object.getPrototypeOf(t),i=Object.getOwnPropertyNames(n),r=t;for(const s of i){const n=r[s];"function"===typeof n&&(e.find((t=>s===t))||(r[s]=n.bind(t)))}}(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((cw()-this._startTs).toPrecision(10))}getDelta(){return Number((cw()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[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,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){if(!t)throw new Error(e||"Assertion failed")}warn(t){return this._getLogFunction(0,t,uw.warn,arguments,fw)}error(t){return this._getLogFunction(0,t,uw.error,arguments)}deprecated(t,e){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${e}\` instead`)}removed(t,e){return this.error(`\`${t}\` has been removed. Use \`${e}\` instead`)}probe(t,e){return this._getLogFunction(t,e,uw.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,uw.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,uw.debug||uw.info,arguments,fw)}table(t,e,n){return e?this._getLogFunction(t,e,console.table||dw,n&&[n],{tag:yw(e)}):dw}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||dw)}group(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const i=_w({logLevel:t,message:e,opts:n}),{collapsed:r}=n;return i.method=(r?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(t,e,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||dw)}withGroup(t,e,n){this.group(t,e)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=mw(t)}_getLogFunction(t,e,n,i,r){if(this._shouldLog(t)){r=_w({logLevel:t,message:e,args:i,opts:r}),sw(n=n||r.method),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=cw();const s=r.tag||r.message;if(r.once&&s){if(pw[s])return dw;pw[s]=cw()}return e=function(t,e,n){if("string"===typeof e){const i=n.time?function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const n=Math.max(e-t.length,0);return`${" ".repeat(n)}${t}`}(function(t){let e;return e=t<10?`${t.toFixed(2)}ms`:t<100?`${t.toFixed(1)}ms`:t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`,e}(n.total)):"";e=function(t,e,n){Qb||"string"!==typeof t||(e&&(t=`\x1b[${rw(e)}m${t}\x1b[39m`),n&&(t=`\x1b[${rw(n)+iw}m${t}\x1b[49m`));return t}(e=n.time?`${t}: ${i} ${e}`:`${t}: ${e}`,n.color,n.background)}return e}(this.id,r.message,r),n.bind(console,e,...r.args)}return dw}}function mw(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return sw(Number.isFinite(e)&&e>=0),e}function _w(t){const{logLevel:e,message:n}=t;t.logLevel=mw(e);const i=t.args?Array.from(t.args):[];for(;i.length&&i.shift()!==n;);switch(typeof e){case"string":case"function":void 0!==n&&i.unshift(n),t.message=e;break;case"object":Object.assign(t,e)}"function"===typeof t.message&&(t.message=t.message());const r=typeof t.message;return sw("string"===r||"object"===r),Object.assign(t,{args:i},t.opts)}function yw(t){for(const e in t)for(const n in t[e])return n||"untitled";return"empty"}gw.VERSION=tw;const vw=new gw({id:"deck"}),bw={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(bw,"IDENTITY",{get:()=>(vw.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});const ww={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},Ew={common:0,meters:1,pixels:2},xw={click:{handler:"onClick"},panstart:{handler:"onDragStart"},panmove:{handler:"onDrag"},panend:{handler:"onDragEnd"}},Sw=`${Object.keys(bw).map((t=>`const int COORDINATE_SYSTEM_${t} = ${bw[t]};`)).join("")}\n${Object.keys(ww).map((t=>`const int PROJECTION_MODE_${t} = ${ww[t]};`)).join("")}\n${Object.keys(Ew).map((t=>`const int UNIT_${t.toUpperCase()} = ${Ew[t]};`)).join("")}\nuniform int project_uCoordinateSystem;\nuniform int project_uProjectionMode;\nuniform float project_uScale;\nuniform bool project_uWrapLongitude;\nuniform vec3 project_uCommonUnitsPerMeter;\nuniform vec3 project_uCommonUnitsPerWorldUnit;\nuniform vec3 project_uCommonUnitsPerWorldUnit2;\nuniform vec4 project_uCenter;\nuniform mat4 project_uModelMatrix;\nuniform mat4 project_uViewProjectionMatrix;\nuniform vec2 project_uViewportSize;\nuniform float project_uDevicePixelRatio;\nuniform float project_uFocalDistance;\nuniform vec3 project_uCameraPosition;\nuniform vec3 project_uCoordinateOrigin;\nuniform vec3 project_uCommonOrigin;\nuniform bool project_uPseudoMeters;\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / (PI * 2.0);\nconst vec3 ZERO_64_LOW = vec3(0.0);\nconst float EARTH_RADIUS = 6370972.0;\nconst float GLOBE_RADIUS = 256.0;\nfloat project_size_at_latitude(float lat) {\nfloat y = clamp(lat, -89.9, 89.9);\nreturn 1.0 / cos(radians(y));\n}\nfloat project_size() {\nif (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR &&\nproject_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT &&\nproject_uPseudoMeters == false) {\nif (geometry.position.w == 0.0) {\nreturn project_size_at_latitude(geometry.worldPosition.y);\n}\nfloat y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;
2\nfloat y2 = y * y;\nfloat y4 = y2 * y2;\nfloat y6 = y4 * y2;\nreturn 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;\n}\nreturn 1.0;\n}\nfloat project_size_at_latitude(float meters, float lat) {\nreturn meters * project_uCommonUnitsPerMeter.z * project_size_at_latitude(lat);\n}\nfloat project_size(float meters) {\nreturn meters * project_uCommonUnitsPerMeter.z * project_size();\n}\nvec2 project_size(vec2 meters) {\nreturn meters * project_uCommonUnitsPerMeter.xy * project_size();\n}\nvec3 project_size(vec3 meters) {\nreturn meters * project_uCommonUnitsPerMeter * project_size();\n}\nvec4 project_size(vec4 meters) {\nreturn vec4(meters.xyz * project_uCommonUnitsPerMeter, meters.w);\n}\nmat3 project_get_orientation_matrix(vec3 up) {\nvec3 uz = normalize(up);\nvec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));\nvec3 uy = cross(uz, ux);\nreturn mat3(ux, uy, uz);\n}\nbool project_needs_rotation(vec3 commonPosition, out mat3 transform) {\nif (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\ntransform = project_get_orientation_matrix(commonPosition);\nreturn true;\n}\nreturn false;\n}\nvec3 project_normal(vec3 vector) {\nvec4 normal_modelspace = project_uModelMatrix * vec4(vector, 0.0);\nvec3 n = normalize(normal_modelspace.xyz * project_uCommonUnitsPerMeter);\nmat3 rotation;\nif (project_needs_rotation(geometry.position.xyz, rotation)) {\nn = rotation * n;\n}\nreturn n;\n}\nvec4 project_offset_(vec4 offset) {\nfloat dy = offset.y;\nvec3 commonUnitsPerWorldUnit = project_uCommonUnitsPerWorldUnit + project_uCommonUnitsPerWorldUnit2 * dy;\nreturn vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);\n}\nvec2 project_mercator_(vec2 lnglat) {\nfloat x = lnglat.x;
2\nif (project_uWrapLongitude) {\nx = mod(x + 180., 360.0) - 180.;\n}\nfloat y = clamp(lnglat.y, -89.9, 89.9);\nreturn vec2(\nradians(x) + PI,\nPI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))\n) * WORLD_SCALE;\n}\nvec3 project_globe_(vec3 lnglatz) {\nfloat lambda = radians(lnglatz.x);\nfloat phi = radians(lnglatz.y);\nfloat cosPhi = cos(phi);\nfloat D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;\nreturn vec3(\nsin(lambda) * cosPhi,\n-cos(lambda) * cosPhi,\nsin(phi)\n) * D;\n}\nvec4 project_position(vec4 position, vec3 position64Low) {\nvec4 position_world = project_uModelMatrix * position;\nif (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR) {\nif (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\nreturn vec4(\nproject_mercator_(position_world.xy),\nproject_size_at_latitude(position_world.z, position_world.y),\nposition_world.w\n);\n}\nif (project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {\nposition_world.xyz += project_uCoordinateOrigin;\n}\n}\nif (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\nif (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\nreturn vec4(\nproject_globe_(position_world.xyz),\nposition_world.w\n);\n}\n}\nif (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\nif (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\nif (abs(position_world.y - project_uCoordinateOrigin.y) > 0.25) {\nreturn vec4(\nproject_mercator_(position_world.xy) - project_uCommonOrigin.xy,\nproject_size(position_world.z),\nposition_world.w\n);\n}\n}\n}\nif (project_uProjectionMode == PROJECTION_MODE_IDENTITY ||\n(project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&\n(project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\nproject_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {\nposition_world.xyz -= project_uCoordinateOrigin;\n}\nreturn project_offset_(position_world) + project_offset_(project_uModelMatrix * vec4(position64Low, 0.0));\n}\nvec4 project_position(vec4 position) {\nreturn project_position(position, ZERO_64_LOW);\n}\nvec3 project_position(vec3 position, vec3 position64Low) {\nvec4 projected_position = project_position(vec4(position, 1.0), position64Low);\nreturn projected_position.xyz;\n}\nvec3 project_position(vec3 position) {\nvec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);\nreturn projected_position.xyz;\n}\nvec2 project_position(vec2 position) {\nvec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);\nreturn projected_position.xy;\n}\nvec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {\nreturn viewProjectionMatrix * position + center;\n}\nvec4 project_common_position_to_clipspace(vec4 position) {\nreturn project_common_position_to_clipspace(position, project_uViewProjectionMatrix, project_uCenter);\n}\nvec2 project_pixel_size_to_clipspace(vec2 pixels) {\nvec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio * 2.0;\nreturn offset * project_uFocalDistance;\n}\nfloat project_size_to_pixel(float meters) {\nreturn project_size(meters) * project_uScale;\n}\nfloat project_size_to_pixel(float size, int unit) {\nif (unit == UNIT_METERS) return project_size_to_pixel(size);\nif (unit == UNIT_COMMON) return size * project_uScale;\nreturn size;\n}\nfloat project_pixel_size(float pixels) {\nreturn pixels / project_uScale;\n}\nvec2 project_pixel_size(vec2 pixels) {\nreturn pixels / project_uScale;\n}\n`,Tw=1e-6;let Cw="undefined"!==typeof Float32Array?Float32Array:Array;Math.random;Math.PI;function Aw(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function Pw(t){const e=t[0],n=t[1],i=t[2],r=t[3];return Math.sqrt(e*e+n*n+i*i+r*r)}function Rw(t){const e=t[0],n=t[1],i=t[2],r=t[3];return e*e+n*n+i*i+r*r}function Mw(t,e,n){const i=e[0],r=e[1],s=e[2],o=e[3];return t[0]=n[0]*i+n[4]*r+n[8]*s+n[12]*o,t[1]=n[1]*i+n[5]*r+n[9]*s+n[13]*o,t[2]=n[2]*i+n[6]*r+n[10]*s+n[14]*o,t[3]=n[3]*i+n[7]*r+n[11]*s+n[15]*o,t}!function(){const t=function(){const t=new Cw(4);return Cw!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}();function Iw(t,e){const n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],f=e[12],g=e[13],m=e[14],_=e[15],y=n*a-i*o,v=n*l-r*o,b=n*c-s*o,w=i*l-r*a,E=i*c-s*a,x=r*c-s*l,S=u*g-h*f,T=u*m-d*f,C=u*_-p
2*f,A=h*m-d*g,P=h*_-p*g,R=d*_-p*m;let M=y*R-v*P+b*A+w*C-E*T+x*S;return M?(M=1/M,t[0]=(a*R-l*P+c*A)*M,t[1]=(r*P-i*R-s*A)*M,t[2]=(g*x-m*E+_*w)*M,t[3]=(d*E-h*x-p*w)*M,t[4]=(l*C-o*R-c*T)*M,t[5]=(n*R-r*C+s*T)*M,t[6]=(m*b-f*x-_*v)*M,t[7]=(u*x-d*b+p*v)*M,t[8]=(o*P-a*C+c*S)*M,t[9]=(i*C-n*P-s*S)*M,t[10]=(f*E-g*b+_*y)*M,t[11]=(h*b-u*E-p*y)*M,t[12]=(a*T-o*A-l*S)*M,t[13]=(n*A-i*T+r*S)*M,t[14]=(g*v-f*w-m*y)*M,t[15]=(u*w-h*v+d*y)*M,t):null}function Lw(t,e,n){const i=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=e[9],p=e[10],f=e[11],g=e[12],m=e[13],_=e[14],y=e[15];let v=n[0],b=n[1],w=n[2],E=n[3];return t[0]=v*i+b*a+w*h+E*g,t[1]=v*r+b*l+w*d+E*m,t[2]=v*s+b*c+w*p+E*_,t[3]=v*o+b*u+w*f+E*y,v=n[4],b=n[5],w=n[6],E=n[7],t[4]=v*i+b*a+w*h+E*g,t[5]=v*r+b*l+w*d+E*m,t[6]=v*s+b*c+w*p+E*_,t[7]=v*o+b*u+w*f+E*y,v=n[8],b=n[9],w=n[10],E=n[11],t[8]=v*i+b*a+w*h+E*g,t[9]=v*r+b*l+w*d+E*m,t[10]=v*s+b*c+w*p+E*_,t[11]=v*o+b*u+w*f+E*y,v=n[12],b=n[13],w=n[14],E=n[15],t[12]=v*i+b*a+w*h+E*g,t[13]=v*r+b*l+w*d+E*m,t[14]=v*s+b*c+w*p+E*_,t[15]=v*o+b*u+w*f+E*y,t}function kw(t,e,n){const i=n[0],r=n[1],s=n[2];let o,a,l,c,u,h,d,p,f,g,m,_;return e===t?(t[12]=e[0]*i+e[4]*r+e[8]*s+e[12],t[13]=e[1]*i+e[5]*r+e[9]*s+e[13],t[14]=e[2]*i+e[6]*r+e[10]*s+e[14],t[15]=e[3]*i+e[7]*r+e[11]*s+e[15]):(o=e[0],a=e[1],l=e[2],c=e[3],u=e[4],h=e[5],d=e[6],p=e[7],f=e[8],g=e[9],m=e[10],_=e[11],t[0]=o,t[1]=a,t[2]=l,t[3]=c,t[4]=u,t[5]=h,t[6]=d,t[7]=p,t[8]=f,t[9]=g,t[10]=m,t[11]=_,t[12]=o*i+u*r+f*s+e[12],t[13]=a*i+h*r+g*s+e[13],t[14]=l*i+d*r+m*s+e[14],t[15]=c*i+p*r+_*s+e[15]),t}function Nw(t,e,n){const i=n[0],r=n[1],s=n[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Ow(t,e,n){const i=Math.sin(n),r=Math.cos(n),s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*r+c*i,t[5]=o*r+u*i,t[6]=a*r+h*i,t[7]=l*r+d*i,t[8]=c*r-s*i,t[9]=u*r-o*i,t[10]=h*r-a*i,t[11]=d*r-l*i,t}function Dw(t,e,n){const i=Math.sin(n),r=Math.cos(n),s=e[0],o=e[1],a=e[2],l=e[3],c=e[4],u=e[5],h=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*r+c*i,t[1]=o*r+u*i,t[2]=a*r+h*i,t[3]=l*r+d*i,t[4]=c*r-s*i,t[5]=u*r-o*i,t[6]=h*r-a*i,t[7]=d*r-l*i,t}function Fw(t,e){const n=e[0],i=e[1],r=e[2],s=e[4],o=e[5],a=e[6],l=e[8],c=e[9],u=e[10];return t[0]=Math.sqrt(n*n+i*i+r*r),t[1]=Math.sqrt(s*s+o*o+a*a),t[2]=Math.sqrt(l*l+c*c+u*u),t}const Bw=function(t,e,n,i,r){const s=1/Math.tan(e/2);if(t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=r&&r!==1/0){const e=1/(i-r);t[10]=(r+i)*e,t[14]=2*r*i*e}else t[10]=-1,t[14]=-2*i;return t};const Uw=function(t,e,n,i,r,s,o){const a=1/(e-n),l=1/(i-r),c=1/(s-o);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*a,t[13]=(r+i)*l,t[14]=(o+s)*c,t[15]=1,t};function zw(t,e){if(t===e)return!0;if(Array.isArray(t)){const n=t.length;if(!e||e.length!==n)return!1;for(let i=0;i<n;i++)if(t[i]!==e[i])return!1;return!0}return!1}function jw(t){let e,n={};return i=>{for(const r in i)if(!zw(i[r],n[r])){e=t(i),n=i;break}return e}}const Vw=[0,0,0,0],Ww=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],$w=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Gw=[0,0,0],Hw=[0,0,0],qw=jw((function(t){let{viewport:e,devicePixelRatio:n,coordinateSystem:i,coordinateOrigin:r}=t;const{projectionCenter:s,viewProjectionMatrix:o,originCommon:a,cameraPosCommon:l,shaderCoordinateOrigin:c,geospatialOrigin:u}=function(t,e,n){const{viewMatrixUncentered:i,projectionMatrix:r}=t;let{viewMatrix:s,viewProjectionMatrix:o}=t,a=Vw,l=Vw,c=t.cameraPosition;const{geospatialOrigin:u,shaderCoordinateOrigin:h,offsetMode:d}=Zw(t,e,n);d&&(l=t.projectPosition(u||h),c=[c[0]-l[0],c[1]-l[1],c[2]-l[2]],l[3]=1,a=Mw([],l,o),s=i||s,o=Lw([],r,s),o=Lw([],o,Ww));return{viewMatrix:s,viewProjectionMatrix:o,projectionCenter:a,originCommon:l,cameraPosCommon:c,shaderCoordinateOrigin:h,geospatialOrigin:u}}(e,i,r),h=e.getDistanceScales(),d=[e.width*n,e.height*n],p=Mw([],[0,0,-e.focalDistance,1],e.projectionMatrix)[3]||1,f={project_uCoordinateSystem:i,project_uProjectionMode:e.projectionMode,project_uCoordinateOrigin:c,project_uCommonOrigin:a.slice(0,3),project_uCenter:s,project_uPseudoMeters:Boolean(e._pseudoMeters),project_uViewportSize:d,project_uDevicePixelRatio:n,project_uFocalDistance:p,project_uCommonUnitsPerMeter:h.unitsPerMeter,project_uCommonUnitsPerWorldUnit:h.unitsPerMeter,project_uCommonUnitsPerWorldUnit2:Gw,project_uScale:e.scale,project_uWrapLongitude:!1,project_uViewProjectionMatrix:o,project_uModelMatrix:$w,project_uCameraPosition:l};if(u){const t=e.getDistanceScales(u);switch(i){case bw.METER_OFFSETS:f.project_uCommonUnitsPerWorldUnit=t.unitsPerMeter,f.project_uCommonUnitsPerWorldUnit2=t.unitsPerMeter2;break;case bw.LNGLAT:case bw.LNGLAT_OFFSETS:e._pseudoMeters||(f.project_uCommonUnitsPerMeter=t.unitsPerMeter),f.project_uCommonUnitsPerWorldUnit=t.unitsPerDegree,f.project_uCommonUnitsPerWorldUnit2=t.unitsPerDegree2;break;case bw.CARTESIAN:f.project_uCommonUnitsPerWorldUnit=[1,1,t.unitsPerMeter[2]],f.project_uCommonUnitsPerWorldUnit2=[0,0,t.unitsPerMeter2[2]]}}return f}));function Zw(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Hw;n.length<3&&(n=[n[0],n[1],0]);let i,r=n,s=!0;switch(i=e===bw.LNGLAT_OFFSETS||e===bw.METER_OFFSETS?n:t.isGeospatial?[Math.fround(t.longitude),Math.fround(t.latitude),0]:null,t.projectionMode){case ww.WEB_MERCATOR:e!==bw.LNGLAT&&e!==bw.CARTESIAN||(i=[0,0,0],s=!1);break;
2case ww.WEB_MERCATOR_AUTO_OFFSET:e===bw.LNGLAT?r=i:e===bw.CARTESIAN&&(r=[Math.fround(t.center[0]),Math.fround(t.center[1]),0],i=t.unprojectPosition(r),r[0]-=n[0],r[1]-=n[1],r[2]-=n[2]);break;case ww.IDENTITY:r=t.position.map(Math.fround),r[2]=r[2]||0;break;case ww.GLOBE:s=!1,i=null;break;default:s=!1}return{geospatialOrigin:i,shaderCoordinateOrigin:r,offsetMode:s}}const Xw={};const Kw={name:"project",dependencies:[Xb,Yb],vs:Sw,getUniforms:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xw;return"viewport"in t?function(t){let{viewport:e,devicePixelRatio:n=1,modelMatrix:i=null,coordinateSystem:r=bw.DEFAULT,coordinateOrigin:s=Hw,autoWrapLongitude:o=!1}=t;r===bw.DEFAULT&&(r=e.isGeospatial?bw.LNGLAT:bw.CARTESIAN);const a=qw({viewport:e,devicePixelRatio:n,coordinateSystem:r,coordinateOrigin:s});return a.project_uWrapLongitude=o,a.project_uModelMatrix=i||$w,a}(t):{}}},Yw=[Kw],Jw=["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)"];function Qw(){const t=Zb.getDefaultShaderAssembler();for(const e of Yw)t.addDefaultModule(e);for(const e of Jw)t.addShaderHook(e);return t}const tE="Awaiting state",eE="Matched. State transferred from previous layer",nE="Initialized",iE="Discarded. Awaiting garbage collection",rE="No longer matched. Awaiting garbage collection",sE="Finalized! Awaiting garbage collection",oE=Symbol.for("component"),aE=Symbol.for("propTypes"),lE=Symbol.for("deprecatedProps"),cE=Symbol.for("asyncPropDefaults"),uE=Symbol.for("asyncPropOriginal"),hE=Symbol.for("asyncPropResolved");let dE={};function pE(t){dE=t}function fE(t,e,n,i){vw.level>0&&dE[t]&&dE[t].call(null,e,n,i)}function gE(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;return Array.isArray(t)?mE(t,e,[]):e(t)?[t]:[]}function mE(t,e,n){let i=-1;for(;++i<t.length;){const r=t[i];Array.isArray(r)?mE(r,e,n):e(r)&&n.push(r)}return n}function _E(t){let{target:e,source:n,start:i=0,count:r=1}=t;const s=n.length,o=r*s;let a=0;for(let l=i;a<s;a++)e[l++]=n[a];for(;a<o;)a<o-a?(e.copyWithin(i+a,i,i+a),a*=2):(e.copyWithin(i+a,i,i+o-a),a=o);return e}function yE(){let t;if("undefined"!==typeof window&&window.performance)t=window.performance.now();else if("undefined"!==typeof process&&process.hrtime){const e=process.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}class vE{constructor(t,e){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=e,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=yE(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(yE()-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)}}class bE{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(const t of Object.values(this.stats))t.reset();return this}forEach(t){for(const e of Object.values(this.stats))t(e)}getTable(){const t={};return this.forEach((e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}})),t}_initializeStats(){(arguments.length>
20&&void 0!==arguments[0]?arguments[0]:[]).forEach((t=>this._getOrCreate(t)))}_getOrCreate(t){const{name:e,type:n}=t;let i=this.stats[e];return i||(i=t instanceof vE?t:new vE(e,n),this.stats[e]=i),i}}const wE=t=>"boolean"===typeof t,EE=t=>"function"===typeof t,xE=t=>null!==t&&"object"===typeof t,SE=t=>xE(t)&&t.constructor==={}.constructor,TE=t=>Boolean(t)&&"function"===typeof t[Symbol.iterator],CE=t=>t&&"function"===typeof t[Symbol.asyncIterator],AE=t=>"undefined"!==typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,PE=t=>"undefined"!==typeof Blob&&t instanceof Blob,RE=t=>t&&"object"===typeof t&&t.isBuffer,ME=t=>(t=>"undefined"!==typeof ReadableStream&&t instanceof ReadableStream||xE(t)&&EE(t.tee)&&EE(t.cancel)&&EE(t.getReader))(t)||(t=>xE(t)&&EE(t.read)&&EE(t.pipe)&&wE(t.readable))(t);function IE(t,e){if(!t)throw new Error(e||"loader assertion failed.")}function LE(t){if(!t)return!1;Array.isArray(t)&&(t=t[0]);return Array.isArray(t?.extensions)}function kE(t){let e;return IE(t,"null loader"),IE(LE(t),"invalid loader"),Array.isArray(t)&&(e=t[1],t=t[0],t={...t,options:{...t.options,...e}}),(t?.parseTextSync||t?.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}let NE="";const OE={};class DE extends Error{constructor(t,e){super(t),this.reason=e.reason,this.url=e.url,this.response=e.response}reason;url;response}const FE=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,BE=/^([-\w.]+\/[-\w.+]+)/;function UE(t,e){return t.toLowerCase()===e.toLowerCase()}function zE(t){const e=FE.exec(t);return e?e[1]:""}const jE=/\?.*/;function VE(t){return t.replace(jE,"")}function WE(t){if(AE(t)){return t.url}if(PE(t)){return t.name||""}return"string"===typeof t?t:""}function $E(t){if(AE(t)){const e=t,n=e.headers.get("content-type")||"",i=VE(e.url);return function(t){const e=BE.exec(t);return e?e[1]:t}(n)||zE(i)}if(PE(t)){return t.type||""}return"string"===typeof t?zE(t):""}async function GE(t){if(AE(t))return t;const e={},n=function(t){if(AE(t))return t.headers["content-length"]||-1;if(PE(t))return t.size;return"string"===typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}(t);n>=0&&(e["content-length"]=String(n));const i=WE(t),r=$E(t);r&&(e["content-type"]=r);const s=await async function(t){const e=5;if("string"===typeof t)return`data:,${t.slice(0,e)}`;if(t instanceof Blob){const e=t.slice(0,5);return await new Promise((t=>{const n=new FileReader;n.onload=e=>t(e?.target?.result),n.readAsDataURL(e)}))}if(t instanceof ArrayBuffer){const n=function(t){let e="";const n=new Uint8Array(t);for(let i=0;i<n.byteLength;i++)e+=String.fromCharCode(n[i]);return btoa(e)}(t.slice(0,e));return`data:base64,${n}`}return null}(t);s&&(e["x-first-bytes"]=s),"string"===typeof t&&(t=(new TextEncoder).encode(t));const o=new Response(t,{headers:e});return Object.defineProperty(o,"url",{value:i}),o}async function HE(t){if(!t.ok){const e=await async function(t){const n=function(t){if(t.length<50)return t;const e=t.slice(t.length-15);return`${t.substr(0,32)}...${e}`}(t.url);let i=`Failed to fetch resource (${t.status}) ${t.statusText}: ${n}`;i=i.length>100?`${i.slice(0,100)}...`:i;const r={reason:t.statusText,url:t.url,response:t};try{const e=t.headers.get("Content-Type");r.reason=e?.includes("application/json")?await t.json():t.text()}catch(e){}return new DE(i,r)}(t);throw e}}async function qE(t,e){if("string"===typeof t){const n=function(t){for(const e in OE)if(t.startsWith(e)){const n=OE[e];t=t.replace(e,n)}return t.startsWith("http://")||t.startsWith("https://")||(t=`${NE}${t}`),t}(t);return function(t){return!function(t){return t.startsWith("http:")||t.startsWith("https:")}(t)&&!function(t){return t.startsWith("data:")}(t)}(n)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(n,e):await fetch(n,e)}return await GE(t)}const ZE=new gw({id:"loaders.gl"});class XE{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}"undefined"!==typeof self&&self,"undefined"!==typeof window&&window,"undefined"!==typeof global&&global,"undefined"!==typeof document&&document;const KE=Boolean("object"!==typeof process||"[object process]"!==String(process)||process.browser),YE="undefined"!==typeof process&&process.version&&/v([0-9]*)/.exec(process.version),JE=(YE&&parseFloat(YE[1]),{fetch:null,mimeType:void 0,nothrow:!1,log:new class{console;constructor(){this.console=console}log(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.console.log.bind(this.console,...e)}info(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.console.info.bind(this.console,...e)}warn(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.console.warn.bind(this.console,...e)}error(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.console.error.bind(this.console,...e)}}
vendor: 25,746 bytes, line 2
2,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:KE,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]}),QE={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 tx(){globalThis.loaders=globalThis.loaders||{};const{loaders:t}=globalThis;return t._state||(t._state={}),t._state}function ex(){const t=tx();return t.globalOptions=t.globalOptions||{...JE},t.globalOptions}function nx(t,e,n,i){return n=n||[],function(t,e){ix(t,null,JE,QE,e);for(const n of e){const i=t&&t[n.id]||{},r=n.options&&n.options[n.id]||{},s=n.deprecatedOptions&&n.deprecatedOptions[n.id]||{};ix(i,n.id,r,s,e)}}(t,n=Array.isArray(n)?n:[n]),sx(e,t,i)}function ix(t,e,n,i,r){const s=e||"Top level",o=e?`${e}.`:"";for(const a in t){const l=!e&&xE(t[a]);if(!(a in n)&&!("baseUri"===a&&!e)&&!("workerUrl"===a&&e))if(a in i)ZE.warn(`${s} loader option '${o}${a}' no longer supported, use '${i[a]}'`)();else if(!l){const t=rx(a,r);ZE.warn(`${s} loader option '${o}${a}' not recognized. ${t}`)()}}}function rx(t,e){const n=t.toLowerCase();let i="";for(const r of e)for(const e in r.options){if(t===e)return`Did you mean '${r.id}.${e}'?`;const s=e.toLowerCase();(n.startsWith(s)||s.startsWith(n))&&(i=i||`Did you mean '${r.id}.${e}'?`)}return i}function sx(t,e,n){const i={...t.options||{}};return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(i,n),null===i.log&&(i.log=new XE),ox(i,ex()),ox(i,e),i}function ox(t,e){for(const n in e)if(n in e){const i=e[n];SE(i)&&SE(t[n])?t[n]={...t[n],...e[n]}:t[n]=e[n]}}function ax(t,e){const n=ex(),i=t||n;return"function"===typeof i.fetch?i.fetch:xE(i.fetch)?t=>qE(t,i.fetch):e?.fetch?e?.fetch:qE}"undefined"!==typeof self&&self,"undefined"!==typeof window&&window,"undefined"!==typeof global&&global,"undefined"!==typeof document&&document;const lx="object"!==typeof process||"[object process]"!==String(process)||process.browser,cx="undefined"!==typeof window&&"undefined"!==typeof window.orientation,ux="undefined"!==typeof process&&process.version&&/v([0-9]*)/.exec(process.version);ux&&parseFloat(ux[1]);class hx{terminate(){}}function dx(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const px=new Map;function fx(t){dx(t.source&&!t.url||!t.source&&t.url);let e=px.get(t.source||t.url);return e||(t.url&&(e=function(t){if(!t.startsWith("http"))return t;return gx((e=t,`try {\n importScripts('${e}');\n} catch (error) {\n console.error(error);\n throw error;\n}`));var e}(t.url),px.set(t.url,e)),t.source&&(e=gx(t.source),px.set(t.source,e))),dx(e),e}function gx(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function mx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0;const i=n||new Set;if(t){if(_x(t))i.add(t);else if(_x(t.buffer))i.add(t.buffer);else if(ArrayBuffer.isView(t));else if(e&&"object"===typeof t)for(const r in t)mx(t[r],e,i)}else;return void 0===n?Array.from(i):[]}function _x(t){return!!t&&(t instanceof ArrayBuffer||("undefined"!==typeof MessagePort&&t instanceof MessagePort||("undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&t instanceof OffscreenCanvas)))}const yx=()=>{};class vx{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return"undefined"!==typeof Worker&&lx||"undefined"!==typeof hx&&!lx}constructor(t){const{name:e,source:n,url:i}=t;dx(n||i),this.name=e,this.source=n,this.url=i,this.onMessage=yx,this.onError=t=>console.log(t),this.worker=lx?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=yx,this.onError=yx,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||mx(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name} from ${this.url}. `,t.message&&(e+=`${t.message} in `),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=fx({source:this.source,url:this.url});const t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},t.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},t.onmessageerror=t=>console.error(t),t}_createNodeWorker(){let t;if(this.url){const e=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;t=new hx(e,{eval:!1})}else{if(!this.source)throw new Error("no worker");t=new hx(this.source,{eval:!0})}return t.on("message",(t=>{this.onMessage(t)})),t.on("error",(t=>{this.onError(t)})),t.on("exit",(t=>{})),t}}class bx{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,e){this.name=t,this.workerThread=e,this.result=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){dx(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){dx(this.isRunning),this.isRunning=!1,this._reject(t)}}class wx{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return vx.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},void 0!==t.name&&(this.name=t.name),void 0!==t.maxConcurrency&&(this.maxConcurrency=t.maxConcurrency),void 0!==t.maxMobileConcurrency&&(this.maxMobileConcurrency=t.maxMobileConcurrency),void 0!==t.reuseWorkers&&(this.reuseWorkers=t.reuseWorkers),void 0!==t.onDebug&&(this.onDebug=t.onDebug)}async startJob(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(t,e,n)=>t.done(n),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(t,e)=>t.error(e);const i=new Promise((i=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:i}),this)));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;const t=this._getAvailableWorker();if(!t)return;const e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});const n=new bx(e.name,t);t.onMessage=t=>e.onMessage(n,t.type,t.payload),t.onError=t=>e.onError(n,t),e.onStart(n);try{await n.result}catch($c){console.error(`Worker exception: ${$c}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!lx||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++;const t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new vx({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return cx?this.maxMobileConcurrency:this.maxConcurrency}}const Ex={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class xx{props;workerPools=(()=>new Map)();static _workerFarm;static isSupported(){return vx.isSupported()}static getWorkerFarm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xx._workerFarm=xx._workerFarm||new xx({}),xx._workerFarm.setProps(t),xx._workerFarm}constructor(t){this.props={...Ex},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(const e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:n,url:i}=t;let r=this.workerPools.get(e);return r||(r=new wx({name:e,source:n,url:i}),r.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,r)),r}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}const Sx="latest";const Tx=(globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.1"),globalThis._loadersgl_.version);async function Cx(t,e,n,i,r){const s=t.id,o=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e[t.id]||{},i=lx?`${t.id}-worker.js`:`${t.id}-worker-node.js`;let r=n.workerUrl;if(r||"compression"!==t.id||(r=e.workerUrl),"test"===e._workerType&&(r=lx?`modules/${t.module}/dist/${i}`:`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!r){let e=t.version;"latest"===e&&(e=Sx);const n=e?`@${e}`:"";r=`https://unpkg.com/@loaders.gl/${t.module}${n}/dist/${i}`}return dx(r),r}(t,n),a=xx.getWorkerFarm(n).getWorkerPool({name:s,url:o});n=JSON.parse(JSON.stringify(n)),i=JSON.parse(JSON.stringify(i||{}));const l=await a.startJob("process-on-worker",Ax.bind(null,r));l.postMessage("process",{input:e,options:n,context:i});const c=await l.result;return await c.result}async function Ax(t,e,n,i){switch(n){case"done":e.done(i);break;case"error":e.error(new Error(i.error));break;case"process":const{id:r,input:s,options:o}=i;try{const n=await t(s,o);e.postMessage("done",{id:r,result:n})}catch($c){const n=$c instanceof Error?$c.message:"unknown error";e.postMessage("error",{id:r,error:n})}break;default:console.warn(`parse-with-worker unknown message ${n}`)}}function Px(t,e){return Rx(t||{},e)}function Rx(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(n>3)return e;const i={...t};for(const[r,s]of Object.entries(e))s&&"object"===typeof s&&!Array.isArray(s)?i[r]=Rx(i[r]||{},e[r],n+1):i[r]=e[r];return i}function Mx(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){const e=t.map((t=>t instanceof ArrayBuffer?new Uint8Array(t):t)),n=e.reduce(((t,e)=>t+e.byteLength),0),i=new Uint8Array(n);let r=0;for(const s of e)i.set(s,r),r+=s.byteLength;return i.buffer}(e)}const Ix=262144;const Lx=262144;const kx=1048576;function Nx(t){if(function(t){return t&&"object"===typeof t&&t.isBuffer}(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return 0===t.byteOffset&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if("string"===typeof t){const e=t;return(new TextEncoder).encode(e).buffer}if(t&&"object"===typeof t&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}function Ox(t,e){return KE?async function*(t,e){const n=t.getReader();let i;try{for(;;){const t=i||n.read();e?._streamReadAhead&&(i=n.read());const{done:r,value:s}=await t;if(r)return;yield Nx(s)}}catch($c){n.releaseLock()}}(t,e):async function*(t,e){for await(const n of t)yield Nx(n)}(t)}function Dx(t,e){if("string"===typeof t)return function*(t,e){const n=e?.chunkSize||Ix;let i=0;const r=new TextEncoder;for(;i<t.length;){const e=Math.min(t.length-i,n),s=t.slice(i,i+e);i+=e,yield r.encode(s)}}(t,e);if(t instanceof ArrayBuffer)return function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){const{chunkSize:n=Lx}=e;let i=0;for(;i<t.byteLength;){const e=Math.min(t.byteLength-i,n),r=new ArrayBuffer(e),s=new Uint8Array(t,i,e);new Uint8Array(r).set(s),i+=e,yield r}}()}(t,e);if(PE(t))return async function*(t,e){const n=e?.chunkSize||kx;let i=0;for(;i<t.size;){const e=i+n,r=await t.slice(i,e).arrayBuffer();i=e,yield r}}(t,e);if(ME(t))return Ox(t,e);if(AE(t)){return Ox(t.body,e)}throw new Error("makeIterator")}const Fx="Cannot convert supplied data type";async function Bx(t,e,n){const i=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if("string"===typeof t||i)return function(t,e,n){if(e.text&&"string"===typeof t)return t;if(RE(t)&&(t=t.buffer),t instanceof ArrayBuffer){const n=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let n=t.buffer;const i=t.byteLength||t.length;return 0===t.byteOffset&&i===n.byteLength||(n=n.slice(t.byteOffset,t.byteOffset+i)),n}throw new Error(Fx)}(t,e);if(PE(t)&&(t=await GE(t)),AE(t)){const n=t;return await HE(n),e.binary?await n.arrayBuffer():await n.text()}if(ME(t)&&(t=Dx(t,n)),TE(t)||CE(t))return async function(t){const e=[];for await(const n of t)e.push(n);return Mx(...e)}(t);throw new Error(Fx)}function Ux(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function zx(t,e,n){if(n)return n;const i={fetch:ax(e,t),...t};if(i.url){const t=VE(i.url);i.baseUrl=t,i.queryString=function(t){const e=t.match(jE);return e&&e[0]}(i.url),i.filename=Ux(t),i.baseUrl=function(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}(t)}return Array.isArray(i.loaders)||(i.loaders=null),i}const jx=new gw({id:"loaders.gl"}),Vx=()=>{const t=tx();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};const Wx=/\.([^.]+)$/;function $x(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!Gx(t))return null;if(e&&!Array.isArray(e))return kE(e);let r=[];e&&(r=r.concat(e)),n?.ignoreRegisteredLoaders||r.push(...Vx()),function(t){for(const e of t)kE(e)}(r);const s=function(t,e,n,i){const r=WE(t),s=$E(t),o=VE(r)||i?.url;let a=null,l="";n?.mimeType&&(a=qx(e,n?.mimeType),l=`match forced by supplied MIME type ${n?.mimeType}`);a=a||function(t,e){const n=e&&Wx.exec(e),i=n&&n[1];return i?function(t,e){e=e.toLowerCase();for(const n of t)for(const t of n.extensions)if(t.toLowerCase()===e)return n;return null}(t,i):null}(e,o),l=l||(a?`matched url ${o}`:""),a=a||qx(e,s),l=l||(a?`matched MIME type ${s}`:""),a=a||function(t,e){if(!e)return null;for(const n of t)if("string"===typeof e){if(Zx(e,n))return n}else if(ArrayBuffer.isView(e)){if(Xx(e.buffer,e.byteOffset,n))return n}else if(e instanceof ArrayBuffer){if(Xx(e,0,n))return n}return null}(e,t),l=l||(a?`matched initial data ${Kx(t)}`:""),n?.fallbackMimeType&&(a=a||qx(e,n?.fallbackMimeType),l=l||(a?`matched fallback MIME type ${s}`:""));l&&jx.log(1,`selectLoader selected ${a?.name}: ${l}.`);return a}(t,r,n,i);if(!s&&!n?.nothrow)throw new Error(Hx(t));return s}function Gx(t){return!(t instanceof Response&&204===t.status)}function Hx(t){const e=WE(t),n=$E(t);let i="No valid loader found (";i+=e?`${Ux(e)}, `:"no url provided, ",i+=`MIME type: ${n?`"${n}"`:"not provided"}, `;const r=t?Kx(t):"";return i+=r?` first bytes: "${r}"`:"first bytes: not available",i+=")",i}function qx(t,e){for(const n of t){if(n.mimeTypes?.some((t=>UE(e,t))))return n;if(UE(e,`application/x.${n.id}`))return n}return null}function Zx(t,e){if(e.testText)return e.testText(t);return(Array.isArray(e.tests)?e.tests:[e.tests]).some((e=>t.startsWith(e)))}function Xx(t,e,n){return(Array.isArray(n.tests)?n.tests:[n.tests]).some((n=>function(t,e,n,i){if(i instanceof ArrayBuffer)return function(t,e,n){if(n=n||t.byteLength,t.byteLength<n||e.byteLength<n)return!1;const i=new Uint8Array(t),r=new Uint8Array(e);for(let s=0;s<i.length;++s)if(i[s]!==r[s])return!1;return!0}(i,t,i.byteLength);switch(typeof i){case"function":return i(t);case"string":return i===Yx(t,e,i.length);default:return!1}}(t,e,0,n)))}function Kx(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;if("string"===typeof t)return t.slice(0,e);if(ArrayBuffer.isView(t))return Yx(t.buffer,t.byteOffset,e);if(t instanceof ArrayBuffer){return Yx(t,0,e)}return""}function Yx(t,e,n){if(t.byteLength<e+n)return"";const i=new DataView(t);let r="";for(let s=0;s<n;s++)r+=String.fromCharCode(i.getUint8(e+s));return r}async function Jx(t,e,n,i){!e||Array.isArray(e)||LE(e)||(i=void 0,n=e,e=void 0),n=n||{};const r=WE(t=await t),s=function(t,e){if(t&&!Array.isArray(t))return t;let n;if(t&&(n=Array.isArray(t)?t:[t]),e&&e.loaders){const t=Array.isArray(e.loaders)?e.loaders:[e.loaders];n=n?[...n,...t]:t}return n&&n.length?n:void 0}(e,i),o=await async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!Gx(t))return null;let r=$x(t,e,{...n,nothrow:!0},i);if(r)return r;if(PE(t)&&(r=$x(t=await t.slice(0,10).arrayBuffer(),e,n,i)),!r&&!n?.nothrow)throw new Error(Hx(t));return r}(t,s,n);return o?(i=zx({url:r,_parse:Jx,loaders:s},n=nx(n,o,s,r),i||null),await async function(t,e,n,i){if(function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tx;dx(t,"no worker provided");const n=t.version}(t),n=Px(t.options,n),AE(e)){const t=e,{ok:n,redirected:r,status:s,statusText:o,type:a,url:l}=t,c=Object.fromEntries(t.headers.entries());i.response={headers:c,ok:n,redirected:r,status:s,statusText:o,type:a,url:l}}e=await Bx(e,t,n);const r=t;if(r.parseTextSync&&"string"===typeof e)return r.parseTextSync(e,n,i);if(function(t,e){return!!xx.isSupported()&&!(!lx&&!e?._nodeWorkers)&&t.worker&&e?.worker}(t,n))return await Cx(t,e,n,i,Jx);if(r.parseText&&"string"===typeof e)return await r.parseText(e,n,i);if(r.parse)return await r.parse(e,n,i);throw dx(!r.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}(o,t,n,i)):null}async function Qx(t,e,n,i){let r,s;Array.isArray(e)||LE(e)?(r=e,s=n):(r=[],s=e);const o=ax(s);let a=t;return"string"===typeof t&&(a=await o(t)),PE(t)&&(a=await o(t)),Array.isArray(r),await Jx(a,r,s)}class tS{constructor(t,e,n){this._loadCount=0,this._subscribers=new Set,this.id=t,this.context=n,this.setData(e)}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,e){if(t===this._data&&!e)return;this._data=t;const n=++this._loadCount;let i=t;"string"===typeof t&&(i=Qx(t)),i instanceof Promise?(this.isLoaded=!1,this._loader=i.then((t=>{this._loadCount===n&&(this.isLoaded=!0,this._error=void 0,this._content=t)})).catch((t=>{this._loadCount===n&&(this.isLoaded=!0,this._error=t||!0)}))):(this.isLoaded=!0,this._error=void 0,this._content=t);for(const r of this._subscribers)r.onChange(this.getData())}}class eS{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)||t in this._resources}add(t){let{resourceId:e,data:n,forceUpdate:i=!1,persistent:r=!0}=t,s=this._resources[e];s?s.setData(n,i):(s=new tS(e,n,this._context),this._resources[e]=s),s.persistent=r}remove(t){const e=this._resources[t];e&&(e.delete(),delete this._resources[t])}unsubscribe(t){let{consumerId:e}=t;const n=this._consumers[e];if(n){for(const t in n){const e=n[t],i=this._resources[e.resourceId];i&&i.unsubscribe(e)}delete this._consumers[e],this.prune()}}subscribe(t){let{resourceId:e,onChange:n,consumerId:i,requestId:r="default"}=t;const{_resources:s,protocol:o}=this;e.startsWith(o)&&(e=e.replace(o,""),s[e]||this.add({resourceId:e,data:null,persistent:!1}));const a=s[e];if(this._track(i,r,a,n),a)return a.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout((()=>this._prune()),0))}finalize(){for(const t in this._resources)this._resources[t].delete()}_track(t,e,n,i){const r=this._consumers,s=r[t]=r[t]||{};let o=s[e];const a=o&&o.resourceId&&this._resources[o.resourceId];a&&(a.unsubscribe(o),this.prune()),n&&(o?(o.onChange=i,o.resourceId=n.id):o={onChange:i,resourceId:n.id},s[e]=o,n.subscribe(o))}_prune(){this._pruneRequest=null;for(const t of Object.keys(this._resources)){const e=this._resources[t];e.persistent||e.inUse()||(e.delete(),delete this._resources[t])}}}const nS=new class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._pool=[],this.opts={overAlloc:2,poolSize:100},this.setOptions(t)}setOptions(t){Object.assign(this.opts,t)}allocate(t,e,n){let{size:i=1,type:r,padding:s=0,copy:o=!1,initialize:a=!1,maxCount:l}=n;const c=r||t&&t.constructor||Float32Array,u=e*i+s;if(ArrayBuffer.isView(t)){if(u<=t.length)return t;if(u*t.BYTES_PER_ELEMENT<=t.buffer.byteLength)return new c(t.buffer,0,u)}let h=1/0;l&&(h=l*i+s);const d=this._allocate(c,u,a,h);return t&&o?d.set(t):a||d.fill(0,0,4),this._release(t),d}release(t){this._release(t)}_allocate(t,e,n,i){let r=Math.max(Math.ceil(e*this.opts.overAlloc),1);r>i&&(r=i);const s=this._pool,o=t.BYTES_PER_ELEMENT*r,a=s.findIndex((t=>t.byteLength>=o));if(a>=0){const e=new t(s.splice(a,1)[0],0,r);return n&&e.fill(0),e}return new t(r)}_release(t){if(!ArrayBuffer.isView(t))return;const e=this._pool,{buffer:n}=t,{byteLength:i}=n,r=e.findIndex((t=>t.byteLength>=i));r<0?e.push(n):(r>0||e.length<this.opts.poolSize)&&e.splice(r,0,n),e.length>this.opts.poolSize&&e.shift()}};Math.PI,Math.PI;globalThis.mathgl=globalThis.mathgl||{config:{EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1}};const iS=globalThis.mathgl.config;function rS(t){let{precision:e=iS.precision}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=function(t){return Math.round(t/iS.EPSILON)*iS.EPSILON}(t),`${parseFloat(t.toPrecision(e))}`}function sS(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function oS(t,e,n){return cS(t,(t=>Math.max(e,Math.min(n,t))))}function aS(t,e,n){return sS(t)?t.map(((t,i)=>aS(t,e[i],n))):n*e+(1-n)*t}function lS(t,e,n){const i=iS.EPSILON;n&&(iS.EPSILON=n);try{if(t===e)return!0;if(sS(t)&&sS(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!lS(t[n],e[n]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):"number"===typeof t&&"number"===typeof e&&Math.abs(t-e)<=iS.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{iS.EPSILON=i}}function cS(t,e,n){if(sS(t)){const i=t;n=n||function(t){return t.clone?t.clone():new Array(t.length)}(i);for(let r=0;r<n.length&&r<i.length;++r){const i="number"===typeof t?t:t[r];n[r]=e(i,r,n)}return n}return e(t)}class uS extends Array{clone(){return(new this.constructor).copy(this)}fromArray(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+e];return this.check()}toArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<this.ELEMENTS;++n)t[e+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:sS(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(iS)}formatString(t){let e="";for(let n=0;n<this.ELEMENTS;++n)e+=(n>0?", ":"")+rS(this[n],t);return`${t.printTypes?this.constructor.name:""}[${e}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!lS(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,n){if(void 0===n)return this.lerp(this,t,e);for(let i=0;i<this.ELEMENTS;++i){const r=t[i],s="number"===typeof e?e:e[i];this[i]=r+n*(s-r)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),e[n]);return this.check()}add(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];for(const i of e)for(let t=0;t<this.ELEMENTS;++t)this[t]+=i[t];return this.check()}subtract(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];for(const i of e)for(let t=0;t<this.ELEMENTS;++t)this[t]-=i[t];return this.check()}scale(t){if("number"===typeof t)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;else for(let e=0;e<this.ELEMENTS&&e<t.length;++e)this[e]*=t[e];return this.check()}multiplyByScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}check(){if(iS.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 e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,e){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t),e);return this.check()}get elements(){return this}}function hS(t){if(!Number.isFinite(t))throw new Error(`Invalid number ${JSON.stringify(t)}`);return t}function dS(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(iS.debug&&!function(t,e){if(t.length!==e)return!1;for(let n=0;n<t.length;++n)if(!Number.isFinite(t[n]))return!1;return!0}(t,e))throw new Error(`math.gl: ${n}
2 some fields set to invalid numbers'`);return t}function pS(t,e){if(!t)throw new Error(`math.gl assertion ${e}`)}class fS extends uS{get x(){return this[0]}set x(t){this[0]=hS(t)}get y(){return this[1]}set y(t){this[1]=hS(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let e=0;e<this.ELEMENTS;++e)t+=this[e]*this[e];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let e=0;for(let n=0;n<this.ELEMENTS;++n){const i=this[n]-t[n];e+=i*i}return hS(e)}dot(t){let e=0;for(let n=0;n<this.ELEMENTS;++n)e+=this[n]*t[n];return hS(e)}normalize(){const t=this.magnitude();if(0!==t)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t;return this.check()}multiply(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];for(const i of e)for(let t=0;t<this.ELEMENTS;++t)this[t]*=i[t];return this.check()}divide(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];for(const i of e)for(let t=0;t<this.ELEMENTS;++t)this[t]/=i[t];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return pS(t>=0&&t<this.ELEMENTS,"index is out of range"),hS(this[t])}setComponent(t,e){return pS(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=e,this.check()}addVectors(t,e){return this.copy(t).add(e)}subVectors(t,e){return this.copy(t).subtract(e)}multiplyVectors(t,e){return this.copy(t).multiply(e)}addScaledVector(t,e){return this.add(new this.constructor(t).multiplyScalar(e))}}function gS(){const t=new Cw(3);return Cw!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function mS(t,e,n){const i=new Cw(3);return i[0]=t,i[1]=e,i[2]=n,i}function _S(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function yS(t,e,n){const i=e[0],r=e[1],s=e[2],o=n[0],a=n[1],l=n[2];return t[0]=r*l-s*a,t[1]=s*o-i*l,t[2]=i*a-r*o,t}function vS(t,e,n){const i=e[0],r=e[1],s=e[2];let o=n[3]*i+n[7]*r+n[11]*s+n[15];return o=o||1,t[0]=(n[0]*i+n[4]*r+n[8]*s+n[12])/o,t[1]=(n[1]*i+n[5]*r+n[9]*s+n[13])/o,t[2]=(n[2]*i+n[6]*r+n[10]*s+n[14])/o,t}function bS(t,e,n){const i=e[0],r=e[1],s=e[2];return t[0]=i*n[0]+r*n[3]+s*n[6],t[1]=i*n[1]+r*n[4]+s*n[7],t[2]=i*n[2]+r*n[5]+s*n[8],t}function wS(t,e,n){const i=n[0],r=n[1],s=n[2],o=n[3],a=e[0],l=e[1],c=e[2];let u=r*c-s*l,h=s*a-i*c,d=i*l-r*a,p=r*d-s*h,f=s*u-i*d,g=i*h-r*u;const m=2*o;return u*=m,h*=m,d*=m,p*=2,f*=2,g*=2,t[0]=a+u+p,t[1]=l+h+f,t[2]=c+d+g,t}const ES=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t},xS=function(t){const e=t[0],n=t[1],i=t[2];return Math.sqrt(e*e+n*n+i*i)},SS=function(t){const e=t[0],n=t[1],i=t[2];return e*e+n*n+i*i};!function(){const t=gS()}();function TS(t,e,n){const i=e[0],r=e[1],s=e[2],o=n[3]*i+n[7]*r+n[11]*s||1;return t[0]=(n[0]*i+n[4]*r+n[8]*s)/o,t[1]=(n[1]*i+n[5]*r+n[9]*s)/o,t[2]=(n[2]*i+n[6]*r+n[10]*s)/o,t}function CS(t,e,n){const i=e[0],r=e[1],s=e[2];return t[0]=n[0]*i+n[3]*r+n[6]*s,t[1]=n[1]*i+n[4]*r+n[7]*s,t[2]=n[2]*i+n[5]*r+n[8]*s,t[3]=e[3],t}const AS=[0,0,0];let PS;class RS extends fS{static get ZERO(){return PS||(PS=new RS(0,0,0),Object.freeze(PS)),PS}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;super(-0,-0,-0),1===arguments.length&&sS(t)?this.copy(t):(iS.debug&&(hS(t),hS(e),hS(n)),this[0]=t,this[1]=e,this[2]=n)}set(t,e,n){return this[0]=t,this[1]=e,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 iS.debug&&(hS(t.x),hS(t.y),hS(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]=hS(t)}angle(t){return function(t,e){const n=t[0],i=t[1],r=t[2],s=e[0],o=e[1],a=e[2],l=Math.sqrt((n*n+i*i+r*r)*(s*s+o*o+a*a)),c=l&&_S(t,e)/l;return Math.acos(Math.min(Math.max(c,-1),1))}(this,t)}cross(t){return yS(this,this,t),this.check()}rotateX(t){let{radians:e,origin:n=AS}=t;return function(t,e,n,i){const r=[],s=[];r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],s[0]=r[0],s[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),s[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2]}(this,this,n,e),this.check()}rotateY(t){let{radians:e,origin:n=AS}=t;return function(t,e,n,i){const r=[],s=[];r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],s[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),s[1]=r[1],s[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2]}(this,this,n,e),this.check()}rotateZ(t){let{radians:e,origin:n=AS}=t;return function(t,e,n,i){const r=[],s=[];r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],s[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),s[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),s[2]=r[2],t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2]}(this,this,n,e),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return vS(this,this,t),this.check()}transformAsVector(t){return TS(this,this,t),this.check()}transformByMatrix3(t){return bS(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,n){const i=e[0],r=e[1];t[0]=n[0]*i+n[2]*r,t[1]=n[1]*i+n[3]*r,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){return wS(this,this,t),this.check()}}const MS=new RS;function IS(t,e,n,i){MS.set(t,e,n);const r=MS.len();return{distance:i/r,normal:new RS(-t/r,-e/r,-n/r)}}let LS;function kS(t,e){const{size:n=1,startIndex:i=0}=e,r=void 0!==e.endIndex?e.endIndex:t.length,s=(r-i)/n;LS=nS.allocate(LS,s,{type:Float32Array,size:2*n});let o=i,a=0;for(;o<r;){for(let e=0;e<n;e++){const i=t[o++];LS[a+e]=i,LS[a+e+n]=(l=i)-Math.fround(l)}a+=2*n}var l;return LS.subarray(0,s*n*2)}function NS(t){let e=null,n=!1;for(const i of t)i&&(e?(n||(e=[[e[0][0],e[0][1]],[e[1][0],e[1][1]]],n=!0),e[0][0]=Math.min(e[0][0],i[0][0]),e[0][1]=Math.min(e[0][1],i[0][1]),e[1][0]=Math.max(e[1][0],i[1][0]),e[1][1]=Math.max(e[1][1],i[1][1])):e=i);return e}class OS extends uS{toString(){let t="[";if(iS.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+e]}`}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=` ${this[e]}`}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,n){return this[e*this.RANK+t]=hS(n),this}getColumn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Array(this.RANK).fill(-0);const n=t*this.RANK;for(let i=0;i<this.RANK;++i)e[i]=this[n+i];return e}setColumn(t,e){const n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=e[i];return this}}function DS(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function FS(t,e,n,i){const r=e[0],s=e[1];return t[0]=r+i*(n[0]-r),t[1]=s+i*(n[1]-s),t}!function(){const t=function(){const t=new Cw(2);return Cw!=Float32Array&&(t[0]=0,t[1]=0),t}()}();var BS;!function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"}(BS||(BS={}));const US=45*Math.PI/180,zS=1,jS=.1,VS=500,WS=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class $S extends OS{static get IDENTITY(){return function(){HS||(HS=new $S,Object.freeze(HS));return HS}()}static get ZERO(){return function(){GS||(GS=new $S([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(GS));return GS}()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return BS}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&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
vendor: 7,389 bytes, line 2
2]=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,e,n,i,r,s,o,a,l,c,u,h,d,p,f,g){return this[0]=t,this[1]=e,this[2]=n,this[3]=i,this[4]=r,this[5]=s,this[6]=o,this[7]=a,this[8]=l,this[9]=c,this[10]=u,this[11]=h,this[12]=d,this[13]=p,this[14]=f,this[15]=g,this.check()}setRowMajor(t,e,n,i,r,s,o,a,l,c,u,h,d,p,f,g){return this[0]=t,this[1]=r,this[2]=l,this[3]=d,this[4]=e,this[5]=s,this[6]=c,this[7]=p,this[8]=n,this[9]=o,this[10]=u,this[11]=f,this[12]=i,this[13]=a,this[14]=h,this[15]=g,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(WS)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){const n=e[0],i=e[1],r=e[2],s=e[3],o=n+n,a=i+i,l=r+r,c=n*o,u=i*o,h=i*a,d=r*o,p=r*a,f=r*l,g=s*o,m=s*a,_=s*l;t[0]=1-h-f,t[1]=u+_,t[2]=d-m,t[3]=0,t[4]=u-_,t[5]=1-c-f,t[6]=p+g,t[7]=0,t[8]=d+m,t[9]=p-g,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum(t){const{left:e,right:n,bottom:i,top:r,near:s=jS,far:o=VS}=t;return o===1/0?function(t,e,n,i,r,s){const o=2*s/(n-e),a=2*s/(r-i),l=(n+e)/(n-e),c=(r+i)/(r-i),u=-1,h=-1,d=-2*s;t[0]=o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=l,t[9]=c,t[10]=u,t[11]=h,t[12]=0,t[13]=0,t[14]=d,t[15]=0}(this,e,n,i,r,s):function(t,e,n,i,r,s,o){const a=1/(n-e),l=1/(r-i),c=1/(s-o);t[0]=2*s*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*s*l,t[6]=0,t[7]=0,t[8]=(n+e)*a,t[9]=(r+i)*l,t[10]=(o+s)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*s*2*c,t[15]=0}(this,e,n,i,r,s,o),this.check()}lookAt(t){const{eye:e,center:n=[0,0,0],up:i=[0,1,0]}=t;return function(t,e,n,i){let r,s,o,a,l,c,u,h,d,p;const f=e[0],g=e[1],m=e[2],_=i[0],y=i[1],v=i[2],b=n[0],w=n[1],E=n[2];Math.abs(f-b)<Tw&&Math.abs(g-w)<Tw&&Math.abs(m-E)<Tw?function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(h=f-b,d=g-w,p=m-E,r=1/Math.sqrt(h*h+d*d+p*p),h*=r,d*=r,p*=r,s=y*p-v*d,o=v*h-_*p,a=_*d-y*h,r=Math.sqrt(s*s+o*o+a*a),r?(r=1/r,s*=r,o*=r,a*=r):(s=0,o=0,a=0),l=d*a-p*o,c=p*s-h*a,u=h*o-d*s,r=Math.sqrt(l*l+c*c+u*u),r?(r=1/r,l*=r,c*=r,u*=r):(l=0,c=0,u=0),t[0]=s,t[1]=l,t[2]=h,t[3]=0,t[4]=o,t[5]=c,t[6]=d,t[7]=0,t[8]=a,t[9]=u,t[10]=p,t[11]=0,t[12]=-(s*f+o*g+a*m),t[13]=-(l*f+c*g+u*m),t[14]=-(h*f+d*g+p*m),t[15]=1)}(this,e,n,i),this.check()}ortho(t){const{left:e,right:n,bottom:i,top:r,near:s=jS,far:o=VS}=t;return Uw(this,e,n,i,r,s,o),this.check()}orthographic(t){const{fovy:e=US,aspect:n=zS,focalDistance:i=1,near:r=jS,far:s=VS}=t;qS(e);const o=e/2,a=i*Math.tan(o),l=a*n;return this.ortho({left:-l,right:l,bottom:-a,top:a,near:r,far:s})}perspective(t){const{fovy:e=45*Math.PI/180,aspect:n=1,near:i=.1,far:r=500}=t;return qS(e),Bw(this,e,n,i,r),this.check()}determinant(){return function(t){const e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11],p=t[12],f=t[13],g=t[14],m=e*o-n*s,_=e*a-i*s,y=n*a-i*o,v=c*f-u*p,b=c*g-h*p,w=u*g-h*f;return l*(e*w-n*b+i*v)-r*(s*w-o*b+a*v)+t[15]*(c*y-u*_+h*m)-d*(p*y-f*_+g*m)}(this)}getScale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0];return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),i=1/n[0],r=1/n[1],s=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*r,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*i,t[5]=this[5]*r,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*i,t[9]=this[9]*r,t[10]=this[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),i=1/n[0],r=1/n[1],s=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*r,t[2]=this[2]*s,t[3]=this[4]*i,t[4]=this[5]*r,t[5]=this[6]*s,t[6]=this[8]*i,t[7]=this[9]*r,t[8]=this[10]*s,t}transpose(){return function(t,e){if(t===e){const n=e[1],i=e[2],r=e[3],s=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=s,t[11]=e[14],t[12]=r,t[13]=o,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){return Iw(this,this),this.check()}multiplyLeft(t){return Lw(this,t,this),this.check()}multiplyRight(t){return Lw(this,this,t),this.check()}rotateX(t){return Ow(this,this,t),this.check()}rotateY(t){return function(t,e,n){const i=Math.sin(n),r=Math.cos(n),s=e[0],o=e[1],a=e[2],l=e[3],c=e[8],u=e[9],h=e[10],d=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*r-c*i,t[1]=o*r-u*i,t[2]=a*r-h*i,t[3]=l*r-d*i,t[8]=s*i+c*r,t[9]=o*i+u*r,t[10]=a*i+h*r,t[11]=l*i+d*r}(this,this,t),this.check()}rotateZ(t){return Dw(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return function(t,e,n,i){let r,s,o,a,l,c,u,h,d,p,f,g,m,_,y,v,b,w,E,x,S,T,C,A,P=i[0],R=i[1],M=i[2],I=Math.sqrt(P*P+R*R+M*M);I<Tw||(I=1/I,P*=I,R*=I,M*=I,s=Math.sin(n),r=Math.cos(n),o=1-r,a=e[0],l=e[1],c=e[2],u=e[3],h=e[4],d=e[5],p=e[6],f=e[7],g=e[8],m=e[9],_=e[10],y=e[11],v=P*P*o+r,b=R*P*o+M*s,w=M*P*o-R*s,E=P*R*o-M*s,x=R*R*o+r,S=M*R*o+P*s,T=P*M*o+R*s,C=R*M*o-P*s,A=M*M*o+r,t[0]=a*v+h*b+g*w,t[1]=l*v+d*b+m*w,t[2]=c*v+p*b+_*w,t[3]=u*v+f*b+y*w,t[4]=a*E+h*x+g*S,t[5]=l*E+d*x+m*S,t[6]=c*E+p*x+_*S,t[7]=u*E+f*x+y*S,t[8]=a*T+h*C+g*A,t[9]=l*T+d*C+m*A,t[10]=c*T+p*C+_*A,t[11]=u*T+f*C+y*A,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return Nw(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return kw(this,this,t),this.check()}transform(t,e){return 4===t.length?(dS(e=Mw(e||[-0,-0,-0,-0],t,this),4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:n}=t;let i;switch(n){case 2:i=function(t,e,n){const i=e[0],r=e[1];return t[0]=n[0]*i+n[4]*r+n[12],t[1]=n[1]*i+n[5]*r+n[13],t}(e||[-0,-0],t,this);break;case 3:i=vS(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return dS(i,t.length),i}transformAsVector(t,e){let n;switch(t.length){case 2:n=function(t,e,n){const i=e[0],r=e[1],s=n[3]*i+n[7]*r||1;return t[0]=(n[0]*i+n[4]*r)/s,t[1]=(n[1]*i+n[5]*r)/s,t}(e||[-0,-0],t,this);break;case 3:n=TS(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return dS(n,t.length),n}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,n){return this.identity().translate([t,e,n])}}let GS,HS;function qS(t){if(t>2*Math.PI)throw Error("expected radians")}function ZS(t,e){const n=Mw([],e,t);return Aw(n,n,1/n[3]),n}function XS(t,e){const n=t%e;return n<0?e+n:n}function KS(t,e,n){return t<e?e:t>
vendor: 6,631 bytes, line 2
2n?n:t}const YS=Math.log2||function(t){return Math.log(t)*Math.LOG2E};function JS(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}const QS=Math.PI,tT=QS/4,eT=QS/180,nT=180/QS,iT=512,rT=4003e4,sT=85.051129,oT=1.5;function aT(t){const[e,n]=t;JS(Number.isFinite(e)),JS(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");const i=n*eT;return[iT*(e*eT+QS)/(2*QS),iT*(QS+Math.log(Math.tan(tT+.5*i)))/(2*QS)]}function lT(t){const[e,n]=t,i=e/iT*(2*QS)-QS,r=2*(Math.atan(Math.exp(n/iT*(2*QS)-QS))-tT);return[i*nT,r*nT]}function cT(t){const{latitude:e}=t;JS(Number.isFinite(e));const n=Math.cos(e*eT);return function(t){return YS(t)}(rT*n)-9}function uT(t){const e=Math.cos(t*eT);return iT/rT/e}function hT(t){const{latitude:e,longitude:n,highPrecision:i=!1}=t;JS(Number.isFinite(e)&&Number.isFinite(n));const r=iT,s=Math.cos(e*eT),o=r/360,a=o/s,l=r/rT/s,c={unitsPerMeter:[l,l,l],metersPerUnit:[1/l,1/l,1/l],unitsPerDegree:[o,a,l],degreesPerUnit:[1/o,1/a,1/l]};if(i){const t=eT*Math.tan(e*eT)/s,n=o*t/2,i=r/rT*t,u=i/a*l;c.unitsPerDegree2=[0,n,i],c.unitsPerMeter2=[u,0,u]}return c}function dT(t,e){const[n,i,r]=t,[s,o,a]=e,{unitsPerMeter:l,unitsPerMeter2:c}=hT({longitude:n,latitude:i,highPrecision:!0}),u=aT(t);u[0]+=s*(l[0]+c[0]*o),u[1]+=o*(l[1]+c[1]*o);const h=lT(u),d=(r||0)+(a||0);return Number.isFinite(r)||Number.isFinite(a)?[h[0],h[1],d]:h}function pT(t){const{width:e,height:n,altitude:i,pitch:r=0,offset:s,center:o,scale:a,nearZMultiplier:l=1,farZMultiplier:c=1}=t;let{fovy:u=fT(oT)}=t;void 0!==i&&(u=fT(i));const h=u*eT,d=r*eT,p=gT(u);let f=p;o&&(f+=o[2]*a/Math.cos(d)/n);const g=h*(.5+(s?s[1]:0)/n),m=Math.sin(g)*f/Math.sin(KS(Math.PI/2-d-g,.01,Math.PI-.01)),_=Math.sin(d)*m+f,y=10*f;return{fov:h,aspect:e/n,focalDistance:p,near:l,far:Math.min(_*c,y)}}function fT(t){return 2*Math.atan(.5/t)*nT}function gT(t){return.5/Math.tan(.5*t*eT)}function mT(t,e){const[n,i,r=0]=t;return JS(Number.isFinite(n)&&Number.isFinite(i)&&Number.isFinite(r)),ZS(e,[n,i,r,1])}function _T(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const[i,r,s]=t;if(JS(Number.isFinite(i)&&Number.isFinite(r),"invalid pixel coordinate"),Number.isFinite(s)){return ZS(e,[i,r,s,1])}const o=ZS(e,[i,r,0,1]),a=ZS(e,[i,r,1,1]),l=o[2],c=a[2];return FS([],o,a,l===c?0:((n||0)-l)/(c-l))}function yT(t){const{width:e,height:n,bounds:i,minExtent:r=0,maxZoom:s=24,offset:o=[0,0]}=t,[[a,l],[c,u]]=i,h=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if("number"===typeof t)return{top:t,bottom:t,left:t,right:t};return JS(Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&Number.isFinite(t.left)&&Number.isFinite(t.right)),t}(t.padding),d=aT([a,KS(u,-85.051129,sT)]),p=aT([c,KS(l,-85.051129,sT)]),f=[Math.max(Math.abs(p[0]-d[0]),r),Math.max(Math.abs(p[1]-d[1]),r)],g=[e-h.left-h.right-2*Math.abs(o[0]),n-h.top-h.bottom-2*Math.abs(o[1])];JS(g[0]>0&&g[1]>0);const m=g[0]/f[0],_=g[1]/f[1],y=(h.right-h.left)/2/m,v=(h.top-h.bottom)/2/_,b=lT([(p[0]+d[0])/2+y,(p[1]+d[1])/2+v]),w=Math.min(s,YS(Math.abs(Math.min(m,_))));return JS(Number.isFinite(w)),{longitude:b[0],latitude:b[1],zoom:w}}const vT=Math.PI/180;function bT(t,e,n){const{pixelUnprojectionMatrix:i}=t,r=ZS(i,[e,0,1,1]),s=ZS(i,[e,t.height,1,1]),o=lT(FS([],r,s,(n*t.distanceScales.unitsPerMeter[2]-r[2])/(s[2]-r[2])));return o.push(n),o}const wT=Math.PI/180,ET=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],xT=[0,0,0],ST={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};class TT{static#t=(()=>this.displayName="Viewport")();constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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||ST,this.focalDistance=t.focalDistance||1,this.position=t.position||xT,this.modelMatrix=t.modelMatrix||null;const{longitude:e,latitude:n}=t;this.isGeospatial=Number.isFinite(n)&&Number.isFinite(e),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?ww.WEB_MERCATOR:ww.WEB_MERCATOR_AUTO_OFFSET:ww.IDENTITY}equals(t){return t instanceof TT&&(this===t||t.width===this.width&&t.height===this.height&&t.scale===this.scale&&lS(t.projectionMatrix,this.projectionMatrix)&&lS(t.viewMatrix,this.viewMatrix))}project(t){let{topLeft:e=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=mT(this.projectPosition(t),this.pixelProjectionMatrix),[i,r]=n,s=e?r:this.height-r;return 2===t.length?[i,s]:[i,s,n[2]]}unproject(t){let{topLeft:e=!0,targetZ:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const[i,r,s]=t,o=e?r:this.height-r,a=n&&n*this.distanceScales.unitsPerMeter[2],l=_T([i,o,s],this.pixelUnprojectionMatrix,a),[c,u,h]=this.unprojectPosition(l);return Number.isFinite(s)?[c,u,h]:Number.isFinite(n)?[c,u,n]:[c,u]}projectPosition(t){const[e,n]=this.projectFlat(t);return[e,n,(t[2]||0)*this.distanceScales.unitsPerMeter[2]]}unprojectPosition(t){const[e,n]=this.unprojectFlat(t);return[e,n,(t[2]||0)*this.distanceScales.metersPerUnit[2]]}projectFlat(t){if(this.isGeospatial){const e=aT(t);return e[1]=oS(e[1],-318,830),e}return t}unprojectFlat(t){return this.isGeospatial?lT(t):t}getBounds(){const t={targetZ:(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).z||0},e=this.unproject([0,0],t),n=this.unproject([this.width,0],t),i=this.unproject([0,this.height],t),r=this.unproject([this.width,this.height],t);return[Math.min(e[0],n[0],i[0],r[0]),Math.min(e[1],n[1],i[1],r[1]),Math.max(e[0],n[0],i[0],r[0]),Math.max(e[1],n[1],i[1],r[1])]}getDistanceScales(t){return t?hT({longitude:t[0],latitude:t[1],highPrecision:!0}):this.distanceScales}containsPixel(t){let{x:e,y:n,width:i=1,height:r=1}=t;return e<this.x+this.width&&this.x<e+i&&n<this.y+this.height&&this.y<n+r}getFrustumPlanes(){return this._frustumPlanes.near||Object.assign(this._frustumPlanes,{left:IS((t=this.viewProjectionMatrix)[3]+t[0],t[7]+t[4],t[11]+t[8],t[15]+t[12]),right:IS(t[3]-t[0],t[7]-t[4],t[11]-t[8],t[15]-t[12]),bottom:IS(t[3]+t[1],t[7]+t[5],t[11]+t[9],t[15]+t[13]),top:IS(t[3]-t[1],t[7]-t[5],t[11]-t[9],t[15]-t[13]),near:IS(t[3]+t[2],t[7]+t[6],t[11]+t[10
2],t[15]+t[14]),far:IS(t[3]-t[2],t[7]-t[6],t[11]-t[10],t[15]-t[14])}),this._frustumPlanes;var t}panByPosition(t,e){return null}_initProps(t){const e=t.longitude,n=t.latitude;this.isGeospatial&&(Number.isFinite(t.zoom)||(this.zoom=cT({latitude:n})+Math.log2(this.focalDistance)),this.distanceScales=t.distanceScales||hT({latitude:n,longitude:e}));const i=Math.pow(2,this.zoom);this.scale=i;const{position:r,modelMatrix:s}=t;let o=xT;if(r&&(o=s?new $S(s).transformAsVector(r,[]):r),this.isGeospatial){const t=this.projectPosition([e,n,0]);this.center=new RS(o).scale(this.distanceScales.unitsPerMeter).add(t)}else this.center=this.projectPosition(o)}_initMatrices(t){const{viewMatrix:e=ET,projectionMatrix:n=null,orthographic:i=!1,fovyRadians:r,fovy:s=75,near:o=.1,far:a=1e3,padding:l=null,focalDistance:c=1}=t;this.viewMatrixUncentered=e,this.viewMatrix=(new $S).multiplyRight(e).translate(new RS(this.center).negate()),this.projectionMatrix=n||function(t){let{width:e,height:n,orthographic:i,fovyRadians:r,focalDistance:s,padding:o,near:a,far:l}=t;const c=e/n,u=i?(new $S).orthographic({fovy:r,aspect:c,focalDistance:s,near:a,far:l}):(new $S).perspective({fovy:r,aspect:c,near:a,far:l});if(o){const{left:t=0,right:i=0,top:r=0,bottom:s=0}=o,a=oS((t+e-i)/2,0,e)-e/2,l=oS((r+n-s)/2,0,n)-n/2;u[8]-=2*a/e,u[9]+=2*l/n}return u}({width:this.width,height:this.height,orthographic:i,fovyRadians:r||s*wT,focalDistance:c,padding:l,near:o,far:a});const u=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];var h;Lw(u,u,this.projectionMatrix),Lw(u,u,this.viewMatrix),this.viewProjectionMatrix=u,this.viewMatrixInverse=Iw([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=[(h=this.viewMatrixInverse)[12],h[13],h[14]];const d=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],p=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];Nw(d,d,[this.width/2,-this.height/2,1]),kw(d,d,[1,-1,0]),Lw(p,d,this.viewProjectionMatrix),this.pixelProjectionMatrix=p,this.pixelUnprojectionMatrix=Iw([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||vw.warn("Pixel project matrix not invertible")()}}class CT{constructor(t,e){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=t=>{fE("layerManager.activateViewport",this,t),t&&(this.context.viewport=t)};const{deck:n,stats:i,viewport:r,timeline:s}=e||{};this.layers=[],this.resourceManager=new eS({device:t,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:t,gl:t?.gl,deck:n,shaderAssembler:Qw(),defaultShaderModules:[],renderPass:void 0,stats:i||new bE({id:"deck.gl"}),viewport:r||new TT({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:s||new gb,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(const t of this.layers)this._finalizeLayer(t)}needsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1},e=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);for(const n of this.layers){const i=n.getNeedsRedraw(t);e=e||i}return e}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(){let{layerIds:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t?this.layers.filter((e=>t.find((t=>0===e.id.indexOf(t))))):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,e){fE("layerManager.setLayers",this,e,t),this._lastRenderedLayers=t;const n=gE(t,Boolean);for(const i of n)i.context=this.context;this._updateLayers(this.layers,n)}updateLayers(){const t=this.needsUpdate();t&&(this.setNeedsRedraw(`updating layers: ${t}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,t)),this._nextLayers=null}addDefaultShaderModule(t){const{defaultShaderModules:e}=this.context;e.find((e=>e.name===t.name))||(e.push(t),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(t){const{defaultShaderModules:e}=this.context,n=e.findIndex((e=>e.name===t.name));n>=0&&(e.splice(n,1),this._defaultShaderModulesChanged=!0)}_handleError(t,e,n){n.raiseError(e,`${t} of ${n}`)}_updateLayers(t,e){const n={};for(const s of t)n[s.id]?vw.warn(`Multiple old layers with same id ${s.id}`)():n[s.id]=s;if(this._defaultShaderModulesChanged){for(const e of t)e.setNeedsUpdate(),e.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}const i=[];this._updateSublayersRecursively(e,n,i),this._finalizeOldLayers(n);let r=!1;for(const s of i)if(s.hasUniformTransition()){r=`Uniform transition in ${s}`;break}this._needsUpdate=r,this.layers=i}_updateSublayersRecursively(t,e,n){for(const r of t){r.context=this.context;const t=e[r.id];null===t&&vw.warn(`Multiple new layers with same id ${r.id}`)(),e[r.id]=null;let s=null;try{this._debug&&t!==r&&r.validateProps(),t?(this._transferLayerState(t,r),this._updateLayer(r)):this._initializeLayer(r),n.push(r),s=r.isComposite?r.getSubLayers():null}catch(i){this._handleError("matching",i,r)}s&&this._updateSublayersRecursively(s,e,n)}}_finalizeOldLayers(t){for(const e in t){const n=t[e];n&&this._finalizeLayer(n)}}_initializeLayer(t){try{t._initialize(),t.lifecycle=nE}catch(e){this._handleError("initialization",e,t)}}_transferLayerState(t,e){e._transferState(t),e.lifecycle=eE,e!==t&&(t.lifecycle=iE)}_updateLayer(t){try{t._update()}catch(e){this._handleError("update",e,t)}}_finalizeLayer(t){this._needsRedraw=this._needsRedraw||`finalized ${t}`,t.lifecycle=rE;try{t._finalize(),t.lifecycle=sE}catch(e){this._handleError("finalization",e,t)}}}function AT(t,e,n){if(t===e)return!0;
vendor: 4,660 bytes, line 2
2if(!n||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!AT(t[i],e[i],n-1))return!1;return!0}if(Array.isArray(e))return!1;if("object"===typeof t&&"object"===typeof e){const i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length)return!1;for(const s of i){if(!e.hasOwnProperty(s))return!1;if(!AT(t[s],e[s],n-1))return!1}return!0}return!1}class PT{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(const t in this.controllers){const e=this.controllers[t];e&&e.finalize()}this.controllers={}}needsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t,this._needsRedraw=this._needsRedraw||t}updateViewStates(){for(const t in this.controllers){const e=this.controllers[t];e&&e.updateTransition()}}getViewports(t){return t?this._viewports.filter((e=>e.containsPixel(t))):this._viewports}getViews(){const t={};return this.views.forEach((e=>{t[e.id]=e})),t}getView(t){return this.views.find((e=>e.id===t))}getViewState(t){const e="string"===typeof t?this.getView(t):t,n=e&&this.viewState[e.getViewStateId()]||this.viewState;return e?e.filterViewState(n):n}getViewport(t){return this._viewportMap[t]}unproject(t,e){const n=this.getViewports(),i={x:t[0],y:t[1]};for(let r=n.length-1;r>=0;--r){const s=n[r];if(s.containsPixel(i)){const n=t.slice();return n[0]-=s.x,n[1]-=s.y,s.unproject(n,e)}}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,e){t===this.width&&e===this.height||(this.width=t,this.height=e,this.setNeedsUpdate("Size changed"))}_setViews(t){t=gE(t,Boolean);this._diffViews(t,this.views)&&this.setNeedsUpdate("views changed"),this.views=t}_setViewState(t){if(t){!AT(t,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=t}else vw.warn("missing `viewState` or `initialViewState`")()}_createController(t,e){return new(0,e.type)({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:e=>this.getView(t.id)?.makeViewport({viewState:e,width:this.width,height:this.height})})}_updateController(t,e,n,i){const r=t.controller;if(r&&n){const s={...e,...r,id:t.id,x:n.x,y:n.y,width:n.width,height:n.height};return i&&i.constructor===r.type||(i=this._createController(t,s)),i&&i.setProps(s),i}return null}_rebuildViewports(){const{views:t}=this,e=this.controllers;this._viewports=[],this.controllers={};let n=!1;for(let i=t.length;i--;){const r=t[i],s=this.getViewState(r),o=r.makeViewport({viewState:s,width:this.width,height:this.height});let a=e[r.id];const l=Boolean(r.controller);l&&!a&&(n=!0),!n&&l||!a||(a.finalize(),a=null),this.controllers[r.id]=this._updateController(r,s,o,a),o&&this._viewports.unshift(o)}for(const i in e){const t=e[i];t&&!this.controllers[i]&&t.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach((t=>{t.id&&(this._viewportMap[t.id]=this._viewportMap[t.id]||t)}))}_diffViews(t,e){return t.length!==e.length||t.some(((n,i)=>!t[i].equals(e[i])))}}const RT=/([0-9]+\.?[0-9]*)(%|px)/;function MT(t){switch(typeof t){case"number":return{position:t,relative:!1};case"string":const e=RT.exec(t);if(e&&e.length>=3){const t="%"===e[2],n=parseFloat(e[1]);return{position:t?n/100:n,relative:t}}default:throw new Error(`Could not parse position string ${t}`)}}function IT(t,e){return t.relative?Math.round(t.position*e):t.position}class LT{constructor(t){const{id:e,x:n=0,y:i=0,width:r="100%",height:s="100%",padding:o=null}=t;this.id=e||this.constructor.displayName||"view",this.props={...t,id:this.id},this._x=MT(n),this._y=MT(i),this._width=MT(r),this._height=MT(s),this._padding=o&&{left:MT(o.left||0),right:MT(o.right||0),top:MT(o.top||0),bottom:MT(o.bottom||0)}
2,this.equals=this.equals.bind(this),Object.seal(this)}equals(t){return this===t||this.ViewportType===t.ViewportType&&AT(this.props,t.props,2)}makeViewport(t){let{width:e,height:n,viewState:i}=t;i=this.filterViewState(i);const r=this.getDimensions({width:e,height:n});return r.height&&r.width?new this.ViewportType({...i,...this.props,...r}):null}getViewStateId(){const{viewState:t}=this.props;return"string"===typeof t?t:t?.id||this.id}filterViewState(t){if(this.props.viewState&&"object"===typeof this.props.viewState){if(!this.props.viewState.id)return this.props.viewState;const e={...t};for(const t in this.props.viewState)"id"!==t&&(e[t]=this.props.viewState[t]);return e}return t}getDimensions(t){let{width:e,height:n}=t;const i={x:IT(this._x,e),y:IT(this._y,n),width:IT(this._width,e),height:IT(this._height,n)};return this._padding&&(i.padding={left:IT(this._padding.left,e),top:IT(this._padding.top,n),right:IT(this._padding.right,e),bottom:IT(this._padding.bottom,n)}),i}get controller(){const t=this.props.controller;return t?!0===t?{type:this.ControllerType}:"function"===typeof t?{type:t}:{type:this.ControllerType,...t}:null}}class kT extends TT{static#t=(()=>this.displayName="WebMercatorViewport")();constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{latitude:e=0,longitude:n=0,zoom:i=0,pitch:r=0,bearing:s=0,nearZMultiplier:o=.1,farZMultiplier:a=1.01,nearZ:l,farZ:c,orthographic:u=!1,projectionMatrix:h,repeat:d=!1,worldOffset:p=0,position:f,padding:g,legacyMeterSizes:m=!1}=t;let{width:_,height:y,altitude:v=1.5}=t;const b=Math.pow(2,i);let w;_=_||1,y=y||1;let E=null;if(h)v=h[5]/2,w=fT(v);else{let n;if(t.fovy?(w=t.fovy,v=gT(w)):w=fT(v),g){const{top:t=0,bottom:e=0}=g;n=[0,oS((t+y-e)/2,0,y)-y/2]}E=pT({width:_,height:y,scale:b,center:f&&[0,0,f[2]*uT(e)],offset:n,pitch:r,fovy:w,nearZMultiplier:o,farZMultiplier:a}),Number.isFinite(l)&&(E.near=l),Number.isFinite(c)&&(E.far=c)}let x=function(t){const{height:e,pitch:n,bearing:i,altitude:r,scale:s,center:o}=t,a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];kw(a,a,[0,0,-r]),Ow(a,a,-n*eT),Dw(a,a,i*eT);const l=s/e;var c,u;return Nw(a,a,[l,l,l]),o&&kw(a,a,((c=[])[0]=-(u=o)[0],c[1]=-u[1],c[2]=-u[2],c)),a}({height:y,pitch:r,bearing:s,scale:b,altitude:v});if(p){x=(new $S).translate([512*p,0,0]).multiplyLeft(x)}super({...t,width:_,height:y,viewMatrix:x,longitude:n,latitude:e,zoom:i,...E,fovy:w,focalDistance:v}),this.latitude=e,this.longitude=n,this.zoom=i,this.pitch=r,this.bearing=s,this.altitude=v,this.fovy=w,this.orthographic=u,this._subViewports=d?[]:null,this._pseudoMeters=m,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){const t=this.getBounds(),e=Math.floor((t[0]+180)/360),n=Math.ceil((t[2]-180)/360);for(let i=e;i<=n;i++){const t=i?new kT({...this,worldOffset:i}):this;this._subViewports.push(t)}}return this._subViewports}projectPosition(t){if(this._pseudoMeters)return super.projectPosition(t);const[e,n]=this.projectFlat(t);return[e,n,(t[2]||0)*uT(t[1])]}unprojectPosition(t){if(this._pseudoMeters)return super.unprojectPosition(t);const[e,n]=this.unprojectFlat(t);return[e,n,(t[2]||0)/uT(n)]}addMetersToLngLat(t,e){return dT(t,e)}panByPosition(t,e){const n=_T(e,this.pixelUnprojectionMatrix),i=DS([],this.projectFlat(t),((r=[])[0]=-(s=n)[0],r[1]=-s[1],r));var r,s;const o=DS([],this.center,i),[a,l]=this.unprojectFlat(o);return{longitude:a,latitude:l}}getBounds(){const t=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const{width:n,height:i,unproject:r}=t,s={targetZ:e},o=r([0,i],s),a=r([n,i],s);let l,c;return(t.fovy?.5*t.fovy*vT:Math.atan(.5/t.altitude))>(90-t.pitch)*vT-.01?(l=bT(t,0,e),c=bT(t,n,e)):(l=r([0,0],s),c=r([n,0],s)),[o,a,c,l]}(this,(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).z||0);return[Math.min(t[0][0],t[1][0],t[2][0],t[3][0]),Math.min(t[0][1],t[1][1],t[2][1],t[3][1]),Math.max(t[0][0],t[1][0],t[2][0],t[3][0]),Math.max(t[0][1],t[1][1],t[2][1],t[3][1])]}fitBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{width:n,height:i}=this,{longitude:r,latitude:s,zoom:o}=yT({width:n,height:i,bounds:t,...e});return new kT({width:n,height:i,longitude:r,latitude:s,zoom:o})}}class NT{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(null===this._handle){const{_timeline:t,settings:e}=this;this._handle=t.addChannel({delay:t.getTime(),duration:e.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}}const OT=()=>{}
vendor: 34,843 bytes, line 2
2,DT=2,FT=3,BT=t=>t,UT=1;class zT{constructor(t){this._onTransitionUpdate=t=>{const{time:e,settings:{interpolator:n,startProps:i,endProps:r,duration:s,easing:o}}=t,a=o(e/s),l=n.interpolateProps(i,r,a);this.propsInTransition=this.getControllerState({...this.props,...l}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=t.getControllerState,this.propsInTransition=null,this.transition=new NT(t.timeline),this.onViewStateChange=t.onViewStateChange||OT,this.onStateChange=t.onStateChange||OT}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(t){let e=!1;const n=this.props;if(this.props=t,!n||this._shouldIgnoreViewportChange(n,t))return!1;if(this._isTransitionEnabled(t)){let i=n;if(this.transition.inProgress){const{interruption:t,endProps:e}=this.transition.settings;i={...n,...t===DT?e:this.propsInTransition||n}}this._triggerTransition(i,t),e=!0}else this.transition.cancel();return e}updateTransition(){this.transition.update()}_isTransitionEnabled(t){const{transitionDuration:e,transitionInterpolator:n}=t;return(e>0||"auto"===e)&&Boolean(n)}_isUpdateDueToCurrentTransition(t){return!(!this.transition.inProgress||!this.propsInTransition)&&this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition)}_shouldIgnoreViewportChange(t,e){if(this.transition.inProgress){return this.transition.settings.interruption===FT||this._isUpdateDueToCurrentTransition(e)}return!this._isTransitionEnabled(e)||e.transitionInterpolator.arePropsEqual(t,e)}_triggerTransition(t,e){const n=this.getControllerState(t),i=this.getControllerState(e).shortestPathFrom(n),r=e.transitionInterpolator,s=r.getDuration?r.getDuration(t,e):e.transitionDuration;if(0===s)return;const o=r.initializeProps(t,i);this.propsInTransition={};const a={duration:s,easing:e.transitionEasing||BT,interpolator:r,interruption:e.transitionInterruption||UT,startProps:o.start,endProps:o.end,onStart:e.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(e.onTransitionInterrupt),onEnd:this._onTransitionEnd(e.onTransitionEnd)};this.transition.start(a),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(t){return e=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),t?.(e)}}}function jT(t,e){if(!t)throw new Error(e||"deck.gl: assertion failed.")}class VT{constructor(t){const{compare:e,extract:n,required:i}=t;this._propsToCompare=e,this._propsToExtract=n||e,this._requiredProps=i}arePropsEqual(t,e){for(const n of this._propsToCompare)if(!(n in t)||!(n in e)||!lS(t[n],e[n]))return!1;return!0}initializeProps(t,e){const n={},i={};for(const r of this._propsToExtract)(r in t||r in e)&&(n[r]=t[r],i[r]=e[r]);return this._checkRequiredProps(n),this._checkRequiredProps(i),{start:n,end:i}}getDuration(t,e){return e.transitionDuration}_checkRequiredProps(t){this._requiredProps&&this._requiredProps.forEach((e=>{const n=t[e];jT(Number.isFinite(n)||Array.isArray(n),`${e} is required for transition`)}))}}const WT=["longitude","latitude","zoom","bearing","pitch"],$T=["longitude","latitude","zoom"];class GT extends VT{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=Array.isArray(t)?t:t.transitionProps,n=Array.isArray(t)?{}:t;n.transitionProps=Array.isArray(e)?{compare:e,required:e}:e||{compare:WT,required:$T},super(n.transitionProps),this.opts=n}initializeProps(t,e){const n=super.initializeProps(t,e),{makeViewport:i,around:r}=this.opts;if(i&&r){const s=i(t),o=i(e),a=s.unproject(r);n.start.around=r,Object.assign(n.end,{around:o.project(a),aroundPosition:a,width:e.width,height:e.height})}return n}interpolateProps(t,e,n){const i={};for(const r of this._propsToExtract)i[r]=aS(t[r]||0,e[r]||0,n);if(e.aroundPosition&&this.opts.makeViewport){const r=this.opts.makeViewport({...e,...i});Object.assign(i,r.panByPosition(e.aroundPosition,aS(t.around,e.around,n)))}return i}}const HT={transitionDuration:0},qT=t=>1-(1-t)*(1-t),ZT=["wheel"],XT=["panstart","panmove","panend"],KT=["pinchstart","pinchmove","pinchend"],YT=["tripanstart","tripanmove","tripanend"],JT=["doubletap"],QT=["keydown"],tC={};class eC{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 zT({...t,getControllerState:t=>new this.ControllerState(t),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(const t in this._events)this._events[t]&&this.eventManager?.off(t,this.handleEvent);this.transitionManager.finalize()}handleEvent(t){this._controllerState=void 0;const e=this._eventStartBlocked;switch(t.type){case"panstart":return!e&&this._onPanStart(t);case"panmove":return this._onPan(t);case"panend":return this._onPanEnd(t);case"pinchstart":return!e&&this._onPinchStart(t);case"pinchmove":return this._onPinch(t);case"pinchend":return this._onPinchEnd(t);case"tripanstart":return!e&&this._onTriplePanStart(t);case"tripanmove":return this._onTriplePan(t);case"tripanend":return this._onTriplePanEnd(t);case"doubletap":return this._onDoubleTap(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){const{x:e,y:n}=this.props,{offsetCenter:i}=t;return[i.x-e,i.y-n]}isPointInBounds(t,e){const{width:n,height:i}=this.props;if(e&&e.handled)return!1;const r=t[0]>=0&&t[0]<=n&&t[1]>=0&&t[1]<=i;return r&&e&&e.stopPropagation(),r}isFunctionKeyPressed(t){const{srcEvent:e}=t;return Boolean(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(t){const e=setTimeout((()=>{this._eventStartBlocked===e&&(this._eventStartBlocked=null)}),t);this._eventStartBlocked=e}setProps(t){t.dragMode&&(this.dragMode=t.dragMode),this.props=t,"transitionInterpolator"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);const{inertia:e}=t;this.inertia=Number.isFinite(e)?e:!0===e?300:0;const{scrollZoom:n=!0,dragPan:i=!0,dragRotate:r=!0,doubleClickZoom:s=!0,touchZoom:o=!0,touchRotate:a=!1,keyboard:l=!0}=t,c=Boolean(this.onViewStateChange);this.toggleEvents(ZT,c&&n),this.toggleEvents(XT,c),this.toggleEvents(KT,c&&(o||a)),this.toggleEvents(YT,c&&a),this.toggleEvents(JT,c&&s),this.toggleEvents(QT,c&&l),this.scrollZoom=n,this.dragPan=i,this.dragRotate=r,this.doubleClickZoom=s,this.touchZoom=o,this.touchRotate=a,this.keyboard=l}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(t,e){this.eventManager&&t.forEach((t=>{this._events[t]!==e&&(this._events[t]=e,e?this.eventManager.on(t,this.handleEvent):this.eventManager.off(t,this.handleEvent))}))}updateViewport(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i={...t.getViewportProps(),...e},r=this.controllerState!==t;if(this.state=t.getState(),this._setInteractionState(n),r){const t=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:i,interactionState:this._interactionState,oldViewState:t,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){const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;let n=this.isFunctionKeyPressed(t)||t.rightButton||!1;(this.invertPan||"pan"===this.dragMode)&&(n=!n);const i=this.controllerState[n?"panStart":"rotateStart"]({pos:e});return this._panMove=n,this.updateViewport(i,HT,{isDragging:!0}),!0}_onPan(t){return!!this.isDragging()&&(this._panMove?this._onPanMove(t):this._onPanRotate(t))}_onPanEnd(t){return!!this.isDragging()&&(this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t))}_onPanMove(t){if(!this.dragPan)return!1;const e=this.getCenter(t),n=this.controllerState.pan({pos:e});return this.updateViewport(n,HT,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(t){const{inertia:e}=this;if(this.dragPan&&e&&t.velocity){const n=this.getCenter(t),i=[n[0]+t.velocityX*e/2,n[1]+t.velocityY*e/2],r=this.controllerState.pan({pos:i}).panEnd();this.updateViewport(r,{...this._getTransitionProps(),transitionDuration:e,transitionEasing:qT},{isDragging:!1,isPanning:!0})}else{const t=this.controllerState.panEnd();this.updateViewport(t,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(t){if(!this.dragRotate)return!1;const e=this.getCenter(t),n=this.controllerState.rotate({pos:e});return this.updateViewport(n,HT,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(t){const{inertia:e}=this;if(this.dragRotate&&e&&t.velocity){const n=this.getCenter(t),i=[n[0]+t.velocityX*e/2,n[1]+t.velocityY*e/2],r=this.controllerState.rotate({pos:i}).rotateEnd();this.updateViewport(r,{...this._getTransitionProps(),transitionDuration:e,transitionEasing:qT},{isDragging:!1,isRotating:!0})}else{const t=this.controllerState.rotateEnd();this.updateViewport(t,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(t){if(!this.scrollZoom)return!1;const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;t.srcEvent.preventDefault();const{speed:n=.01,smooth:i=!1}=!0===this.scrollZoom?{}:this.scrollZoom,{delta:r}=t;let s=2/(1+Math.exp(-Math.abs(r*n)));r<0&&0!==s&&(s=1/s);const o=this.controllerState.zoom({pos:e,scale:s});return this.updateViewport(o,{...this._getTransitionProps({around:e}),transitionDuration:i?250:1},{isZooming:!0,isPanning:!0}),!0}_onTriplePanStart(t){const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;const n=this.controllerState.rotateStart({pos:e});return this.updateViewport(n,HT,{isDragging:!0}),!0}_onTriplePan(t){if(!this.touchRotate)return!1;if(!this.isDragging())return!1;const e=this.getCenter(t);e[0]-=t.deltaX;const n=this.controllerState.rotate({pos:e});return this.updateViewport(n,HT,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(t){if(!this.isDragging())return!1;const{inertia:e}=this;if(this.touchRotate&&e&&t.velocityY){const n=this.getCenter(t),i=[n[0],n[1]+=t.velocityY*e/2],r=this.controllerState.rotate({pos:i});this.updateViewport(r,{...this._getTransitionProps(),transitionDuration:e,transitionEasing:qT},{isDragging:!1,isRotating:!0}),this.blockEvents(e)}else{const t=this.controllerState.rotateEnd();this.updateViewport(t,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(t){const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;const n=this.controllerState.zoomStart({pos:e}).rotateStart({pos:e});return tC._startPinchRotation=t.rotation,tC._lastPinchEvent=t,this.updateViewport(n,HT,{isDragging:!0}),!0}_onPinch(t){if(!this.touchZoom&&!this.touchRotate)return!1;if(!this.isDragging())return!1;let e=this.controllerState;if(this.touchZoom){const{scale:n}=t,i=this.getCenter(t);e=e.zoom({pos:i,scale:n})}if(this.touchRotate){const{rotation:n}=t;e=e.rotate({deltaAngleX:tC._startPinchRotation-n})}return this.updateViewport(e,HT,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),tC._lastPinchEvent=t,!0}_onPinchEnd(t){if(!this.isDragging())return!1;const{inertia:e}=this,{_lastPinchEvent:n}=tC;if(this.touchZoom&&e&&n&&t.scale!==n.scale){const i=this.getCenter(t);let r=this.controllerState.rotateEnd();const s=Math.log2(t.scale),o=(s-Math.log2(n.scale))/(t.deltaTime-n.deltaTime),a=Math.pow(2,s+o*e/2);r=r.zoom({pos:i,scale:a}).zoomEnd(),this.updateViewport(r,{...this._getTransitionProps({around:i}),transitionDuration:e,transitionEasing:qT},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(e)}else{const t=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(t,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return tC._startPinchRotation=null,tC._lastPinchEvent=null,!0}_onDoubleTap(t){if(!this.doubleClickZoom)return!1;const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;const n=this.isFunctionKeyPressed(t),i=this.controllerState.zoom({pos:e,scale:n?.5:2});return this.updateViewport(i,this._getTransitionProps({around:e}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(t){if(!this.keyboard)return!1;const e=this.isFunctionKeyPressed(t),{zoomSpeed:n,moveSpeed:i,rotateSpeedX:r,rotateSpeedY:s}=!0===this.keyboard?{}:this.keyboard,{controllerState:o}=this;let a;const l={};switch(t.srcEvent.code){case"Minus":a=e?o.zoomOut(n).zoomOut(n):o.zoomOut(n),l.isZooming=!0;break;case"Equal":a=e?o.zoomIn(n).zoomIn(n):o.zoomIn(n),l.isZooming=!0;break;case"ArrowLeft":e?(a=o.rotateLeft(r),l.isRotating=!0):(a=o.moveLeft(i),l.isPanning=!0);break;case"ArrowRight":e?(a=o.rotateRight(r),l.isRotating=!0):(a=o.moveRight(i),l.isPanning=!0);break;case"ArrowUp":e?(a=o.rotateUp(s),l.isRotating=!0):(a=o.moveUp(i),l.isPanning=!0);break;case"ArrowDown":e?(a=o.rotateDown(s),l.isRotating=!0):(a=o.moveDown(i),l.isPanning=!0);break;default:return!1}return this.updateViewport(a,this._getTransitionProps(),l),!0}_getTransitionProps(t){const{transition:e}=this;return e&&e.transitionInterpolator?t?{...e,transitionInterpolator:new GT({...t,...e.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:e:HT}}class nC{constructor(t,e){this._viewportProps=this.applyConstraints(t),this._state=e}getViewportProps(){return this._viewportProps}getState(){return this._state}}class iC extends nC{constructor(t){const{width:e,height:n,latitude:i,longitude:r,zoom:s,bearing:o=0,pitch:a=0,altitude:l=1.5,position:c=[0,0,0],maxZoom:u=20,minZoom:h=0,maxPitch:d=60,minPitch:p=0,startPanLngLat:f,startZoomLngLat:g,startRotatePos:m,startBearing:_,startPitch:y,startZoom:v,normalize:b=!0}=t;jT(Number.isFinite(r)),jT(Number.isFinite(i)),jT(Number.isFinite(s)),super({width:e,height:n,latitude:i,longitude:r,zoom:s,bearing:o,pitch:a,altitude:l,maxZoom:u,minZoom:h,maxPitch:d,minPitch:p,normalize:b,position:c},{startPanLngLat:f,startZoomLngLat:g,startRotatePos:m,startBearing:_,startPitch:y,startZoom:v}),this.makeViewport=t.makeViewport}panStart(t){let{pos:e}=t;return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan(t){let{pos:e,startPos:n}=t;const i=this.getState().startPanLngLat||this._unproject(n);if(!i)return this;const r=this.makeViewport(this.getViewportProps()).panByPosition(i,e);return this._getUpdatedState(r)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart(t){let{pos:e}=t;return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate(t){let{pos:e,deltaAngleX:n=0,deltaAngleY:i=0}=t;const{startRotatePos:r,startBearing:s,startPitch:o}=this.getState();if(!r||void 0===s||void 0===o)return this;let a;return a=e?this._getNewRotation(e,r,o,s):{bearing:s+n,pitch:o+i},this._getUpdatedState(a)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart(t){let{pos:e}=t;return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom(t){let{pos:e,startPos:n,scale:i}=t,{startZoom:r,startZoomLngLat:s}=this.getState();if(s||(r=this.getViewportProps().zoom,s=this._unproject(n)||this._unproject(e)),!s)return this;const{maxZoom:o,minZoom:a}=this.getViewportProps();let l=r+Math.log2(i);l=oS(l,a,o);const c=this.makeViewport({...this.getViewportProps(),zoom:l});return this._getUpdatedState({zoom:l,...c.panByPosition(s,e)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;return this._zoomFromCenter(t)}zoomOut(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;return this._zoomFromCenter(1/t)}moveLeft(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([t,0])}moveRight(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([-t,0])}moveUp(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([0,t])}moveDown(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([0,-t])}rotateLeft(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;return this._getUpdatedState({bearing:this.getViewportProps().bearing-t})}rotateRight(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;return this._getUpdatedState({bearing:this.getViewportProps().bearing+t})}rotateUp(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this._getUpdatedState({pitch:this.getViewportProps().pitch+t})}rotateDown(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this._getUpdatedState({pitch:this.getViewportProps().pitch-t})}shortestPathFrom(t){const e=t.getViewportProps(),n={...this.getViewportProps()},{bearing:i,longitude:r}=n;return Math.abs(i-e.bearing)>180&&(n.bearing=i<0?i+360:i-360),Math.abs(r-e.longitude)>180&&(n.longitude=r<0?r+360:r-360),n}applyConstraints(t){const{maxZoom:e,minZoom:n,zoom:i}=t;t.zoom=oS(i,n,e);const{maxPitch:r,minPitch:s,pitch:o}=t;t.pitch=oS(o,s,r);const{normalize:a=!0}=t;return a&&Object.assign(t,function(t){const{width:e,height:n,pitch:i=0}=t;let{longitude:r,latitude:s,zoom:o,bearing:a=0}=t;(r<-180||r>180)&&(r=XS(r+180,360)-180),(a<-180||a>180)&&(a=XS(a+180,360)-180);const l=YS(n/512);if(o<=l)o=l,s=0;else{const t=n/2/Math.pow(2,o),e=lT([0,t])[1];if(s<e)s=e;else{const e=lT([0,512-t])[1];s>e&&(s=e)}}return{width:e,height:n,longitude:r,latitude:s,zoom:o,pitch:i,bearing:a}}(t)),t}_zoomFromCenter(t){const{width:e,height:n}=this.getViewportProps();return this.zoom({pos:[e/2,n/2],scale:t})}_panFromCenter(t){const{width:e,height:n}=this.getViewportProps();return this.pan({startPos:[e/2,n/2],pos:[e/2+t[0],n/2+t[1]]})}_getUpdatedState(t){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...t})}_unproject(t){const e=this.makeViewport(this.getViewportProps());return t&&e.unproject(t)}_getNewRotation(t,e,n,i){const r=t[0]-e[0],s=t[1]-e[1],o=t[1],a=e[1],{width:l,height:c}=this.getViewportProps(),u=r/l;let h=0;s>0?Math.abs(c-a)>5&&(h=s/(a-c)*1.2):s<0&&a>5&&(h=1-o/a),h=oS(h,-1,1);const{minPitch:d,maxPitch:p}=this.getViewportProps();let f=n;return h>0?f=n+h*(p-n):h<0&&(f=n-h*(d-n)),{pitch:f,bearing:i+180*u}}}class rC extends eC{constructor(){super(...arguments),this.ControllerState=iC,this.transition={transitionDuration:300,transitionInterpolator:new GT({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(t){t.position=t.position||[0,0,0];const e=this.props;super.setProps(t);(!e||e.height!==t.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...t,...this.state}))}}class sC extends LT{static#t=(()=>this.displayName="MapView")();constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}get ViewportType(){return kT}get ControllerType(){return rC}}const oC=[255,255,255],aC=1;let lC=0;class cC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="ambient";const{color:e=oC}=t,{intensity:n=aC}=t;this.id=t.id||"ambient-"+lC++,this.color=e,this.intensity=n}}const uC=[255,255,255],hC=1,dC=[0,0,-1];let pC=0;class fC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="directional";const{color:e=uC}=t,{intensity:n=hC}=t,{direction:i=dC}=t,{_shadow:r=!1}=t;this.id=t.id||"directional-"+pC++,this.color=e,this.intensity=n,this.type="directional",this.direction=new RS(i).normalize().toArray(),this.shadow=r}getProjectedLight(t){return this}}class gC{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{id:"pass"};const{id:n}=e;this.id=n,this.device=t,this.props={...e}}setProps(t){Object.assign(this.props,t)}render(t){}cleanup(){}}class mC extends gC{constructor(){super(...arguments),this._lastRenderIndex=-1}render(t){const[e,n]=this.device.canvasContext.getDrawingBufferSize(),i=t.clearCanvas??!0,r=t.clearColor??(!!i&&[0,0,0,0]),s=!!i&&1,o=!!i&&0,a=t.colorMask??15,l={viewport:[0,0,e,n]};t.colorMask&&(l.colorMask=a),t.scissorRect&&(l.scissorRect=t.scissorRect);const c=this.device.beginRenderPass({framebuffer:t.target,parameters:l,clearColor:r,clearDepth:s,clearStencil:o});try{return this._drawLayers(c,t)}finally{c.end()}}_drawLayers(t,e){const{target:n,moduleParameters:i,viewports:r,views:s,onViewportActive:o,clearStack:a=!0}=e;e.pass=e.pass||"unknown",a&&(this._lastRenderIndex=-1);const l=[];for(const c of r){const r=s&&s[c.id];o?.(c);const a=this._getDrawLayerParams(c,e),u=c.subViewports||[c];for(const s of u){const o=this._drawLayersInViewport(t,{target:n,moduleParameters:i,viewport:s,view:r,pass:e.pass,layers:e.layers},a);l.push(o)}}return l}_getDrawLayerParams(t,e){let{layers:n,pass:i,isPicking:r=!1,layerFilter:s,cullRect:o,effects:a,moduleParameters:l}=e,c=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const u=[],h=_C(this._lastRenderIndex+1),d={layer:n[0],viewport:t,isPicking:r,renderPass:i,cullRect:o},p={};for(let f=0;f<n.length;f++){const e=n[f],r=this._shouldDrawLayer(e,d,s,p),o={shouldDrawLayer:r};r&&!c&&(o.layerRenderIndex=h(e,r),o.moduleParameters=this._getModuleParameters(e,a,i,l),o.layerParameters={...e.context.deck?.props.parameters,...this.getLayerParameters(e,f,t)}),u[f]=o}return u}_drawLayersInViewport(t,e,n){let{layers:i,moduleParameters:r,pass:s,target:o,viewport:a,view:l}=e;const c=function(t,e){let{moduleParameters:n,target:i,viewport:r}=e;const s=n&&n.devicePixelRatio||t.canvasContext.cssToDeviceRatio(),[,o]=t.canvasContext.getDrawingBufferSize(),a=i?i.height:o,l=r;return[l.x*s,a-(l.y+l.height)*s,l.width*s,l.height*s]}(this.device,{moduleParameters:r,target:o,viewport:a});if(l&&l.props.clear){const t=!0===l.props.clear?{color:!0,depth:!0}:l.props.clear;this.device.withParametersWebGL({scissorTest:!0,scissor:c},(()=>this.device.clearWebGL(t)))}const u={totalCount:i.length,visibleCount:0,compositeCount:0,pickableCount:0};t.setParameters({viewport:c});for(let d=0;d<i.length;d++){const e=i[d],{shouldDrawLayer:r,layerRenderIndex:o,moduleParameters:l,layerParameters:c}=n[d];if(r&&e.props.pickable&&u.pickableCount++,e.isComposite)u.compositeCount++;else if(r){u.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,o),l.viewport=a,e.context.renderPass=t;try{e._drawLayer({renderPass:t,moduleParameters:l,uniforms:{layerIndex:o},parameters:c})}catch(h){e.raiseError(h,`drawing ${e} to ${s}`)}}}return u}shouldDrawLayer(t){return!0}getModuleParameters(t,e){return null}getLayerParameters(t,e,n){return t.props.parameters}_shouldDrawLayer(t,e,n,i){if(!(t.props.visible&&this.shouldDrawLayer(t)))return!1;e.layer=t;let r=t.parent;for(;r;){if(!r.props.visible||!r.filterSubLayer(e))return!1;e.layer=r,r=r.parent}if(n){const t=e.layer.id;if(t in i||(i[t]=n(e)),!i[t])return!1}return t.activateViewport(e.viewport),!0}_getModuleParameters(t,e,n,i){const r=this.device.canvasContext.cssToDeviceRatio(),s=Object.assign(Object.create(t.internalState?.propsInTransition||t.props),{autoWrapLongitude:t.wrapLongitude,viewport:t.context.viewport,mousePosition:t.context.mousePosition,picking:{isActive:0},devicePixelRatio:r});if(e)for(const o of e)Object.assign(s,o.getModuleParameters?.(t));return Object.assign(s,this.getModuleParameters(t,e),i)}}function _C(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={},i=(r,s)=>{const o=r.props._offset,a=r.id,l=r.parent&&r.parent.id;let c;if(l&&!(l in e)&&i(r.parent,!1),l in n){const t=n[l]=n[l]||_C(e[l],e);c=t(r,s),n[a]=t}else Number.isFinite(o)?(c=o+(e[l]||0),n[a]=null):c=t;return s&&c>=t&&(t=c+1),e[a]=c,c};return i}class yC extends mC{constructor(t,e){super(t,e),this.shadowMap=t.createTexture({width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.depthBuffer=t.createTexture({format:"depth16unorm",width:1,height:1,mipmaps:!1,dataFormat:6402,type:5125}),this.fbo=t.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[this.shadowMap],depthStencilAttachment:this.depthBuffer})}render(t){const e=this.fbo,n=this.device.canvasContext.cssToDeviceRatio(),i=t.viewports[0],r=i.width*n,s=i.height*n;r===e.width&&s===e.height||e.resize({width:r,height:s}),super.render({...t,clearColor:[1,1,1,1],target:e,pass:"shadow"})}getLayerParameters(t,e,n){return{...t.props.parameters,blend:!1,depthRange:[0,1],depthTest:!0}}shouldDrawLayer(t){return!1!==t.props.shadowEnabled}getModuleParameters(){return{drawToShadowMap:!0}}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.shadowMap&&(this.shadowMap.destroy(),this.shadowMap=null),this.depthBuffer&&(this.depthBuffer.destroy(),this.depthBuffer=null)}}const vC=jw((function(t){let{viewport:e,center:n}=t;return new $S(e.viewProjectionMatrix).invert().transform(n)})),bC=jw((function(t){let{viewport:e,shadowMatrices:n}=t;const i=[],r=e.pixelUnprojectionMatrix,s=e.isGeospatial?void 0:1,o=[[0,0,s],[e.width,0,s],[0,e.height,s],[e.width,e.height,s],[0,0,-1],[e.width,0,-1],[0,e.height,-1],[e.width,e.height,-1]].map((t=>function(t,e){const[n,i,r]=t,s=_T([n,i,r],e);if(Number.isFinite(r))return s;return[s[0],s[1],0]}(t,r)));for(const a of n){const t=a.clone().translate(new RS(e.center).negate()),n=o.map((e=>t.transform(e))),r=(new $S).ortho({left:Math.min(...n.map((t=>t[0]))),right:Math.max(...n.map((t=>t[0]))),bottom:Math.min(...n.map((t=>t[1]))),top:Math.max(...n.map((t=>t[1]))),near:Math.min(...n.map((t=>-t[2]))),far:Math.max(...n.map((t=>-t[2])))});i.push(r.multiplyRight(a))}return i})),wC=[0,0,0,1],EC=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];const xC={name:"shadow",dependencies:[Kw],vs:"\nconst int max_lights = 2;\nuniform mat4 shadow_uViewProjectionMatrices[max_lights];\nuniform vec4 shadow_uProjectCenters[max_lights];\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform int shadow_uLightId;\nuniform float shadow_uLightCount;\n\nout vec3 shadow_vPosition[max_lights];\n\nvec4 shadow_setVertexPosition(vec4 position_commonspace) {\n if (shadow_uDrawShadowMap) {\n return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]);\n }\n if (shadow_uUseShadowMap) {\n for (int i = 0; i < max_lights; i++) {\n if(i < int(shadow_uLightCount)) {\n vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]);\n shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;\n }\n }\n }\n return gl_Position;\n}\n",fs:"\nconst int max_lights = 2;\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform sampler2D shadow_uShadowMap0;\nuniform sampler2D shadow_uShadowMap1;\nuniform vec4 shadow_uColor;\nuniform float shadow_uLightCount;\n\nin vec3 shadow_vPosition[max_lights];\n\nconst vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);\nconst vec4 bitUnpackShift = 1.0 / bitPackShift;\nconst vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n\nfloat shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {\n vec4 rgbaDepth = texture(shadowMap, position.xy);\n\n float z = dot(rgbaDepth, bitUnpackShift);\n return smoothstep(0.001, 0.01, position.z - z);\n}\n\nvec4 shadow_filterShadowColor(vec4 color) {\n if (shadow_uDrawShadowMap) {\n vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);\n rgbaDepth -= rgbaDepth.gbaa * bitMask;\n return rgbaDepth;\n }\n if (shadow_uUseShadowMap) {\n float shadowAlpha = 0.0;\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);\n if(shadow_uLightCount > 1.0) {\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);\n }\n shadowAlpha *= shadow_uColor.a / shadow_uLightCount;\n float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);\n\n return vec4(\n mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha),\n blendedAlpha\n );\n }\n return color;\n}\n",inject:{"vs:DECKGL_FILTER_GL_POSITION":"\n position = shadow_setVertexPosition(geometry.position);\n ","fs:DECKGL_FILTER_COLOR":"\n color = shadow_filterShadowColor(color);\n "},getUniforms:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"viewport"in t&&(t.drawToShadowMap||t.shadowMaps&&t.shadowMaps.length>0)?function(t,e){const{shadowEnabled:n=!0}=t;if(!n||!t.shadowMatrices||!t.shadowMatrices.length)return{shadow_uDrawShadowMap:!1,shadow_uUseShadowMap:!1,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};const i={shadow_uDrawShadowMap:Boolean(t.drawToShadowMap),shadow_uUseShadowMap:!!t.shadowMaps&&t.shadowMaps.length>0,shadow_uColor:t.shadowColor||wC,shadow_uLightId:t.shadowLightId||0,shadow_uLightCount:t.shadowMatrices.length},r=vC({viewport:t.viewport,center:e.project_uCenter}),s=[],o=bC({shadowMatrices:t.shadowMatrices,viewport:t.viewport}).slice();for(let a=0;a<t.shadowMatrices.length;a++){const n=o[a],i=n.clone().translate(new RS(t.viewport.center).negate());e.project_uCoordinateSystem===bw.LNGLAT&&e.project_uProjectionMode===ww.WEB_MERCATOR?(o[a]=i,s[a]=r):(o[a]=n.clone().multiplyRight(EC),s[a]=i.transform(r))}for(let a=0;a<o.length;a++)i[`shadow_uViewProjectionMatrices[${a}]`]=o[a],i[`shadow_uProjectCenters[${a}]`]=s[a];for(let a=0;a<2;a++)i[`shadow_uShadowMap${a}`]=t.shadowMaps&&t.shadowMaps[a]||t.dummyShadowMap;return i}(t,e):{}}},SC={color:[255,255,255],intensity:1},TC=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],CC=[0,0,0,200/255];class AC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.id="lighting-effect",this.shadowColor=CC,this.shadow=!1,this.ambientLight=null,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.shadowMaps=[],this.dummyShadowMap=null,this.setProps(t)}setup(t){this.context=t;const{device:e,deck:n}=t;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(e),n._addDefaultShaderModule(xC),this.dummyShadowMap=e.createTexture({width:1,height:1}))}setProps(t){this.ambientLight=null,this.directionalLights=[],this.pointLights=[];for(const e in t){const n=t[e];switch(n.type){case"ambient":this.ambientLight=n;break;case"directional":this.directionalLights.push(n);break;case"point":this.pointLights.push(n)}}this._applyDefaultLights(),this.shadow=this.directionalLights.some((t=>t.shadow)),this.context&&this.setup(this.context),this.props=t}preRender(t){let{layers:e,layerFilter:n,viewports:i,onViewportActive:r,views:s}=t;if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let t=0;t<this.shadowPasses.length;t++){this.shadowPasses[t].render({layers:e,layerFilter:n,viewports:i,onViewportActive:r,views:s,moduleParameters:{shadowLightId:t,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}})}}}getModuleParameters(t){const e=this.shadow?{shadowMaps:this.shadowMaps,dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{};return e.lightSources={ambientLight:this.ambientLight,directionalLights:this.directionalLights.map((e=>e.getProjectedLight({layer:t}))),pointLights:this.pointLights.map((e=>e.getProjectedLight({layer:t})))},e}cleanup(t){for(const e of this.shadowPasses)e.delete();this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,t.deck._removeDefaultShaderModule(xC))}_calculateMatrices(){const t=[];for(const e of this.directionalLights){const n=(new $S).lookAt({eye:new RS(e.direction).negate()});t.push(n)}return t}_createShadowPasses(t){for(let e=0;e<this.directionalLights.length;e++){const n=new yC(t);this.shadowPasses[e]=n,this.shadowMaps[e]=n.shadowMap}}_applyDefaultLights(){const{ambientLight:t,pointLights:e,directionalLights:n}=this;t||0!==e.length||0!==n.length||(this.ambientLight=new cC(SC),this.directionalLights.push(new fC(TC[0]),new fC(TC[1])))}}const PC=new AC;class RC{constructor(t){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=t,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(t){const e=this._defaultEffects;if(!e.find((e=>e.id===t.id))){const n=e.findIndex((e=>function(t,e){return(t.order??1/0)-(e.order??1/0)}(e,t)>0));n<0?e.push(t):e.splice(n,0,t),t.setup(this._context),this._setEffects(this.effects)}}setProps(t){"effects"in t&&(AT(t.effects,this.effects,1)||this._setEffects(t.effects))}needsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}getEffects(){return this._resolvedEffects}_setEffects(t){const e={};for(const i of this.effects)e[i.id]=i;const n=[];for(const i of t){const t=e[i.id];let r=i;t&&t!==i?t.setProps?(t.setProps(i.props),r=t):t.cleanup(this._context):t||i.setup(this._context),n.push(r),delete e[i.id]}for(const i in e)e[i].cleanup(this._context);this.effects=n,this._resolvedEffects=n.concat(this._defaultEffects),t.some((t=>t instanceof AC))||this._resolvedEffects.push(PC),this._needsRedraw="effects changed"}finalize(){for(const t of this._resolvedEffects)t.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}}class MC extends mC{shouldDrawLayer(t){const{operation:e}=t.props;return e.includes("draw")||e.includes("terrain")}}const IC={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"
2constant-alpha",blendAlphaDstFactor:"zero"};class LC extends mC{constructor(){super(...arguments),this._colorEncoderState=null}render(t){return"pickingFBO"in t?this._drawPickingBuffer(t):super.render(t)}_drawPickingBuffer(t){let{layers:e,layerFilter:n,views:i,viewports:r,onViewportActive:s,pickingFBO:o,deviceRect:{x:a,y:l,width:c,height:u},cullRect:h,effects:d,pass:p="picking",pickZ:f,moduleParameters:g}=t;this.pickZ=f;const m=this._resetColorEncoder(f),_=[a,l,c,u],y=super.render({target:o,layers:e,layerFilter:n,views:i,viewports:r,onViewportActive:s,cullRect:h,effects:d?.filter((t=>t.useInPicking)),pass:p,isPicking:!0,moduleParameters:g,clearColor:[0,0,0,0],colorMask:15,scissorRect:_});this._colorEncoderState=null;return{decodePickingColor:m&&kC.bind(null,m),stats:y}}shouldDrawLayer(t){const{pickable:e,operation:n}=t.props;return e&&n.includes("draw")||n.includes("terrain")||n.includes("mask")}getModuleParameters(){return{picking:{isActive:1,isAttribute:this.pickZ},lightSources:{}}}getLayerParameters(t,e,n){const i={depthMask:!0,depthTest:!0,depthRange:[0,1],...t.props.parameters},{pickable:r,operation:s}=t.props;return!this._colorEncoderState||s.includes("terrain")?i.blend=!1:r&&s.includes("draw")&&(Object.assign(i,IC),i.blend=!0,i.blendColor=function(t,e,n){const{byLayer:i,byAlpha:r}=t;let s,o=i.get(e);o?(o.viewports.push(n),s=o.a):(s=i.size+1,s<=255?(o={a:s,layer:e,viewports:[n]},i.set(e,o),r[s]=o):(vw.warn("Too many pickable layers, only picking the first 255")(),s=0));return[0,0,0,s/255]}(this._colorEncoderState,t,n)),i}_resetColorEncoder(t){return this._colorEncoderState=t?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}}function kC(t,e){const n=t.byAlpha[e[3]];return n&&{pickedLayer:n.layer,pickedViewports:n.viewports,pickedObjectIndex:n.layer.decodePickingColor(e)}}class NC{constructor(t){this.device=t,this.gl=t.gl,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new MC(t),this.pickLayersPass=new LC(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;const e=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,n={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...t};n.effects&&this._preRender(n.effects,n);const i=this.lastPostProcessEffect?this.renderBuffers[0]:n.target;this.lastPostProcessEffect&&(n.clearColor=[0,0,0,0],n.clearCanvas=!0);const r=e.render({...n,target:i});n.effects&&this._postRender(n.effects,n),this.renderCount++,fE("deckRenderer.renderLayers",this,r,t)}needsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}finalize(){const{renderBuffers:t}=this;for(const e of t)e.delete();t.length=0}_preRender(t,e){this.lastPostProcessEffect=null,e.preRenderStats=e.preRenderStats||{};for(const n of t)e.preRenderStats[n.id]=n.preRender(e),n.postRender&&(this.lastPostProcessEffect=n.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){const{renderBuffers:t}=this,e=this.device.canvasContext.getDrawingBufferSize();0===t.length&&[0,1].map((e=>{const n=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"}});t.push(this.device.createFramebuffer({id:`deck-renderbuffer-${e}`,colorAttachments:[n]}))}));for(const n of t)n.resize(e)}_postRender(t,e){const{renderBuffers:n}=this,i={...e,inputBuffer:n[0],swapBuffer:n[1]};for(const r of t)if(r.postRender){i.target=r.id===this.lastPostProcessEffect?e.target:void 0;const t=r.postRender(i);i.inputBuffer=t,i.swapBuffer=t===n[0]?n[1]:n[0]}}}const OC={pickedColor:null,pickedObjectIndex:-1};function DC(t){let{pickedColors:e,decodePickingColor:n,deviceX:i,deviceY:r,deviceRadius:s,deviceRect:o}=t;const{x:a,y:l,width:c,height:u}=o;let h=s*s,d=-1,p=0;for(let f=0;f<u;f++){const t=f+l-r,n=t*t;if(n>h)p+=4*c;else for(let r=0;r<c;r++){if(e[p+3]-1>=0){const t=r+a-i,e=t*t+n;e<=h&&(h=e,d=p)}p+=4}}if(d>=0){const t=e.slice(d,d+4),i=n(t);if(i){const e=Math.floor(d/4/c),n=d/4-e*c;return{...i,pickedColor:t,pickedX:a+n,pickedY:l+e}}vw.error("Picked non-existent layer. Is picking buffer corrupt?")()}return OC}function FC(t){let e,{pickInfo:n,viewports:i,pixelRatio:r,x:s,y:o,z:a}=t,l=i[0];if(i.length>1&&(l=function(t,e){for(let n=t.length-1;n>=0;n--){const i=t[n];if(i.containsPixel(e))return i}return t[0]}(n?.pickedViewports||i,{x:s,y:o})),l){const t=[s-l.x,o-l.y];void 0!==a&&(t[2]=a),e=l.unproject(t)}return{color:null,layer:null,viewport:l,index:-1,picked:!1,x:s,y:o,pixel:[s,o],coordinate:e,devicePixel:n&&"pickedX"in n?[n.pickedX,n.pickedY]:void 0,pixelRatio:r}}function BC(t){const{pickInfo:e,lastPickedInfo:n,mode:i,layers:r}=t,{pickedColor:s,pickedLayer:o,pickedObjectIndex:a}=e,l=o?[o]:[];if("hover"===i){const t=n.index,e=n.layerId,i=o?o.props.id:null;if(i!==e||a!==t){if(i!==e){const t=r.find((t=>t.props.id===e));t&&l.unshift(t)}n.layerId=i,n.index=a,n.info=null}}const c=FC(t),u=new Map;return u.set(null,c),l.forEach((t=>{let e={...c};t===o&&(e.color=s,e.index=a,e.picked=!0),e=UC({layer:t,info:e,mode:i});const r=e.layer;t===o&&"hover"===i&&(n.info=e),u.set(r.id,e),"hover"===i&&r.updateAutoHighlight(e)})),u}function UC(t){let{layer:e,info:n,mode:i}=t;
vendor: 9,392 bytes, line 2
2for(;e&&n;){const t=n.layer||null;n.sourceLayer=t,n.layer=e,n=e.getPickingInfo({info:n,mode:i,sourceLayer:t}),e=e.parent}return n}class zC{constructor(t){this._pickable=!0,this.device=t,this.pickLayersPass=new LC(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()}pickObject(t){return this._pickClosestObject(t)}pickObjects(t){return this._pickVisibleObjects(t)}getLastPickedObject(t){let{x:e,y:n,layers:i,viewports:r}=t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.lastPickedInfo.info;const o=s&&s.layer&&s.layer.id,a=s&&s.viewport&&s.viewport.id,l=o?i.find((t=>t.id===o)):null,c=a&&r.find((t=>t.id===a))||r[0],u=c&&c.unproject([e-c.x,n-c.y]),h={x:e,y:n,viewport:c,coordinate:u,layer:l};return{...s,...h}}_resizeBuffer(){if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float"))){const t=this.device.createFramebuffer({colorAttachments:["rgba32float"],depthStencilAttachment:"depth16unorm"});this.depthFBO=t}const t=this.device.gl;this.pickingFBO?.resize({width:t.canvas.width,height:t.canvas.height}),this.depthFBO?.resize({width:t.canvas.width,height:t.canvas.height})}_getPickable(t){if(!1===this._pickable)return null;const e=t.filter((t=>this.pickLayersPass.shouldDrawLayer(t)&&!t.isComposite));return e.length?e:null}_pickClosestObject(t){let{layers:e,views:n,viewports:i,x:r,y:s,radius:o=0,depth:a=1,mode:l="query",unproject3D:c,onViewportActive:u,effects:h}=t;const d=this.device.canvasContext.cssToDeviceRatio(),p=this._getPickable(e);if(!p||0===i.length)return{result:[],emptyInfo:FC({viewports:i,x:r,y:s,pixelRatio:d})};this._resizeBuffer();const f=this.device.canvasContext.cssToDevicePixels([r,s],!0),g=[f.x+Math.floor(f.width/2),f.y+Math.floor(f.height/2)],m=Math.round(o*d),{width:_,height:y}=this.pickingFBO,v=this._getPickingRect({deviceX:g[0],deviceY:g[1],deviceRadius:m,deviceWidth:_,deviceHeight:y}),b={x:r-o,y:s-o,width:2*o+1,height:2*o+1};let w;const E=[],x=new Set;for(let S=0;S<a;S++){let t,e;if(v){t=DC({...this._drawAndSample({layers:p,views:n,viewports:i,onViewportActive:u,deviceRect:v,cullRect:b,effects:h,pass:`picking:${l}`}),deviceX:g[0],deviceY:g[1],deviceRadius:m,deviceRect:v})}else t={pickedColor:null,pickedObjectIndex:-1};if(t.pickedLayer&&c&&this.depthFBO){const{pickedColors:r}=this._drawAndSample({layers:[t.pickedLayer],views:n,viewports:i,onViewportActive:u,deviceRect:{x:t.pickedX,y:t.pickedY,width:1,height:1},cullRect:b,effects:h,pass:`picking:${l}:z`},!0);r[3]&&(e=r[0])}t.pickedLayer&&S+1<a&&(x.add(t.pickedLayer),t.pickedLayer.disablePickingIndex(t.pickedObjectIndex)),w=BC({pickInfo:t,lastPickedInfo:this.lastPickedInfo,mode:l,layers:p,viewports:i,x:r,y:s,z:e,pixelRatio:d});for(const n of w.values())n.layer&&E.push(n);if(!t.pickedColor)break}for(const S of x)S.restorePickingColors();return{result:E,emptyInfo:w.get(null)}}_pickVisibleObjects(t){let{layers:e,views:n,viewports:i,x:r,y:s,width:o=1,height:a=1,mode:l="query",maxObjects:c=null,onViewportActive:u,effects:h}=t;const d=this._getPickable(e);if(!d||0===i.length)return[];this._resizeBuffer();const p=this.device.canvasContext.cssToDeviceRatio(),f=this.device.canvasContext.cssToDevicePixels([r,s],!0),g=f.x,m=f.y+f.height,_=this.device.canvasContext.cssToDevicePixels([r+o,s+a],!0),y=_.x+_.width,v=_.y,b={x:g,y:v,width:y-g,height:m-v},w=function(t){let{pickedColors:e,decodePickingColor:n}=t;const i=new Map;if(e)for(let r=0;r<e.length;r+=4)if(e[r+3]-1>=0){const t=e.slice(r,r+4),s=t.join(",");if(!i.has(s)){const e=n(t);e?i.set(s,{...e,color:t}):vw.error("Picked non-existent layer. Is picking buffer corrupt?")()}}return Array.from(i.values())}(this._drawAndSample({layers:d,views:n,viewports:i,onViewportActive:u,deviceRect:b,cullRect:{x:r,y:s,width:o,height:a},effects:h,pass:`picking:${l}`})),E=new Map,x=[],S=Number.isFinite(c);for(let T=0;T<w.length&&!(S&&x.length>=c);T++){const t=w[T];let e={color:t.pickedColor,layer:null,index:t.pickedObjectIndex,picked:!0,x:r,y:s,pixelRatio:p};e=UC({layer:t.pickedLayer,info:e,mode:l});const n=e.layer.id;E.has(n)||E.set(n,new Set);const i=E.get(n),o=e.object??e.index;i.has(o)||(i.add(o),x.push(e))}return x}_drawAndSample(t){let{layers:e,views:n,viewports:i,onViewportActive:r,deviceRect:s,cullRect:o,effects:a,pass:l}=t,c=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const u=c?this.depthFBO:this.pickingFBO,h={layers:e,layerFilter:this.layerFilter,views:n,viewports:i,onViewportActive:r,pickingFBO:u,deviceRect:s,cullRect:o,effects:a,pass:l,pickZ:c,preRenderStats:{}};for(const y of a)y.useInPicking&&(h.preRenderStats[y.id]=y.preRender(h));const{decodePickingColor:d}=this.pickLayersPass.render(h),{x:p,y:f,width:g,height:m}=s,_=new(c?Float32Array:Uint8Array)(g*m*4);return this.device.readPixelsToArrayWebGL(u,{sourceX:p,sourceY:f,sourceWidth:g,sourceHeight:m,target:_}),{pickedColors:_,decodePickingColor:d}}_getPickingRect(t){let{deviceX:e,deviceY:n,deviceRadius:i,deviceWidth:r,deviceHeight:s}=t;const o=Math.max(0,e-i),a=Math.max(0,n-i),l=Math.min(r,e+i+1)-o,c=Math.min(s,n+i+1)-a;return l<=0||c<=0?null:{x:o,y:a,width:l,height:c}}}const jC={"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}},VC="top-left",WC="__root";class $C{constructor(t){let{deck:e,parentElement:n}=t;this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=e,this.parentElement=n}getWidgets(){return this.resolvedWidgets}setProps(t){t.widgets&&!AT(t.widgets,this.widgets,1)&&this._setWidgets(t.widgets)}finalize(){for(const t of this.getWidgets())this._remove(t);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(const t in this.containers)this.containers[t].remove()}addDefault(t){this.defaultWidgets.find((e=>e.id===t.id))||(this._add(t),this.defaultWidgets.push(t),this._setWidgets(this.widgets))}_setWidgets(t){const e={};for(const n of this.resolvedWidgets)e[n.id]=n;this.resolvedWidgets.length=0;for(const n of this.defaultWidgets)e[n.id]=null,this.resolvedWidgets.push(n);for(let n of t){const t=e[n.id];t?t.viewId!==n.viewId||t.placement!==n.placement?(this._remove(t),this._add(n)):n!==t&&(t.setProps(n.props),n=t):this._add(n),e[n.id]=null,this.resolvedWidgets.push(n)}for(const n in e){const t=e[n];t&&this._remove(t)}this.widgets=t}_add(t){const{viewId:e=null,placement:n=VC}=t,i=t.onAdd({deck:this.deck,viewId:e});i&&this._getContainer(e,n).append(i),t._element=i}_remove(t){t.onRemove(),t._element&&t._element.remove(),t._element=void 0}_getContainer(t,e){const n=t||WC;let i=this.containers[n];i||(i=document.createElement("div"),i.style.pointerEvents="none",i.style.position="absolute",i.style.overflow="hidden",this.parentElement?.append(i),this.containers[n]=i);let r=i.querySelector(`.${e}`);return r||(r=document.createElement("div"),r.className=e,r.style.position="absolute",r.style.zIndex="2",Object.assign(r.style,jC[e]),i.append(r)),r}_updateContainers(){const t=this.deck.width,e=this.deck.height;for(const n in this.containers){const i=this.lastViewports[n]||null,r=n===WC||i,s=this.containers[n];r?(s.style.display="block",s.style.left=`${i?i.x:0}px`,s.style.top=`${i?i.y:0}px`,s.style.width=`${i?i.width:t}px`,s.style.height=`${i?i.height:e}px`):s.style.display="none"}}onRedraw(t){let{viewports:e,layers:n}=t;const i=e.reduce(((t,e)=>(t[e.id]=e,t)),{}),{lastViewports:r}=this;for(const s of this.getWidgets()){const{viewId:t}=s;if(t){const e=i[t];e&&(s.onViewportChange&&!e.equals(r[t])&&s.onViewportChange(e),s.onRedraw?.({viewports:[e],layers:n}))}else{if(s.onViewportChange)for(const t of e)t.equals(r[t.id])||s.onViewportChange(t);s.onRedraw?.({viewports:e,layers:n})}}this.lastViewports=i,this._updateContainers()}onHover(t,e){for(const n of this.getWidgets()){const{viewId:i}=n;i&&i!==t.viewport?.id||n.onHover?.(t,e)}}onEvent(t,e){const n=xw[e.type];if(n)for(const i of this.getWidgets()){const{viewId:r}=i;r&&r!==t.viewport?.id||i[n.handler]?.(t,e)}}}const GC={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"};class HC{constructor(){this.id="default-tooltip",this.placement="fill",this.props={},this.isVisible=!1}onAdd(t){let{deck:e}=t;const n=document.createElement("div");return n.className="deck-tooltip",Object.assign(n.style,GC),this.deck=e,this.element=n,n}onRemove(){this.deck=void 0,this.element=void 0}setProps(){}onViewportChange(t){this.isVisible&&t.id===this.lastViewport?.id&&t!==this.lastViewport&&this.setTooltip(null)}onHover(t){const{deck:e}=this,n=e&&e.props.getTooltip;if(!n)return;const i=n(t);this.lastViewport=t.viewport,this.setTooltip(i,t.x,t.y)}setTooltip(t,e,n){const i=this.element;if(i){if("string"===typeof t)i.innerText=t;else{if(!t)return this.isVisible=!1,void(i.style.display="none");t.text&&(i.innerText=t.text),t.html&&(i.innerHTML=t.html),t.className&&(i.className=t.className)}this.isVisible=!0,i.style.display="block",i.style.transform=`translate(${e}px, ${n}px)`,t&&"object"===typeof t&&"style"in t&&Object.assign(i.style,t.style)}
2}}const qC=globalThis.loaders?.parseImageNode,ZC="undefined"!==typeof Image,XC="undefined"!==typeof ImageBitmap,KC=Boolean(qC),YC=!!KE||KC;function JC(t){const e=tA(t);if(!e)throw new Error("Not an image");return e}function QC(t){switch(JC(t)){case"data":return t;case"image":case"imagebitmap":const e=document.createElement("canvas"),n=e.getContext("2d");if(!n)throw new Error("getImageData");return e.width=t.width,e.height=t.height,n.drawImage(t,0,0),n.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function tA(t){return"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap?"imagebitmap":"undefined"!==typeof Image&&t instanceof Image?"image":t&&"object"===typeof t&&t.data&&t.width&&t.height?"data":null}const eA=/^data:image\/svg\+xml/,nA=/\.svg((\?|#).*)?$/;function iA(t){return t&&(eA.test(t)||nA.test(t))}function rA(t,e){if(iA(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function sA(t,e,n){const i=function(t,e){if(iA(e)){let e=(new TextDecoder).decode(t);try{"function"===typeof unescape&&"function"===typeof encodeURIComponent&&(e=unescape(encodeURIComponent(e)))}catch($c){throw new Error($c.message)}return`data:image/svg+xml;base64,${btoa(e)}`}return rA(t,e)}(t,n),r=self.URL||self.webkitURL,s="string"!==typeof i&&r.createObjectURL(i);try{return await async function(t,e){const n=new Image;if(n.src=t,e.image&&e.image.decode&&n.decode)return await n.decode(),n;return await new Promise(((t,e)=>{try{n.onload=()=>t(n),n.onerror=t=>{const n=t instanceof Error?t.message:"error";e(new Error(n))}}catch($c){e($c)}}))}(s||i,e)}finally{s&&r.revokeObjectURL(s)}}const oA={};let aA=!0;async function lA(t,e,n){let i;if(iA(n)){i=await sA(t,e,n)}else i=rA(t,n);const r=e&&e.imagebitmap;return await async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(t){for(const e in t||oA)return!1;return!0}(e)&&aA||(e=null);if(e)try{return await createImageBitmap(t,e)}catch($c){console.warn($c),aA=!1}return await createImageBitmap(t)}(i,r)}function cA(t){return function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const i=function(t){return[...t].map((t=>t.charCodeAt(0)))}(e);for(let r=0;r<i.length;++r)if(i[r]!==t[r+n])return!1;return!0}(t,"ftyp",4)?0===(96&t[8])?null:function(t){switch(function(t,e,n){return String.fromCharCode(...t.slice(e,n))}(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}(t):null}const uA=!1,hA=!0;function dA(t){const e=pA(t);return function(t){const e=pA(t),n=e.byteLength>=24&&2303741511===e.getUint32(0,uA);if(!n)return null;return{mimeType:"image/png",width:e.getUint32(16,uA),height:e.getUint32(20,uA)}}(e)||function(t){const e=pA(t),n=e.byteLength>=3&&65496===e.getUint16(0,uA)&&255===e.getUint8(2);if(!n)return null;const{tableMarkers:i,sofMarkers:r}=function(){const t=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)t.add(n);const e=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:t,sofMarkers:e}}();let s=2;for(;s+9<e.byteLength;){const t=e.getUint16(s,uA);if(r.has(t))return{mimeType:"image/jpeg",height:e.getUint16(s+5,uA),width:e.getUint16(s+7,uA)};if(!i.has(t))return null;s+=2,s+=e.getUint16(s,uA)}return null}(e)||function(t){const e=pA(t),n=e.byteLength>=10&&1195984440===e.getUint32(0,uA);if(!n)return null;return{mimeType:"image/gif",width:e.getUint16(6,hA),height:e.getUint16(8,hA)}}(e)||function(t){const e=pA(t),n=e.byteLength>=14&&16973===e.getUint16(0,uA)&&e.getUint32(2,hA)===e.byteLength;if(!n)return null;return{mimeType:"image/bmp",width:e.getUint32(18,hA),height:e.getUint32(22,hA)}}(e)||function(t){const e=new Uint8Array(t instanceof DataView?t.buffer:t),n=cA(e);if(!n)return null;return{mimeType:n.mimeType,width:0,height:0}}(e)}function pA(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}const fA={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:"4.2.1",mimeTypes:["image/png","image/jpeg","image/gif","
2image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],parse:async function(t,e,n){const i=((e=e||{}).image||{}).type||"auto",{url:r}=n||{},s=function(t){switch(t){case"auto":case"data":return function(){if(XC)return"imagebitmap";if(ZC)return"image";if(YC)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(t){switch(t){case"auto":return XC||ZC||YC;case"imagebitmap":return XC;case"image":return ZC;case"data":return YC;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}(t),t}}(i);let o;switch(s){case"imagebitmap":o=await lA(t,e,r);break;case"image":o=await sA(t,e,r);break;case"data":o=await async function(t,e){const{mimeType:n}=dA(t)||{},i=globalThis.loaders?.parseImageNode;return IE(i),await i(t,n)}(t);break;default:IE(!1)}return"data"===i&&(o=QC(o)),o},tests:[t=>Boolean(dA(new DataView(t)))],options:{image:{type:"auto",decode:!0}}};const gA={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:function(t){const e=t[0],n=t[t.length-1];return"{"===e&&"}"===n||"["===e&&"]"===n},parseTextSync:JSON.parse};const mA=function(){const t="9.0.20",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(vw.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:vw,_registerLoggers:pE},function(t){const e=Vx();t=Array.isArray(t)?t:[t];for(const n of t){const t=kE(n);e.find((e=>t===e))||e.unshift(t)}}([gA,[fA,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}(),_A=new gw({id:"luma.gl"});const yA=new class{stats=(()=>new Map)();getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new bE({id:t})),this.stats.get(t)}};const vA=function(){const t="9.0.15";if(globalThis.luma&&globalThis.luma.VERSION!==t)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${t}`);return globalThis.luma||(Qb()&&_A.log(1,`${t} - set luma.log.level=1 (or higher) to trace rendering`)(),globalThis.luma=globalThis.luma||{VERSION:t,version:t,log:_A,stats:yA}),t}(),bA={};function wA(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";bA[t]=bA[t]||1;return`${t}-${bA[t]++}`}function EA(t){let e=!0;for(const n in t){e=!1;break}return e}class xA{static defaultProps={id:"undefined",handle:void 0,userData:void 0};id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=(()=>new Set)();constructor(t,e,n){if(!t)throw new Error("no device");this._device=t,this.props=function(t,e){const n={...e};for(const i in t)void 0!==t[i]&&(n[i]=t[i]);return n}(e,n);const i="undefined"!==this.props.id?this.props.id:wA(this[Symbol.toStringTag]);this.props.id=i,this.id=i,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}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(const t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){const t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get(`${e}s Active`).decrementCount()}trackAllocatedMemory(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this[Symbol.toStringTag];const n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(t),n.get(`${e} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this[Symbol.toStringTag];const e=this._device.statsManager.getStats("Resource Counts");e.get("GPU Memory").subtractCount(this.allocatedBytes),e.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){const t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${e}s Created`).incrementCount(),t.get(`${e}s Active`).incrementCount()}}class SA extends xA{static defaultProps={...xA.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1};static MAP_READ=1;static MAP_WRITE=2;static COPY_SRC=4;static COPY_DST=8;static INDEX=16;static VERTEX=32;static UNIFORM=64;static STORAGE=128;static INDIRECT=256;static QUERY_RESOLVE=512;get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,e){const n={...e};(e.usage||0)&SA.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?n.indexType="uint32":e.data instanceof Uint16Array&&(n.indexType="uint16")),super(t,n,SA.defaultProps),this.usage=e.usage||0,this.indexType=n.indexType,this.updateTimestamp=t.incrementTimestamp()}
2readSyncWebGL(t,e){throw new Error("not implemented")}static DEBUG_DATA_MAX_LENGTH=32;debugData=(()=>new ArrayBuffer(0))();_setDebugData(t,e,n){const i=ArrayBuffer.isView(t)?t.buffer:t,r=Math.min(t?t.byteLength:n,SA.DEBUG_DATA_MAX_LENGTH);null===t?this.debugData=new ArrayBuffer(r):0===e&&n===t.byteLength?this.debugData=i.slice(0,r):this.debugData=i.slice(e,e+r)}}function TA(t){const e=function(t){const e=AA[t];return e}(CA[t]),n=t.includes("norm"),i=!n&&!t.startsWith("float"),r=t.startsWith("s");return{dataType:CA[t],byteLength:e,integer:i,signed:r,normalized:n}}const CA={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},AA={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4},PA=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],RA=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function MA(t){const e=RA.exec(t);if(e){const[,t,n,i,r,s]=e;if(t){const e=TA(`${i}${n}`);return{format:t,components:t.length,srgb:"-srgb"===r,unsized:"-unsized"===s,webgl:"-webgl"===s,...e}}}return function(t){const e=IA[t];if(!e)throw new Error(`Unknown format ${t}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}(t)}const IA={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};class LA{}class kA{features;disabledFeatures;constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;this.features=new Set(t),this.disabledFeatures=e||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures[t]&&this.features.has(t)}}class NA{static defaultProps=(()=>({id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(_A.get("debug")),spector:Boolean(_A.get("spector")||_A.get("spectorjs")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:t=>_A.error(t.message)}))();get[Symbol.toStringTag](){return"Device"}static VERSION=(()=>vA)();constructor(t){this.props={...NA.defaultProps,...t},this.id=this.props.id||wA(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=(()=>yA)();_lumaData={};isTextureFormatCompressed(t){return e=t,PA.some((t=>e.startsWith(t)));var e}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(t){return(t instanceof Promise||"string"===typeof t)&&(t={data:t}),this._createTexture(t)}createCommandEncoder(){throw new Error("not implemented")}readPixelsToArrayWebGL(t,e){throw new Error("not implemented")}readPixelsToBufferWebGL(t,e){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,e){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(t){this.props.onError(t)}_getBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e={...t};return(t.usage||0)&SA.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?e.indexType="uint32":t.data instanceof Uint16Array?e.indexType="uint16":_A.warn("indices buffer content must be of integer type")()),e}}function OA(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}const DA=new Map;class FA{static defaultProps=(()=>({...NA.defaultProps,type:"best-available",devices:void 0}))();static stats=(()=>yA)();static log=(()=>_A)();static registerDevices(t){for(const e of t)OA(e.type&&e.isSupported&&e.create),DA.set(e.type,e)}static getAvailableDevices(){return Array.from(DA).map((t=>t.type))}
vendor: 53,289 bytes, line 2
2static getSupportedDevices(){return Array.from(DA).filter((t=>t.isSupported())).map((t=>t.type))}static setDefaultDeviceProps(t){Object.assign(NA.defaultProps,t)}static async attachDevice(t){const e=BA(t.devices)||DA;if(t.handle instanceof WebGL2RenderingContext){const n=e.get("webgl");if(n)return await n.attach(t.handle)}if(null===t.handle){const t=e.get("unknown");if(t)return await t.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t={...FA.defaultProps,...t},t.gl&&(t.type="webgl");const e=BA(t.devices)||DA;switch(t.type){case"webgpu":let n=e.get("webgpu");if(n)return await n.create(t);break;case"webgl":let i=e.get("webgl");if(i)return await i.create(t);break;case"unknown":const r=e.get("unknown");if(r)return await r.create(t);break;case"best-available":if(n=e.get("webgpu"),n?.isSupported?.())return await n.create(t);if(i=e.get("webgl"),i?.isSupported?.())return await i.create(t)}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static enforceWebGL2(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext)return e.getContext=e.originalGetContext,void(e.originalGetContext=void 0);e.originalGetContext=e.getContext,e.getContext=function(t,e){return"webgl"===t||"experimental-webgl"===t?this.originalGetContext("webgl2",e):this.originalGetContext(t,e)}}}function BA(t){if(!t||0===t?.length)return null;const e=new Map;for(const n of t)e.set(n.type,n);return e}const UA=Qb()&&"undefined"!==typeof document,zA=()=>UA&&"complete"===document.readyState,jA={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"};class VA{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return zA()}static pageLoaded=(()=>function(){if(zA()||"undefined"===typeof window)return Promise.resolve();return new Promise((t=>{window.addEventListener("load",(()=>t()))}))}())();constructor(t){if(this.props={...jA,...t},t=this.props,!Qb())return this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,void(this.canvas=null);if(t.canvas)"string"===typeof t.canvas?this.canvas=function(t){const e=document.getElementById(t);if(!e&&!zA())throw new Error(`Accessing '${t}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}(t.canvas):this.canvas=t.canvas;else{const e=function(t){const{width:e,height:n}=t,i=document.createElement("canvas");return i.id="lumagl-auto-created-canvas",i.width=e||1,i.height=n||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(n)?`${n}px`:"100%",i}(t),n=function(t){if("string"===typeof t){const e=document.getElementById(t);if(!e&&!zA())throw new Error(`Accessing '${t}' before page was loaded`);if(!e)throw new Error(`${t} is not an HTML element`);return e}if(t)return t;return document.body}(t?.container||null);n.insertBefore(e,n.firstChild),this.canvas=e,t?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver((t=>{for(const e of t)e.target===this.canvas&&this.update()})),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(t){if("undefined"!==typeof OffscreenCanvas&&this.canvas instanceof OffscreenCanvas)return 1;if(!(t=void 0===t?this.props.useDevicePixels:t)||t<=0)return 1;if(!0===t){return"undefined"!==typeof window&&window.devicePixelRatio||1}return t}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":const t=this.getDevicePixelRatio(),e=this.canvas;return e.parentElement?[e.clientWidth*t,e.clientHeight*t]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){const[t,e]=this.getPixelSize();return t/e}cssToDeviceRatio(){try{const[t]=this.getDrawingBufferSize(),{clientWidth:e}=this._canvasSizeInfo;return e?t/e:1}catch{return 1}}cssToDevicePixels(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=this.cssToDeviceRatio(),[i,r]=this.getDrawingBufferSize();return function(t,e,n,i,r){const s=t,o=WA(s[0],e,n);let a=$A(s[1],e,i,r),l=WA(s[0]+1,e,n);const c=l===n-1?l:l-1;let u;l=$A(s[1]+1,e,i,r),r?(l=0===l?l:l+1,u=a,a=l):u=l===i-1?l:l-1;return{x:o,y:a,width:Math.max(c-o+1,1),height:Math.max(u-a+1,1)}}(t,n,i,r,e)}setDevicePixelRatio(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.htmlCanvas)return;let n="width"in e?e.width:this.htmlCanvas.clientWidth,i="height"in e?e.height:this.htmlCanvas.clientHeight;n&&i||(_A.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,n=this.htmlCanvas.width||1,i=this.htmlCanvas.height||1);const r=this._canvasSizeInfo;if(r.clientWidth!==n||r.clientHeight!==i||r.devicePixelRatio!==t){let e=t;const r=Math.floor(n*e),s=Math.floor(i*e);this.htmlCanvas.width=r,this.htmlCanvas.height=s;const[o,a]=this.getDrawingBufferSize();o===r&&a===s||(e=Math.min(o/n,a/i),this.htmlCanvas.width=Math.floor(n*e),this.htmlCanvas.height=Math.floor(i*e),_A.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=n,this._canvasSizeInfo.clientHeight=i,this._canvasSizeInfo.devicePixelRatio=t}}getDrawingBufferSize(){const t=this.device.gl;if(!t)throw new Error("canvas size");return[t.drawingBufferWidth,t.drawingBufferHeight]}_setAutoCreatedCanvasId(t){"lumagl-auto-created-canvas"===this.htmlCanvas?.id&&(this.htmlCanvas.id=t)}}function WA(t,e,n){return Math.min(Math.round(t*e),n-1)}function $A(t,e,n,i){return i?Math.max(0,n-1-Math.round(t*e)):Math.min(Math.round(t*e),n-1)}const GA={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},HA=(t,e,n)=>e?t.enable(n):t.disable(n),qA=(t,e,n)=>t.hint(n,e),ZA=(t,e,n)=>t.pixelStorei(n,e),XA=(t,e,n)=>{const i=36006===n?36009:36008;return t.bindFramebuffer(i,e)},KA=(t,e,n)=>{const i={34964:34962,36662:36662,36663:36663,35053:35051,35055:35052}[n];t.bindBuffer(i,e)};function YA(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}const JA={3042:HA,32773:(t,e)=>t.blendColor(...e),32777:"blendEquation",34877:"blendEquation",32969:"blendFunc",32968:"blendFunc",32971:"blendFunc",32970:"blendFunc",3106:(t,e)=>t.clearColor(...e),3107:(t,e)=>t.colorMask(...e),2884:HA,2885:(t,e)=>t.cullFace(e),2929:HA,2931:(t,e)=>t.clearDepth(e),2932:(t,e)=>t.depthFunc(e),2928:(t,e)=>t.depthRange(...e),2930:(t,e)=>t.depthMask(e),3024:HA,35723:qA,35725:(t,e)=>t.useProgram(e),36007:(t,e)=>t.bindRenderbuffer(36161,e),36389:(t,e)=>t.bindTransformFeedback?.(36386,e),34229:(t,e)=>t.bindVertexArray(e),36006:XA,36010:XA,34964:KA,36662:KA,36663:KA,35053:KA,35055:KA,2886:(t,e)=>t.frontFace(e),33170:qA,2849:(t,e)=>t.lineWidth(e),32823:HA,32824:"polygonOffset",10752:"polygonOffset",35977:HA,32926:HA,32928:HA,32938:"sampleCoverage",32939:"sampleCoverage",3089:HA,3088:(t,e)=>t.scissor(...e),2960:HA,2961:(t,e)=>t.clearStencil(e),2968:(t,e)=>t.stencilMaskSeparate(1028,e),36005:(t,e)=>t.stencilMaskSeparate(1029,e),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:(t,e)=>t.viewport(...e),34383:HA,10754:HA,12288:HA,12289:HA,12290:HA,12291:HA,12292:HA,12293:HA,12294:HA,12295:HA,3333:ZA,3317:ZA,37440:ZA,37441:ZA,37443:ZA,3330:ZA,3332:ZA,3331:ZA,3314:ZA,32878:ZA,3316:ZA,3315:ZA,32877:ZA,framebuffer:(t,e)=>{const n=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,n)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{const n="number"===typeof e?[e,e]:e;t.blendEquationSeparate(...n)},blendFunc:(t,e)=>{const n=2===e?.length?[...e,...e]:e;t.blendFuncSeparate(...n)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(...e),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=YA(e)?e:[e,e];const[n,i]=e;t.stencilMaskSeparate(1028,n),t.stencilMaskSeparate(1029,i)},stencilFunc:(t,e)=>{e=YA(e)&&3===e.length?[...e,...e]:e;const[n,i,r,s,o,a]=e;t.stencilFuncSeparate(1028,n,i,r),t.stencilFuncSeparate(1029,s,o,a)},stencilOp:(t,e)=>{e=YA(e)&&3===e.length?[...e,...e]:e;const[n,i,r,s,o,a]=e;t.stencilOpSeparate(1028,n,i,r),t.stencilOpSeparate(1029,s,o,a)},viewport:(t,e)=>t.viewport(...e)};function QA(t,e,n){return void 0!==e[t]?e[t]:n[t]}const tP={blendEquation:(t,e,n)=>t.blendEquationSeparate(QA(32777,e,n),QA(34877,e,n)),blendFunc:(t,e,n)=>t.blendFuncSeparate(QA(32969,e,n),QA(32968,e,n),QA(32971,e,n),QA(32970,e,n)),polygonOffset:(t,e,n)=>t.polygonOffset(QA(32824,e,n),QA(10752,e,n)),sampleCoverage:(t,e,n)=>t.sampleCoverage(QA(32938,e,n),QA(32939,e,n)),stencilFuncFront:(t,e,n)=>t.stencilFuncSeparate(1028,QA(2962,e,n),QA(2967,e,n),QA(2963,e,n)),stencilFuncBack:(t,e,n)=>t.stencilFuncSeparate(1029,QA(34816,e,n),QA(36003,e,n),QA(36004,e,n)),stencilOpFront:(t,e,n)=>t.stencilOpSeparate(1028,QA(2964,e,n),QA(2965,e,n),QA(2966,e,n)),stencilOpBack:(t,e,n)=>t.stencilOpSeparate(1029,QA(34817,e,n),QA(34818,e,n),QA(34819,e,n))},eP={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,n)=>t({[e]:n}),hint:(t,e,n)=>t({[e]:n}),useProgram:(t,e)=>t({35725:e}),bindRenderbuffer:(t,e,n)=>t({36007:n}),bindTransformFeedback:(t,e,n)=>t({36389:n}),bindVertexArray:(t,e)=>t({34229:e}),bindFramebuffer:(t,e,n)=>{switch(e){case 36160:return t({36006:n,36010:n});case 36009:return t({36006:n});case 36008:return t({36010:n});default:return null}},bindBuffer:(t,e,n)=>{const i={34962:[34964],36662:[36662],36663:[36663],35051:[35053],35052:[35055]}[e];return i?t({[i]:n}):{valueChanged:!0}},blendColor:(t,e,n,i,r)=>t({32773:new Float32Array([e,n,i,r])}),blendEquation:(t,e)=>t({32777:e,34877:e}),blendEquationSeparate:(t,e,n)=>t({32777:e,34877:n}),blendFunc:(t,e,n)=>t({32969:e,32968:n,32971:e,32970:n}),blendFuncSeparate:(t,e,n,i,r)=>t({32969:e,32968:n,32971:i,32970:r}),clearColor:(t,e,n,i,r)=>t({3106:new Float32Array([e,n,i,r])}),clearDepth:(t,e)=>t({2931:e}),clearStencil:(t,e)=>t({2961:e}),colorMask:(t,e,n,i,r)=>t({3107:[e,n,i,r]}),cullFace:(t,e)=>t({2885:e}),depthFunc:(t,e)=>t({2932:e}),depthRange:(t,e,n)=>t({2928:new Float32Array([e,n])}),depthMask:(t,e)=>t({2930:e}),frontFace:(t,e)=>t({2886:e}),lineWidth:(t,e)=>t({2849:e}),polygonOffset:(t,e,n)=>t({32824:e,10752:n}),sampleCoverage:(t,e,n)=>t({32938:e,32939:n}),scissor:(t,e,n,i,r)=>t({3088:new Int32Array([e,n,i,r])}),stencilMask:(t,e)=>t({2968:e,36005:e}),stencilMaskSeparate:(t,e,n)=>t({[1028===e?2968:36005]:n}),stencilFunc:(t,e,n,i)=>t({2962:e,2967:n,2963:i,34816:e,36003:n,36004:i}),stencilFuncSeparate:(t,e,n,i,r)=>t({[1028===e?2962:34816]:n,[1028===e?2967:36003]:i,[1028===e?2963:36004]:r}),stencilOp:(t,e,n,i)=>t({2964:e,2965:n,2966:i,34817:e,34818:n,34819:i}),stencilOpSeparate:(t,e,n,i,r)=>t({[1028===e?2964:34817]:n,[1028===e?2965:34818]:i,[1028===e?2966:34819]:r}),viewport:(t,e,n,i,r)=>t({2978:[e,n,i,r]})},nP=(t,e)=>t.isEnabled(e),iP={3042:nP,2884:nP,2929:nP,3024:nP,32823:nP,32926:nP,32928:nP,3089:nP,2960:nP,35977:nP},rP=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 sP(t,e){if(function(t){for(const e in t)return!1;return!0}(e))return;const n={};for(const r in e){const i=Number(r),s=JA[r];s&&("string"===typeof s?n[s]=!0:s(t,e[r],i))}const i=t.state&&t.state.cache;if(i)for(const r in n){(0,tP[r])(t,e,i)}}function oP(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:GA;if("number"===typeof e){const n=e,i=iP[n];return i?i(t,n):t.getParameter(n)}const n=Array.isArray(e)?e:Object.keys(e),i={};for(const r of n){const e=iP[r];i[r]=e?e(t,Number(r)):t.getParameter(Number(r))}return i}function aP(t,e){if(t===e)return!0;const n=Array.isArray(t)||ArrayBuffer.isView(t),i=Array.isArray(e)||ArrayBuffer.isView(e);if(n&&i&&t.length===e.length){for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}return!1}class lP{gl;program=null;stateStack=[];enable=!0;cache;log;constructor(t){let{copyState:e=!1,log:n=(()=>{})}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.gl=t,this.cache=e?oP(t):Object.assign({},GA),this.log=n,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){this.stateStack.push({})}pop(){OA(this.stateStack.length>0);const t=this.stateStack[this.stateStack.length-1];sP(this.gl,t),this.stateStack.pop()}_updateCache(t){let e,n=!1;const i=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(const r in t){OA(void 0!==r);const s=t[r],o=this.cache[r];aP(s,o)||(n=!0,e=o,i&&!(r in i)&&(i[r]=o),this.cache[r]=s)}return{valueChanged:n,oldValue:e}}}function cP(t){return t.state}function uP(t,e){const{enable:n=!0,copyState:i}=e;if(OA(void 0!==i),!t.state){t.state=new lP(t,{copyState:i}),function(t){const e=t.useProgram.bind(t);t.useProgram=function(n){const i=cP(t);i.program!==n&&(e(n),i.program=n)}}(t);for(const e in eP){fP(t,e,eP[e])}pP(t,"getParameter"),pP(t,"isEnabled")}return cP(t).enable=n,t}function hP(t){let e=cP(t);e||(uP(t,{copyState:!1}),e=cP(t)),e.push()}function dP(t){const e=cP(t);OA(e),e.pop()}function pP(t,e){const n=t[e].bind(t);t[e]=function(e){if(void 0===e||rP.has(e))return n(e);const i=cP(t);return e in i.cache||(i.cache[e]=n(e)),i.enable?i.cache[e]:n(e)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function fP(t,e,n){if(!t[e])return;const i=t[e].bind(t);t[e]=function(){const e=cP(t);for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];const{valueChanged:a,oldValue:l}=n(e._updateCache,...s);return a&&i(...s),l},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}const gP={powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function mP(t,e,n){return void 0===n[e]&&(n[e]=t.getExtension(e)||null),n[e]}function _P(t,e){const n=t.getParameter(7936),i=t.getParameter(7937);mP(t,"WEBGL_debug_renderer_info",e);const r=e.WEBGL_debug_renderer_info,s=t.getParameter(r?r.UNMASKED_VENDOR_WEBGL:7936)||n,o=t.getParameter(r?r.UNMASKED_RENDERER_WEBGL:7937)||i,a=t.getParameter(7938),l=yP(s,o),c=function(t,e){if(/Metal/i.exec(t)||/Metal/i.exec(e))return"metal";if(/ANGLE/i.exec(t)||/ANGLE/i.exec(e))return"opengl";return"unknown"}(s,o),u=function(t,e){if(/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e))return"cpu";switch(yP(t,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}(s,o);return{type:"webgl",gpu:l,gpuType:u,gpuBackend:c,vendor:s,renderer:o,version:a,shadingLanguage:"glsl",shadingLanguageVersion:300}}function yP(t,e){return/NVIDIA/i.exec(t)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(t)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(t)||/Apple/i.exec(e)?"apple":/AMD/i.exec(t)||/AMD/i.exec(e)||/ATI/i.exec(t)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e)?"software":"unknown"}function vP(t){switch(t){case"uint8":case"unorm8":return 5121;case"sint8":case"snorm8":return 5120;case"uint16":case"unorm16":return 5123;case"sint16":case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(t))}const bP="texture-compression-bc",wP="texture-compression-astc",EP="texture-compression-etc2",xP="texture-compression-pvrtc-webgl",SP="texture-compression-atc-webgl",TP="float32-renderable-webgl",CP="float16-renderable-webgl",AP="snorm8-renderable-webgl",PP="norm16-renderable-webgl",RP="snorm16-renderable-webgl",MP="float32-filterable",IP="float16-filterable-webgl",LP="WEBGL_compressed_texture_s3tc",kP="WEBGL_compressed_texture_s3tc_srgb",NP="EXT_texture_compression_rgtc",OP="EXT_texture_compression_bptc",DP="EXT_texture_norm16",FP="EXT_render_snorm",BP={"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":[FP],"norm16-renderable-webgl":[DP],"snorm16-renderable-webgl":[DP,FP],"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":[LP,kP,NP,OP],"texture-compression-bc5-webgl":[NP],"texture-compression-bc7-webgl":[OP],"texture-compression-etc2":["WEBGL_compressed_texture_etc"],"texture-compression-astc":["WEBGL_compressed_texture_astc"],"texture-compression-etc1-webgl":["WEBGL_compressed_texture_etc1"],"texture-compression-pvrtc-webgl":["WEBGL_compressed_texture_pvrtc"],"texture-compression-atc-webgl":["WEBGL_compressed_texture_atc"]};function UP(t,e,n){return(BP[e]||[]).every((e=>mP(t,e,n)))}const zP={"rgb8unorm-unsized":{gl:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,rb:!0},r8snorm:{gl:36756,b:1,c:1,render:AP},r8uint:{gl:33330,b:1,c:1,rb:!0},r8sint:{gl:33329,b:1,c:1,rb:!0},rg8unorm:{gl:33323,b:2,c:2,rb:!0},rg8snorm:{gl:36757,b:2,c:2,render:AP},rg8uint:{gl:33336,b:2,c:2,rb:!0},rg8sint:{gl:33335,b:2,c:2,rb:!0},r16uint:{gl:33332,b:2,c:1,rb:!0},r16sint:{gl:33331,b:2,c:1,rb:!0},r16float:{gl:33325,b:2,c:1,render:CP,filter:"float16-filterable-webgl",rb:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:PP,rb:!0},"r16snorm-webgl":{gl:36760,b:2,c:1,f:RP},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,rb:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,rb:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,rb:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,b:4,c:4,bpp:4},rgba8snorm:{gl:36759,b:4,c:4,render:AP},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:CP,filter:IP,rb:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,render:PP},"rg16snorm-webgl":{gl:36761,b:2,c:2,render:RP},r32uint:{gl:33334,b:4,c:1,bpp:4,rb:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,rb:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:TP,filter:MP},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:"rgb9e5ufloat_renderable-webgl"},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:TP,rb:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,rb:!0},"rgb10a2uint-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,rb:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:PP},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:PP},rg32uint:{gl:33340,b:8,c:2,rb:!0},rg32sint:{gl:33339,b:8,c:2,rb:!0},rg32float:{gl:33328,b:8,c:2,render:TP,filter:MP,rb:!0},rgba16uint:{gl:36214,b:8,c:4,rb:!0},rgba16sint:{gl:36232,b:8,c:4,rb:!0},rgba16float:{gl:34842,b:8,c:4,render:CP,filter:IP},"rgba16unorm-webgl":{gl:32859,b:2,c:4,render:PP,rb:!0},"rgba16snorm-webgl":{gl:36763,b:2,c:4,render:RP},"rgb32float-webgl":{gl:34837,render:TP,filter:MP,gl2ext:"EXT_color_buffer_float",dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,rb:!0},rgba32sint:{gl:36226,b:16,c:4,rb:!0},rgba32float:{gl:34836,b:16,c:4,render:TP,filter:MP,rb:!0},stencil8:{gl:36168,b:1,c:1,attachment:36128,rb:!0},depth16unorm:{gl:33189,b:2,c:1,attachment:36096,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096,dataFormat:6402,types:[5125]},depth32float:{gl:36012,b:4,c:1,attachment:36096,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,dataFormat:34041,types:[34042],rb:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:LP,f:bP},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:kP,f:bP},"bc1-rgba-unorm":{gl:33777,x:LP,f:bP},"bc1-rgba-unorm-srgb":{gl:35916,x:kP,f:bP},"bc2-rgba-unorm":{gl:33778,x:LP,f:bP},"bc2-rgba-unorm-srgb":{gl:35918,x:kP,f:bP},"bc3-rgba-unorm":{gl:33779,x:LP,f:bP},"bc3-rgba-unorm-srgb":{gl:35919,x:kP,f:bP},"bc4-r-unorm":{gl:36283,x:NP,f:bP},"bc4-r-snorm":{gl:36284,x:NP,f:bP},"bc5-rg-unorm":{gl:36285,x:NP,f:bP},"bc5-rg-snorm":{gl:36286,x:NP,f:bP},"bc6h-rgb-ufloat":{gl:36495,x:OP,f:bP},"bc6h-rgb-float":{gl:36494,x:OP,f:bP},"bc7-rgba-unorm":{gl:36492,x:OP,f:bP},"bc7-rgba-unorm-srgb":{gl:36493,x:OP,f:bP},"etc2-rgb8unorm":{gl:37492,f:EP},"etc2-rgb8unorm-srgb":{gl:37494,f:EP},"etc2-rgb8a1unorm":{gl:37496,f:EP},"etc2-rgb8a1unorm-srgb":{gl:37497,f:EP},"etc2-rgba8unorm":{gl:37493,f:EP},"etc2-rgba8unorm-srgb":{gl:37495,f:EP},"eac-r11unorm":{gl:37488,f:EP},"eac-r11snorm":{gl:37489,f:EP},"eac-rg11unorm":{gl:37490,f:EP},"eac-rg11snorm":{gl:37491,f:EP},"astc-4x4-unorm":{gl:37808,f:wP},"astc-4x4-unorm-srgb":{gl:37840,f:wP},"astc-5x4-unorm":{gl:37809,f:wP},"astc-5x4-unorm-srgb":{gl:37841,f:wP},"astc-5x5-unorm":{gl:37810,f:wP},"astc-5x5-unorm-srgb":{gl:37842,f:wP},"astc-6x5-unorm":{gl:37811,f:wP},"astc-6x5-unorm-srgb":{gl:37843,f:wP},"astc-6x6-unorm":{gl:37812,f:wP},"astc-6x6-unorm-srgb":{gl:37844,f:wP},"astc-8x5-unorm":{gl:37813,f:wP},"astc-8x5-unorm-srgb":{gl:37845,f:wP},"astc-8x6-unorm":{gl:37814,f:wP},"astc-8x6-unorm-srgb":{gl:37846,f:wP},"astc-8x8-unorm":{gl:37815,f:wP},"astc-8x8-unorm-srgb":{gl:37847,f:wP},"astc-10x5-unorm":{gl:37819,f:wP},"astc-10x5-unorm-srgb":{gl:37851,f:wP},"astc-10x6-unorm":{gl:37817,f:wP},"astc-10x6-unorm-srgb":{gl:37849,f:wP},"astc-10x8-unorm":{gl:37818,f:wP},"astc-10x8-unorm-srgb":{gl:37850,f:wP},"astc-10x10-unorm":{gl:37819,f:wP},"astc-10x10-unorm-srgb":{gl:37851,f:wP},"astc-12x10-unorm":{gl:37820,f:wP},"astc-12x10-unorm-srgb":{gl:37852,f:wP},"astc-12x12-unorm":{gl:37821,f:wP},"astc-12x12-unorm-srgb":{gl:37853,f:wP},"pvrtc-rgb4unorm-webgl":{gl:35840,f:xP},"pvrtc-rgba4unorm-webgl":{gl:35842,f:xP},"pvrtc-rbg2unorm-webgl":{gl:35841,f:xP},"pvrtc-rgba2unorm-webgl":{gl:35843,f:xP},"etc1-rbg-unorm-webgl":{gl:36196,f:"texture-compression-etc1-webgl"},"atc-rgb-unorm-webgl":{gl:35986,f:SP},"atc-rgba-unorm-webgl":{gl:35986,f:SP},"atc-rgbai-unorm-webgl":{gl:34798,f:SP}},jP={6403:1,36244:1,33319:2,33320:2,6407:3,36248:3,6408:4,36249:4,6402:1,34041:1,6406:1,6409:1,6410:2},VP={5126:4,5125:4,5124:4,5123:2,5122:2,5131:2,5120:1,5121:1};function WP(t,e,n){const i=zP[e];if(!i)return!1;if(void 0===i.gl)return!1;const r=i.x||i.gl2ext;return!r||Boolean(mP(t,r,n))}function $P(t){const e=zP[t],n=e?.gl;if(void 0===n)throw new Error(`Unsupported texture format ${t}`);return n}function GP(t){const e=zP[t],n=$P(t),i=MA(t);return{format:n,dataFormat:e?.dataFormat||qP(i.format,i.integer,i.normalized,n),type:i.dataType?vP(i.dataType):e?.types?.[0]||5121,compressed:i.compressed}}function HP(t){const e=GP(t);return(jP[e.dataFormat]||4)*(VP[e.type]||1)}function qP(t,e,n,i){if(6408===i||6407===i)return i;switch(t){case"r":return e&&!n?36244:6403;case"rg":return e&&!n?33320:33319;case"rgb":return e&&!n?36248:6407;case"rgba":return e&&!n?36249:6408;default:return 6408}}const ZP={"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"};class XP extends kA{gl;extensions;testedFeatures=(()=>new Set)();constructor(t,e,n){super([],n),this.gl=t,this.extensions=e,mP(t,"EXT_color_buffer_float",e)}*[Symbol.iterator](){const t=this.getFeatures();for(const e of t)this.has(e)&&(yield e);return[]}has(t){return!this.disabledFeatures[t]&&(this.testedFeatures.has(t)||(this.testedFeatures.add(t),function(t){return t in BP}(t)&&UP(this.gl,t,this.extensions)&&this.features.add(t),this.getWebGLFeature(t)&&this.features.add(t)),this.features.has(t))}initializeFeatures(){const t=this.getFeatures().filter((t=>"polygon-mode-webgl"!==t));for(const e of t)this.has(e)}getFeatures(){return[...Object.keys(ZP),...Object.keys(BP)]}getWebGLFeature(t){const e=ZP[t];return"string"===typeof e?Boolean(mP(this.gl,e,this.extensions)):Boolean(e)}}class KP extends LA{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 maxInterStageShaderComponents(){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 void 0===this.limits[t]&&(this.limits[t]=this.gl.getParameter(t)),this.limits[t]}}class YP extends xA{static defaultProps=(()=>({...xA.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}))();static COPY_SRC=1;static COPY_DST=2;static TEXTURE_BINDING=4;static STORAGE_BINDING=8;static RENDER_ATTACHMENT=16;get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(t,e){super(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:YP.defaultProps),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=t.incrementTimestamp()}}class JP extends xA{static defaultProps={...xA.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null};get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},JP.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(t){let e=!t;if(t){const[n,i]=Array.isArray(t)?t:[t.width,t.height];e=e||i!==this.height||n!==this.width,this.width=n,this.height=i}e&&(_A.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(0===this.props.colorAttachments.length&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map((t=>{if("string"===typeof t){const e=this.createColorTexture(t);return this.attachResource(e),e.view}return t instanceof YP?t.view:t}));const t=this.props.depthStencilAttachment;if(t)if("string"===typeof t){const e=this.createDepthStencilTexture(t);this.attachResource(e),this.depthStencilAttachment=e.view}else this.depthStencilAttachment=t instanceof YP?t.view:t}createColorTexture(t){return this.device.createTexture({id:"color-attachment",usage:YP.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}createDepthStencilTexture(t){return this.device.createTexture({id:"depth-stencil-attachment",usage:YP.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}resizeAttachments(t,e){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){const i=this.device._createTexture({...this.colorAttachments[n].props,width:t,height:e});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=i.view,this.attachResource(i.view)}if(this.depthStencilAttachment){const n=this.device._createTexture({...this.depthStencilAttachment.props,width:t,height:e});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}}}let QP="";async function tR(t,e){return await new Promise(((n,i)=>{try{const r=new Image;r.onload=()=>n(r),r.onerror=()=>i(new Error(`Could not load image ${t}.`)),r.crossOrigin=e?.crossOrigin||"anonymous",r.src=t.startsWith("http")?t:QP+t}catch($c){i($c)}}))}async function eR(t,e){const n=document.getElementsByTagName("head")[0];if(!n)throw new Error("loadScript");const i=document.createElement("script");return i.setAttribute("type","text/javascript"),i.setAttribute("src",t),e&&(i.id=e),new Promise(((e,r)=>{i.onload=e,i.onerror=e=>r(new Error(`Unable to load script '${t}': ${e}`)),n.appendChild(i)}))}function nR(t,e,n){if(function(t){for(const e in t)return!1;return!0}(e))return n(t);const{nocatch:i=!0}=e;let r;if(hP(t),sP(t,e),i)r=n(t),dP(t);else try{r=n(t)}finally{dP(t)}return r}function iR(t,e){const n=t,{gl:i}=n;if(e.cullMode)switch(e.cullMode){case"none":i.disable(2884);break;case"front":i.enable(2884),i.cullFace(1028);break;case"back":i.enable(2884),i.cullFace(1029)}if(e.frontFace&&i.frontFace(lR("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&t.features.has("depth-clip-control")&&i.enable(34383),void 0!==e.depthBias&&(i.enable(32823),i.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&t.features.has("provoking-vertex-webgl")){const t=n.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,i=lR("provokingVertex",e.provokingVertex,{first:36429,last:36430});t?.provokingVertexWEBGL(i)}if((e.polygonMode||e.polygonOffsetLine)&&t.features.has("polygon-mode-webgl")){if(e.polygonMode){const t=n.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,i=lR("polygonMode",e.polygonMode,{fill:6914,line:6913});t?.polygonModeWEBGL(1028,i),t?.polygonModeWEBGL(1029,i)}e.polygonOffsetLine&&i.enable(10754)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&i.enable(12288),e.clipDistance1&&i.enable(12289),e.clipDistance2&&i.enable(12290),e.clipDistance3&&i.enable(12291),e.clipDistance4&&i.enable(12292),e.clipDistance5&&i.enable(12293),e.clipDistance6&&i.enable(12294),e.clipDistance7&&i.enable(12295)),void 0!==e.depthWriteEnabled&&i.depthMask(function(t,e){return e}(0,e.depthWriteEnabled)),e.depthCompare&&("always"!==e.depthCompare?i.enable(2929):i.disable(2929),i.depthFunc(rR("depthCompare",e.depthCompare))),e.stencilWriteMask){const t=e.stencilWriteMask;i.stencilMaskSeparate(1028,t),i.stencilMaskSeparate(1029,t)}if(e.stencilReadMask&&_A.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){const t=e.stencilReadMask||4294967295,n=rR("depthCompare",e.stencilCompare);"always"!==e.stencilCompare?i.enable(2960):i.disable(2960),i.stencilFuncSeparate(1028,n,0,t),i.stencilFuncSeparate(1029,n,0,t)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){const t=sR("stencilPassOperation",e.stencilPassOperation),n=sR("stencilFailOperation",e.stencilFailOperation),r=sR("stencilDepthFailOperation",e.stencilDepthFailOperation);i.stencilOpSeparate(1028,n,r,t),i.stencilOpSeparate(1029,n,r,t)}if(e.blendColorOperation||e.blendAlphaOperation){i.enable(3042);const t=oR("blendColorOperation",e.blendColorOperation||"add"),n=oR("blendAlphaOperation",e.blendAlphaOperation||"add");i.blendEquationSeparate(t,n);const r=aR("blendColorSrcFactor",e.blendColorSrcFactor||"one"),s=aR("blendColorDstFactor",e.blendColorDstFactor||"zero"),o=aR("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),a=aR("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");i.blendFuncSeparate(r,s,o,a)}}function rR(t,e){return lR(t,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function sR(t,e){return lR(t,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function oR(t,e){return lR(t,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function aR(t,e){return lR(t,e,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,"constant-color":32769,"one-minus-constant-color":32770,"constant-alpha":32771,"one-minus-constant-alpha":32772})}function lR(t,e,n){if(!(e in n))throw new Error(function(t,e){return`Illegal parameter ${e} for ${t}`}(t,e));return n[e]}function cR(t){const e={};return t.addressModeU&&(e[10242]=uR(t.addressModeU)),t.addressModeV&&(e[10243]=uR(t.addressModeV)),t.addressModeW&&(e[32882]=uR(t.addressModeW)),t.magFilter&&(e[10240]=hR(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[10241]=function(t,e){if(!e)return hR(t);switch(t){case"nearest":return"nearest"===e?9984:9986;case"linear":return"nearest"===e?9985:9987}}(t.minFilter||"linear",t.mipmapFilter)),void 0!==t.lodMinClamp&&(e[33082]=t.lodMinClamp),void 0!==t.lodMaxClamp&&(e[33083]=t.lodMaxClamp),"comparison-sampler"===t.type&&(e[34892]=34894),t.compare&&(e[34893]=rR("compare",t.compare)),t.maxAnisotropy&&(e[34046]=t.maxAnisotropy),e}function uR(t){switch(t){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function hR(t){switch(t){case"nearest":return 9728;case"linear":return 9729}}class dR extends SA{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength;bytesUsed;constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(t,e),this.device=t,this.gl=this.device.gl;const n="object"===typeof e?e.handle:void 0;this.handle=n||this.gl.createBuffer(),t.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=function(t){if(t&SA.INDEX)return 34963;if(t&SA.VERTEX)return 34962;if(t&SA.UNIFORM)return 35345;return 34962}(this.props.usage),this.glUsage=function(t){if(t&SA.INDEX)return 35044;if(t&SA.VERTEX)return 35044;if(t&SA.UNIFORM)return 35048;return 35044}(this.props.usage),this.glIndexType="uint32"===this.props.indexType?5125:5123,e.data?this._initWithData(e.data,e.byteOffset,e.byteLength):this._initWithByteLength(e.byteLength||0)}_initWithData(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.byteLength+e;const i=this.glTarget;this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,n,this.glUsage),this.gl.bufferSubData(i,e,t),this.gl.bindBuffer(i,null),this.bytesUsed=n,this.byteLength=n,this._setDebugData(t,e,n),this.trackAllocatedMemory(n)}_initWithByteLength(t){OA(t>=0);let e=t;0===t&&(e=new Float32Array(0));const n=this.glTarget;return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,e,this.glUsage),this.gl.bindBuffer(n,null),this.bytesUsed=t,this.byteLength=t,this._setDebugData(null,0,t),this.trackAllocatedMemory(t),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=36663;this.gl.bindBuffer(n,this.handle),this.gl.bufferSubData(n,e,t),this.gl.bindBuffer(n,null),this._setDebugData(t,e,t.byteLength)}async readAsync(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return this.readSyncWebGL(t,e)}readSyncWebGL(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;e=e??this.byteLength-t;const n=new Uint8Array(e);return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,t,n,0,e),this.gl.bindBuffer(36662,null),this._setDebugData(n,t,e),n}}class pR extends xA{static defaultProps={...xA.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1};get[Symbol.toStringTag](){return"Sampler"}constructor(t,e){super(t,e,pR.defaultProps)}}class fR extends pR{device;handle;parameters;constructor(t,e){super(t,e),this.device=t,this.parameters=cR(e),this.handle=this.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(const[e,n]of Object.entries(t)){const t=Number(e);switch(t){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,t,n);break;default:this.device.gl.samplerParameteri(this.handle,t,n)}}}}class gR extends xA{static defaultProps=(()=>({...xA.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0}))();get[Symbol.toStringTag](){return"TextureView"}constructor(t,e){super(t,e,gR.defaultProps)}}class mR extends gR{device;gl;handle;texture;constructor(t,e){super(t,{...YP.defaultProps,...e}),this.device=t,this.gl=this.device.gl,this.handle=null,this.texture=e.texture}}const _R={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0};class yR extends YP{static FACES=[34069,34070,34071,34072,34073,34074];MAX_ATTRIBUTES;device;gl;handle;sampler=void 0;view=void 0;glFormat=void 0;type=void 0;dataFormat=void 0;mipmaps=void 0;target;textureUnit=void 0;loaded=!1;_video;constructor(t,e){super(t,{..._R,format:"rgba8unorm",...e}),this.device=t,this.gl=this.device.gl,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=6408,this.target=function(t){switch(t.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;default:throw new Error(t.dimension)}}(this.props),this.loaded=!1,"string"===typeof this.props?.data&&Object.assign(this.props,{data:tR(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}createView(t){return new mR(this.device,{...t,texture:this})}initialize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("cube"===this.props.dimension)return this.initializeCube(t);let e=t.data;if(e instanceof Promise)return e.then((e=>this.initialize(Object.assign({},t,{pixels:e,data:e})))),this;const n="undefined"!==typeof HTMLVideoElement&&e instanceof HTMLVideoElement;if(n&&e.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,e.addEventListener("loadeddata",(()=>this.initialize(t))),this;const{parameters:i={}}=t,{pixels:r=null,pixelStore:s={},textureUnit:o,mipmaps:a=!0}=t;e||(e=r);let{width:l,height:c,dataFormat:u,type:h,compressed:d=!1}=t;const{depth:p=0}=t,f=$P(t.format);return({width:l,height:c,compressed:d,dataFormat:u,type:h}=this._deduceParameters({format:t.format,type:h,dataFormat:u,compressed:d,data:e,width:l,height:c})),this.width=l,this.height=c,this.glFormat=f,this.type=h,this.dataFormat=u,this.textureUnit=o,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),this.mipmaps=a,this.setImageData({data:e,width:l,height:c,depth:p,format:f,type:h,dataFormat:u,parameters:s,compressed:d}),this.setSampler(t.sampler),this._setSamplerParameters(i),this.view=this.createView({...this.props,mipLevelCount:1,arrayLayerCount:1}),a&&this.device.isTextureFormatFilterable(t.format)&&this.generateMipmap(),n&&(this._video={video:e,parameters:i,lastTime:e.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?e.currentTime:-1}),this}initializeCube(t){const{mipmaps:e=!0,parameters:n={}}=t;return this.setCubeMapImageData(t).then((()=>{this.loaded=!0,e&&this.generateMipmap(t),this.setSampler(t.sampler),this._setSamplerParameters(n)})),this}setSampler(){let t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e instanceof fR?(this.sampler=e,t=e.props):(this.sampler=new fR(this.device,e),t=e);const n=cR(t);return this._setSamplerParameters(n),this}resize(t){const{height:e,width:n,mipmaps:i=!1}=t;return n!==this.width||e!==this.height?this.initialize({width:n,height:e,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:i}):this}update(){if(this._video){const{video:t,parameters:e,lastTime:n}=this._video;if(n===t.currentTime||t.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:t,parameters:e}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=t.currentTime}}generateMipmap(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),nR(this.gl,t,(()=>{this.gl.generateMipmap(this.target)})),this.gl.bindTexture(this.target,null),this}setImageData(t){if("3d"===this.props.dimension||"2d-array"===this.props.dimension)return this.setImageData3D(t);this.trackDeallocatedMemory("Texture");const{target:e=this.target,pixels:n=null,level:i=0,glFormat:r=this.glFormat,offset:s=0,parameters:o={}}=t;let{data:a=null,type:l=this.type,width:c=this.width,height:u=this.height,dataFormat:h=this.dataFormat,compressed:d=!1}=t;a||(a=n),({type:l,dataFormat:h,compressed:d,width:c,height:u}=this._deduceParameters({format:this.props.format,type:l,dataFormat:h,compressed:d,data:a,width:c,height:u}));const{gl:p}=this;p.bindTexture(this.target,this.handle);let f=null;if(({data:a,dataType:f}=this._getDataType({data:a,compressed:d})),nR(this.gl,o,(()=>{switch(f){case"null":case"browser-object":p.texImage2D(e,i,r,c,u,0,h,l,a);break;case"typed-array":p.texImage2D(e,i,r,c,u,0,h,l,a,s);break;case"buffer":this.device.gl.bindBuffer(35052,a.handle||a),this.device.gl.texImage2D(e,i,r,c,u,0,h,l,s),this.device.gl.bindBuffer(35052,null);break;case"compressed":for(const[t,n]of a.entries())p.compressedTexImage2D(e,t,n.format,n.width,n.height,0,n.data);break;default:OA(!1,"Unknown image data type")}})),a&&a.byteLength)this.trackAllocatedMemory(a.byteLength,"Texture");else{const t=HP(this.props.format);this.trackAllocatedMemory(this.width*this.height*t,"Texture")}return this.loaded=!0,this}setSubImageData(t){let{target:e=this.target,pixels:n=null,data:i=null,x:r=0,y:s=0,width:o=this.width,height:a=this.height,level:l=0,glFormat:c=this.glFormat,type:u=this.type,dataFormat:h=this.dataFormat,compressed:d=!1,offset:p=0,parameters:f={}}=t;if(({type:u,dataFormat:h,compressed:d,width:o,height:a}=this._deduceParameters({format:this.props.format,type:u,dataFormat:h,compressed:d,data:i,width:o,height:a})),OA(1===this.depth,"texSubImage not supported for 3D textures"),i||(i=n),i&&i.data){const t=i;i=t.data,o=t.shape[0],a=t.shape[1]}i instanceof dR&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),nR(this.gl,f,(()=>{d?this.gl.compressedTexSubImage2D(e,l,r,s,o,a,c,i):null===i?this.gl.texSubImage2D(e,l,r,s,o,a,h,u,null):ArrayBuffer.isView(i)?this.gl.texSubImage2D(e,l,r,s,o,a,h,u,i,p):"undefined"!==typeof WebGLBuffer&&i instanceof WebGLBuffer?(this.device.gl.bindBuffer(35052,i),this.device.gl.texSubImage2D(e,l,r,s,o,a,h,u,p),this.device.gl.bindBuffer(35052,null)):this.device.gl.texSubImage2D(e,l,r,s,o,a,h,u,i)})),this.gl.bindTexture(this.target,null)}copyFramebuffer(){return _A.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.textureUnit;const{gl:e}=this;return void 0!==t&&(this.textureUnit=t,e.activeTexture(33984+t)),e.bindTexture(this.target,this.handle),t}unbind(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.textureUnit;const{gl:e}=this;return void 0!==t&&(this.textureUnit=t,e.activeTexture(33984+t)),e.bindTexture(this.target,null),t}_getDataType(t){let{data:e,compressed:n=!1}=t;return n?{data:e,dataType:"compressed"}:null===e?{data:e,dataType:"null"}:ArrayBuffer.isView(e)?{data:e,dataType:"typed-array"}:e instanceof dR?{data:e.handle,dataType:"buffer"}:"undefined"!==typeof WebGLBuffer&&e instanceof WebGLBuffer?{data:e,dataType:"buffer"}:{data:e,dataType:"browser-object"}}_deduceParameters(t){const{format:e,data:n}=t;let{width:i,height:r,dataFormat:s,type:o,compressed:a}=t;const l=GP(e);return s=s||l.dataFormat,o=o||l.type,a=a||l.compressed,({width:i,height:r}=this._deduceImageSize(n,i,r)),{dataFormat:s,type:o,compressed:a,width:i,height:r,format:e,data:n}}_deduceImageSize(t,e,n){let i;return i="undefined"!==typeof ImageData&&t instanceof ImageData?{width:t.width,height:t.height}:"undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement?{width:t.naturalWidth,height:t.naturalHeight}:"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap?{width:t.width,height:t.height}:"undefined"!==typeof HTMLVideoElement&&t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t?{width:e,height:n}:{width:e>=0?e:1,height:n>=0?n:1},OA(i,"Could not deduced texture size"),OA(void 0===e||i.width===e,"Deduced texture width does not match supplied width"),OA(void 0===n||i.height===n,"Deduced texture height does not match supplied height"),i}async setCubeMapImageData(t){const{gl:e}=this,{width:n,height:i,pixels:r,data:s,format:o=6408,type:a=5121}=t,l=r||s,c=await Promise.all(yR.FACES.map((t=>{const e=l[t];return Promise.all(Array.isArray(e)?e:[e])})));this.bind(),yR.FACES.forEach(((t,r)=>{c[r].length>1&&!1!==this.props.mipmaps&&_A.warn(`${this.id} has mipmap and multiple LODs.`)(),c[r].forEach(((r,s)=>{n&&i?e.texImage2D(t,s,o,n,i,0,o,a,r):e.texImage2D(t,s,o,o,a,r)}))})),this.unbind()}setImageDataForFace(t){const{face:e,width:n,height:i,pixels:r,data:s,format:o=6408,type:a=5121}=t,{gl:l}=this,c=r||s;return this.bind(),c instanceof Promise?c.then((n=>this.setImageDataForFace(Object.assign({},t,{face:e,data:n,pixels:n})))):this.width||this.height?l.texImage2D(e,0,o,n,i,0,o,a,c):l.texImage2D(e,0,o,o,a,c),this}setImageData3D(t){const{level:e=0,dataFormat:n,format:i,type:r,width:s,height:o,depth:a=1,offset:l=0,data:c,parameters:u={}}=t;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);const h=GP(i);if(nR(this.gl,u,(()=>{ArrayBuffer.isView(c)&&this.gl.texImage3D(this.target,e,h.format,s,o,a,0,h.dataFormat,h.type,c),c instanceof dR&&(this.gl.bindBuffer(35052,c.handle),this.gl.texImage3D(this.target,e,n,s,o,a,0,i,r,l))})),c&&c.byteLength)this.trackAllocatedMemory(c.byteLength,"Texture");else{const t=HP(this.props.format);this.trackAllocatedMemory(this.width*this.height*this.depth*t,"Texture")}return this.loaded=!0,this}_setSamplerParameters(t){if(!EA(t)){!function(t){_A.log(1,"texture sampler parameters",t)()}(t),this.gl.bindTexture(this.target,this.handle);for(const[e,n]of Object.entries(t)){const t=Number(e),i=n;switch(t){case 33082:case 33083:this.gl.texParameterf(this.target,t,i);break;default:this.gl.texParameteri(this.target,t,i)}}this.gl.bindTexture(this.target,null)}}}class vR extends JP{device;gl;handle;get texture(){return this.colorAttachments[0]}constructor(t,e){super(t,e);const n=null===e.handle;if(this.device=t,this.gl=t.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),!n){t.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures();const n=this.gl.bindFramebuffer(36160,this.handle);for(let t=0;t<this.colorAttachments.length;++t){const e=this.colorAttachments[t],n=36064+t;e&&this._attachOne(n,e)}if(this.depthStencilAttachment&&this._attachOne(function(t){const e=zP[t];if(!e?.attachment)throw new Error(`${t} is not a depth stencil format`);return e.attachment}(this.depthStencilAttachment.props.format),this.depthStencilAttachment),!1!==e.check){const t=this.gl.checkFramebufferStatus(36160);if(36053!==t)throw new Error(`Framebuffer ${function(t){switch(t){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`${t}`}}(t)}`)}this.gl.bindFramebuffer(36160,n)}}destroy(){super.destroy(),this.destroyed||null===this.handle||this.gl.deleteFramebuffer(this.handle)}createDepthStencilTexture(t){return new yR(this.device,{id:`${this.id}-depth-stencil`,format:t,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(t,e){if(null===this.handle)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;void 0===t&&(t=this.gl.drawingBufferWidth),void 0===e&&(e=this.gl.drawingBufferHeight);for(const n of this.colorAttachments)n.texture.resize({width:t,height:e});return this.depthStencilAttachment&&this.depthStencilAttachment.texture.resize({width:t,height:e}),this}_attachOne(t,e){if(Array.isArray(e)){const[n,i=0,r=0]=e;return this._attachTexture(t,n,i,r),n}if(e instanceof yR)return this._attachTexture(t,e,0,0),e;if(e instanceof mR){const n=e;return this._attachTexture(t,n.texture,n.props.baseMipLevel,n.props.baseArrayLayer),e.texture}throw new Error("attach")}_attachTexture(t,e,n,i){const{gl:r}=this.device;switch(r.bindTexture(e.target,e.handle),e.target){case 35866:case 32879:r.framebufferTextureLayer(36160,t,e.target,i,n);break;case 34067:const s=function(t){return t<34069?t+34069:t}(n);r.framebufferTexture2D(36160,t,s,e.handle,i);break;case 3553:r.framebufferTexture2D(36160,t,3553,e.handle,i);break;default:OA(!1,"Illegal texture type")}r.bindTexture(e.target,null)}}class bR extends VA{device;presentationSize;_framebuffer=null;constructor(t,e){super(e),this.device=t,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new vR(this.device,{handle:null}),this._framebuffer}update(){const t=this.getPixelSize();(t[0]!==this.presentationSize[0]||t[1]!==this.presentationSize[1])&&(this.presentationSize=t,this.resize())}resize(t){if(this.device.gl)if(this.canvas){const e=this.getDevicePixelRatio(t?.useDevicePixels);this.setDevicePixelRatio(e,t)}else;}commit(){}}const wR={spector:_A.get("spector")||_A.get("spectorjs")};let ER=null,xR=!1;var SR
vendor: 32,711 bytes, line 2
2;!function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",t[t.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.CULL_FACE=2884]="CULL_FACE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.BLEND=3042]="BLEND",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.DITHER=3024]="DITHER",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DOUBLE=5130]="DOUBLE",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",t[t.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.READ_BUFFER=3074]="READ_BUFFER",t[t.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",t[t.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",t[t.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",t[t.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",t[t.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",t[t.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",t[t.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",t[t.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",t[t.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",t[t.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",t[t.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",t[t.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",t[t.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",t[t.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",t[t.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",t[t.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",t[t.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",t[t.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",t[t.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",t[t.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",t[t.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",t[t.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",t[t.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",t[t.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",t[t.RED=6403]="RED",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB10_A2=32857]="RGB10_A2",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",t[t.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",t[t.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",t[t.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",t[t.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",t[t.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",t[t.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",t[t.SRGB=35904]="SRGB",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",t[t.RGBA32F=34836]="RGBA32F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.RGB16F=34843]="RGB16F",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R16F=33325]="R16F",t[t.R32F=33326]="R32F",t[t.RG16F=33327]="RG16F",t[t.RG32F=33328]="RG32F",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2UI=36975]="RGB10_A2UI",t[t.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",t[t.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.RG=33319]="RG",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",t[t.CURRENT_QUERY=34917]="CURRENT_QUERY",t[t.QUERY_RESULT=34918]="QUERY_RESULT",t[t.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",t[t.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",t[t.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",t[t.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",t[t.DRAW_BUFFER0=34853]="DRAW_BUFFER0",t[t.DRAW_BUFFER1=34854]="DRAW_BUFFER1",t[t.DRAW_BUFFER2=34855]="DRAW_BUFFER2",t[t.DRAW_BUFFER3=34856]="DRAW_BUFFER3",t[t.DRAW_BUFFER4=34857]="DRAW_BUFFER4",t[t.DRAW_BUFFER5=34858]="DRAW_BUFFER5",t[t.DRAW_BUFFER6=34859]="DRAW_BUFFER6",t[t.DRAW_BUFFER7=34860]="DRAW_BUFFER7",t[t.DRAW_BUFFER8=34861]="DRAW_BUFFER8",t[t.DRAW_BUFFER9=34862]="DRAW_BUFFER9",t[t.DRAW_BUFFER10=34863]="DRAW_BUFFER10",t[t.DRAW_BUFFER11=34864]="DRAW_BUFFER11",t[t.DRAW_BUFFER12=34865]="DRAW_BUFFER12",t[t.DRAW_BUFFER13=34866]="DRAW_BUFFER13",t[t.DRAW_BUFFER14=34867]="DRAW_BUFFER14",t[t.DRAW_BUFFER15=34868]="DRAW_BUFFER15",t[t.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",t[t.MAX_SAMPLES=36183]="MAX_SAMPLES",t[t.SAMPLER_BINDING=35097]="SAMPLER_BINDING",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",t[t.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",t[t.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",t[t.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",t[t.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",t[t.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",t[t.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",t[t.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",t[t.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",t[t.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",t[t.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",t[t.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",t[t.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",t[t.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",t[t.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",t[t.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",t[t.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",t[t.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",t[t.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",t[t.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",t[t.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",t[t.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",t[t.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",t[t.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",t[t.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",t[t.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",t[t.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",t[t.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",t[t.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",t[t.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",t[t.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",t[t.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",t[t.UNIFORM_TYPE=35383]="UNIFORM_TYPE",t[t.UNIFORM_SIZE=35384]="UNIFORM_SIZE",t[t.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",t[t.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",t[t.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",t[t.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",t[t.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",t[t.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",t[t.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",t[t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",t[t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS",t[t.SYNC_FENCE=37142]="SYNC_FENCE",t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED",t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED",t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",t[t.COLOR=6144]="COLOR",t[t.DEPTH=6145]="DEPTH",t[t.STENCIL=6146]="STENCIL",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STREAM_COPY=35042]="STREAM_COPY",t[t.STATIC_READ=35045]="STATIC_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",t[t.INVALID_INDEX=4294967295]="INVALID_INDEX",t[t.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",t[t.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",t[t.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",t[t.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",t[t.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",t[t.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",t[t.R16_EXT=33322]="R16_EXT",t[t.RG16_EXT=33324]="RG16_EXT",t[t.RGB16_EXT=32852]="RGB16_EXT",t[t.RGBA16_EXT=32859]="RGBA16_EXT",t[t.R16_SNORM_EXT=36760]="R16_SNORM_EXT",t[t.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",t[t.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",t[t.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",t[t.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",t[t.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",t[t.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",t[t.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",t[t.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",t[t.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",t[t.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",t[t.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",t[t.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",t[t.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",t[t.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",t[t.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",t[t.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",t[t.LINE_WEBGL=6913]="LINE_WEBGL",t[t.FILL_WEBGL=6914]="FILL_WEBGL",t[t.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",t[t.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",t[t.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",t[t.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",t[t.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",t[t.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",t[t.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",t[t.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",t[t.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",t[t.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",t[t.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",t[t.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",t[t.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",t[t.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",t[t.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",t[t.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",t[t.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",t[t.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",t[t.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",t[t.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",t[t.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",t[t.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",t[t.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",t[t.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"}(
2SR||(SR={}));function TR(t){return t.luma=t.luma||{},t.luma}function CR(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t?e.debug?function(t,e){if(!globalThis.WebGLDebugUtils)return _A.warn("webgl-debug not loaded")(),t;const n=TR(t);if(n.debugContext)return n.debugContext;globalThis.WebGLDebugUtils.init({...SR,...t});const i=globalThis.WebGLDebugUtils.makeDebugContext(t,PR.bind(null,e),RR.bind(null,e));for(const o in SR)o in i||"number"!==typeof SR[o]||(i[o]=SR[o]);class r{}Object.setPrototypeOf(i,Object.getPrototypeOf(t)),Object.setPrototypeOf(r,i);const s=Object.create(r);return n.realContext=t,n.debugContext=s,s.debug=!0,s}(t,e):function(t){const e=TR(t);return e.realContext?e.realContext:t}(t):null}function AR(t,e){e=Array.from(e).map((t=>void 0===t?"undefined":t));let n=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,e);return n=`${n.slice(0,100)}${n.length>100?"...":""}`,`gl.${t}(${n})`}function PR(t,e,n,i){i=Array.from(i).map((t=>void 0===t?"undefined":t));const r=`${globalThis.WebGLDebugUtils.glEnumToString(e)} in gl.${n}(${globalThis.WebGLDebugUtils.glFunctionArgsToString(n,i)})`;if(_A.error(r)(),t.throwOnError)throw new Error(r)}function RR(t,e,n){let i="";if(_A.level>=1&&(i=AR(e,n),_A.log(1,i)()),t.break&&t.break.length>0){i=i||AR(e,n);t.break.every((t=>-1!==i.indexOf(t)))}for(const r of n)if(void 0===r){if(i=i||AR(e,n),t.throwOnError)throw new Error(`Undefined argument: ${i}`);_A.error(`Undefined argument: ${i}`)()}}function MR(t,e,n,i){if(i?.inlineSource){const i=function(t,e,n){let i="";for(let r=e-2;r<=e;r++){const s=t[r-1];void 0!==s&&(i+=IR(s,e,n))}return i}(e,n);return`\n${i}${t.linePos>0?`${" ".repeat(t.linePos+5)}^^^\n`:""}${t.type.toUpperCase()}: ${t.message}\n\n`}return i?.html?`<div class='luma-compiler-log-error' style="color:red;"><b> ${t.type.toUpperCase()}: ${t.message}</b></div>`:`${t.type.toUpperCase()}: ${t.message}`}function IR(t,e,n){const i=n?.html?t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"):t;return`${function(t,e){let n="";for(let i=t.length;i<e;++i)n+=" ";return n+t}(String(e),4)}: ${i}${n?.html?"<br/>":"\n"}`}function LR(t,e){return{name:kR(t,e),language:"glsl",version:NR(t)}}function kR(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unnamed";const n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(t);return n?n[1]:e}function NR(t){let e=100;const n=t.match(/[^\s]+/g);if(n&&n.length>=2&&"#version"===n[0]){const t=parseInt(n[1],10);Number.isFinite(t)&&(e=t)}return e}class OR extends xA{static defaultProps=(()=>({...xA.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"}))();get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(t,e){super(t,{id:DR(e),...e},OR.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){switch(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.debug){case"never":return;case"errors":if("success"===this.compilationStatus)return}const t=await this.getCompilationInfo();"warnings"===this.props.debug&&0===t?.length||this._displayShaderLog(t)}
vendor: 36,512 bytes, line 2
2_displayShaderLog(t){if("undefined"===typeof document||!document?.createElement)return;const e=LR(this.source).name,n=`${this.stage} ${e}`;let i=function(t,e,n){let i="";const r=e.split(/\r?\n/),s=t.slice().sort(((t,e)=>t.lineNum-e.lineNum));switch(n?.showSourceCode||"no"){case"all":let e=0;for(let t=1;t<=r.length;t++)for(i+=IR(r[t-1],t,n);s.length>e&&s[e].lineNum===t;){const t=s[e++];i+=MR(t,r,t.lineNum,{...n,inlineSource:!1})}return i;case"issues":case"no":for(const s of t)i+=MR(s,r,s.lineNum,{inlineSource:"no"!==n?.showSourceCode});return i}}(t,this.source,{showSourceCode:"all",html:!0});const r=this.getTranslatedSource();r&&(i+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${r}</pre></code>`);const s=document.createElement("Button");s.innerHTML=`\n<h1>Shader Compilation Error in ${n}</h1><br /><br />\n<code style="user-select:text;"><pre>\n${i}\n</pre></code>`,s.style.top="10px",s.style.left="10px",s.style.position="absolute",s.style.zIndex="9999",s.style.width="100%",s.style.textAlign="left",document.body.appendChild(s);const o=document.getElementsByClassName("luma-compiler-log-error");o[0]?.scrollIntoView&&o[0].scrollIntoView(),s.onclick=()=>{const t=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(t)}}}function DR(t){return LR(t.source).name||t.id||wA(`unnamed ${t.stage}-shader`)}function FR(t){const e=t.toLowerCase();return["warning","error","info"].includes(e)?e:"info"}class BR extends OR{device;handle;constructor(t,e){switch(super(t,e),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)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){return function(t){const e=t.split(/\r?\n/),n=[];for(const i of e){if(i.length<=1)continue;const t=i.split(":");if(2===t.length){const[e,i]=t;n.push({message:i.trim(),type:FR(e),lineNum:0,linePos:0});continue}const[e,r,s,...o]=t;let a=parseInt(s,10);isNaN(a)&&(a=0);let l=parseInt(r,10);isNaN(l)&&(l=0),n.push({message:o.join(":").trim(),type:FR(e),lineNum:a,linePos:l})}return n}(this.device.gl.getShaderInfoLog(this.handle))}getTranslatedSource(){const t=this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders;return t?.getTranslatedShaderSource(this.handle)}async _compile(t){t=(t=>t.startsWith("#version ")?t:`#version 100\n${t}`)(t);const{gl:e}=this.device;if(e.shaderSource(this.handle,t),e.compileShader(this.handle),0!==_A.level){if(this.device.features.has("compilation-status-async-webgl"))_A.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),_A.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader();else if(this._getCompilationStatus(),this.debugShader(),"error"===this.compilationStatus)throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`)}else this.compilationStatus="pending"}async _waitForCompilationComplete(){const t=async t=>await new Promise((e=>setTimeout(e,t)));if(!this.device.features.has("compilation-status-async-webgl"))return void await t(10);const{gl:e}=this.device;for(;;){if(e.getShaderParameter(this.handle,37297))return;await t(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}}class UR extends xA{static defaultProps=(()=>({...xA.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0}))();get[Symbol.toStringTag](){return"RenderPass"}constructor(t,e){super(t,e,UR.defaultProps)}}const zR=6144,jR=[1,2,4,8];class VR extends UR{device;glParameters;constructor(t,e){super(t,e),this.device=t,hP(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){dP(this.device.gl)}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}setParameters(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={...this.glParameters};this.props.framebuffer&&(e.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(e.depthMask=!this.props.depthReadOnly),e.stencilMask=this.props.stencilReadOnly?0:1,e[35977]=this.props.discard,t.viewport&&(t.viewport.length>=6?(e.viewport=t.viewport.slice(0,4),e.depthRange=[t.viewport[4],t.viewport[5]]):e.viewport=t.viewport),t.scissorRect&&(e.scissorTest=!0,e.scissor=t.scissorRect),t.blendConstant&&(e.blendColor=t.blendConstant),t.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),t[2967]=t.stencilReference),t.colorMask&&(e.colorMask=jR.map((e=>Boolean(e&t.colorMask)))),this.glParameters=e,sP(this.device.gl,e)}beginOcclusionQuery(t){const e=this.props.occlusionQuerySet;e?.beginOcclusionQuery()}endOcclusionQuery(){const t=this.props.occlusionQuerySet;t?.endOcclusionQuery()}clear(){const t={...this.glParameters};let e=0;!1!==this.props.clearColor&&(e|=16384,t.clearColor=this.props.clearColor),!1!==this.props.clearDepth&&(e|=256,t.clearDepth=this.props.clearDepth),!1!==this.props.clearStencil&&(e|=1024,t.clearStencil=this.props.clearStencil),0!==e&&nR(this.device.gl,t,(()=>{this.device.gl.clear(e)}))}clearColorBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,0];nR(this.device.gl,{framebuffer:this.props.framebuffer},(()=>{switch(e.constructor){case Int32Array:this.device.gl.clearBufferiv(zR,t,e);break;case Uint32Array:this.device.gl.clearBufferuiv(zR,t,e);break;case Float32Array:default:this.device.gl.clearBufferfv(zR,t,e)}}))}}class WR extends xA{static defaultProps={...xA.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}};get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(t,e){super(t,e,WR.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(t){throw new Error("Use uniform blocks")}}function $R(t){return Array.isArray(t)?0===t.length||"number"===typeof t[0]?t:null:function(t){return!ArrayBuffer.isView(t)||t instanceof DataView?null:t}(t)}function GR(t){const e={bindings:{},uniforms:{}};return Object.keys(t).forEach((n=>{const i=t[n];!function(t){return null!==$R(t)||"number"===typeof t||"boolean"===typeof t}(i)?e.bindings[n]=i:e.uniforms[n]=i})),e}const HR={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]},qR={f32:4,f16:2,i32:4,u32:4};function ZR(t){let e;t.endsWith("-webgl")&&(t.replace("-webgl",""),e=!0);const[n,i]=t.split("x"),r=n,s=i?parseInt(i):1,o=TA(r),a={type:r,components:s,byteLength:o.byteLength*s,integer:o.integer,signed:o.signed,normalized:o.normalized};return e&&(a.webglOnly=!0),a}function XR(t,e){const n={};for(const i of t.attributes)n[i.name]=KR(t,e,i.name);return n}function KR(t,e,n){const i=function(t,e){const n=t.attributes.find((t=>t.name===e));n||_A.warn(`shader layout attribute "${e}" not present in shader`);return n||null}(t,n),r=function(t,e){YR(t);let n=function(t,e){for(const n of t)if(n.format&&n.name===e)return{attributeName:n.name,bufferName:e,stepMode:n.stepMode,vertexFormat:n.format,byteOffset:0,byteStride:n.byteStride||0};return null}(t,e);if(n)return n;if(n=function(t,e){for(const n of t){let t=n.byteStride;if("number"!==typeof n.byteStride)for(const e of n.attributes||[]){t+=ZR(e.format).byteLength}const i=n.attributes?.find((t=>t.attribute===e));if(i)return{attributeName:i.attribute,bufferName:n.name,stepMode:n.stepMode,vertexFormat:i.format,byteOffset:i.byteOffset,byteStride:t}}return null}(t,e),n)return n;return _A.warn(`layout for attribute "${e}" not present in buffer layout`),null}(e,n);if(!i)return null;const s=function(t){const[e,n]=HR[t],i="i32"===e||"u32"===e,r="u32"!==e,s=qR[e]*n,o=function(t,e){let n;switch(t){case"f32":n="float32";break;case"i32":n="sint32";break;case"u32":n="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return 1===e?n:`${n}x${e}`}(e,n);return{dataType:e,components:n,defaultVertexFormat:o,byteLength:s,integer:i,signed:r}}(i.type),o=r?.vertexFormat||s.defaultVertexFormat,a=ZR(o);return{attributeName:r?.attributeName||i.name,bufferName:r?.bufferName||i.name,location:i.location,shaderType:i.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:o,bufferDataType:a.type,bufferComponents:a.components,normalized:a.normalized,integer:s.integer,stepMode:r?.stepMode||i.stepMode,byteOffset:r?.byteOffset||0,byteStride:r?.byteStride||0}}function YR(t){for(const e of t)(e.attributes&&e.format||!e.attributes&&!e.format)&&_A.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}const JR="Failed to deduce GL constant from typed array";function QR(t,e){const{clamped:n=!0}=e||{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return n?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}const tM={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},eM={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}};class nM{offset;stride;type;size;divisor;normalized;integer;buffer;index;static getBytesPerElement(t){return QR(t.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(t){OA(t.size);return QR(t.type||5126).BYTES_PER_ELEMENT*t.size}static resolve(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new nM(...[tM,...e])}constructor(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e.forEach((t=>this._assign(t))),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return nM.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return nM.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=function(t,e,n){const{removedProps:i={},deprecatedProps:r={},replacedProps:s={}}=n;for(const a in i)if(a in e){const e=i[a]?`${t}.${i[a]}`:"N/A";_A.removed(`${t}.${a}`,e)()}for(const a in r)if(a in e){const e=r[a];_A.deprecated(`${t}.${a}`,`${t}.${e}`)()}let o=null;for(const[a,l]of Object.entries(s))a in e&&(_A.deprecated(`${t}.${a}`,`${t}.${l}`)(),o=o||Object.assign({},e),o[l]=e[a],delete o[a]);return o||e}("Accessor",t,eM),void 0!==t.type&&(this.type=t.type,5124!==t.type&&5125!==t.type||(this.integer=!0)),void 0!==t.size&&(this.size=t.size),void 0!==t.offset&&(this.offset=t.offset),void 0!==t.stride&&(this.stride=t.stride),void 0!==t.normalize&&(this.normalized=t.normalize),void 0!==t.normalized&&(this.normalized=t.normalized),void 0!==t.integer&&(this.integer=t.integer),void 0!==t.divisor&&(this.divisor=t.divisor),void 0!==t.buffer&&(this.buffer=t.buffer),void 0!==t.index&&("boolean"===typeof t.index?this.index=t.index?1:0:this.index=t.index),void 0!==t.instanced&&(this.divisor=t.instanced?1:0),void 0!==t.isInstanced&&(this.divisor=t.isInstanced?1:0),void 0===this.offset&&delete this.offset,void 0===this.stride&&delete this.stride,void 0===this.type&&delete this.type,void 0===this.size&&delete this.size,void 0===this.divisor&&delete this.divisor,void 0===this.normalized&&delete this.normalized,void 0===this.integer&&delete this.integer,void 0===this.buffer&&delete this.buffer,void 0===this.index&&delete this.index,this}}function iM(t){return rM.includes(t)}const rM=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],sM={5126:[5126,1,"float","f32","float32"],35664:[5126,2,"vec2","vec2<f32>","float32x2"],35665:[5126,3,"vec3","vec3<f32>","float32x3"],35666:[5126,4,"vec4","vec4<f32>","float32x4"],5124:[5124,1,"int","i32","sint32"],35667:[5124,2,"ivec2","vec2<i32>","sint32x2"],35668:[5124,3,"ivec3","vec3<i32>","sint32x3"],35669:[5124,4,"ivec4","vec4<i32>","sint32x4"],5125:[5125,1,"uint","u32","uint32"],36294:[5125,2,"uvec2","vec2<u32>","uint32x2"],36295:[5125,3,"uvec3","vec3<u32>","uint32x3"],36296:[5125,4,"uvec4","vec4<u32>","uint32x4"],35670:[5126,1,"bool","f32","float32"],35671:[5126,2,"bvec2","vec2<f32>","float32x2"],35672:[5126,3,"bvec3","vec3<f32>","float32x3"],35673:[5126,4,"bvec4","vec4<f32>","float32x4"],35674:[5126,8,"mat2","mat2x2<f32>"],35685:[5126,8,"mat2x3","mat2x3<f32>"],35686:[5126,8,"mat2x4","mat2x4<f32>"],35687:[5126,12,"mat3x2","mat3x2<f32>"],35675:[5126,12,"mat3","mat3x3<f32>"],35688:[5126,12,"mat3x4","mat3x4<f32>"],35689:[5126,16,"mat4x2","mat4x2<f32>"],35690:[5126,16,"mat4x3","mat4x3<f32>"],35676:[5126,16,"mat4","mat4x4<f32>"]};function oM(t){const e=sM[t];if(!e)throw new Error("uniform");const[n,i,,r]=e;return{format:r,components:i,glType:n}}function aM(t){const e=sM[t];if(!e)throw new Error("attribute");const[,n,,i,r]=e;return{attributeType:i,vertexFormat:r,components:n}}function lM(t,e){const n={attributes:[],bindings:[]};n.attributes=function(t,e){const n=[],i=t.getProgramParameter(e,35721);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r);if(!i)throw new Error("activeInfo");const{name:s,type:o}=i,a=t.getAttribLocation(e,s);if(a>=0){const{attributeType:t}=aM(o),e=/instance/i.test(s)?"instance":"vertex";n.push({name:s,location:a,stepMode:e,type:t})}}return n.sort(((t,e)=>t.location-e.location)),n}(t,e);const i=function(t,e){const n=(n,i)=>t.getActiveUniformBlockParameter(e,n,i),i=[],r=t.getProgramParameter(e,35382);for(let s=0;s<r;s++){const r={name:t.getActiveUniformBlockName(e,s)||"",location:n(s,35391),byteLength:n(s,35392),vertex:n(s,35396),fragment:n(s,35398),uniformCount:n(s,35394),uniforms:[]},o=n(s,35395)||[],a=t.getActiveUniforms(e,o,35383),l=t.getActiveUniforms(e,o,35384),c=t.getActiveUniforms(e,o,35387),u=t.getActiveUniforms(e,o,35388);for(let n=0;n<r.uniformCount;++n){const i=t.getActiveUniform(e,o[n]);if(!i)throw new Error("activeInfo");r.uniforms.push({name:i.name,format:oM(a[n]).format,type:a[n],arrayLength:l[n],byteOffset:c[n],byteStride:u[n]})}i.push(r)}return i.sort(((t,e)=>t.location-e.location)),i}(t,e);for(const a of i){const t=a.uniforms.map((t=>({name:t.name,format:t.format,byteOffset:t.byteOffset,byteStride:t.byteStride,arrayLength:t.arrayLength})));n.bindings.push({type:"uniform",name:a.name,location:a.location,visibility:(a.vertex?1:0)&(a.fragment?2:0),minBindingSize:a.byteLength,uniforms:t})}const r=function(t,e){const n=[],i=t.getProgramParameter(e,35718);for(let r=0;r<i;r++){const i=t.getActiveUniform(e,r);if(!i)throw new Error("activeInfo");const{name:s,size:o,type:a}=i,{name:l,isArray:c}=hM(s);let u=t.getUniformLocation(e,l);const h={location:u,name:l,size:o,type:a,isArray:c};if(n.push(h),h.size>1)for(let r=0;r<h.size;r++){const i=`${l}[${r}]`;u=t.getUniformLocation(e,i);const s={...h,name:i,location:u};n.push(s)}}return n}(t,e);let s=0;for(const a of r)if(iM(a.type)){const{viewDimension:t,sampleType:e}=uM(a.type);n.bindings.push({type:"texture",name:a.name,location:s,viewDimension:t,sampleType:e}),a.textureUnit=s,s+=1}r.length&&(n.uniforms=r);const o=function(t,e){const n=[],i=t.getProgramParameter(e,35971);for(let r=0;r<i;r++){const i=t.getTransformFeedbackVarying(e,r);if(!i)throw new Error("activeInfo");const{name:s,type:o,size:a}=i,{glType:l,components:c}=oM(o),u={location:r,name:s,accessor:new nM({type:l,size:a*c})};n.push(u)}return n.sort(((t,e)=>t.location-e.location)),n}(t,e);return o?.length&&(n.varyings=o),n}const cM={35678:["2d","float"],35680:["cube","float"],35679:["3d","float"],35682:["3d","depth"],36289:["2d-array","float"],36292:["2d-array","depth"],36293:["cube","float"],36298:["2d","sint"],36299:["3d","sint"],36300:["cube","sint"],36303:["2d-array","uint"],36306:["2d","uint"],36307:["3d","uint"],36308:["cube","uint"],36311:["2d-array","uint"]};function uM(t){const e=cM[t];if(!e)throw new Error("sampler");const[n,i]=e;return{viewDimension:n,sampleType:i}}function hM(t){if("]"!==t[t.length-1])return{name:t,length:1,isArray:!1};const e=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!e||e.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:e[1],length:e[2]?1:0,isArray:Boolean(e[2])}}function dM(t,e,n,i){const r=t;let s=i;!0===s&&(s=1),!1===s&&(s=0);const o="number"===typeof s?[s]:s;switch(n){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("number"!==typeof i)throw new Error("samplers must be set to integers");return t.uniform1i(e,i);case 5126:return t.uniform1fv(e,o);case 35664:return t.uniform2fv(e,o);case 35665:return t.uniform3fv(e,o);case 35666:return t.uniform4fv(e,o);case 5124:case 35670:return t.uniform1iv(e,o);case 35667:case 35671:return t.uniform2iv(e,o);case 35668:case 35672:return t.uniform3iv(e,o);case 35669:case 35673:return t.uniform4iv(e,o);case 5125:return r.uniform1uiv(e,o,1);case 36294:return r.uniform2uiv(e,o,2);case 36295:return r.uniform3uiv(e,o,3);case 36296:return r.uniform4uiv(e,o,4);case 35674:return t.uniformMatrix2fv(e,!1,o);case 35675:return t.uniformMatrix3fv(e,!1,o);case 35676:return t.uniformMatrix4fv(e,!1,o);case 35685:return r.uniformMatrix2x3fv(e,!1,o);case 35686:return r.uniformMatrix2x4fv(e,!1,o);case 35687:return r.uniformMatrix3x2fv(e,!1,o);case 35688:return r.uniformMatrix3x4fv(e,!1,o);case 35689:return r.uniformMatrix4x2fv(e,!1,o);case 35690:return r.uniformMatrix4x3fv(e,!1,o)}throw new Error("Illegal uniform")}class pM extends WR{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(t,e){super(t,e),this.device=t,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=e.vs,this.fs=e.fs;const{varyings:n,bufferMode:i=35981}=e;switch(n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,i)),this._linkShaders(),_A.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=lM(this.device.gl,this.handle),_A.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=function(t,e){const n={...t,attributes:t.attributes.map((t=>({...t})))};for(const i of e?.attributes||[]){const t=n.attributes.find((t=>t.name===i.name));t?(t.type=i.type||t.type,t.stepMode=i.stepMode||t.stepMode):_A.warn(`shader layout attribute ${i.name} not present in shader`)}return n}(this.introspectedLayout,e.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":_A.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`)}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(t,e){for(const[n,i]of Object.entries(t)){const t=this.shaderLayout.bindings.find((t=>t.name===n))||this.shaderLayout.bindings.find((t=>t.name===`${n}Uniforms`));if(t){switch(i||_A.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),t.type){case"uniform":if(!(i instanceof dR)&&!(i.buffer instanceof dR))throw new Error("buffer value");break;case"texture":if(!(i instanceof mR||i instanceof yR||i instanceof vR))throw new Error("texture value");break;case"sampler":_A.warn(`Ignoring sampler ${n}`)();break;default:throw new Error(t.type)}this.bindings[n]=i}else{const t=this.shaderLayout.bindings.map((t=>`"${t.name}"`)).join(", ");e?.disableWarnings||_A.warn(`Unknown binding "${n}" in render pipeline "${this.id}", expected one of ${t}`)()}}}draw(t){const{renderPass:e,parameters:n=this.props.parameters,topology:i=this.props.topology,vertexArray:r,vertexCount:s,instanceCount:o,isInstanced:a=!1,firstVertex:l=0,transformFeedback:c}=t,u=function(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(t)}}(i),h=Boolean(r.indexBuffer),d=r.indexBuffer?.glIndexType;if("success"!==this.linkStatus)return _A.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable()||0===s)return _A.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;if(0===s)return _A.info(2,`RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)(),!0;this.device.gl.useProgram(this.handle),r.bindBeforeRender(e),c&&c.begin(this.props.topology),this._applyBindings(),this._applyUniforms();const p=e;return function(t,e,n,i){if(EA(e))return i(t);const r=t;hP(r.gl);try{return iR(t,e),sP(r.gl,n),i(t)}finally{dP(r.gl)}}(this.device,n,p.glParameters,(()=>{h&&a?this.device.gl.drawElementsInstanced(u,s||0,d,l,o||0):h?this.device.gl.drawElements(u,s||0,d,l):a?this.device.gl.drawArraysInstanced(u,l,s||0,o||0):this.device.gl.drawArrays(u,l,s||0),c&&c.end()})),r.unbindAfterRender(e),!0}setUniformsWebGL(t){const{bindings:e}=GR(t);Object.keys(e).forEach((t=>{_A.warn(`Unsupported value "${JSON.stringify(e[t])}" used in setUniforms() for key ${t}. Use setBindings() instead?`)()})),Object.assign(this.uniforms,t)}async _linkShaders(){const{gl:t}=this.device;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),_A.time(4,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),_A.timeEnd(4,`linkProgram for ${this.id}`)(),_A.level,!this.device.features.has("compilation-status-async-webgl")){const t=this._getLinkStatus();return void this._reportLinkStatus(t)}_A.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),_A.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();const e=this._getLinkStatus();this._reportLinkStatus(e)}_reportLinkStatus(t){if("success"!==t){if("error"===this.vs.compilationStatus)throw this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`);if("error"===this.fs?.compilationStatus)throw this.fs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`);throw new Error(`Error during ${t}: ${this.device.gl.getProgramInfoLog(this.handle)}`)}}_getLinkStatus(){const{gl:t}=this.device;if(!t.getProgramParameter(this.handle,35714))return this.linkStatus="error","linking";t.validateProgram(this.handle);return t.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")}async _waitForLinkComplete(){const t=async t=>await new Promise((e=>setTimeout(e,t)));if(!this.device.features.has("compilation-status-async-webgl"))return void await t(10);const{gl:e}=this.device;for(;;){if(e.getProgramParameter(this.handle,37297))return;await t(10)}}_areTexturesRenderable(){let t=!0;for(const[,e]of Object.entries(this.bindings))e instanceof yR&&(e.update(),t=t&&e.loaded);return t}_applyBindings(){if("success"!==this.linkStatus)return;const{gl:t}=this.device;t.useProgram(this.handle);let e=0,n=0;for(const i of this.shaderLayout.bindings){const r=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!r)throw new Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":const{name:s}=i,o=t.getUniformBlockIndex(this.handle,s);if(4294967295===o)throw new Error(`Invalid uniform block name ${s}`);t.uniformBlockBinding(this.handle,n,o),r instanceof dR?t.bindBufferBase(35345,n,r.handle):t.bindBufferRange(35345,n,r.buffer.handle,r.offset||0,r.size||r.buffer.byteLength-r.offset),n+=1;break;case"texture":if(!(r instanceof mR||r instanceof yR||r instanceof vR))throw new Error("texture");let a;if(r instanceof mR)a=r.texture;else if(r instanceof yR)a=r;else{if(!(r instanceof vR&&r.colorAttachments[0]instanceof mR))throw new Error("No texture");_A.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),a=r.colorAttachments[0].texture}t.activeTexture(33984+e),t.bindTexture(a.target,a.handle),e+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(const t of this.shaderLayout.uniforms||[]){const{name:e,location:n,type:i,textureUnit:r}=t,s=this.uniforms[e]??r;void 0!==s&&dM(this.device.gl,n,i,s)}}}class fM extends xA{static defaultProps=(()=>({...xA.defaultProps,measureExecutionTime:void 0}))();get[Symbol.toStringTag](){return"CommandEncoder"}constructor(t,e){super(t,e,fM.defaultProps)}}class gM extends xA{static defaultProps={...xA.defaultProps};get[Symbol.toStringTag](){return"CommandBuffer"}constructor(t,e){super(t,e,gM.defaultProps)}}class mM extends gM{device;commands=[];constructor(t){super(t,{}),this.device=t}submitCommands(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.commands;for(const e of t)switch(e.name){case"copy-buffer-to-buffer":_M(this.device,e.options);break;case"copy-buffer-to-texture":yM(this.device,e.options);break;case"copy-texture-to-buffer":vM(this.device,e.options);break;case"copy-texture-to-texture":bM(this.device,e.options)}}}function _M(t,e){const n=e.source,i=e.destination;t.gl.bindBuffer(36662,n.handle),t.gl.bindBuffer(36663,i.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function yM(t,e){throw new Error("Not implemented")}function vM(t,e){const{source:n,mipLevel:i=0,aspect:r="all",width:s=e.source.width,height:o=e.source.height,depthOrArrayLayers:a=0,origin:l=[0,0],destination:c,byteOffset:u=0,bytesPerRow:h,rowsPerImage:d}=e;if("all"!==r)throw new Error("not supported");if(0!==i||0!==a||h||d)throw new Error("not implemented");const{framebuffer:p,destroyFramebuffer:f}=wM(n);let g;try{const e=c,n=s||p.width,i=o||p.height,r=GP(p.texture.props.format),a=r.dataFormat,h=r.type;t.gl.bindBuffer(35051,e.handle),g=t.gl.bindFramebuffer(36160,p.handle),t.gl.readPixels(l[0],l[1],n,i,a,h,u)}finally{t.gl.bindBuffer(35051,null),void 0!==g&&t.gl.bindFramebuffer(36160,g),f&&p.destroy()}}function bM(t,e){const{source:n,destinationMipLevel:i=0,origin:r=[0,0],destinationOrigin:s=[0,0],destination:o}=e;let{width:a=e.destination.width,height:l=e.destination.height}=e;const{framebuffer:c,destroyFramebuffer:u}=wM(n),[h,d]=r,[p,f,g]=s,m=t.gl.bindFramebuffer(36160,c.handle);let _,y=null;if(!(o instanceof yR))throw new Error("invalid destination");switch(y=o,a=Number.isFinite(a)?a:y.width,l=Number.isFinite(l)?l:y.height,y.bind(0),_=y.target,_){case 3553:case 34067:t.gl.copyTexSubImage2D(_,i,p,f,h,d,a,l);break;case 35866:case 32879:t.gl.copyTexSubImage3D(_,i,p,f,g,h,d,a,l)}y&&y.unbind(),t.gl.bindFramebuffer(36160,m),u&&c.destroy()}function wM(t){if(t instanceof YP){const{width:e,height:n,id:i}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${i}`,width:e,height:n,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}class EM extends fM{device;commandBuffer;constructor(t,e){super(t,e),this.device=t,this.commandBuffer=new mM(t)}destroy(){}finish(){this.commandBuffer.submitCommands()}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,e,n){}}class xM extends xA{static defaultProps={...xA.defaultProps,renderPipeline:null};get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(t,e){super(t,e,xM.defaultProps),this.maxVertexAttributes=t.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16;const i=XR(t,e),r=new Array(n).fill(null);for(const s of Object.values(i))r[s.location]=s;return r}(e.renderPipeline.shaderLayout,e.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(t,e){throw new Error("constant attributes not supported")}}let SM;function TM(t){return(!SM||SM.byteLength<t)&&(SM=new ArrayBuffer(t)),SM}class CM extends xM{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(t){return"Chrome"===(e||Qb()?Jb(e)?"Electron":(e||lw.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node");var e}constructor(t,e){super(t,e),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){const e=t;if(e&&34963!==e.glTarget)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,e?e.handle:null),this.indexBuffer=e,this.device.gl.bindVertexArray(null)}setBuffer(t,e){const n=e;if(34963===n.glTarget)throw new Error("Use .setIndexBuffer()");const{size:i,type:r,stride:s,offset:o,normalized:a,integer:l,divisor:c}=this._getAccessor(t);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),l?this.device.gl.vertexAttribIPointer(t,i,r,s,o):this.device.gl.vertexAttribPointer(t,i,r,a,s,o),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(t),this.device.gl.vertexAttribDivisor(t,c||0),this.attributes[t]=n,this.device.gl.bindVertexArray(null)}setConstantWebGL(t,e){this._enable(t,!1),this.attributes[t]=e}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let t=0;t<this.maxVertexAttributes;++t){const e=this.attributes[t];ArrayBuffer.isView(e)&&this.device.setConstantAttributeWebGL(t,e)}}_getAccessor(t){const e=this.attributeInfos[t];if(!e)throw new Error(`Unknown attribute location ${t}`);const n=vP(e.bufferDataType);return{size:e.bufferComponents,type:n,stride:e.byteStride,offset:e.byteOffset,normalized:e.normalized,integer:e.integer,divisor:"instance"===e.stepMode?1:0}}_enable(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=CM.isConstantAttributeZeroSupported(this.device);(e||(n||0!==t))&&(t=Number(t),this.device.gl.bindVertexArray(this.handle),e?this.device.gl.enableVertexAttribArray(t):this.device.gl.disableVertexAttribArray(t),this.device.gl.bindVertexArray(null))}getConstantBuffer(t,e){const n=function(t){if(Array.isArray(t))return new Float32Array(t);return t}(e),i=n.byteLength*t,r=n.length*t;if(this.buffer&&i!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${i} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),s=s||!function(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}(n,this.bufferValue),s){const t=function(t,e){return new t(TM(t.BYTES_PER_ELEMENT*e),0,e)}(e.constructor,r);!function(t){const{target:e,source:n,start:i=0,count:r=1}=t,s=n.length,o=r*s;let a=0;for(let l=i;a<s;a++)e[l++]=n[a];for(;a<o;)a<o-a?(e.copyWithin(i+a,i,i+a),a*=2):(e.copyWithin(i+a,i,i+o-a),a=o);t.target}({target:t,source:n,start:0,count:r}),this.buffer.write(t),this.bufferValue=e}return this.buffer}}class AM extends xA{static defaultProps=(()=>({...xA.defaultProps,layout:void 0,buffers:{}}))();get[Symbol.toStringTag](){return"TransformFeedback"}constructor(t,e){super(t,e,AM.defaultProps)}}class PM extends AM{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(t,e){super(t,e),this.device=t,this.gl=t.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,e.buffers&&this.setBuffers(e.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"point-list";this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(function(t){switch(t){case"point-list":return 0;case"line-list":case"line-strip":case"line-loop-webgl":return 1;case"triangle-list":case"triangle-strip":case"triangle-fan-webgl":return 4;default:throw new Error(t)}}(t))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(t){this.buffers={},this.unusedBuffers={},this.bind((()=>{for(const e in t)this.setBuffer(e,t[e])}))}setBuffer(t,e){const n=this._getVaryingIndex(t),{buffer:i,byteLength:r,byteOffset:s}=this._getBufferRange(e);if(n<0)return this.unusedBuffers[t]=i,void _A.warn(`${this.id} unusedBuffers varying buffer ${t}`)();this.buffers[n]={buffer:i,byteLength:r,byteOffset:s},this.bindOnUse||this._bindBuffer(n,i,s,r)}getBuffer(t){if(RM(t))return this.buffers[t]||null;const e=this._getVaryingIndex(t);return e>=0?this.buffers[e]:null}bind(){let t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.handle;return"function"!==typeof e?(this.gl.bindTransformFeedback(36386,e),this):(this._bound?t=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,t=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),t)}unbind(){this.bind(null)}_getBufferRange(t){if(t instanceof dR)return{buffer:t,byteOffset:0,byteLength:t.byteLength};const{buffer:e,byteOffset:n=0,byteLength:i=t.buffer.byteLength}=t;return{buffer:e,byteOffset:n,byteLength:i}}_getVaryingIndex(t){if(RM(t))return Number(t);for(const e of this.layout.varyings)if(t===e.name)return e.location;return-1}_bindBuffers(){for(const t in this.buffers){const{buffer:e,byteLength:n,byteOffset:i}=this._getBufferRange(this.buffers[t]);this._bindBuffer(Number(t),e,i,n)}}_unbindBuffers(){for(const t in this.buffers)this.gl.bindBufferBase(35982,Number(t),null)}_bindBuffer(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0;const r=e&&e.handle;r&&void 0!==i?this.gl.bindBufferRange(35982,t,r,n,i):this.gl.bindBufferBase(35982,t,r)}}function RM(t){return"number"===typeof t?Number.isInteger(t):/^\d+$/.test(t)}class MM extends xA{static defaultProps=(()=>({...xA.defaultProps,type:void 0,count:void 0}))();get[Symbol.toStringTag](){return"QuerySet"}constructor(t,e){super(t,e,MM.defaultProps)}}class IM extends MM{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(t,e){if(super(t,e),this.device=t,e.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),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;const t=this.device.gl.getQueryParameter(this.handle,34919);return t&&(this._queryPending=!1),t}
2isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.POSITIVE_INFINITY;if(this._pollingPromise)return this._pollingPromise;let e=0;return this._pollingPromise=new Promise(((n,i)=>{const r=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):e++>t?(i("Timed out"),this._pollingPromise=null):requestAnimationFrame(r)};requestAnimationFrame(r)})),this._pollingPromise}}function LM(t){switch(t){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return OA(!1),0}}function kM(t,e){const{sourceX:n=0,sourceY:i=0,sourceFormat:r=6408,sourceAttachment:s=36064}=e||{};let{target:o=null,sourceWidth:a,sourceHeight:l,sourceType:c}=e||{};const{framebuffer:u,deleteFramebuffer:h}=OM(t);OA(u);const{gl:d,handle:p}=u;a=a||u.width,l=l||u.height;const f=s-36064;c=c||u.colorAttachments[f]?.texture?.type||5121,o=function(t,e,n,i,r){if(t)return t;e=e||5121;const s=QR(e,{clamped:!1}),o=LM(n);return new s(i*r*o)}(o,c,r,a,l),c=c||function(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(JR)}}(o);const g=d.bindFramebuffer(36160,p);return d.readPixels(n,i,a,l,r,c,o),d.bindFramebuffer(36160,g||null),h&&u.destroy(),o}function NM(t,e){const{target:n,sourceX:i=0,sourceY:r=0,sourceFormat:s=6408,targetByteOffset:o=0}=e||{};let{sourceWidth:a,sourceHeight:l,sourceType:c}=e||{};const{framebuffer:u,deleteFramebuffer:h}=OM(t);OA(u),a=a||u.width,l=l||u.height;const d=u;c=c||5121;let p=n;if(!p){const t=LM(s),e=function(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return OA(!1),0}}(c),n=o+a*l*t*e;p=d.device.createBuffer({byteLength:n})}const f=t.device.createCommandEncoder();return f.copyTextureToBuffer({source:t,width:a,height:l,origin:[i,r],destination:p,byteOffset:o}),f.destroy(),h&&u.destroy(),p}function OM(t){return t instanceof JP?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:DM(t),deleteFramebuffer:!0}}function DM(t,e){const{device:n,width:i,height:r,id:s}=t;return n.createFramebuffer({...e,id:`framebuffer-for-${s}`,width:i,height:r,colorAttachments:[t]})}const FM="clear: bad arguments";class BM extends NA{static type="webgl";type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;static isSupported(){return"undefined"!==typeof WebGL2RenderingContext}static attach(t){if(t instanceof BM)return t;if(t?.device instanceof NA)return t.device;if(!function(t){if("undefined"!==typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext)return!0;return Boolean(t&&Number.isFinite(t._version))}(t))throw new Error("Invalid WebGL2RenderingContext");return new BM({gl:t})}static async create(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_A.groupCollapsed(1,"WebGLDevice created")();const e=[];t.debug&&e.push(async function(){Qb()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await eR("https://unpkg.com/[email protected]/index.js"))}()),t.spector&&e.push(async function(t){if(!globalThis.SPECTOR)try{await eR("https://cdn.jsdelivr.net/npm/[email protected]/dist/spector.bundle.js")}catch($c){_A.warn(String($c))}}()),"string"===typeof t.canvas&&e.push(VA.pageLoaded);const n=await Promise.allSettled(e);for(const s of n)"rejected"===s.status&&_A.error(`Failed to initialize debug libraries ${s.reason}`)();if(_A.probe(2,"DOM is loaded")(),t.gl?.device)return _A.warn("reattaching existing device")(),BM.attach(t.gl);const i=new BM(t),r=`Created ${i.type}${i.debug?" debug":""} context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return _A.probe(1,r)(),_A.table(1,i.info)(),_A.groupEnd(1)(),i}constructor(t){super({...t,id:t.id||wA("webgl-device")});const e=t.gl?.device;if(e)throw new Error(`WebGL context already attached to device ${e.id}`);const n=t.gl?.canvas||t.canvas;this.canvasContext=new bR(this,{...t,canvas:n}),this.lost=new Promise((t=>{this._resolveContextLost=t}));let i=t.gl||null;if(i||=function(t,e){e={...gP,...e};let n=null;const i=t=>n=t.statusMessage||n;t.addEventListener("webglcontextcreationerror",i,!1);let r=null;if(r||=t.getContext("webgl2",e),t.removeEventListener("webglcontextcreationerror",i,!1),!r)throw new Error(`Failed to create WebGL context: ${n||"Unknown error"}`);if(e.onContextLost){const{onContextLost:n}=e;t.addEventListener("webglcontextlost",(t=>n(t)),!1)}if(e.onContextRestored){const{onContextRestored:n}=e;t.addEventListener("webglcontextrestored",(t=>n(t)),!1)}return r}(this.canvasContext.canvas,{...t,onContextLost:t=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})}),!i)throw new Error("WebGL context creation failed");this.handle=i,this.gl=i,this.gl.device=this,this.gl._version=2,t.spector&&(this.spectorJS=function(t){if(t={...wR,...t},!t?.spector)return null;
vendor: 50,586 bytes, line 2
2if(!ER&&globalThis.SPECTOR&&(_A.probe(1,"SPECTOR found and initialized")(),ER=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=ER)),!ER)return null;if(xR||(xR=!0,ER.spyCanvases(),ER?.onCaptureStarted.add((t=>_A.info("Spector capture started:",t)())),ER?.onCapture.add((t=>{_A.info("Spector capture complete:",t)(),ER?.getResultUI(),ER?.resultView.display(),ER?.resultView.addCapture(t)}))),t?.canvas){if("string"===typeof t.spector&&t.spector!==t.canvas.id)return ER;ER?.startCapture(t?.canvas,500),new Promise((t=>setTimeout(t,2e3))).then((t=>{_A.info("Spector capture stopped after 2 seconds")(),ER?.stopCapture()}))}return ER}({...this.props,canvas:this.handle.canvas})),this.info=_P(this.gl,this._extensions),this.limits=new KP(this.gl),this.features=new XP(this.gl,this._extensions,this.props.disabledFeatures),this.props.initalizeFeatures&&this.features.initializeFeatures(),this.canvasContext.resize();const{enable:r=!0,copyState:s=!1}=t;uP(this.gl,{enable:r,copyState:s,log:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return _A.log(1,...e)()}}),t.debug&&(this.gl=CR(this.gl,{...t,throwOnError:!0}),this.debug=!0,_A.level=Math.max(_A.level,1),_A.warn("WebGL debug mode activated. Performance reduced.")())}destroy(){}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(t){return WP(this.gl,t,this._extensions)}isTextureFormatFilterable(t){return function(t,e,n){if(!WP(t,e,n))return!1;if(e.startsWith("depth")||e.startsWith("stencil"))return!1;try{if(MA(e).signed)return!1}catch{return!1}return e.endsWith("32float")?Boolean(mP(t,"OES_texture_float_linear, extensions",n)):!e.endsWith("16float")||Boolean(mP(t,"OES_texture_half_float_linear, extensions",n))}(this.gl,t,this._extensions)}isTextureFormatRenderable(t){return function(t,e,n){return!!WP(t,e,n)&&"number"!==typeof e}(this.gl,t,this._extensions)}createCanvasContext(t){throw new Error("WebGL only supports a single canvas")}createBuffer(t){const e=this._getBufferProps(t);return new dR(this,e)}_createTexture(t){return new yR(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new fR(this,t)}createShader(t){return new BR(this,t)}createFramebuffer(t){return new vR(this,t)}createVertexArray(t){return new CM(this,t)}createTransformFeedback(t){return new PM(this,t)}createQuerySet(t){return new IM(this,t)}createRenderPipeline(t){return new pM(this,t)}beginRenderPass(t){return new VR(this,t)}createComputePipeline(t){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(t){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(t){return new EM(this,t)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(t,e){return kM(t,e)}readPixelsToBufferWebGL(t,e){return NM(t,e)}setParametersWebGL(t){sP(this.gl,t)}getParametersWebGL(t){return oP(this.gl,t)}withParametersWebGL(t,e){return nR(this.gl,t,e)}clearWebGL(t){!function(t,e){const{framebuffer:n=null,color:i=null,depth:r=null,stencil:s=null}=e||{},o={};n&&(o.framebuffer=n);let a=0;i&&(a|=16384,!0!==i&&(o.clearColor=i)),r&&(a|=256,!0!==r&&(o.clearDepth=r)),s&&(a|=1024,!0!==r&&(o.clearStencil=r)),OA(0!==a,FM);const l=t.gl;nR(l,o,(()=>{l.clear(a)}))}(this,t)}resetWebGL(){_A.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),sP(this.gl,GA)}gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;loseDevice(){let t=!1;const e=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return e&&(t=!0,e.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),t}pushState(){hP(this.gl)}popState(){dP(this.gl)}setSpectorMetadata(t,e){t.__SPECTOR_Metadata=e}getGLKey(t,e){e=e||this.gl2||this.gl;const n=Number(t);for(const i in e)if(e[i]===n)return`GL.${i}`;return String(t)}_constants;setConstantAttributeWebGL(t,e){const n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);const i=this._constants[t];switch(i&&function(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}(i,e)&&_A.info(1,`setConstantAttributeWebGL(${t}) could have been skipped, value unchanged`)(),this._constants[t]=e,e.constructor){case Float32Array:!function(t,e,n){switch(n.length){case 1:t.gl.vertexAttrib1fv(e,n);break;case 2:t.gl.vertexAttrib2fv(e,n);break;case 3:t.gl.vertexAttrib3fv(e,n);break;case 4:t.gl.vertexAttrib4fv(e,n);break;default:OA(!1)}}(this,t,e);break;case Int32Array:!function(t,e,n){t.gl.vertexAttribI4iv(e,n)}(this,t,e);break;case Uint32Array:!function(t,e,n){t.gl.vertexAttribI4uiv(e,n)}(this,t,e);break;default:OA(!1)}}getExtension(t){return mP(this.gl,t,this._extensions),this._extensions}}let UM=0;const zM={device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:t=>console.error(t),stats:FA.stats.get("animation-loop-"+UM++),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1};class jM{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;constructor(t){if(this.props={...zM,...t},!(t=this.props).device)throw new Error("No device provided");const{useDevicePixels:e=!0}=this.props;this.stats=t.stats||new bE({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,autoResizeDrawingBuffer:t.autoResizeDrawingBuffer,useDevicePixels:e}),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()}setNeedsRedraw(t){return this.needsRedraw=this.needsRedraw||t,this}setProps(t){return"autoResizeViewport"in t&&(this.props.autoResizeViewport=t.autoResizeViewport||!1),"autoResizeDrawingBuffer"in t&&(this.props.autoResizeDrawingBuffer=t.autoResizeDrawingBuffer||!1),"useDevicePixels"in t&&(this.props.useDevicePixels=t.useDevicePixels||!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?(!1!==t&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(t){const e=t instanceof Error?t:new Error("Unknown error");throw this.props.onError(e),e}}stop(){return this._running&&(this.animationProps&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){return this.device?.isLost||(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._resizeCanvasDrawingBuffer(),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=function(t){return"undefined"!==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,1e3/60)}(this._animationFrame.bind(this)))}_cancelAnimationFrame(){var t;null!==this._animationFrameId&&(t=this._animationFrameId,"undefined"!==typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame(t):clearTimeout(t),this._animationFrameId=null)}_animationFrame(){this._running&&(this.redraw(),this._requestAnimationFrame())}_renderFrame(t){this.display?this.display._renderFrame(t):(this.props.onRender(this._getAnimationProps()),this.device.submit())}_clearNeedsRedraw(){this.needsRedraw=!1}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport()}_initializeAnimationProps(){if(!this.device)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:this.device?.canvasContext?.canvas,timeline:this.timeline,useDevicePixels:this.props.useDevicePixels,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;const{width:t,height:e,aspect:n}=this._getSizeAndAspect();t===this.animationProps.width&&e===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=e,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.canvasContext?.canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){const t=document.createElement("div");document.body.appendChild(t),t.style.position="relative";const e=document.createElement("div");e.style.position="absolute",e.style.left="10px",e.style.bottom="10px",e.style.width="300px",e.style.background="white",this.canvas instanceof HTMLCanvasElement&&t.appendChild(this.canvas),t.appendChild(e);const n=this.props.onAddHTML(e);n&&(e.innerHTML=n)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};const[t,e]=this.device?.canvasContext?.getPixelSize()||[1,1];let n=1;const i=this.device?.canvasContext?.canvas;return i&&i.clientHeight?n=i.clientWidth/i.clientHeight:t>0&&e>0&&(n=t/e),{width:t,height:e,aspect:n}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.props.autoResizeDrawingBuffer&&this.device?.canvasContext?.resize({useDevicePixels:this.props.useDevicePixels})}_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}}var VM=n(902);const WM={mousedown:1,mousemove:2,mouseup:4};!function(t){const e=t.prototype.handler;t.prototype.handler=function(t){const n=this.store;t.button>0&&"pointerdown"===t.type&&(function(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return!0;return!1}(n,(e=>e.pointerId===t.pointerId))||n.push(t)),e.call(this,t)}}(VM.PointerEventInput),VM.MouseInput.prototype.handler=function(t){let e=WM[t.type];1&e&&t.button>=0&&(this.pressed=!0),2&e&&0===t.buttons&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))};const $M=VM.Manager,GM=VM;class HM{constructor(t,e,n){this.element=t,this.callback=e,this.options={enable:!0,...n}}}const qM=GM?[[GM.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[GM.Rotate,{enable:!1}],[GM.Pinch,{enable:!1}],[GM.Swipe,{enable:!1}],[GM.Pan,{threshold:0,enable:!1}],[GM.Press,{enable:!1}],[GM.Tap,{event:"doubletap",taps:2,enable:!1}],[GM.Tap,{event:"anytap",enable:!1}],[GM.Tap,{enable:!1}]]:null,ZM={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},XM={doubletap:["tap"]},KM={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},YM={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},JM={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},QM={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},tI="undefined"!==typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",eI="undefined"!==typeof window?window:n.g;"undefined"!==typeof n.g?n.g:window,"undefined"!==typeof document&&document;let nI=!1;try{const t={get passive(){return nI=!0,!0}};eI.addEventListener("test",null,t),eI.removeEventListener("test",null)}catch(yG){nI=!1}const iI=-1!==tI.indexOf("firefox"),{WHEEL_EVENTS:rI}=YM,sI="wheel",oI=4.000244140625;class aI extends HM{constructor(t,e,n){super(t,e,n),this.handleEvent=t=>{if(!this.options.enable)return;let e=t.deltaY;eI.WheelEvent&&(iI&&t.deltaMode===eI.WheelEvent.DOM_DELTA_PIXEL&&(e/=eI.devicePixelRatio),t.deltaMode===eI.WheelEvent.DOM_DELTA_LINE&&(e*=40)),0!==e&&e%oI===0&&(e=Math.floor(e/oI)),t.shiftKey&&e&&(e*=.25),this.callback({type:sI,center:{x:t.clientX,y:t.clientY},delta:-e,srcEvent:t,pointerType:"mouse",target:t.target})},this.events=(this.options.events||[]).concat(rI),this.events.forEach((e=>t.addEventListener(e,this.handleEvent,!!nI&&{passive:!1})))}destroy(){this.events.forEach((t=>this.element.removeEventListener(t,this.handleEvent)))}enableEventType(t,e){t===sI&&(this.options.enable=e)}}const{MOUSE_EVENTS:lI}=YM,cI="pointermove",uI="pointerover",hI="pointerout",dI="pointerenter",pI="pointerleave";class fI extends HM{constructor(t,e,n){super(t,e,n),this.handleEvent=t=>{this.handleOverEvent(t),this.handleOutEvent(t),this.handleEnterEvent(t),this.handleLeaveEvent(t),this.handleMoveEvent(t)},this.pressed=!1;const{enable:i}=this.options;this.enableMoveEvent=i,this.enableLeaveEvent=i,this.enableEnterEvent=i,this.enableOutEvent=i,this.enableOverEvent=i,this.events=(this.options.events||[]).concat(lI),this.events.forEach((e=>t.addEventListener(e,this.handleEvent)))}destroy(){this.events.forEach((t=>this.element.removeEventListener(t,this.handleEvent)))}enableEventType(t,e){t===cI&&(this.enableMoveEvent=e),t===uI&&(this.enableOverEvent=e),t===hI&&(this.enableOutEvent=e),t===dI&&(this.enableEnterEvent=e),t===pI&&(this.enableLeaveEvent=e)}handleOverEvent(t){this.enableOverEvent&&"mouseover"===t.type&&this._emit(uI,t)}handleOutEvent(t){this.enableOutEvent&&"mouseout"===t.type&&this._emit(hI,t)}handleEnterEvent(t){this.enableEnterEvent&&"mouseenter"===t.type&&this._emit(dI,t)}handleLeaveEvent(t){this.enableLeaveEvent&&"mouseleave"===t.type&&this._emit(pI,t)}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case"mousedown":t.button>=0&&(this.pressed=!0);break;case"mousemove":0===t.buttons&&(this.pressed=!1),this.pressed||this._emit(cI,t);break;case"mouseup":this.pressed=!1}}_emit(t,e){this.callback({type:t,center:{x:e.clientX,y:e.clientY},srcEvent:e,pointerType:"mouse",target:e.target})}}const{KEY_EVENTS:gI}=YM,mI="keydown",_I="keyup";class yI extends HM{constructor(t,e,n){super(t,e,n),this.handleEvent=t=>{const e=t.target||t.srcElement;"INPUT"===e.tagName&&"text"===e.type||"TEXTAREA"===e.tagName||(this.enableDownEvent&&"keydown"===t.type&&this.callback({type:mI,srcEvent:t,key:t.key,target:t.target}),this.enableUpEvent&&"keyup"===t.type&&this.callback({type:_I,srcEvent:t,key:t.key,target:t.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(gI),t.tabIndex=this.options.tabIndex||0,t.style.outline="none",this.events.forEach((e=>t.addEventListener(e,this.handleEvent)))}destroy(){this.events.forEach((t=>this.element.removeEventListener(t,this.handleEvent)))}enableEventType(t,e){t===mI&&(this.enableDownEvent=e),t===_I&&(this.enableUpEvent=e)}}const vI="contextmenu";class bI extends HM{constructor(t,e,n){super(t,e,n),this.handleEvent=t=>{this.options.enable&&this.callback({type:vI,center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})},t.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(t,e){t===vI&&(this.options.enable=e)}}const wI={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4};function EI(t){const e=wI[t.srcEvent.type];if(!e)return null;const{buttons:n,button:i}=t.srcEvent;let r=!1,s=!1,o=!1;return 2===e?(r=Boolean(1&n),s=Boolean(4&n),o=Boolean(2&n)):(r=0===i,s=1===i,o=2===i),{leftButton:r,middleButton:s,rightButton:o}}function xI(t,e){const n=t.center;if(!n)return null;const i=e.getBoundingClientRect(),r=i.width/e.offsetWidth||1,s=i.height/e.offsetHeight||1;return{center:n,offsetCenter:{x:(n.x-i.left-e.clientLeft)/r,y:(n.y-i.top-e.clientTop)/s}}}const SI={srcElement:"root",priority:0};class TI{constructor(t){this.handleEvent=t=>{if(this.isEmpty())return;const e=this._normalizeEvent(t);let n=t.srcEvent.target;for(;n&&n!==e.rootElement;){if(this._emit(e,n),e.handled)return;n=n.parentNode}this._emit(e,"root")},this.eventManager=t,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{handlers:s,handlersByElement:o}=this;let a=SI;"string"===typeof n||n&&n.addEventListener?a={...SI,srcElement:n}:n&&(a={...SI,...n});let l=o.get(a.srcElement);l||(l=[],o.set(a.srcElement,l));const c={type:t,handler:e,srcElement:a.srcElement,priority:a.priority};i&&(c.once=!0),r&&(c.passive=!0),s.push(c),this._active=this._active||!c.passive;let u=l.length-1;for(;u>=0&&!(l[u].priority>=c.priority);)u--;l.splice(u+1,0,c)}remove(t,e){const{handlers:n,handlersByElement:i}=this;for(let r=n.length-1;r>=0;r--){const s=n[r];if(s.type===t&&s.handler===e){n.splice(r,1);const t=i.get(s.srcElement);t.splice(t.indexOf(s),1),0===t.length&&i.delete(s.srcElement)}}this._active=n.some((t=>!t.passive))}_emit(t,e){const n=this.handlersByElement.get(e);if(n){let e=!1;const i=()=>{t.handled=!0},r=()=>{t.handled=!0,e=!0},s=[];for(let o=0;o<n.length;o++){const{type:a,handler:l,once:c}=n[o];if(l({...t,type:a,stopPropagation:i,stopImmediatePropagation:r}),c&&s.push(n[o]),e)break}for(let t=0;t<s.length;t++){const{type:e,handler:n}=s[t];this.remove(e,n)}}}_normalizeEvent(t){const e=this.eventManager.getElement();return{...t,...EI(t),...xI(t,e),preventDefault:()=>{t.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:e}}}const CI={events:null,recognizers:null,recognizerOptions:{},Manager:$M,touchAction:"none",tabIndex:0};class AI{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1?arguments[1]:void 0;this._onBasicInput=t=>{const{srcEvent:e}=t,n=KM[e.type];n&&this.manager.emit(n,t)},this._onOtherEvent=t=>{this.manager.emit(t.type,t)},this.options={...CI,...e},this.events=new Map,this.setElement(t);const{events:n}=this.options;n&&this.on(n)}getElement(){return this.element}setElement(t){if(this.element&&this.destroy(),this.element=t,!t)return;const{options:e}=this,n=e.Manager;this.manager=new n(t,{touchAction:e.touchAction,recognizers:e.recognizers||qM}).on("hammer.input",this._onBasicInput),e.recognizers||Object.keys(ZM).forEach((t=>{const e=this.manager.get(t);e&&ZM[t].forEach((t=>{e.recognizeWith(t)}))}));for(const i in e.recognizerOptions){const t=this.manager.get(i);if(t){const n=e.recognizerOptions[i];delete n.enable,t.set(n)}}this.wheelInput=new aI(t,this._onOtherEvent,{enable:!1}),this.moveInput=new fI(t,this._onOtherEvent,{enable:!1}),this.keyInput=new yI(t,this._onOtherEvent,{enable:!1,tabIndex:e.tabIndex}),this.contextmenuInput=new bI(t,this._onOtherEvent,{enable:!1});for(const[i,r]of this.events)r.isEmpty()||(this._toggleRecognizer(r.recognizerName,!0),this.manager.on(i,r.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(t,e,n){this._addEventHandler(t,e,n,!1)}once(t,e,n){this._addEventHandler(t,e,n,!0)}watch(t,e,n){this._addEventHandler(t,e,n,!1,!0)}off(t,e){this._removeEventHandler(t,e)}_toggleRecognizer(t,e){const{manager:n}=this;if(!n)return;const i=n.get(t);if(i&&i.options.enable!==e){i.set({enable:e});const r=XM[t];r&&!this.options.recognizers&&r.forEach((r=>{const s=n.get(r);e?(s.requireFailure(t),i.dropRequireFailure(r)):s.dropRequireFailure(t)}))}this.wheelInput.enableEventType(t,e),this.moveInput.enableEventType(t,e),this.keyInput.enableEventType(t,e),this.contextmenuInput.enableEventType(t,e)}_addEventHandler(t,e,n,i,r){if("string"!==typeof t){n=e;for(const e in t)this._addEventHandler(e,t[e],n,i,r);return}const{manager:s,events:o}=this,a=QM[t]||t;let l=o.get(a);l||(l=new TI(this),o.set(a,l),l.recognizerName=JM[a]||a,s&&s.on(a,l.handleEvent)),l.add(t,e,n,i,r),l.isEmpty()||this._toggleRecognizer(l.recognizerName,!0)}_removeEventHandler(t,e){if("string"!==typeof t){for(const e in t)this._removeEventHandler(e,t[e]);return}const{events:n}=this,i=QM[t]||t,r=n.get(i);if(r&&(r.remove(t,e),r.isEmpty())){const{recognizerName:t}=r;let e=!1;for(const i of n.values())if(i.recognizerName===t&&!i.isEmpty()){e=!0;break}e||this._toggleRecognizer(t,!1)}}}function PI(){}const RI={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{type:"webgl"},gl:null,glOptions:{},canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:PI,onWebGLInitialized:PI,onResize:PI,onViewStateChange:PI,onInteractionStateChange:PI,onBeforeRender:PI,onAfterRender:PI,onLoad:PI,onError:t=>vw.error(t.message,t.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:t=>{let{isDragging:e}=t;return e?"grabbing":"grab"},getTooltip:null,debug:!1,drawPickingColors:!1};class MI{static#t=(()=>this.defaultProps=RI)();static#e=(()=>this.VERSION=mA)();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 bE({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=t=>{const{_pickRequest:e}=this;if("pointerleave"===t.type)e.x=-1,e.y=-1,e.radius=0;else{if(t.leftButton||t.rightButton)return;{const n=t.offsetCenter;if(!n)return;e.x=n.x,e.y=n.y,e.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:e.x,y:e.y}),e.event=t},this._onEvent=t=>{const e=xw[t.type],n=t.offsetCenter;if(!e||!n||!this.layerManager)return;const i=this.layerManager.getLayers(),r=this.deckPicker.getLastPickedObject({x:n.x,y:n.y,layers:i,viewports:this.getViewports(n)},this._lastPointerDownInfo),{layer:s}=r,o=s&&(s[e.handler]||s.props[e.handler]),a=this.props[e.handler];let l=!1;o&&(l=o.call(s,r,t)),l||(a?.(r,t),this.widgetManager.onEvent(r,t))},this._onPointerDown=t=>{const e=t.offsetCenter,n=this._pick("pickObject","pickObject Time",{x:e.x,y:e.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=n.result[0]||n.emptyInfo},this.props={...RI,...t},(t=this.props).viewState&&t.initialViewState&&vw.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:t.gl&&(t.gl instanceof WebGLRenderingContext&&vw.error("WebGL1 context not supported.")(),this.device=BM.attach(t.gl));let e=this.device;e||(FA.registerDevices([BM]),e=FA.createDevice({...t.deviceProps,canvas:this._createCanvas(t)})),this.animationLoop=this._createAnimationLoop(e,t),this.setProps(t),t._typedArrayManagerProps&&nS.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&&vw.removed("onLayerHover","onHover")(),"onLayerClick"in t&&vw.removed("onLayerClick","onClick")(),t.initialViewState&&!AT(this.props.initialViewState,t.initialViewState,3)&&(this.viewState=t.initialViewState),Object.assign(this.props,t),this._setCanvasSize(this.props);const e=Object.create(this.props);Object.assign(e,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop?.setProps(e),this.layerManager&&(this.viewManager.setProps(e),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(e),this.effectManager.setProps(e),this.deckRenderer.setProps(e),this.deckPicker.setProps(e),this.widgetManager.setProps(e)),this.stats.get("setProps Time").timeEnd()}needsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let e=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);const n=this.viewManager.needsRedraw(t),i=this.layerManager.needsRedraw(t),r=this.effectManager.needsRedraw(t),s=this.deckRenderer.needsRedraw(t);return e=e||n||i||r||s,e}redraw(t){if(!this.layerManager)return;let e=this.needsRedraw({clearRedrawFlags:!0});e=t||e,e&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(e):this._drawLayers(e))}get isInitialized(){return null!==this.viewManager}getViews(){return jT(this.viewManager),this.viewManager.views}getViewports(t){return jT(this.viewManager),this.viewManager.getViewports(t)}getCanvas(){return this.canvas}pickObject(t){const e=this._pick("pickObject","pickObject Time",t).result;return e.length?e[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){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(const n in t)this.layerManager.resourceManager.add({resourceId:n,data:t[n],forceUpdate:e})}_removeResources(t){for(const e of t)this.layerManager.resourceManager.remove(e)}_addDefaultEffect(t){this.effectManager.addDefaultEffect(t)}_addDefaultShaderModule(t){this.layerManager.addDefaultShaderModule(t)}_removeDefaultShaderModule(t){this.layerManager?.removeDefaultShaderModule(t)}_pick(t,e,n){jT(this.deckPicker);const{stats:i}=this;i.get("Pick Count").incrementCount(),i.get(e).timeStart();const r=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 i.get(e).timeEnd(),r}_createCanvas(t){let e=t.canvas;if("string"===typeof e&&(e=document.getElementById(e),jT(e)),!e){e=document.createElement("canvas"),e.id=t.id||"deckgl-overlay";(t.parent||document.body).appendChild(e)}return Object.assign(e.style,t.style),e}_setCanvasSize(t){if(!this.canvas)return;const{width:e,height:n}=t;if(e||0===e){const t=Number.isFinite(e)?`${e}px`:e;this.canvas.style.width=t}if(n||0===n){const e=Number.isFinite(n)?`${n}px`:n;this.canvas.style.position=t.style?.position||"absolute",this.canvas.style.height=e}}_updateCanvasSize(){const{canvas:t}=this;if(!t)return;const e=t.clientWidth??t.width,n=t.clientHeight??t.height;e===this.width&&n===this.height||(this.width=e,this.height=n,this.viewManager?.setProps({width:e,height:n}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:e,height:n}))}_createAnimationLoop(t,e){const{gl:n,onError:i,useDevicePixels:r}=e;return new jM({device:t,useDevicePixels:r,autoResizeDrawingBuffer:!n,autoResizeViewport:!1,onInitialize:t=>this._setDevice(t.device),onRender:this._onRenderFrame.bind(this),onError:i})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){const{views:t}=this.props,e=Array.isArray(t)?t:t?[t]:[new sC({id:"default-view"})];return e.length&&this.props.controller&&(e[0].props.controller=this.props.controller),e}_onContextLost(){const{onError:t}=this.props;this.animationLoop&&t&&t(new Error("WebGL context is lost"))}_pickAndCallback(){const{_pickRequest:t}=this;if(t.event){const{result:e,emptyInfo:n}=this._pick("pickObject","pickObject Time",t);this.cursorState.isHovering=e.length>0;let i=n,r=!1;for(const s of e)i=s,r=s.layer?.onHover(s,t.event)||r;r||(this.props.onHover?.(i,t.event),this.widgetManager.onHover(i,t.event)),t.event=null}}_updateCursor(){const 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.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device instanceof BM&&this.props.onWebGLInitialized(this.device.gl);const e=new gb;e.play(),this.animationLoop.attachTimeline(e),this.eventManager=new AI(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(const i in xw)this.eventManager.on(i,this._onEvent);this.viewManager=new PT({timeline:e,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});const n=this.viewManager.getViewports()[0];this.layerManager=new CT(this.device,{deck:this,stats:this.stats,viewport:n,timeline:e}),this.effectManager=new RC({deck:this,device:this.device}),this.deckRenderer=new NC(this.device),this.deckPicker=new zC(this.device),this.widgetManager=new $C({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new HC),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(t,e){const{device:n,gl:i}=this.layerManager.context;this.props.onBeforeRender({device:n,gl:i});const r={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(),...e};this.deckRenderer?.renderLayers(r),"screen"===r.pass&&this.widgetManager.onRedraw({viewports:r.viewports,layers:r.layers}),this.props.onAfterRender({device:n,gl:i})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),vw.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(t){const e=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState={...this.viewState,[t.viewId]:e},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(t){this.cursorState.isDragging=t.isDragging||!1,this.props.onInteractionStateChange(t)}_getFrameStats(){const{stats:t}=this;t.get("frameRate").timeEnd(),t.get("frameRate").timeStart();const e=this.animationLoop.stats;t.get("GPU Time").addTime(e.get("GPU Time").lastTiming),t.get("CPU Time").addTime(e.get("CPU Time").lastTiming)}_getMetrics(){const{metrics:t,stats:e}=this;t.fps=e.get("frameRate").getHz(),t.setPropsTime=e.get("setProps Time").time,t.updateAttributesTime=e.get("Update Attributes").time,t.framesRedrawn=e.get("Redraw Count").count,t.pickTime=e.get("pickObject Time").time+e.get("pickMultipleObjects Time").time+e.get("pickObjects Time").time,t.pickCount=e.get("Pick Count").count,t.gpuTime=e.get("GPU Time").time,t.cpuTime=e.get("CPU Time").time,t.gpuTimePerFrame=e.get("GPU Time").getAverageTime(),t.cpuTimePerFrame=e.get("CPU Time").getAverageTime();const n=FA.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}}const II="undefined"!==typeof window?e.useLayoutEffect:e.useEffect;function LI(t,e){for(;t;){if(t===e)return!0;t=Object.getPrototypeOf(t)}return!1}function kI(t){const e=ArrayBuffer.isView(t)?t.constructor:t;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function NI(t){switch(t){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(t)}}function OI(t,e,n){if(!e||e>4)throw new Error(`size ${e}`);const i=e;let r=kI(t);if("uint8"===r||"sint8"===r){if(1===i||3===i)throw new Error(`size: ${e}`);return n&&(r=r.replace("int","norm")),`${r}x${i}`}if("uint16"===r||"sint16"===r){if(1===i||3===i)throw new Error(`size: ${e}`);return n&&(r=r.replace("int","norm")),`${r}x${i}`}return 1===i?r:`${r}x${i}`}const DI=kI;function FI(t,e){return{attribute:t,format:e.size>1?`${e.type}x${e.size}`:e.type,byteOffset:e.offset||0}}function BI(t){return t.stride||t.size*t.bytesPerElement}function UI(t,e){e.offset&&vw.removed("shaderAttribute.offset","vertexOffset, elementOffset")();const n=BI(t),i=(void 0!==e.vertexOffset?e.vertexOffset:t.vertexOffset||0)*n+(e.elementOffset||0)*t.bytesPerElement+(t.offset||0);return{...e,offset:i,stride:n}}class zI{constructor(t,e,n){this._buffer=null,this.device=t,this.id=e.id||"",this.size=e.size||1;const i=e.logicalType||e.type,r="float64"===i;let s,{defaultValue:o}=e;o=Number.isFinite(o)?[o]:o||new Array(this.size).fill(0),s=r?"float32":!i&&e.isIndexed?"uint32":i||"float32";let a=function(t){switch(t){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return NI(t)}}(i||s);this.doublePrecision=r,r&&!1===e.fp64&&(a=Float32Array),this.value=null,this.settings={...e,defaultType:a,defaultValue:o,logicalType:i,type:s,normalized:s.includes("norm"),size:this.size,bytesPerElement:a.BYTES_PER_ELEMENT},this.state={...n,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){const t=this.getAccessor();return t.vertexOffset?t.vertexOffset*BI(t):0}get numInstances(){return this.state.numInstances}set numInstances(t){this.state.numInstances=t}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),nS.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.id,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n={};if(this.state.constant){const i=this.value;if(e){const r=UI(this.getAccessor(),e),s=r.offset/i.BYTES_PER_ELEMENT,o=r.size||this.size;n[t]=i.subarray(s,s+o)}else n[t]=i}else n[t]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?n[`${t}64Low`]=n[t]:n[`${t}64Low`]=new Float32Array(this.size)),n}_getBufferLayout(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.id,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=this.getAccessor(),i=[],r={name:this.id,byteStride:BI(n),attributes:i};if(this.doublePrecision){const r=function(t,e){const n=UI(t,e);return{high:n,low:{...n,offset:n.offset+4*t.size}}}(n,e||{});i.push(FI(t,{...n,...r.high}),FI(`${t}64Low`,{...n,...r.low}))}else if(e){const r=UI(n,e);i.push(FI(t,{...n,...r}))}else i.push(FI(t,n));return r}setAccessor(t){this.state.bufferAccessor=t}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let t=null;if(this.state.constant&&this.value){const e=Array.from(this.value);t=[e,e]}else{const{value:e,numInstances:n,size:i}=this,r=n*i;if(e&&r&&e.length>=r){const n=new Array(i).fill(1/0),s=new Array(i).fill(-1/0);for(let t=0;t<r;)for(let r=0;r<i;r++){const i=e[t++];i<n[r]&&(n[r]=i),i>s[r]&&(s[r]=i)}t=[n,s]}}return this.state.bounds=t,t}setData(t){const{state:e}=this;let n;n=ArrayBuffer.isView(t)?{value:t}:t instanceof SA?{buffer:t}:t;const i={...this.settings,...n};if(ArrayBuffer.isView(n.value)){if(!n.type){if(this.doublePrecision&&n.value instanceof Float64Array)i.type="float32";else{const t=DI(n.value);i.type=i.normalized?t.replace("int","norm"):t}}i.bytesPerElement=n.value.BYTES_PER_ELEMENT,i.stride=BI(i)}if(e.bounds=null,n.constant){let t=n.value;t=this._normalizeValue(t,[],0),this.settings.normalized&&(t=this.normalizeConstant(t));if(!(!e.constant||!this._areValuesEqual(t,this.value)))return!1;e.externalBuffer=null,e.constant=!0,this.value=ArrayBuffer.isView(t)?t:new Float32Array(t)}else if(n.buffer){const t=n.buffer;e.externalBuffer=t,e.constant=!1,this.value=n.value||null}else if(n.value){this._checkExternalBuffer(n);let t=n.value;e.externalBuffer=null,e.constant=!1,this.value=t;let{buffer:r}=this;const s=BI(i),o=(i.vertexOffset||0)*s;if(this.doublePrecision&&t instanceof Float64Array&&(t=kS(t,i)),this.settings.isIndexed){const e=this.settings.defaultType;t.constructor!==e&&(t=new e(t))}const a=t.byteLength+o+2*s;(!r||r.byteLength<a)&&(r=this._createBuffer(a)),r.write(t,o)}return this.setAccessor(i),!0}updateSubBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.state.bounds=null;const e=this.value,{startOffset:n=0,endOffset:i}=t;this.buffer.write(this.doublePrecision&&e instanceof Float64Array?kS(e,{size:this.size,startIndex:n,endIndex:i}):e.subarray(n,i),n*e.BYTES_PER_ELEMENT+this.byteOffset)}allocate(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{state:n}=this,i=n.allocatedValue,r=nS.allocate(i,t+1,{size:this.size,type:this.settings.defaultType,copy:e});this.value=r;const{byteOffset:s}=this;let{buffer:o}=this;return(!o||o.byteLength<r.byteLength+s)&&(o=this._createBuffer(r.byteLength+s),e&&i&&o.write(i instanceof Float64Array?kS(i,this):i,s)),n.allocatedValue=r,n.constant=!1,n.externalBuffer=null,this.setAccessor(this.settings),!0}_checkExternalBuffer(t){const{value:e}=t;if(!ArrayBuffer.isView(e))throw new Error(`Attribute ${this.id} value is not TypedArray`);const n=this.settings.defaultType;let i=!1;if(this.doublePrecision&&(i=e.BYTES_PER_ELEMENT<4),i)throw new Error(`Attribute ${this.id} does not support ${e.constructor.name}`);e instanceof n||!this.settings.normalized||"normalized"in t||vw.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(t){switch(this.settings.type){case"snorm8":return new Float32Array(t).map((t=>(t+128)/255*2-1));case"snorm16":return new Float32Array(t).map((t=>(t+32768)/65535*2-1));case"unorm8":return new Float32Array(t).map((t=>t/255));case"unorm16":return new Float32Array(t).map((t=>t/65535));default:return t}}_normalizeValue(t,e,n){const{defaultValue:i,size:r}=this.settings;if(Number.isFinite(t))return e[n]=t,e;if(!t){let t=r;for(;--t>=0;)e[n+t]=i[t];return e}switch(r){case 4:e[n+3]=Number.isFinite(t[3])?t[3]:i[3];case 3:e[n+2]=Number.isFinite(t[2])?t[2]:i[2];case 2:e[n+1]=Number.isFinite(t[1])?t[1]:i[1];case 1:e[n+0]=Number.isFinite(t[0])?t[0]:i[0];break;default:let s=r;for(;--s>=0;)e[n+s]=Number.isFinite(t[s])?t[s]:i[s]}return e}_areValuesEqual(t,e){if(!t||!e)return!1;const{size:n}=this;for(let i=0;i<n;i++)if(t[i]!==e[i])return!1;return!0}_createBuffer(t){this._buffer&&this._buffer.destroy();const{isIndexed:e,type:n}=this.settings;return this._buffer=this.device.createBuffer({...this._buffer?.props,id:this.id,usage:e?SA.INDEX:SA.VERTEX,indexType:e?n:void 0,byteLength:t}),this._buffer}}const jI=[],VI=[];function WI(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,i=jI;const r={index:-1,data:t,target:[]};return t?"function"===typeof t[Symbol.iterator]?i=t:t.length>0&&(VI.length=t.length,i=VI):i=jI,(e>0||Number.isFinite(n))&&(i=(Array.isArray(i)?i:Array.from(i)).slice(e,n),r.index=e-1),{iterable:i,objectInfo:r}}function $I(t){return t&&t[Symbol.asyncIterator]}function GI(t,e){const{size:n,stride:i,offset:r,startIndices:s,nested:o}=e,a=t.BYTES_PER_ELEMENT,l=i?i/a:n,c=r?r/a:0,u=Math.floor((t.length-c)/l);return(e,i)=>{let{index:r,target:a}=i;if(!s){const e=r*l+c;for(let i=0;i<n;i++)a[i]=t[e+i];return a}const h=s[r],d=s[r+1]||u;let p;if(o){p=new Array(d-h);for(let e=h;e<d;e++){const i=e*l+c;a=new Array(n);for(let e=0;e<n;e++)a[e]=t[i+e];p[e-h]=a}}else if(l===n)p=t.subarray(h*n+c,d*n+c);else{p=new t.constructor((d-h)*n);let e=0;for(let i=h;i<d;i++){const r=i*l+c;for(let i=0;i<n;i++)p[e++]=t[r+i]}}return p}}const HI=[],qI=[[0,1/0]];const ZI={interpolation:{duration:0,easing:t=>t},spring:{stiffness:.05,damping:.5}};function XI(t,e){if(!t)return null;Number.isFinite(t)&&(t={type:"interpolation",duration:t});const n=t.type||"interpolation";return{...ZI[n],...e,...t,type:n}}class KI extends zI{constructor(t,e){super(t,e,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:qI}),this.constant=!1,this.settings.update=e.update||(e.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(t){this.state.startIndices=t}needsUpdate(){return this.state.needsUpdate}needsRedraw(){let{clearChangedFlags:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this.state.needsRedraw;return this.state.needsRedraw=e&&!t,e}layoutChanged(){return this.state.layoutChanged}setAccessor(t){var e,n;this.state.layoutChanged||=(e=t,n=this.getAccessor(),!(e.type===n.type&&e.size===n.size&&BI(e)===BI(n)&&(e.offset||0)===(n.offset||0))),super.setAccessor(t)}getUpdateTriggers(){const{accessor:t}=this.settings;return[this.id].concat("function"!==typeof t&&t||[])}supportsTransition(){return Boolean(this.settings.transition)}getTransitionSetting(t){if(!t||!this.supportsTransition())return null;const{accessor:e}=this.settings,n=this.settings.transition;return XI(Array.isArray(e)?t[e.find((e=>t[e]))]:t[e],n)}setNeedsUpdate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.id,e=arguments.length>1?arguments[1]:void 0;if(this.state.needsUpdate=this.state.needsUpdate||t,this.setNeedsRedraw(t),e){const{startRow:t=0,endRow:n=1/0}=e;this.state.updateRanges=function(t,e){if(t===qI)return t;if(e[0]<0&&(e[0]=0),e[0]>=e[1])return t;const n=[],i=t.length;let r=0;for(let s=0;s<i;s++){const i=t[s];i[1]<e[0]?(n.push(i),r=s+1):i[0]>e[1]?n.push(i):e=[Math.min(i[0],e[0]),Math.max(i[1],e[1])]}return n.splice(r,0,e),n}(this.state.updateRanges,[t,n])}else this.state.updateRanges=qI}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=HI}setNeedsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.id;this.state.needsRedraw=this.state.needsRedraw||t}allocate(t){const{state:e,settings:n}=this;return!n.noAlloc&&(!!n.update&&(super.allocate(t,e.updateRanges!==qI),!0))}updateBuffer(t){let{numInstances:e,data:n,props:i,context:r}=t;if(!this.needsUpdate())return!1;const{state:{updateRanges:s},settings:{update:o,noAlloc:a}}=this;let l=!0;if(o){for(const[t,a]of s)o.call(r,this,{data:n,startRow:t,endRow:a,props:i,numInstances:e});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.setData({value:this.value,constant:this.constant}),this.constant=!1;else for(const[t,n]of s){const i=Number.isFinite(t)?this.getVertexOffset(t):0,r=Number.isFinite(n)?this.getVertexOffset(n):a||!Number.isFinite(e)?this.value.length:e*this.size;super.updateSubBuffer({startOffset:i,endOffset:r})}else;this._checkAttributeArray()}else l=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),l}setConstantValue(t){if(void 0===t||"function"===typeof t)return!1;return this.setData({constant:!0,value:t})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0}setExternalBuffer(t){const{state:e}=this;return t?(this.clearNeedsUpdate(),e.lastExternalBuffer===t||(e.lastExternalBuffer=t,this.setNeedsRedraw(),this.setData(t)),!0):(e.lastExternalBuffer=null,!1)}setBinaryValue(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const{state:n,settings:i}=this;if(!t)return n.binaryValue=null,n.binaryAccessor=null,!1;if(i.noAlloc)return!1;if(n.binaryValue===t)return this.clearNeedsUpdate(),!0;n.binaryValue=t,this.setNeedsRedraw();if(i.transform||e!==this.startIndices){ArrayBuffer.isView(t)&&(t={value:t});const r=t;jT(ArrayBuffer.isView(r.value),`invalid ${i.accessor}`);const s=Boolean(r.size)&&r.size!==this.size;return n.binaryAccessor=GI(r.value,{size:r.size||this.size,stride:r.stride,offset:r.offset,startIndices:e,nested:s}),!1}return this.clearNeedsUpdate(),this.setData(t),!0}getVertexOffset(t){const{startIndices:e}=this;return(e?t<e.length?e[t]:this.numInstances:t)*this.size}getValue(){const t=this.settings.shaderAttributes,e=super.getValue();if(!t)return e;for(const n in t)Object.assign(e,super.getValue(n,t[n]));return e}getBufferLayout(t){this.state.layoutChanged=!1;const e=this.settings.shaderAttributes,n=super._getBufferLayout(),{stepMode:i}=this.settings;if(n.stepMode="dynamic"===i?t?t.isInstanced?"instance":"vertex":"instance":i??"vertex",!e)return n;for(const r in e){const t=super._getBufferLayout(r,e[r]);n.attributes.push(...t.attributes)}return n}_autoUpdater(t,e){let{data:n,startRow:i,endRow:r,props:s,numInstances:o}=e;if(t.constant)return;const{settings:a,state:l,value:c,size:u,startIndices:h}=t,{accessor:d,transform:p}=a,f=l.binaryAccessor||("function"===typeof d?d:s[d]);jT("function"===typeof f,`accessor "${d}" is not a function`);let g=t.getVertexOffset(i);const{iterable:m,objectInfo:_}=WI(n,i,r);for(const y of m){_.index++;let e=f(y,_);if(p&&(e=p.call(this,e)),h){const n=(_.index<h.length-1?h[_.index+1]:o)-h[_.index];if(e&&Array.isArray(e[0])){let n=g;for(const i of e)t._normalizeValue(i,c,n),n+=u}else e&&e.length>u?c.set(e,g):(t._normalizeValue(e,_.target,0),_E({target:c,source:_.target,start:g,count:n}));g+=n*u}else t._normalizeValue(e,c,g),g+=u}}_validateAttributeUpdaters(){const{settings:t}=this;if(!(t.noAlloc||"function"===typeof t.update))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){const{value:t}=this,e=Math.min(4,this.size);if(t&&t.length>=e){let n=!0;switch(e){case 4:n=n&&Number.isFinite(t[3]);case 3:n=n&&Number.isFinite(t[2]);case 2:n=n&&Number.isFinite(t[1]);case 1:n=n&&Number.isFinite(t[0]);break;default:n=!1}if(!n)throw new Error(`Illegal attribute generated for ${this.id}`)}}}function YI(t){const{input:e,inputChannels:n,output:i}=t||{};
2if(!e)return"#version 300 es\nout vec4 transform_output;\nvoid main() {\ntransform_output = vec4(0);\n}";if(!n)throw new Error("inputChannels");return`#version 300 es\nin ${function(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`invalid channels: ${t}`)}}(n)} ${e};\nout vec4 ${i};\nvoid main() {\n ${i} = ${function(t,e){switch(e){case 1:return`vec4(${t}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${t}, 0.0, 1.0)`;case 3:return`vec4(${t}, 1.0)`;case 4:return t;default:throw new Error(`invalid channels: ${e}`)}}(e,n)};\n}`}class JI{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(t){if(this.name=t?.name,t?.name&&t?.shaderLayout){const e=t?.shaderLayout.bindings?.find((e=>"uniform"===e.type&&e.name===t?.name));if(!e)throw new Error(t?.name);const n=e;for(const t of n.uniforms||[])this.bindingLayout[t.name]=t}}setUniforms(t){for(const[e,n]of Object.entries(t))this._setUniform(e,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${e}=${n}`)}setNeedsRedraw(t){this.needsRedraw=this.needsRedraw||t}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(t,e){(function(t,e){if(t!==e)return!1;const n=$R(t);if(!n)return!1;const i=$R(e);if(i&&n.length===i.length)for(let r=0;r<n.length;++r)if(i[r]!==n[r])return!1;return!0})(this.uniforms[t],e)||(this.uniforms[t]=function(t){const e=$R(t);return e?e.slice():t}(e),this.modifiedUniforms[t]=!0,this.modified=!0)}}const QI={f32:{type:"f32",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<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}};function tL(t){const e=QI[t];return OA(t),e}function eL(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}class nL{layout={};byteLength;constructor(t){let e=0;for(const[i,r]of Object.entries(t)){const t=tL(r),{type:n,components:s}=t;e=eL(e,s);const o=e;e+=s,this.layout[i]={type:n,size:s,offset:o}}e+=(4-e%4)%4;const n=4*e;this.byteLength=Math.max(n,1024)}getData(t){const e=TM(Math.max(this.byteLength,1024)),n={i32:new Int32Array(e),u32:new Uint32Array(e),f32:new Float32Array(e),f16:new Uint16Array(e)};for(const[i,r]of Object.entries(t)){const t=this.layout[i];if(!t){_A.warn(`Supplied uniform value ${i} not present in uniform block layout`)();continue}const{type:e,size:s,offset:o}=t,a=n[e];if(1===s){if("number"!==typeof r&&"boolean"!==typeof r){_A.warn(`Supplied value for single component uniform ${i} is not a number: ${r}`)();continue}a[o]=Number(r)}else{const t=$R(r);if(!t){_A.warn(`Supplied value for multi component / array uniform ${i} is not a numeric array: ${r}`)();continue}a.set(t,o)}}return new Uint8Array(e)}has(t){return Boolean(this.layout[t])}get(t){return this.layout[t]}}class iL{uniformBlocks=(()=>new Map)();uniformBufferLayouts=(()=>new Map)();uniformBuffers=(()=>new Map)();constructor(t){for(const[e,n]of Object.entries(t)){const t=e,i=new nL(n.uniformTypes||{});this.uniformBufferLayouts.set(t,i);const r=new JI({name:e});r.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(t,r)}}destroy(){for(const t of this.uniformBuffers.values())t.destroy()}setUniforms(t){for(const[e,n]of Object.entries(t))this.uniformBlocks.get(e).setUniforms(n);this.updateUniformBuffers()}getUniformBufferByteLength(t){return this.uniformBufferLayouts.get(t).byteLength}getUniformBufferData(t){const e=this.uniformBlocks.get(t).getAllUniforms();return this.uniformBufferLayouts.get(t).getData(e)}createUniformBuffer(t,e,n){n&&this.setUniforms(n);const i=this.getUniformBufferByteLength(e),r=t.createBuffer({usage:SA.UNIFORM|SA.COPY_DST,byteLength:i}),s=this.getUniformBufferData(e);return r.write(s),r}getManagedUniformBuffer(t,e){if(!this.uniformBuffers.get(e)){const n=this.getUniformBufferByteLength(e),i=t.createBuffer({usage:SA.UNIFORM|SA.COPY_DST,byteLength:n});this.uniformBuffers.set(e,i)}return this.uniformBuffers.get(e)}updateUniformBuffers(){let t=!1;for(const e of this.uniformBlocks.keys()){const n=this.updateUniformBuffer(e);t||=n}return t&&_A.log(3,`UniformStore.updateUniformBuffers(): ${t}`)(),t}updateUniformBuffer(t){const e=this.uniformBlocks.get(t);let n=!1;if(this.uniformBuffers.get(t)&&e.needsRedraw){n||=e.needsRedraw;const i=this.getUniformBufferData(t);this.uniformBuffers.get(t).write(i);const r=this.uniformBlocks.get(t).getAllUniforms();_A.log(4,`Writing to uniform buffer ${String(t)}`,i,r)()}return n}}function rL(t,e,n){if(t===e)return!0;
vendor: 12,308 bytes, line 2
2if(!n||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!rL(t[i],e[i],n-1))return!1;return!0}if(Array.isArray(e))return!1;if("object"===typeof t&&"object"===typeof e){const i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length)return!1;for(const s of i){if(!e.hasOwnProperty(s))return!1;if(!rL(t[s],e[s],n-1))return!1}return!0}return!1}class sL{constructor(){this.constants=new Map,this.aliases=new Map,this.structs=new Map}}class oL{constructor(){}get isAstNode(){return!0}get astNodeType(){return""}evaluate(t){throw new Error("Cannot evaluate node")}evaluateString(t){return this.evaluate(t).toString()}}class aL extends oL{constructor(){super()}}class lL extends aL{constructor(t,e,n,i){super(),this.name=t,this.args=e,this.returnType=n,this.body=i}get astNodeType(){return"function"}}class cL extends aL{constructor(t){super(),this.expression=t}get astNodeType(){return"staticAssert"}}class uL extends aL{constructor(t,e){super(),this.condition=t,this.body=e}get astNodeType(){return"while"}}class hL extends aL{constructor(t){super(),this.body=t}get astNodeType(){return"continuing"}}class dL extends aL{constructor(t,e,n,i){super(),this.init=t,this.condition=e,this.increment=n,this.body=i}get astNodeType(){return"for"}}class pL extends aL{constructor(t,e,n,i,r){super(),this.name=t,this.type=e,this.storage=n,this.access=i,this.value=r}get astNodeType(){return"var"}}class fL extends aL{constructor(t,e,n){super(),this.name=t,this.type=e,this.value=n}get astNodeType(){return"override"}}class gL extends aL{constructor(t,e,n,i,r){super(),this.name=t,this.type=e,this.storage=n,this.access=i,this.value=r}get astNodeType(){return"let"}}class mL extends aL{constructor(t,e,n,i,r){super(),this.name=t,this.type=e,this.storage=n,this.access=i,this.value=r}get astNodeType(){return"const"}evaluate(t){return this.value.evaluate(t)}}var _L,yL,vL,bL,wL;!function(t){t.increment="++",t.decrement="--"}(_L||(_L={})),function(t){t.parse=function(e){const n=e;if("parse"==n)throw new Error("Invalid value for IncrementOperator");return t[n]}}(_L||(_L={}));class EL extends aL{constructor(t,e){super(),this.operator=t,this.variable=e}get astNodeType(){return"increment"}}!function(t){t.assign="=",t.addAssign="+=",t.subtractAssin="-=",t.multiplyAssign="*=",t.divideAssign="/=",t.moduloAssign="%=",t.andAssign="&=",t.orAssign="|=",t.xorAssign="^=",t.shiftLeftAssign="<<=",t.shiftRightAssign=">>="}(yL||(yL={})),function(t){t.parse=function(e){const n=e;if("parse"==n)throw new Error("Invalid value for AssignOperator");return t[n]}}(yL||(yL={}));class xL extends aL{constructor(t,e,n){super(),this.operator=t,this.variable=e,this.value=n}get astNodeType(){return"assign"}}class SL extends aL{constructor(t,e){super(),this.name=t,this.args=e}get astNodeType(){return"call"}}class TL extends aL{constructor(t,e){super(),this.body=t,this.continuing=e}get astNodeType(){return"loop"}}class CL extends aL{constructor(t,e){super(),this.condition=t,this.body=e}get astNodeType(){return"body"}}class AL extends aL{constructor(t,e,n,i){super(),this.condition=t,this.body=e,this.elseif=n,this.else=i}get astNodeType(){return"if"}}class PL extends aL{constructor(t){super(),this.value=t}get astNodeType(){return"return"}}class RL extends aL{constructor(t){super(),this.name=t}get astNodeType(){return"enable"}}class ML extends aL{constructor(t,e){super(),this.name=t,this.type=e}get astNodeType(){return"alias"}}class IL extends aL{constructor(){super()}get astNodeType(){return"discard"}}class LL extends aL{constructor(){super()}get astNodeType(){return"break"}}class kL extends aL{constructor(){super()}get astNodeType(){return"continue"}}class NL extends aL{constructor(t){super(),this.name=t}get astNodeType(){return"type"}get isStruct(){return!1}get isArray(){return!1}}class OL extends NL{constructor(t,e){super(t),this.members=e}get astNodeType(){return"struct"}get isStruct(){return!0}getMemberIndex(t){for(let e=0;e<this.members.length;e++)if(this.members[e].name==t)return e;return-1}}class DL extends NL{constructor(t,e,n){super(t),this.format=e,this.access=n}get astNodeType(){return"template"}}class FL extends NL{constructor(t,e,n,i){super(t),this.storage=e,this.type=n,this.access=i}get astNodeType(){return"pointer"}}class BL extends NL{constructor(t,e,n,i){super(t),this.attributes=e,this.format=n,this.count=i}get astNodeType(){return"array"}get isArray(){return!0}}class UL extends NL{constructor(t,e,n){super(t),this.format=e,this.access=n}get astNodeType(){return"sampler"}}class zL extends oL{constructor(){super()}}class jL extends zL{constructor(t){super(),this.value=t}get astNodeType(){return"stringExpr"}toString(){return this.value}evaluateString(){return this.value}}class VL extends zL{constructor(t,e){super(),this.type=t,this.args=e}get astNodeType(){return"createExpr"}}class WL extends zL{constructor(t,e){super(),this.name=t,this.args=e}get astNodeType(){return"callExpr"}evaluate(t){switch(this.name){case"abs":return Math.abs(this.args[0].evaluate(t));case"acos":return Math.acos(this.args[0].evaluate(t));case"acosh":return Math.acosh(this.args[0].evaluate(t));case"asin":return Math.asin(this.args[0].evaluate(t));case"asinh":return Math.asinh(this.args[0].evaluate(t));case"atan":return Math.atan(this.args[0].evaluate(t));case"atan2":return Math.atan2(this.args[0].evaluate(t),this.args[1].evaluate(t));case"atanh":return Math.atanh(this.args[0].evaluate(t));case"ceil":return Math.ceil(this.args[0].evaluate(t));case"clamp":return Math.min(Math.max(this.args[0].evaluate(t),this.args[1].evaluate(t)),this.args[2].evaluate(t));case"cos":return Math.cos(this.args[0].evaluate(t));case"degrees":return 180*this.args[0].evaluate(t)/Math.PI;case"distance":return Math.sqrt(Math.pow(this.args[0].evaluate(t)-this.args[1].evaluate(t),2));case"dot":case"exp":return Math.exp(this.args[0].evaluate(t));case"exp2":return Math.pow(2,this.args[0].evaluate(t));case"floor":return Math.floor(this.args[0].evaluate(t));case"fma":return this.args[0].evaluate(t)*this.args[1].evaluate(t)+this.args[2].evaluate(t);case"fract":case"modf":return this.args[0].evaluate(t)-Math.floor(this.args[0].evaluate(t));case"inverseSqrt":return 1/Math.sqrt(this.args[0].evaluate(t));case"log":return Math.log(this.args[0].evaluate(t));case"log2":return Math.log2(this.args[0].evaluate(t));case"max":return Math.max(this.args[0].evaluate(t),this.args[1].evaluate(t));case"min":return Math.min(this.args[0].evaluate(t),this.args[1].evaluate(t));case"mix":return this.args[0].evaluate(t)*(1-this.args[2].evaluate(t))+this.args[1].evaluate(t)*this.args[2].evaluate(t);case"pow":return Math.pow(this.args[0].evaluate(t),this.args[1].evaluate(t));case"radians":return this.args[0].evaluate(t)*Math.PI/180;case"round":return Math.round(this.args[0].evaluate(t));case"sign":return Math.sign(this.args[0].evaluate(t));case"sin":return Math.sin(this.args[0].evaluate(t));case"sinh":return Math.sinh(this.args[0].evaluate(t));case"saturate":return Math.min(Math.max(this.args[0].evaluate(t),0),1);case"smoothstep":return this.args[0].evaluate(t)*this.args[0].evaluate(t)*(3-2*this.args[0].evaluate(t));case"sqrt":return Math.sqrt(this.args[0].evaluate(t));case"step":return this.args[0].evaluate(t)<this.args[1].evaluate(t)?0:1;case"tan":return Math.tan(this.args[0].evaluate(t));case"tanh":return Math.tanh(this.args[0].evaluate(t));case"trunc":return Math.trunc(this.args[0].evaluate(t));default:throw new Error("Non const function: "+this.name)}}}class $L extends zL{constructor(t){super(),this.name=t}get astNodeType(){return"varExpr"}}class GL extends zL{constructor(t,e){super(),this.name=t,this.initializer=e}get astNodeType(){return"constExpr"}evaluate(t){var e,n;if(this.initializer instanceof VL){const i=null===(e=this.postfix)||void 0===e?void 0:e.evaluateString(t),r=null===(n=this.initializer.type)||void 0===n?void 0:n.name,s=t.structs.get(r),o=null===s||void 0===s?void 0:s.getMemberIndex(i);if(-1!=o){return this.initializer.args[o].evaluate(t)}console.log(o)}return this.initializer.evaluate(t)}}class HL extends zL{constructor(t){super(),this.value=t}get astNodeType(){return"literalExpr"}evaluate(){return this.value}}class qL extends zL{constructor(t,e){super(),this.type=t,this.value=e}get astNodeType(){return"bitcastExpr"}}class ZL extends zL{constructor(t,e){super(),this.type=t,this.args=e}get astNodeType(){return"typecastExpr"}evaluate(t){return this.args[0].evaluate(t)}}class XL extends zL{constructor(t){super(),this.contents=t}get astNodeType(){return"groupExpr"}evaluate(t){return this.contents[0].evaluate(t)}}class KL extends zL{constructor(){super()}}class YL extends KL{constructor(t,e){super(),this.operator=t,this.right=e}get astNodeType(){return"unaryOp"}evaluate(t){switch(this.operator){case"+":return this.right.evaluate(t);case"-":return-this.right.evaluate(t);case"!":return this.right.evaluate(t)?0:1;case"~":return~this.right.evaluate(t);default:throw new Error("Unknown unary operator: "+this.operator)}}}class JL extends KL{constructor(t,e,n){super(),this.operator=t,this.left=e,this.right=n}get astNodeType(){return"binaryOp"}evaluate(t){switch(this.operator){case"+":return this.left.evaluate(t)+this.right.evaluate(t);case"-":return this.left.evaluate(t)-this.right.evaluate(t);case"*":return this.left.evaluate(t)*this.right.evaluate(t);case"/":return this.left.evaluate(t)/this.right.evaluate(t);case"%":return this.left.evaluate(t)%this.right.evaluate(t);case"==":return this.left.evaluate(t)==this.right.evaluate(t)?1:0;case"!=":return this.left.evaluate(t)!=this.right.evaluate(t)?1:0;case"<":return this.left.evaluate(t)<this.right.evaluate(t)?1:0;case">":return this.left.evaluate(t)>this.right.evaluate(t)?1:0;case"<=":return this.left.evaluate(t)<=this.right.evaluate(t)?1:0;case">=":return this.left.evaluate(t)>=this.right.evaluate(t)?1:0;case"&&":return this.left.evaluate(t)&&this.right.evaluate(t)?1:0;case"||":return this.left.evaluate(t)||this.right.evaluate(t)?1:0;default:throw new Error(`Unknown operator ${this.operator}`)}}}class QL extends oL{constructor(){super()}}class tk extends QL{constructor(t,e){super(),this.selector=t,this.body=e}get astNodeType(){return"case"}}class ek extends QL{constructor(t){super(),this.body=t}get astNodeType(){return"default"}}class nk extends oL{constructor(t,e,n){super(),this.name=t,this.type=e,this.attributes=n}get astNodeType(){return"argument"}}class ik extends oL{constructor(t,e){super(),this.condition=t,this.body=e}get astNodeType(){return"elseif"}}class rk extends oL{constructor(t,e,n){super(),this.name=t,this.type=e,this.attributes=n}get astNodeType(){return"member"}}class sk extends oL{constructor(t,e){super(),this.name=t,this.value=e}get astNodeType(){return"attribute"}}!function(t){t[t.token=0]="token",t[t.keyword=1]="keyword",t[t.reserved=2]="reserved"}(bL||(bL={}));class ok{constructor(t,e,n){this.name=t,this.type=e,this.rule=n}toString(){return this.name}}class ak{}vL=ak,ak.none=new ok("",bL.reserved,""),ak.eof=new ok("EOF",bL.token,""),ak.reserved={asm:new ok("asm",bL.reserved,"asm"),bf16:new ok("bf16",bL.reserved,"bf16"),do:new ok("do",bL.reserved,"do"),enum:new ok("enum",bL.reserved,"enum"),f16:new ok("f16",bL.reserved,"f16"),f64:new ok("f64",bL.reserved,"f64"),handle:new ok("handle",bL.reserved,"handle"),i8:new ok("i8",bL.reserved,"i8"),i16:new ok("i16",bL.reserved,"i16"),i64:new ok("i64",bL.reserved,"i64"),mat:new ok("mat",bL.reserved,"mat"),premerge:new ok("premerge",bL.reserved,"premerge"),regardless:new ok("regardless",bL.reserved,"regardless"),typedef:new ok("typedef",bL.reserved,"typedef"),u8:new ok("u8",bL.reserved,"u8"),u16:new ok("u16",bL.reserved,"u16"),u64:new ok("u64",bL.reserved,"u64"),unless:new ok("unless",bL.reserved,"unless"),using:new ok("using",bL.reserved,"using"),vec:new ok("vec",bL.reserved,"vec"),void:new ok("void",bL.reserved,"void")},ak.keywords={array:new ok("array",bL.keyword,"array"),atomic:new ok("atomic",bL.keyword,"atomic"),bool:new ok("bool",bL.keyword,"bool"),f32:new ok("f32",bL.keyword,"f32"),i32:new ok("i32",bL.keyword,"i32"),mat2x2:new ok("mat2x2",bL.keyword,"mat2x2"),mat2x3:new ok("mat2x3",bL.keyword,"mat2x3"),mat2x4:new ok("mat2x4",bL.keyword,"mat2x4"),mat3x2:new ok("mat3x2",bL.keyword,"mat3x2"),mat3x3:new ok("mat3x3",bL.keyword,"mat3x3"),mat3x4:ne
2w ok("mat3x4",bL.keyword,"mat3x4"),mat4x2:new ok("mat4x2",bL.keyword,"mat4x2"),mat4x3:new ok("mat4x3",bL.keyword,"mat4x3"),mat4x4:new ok("mat4x4",bL.keyword,"mat4x4"),ptr:new ok("ptr",bL.keyword,"ptr"),sampler:new ok("sampler",bL.keyword,"sampler"),sampler_comparison:new ok("sampler_comparison",bL.keyword,"sampler_comparison"),struct:new ok("struct",bL.keyword,"struct"),texture_1d:new ok("texture_1d",bL.keyword,"texture_1d"),texture_2d:new ok("texture_2d",bL.keyword,"texture_2d"),texture_2d_array:new ok("texture_2d_array",bL.keyword,"texture_2d_array"),texture_3d:new ok("texture_3d",bL.keyword,"texture_3d"),texture_cube:new ok("texture_cube",bL.keyword,"texture_cube"),texture_cube_array:new ok("texture_cube_array",bL.keyword,"texture_cube_array"),texture_multisampled_2d:new ok("texture_multisampled_2d",bL.keyword,"texture_multisampled_2d"),texture_storage_1d:new ok("texture_storage_1d",bL.keyword,"texture_storage_1d"),texture_storage_2d:new ok("texture_storage_2d",bL.keyword,"texture_storage_2d"),texture_storage_2d_array:new ok("texture_storage_2d_array",bL.keyword,"texture_storage_2d_array"),texture_storage_3d:new ok("texture_storage_3d",bL.keyword,"texture_storage_3d"),texture_depth_2d:new ok("texture_depth_2d",bL.keyword,"texture_depth_2d"),texture_depth_2d_array:new ok("texture_depth_2d_array",bL.keyword,"texture_depth_2d_array"),texture_depth_cube:new ok("texture_depth_cube",bL.keyword,"texture_depth_cube"),texture_depth_cube_array:new ok("texture_depth_cube_array",bL.keyword,"texture_depth_cube_array"),texture_depth_multisampled_2d:new ok("texture_depth_multisampled_2d",b
vendor: 3,545 bytes, line 2
2L.keyword,"texture_depth_multisampled_2d"),texture_external:new ok("texture_external",bL.keyword,"texture_external"),u32:new ok("u32",bL.keyword,"u32"),vec2:new ok("vec2",bL.keyword,"vec2"),vec3:new ok("vec3",bL.keyword,"vec3"),vec4:new ok("vec4",bL.keyword,"vec4"),bitcast:new ok("bitcast",bL.keyword,"bitcast"),block:new ok("block",bL.keyword,"block"),break:new ok("break",bL.keyword,"break"),case:new ok("case",bL.keyword,"case"),continue:new ok("continue",bL.keyword,"continue"),continuing:new ok("continuing",bL.keyword,"continuing"),default:new ok("default",bL.keyword,"default"),discard:new ok("discard",bL.keyword,"discard"),else:new ok("else",bL.keyword,"else"),enable:new ok("enable",bL.keyword,"enable"),fallthrough:new ok("fallthrough",bL.keyword,"fallthrough"),false:new ok("false",bL.keyword,"false"),fn:new ok("fn",bL.keyword,"fn"),for:new ok("for",bL.keyword,"for"),function:new ok("function",bL.keyword,"function"),if:new ok("if",bL.keyword,"if"),let:new ok("let",bL.keyword,"let"),const:new ok("const",bL.keyword,"const"),loop:new ok("loop",bL.keyword,"loop"),while:new ok("while",bL.keyword,"while"),private:new ok("private",bL.keyword,"private"),read:new ok("read",bL.keyword,"read"),read_write:new ok("read_write",bL.keyword,"read_write"),return:new ok("return",bL.keyword,"return"),storage:new ok("storage",bL.keyword,"storage"),switch:new ok("switch",bL.keyword,"switch"),true:new ok("true",bL.keyword,"true"),alias:new ok("alias",bL.keyword,"alias"),type:new ok("type",bL.keyword,"type"),uniform:new ok("uniform",bL.keyword,"uniform"),var:new ok("var",bL.keyword,"var"),override:new ok("override",bL.keyword,"override"),workgroup:new ok("workgroup",bL.keyword,"workgroup"),write:new ok("write",bL.keyword,"write"),r8unorm:new ok("r8unorm",bL.keyword,"r8unorm"),r8snorm:new ok("r8snorm",bL.keyword,"r8snorm"),r8uint:new ok("r8uint",bL.keyword,"r8uint"),r8sint:new ok("r8sint",bL.keyword,"r8sint"),r16uint:new ok("r16uint",bL.keyword,"r16uint"),r16sint:new ok("r16sint",bL.keyword,"r16sint"),r16float:new ok("r16float",bL.keyword,"r16float"),rg8unorm:new ok("rg8unorm",bL.keyword,"rg8unorm"),rg8snorm:new ok("rg8snorm",bL.keyword,"rg8snorm"),rg8uint:new ok("rg8uint",bL.keyword,"rg8uint"),rg8sint:new ok("rg8sint",bL.keyword,"rg8sint"),r32uint:new ok("r32uint",bL.keyword,"r32uint"),r32sint:new ok("r32sint",bL.keyword,"r32sint"),r32float:new ok("r32float",bL.keyword,"r32float"),rg16uint:new ok("rg16uint",bL.keyword,"rg16uint"),rg16sint:new ok("rg16sint",bL.keyword,"rg16sint"),rg16float:new ok("rg16float",bL.keyword,"rg16float"),rgba8unorm:new ok("rgba8unorm",bL.keyword,"rgba8unorm"),rgba8unorm_srgb:new ok("rgba8unorm_srgb",bL.keyword,"rgba8unorm_srgb"),rgba8snorm:new ok("rgba8snorm",bL.keyword,"rgba8snorm"),rgba8uint:new ok("rgba8uint",bL.keyword,"rgba8uint"),rgba8sint:new ok("rgba8sint",bL.keyword,"rgba8sint"),bgra8unorm:new ok("bgra8unorm",bL.keyword,"bgra8unorm"),bgra8unorm_srgb:new ok("bgra8unorm_srgb",bL.keyword,"bgra8unorm_srgb"),rgb10a2unorm:new ok("rgb10a2unorm",bL.keyword,"rgb10a2unorm"),rg11b10float:new ok("rg11b10float",bL.keyword,"rg11b10float"),rg32uint:new ok("rg32uint",bL.keyword,"rg32uint"),rg32sint:new ok("rg32sint",bL.keyword,"rg32sint"),rg32float:new ok("rg32float",bL.keyword,"rg32float"),rgba16uint:new ok("rgba16uint",bL.keyword,"rgba16uint"),rgba16sint:new ok("rgba16sint",bL.keyword,"rgba16sint"),rgba16float:new ok("rgba16float",bL.keyword,"rgba16float"),rgba32uint:new ok("rgba32uint",bL.keyword,"rgba32uint"),rgba32sint:new ok("rgba32sint",bL.keyword,"rgba32sint"),rgba32float:ne
2w ok("rgba32float",bL.keyword,"rgba32float"),static_assert:new ok("static_assert",bL.keyword,"static_assert")},ak.tokens={decimal_float_literal:new ok("decimal_float_literal",bL.token,/((-?[0-9]*\.[0-9]+|-?[0-9]+\.[0-9]*)((e|E)(\+|-)?[0-9]+)?f?)|(-?[0-9]+(e|E)(\+|-)?[0-9]+f?)|([0-9]+f)/),hex_float_literal:new ok("hex_float_literal",bL.token,/-?0x((([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.[0-9a-fA-F]*)((p|P)(\+|-)?[0-9]+f?)?)|([0-9a-fA-F]+(p|P)(\+|-)?[0-9]+f?))/),int_literal:new ok("int_literal",bL.token,/-?0x[0-9a-fA-F]+|0i?|-?[1-9][0-9]*i?/),uint_literal:new ok("uint_literal",bL.token,/0x[0-9a-fA-F]+u|0u|[1-9][0-9]*u/),ident:new ok("ident",bL.token,/[a-zA-Z][0-9a-zA-Z_]*/),and:new ok("and",bL.token,"&"),and_and:new ok("and_and",bL.token,"&&"),arrow:new ok("arrow ",bL.token,"->"),attr:new ok("attr",bL.token,"@"),attr_left:new ok("attr_left",bL.token,"[["),attr_right:new ok("attr_right",bL.token,"]]"),forward_slash:new ok("forward_slash",bL.token,"/"),bang:new ok("bang",bL.token,"!"),bracket_left:new ok("bracket_left",bL.token,"["),bracket_right:new ok("bracket_right",bL.token,"]"),brace_left:new ok("brace_left",bL.token,"{"),brace_right:new ok("brace_right",bL.token,"}
2"),colon:new ok("colon",bL.token,":"),comma:new ok("comma",bL.token,","),equal:new ok("equal",bL.token,"="),equal_equal:new ok("equal_equal",bL.token,"=="),not_equal:new ok("not_equal",bL.token,"!="),greater_than:new ok("greater_than",bL.token,">"),greater_than_equal:new ok("greater_than_equal",bL.token,">="),shift_right:new ok("shift_right",bL.token,">>"),less_than:new ok("less_than",bL.token,"<"),less_than_equal:new ok("less_than_equal",bL.token,"<="),shift_left:new ok("shift_left",bL.token,"<<"),modulo:new ok("modulo",bL.token,"%"),minus:new ok("minus",bL.token,"-"),minus_minus:new ok("minus_minus",bL.token,"--"),period:new ok("period",bL.token,"."),plus:new ok("plus",bL.token,"+"),plus_plus:new ok("plus_plus",bL.token,"++"),or:new ok("or",bL.token,"|"),or_or:new ok("or_or",bL.token,"||"),paren_left:new ok("paren_left",bL.token,"("),paren_right:new ok("paren_right",bL.token,")"),semicolon:new ok("semicolon",bL.token,";"),star:new ok("star",bL.token,"*"),tilde:new ok("tilde",bL.token,"~"),underscore:new ok("underscore",bL.token,"_"),xor:new ok("xor",bL.token,"^"),plus_equal:new ok("plus_equal",bL.token,"+="),minus_equal:new ok("minus_equal",bL.token,"-="),times_equal:new ok("times_equal",bL.token,"*="),division_equal:new ok("division_equal",bL.token,"/="),modulo_equal:new ok("modulo_equal",bL.token,"%="),and_equal:new ok("and_equal",bL.token,"&="),or_equal:new ok("or_equal",bL.token,"|="),xor_equal:new ok("xor_equal",bL.token,"^="),shift_right_equal:new ok("shift_right_equal",bL.token,">>="),shift_left_equal:new ok("shift_left_equal",bL.token,"<<=")},ak.storage_class=[vL.keywords.function,vL.keywords.private,vL.keywords.workgroup,vL.keywords.uniform,vL.keywords.storage],ak.access_mode=[vL.keywords.read,vL.keywords.write,vL.keywords.read_write],ak.sampler_type=[vL.keywords.sampler,vL.keywords.sampler_comparison],ak.sampled_texture_type=[vL.keywords.texture_1d,vL.keywords.texture_2d,vL.keywords.texture_2d_array,vL.keywords.texture_3d,vL.keywords.texture_cube,vL.keywords.texture_cube_array],ak.multisampled_texture_type=[vL.keywords.texture_multisampled_2d],ak.storage_texture_type=[vL.keywords.texture_storage_1d,vL.keywords.texture_storage_2d,vL.keywords.texture_storage_2d_array,vL.keywords.texture_storage_3d],ak.depth_texture_type=[vL.keywords.texture_depth_2d,vL.keywords.texture_depth_2d_array,vL.keywords.texture_depth_cube,vL.keywords.texture_depth_cube_array,vL.keywords.texture_depth_multisampled_2d],ak.texture_external_type=[vL.keywords.texture_external],ak.any_texture_type=[...vL.sampled_texture_type,...vL.multisampled_texture_type,...vL.storage_texture_type,...vL.depth_texture_type,...vL.texture_external_type],ak.texel_format=[vL.keywords.r8unorm,vL.keywords.r8snorm,vL.keywords.r8uint,vL.keywords.r8sint,vL.keywords.r16uint,vL.keywords.r16sint,vL.keywords.r16float,vL.keywords.rg8unorm,vL.keywords.rg8snorm,vL.keywords.rg8uint,vL.keywords.rg8sint,vL.keywords.r32uint,vL.keywords.r32sint,vL.keywords.r32float,vL.keywords.rg16uint,vL.keywords.rg16sint,vL.keywords.rg16float,vL.keywords.rgba8unorm,vL.keywords.rgba8unorm_srgb,vL.keywords.rgba8snorm,vL.keywords.rgba8uint,vL.keywords.rgba8sint,vL.keywords.bgra8unorm,vL.keywords.bgra8unorm_srgb,vL.keywords.rgb10a2unorm,vL.keywords.rg11b10float,vL.keywords.rg32uint,vL.keywords.rg32sint,vL.keywords.rg32float,vL.keywords.rgba16uint,vL.keywords.rgba16sint,vL.keywords.rgba16float,vL.keywords.rgba32uint,vL.keywords.rgba32sint,vL.keywords.rgba32float],ak.const_literal=[vL.tokens.int_literal,vL.tokens.uint_literal,vL.tokens.decimal_float_literal,vL.tokens.hex_float_literal,vL.keywords.true,vL.keywords.false],ak.literal_or_ident=[vL.tokens.ident,vL.tokens.int_literal,vL.tokens.uint_literal,vL.tokens.decimal_float_literal,vL.tokens.hex_float_literal],ak.element_count_expression=[vL.tokens.int_literal,vL.tokens.uint_literal,vL.tokens.ident],ak.template_types=[vL.keywords.vec2,vL.keywords.vec3,vL.keywords.vec4,vL.keywords.mat2x2,vL.keywords.mat2x3,vL.keywords.mat2x4,vL.keywords.mat3x2,vL.keywords.mat3x3,vL.keywords.mat3x4,vL.keywords.mat4x2,vL.keywords.mat4x3,vL.keywords.mat4x4,vL.keywords.atomic,vL.keywords.bitcast,...vL.any_texture_type],ak.attribute_name=[vL.tokens.ident,vL.keywords.block],ak.assignment_operators=[vL.tokens.equal,vL.tokens.plus_equal,vL.tokens.minus_equal,vL.tokens.times_equal,vL.tokens.division_equal,vL.tokens.modulo_equal,vL.tokens.and_equal,vL.tokens.or_equal,vL.tokens.xor_equal,vL.tokens.shift_right_equal,vL.tokens.shift_left_equal],ak.increment_operators=[vL.tokens.plus_plus,vL.tokens.minus_minu
2s];class lk{constructor(t,e,n){this.type=t,this.lexeme=e,this.line=n}toString(){return this.lexeme}isTemplateType(){return-1!=ak.template_types.indexOf(this.type)}isArrayType(){return this.type==ak.keywords.array}isArrayOrTemplateType(){return this.isArrayType()||this.isTemplateType()}}class ck{constructor(t){this._tokens=[],this._start=0,this._current=0,this._line=1,this._source=null!==t&&void 0!==t?t:""}scanTokens(){for(;!this._isAtEnd();)if(this._start=this._current,!this.scanToken())throw`Invalid syntax at line ${this._line}`;return this._tokens.push(new lk(ak.eof,"",this._line)),this._tokens}scanToken(){let t=this._advance();if("\n"==t)return this._line++,!0;if(this._isWhitespace(t))return!0;if("/"==t){if("/"==this._peekAhead()){for(;"\n"!=t;){if(this._isAtEnd())return!0;t=this._advance()}return this._line++,!0}if("*"==this._peekAhead()){this._advance();let e=1;for(;e>0;){if(this._isAtEnd())return!0;if(t=this._advance(),"\n"==t)this._line++;else if("*"==t){if("/"==this._peekAhead()&&(this._advance(),e--,0==e))return!0}else"/"==t&&"*"==this._peekAhead()&&(this._advance(),e++)}return!0}}let e=ak.none;for(;;){let n=this._findType(t);const i=this._peekAhead();if(">"==t&&(">"==i||"="==i)){let t=!1,e=this._tokens.length-1;for(let n=0;n<5&&e>=0;++n,--e)if(this._tokens[e].type===ak.tokens.less_than){e>0&&this._tokens[e-1].isArrayOrTemplateType()&&(t=!0);break}if(t)return this._addToken(n),!0}if(n===ak.none){let i=t,r=0;const s=2;for(let t=0;t<s;++t)if(i+=this._peekAhead(t),n=this._findType(i),n!==ak.none){r=t;break}if(n===ak.none)return e!==ak.none&&(this._current--,this._addToken(e),!0);t=i,this._current+=r+1}if(e=n,this._isAtEnd())break;t+=this._advance()}return e!==ak.none&&(this._addToken(e),!0)}_findType(t){for(const e in ak.keywords){const n=ak.keywords[e];if(this._match(t,n.rule))return n}for(const e in ak.tokens){const n=ak.tokens[e];if(this._match(t,n.rule))return n}return ak.none}_match(t,e){if("string"===typeof e){if(e==t)return!0}else{const n=e.exec(t);if(n&&0==n.index&&n[0]==t)return!0}return!1}_isAtEnd(){return this._current>=this._source.length}_isWhitespace(t){return" "==t||"\t"==t||"\r"==t}_advance(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this._source[this._current];return t=t||0,t++,this._current+=t,e}_peekAhead(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t=t||0,this._current+t>=this._source.length?"\0":this._source[this._current+t]}_addToken(t){const e=this._source.substring(this._start,this._current);this._tokens.push(new lk(t,e,this._line))}}class uk{constructor(){this._tokens=[],this._current=0,this._context=new sL}parse(t){this._initialize(t);let e=[];for(;!this._isAtEnd();){const t=this._global_decl_or_directive();if(!t)break;e.push(t)}return e}_initialize(t){if(t)if("string"==typeof t){const e=new ck(t);this._tokens=e.scanTokens()}else this._tokens=t;else this._tokens=[];this._current=0}_error(t,e){return console.error(t,e),{token:t,message:e,toString:function(){return`${e}`}}}_isAtEnd(){return this._current>=this._tokens.length||this._peek().type==ak.eof}_match(t){if(t instanceof ok)return!!this._check(t)&&(this._advance(),!0);for(let e=0,n=t.length;e<n;++e){const n=t[e];if(this._check(n))return this._advance(),!0}return!1}_consume(t,e){if(this._check(t))return this._advance();throw this._error(this._peek(),e)}_check(t){if(this._isAtEnd())return!1;const e=this._peek();if(t instanceof Array){let n=e.type;return-1!=t.indexOf(n)}return e.type==t}_advance(){return this._isAtEnd()||this._current++,this._previous()}_peek(){return this._tokens[this._current]}_previous(){return this._tokens[this._current-1]}_global_decl_or_directive(){for(;this._match(ak.tokens.semicolon)&&!this._isAtEnd(););if(this._match(ak.keywords.alias)){const t=this._type_alias();return this._consume(ak.tokens.semicolon,"Expected ';'"),t}if(this._match(ak.keywords.enable)){const t=this._enable_directive();return this._consume(ak.tokens.semicolon,"Expected ';'"),t}const t=this._attribute();if(this._check(ak.keywords.var)){const e=this._global_variable_decl();return null!=e&&(e.attributes=t),this._consume(ak.tokens.semicolon,"Expected ';'."),e}if(this._check(ak.keywords.override)){const e=this._override_variable_decl();return null!=e&&(e.attributes=t),this._consume(ak.tokens.semicolon,"Expected ';'."),e}if(this._check(ak.keywords.let)){const e=this._global_let_decl();return null!=e&&(e.attributes=t),this._consume(ak.tokens.semicolon,"Expected ';'."),e}if(this._check(ak.keywords.const)){const e=this._global_const_decl();return null!=e&&(e.attributes=t),this._consume(ak.tokens.semicolon,"Expected ';'."),e}if(this._check(ak.keywords.struct)){const e=this._struct_decl();return null!=e&&(e.attributes=t),e}if(this._check(ak.keywords.fn)){const e=this._function_decl();return null!=e&&(e.attributes=t),e}return null}
vendor: 29,739 bytes, line 2
2_function_decl(){if(!this._match(ak.keywords.fn))return null;const t=this._consume(ak.tokens.ident,"Expected function name.").toString();this._consume(ak.tokens.paren_left,"Expected '(' for function arguments.");const e=[];if(!this._check(ak.tokens.paren_right))do{if(this._check(ak.tokens.paren_right))break;const t=this._attribute(),n=this._consume(ak.tokens.ident,"Expected argument name.").toString();this._consume(ak.tokens.colon,"Expected ':' for argument type.");const i=this._attribute(),r=this._type_decl();null!=r&&(r.attributes=i,e.push(new nk(n,r,t)))}while(this._match(ak.tokens.comma));this._consume(ak.tokens.paren_right,"Expected ')' after function arguments.");let n=null;if(this._match(ak.tokens.arrow)){const t=this._attribute();n=this._type_decl(),null!=n&&(n.attributes=t)}const i=this._compound_statement();return new lL(t,e,n,i)}_compound_statement(){const t=[];for(this._consume(ak.tokens.brace_left,"Expected '{' for block.");!this._check(ak.tokens.brace_right);){const e=this._statement();null!==e&&t.push(e)}return this._consume(ak.tokens.brace_right,"Expected '}' for block."),t}_statement(){for(;this._match(ak.tokens.semicolon)&&!this._isAtEnd(););if(this._check(ak.keywords.if))return this._if_statement();if(this._check(ak.keywords.switch))return this._switch_statement();if(this._check(ak.keywords.loop))return this._loop_statement();if(this._check(ak.keywords.for))return this._for_statement();if(this._check(ak.keywords.while))return this._while_statement();if(this._check(ak.keywords.continuing))return this._continuing_statement();if(this._check(ak.keywords.static_assert))return this._static_assert_statement();if(this._check(ak.tokens.brace_left))return this._compound_statement();let t=null;return t=this._check(ak.keywords.return)?this._return_statement():this._check([ak.keywords.var,ak.keywords.let,ak.keywords.const])?this._variable_statement():this._match(ak.keywords.discard)?new IL:this._match(ak.keywords.break)?new LL:this._match(ak.keywords.continue)?new kL:this._increment_decrement_statement()||this._func_call_statement()||this._assignment_statement(),null!=t&&this._consume(ak.tokens.semicolon,"Expected ';' after statement."),t}_static_assert_statement(){if(!this._match(ak.keywords.static_assert))return null;let t=this._optional_paren_expression();return new cL(t)}_while_statement(){if(!this._match(ak.keywords.while))return null;let t=this._optional_paren_expression();const e=this._compound_statement();return new uL(t,e)}_continuing_statement(){if(!this._match(ak.keywords.continuing))return null;const t=this._compound_statement();return new hL(t)}_for_statement(){if(!this._match(ak.keywords.for))return null;this._consume(ak.tokens.paren_left,"Expected '('.");const t=this._check(ak.tokens.semicolon)?null:this._for_init();this._consume(ak.tokens.semicolon,"Expected ';'.");const e=this._check(ak.tokens.semicolon)?null:this._short_circuit_or_expression();this._consume(ak.tokens.semicolon,"Expected ';'.");const n=this._check(ak.tokens.paren_right)?null:this._for_increment();this._consume(ak.tokens.paren_right,"Expected ')'.");const i=this._compound_statement();return new dL(t,e,n,i)}_for_init(){return this._variable_statement()||this._func_call_statement()||this._assignment_statement()}_for_increment(){return this._func_call_statement()||this._increment_decrement_statement()||this._assignment_statement()}_variable_statement(){if(this._check(ak.keywords.var)){const t=this._variable_decl();if(null===t)throw this._error(this._peek(),"Variable declaration expected.");let e=null;return this._match(ak.tokens.equal)&&(e=this._short_circuit_or_expression()),new pL(t.name,t.type,t.storage,t.access,e)}if(this._match(ak.keywords.let)){const t=this._consume(ak.tokens.ident,"Expected name for let.").toString();let e=null;if(this._match(ak.tokens.colon)){const t=this._attribute();e=this._type_decl(),null!=e&&(e.attributes=t)}this._consume(ak.tokens.equal,"Expected '=' for let.");const n=this._short_circuit_or_expression();return new gL(t,e,null,null,n)}if(this._match(ak.keywords.const)){const t=this._consume(ak.tokens.ident,"Expected name for const.").toString();let e=null;if(this._match(ak.tokens.colon)){const t=this._attribute();e=this._type_decl(),null!=e&&(e.attributes=t)}this._consume(ak.tokens.equal,"Expected '=' for const.");const n=this._short_circuit_or_expression();return new mL(t,e,null,null,n)}return null}_increment_decrement_statement(){const t=this._current,e=this._unary_expression();if(null==e)return null;if(!this._check(ak.increment_operators))return this._current=t,null;const n=this._consume(ak.increment_operators,"Expected increment operator");return new EL(n.type===ak.tokens.plus_plus?_L.increment:_L.decrement,e)}_assignment_statement(){let t=null;if(this._check(ak.tokens.brace_right))return null;let e=this._match(ak.tokens.underscore);if(e||(t=this._unary_expression()),!e&&null==t)return null;const n=this._consume(ak.assignment_operators,"Expected assignment operator."),i=this._short_circuit_or_expression();return new xL(yL.parse(n.lexeme),t,i)}_func_call_statement(){if(!this._check(ak.tokens.ident))return null;const t=this._current,e=this._consume(ak.tokens.ident,"Expected function name."),n=this._argument_expression_list();return null===n?(this._current=t,null):new SL(e.lexeme,n)}_loop_statement(){if(!this._match(ak.keywords.loop))return null;this._consume(ak.tokens.brace_left,"Expected '{' for loop.");const t=[];let e=this._statement();for(;null!==e;){if(Array.isArray(e))for(let n of e)t.push(n);else t.push(e);e=this._statement()}let n=null;return this._match(ak.keywords.continuing)&&(n=this._compound_statement()),this._consume(ak.tokens.brace_right,"Expected '}' for loop."),new TL(t,n)}_switch_statement(){if(!this._match(ak.keywords.switch))return null;const t=this._optional_paren_expression();this._consume(ak.tokens.brace_left,"Expected '{' for switch.");const e=this._switch_body();if(null==e||0==e.length)throw this._error(this._previous(),"Expected 'case' or 'default'.");return this._consume(ak.tokens.brace_right,"Expected '}' for switch."),new CL(t,e)}_switch_body(){const t=[];if(this._match(ak.keywords.case)){const e=this._case_selectors();this._match(ak.tokens.colon),this._consume(ak.tokens.brace_left,"Exected '{' for switch case.");const n=this._case_body();this._consume(ak.tokens.brace_right,"Exected '}' for switch case."),t.push(new tk(e,n))}if(this._match(ak.keywords.default)){this._match(ak.tokens.colon),this._consume(ak.tokens.brace_left,"Exected '{' for switch default.");const e=this._case_body();this._consume(ak.tokens.brace_right,"Exected '}' for switch default."),t.push(new ek(e))}if(this._check([ak.keywords.default,ak.keywords.case])){const e=this._switch_body();t.push(e[0])}return t}_case_selectors(){var t,e,n,i;const r=[null!==(e=null===(t=this._shift_expression())||void 0===t?void 0:t.evaluate(this._context).toString())&&void 0!==e?e:""];for(;this._match(ak.tokens.comma);)r.push(null!==(i=null===(n=this._shift_expression())||void 0===n?void 0:n.evaluate(this._context).toString())&&void 0!==i?i:"");return r}_case_body(){if(this._match(ak.keywords.fallthrough))return this._consume(ak.tokens.semicolon,"Expected ';'"),[];let t=this._statement();if(null==t)return[];t instanceof Array||(t=[t]);const e=this._case_body();return 0==e.length?t:[...t,e[0]]}_if_statement(){if(!this._match(ak.keywords.if))return null;const t=this._optional_paren_expression(),e=this._compound_statement();let n=[];this._match_elseif()&&(n=this._elseif_statement(n));let i=null;return this._match(ak.keywords.else)&&(i=this._compound_statement()),new AL(t,e,n,i)}_match_elseif(){return this._tokens[this._current].type===ak.keywords.else&&this._tokens[this._current+1].type===ak.keywords.if&&(this._advance(),this._advance(),!0)}_elseif_statement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=this._optional_paren_expression(),n=this._compound_statement();return t.push(new ik(e,n)),this._match_elseif()&&this._elseif_statement(t),t}_return_statement(){if(!this._match(ak.keywords.return))return null;const t=this._short_circuit_or_expression();return new PL(t)}_short_circuit_or_expression(){let t=this._short_circuit_and_expr();for(;this._match(ak.tokens.or_or);)t=new JL(this._previous().toString(),t,this._short_circuit_and_expr());return t}_short_circuit_and_expr(){let t=this._inclusive_or_expression();for(;this._match(ak.tokens.and_and);)t=new JL(this._previous().toString(),t,this._inclusive_or_expression());return t}_inclusive_or_expression(){let t=this._exclusive_or_expression();for(;this._match(ak.tokens.or);)t=new JL(this._previous().toString(),t,this._exclusive_or_expression());return t}_exclusive_or_expression(){let t=this._and_expression();for(;this._match(ak.tokens.xor);)t=new JL(this._previous().toString(),t,this._and_expression());return t}_and_expression(){let t=this._equality_expression();for(;this._match(ak.tokens.and);)t=new JL(this._previous().toString(),t,this._equality_expression());return t}_equality_expression(){const t=this._relational_expression();return this._match([ak.tokens.equal_equal,ak.tokens.not_equal])?new JL(this._previous().toString(),t,this._relational_expression()):t}_relational_expression(){let t=this._shift_expression();for(;this._match([ak.tokens.less_than,ak.tokens.greater_than,ak.tokens.less_than_equal,ak.tokens.greater_than_equal]);)t=new JL(this._previous().toString(),t,this._shift_expression());return t}_shift_expression(){let t=this._additive_expression();for(;this._match([ak.tokens.shift_left,ak.tokens.shift_right]);)t=new JL(this._previous().toString(),t,this._additive_expression());return t}_additive_expression(){let t=this._multiplicative_expression();for(;this._match([ak.tokens.plus,ak.tokens.minus]);)t=new JL(this._previous().toString(),t,this._multiplicative_expression());return t}_multiplicative_expression(){let t=this._unary_expression();for(;this._match([ak.tokens.star,ak.tokens.forward_slash,ak.tokens.modulo]);)t=new JL(this._previous().toString(),t,this._unary_expression());return t}_unary_expression(){return this._match([ak.tokens.minus,ak.tokens.bang,ak.tokens.tilde,ak.tokens.star,ak.tokens.and])?new YL(this._previous().toString(),this._unary_expression()):this._singular_expression()}_singular_expression(){const t=this._primary_expression(),e=this._postfix_expression();return e&&(t.postfix=e),t}_postfix_expression(){if(this._match(ak.tokens.bracket_left)){const t=this._short_circuit_or_expression();this._consume(ak.tokens.bracket_right,"Expected ']'.");const e=this._postfix_expression();return e&&(t.postfix=e),t}if(this._match(ak.tokens.period)){const t=this._consume(ak.tokens.ident,"Expected member name."),e=this._postfix_expression(),n=new jL(t.lexeme);return e&&(n.postfix=e),n}return null}_getStruct(t){if(this._context.aliases.has(t)){return this._context.aliases.get(t).type}if(this._context.structs.has(t)){return this._context.structs.get(t)}return null}_primary_expression(){if(this._match(ak.tokens.ident)){const t=this._previous().toString();if(this._check(ak.tokens.paren_left)){const e=this._argument_expression_list(),n=this._getStruct(t);return null!=n?new VL(n,e):new WL(t,e)}if(this._context.constants.has(t)){const e=this._context.constants.get(t);return new GL(t,e.value)}return new $L(t)}if(this._match(ak.const_literal))return new HL(parseFloat(this._previous().toString()));if(this._check(ak.tokens.paren_left))return this._paren_expression();if(this._match(ak.keywords.bitcast)){this._consume(ak.tokens.less_than,"Expected '<'.");const t=this._type_decl();this._consume(ak.tokens.greater_than,"Expected '>'.");const e=this._paren_expression();return new qL(t,e)}const t=this._type_decl(),e=this._argument_expression_list();return new ZL(t,e)}_argument_expression_list(){if(!this._match(ak.tokens.paren_left))return null;const t=[];do{if(this._check(ak.tokens.paren_right))break;const e=this._short_circuit_or_expression();t.push(e)}while(this._match(ak.tokens.comma));return this._consume(ak.tokens.paren_right,"Expected ')' for agument list"),t}_optional_paren_expression(){this._match(ak.tokens.paren_left);const t=this._short_circuit_or_expression();return this._match(ak.tokens.paren_right),new XL([t])}_paren_expression(){this._consume(ak.tokens.paren_left,"Expected '('.");const t=this._short_circuit_or_expression();return this._consume(ak.tokens.paren_right,"Expected ')'."),new XL([t])}_struct_decl(){if(!this._match(ak.keywords.struct))return null;const t=this._consume(ak.tokens.ident,"Expected name for struct.").toString();this._consume(ak.tokens.brace_left,"Expected '{' for struct body.");const e=[];for(;!this._check(ak.tokens.brace_right);){const t=this._attribute(),n=this._consume(ak.tokens.ident,"Expected variable name.").toString();this._consume(ak.tokens.colon,"Expected ':' for struct member type.");const i=this._attribute(),r=this._type_decl();null!=r&&(r.attributes=i),this._check(ak.tokens.brace_right)?this._match(ak.tokens.comma):this._consume(ak.tokens.comma,"Expected ',' for struct member."),e.push(new rk(n,r,t))}this._consume(ak.tokens.brace_right,"Expected '}' after struct body.");const n=new OL(t,e);return this._context.structs.set(t,n),n}_global_variable_decl(){const t=this._variable_decl();return t&&this._match(ak.tokens.equal)&&(t.value=this._const_expression()),t}_override_variable_decl(){const t=this._override_decl();return t&&this._match(ak.tokens.equal)&&(t.value=this._const_expression()),t}_global_const_decl(){if(!this._match(ak.keywords.const))return null;const t=this._consume(ak.tokens.ident,"Expected variable name");let e=null;if(this._match(ak.tokens.colon)){const t=this._attribute();e=this._type_decl(),null!=e&&(e.attributes=t)}let n=null;if(this._match(ak.tokens.equal)){const t=this._short_circuit_or_expression();if(t instanceof VL)n=t;else if(t instanceof GL&&t.initializer instanceof VL)n=t.initializer;else try{const e=t.evaluate(this._context);n=new HL(e)}catch(vL){n=t}}const i=new mL(t.toString(),e,"","",n);return this._context.constants.set(i.name,i),i}_global_let_decl(){if(!this._match(ak.keywords.let))return null;const t=this._consume(ak.tokens.ident,"Expected variable name");let e=null;if(this._match(ak.tokens.colon)){const t=this._attribute();e=this._type_decl(),null!=e&&(e.attributes=t)}let n=null;return this._match(ak.tokens.equal)&&(n=this._const_expression()),new gL(t.toString(),e,"","",n)}_const_expression(){if(this._match(ak.const_literal))return new jL(this._previous().toString());const t=this._type_decl();this._consume(ak.tokens.paren_left,"Expected '('.");let e=[];for(;!this._check(ak.tokens.paren_right)&&(e.push(this._const_expression()),this._check(ak.tokens.comma));)this._advance();return this._consume(ak.tokens.paren_right,"Expected ')'."),new VL(t,e)}_variable_decl(){if(!this._match(ak.keywords.var))return null;let t="",e="";this._match(ak.tokens.less_than)&&(t=this._consume(ak.storage_class,"Expected storage_class.").toString(),this._match(ak.tokens.comma)&&(e=this._consume(ak.access_mode,"Expected access_mode.").toString()),this._consume(ak.tokens.greater_than,"Expected '>'."));const n=this._consume(ak.tokens.ident,"Expected variable name");let i=null;if(this._match(ak.tokens.colon)){const t=this._attribute();i=this._type_decl(),null!=i&&(i.attributes=t)}return new pL(n.toString(),i,t,e,null)}_override_decl(){if(!this._match(ak.keywords.override))return null;const t=this._consume(ak.tokens.ident,"Expected variable name");let e=null;if(this._match(ak.tokens.colon)){const t=this._attribute();e=this._type_decl(),null!=e&&(e.attributes=t)}return new fL(t.toString(),e,null)}_enable_directive(){const t=this._consume(ak.tokens.ident,"identity expected.");return new RL(t.toString())}_type_alias(){const t=this._consume(ak.tokens.ident,"identity expected.");this._consume(ak.tokens.equal,"Expected '=' for type alias.");let e=this._type_decl();if(null===e)throw this._error(this._peek(),"Expected Type for Alias.");this._context.aliases.has(e.name)&&(e=this._context.aliases.get(e.name).type);const n=new ML(t.toString(),e);return this._context.aliases.set(n.name,n),n}_type_decl(){if(this._check([ak.tokens.ident,...ak.texel_format,ak.keywords.bool,ak.keywords.f32,ak.keywords.i32,ak.keywords.u32])){const t=this._advance(),e=t.toString();return this._context.structs.has(e)?this._context.structs.get(e):this._context.aliases.has(e)?this._context.aliases.get(e).type:new NL(t.toString())}let t=this._texture_sampler_types();if(t)return t;if(this._check(ak.template_types)){let t=this._advance().toString(),e=null,n=null;return this._match(ak.tokens.less_than)&&(e=this._type_decl(),n=null,this._match(ak.tokens.comma)&&(n=this._consume(ak.access_mode,"Expected access_mode for pointer").toString()),this._consume(ak.tokens.greater_than,"Expected '>' for type.")),new DL(t,e,n)}if(this._match(ak.keywords.ptr)){let t=this._previous().toString();this._consume(ak.tokens.less_than,"Expected '<' for pointer.");const e=this._consume(ak.storage_class,"Expected storage_class for pointer");this._consume(ak.tokens.comma,"Expected ',' for pointer.");const n=this._type_decl();let i=null;return this._match(ak.tokens.comma)&&(i=this._consume(ak.access_mode,"Expected access_mode for pointer").toString()),this._consume(ak.tokens.greater_than,"Expected '>' for pointer."),new FL(t,e.toString(),n,i)}const e=this._attribute();if(this._match(ak.keywords.array)){let t=null,n=-1;const i=this._previous();if(this._match(ak.tokens.less_than)){t=this._type_decl(),this._context.aliases.has(t.name)&&(t=this._context.aliases.get(t.name).type);let e="";if(this._match(ak.tokens.comma)){e=this._shift_expression().evaluate(this._context).toString()}this._consume(ak.tokens.greater_than,"Expected '>' for array."),n=e?parseInt(e):0}return new BL(i.toString(),e,t,n)}return null}_texture_sampler_types(){if(this._match(ak.sampler_type))return new UL(this._previous().toString(),null,null);if(this._match(ak.depth_texture_type))return new UL(this._previous().toString(),null,null);if(this._match(ak.sampled_texture_type)||this._match(ak.multisampled_texture_type)){const t=this._previous();this._consume(ak.tokens.less_than,"Expected '<' for sampler type.");const e=this._type_decl();return this._consume(ak.tokens.greater_than,"Expected '>' for sampler type."),new UL(t.toString(),e,null)}if(this._match(ak.storage_texture_type)){const t=this._previous();this._consume(ak.tokens.less_than,"Expected '<' for sampler type.");const e=this._consume(ak.texel_format,"Invalid texel format.").toString();this._consume(ak.tokens.comma,"Expected ',' after texel format.");const n=this._consume(ak.access_mode,"Expected access mode for storage texture type.").toString();return this._consume(ak.tokens.greater_than,"Expected '>' for sampler type."),new UL(t.toString(),e,n)}return null}_attribute(){let t=[];for(;this._match(ak.tokens.attr);){const e=this._consume(ak.attribute_name,"Expected attribute name"),n=new sk(e.toString(),null);if(this._match(ak.tokens.paren_left)){if(n.value=this._consume(ak.literal_or_ident,"Expected attribute value").toString(),this._check(ak.tokens.comma)){this._advance();do{const t=this._consume(ak.literal_or_ident,"Expected attribute value").toString();n.value instanceof Array||(n.value=[n.value]),n.value.push(t)}while(this._match(ak.tokens.comma))}this._consume(ak.tokens.paren_right,"Expected ')'")}t.push(n)}for(;this._match(ak.tokens.attr_left);){if(!this._check(ak.tokens.attr_right))do{const e=this._consume(ak.attribute_name,"Expected attribute name"),n=new sk(e.toString(),null);if(this._match(ak.tokens.paren_left)){if(n.value=[this._consume(ak.literal_or_ident,"Expected attribute value").toString()],this._check(ak.tokens.comma)){this._advance();do{const t=this._consume(ak.literal_or_ident,"Expected attribute value").toString();n.value.push(t)}while(this._match(ak.tokens.comma))}this._consume(ak.tokens.paren_right,"Expected ')'")}t.push(n)}while(this._match(ak.tokens.comma));this._consume(ak.tokens.attr_right,"Expected ']]' after attribute declarations")}return 0==t.length?null:t}}class hk{constructor(t,e){this.name=t,this.attributes=e,this.size=0}get isArray(){return!1}get isStruct(){return!1}get isTemplate(){return!1}}class dk{constructor(t,e,n){this.name=t,this.type=e,this.attributes=n,this.offset=0,this.size=0}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray||this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}}class pk extends hk{constructor(t,e){super(t,e),this.members=[],this.align=0}get isStruct(){return!0}}class fk extends hk{constructor(t,e){super(t,e),this.count=0,this.stride=0}get isArray(){return!0}}class gk extends hk{constructor(t,e,n,i){super(t,n),this.format=e,this.access=i}get isTemplate(){return!0}}!function(t){t[t.Uniform=0]="Uniform",t[t.Storage=1]="Storage",t[t.Texture=2]="Texture",t[t.Sampler=3]="Sampler",t[t.StorageTexture=4]="StorageTexture"}(wL||(wL={}));class mk{constructor(t,e,n,i,r,s,o){this.name=t,this.type=e,this.group=n,this.binding=i,this.attributes=r,this.resourceType=s,this.access=o}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get size(){return this.type.size}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray||this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}}class _k{constructor(t,e){this.name=t,this.type=e}}class yk{constructor(t,e){this.align=t,this.size=e}}class vk{constructor(t,e,n,i){this.name=t,this.type=e,this.locationType=n,this.location=i,this.interpolation=null}}class bk{constructor(t,e,n,i){this.name=t,this.type=e,this.locationType=n,this.location=i}}class wk{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.stage=null,this.inputs=[],this.outputs=[],this.name=t,this.stage=e}}class Ek{constructor(){this.vertex=[],this.fragment=[],this.compute=[]}}class xk{constructor(t,e,n,i){this.name=t,this.type=e,this.attributes=n,this.id=i}}class Sk{constructor(t){this.uniforms=[],this.storage=[],this.textures=[],this.samplers=[],this.aliases=[],this.overrides=[],this.structs=[],this.entry=new Ek,this._types=new Map,t&&this.update(t)}_isStorageTexture(t){return"texture_storage_1d"==t.name||"texture_storage_2d"==t.name||"texture_storage_2d_array"==t.name||"texture_storage_3d"==t.name}update(t){const e=(new uk).parse(t);for(const n of e)if(n instanceof OL){const t=this._getTypeInfo(n,null);t instanceof pk&&this.structs.push(t)}else if(n instanceof ML)this.aliases.push(this._getAliasInfo(n));else if(n instanceof fL){const t=n,e=this._getAttributeNum(t.attributes,"id",0),i=null!=t.type?this._getTypeInfo(t.type,t.attributes):null;this.overrides.push(new xk(t.name,i,t.attributes,e))}else if(this._isUniformVar(n)){const t=n,e=this._getAttributeNum(t.attributes,"group",0),i=this._getAttributeNum(t.attributes,"binding",0),r=this._getTypeInfo(t.type,t.attributes),s=new mk(t.name,r,e,i,t.attributes,wL.Uniform,t.access);this.uniforms.push(s)}else if(this._isStorageVar(n)){const t=n,e=this._getAttributeNum(t.attributes,"group",0),i=this._getAttributeNum(t.attributes,"binding",0),r=this._getTypeInfo(t.type,t.attributes),s=this._isStorageTexture(r),o=new mk(t.name,r,e,i,t.attributes,s?wL.StorageTexture:wL.Storage,t.access);this.storage.push(o)}else if(this._isTextureVar(n)){const t=n,e=this._getAttributeNum(t.attributes,"group",0),i=this._getAttributeNum(t.attributes,"binding",0),r=this._getTypeInfo(t.type,t.attributes),s=this._isStorageTexture(r),o=new mk(t.name,r,e,i,t.attributes,s?wL.StorageTexture:wL.Texture,t.access);s?this.storage.push(o):this.textures.push(o)}else if(this._isSamplerVar(n)){const t=n,e=this._getAttributeNum(t.attributes,"group",0),i=this._getAttributeNum(t.attributes,"binding",0),r=this._getTypeInfo(t.type,t.attributes),s=new mk(t.name,r,e,i,t.attributes,wL.Sampler,t.access);this.samplers.push(s)}else if(n instanceof lL){const t=this._getAttribute(n,"vertex"),e=this._getAttribute(n,"fragment"),i=this._getAttribute(n,"compute"),r=t||e||i;if(r){const t=new wk(n.name,r.name);t.inputs=this._getInputs(n.args),t.outputs=this._getOutputs(n.returnType),this.entry[r.name].push(t)}}else;}getBindGroups(){const t=[];function e(e,n){e>=t.length&&(t.length=e+1),void 0===t[e]&&(t[e]=[]),n>=t[e].length&&(t[e].length=n+1)}for(const n of this.uniforms){e(n.group,n.binding);t[n.group][n.binding]=n}for(const n of this.storage){e(n.group,n.binding);t[n.group][n.binding]=n}for(const n of this.textures){e(n.group,n.binding);t[n.group][n.binding]=n}for(const n of this.samplers){e(n.group,n.binding);t[n.group][n.binding]=n}return t}_getOutputs(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(void 0===e&&(e=[]),t instanceof OL)this._getStructOutputs(t,e);else{const n=this._getOutputInfo(t);null!==n&&e.push(n)}return e}_getStructOutputs(t,e){for(const n of t.members)if(n.type instanceof OL)this._getStructOutputs(n.type,e);else{const t=this._getAttribute(n,"location")||this._getAttribute(n,"builtin");if(null!==t){const i=this._getTypeInfo(n.type,n.type.attributes),r=this._parseInt(t.value),s=new bk(n.name,i,t.name,r);e.push(s)}}}_getOutputInfo(t){const e=this._getAttribute(t,"location")||this._getAttribute(t,"builtin");if(null!==e){const n=this._getTypeInfo(t,t.attributes),i=this._parseInt(e.value);return new bk("",n,e.name,i)}return null}_getInputs(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;void 0===e&&(e=[]);for(const n of t)if(n.type instanceof OL)this._getStructInputs(n.type,e);else{const t=this._getInputInfo(n);null!==t&&e.push(t)}return e}_getStructInputs(t,e){for(const n of t.members)if(n.type instanceof OL)this._getStructInputs(n.type,e);else{const t=this._getInputInfo(n);null!==t&&e.push(t)}}_getInputInfo(t){const e=this._getAttribute(t,"location")||this._getAttribute(t,"builtin");if(null!==e){const n=this._getAttribute(t,"interpolation"),i=this._getTypeInfo(t.type,t.attributes),r=this._parseInt(e.value),s=new vk(t.name,i,e.name,r);return null!==n&&(s.interpolation=this._parseString(n.value)),s}return null}_parseString(t){return t instanceof Array&&(t=t[0]),t}_parseInt(t){t instanceof Array&&(t=t[0]);const e=parseInt(t);return isNaN(e)?t:e}_getAlias(t){for(const e of this.aliases)if(e.name==t)return e.type;return null}_getAliasInfo(t){return new _k(t.name,this._getTypeInfo(t.type,null))}_getTypeInfo(t,e){if(this._types.has(t))return this._types.get(t);if(t instanceof BL){const n=t,i=this._getTypeInfo(n.format,n.attributes),r=new fk(n.name,e);return r.format=i,r.count=n.count,this._types.set(t,r),this._updateTypeInfo(r),r}if(t instanceof OL){const n=t,i=new pk(n.name,e);for(const t of n.members){const e=this._getTypeInfo(t.type,t.attributes);i.members.push(new dk(t.name,e,t.attributes))}return this._types.set(t,i),this._updateTypeInfo(i),i}if(t instanceof UL){const n=t,i=n.format instanceof NL,r=n.format?i?this._getTypeInfo(n.format,null):new hk(n.format,null):null,s=new gk(n.name,r,e,n.access);return this._types.set(t,s),this._updateTypeInfo(s),s}if(t instanceof DL){const n=t,i=n.format?this._getTypeInfo(n.format,null):null,r=new gk(n.name,i,e,n.access);return this._types.set(t,r),this._updateTypeInfo(r),r}const n=new hk(t.name,e);return this._types.set(t,n),this._updateTypeInfo(n),n}_updateTypeInfo(t){var e,n;const i=this._getTypeSize(t);if(t.size=null!==(e=null===i||void 0===i?void 0:i.size)&&void 0!==e?e:0,t instanceof fk){const e=this._getTypeSize(t.format);t.stride=null!==(n=null===e||void 0===e?void 0:e.size)&&void 0!==n?n:0,this._updateTypeInfo(t.format)}t instanceof pk&&this._updateStructInfo(t)}_updateStructInfo(t){var e;let n=0,i=0,r=0,s=0;for(let o=0,a=t.members.length;o<a;++o){const a=t.members[o],l=this._getTypeSize(a);if(!l)continue;null!==(e=this._getAlias(a.type.name))&&void 0!==e||a.type;const c=l.align,u=l.size;n=this._roundUp(c,n+i),i=u,r=n,s=Math.max(s,c),a.offset=n,a.size=u,this._updateTypeInfo(a.type)}t.size=this._roundUp(s,r+i),t.align=s}_getTypeSize(t){var e;if(null===t||void 0===t)return null;const n=this._getAttributeNum(t.attributes,"size",0),i=this._getAttributeNum(t.attributes,"align",0);if(t instanceof dk&&(t=t.type),t instanceof hk){const e=this._getAlias(t.name);null!==e&&(t=e)}{const e=Sk._typeInfo[t.name];if(void 0!==e){const r="f16"===t.format?2:1;return new yk(Math.max(i,e.align/r),Math.max(n,e.size/r))}}{const e=Sk._typeInfo[t.name.substring(0,t.name.length-1)];if(e){const r="h"===t.name[t.name.length-1]?2:1;return new yk(Math.max(i,e.align/r),Math.max(n,e.size/r))}}if(t instanceof fk){let r=t,s=8,o=8;const a=this._getTypeSize(r.format);null!==a&&(o=a.size,s=a.align);return o=r.count*this._getAttributeNum(null!==(e=null===t||void 0===t?void 0:t.attributes)&&void 0!==e?e:null,"stride",this._roundUp(s,o)),n&&(o=n),new yk(Math.max(i,s),Math.max(n,o))}if(t instanceof pk){let e=0,r=0,s=0,o=0,a=0;for(const n of t.members){const t=this._getTypeSize(n.type);null!==t&&(e=Math.max(t.align,e),s=this._roundUp(t.align,s+o),o=t.size,a=s)}return r=this._roundUp(e,a+o),new yk(Math.max(i,e),Math.max(n,r))}return null}_isUniformVar(t){return t instanceof pL&&"uniform"==t.storage}_isStorageVar(t){return t instanceof pL&&"storage"==t.storage}_isTextureVar(t){return t instanceof pL&&null!==t.type&&-1!=Sk._textureTypes.indexOf(t.type.name)}
2_isSamplerVar(t){return t instanceof pL&&null!==t.type&&-1!=Sk._samplerTypes.indexOf(t.type.name)}_getAttribute(t,e){const n=t;if(!n||!n.attributes)return null;const i=n.attributes;for(let r of i)if(r.name==e)return r;return null}_getAttributeNum(t,e,n){if(null===t)return n;for(let i of t)if(i.name==e){let t=null!==i&&null!==i.value?i.value:n;return t instanceof Array&&(t=t[0]),"number"===typeof t?t:"string"===typeof t?parseInt(t):n}return n}_roundUp(t,e){return Math.ceil(e/t)*t}}function Tk(t){const e={attributes:[],bindings:[]};let n;try{n=function(t){try{return new Sk(t)}catch($c){if($c instanceof Error)throw $c;let e="WGSL parse error";throw"object"===typeof $c&&$c?.message&&(e+=`: ${$c.message} `),"object"===typeof $c&&$c?.token&&(e+=$c.token.line||""),new Error(e,{cause:$c})}}(t)}catch($c){return _A.error($c.message)(),e}for(const s of n.uniforms){const t=[];for(const e of s.type.members)t.push({name:e.name,type:Ck(e.type)});e.bindings.push({type:"uniform",name:s.name,location:s.binding,group:s.group,members:t})}const i=n.entry.vertex[0],r=i?.inputs.length||0;for(let s=0;s<r;s++){const t=i.inputs[s];if("location"===t.locationType){const n=Ck(t.type);e.attributes.push({name:t.name,location:t.location,type:n})}}return e}function Ck(t){return t.format?`${t.name}<${t.format.name}>`:t.name}Sk._typeInfo={f16:{align:2,size:2},i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},atomic:{align:4,size:4},vec2:{align:8,size:8},vec3:{align:16,size:12},vec4:{align:16,size:16},mat2x2:{align:8,size:16},mat3x2:{align:8,size:24},mat4x2:{align:8,size:32},mat2x3:{align:16,size:32},mat3x3:{align:16,size:48},mat4x3:{align:16,size:64},mat2x4:{align:16,size:32},mat3x4:{align:16,size:48},mat4x4:{align:16,size:64}},Sk._textureTypes=ak.any_texture_type.map((t=>t.name)),Sk._samplerTypes=ak.sampler_type.map((t=>t.name));class Ak{id;userData={};topology;bufferLayout=[];vertexCount;indices;attributes;constructor(t){this.id=t.id||wA("geometry"),this.topology=t.topology,this.indices=t.indices||null,this.attributes=t.attributes,this.vertexCount=t.vertexCount,this.bufferLayout=t.bufferLayout||[],this.indices&&OA(this.indices.usage===SA.INDEX)}destroy(){this.indices?.destroy();for(const t of Object.values(this.attributes))t.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(t){return t.byteLength/12}}function Pk(t,e){if(e instanceof Ak)return e;const n=function(t,e){if(!e.indices)return;const n=e.indices.value;return t.createBuffer({usage:SA.INDEX,data:n})}(t,e),{attributes:i,bufferLayout:r}=function(t,e){const n=[],i={};for(const[s,o]of Object.entries(e.attributes)){let e=s;switch(s){case"POSITION":e="positions";break;case"NORMAL":e="normals";break;case"TEXCOORD_0":e="texCoords";break;case"COLOR_0":e="colors"}i[e]=t.createBuffer({data:o.value,id:`${s}-buffer`});const{value:r,size:a,normalized:l}=o;n.push({name:e,format:OI(r,a,l)})}const r=e._calculateVertexCount(e.attributes,e.indices);return{attributes:i,bufferLayout:n,vertexCount:r}}(t,e);return new Ak({topology:e.topology||"triangle-list",bufferLayout:r,vertexCount:e.vertexCount,indices:n,attributes:i})}class Rk{modules;moduleUniforms;moduleBindings;moduleUniformsChanged;constructor(t){const e=Ib(Object.values(t).filter((t=>t.dependencies)));for(const n of e)t[n.name]=n;_A.log(1,"Creating ShaderInputs with modules",Object.keys(t))(),this.modules=t,this.moduleUniforms={},this.moduleBindings={};for(const[n,i]of Object.entries(t)){const t=n;this.moduleUniforms[t]=i.defaultUniforms||{},this.moduleBindings[t]={}}}destroy(){}setProps(t){for(const e of Object.keys(t)){const n=e,i=t[n],r=this.modules[n];if(!r){_A.warn(`Module ${e} not found`)();continue}const s=this.moduleUniforms[n],o=this.moduleBindings[n],a=r.getUniforms?.(i,this.moduleUniforms[n])||i,{uniforms:l,bindings:c}=GR(a);this.moduleUniforms[n]={...s,...l},this.moduleBindings[n]={...o,...c}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){const t={};
vendor: 11,789 bytes, line 2
2for(const e of Object.values(this.moduleBindings))Object.assign(t,e);return t}getDebugTable(){const t={};for(const[e,n]of Object.entries(this.moduleUniforms))for(const[i,r]of Object.entries(n))t[`${e}.${i}`]={type:this.modules[e].uniformTypes?.[i],value:String(r)};return t}}class Mk extends xA{static defaultProps=(()=>({...xA.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0}))();get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(t,e){super(t,e,Mk.defaultProps)}}class Ik{static defaultProps={...WR.defaultProps};device;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};static getDefaultPipelineFactory(t){return t._lumaData.defaultPipelineFactory=t._lumaData.defaultPipelineFactory||new Ik(t),t._lumaData.defaultPipelineFactory}constructor(t){this.device=t}createRenderPipeline(t){const e={...WR.defaultProps,...t},n=this._hashRenderPipeline(e);if(!this._renderPipelineCache[n]){const t=this.device.createRenderPipeline({...e,id:e.id?`${e.id}-cached`:void 0});t.hash=n,this._renderPipelineCache[n]={pipeline:t,useCount:0}}return this._renderPipelineCache[n].useCount++,this._renderPipelineCache[n].pipeline}createComputePipeline(t){const e={...Mk.defaultProps,...t},n=this._hashComputePipeline(e);if(!this._computePipelineCache[n]){const t=this.device.createComputePipeline({...e,id:e.id?`${e.id}-cached`:void 0});t.hash=n,this._computePipelineCache[n]={pipeline:t,useCount:0}}return this._computePipelineCache[n].useCount++,this._computePipelineCache[n].pipeline}release(t){const e=t.hash,n=t instanceof Mk?this._computePipelineCache:this._renderPipelineCache;n[e].useCount--,0===n[e].useCount&&(n[e].pipeline.destroy(),delete n[e])}_hashComputePipeline(t){return`${this._getHash(t.shader.source)}`}_hashRenderPipeline(t){const e=this._getHash(t.vs.source),n=t.fs?this._getHash(t.fs.source):0,i=this._getHash(JSON.stringify(t.bufferLayout));if("webgl"===this.device.type)return`${e}/${n}V-BL${i}`;{const r=this._getHash(JSON.stringify(t.parameters));return`${e}/${n}V-T${t.topology}P${r}BL${i}`}}_getHash(t){return void 0===this._hashes[t]&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}}class Lk{static defaultProps={...OR.defaultProps};device;_cache={};static getDefaultShaderFactory(t){return t._lumaData.defaultShaderFactory||=new Lk(t),t._lumaData.defaultShaderFactory}constructor(t){this.device=t}createShader(t){const e=this._hashShader(t);let n=this._cache[e];if(!n){const i=this.device.createShader({...t,id:t.id?`${t.id}-cached`:void 0});this._cache[e]=n={shader:i,useCount:0}}return n.useCount++,n.shader}release(t){const e=this._hashShader(t),n=this._cache[e];n&&(n.useCount--,0===n.useCount&&(delete this._cache[e],n.shader.destroy()))}_hashShader(t){return`${t.stage}:${t.source}`}}let kk=null,Nk=null;class Ok{static defaultProps=(()=>({...WR.defaultProps,source:null,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],isInstanced:void 0,instanceCount:0,vertexCount:0,shaderInputs:void 0,pipelineFactory:void 0,shaderFactory:void 0,transformFeedback:void 0,shaderAssembler:Zb.getDefaultShaderAssembler(),debugShaders:void 0,disableWarnings:void 0}))();device;id;source;vs;fs;pipelineFactory;shaderFactory;userData={};parameters;topology;bufferLayout;isInstanced=void 0;instanceCount=0;vertexCount;indexBuffer=null;bufferAttributes={};constantAttributes={};bindings={};uniforms={};vertexArray;transformFeedback=null;pipeline;shaderInputs;_uniformStore;_attributeInfos={};_gpuGeometry=null;_getModuleUniforms;props;_pipelineNeedsUpdate="newly created";_needsRedraw="initializing";_destroyed=!1;_lastDrawTimestamp=-1;constructor(t,e){this.props={...Ok.defaultProps,...e},e=this.props,this.id=e.id||wA("model"),this.device=t,Object.assign(this.userData,e.userData);const n=Object.fromEntries(this.props.modules?.map((t=>[t.name,t]))||[]);this.setShaderInputs(e.shaderInputs||new Rk(n));const i=function(t){return{type:t.type,shaderLanguage:t.info.shadingLanguage,shaderLanguageVersion:t.info.shadingLanguageVersion,gpu:t.info.gpu,features:t.features}}(t),r=(this.props.modules?.length>0?this.props.modules:this.shaderInputs?.getModules())||[];if("webgpu"===this.device.type&&this.props.source){this.props.shaderLayout||=Tk(this.props.source);const{source:t,getUniforms:e}=this.props.shaderAssembler.assembleShader({platformInfo:i,...this.props,modules:r});this.source=t,this._getModuleUniforms=e}else{const{vs:t,fs:e,getUniforms:n}=this.props.shaderAssembler.assembleShaderPair({platformInfo:i,...this.props,modules:r});this.vs=t,this.fs=e,this._getModuleUniforms=n}this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,e.geometry&&this.setGeometry(e.geometry),this.pipelineFactory=e.pipelineFactory||Ik.getDefaultPipelineFactory(this.device),this.shaderFactory=e.shaderFactory||Lk.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=t.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),"isInstanced"in e&&(this.isInstanced=e.isInstanced),e.instanceCount&&this.setInstanceCount(e.instanceCount),e.vertexCount&&this.setVertexCount(e.vertexCount),e.indexBuffer&&this.setIndexBuffer(e.indexBuffer),e.attributes&&this.setAttributes(e.attributes),e.constantAttributes&&this.setConstantAttributes(e.constantAttributes),e.bindings&&this.setBindings(e.bindings),e.uniforms&&this.setUniforms(e.uniforms),e.moduleSettings&&this.updateModuleSettings(e.moduleSettings),e.transformFeedback&&(this.transformFeedback=e.transformFeedback),Object.seal(this)}destroy(){this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.shaderFactory.release(this.pipeline.fs),this._uniformStore.destroy(),this._gpuGeometry?.destroy(),this._destroyed=!0)}needsRedraw(){this._getBindingsUpdateTimestamp()>this._lastDrawTimestamp&&this.setNeedsRedraw("contents of bound textures or buffers updated");const t=this._needsRedraw;return this._needsRedraw=!1,t}setNeedsRedraw(t){this._needsRedraw||=t}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(t){let e;this.predraw();try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings,{disableWarnings:this.props.disableWarnings}),EA(this.uniforms)||this.pipeline.setUniformsWebGL(this.uniforms);const{indexBuffer:n}=this.vertexArray,i=n?n.byteLength/("uint32"===n.indexType?4:2):void 0;e=this.pipeline.draw({renderPass:t,vertexArray:this.vertexArray,isInstanced:this.isInstanced,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:i,transformFeedback:this.transformFeedback||void 0,parameters:this.parameters,topology:this.topology})}finally{this._logDrawCallEnd()}return this._logFramebuffer(t),e?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):this._needsRedraw="waiting for resource initialization",e}setGeometry(t){this._gpuGeometry?.destroy();const e=t&&Pk(this.device,t);e&&(this.setTopology(e.topology||"triangle-list"),this.bufferLayout=Dk(e.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(e)),this._gpuGeometry=e}setTopology(t){t!==this.topology&&(this.topology=t,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(t){this.bufferLayout=this._gpuGeometry?Dk(t,this._gpuGeometry.bufferLayout):t,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(t){rL(t,this.parameters,2)||(this.parameters=t,this._setPipelineNeedsUpdate("parameters"))}setInstanceCount(t){this.instanceCount=t,void 0===this.isInstanced&&t>0&&(this.isInstanced=!0),this.setNeedsRedraw("instanceCount")}setVertexCount(t){this.vertexCount=t,this.setNeedsRedraw("vertexCount")}setShaderInputs(t){this.shaderInputs=t,this._uniformStore=new iL(this.shaderInputs.modules);for(const e of Object.keys(this.shaderInputs.modules)){const t=this._uniformStore.getManagedUniformBuffer(this.device,e);this.bindings[`${e}Uniforms`]=t}this.setNeedsRedraw("shaderInputs")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setBindings(this.shaderInputs.getBindings()),this.setNeedsRedraw("shaderInputs")}setBindings(t){Object.assign(this.bindings,t),this.setNeedsRedraw("bindings")}setTransformFeedback(t){this.transformFeedback=t,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(t){this.vertexArray.setIndexBuffer(t),this.setNeedsRedraw("indexBuffer")}setAttributes(t,e){t.indices&&_A.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(const[n,i]of Object.entries(t)){const t=this.bufferLayout.find((t=>Fk(t).includes(n)));if(!t){_A.warn(`Model(${this.id}): Missing layout for buffer "${n}".`)();continue}const r=Fk(t);let s=!1;for(const e of r){const t=this._attributeInfos[e];t&&(this.vertexArray.setBuffer(t.location,i),s=!0)}s||(e?.disableWarnings??this.props.disableWarnings)||_A.warn(`Model(${this.id}): Ignoring buffer "${i.id}" for unknown attribute "${n}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(t,e){for(const[n,i]of Object.entries(t)){const t=this._attributeInfos[n];t?this.vertexArray.setConstantWebGL(t.location,i):(e?.disableWarnings??this.props.disableWarnings)||_A.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${n}"`)()}this.setNeedsRedraw("constants")}setUniforms(t){EA(t)||(this.pipeline.setUniformsWebGL(t),Object.assign(this.uniforms,t)),this.setNeedsRedraw("uniforms")}updateModuleSettings(t){const{bindings:e,uniforms:n}=GR(this._getModuleUniforms(t));Object.assign(this.bindings,e),Object.assign(this.uniforms,n),this.setNeedsRedraw("moduleSettings")}_getBindingsUpdateTimestamp(){let t=0;for(const e of Object.values(this.bindings))e instanceof gR?t=Math.max(t,e.texture.updateTimestamp):e instanceof SA||e instanceof YP?t=Math.max(t,e.updateTimestamp):e instanceof pR||(t=Math.max(t,e.buffer.updateTimestamp));return t}_setGeometryAttributes(t){const e={...t.attributes};for(const[n]of Object.entries(e))this.pipeline.shaderLayout.attributes.find((t=>t.name===n))||"positions"===n||delete e[n];this.vertexCount=t.vertexCount,this.setIndexBuffer(t.indices||null),this.setAttributes(t.attributes,{disableWarnings:!0}),this.setAttributes(e,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(t){this._pipelineNeedsUpdate||=t,this.setNeedsRedraw(t)}_updatePipeline(){if(this._pipelineNeedsUpdate){let t=null,e=null;this.pipeline&&(_A.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),t=this.pipeline.vs,e=this.pipeline.fs),this._pipelineNeedsUpdate=!1;const n=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debug:this.props.debugShaders});let i=null;this.source?i=n:this.fs&&(i=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debug:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:n,fs:i}),this._attributeInfos=XR(this.pipeline.shaderLayout,this.bufferLayout),t&&this.shaderFactory.release(t),e&&this.shaderFactory.release(e)}return this.pipeline}_lastLogTime=0;_logOpen=!1;_logDrawCallStart(){const t=_A.level>3?0:1e4;
2_A.level<2||Date.now()-this._lastLogTime<t||(this._lastLogTime=Date.now(),this._logOpen=!0,_A.group(2,`>>> DRAWING MODEL ${this.id}`,{collapsed:_A.level<=2})())}_logDrawCallEnd(){if(this._logOpen){const t=function(t,e){const n={},i="Values";if(0===t.attributes.length&&!t.varyings?.length)return{"No attributes or varyings":{[i]:"N/A"}};for(const r of t.attributes)r&&(n[`in ${r.location} ${r.name}: ${r.type}`]={[i]:r.stepMode||"vertex"});for(const r of t.varyings||[])n[`out ${r.location} ${r.name}`]={[i]:JSON.stringify(r.accessor)};return n}(this.pipeline.shaderLayout,this.id);_A.table(2,t)();const e=this.shaderInputs.getDebugTable();for(const[i,r]of Object.entries(this.uniforms))e[i]={value:r};_A.table(2,e)();const n=this._getAttributeDebugTable();_A.table(2,this._attributeInfos)(),_A.table(2,n)(),_A.groupEnd(2)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(t){const e=_A.get("framebuffer");if(this._drawCount++,!e||this._drawCount++>3&&this._drawCount%60)return;const n=t.props.framebuffer;n&&function(t,e){let{id:n,minimap:i,op
2aque:r,top:s="0",left:o="0",rgbaScale:a=1}=e;kk||(kk=document.createElement("canvas"),kk.id=n,kk.title=n,kk.style.zIndex="100",kk.style.position="absolute",kk.style.top=s,kk.style.left=o,kk.style.border="blue 1px solid",kk.style.transform="scaleY(-1)",document.body.appendChild(kk),Nk=kk.getContext("2d")),kk.width===t.width&&kk.height===t.height||(kk.width=t.width/2,kk.height=t.height/2,kk.style.width="400px",kk.style.height="400px");const l=t.device.readPixelsToArrayWebGL(t),c=Nk.createImageData(t.width,t.height);for(let u=0;u<l.length;u+=4)c.data[0+u+0]=l[u+0]*a,c.data[0+u+1]=l[u+1]*a,c.data[0+u+2]=l[u+2]*a,c.data[0+u+3]=r?255:l[u+3]*a;Nk.putImageData(c,0,0)}(n,{id:n.id,minimap:!0})}_getAttributeDebugTable(){const t={};for(const[e,n]of Object.entries(this._attributeInfos))t[n.location]={name:e,type:n.shaderType,values:this._getBufferOrConstantValues(this.vertexArray.attributes[n.location],n.bufferDataType)};if(this.vertexArray.indexBuffer){const{indexBuffer:e}=this.vertexArray,n="uint32"===e.indexType?new Uint32Array(e.debugData):new Uint16Array(e.debugData);t.indices={name:"indices",type:e.indexType,values:n.toString()}}return t}_getBufferOrConstantValues(t,e){const n=NI(e);return(t instanceof SA?new n(t.debugData):t).toString()}}function Dk(t,e){const n=[...t];for(const i of e){const t=n.findIndex((t=>t.name===i.name));t<0?n.push(i):n[t]=i}return n}function Fk(t){return t.attributes?t.attributes?.map((t=>t.attribute)):[t.name]}class Bk{device;model;transformFeedback;static isSupported(t){return"webgl"===t?.info?.type}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ok.defaultProps;OA(Bk.isSupported(t),"BufferTransform not yet implemented on WebGPU"),this.device=t,this.model=new Ok(this.device,{id:e.id||"buffer-transform-model",fs:e.fs||YI(),topology:e.topology||"point-list",...e}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:e.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(t){const e=this.device.beginRenderPass(t);this.model.draw(e),e.end()}update(){console.warn("TextureTransform#update() not implemented")}getBuffer(t){return this.transformFeedback.getBuffer(t)}readAsync(t){const e=this.getBuffer(t);if(e instanceof SA)return e.readAsync();const{buffer:n,byteOffset:i=0,byteLength:r=n.byteLength}=e;return n.readAsync(i,r)}}function Uk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const i=Math.fround(t),r=t-i;return e[n]=i,e[n+1]=r,e}function zk(t){return t-Math.fround(t)}function jk(t){const e=new Float32Array(32);for(let n=0;n<4;++n)for(let i=0;i<4;++i){const r=4*n+i;Uk(t[4*i+n],e,2*r)}return e}const Vk={ONE:1};const Wk={name:"fp64-arithmetic",vs:"uniform float ONE;\nvec2 split(float a) {\nconst float SPLIT = 4097.0;\nfloat t = a * SPLIT;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nfloat a_hi = t * ONE - (t - a);\nfloat a_lo = a * ONE - a_hi;\n#else\nfloat a_hi = t - (t - a);\nfloat a_lo = a - a_hi;\n#endif\nreturn vec2(a_hi, a_lo);\n}\nvec2 split2(vec2 a) {\nvec2 b = split(a.x);\nb.y += a.y;\nreturn b;\n}\nvec2 quickTwoSum(float a, float b) {\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nfloat sum = (a + b) * ONE;\nfloat err = b - (sum - a) * ONE;\n#else\nfloat sum = a + b;\nfloat err = b - (sum - a);\n#endif\nreturn vec2(sum, err);\n}\nvec2 twoSum(float a, float b) {\nfloat s = (a + b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nfloat v = (s * ONE - a) * ONE;\nfloat err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);\n#else\nfloat v = s - a;\nfloat err = (a - (s - v)) + (b - v);\n#endif\nreturn vec2(s, err);\n}\nvec2 twoSub(float a, float b) {\nfloat s = (a - b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nfloat v = (s * ONE - a) * ONE;\nfloat err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);\n#else\nfloat v = s - a;\nfloat err = (a - (s - v)) - (b + v);\n#endif\nreturn vec2(s, err);\n}
2\nvec2 twoSqr(float a) {\nfloat prod = a * a;\nvec2 a_fp64 = split(a);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nfloat err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *\na_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;\n#else\nfloat err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;\n#endif\nreturn vec2(prod, err);\n}\nvec2 twoProd(float a, float b) {\nfloat prod = a * b;\nvec2 a_fp64 = split(a);\nvec2 b_fp64 = split(b);\nfloat err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +\na_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;\nreturn vec2(prod, err);\n}\nvec2 sum_fp64(vec2 a, vec2 b) {\nvec2 s, t;\ns = twoSum(a.x, b.x);\nt = twoSum(a.y, b.y);\ns.y += t.x;\ns = quickTwoSum(s.x, s.y);\ns.y += t.y;\ns = quickTwoSum(s.x, s.y);\nreturn s;\n}\nvec2 sub_fp64(vec2 a, vec2 b) {\nvec2 s, t;\ns = twoSub(a.x, b.x);\nt = twoSub(a.y, b.y);\ns.y += t.x;\ns = quickTwoSum(s.x, s.y);\ns.y += t.y;\ns = quickTwoSum(s.x, s.y);\nreturn s;\n}\nvec2 mul_fp64(vec2 a, vec2 b) {\nvec2 prod = twoProd(a.x, b.x);\nprod.y += a.x * b.y;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\nprod = split2(prod);\n#endif\nprod = quickTwoSum(prod.x, prod.y);\nprod.y += a.y * b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\nprod = split2(prod);\n#endif\nprod = quickTwoSum(prod.x, prod.y);\nreturn prod;\n}\nvec2 div_fp64(vec2 a, vec2 b) {\nfloat xn = 1.0 / b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\nvec2 yn = mul_fp64(a, vec2(xn, 0));\n#else\nvec2 yn = a * xn;\n#endif\nfloat diff = (sub_fp64(a, mul_fp64(b, yn))).x;\nvec2 prod = twoProd(xn, diff);\nreturn sum_fp64(yn, prod);\n}\nvec2 sqrt_fp64(vec2 a) {\nif (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);\nif (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);\nfloat x = 1.0 / sqrt(a.x);\nfloat yn = a.x * x;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\nvec2 yn_sqr = twoSqr(yn) * ONE;\n#else\nvec2 yn_sqr = twoSqr(yn);\n#endif\nfloat diff = sub_fp64(a, yn_sqr).x;\nvec2 prod = twoProd(x * 0.5, diff);\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\nreturn sum_fp64(split(yn), prod);\n#else\nreturn sum_fp64(vec2(yn, 0.0), prod);\n#endif\n}\n",getUniforms:function(){return Vk},fp64ify:Uk,fp64LowPart:zk,fp64ifyMatrix4:jk};function $k(t){const{source:e,target:n,start:i=0,size:r,getData:s}=t,o=t.end||n.length,a=e.length,l=o-i;if(a>l)return void n.set(e.subarray(0,l),i);if(n.set(e,i),!s)return;let c=a;for(;c<l;){const t=s(c,e);for(let e=0;e<r;e++)n[i+c]=t[e]||0,c++}}function Gk(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`No defined attribute type for size "${t}"`)}}function Hk(t){switch(t){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw new Error("invalid type size")}}function qk(t){t.push(t.shift())}function Zk(t){let{device:e,source:n,target:i}=t;return(!i||i.byteLength<n.byteLength)&&(i?.destroy(),i=e.createBuffer({byteLength:n.byteLength,usage:n.usage})),i}function Xk(t){let{device:e,buffer:n,attribute:i,fromLength:r,toLength:s,fromStartIndices:o,getData:a=(t=>t)}=t;const l=i.doublePrecision&&i.value instanceof Float64Array?2:1,c=i.size*l,u=i.byteOffset,h=i.settings.bytesPerElement<4?u/i.settings.bytesPerElement*4:u,d=i.startIndices,p=o&&d,f=i.isConstant;if(!p&&n&&r>=s)return n;const g=i.value instanceof Float64Array?Float32Array:i.value.constructor,m=f?i.value:new g(i.getBuffer().readSyncWebGL(u,s*g.BYTES_PER_ELEMENT).buffer);if(i.settings.normalized&&!f){const t=a;a=(e,n)=>i.normalizeConstant(t(e,n))}const _=f?(t,e)=>a(m,e):(t,e)=>a(m.subarray(t+u,t+u+c),e),y=n?new Float32Array(n.readSyncWebGL(h,4*r).buffer):new Float32Array(0),v=new Float32Array(s);return function(t){let{source:e,target:n,size:i,getData:r,sourceStartIndices:s,targetStartIndices:o}=t;if(!s||!o)return $k({source:e,target:n,size:i,getData:r}),n;let a=0,l=0;const c=r&&((t,e)=>r(t+l,e)),u=Math.min(s.length,o.length);for(let h=1;h<u;h++){const t=s[h]*i,r=o[h]*i;$k({source:e.subarray(a,t),target:n,start:l,end:r,size:i,getData:c}),a=t,l=r}l<n.length&&$k({source:[],target:n,start:l,size:i,getData:c})}
vendor: 11,747 bytes, line 2
2({source:y,target:v,sourceStartIndices:o,targetStartIndices:d,size:c,getData:_}),(!n||n.byteLength<v.byteLength+h)&&(n?.destroy(),n=e.createBuffer({byteLength:v.byteLength+h,usage:35050})),n.write(v,h),n}class Kk{constructor(t){let{device:e,attribute:n,timeline:i}=t;this.buffers=[],this.currentLength=0,this.device=e,this.transition=new NT(i),this.attribute=n,this.attributeInTransition=function(t){const{device:e,settings:n,value:i}=t,r=new KI(e,n);return r.setData({value:i instanceof Float64Array?new Float64Array(0):new Float32Array(0),normalized:n.normalized}),r}(n),this.currentStartIndices=n.startIndices}get inProgress(){return this.transition.inProgress}start(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0;this.settings=t,this.currentStartIndices=this.attribute.startIndices,this.currentLength=function(t,e){const{doublePrecision:n,settings:i,value:r,size:s}=t,o=n&&r instanceof Float64Array?2:1;let a=0;const{shaderAttributes:l}=t.settings;if(l)for(const c of Object.values(l))a=Math.max(a,c.vertexOffset??0);return(i.noAlloc?r.length:(e+a)*s)*o}(this.attribute,e),this.transition.start({...t,duration:n})}update(){const t=this.transition.update();return t&&this.onUpdate(),t}setBuffer(t){this.attributeInTransition.setData({buffer:t,normalized:this.attribute.settings.normalized,value:this.attributeInTransition.value})}cancel(){this.transition.cancel()}delete(){this.cancel();for(const t of this.buffers)t.destroy();this.buffers.length=0}}const Yk="#version 300 es\n#define SHADER_NAME interpolation-transition-vertex-shader\n\nuniform float time;\nin ATTRIBUTE_TYPE aFrom;\nin ATTRIBUTE_TYPE aTo;\nout ATTRIBUTE_TYPE vCurrent;\n\nvoid main(void) {\n vCurrent = mix(aFrom, aTo, time);\n gl_Position = vec4(0.0);\n}\n",Jk="#version 300 es\n#define SHADER_NAME interpolation-transition-vertex-shader\n\nuniform float time;\nin ATTRIBUTE_TYPE aFrom;\nin ATTRIBUTE_TYPE aFrom64Low;\nin ATTRIBUTE_TYPE aTo;\nin ATTRIBUTE_TYPE aTo64Low;\nout ATTRIBUTE_TYPE vCurrent;\nout ATTRIBUTE_TYPE vCurrent64Low;\n\nvec2 mix_fp64(vec2 a, vec2 b, float x) {\n vec2 range = sub_fp64(b, a);\n return sum_fp64(a, mul_fp64(range, vec2(x, 0.0)));\n}\n\nvoid main(void) {\n for (int i=0; i<ATTRIBUTE_SIZE; i++) {\n vec2 value = mix_fp64(vec2(aFrom[i], aFrom64Low[i]), vec2(aTo[i], aTo64Low[i]), time);\n vCurrent[i] = value.x;\n vCurrent64Low[i] = value.y;\n }\n gl_Position = vec4(0.0);\n}\n";function Qk(t){return t.doublePrecision&&t.value instanceof Float64Array}const tN="#version 300 es\n#define SHADER_NAME spring-transition-vertex-shader\n\n#define EPSILON 0.00001\n\nuniform float stiffness;\nuniform float damping;\nin ATTRIBUTE_TYPE aPrev;\nin ATTRIBUTE_TYPE aCur;\nin ATTRIBUTE_TYPE aTo;\nout ATTRIBUTE_TYPE vNext;\nout float vIsTransitioningFlag;\n\nATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) {\n ATTRIBUTE_TYPE velocity = cur - prev;\n ATTRIBUTE_TYPE delta = dest - cur;\n ATTRIBUTE_TYPE spring = delta * stiffness;\n ATTRIBUTE_TYPE damper = velocity * -1.0 * damping;\n return spring + damper + velocity + cur;\n}\n\nvoid main(void) {\n bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON;\n vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0;\n\n vNext = getNextValue(aCur, aPrev, aTo);\n gl_Position = vec4(0, 0, 0, 1);\n gl_PointSize = 100.0;\n}\n",eN="#version 300 es\n#define SHADER_NAME spring-transition-is-transitioning-fragment-shader\n\nin float vIsTransitioningFlag;\n\nout vec4 fragColor;\n\nvoid main(void) {\n if (vIsTransitioningFlag == 0.0) {\n discard;\n }\n fragColor = vec4(1.0);\n}";const nN={interpolation:class extends Kk{constructor(t){let{device:e,attribute:n,timeline:i}=t;super({device:e,attribute:n,timeline:i}),this.type="interpolation",this.transform=function(t,e){const n=e.size,i=Gk(n),r=Hk(n),s=e.getBufferLayout();if(Qk(e))return new Bk(t,{vs:Jk,bufferLayout:[{name:"aFrom",byteStride:8*n,attributes:[{attribute:"aFrom",format:r,byteOffset:0},{attribute:"aFrom64Low",format:r,byteOffset:4*n}]},{name:"aTo",byteStride:8*n,attributes:[{attribute:"aTo",format:r,byteOffset:0},{attribute:"aTo64Low",format:r,byteOffset:4*n}]}],modules:[Wk],defines:{ATTRIBUTE_TYPE:i,ATTRIBUTE_SIZE:n},moduleSettings:{},varyings:["vCurrent","vCurrent64Low"],bufferMode:35980,disableWarnings:!0});return new Bk(t,{vs:Yk,bufferLayout:[{name:"aFrom",format:r},{name:"aTo",format:s.attributes[0].format}],defines:{ATTRIBUTE_TYPE:i},varyings:["vCurrent"],disableWarnings:!0})}(e,n)}start(t,e){const n=this.currentLength,i=this.currentStartIndices;if(super.start(t,e,t.duration),t.duration<=0)return void this.transition.cancel();const{buffers:r,attribute:s}=this;qk(r),r[0]=Xk({device:this.device,buffer:r[0],attribute:s,fromLength:n,toLength:this.currentLength,fromStartIndices:i,getData:t.enter}),r[1]=Zk({device:this.device,source:r[0],target:r[1]}),this.setBuffer(r[1]);const{transform:o}=this,a=o.model;let l=Math.floor(this.currentLength/s.size);Qk(s)&&(l/=2),a.setVertexCount(l),s.isConstant?(a.setAttributes({aFrom:r[0]}),a.setConstantAttributes({aTo:s.value})):a.setAttributes({aFrom:r[0],aTo:s.getBuffer()}),o.transformFeedback.setBuffers({vCurrent:r[1]})}onUpdate(){const{duration:t,easing:e}=this.settings,{time:n}=this.transition;let i=n/t;e&&(i=e(i));const{model:r}=this.transform;r.setUniforms({time:i}),this.transform.run({discard:!0})}delete(){super.delete(),this.transform.destroy()}},spring:class extends Kk{constructor(t){let{device:e,attribute:n,timeline:i}=t;super({device:e,attribute:n,timeline:i}),this.type="spring",this.texture=function(t){return t.createTexture({data:new Uint8Array(4),format:"rgba8unorm",mipmaps:!1,width:1,height:1})}(e),this.framebuffer=function(t,e){return t.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}(e,this.texture),this.transform=function(t,e){const n=Gk(e.size),i=Hk(e.size);return new Bk(t,{vs:tN,fs:eN,bufferLayout:[{name:"aPrev",format:i},{name:"aCur",format:i},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],defines:{ATTRIBUTE_TYPE:n},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}(e,n)}start(t,e){const n=this.currentLength,i=this.currentStartIndices;super.start(t,e);const{buffers:r,attribute:s}=this;for(let a=0;a<2;a++)r[a]=Xk({device:this.device,buffer:r[a],attribute:s,fromLength:n,toLength:this.currentLength,fromStartIndices:i,getData:t.enter});r[2]=Zk({device:this.device,source:r[0],target:r[2]}),this.setBuffer(r[1]);const{model:o}=this.transform;o.setVertexCount(Math.floor(this.currentLength/s.size)),s.isConstant?o.setConstantAttributes({aTo:s.value}):o.setAttributes({aTo:s.getBuffer()})}onUpdate(){const{buffers:t,transform:e,framebuffer:n,transition:i}=this,r=this.settings;e.model.setAttributes({aPrev:t[0],aCur:t[1]}),e.transformFeedback.setBuffers({vNext:t[2]}),e.model.setUniforms({stiffness:r.stiffness,damping:r.damping}),e.run({framebuffer:n,discard:!1,parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]}),qk(t),this.setBuffer(t[1]);this.device.readPixelsToArrayWebGL(n)[0]>0||i.end()}delete(){super.delete(),this.transform.destroy(),this.texture.destroy(),this.framebuffer.destroy()}}};class iN{constructor(t,e){let{id:n,timeline:i}=e;if(!t)throw new Error("AttributeTransitionManager is constructed without device");this.id=n,this.device=t,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(const t in this.transitions)this._removeTransition(t)}update(t){let{attributes:e,transitions:n,numInstances:i}=t;this.numInstances=i||1;for(const r in e){const t=e[r],i=t.getTransitionSetting(n);i&&this._updateAttribute(r,t,i)}for(const r in this.transitions){const t=e[r];t&&t.getTransitionSetting(n)||this._removeTransition(r)}}hasAttribute(t){const e=this.transitions[t];return e&&e.inProgress}getAttributes(){const t={};for(const e in this.transitions){const n=this.transitions[e];n.inProgress&&(t[e]=n.attributeInTransition)}return t}run(){if(0===this.numInstances)return!1;for(const e in this.transitions){this.transitions[e].update()&&(this.needsRedraw=!0)}const t=this.needsRedraw;return this.needsRedraw=!1,t}_removeTransition(t){this.transitions[t].delete(),delete this.transitions[t]}_updateAttribute(t,e,n){const i=this.transitions[t];let r=!i||i.type!==n.type;if(r){i&&this._removeTransition(t);const s=nN[n.type];s?this.transitions[t]=new s({attribute:e,timeline:this.timeline,device:this.device}):(vw.error(`unsupported transition type '${n.type}'`)(),r=!1)}(r||e.needsRedraw())&&(this.needsRedraw=!0,this.transitions[t].start(n,this.numInstances))}}const rN="attributeManager.invalidate";class sN{constructor(t){let{id:e="attribute-manager",stats:n,timeline:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.mergeBoundsMemoized=jw(NS),this.id=e,this.device=t,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=n,this.attributeTransitionManager=new iN(t,{id:`${e}-transitions`,timeline:i}),Object.seal(this)}finalize(){for(const t in this.attributes)this.attributes[t].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};const e=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!t.clearRedrawFlags,e&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(t){this._add(t)}addInstanced(t){this._add(t,{stepMode:"instance"})}remove(t){for(const e of t)void 0!==this.attributes[e]&&(this.attributes[e].delete(),delete this.attributes[e])}invalidate(t,e){const n=this._invalidateTrigger(t,e);fE(rN,this,t,n)}invalidateAll(t){for(const e in this.attributes)this.attributes[e].setNeedsUpdate(e,t);fE(rN,this,"all")}update(t){let{data:e,numInstances:n,startIndices:i=null,transitions:r,props:s={},buffers:o={},context:a={}}=t,l=!1;fE("attributeManager.updateStart",this),this.stats&&this.stats.get("Update Attributes").timeStart();for(const c in this.attributes){const t=this.attributes[c],r=t.settings.accessor;t.startIndices=i,t.numInstances=n,s[c]&&vw.removed(`props.${c}`,`data.attributes.${c}`)(),t.setExternalBuffer(o[c])||t.setBinaryValue("string"===typeof r?o[r]:void 0,e.startIndices)||"string"===typeof r&&!o[r]&&t.setConstantValue(s[r])||t.needsUpdate()&&(l=!0,this._updateAttribute({attribute:t,numInstances:n,data:e,props:s,context:a})),this.needsRedraw=this.needsRedraw||t.needsRedraw()}l&&fE("attributeManager.updateEnd",this,n),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:n,transitions:r})}updateTransition(){const{attributeTransitionManager:t}=this,e=t.run();return this.needsRedraw=this.needsRedraw||e,e}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(t){const e=t.map((t=>this.attributes[t]?.getBounds()));return this.mergeBoundsMemoized(e)}getChangedAttributes(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearChangedFlags:!1};const{attributes:e,attributeTransitionManager:n}=this,i={...n.getAttributes()};for(const r in e){const s=e[r];s.needsRedraw(t)&&!n.hasAttribute(r)&&(i[r]=s)}return i}getBufferLayouts(t){return Object.values(this.getAttributes()).map((e=>e.getBufferLayout(t)))}_add(t,e){for(const n in t){const i=t[n],r={...i,id:n,size:(i.isIndexed?1:i.size)||1,...e};this.attributes[n]=new KI(this.device,r)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){const t={};for(const e in this.attributes){this.attributes[e].getUpdateTriggers().forEac
2h((n=>{t[n]||(t[n]=[]),t[n].push(e)}))}this.updateTriggers=t}_invalidateTrigger(t,e){const{attributes:n,updateTriggers:i}=this,r=i[t];return r&&r.forEach((t=>{const i=n[t];i&&i.setNeedsUpdate(i.id,e)})),r}_updateAttribute(t){const{attribute:e,numInstances:n}=t;if(fE("attribute.updateStart",e),e.constant)return void e.setConstantValue(e.value);e.allocate(n)&&fE("attribute.allocate",e,n);e.updateBuffer(t)&&(this.needsRedraw=!0,fE("attribute.updateEnd",e,n))}}const oN=1e-5;function aN(t,e,n,i,r){const s=e-t;return(n-e)*r+-s*i+s+e}function lN(t,e){if(Array.isArray(t)){let n=0;for(let i=0;i<t.length;i++){const r=t[i]-e[i];n+=r*r}return Math.sqrt(n)}return Math.abs(t-e)}const cN={interpolation:class extends NT{get value(){return this._value}_onUpdate(){const{time:t,settings:{fromValue:e,toValue:n,duration:i,easing:r}}=this,s=r(t/i);this._value=aS(e,n,s)}},spring:class extends NT{get value(){return this._currValue}_onUpdate(){const{fromValue:t,toValue:e,damping:n,stiffness:i}=this.settings,{_prevValue:r=t,_currValue:s=t}=this;let o=function(t,e,n,i,r){if(Array.isArray(n)){const s=[];for(let o=0;o<n.length;o++)s[o]=aN(t[o],e[o],n[o],i,r);return s}return aN(t,e,n,i,r)}(r,s,e,n,i);const a=lN(o,e),l=lN(o,s);a<oN&&l<oN&&(o=e,this.end()),this._prevValue=s,this._currValue=o}}};class uN{constructor(t){this.transitions=new Map,this.timeline=t}get active(){return this.transitions.size>0}add(t,e,n,i){const{transitions:r}=this;if(r.has(t)){const n=r.get(t),{value:i=n.settings.fromValue}=n;e=i,this.remove(t)}if(!(i=XI(i)))return;const s=cN[i.type];if(!s)return void vw.error(`unsupported transition type '${i.type}'`)();const o=new s(this.timeline);o.start({...i,fromValue:e,toValue:n}),r.set(t,o)}remove(t){const{transitions:e}=this;e.has(t)&&(e.get(t).cancel(),e.delete(t))}update(){const t={};for(const[e,n]of this.transitions)n.update(),t[e]=n.value,n.inProgress||this.remove(e);return t}clear(){for(const t of this.transitions.keys())this.remove(t)}}function hN(t,e){const n=pN({newProps:t,oldProps:e,propTypes:t[aE],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),i=function(t,e){if(null===e)return"oldProps is null, initial diff";let n=!1;const{dataComparator:i,_dataDiff:r}=t;i?i(t.data,e.data)||(n="Data comparator detected a change"):t.data!==e.data&&(n="A new data container was supplied");n&&r&&(n=r(t.data,e.data)||n);return n}(t,e);let r=!1;return i||(r=function(t,e){if(null===e)return{all:!0};if("all"in t.updateTriggers){if(mN(t,e,"all"))return{all:!0}}const n={};let i=!1;for(const r in t.updateTriggers)if("all"!==r){mN(t,e,r)&&(n[r]=!0,i=!0)}return!!i&&n}(t,e)),{dataChanged:i,propsChanged:n,updateTriggersChanged:r,extensionsChanged:gN(t,e),transitionsChanged:dN(t,e)}}function dN(t,e){if(!t.transitions)return!1;const n={},i=t[aE];let r=!1;for(const s in t.transitions){const o=i[s],a=o&&o.type;("number"===a||"color"===a||"array"===a)&&fN(t[s],e[s],o)&&(n[s]=!0,r=!0)}return!!r&&n}function pN(t){let{newProps:e,oldProps:n,ignoreProps:i={},propTypes:r={},triggerName:s="props"}=t;if(n===e)return!1;if("object"!==typeof e||null===e)return`${s} changed shallowly`;if("object"!==typeof n||null===n)return`${s} changed shallowly`;for(const o of Object.keys(e))if(!(o in i)){if(!(o in n))return`${s}.${o} added`;const t=fN(e[o],n[o],r[o]);if(t)return`${s}.${o} ${t}`}for(const o of Object.keys(n))if(!(o in i)){if(!(o in e))return`${s}.${o} dropped`;if(!Object.hasOwnProperty.call(e,o)){const t=fN(e[o],n[o],r[o]);if(t)return`${s}.${o} ${t}`}}return!1}function fN(t,e,n){let i=n&&n.equal;return i&&!i(t,e,n)?"changed deeply":i||(i=t&&e&&t.equals,!i||i.call(t,e))?i||e===t?null:"changed shallowly":"changed deeply"}function gN(t,e){if(null===e)return!0;const n=e.extensions,{extensions:i}=t;if(i===n)return!1;if(!n||!i)return!0;if(i.length!==n.length)return!0;for(let r=0;r<i.length;r++)if(!i[r].equals(n[r]))return!0;return!1}function mN(t,e,n){let i=t.updateTriggers[n];i=void 0===i||null===i?{}:i;let r=e.updateTriggers[n];r=void 0===r||null===r?{}:r;return pN({oldProps:r,newProps:i,triggerName:n})}function _N(t){if(!function(t){return null!==t&&"object"===typeof t}(t))throw new Error("count(): argument not an object");
2if("function"===typeof t.count)return t.count();if(Number.isFinite(t.size))return t.size;if(Number.isFinite(t.length))return t.length;if(function(t){return null!==t&&"object"===typeof t&&t.constructor===Object}(t))return Object.keys(t).length;throw new Error("count(): argument not a container")}function yN(t,e){if(!e)return t;const n={...t,...e};if("defines"in e&&(n.defines={...t.defines,...e.defines}),"modules"in e&&(n.modules=(t.modules||[]).concat(e.modules),e.modules.some((t=>"project64"===t.name)))){const t=n.modules.findIndex((t=>"project32"===t.name));t>=0&&n.modules.splice(t,1)}if("inject"in e)if(t.inject){const i={...t.inject};for(const t in e.inject)i[t]=(i[t]||"")+e.inject[t];n.inject=i}else n.inject=e.inject;return n}const vN=[0,0,0];function bN(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=e.projectPosition(t);if(n&&e instanceof kT){const[n,r,s=0]=t,o=e.getDistanceScales([n,r]);i[2]=s*o.unitsPerMeter[2]}return i}function wN(t,e){let{viewport:n,modelMatrix:i,coordinateSystem:r,coordinateOrigin:s,offsetMode:o}=e,[a,l,c=0]=t;switch(i&&([a,l,c]=Mw([],[a,l,c,1],i)),r){case bw.LNGLAT:return bN([a,l,c],n,o);case bw.LNGLAT_OFFSETS:return bN([a+s[0],l+s[1],c+(s[2]||0)],n,o);case bw.METER_OFFSETS:return bN(dT(s,[a,l,c]),n,o);case bw.CARTESIAN:default:return n.isGeospatial?[a+s[0],l+s[1],c+s[2]]:n.projectPosition([a,l,c])}}function EN(t,e){const{viewport:n,coordinateSystem:i,coordinateOrigin:r,modelMatrix:s,fromCoordinateSystem:o,fromCoordinateOrigin:a}=function(t){const{viewport:e,modelMatrix:n,coordinateOrigin:i}=t;let{coordinateSystem:r,fromCoordinateSystem:s,fromCoordinateOrigin:o}=t;return r===bw.DEFAULT&&(r=e.isGeospatial?bw.LNGLAT:bw.CARTESIAN),void 0===s&&(s=r),void 0===o&&(o=i),{viewport:e,coordinateSystem:r,coordinateOrigin:i,modelMatrix:n,fromCoordinateSystem:s,fromCoordinateOrigin:o}}(e),{autoOffset:l=!0}=e,{geospatialOrigin:c=vN,shaderCoordinateOrigin:u=vN,offsetMode:h=!1}=l?Zw(n,i,r):{},d=wN(t,{viewport:n,modelMatrix:s,coordinateSystem:o,coordinateOrigin:a,offsetMode:h});if(h){const t=n.projectPosition(c||u);ES(d,d,t)}return d}const xN={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},SN={};const TN={boolean:{validate:(t,e)=>!0,equal:(t,e,n)=>Boolean(t)===Boolean(e)},number:{validate:(t,e)=>Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)},color:{validate:(t,e)=>e.optional&&!t||PN(t)&&(3===t.length||4===t.length),equal:(t,e,n)=>AT(t,e,1)},accessor:{validate(t,e){const n=RN(t);return"function"===n||n===RN(e.value)},equal:(t,e,n)=>"function"===typeof e||AT(t,e,1)},array:{validate:(t,e)=>e.optional&&!t||PN(t),equal(t,e,n){const{compare:i}=n,r=Number.isInteger(i)?i:i?1:0;return i?AT(t,e,r):t===e}},object:{equal(t,e,n){if(n.ignore)return!0;const{compare:i}=n,r=Number.isInteger(i)?i:i?1:0;return i?AT(t,e,r):t===e}},function:{validate:(t,e)=>e.optional&&!t||"function"===typeof t,equal:(t,e,n)=>!n.compare&&!1!==n.ignore||t===e},data:{transform:(t,e,n)=>{if(!t)return t;const{dataTransform:i}=n.props;return i?i(t):"string"===typeof t.shape&&t.shape.endsWith("-table")&&Array.isArray(t.data)?t.data:t}},image:{transform:(t,e,n)=>{const i=n.context;return i&&i.device?function(t,e,n,i){if(n instanceof YP)return n;n.constructor&&"Object"!==n.constructor.name&&(n={data:n});let r=null;n.compressed&&(r={minFilter:"linear",mipmapFilter:n.data.length>1?"nearest":"linear"});const s=e.createTexture({...n,sampler:{...xN,...r,...i}});return SN[s.id]=t,s}(n.id,i.device,t,{...e.parameters,...n.props.textureParameters}):null},release:(t,e,n)=>{var i,r;i=n.id,(r=t)&&r instanceof YP&&SN[r.id]===i&&(r.delete(),delete SN[r.id])}}};function CN(t,e){switch(RN(e)){case"object":return AN(t,e);case"array":return AN(t,{type:"array",value:e,compare:!1});case"boolean":return AN(t,{type:"boolean",value:e});case"number":return AN(t,{type:"number",value:e});case"function":return AN(t,{type:"function",value:e,compare:!0});default:return{name:t,type:"unknown",value:e}}}function AN(t,e){return"type"in e?{name:t,...TN[e.type],...e}:"value"in e?{name:t,type:RN(e.value),...e}:{name:t,type:"object",value:e}}function PN(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function RN(t){return PN(t)?"array":null===t?"null":typeof t}const MN="_mergedDefaultProps";function IN(t,e){let n=MN;if(e)for(const r of e){const t=r.constructor;t&&(n+=`:${t.extensionName||t.name}`)}const i=NN(t,n);
2return i||(t[n]=function(t,e){const n=t.prototype;if(!n)return null;const i=Object.getPrototypeOf(t),r=IN(i),s=NN(t,"defaultProps")||{},o=function(t){const e={},n={},i={};for(const[r,s]of Object.entries(t)){const t=s?.deprecatedFor;if(t)i[r]=Array.isArray(t)?t:[t];else{const t=CN(r,s);e[r]=t,n[r]=t.value}}return{propTypes:e,defaultProps:n,deprecatedProps:i}}(s),a=Object.assign(Object.create(null),r,o.defaultProps),l=Object.assign(Object.create(null),r?.[aE],o.propTypes),c=Object.assign(Object.create(null),r?.[lE],o.deprecatedProps);for(const u of e){const t=IN(u.constructor);t&&(Object.assign(a,t),Object.assign(l,t[aE]),Object.assign(c,t[lE]))}(function(t,e){const n=function(t){const e=t.componentName;e||vw.warn(`${t.name}.componentName not specified`)();return e||t.name}(e);Object.defineProperties(t,{id:{writable:!0,value:n}})})(a,t),function(t,e){const n={},i={};for(const r in e){const t=e[r],{name:s,value:o}=t;t.async&&(n[s]=o,i[s]=LN(s))}t[cE]=n,t[uE]={},Object.defineProperties(t,i)}(a,l),function(t,e){for(const n in e)Object.defineProperty(t,n,{enumerable:!1,set(t){const i=`${this.id}: ${n}`;for(const r of e[n])kN(this,r)||(this[r]=t);vw.deprecated(i,e[n].join("/"))()}})}(a,c),a[aE]=l,a[lE]=c,0!==e.length||kN(t,"_propTypes")||(t._propTypes=l);return a}(t,e||[]))}function LN(t){return{enumerable:!0,set(e){"string"===typeof e||e instanceof Promise||$I(e)?this[uE][t]=e:this[hE][t]=e},get(){if(this[hE]){if(t in this[hE]){return this[hE][t]||this[cE][t]}if(t in this[uE]){const e=this[oE]&&this[oE].internalState;if(e&&e.hasAsyncProp(t))return e.getAsyncProp(t)||this[cE][t]}}return this[cE][t]}}}function kN(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function NN(t,e){return kN(t,e)&&t[e]}let ON=0;class DN{static#t=(()=>this.componentName="Component")();static#e=(()=>this.defaultProps={})();constructor(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this.props=function(t,e){let n;for(let s=e.length-1;s>=0;s--){const t=e[s];"extensions"in t&&(n=t.extensions)}const i=IN(t.constructor,n),r=Object.create(i);r[oE]=t,r[uE]={},r[hE]={};for(let s=0;s<e.length;++s){const t=e[s];for(const e in t)r[e]=t[e]}return Object.freeze(r),r}(this,e),this.id=this.props.id,this.count=ON++}clone(t){const{props:e}=this,n={};for(const i in e[cE])i in e[hE]?n[i]=e[hE][i]:i in e[uE]&&(n[i]=e[uE][i]);return new this.constructor({...e,...n,...t})}}const FN=Object.freeze({});class BN{constructor(t){this.component=t,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(const t in this.asyncProps){const e=this.asyncProps[t];e&&e.type&&e.type.release&&e.type.release(e.resolvedValue,e.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||FN}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(t){return t in this.asyncProps}getAsyncProp(t){const e=this.asyncProps[t];return e&&e.resolvedValue}isAsyncPropLoading(t){if(t){const e=this.asyncProps[t];return Boolean(e&&e.pendingLoadCount>0&&e.pendingLoadCount!==e.resolvedLoadCount)}for(const e in this.asyncProps)if(this.isAsyncPropLoading(e))return!0;return!1}reloadAsyncProp(t,e){this._watchPromise(t,Promise.resolve(e))}setAsyncProps(t){this.component=t[oE]||this.component;const e=t[hE]||{},n=t[uE]||t,i=t[cE]||{};for(const r in e){const t=e[r];this._createAsyncPropData(r,i[r]),this._updateAsyncProp(r,t),e[r]=this.getAsyncProp(r)}for(const r in n){const t=n[r];this._createAsyncPropData(r,i[r]),this._updateAsyncProp(r,t)}}_fetch(t,e){return null}_onResolve(t,e){}_onError(t,e){}_updateAsyncProp(t,e){this._didAsyncInputValueChange(t,e)&&("string"===typeof e&&(e=this._fetch(t,e)),e instanceof Promise?this._watchPromise(t,e):$I(e)?this._resolveAsyncIterable(t,e):this._setPropValue(t,e))}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(const t in this.asyncProps)Object.defineProperty(this.oldAsyncProps,t,{enumerable:!0,value:this.oldProps[t]})}}_didAsyncInputValueChange(t,e){const n=this.asyncProps[t];return e!==n.resolvedValue&&e!==n.lastValue&&(n.lastValue=e,!0)}_setPropValue(t,e){this._freezeAsyncOldProps();const n=this.asyncProps[t];n&&(e=this._postProcessValue(n,e),n.resolvedValue=e,n.pendingLoadCount++,n.resolvedLoadCount=n.pendingLoadCount)}_setAsyncPropValue(t,e,n){const i=this.asyncProps[t];i&&n>=i.resolvedLoadCount&&void 0!==e&&(this._freezeAsyncOldProps(),i.resolvedValue=e,i.resolvedLoadCount=n,this.onAsyncPropUpdated(t,e))}_watchPromise(t,e){const n=this.asyncProps[t];if(n){n.pendingLoadCount++;const i=n.pendingLoadCount;e.then((e=>{this.component&&(e=this._postProcessValue(n,e),this._setAsyncPropValue(t,e,i),this._onRes
2olve(t,e))})).catch((e=>{this._onError(t,e)}))}}async _resolveAsyncIterable(t,e){if("data"!==t)return void this._setPropValue(t,e);const n=this.asyncProps[t];if(!n)return;n.pendingLoadCount++;const i=n.pendingLoadCount;let r=[],s=0;for await(const o of e){if(!this.component)return;const{dataTransform:e}=this.component.props;r=e?e(o,r):r.concat(o),Object.defineProperty(r,"__diff",{enumerable:!1,value:[{startRow:s,endRow:r.length}]}),s=r.length,this._setAsyncPropValue(t,r,i)}this._onResolve(t,r)}_postProcessValue(t,e){const n=t.type;return n&&this.component&&(n.release&&n.release(t.resolvedValue,n,this.component),n.transform)?n.transform(e,n,this.component):e}_createAsyncPropData(t,e){if(!this.asyncProps[t]){const n=this.component&&this.component.props[aE];this.asyncProps[t]={type:n&&n[t],lastValue:null,resolvedValue:e,pendingLoadCount:0,resolvedLoadCount:0}}}}class UN extends BN{constructor(t){let{attributeManager:e,layer:n}=t;super(n),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(t,e){const n=this.layer,i=n?.props.fetch;return i?i(e,{propName:t,layer:n}):super._fetch(t,e)}_onResolve(t,e){const n=this.layer;if(n){const i=n.props.onDataLoad;"data"===t&&i&&i(e,{propName:t,layer:n})}}_onError(t,e){const n=this.layer;n&&n.raiseError(e,`loading ${t} of ${this.layer}`)}}const zN=2**24-1,jN=Object.freeze([]),VN=jw((t=>{let{oldViewport:e,viewport:n}=t;return e.equals(n)}));let WN=new Uint8ClampedArray(0);const $N={data:{type:"data",value:jN,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:t=>t&&t.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(t,e)=>{let{propName:n,layer:i,loaders:r,loadOptions:s,signal:o}=e;const{resourceManager:a}=i.context;s=s||i.getLoadOptions(),r=r||i.props.loaders,o&&(s={...s,fetch:{...s?.fetch,signal:o}});let l=a.contains(t);return l||s||(a.add({resourceId:t,data:Qx(t,r),persistent:!1}),l=!0),l?a.subscribe({resourceId:t,onChange:t=>i.internalState?.reloadAsyncProp(n,t),consumerId:i.id,requestId:n}):Qx(t,r,s)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:bw.DEFAULT,coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:t=>{let{layerIndex:e}=t;return[0,100*-e]}},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}};class GN extends DN{constructor(){super(...arguments),this.internalState=null,this.lifecycle=tE,this.parent=null}static#t=(()=>this.defaultProps=$N)();static#e=(()=>this.layerName="Layer")();static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let t=this;for(;t.parent;)t=t.parent;return t}toString(){return`${this.constructor.layerName||this.constructor.name}({id: '${this.props.id}'})`}project(t){jT(this.internalState);const e=this.internalState.viewport||this.context.viewport,n=wN(t,{viewport:e,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[i,r,s]=mT(n,e.pixelProjectionMatrix);return 2===t.length?[i,r]:[i,r,s]}unproject(t){jT(this.internalState);return(this.internalState.viewport||this.context.viewport).unproject(t)}projectPosition(t,e){jT(this.internalState);return EN(t,{viewport:this.internalState.viewport||this.context.viewport,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...e})}get isComposite(){return!1}setState(t){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,t),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return!!this.internalState&&!this.internalState.isAsyncPropLoading()}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){const t=this.state;return t&&(t.models||t.model&&[t.model])||[]}setModuleParameters(t){for(const e of this.getModels())e.updateModuleSettings(t)}setShaderModuleProps(){for(const t of this.getModels())t.shaderInputs.setProps(...arguments)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){const{coordinateSystem:t}=this.props;return t===bw.DEFAULT||t===bw.LNGLAT||t===bw.CARTESIAN}onHover(t,e){return this.props.onHover&&this.props.onHover(t,e)||!1}onClick(t,e){return this.props.onClick&&this.props.onClick(t,e)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e[0]=t+1&255,e[1]=t+1>>8&255,e[2]=t+1>>8>>8&255,e}decodePickingColor(t){jT(t instanceof Uint8Array);const[e,n,i]=t;return e+256*n+65536*i-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&void 0!==this.state.numInstances?this.state.numInstances:_N(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){return this.getAttributeManager()?.getBounds(["positions","instancePositions"])}getShaders(t){t=yN(t,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(const e of this.props.extensions)t=yN(t,e.getShaders.call(this,e));return t}shouldUpdateState(t){return t.changeFlags.propsOrDataChanged}updateState(t){const e=this.getAttributeManager(),{dataChanged:n}=t.changeFlags;if(n&&e)if(Array.isArray(n))for(const i of n)e.invalidateAll(i);
vendor: 13,598 bytes, line 2
2else e.invalidateAll();if(e){const{props:n}=t,i=this.internalState.hasPickingBuffer,r=Number.isInteger(n.highlightedObjectIndex)||n.pickable||n.extensions.some((t=>t.getNeedsPickingBuffer.call(this,t)));if(i!==r){this.internalState.hasPickingBuffer=r;const{pickingColors:t,instancePickingColors:n}=e.attributes,i=t||n;i&&(r&&i.constant&&(i.constant=!1,e.invalidate(i.id)),i.value||r||(i.constant=!0,i.value=[0,0,0]))}}}finalizeState(t){for(const n of this.getModels())n.destroy();const e=this.getAttributeManager();e&&e.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(t){for(const e of this.getModels())e.draw(t)}getPickingInfo(t){let{info:e,mode:n,sourceLayer:i}=t;const{index:r}=e;return r>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[r]),e}raiseError(t,e){e&&(t=new Error(`${e}: ${t.message}`,{cause:t})),this.props.onError?.(t)||this.context?.onError?.(t,this)}getNeedsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};return this._getNeedsRedraw(t)}needsUpdate(){return!!this.internalState&&(this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()))}hasUniformTransition(){return this.internalState?.uniformTransitions.active||!1}activateViewport(t){if(!this.internalState)return;const e=this.internalState.viewport;this.internalState.viewport=t,e&&VN({oldViewport:e,viewport:t})||(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"all";const e=this.getAttributeManager();e&&("all"===t?e.invalidateAll():e.invalidate(t))}updateAttributes(t){let e=!1;for(const n in t)t[n].layoutChanged()&&(e=!0);for(const n of this.getModels())this._setModelAttributes(n,t,e)}_updateAttributes(){const t=this.getAttributeManager();if(!t)return;const e=this.props,n=this.getNumInstances(),i=this.getStartIndices();t.update({data:e.data,numInstances:n,startIndices:i,props:e,transitions:e.transitions,buffers:e.data.attributes,context:this});const r=t.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(r)}_updateAttributeTransition(){const t=this.getAttributeManager();t&&t.updateTransition()}_updateUniformTransition(){const{uniformTransitions:t}=this.internalState;if(t.active){const e=t.update(),n=Object.create(this.props);for(const t in e)Object.defineProperty(n,t,{value:e[t]});return n}return this.props}calculateInstancePickingColors(t,e){let{numInstances:n}=e;if(t.constant)return;const i=Math.floor(WN.length/4);if(this.internalState.usesPickingColorCache=!0,i<n){n>zN&&vw.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),WN=nS.allocate(WN,n,{size:4,copy:!0,maxCount:Math.max(n,zN)});const t=Math.floor(WN.length/4),e=[];for(let n=i;n<t;n++)this.encodePickingColor(n,e),WN[4*n+0]=e[0],WN[4*n+1]=e[1],WN[4*n+2]=e[2]}t.value=WN.subarray(0,4*n)}_setModelAttributes(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!Object.keys(e).length)return;if(n){const n=this.getAttributeManager();t.setBufferLayout(n.getBufferLayouts(t)),e=n.getAttributes()}const i=t.userData?.excludeAttributes||{},r={},s={};for(const o in e){if(i[o])continue;const n=e[o].getValue();for(const i in n){const a=n[i];a instanceof SA?e[o].settings.isIndexed?t.setIndexBuffer(a):r[i]=a:a&&(s[i]=a)}}t.setAttributes(r),t.setConstantAttributes(s)}disablePickingIndex(t){const e=this.props.data;if(!("attributes"in e))return void this._disablePickingIndex(t);const{pickingColors:n,instancePickingColors:i}=this.getAttributeManager().attributes,r=n||i,s=r&&e.attributes&&e.attributes[r.id];if(s&&s.value){const n=s.value,i=this.encodePickingColor(t);for(let t=0;t<e.length;t++){const e=r.getVertexOffset(t);n[e]===i[0]&&n[e+1]===i[1]&&n[e+2]===i[2]&&this._disablePickingIndex(t)}}else this._disablePickingIndex(t)}_disablePickingIndex(t){const{pickingColors:e,instancePickingColors:n}=this.getAttributeManager().attributes,i=e||n;if(!i)return;const r=i.getVertexOffset(t),s=i.getVertexOffset(t+1);i.buffer.write(new Uint8Array(s-r),r)}restorePickingColors(){const{pickingColors:t,instancePickingColors:e}=this.getAttributeManager().attributes,n=t||e;n&&(this.internalState.usesPickingColorCache&&n.value.buffer!==WN.buffer&&(n.value=WN.subarray(0,n.value.length)),n.updateSubBuffer({startOffset:0}))}_initialize(){jT(!this.internalState),jT(Number.isFinite(this.props.coordinateSystem)),fE("layer.initialize",this);const t=this._getAttributeManager();t&&t.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new UN({attributeManager:t,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(vw.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),t)}),this.internalState.uniformTransitions=new uN(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(const e of this.props.extensions)e.initializeState.call(this,this.context,e);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(t){fE("layer.matched",this,this===t);const{state:e,internalState:n}=t;this!==t&&(this.internalState=n,this.state=e,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){const t=this.needsUpdate();if(fE("layer.update",this,t),!t)return;const e=this.props,n=this.context,i=this.internalState,r=n.viewport,s=this._updateUniformTransition();i.propsInTransition=s,n.viewport=i.viewport||r,this.props=s;try{const t=this._getUpdateParams(),e=this.getModels();if(n.device)this.updateState(t);else try{this.updateState(t)}catch($c){}for(const n of this.props.extensions)n.updateState.call(this,t,n);const i=this.getModels()[0]!==e[0];this._postUpdate(t,i)}finally{n.viewport=r,this.props=e,this._clearChangeFlags(),i.needsUpdate=!1,i.resetOldProps()}}_finalize(){fE("layer.finalize",this),this.finalizeState(this.context);for(const t of this.props.extensions)t.finalizeState.call(this,this.context,t)}_drawLayer(t){let{renderPass:e,moduleParameters:n=null,uniforms:i={},parameters:r={}}=t;this._updateAttributeTransition();const s=this.props,o=this.context;this.props=this.internalState.propsInTransition||s;const a=this.props.opacity;i.opacity=Math.pow(a,1/2.2);try{if(n){const{isActive:t,isAttribute:e}=n.picking;this.setModuleParameters(n),this.setShaderModuleProps({picking:{isActive:t,isAttribute:e}})}const{getPolygonOffset:t}=this.props,s=t&&t(i)||[0,0];o.device.setParametersWebGL({polygonOffset:s});for(const e of this.getModels())e.setParameters(r);o.device.withParametersWebGL(r,(()=>{const t={renderPass:e,moduleParameters:n,uniforms:i,parameters:r,context:o};for(const e of this.props.extensions)e.draw.call(this,t,e);this.draw(t)}))}finally{this.props=s}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(t){if(!this.internalState)return;const{changeFlags:e}=this.internalState;for(const i in t)if(t[i]){let n=!1;if("dataChanged"===i){const r=t[i],s=e[i];r&&Array.isArray(s)&&(e.dataChanged=Array.isArray(r)?s.concat(r):r,n=!0)}e[i]||(e[i]=t[i],n=!0),n&&fE("layer.changeFlag",this,i,t)}const n=Boolean(e.dataChanged||e.updateTriggersChanged||e.propsChanged||e.extensionsChanged);e.propsOrDataChanged=n,e.somethingChanged=n||e.viewportChanged||e.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(t,e){const n=hN(t,e);if(n.updateTriggersChanged)for(const i in n.updateTriggersChanged)n.updateTriggersChanged[i]&&this.invalidateAttribute(i);if(n.transitionsChanged)for(const i in n.transitionsChanged)this.internalState.uniformTransitions.add(i,e[i],t[i],t.transitions?.[i]);return this.setChangeFlags(n)}validateProps(){!function(t){const e=t[aE];for(const n in e){const i=e[n],{validate:r}=i;if(r&&!r(t[n],i))throw new Error(`Invalid prop ${n}: ${t[n]}`)}}(this.props)}updateAutoHighlight(t){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(t)}_updateAutoHighlight(t){const e={highlightedObjectColor:t.picked?t.color:null},{highlightColor:n}=this.props;t.picked&&"function"===typeof n&&(e.highlightColor=n(t)),this.setShaderModuleProps({picking:e}),this.setNeedsRedraw()}_getAttributeManager(){const t=this.context;return new sN(t.device,{id:this.props.id,stats:t.stats,timeline:t.timeline})}_postUpdate(t,e){const{props:n,oldProps:i}=t;this.setNeedsRedraw(),this._updateAttributes();const r=this.state.model;r?.isInstanced&&r.setInstanceCount(this.getNumInstances());const{autoHighlight:s,highlightedObjectIndex:o,highlightColor:a}=n;if(e||i.autoHighlight!==s||i.highlightedObjectIndex!==o||i.highlightColor!==a){const t={};s||(t.highlightedObjectColor=null),Array.isArray(a)&&(t.highlightColor=a),(e||o!==i.highlightedObjectIndex)&&(t.highlightedObjectColor=Number.isFinite(o)&&o>=0?this.encodePickingColor(o):null),this.setShaderModuleProps({picking:t})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(t){if(!this.internalState)return!1;let e=!1;e=e||this.internalState.needsRedraw&&this.id;const n=this.getAttributeManager(),i=!!n&&n.getNeedsRedraw(t);if(e=e||i,e)for(const r of this.props.extensions)r.onNeedsRedraw.call(this,r);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!t.clearRedrawFlags,e}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}}const HN={position:"absolute",zIndex:-1};function qN(t,n){if("function"===typeof t)return t(n);if(Array.isArray(t))return t.map((t=>qN(t,n)));if(ZN(t)){if(function(t){return t.props?.mapStyle}(t))return n.style=HN,(0,e.cloneElement)(t,n);if(function(t){const e=t.type;return e&&e.deckGLViewProps}(t))return(0,e.cloneElement)(t,n)}return t}function ZN(t){return t&&"object"===typeof t&&"type"in t||!1}function XN(t){if("function"===typeof t)return(0,e.createElement)(LT,{},t);if(Array.isArray(t))return t.map(XN);if(ZN(t)){if(t.type===e.Fragment)return XN(t.props.children);if(LI(t.type,LT))return t}return t}const KN={mixBlendMode:null};function YN(t){t.redrawReason&&(t.deck._drawLayers(t.redrawReason),t.redrawReason=null)}const JN=e.forwardRef((function(t,n){const[i,r]=(0,e.useState)(0),s=(0,e.useRef)({control:null,version:i,forceUpdate:()=>r((t=>t+1))}).current,o=(0,e.useRef)(null),a=(0,e.useRef)(null),l=(0,e.useMemo)((()=>function(t){let{children:n,layers:i=[],views:r=null}=t;const s=[],o=[],a={};return e.Children.forEach(XN(n),(t=>{if(ZN(t)){const e=t.type;if(LI(e,GN)){const n=function(t,e){const n={},i=t.defaultProps||{};for(const r in e)i[r]!==e[r]&&(n[r]=e[r]);return new t(n)}(e,t.props);o.push(n)}else s.push(t);if(LI(e,LT)&&e!==LT&&t.props.id){const n=new e(t.props);a[n.id]=n}}else t&&s.push(t)})),Object.keys(a).length>0&&(Array.isArray(r)?r.forEach((t=>{a[t.id]=t})):r&&(a[r.id]=r),r=Object.values(a)),i=o.length>0?[...o,...i]:i,{layers:i,children:s,views:r}}(t)),[t.layers,t.views,t.children]);let c=!0;const u=e=>c&&t.viewState?(s.viewStateUpdateRequested=e,null):(s.viewStateUpdateRequested=null,t.onViewStateChange?.(e)),h=e=>{c?s.interactionStateUpdateRequested=e:(s.interactionStateUpdateRequested=null,t.onInteractionStateChange?.(e))},d=(0,e.useMemo)((()=>{const e={...t,style:null,width:"100%",height:"100%",parent:o.current,canvas:a.current,layers:l.layers,views:l.views,onViewStateChange:u,onInteractionStateChange:h};return delete e._customRender,s.deck&&s.deck.setProps(e),e}),[t]);(0,e.useEffect)((()=>{const e=t.Deck||MI;return s.deck=function(t,e,n){const i=new e({...n,_customRender:e=>{t.redrawReason=e;const n=i.getViewports();t.lastRenderedViewports!==n?t.forceUpdate():YN(t)}});return i}(s,e,{...d,parent:o.current,canvas:a.current}),()=>s.deck?.finalize()}),[]),II((()=>{YN(s);const{viewStateUpdateRequested:t,interactionStateUpdateRequested:e}=s;t&&u(t),e&&h(e)})),(0,e.useImperativeHandle)(n,(()=>function(t){return{get deck(){return t.deck},pickObject:e=>t.deck.pickObject(e),pickMultipleObjects:e=>t.deck.pickMultipleObjects(e),pickObjects:e=>t.deck.pickObjects(e)}}(s)),[]);const p=s.deck&&s.deck.isInitialized?s.deck.getViewports():void 0,{ContextProvider:f,width:g="100%",height:m="100%",id:_,style:y}=t,{containerStyle:v,canvasStyle:b}=(0,e.useMemo)((()=>function(t){let{width:e,height:n,style:i}=t;const r={position:"absolute",zIndex:0,left:0,top:0,width:e,height:n},s={left:0,top:0};if(i)for(const o in i)o in KN?s[o]=i[o]:r[o]=i[o];return{containerStyle:r,canvasStyle:s}}({width:g,height:m,style:y})),[g,m,y]);if(!s.viewStateUpdateRequested&&s.lastRenderedViewports===p||s.version!==i){s.lastRenderedViewports=p,s.version=i;const t=function(t){let{children:n,deck:i,ContextProvider:r}=t;const{viewManager:s}=i||{};if(!s||!s.views.length)return[];const o={},a=s.views[0].id;for(const e of n){let t=a,n=e;ZN(e)&&LI(e.type,LT)&&(t=e.props.id||a,n=e.props.children);const i=s.getViewport(t),r=s.getViewState(t);if(i){r.padding=i.padding;const{x:e,y:s,width:a,height:l}=i;
2n=qN(n,{x:e,y:s,width:a,height:l,viewport:i,viewState:r}),o[t]||(o[t]={viewport:i,children:[]}),o[t].children.push(n)}}return Object.keys(o).map((t=>{const{viewport:n,children:s}=o[t],{x:a,y:l,width:c,height:u}=n,h={position:"absolute",left:a,top:l,width:c,height:u},d=`view-${t}`,p=(0,e.createElement)("div",{key:d,id:d,style:h},...s);if(r){const s={viewport:n,container:i.canvas.offsetParent,eventManager:i.eventManager,onViewStateChange:e=>{e.viewId=t,i._onViewStateChange(e)}};return(0,e.createElement)(r,{key:d,value:s},p)}return p}))}({children:l.children,deck:s.deck,ContextProvider:f}),n=(0,e.createElement)("canvas",{key:"canvas",id:_||"deckgl-overlay",ref:a,style:b});s.control=(0,e.createElement)("div",{id:`${_||"deckgl"}-wrapper`,ref:o,style:v},[n,t])}return c=!1,s.control})),QN=JN,tO=e.createContext(null);function eO(t,e){if(t===e)return!0;if(!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!eO(t[n],e[n]))return!1;return!0}if(Array.isArray(e))return!1;if("object"===typeof t&&"object"===typeof e){const n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(const r of n){if(!e.hasOwnProperty(r))return!1;if(!eO(t[r],e[r]))return!1}return!0}return!1}function nO(t,e){if(!t.getProjection)return;const n=t.getProjection();eO(n,e.getProjection())||e.setProjection(n)}function iO(t){return{longitude:t.center.lng,latitude:t.center.lat,zoom:t.zoom,pitch:t.pitch,bearing:t.bearing,padding:t.padding}}function rO(t,e){const n=e.viewState||e;let i=!1;if("longitude"in n&&"latitude"in n){const e=t.center;t.center=new e.constructor(n.longitude,n.latitude),i=i||e!==t.center}if("zoom"in n){const e=t.zoom;t.zoom=n.zoom,i=i||e!==t.zoom}if("bearing"in n){const e=t.bearing;t.bearing=n.bearing,i=i||e!==t.bearing}if("pitch"in n){const e=t.pitch;t.pitch=n.pitch,i=i||e!==t.pitch}return n.padding&&!t.isPaddingEqual(n.padding)&&(i=!0,t.padding=n.padding),i}const sO=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function oO(t){if(!t)return null;if("string"===typeof t)return t;if("toJS"in t&&(t=t.toJS()),!t.layers)return t;const e={};for(const i of t.layers)e[i.id]=i;const n=t.layers.map((t=>{let n=null;"interactive"in t&&(n=Object.assign({},t),delete n.interactive);const i=e[t.ref];if(i){n=n||Object.assign({},t),delete n.ref;for(const t of sO)t in i&&(n[t]=i[t])}return n||t}));return{...t,layers:n}}const aO={version:8,sources:{},layers:[]},lO={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},cO={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},uO={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},hO=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],dO=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class pO{constructor(t,e,n){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=t=>{const e=this.props[uO[t.type]];e?e(t):"error"===t.type&&console.error(t.error)},this._onPointerEvent=t=>{"mousemove"!==t.type&&"mouseout"!==t.type||this._updateHover(t);const e=this.props[lO[t.type]];e&&(this.props.interactiveLayerIds&&"mouseover"!==t.type&&"mouseout"!==t.type&&(t.features=this._hoveredFeatures||this._queryRenderedFeatures(t.point)),e(t),delete t.features)},this._onCameraEvent=t=>{if(!this._internalUpdate){const e=this.props[cO[t.type]];e&&e(t)}
2t.type in this._deferredEvents&&(this._deferredEvents[t.type]=!1)},this._MapClass=t,this.props=e,this._initialize(n)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){const e=this.props;this.props=t;const n=this._updateSettings(t,e);n&&this._createShadowTransform(this._map);const i=this._updateSize(t),r=this._updateViewState(t,!0);this._updateStyle(t,e),this._updateStyleComponents(t,e),this._updateHandlers(t,e),(n||i||r&&!this._map.isMoving())&&this.redraw()}static reuse(t,e){const n=pO.savedMaps.pop();if(!n)return null;const i=n.map,r=i.getContainer();for(e.className=r.className;r.childNodes.length>0;)e.appendChild(r.childNodes[0]);i._container=e;const s=i._resizeObserver;s&&(s.disconnect(),s.observe(e)),n.setProps({...t,styleDiffing:!1}),i.resize();const{initialViewState:o}=t;return o&&(o.bounds?i.fitBounds(o.bounds,{...o.fitBoundsOptions,duration:0}):n._updateViewState(o,!1)),i.isStyleLoaded()?i.fire("load"):i.once("styledata",(()=>i.fire("load"))),i._update(),n}_initialize(t){const{props:e}=this,{mapStyle:n=aO}=e,i={...e,...e.initialViewState,accessToken:e.mapboxAccessToken||fO()||null,container:t,style:oO(n)},r=i.initialViewState||i.viewState||i;if(Object.assign(i,{center:[r.longitude||0,r.latitude||0],zoom:r.zoom||0,pitch:r.pitch||0,bearing:r.bearing||0}),e.gl){const t=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=t,e.gl)}const s=new this._MapClass(i);r.padding&&s.setPadding(r.padding),e.cursor&&(s.getCanvas().style.cursor=e.cursor),this._createShadowTransform(s);const o=s._render;s._render=t=>{this._inRender=!0,o.call(s,t),this._inRender=!1};const a=s._renderTaskQueue.run;s._renderTaskQueue.run=t=>{a.call(s._renderTaskQueue,t),this._onBeforeRepaint()},s.on("render",(()=>this._onAfterRepaint()));const l=s.fire;s.fire=this._fireEvent.bind(this,l),s.on("resize",(()=>{this._renderTransform.resize(s.transform.width,s.transform.height)})),s.on("styledata",(()=>{this._updateStyleComponents(this.props,{}),nO(s.transform,this._renderTransform)})),s.on("sourcedata",(()=>this._updateStyleComponents(this.props,{})));for(const c in lO)s.on(c,this._onPointerEvent);for(const c in cO)s.on(c,this._onCameraEvent);for(const c in uO)s.on(c,this._onEvent);this._map=s}recycle(){const t=this.map.getContainer().querySelector("[mapboxgl-children]");null===t||void 0===t||t.remove(),pO.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){const e=function(t){const e=t.clone();return e.pixelsToGLUnits=t.pixelsToGLUnits,e}(t.transform);t.painter.transform=e,this._renderTransform=e}_updateSize(t){const{viewState:e}=t;if(e){const t=this._map;if(e.width!==t.transform.width||e.height!==t.transform.height)return t.resize(),!0}return!1}_updateViewState(t,e){if(this._internalUpdate)return!1;const n=this._map,i=this._renderTransform,{zoom:r,pitch:s,bearing:o}=i,a=n.isMoving();a&&(i.cameraElevationReference="sea");const l=rO(i,{...iO(n.transform),...t});if(a&&(i.cameraElevationReference="ground"),l&&e){const t=this._deferredEvents;t.move=!0,t.zoom||(t.zoom=r!==i.zoom),t.rotate||(t.rotate=o!==i.bearing),t.pitch||(t.pitch=s!==i.pitch)}return a||rO(n.transform,t),l}_updateSettings(t,e){const n=this._map;let i=!1;for(const r of hO)if(r in t&&!eO(t[r],e[r])){i=!0;const e=n[`set${r[0].toUpperCase()}${r.slice(1)}`];null===e||void 0===e||e.call(n,t[r])}return i}_updateStyle(t,e){if(t.cursor!==e.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==e.mapStyle){const{mapStyle:e=aO,styleDiffing:n=!0}=t,i={diff:n};return"localIdeographFontFamily"in t&&(i.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(oO(e),i),!0}return!1}_updateStyleComponents(t,e){const n=this._map;let i=!1;return n.isStyleLoaded()&&("light"in t&&n.setLight&&!eO(t.light,e.light)&&(i=!0,n.setLight(t.light)),"fog"in t&&n.setFog&&!eO(t.fog,e.fog)&&(i=!0,n.setFog(t.fog)),"terrain"in t&&n.setTerrain&&!eO(t.terrain,e.terrain)&&(t.terrain&&!n.getSource(t.terrain.source)||(i=!0,n.setTerrain(t.terrain)))),i}_updateHandlers(t,e){var n,i;const r=this._map;let s=!1;for(const o of dO){const a=null===(n=t[o])||void 0===n||n;eO(a,null===(i=e[o])||void 0===i||i)||(s=!0,a?r[o].enable(a):r[o].disable())}return s}_queryRenderedFeatures(t){const e=this._map,n=e.transform,{interactiveLayerIds:i=[]}=this.props;try{return e.transform=this._renderTransform,e.queryRenderedFeatures(t,{layers:i.filter(e.getLayer.bind(e))})}catch(vL){return[]}finally{e.transform=n}}_updateHover(t){var e;const{props:n}=this;if(n.interactiveLayerIds&&(n.onMouseMove||n.onMouseEnter||n.onMouseLeave)){const n=t.type,i=(null===(e=this._hoveredFeatures)||void 0===e?void 0:e.length)>0,r=this._queryRenderedFeatures(t.point),s=r.length>0;!s&&i&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=r,s&&!i&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=n}else this._hoveredFeatures=null}_fireEvent(t,e,n){const i=this._map,r=i.transform,s="string"===typeof e?e:e.type;return"move"===s&&this._updateViewState(this.props,!1),s in cO&&("object"===typeof e&&(e.viewState=iO(r)),this._map.isMoving())?(i.transform=this._renderTransform,t.call(i,e,
2n),i.transform=r,i):(t.call(i,e,n),i)}_onBeforeRepaint(){const t=this._map;this._internalUpdate=!0;for(const n in this._deferredEvents)this._deferredEvents[n]&&t.fire(n);this._internalUpdate=!1;const e=this._map.transform;t.transform=this._renderTransform,this._onAfterRepaint=()=>{nO(this._renderTransform,e),t.transform=e}}}function fO(){let t=null;if("undefined"!==typeof location){const e=/access_token=([^&\/]*)/.exec(location.search);t=e&&e[1]}try{t=t||{NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_FIREBASE_PASSWORD:"ClearloopData123!",REACT_APP_OPENWEATHER_API_KEY:"03c641fb2401c9014257bab115dd66ad",REACT_APP_FIREBASE_EMAIL:"[email protected]",REACT_APP_MAPBOX_TOKEN:"pk.eyJ1IjoibWFuZGFsaSIsImEiOiJjbHh0Z2I4YW0wNGtvMmlvYzZhM28wMTV2In0.maKcZ_aBF3G64JMJM2W1EQ"}.MapboxAccessToken}catch(vL){}try{t=t||{NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_FIREBASE_PASSWORD:"ClearloopData123!",REACT_APP_OPENWEATHER_API_KEY:"03c641fb2401c9014257bab115dd66ad",REACT_APP_FIREBASE_EMAIL:"[email protected]",REACT_APP_MAPBOX_TOKEN:"pk.eyJ1IjoibWFuZGFsaSIsImEiOiJjbHh0Z2I4YW0wNGtvMmlvYzZhM28wMTV2In0.maKcZ_aBF3G64JMJM2W1EQ"}.REACT_APP_MAPBOX_ACCESS_TOKEN}catch(e){}return t}pO.savedMaps=[];const gO=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function mO(t){if(!t)return null;const e=t.map,n={getMap:()=>e,getCenter:()=>t.transform.center,getZoom:()=>t.transform.zoom,getBearing:()=>t.transform.bearing,getPitch:()=>t.transform.pitch,getPadding:()=>t.transform.padding,getBounds:()=>t.transform.getBounds(),project:n=>{const i=e.transform;e.transform=t.transform;const r=e.project(n);return e.transform=i,r},unproject:n=>{const i=e.transform;e.transform=t.transform;const r=e.unproject(n);return e.transform=i,r},queryTerrainElevation:(n,i)=>{const r=e.transform;e.transform=t.transform;const s=e.queryTerrainElevation(n,i);return e.transform=r,s},queryRenderedFeatures:(n,i)=>{const r=e.transform;e.transform=t.transform;const s=e.queryRenderedFeatures(n,i);return e.transform=r,s}};for(const i of function(t){const e=new Set;let n=t;for(;n;){for(const i of Object.getOwnPropertyNames(n))"_"!==i[0]&&"function"===typeof t[i]&&"fire"!==i&&"setEventedParent"!==i&&e.add(i);n=Object.getPrototypeOf(n)}return Array.from(e)}(e))i in n||gO.includes(i)||(n[i]=e[i].bind(e));return n}const _O="undefined"!==typeof document?e.useLayoutEffect:e.useEffect,yO=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];const vO=e.createContext(null);function bO(t,n,i){const r=(0,e.useContext)(tO),[s,o]=(0,e.useState)(null),a=(0,e.useRef)(),{current:l}=(0,e.useRef)({mapLib:null,map:null});(0,e.useEffect)((()=>{const e=t.mapLib;let n,s=!0;return Promise.resolve(e||i).then((e=>{if(!s)return;if(!e)throw new Error("Invalid mapLib");const i="Map"in e?e:e.default;if(!i.Map)throw new Error("Invalid mapLib");if(function(t,e){for(const i of yO)i in e&&(t[i]=e[i]);const{RTLTextPlugin:n="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=e;n&&t.getRTLTextPluginStatus&&"unavailable"===t.getRTLTextPluginStatus()&&t.setRTLTextPlugin(n,(t=>{t&&console.error(t)}),!0)}(i,t),i.supported&&!i.supported(t))throw new Error("Map is not supported by this browser");t.reuseMaps&&(n=pO.reuse(t,a.current)),n||(n=new pO(i.Map,t,a.current)),l.map=mO(n),l.mapLib=i,o(n),null===r||void 0===r||r.onMapMount(l.map,t.id)})).catch((e=>{const{onError:n}=t;n?n({type:"error",target:null,originalEvent:null,error:e}):console.error(e)})),()=>{s=!1,n&&(null===r||void 0===r||r.onMapUnmount(t.id),t.reuseMaps?n.recycle():n.destroy())}}),[]),_O((()=>{s&&s.setProps(t)})),(0,e.useImperativeHandle)(n,(()=>l.map),[s]);const c=(0,e.useMemo)((()=>({position:"relative",width:"100%",height:"100%",...t.style})),[t.style]);return e.createElement("div",{id:t.id,ref:a,style:c},s&&e.createElement(vO.Provider,{value:l},e.createElement("div",{"mapboxgl-children":"",style:{height:"100%"}},t.children)))}const wO=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function EO(t,e){if(!t||!e)return;const n=t.style;for(const i in e){const t=e[i];Number.isFinite(t)&&!wO.test(i)?n[i]=`${t}px`:n[i]=t}}(0,e.memo)((0,e.forwardRef)((function(t,n){const{map:i,mapLib:r}=(0,e.useContext)(vO),s=(0,e.useRef)({props:t});s.current.props=t;const o=(0,e.useMemo)((()=>{let n=!1;
2e.Children.forEach(t.children,(t=>{t&&(n=!0)}));const i={...t,element:n?document.createElement("div"):null},a=new r.Marker(i);return a.setLngLat([t.longitude,t.latitude]),a.getElement().addEventListener("click",(t=>{var e,n;null===(n=(e=s.current.props).onClick)||void 0===n||n.call(e,{type:"click",target:a,originalEvent:t})})),a.on("dragstart",(t=>{var e,n;const i=t;i.lngLat=o.getLngLat(),null===(n=(e=s.current.props).onDragStart)||void 0===n||n.call(e,i)})),a.on("drag",(t=>{var e,n;const i=t;i.lngLat=o.getLngLat(),null===(n=(e=s.current.props).onDrag)||void 0===n||n.call(e,i)})),a.on("dragend",(t=>{var e,n;const i=t;i.lngLat=o.getLngLat(),null===(n=(e=s.current.props).onDragEnd)||void 0===n||n.call(e,i)})),a}),[]);(0,e.useEffect)((()=>(o.addTo(i.getMap()),()=>{o.remove()})),[]);const{longitude:a,latitude:l,offset:c,style:u,draggable:h=!1,popup:d=null,rotation:p=0,rotationAlignment:f="auto",pitchAlignment:g="auto"}=t;return(0,e.useEffect)((()=>{EO(o.getElement(),u)}),[u]),(0,e.useImperativeHandle)(n,(()=>o),[]),o.getLngLat().lng===a&&o.getLngLat().lat===l||o.setLngLat([a,l]),c&&!function(t,e){const n=Array.isArray(t)?t[0]:t?t.x:0,i=Array.isArray(t)?t[1]:t?t.y:0,r=Array.isArray(e)?e[0]:e?e.x:0,s=Array.isArray(e)?e[1]:e?e.y:0;return n===r&&i===s}(o.getOffset(),c)&&o.setOffset(c),o.isDraggable()!==h&&o.setDraggable(h),o.getRotation()!==p&&o.setRotation(p),o.getRotationAlignment()!==f&&o.setRotationAlignment(f),o.getPitchAlignment()!==g&&o.setPitchAlignment(g),o.getPopup()!==d&&o.setPopup(d),(0,Py.createPortal)(t.children,o.getElement())})));function xO(t){return new Set(t?t.trim().split(/\s+/):[])}(0,e.memo)((0,e.forwardRef)((function(t,n){const{map:i,mapLib:r}=(0,e.useContext)(vO),s=(0,e.useMemo)((()=>document.createElement("div")),[]),o=(0,e.useRef)({props:t});o.current.props=t;const a=(0,e.useMemo)((()=>{const e={...t},n=new r.Popup(e);return n.setLngLat([t.longitude,t.latitude]),n.once("open",(t=>{var e,n;null===(n=(e=o.current.props).onOpen)||void 0===n||n.call(e,t)})),n}),[]);if((0,e.useEffect)((()=>{const t=t=>{var e,n;null===(n=(e=o.current.props).onClose)||void 0===n||n.call(e,t)};return a.on("close",t),a.setDOMContent(s).addTo(i.getMap()),()=>{a.off("close",t),a.isOpen()&&a.remove()}}),[]),(0,e.useEffect)((()=>{EO(a.getElement(),t.style)}),[t.style]),(0,e.useImperativeHandle)(n,(()=>a),[]),a.isOpen()&&(a.getLngLat().lng===t.longitude&&a.getLngLat().lat===t.latitude||a.setLngLat([t.longitude,t.latitude]),t.offset&&!eO(a.options.offset,t.offset)&&a.setOffset(t.offset),a.options.anchor===t.anchor&&a.options.maxWidth===t.maxWidth||(a.options.anchor=t.anchor,a.setMaxWidth(t.maxWidth)),a.options.className!==t.className)){const e=xO(a.options.className),n=xO(t.className);for(const t of e)n.has(t)||a.removeClassName(t);for(const t of n)e.has(t)||a.addClassName(t);a.options.className=t.className}return(0,Py.createPortal)(t.children,s)})));const SO=function(t,n,i,r){const s=(0,e.useContext)(vO),o=(0,e.useMemo)((()=>t(s)),[]);return(0,e.useEffect)((()=>{const t=r||i||n,e="function"===typeof n&&"function"===typeof i?n:null,a="function"===typeof i?i:"function"===typeof n?n:null,{map:l}=s;return l.hasControl(o)||(l.addControl(o,null===t||void 0===t?void 0:t.position),e&&e(s)),()=>{a&&a(s),l.hasControl(o)&&l.removeControl(o)}}),[]),o};(0,e.memo)((function(t){const n=SO((e=>{let{mapLib:n}=e;return new n.AttributionControl(t)}),{position:t.position});return(0,e.useEffect)((()=>{EO(n._container,t.style)}),[t.style]),null}));(0,e.memo)((function(t){const n=SO((e=>{let{mapLib:n}=e;return new n.FullscreenControl({container:t.containerId&&document.getElementById(t.containerId)})}),{position:t.position});return(0,e.useEffect)((()=>{EO(n._controlContainer,t.style)}),[t.style]),null}));(0,e.memo)((0,e.forwardRef)((function(t,n){const i=(0,e.useRef)({props:t}),r=SO((e=>{let{mapLib:n}=e;const r=new n.GeolocateControl(t),s=r._setupUI;return r._setupUI=t=>{r._container.hasChildNodes()||s(t)},r.on("geolocate",(t=>{var e,n;null===(n=(e=i.current.props).onGeolocate)||void 0===n||n.call(e,t)})),r.on("error",(t=>{var e,n;null===(n=(e=i.current.props).onError)||void 0===n||n.call(e,t)})),r.on("outofmaxbounds",(t=>{var e,n;null===(n=(e=i.current.props).onOutOfMaxBounds)||void 0===n||n.call(e,t)})),r.on("trackuserlocationstart",(t=>{var e,n;null===(n=(e=i.current.props).onTrackUserLocationStart)||void 0===n||n.call(e,t)})),r.on("trackuserlocationend",(t=>{var e,n;null===(n=(e=i.current.props).onTrackUserLocationEnd)||void 0===n||n.call(e,t)})),r}),{position:t.position});return i.current.props=t,(0,e.useImperativeHandle)(n,(()=>r),[]),(0,e.useEffect)((()=>{EO(r._container,t.style)}
2),[t.style]),null})));(0,e.memo)((function(t){const n=SO((e=>{let{mapLib:n}=e;return new n.NavigationControl(t)}),{position:t.position});return(0,e.useEffect)((()=>{EO(n._container,t.style)}),[t.style]),null}));(0,e.memo)((function(t){const n=SO((e=>{let{mapLib:n}=e;return new n.ScaleControl(t)}),{position:t.position}),i=(0,e.useRef)(t),r=i.current;i.current=t;const{style:s}=t;return void 0!==t.maxWidth&&t.maxWidth!==r.maxWidth&&(n.options.maxWidth=t.maxWidth),void 0!==t.unit&&t.unit!==r.unit&&n.setUnit(t.unit),(0,e.useEffect)((()=>{EO(n._container,s)}),[s]),null}));const TO=n.e(396).then(n.t.bind(n,396,23)),CO=e.forwardRef((function(t,e){return bO(t,e,TO)}));class AO extends GN{static#t=(()=>this.layerName="CompositeLayer")();get isComposite(){return!0}get isLoaded(){return super.isLoaded&&this.getSubLayers().every((t=>t.isLoaded))}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(t){}setState(t){super.setState(t),this.setNeedsUpdate()}getPickingInfo(t){let{info:e}=t;const{object:n}=e;return n&&n.__source&&n.__source.parent&&n.__source.parent.id===this.id?(e.object=n.__source.object,e.index=n.__source.index,e):e}filterSubLayer(t){return!0}shouldRenderSubLayer(t,e){return e&&e.length}getSubLayerClass(t,e){const{_subLayerProps:n}=this.props;return n&&n[t]&&n[t].type||e}getSubLayerRow(t,e,n){return t.__source={parent:this,object:e,index:n},t}getSubLayerAccessor(t){if("function"===typeof t){const e={index:-1,data:this.props.data,target:[]};return(n,i)=>n&&n.__source?(e.index=n.__source.index,t(n.__source.object,e)):t(n,i)}return t}getSubLayerProps(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{opacity:e,pickable:n,visible:i,parameters:r,getPolygonOffset:s,highlightedObjectIndex:o,autoHighlight:a,highlightColor:l,coordinateSystem:c,coordinateOrigin:u,wrapLongitude:h,positionFormat:d,modelMatrix:p,extensions:f,fetch:g,operation:m,_subLayerProps:_}=this.props,y={id:"",updateTriggers:{},opacity:e,pickable:n,visible:i,parameters:r,getPolygonOffset:s,highlightedObjectIndex:o,autoHighlight:a,highlightColor:l,coordinateSystem:c,coordinateOrigin:u,wrapLongitude:h,positionFormat:d,modelMatrix:p,extensions:f,fetch:g,operation:m},v=_&&t.id&&_[t.id],b=v&&v.updateTriggers,w=t.id||"sublayer";if(v){const e=this.props[aE],n=t.type?t.type._propTypes:{};for(const t in v){const i=n[t]||e[t];i&&"accessor"===i.type&&(v[t]=this.getSubLayerAccessor(v[t]))}}Object.assign(y,t,v),y.id=`${this.props.id}-${w}`,y.updateTriggers={all:this.props.updateTriggers?.all,...t.updateTriggers,...b};for(const E of f){const t=E.getSubLayerProps.call(this,E);t&&Object.assign(y,t,{updateTriggers:Object.assign(y.updateTriggers,t.updateTriggers)})}return y}_updateAutoHighlight(t){for(const e of this.getSubLayers())e.updateAutoHighlight(t)}_getAttributeManager(){return null}_postUpdate(t,e){let n=this.internalState.subLayers;const i=!n||this.needsUpdate();if(i){n=gE(this.renderLayers(),Boolean),this.internalState.subLayers=n}fE("compositeLayer.renderLayers",this,i,n);for(const r of n)r.parent=this}}const PO={name:"project32",dependencies:[Kw],vs:"\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition\n) {\n vec3 projectedPosition = project_position(position, position64Low);\n mat3 rotation;\n if (project_needs_rotation(projectedPosition, rotation)) {\n // offset is specified as ENU\n // when in globe projection, rotate offset so that the ground alighs with the surface of the globe\n offset = rotation * offset;\n }\n commonPosition = vec4(projectedPosition + offset, 1.0);\n return project_common_position_to_clipspace(commonPosition);\n}\n\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset\n) {\n vec4 commonPosition;\n return project_position_to_clipspace(position, position64Low, offset, commonPosition);\n}\n"},RO="#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))\nstruct AmbientLight {\nvec3 color;\n};
2\nstruct PointLight {\nvec3 color;\nvec3 position;\nvec3 attenuation;\n};\nstruct DirectionalLight {\nvec3 color;\nvec3 direction;\n};\nuniform AmbientLight lighting_uAmbientLight;\nuniform PointLight lighting_uPointLight[MAX_LIGHTS];\nuniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];\nuniform int lighting_uPointLightCount;\nuniform int lighting_uDirectionalLightCount;\nuniform bool lighting_uEnabled;\nfloat getPointLightAttenuation(PointLight pointLight, float distance) {\nreturn pointLight.attenuation.x\n+ pointLight.attenuation.y * distance\n+ pointLight.attenuation.z * distance * distance;\n}\n#endif\n",MO={lightSources:{}};function IO(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:e=[0,0,0],intensity:n=1}=t;return e.map((t=>t*n/255))}const LO={name:"lights",vs:RO,fs:RO,getUniforms:function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:MO;if("lightSources"in e){const{ambientLight:t,pointLights:n,directionalLights:i}=e.lightSources||{};return t||n&&n.length>0||i&&i.length>0?Object.assign({},function(t){let{ambientLight:e,pointLights:n=[],directionalLights:i=[]}=t;const r={};return r["lighting_uAmbientLight.color"]=e?IO(e):[0,0,0],n.forEach(((t,e)=>{r[`lighting_uPointLight[${e}].color`]=IO(t),r[`lighting_uPointLight[${e}].position`]=t.position,r[`lighting_uPointLight[${e}].attenuation`]=t.attenuation||[1,0,0]})),r.lighting_uPointLightCount=n.length,i.forEach(((t,e)=>{r[`lighting_uDirectionalLight[${e}].color`]=IO(t),r[`lighting_uDirectionalLight[${e}].direction`]=t.direction})),r.lighting_uDirectionalLightCount=i.length,r}({ambientLight:t,pointLights:n,directionalLights:i}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in e){const n={pointLights:[],directionalLights:[]};for(const t of e.lights||[])switch(t.type){case"ambient":n.ambientLight=t;break;case"directional":n.directionalLights?.push(t);break;case"point":n.pointLights?.push(t)}return t({lightSources:n})}return{}},defines:{MAX_LIGHTS:3}},kO="uniform float lighting_uAmbient;\nuniform float lighting_uDiffuse;\nuniform float lighting_uShininess;\nuniform vec3 lighting_uSpecularColor;\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\nvec3 halfway_direction = normalize(light_direction + view_direction);\nfloat lambertian = dot(light_direction, normal_worldspace);\nfloat specular = 0.0;\nif (lambertian > 0.0) {\nfloat specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\nspecular = pow(specular_angle, lighting_uShininess);\n}\nlambertian = max(lambertian, 0.0);\nreturn (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;\n}\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\nvec3 lightColor = surfaceColor;\nif (lighting_uEnabled) {\nvec3 view_direction = normalize(cameraPosition - position_worldspace);\nlightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;\nfor (int i = 0; i < MAX_LIGHTS; i++) {\nif (i >= lighting_uPointLightCount) {\nbreak;\n}\nPointLight pointLight = lighting_uPointLight[i];\nvec3 light_position_worldspace = pointLight.position;\nvec3 light_direction = normalize(light_position_worldspace - position_worldspace);\nlightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n}\nfor (int i = 0; i < MAX_LIGHTS; i++) {\nif (i >= lighting_uDirectionalLightCount) {\nbreak;\n}\nDirectionalLight directionalLight = lighting_uDirectionalLight[i];\nlightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n}\n}\nreturn lightColor;\n}\nvec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\nvec3 lightColor = vec3(0, 0, 0);\nvec3 surfaceColor = vec3(0, 0, 0);\nif (lighting_uEnabled) {\nvec3 view_direction = normalize(cameraPosition - position_worldspace);\nfor (int i = 0; i < MAX_LIGHTS;
2 i++) {\nif (i >= lighting_uPointLightCount) {\nbreak;\n}\nPointLight pointLight = lighting_uPointLight[i];\nvec3 light_position_worldspace = pointLight.position;\nvec3 light_direction = normalize(light_position_worldspace - position_worldspace);\nlightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n}\nfor (int i = 0; i < MAX_LIGHTS; i++) {\nif (i >= lighting_uDirectionalLightCount) {\nbreak;\n}\nDirectionalLight directionalLight = lighting_uDirectionalLight[i];\nlightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n}\n}\nreturn lightColor;\n}\n",NO={};function OO(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NO;if(!("material"in t))return{};const{material:e}=t;return e?function(t){const{ambient:e=.35,diffuse:n=.6,shininess:i=32,specularColor:r=[30,30,30]}=t;return{lighting_uAmbient:e,lighting_uDiffuse:n,lighting_uShininess:i,lighting_uSpecularColor:r.map((t=>t/255))}}(e):{lighting_uEnabled:!1}}const DO={name:"gouraud-lighting",dependencies:[LO],vs:kO,defines:{LIGHTING_VERTEX:1},getUniforms:OO},FO={name:"phong-lighting",dependencies:[LO],fs:kO,defines:{LIGHTING_FRAGMENT:1},getUniforms:OO},BO=new Float32Array([0,1,1,1]),UO={name:"picking",vs:"uniform pickingUniforms {\nfloat isActive;\nfloat isAttribute;\nfloat isHighlightActive;\nfloat useFloatColors;\nvec3 highlightedObjectColor;\nvec4 highlightColor;\n} picking;\nout vec4 picking_vRGBcolor_Avalid;\nvec3 picking_normalizeColor(vec3 color) {\nreturn picking.useFloatColors > 0.5 ? color : color / 255.0;\n}\nvec4 picking_normalizeColor(vec4 color) {\nreturn picking.useFloatColors > 0.5 ? color : color / 255.0;\n}\nbool picking_isColorZero(vec3 color) {\nreturn dot(color, vec3(1.0)) < 0.00001;\n}\nbool picking_isColorValid(vec3 color) {\nreturn dot(color, vec3(1.0)) > 0.00001;\n}\nbool isVertexHighlighted(vec3 vertexColor) {\nvec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);\nreturn\nbool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor));\n}\nvoid picking_setPickingColor(vec3 pickingColor) {\npickingColor = picking_normalizeColor(pickingColor);\nif (bool(picking.isActive)) {\npicking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));\nif (!bool(picking.isAttribute)) {\npicking_vRGBcolor_Avalid.rgb = pickingColor;\n}\n} else {\npicking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor));\n}\n}\nvoid picking_setPickingAttribute(float value) {\nif (bool(picking.isAttribute)) {\npicking_vRGBcolor_Avalid.r = value;\n}\n}\nvoid picking_setPickingAttribute(vec2 value) {\nif (bool(picking.isAttribute)) {\npicking_vRGBcolor_Avalid.rg = value;\n}\n}\nvoid picking_setPickingAttribute(vec3 value) {\nif (bool(picking.isAttribute)) {\npicking_vRGBcolor_Avalid.rgb = value;\n}\n}\n",fs:"uniform pickingUniforms {\nfloat isActive;\nfloat isAttribute;\nfloat isHighlightActive;\nfloat useFloatColors;\nvec3 highlightedObjectColor;\nvec4 highlightColor;\n} picking;\nin vec4 picking_vRGBcolor_Avalid;\nvec4 picking_filterHighlightColor(vec4 color) {\nif (picking.isActive > 0.5) {\nreturn color;\n}\nbool selected = bool(picking_vRGBcolor_Avalid.a);\nif (selected) {\nfloat highLightAlpha = picking.highlightColor.a;\nfloat blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);\nfloat highLightRatio = highLightAlpha / blendedAlpha;\nvec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio);\nreturn vec4(blendedRGB, blendedAlpha);\n} else {\nreturn color;\n}\n}\nvec4 picking_filterPickingColor(vec4 color) {\nif (bool(picking.isActive)) {\nif (picking_vRGBcolor_Avalid.a == 0.0) {\ndiscard;\n}\nreturn picking_vRGBcolor_Avalid;\n}\nreturn color;\n}\nvec4 picking_filterColor(vec4 color) {\nvec4 highlightColor = picking_filterHighlightColor(color);\nreturn picking_filterPickingColor(highlightColor);\n}\n",uniformTypes:{isActive:"f32",isAttribute:"f32",isHighlightActive:"f32",useFloatColors:"f32",highlightedObjectColor:"vec3<f32>",highlightColor:"vec4<f32>"},defaultUniforms:{isActive:!1,isAttribute:!1,isHighlightActive:!1,useFloatColors:!0,highlightedObjectColor:new Float32Array([0,0,0]),highlightColor:BO},getUniforms:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={};if(void 0===t.highlightedObjectColor);else if(null===t.highlightedObjectColor)e.isHighlightActive=!1;else{e.isHighlightActive=!0;const n=t.highlightedObjectColor.slice(0,3);e.highlightedObjectColor=n}if(t.highlightColor){const n=Array.from(t.highlightColor,(t=>t/255));Number.isFinite(n[3])||(n[3]=1),e.highlightColor=n}void 0!==t.isActive&&(e.isActive=Boolean(t.isActive),e.isAttribute=Boolean(t.isAttribute));void 0!==t.useFloatColors&&(e.useFloatColors=Boolean(t.useFloatColors));return e}};const zO={...UO,defaultUniforms:{...UO.defaultUniforms,useFloatColors:!1},inject:{"vs:DECKGL_FILTER_GL_POSITION":"\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n ","vs:DECKGL_FILTER_COLOR":"\n picking_setPickingColor(geometry.pickingColor);\n ","fs:DECKGL_FILTER_COLOR":{order:99,injection:"\n // use highlight color if this fragment belongs to the selected object.\n color = picking_filterHighlightColor(color);\n\n // use picking color if rendering to picking FBO.\n color = picking_filterPickingColor(color);\n "}}};
vendor: 15,539 bytes, line 2
2class jO{id;topology;vertexCount;indices;attributes;userData={};constructor(t){const{attributes:e={},indices:n=null,vertexCount:i=null}=t;this.id=t.id||wA("geometry"),this.topology=t.topology,n&&(this.indices=ArrayBuffer.isView(n)?{value:n,size:1}:n),this.attributes={};for(const[r,s]of Object.entries(e)){const t=ArrayBuffer.isView(s)?{value:s}:s;OA(ArrayBuffer.isView(t.value),`${this._print(r)}: must be typed array or object with value as typed array`),"POSITION"!==r&&"positions"!==r||t.size||(t.size=3),"indices"===r?(OA(!this.indices),this.indices=t):this.attributes[r]=t}this.indices&&void 0!==this.indices.isIndexed&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=i||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return`Geometry ${this.id} attribute ${t}`}_setAttributes(t,e){return this}_calculateVertexCount(t,e){if(e)return e.value.length;let n=1/0;for(const i of Object.values(t)){const{value:t,size:e,constant:r}=i;!r&&t&&e>=1&&(n=Math.min(n,t.length/e))}return OA(Number.isFinite(n)),n}}var VO=n(392);const WO=1,$O=-1;function GO(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Math.sign(function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{start:n=0,end:i=t.length,plane:r="xy"}=e,s=e.size||2;let o=0;const a=HO[r[0]],l=HO[r[1]];for(let c=n,u=i-s;c<i;c+=s)o+=(t[c+a]-t[u+a])*(t[c+l]+t[u+l]),u=c;return o/2}(t,e))}(t,n);return i!==e&&(function(t,e){const{start:n=0,end:i=t.length,size:r=2}=e,s=(i-n)/r,o=Math.floor(s/2);for(let a=0;a<o;++a){const e=n+a*r,i=n+(s-1-a)*r;for(let n=0;n<r;++n){const r=t[e+n];t[e+n]=t[i+n],t[i+n]=r}}}(t,n),!0)}const HO={x:0,y:1,z:2};function qO(t,e,n,i){let r,s,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];if(8&n)r=(i[3]-t[1])/(e[1]-t[1]),s=3;else if(4&n)r=(i[1]-t[1])/(e[1]-t[1]),s=1;else if(2&n)r=(i[2]-t[0])/(e[0]-t[0]),s=2;else{if(!(1&n))return null;r=(i[0]-t[0])/(e[0]-t[0]),s=0}for(let a=0;a<t.length;a++)o[a]=(1&s)===a?i[s]:r*(e[a]-t[a])+t[a];return o}function ZO(t,e){let n=0;return t[0]<e[0]?n|=1:t[0]>e[2]&&(n|=2),t[1]<e[1]?n|=4:t[1]>e[3]&&(n|=8),n}function XO(t,e){const n=e.length,i=t.length;if(i>0){let r=!0;for(let s=0;s<n;s++)if(t[i-n+s]!==e[s]){r=!1;break}if(r)return!1}for(let r=0;r<n;r++)t[i+r]=e[r];return!0}function KO(t,e){const n=e.length;for(let i=0;i<n;i++)t[i]=e[i]}function YO(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];const s=i+e*n;for(let o=0;o<n;o++)r[o]=t[s+o];return r}function JO(t,e){const{size:n=2,broken:i=!1,gridResolution:r=10,gridOffset:s=[0,0],startIndex:o=0,endIndex:a=t.length}=e||{},l=(a-o)/n;let c=[];const u=[c],h=YO(t,0,n,o);let d,p;const f=iD(h,r,s,[]),g=[];XO(c,h);for(let m=1;m<l;m++){for(d=YO(t,m,n,o,d),p=ZO(d,f);p;){qO(h,d,p,f,g);const t=ZO(g,f);t&&(qO(h,g,t,f,g),p=t),XO(c,g),KO(h,g),rD(f,r,p),i&&c.length>n&&(c=[],u.push(c),XO(c,h)),p=ZO(d,f)}XO(c,d),KO(h,d)}return i?u:u[0]}const QO=0,tD=1;function eD(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0;if(!t.length)return[];const{size:i=2,gridResolution:r=10,gridOffset:s=[0,0],edgeTypes:o=!1}=n||{},a=[],l=[{pos:t,types:o?new Array(t.length/i).fill(tD):null,holes:e||[]}],c=[[],[]];let u=[];for(;l.length;){const{pos:t,types:e,holes:n}=l.shift();sD(t,i,n[0]||t.length,c),u=iD(c[0],r,s,u);const h=ZO(c[1],u);if(h){let r=nD(t,e,i,0,n[0]||t.length,u,h);const s={pos:r[0].pos,types:r[0].types,holes:[]},a={pos:r[1].pos,types:r[1].types,holes:[]};l.push(s,a);for(let l=0;l<n.length;l++)r=nD(t,e,i,n[l],n[l+1]||t.length,u,h),r[0]&&(s.holes.push(s.pos.length),s.pos=oD(s.pos,r[0].pos),o&&(s.types=oD(s.types,r[0].types))),r[1]&&(a.holes.push(a.pos.length),a.pos=oD(a.pos,r[1].pos),o&&(a.types=oD(a.types,r[1].types)))}else{const i={positions:t};o&&(i.edgeTypes=e),n.length&&(i.holeIndices=n),a.push(i)}}return a}function nD(t,e,n,i,r,s,o){const a=(r-i)/n,l=[],c=[],u=[],h=[],d=[];let p,f,g;const m=YO(t,a-1,n,i);let _=Math.sign(8&o?m[1]-s[3]:m[0]-s[2]),y=e&&e[a-1],v=0,b=0;for(let w=0;w<a;w++)p=YO(t,w,n,i,p),f=Math.sign(8&o?p[1]-s[3]:p[0]-s[2]),g=e&&e[i/n+w],f&&_&&_!==f&&(qO(m,p,o,s,d),XO(l,d)&&u.push(y),XO(c,d)&&h.push(y)),f<=0?(XO(l,p)&&u.push(g),v-=f):u.length&&(u[u.length-1]=QO),f>=0?(XO(c,p)&&h.push(g),b+=f):h.length&&(h[h.length-1]=QO),KO(m,p),_=f,y=g;return[v?{pos:l,types:e&&u}:null,b?{pos:c,types:e&&h}:null]}function iD(t,e,n,i){const r=Math.floor((t[0]-n[0])/e)*e+n[0],s=Math.floor((t[1]-n[1])/e)*e+n[1];return i[0]=r,i[1]=s,i[2]=r+e,i[3]=s+e,i}function rD(t,e,n){8&n?(t[1]+=e,t[3]+=e):4&n?(t[1]-=e,t[3]-=e):2&n?(t[0]+=e,t[2]+=e):1&n&&(t[0]-=e,t[2]-=e)}function sD(t,e,n,i){let r=1/0,s=-1/0,o=1/0,a=-1/0;for(let l=0;l<n;l+=e){const e=t[l],n=t[l+1];r=e<r?e:r,s=e>s?e:s,o=n<o?n:o,a=n>a?n:a}return i[0][0]=r,i[0][1]=o,i[1][0]=s,i[1][1]=a,i}function oD(t,e){for(let n=0;n<e.length;n++)t.push(e[n]);return t}const aD=85.051129;function lD(t,e,n,i){let r=-1,s=-1;for(let o=n+1;o<i;o+=e){const e=Math.abs(t[o]);e>r&&(r=e,s=o-1)}return s}function cD(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:aD;const s=t[n],o=t[i-e];if(Math.abs(s-o)>180){const i=YO(t,0,e,n);i[0]+=360*Math.round((o-s)/360),XO(t,i),i[1]=Math.sign(i[1])*r,XO(t,i),i[0]=s,XO(t,i)}}function uD(t,e,n,i){let r,s=t[0];for(let o=n;o<i;o+=e){r=t[o];const e=r-s;(e>180||e<-180)&&(r-=360*Math.round(e/360)),t[o]=s=r}}function hD(t,e){let n;const i=t.length/e;for(let s=0;s<i&&(n=t[s*e],(n+180)%360===0);s++);const r=360*-Math.round(n/360);if(0!==r)for(let s=0;s<i;s++)t[s*e]+=r}const dD=WO,pD=$O,fD={isClosed:!0};function gD(t){return"positions"in t?t.positions:t}function mD(t){return"holeIndices"in t?t.holeIndices:null}function _D(t,e,n,i,r){let s=e;const o=n.length;for(let a=0;a<o;a++)for(let e=0;e<i;e++)t[s++]=n[a][e]||0;if(!function(t){const e=t[0],n=t[t.length-1];return e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]}(n))for(let a=0;a<i;a++)t[s++]=n[0][a]||0;return fD.start=e,fD.end=s,fD.size=i,GO(t,r,fD),s}function yD(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0;s=s||n.length;const a=s-r;if(a<=0)return e;let l=e;for(let c=0;c<a;c++)t[l++]=n[r+c];if(!function(t,e,n,i){for(let r=0;r<e;r++)if(t[n+r]!==t[i-e+r])return!1;return!0}(n,i,r,s))for(let c=0;c<i;c++)t[l++]=n[r+c];return fD.start=e,fD.end=l,fD.size=i,GO(t,o,fD),l}function vD(t,e){!function(t){if(t=t&&t.positions||t,!Array.isArray(t)&&!ArrayBuffer.isView(t))throw new Error("invalid polygon")}(t);const n=[],i=[];if("positions"in t){const{positions:r,holeIndices:s}=t;if(s){let t=0;for(let o=0;o<=s.length;o++)t=yD(n,t,r,e,s[o-1],s[o],0===o?dD:pD),i.push(t);return i.pop(),{positions:n,holeIndices:i}}t=r}if(!function(t){return Array.isArray(t[0])}(t))return yD(n,0,t,e,0,n.length,dD),n;if(!function(t){return t.length>=1&&t[0].length>=2&&Number.isFinite(t[0][0])}(t)){let r=0;for(const[s,o]of t.entries())r=_D(n,r,o,e,0===s?dD:pD),i.push(r);return i.pop(),{positions:n,holeIndices:i}}return _D(n,0,t,e,dD),n}function bD(t,e,n){const i=t.length/3;let r=0;for(let s=0;s<i;s++){const o=(s+1)%i;r+=t[3*s+e]*t[3*o+n],r-=t[3*o+e]*t[3*s+n]}return Math.abs(r/2)}function wD(t,e,n,i){const r=t.length/3;for(let s=0;s<r;s++){const r=3*s,o=t[r+0],a=t[r+1],l=t[r+2];t[r+e]=o,t[r+n]=a,t[r+i]=l}}class ED{constructor(t){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;const{attributes:e={}}=t;this.typedArrayManager=nS,this.attributes={},this._attributeDefs=e,this.opts=t,this.updateGeometry(t)}updateGeometry(t){Object.assign(this.opts,t);const{data:e,buffers:n={},getGeometry:i,geometryBuffer:r,positionFormat:s,dataChanged:o,normalize:a=!0}=this.opts;if(this.data=e,this.getGeometry=i,this.positionSize=r&&r.size||("XY"===s?2:3),this.buffers=n,this.normalize=a,r&&(jT(e.startIndices),this.getGeometry=this.getGeometryFromBuffer(r),a||(n.vertexPositions=r)),this.geometryBuffer=n.vertexPositions,Array.isArray(o))for(const l of o)this._rebuildGeometry(l);else this._rebuildGeometry()}updatePartialGeometry(t){let{startRow:e,endRow:n}=t;this._rebuildGeometry({startRow:e,endRow:n})}getGeometryFromBuffer(t){const e=t.value||t;return ArrayBuffer.isView(e)?GI(e,{size:this.positionSize,offset:t.offset,stride:t.stride,startIndices:this.data.startIndices}):null}_allocate(t,e){const{attributes:n,buffers:i,_attributeDefs:r,typedArrayManager:s}=this;for(const o in r)if(o in i)s.release(n[o]),n[o]=null;else{const i=r[o];i.copy=e,n[o]=s.allocate(n[o],t,i)}}_forEachGeometry(t,e,n){const{data:i,getGeometry:r}=this,{iterable:s,objectInfo:o}=WI(i,e,n);for(const a of s){o.index++;t(r?r(a,o):null,o.index)}}_rebuildGeometry(t){if(!this.data)return;let{indexStarts:e,vertexStarts:n,instanceCount:i}=this;const{data:r,geometryBuffer:s}=this,{startRow:o=0,endRow:a=1/0}=t||{},l={};if(t||(e=[0],n=[0]),this.normalize||!s)this._forEachGeometry(((t,e)=>{const i=t&&this.normalizeGeometry(t);l[e]=i,n[e+1]=n[e]+(i?this.getGeometrySize(i):0)}),o,a),i=n[n.length-1];else if(n=r.startIndices,i=n[r.length]||0,ArrayBuffer.isView(s))i=i||s.length/this.positionSize;else if(s instanceof SA){const t=4*this.positionSize;i=i||s.byteLength/t}else if(s.buffer){const t=s.stride||4*this.positionSize;i=i||s.buffer.byteLength/t}else if(s.value){const t=s.value,e=s.stride/t.BYTES_PER_ELEMENT||this.positionSize;i=i||t.length/e}this._allocate(i,Boolean(t)),this.indexStarts=e,this.vertexStarts=n,this.instanceCount=i;const c={};this._forEachGeometry(((t,r)=>{const s=l[r]||t;c.vertexStart=n[r],c.indexStart=e[r];const o=r<n.length-1?n[r+1]:i;c.geometrySize=o-n[r],c.geometryIndex=r,this.updateGeometryAttributes(s,c)}),o,a),this.vertexCount=e[e.length-1]}}class xD extends ED{constructor(t){const{fp64:e,IndexType:n=Uint32Array}=t;super({...t,attributes:{positions:{size:3,type:e?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:n,size:1}}})}get(t){const{attributes:e}=this;return"indices"===t?e.indices&&e.indices.subarray(0,this.vertexCount):e[t]}updateGeometry(t){super.updateGeometry(t);const e=this.buffers.indices;if(e)this.vertexCount=(e.value||e).length;else if(this.data&&!this.getGeometry)throw new Error("missing indices buffer")}normalizeGeometry(t){if(this.normalize){const e=vD(t,this.positionSize);return this.opts.resolution?eD(gD(e),mD(e),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0;const{size:i=2,normalize:r=!0,edgeTypes:s=!1}=n||{};e=e||[];const o=[],a=[];let l=0,c=0;for(let h=0;h<=e.length;h++){const r=e[h]||t.length,s=c,u=lD(t,i,l,r);for(let e=u;e<r;e++)o[c++]=t[e];for(let e=l;e<u;e++)o[c++]=t[e];uD(o,i,s,c),cD(o,i,s,c,n?.maxLatitude),l=r,a[h]=c}a.pop();const u=eD(o,a,{size:i,gridResolution:360,gridOffset:[-180,-180],edgeTypes:s});if(r)for(const h of u)hD(h.positions,i);return u}(gD(e),mD(e),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):e}return t}getGeometrySize(t){if(SD(t)){let e=0;for(const n of t)e+=this.getGeometrySize(n);return e}return gD(t).length/this.positionSize}getGeometryFromBuffer(t){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(t):null}updateGeometryAttributes(t,e){if(t&&SD(t))for(const n of t){const t=this.getGeometrySize(n);e.geometrySize=t,this.updateGeometryAttributes(n,e),e.vertexStart+=t,e.indexStart=this.indexStarts[e.geometryIndex+1]}else{const n=t;this._updateIndices(n,e),this._updatePositions(n,e),this._updateVertexValid(n,e)}}_updateIndices(t,e){let{geometryIndex:n,vertexStart:i,indexStart:r}=e;const{attributes:s,indexStarts:o,typedArrayManager:a}=this;let l=s.indices;if(!l||!t)return;let c=r;const u=function(t,e,n,i){let r=mD(t);r&&(r=r.map((t=>t/e)));let s=gD(t);const o=i&&3===e;if(n){const t=s.length;s=s.slice();const i=[];for(let r=0;r<t;r+=e){i[0]=s[r],i[1]=s[r+1],o&&(i[2]=s[r+2]);const t=n(i);s[r]=t[0],s[r+1]=t[1],o&&(s[r+2]=t[2])}}if(o){const t=bD(s,0,1),e=bD(s,0,2),i=bD(s,1,2);if(!t&&!e&&!i)return[];t>e&&t>i||(e>i?(n||(s=s.slice()),wD(s,0,2,1)):(n||(s=s.slice()),wD(s,2,0,1)))}return VO(s,r,e)}(t,this.positionSize,this.opts.preproject,this.opts.full3d);l=a.allocate(l,r+u.length,{copy:!0});for(let h=0;h<u.length;h++)l[c++]=u[h]+i;o[n+1]=r+u.length,s.indices=l}_updatePositions(t,e){let{vertexStart:n,geometrySize:i}=e;const{attributes:{positions:r},positionSize:s}=this;if(!r||!t)return;const o=gD(t);for(let a=n,l=0;l<i;a++,l++){const t=o[l*s],e=o[l*s+1],n=s>2?o[l*s+2]:0;r[3*a]=t,r[3*a+1]=e,r[3*a+2]=n}}_updateVertexValid(t,e){let{vertexStart:n,geometrySize:i}=e;const{positionSize:r}=this,s=this.attributes.vertexValid,o=t&&mD(t);if(t&&t.edgeTypes?s.set(t.edgeTypes,n):s.fill(1,n,n+i),o)for(let a=0;a<o.length;a++)s[n+o[a]/r-1]=0;s[n+i-1]=0}}function SD(t){return Array.isArray(t)&&t.length>0&&!Number.isFinite(t[0])}const TD="uniform bool extruded;\nuniform bool isWireframe;\nuniform float elevationScale;\nuniform float opacity;\nin vec4 fillColors;\nin vec4 lineColors;\nin vec3 pickingColors;\nout vec4 vColor;\nstruct PolygonProps {\nvec3 positions;\nvec3 positions64Low;\nvec3 normal;\nfloat elevations;\n};\nvec3 project_offset_normal(vec3 vector) {\nif (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\nproject_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\nreturn normalize(vector * project_uCommonUnitsPerWorldUnit);\n}\nreturn project_normal(vector);\n}\nvoid calculatePosition(PolygonProps props) {\nvec3 pos = props.positions;\nvec3 pos64Low = props.positions64Low;\nvec3 normal = props.normal;\nvec4 colors = isWireframe ? lineColors : fillColors;\ngeometry.worldPosition = props.positions;\ngeometry.pickingColor = pickingColors;\nif (extruded) {\npos.z += props.elevations * elevationScale;\n}\ngl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\nif (extruded) {\n#ifdef IS_SIDE_VERTEX\nnormal = project_offset_normal(normal);\n#else\nnormal = project_normal(normal);\n#endif\ngeometry.normal = normal;\nvec3 lightColor = lighting_getLightColor(colors.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);\nvColor = vec4(lightColor, colors.a * opacity);\n} else {\nvColor = vec4(colors.rgb, colors.a * opacity);\n}\nDECKGL_FILTER_COLOR(vColor, geometry);\n}\n",CD=`#version 300 es\n#define SHADER_NAME solid-polygon-layer-vertex-shader\nin vec3 vertexPositions;\nin vec3 vertexPositions64Low;\nin float elevations;\n${TD}\nvoid main(void) {\nPolygonProps props;\nprops.positions = vertexPositions;\nprops.positions64Low = vertexPositions64Low;\nprops.elevations = elevations;\nprops.normal = vec3(0.0, 0.0, 1.0);\ncalculatePosition(props);\n}\n`,AD=`#version 300 es\n#define SHADER_NAME solid-polygon-layer-vertex-shader-side\n#define IS_SIDE_VERTEX\nin vec2 positions;\nin vec3 vertexPositions;\nin vec3 nextVertexPositions;\nin vec3 vertexPositions64Low;\nin vec3 nextVertexPositions64Low;\nin float elevations;\nin float instanceVertexValid;\n${TD}\nvoid main(void) {\nif(instanceVertexValid < 0.5){\ngl_Position = vec4(0.);\nreturn;\n}\nPolygonProps props;\nvec3 pos;\nvec3 pos64Low;\nvec3 nextPos;\nvec3 nextPos64Low;\n#if RING_WINDING_ORDER_CW == 1\npos = vertexPositions;\npos64Low = vertexPositions64Low;
2\nnextPos = nextVertexPositions;\nnextPos64Low = nextVertexPositions64Low;\n#else\npos = nextVertexPositions;\npos64Low = nextVertexPositions64Low;\nnextPos = vertexPositions;\nnextPos64Low = vertexPositions64Low;\n#endif\nprops.positions = mix(pos, nextPos, positions.x);\nprops.positions64Low = mix(pos64Low, nextPos64Low, positions.x);\nprops.normal = vec3(\npos.y - nextPos.y + (pos64Low.y - nextPos64Low.y),\nnextPos.x - pos.x + (nextPos64Low.x - pos64Low.x),\n0.0);\nprops.elevations = elevations * positions.y;\ncalculatePosition(props);\n}\n`,PD=[0,0,0,255],RD={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:t=>t.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:PD},getLineColor:{type:"accessor",value:PD},material:!0},MD={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t};class ID extends GN{static#t=(()=>this.defaultProps=RD)();static#e=(()=>this.layerName="SolidPolygonLayer")();getShaders(t){return super.getShaders({vs:"top"===t?CD:AD,fs:"#version 300 es\n#define SHADER_NAME solid-polygon-layer-fragment-shader\nprecision highp float;\nin vec4 vColor;\nout vec4 fragColor;\nvoid main(void) {\nfragColor = vColor;\ngeometry.uv = vec2(0.);\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",defines:{RING_WINDING_ORDER_CW:this.props._normalize||"CCW"!==this.props._windingOrder?1:0},modules:[PO,DO,zO]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){const{viewport:t}=this.context;let{coordinateSystem:e}=this.props;const{_full3d:n}=this.props;let i;t.isGeospatial&&e===bw.DEFAULT&&(e=bw.LNGLAT),e===bw.LNGLAT&&(i=n?t.projectPosition.bind(t):t.projectFlat.bind(t)),this.setState({numInstances:0,polygonTesselator:new xD({preproject:i,fp64:this.use64bitPositions(),IndexType:Uint32Array})});const r=this.getAttributeManager(),s=!0;r.remove(["instancePickingColors"]),r.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:s},vertexPositions:{size:3,type:"float64",stepMode:"dynamic",fp64:this.use64bitPositions(),transition:MD,accessor:"getPolygon",update:this.calculatePositions,noAlloc:s,shaderAttributes:{nextVertexPositions:{vertexOffset:1}}},instanceVertexValid:{size:1,type:"uint16",stepMode:"instance",update:this.calculateVertexValid,noAlloc:s},elevations:{size:1,stepMode:"dynamic",transition:MD,accessor:"getElevation"},fillColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:MD,accessor:"getFillColor",defaultValue:PD},lineColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:MD,accessor:"getLineColor",defaultValue:PD},pickingColors:{size:4,type:"uint8",stepMode:"dynamic",accessor:(t,e)=>{let{index:n,target:i}=e;return this.encodePickingColor(t&&t.__source?t.__source.index:n,i)}}})}getPickingInfo(t){const e=super.getPickingInfo(t),{index:n}=e,i=this.props.data;return i[0]&&i[0].__source&&(e.object=i.find((t=>t.__source.index===n))),e}disablePickingIndex(t){const e=this.props.data;if(e[0]&&e[0].__source)for(let n=0;n<e.length;n++)e[n].__source.index===t&&this._disablePickingIndex(n);else super.disablePickingIndex(t)}draw(t){let{uniforms:e}=t;const{extruded:n,filled:i,wireframe:r,elevationScale:s}=this.props,{topModel:o,sideModel:a,wireframeModel:l,polygonTesselator:c}=this.state,u={...e,extruded:Boolean(n),elevationScale:s};l&&r&&(l.setInstanceCount(c.instanceCount-1),l.setUniforms(u),l.draw(this.context.renderPass)),a&&i&&(a.setInstanceCount(c.instanceCount-1),a.setUniforms(u),a.draw(this.context.renderPass)),o&&i&&(o.setVertexCount(c.vertexCount),o.setUniforms(u),o.draw(this.context.renderPass))}updateState(t){super.updateState(t),this.updateGeometry(t);const{props:e,oldProps:n,changeFlags:i}=t,r=this.getAttributeManager();(i.extensionsChanged||e.filled!==n.filled||e.extruded!==n.extruded)&&(this.state.models?.forEach((t=>t.destroy())),this.setState(this._getModels()),r.invalidateAll())}updateGeometry(t){let{props:e,oldProps:n,changeFlags:i}=t;if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){const{polygonTesselator:t}=this.state,n=e.data.attributes||{};t.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:n.getPolygon,buffers:n,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:e._full3d}),this.setState({numInstances:t.instanceCount,startIndices:t.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){const{id:t,filled:e,extruded:n}=this.props;let i,r,s;if(e){const e=this.getShaders("top");e.defines.NON_INSTANCED_MODEL=1;const n=this.getAttributeManager().getBufferLayouts({isInstanced:!1});i=new Ok(this.context.device,{...e,id:`${t}-top`,topology:"triangle-list",uniforms:{isWireframe:!1},bufferLayout:n,isIndexed:!0,userData:{excludeAttributes:{instanceVertexValid:!0}}})}if(n){const e=this.getAttributeManager().getBufferLayouts({isInstanced:!0});
2r=new Ok(this.context.device,{...this.getShaders("side"),id:`${t}-side`,bufferLayout:e,uniforms:{isWireframe:!1},geometry:new jO({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}),s=new Ok(this.context.device,{...this.getShaders("side"),id:`${t}-wireframe`,bufferLayout:e,uniforms:{isWireframe:!0},geometry:new jO({topology:"line-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}})}return{models:[r,s,i].filter(Boolean),topModel:i,sideModel:r,wireframeModel:s}}calculateIndices(t){const{polygonTesselator:e}=this.state;t.startIndices=e.indexStarts,t.value=e.get("indices")}calculatePositions(t){const{polygonTesselator:e}=this.state;t.startIndices=e.vertexStarts,t.value=e.get("positions")}calculateVertexValid(t){t.value=this.state.polygonTesselator.get("vertexValid")}}function LD(t,e,n,i){let r;if(Array.isArray(t[0])){const n=t.length*e;r=new Array(n);for(let i=0;i<t.length;i++)for(let n=0;n<e;n++)r[i*e+n]=t[i][n]||0}else r=t;return n?JO(r,{size:e,gridResolution:n}):i?function(t,e){const{size:n=2,startIndex:i=0,endIndex:r=t.length,normalize:s=!0}=e||{},o=t.slice(i,r);uD(o,n,0,r-i);const a=JO(o,{size:n,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(s)for(const l of a)hD(l,n);return a}(r,{size:e}):r}class kD extends ED{constructor(t){super({...t,attributes:{positions:{size:3,padding:18,initialize:!0,type:t.fp64?Float64Array:Float32Array},segmentTypes:{size:1,type:Uint8ClampedArray}}})}get(t){return this.attributes[t]}getGeometryFromBuffer(t){return this.normalize?super.getGeometryFromBuffer(t):null}normalizeGeometry(t){return this.normalize?LD(t,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):t}getGeometrySize(t){if(ND(t)){let e=0;for(const n of t)e+=this.getGeometrySize(n);return e}const e=this.getPathLength(t);return e<2?0:this.isClosed(t)?e<3?0:e+2:e}updateGeometryAttributes(t,e){if(0!==e.geometrySize)if(t&&ND(t))for(const n of t){const t=this.getGeometrySize(n);e.geometrySize=t,this.updateGeometryAttributes(n,e),e.vertexStart+=t}else this._updateSegmentTypes(t,e),this._updatePositions(t,e)}_updateSegmentTypes(t,e){const n=this.attributes.segmentTypes,i=!!t&&this.isClosed(t),{vertexStart:r,geometrySize:s}=e;n.fill(0,r,r+s),i?(n[r]=4,n[r+s-2]=4):(n[r]+=1,n[r+s-2]+=2),n[r+s-1]=4}_updatePositions(t,e){const{positions:n}=this.attributes;if(!n||!t)return;const{vertexStart:i,geometrySize:r}=e,s=new Array(3);for(let o=i,a=0;a<r;o++,a++)this.getPointOnPath(t,a,s),n[3*o]=s[0],n[3*o+1]=s[1],n[3*o+2]=s[2]}getPathLength(t){return t.length/this.positionSize}getPointOnPath(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const{positionSize:i}=this;e*i>=t.length&&(e+=1-t.length/i);const r=e*i;return n[0]=t[r],n[1]=t[r+1],n[2]=3===i&&t[r+2]||0,n}isClosed(t){if(!this.normalize)return Boolean(this.opts.loop);const{positionSize:e}=this,n=t.length-e;return t[0]===t[n]&&t[1]===t[n+1]&&(2===e||t[2]===t[n+2])}}function ND(t){return Array.isArray(t[0])}const OD=[0,0,0,255],DD={widthUnits:"meters",widthScale:{type:"number",min:0,value:1},widthMinPixels:{type:"number",min:0,value:0},widthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:"number",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:"accessor",value:t=>t.path},getColor:{type:"accessor",value:OD},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},FD={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t};class BD extends GN{static#t=(()=>this.defaultProps=DD)();static#e=(()=>this.layerName="PathLayer")();getShaders(){return super.getShaders({vs:"#version 300 es\n#define SHADER_NAME path-layer-vertex-shader\nin vec2 positions;\nin float instanceTypes;\nin vec3 instanceStartPositions;\nin vec3 instanceEndPositions;\nin vec3 instanceLeftPositions;\nin vec3 instanceRightPositions;\nin vec3 instanceLeftPositions64Low;\nin vec3 instanceStartPositions64Low;\nin vec3 instanceEndPositions64Low;\nin vec3 instanceRightPositions64Low;\nin float instanceStrokeWidths;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float jointType;\nuniform float capType;\nuniform float miterLimit;
2\nuniform bool billboard;\nuniform int widthUnits;\nuniform float opacity;\nout vec4 vColor;\nout vec2 vCornerOffset;\nout float vMiterLength;\nout vec2 vPathPosition;\nout float vPathLength;\nout float vJointType;\nconst float EPSILON = 0.001;\nconst vec3 ZERO_OFFSET = vec3(0.0);\nfloat flipIfTrue(bool flag) {\nreturn -(float(flag) * 2. - 1.);\n}\nvec3 getLineJoinOffset(\nvec3 prevPoint, vec3 currPoint, vec3 nextPoint,\nvec2 width\n) {\nbool isEnd = positions.x > 0.0;\nfloat sideOfPath = positions.y;\nfloat isJoint = float(sideOfPath == 0.0);\nvec3 deltaA3 = (currPoint - prevPoint);\nvec3 deltaB3 = (nextPoint - currPoint);\nmat3 rotationMatrix;\nbool needsRotation = !billboard && project_needs_rotation(currPoint, rotationMatrix);\nif (needsRotation) {\ndeltaA3 = deltaA3 * rotationMatrix;\ndeltaB3 = deltaB3 * rotationMatrix;\n}\nvec2 deltaA = deltaA3.xy / width;\nvec2 deltaB = deltaB3.xy / width;\nfloat lenA = length(deltaA);\nfloat lenB = length(deltaB);\nvec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);\nvec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);\nvec2 perpA = vec2(-dirA.y, dirA.x);\nvec2 perpB = vec2(-dirB.y, dirB.x);\nvec2 tangent = dirA + dirB;\ntangent = length(tangent) > 0. ? normalize(tangent) : perpA;\nvec2 miterVec = vec2(-tangent.y, tangent.x);\nvec2 dir = isEnd ? dirA : dirB;\nvec2 perp = isEnd ? perpA : perpB;\nfloat L = isEnd ? lenA : lenB;\nfloat sinHalfA = abs(dot(miterVec, perp));\nfloat cosHalfA = abs(dot(dirA, miterVec));\nfloat turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);\nfloat cornerPosition = sideOfPath * turnDirection;\nfloat miterSize = 1.0 / max(sinHalfA, EPSILON);\nmiterSize = mix(\nmin(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),\nmiterSize,\nstep(0.0, cornerPosition)\n);\nvec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))\n* (sideOfPath + isJoint * turnDirection);\nbool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));\nbool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));\nbool isCap = isStartCap || isEndCap;\nif (isCap) {\noffsetVec = mix(perp * sideOfPath, dir * capType * 4.0 * flipIfTrue(isStartCap), isJoint);\nvJointType = capType;\n} else {\nvJointType = jointType;\n}\nvPathLength = L;\nvCornerOffset = offsetVec;\nvMiterLength = dot(vCornerOffset, miterVec * turnDirection);\nvMiterLength = isCap ? isJoint : vMiterLength;\nvec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);\nvPathPosition = vec2(\ndot(offsetFromStartOfPath, perp),\ndot(offsetFromStartOfPath, dir)\n);\ngeometry.uv = vPathPosition;\nfloat isValid = step(instanceTypes, 3.5);\nvec3 offset = vec3(offsetVec * width * isValid, 0.0);\nif (needsRotation) {\noffset = rotationMatrix * offset;\n}\nreturn offset;\n}\nvoid clipLine(inout vec4 position, vec4 refPosition) {\nif (position.w < EPSILON) {\nfloat r = (EPSILON - refPosition.w) / (position.w - refPosition.w);\nposition = refPosition + (position - refPosition) * r;\n}\n}\nvoid main() {\ngeometry.pickingColor = instancePickingColors;\nvColor = vec4(instanceColors.rgb, instanceColors.a * opacity);\nfloat isEnd = positions.x;\nvec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);\nvec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);\nvec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);\nvec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);\nvec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);\nvec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);\ngeometry.worldPosition = currPosition;\nvec2 widthPixels = vec2(clamp(\nproject_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),\nwidthMinPixels, widthMaxPixels) / 2.0);\nvec3 width;\nif (billboard) {\nvec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);\nvec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);
2\nvec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);\nclipLine(prevPositionScreen, currPositionScreen);\nclipLine(nextPositionScreen, currPositionScreen);\nclipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));\nwidth = vec3(widthPixels, 0.0);\nDECKGL_FILTER_SIZE(width, geometry);\nvec3 offset = getLineJoinOffset(\nprevPositionScreen.xyz / prevPositionScreen.w,\ncurrPositionScreen.xyz / currPositionScreen.w,\nnextPositionScreen.xyz / nextPositionScreen.w,\nproject_pixel_size_to_clipspace(width.xy)\n);\nDECKGL_FILTER_GL_POSITION(currPositionScreen, geometry);\ngl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w);\n} else {\nprevPosition = project_position(prevPosition, prevPosition64Low);\ncurrPosition = project_position(currPosition, currPosition64Low);\nnextPosition = project_position(nextPosition, nextPosition64Low);\nwidth = vec3(project_pixel_size(widthPixels), 0.0);\nDECKGL_FILTER_SIZE(width, geometry);\nvec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy);\ngeometry.position = vec4(currPosition + offset, 1.0);\ngl_Position = project_common_position_to_clipspace(geometry.position);\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n}\nDECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME path-layer-fragment-shader\nprecision highp float;\nuniform float miterLimit;\nin vec4 vColor;\nin vec2 vCornerOffset;\nin float vMiterLength;\nin vec2 vPathPosition;\nin float vPathLength;\nin float vJointType;\nout vec4 fragColor;\nvoid main(void) {\ngeometry.uv = vPathPosition;\nif (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {\nif (vJointType > 0.5 && length(vCornerOffset) > 1.0) {\ndiscard;\n}\nif (vJointType < 0.5 && vMiterLength > miterLimit + 1.0) {\ndiscard;\n}\n}\nfragColor = vColor;\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",modules:[PO,zO]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){this.getAttributeManager().addInstanced({vertexPositions:{size:3,vertexOffset:1,type:"float64",fp64:this.use64bitPositions(),transition:FD,accessor:"getPath",update:this.calculatePositions,noAlloc:true,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:"uint8",update:this.calculateSegmentTypes,noAlloc:true},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:FD,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:FD,defaultValue:OD},instancePickingColors:{size:4,type:"uint8",accessor:(t,e)=>{let{index:n,target:i}=e;return this.encodePickingColor(t&&t.__source?t.__source.index:n,i)}}}),this.setState({pathTesselator:new kD({fp64:this.use64bitPositions()})})}updateState(t){super.updateState(t);const{props:e,changeFlags:n}=t,i=this.getAttributeManager();if(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getPath)){const{pathTesselator:t}=this.state,r=e.data.attributes||{};t.updateGeometry({data:e.data,geometryBuffer:r.getPath,buffers:r,normalize:!e._pathType,loop:"loop"===e._pathType,getGeometry:e.getPath,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:n.dataChanged}),this.setState({numInstances:t.instanceCount,startIndices:t.vertexStarts}),n.dataChanged||i.invalidateAll()}n.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),i.invalidateAll())}getPickingInfo(t){const e=super.getPickingInfo(t),{index:n}=e,i=this.props.data;return i[0]&&i[0].__source&&(e.object=i.find((t=>t.__source.index===n))),e}disablePickingIndex(t){const e=this.props.data;if(e[0]&&e[0].__source)for(let n=0;n<e.length;n++)e[n].__source.index===t&&this._disablePickingIndex(n);else super.disablePickingIndex(t)}draw(t){let{uniforms:e}=t;const{jointRounded:n,capRounded:i,billboard:r,miterLimit:s,widthUnits:o,widthScale:a,widthMinPixels:l,widthMaxPixels:c}=this.props,u=this.state.model;u.setUniforms(e),u.setUniforms({jointType:Number(n),capType:Number(i),billboard:r,widthUnits:Ew[o],widthScale:a,miterLimit:s,widthMinPixels:l,widthMaxPixels:c}),u.draw(this.context.renderPass)}
2_getModel(){return new Ok(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new jO({topology:"triangle-list",attributes:{indices:new Uint16Array([0,1,2,1,4,2,1,3,4,3,5,4]),positions:{value:new Float32Array([0,0,0,-1,0,1,1,-1,1,1,1,0]),size:2}}}),isInstanced:!0})}calculatePositions(t){const{pathTesselator:e}=this.state;t.startIndices=e.vertexStarts,t.value=e.get("positions")}calculateSegmentTypes(t){const{pathTesselator:e}=this.state;t.startIndices=e.vertexStarts,t.value=e.get("segmentTypes")}}function UD(t){let{data:e,getIndex:n,dataRange:i,replace:r}=t;const{startRow:s=0,endRow:o=1/0}=i,a=e.length;let l=a,c=a;for(let d=0;d<a;d++){const t=n(e[d]);if(l>d&&t>=s&&(l=d),t>=o){c=d;break}}let u=l;const h=c-l!==r.length?e.slice(c):void 0;for(let d=0;d<r.length;d++)e[u++]=r[d];if(h){for(let t=0;t<h.length;t++)e[u++]=h[t];e.length=u}return{startRow:l,endRow:l+r.length}}const zD=[0,0,0,255],jD={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,getPolygon:{type:"accessor",value:t=>t.polygon},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:zD},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0};class VD extends AO{static#t=(()=>this.layerName="PolygonLayer")();static#e=(()=>this.defaultProps=jD)();initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&vw.removed("getLineDashArray","PathStyleExtension")()}updateState(t){let{changeFlags:e}=t;const n=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(n&&Array.isArray(e.dataChanged)){const t=this.state.paths.slice(),n=e.dataChanged.map((e=>UD({data:t,getIndex:t=>t.__source.index,dataRange:e,replace:this._getPaths(e)})));this.setState({paths:t,pathsDiff:n})}else n&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{data:e,getPolygon:n,positionFormat:i,_normalize:r}=this.props,s=[],o="XY"===i?2:3,{startRow:a,endRow:l}=t,{iterable:c,objectInfo:u}=WI(e,a,l);for(const h of c){u.index++;let t=n(h,u);r&&(t=vD(t,o));const{holeIndices:e}=t,i=t.positions||t;if(e)for(let n=0;n<=e.length;n++){const t=i.slice(e[n-1]||0,e[n]||i.length);s.push(this.getSubLayerRow({path:t},h,u.index))}else s.push(this.getSubLayerRow({path:i},h,u.index))}return s}renderLayers(){const{data:t,_dataDiff:e,stroked:n,filled:i,extruded:r,wireframe:s,_normalize:o,_windingOrder:a,elevationScale:l,transitions:c,positionFormat:u}=this.props,{lineWidthUnits:h,lineWidthScale:d,lineWidthMinPixels:p,lineWidthMaxPixels:f,lineJointRounded:g,lineMiterLimit:m,lineDashJustified:_}=this.props,{getFillColor:y,getLineColor:v,getLineWidth:b,getLineDashArray:w,getElevation:E,getPolygon:x,updateTriggers:S,material:T}=this.props,{paths:C,pathsDiff:A}=this.state,P=this.getSubLayerClass("fill",ID),R=this.getSubLayerClass("stroke",BD),M=this.shouldRenderSubLayer("fill",C)&&new P({_dataDiff:e,extruded:r,elevationScale:l,filled:i,wireframe:s,_normalize:o,_windingOrder:a,getElevation:E,getFillColor:y,getLineColor:r&&s?v:zD,material:T,transitions:c},this.getSubLayerProps({id:"fill",updateTriggers:S&&{getPolygon:S.getPolygon,getElevation:S.getElevation,getFillColor:S.getFillColor,lineColors:r&&s,getLineColor:S.getLineColor}}),{data:t,positionFormat:u,getPolygon:x});return[!r&&M,!r&&n&&this.shouldRenderSubLayer("stroke",C)&&new R({_dataDiff:A&&(()=>A),widthUnits:h,widthScale:d,widthMinPixels:p,widthMaxPixels:f,jointRounded:g,miterLimit:m,dashJustified:_,_pathType:"loop",transitions:c&&{getWidth:c.getLineWidth,getColor:c.getLineColor,getPath:c.getPolygon},getColor:this.getSubLayerAccessor(v),getWidth:this.getSubLayerAccessor(b),getDashArray:this.getSubLayerAccessor(w)}
2,this.getSubLayerProps({id:"stroke",updateTriggers:S&&{getWidth:S.getLineWidth,getColor:S.getLineColor,getDashArray:S.getLineDashArray}}),{data:C,positionFormat:u,getPath:t=>t.path}),r&&M]}}const WD=t=>{let{data:e,dataType:n,minValue:i,maxValue:r,polygonBaseHeight:s,polygonScaleFactor:o,healthScaleFactor:a,onHover:l}=t;const c=oa().domain([i,100,r]).range([[255,235,235],[50,0,155],[0,0,0]]),u=oa().domain([i,r]).range("moer"===n?[[255,255,0],[139,0,0]]:[[255,235,235],[50,0,155]]),h=oa().domain([i,r]).range([[255,255,255],[255,0,0],[0,0,0]]);return new VD({id:`polygon-layer-${n}`,data:e,pickable:!0,stroked:!0,filled:!0,extruded:!0,lineWidthMinPixels:1,getPolygon:t=>t.polygon,getElevation:t=>{const e=s,r=o;if("moer"===n)return e+(t.properties.value-i)*r;if("health_damage"===n)return e+(t.properties.health_damage-i)*r;if("social_cost_of_carbon"===n){return e+(Math.round(453592e-9*t.properties.value*208*100)/100-i)*r}},getFillColor:t=>{let e,i;return"moer"===n?(e=t.properties.value,i=u(e)):"health_damage"===n?(e=t.properties.health_damage,i=e>100?[25,0,105]:c(e)):"social_cost_of_carbon"===n&&(e=Math.round(453592e-9*t.properties.value*208*100)/100,i=h(e)),i},getLineColor:[255,100,100],transitions:{getElevation:{duration:1e3,easing:vi}},onHover:l})},$D=Math.PI/180,GD=new Float32Array(16),HD=new Float32Array(12);function qD(t,e,n){const i=e[0]*$D,r=e[1]*$D,s=e[2]*$D,o=Math.sin(s),a=Math.sin(i),l=Math.sin(r),c=Math.cos(s),u=Math.cos(i),h=Math.cos(r),d=n[0],p=n[1],f=n[2];t[0]=d*h*u,t[1]=d*l*u,t[2]=d*-a,t[3]=p*(-l*c+h*a*o),t[4]=p*(h*c+l*a*o),t[5]=p*u*o,t[6]=f*(l*o+h*a*c),t[7]=f*(-h*o+l*a*c),t[8]=f*u*c}function ZD(t){return t[0]=t[0],t[1]=t[1],t[2]=t[2],t[3]=t[4],t[4]=t[5],t[5]=t[6],t[6]=t[8],t[7]=t[9],t[8]=t[10],t[9]=t[12],t[10]=t[13],t[11]=t[14],t.subarray(0,12)}const XD={size:12,accessor:["getOrientation","getScale","getTranslation","getTransformMatrix"],shaderAttributes:{instanceModelMatrixCol0:{size:3,elementOffset:0},instanceModelMatrixCol1:{size:3,elementOffset:3},instanceModelMatrixCol2:{size:3,elementOffset:6},instanceTranslation:{size:3,elementOffset:9}},update(t,e){let{startRow:n,endRow:i}=e;const{data:r,getOrientation:s,getScale:o,getTranslation:a,getTransformMatrix:l}=this.props,c=Array.isArray(l),u=c&&16===l.length,h=Array.isArray(o),d=Array.isArray(s),p=Array.isArray(a),f=u||!c&&Boolean(l(r[0]));t.constant=f?u:d&&h&&p;const g=t.value;if(t.constant){let e;if(f)GD.set(l),e=ZD(GD);else{e=HD;qD(e,s,o),e.set(a,9)}t.value=new Float32Array(e)}else{let e=n*t.size;const{iterable:c,objectInfo:m}=WI(r,n,i);for(const t of c){let n;if(m.index++,f)GD.set(u?l:l(t,m)),n=ZD(GD);else{n=HD;qD(n,d?s:s(t,m),h?o:o(t,m)),n.set(p?a:a(t,m),9)}g[e++]=n[0],g[e++]=n[1],g[e++]=n[2],g[e++]=n[3],g[e++]=n[4],g[e++]=n[5],g[e++]=n[6],g[e++]=n[7],g[e++]=n[8],g[e++]=n[9],g[e++]=n[10],g[e++]=n[11]}}}};function KD(t,e){return e===bw.CARTESIAN||e===bw.METER_OFFSETS||e===bw.DEFAULT&&!t.isGeospatial}function YD(t){const e=t.positions||t.POSITION;vw.assert(e,'no "postions" or "POSITION" attribute in mesh');const n=e.value.length/e.size;let i=t.COLOR_0||t.colors;i||(i={size:3,value:new Float32Array(3*n).fill(1)});let r=t.NORMAL||t.normals;r||(r={size:3,value:new Float32Array(3*n).fill(0)});let s=t.TEXCOORD_0||t.texCoords;return s||(s={size:2,value:new Float32Array(2*n).fill(0)}),{positions:e,colors:i,normals:r,texCoords:s}}function JD(t){return t instanceof jO?(t.attributes=YD(t.attributes),t):t.attributes?new jO({...t,topology:"triangle-list",attributes:YD(t.attributes)}):new jO({topology:"triangle-list",attributes:YD(t)})}const QD={mesh:{type:"object",value:null,async:!0},texture:{type:"image",value:null,async:!0},sizeScale:{type:"number",value:1,min:0},_instanced:!0,wireframe:!1,material:!0,getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:[0,0,0,255]},getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},textureParameters:{type:"object",ignore:!0,value:null}};class tF extends GN{static#t=(()=>this.defaultProps=QD)();static#e=(()=>this.layerName="SimpleMeshLayer")();getShaders(){return super.getShaders({vs:"#version 300 es\n#define SHADER_NAME simple-mesh-layer-vs\nuniform float sizeScale;\nuniform bool composeModelMatrix;\nin vec3 positions;\nin vec3 normals;\nin vec3 colors;\nin vec2 texCoords;\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin vec3 instanceModelMatrixCol0;\nin vec3 instanceModelMatrixCol1;\nin vec3 instanceModelMatrixCol2;\nin vec3 instanceTranslation;\nout vec2 vTexCoord;\nout vec3 cameraPosition;\nout vec3 normals_commonspace;\nout vec4 position_commonspace;\nout vec4 vColor;\nvoid main(void) {\ngeometry.worldPosition = instancePositions;\ngeometry.uv = texCoords;\ngeometry.pickingColor = instancePickingColors;\nvTexCoord = texCoords;\ncameraPosition = project_uCameraPosition;\nvColor = vec4(colors * instanceColors.rgb, instanceColors.a);\nmat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);\nvec3 pos = (instanceModelMatrix * positions) * sizeScale + instanceTranslation;\nif (composeModelMatrix) {\nDECKGL_FILTER_SIZE(pos, geometry);\nnormals_commonspace = project_normal(instanceModelMatrix * normals);\ngeometry.worldPosition += pos;\ngl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), position_commonspace);\ngeometry.position = position_commonspace;\n}\nelse {\npos = project_size(pos);\nDECKGL_FILTER_SIZE(pos, geometry);\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, position_commonspace);\ngeometry.position = position_commonspace;\nnormals_commonspace = project_normal(instanceModelMatrix * normals);\n}\ngeometry.normal = normals_commonspace;\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\nDECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME simple-mesh-layer-fs\nprecision highp float;\nuniform bool hasTexture;\nuniform sampler2D sampler;\nuniform bool flatShading;\nuniform float opacity;\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\nout vec4 fragColor;\nvoid main(void) {\ngeometry.uv = vTexCoord;\nvec3 normal;\nif (flatShading) {\nnormal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n} else {\nnormal = normals_commonspace;\n}\nvec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;\nDECKGL_FILTER_COLOR(color, geometry);\nvec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\nfragColor = vec4(lightColor, color.a * opacity);\n}\n",modules:[PO,FO,zO]})}getBounds(){if(this.props._instanced)return super.getBounds();let t=this.state.positionBounds;if(t)return t;const{mesh:e}=this.props;if(!e)return null;
vendor: 4,079 bytes, line 2
2if(t=e.header?.boundingBox,!t){const{attributes:n}=JD(e);n.POSITION=n.POSITION||n.positions,t=function(t){let e=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;const a=t.POSITION?t.POSITION.value:[],l=a&&a.length;for(let c=0;c<l;c+=3){const t=a[c],l=a[c+1],u=a[c+2];e=t<e?t:e,n=l<n?l:n,i=u<i?u:i,r=t>r?t:r,s=l>s?l:s,o=u>o?u:o}return[[e,n,i],[r,s,o]]}(n)}return this.state.positionBounds=t,t}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{transition:!0,type:"float64",fp64:this.use64bitPositions(),size:3,accessor:"getPosition"},instanceColors:{type:"unorm8",transition:!0,size:this.props.colorFormat.length,accessor:"getColor",defaultValue:[0,0,0,255]},instanceModelMatrix:XD}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState(t){super.updateState(t);const{props:e,oldProps:n,changeFlags:i}=t;if(e.mesh!==n.mesh||i.extensionsChanged){if(this.state.positionBounds=null,this.state.model?.destroy(),e.mesh){this.state.model=this.getModel(e.mesh);const t=e.mesh.attributes||e.mesh;this.setState({hasNormals:Boolean(t.NORMAL||t.normals)})}this.getAttributeManager().invalidateAll()}e.texture!==n.texture&&e.texture instanceof YP&&this.setTexture(e.texture),this.state.model&&this.state.model.setTopology(this.props.wireframe?"line-strip":"triangle-list")}finalizeState(t){super.finalizeState(t),this.state.emptyTexture.delete()}draw(t){let{uniforms:e}=t;const{model:n}=this.state;if(!n)return;const{viewport:i,renderPass:r}=this.context,{sizeScale:s,coordinateSystem:o,_instanced:a}=this.props;n.setUniforms(e),n.setUniforms({sizeScale:s,composeModelMatrix:!a||KD(i,o),flatShading:!this.state.hasNormals}),n.draw(r)}get isLoaded(){return Boolean(this.state?.model&&super.isLoaded)}getModel(t){const e=new Ok(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:JD(t),isInstanced:!0}),{texture:n}=this.props,{emptyTexture:i}=this.state;return e.setBindings({sampler:n||i}),e.setUniforms({hasTexture:Boolean(n)}),e}setTexture(t){const{emptyTexture:e,model:n}=this.state;n&&(n.setBindings({sampler:t||e}),n.setUniforms({hasTexture:Boolean(t)}))}}const eF={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:"4.2.1",worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};const nF=()=>{},iF={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},rF={x:0,y:0,width:0,height:0};function sF(t){return Math.pow(2,Math.ceil(Math.log2(t)))}function oF(t,e,n,i){const r=Math.min(n/e.width,i/e.height),s=Math.floor(e.width*r),o=Math.floor(e.height*r);return 1===r?{data:e,width:s,height:o}:(t.canvas.height=o,t.canvas.width=s,t.clearRect(0,0,s,o),t.drawImage(e,0,0,e.width,e.height,0,0,s,o),{data:t.canvas,width:s,height:o})}function aF(t){return t&&(t.id||t.url)}function lF(t,e,n){for(let i=0;i<e.length;i++){const{icon:r,xOffset:s}=e[i];t[aF(r)]={...r,x:s,y:n}}}class cF{constructor(t,e){let{onUpdate:n=nF,onError:i=nF}=e;this._loadOptions=null,this._texture=null,this._externalTexture=null,this._mapping={},this._textureParameters=null,this._pendingCount=0,this._autoPacking=!1,this._xOffset=0,this._yOffset=0,this._rowHeight=0,this._buffer=4,this._canvasWidth=1024,this._canvasHeight=0,this._canvas=null,this.device=t,this.onUpdate=n,this.onError=i}finalize(){this._texture?.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(t){const e=this._autoPacking?aF(t):t;return this._mapping[e]||rF}setProps(t){let{loadOptions:e,autoPacking:n,iconAtlas:i,iconMapping:r,textureParameters:s}=t;e&&(this._loadOptions=e),void 0!==n&&(this._autoPacking=n),r&&(this._mapping=r),i&&(this._texture?.delete(),this._texture=null,this._externalTexture=i),s&&(this._textureParameters=s)}
2get isLoaded(){return 0===this._pendingCount}packIcons(t,e){if(!this._autoPacking||"undefined"===typeof document)return;const n=Object.values(function(t,e,n){if(!t||!e)return null;n=n||{};const i={},{iterable:r,objectInfo:s}=WI(t);for(const o of r){s.index++;const t=e(o,s),r=aF(t);if(!t)throw new Error("Icon is missing.");if(!t.url)throw new Error("Icon url is missing.");i[r]||n[r]&&t.url===n[r].url||(i[r]={...t,source:o,sourceIndex:s.index})}return i}(t,e,this._mapping)||{});if(n.length>0){const{mapping:t,xOffset:e,yOffset:i,rowHeight:r,canvasHeight:s}=function(t){let{icons:e,buffer:n,mapping:i={},xOffset:r=0,yOffset:s=0,rowHeight:o=0,canvasWidth:a}=t,l=[];for(let c=0;c<e.length;c++){const t=e[c];if(!i[aF(t)]){const{height:e,width:c}=t;r+c+n>a&&(lF(i,l,s),r=0,s=o+s+n,o=0,l=[]),l.push({icon:t,xOffset:r}),r=r+c+n,o=Math.max(o,e)}}return l.length>0&&lF(i,l,s),{mapping:i,rowHeight:o,xOffset:r,yOffset:s,canvasWidth:a,canvasHeight:sF(o+s+n)}}({icons:n,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=r,this._mapping=t,this._xOffset=e,this._yOffset=i,this._canvasHeight=s,this._texture||(this._texture=this.device.createTexture({format:"rgba8unorm",width:this._canvasWidth,height:this._canvasHeight,sampler:this._textureParameters||iF})),this._texture.height!==this._canvasHeight&&(this._texture=function(t,e,n,i){const{width:r,height:s,device:o}=t,a=o.createTexture({format:"rgba8unorm",width:e,height:n,sampler:i}),l=o.createCommandEncoder();return l.copyTextureToTexture({source:t,destination:a,width:r,height:s}),l.finish(),t.destroy(),a}(this._texture,this._canvasWidth,this._canvasHeight,this._textureParameters||iF)),this.onUpdate(),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(n)}}_loadIcons(t){const e=this._canvas.getContext("2d",{willReadFrequently:!0});for(const n of t)this._pendingCount++,Qx(n.url,this._loadOptions).then((t=>{const i=aF(n),r=this._mapping[i],{x:s,y:o,width:a,height:l}=r,{data:c,width:u,height:h}=oF(e,t,a,l);this._texture.setSubImageData({data:c,x:s+(a-u)/2,y:o+(l-h)/2,width:u,height:h}),r.width=u,r.height=h,this._texture.generateMipmap(),this.onUpdate()})).catch((t=>{this.onError({url:n.url,source:n.source,sourceIndex:n.sourceIndex,loadOptions:this._loadOptions,error:t})})).finally((()=>{this._pendingCount--}))}}const uF=[0,0,0,255],hF={iconAtlas:{type:"image",value:null,async:!0},iconMapping:{type:"object",value:{},async:!0},sizeScale:{type:"number",value:1,min:0},billboard:!0,sizeUnits:"pixels",sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},alphaCutoff:{type:"number",value:.05,min:0,max:1},getPosition:{type:"accessor",value:t=>t.position},getIcon:{type:"accessor",value:t=>t.icon},getColor:{type:"accessor",value:uF},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},onIconError:{type:"function",value:null,optional:!0},textureParameters:{type:"object",ignore:!0,value:null}};class dF extends GN{static#t=(()=>this.defaultProps=hF)();static#e=(()=>this.layerName="IconLayer")();getShaders(){return super.getShaders({vs:"#version 300 es\n#define SHADER_NAME icon-layer-vertex-shader\nin vec2 positions;\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin float instanceSizes;\nin float instanceAngles;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin vec4 instanceIconFrames;\nin float instanceColorModes;\nin vec2 instanceOffsets;\nin vec2 instancePixelOffset;\nuniform float sizeScale;\nuniform vec2 iconsTextureDim;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform bool billboard;\nuniform int sizeUnits;\nout float vColorMode;\nout vec4 vColor;\nout vec2 vTextureCoords;\nout vec2 uv;\nvec2 rotate_by_angle(vec2 vertex, float angle) {\nfloat angle_radian = angle * PI / 180.0;\nfloat cos_angle = cos(angle_radian);\nfloat sin_angle = sin(angle_radian);\nmat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\nreturn rotationMatrix * vertex;\n}\nvoid main(void) {\ngeometry.worldPosition = instancePositions;\ngeometry.uv = positions;\ngeometry.pickingColor = instancePickingColors;\nuv = positions;\nvec2 iconSize = instanceIconFrames.zw;\nfloat sizePixels = clamp(\nproject_size_to_pixel(instanceSizes * sizeScale, sizeUnits),\nsizeMinPi
2xels, sizeMaxPixels\n);\nfloat instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y;\nvec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;\npixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;\npixelOffset += instancePixelOffset;\npixelOffset.y *= -1.0;\nif (billboard) {\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\nvec3 offset = vec3(pixelOffset, 0.0);\nDECKGL_FILTER_SIZE(offset, geometry);\ngl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n} else {\nvec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\nDECKGL_FILTER_SIZE(offset_common, geometry);\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n}\nvTextureCoords = mix(\ninstanceIconFrames.xy,\ninstanceIconFrames.xy + iconSize,\n(positions.xy + 1.0) / 2.0\n) / iconsTextureDim;\nvColor = instanceColors;\nDECKGL_FILTER_COLOR(vColor, geometry);\nvColorMode = instanceColorModes;\n}\n",fs:"#version 300 es\n#define SHADER_NAME icon-layer-fragment-shader\nprecision highp float;\nuniform float opacity;\nuniform sampler2D iconsTexture;\nuniform float alphaCutoff;\nin float vColorMode;\nin vec4 vColor;\nin vec2 vTextureCoords;\nin vec2 uv;\nout vec4 fragColor;\nvoid main(void) {\ngeometry.uv = uv;\nvec4 texColor = texture(iconsTexture, vTextureCoords);\nvec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);\nfloat a = texColor.a * opacity * vColor.a;\nif (a < alphaCutoff) {\ndiscard;\n}\nfragColor = vec4(color, a);\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",modules:[PO,zO]})}initializeState(){this.state={iconManager:new cF(this.context.device,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})};this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceOffsets:{size:2,accessor:"getIcon",transform:this.getInstanceOffset},instanceIconFrames:{size:4,accessor:"getIcon",transform:this.getInstanceIconFrame},instanceColorModes:{size:1,type:"uint8",accessor:"getIcon",transform:this.getInstanceColorMode},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:uF},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instancePixelOffset:{size:2,transition:!0,accessor:"getPixelOffset"}})}updateState(t){super.updateState(t);const{props:e,oldProps:n,changeFlags:i}=t,r=this.getAttributeManager(),{iconAtlas:s,iconMapping:o,data:a,getIcon:l,textureParameters:c}=e,{iconManager:u}=this.state;if("string"===typeof s)return;const h=s||this.internalState.isAsyncPropLoading("iconAtlas");u.setProps({loadOptions:e.loadOptions,autoPacking:!h,iconAtlas:s,iconMapping:h?o:null,textureParameters:c}),h?n.iconMapping!==e.iconMapping&&r.invalidate("getIcon"):(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getIcon))&&u.packIcons(a,l),i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),r.invalidateAll())}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(t){super.finalizeState(t),this.state.iconManager.finalize()}draw(t){let{uniforms:e}=t;const{sizeScale:n,sizeMinPixels:i,sizeMaxPixels:r,sizeUnits:s,billboard:o,alphaCutoff:a}=this.props,{iconManager:l}=this.state,c=l.getTexture();if(c){const t=this.state.model;t.setBindings({iconsTexture:c}),t.setUniforms(e),t.setUniforms({iconsTextureDim:[c.width,c.height],sizeUnits:Ew[s],sizeScale:n,sizeMinPixels:i,sizeMaxPixels:r,billboard:o,alphaCutoff:a}),t.draw(this.context.renderPass)}}_getModel(){return new Ok(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new jO({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([-1,-1,1,-1,-1,1,1,1])}}}),isInstanced:!0})}_onUpdate(){this.setNeedsRedraw()}_onError(t){const e=this.getCurrentLayer()?.props.onIconError;e?e(t):vw.error(t.error.message)()}getInstanceOffset(t){const{width:e,height:n,anchorX:i=e/2,anchorY:r=n/2}=this.state.iconManager.getIconMapping(t);return[e/2-i,n/2-r]}getInstanceColorMode(t){return this.state.iconManager.getIconMapping(t).mask?1:0}getInstanceIconFrame(t){const{x:e,y:n,width:i,height:r}=this.state.iconManager.getIconMapping(t);return[e,n,i,r]}}const pF=[0,0,0,255],fF={radiusUnits:"meters",radiusScale:{type:"number",min:0,value:1},radiusMinPixels:{type:"number",min:0,value:0},radiusMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:"meters",lineWidthScale:{type:"number",min:0,value:1},lineWidthMinPixels:{type:"number",min:0,value:0},lineWidthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:"accessor",value:t=>t.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:pF},getLineColor:{type:"accessor",value:pF},getLineWidth:{type:"accessor",value:1},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class gF extends GN{static#t=(()=>this.defaultProps=fF)();static#e=(()=>this.layerName="ScatterplotLayer")();getShaders(){return super.getShaders({vs:"#version 300 es\n#define SHADER_NAME scatterplot-layer-vertex-shader\nin vec3 positions;\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin float instanceRadius;\nin float instanceLineWidths;\nin vec4 instanceFillColors;\nin vec4 instanceLineColors;\nin vec3 instancePickingColors;\nuniform float opacity;\nuniform float radiusScale;\nuniform float radiusMinPixels;\nuniform float radiusMaxPixels;\nuniform float lineWidthScale;\nuniform float lineWidthMinPixels;\nuniform float lineWidthMaxPixels;\nuniform float stroked;\nuniform bool filled;\nuniform bool antialiasing;\nuniform bool billboard;\nuniform int radiusUnits;\nuniform int lineWidthUnits;\nout vec4 vFillColor;\nout vec4 vLineColor;\nout vec2 unitPosition;\nout float innerUnitRadius;\nout float outerRadiusPixels;\nvoid main(void) {\ngeometry.worldPosition = instancePositions;\nouterRadiusPixels = clamp(\nproject_size_to_pixel(radiusScale * instanceRadius, radiusUnits),\nradiusMinPixels, radiusMaxPixels\n);\nfloat lineWidthPixels = clamp(\nproject_size_to_pixel(lineWidthScale * instanceLineWidths, lineWidthUnits),\nlineWidthMinPixels, lineWidthMaxPixels\n);\nouterRadiusPixels += stroked * lineWidthPixels / 2.0;\nfloat edgePadding = antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0;\nunitPosition = edgePadding * positions.xy;\ngeometry.uv = unitPosition;\ngeometry.pickingColor = instancePickingColors;\ninnerUnitRadius = 1.0 - stroked * lineWidthPixels / outerRadiusPixels;\nif (billboard) {\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\nvec3 offset = edgePadding * positions * outerRadiusPixels;\nDECKGL_FILTER_SIZE(offset, geometry);\ngl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n} else {\nvec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels);\nDECKGL_FILTER_SIZE(offset, geometry);\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n}\nvFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\nDECKGL_FILTER_COLOR(vFillColor, geometry);\nvLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\nDECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME scatterplot-layer-fragment-shader\nprecision highp float;\nuniform bool filled;\nuniform float stroked;\nuniform bool antialiasing;\nin vec4 vFillColor;\nin vec4 vLineColor;\nin vec2 unitPosition;\nin float innerUnitRadius;\nin float outerRadiusPixels;\nout vec4 fragColor;\nvoid main(void) {\ngeometry.uv = unitPosition;\nfloat distToCenter = length(unitPosition) * outerRadiusPixels;\nfloat inCircle = antialiasing ?\nsmoothedge(distToCenter, outerRadiusPixels) :\nstep(distToCenter, outerRadiusPixels);\nif (inCircle == 0.0) {\ndiscard;\n}\nif (stroked > 0.5) {\nfloat isLine = antialiasing ?\nsmoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :\nstep(innerUnitRadius * outerRadiusPixels, distToCenter);\nif (filled) {\nfragColor = mix(vFillColor, vLineColor, isLine);\n} else {\nif (isLine == 0.0) {\ndiscard;\n}\nfragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);\n}\n} else if (!filled) {\ndiscard;\n} else {\nfragColor = vFillColor;\n}\nfragColor.a *= inCircle;\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",modules:[PO,zO]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceRadius:{size:1,transition:!0,accessor:"getRadius",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(t){super.updateState(t),t.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw(t){let{uniforms:e}=t;const{radiusUnits:n,radiusScale:i,radiusMinPixels:r,radiusMaxPixels:s,stroked:o,filled:a,billboard:l,antialiasing:c,lineWidthUnits:u,lineWidthScale:h,lineWidthMinPixels:d,lineWidthMaxPixels:p}=this.props,f=this.state.model;f.setUniforms(e),f.setUniforms({stroked:o?1:0,filled:a,billboard:l,antialiasing:c,radiusUnits:Ew[n],radiusScale:i,radiusMinPixels:r,radiusMaxPixels:s,lineWidthUnits:Ew[u],lineWidthScale:h,lineWidthMinPixels:d,lineWidthMaxPixels:p}),f.draw(this.context.renderPass)}
vendor: 8,951 bytes, line 2
2_getModel(){return new Ok(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new jO({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0])}}}),isInstanced:!0})}}const mF=.75,_F=[],yF={getIconOffsets:{type:"accessor",value:t=>t.offsets},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:"color",value:[0,0,0,255]}};class vF extends dF{static#t=(()=>this.defaultProps=yF)();static#e=(()=>this.layerName="MultiIconLayer")();getShaders(){return{...super.getShaders(),fs:"#version 300 es\n#define SHADER_NAME multi-icon-layer-fragment-shader\nprecision highp float;\nuniform float opacity;\nuniform sampler2D iconsTexture;\nuniform float gamma;\nuniform bool sdf;\nuniform float alphaCutoff;\nuniform float sdfBuffer;\nuniform float outlineBuffer;\nuniform vec4 outlineColor;\nin vec4 vColor;\nin vec2 vTextureCoords;\nin vec2 uv;\nout vec4 fragColor;\nvoid main(void) {\ngeometry.uv = uv;\nif (!bool(picking.isActive)) {\nfloat alpha = texture(iconsTexture, vTextureCoords).a;\nvec4 color = vColor;\nif (sdf) {\nfloat distance = alpha;\nalpha = smoothstep(sdfBuffer - gamma, sdfBuffer + gamma, distance);\nif (outlineBuffer > 0.0) {\nfloat inFill = alpha;\nfloat inBorder = smoothstep(outlineBuffer - gamma, outlineBuffer + gamma, distance);\ncolor = mix(outlineColor, vColor, inFill);\nalpha = inBorder;\n}\n}\nfloat a = alpha * color.a;\nif (a < alphaCutoff) {\ndiscard;\n}\nfragColor = vec4(color.rgb, a * opacity);\n}\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n"}}initializeState(){super.initializeState();this.getAttributeManager().addInstanced({instanceOffsets:{size:2,accessor:"getIconOffsets"},instancePickingColors:{type:"uint8",size:3,accessor:(t,e)=>{let{index:n,target:i}=e;return this.encodePickingColor(n,i)}}})}updateState(t){super.updateState(t);const{props:e,oldProps:n}=t;let{outlineColor:i}=e;i!==n.outlineColor&&(i=i.map((t=>t/255)),i[3]=Number.isFinite(i[3])?i[3]:1,this.setState({outlineColor:i})),!e.sdf&&e.outlineWidth&&vw.warn(`${this.id}: fontSettings.sdf is required to render outline`)()}draw(t){const{sdf:e,smoothing:n,outlineWidth:i}=this.props,{outlineColor:r}=this.state,s=i?Math.max(n,mF*(1-i)):-1;if(t.uniforms={...t.uniforms,sdfBuffer:mF,outlineBuffer:s,gamma:n,sdf:Boolean(e),outlineColor:r},super.draw(t),e&&i){const{iconManager:t}=this.state,e=t.getTexture(),n=this.state.model;e&&(n.setUniforms({outlineBuffer:mF}),n.draw(this.context.renderPass))}}getInstanceOffset(t){return t?Array.from(t).flatMap((t=>super.getInstanceOffset(t))):_F}getInstanceColorMode(t){return 1}getInstanceIconFrame(t){return t?Array.from(t).flatMap((t=>super.getInstanceIconFrame(t))):_F}}const bF=1e20;class wF{constructor(){let{fontSize:t=24,buffer:e=3,radius:n=8,cutoff:i=.25,fontFamily:r="sans-serif",fontWeight:s="normal",fontStyle:o="normal"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.buffer=e,this.cutoff=i,this.radius=n;const a=this.size=t+4*e,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${s} ${t}px ${r}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:i,actualBoundingBoxLeft:r,actualBoundingBoxRight:s}=this.ctx.measureText(t),o=Math.ceil(n),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-r))),l=Math.min(this.size-this.buffer,o+Math.ceil(i)),c=a+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:a,glyphHeight:l,glyphTop:o,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return p;const{ctx:f,buffer:g,gridInner:m,gridOuter:_}=this;f.clearRect(g,g,a,l),f.fillText(t,g,g+o);const y=f.getImageData(g,g,a,l);_.fill(bF,0,h),m.fill(0,0,h);for(let v=0;v<l;v++)for(let t=0;t<a;t++){const e=y.data[4*(v*a+t)+3]/255;if(0===e)continue;const n=(v+g)*c+t+g;if(1===e)_[n]=0,m[n]=bF;else{const t=.5-e;_[n]=t>0?t*t:0,m[n]=t<0?t*t:0}}EF(_,0,0,c,u,c,this.f,this.v,this.z),EF(m,g,g,a,l,c,this.f,this.v,this.z);for(let v=0;v<h;v++){const t=Math.sqrt(_[v])-Math.sqrt(m[v]);d[v]=Math.round(255-255*(t/this.radius+this.cutoff))}return p}}function EF(t,e,n,i,r,s,o,a,l){for(let c=e;c<e+i;c++)xF(t,n*s+c,s,r,o,a,l);for(let c=n;c<n+r;c++)xF(t,c*s+e,1,i,o,a,l)}function xF(t,e,n,i,r,s,o){s[0]=0,o[0]=-bF,o[1]=bF,r[0]=t[e];for(let a=1,l=0,c=0;a<i;a++){r[a]=t[e+a*n];const i=a*a;do{const t=s[l];c=(r[a]-r[t]+i-t*t)/(a-t)/2}while(c<=o[l]&&--l>-1);l++,s[l]=a,o[l]=c,o[l+1]=bF}for(let a=0,l=0;a<i;a++){for(;o[l+1]<a;)l++;const i=s[l],c=a-i;t[e+a*n]=r[i]+c*c}}const SF=32,TF=[];function CF(t){return Math.pow(2,Math.ceil(Math.log2(t)))}function AF(t,e,n,i){let r=0;for(let s=e;s<n;s++){const e=t[s];r+=i[e]?.layoutWidth||0}return r}function PF(t,e,n,i,r,s){let o=e,a=0;for(let l=e;l<n;l++){const e=AF(t,l,l+1,r);a+e>i&&(o<l&&s.push(l),o=l,a=0),a+=e}return a}function RF(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5?arguments[5]:void 0;void 0===s&&(s=t.length);const o=[];return"break-all"===e?PF(t,r,s,n,i,o):function(t,e,n,i,r,s){let o=e,a=e,l=e,c=0;for(let u=e;u<n;u++)if(" "===t[u]?l=u+1:" "!==t[u+1]&&u+1!==n||(l=u+1),l>a){let e=AF(t,a,l,r);c+e>i&&(o<a&&(s.push(a),o=a,c=0),e>i&&(e=PF(t,a,l,i,r,s),o=s[s.length-1])),a=l,c+=e}}(t,r,s,n,i,o),o}function MF(t,e,n,i,r,s){let o=0,a=0;for(let l=e;l<n;l++){const e=t[l],n=i[e];n?(a||(a=n.layoutHeight),r[l]=o+n.layoutWidth/2,o+=n.layoutWidth):(vw.warn(`Missing character: ${e} (${e.codePointAt(0)})`)(),r[l]=o,o+=SF)}s[0]=o,s[1]=a}class IF{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5;this._cache={},this._order=[],this.limit=t}get(t){const e=this._cache[t];return e&&(this._deleteOrder(t),this._appendOrder(t)),e}set(t,e){this._cache[t]?(this.delete(t),this._cache[t]=e,this._appendOrder(t)):(Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[t]=e,this._appendOrder(t))}delete(t){this._cache[t]&&(delete this._cache[t],this._deleteOrder(t))}_deleteOrder(t){const e=this._order.indexOf(t);e>=0&&this._order.splice(e,1)}_appendOrder(t){this._order.push(t)}}const LF={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:function(){const t=[];for(let e=32;e<128;e++)t.push(String.fromCharCode(e));return t}(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1};let kF=new IF(3);function NF(t,e){for(let n=0;n<t.length;n++)e.data[4*n+3]=t[n]}function OF(t,e,n,i){t.font=`${i} ${n}px ${e}`,t.fillStyle="#000",t.textBaseline="alphabetic",t.textAlign="left"}class DF{constructor(){this.props={...LF}}get atlas(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}get scale(){const{fontSize:t,buffer:e}=this.props;return(1.2*t+2*e)/t}setProps(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(this.props,t),this._key=this._getKey();const e=function(t,e){let n;n="string"===typeof e?new Set(Array.from(e)):new Set(e);const i=kF.get(t);if(!i)return n;for(const r in i.mapping)n.has(r)&&n.delete(r);return n}(this._key,this.props.characterSet),n=kF.get(this._key);if(n&&0===e.size)return void(this._atlas!==n&&(this._atlas=n));const i=this._generateFontAtlas(e,n);this._atlas=i,kF.set(this._key,i)}_generateFontAtlas(t,e){const{fontFamily:n,fontWeight:i,fontSize:r,buffer:s,sdf:o,radius:a,cutoff:l}=this.props;let c=e&&e.data;c||(c=document.createElement("canvas"),c.width=1024);const u=c.getContext("2d",{willReadFrequently:!0});OF(u,n,r,i);const{mapping:h,canvasHeight:d,xOffset:p,yOffset:f}=function(t){let{characterSet:e,getFontWidth:n,fontHeight:i,buffer:r,maxCanvasWidth:s,mapping:o={},xOffset:a=0,yOffset:l=0}=t,c=0,u=a;const h=i+2*r;for(const d of e)if(!o[d]){const t=n(d);u+t+2*r>s&&(u=0,c++),o[d]={x:u+r,y:l+c*h+r,width:t,height:h,layoutWidth:t,layoutHeight:i},u+=t+2*r}return{mapping:o,xOffset:u,yOffset:l+c*h,canvasHeight:CF(l+(c+1)*h)}}({getFontWidth:t=>u.measureText(t).width,fontHeight:1.2*r,buffer:s,characterSet:t,maxCanvasWidth:1024,...e&&{mapping:e.mapping,xOffset:e.xOffset,yOffset:e.yOffset}});if(c.height!==d){const t=u.getImageData(0,0,c.width,c.height);c.height=d,u.putImageData(t,0,0)}if(OF(u,n,r,i),o){const e=new wF({fontSize:r,buffer:s,radius:a,cutoff:l,fontFamily:n,fontWeight:`${i}`});for(const n of t){const{data:t,width:i,height:s,glyphTop:o}=e.draw(n);h[n].width=i,h[n].layoutOffsetY=.9*r-o;const a=u.createImageData(i,s);NF(t,a),u.putImageData(a,h[n].x,h[n].y)}}else for(const g of t)u.fillText(g,h[g].x,h[g].y+s+.9*r);return{xOffset:p,yOffset:f,mapping:h,data:c,width:c.width,height:c.height}}_getKey(){const{fontFamily:t,fontWeight:e,fontSize:n,buffer:i,sdf:r,radius:s,cutoff:
2o}=this.props;return r?`${t} ${e} ${n} ${i} ${s} ${o}`:`${t} ${e} ${n} ${i}`}}const FF={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:t=>t.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}};class BF extends GN{static#t=(()=>this.defaultProps=FF)();static#e=(()=>this.layerName="TextBackgroundLayer")();getShaders(){return super.getShaders({vs:"#version 300 es\n#define SHADER_NAME text-background-layer-vertex-shader\nin vec2 positions;\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec4 instanceRects;\nin float instanceSizes;\nin float instanceAngles;\nin vec2 instancePixelOffsets;\nin float instanceLineWidths;\nin vec4 instanceFillColors;\nin vec4 instanceLineColors;\nin vec3 instancePickingColors;\nuniform bool billboard;\nuniform float opacity;\nuniform float sizeScale;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform vec4 padding;\nuniform int sizeUnits;\nout vec4 vFillColor;\nout vec4 vLineColor;\nout float vLineWidth;\nout vec2 uv;\nout vec2 dimensions;\nvec2 rotate_by_angle(vec2 vertex, float angle) {\nfloat angle_radian = radians(angle);\nfloat cos_angle = cos(angle_radian);\nfloat sin_angle = sin(angle_radian);\nmat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\nreturn rotationMatrix * vertex;\n}\nvoid main(void) {\ngeometry.worldPosition = instancePositions;\ngeometry.uv = positions;\ngeometry.pickingColor = instancePickingColors;\nuv = positions;\nvLineWidth = instanceLineWidths;\nfloat sizePixels = clamp(\nproject_size_to_pixel(instanceSizes * sizeScale, sizeUnits),\nsizeMinPixels, sizeMaxPixels\n);\ndimensions = instanceRects.zw * sizePixels + padding.xy + padding.zw;\nvec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-padding.xy, padding.zw, positions);\npixelOffset = rotate_by_angle(pixelOffset, instanceAngles);\npixelOffset += instancePixelOffsets;\npixelOffset.y *= -1.0;\nif (billboard) {\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\nvec3 offset = vec3(pixelOffset, 0.0);\nDECKGL_FILTER_SIZE(offset, geometry);\ngl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n} else {\nvec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\nDECKGL_FILTER_SIZE(offset_common, geometry);\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n}\nvFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\nDECKGL_FILTER_COLOR(vFillColor, geometry);\nvLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\nDECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME text-background-layer-fragment-shader\nprecision highp float;\nuniform bool stroked;\nin vec4 vFillColor;\nin vec4 vLineColor;\nin float vLineWidth;\nin vec2 uv;\nin vec2 dimensions;\nout vec4 fragColor;\nvoid main(void) {\ngeometry.uv = uv;\nvec2 pixelPosition = uv * dimensions;\nif (stroked) {\nfloat distToEdge = min(\nmin(pixelPosition.x, dimensions.x - pixelPosition.x),\nmin(pixelPosition.y, dimensions.y - pixelPosition.y)\n);\nfloat isBorder = smoothedge(distToEdge, vLineWidth);\nfragColor = mix(vFillColor, vLineColor, isBorder);\n} else {\nfragColor = vFillColor;\n}\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",modules:[PO,zO]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(t){super.updateState(t);const{changeFlags:e}=t;e.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw(t){let{uniforms:e}=t;
vendor: 5,123 bytes, line 2
2const{billboard:n,sizeScale:i,sizeUnits:r,sizeMinPixels:s,sizeMaxPixels:o,getLineWidth:a}=this.props;let{padding:l}=this.props;l.length<4&&(l=[l[0],l[1],l[0],l[1]]);const c=this.state.model;c.setUniforms(e),c.setUniforms({billboard:n,stroked:Boolean(a),padding:l,sizeUnits:Ew[r],sizeScale:i,sizeMinPixels:s,sizeMaxPixels:o}),c.draw(this.context.renderPass)}_getModel(){return new Ok(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new jO({topology:"triangle-fan-webgl",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array([0,0,1,0,1,1,0,1])}}}),isInstanced:!0})}}const UF={start:1,middle:0,end:-1},zF={top:1,center:0,bottom:-1},jF=[0,0,0,255],VF={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:jF},getBorderWidth:{type:"accessor",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:LF.characterSet},fontFamily:LF.fontFamily,fontWeight:LF.fontWeight,lineHeight:1,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:jF},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:t=>t.text},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:jF},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}};class WF extends AO{constructor(){super(...arguments),this.getBoundingRect=(t,e)=>{let{size:[n,i]}=this.transformParagraph(t,e);const{fontSize:r}=this.state.fontAtlasManager.props;n/=r,i/=r;const{getTextAnchor:s,getAlignmentBaseline:o}=this.props;return[(UF["function"===typeof s?s(t,e):s]-1)*n/2,(zF["function"===typeof o?o(t,e):o]-1)*i/2,n,i]},this.getIconOffsets=(t,e)=>{const{getTextAnchor:n,getAlignmentBaseline:i}=this.props,{x:r,y:s,rowWidth:o,size:[a,l]}=this.transformParagraph(t,e),c=UF["function"===typeof n?n(t,e):n],u=zF["function"===typeof i?i(t,e):i],h=r.length,d=new Array(2*h);let p=0;for(let f=0;f<h;f++){const t=(1-c)*(a-o[f])/2;d[p++]=(c-1)*a/2+t+r[f],d[p++]=(u-1)*l/2+s[f]}return d}}static#t=(()=>this.defaultProps=VF)();static#e=(()=>this.layerName="TextLayer")();initializeState(){this.state={styleVersion:0,fontAtlasManager:new DF},this.props.maxWidth>0&&vw.warn("v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(t){const{props:e,oldProps:n,changeFlags:i}=t;(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getText))&&this._updateText();(this._updateFontAtlas()||e.lineHeight!==n.lineHeight||e.wordBreak!==n.wordBreak||e.maxWidth!==n.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo(t){let{info:e}=t;return e.object=e.index>=0?this.props.data[e.index]:null,e}_updateFontAtlas(){const{fontSettings:t,fontFamily:e,fontWeight:n}=this.props,{fontAtlasManager:i,characterSet:r}=this.state,s={...t,characterSet:r,fontFamily:e,fontWeight:n};if(!i.mapping)return i.setProps(s),!0;for(const o in s)if(s[o]!==i.props[o])return i.setProps(s),!0;return!1}_updateText(){const{data:t,characterSet:e}=this.props,n=t.attributes?.getText;let i,{getText:r}=this.props,s=t.startIndices;const o="auto"===e&&new Set;if(n&&s){const{texts:e,characterCount:a}=function(t){let{value:e,length:n,stride:i,offset:r,startIndices:s,characterSet:o}=t;const a=e.BYTES_PER_ELEMENT,l=i?i/a:1,c=r?r/a:0,u=s[n]||Math.ceil((e.length-c)/l),h=o&&new Set,d=new Array(n);let p=e;if(l>1||c>0){p=new(0,e.constructor)(u);for(let t=0;t<u;t++)p[t]=e[t*l+c]}for(let f=0;f<n;f++){const t=s[f],e=s[f+1]||u,n=p.subarray(t,e);d[f]=String.fromCodePoint.apply(null,n),h&&n.forEach(h.add,h)}if(h)for(const f of h)o.add(String.fromCodePoint(f));return{texts:d,characterCount:u}}({...ArrayBuffer.isView(n)?{value:n}:n,length:t.length,startIndices:s,characterSet:o});i=a,r=(t,n)=>{let{index:i}=n;return e[i]}}else{const{iterable:e,objectInfo:n}=WI(t);s=[0],i=0;for(const t of e){n.index++;const e=Array.from(r(t,n)||"");o&&e.forEach(o.add,o),i+=e.length,s.push(i)}}this.setState({getText:r,startIndices:s,numInstances:i,characterSet:o||e})}transformParagraph(t,e){const{fontAtlasManager:n}=this.state,i=n.mapping,r=this.state.getText,{wordBreak:s,lineHeight:o,maxWidth:a}=this.props;return function(t,e,n,i,r){const s=Array.from(t),o=s.length,a=new Array(o),l=new Array(o),c=new Array(o),u=("break-word"===n||"break-all"===n)&&isFinite(i)&&i>0,h=[0,0],d=[0,0];let p=0,f=0,g=0;for(let m=0;m<=o;m++){const t=s[m];if("\n"!==t&&m!==o||(g=m),g>f){const t=u?RF(s,n,i,r,f,g):TF;for(let n=0;n<=t.length;n++){const i=0===n?f:t[n-1],o=n<t.length?t[n]:g;MF(s,i,o,r,a,d);for(let t=i;t<o;t++){const e=s[t],n=r[e]?.layoutOffsetY||0;l[t]=p+d[1]/2+n,c[t]=d[0]}p+=d[1]*e,h[0]=Math.max(h[0],d[0])}f=g}
2"\n"===t&&(a[f]=0,l[f]=0,c[f]=0,f++)}return h[1]=p,{x:a,y:l,rowWidth:c,size:h}}(r(t,e)||"",o,s,a*n.props.fontSize,i)}renderLayers(){const{startIndices:t,numInstances:e,getText:n,fontAtlasManager:{scale:i,atlas:r,mapping:s},styleVersion:o}=this.state,{data:a,_dataDiff:l,getPosition:c,getColor:u,getSize:h,getAngle:d,getPixelOffset:p,getBackgroundColor:f,getBorderColor:g,getBorderWidth:m,backgroundPadding:_,background:y,billboard:v,fontSettings:b,outlineWidth:w,outlineColor:E,sizeScale:x,sizeUnits:S,sizeMinPixels:T,sizeMaxPixels:C,transitions:A,updateTriggers:P}=this.props,R=this.getSubLayerClass("characters",vF),M=this.getSubLayerClass("background",BF);return[y&&new M({getFillColor:f,getLineColor:g,getLineWidth:m,padding:_,getPosition:c,getSize:h,getAngle:d,getPixelOffset:p,billboard:v,sizeScale:x,sizeUnits:S,sizeMinPixels:T,sizeMaxPixels:C,transitions:A&&{getPosition:A.getPosition,getAngle:A.getAngle,getSize:A.getSize,getFillColor:A.getBackgroundColor,getLineColor:A.getBorderColor,getLineWidth:A.getBorderWidth,getPixelOffset:A.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:P.getPosition,getAngle:P.getAngle,getSize:P.getSize,getFillColor:P.getBackgroundColor,getLineColor:P.getBorderColor,getLineWidth:P.getBorderWidth,getPixelOffset:P.getPixelOffset,getBoundingRect:{getText:P.getText,getTextAnchor:P.getTextAnchor,getAlignmentBaseline:P.getAlignmentBaseline,styleVersion:o}}}),{data:a.attributes&&a.attributes.background?{length:a.length,attributes:a.attributes.background}:a,_dataDiff:l,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new R({sdf:b.sdf,smoothing:Number.isFinite(b.smoothing)?b.smoothing:LF.smoothing,outlineWidth:w/(b.radius||LF.radius),outlineColor:E,iconAtlas:r,iconMapping:s,getPosition:c,getColor:u,getSize:h,getAngle:d,getPixelOffset:p,billboard:v,sizeScale:x*i,sizeUnits:S,sizeMinPi
2xels:T*i,sizeMaxPixels:C*i,transitions:A&&{getPosition:A.getPosition,getAngle:A.getAngle,getColor:A.getColor,getSize:A.getSize,getPixelOffset:A.getPixelOffset}},this.getSubLayerProps({id:"characters",updateTriggers:{all:P.getText,getPosition:P.getPosition,getAngle:P.getAngle,getColor:P.getColor,getSize:P.getSize,getPixelOffset:P.getPixelOffset,getIconOffsets:{getTextAnchor:P.getTextAnchor,getAlignmentBaseline:P.getAlignmentBaseline,styleVersion:o}}}),{data:a,_dataDiff:l,startIndices:t,numInstances:e,getIconOffsets:this.getIconOffsets,getIcon:n})]}static set fontAtlasCacheLimit(t){!function(t){vw.assert(Number.isFinite(t)&&t>=3,"Invalid cache limit"),kF=new IF(t)}(t)}}const $F={circle:{type:gF,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",pointBillboard:"billboard",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:dF,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",iconAlphaCutoff:"alphaCutoff",iconBillboard:"billboard",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:WF,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPi
vendor: 4,084 bytes, line 2
2xels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",textBillboard:"billboard",textFontSettings:"fontSettings",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},GF={type:BD,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},HF={type:ID,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function qF(t){let{type:e,props:n}=t;const i={};for(const r in n)i[r]=e.defaultProps[n[r]];return i}function ZF(t,e){const{transitions:n,updateTriggers:i}=t.props,r={updateTriggers:{},transitions:n&&{getPosition:n.geometry}};for(const s in e){const o=e[s];let a=t.props[s];s.startsWith("get")&&(a=t.getSubLayerAccessor(a),r.updateTriggers[o]=i[s],n&&(r.transitions[o]=n[s])),r[o]=a}return r}function XF(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:r=0,endRow:s=t.length}=n;for(let o=r;o<s;o++){const n=t[o],{geometry:r}=n;if(r)if("GeometryCollection"===r.type){vw.assert(Array.isArray(r.geometries),"GeoJSON does not have geometries array");const{geometries:t}=r;for(let r=0;r<t.length;r++){KF(t[r],i,e,n,o)}}else KF(r,i,e,n,o)}return i}function KF(t,e,n,i,r){const{type:s,coordinates:o}=t,{pointFeatures:a,lineFeatures:l,polygonFeatures:c,polygonOutlineFeatures:u}=e;if(function(t,e){let n=YF[t];vw.assert(n,`Unknown GeoJSON type ${t}`);for(;e&&--n>0;)e=e[0];return e&&Number.isFinite(e[0])}(s,o))switch(s){case"Point":a.push(n({geometry:t},i,r));break;case"MultiPoint":o.forEach((t=>{a.push(n({geometry:{type:"Point",coordinates:t}},i,r))}));break;case"LineString":l.push(n({geometry:t},i,r));break;case"MultiLineString":o.forEach((t=>{l.push(n({geometry:{type:"LineString",coordinates:t}},i,r))}));break;case"Polygon":c.push(n({geometry:t},i,r)),o.forEach((t=>{u.push(n({geometry:{type:"LineString",coordinates:t}},i,r))}));break;case"MultiPolygon":o.forEach((t=>{c.push(n({geometry:{type:"Polygon",coordinates:t}},i,r)),t.forEach((t=>{u.push(n({geometry:{type:"LineString",coordinates:t}},i,r))}))}))}else vw.warn(`${s} coordinates are malformed`)()}const YF={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function JF(t){return t.geometry.coordinates}function QF(t,e){const n={points:{},lines:{},polygons:{},polygonsOutline:{}},{points:i,lines:r,polygons:s}=t,o=function(t,e){const n={points:null,lines:null,polygons:null};for(const i in n){const r=t[i].globalFeatureIds.value;n[i]=new Uint8ClampedArray(3*r.length);const s=[];for(let t=0;t<r.length;t++)e(r[t],s),n[i][3*t+0]=s[0],n[i][3*t+1]=s[1],n[i][3*t+2]=s[2]}return n}(t,e);return n.points.data={length:i.positions.value.length/i.positions.size,attributes:{...i.attributes,getPosition:i.positions,instancePickingColors:{size:3,value:o.points}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},n.lines.data={length:r.pathIndices.value.length-1,startIndices:r.pathIndices.value,attributes:{...r.attributes,getPath:r.positions,instancePickingColors:{size:3,value:o.lines}},properties:r.properties,numericProps:r.numericProps,featureIds:r.featureIds}
2,n.lines._pathType="open",n.polygons.data={length:s.polygonIndices.value.length-1,startIndices:s.polygonIndices.value,attributes:{...s.attributes,getPolygon:s.positions,pickingColors:{size:3,value:o.polygons}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},n.polygons._normalize=!1,s.triangles&&(n.polygons.data.attributes.indices=s.triangles.value),n.polygonsOutline.data={length:s.primitivePolygonIndices.value.length-1,startIndices:s.primitivePolygonIndices.value,attributes:{...s.attributes,getPath:s.positions,instancePickingColors:{size:3,value:o.polygons}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},n.polygonsOutline._pathType="open",n}const tB=["points","linestrings","polygons"],eB={...qF($F.circle),...qF($F.icon),...qF($F.text),...qF(GF),...qF(HF),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:t=>t.properties.icon},getText:{type:"accessor",value:t=>t.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}};class nB extends AO{static#t=(()=>this.layerName="GeoJsonLayer")();static#e=(()=>this.defaultProps=eB)();initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState(t){let{props:e,changeFlags:n}=t;if(!n.dataChanged)return;const{data:i}=this.props,r=i&&"points"in i&&"polygons"in i&&"lines"in i;this.setState({binary:r}),r?this._updateStateBinary({props:e,changeFlags:n}):this._updateStateJSON({props:e,changeFlags:n})}_updateStateBinary(t){let{props:e,changeFlags:n}=t;const i=QF(e.data,this.encodePickingColor);this.setState({layerProps:i})}_updateStateJSON(t){let{props:e,changeFlags:n}=t;const i=function(t){if(Array.isArray(t))return t;switch(vw.assert(t.type,"GeoJSON does not have type"),t.type){case"Feature":return[t];case"FeatureCollection":return vw.assert(Array.isArray(t.features),"GeoJSON does not have features array"),t.features;default:return[{geometry:t}]}}(e.data),r=this.getSubLayerRow.bind(this);let s={};const o={};if(Array.isArray(n.dataChanged)){const t=this.state.features;for(const e in t)s[e]=t[e].slice(),o[e]=[];for(const e of n.dataChanged){const n=XF(i,r,e);for(const i in t)o[i].push(UD({data:s[i],getIndex:t=>t.__source.index,dataRange:e,replace:n[i]}))}}else s=XF(i,r);const a=function(t,e){const n={points:{},lines:{},polygons:{},polygonsOutline:{}},{pointFeatures:i,lineFeatures:r,polygonFeatures:s,polygonOutlineFeatures:o}=t;return n.points.data=i,n.points._dataDiff=e.pointFeatures&&(()=>e.pointFeatures),n.points.getPosition=JF,n.lines.data=r,n.lines._dataDiff=e.lineFeatures&&(()=>e.lineFeatures),n.lines.getPath=JF,n.polygons.data=s,n.polygons._dataDiff=e.polygonFeatures&&(()=>e.polygonFeatures),n.polygons.getPolygon=JF,n.polygonsOutline.data=o,n.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&(()=>e.polygonOutlineFeatures),n.polygonsOutline.getPath=JF,n}(s,o);this.setState({features:s,featuresDiff:o,layerProps:a})}getPickingInfo(t){const e=super.getPickingInfo(t),{index:n,sourceLayer:i}=e;return e.featureType=tB.find((t=>i.id.startsWith(`${this.id}-${t}-`))),n>=0&&i.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(e.index=this.props.data.points.globalFeatureIds.value[n]),e}_updateAutoHighlight(t){const e=`${this.id}-points-`,n="points"===t.featureType;
vendor: 12,263 bytes, line 2
2for(const i of this.getSubLayers())i.id.startsWith(e)===n&&i.updateAutoHighlight(t)}_renderPolygonLayer(){const{extruded:t,wireframe:e}=this.props,{layerProps:n}=this.state,i="polygons-fill",r=this.shouldRenderSubLayer(i,n.polygons?.data)&&this.getSubLayerClass(i,HF.type);if(r){const s=ZF(this,HF.props),o=t&&e;return o||delete s.getLineColor,s.updateTriggers.lineColors=o,new r(s,this.getSubLayerProps({id:i,updateTriggers:s.updateTriggers}),n.polygons)}return null}_renderLineLayers(){const{extruded:t,stroked:e}=this.props,{layerProps:n}=this.state,i="polygons-stroke",r="linestrings",s=!t&&e&&this.shouldRenderSubLayer(i,n.polygonsOutline?.data)&&this.getSubLayerClass(i,GF.type),o=this.shouldRenderSubLayer(r,n.lines?.data)&&this.getSubLayerClass(r,GF.type);if(s||o){const t=ZF(this,GF.props);return[s&&new s(t,this.getSubLayerProps({id:i,updateTriggers:t.updateTriggers}),n.polygonsOutline),o&&new o(t,this.getSubLayerProps({id:r,updateTriggers:t.updateTriggers}),n.lines)]}return null}_renderPointLayers(){const{pointType:t}=this.props,{layerProps:e,binary:n}=this.state;let{highlightedObjectIndex:i}=this.props;!n&&Number.isFinite(i)&&(i=e.points.data.findIndex((t=>t.__source.index===i)));const r=new Set(t.split("+")),s=[];for(const o of r){const t=`points-${o}`,r=$F[o],a=r&&this.shouldRenderSubLayer(t,e.points?.data)&&this.getSubLayerClass(t,r.type);if(a){const l=ZF(this,r.props);let c=e.points;if("text"===o&&n){const{instancePickingColors:t,...e}=c.data.attributes;c={...c,data:{...c.data,attributes:e}}}s.push(new a(l,this.getSubLayerProps({id:t,updateTriggers:l.updateTriggers,highlightedObjectIndex:i}),c))}}return s}renderLayers(){const{extruded:t}=this.props,e=this._renderPolygonLayer();return[!t&&e,this._renderLineLayers(),this._renderPointLayers(),t&&e]}getSubLayerAccessor(t){const{binary:e}=this.state;return e&&"function"===typeof t?(e,n)=>{const{data:i,index:r}=n,s=function(t,e){if(!t)return null;const n="startIndices"in t?t.startIndices[e]:e,i=t.featureIds.value[n];return-1!==n?function(t,e,n){const i={properties:{...t.properties[e]}};for(const r in t.numericProps)i.properties[r]=t.numericProps[r].value[n];return i}(t,i,n):null}(i,r);return t(s,n)}:super.getSubLayerAccessor(t)}}const iB={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};class rB{props;stats;activeRequestCount=0;requestQueue=[];requestMap=(()=>new Map)();updateTimer=null;constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.props={...iB,...t},this.stats=new bE({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);const n={handle:t,priority:0,getPriority:e},i=new Promise((t=>(n.resolve=t,n)));return this.requestQueue.push(n),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){const{handle:e,resolve:n}=t;let i=!1;const r=()=>{i||(i=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:r}):Promise.resolve({done:r})}_issueNewRequests(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout((()=>this._issueNewRequestsAsync()),this.props.debounceTime)}_issueNewRequestsAsync(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=null;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this._updateAllRequests();for(let e=0;e<t;++e){const t=this.requestQueue.shift();t&&this._issueRequest(t)}}}_updateAllRequests(){const t=this.requestQueue;for(let e=0;e<t.length;++e){const n=t[e];this._updateRequest(n)||(t.splice(e,1),this.requestMap.delete(n.handle),e--)}t.sort(((t,e)=>t.priority-e.priority))}_updateRequest(t){return t.priority=t.getPriority(t.handle),!(t.priority<0)||(t.resolve(null),!1)}}class sB{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,this.boundingBox="west"in t?[[t.west,t.south],[t.east,t.north]]:[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then((()=>this.data)):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){const t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData(t){let{getData:e,requestScheduler:n,onLoad:i,onError:r}=t;const{index:s,id:o,bbox:a,userData:l,zoom:c}=this,u=this._loaderId;this._abortController=new AbortController;const{signal:h}=this._abortController,d=await n.scheduleRequest(this,(t=>t.isSelected?1:-1));if(!d)return void(this._isCancelled=!0);if(this._isCancelled)return void d.done();let p,f=null;try{f=await e({index:s,id:o,bbox:a,userData:l,zoom:c,signal:h})}catch(yG){p=yG||!0}finally{d.done()}u===this._loaderId&&(this._loader=void 0,this.content=f,!this._isCancelled||f?(this._isLoaded=!0,this._isCancelled=!1,p?r(p,this):i(this)):this._isLoaded=!1)}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}}const oB=Math.PI/180,aB=180/Math.PI,lB=6370972,cB=256;function uB(){const t=4018225162502676e-20,e=Math.PI/180*cB;return{unitsPerMeter:[t,t,t],unitsPerMeter2:[0,0,0],metersPerUnit:[24886.609375,24886.609375,24886.609375],unitsPerDegree:[e,e,t],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,24886.609375]}}class hB extends TT{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{latitude:e=0,longitude:n=0,zoom:i=0,nearZMultiplier:r=.1,farZMultiplier:s=2,resolution:o=10}=t;let{height:a,altitude:l=1.5}=t;a=a||1,l=Math.max(.75,l);const c=(new $S).lookAt({eye:[0,-l,0],up:[0,0,1]}),u=Math.pow(2,i);c.rotateX(e*oB),c.rotateZ(-n*oB),c.scale(u/a);const h=Math.atan(.5/l),d=512*u/a;super({...t,height:a,viewMatrix:c,longitude:n,latitude:e,zoom:i,distanceScales:uB(),fovyRadians:2*h,focalDistance:l,near:r,far:Math.min(2,1/d+1)*l*s}),this.latitude=e,this.longitude=n,this.resolution=o}get projectionMode(){return ww.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(){const t={targetZ:(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).z||0},e=this.unproject([0,this.height/2],t),n=this.unproject([this.width/2,0],t),i=this.unproject([this.width,this.height/2],t),r=this.unproject([this.width/2,this.height],t);return i[0]<this.longitude&&(i[0]+=360),e[0]>this.longitude&&(e[0]-=360),[Math.min(e[0],i[0],n[0],r[0]),Math.min(e[1],i[1],n[1],r[1]),Math.max(e[0],i[0],n[0],r[0]),Math.max(e[1],i[1],n[1],r[1])]}unproject(t){let{topLeft:e=!0,targetZ:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const[i,r,s]=t,o=e?r:this.height-r,{pixelUnprojectionMatrix:a}=this;let l;if(Number.isFinite(s))l=dB(a,[i,o,s,1]);else{const t=dB(a,[i,o,-1,1]),e=dB(a,[i,o,1,1]),r=((n||0)/lB+1)*cB,s=SS(ES([],t,e)),c=SS(t),u=SS(e),h=4*((4*c*u-(s-c-u)**2)/16)/s;l=function(t,e,n,i){const r=e[0],s=e[1],o=e[2];return t[0]=r+i*(n[0]-r),t[1]=s+i*(n[1]-s),t[2]=o+i*(n[2]-o),t}([],t,e,(Math.sqrt(c-h)-Math.sqrt(Math.max(0,r*r-h)))/Math.sqrt(s))}const[c,u,h]=this.unprojectPosition(l);return Number.isFinite(s)?[c,u,h]:Number.isFinite(n)?[c,u,n]:[c,u]}projectPosition(t){const[e,n,i=0]=t,r=e*oB,s=n*oB,o=Math.cos(s),a=(i/lB+1)*cB;return[Math.sin(r)*o*a,-Math.cos(r)*o*a,Math.sin(s)*a]}unprojectPosition(t){const[e,n,i]=t,r=xS(t),s=Math.asin(i/r);return[Math.atan2(e,-n)*aB,s*aB,(r/cB-1)*lB]}projectFlat(t){return t}unprojectFlat(t){return t}panByPosition(t,e){const n=this.unproject(e);return{longitude:t[0]-n[0]+this.longitude,latitude:t[1]-n[1]+this.latitude}}}function dB(t,e){const n=Mw([],e,t);return Aw(n,n,1/n[3]),n}const pB=-1,fB=0,gB=1,mB=new RS,_B=new RS;class yB{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2?arguments[2]:void 0;n=n||mB.copy(t).add(e).scale(.5),this.center=new RS(n),this.halfDiagonal=new RS(e).subtract(this.center),this.minimum=new RS(t),this.maximum=new RS(e)}clone(){return new yB(this.minimum,this.maximum,this.center)}equals(t){return this===t||Boolean(t)&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){const{halfDiagonal:e}=this,n=_B.from(t.normal),i=e.x*Math.abs(n.x)+e.y*Math.abs(n.y)+e.z*Math.abs(n.z),r=this.center.dot(n)+t.distance;return r-i>0?gB:r+i<0?pB:fB}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=mB.from(t).subtract(this.center),{halfDiagonal:n}=this;let i,r=0;return i=Math.abs(e.x)-n.x,i>0&&(r+=i*i),i=Math.abs(e.y)-n.y,i>0&&(r+=i*i),i=Math.abs(e.z)-n.z,i>0&&(r+=i*i),r}}const vB=new RS,bB=new RS;class wB{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.radius=-0,this.center=new RS,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=vB.from(e),this.center=(new RS).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new wB(this.center,this.radius)}union(t){const e=this.center,n=this.radius,i=t.center,r=t.radius,s=vB.copy(i).subtract(e),o=s.magnitude();if(n>=o+r)return this.clone();if(r>=o+n)return t.clone();const a=.5*(n+o+r);return bB.copy(s).scale((-n+a)/o).add(e),this.center.copy(bB),this.radius=a,this}expand(t){const e=vB.from(t).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=Fw(vB,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){const e=this.distanceTo(t);return e*e}distanceTo(t){const e=vB.from(t).subtract(this.center);return Math.max(0,e.len()-this.radius)}intersectPlane(t){const e=this.center,n=this.radius,i=t.normal.dot(e)+t.distance;return i<-n?pB:i<n?fB:gB}}function EB(t,e,n){const i=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=n[0],p=n[1],f=n[2],g=n[3],m=n[4],_=n[5],y=n[6],v=n[7],b=n[8];return t[0]=d*i+p*o+f*c,t[1]=d*r+p*a+f*u,t[2]=d*s+p*l+f*h,t[3]=g*i+m*o+_*c,t[4]=g*r+m*a+_*u,t[5]=g*s+m*l+_*h,t[6]=y*i+v*o+b*c,t[7]=y*r+v*a+b*u,t[8]=y*s+v*l+b*h,t}function xB(t,e,n){const i=n[0],r=n[1];return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=r*e[3],t[4]=r*e[4],t[5]=r*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}var SB;!function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL1ROW0=3]="COL1ROW0",t[t.COL1ROW1=4]="COL1ROW1",t[t.COL1ROW2=5]="COL1ROW2",t[t.COL2ROW0=6]="COL2ROW0",t[t.COL2ROW1=7]="COL2ROW1",t[t.COL2ROW2=8]="COL2ROW2"}(SB||(SB={}));const TB=Object.freeze([1,0,0,0,1,0,0,0,1]);class CB extends OS{static get IDENTITY(){return function(){RB||(RB=new CB,Object.freeze(RB));return RB}()}static get ZERO(){return function(){AB||(AB=new CB([0,0,0,0,0,0,0,0,0]),Object.freeze(AB));return AB}()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return SB}constructor(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):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
vendor: 3,435 bytes, line 2
2]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(TB)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){const n=e[0],i=e[1],r=e[2],s=e[3],o=n+n,a=i+i,l=r+r,c=n*o,u=i*o,h=i*a,d=r*o,p=r*a,f=r*l,g=s*o,m=s*a,_=s*l;t[0]=1-h-f,t[3]=u-_,t[6]=d+m,t[1]=u+_,t[4]=1-c-f,t[7]=p-g,t[2]=d-m,t[5]=p+g,t[8]=1-c-h}(this,t),this.check()}set(t,e,n,i,r,s,o,a,l){return this[0]=t,this[1]=e,this[2]=n,this[3]=i,this[4]=r,this[5]=s,this[6]=o,this[7]=a,this[8]=l,this.check()}setRowMajor(t,e,n,i,r,s,o,a,l){return this[0]=t,this[1]=i,this[2]=o,this[3]=e,this[4]=r,this[5]=a,this[6]=n,this[7]=s,this[8]=l,this.check()}determinant(){return function(t){const e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8];return e*(c*s-o*l)+n*(-c*r+o*a)+i*(l*r-s*a)}(this)}transpose(){return function(t,e){if(t===e){const n=e[1],i=e[2],r=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=i,t[7]=r}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,d=-u*s+a*l,p=c*s-o*l;let f=n*h+i*d+r*p;f&&(f=1/f,t[0]=h*f,t[1]=(-u*i+r*c)*f,t[2]=(a*i-r*o)*f,t[3]=d*f,t[4]=(u*n-r*l)*f,t[5]=(-a*n+r*s)*f,t[6]=p*f,t[7]=(-c*n+i*l)*f,t[8]=(o*n-i*s)*f)}(this,this),this.check()}multiplyLeft(t){return EB(this,t,this),this.check()}multiplyRight(t){return EB(this,this,t),this.check()}rotate(t){return function(t,e,n){const i=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=Math.sin(n),p=Math.cos(n);t[0]=p*i+d*o,t[1]=p*r+d*a,t[2]=p*s+d*l,t[3]=p*o-d*i,t[4]=p*a-d*r,t[5]=p*l-d*s,t[6]=c,t[7]=u,t[8]=h}(this,this,t),this.check()}scale(t){return Array.isArray(t)?xB(this,this,t):xB(this,this,[t,t]),this.check()}translate(t){return function(t,e,n){const i=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=n[0],p=n[1];t[0]=i,t[1]=r,t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=d*i+p*o+c,t[7]=d*r+p*a+u,t[8]=d*s+p*l+h}(this,this,t),this.check()}transform(t,e){let n;switch(t.length){case 2:n=function(t,e,n){const i=e[0],r=e[1];return t[0]=n[0]*i+n[3]*r+n[6],t[1]=n[1]*i+n[4]*r+n[7],t}(e||[-0,-0],t,this);break;case 3:n=bS(e||[-0,-0,-0],t,this);break;case 4:n=CS(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return dS(n,t.length),n}transformVector(t,e){return this.transform(t,e)}transformVector2(t,e){return this.transform(t,e)}transformVector3(t,e){return this.transform(t,e)}}let AB,PB,RB=null;class MB extends fS{static get ZERO(){return PB||(PB=new MB(0,0,0,0),Object.freeze(PB)),PB}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;super(-0,-0,-0,-0),sS(t)&&1===arguments.length?this.copy(t):(iS.debug&&(hS(t),hS(e),hS(n),hS(i)),this[0]=t,this[1]=e,this[2]=n,this[3]=i)}set(t,e,n,i){return this[0]=t,this[1]=e,this[2]=n,this[3]=i,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return iS.debug&&(hS(t.x),hS(t.y),hS(t.z),hS(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=hS(t)}get w(){return this[3]}
2set w(t){this[3]=hS(t)}transform(t){return vS(this,this,t),this.check()}transformByMatrix3(t){return CS(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,n){const i=e[0],r=e[1];t[0]=n[0]*i+n[2]*r,t[1]=n[1]*i+n[3]*r,t[2]=e[2],t[3]=e[3]}(this,this,t),this.check()}transformByQuaternion(t){return wS(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}}function IB(){const t=new Cw(4);return Cw!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function LB(t,e,n){n*=.5;const i=Math.sin(n);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(n),t}function kB(t,e,n){const i=e[0],r=e[1],s=e[2],o=e[3],a=n[0],l=n[1],c=n[2],u=n[3];return t[0]=i*u+o*a+r*c-s*l,t[1]=r*u+o*l+s*a-i*c,t[2]=s*u+o*c+i*l-r*a,t[3]=o*u-i*a-r*l-s*c,t}function NB(t,e,n,i){const r=e[0],s=e[1],o=e[2],a=e[3];let l,c,u,h,d,p=n[0],f=n[1],g=n[2],m=n[3];return l=r*p+s*f+o*g+a*m,l<0&&(l=-l,p=-p,f=-f,g=-g,m=-m),1-l>Tw?(c=Math.acos(l),d=Math.sin(c),u=Math.sin((1-i)*c)/d,h=Math.sin(i*c)/d):(u=1-i,h=i),t[0]=u*r+h*p,t[1]=u*s+h*f,t[2]=u*o+h*g,t[3]=u*a+h*m,t}function OB(t,e){const n=e[0]+e[4]+e[8];let i;if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{let n=0;e[4]>e[0]&&(n=1),e[8]>e[3*n+n]&&(n=2);const r=(n+1)%3,s=(n+2)%3;i=Math.sqrt(e[3*n+n]-e[3*r+r]-e[3*s+s]+1),t[n]=.5*i,i=.5/i,t[3]=(e[3*r+s]-e[3*s+r])*i,t[r]=(e[3*r+n]+e[3*n+r])*i,t[s]=(e[3*s+n]+e[3*n+s])*i}return t}const DB=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},FB=Aw,BB=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},UB=function(t,e,n,i){const r=e[0],s=e[1],o=e[2],a=e[3];return t[0]=r+i*(n[0]-r),t[1]=s+i*(n[1]-s),t[2]=o+i*(n[2]-o),t[3]=a+i*(n[3]-a),t},zB=Pw,jB=Rw,VB=function(t,e){const n=e[0],i=e[1],r=e[2],s=e[3];let o=n*n+i*i+r*r+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=n*o,t[1]=i*o,t[2]=r*o,t[3]=s*o,t};const WB=function(){const t=gS(),e=mS(1,0,0),n=mS(0,1,0);return function(i,r,s){const o=_S(r,s);return o<-.999999?(yS(t,e,r),xS(t)<1e-6&&yS(t,n,r),function(t,e){const n=e[0],i=e[1],r=e[2];let s=n*n+i*i+r*r;s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s}(t,t),LB(i,t,Math.PI),i):o>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(yS(t,r,s),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+o,VB(i,i))}}(),$B=(function(){const t=IB(),e=IB()}(),function(){const t=function(){const t=new Cw(9);return Cw!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}()}(),[0,0,0,1]);class GB extends uS{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,n,i)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,n,i){return this[0]=t,this[1]=e,this[2]=n,this[3]=i,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return OB(this,t),this.check()}fromAxisRotation(t,e){return LB(this,t,e),this.check()}identity(){var t;return(t=this)[0]=0,t[1]=0,t[2]=0,t[3]=1,this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=hS(t)}get y(){return this[1]}set y(t){this[1]=hS(t)}get z(){return this[2]}set z(t){this[2]=hS(t)}get w(){return this[3]}
2set w(t){this[3]=hS(t)}len(){return zB(this)}lengthSquared(){return jB(this)}dot(t){return BB(this,t)}rotationTo(t,e){return WB(this,t,e),this.check()}add(t){return DB(this,this,t),this.check()}calculateW(){return function(t,e){const n=e[0],i=e[1],r=e[2];t[0]=n,t[1]=i,t[2]=r,t[3]=Math.sqrt(Math.abs(1-n*n-i*i-r*r))}(this,this),this.check()}conjugate(){var t,e;return e=this,(t=this)[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],this.check()}invert(){return function(t,e){const n=e[0],i=e[1],r=e[2],s=e[3],o=n*n+i*i+r*r+s*s,a=o?1/o:0;t[0]=-n*a,t[1]=-i*a,t[2]=-r*a,t[3]=s*a}(this,this),this.check()}lerp(t,e,n){return void 0===n?this.lerp(this,t,e):(UB(this,t,e,n),this.check())}multiplyRight(t){return kB(this,this,t),this.check()}multiplyLeft(t){return kB(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,0===t&&(this[3]=1),this.check()}rotateX(t){return function(t,e,n){n*=.5;const i=e[0],r=e[1],s=e[2],o=e[3],a=Math.sin(n),l=Math.cos(n);t[0]=i*l+o*a,t[1]=r*l+s*a,t[2]=s*l-r*a,t[3]=o*l-i*a}(this,this,t),this.check()}rotateY(t){return function(t,e,n){n*=.5;const i=e[0],r=e[1],s=e[2],o=e[3],a=Math.sin(n),l=Math.cos(n);t[0]=i*l-s*a,t[1]=r*l+o*a,t[2]=s*l+i*a,t[3]=o*l-r*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){n*=.5;const i=e[0],r=e[1],s=e[2],o=e[3],a=Math.sin(n),l=Math.cos(n);t[0]=i*l+r*a,t[1]=r*l-i*a,t[2]=s*l+o*a,t[3]=o*l-s*a}(this,this,t),this.check()}scale(t){return FB(this,this,t),this.check()}slerp(t,e,n){let i,r,s;switch(arguments.length){case 1:({start:i=$B,target:r,ratio:s}=t);break;case 2:i=this,r=t,s=e;break;default:i=t,r=e,s=n}return NB(this,i,r,s),this.check()}transformVector4(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new MB;return function(t,e,n){const i=e[0],r=e[1],s=e[2],o=n[0],a=n[1],l=n[2],c=n[3],u=c*i+a*s-l*r,h=c*r+l*i-o*s,d=c*s+o*r-a*i,p=-o*i-a*r-l*s;t[0]=u*c+p*-o+h*-l-d*-a,t[1]=h*c+p*-a+d*-o-u*-l,t[2]=d*c+p*-l+u*-a-h*-o,t[3]=e[3]}(e,t,this),dS(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}const HB=new RS,qB=new RS,ZB=new RS,XB=new RS,KB=new RS,YB=new RS,JB=new RS,QB=0,tU=1,eU=2,nU=3,iU=4,rU=5,sU=6,oU=7,aU=8;class lU{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,0,0,0,0,0,0];this.center=(new RS).from(t),this.halfAxes=new CB(e)}get halfSize(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new RS(t).len(),new RS(e).len(),new RS(n).len()]}get quaternion(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),i=new RS(t).normalize(),r=new RS(e).normalize(),s=new RS(n).normalize();return(new GB).fromMatrix3(new CB([...i,...r,...s]))}fromCenterHalfSizeQuaternion(t,e,n){const i=new GB(n),r=(new CB).fromQuaternion(i);return r[0]=r[0]*e[0],r[1]=r[1]*e[0],r[2]=r[2]*e[0],r[3]=r[3]*e[1],r[4]=r[4]*e[1],r[5]=r[5]*e[1],r[6]=r[6]*e[2],r[7]=r[7]*e[2],r[8]=r[8]*e[2],this.center=(new RS).from(t),this.halfAxes=r,this}clone(){return new lU(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new wB;const e=this.halfAxes,n=e.getColumn(0,ZB),i=e.getColumn(1,XB),r=e.getColumn(2,KB),s=HB.copy(n).add(i).add(r);return t.center.copy(this.center),t.radius=s.magnitude(),t}intersectPlane(t){const e=this.center,n=t.normal,i=this.halfAxes,r=n.x,s=n.y,o=n.z,a=Math.abs(r*i[QB]+s*i[tU]+o*i[eU])+Math.abs(r*i[nU]+s*i[iU]+o*i[rU])+Math.abs(r*i[sU]+s*i[oU]+o*i[aU]),l=n.dot(e)+t.distance;return l<=-a?pB:l>=a?gB:fB}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=qB.from(t).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,ZB),r=n.getColumn(1,XB),s=n.getColumn(2,KB),o=i.magnitude(),a=r.magnitude(),l=s.magnitude();i.normalize(),r.normalize(),s.normalize();let c,u=0;return c=Math.abs(e.dot(i))-o,c>0&&(u+=c*c),c=Math.abs(e.dot(r))-a,c>0&&(u+=c*c),c=Math.abs(e.dot(s))-l,c>0&&(u+=c*c),u}computePlaneDistances(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[-0,-0],i=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;const s=this.center,o=this.halfAxes,a=o.getColumn(0,ZB),l=o.getColumn(1,XB),c=o.getColumn(2,KB),u=YB.copy(a).add(l).add(c).add(s),h=JB.copy(u).subtract(t);let d=e.dot(h);return i=Math.min(d,i),r=Math.max(d,r),u.copy(s).add(a).add(l).subtract(c),h.copy(u).subtract(t),d=e.dot(h),i=Math.min(d,i),r=Math.max(d,r),u.copy(s).add(a).subtract(l).add(c),h.copy(u).subtract(t),d=e.dot(h),i=Math.min(d,i),r=Math.max(d,r),u.copy(s).add(a).subtract(l).subtract(c),h.copy(u).subtract(t),d=e.dot(h),i=Math.min(d,i),r=Math.max(d,r),s.copy(u).subtract(a).add(l).add(c),h.copy(u).subtract(t),d=e.dot(h),i=Math.min(d,i),r=Math.max(d,r),s.copy(u).subtract(a).add(l).subtract(c),h.copy(u).subtract(t),d=e.dot(h),i=Math.min(d,i),r=Math.max(d,r),s.copy(u).subtract(a).subtract(l).add(c),h.copy(u).subtract(t),d=e.dot(h),i=Math.min(d,i),r=Math.max(d,r),s.copy(u).subtract(a).subtract(l).subtract(c),h.copy(u).subtract(t),d=e.dot(h),i=Math.min(d,i),r=Math.max(d,r),n[0]=i,n[1]=r,n}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,ZB);e.transformAsPoint(t);const n=this.halfAxes.getColumn(1,XB);n.transformAsPoint(t);const i=this.halfAxes.getColumn(2,KB);return i.transformAsPoint(t),this.halfAxes=new CB([...e,...n,...i]),this}getTransform(){throw new Error("not implemented")}}const cU=new RS,uU=new RS;class hU{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,1],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.normal=new RS,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return pS(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=cU.from(t),this.normal.from(e).normalize();const n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,e,n,i){return this.normal.set(t,e,n),pS(lS(this.normal.len(),1)),this.distance=i,this}clone(){return new hU(this.normal,this.distance)}equals(t){return lS(this.distance,t.distance)&&lS(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=uU.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,e)}projectPointOntoPlane(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];const n=cU.from(t),i=this.getPointDistance(n),r=uU.copy(this.normal).scale(i);return n.subtract(r).to(e)}}const dU=[new RS([1,0,0]),new RS([0,1,0]),new RS([0,0,1])],pU=new RS,fU=new RS;class gU{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.planes=t}fromBoundingSphere(t){this.planes.length=2*dU.length;const e=t.center,n=t.radius;let i=0;for(const r of dU){let t=this.planes[i],s=this.planes[i+1];t||(t=this.planes[i]=new hU),s||(s=this.planes[i+1]=new hU);const o=pU.copy(r).scale(-n).add(e);t.fromPointNormal(o,r);const a=pU.copy(r).scale(n).add(e),l=fU.copy(r).negate();s.fromPointNormal(a,l),i+=2}return this}computeVisibility(t){let e=gB;for(const n of this.planes){switch(t.intersectPlane(n)){case pB:return pB;case fB:e=fB}}return e}computeVisibilityWithPlaneMask(t,e){if(pS(Number.isFinite(e),"parentPlaneMask is required."),e===gU.MASK_OUTSIDE||e===gU.MASK_INSIDE)return e;let n=gU.MASK_INSIDE;const i=this.planes;for(let r=0;r<this.planes.length;++r){const s=r<31?1<<r:0;
2if(r<31&&0===(e&s))continue;const o=i[r],a=t.intersectPlane(o);if(a===pB)return gU.MASK_OUTSIDE;a===fB&&(n|=s)}return n}}gU.MASK_OUTSIDE=4294967295,gU.MASK_INSIDE=0,gU.MASK_INDETERMINATE=2147483647;new RS,new RS,new RS,new RS,new RS;new RS,new RS,new RS,new RS,new RS,new RS,new RS,new RS,new RS,new RS,new RS,new RS;const mU=1e-15,_U=1e-20,yU=(Math.PI,Math.PI,Math.PI,Math.PI,new CB),vU=new CB,bU=new CB,wU=new CB,EU=new CB;function xU(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=_U;let i=0,r=0;const s=vU,o=bU;s.identity(),o.copy(t);const a=n*function(t){let e=0;for(let n=0;n<9;++n){const i=t[n];e+=i*i}return Math.sqrt(e)}(o);for(;r<10&&CU(o)>a;)AU(o,wU),EU.copy(wU).transpose(),o.multiplyRight(wU),o.multiplyLeft(EU),s.multiplyRight(wU),++i>2&&(++r,i=0);return e.unitary=s.toTarget(e.unitary),e.diagonal=o.toTarget(e.diagonal),e}const SU=[1,0,0],TU=[2,2,1];function CU(t){let e=0;for(let n=0;n<3;++n){const i=t[yU.getElementIndex(TU[n],SU[n])];e+=2*i*i}return Math.sqrt(e)}function AU(t,e){const n=mU;let i=0,r=1;for(let c=0;c<3;++c){const e=Math.abs(t[yU.getElementIndex(TU[c],SU[c])]);e>i&&(r=c,i=e)}const s=SU[r],o=TU[r];let a=1,l=0;if(Math.abs(t[yU.getElementIndex(o,s)])>n){const e=(t[yU.getElementIndex(o,o)]-t[yU.getElementIndex(s,s)])/2/t[yU.getElementIndex(o,s)];let n;n=e<0?-1/(-e+Math.sqrt(1+e*e)):1/(e+Math.sqrt(1+e*e)),a=1/Math.sqrt(1+n*n),l=n*a}return CB.IDENTITY.to(e),e[yU.getElementIndex(s,s)]=e[yU.getElementIndex(o,o)]=a,e[yU.getElementIndex(o,s)]=l,e[yU.getElementIndex(s,o)]=-l,e}const PU=new RS,RU=new RS,MU=new RS,IU=new RS,LU=new RS,kU=new CB,NU={diagonal:new CB,unitary:new CB};const OU=512,DU=3,FU=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],BU=FU.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),UU=BU.concat([[.25,.5],[.75,.5]]);class zU{constructor(t,e,n){this.x=t,this.y=e,this.z=n}get children(){if(!this._children){const t=2*this.x,e=2*this.y,n=this.z+1;this._children=[new zU(t,e,n),new zU(t,e+1,n),new zU(t+1,e,n),new zU(t+1,e+1,n)]}return this._children}update(t){const{viewport:e,cullingVolume:n,elevationBounds:i,minZ:r,maxZ:s,bounds:o,offset:a,project:l}=t,c=this.getBoundingVolume(i,a,l);if(o&&!this.insideBounds(o))return!1;if(n.computeVisibility(c)<0)return!1;if(!this.childVisible){let{z:t}=this;if(t<s&&t>=r){const n=c.distanceTo(e.cameraPosition)*e.scale/e.height;t+=Math.floor(Math.log2(n))}if(t>=s)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(const u of this.children)u.update(t);return!0}getSelected(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(this.selected&&t.push(this),this._children)for(const e of this._children)e.getSelected(t);return t}insideBounds(t){let[e,n,i,r]=t;const s=Math.pow(2,this.z),o=OU/s;return this.x*o<i&&this.y*o<r&&(this.x+1)*o>e&&(this.y+1)*o>n}getBoundingVolume(t,e,n){if(n){const e=this.z<1?UU:this.z<2?BU:FU,i=[];for(const r of e){const e=XU(this.x+r[0],this.y+r[1],this.z);e[2]=t[0],i.push(n(e)),t[0]!==t[1]&&(e[2]=t[1],i.push(n(e)))}return function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new lU;if(!t||0===t.length)return e.halfAxes=new CB([0,0,0,0,0,0,0,0,0]),e.center=new RS,e;const n=t.length,i=new RS(0,0,0);for(const T of t)i.add(T);const r=1/n;i.multiplyByScalar(r);let s=0,o=0,a=0,l=0,c=0,u=0;for(const T of t){const t=PU.copy(T).subtract(i);s+=t.x*t.x,o+=t.x*t.y,a+=t.x*t.z,l+=t.y*t.y,c+=t.y*t.z,u+=t.z*t.z}s*=r,o*=r,a*=r,l*=r,c*=r,u*=r;const h=kU;h[0]=s,h[1]=o,h[2]=a,h[3]=o,h[4]=l,h[5]=c,h[6]=a,h[7]=c,h[8]=u;const{unitary:d}=xU(h,NU),p=e.halfAxes.copy(d);let f=p.getColumn(0,MU),g=p.getColumn(1,IU),m=p.getColumn(2,LU),_=-Number.MAX_VALUE,y=-Number.MAX_VALUE,v=-Number.MAX_VALUE,b=Number.MAX_VALUE,w=Number.MAX_VALUE,E=Number.MAX_VALUE;for(const T of t)PU.copy(T),_=Math.max(PU.dot(f),_),y=Math.max(PU.dot(g),y),v=Math.max(PU.dot(m),v),b=Math.min(PU.dot(f),b),w=Math.min(PU.dot(g),w),E=Math.min(PU.dot(m),E);f=f.multiplyByScalar(.5*(b+_)),g=g.multiplyByScalar(.5*(w+y)),m=m.multiplyByScalar(.5*(E+v)),e.center.copy(f).add(g).add(m);const x=RU.set(_-b,y-w,v-E).multiplyByScalar(.5),S=new CB([x[0],0,0,0,x[1],0,0,0,x[2]]);return e.halfAxes.multiplyRight(S),e}(i)}const i=Math.pow(2,this.z),r=OU/i,s=this.x*r+e*OU,o=OU-(this.y+1)*r;return new yB([s,o,t[0]],[s+r,o+r,t[1]])}}const jU=512,VU=[-1/0,-1/0,1/0,1/0],WU={type:"object",value:null,validate:(t,e)=>e.optional&&null===t||"string"===typeof t||Array.isArray(t)&&t.every((t=>"string"===typeof t)),equal:(t,e)=>{if(t===e)return!0;
vendor: 4,539 bytes, line 2
2if(!Array.isArray(t)||!Array.isArray(e))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i<n;i++)if(t[i]!==e[i])return!1;return!0}};function $U(t,e){const n=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])];return[Math.min(...n.map((t=>t[0]))),Math.min(...n.map((t=>t[1]))),Math.max(...n.map((t=>t[0]))),Math.max(...n.map((t=>t[1])))]}function GU(t,e){if(!t||!t.length)return null;const{index:n,id:i}=e;if(Array.isArray(t)){t=t[(r=i,Math.abs(r.split("").reduce(((t,e)=>(t<<5)-t+e.charCodeAt(0)|0),0))%t.length)]}var r;let s=t;for(const o of Object.keys(n)){const t=new RegExp(`{${o}}`,"g");s=s.replace(t,String(n[o]))}return Number.isInteger(n.y)&&Number.isInteger(n.z)&&(s=s.replace(/\{-y\}/g,String(Math.pow(2,n.z)-n.y-1))),s}function HU(t){let{viewport:e,z:n,cullRect:i}=t;return(e.subViewports||[e]).map((t=>qU(t,n||0,i)))}function qU(t,e,n){if(!Array.isArray(e)){const i=n.x-t.x,r=n.y-t.y,{width:s,height:o}=n,a={targetZ:e},l=t.unproject([i,r],a),c=t.unproject([i+s,r],a),u=t.unproject([i,r+o],a),h=t.unproject([i+s,r+o],a);return[Math.min(l[0],c[0],u[0],h[0]),Math.min(l[1],c[1],u[1],h[1]),Math.max(l[0],c[0],u[0],h[0]),Math.max(l[1],c[1],u[1],h[1])]}const i=qU(t,e[0],n),r=qU(t,e[1],n);return[Math.min(i[0],r[0]),Math.min(i[1],r[1]),Math.max(i[2],r[2]),Math.max(i[3],r[3])]}function ZU(t,e){return Math.pow(2,t)*jU/e}function XU(t,e,n){const i=ZU(n,jU),r=t/i*360-180,s=Math.PI-2*Math.PI*e/i;return[r,180/Math.PI*Math.atan(.5*(Math.exp(s)-Math.exp(-s)))]}function KU(t,e,n,i){const r=ZU(n,i);return[t/r*jU,e/r*jU]}function YU(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:jU;if(t.isGeospatial){const[t,r]=XU(e,n,i),[s,o]=XU(e+1,n+1,i);return{west:t,north:r,east:s,south:o}}const[s,o]=KU(e,n,i,r),[a,l]=KU(e+1,n+1,i,r);return{left:s,top:o,right:a,bottom:l}}function JU(t,e,n,i,r){const s=function(t,e,n){let i;if(e&&2===e.length){const[n,r]=e,s=t.getBounds({z:n}),o=t.getBounds({z:r});i=[Math.min(s[0],o[0]),Math.min(s[1],o[1]),Math.max(s[2],o[2]),Math.max(s[3],o[3])]}else i=t.getBounds();return t.isGeospatial?[Math.max(i[0],n[0]),Math.max(i[1],n[1]),Math.min(i[2],n[2]),Math.min(i[3],n[3])]:[Math.max(Math.min(i[0],n[2]),n[0]),Math.max(Math.min(i[1],n[3]),n[1]),Math.min(Math.max(i[2],n[0]),n[2]),Math.min(Math.max(i[3],n[1]),n[3])]}(t,null,i),o=ZU(e,n),[a,l,c,u]=function(t,e,n){if(n)return $U(t,n).map((t=>t*e/jU));return t.map((t=>t*e/jU))}(s,o,r),h=[];for(let d=Math.floor(a);d<c;d++)for(let t=Math.floor(l);t<u;t++)h.push({x:d,y:t,z:e});return h}function QU(t){let{viewport:e,maxZoom:n,minZoom:i,zRange:r,extent:s,tileSize:o=jU,modelMatrix:a,modelMatrixInverse:l,zoomOffset:c=0}=t,u=e.isGeospatial?Math.round(e.zoom+Math.log2(jU/o))+c:Math.ceil(e.zoom)+c;if("number"===typeof i&&Number.isFinite(i)&&u<i){if(!s)return[];u=i}"number"===typeof n&&Number.isFinite(n)&&u>n&&(u=n);let h=s;return a&&l&&s&&!e.isGeospatial&&(h=$U(s,a)),e.isGeospatial?function(t,e,n,i){const r=t instanceof hB&&t.resolution?t.projectPosition:null,s=Object.values(t.getFrustumPlanes()).map((t=>{let{normal:e,distance:n}=t;return new hU(e.clone().negate(),n)})),o=new gU(s),a=t.distanceScales.unitsPerMeter[2],l=n&&n[0]*a||0,c=n&&n[1]*a||0,u=t instanceof kT&&t.pitch<=60?e:0;if(i){const[t,e,n,r]=i,s=aT([t,r]),o=aT([n,e]);i=[s[0],OU-s[1],o[0],OU-o[1]]}const h=new zU(0,0,0),d={viewport:t,project:r,cullingVolume:o,elevationBounds:[l,c],minZ:u,maxZ:e,bounds:i,offset:0};if(h.update(d),t instanceof kT&&t.subViewports&&t.subViewports.length>1){for(d.offset=-1;h.update(d)&&!(--d.offset<-DU););for(d.offset=1;h.update(d)&&!(++d.offset>DU););}return h.getSelected()}(e,u,r,s):JU(e,u,o,h||VU,l)}function tz(t,e){if(t===e)return!0;if(Array.isArray(t)){const n=t.length;if(!e||e.length!==n)return!1;for(let i=0;i<n;i++)if(t[i]!==e[i])return!1;return!0}return!1}const ez=2,nz="best-available",iz={[nz]:function(t){for(const e of t)e.state=0;for(const e of t)e.isSelected&&!sz(e)&&oz(e);for(const e of t)e.isVisible=Boolean(e.state&ez)},"no-overlap":function(t){for(const n of t)n.state=0;for(const n of t)n.isSelected&&sz(n);const e=Array.from(t).sort(((t,e)=>t.zoom-e.zoom));for(const n of e)if(n.isVisible=Boolean(n.state&ez),n.children&&(n.isVisible||1&n.state))for(const t of n.children)t.state=1;else n.isSelected&&oz(n)},never:()=>{}},rz={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{}
2,onTileUnload:()=>{},onTileError:()=>{}};function sz(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=ez,!0;e=e.parent}return!1}function oz(t){for(const e of t.children)e.isLoaded||e.content?e.state|=ez:oz(e)}const az={TilesetClass:class{constructor(t){this._getCullBounds=function(t){let e,n={};return i=>{for(const r in i)if(!tz(i[r],n[r])){e=t(i),n=i;break}return e}}(HU),this.opts={...rz,...t},this.setOptions(this.opts),this.onTileLoad=t=>{this.opts.onTileLoad?.(t),this.opts.maxCacheByteSize&&(this._cacheByteSize+=t.byteLength,this._resizeCache())},this._requestScheduler=new rB({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new $S,this._modelMatrixInverse=new $S}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return null!==this._selectedTiles&&this._selectedTiles.every((t=>t.isLoaded))}get needsReload(){return null!==this._selectedTiles&&this._selectedTiles.some((t=>t.needsReload))}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(const t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(const t of this._cache.keys()){const e=this._cache.get(t);this._selectedTiles&&this._selectedTiles.includes(e)?e.setNeedsReload():this._cache.delete(t)}}update(t){let{zRange:e,modelMatrix:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{zRange:null,modelMatrix:null};const i=n?new $S(n):new $S,r=!i.equals(this._modelMatrix);if(this._viewport&&t.equals(this._viewport)&&lS(this._zRange,e)&&!r)this.needsReload&&(this._selectedTiles=this._selectedTiles.map((t=>this._getTile(t.index,!0))));else{r&&(this._modelMatrixInverse=i.clone().invert(),this._modelMatrix=i),this._viewport=t,this._zRange=e;const n=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:e,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=n.map((t=>this._getTile(t,!0))),this._dirty&&this._rebuildTree()}const s=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),s&&this._frameNumber++,this._frameNumber}isTileVisible(t,e){if(!t.isVisible)return!1;if(e&&this._viewport){const n=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:e}),{bbox:i}=t;for(const[t,e,r,s]of n){let n;if("west"in i)n=i.west<r&&i.east>t&&i.south<s&&i.north>e;else{const o=Math.min(i.top,i.bottom),a=Math.max(i.top,i.bottom);n=i.left<r&&i.right>t&&o<s&&a>e}if(n)return!0}return!1}return!0}getTileIndices(t){let{viewport:e,maxZoom:n,minZoom:i,zRange:r,modelMatrix:s,modelMatrixInverse:o}=t;const{tileSize:a,extent:l,zoomOffset:c}=this.opts;return QU({viewport:e,maxZoom:n,minZoom:i,zRange:r,tileSize:a,extent:l,modelMatrix:s,modelMatrixInverse:o,zoomOffset:c})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){const{tileSize:e}=this.opts;return{bbox:YU(this._viewport,t.x,t.y,t.z,e)}}getParentIndex(t){return{x:Math.floor(t.x/2),y:Math.floor(t.y/2),z:t.z-1}}updateTileStates(){const t=this.opts.refinementStrategy||nz,e=new Array(this._cache.size);let n=0;for(const i of this._cache.values())e[n++]=i.isVisible,i.isSelected=!1,i.isVisible=!1;for(const i of this._selectedTiles)i.isSelected=!0,i.isVisible=!0;("function"===typeof t?t:iz[t])(Array.from(this._cache.values())),n=0;
2for(const i of this._cache.values())if(e[n++]!==i.isVisible)return!0;return!1}_pruneRequests(){const{maxRequests:t=0}=this.opts,e=[];let n=0;for(const i of this._cache.values())i.isLoading&&(n++,i.isSelected||i.isVisible||e.push(i));for(;t>0&&n>t&&e.length>0;){e.shift().abort(),n--}}_rebuildTree(){const{_cache:t}=this;for(const e of t.values())e.parent=null,e.children&&(e.children.length=0);for(const e of t.values()){const t=this._getNearestAncestor(e);e.parent=t,t?.children&&t.children.push(e)}}_resizeCache(){const{_cache:t,opts:e}=this,n=e.maxCacheSize||(e.maxCacheByteSize?1/0:5*this.selectedTiles.length),i=e.maxCacheByteSize||1/0;if(t.size>n||this._cacheByteSize>i){for(const[r,s]of t)if(s.isVisible||s.isSelected||(this._cacheByteSize-=e.maxCacheByteSize?s.byteLength:0,t.delete(r),this.opts.onTileUnload?.(s)),t.size<=n&&this._cacheByteSize<=i)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort(((t,e)=>t.zoom-e.zoom)),this._dirty=!1)}_getTile(t,e){const n=this.getTileId(t);let i=this._cache.get(n),r=!1;return!i&&e?(i=new sB(t),Object.assign(i,this.getTileMetadata(i.index)),Object.assign(i,{id:n,zoom:this.getTileZoom(i.index)}),r=!0,this._cache.set(n,i),this._dirty=!0):i&&i.needsReload&&(r=!0),i&&r&&i.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),i}_getNearestAncestor(t){const{_minZoom:e=0}=this;let n=t.index;for(;this.getTileZoom(n)>e;){n=this.getParentIndex(n);const t=this._getTile(n);if(t)return t}return null}},data:{type:"data",value:[]},dataComparator:WU.equal,renderSubLayers:{type:"function",value:t=>new nB(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:nz,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0};class lz extends AO{static#t=(()=>this.defaultProps=az)();static#e=(()=>this.layerName="TileLayer")();initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every((t=>t.isLoaded&&t.layers&&t.layers.every((t=>t.isLoaded)))))}shouldUpdateState(t){let{changeFlags:e}=t;return e.somethingChanged}updateState(t){let{changeFlags:e}=t,{tileset:n}=this.state;const i=e.propsOrDataChanged||e.updateTriggersChanged,r=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);n?i&&(n.setOptions(this._getTilesetOptions()),r?n.reloadAll():n.tiles.forEach((t=>{t.layers=null}))):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){const{tileSize:t,maxCacheSize:e,maxCacheByteSize:n,refinementStrategy:i,extent:r,maxZoom:s,minZoom:o,maxRequests:a,debounceTime:l,zoomOffset:c}=this.props;return{maxCacheSize:e,maxCacheByteSize:n,maxZoom:s,minZoom:o,tileSize:t,refinementStrategy:i,extent:r,maxRequests:a,debounceTime:l,zoomOffset:c,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){const t=this.state.tileset,{zRange:e,modelMatrix:n}=this.props,i=t.update(this.context.viewport,{zRange:e,modelMatrix:n}),{isLoaded:r}=t,s=this.state.isLoaded!==r,o=this.state.frameNumber!==i;r&&(s||o)&&this._onViewportLoad(),o&&this.setState({frameNumber:i}),this.state.isLoaded=r}_onViewportLoad(){const{tileset:t}=this.state,{onViewportLoad:e}=this.props;e&&e(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,e){this.props.onTileError(t),e.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){const{data:e,getTileData:n,fetch:i}=this.props,{signal:r}=t;return t.url="string"===typeof e||Array.isArray(e)?GU(e,t):null,n?n(t):i&&t.url?i(t.url,{propName:"data",layer:this,signal:r}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}
2getPickingInfo(t){const e=t.sourceLayer,n=e.props.tile,i=t.info;return i.picked&&(i.tile=n),i.sourceTile=n,i.sourceTileSubLayer=e,i}_updateAutoHighlight(t){t.sourceTileSubLayer.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map((t=>{const e=this.getSubLayerPropsByTile(t);if(t.isLoaded||t.content)if(t.layers)e&&t.layers[0]&&Object.keys(e).some((n=>t.layers[0].props[n]!==e[n]))&&(t.layers=t.layers.map((t=>t.clone(e))));else{const n=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=gE(n,Boolean).map((n=>n.clone({tile:t,...e})))}else;return t.layers}))}filterSubLayer(t){let{layer:e,cullRect:n}=t;const{tile:i}=e.props;return this.state.tileset.isTileVisible(i,n)}}const cz=[1],uz={...lz.defaultProps,elevationData:WU,texture:{...WU,optional:!0},meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:"",wireframe:!1,material:!0,loaders:[eF]};function hz(t){return Array.isArray(t)?t.join(";"):t||""}class dz extends AO{static#t=(()=>this.defaultProps=uz)();static#e=(()=>this.layerName="TerrainLayer")();updateState(t){let{props:e,oldProps:n}=t;const i=e.elevationData!==n.elevationData;if(i){const{elevationData:t}=e,n=t&&(Array.isArray(t)||t.includes("{x}")&&t.includes("{y}"));this.setState({isTiled:n})}const r=i||e.meshMaxError!==n.meshMaxError||e.elevationDecoder!==n.elevationDecoder||e.bounds!==n.bounds;if(!this.state.isTiled&&r){const t=this.loadTerrain(e);this.setState({terrain:t})}e.workerUrl&&vw.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain(t){let{elevationData:e,bounds:n,elevationDecoder:i,meshMaxError:r,signal:s}=t;if(!e)return null;let o=this.getLoadOptions();o={...o,terrain:{skirtHeight:this.state.isTiled?2*r:0,...o?.terrain,bounds:n,meshMaxError:r,elevationDecoder:i}};const{fetch:a}=this.props;return a(e,{propName:"elevationData",layer:this,loadOptions:o,signal:s})}getTiledTerrainData(t){const{elevationData:e,fetch:n,texture:i,elevationDecoder:r,meshMaxError:s}=this.props,{viewport:o}=this.context,a=GU(e,t),l=i&&GU(i,t),{signal:c}=t;let u=[0,0],h=[0,0];if(o.isGeospatial){const e=t.bbox;u=o.projectFlat([e.west,e.south]),h=o.projectFlat([e.east,e.north])}else{const e=t.bbox;u=[e.left,e.bottom],h=[e.right,e.top]}const d=[u[0],u[1],h[0],h[1]],p=this.loadTerrain({elevationData:a,bounds:d,elevationDecoder:r,meshMaxError:s,signal:c}),f=l?n(l,{propName:"texture",layer:this,loaders:[],signal:c}).catch((t=>null)):Promise.resolve(null);return Promise.all([p,f])}renderSubLayers(t){const e=this.getSubLayerClass("mesh",tF),{color:n,wireframe:i,material:r}=this.props,{data:s}=t;if(!s)return null;const[o,a]=s;return new e(t,{data:cz,mesh:o,texture:a,_instanced:!1,coordinateSystem:bw.CARTESIAN,getPosition:t=>[0,0,0],getColor:n,wireframe:i,material:r})}onViewportLoad(t){if(!t)return;const{zRange:e}=this.state,n=t.map((t=>t.content)).filter(Boolean).map((t=>t[0].header.boundingBox.map((t=>t[2]))));if(0===n.length)return;const i=Math.min(...n.map((t=>t[0]))),r=Math.max(...n.map((t=>t[1])));(!e||i<e[0]||r>e[1])&&this.setState({zRange:[i,r]})}renderLayers(){const{color:t,material:e,elevationData:n,texture:i,wireframe:r,meshMaxError:s,elevationDecoder:o,tileSize:a,maxZoom:l,minZoom:c,extent:u,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:f,maxCacheSize:g,maxCacheByteSize:m,refinementStrategy:_}=this.props;if(this.state.isTiled)return new lz(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:hz(n),texture:hz(i),meshMaxError:s,elevationDecoder:o}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:a,maxZoom:l,minZoom:c,extent:u,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:f,maxCacheSize:g,maxCacheByteSize:m,refinementStrategy:_});if(!n)return null;return new(this.getSubLayerClass("mesh",tF))(this.getSubLayerProps({id:"mesh"}),{data:cz,mesh:this.state.terrain,texture:i,_instanced:!1,getPosition:t=>[0,0,0],getColor:t,material:e,wireframe:r})}}const pz=()=>new dz({id:"terrain-layer",elevationDecoder:{rScaler:2,gScaler:1,bScaler:.5,offset:-32768},texture:"https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",elevationData:"https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",bounds:[-180,-90,180,90]});class fz extends jO{constructor(t){const{indices:e,attributes:n}=function(t){const{radius:e,height:n=1,nradial:i=10}=t;let{vertices:r}=t;r&&(vw.assert(r.length>=i),r=r.flatMap((t=>[t[0],t[1]])),GO(r,$O));const s=n>0,o=i+1,a=s?3*o+1:i,l=2*Math.PI/i,c=new Uint16Array(s?3*i*2:0),u=new Float32Array(3*a),h=new Float32Array(3*a);let d=0;if(s){for(let t=0;t<o;t++){const s=t*l,o=t%i,a=Math.sin(s),c=Math.cos(s);for(let t=0;t<2;t++)u[d+0]=r?r[2*o]:c*e,u[d+1]=r?r[2*o+1]:a*e,u[d+2]=(.5-t)*n,h[d+0]=r?r[2*o]:c,h[d+1]=r?r[2*o+1]:a,d+=3}u[d+0]=u[d-3],u[d+1]=u[d-2],u[d+2]=u[d-1],d+=3}for(let p=s?0:1;p<o;p++){const t=Math.floor(p/2)*Math.sign(.5-p%2),s=t*l,o=(t+i)%i,a=Math.sin(s),c=Math.cos(s);u[d+0]=r?r[2*o]:c*e,u[d+1]=r?r[2*o+1]:a*e,u[d+2]=n/2,h[d+2]=1,d+=3}if(s){let t=0;for(let e=0;e<i;e++)c[t++]=2*e+0,c[t++]=2*e+2,c[t++]=2*e+0,c[t++]=2*e+1,c[t++]=2*e+1,c[t++]=2*e+3}return{indices:c,attributes:{POSITION:{size:3,value:u},NORMAL:{size:3,value:h}}}}(t);super({...t,indices:e,attributes:n}
2)}}const gz=[0,0,0,255],mz={diskResolution:{type:"number",min:4,value:20},vertices:null,radius:{type:"number",min:0,value:1e3},angle:{type:"number",value:0},offset:{type:"array",value:[0,0]},coverage:{type:"number",min:0,max:1,value:1},elevationScale:{type:"number",min:0,value:1},radiusUnits:"meters",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,extruded:!0,wireframe:!1,filled:!0,stroked:!1,flatShading:!1,getPosition:{type:"accessor",value:t=>t.position},getFillColor:{type:"accessor",value:gz},getLineColor:{type:"accessor",value:gz},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0,getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class _z extends GN{static#t=(()=>this.layerName="ColumnLayer")();static#e=(()=>this.defaultProps=mz)();getShaders(){const t={},{flatShading:e}=this.props;return e&&(t.FLAT_SHADING=1),super.getShaders({vs:"#version 300 es\n#define SHADER_NAME column-layer-vertex-shader\nin vec3 positions;\nin vec3 normals;\nin vec3 instancePositions;\nin float instanceElevations;\nin vec3 instancePositions64Low;\nin vec4 instanceFillColors;\nin vec4 instanceLineColors;\nin float instanceStrokeWidths;\nin vec3 instancePickingColors;\nuniform float opacity;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform bool extruded;\nuniform bool stroked;\nuniform bool isStroke;\nuniform float coverage;\nuniform float elevationScale;\nuniform float edgeDistance;\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform int radiusUnits;\nuniform int widthUnits;\nout vec4 vColor;\n#ifdef FLAT_SHADING\nout vec4 position_commonspace;\n#endif\nvoid main(void) {\ngeometry.worldPosition = instancePositions;\nvec4 color = isStroke ? instanceLineColors : instanceFillColors;\nmat2 rotationMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\nfloat elevation = 0.0;\nfloat strokeOffsetRatio = 1.0;\nif (extruded) {\nelevation = instanceElevations * (positions.z + 1.0) / 2.0 * elevationScale;\n} else if (stroked) {\nfloat widthPixels = clamp(\nproject_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),\nwidthMinPixels, widthMaxPixels) / 2.0;\nfloat halfOffset = project_pixel_size(widthPixels) / project_size(edgeDistance * coverage * radius);\nif (isStroke) {\nstrokeOffsetRatio -= sign(positions.z) * halfOffset;\n} else {\nstrokeOffsetRatio -= halfOffset;\n}\n}\nfloat shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);\nfloat dotRadius = radius * coverage * shouldRender;\ngeometry.pickingColor = instancePickingColors;\nvec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);\nvec3 centroidPosition64Low = instancePositions64Low;\nvec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + offset) * dotRadius;\nif (radiusUnits == UNIT_METERS) {\noffset = project_size(offset);\n}\nvec3 pos = vec3(offset, 0.);\nDECKGL_FILTER_SIZE(pos, geometry);\ngl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);\ngeometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\nif (extruded && !isStroke) {\n#ifdef FLAT_SHADING\nposition_commonspace = geometry.position;\nvColor = vec4(color.rgb, color.a * opacity);\n#else\nvec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);\nvColor = vec4(lightColor, color.a * opacity);\n#endif\n} else {\nvColor = vec4(color.rgb, color.a * opacity);\n}\nDECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME column-layer-fragment-shader\nprecision highp float;\nuniform vec3 project_uCameraPosition;\nuniform bool extruded;\nuniform bool isStroke;\nout vec4 fragColor;\nin vec4 vColor;\n#ifdef FLAT_SHADING\nin vec4 position_commonspace;\n#endif\nvoid main(void) {\nfragColor = vColor;\ngeometry.uv = vec2(0.);\n#ifdef FLAT_SHADING\nif (extruded && !isStroke && !bool(picking.isActive)) {\
2nvec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\nfragColor.rgb = lighting_getLightColor(vColor.rgb, project_uCameraPosition, position_commonspace.xyz, normal);\n}\n#endif\nDECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",defines:t,modules:[PO,e?FO:DO,zO]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceElevations:{size:1,transition:!0,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getFillColor",defaultValue:gz},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:gz},instanceStrokeWidths:{size:1,accessor:"getLineWidth",transition:!0}})}updateState(t){super.updateState(t);const{props:e,oldProps:n,changeFlags:i}=t,r=i.extensionsChanged||e.flatShading!==n.flatShading;r&&(this.state.models?.forEach((t=>t.destroy())),this.setState(this._getModels()),this.getAttributeManager().invalidateAll());const s=this.getNumInstances();this.state.fillModel.setInstanceCount(s),this.state.wireframeModel.setInstanceCount(s),(r||e.diskResolution!==n.diskResolution||e.vertices!==n.vertices||(e.extruded||e.stroked)!==(n.extruded||n.stroked))&&this._updateGeometry(e)}getGeometry(t,e,n){const i=new fz({radius:1,height:n?2:0,vertices:e,nradial:t});let r=0;if(e)for(let s=0;s<t;s++){const n=e[s];r+=Math.sqrt(n[0]*n[0]+n[1]*n[1])/t}else r=1;return this.setState({edgeDistance:Math.cos(Math.PI/t)*r}),i}_getModels(){const t=this.getShaders(),e=this.getAttributeManager().getBufferLayouts(),n=new Ok(this.context.device,{...t,id:`${this.props.id}-fill`,bufferLayout:e,isInstanced:!0}),i=new Ok(this.context.device,{...t,id:`${this.props.id}-wireframe`,bufferLayout:e,isInstanced:!0});return{fillModel:n,wireframeModel:i,models:[i,n]}}_updateGeometry(t){let{diskResolution:e,vertices:n,extruded:i,stroked:r}=t;const s=this.getGeometry(e,n,i||r);this.setState({fillVertexCount:s.attributes.POSITION.value.length/3});const o=this.state.fillModel,a=this.state.wireframeModel;o.setGeometry(s),o.setTopology("triangle-strip"),o.setIndexBuffer(null),a.setGeometry(s),a.setTopology("line-list")}draw(t){let{uniforms:e}=t;const{lineWidthUnits:n,lineWidthScale:i,lineWidthMinPixels:r,lineWidthMaxPixels:s,radiusUnits:o,elevationScale:a,extruded:l,filled:c,stroked:u,wireframe:h,offset:d,coverage:p,radius:f,angle:g}=this.props,m=this.state.fillModel,_=this.state.wireframeModel,{fillVertexCount:y,edgeDistance:v}=this.state,b={...e,radius:f,angle:g/180*Math.PI,offset:d,extruded:l,stroked:u,coverage:p,elevationScale:a,edgeDistance:v,radiusUnits:Ew[o],widthUnits:Ew[n],widthScale:i,widthMinPixels:r,widthMaxPixels:s};l&&h&&(_.setUniforms(b),_.setUniforms({isStroke:!0}),_.draw(this.context.renderPass)),m.setUniforms(b),c&&(m.setVertexCount(y),m.setUniforms({isStroke:!1}),m.draw(this.context.renderPass)),!l&&u&&(m.setVertexCount(2*y/3),m.setUniforms({isStroke:!0}),m.draw(this.context.renderPass))}}var yz=Math.PI/3,vz=[0,yz,2*yz,3*yz,4*yz,5*yz];function bz(t){return t[0]}function wz(t){return t[1]}function Ez(t,e,n){const i=n;return i.domain=()=>t,i.range=()=>e,i}function xz(t,e){return Ez(t,e,(n=>function(t,e,n){const i=t[1]-t[0];if(i<=0)return vw.warn("quantizeScale: invalid domain, returning range[0]")(),e[0];const r=i/e.length,s=Math.floor((n-t[0])/r),o=Math.max(Math.min(s,e.length-1),0);return e[o]}(t,e,n)))}function Sz(t,e){return Ez(t,e,(n=>function(t,e,n){return(n-t[0])/(t[1]-t[0])*(e[1]-e[0])+e[0]}(t,e,n)))}function Tz(t,e){const n=t.sort(Cz);let i=0;const r=Math.max(1,e.length),s=new Array(r-1);for(;++i<r;)s[i-1]=Az(n,i/r);const o=t=>function(t,e,n){return e[function(t,e){let n=0,i=t.length;for(;n<i;){const r=n+i>>>1;Cz(t[r],e)>0?i=r:n=r+1}return n}(t,n)]}(s,e,t);return o.thresholds=()=>s,Ez(t,e,o)}function Cz(t,e){return t-e}function Az(t,e){const n=t.length;if(e<=0||n<2)return t[0];if(e>=1)return t[n-1];const i=(n-1)*e,r=Math.floor(i),s=t[r];return s+(t[r+1]-s)*(i-r)}function Pz(t,e){const n=new Map,i=[];for(const r of t){const t=`${r}`;n.has(t)||n.set(t,i.push(r))}return Ez(t,e,(t=>function(t,e,n,i){const r=`${i}`;let s=e.get(r);return void 0===s&&(s=t.push(i),e.set(r,s)),n[(s-1)%n.length]}(i,n,e,t)))}function Rz(t){return void 0!==t&&null!==t}function Mz(t,e){return("function"===typeof e?t.map(e):t).filter(Rz)}function Iz(t,e){return Mz(t,e)}function Lz(t,e){return function(t){const e=[];return t.forEach((t=>{!e.includes(t)&&Rz(t)&&e.push(t)})),e}(Mz(t,e))}const kz=t=>t.length,Nz=t=>t.points,Oz=t=>t.index,Dz=(t,e)=>t<e?-1:t>e?1:t>=e?0:NaN,Fz={getValue:kz,getPoints:Nz,getIndex:Oz,filterData:null};class Bz{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fz;this.aggregatedBins=this.getAggregatedBins(t,e),this._updateMinMaxValues(),this.binMap=this.getBinMap()}getAggregatedBins(t,e){const{getValue:n=kz,getPoints:i=Nz,getIndex:r=Oz,filterData:s}=e,o="function"===typeof s,a=t.length,l=[];let c=0;for(let u=0;u<a;u++){const e=t[u],a=i(e),h=r(e),d=o?a.filter(s):a;e.filteredPoints=o?d:null;const p=d.length?n(d):null;null!==p&&void 0!==p&&(l[c]={i:Number.isFinite(h)?h:u,value:p,counts:d.length},c++)}return l}_percentileToIndex(t){const e=this.sortedBins.length;if(e<2)return[0,0];const[n,i]=t.map((t=>function(t,e,n){return Math.max(e,Math.min(n,t))}(t,0,100)));return[Math.ceil(n/100*(e-1)),Math.floor(i/100*(e-1))]}getBinMap(){const t={};for(const e of this.aggregatedBins)t[e.i]=e;return t}_updateMinMaxValues(){let t=0,e=0,n=3402823466e29,i=0;for(const r of this.aggregatedBins)t=t>r.counts?t:r.counts,e=e>r.value?e:r.value,n=n<r.value?n:r.value,i+=r.counts;this.maxCount=t,this.maxValue=e,this.minValue=n,this.totalCount=i}getValueRange(t){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(((t,e)=>Dz(t.value,e.value)))),!this.sortedBins.length)return[];let e=0,n=this.sortedBins.length-1;if(Array.isArray(t)){const i=this._percentileToIndex(t);e=i[0],n=i[1]}return[this.sortedBins[e].value,this.sortedBins[n].value]}getValueDomainByScale(t){let[e=0,n=100]=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(((t,e)=>Dz(t.value,e.value)))),!this.sortedBins.length)return[];const i=this._percentileToIndex([e,n]);return this._getScaleDomain(t,i)}_getScaleDomain(t,e){let[n,i]=e;const r=this.sortedBins;switch(t){case"quantize":case"linear":default:return[r[n].value,r[i].value];case"quantile":return Iz(r.slice(n,i+1),(t=>t.value));case"ordinal":return Lz(r,(t=>t.value))}}}const Uz={SUM:1,MEAN:2,MIN:3,MAX:4};function zz(t,e){return t+e}function jz(t,e){return e>t?e:t}function Vz(t,e){return e<t?e:t}function Wz(t,e,n){const i=Uz[t]||Uz.SUM;switch(e=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Number.isFinite(t))return t;return n=>(e.index=n.index,t(n.source,e))}(e,n),i){case Uz.MIN:return t=>function(t,e){if(Number.isFinite(e))return t.length?e:null;const n=t.map(e).filter(Number.isFinite);return n.length?n.reduce(Vz,1/0):null}(t,e);case Uz.SUM:return t=>function(t,e){if(Number.isFinite(e))return t.length?t.length*e:null;const n=t.map(e).filter(Number.isFinite);return n.length?n.reduce(zz,0):null}(t,e);case Uz.MEAN:return t=>function(t,e){if(Number.isFinite(e))return t.length?e:null;const n=t.map(e).filter(Number.isFinite);return n.length?n.reduce(zz,0)/n.length:null}(t,e);case Uz.MAX:return t=>function(t,e){if(Number.isFinite(e))return t.length?e:null;const n=t.map(e).filter(Number.isFinite);return n.length?n.reduce(jz,-1/0):null}(t,e);default:return null}}function $z(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>(e.indices=n.map((t=>t.index)),t(n.map((t=>t.source)),e))}function Gz(){}const Hz=["getBins","getDomain","getScaleFunc"],qz=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],Zz=t=>t.cellSize;class Xz{constructor(t){this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=t.getCellSize||Zz,this._getAggregator=t.getAggregator,this._addDimension(t.dimensions||qz)}static defaultDimensions(){return qz}updateState(t,e){const{oldProps:n,props:i,changeFlags:r}=t;this.updateGetValueFuncs(n,i,r);const s=this.needsReProjectPoints(n,i,r);let o=!1;if(r.dataChanged||s)this.getAggregatedData(i,e),o=!0;
vendor: 11,415 bytes, line 2
2else{(this.getDimensionChanges(n,i,r)||[]).forEach((t=>"function"===typeof t&&t())),o=!0}return this.setState({aggregationDirty:o}),this.state}setState(t){this.state={...this.state,...t}}setDimensionState(t,e){this.setState({dimensions:{...this.state.dimensions,[t]:{...this.state.dimensions[t],...e}}})}normalizeResult(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.hexagons?{data:t.hexagons,...t}:t.layerData?{data:t.layerData,...t}:t}getAggregatedData(t,e){const n=this._getAggregator(t)(t,e);this.setState({layerData:this.normalizeResult(n)}),this.changeFlags={layerData:!0},this.getSortedBins(t)}updateGetValueFuncs(t,e,n){for(const i in this.dimensionUpdaters){const{value:r,weight:s,aggregation:o}=this.dimensionUpdaters[i].getBins.triggers;let a=e[r.prop];this.needUpdateDimensionStep(this.dimensionUpdaters[i].getBins,t,e,n)&&(a=a?$z(a,{data:e.data}):Wz(e[o.prop],e[s.prop],{data:e.data})),a&&this.setDimensionState(i,{getValue:a})}}needsReProjectPoints(t,e,n){return this._getCellSize(t)!==this._getCellSize(e)||this._getAggregator(t)!==this._getAggregator(e)||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getPosition)}addDimension(t){this._addDimension(t)}_addDimension(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((t=>{const{key:e}=t;this.dimensionUpdaters[e]=this.getDimensionUpdaters(t),this.state.dimensions[e]={getValue:null,domain:null,sortedBins:null,scaleFunc:Gz}}))}getDimensionUpdaters(t){let{key:e,accessor:n,pickingInfo:i,getBins:r,getDomain:s,getScaleFunc:o,nullValue:a}=t;return{key:e,accessor:n,pickingInfo:i,getBins:{updater:this.getDimensionSortedBins.bind(this),...r},getDomain:{updater:this.getDimensionValueDomain.bind(this),...s},getScaleFunc:{updater:this.getDimensionScale.bind(this),...o},attributeAccessor:this.getSubLayerDimensionAttribute(e,a)}}needUpdateDimensionStep(t,e,n,i){return Object.values(t.triggers).some((t=>t.updateTrigger?i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged[t.updateTrigger]):e[t.prop]!==n[t.prop]))}getDimensionChanges(t,e,n){const i=[];for(const r in this.dimensionUpdaters){const s=Hz.find((i=>this.needUpdateDimensionStep(this.dimensionUpdaters[r][i],t,e,n)));s&&i.push(this.dimensionUpdaters[r][s].updater.bind(this,e,this.dimensionUpdaters[r]))}return i.length?i:null}getUpdateTriggers(t){const e=t.updateTriggers||{},n={};for(const i in this.dimensionUpdaters){const{accessor:r}=this.dimensionUpdaters[i];n[r]={},Hz.forEach((s=>{Object.values(this.dimensionUpdaters[i][s].triggers).forEach((i=>{let{prop:s,updateTrigger:o}=i;if(o){const t=e[o];"object"!==typeof t||Array.isArray(t)?void 0!==t&&(n[r][s]=t):Object.assign(n[r],t)}else n[r][s]=t[s]}))}))}return n}getSortedBins(t){for(const e in this.dimensionUpdaters)this.getDimensionSortedBins(t,this.dimensionUpdaters[e])}getDimensionSortedBins(t,e){const{key:n}=e,{getValue:i}=this.state.dimensions[n],r=new Bz(this.state.layerData.data||[],{getValue:i,filterData:t._filterData});this.setDimensionState(n,{sortedBins:r}),this.getDimensionValueDomain(t,e)}getDimensionValueDomain(t,e){const{getDomain:n,key:i}=e,{triggers:{lowerPercentile:r,upperPercentile:s,scaleType:o}}=n,a=this.state.dimensions[i].sortedBins.getValueDomainByScale(t[o.prop],[t[r.prop],t[s.prop]]);this.setDimensionState(i,{valueDomain:a}),this.getDimensionScale(t,e)}getDimensionScale(t,e){const{key:n,getScaleFunc:i,getDomain:r}=e,{domain:s,range:o}=i.triggers,{scaleType:a}=r.triggers,{onSet:l}=i,c=t[o.prop],u=t[s.prop]||this.state.dimensions[n].valueDomain,h=function(t){switch(t){case"quantize":default:return xz;case"linear":return Sz;case"quantile":return Tz;case"ordinal":return Pz}}(a&&t[a.prop]),d=h(u,c);"object"===typeof l&&"function"===typeof t[l.props]&&t[l.props](d.domain()),this.setDimensionState(n,{scaleFunc:d})}getSubLayerDimensionAttribute(t,e){return n=>{const{sortedBins:i,scaleFunc:r}=this.state.dimensions[t],s=i.binMap[n.index];if(s&&0===s.counts)return e;const o=s&&s.value,a=r.domain();return o>=a[0]&&o<=a[a.length-1]?r(o):e}}getSubLayerAccessors(t){const e={};for(const n in this.dimensionUpdaters){const{accessor:i}=this.dimensionUpdaters[n];e[i]=this.getSubLayerDimensionAttribute(t,n)}return e}getPickingInfo(t){let{info:e}=t;let n=null;if(e.picked&&e.index>-1){const t=this.state.layerData.data[e.index],i={};for(const e in this.dimensionUpdaters){const{pickingInfo:n}=this.dimensionUpdaters[e],{sortedBins:r}=this.state.dimensions[e],s=r.binMap[t.index]&&r.binMap[t.index].value;i[n]=s}n=Object.assign(i,t,{points:t.filteredPoints||t.points})}return e.picked=Boolean(n),e.object=n,e}getAccessor(t){return this.dimensionUpdaters.hasOwnProperty(t)?this.dimensionUpdaters[t].attributeAccessor:Gz}}function Kz(t,e){const n={};for(const i in t)e.includes(i)||(n[i]=t[i]);return n}class Yz extends AO{static#t=(()=>this.layerName="AggregationLayer")();initializeAggregationLayer(t){super.initializeState(this.context),this.setState({ignoreProps:Kz(this.constructor._propTypes,t.data.props),dimensions:t})}updateState(t){super.updateState(t);const{changeFlags:e}=t;if(e.extensionsChanged){const t=this.getShaders({});t&&t.defines&&(t.defines.NON_INSTANCED_MODEL=1),this.updateShaders(t)}this._updateAttributes()}updateAttributes(t){this.setState({changedAttributes:t})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){const{viewport:t,mousePosition:e,device:n}=this.context;return Object.assign(Object.create(this.props),{viewport:t,mousePosition:e,picking:{isActive:0},devicePixelRatio:n.canvasContext.cssToDeviceRatio()})}updateShaders(t){}isAggregationDirty(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{props:n,oldProps:i,changeFlags:r}=t,{compareAll:s=!1,dimension:o}=e,{ignoreProps:a}=this.state,{props:l,accessors:c=[]}=o,{updateTriggersChanged:u}=r;if(r.dataChanged)return!0;if(u){if(u.all)return!0;for(const t of c)if(u[t])return!0}if(s)return!!r.extensionsChanged||pN({oldProps:i,newProps:n,ignoreProps:a,propTypes:this.constructor._propTypes});for(const h of l)if(n[h]!==i[h])return!0;return!1}isAttributeChanged(t){const{changedAttributes:e}=this.state;return t?e&&void 0!==e[t]:!function(t){let e=!0;for(const n in t){e=!1;break}return e}(e)}_getAttributeManager(){return new sN(this.context.device,{id:this.props.id,stats:this.context.stats})}}function Jz(){}const Qz={colorDomain:null,colorRange:[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]],getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:Jz,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Jz,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:function(t,e){const{data:n,radius:i}=t,{viewport:r,attributes:s}=e,o=n.length?function(t,e){const{attributes:n}=e,i=n.positions.value,{size:r}=n.positions.getAccessor();let s,o=1/0,a=1/0,l=-1/0,c=-1/0;for(s=0;s<r*t.length;s+=r){const t=i[s],e=i[s+1];Number.isFinite(t)&&Number.isFinite(e)&&(o=Math.min(t,o),l=Math.max(t,l),a=Math.min(e,a),c=Math.max(e,c))}return[o,a,l,c].every(Number.isFinite)?[(o+l)/2,(a+c)/2]:null}(n,e):null,a=function(t,e,n){const{unitsPerMeter:i}=e.getDistanceScales(n);return t*i[0]}(i,r,o),l=[],{iterable:c,objectInfo:u}=WI(n),h=s.positions.value,{size:d}=s.positions.getAccessor();for(const f of c){u.index++;const t=u.index*d,e=[h[t],h[t+1]];Number.isFinite(e[0])&&Number.isFinite(e[1])?l.push({screenCoord:r.projectFlat(e),source:f,index:u.index}):vw.warn("HexagonLayer: invalid position")()}const p=function(){var t,e,n,i=0,r=0,s=1,o=1,a=bz,l=wz;function c(t){var i,r={},s=[],o=t.length;for(i=0;i<o;++i)if(!isNaN(u=+a.call(null,c=t[i],i,t))&&!isNaN(h=+l.call(null,c,i,t))){var c,u,h,d=Math.round(h/=n),p=Math.round(u=u/e-(1&d)/2),f=h-d;if(3*Math.abs(f)>1){var g=u-p,m=p+(u<p?-1:1)/2,_=d+(h<d?-1:1),y=u-m,v=h-_;g*g+f*f>y*y+v*v&&(p=m+(1&d?1:-1)/2,d=_)}var b=p+"-"+d,w=r[b];w?w.push(c):(s.push(w=r[b]=[c]),w.x=(p+(1&d)/2)*e,w.y=d*n)}return s}function u(t){var e=0,n=0;return vz.map((function(i){var r=Math.sin(i)*t,s=-Math.cos(i)*t,o=r-e,a=s-n;return e=r,n=s,[o,a]}))}return c.hexagon=function(e){return"m"+u(null==e?t:+e).join("l")+"z"},c.centers=function(){for(var a=[],l=Math.round(r/n),c=Math.round(i/e),u=l*n;u<o+t;u+=n,++l)for(var h=c*e+(1&l)*e/2;h<s+e/2;h+=e)a.push([h,u]);return a},c.mesh=function(){var e=u(t).slice(0,4).join("l");return c.centers().map((function(t){return"M"+t+"m"+e})).join("")},c.x=function(t){return arguments.length?(a=t,c):a},c.y=function(t){return arguments.length?(l=t,c):l},c.radius=function(i){return arguments.length?(e=2*(t=+i)*Math.sin(yz),n=1.5*t,c):t},c.size=function(t){return arguments.length?(i=r=0,s=+t[0],o=+t[1],c):[s-i,o-r]},c.extent=function(t){return arguments.length?(i=+t[0][0],r=+t[0][1],s=+t[1][0],o=+t[1][1],c):[[i,r],[s,o]]},c.radius(1)}().radius(a).x((t=>t.screenCoord[0])).y((t=>t.screenCoord[1]));return{hexagons:p(l).map(((t,e)=>({position:r.unprojectFlat([t.x,t.y]),points:t,index:e}))),radiusCommon:a}},getPosition:{type:"accessor",value:t=>t.position},material:!0,_filterData:{type:"function",value:null,optional:!0}};class tj extends Yz{static#t=(()=>this.layerName="HexagonLayer")();static#e=(()=>this.defaultProps=Qz)();initializeState(){const t=new Xz({getAggregator:t=>t.hexagonAggregator,getCellSize:t=>t.radius});this.state={cpuAggregator:t,aggregatorState:t.state,vertices:null};this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(t){if(super.updateState(t),t.changeFlags.propsOrDataChanged){const e=this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==e.layerData){const{hexagonVertices:t}=e.layerData||{};this.setState({vertices:t&&this.convertLatLngToMeterOffset(t)})}this.setState({aggregatorState:e})}}convertLatLngToMeterOffset(t){const{viewport:e}=this.context;if(Array.isArray(t)&&6===t.length){const n=t[0],i=t[3],r=[(n[0]+i[0])/2,(n[1]+i[1])/2],s=e.projectFlat(r),{metersPerUnit:o}=e.getDistanceScales(r);return t.map((t=>{const n=e.projectFlat(t);return[(n[0]-s[0])*o[0],(n[1]-s[1])*o[1]]}))}return vw.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}getPickingInfo(t){let{info:e}=t;return this.state.cpuAggregator.getPickingInfo({info:e})}_onGetSublayerColor(t){return this.state.cpuAggregator.getAccessor("fillColor")(t)}_onGetSublayerElevation(t){return this.state.cpuAggregator.getAccessor("elevation")(t)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){const{elevationScale:t,extruded:e,coverage:n,material:i,transitions:r}=this.props,{aggregatorState:s,vertices:o}=this.state,a=this.getSubLayerClass("hexagon-cell",_z),l=this._getSublayerUpdateTriggers();return new a({...o?{vertices:o,radius:1}
2:{radius:s.layerData.radiusCommon||1,radiusUnits:"common",angle:90},diskResolution:6,elevationScale:t,extruded:e,coverage:n,material:i,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:r&&{getFillColor:r.getColorValue||r.getColorWeight,getElevation:r.getElevationValue||r.getElevationWeight}},this.getSubLayerProps({id:"hexagon-cell",updateTriggers:l}),{data:s.layerData.data})}}const ej=[[1,152,189],[73,227,206],[216,254,181],[254,237,177],[254,173,84],[209,55,78]],nj=t=>{let{data:e,onHover:n}=t;return new tj({id:"source-generation-hexagon-layer",colorRange:ej,data:e,pickable:!0,extruded:!0,radius:15500,elevationScale:1e3,getPosition:t=>t.position,getColorWeight:t=>t.value,getElevationWeight:t=>t.value,getElevationValue:t=>{const e=t.reduce(((t,e)=>t+e.value),0);return e},getColorValue:t=>{if(t.length>0){const e=t.reduce(((t,e)=>t+e.value),0),n=e/t.length,i=t[0].type,r=((t,e)=>{let n;return n="renewable_energy"===t?50*e:"clean_energy"===t?50+25*e:"fossil_fuel"===t?75+25*e:0,n})(i,n),s=r/100;return console.log("totalValue:",e,"avgValue:",n,"type:",i,"normalizedColorValue:",s),s}return 0},onHover:t=>{let{object:e,x:n,y:i}=t;const r=document.getElementById("tooltip");if(e){const t=e.points,s=(t.reduce(((t,e)=>t+e.value),0),t.map((t=>`\n <div>\n State: ${t.source.state}<br>\n Type: ${t.source.type}<br>\n Category: ${t.source.category}<br>\n Value: ${(100*t.source.value).toFixed(2)}%\n </div>\n `)).join("<br>"));r.style.top=`${i}px`,r.style.left=`${n}px`,r.innerHTML=`\n ${s}\n `,r.style.display="block"}else r.style.display="none"}})},ij=[[1,152,189],[209,55,78]],rj=t=>{let{data:e,onHover:n}=t;return new tj({id:"carbon-generation-hexagon-layer",colorRange:ij,data:e,pickable:!0,extruded:!0,radius:2e4,elevationScale:500,getPosition:t=>t.position,getColorWeight:t=>t.value,getElevationWeight:t=>t.value,getElevationValue:t=>{const e=t.reduce(((t,e)=>t+e.value),0);return e},getColorValue:t=>{if(t.length>0){const e=t.reduce(((t,e)=>t+e.value),0),n=e/t.length,i=t[0].type,r=((t,e)=>{let n;return n="Carbon Free"===t?50*e:"Fossil Fuel"===t?50+50*e:0,n})(i,n),s=r/100;return console.log("totalValue:",e,"avgValue:",n,"type:",i,"normalizedColorValue:",s),100*s}return 0},onHover:t=>{let{object:e,x:n,y:i}=t;const r=document.getElementById("tooltip");if(e){const t=e.points,s=(t.reduce(((t,e)=>t+e.value),0),t.map((t=>`\n <div>\n State: ${t.source.state}<br>\n Type: ${t.source.type}<br>\n Value: ${t.source.value}\n </div>\n `)).join("<br>"));r.style.top=`${i}px`,r.style.left=`${n}px`,r.innerHTML=`\n ${s}\n `,r.style.display="block"}else r.style.display="none"}})},sj=[[86,163,145],[125,179,136],[199,201,135],[207,195,171],[133,111,102]],oj=t=>{let{data:e,onHover:n}=t;return new tj({id:"air-generation-hexagon-layer",colorRange:sj,data:e,pickable:!0,extruded:!0,radius:2e4,elevationScale:1e3,getPosition:t=>t.position,getColorWeight:t=>t.value,getElevationWeight:t=>t.value,getElevationValue:t=>t.reduce(((t,e)=>t+e.value),0),getColorValue:t=>{if(t.length>0){const e=t.reduce(((t,e)=>t+e.value),0),n=(t.length,(t=>{let e;return e="NOx"===t?10:"SO2"===t?30:"CO2"===t?50:"CH4"===t?70:"N2O"===t?90:0,e})(t[0].type));return 100*(n/100)}return 0},onHover:t=>{let{object:e,x:n,y:i}=t;const r=document.getElementById("tooltip");if(e){const t=e.points.map((t=>`\n <div>\n State: ${t.source.state}<br>\n Type: ${t.source.type}<br>\n Value: ${t.source.value}\n </div>\n `)).join("<br>");r.style.top=`${i}px`,r.style.left=`${n}px`,r.innerHTML=`\n ${t}\n `,r.style.display="block"}else r.style.display="none"}})},aj={moer:{title:"MOER Data",description:"This data visualization represents the Marginal Operating Emissions Rate (MOER) by region.",colorScale:{startColor:"rgb(255, 255, 0)",endColor:"rgb(139, 0, 0)",startLabel:"Low MOER",endLabel:"High MOER"}},health_damage:{title:"Health Damage Data",description:"The Health Damage data signal estimates the impact of emissions from electricity generation on human health, considering factors like pollutant types, smokestack heights, and population downwind. Unlike the Social Cost of Carbon, which monetizes global climate impacts, Health Damage focuses on immediate, localized harm to human health in specific regions and times.",colorScale:{startColor:"rgb(255, 235, 235)",endColor:"rgb(25, 0, 155)",startLabel:"Low Damage",endLabel:"High Damage"}},social_cost_of_carbon:{title:"Social Cost of Health",description:(0,s.jsxs)(s.Fragment,{children:["This data visualization represents the social cost of health calculated by the marginal operating emission rate of CO2. The detailed calculation can be viewed at",(0,s.jsx)("a",{href:"https://costofcarbon.org/calculator",target:"_blank",rel:"noopener noreferrer",children:" Social Cost of Health Calculator"}),"."]}),colorScale:{startColor:"rgb(255, 255, 255)",endColor:"rgb(255, 0, 0)",startLabel:"Low Cost",endLabel:"High Cost"}},source_generation:{title:"Energy Generation Percent by State",description:"This data visualization shows the energy generation percent by state in 2022.",legendItems:[{color:"rgb(1, 152, 189)",label:"Renewable Energy (<30%)"},{color:"rgb(73, 227, 206)",label:"Renewable Energy (>30%)"},{color:"rgb(145, 245, 150)",label:"Clean Energy (<60%)"},{color:"rgb(255, 232, 170)",label:"Clean Energy (>60%)"},{color:"rgb(254, 173, 84)",label:"Fossil Fuel (<25%)"},{color:"rgb(209, 55, 78)",label:"Fossil Fuel (>25%)"}]},air_generation:{title:"Air Generation Data",description:"This data visualization represents air pollutant generation amount across different states.",legendItems:[{color:"rgb(86, 163, 145)",label:"NOx"},{color:"rgb(125, 179, 136)",label:"SO2"},{color:"rgb(199, 201, 135)",label:"CO2"},{color:"rgb(207, 195, 171)",label:"CH4"},{color:"rgb(133, 111, 102)",label:"N2O"}]},carbon_generation:{title:"Carbon Generation Data",description:"This data visualization represents carbon generation percentage across different states.",legendItems:[{color:"rgb(1, 152, 189)",label:"Carbon Free"},{color:"rgb(209, 55, 78)",label:"Fossil Fuel"}]}},lj=t=>{let{dataType:e}=t;const n=aj[e];return n?(0,s.jsxs)("div",{className:"info-panel",children:[(0,s.jsx)("h2",{children:n.title}),(0,s.jsx)("p",{children:n.description}),!n.colorScale&&(0,s.jsx)("div",{className:"legend",children:n.legendItems.map(((t,e)=>(0,s.jsxs)("div",{className:"legend-item",children:[(0,s.jsx)("div",{className:"color-box",style:{backgroundColor:t.color}}),(0,s.jsx)("span",{children:t.label})]},e)))}),n.colorScale&&(0,s.jsxs)("div",{className:"color-scale",style:{background:`linear-gradient(to right, ${n.colorScale.startColor}, ${n.colorScale.endColor})`},children:[(0,s.jsx)("span",{className:"start gradient-label",children:n.colorScale.startLabel}),(0,s.jsx)("span",{className:"end gradient-label",children:n.colorScale.endLabel})]})]}):null},cj={longitude:-95.7129,latitude:37.0902,zoom:3.5,pitch:50,bearing:-20},uj={Alabama:[32.806671,-86.79113],Alaska:[61.370716,-152.404419],Arizona:[33.729759,-111.431221],Arkansas:[34.969704,-92.373123],California:[36.116203,-119.681564],Colorado:[39.059811,-105.311104],Connecticut:[41.597782,-72.755371],Delaware:[39.318523,-75.507141],Florida:[27.766279,-81.686783],Georgia:[33.040619,-83.643074],Hawaii:[21.094318,-157.498337],Idaho:[44.240459,-114.478828],Illinois:[40.349457,-88.986137],Indiana:[39.849426,-86.258278],Iowa:[42.011539,-93.210526],Kansas:[38.5266,-96.726486],Kentucky:[37.66814,-84.670067],Louisiana:[31.169546,-91.867805],Maine:[44.693947,-69.381927],Maryland:[39.063946,-76.802101],Massachusetts:[42.230171,-71.530106],Michigan:[43.326618,-84.536095],Minnesota:[45.694454,-93.900192],Mississippi:[32.741646,-89.678696],Missouri:[38.456085,-92.288368],Montana:[46.921925,-110.454353],Nebraska:[41.12537,-98.268082],Nevada:[38.313515,-117.055374],"New Hampshire":[43.452492,-71.563896],"New Jersey":[40.298904,-74.521011],"New Mexico":[34.840515,-106.248482],"New York":[42.165726,-74.948051],"North Carolina":[35.630066,-79.806419],"North Dakota":[47.528912,-99.784012],Ohio:[40.388783,-82.764915],Oklahoma:[35.565342,-96.928917],Oregon:[44.572021,-122.070938],Pennsylvania:[40.590752,-77.209755],"Rhode Island":[41.680893,-71.51178],"South Carolina":[33.856892,-80.945007],"South Dakota":[44.299782,-99.438828],Tennessee:[35.747845,-86.692345],Texas:[31.054487,-97.563461],Utah:[40.150032,-111.862434],Vermont:[44.045876,-72.710686],Virginia:[37.769337,-78.169968],Washington:[47.400902,-121.490494],"West Virginia":[38.491226,-80.954456],Wisconsin:[44.268543,-89.616508],Wyoming:[42.755966,-107.30249],"District of Columbia":[38.897957,-77.03656],"Puerto Rico":[18.220833,-66.590149]},hj=["State coal generation percent (resource mix)","State oil generation percent (resource mix)","State gas generation percent (resource mix)","State other fossil generation percent (resource mix)"],dj=["State nuclear generation percent (resource mix)"],pj=["State hydro generation percent (resource mix)","State biomass generation percent (resource mix)","State wind generation percent (resource mix)","State solar generation percent (resource mix)","State geothermal generation percent (resource mix)"];const fj=function(){const[t,n]=(0,e.useState)("polygon"),[i,r]=(0,e.useState)([]),[o,a]=(0,e.useState)([]),[l,c]=(0,e.useState)([]),[u,h]=(0,e.useState)([]),[d,p]=(0,e.useState)([]),[f,g]=(0,e.useState)("moer"),[m,_]=(0,e.useState)(cj.zoom);(0,e.useEffect)((()=>{fetch("/global_region_moer.json").then((t=>t.json())).then((t=>{r(t)}
2)).catch((t=>console.error("Error loading region_moer.json:",t))),fetch("/region_health.json").then((t=>t.json())).then((t=>{a(t.filter((t=>void 0!==t.properties.health_damage)))})).catch((t=>console.error("Error loading region_health.json:",t))),ji("/source_generation.csv").then((t=>{const e=[];t.forEach((t=>{const n=uj[t.state];if(n){const i=.8,r=[...hj.map((e=>({type:"fossil_fuel",category:e,value:+t[e]}))),...dj.map((e=>({type:"clean_energy",category:e,value:+t[e]}))),...pj.map((e=>({type:"renewable_energy",category:e,value:+t[e]})))];r.forEach(((s,o)=>{const a=o/r.length*2*Math.PI,l=i*Math.cos(a),c=i*Math.sin(a);e.push({position:[n[1]+l,n[0]+c],type:s.type,category:s.category,value:s.value,state:t.state})}))}})),c(e)})).catch((t=>console.error("Error loading source_generation.csv:",t))),ji("/air_generation.csv").then((t=>{const e=[];t.forEach((t=>{const n=uj[t.state];if(n){const i=.3,r=[{type:"NOx",value:+t["State annual NOx emissions (tons)"]},{type:"SO2",value:+t["State annual SO2 emissions (tons)"]},{type:"CO2",value:+t["State annual CO2 emissions (tons)"]},{type:"CH4",value:+t["State annual CH4 emissions (lbs)"]},{type:"N2O",value:+t["State annual N2O emissions (lbs)"]}];r.forEach(((s,o)=>{const a=o/r.length*2*Math.PI,l=i*Math.cos(a),c=i*Math.sin(a);e.push({position:[n[1]+l,n[0]+c],type:s.type,value:s.value,state:t.state})}))}})),p(e)})).catch((t=>console.error("Error loading carbon_generation.csv:",t))),ji("/carbon_generation.csv").then((t=>{const e=[];t.forEach((t=>{const n=uj[t.state];if(n){const i=.3,r=[{type:"Carbon Free",value:+t["State total renewables generation percent (resource mix)"]},{type:"Fossil Fuel",value:+t["State total nonrenewables generation percent (resource mix)"]}];r.forEach(((s,o)=>{const a=o/r.length*2*Math.PI,l=i*Math.cos(a),c=i*Math.sin(a);e.push({position:[n[1]+l,n[0]+c],type:s.type,value:s.value,state:t.state})}))}})),h(e)})).catch((t=>console.error("Error loading carbon_generation.csv:",t)))}),[]);const y=U(i,(t=>t.properties.value)),v=B(i,(t=>t.properties.value)),b=U(o,(t=>t.properties.health_damage)),w=B(o,(t=>t.properties.health_damage)),E=["source_generation"!==f&&"carbon_generation"!==f&&"air_generation"!==f&&WD({data:"moer"===f?i:o,dataType:f,minValue:"moer"===f?y:b,maxValue:"moer"===f?v:w,polygonBaseHeight:0,polygonScaleFactor:100,healthScaleFactor:5e3,onHover:t=>{let{object:e,x:n,y:i}=t;const r=document.getElementById("tooltip");if(e){let t=`<div>Region: ${e.region}</div>`;if("moer"===f)t+=`<div>Value: ${e.properties.value}</div>`;else if("health_damage"===f)t+=`<div>Health Damage: ${e.properties.health_damage}</div>`;else if("social_cost_of_carbon"===f){t+=`<div>Social Cost of Carbon: ${Math.round(453592e-9*e.properties.value*208*100)/100}</div>`}r.style.top=`${i}px`,r.style.left=`${n}px`,r.innerHTML=t,r.style.display="block"}else r.style.display="none"}}),"source_generation"===f&&nj({data:l,onHover:t=>{let{object:e,x:n,y:i}=t;const r=document.getElementById("tooltip");if(e){const{state:t,type:s,category:o,value:a}=e.points[0].source;r.style.top=`${i}px`,r.style.left=`${n}px`,r.innerHTML=`<div>State: ${t}</div><div>Type: ${s}</div><div>Category: ${o}</div><div>Value: ${a}</div>`,r.style.display="block"}else r.style.display="none"}}),"air_generation"===f&&oj({data:d,onHover:t=>{let{object:e,x:n,y:i}=t;const r=document.getElementById("tooltip");if(e){const{state:t,type:s,value:o}=e.points[0].source;r.style.top=`${i}px`,r.style.left=`${n}px`,r.innerHTML=`<div>State: ${t}</div><div>Type: ${s}</div><div>Value: ${o}</div>`,r.style.display="block"}else r.style.display="none"}}),"carbon_generation"===f&&rj({data:u,onHover:t=>{let{object:e,x:n,y:i}=t;const r=document.getElementById("tooltip");if(e){const{state:t,type:s,value:o}=e.points[0].source;r.style.top=`${i}px`,r.style.left=`${n}px`,r.innerHTML=`<div>State: ${t}</div><div>Type: ${s}</div><div>Value: ${o}</div>`,r.style.display="block"}else r.style.display="none"}}),m<=1&&pz()].filter(Boolean);return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"control-panel",children:[(0,s.jsxs)("div",{className:"category",children:[(0,s.jsx)("h3",{children:"Polygon Layers"}),(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"radio",value:"moer",checked:"moer"===f&&"polygon"===t,onChange:()=>
2{n("polygon"),g("moer")}}),"MOER Data"]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"radio",value:"social_cost_of_carbon",checked:"social_cost_of_carbon"===f&&"polygon"===t,onChange:()=>{n("polygon"),g("social_cost_of_carbon")}}),"Health Damage: Social Cost of Carbon"]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"radio",value:"health_damage",checked:"health_damage"===f&&"polygon"===t,onChange:()=>{n("polygon"),g("health_damage")}}),"Health Damage Data"]})]}),(0,s.jsxs)("div",{className:"category",children:[(0,s.jsx)("h3",{children:"Hexagon Layers"}),(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"radio",value:"source_generation",checked:"source_generation"===f&&"hexagon"===t,onChange:()=>{n("hexagon"),g("source_generation")}}),"Source Generation Data"]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"radio",value:"air_generation",checked:"air_generation"===f&&"hexagon"===t,onChange:()=>{n("hexagon"),g("air_generation")}}),"Air Generation Data"]}),(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"radio",value:"carbon_generation",checked:"carbon_generation"===f&&"hexagon"===t,onChange:()=>{n("hexagon"),g("carbon_generation")}}),"Carbon Generation Data"]})]})]}),(0,s.jsx)(QN,{initialViewState:cj,controller:!0,layers:E,onViewStateChange:t=>{let{viewState:e}=t;_(e.zoom)},style:{width:"100%",height:"100%"},children:(0,s.jsx)(CO,{mapStyle:"mapbox://styles/mapbox/dark-v10",mapboxAccessToken:"pk.eyJ1IjoibWFuZGFsaSIsImEiOiJjbHh0Z2I4YW0wNGtvMmlvYzZhM28wMTV2In0.maKcZ_aBF3G64JMJM2W1EQ",style:{width:"100%",height:"100%"}})}),(0,s.jsx)(lj,{dataType:f}),(0,s.jsx)("div",{id:"tooltip",style:{position:"absolute",display:"none",pointerEvents:"none",background:"rgba(255, 255, 255, 0.9)",color:"black",padding:"5px",borderRadius:"3px",boxShadow:"0 2px 6px rgba(0,0,0,0.15)"}})]})};function gj(t,e){let n=0;if(void 0===e)for(let i of t)(i=+i)&&(n+=i);else{let i=-1;for(let r of t)(r=+e(r,++i,t))&&(n+=r)}return n}function mj(t,e){let n;if(void 0===e)for(const i of t)null!=i&&(n<i||void 0===n&&i>=i)&&(n=i);else{let i=-1;for(let r of t)null!=(r=e(r,++i,t))&&(n<r||void 0===n&&r>=r)&&(n=r)}return n}function _j(t,e){let n;if(void 0===e)for(const i of t)null!=i&&(n>i||void 0===n&&i>=i)&&(n=i);else{let i=-1;for(let r of t)null!=(r=e(r,++i,t))&&(n>r||void 0===n&&r>=r)&&(n=r)}return n}function yj(t){return t.target.depth}function vj(t,e){return t.sourceLinks.length?t.depth:e-1}function bj(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?_j(t.sourceLinks,yj)-1:0}function wj(t){return function(){return t}}function Ej(t,e){return Sj(t.source,e.source)||t.index-e.index}function xj(t,e){return Sj(t.target,e.target)||t.index-e.index}function Sj(t,e){return t.y0-e.y0}function Tj(t){return t.value}function Cj(t){return t.index}function Aj(t){return t.nodes}function Pj(t){return t.links}function Rj(t,e){const n=t.get(e);if(!n)throw new Error("missing: "+e);return n}function Mj(t){let{nodes:e}=t;for(const n of e){let t=n.y0,e=t;for(const i of n.sourceLinks)i.y0=t+i.width/2,t+=i.width;for(const i of n.targetLinks)i.y1=e+i.width/2,e+=i.width}}function Ij(){let t,e,n,i=0,r=0,s=1,o=1,a=24,l=8,c=Cj,u=vj,h=Aj,d=Pj,p=6;function f(){const f={nodes:h.apply(null,arguments),links:d.apply(null,arguments)};return function(t){let{nodes:e,links:i}=t;for(const[n,s]of e.entries())s.index=n,s.sourceLinks=[],s.targetLinks=[];const r=new Map(e.map(((t,n)=>[c(t,n,e),t])));for(const[n,s]of i.entries()){s.index=n;let{source:t,target:e}=s;"object"!==typeof t&&(t=s.source=Rj(r,t)),"object"!==typeof e&&(e=s.target=Rj(r,e)),t.sourceLinks.push(s),e.targetLinks.push(s)}if(null!=n)for(const{sourceLinks:s,targetLinks:o}of e)s.sort(n),o.sort(n)}(f),function(t){let{nodes:e}=t;for(const n of e)n.value=void 0===n.fixedValue?Math.max(gj(n.sourceLinks,Tj),gj(n.targetLinks,Tj)):n.fixedValue}(f),function(t){let{nodes:e}=t;const n=e.length;let i=new Set(e),r=new Set,s=0;for(;i.size;){for(const t of i){t.depth=s;for(const{target:e}of t.sourceLinks)r.add(e)}if(++s>n)throw new Error("circular link");i=r,r=new Set}}(f),function(t){let{nodes:e}=t;const n=e.length;let i=new Set(e),r=new Set,s=0;for(;i.size;){for(const t of i){t.height=s;for(const{source:e}of t.targetLinks)r.add(e)}if(++s>n)throw new Error("circular link");i=r,r=new Set}}(f),function(n){const c=function(t){let{nodes:n}=t;const r=mj(n,(t=>t.depth))+1,o=(s-i-a)/(r-1),l=new Array(r);for(const e of n){const t=Math.max(0,Math.min(r-1,Math.floor(u.call(null,e,r))));e.layer=t,e.x0=i+t*o,e.x1=e.x0+a,l[t]?l[t].push(e):l[t]=[e]}if(e)for(const i of l)i.sort(e);return l}(n);t=Math.min(l,(o-r)/(mj(c,(t=>t.length))-1)),function(e){const n=_j(e,(e=>(o-r-(e.length-1)*t)/gj(e,Tj)));for(const i of e){let e=r;
2for(const r of i){r.y0=e,r.y1=e+r.value*n,e=r.y1+t;for(const t of r.sourceLinks)t.width=t.value*n}e=(o-e+t)/(i.length+1);for(let t=0;t<i.length;++t){const n=i[t];n.y0+=e*(t+1),n.y1+=e*(t+1)}w(i)}}(c);for(let t=0;t<p;++t){const e=Math.pow(.99,t),n=Math.max(1-e,(t+1)/p);m(c,e,n),g(c,e,n)}}(f),Mj(f),f}function g(t,n,i){for(let r=1,s=t.length;r<s;++r){const s=t[r];for(const t of s){let e=0,i=0;for(const{source:n,value:s}of t.targetLinks){let r=s*(t.layer-n.layer);e+=E(n,t)*r,i+=r}if(!(i>0))continue;let r=(e/i-t.y0)*n;t.y0+=r,t.y1+=r,b(t)}void 0===e&&s.sort(Sj),_(s,i)}}function m(t,n,i){for(let r=t.length-2;r>=0;--r){const s=t[r];for(const t of s){let e=0,i=0;for(const{target:n,value:s}of t.sourceLinks){let r=s*(n.layer-t.layer);e+=x(t,n)*r,i+=r}if(!(i>0))continue;let r=(e/i-t.y0)*n;t.y0+=r,t.y1+=r,b(t)}void 0===e&&s.sort(Sj),_(s,i)}}function _(e,n){const i=e.length>>1,s=e[i];v(e,s.y0-t,i-1,n),y(e,s.y1+t,i+1,n),v(e,o,e.length-1,n),y(e,r,0,n)}function y(e,n,i,r){for(;i<e.length;++i){const s=e[i],o=(n-s.y0)*r;o>1e-6&&(s.y0+=o,s.y1+=o),n=s.y1+t}}function v(e,n,i,r){for(;i>=0;--i){const s=e[i],o=(s.y1-n)*r;o>1e-6&&(s.y0-=o,s.y1-=o),n=s.y0-t}}function b(t){let{sourceLinks:e,targetLinks:i}=t;if(void 0===n){for(const{source:{sourceLinks:t}}of i)t.sort(xj);for(const{target:{targetLinks:t}}of e)t.sort(Ej)}}function w(t){if(void 0===n)for(const{sourceLinks:e,targetLinks:n}of t)e.sort(xj),n.sort(Ej)}function E(e,n){let i=e.y0-(e.sourceLinks.length-1)*t/2;for(const{target:r,width:s}of e.sourceLinks){if(r===n)break;i+=s+t}for(const{source:t,width:r}of n.targetLinks){if(t===e)break;i-=r}return i}function x(e,n){let i=n.y0-(n.targetLinks.length-1)*t/2;for(const{source:r,width:s}of n.targetLinks){if(r===e)break;i+=s+t}for(const{target:t,width:r}of e.sourceLinks){if(t===n)break;i-=r}return i}return f.update=function(t){return Mj(t),t},f.nodeId=function(t){return arguments.length?(c="function"===typeof t?t:wj(t),f):c},f.nodeAlign=function(t){return arguments.length?(u="function"===typeof t?t:wj(t),f):u},f.nodeSort=function(t){return arguments.length?(e=t,f):e},f.nodeWidth=function(t){return arguments.length?(a=+t,f):a},f.nodePadding=function(e){return arguments.length?(l=t=+e,f):l},f.nodes=function(t){return arguments.length?(h="function"===typeof t?t:wj(t),f):h},f.links=function(t){return arguments.length?(d="function"===typeof t?t:wj(t),f):d},f.linkSort=function(t){return arguments.length?(n=t,f):n},f.size=function(t){return arguments.length?(i=r=0,s=+t[0],o=+t[1],f):[s-i,o-r]},f.extent=function(t){return arguments.length?(i=+t[0][0],s=+t[1][0],r=+t[0][1],o=+t[1][1],f):[[i,r],[s,o]]},f.iterations=function(t){return arguments.length?(p=+t,f):p},f}const Lj=n.p+"static/media/fuel.0809a859e1d4c4e6278f.png",kj=n.p+"static/media/air.95164d6fe8f8395ec1bb.png",Nj=n.p+"static/media/air-health.2879a532b2edceabee08.png",Oj={"Fossil Fuels":"/carbon_generation.csv","Air Pollutants":"/air_generation.csv","Health Damage":"/region_health.json"},Dj=t=>{let{nodeTitle:n}=t;const i=(0,e.useRef)(),[r,o]=(0,e.useState)([]),[a,l]=(0,e.useState)({});return(0,e.useEffect)((()=>{if(!n||!Oj[n])return;(async()=>{try{if("Fossil Fuels"===n||"Air Pollutants"===n){const t=await ji(Oj[n]);let e;"Fossil Fuels"===n?e=t.map((t=>({state:t.state,fossilFuelPercent:+t["State total nonrenewables generation percent (resource mix)"]}))).sort(((t,e)=>e.fossilFuelPercent-t.fossilFuelPercent)):"Air Pollutants"===n&&(e=t.map((t=>({state:t.state,NOx:+t["State annual NOx emissions (tons)"],SO2:+t["State annual SO2 emissions (tons)"],CO2:+t["State annual CO2 emissions (tons)"],CH4:+t["State annual CH4 emissions (lbs)"],N2O:+t["State annual N2O emissions (lbs)"]}))).sort(((t,e)=>e.NOx-t.NOx))),o(e)}else if("Health Damage"===n){$f(Uf(Kf(Qf),"health"),(t=>{const e=t.val();if(e){l(e);const t={};Object.keys(e).forEach((n=>{const i=Math.round(e[n]);t[i]||(t[i]=[]),t[i].push(n)}));const n=Object.entries(t).map((t=>{let[e,n]=t;return{health:+e,states:n.join(", ")}})).sort(((t,e)=>e.health-t.health));o(n)}}))}}catch($c){console.error("Error loading data:",$c)}})()}),[n]),(0,e.useEffect)((()=>{if(!r||0===r.length)return;const t=ma(i.current);t.selectAll("*").remove();const e=40,s=90,o=700-s-30,a=600-e-40,l=tr(".2s"),c=ma("body").append("div").attr("class","horizontal-bar-graph-tooltip").style("opacity",0);if("Fossil Fuels"===n){const n=oa().domain([0,B(r,(t=>t.fossilFuelPercent))]).range([0,o]),i=Lo().domain(r.map((t=>t.state))).range([0,a]).padding(.1),l=t.append("g").attr("transform",`translate(${s+5},${e})`);l.append("text").attr("x",o/2).attr("y",-20).attr("text-anchor","middle").style("font-size","16px").text("Fossil Fuel Generation Percentage"),l.append("g").selectAll("rect").data(r).enter().append("rect").attr("x",0).attr("y",(t=>i(t.state))).attr("width",(t=>n(t.fossilFuelPercent))).attr("height",i.bandwidth()).attr("fill","#520b0a").on("mouseover",((t,e)=>{c.transition().duration(200).style("opacity",.9),c.html(`${e.state}: ${100*e.fossilFuelPercent}%`).style("left",t.pageX+5+"px").style("top",t.pageY-28+"px")})).on("mouseout",((t,e)=>{c.transition().duration(500).style("opacity",0)})),l.append("g").call(Q(i)),l.append("g").attr("transform",`translate(0,${a})`).call(J(n).tickFormat((t=>100*t+"%")))}else if("Air Pollutants"===n){const n=["#ff7f0e","#1f77b4","#2ca02c","#d62728","#9467bd"],i=["tons","tons","tons","lbs","lbs"];["NOx","SO2","CO2","CH4","N2O"].forEach(((u,h)=>{const d=oa().domain([0,B(r,(t=>t[u]))]).range([0,(o-40)/5]),p=Lo().domain(r.map((t=>t.state))).range([0,a]).padding(.1),f=t.append("g").attr("transform",`translate(${s+5+h*((o-40)/5+15)},${e})`);f.append("text").attr("x",(o-40)/10).attr("y",-10).attr("text-anchor","middle").style("font-size","12px").text(`${u} (${i[h]})`),f.append("g").selectAll("rect").data(r).enter().append("rect").attr("x",0).attr("y",(t=>p(t.state))).attr("width",(t=>d(t[u]))).attr("height",p.bandwidth()).attr("fill",n[h]).on("mouseover",((t,e)=>{c.transition().duration(200).style("opacity",.9),c.html(`${e.state}: ${e[u]} ${i[h]}`).style("left",t.pageX+5+"px").style("top",t.pageY-28+"px")})).on("mouseout",((t,e)=>{c.transition().duration(500).style("opacity",0)})),0===h&&f.append("g").call(Q(p)),f.append("g").attr("transform",`translate(0,${a})`).call(J(d).tickFormat(l).ticks(3))}))}else if("Health Damage"===n){const n=oa().domain([0,B(r,(t=>t.health))]).range([0,o]),i=Lo().domain(r.map((t=>t.health))).range([0,a]).padding(.2),u=t.append("g").attr("transform",`translate(${s+5},${e})`);u.append("text").attr("x",o/2).attr("y",-30).attr("text-anchor","middle").style("font-size","12px").text("Health Damage (USD/MWh)"),u.append("g").selectAll("rect").data(r).enter().append("rect").attr("x",0).attr("y",(t=>i(t.health))).attr("width",(t=>n(t.health))).attr("height",i.bandwidth()).attr("fill","#0a1112").on("mouseover",((t,e)=>{c.transition().duration(200).style("opacity",.9),c.html(`<strong>States:</strong> ${e.states}<br><strong>Health Damage:</strong> ${e.health} USD/MWh`).style("left",t.pageX+5+"px").style("top",t.pageY-28+"px")})).on("mouseout",((t,e)=>{c.transition().duration(500).style("opacity",0)}
2)),u.append("g").call(Q(i).tickFormat((t=>r.find((e=>e.health===t)).states))).selectAll("text").style("font-size","8px"),u.append("g").attr("transform",`translate(0,${a})`).call(J(n).tickFormat(l).ticks(3))}return()=>{c.remove()}}),[r,a,n]),(0,s.jsx)("svg",{ref:i,width:"740",height:"900"})},Fj=t=>{let{width:n=500,height:i=600}=t;const r=(0,e.useRef)(),o=50,a=150,[l,c]=(0,e.useState)(null),u={nodes:[{name:"Fossil Fuels"},{name:"Natural Gas"},{name:"Oil"},{name:"Coal"},{name:"Air Pollutants"},{name:"CO2"},{name:"SO2"},{name:"NOx"},{name:"Particulates"},{name:"CH4"},{name:"N2O"},{name:"Respiratory"},{name:"Cardiovascular"},{name:"Cancer"},{name:"Health Damage"}],links:[{source:0,target:1,value:50},{source:0,target:2,value:30},{source:0,target:3,value:20},{source:1,target:4,value:20},{source:2,target:4,value:30},{source:3,target:4,value:30},{source:4,target:5,value:40},{source:4,target:6,value:30},{source:4,target:7,value:20},{source:4,target:8,value:10},{source:4,target:9,value:20},{source:4,target:10,value:20},{source:6,target:11,value:30},{source:7,target:11,value:10},{source:7,target:12,value:10},{source:8,target:11,value:10},{source:8,target:12,value:10},{source:8,target:13,value:10},{source:9,target:11,value:20},{source:10,target:12,value:20},{source:11,target:14,value:60},{source:12,target:14,value:30},{source:13,target:14,value:30}]};return(0,e.useEffect)((()=>{ma(r.current).selectAll("*").remove();const t=ma(r.current).attr("width",n+a).attr("height",i+o).attr("viewBox",`0 0 ${n+a} ${i+o}`).append("g").attr("transform",`translate(${a},${o}) rotate(90) translate(0, -${n})`),e=Ij().nodeWidth(25).nodePadding(20).extent([[1,1],[i-1,n-1]]).nodeAlign(bj),{nodes:s,links:l}=e({nodes:u.nodes.map((t=>Object.assign({},t))),links:u.links.map((t=>Object.assign({},t)))}),h=(Io(ga),["#520b0a","#e06f04","#997a25","#94a632","#325e4d","#0a1112"]);(function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return F(t,D,D,n)})(s,(t=>t.depth)).forEach(((t,e)=>{t.length>1?t.forEach(((t,n)=>{const i=Un(h[e%h.length]);t.color=i.darker(.8*n).toString()})):t.forEach((t=>{t.color=h[e%h.length]}))}));const d=t.append("defs");l.forEach(((t,e)=>{const n=d.append("linearGradient").attr("id",`gradient${e}`).attr("gradientUnits","userSpaceOnUse").attr("x1","0%").attr("y1","0%").attr("x2","50%").attr("y2","0%");n.append("stop").attr("offset","0%").attr("stop-color",An(t.source.color).brighter(1).toString()),n.append("stop").attr("offset","100%").attr("stop-color",An(t.target.color).brighter(4).toString())}));const p=t.append("g").selectAll("path").data(s).join("path").attr("d",(t=>((t,e,n,i,r)=>`M${t},${e+r}\n Q${t},${e} ${t+r},${e}\n L${t+n-r},${e}\n Q${t+n},${e} ${t+n},${e+r}\n L${t+n},${e+i-r}\n Q${t+n},${e+i} ${t+n-r},${e+i}\n L${t+r},${e+i}\n Q${t},${e+i} ${t},${e+i-r}\n Z`)(t.x0,t.y0,e.nodeWidth(),t.y1-t.y0,5))).attr("fill",(t=>t.color)).attr("stroke",(t=>t.color));p.append("title").text((t=>`${t.name}\n${t.value}`)),p.on("mouseover",((t,e)=>{"Fossil Fuels"!==e.name&&"Air Pollutants"!==e.name&&"Health Damage"!==e.name||c(e.name)})).on("mouseout",(()=>{c(null)}));const f=t.append("g").attr("fill","none").attr("stroke-opacity",.5).selectAll("path").data(l).join("g").style("mix-blend-mode","multiply"),g=Pa().curve(Ia).x((t=>t[0])).y((t=>t[1]));f.append("path").attr("d",(t=>{const e=Math.max(1,t.width),n=[[t.source.x1,t.y0-e/2],[t.source.x1+(t.target.x0-t.source.x1)/2,t.y0-e/2],[t.target.x0,t.y1-e/2],[t.target.x0,t.y1-e/2],[t.target.x0,t.y1],[t.target.x0,t.y1+e/2],[t.target.x0,t.y1+e/2],[t.source.x1+(t.target.x0-t.source.x1)/2,t.y0+e/2],[t.source.x1,t.y0+e/2]];return g(n)})).attr("stroke","white").attr("fill",((t,e)=>`url(#gradient${e})`)),f.append("title").text((t=>`${t.source.name} \u2192 ${t.target.name}\n${t.value}`)),t.append("g").style("font","10px droid-serif").selectAll("text").data(s).join("text").attr("x",(t=>t.x0<i/2?t.x1-10:t.x0+5)).attr("y",(t=>(t.y1+t.y0)/2)).attr("transform",(t=>`rotate(-90, ${(t.x0+t.x1)/2}, ${(t.y0+t.y1)/2})`)).attr("dy","0.35em").attr("text-anchor","middle").text((t=>t.name)).attr("fill","white")}),[l]),(0,s.jsxs)("div",{className:"scrollable-container",children:[(0,s.jsx)("h1",{className:"sankey-title",children:"Fossil Fuel to Health Damage"}),(0,s.jsxs)("div",{className:"container",children:[(0,s.jsxs)("div",{className:"image-container",children:[(0,s.jsx)("img",{src:Lj,alt:"Image 1"}),(0,s.jsx)("img",{src:kj,alt:"Image 2"}),(0,s.jsx)("img",{src:Nj,alt:"Image 3"})]}),(0,s.jsx)("div",{className:"svg-container",children:(0,s.jsx)("svg",{ref:r})}),l&&(0,s.jsx)("div",{className:"tooltip-container",children:(0,s.jsx)(Dj,{nodeTitle:l})})]})]})};function Bj(t){return t}function Uj(t,e){return"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return zj(t,e)}))}:zj(t,e)}function zj(t,e){var n=e.id,i=e.bbox,r=null==e.properties?{}:e.properties,s=function(t,e){var n=function(t){if(null==t)return Bj;var e,n,i=t.scale[0],r=t.scale[1],s=t.translate[0],o=t.translate[1];return function(t,a){a||(e=n=0);var l=2,c=t.length,u=new Array(c);for(u[0]=(e+=t[0])*i+s,u[1]=(n+=t[1])*r+o;l<c;)u[l]=t[l],++l;return u}}(t.transform),i=t.arcs;function r(t,e){e.length&&e.pop();for(var r=i[t<0?~t:t],s=0,o=r.length;s<o;++s)e.push(n(r[s],s));t<0&&function(t,e){for(var n,i=t.length,r=i-e;r<--i;)n=t[r],t[r++]=t[i],t[i]=n}(e,o)}function s(t){return n(t)}function o(t){for(var e=[],n=0,i=t.length;n<i;++n)r(t[n],e);return e.length<2&&e.push(e[0]),e}function a(t){for(var e=o(t);e.length<4;)e.push(e[0]);return e}function l(t){return t.map(a)}function c(t){var e,n=t.type;switch(n){case"GeometryCollection":return{type:n,geometries:t.geometries.map(c)};case"Point":e=s(t.coordinates);break;case"MultiPoint":e=t.coordinates.map(s);break;case"LineString":e=o(t.arcs);break;case"MultiLineString":e=t.arcs.map(o);break;case"Polygon":e=l(t.arcs);break;case"MultiPolygon":e=t.arcs.map(l);break;default:return null}return{type:n,coordinates:e}}return c(e)}(t,e);return null==n&&null==i?{type:"Feature",properties:r,geometry:s}:null==i?{type:"Feature",id:n,properties:r,geometry:s}:{type:"Feature",id:n,bbox:i,properties:r,geometry:s}}const jj=Kf(Qf),Vj=t=>{let{hoveredState:n,alterEmissionOffset:i,currentEmissionOffset:r,database:o,displayName:a}=t;const[l,c]=(0,e.useState)([]),[u,h]=(0,e.useState)(0),[d,p]=(0,e.useState)(0),[f,g]=(0,e.useState)(0);return(0,e.useEffect)((()=>
2{if(n){$f(Uf(jj,"avg_moer"),(t=>{const e=t.val(),i=Object.values(e);c(i),h(i.reduce(((t,e)=>t+e),0)/i.length),p(e[n.region]),g(e.TVA)}))}}),[n]),(0,e.useEffect)((()=>{if(l.length>0){const t=400,e=280,i=ma("#barGraph-dialmap").attr("width",t).attr("height",e);i.selectAll("*").remove();const r=B(l),s=Lo().domain([a,"Average",`${n.city}`]).range([30,t-30]).padding(.1),o=oa().domain([0,r]).nice().range([90,20]),c=[{label:a,value:f},{label:"Average",value:u},{label:`${n.city}`,value:d}];i.append("g").selectAll("rect").data(c).enter().append("rect").attr("x",(t=>s(t.label))).attr("y",(t=>o(t.value))).attr("width",s.bandwidth()).attr("height",(t=>90-o(t.value))).attr("fill","#2F2D57"),i.append("g").selectAll("text").data(c).enter().append("text").text((t=>Math.round(t.value))).attr("x",(t=>s(t.label)+s.bandwidth()/2)).attr("y",(t=>o(t.value)-2)).attr("text-anchor","middle").attr("fill","black").style("font-size","8px"),i.append("g").attr("transform","translate(0, 90)").call(J(s).tickSize(0)).selectAll("text").attr("y",10).attr("x",0).attr("dy",".35em").style("text-anchor","start"),i.append("g").attr("transform","translate(30, 0)").call(Q(o).ticks(5).tickSize(0)).selectAll("text").style("font-size","8px"),i.append("text").attr("x",40).attr("y",15).attr("text-anchor","end").attr("fill","black").style("font-size","10px").text("lbs/MWh");const h=i.append("g").attr("class","legend").attr("transform","translate(280, 10)"),p=[{label:"CO2 Emission Rate",color:"#2F2D57"}];h.selectAll("rect").data(p).enter().append("rect").attr("x",40).attr("y",((t,e)=>20*e)).attr("width",10).attr("height",10).attr("fill",(t=>t.color)),h.selectAll("text").data(p).enter().append("text").attr("x",55).attr("y",((t,e)=>20*e+2)).attr("dy",".2em").attr("text-anchor","start").attr("alignment-baseline","middle").attr("fill","black").style("font-size","8px").each((function(t){const e=ma(this);e.append("tspan").text("CO2 Emission Rate").attr("x",55).attr("dy","0em"),e.append("tspan").text("(Annual Average)").attr("x",55).attr("dy","1.2em")}))}}),[l,u,d,f]),(0,s.jsx)("div",{className:"bar-graph-tooltip",children:(0,s.jsx)("svg",{id:"barGraph-dialmap"})})},Wj=Kf(Qf),$j=t=>{let{hoveredState:n,database:i,displayName:r}=t;const[o,a]=(0,e.useState)(""),[l,c]=(0,e.useState)(""),[u,h]=(0,e.useState)(null),[d,p]=(0,e.useState)(null),[f,g]=(0,e.useState)(0),[m,_]=(0,e.useState)(0);(0,e.useEffect)((()=>{const t=Uf(Wj,`realtime/lastHour/${i}/alter`);console.log("Database:",i),$f(t,(t=>{const e=t.val();if(e){const t=Object.values(e).filter((t=>null!==t.co2&&void 0!==t.co2)),i=Math.min(...t.map((t=>t.co2))),r=Math.max(...t.map((t=>t.co2)));h(i),p(r),n&&e[n.region]&&(g(e[n.region].co2),console.log(n.region,e[n.region].co2)),_(e.TVA?e.TVA.co2:0)}}))}),[n]);const y=t=>Math.round(453592e-9*t*208*100)/100,v=(t,e)=>{const n=e[0],i=e[1],r=n+(i-n)/3;return t<=r?tg:t>r&&t<=n+2*(i-n)/3?eg:ng};return(0,e.useEffect)((()=>{if(null!==u&&null!==d){const t=[y(u),y(d)],e=y(f),n=y(m);a(v(e,t)),c(v(n,t))}}),[u,d,f,m]),(0,s.jsxs)("div",{className:"dial-map-health-damage-tooltip",children:[(0,s.jsxs)("div",{className:"dial-map-health-damage-container",children:[(0,s.jsxs)("div",{className:"dial-map-health-damage-item",children:[(0,s.jsx)("img",{src:o,alt:"City Health status"}),(0,s.jsxs)("div",{children:[n.city,": ",y(f)," USD/MWh"]})]}),(0,s.jsxs)("div",{className:"dial-map-health-damage-item",children:[(0,s.jsx)("img",{src:l,alt:"Tennessee Health status"}),(0,s.jsxs)("div",{children:[r,": ",y(m)," USD/MWh"]})]})]}),(0,s.jsx)("a",{href:"https://costofcarbon.org/calculator",target:"_blank",children:"Social Cost of Carbon Calculator"})]})},Gj=t=>{var e;let{currentEmissionOffset:n,MAX_CO2:i,alterEmissionOffset:r,alter:o=!1}=t;const a=180*(o?r/i:n/i),l=[100,100],c=[50+50*Math.cos((180+a)*Math.PI/180),50+50*Math.sin((180+a)*Math.PI/180)],u=[50+50*Math.cos(a*Math.PI/180),50+50*Math.sin(a*Math.PI/180)];return(0,s.jsxs)("svg",{viewBox:`0 0 ${l[0]} ${l[1]}`,xmlns:"http://www.w3.org/2000/svg",id:"carbon-svg",children:[(0,s.jsx)("text",{x:"13",y:"56",fontSize:"3",fill:"#100B32",children:"0"})," ",(0,s.jsxs)("text",{x:"82",y:"56",fontSize:"3",fill:"#100B32",children:[i,"+"]}),(0,s.jsxs)("g",{"transform-origin":"50 50",transform:"translate(0,2.5) scale(1.15)",children:[(0,s.jsx)("image",{href:y,width:"100",height:"100"}),(0,s.jsxs)("mask",{id:"dark-mask",children:[(0,s.jsx)("path",{d:`\n M ${l[0]/2} ${l[1]/2} \n L ${c[0]}
2 ${c[1]} \n L ${l[0]/2} 0\n L 0 0\n L 0 ${l[1]/2}\n Z`,fill:"white",style:{transition:"d 1s"}}),(0,s.jsx)("path",{d:`\n M ${l[0]/2} ${l[1]/2} \n L ${u[0]} ${u[1]} \n L ${l[0]/2} ${l[1]} \n L ${l[0]} ${l[1]} \n L ${l[0]} ${l[1]/2} \n Z`,fill:"white",style:{transition:"d 1s"}})]}),(0,s.jsx)("image",{href:w,width:"100",height:"100",mask:"url(#dark-mask)"}),(0,s.jsx)("image",{href:T,width:"100",height:"100"}),(0,s.jsxs)("g",{x:"50",y:"50",width:"100",height:"100",transform:`\n rotate(${null!==a&&void 0!==a?a:0})\n translate(-30,${a<90?"-9":"9"})\n rotate(${null!==(e=-1*a)&&void 0!==e?e:0})\n `,style:{transition:"transform 1s"},children:[(0,s.jsx)("image",{href:A,width:"100",height:"100"}),(0,s.jsx)("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"2",className:"call-out-text",children:o?Math.floor(r):Math.floor(n)})]}),(0,s.jsx)("image",{href:x,id:"needle",className:"globe-element",style:{transform:"rotate("+a+"deg)",transition:"transform 1s"},alt:"needle pointing at values"})]})]})},Hj=t=>{var e,n;let{alterEmissionOffset:i,MAX_CO2:r}=t;let o=180*(i/r);o>180&&(o=180);const a=[100,100],l=[50+50*Math.cos((180+o)*Math.PI/180),50+50*Math.sin((180+o)*Math.PI/180)],c=[50+
250*Math.cos(o*Math.PI/180),50+50*Math.sin(o*Math.PI/180)];return(0,s.jsxs)("svg",{viewBox:`0 0 ${a[0]} ${a[1]}`,xmlns:"http://www.w3.org/2000/svg",id:"alt-svg",children:[(0,s.jsx)("text",{x:"13",y:"56",fontSize:"3",fill:"#100B32",children:"0"})," ",(0,s.jsxs)("text",{x:"82",y:"56",fontSize:"3",fill:"#100B32",children:[r,"+"]}),(0,s.jsxs)("g",{"transform-origin":"50 50",transform:"translate(0,2.5) scale(1.15)",children:[(0,s.jsx)("image",{href:y,width:"100",height:"100"}),(0,s.jsxs)("mask",{id:"alt-mask",children:[(0,s.jsx)("path",{d:`\n M ${a[0]/2} ${a[1]/2} \n L ${l[0]} ${l[1]} \n L ${a[0]/2} 0\n L 0 0\n L 0 ${a[1]/2}\n Z`,fill:"white",style:{transition:"d 1s"}}),(0,s.jsx)("path",{d:`\n M ${a[0]/2} ${a[1]/2} \n L ${c[0]} ${c[1]} \n L ${a[0]/2} ${a[1]} \n L ${a[0]} ${a[1]} \n L ${a[0]} ${a[1]/2} \n Z`,fill:"white",style:{transition:"d 1s"}})]}),(0,s.jsx)("image",{href:w,width:"100",height:"100",mask:"url(#alt-mask)"}),(0,s.jsx)("image",{href:T,width:"100",height:"100"}),(0,s.jsxs)("g",{x:"50",y:"50",width:"100",height:"100",transform:`\n rotate(${null!==(e=o)&&void 0!==e?e:0})\n translate(-30,${o<90?"-9":"9"})\n rotate(${null!==(n=-1*o)&&void 0!==n?n:0})\n `,style:{transition:"transform 1s"},children:[(0,s.jsx)("image",{href:A,width:"100",height:"100"}),(0,s.jsx)("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"2",className:"call-out-text",children:Math.floor(i)})]}),(0,s.jsx)("image",{href:x,id:"needle",className:"globe-element",style:{transform:"rotate("+o+"deg)",transition:"transform 1s"},alt:"needle pointing at values"})]})]})};Qm(_y(Qf),"[email protected]","ClearloopData123!").then((t=>{Uf(Kf(Qf),"/realtime/")})).catch((t=>{console.error("Auth failed:",t)}));const qj=Kf(Qf),Zj=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];const Xj=function(t){const[n,i]=(0,e.useState)(0),[r,o]=(0,e.useState)("0"),[a,l]=(0,e.useState)(["Loading data...",""]),[c,u]=(0,e.useState)(!0),[h,d]=(0,e.useState)(0),[p,f]=(0,e.useState)(""),[g,m]=(0,e.useState)(""),y=(0,e.useMemo)((()=>1175*t.capacity),[t.capacity]);return(0,e.useEffect)((()=>{const t=()=>u(window.innerWidth>768);return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)}),[]),(0,e.useEffect)((()=>{if(t.hoveredState&&t.hoveredState.region){$f(Uf(qj,`realtime/lastHour${t.database}/alter/${t.hoveredState.region}`),(e=>{const n=e.val();d((null===n||void 0===n?void 0:n.co2)||0),f(t.hoveredState.city),m(t.hoveredState.state)}))}else d(0),f(""),m("")}),[t.hoveredState,t.database]),(0,e.useEffect)((()=>{$f(Uf(qj,`realtime/lastHour${t.database}`),(t=>{const e=t.val();if(e){const t=new Date,n=`${Zj[t.getMonth()]} ${t.getDate()}, ${t.getFullYear()}`,r=t.getHours()>12?t.getHours()%12:t.getHours(),s=t.getHours()>=12?"PM":"AM",a=t.getMinutes().toString().padStart(2,"0");l([n,`${r}:${a} ${s}`]),o(e.mwh.toFixed(2)),i(e.co2)}}))}),[t.database]),(0,s.jsx)("div",{className:"carbon-dial-in-tooltip",children:c?(0,s.jsx)(_,{children:(0,s.jsxs)("div",{id:"carbon-canvas-container",className:"flex-row justify-between align-center",children:[(0,s.jsxs)("div",{id:"localization-text",children:[(0,s.jsx)("p",{className:"time-text",children:"Realtime Carbon"}),(0,s.jsx)("div",{className:"vert-div"}),(0,s.jsx)("p",{className:"time-text",children:a[0]}),(0,s.jsx)("div",{className:"circle-div"}),(0,s.jsx)("p",{className:"time-text",children:a[1]})]}),(0,s.jsxs)("div",{className:"flex-row text-container",children:[(0,s.jsx)("h1",{id:"map-city-name",children:`${t.displayName||"Jackson"}, ${t.location||"Tennessee"}`}),p&&g&&(0,s.jsx)("h1",{id:"map-city-name",children:`${p}, ${g}`})]}),(0,s.jsxs)("div",{className:"flex-row carbon-dial-container",children:[(0,s.jsx)(Gj,{currentEmissionOffset:n,MAX_CO2:y}),(0,s.jsx)(Hj,{alterEmissionOffset:h,MAX_CO2:y})]})]})}):(0,s.jsx)("div",{className:"",children:"Mobile view dial placeholder"})})};Qm(_y(Qf),"[email protected]","ClearloopData123!").then((t=>{Uf(Kf(Qf),"/realtime/")})).catch((t=>{console.error("Auth failed:",t)}));const Kj=t=>{let{setHoveredState:n,alterEmissionOffset:i,setAlterEmissionOffset:o,currentEmissionOffset:a,database:l,displayName:c,handleHealthData:u,location:h,capacity:d}=t;const p=(0,e.useRef)(),f=(0,e.useRef)(null),[g,m]=(0,e.useState)({city:"",region:"",state:""}),[_,y]=(0,e.useState)(null),[v,b]=(0,e.useState)(!1),w=((0,e.useRef)(0),(0,e.useRef)(null)),E=(0,e.useRef)({}),x=(0,e.useRef)({}),S=(0,e.useRef)(null),[T,C]=(0,e.useState)(null),[A,P]=(0,e.useState)({}),R=[1137,1157];(0,e.useEffect)((()=>{$f(Uf(Kf(Qf),"avg_moer"),(t=>{const e=t.val();P(e)}))}),[]);const M=t=>{const e=A[t];return void 0===e?"#ededed":e<R[0]?"#EAEAEF":e>R[1]?"#787E9B":"#AEB3C4"};return(0,e.useEffect)((()=>{f.current=ma(p.current).attr("width",960).attr("height",900);const t=Ao().translate([480,450]).scale([1e3]),e=Os().projection(t);return Wi("/us-states-cleaned.json").then((u=>{const g=Uj(u,u.objects.states).features;f.current.append("defs").append("pattern").attr("id","image-pattern").attr("patternUnits","userSpaceOnUse").attr("width",95).attr("height",100).append("image").attr("href","/brightCarbon.png").attr("width",100).attr("height",100),f.current.selectAll(".custom-state").data(g).enter().append("path").attr("class","custom-state").attr("d",e).style("fill",(t=>"Tennessee"===t.properties.name?"url(#image-pattern)":"#ededed")).style("stroke","white"),Wi("/full_city_region_polygon.json").then((u=>{if(u){E.current=u;const g=f.current.append("g").attr("class","custom-regions");Object.entries(u).forEach((t=>{let[n,i]=t;e({type:"MultiPolygon",coordinates:[i.polygon]});try{let t=e({type:"MultiPolygon",coordinates:[i.polygon]});const r=/M\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?Z/,s=/M\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?Z\s*M\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?Z$/;let o=t.replace(r,"").replace(s,"").trim();g.append("path").datum({polygon:i.polygon,region:i.region}).attr("class",`custom-region custom-region-${n}`).attr("d",o).style("fill",(()=>M(i.region))).style("stroke","white").style("stroke-width","0.5px")}catch($c){console.error("Error projecting path:",$c)}})),(t=>{const e=[{label:"Below Average",color:"#EAEAEF"},{label:"Average Range(1147 \xb110)",color:"#AEB3C4"},{label:"Above Average",color:"#787E9B"}],n=f.current.append("g").attr("class","custom-legend").attr("transform",`translate(${t-300}, 160)`);n.append("text").attr("x",0).attr("y",-10).text("CO2 MOER Annual Average (lbs/MWh)").style("font-size","14px").style("font-weight","bold").style("fill","#333"),n.selectAll("rect").data(e).enter().append("rect").attr("x",0).attr("y",((t,e)=>25*e)).attr("width",20).attr("height",20).style("fill",(t=>t.color)),n.selectAll("text.label").data(e).enter().append("text").attr("class","label").attr("x",30).attr("y",((t,e)=>25*e+15)).text((t=>t.label)).style("font-size","12px").style("fill","#333")})(960),Wi("/location.json").then((e=>{const n=l.startsWith("/")?l.slice(1):l;f.current.append("defs").append("pattern").attr("id","clearloop-logo-pattern").attr("patternUnits","objectBoundingBox").attr("width",1).attr("height",1).append("image").attr("href","/clearloop-logo.png").attr("width",30).attr("height",30);const i=f.current.append("g").attr("class","plant-locations");
2if(e[n]){const[r,s]=e[n],[o,a]=t([s,r]);i.append("circle").attr("class",`plant-circle plant-background-${n}`).attr("cx",o).attr("cy",a).attr("r",15).style("fill","white").style("stroke","black").style("stroke-width",.7),i.append("circle").attr("class",`plant-circle plant-${n}`).attr("cx",o).attr("cy",a).attr("r",15).style("fill","url(#clearloop-logo-pattern)").style("pointer-events","none"),i.select(`.plant-background-${n}`).on("mouseover",(function(){const[t,e]=[ma(this).attr("cx"),ma(this).attr("cy")];f.current.append("text").attr("class",`tooltip-${n}`).attr("x",t).attr("y",e-20).attr("text-anchor","middle").style("font-size","16px").style("font-family","Droid Serif, serif").style("font-weight","bold").style("fill","#f2d10a").style("stroke-width","0.1px").text(`Clearloop Plant: ${c}`)})).on("mouseout",(function(){f.current.select(`.tooltip-${n}`).remove()}))}else console.warn(`Plant location for "${n}" not found in location.json`)})).catch((t=>console.error("Error fetching location.json:",t)));f.current.append("g").attr("class","custom-cities").selectAll(".custom-city").data(Object.entries(u)).enter().append("image").attr("class","custom-city").attr("x",(e=>{const n=t([e[1].lng,e[1].lat])[0]-10;return x.current[e[0]]={x:n,y:t([e[1].lng,e[1].lat])[1]-20},n})).attr("y",(t=>x.current[t[0]].y)).attr("width",20).attr("height",25).attr("href",Yf).style("cursor","pointer").on("mouseover",(function(e,o){if(S.current&&(clearTimeout(S.current),S.current=null),T)return;f.current.selectAll(".custom-city").attr("href",Yf),ma(this).attr("href",Jf).attr("width",30).attr("height",35).raise();const u=`custom-region-${o[0]}`;f.current.selectAll(".custom-region").style("fill",(function(t){return ma(this).attr("class").includes(u)?"#F7E15D":M(t.region)})),y({city:o[0],region:o[1].region_full_name,state:o[1].state}),m({city:o[0],region:o[1].region,state:o[1].state}),n({city:o[0],region:o[1].region,state:o[1].state}),b(!0),w.current&&clearInterval(w.current),f.current.selectAll(".custom-tooltip").remove();const g=p.current.getBoundingClientRect(),_=600;let v=t([o[1].lng,o[1].lat])[0]+25,E=t([o[1].lng,o[1].lat])[1]-200;console.log("Tooltip position:",E,v+_,g.width,g.width-_),v+_>g.width-g.width/4-_&&(v-=580);Math.max(0,Math.min(E,g.height-800));E+400>g.height&&(E=g.height-400-150);f.current.append("foreignObject").attr("class","custom-tooltip").attr("x",v).attr("y",E).attr("width",_).attr("height",400).append("xhtml:div").attr("id","tooltip-content").style("background-color","rgba(255, 255, 255, 0.1)").style("border","1px solid white").style("padding","1px").style("opacity","1");(0,r.createRoot)(document.getElementById("tooltip-content")).render((0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{children:[" ",o[0],", ",o[1].state," ",(0,s.jsx)("br",{})," Balance Authority: ",o[1].region_full_name," "]}),(0,s.jsx)(Xj,{hoveredState:{city:o[0],region:o[1].region,state:o[1].state},alterEmissionOffset:i,currentEmissionOffset:a,database:l,displayName:c,location:h,capacity:d})]}))})).on("mouseout",(function(t,e){T||(S.current=setTimeout((()=>{f.current.selectAll(".custom-city").attr("href",Yf).attr("width",20).attr("height",25),f.current.selectAll(".custom-region").style("fill",(t=>M(t.region))),f.current.selectAll(".custom-tooltip").remove(),y(null),m(""),n({city:"",region:"",state:""}),o(0),b(!1)}),0))})).on("click",(function(t,e){C(e[0])}))}})).catch((t=>{console.error("Error fetching cities data:",t)}))})),()=>{w.current&&clearInterval(w.current)}}),[n,A]),(0,s.jsx)("div",{className:"custom-map-container",children:(0,s.jsx)("svg",{ref:p,id:"custom-map"})})},Yj=t=>{let{setHoveredState:n,alterEmissionOffset:i,setAlterEmissionOffset:o,currentEmissionOffset:a,database:l,displayName:c,location:u,capacity:h}=t;const d=(0,e.useRef)(),p=(0,e.useRef)(null),[f,g]=(0,e.useState)({city:"",region:"",state:""}),[m,_]=(0,e.useState)(null),[y,v]=(0,e.useState)(!1),b=((0,e.useRef)(0),(0,e.useRef)(null)),w=(0,e.useRef)({}),E=(0,e.useRef)({}),x=(0,e.useRef)(null),[S,T]=(0,e.useState)(null),[C,A]=(0,e.useState)({}),P=[1137,1157];(0,e.useEffect)((()=>{$f(Uf(Kf(),"avg_moer"),(t=>{const e=t.val();A(e)}))}),[]);const R=t=>{const e=C[t];return void 0===e||e<P[0]?"#FFCCCB":e>P[1]?"#FF6666":"#FF9999"};return(0,e.useEffect)((()=>{p.current=ma(d.current).attr("width",960).attr("height",900);const t=Ao().translate([480,450]).scale([1e3]),e=Os().projection(t);return Wi("/us-states-cleaned.json").then((f=>{const m=Uj(f,f.objects.states).features;p.current.append("defs").append("pattern").attr("id","image-pattern").attr("patternUnits","userSpaceOnUse").attr("width",95).attr("height",100).append("image").attr("href","/brightCarbon.png").attr("width",100).attr("height",100),p.current.selectAll(".health-state").data(m).enter().append("path").attr("class","health-state").attr("d",e).style("fill",(t=>"Tennessee"===t.properties.name?"url(#image-pattern)":"#ededed")).style("stroke","white"),Wi("/full_city_region_polygon.json").then((f=>{if(f){w.current=f;const m=p.current.append("g").attr("class","health-regions");Object.entries(f).forEach((t=>{let[n,i]=t;e({type:"MultiPolygon",coordinates:[i.polygon]});try{let t=e({type:"MultiPolygon",coordinates:[i.polygon]});const r=/M\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?Z/,s=/M\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?Z\s*M\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?L\d+(\.\d+)?,\d+(\.\d+)?Z$/;let o=t.replace(r,"").replace(s,"").trim();m.append("path").datum({polygon:i.polygon,region:i.region}).attr("class",`health-region health-region-${n}`).attr("d",o).style("fill",(()=>R(i.region))).style("stroke","white").style("stroke-width","0.5px")}catch($c){console.error("Error projecting path:",$c)}})),(t=>{const e=[{label:"Below Average",color:"#FFCCCB"},{label:"Average Range(1147 \xb110)",color:"#FF9999"},{label:"Above Average",color:"#FF6666"}],n=p.current.append("g").attr("class","health-legend").attr("transform",`translate(${t-300}, 160)`);n.selectAll("rect").data(e).enter().append("rect").attr("x",0).attr("y",((t,e)=>25*e)).attr("width",20).attr("height",20).style("fill",(t=>t.color)),n.selectAll("text").data(e).enter().append("text").attr("x",30).attr("y",((t,e)=>25*e+15)).text((t=>t.label)).style("font-size","12px").style("fill","#333")})(960);p.current.append("g").attr("class","health-cities").selectAll(".health-city").data(Object.entries(f)).enter().append("image").attr("class","health-city").attr("x",(e=>{const n=t([e[1].lng,e[1].lat])[0]-10;return E.current[e[0]]={x:n,y:t([e[1].lng,e[1].lat])[1]-20},n})).attr("y",(t=>E.current[t[0]].y)).attr("width",20).attr("height",25).attr("href",Yf).style("cursor","pointer").on("mouseover",(function(e,o){if(x.current&&(clearTimeout(x.current),x.current=null),S)return;p.current.selectAll(".health-city").attr("href",Yf),ma(this).attr("href",Jf).attr("width",30).attr("height",35).raise();const f=`health-region-${o[0]}`;p.current.selectAll(".health-region").style("fill",(function(t){return ma(this).attr("class").includes(f)?"#F7E15D":R(t.region)})),_({city:o[0],region:o[1].region_full_name,state:o[1].state}),g({city:o[0],region:o[1].region,state:o[1].state}),n({city:o[0],region:o[1].region,state:o[1].state}),v(!0),b.current&&clearInterval(b.current),p.current.selectAll(".health-tooltip").remove();const m=d.current.getBoundingClientRect(),y=600;let w=t([o[1].lng,o[1].lat])[0]+25,E=t([o[1].lng,o[1].lat])[1]-200;w+y>m.width-y&&(w-=580);Math.max(0,Math.min(E,m.height-800));E+530>m.height&&(E=m.height-530-150);p.current.append("foreignObject").attr("class","health-tooltip").attr("x",w).attr("y",E).attr("width",y).attr("height",530).append("xhtml:div").attr("id","tooltip-content").style("background-color","rgba(255, 255, 255, 0.1)").style("border","1p
2x solid white").style("padding","1px").style("opacity","1");(0,r.createRoot)(document.getElementById("tooltip-content")).render((0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{children:[" ",o[0],", ",o[1].state," ",(0,s.jsx)("br",{})," Balance Authority: ",o[1].region_full_name," "]}),(0,s.jsx)("p",{className:"time-text",children:"2023 Annual Average Carbon Marginal Operating Emission Rate"}),(0,s.jsx)(Vj,{hoveredState:{city:o[0],region:o[1].region,state:o[1].state},alterEmissionOffset:i,currentEmissionOffset:a,database:l,displayName:c}),(0,s.jsx)("h3",{className:"dial-map-health-title",children:"Social Cost of Carbon"}),(0,s.jsx)($j,{hoveredState:{city:o[0],region:o[1].region,state:o[1].state},alterEmissionOffset:i,currentEmissionOffset:a,database:l,displayName:c,location:u,capacity:h})]}))})).on("mouseout",(function(t,e){S||(x.current=setTimeout((()=>{ma(this).attr("href",Yf).attr("width",20).attr("height",25),p.current.selectAll(".health-region").style("fill",(t=>R(t.region))),p.current.selectAll(".health-tooltip").remove(),_(null),g(""),n({city:"",region:"",state:""}),o(0),v(!1)}),1e3))})).on("click",(function(t,e){T(e[0])}))}})).catch((t=>{console.error("Error fetching cities data:",t)}))})),()=>{b.current&&clearInterval(b.current)}}),[n,C]),(0,s.jsx)("div",{className:"health-map-container",children:(0,s.jsx)("svg",{ref:d,id:"health-map"})})},Jj=()=>{const t=(0,e.useRef)(),n=(0,e.useRef)(null),[i,r]=(0,e.useState)(null);(0,e.useEffect)((()=>{Wi("/filtered_counties_with_dci.geojson").then((t=>{r(t)})).catch((t=>{console.error("Error loading GeoJSON data:",t)}))}),[]);(0,e.useEffect)((()=>{if(!i)return;n.current=ma(t.current).attr("width",960).attr("height",900);const e=Ao().translate([480,450]).scale([1e3]),r=Os().projection(e);n.current.selectAll(".dci-county").data(i.features).enter().append("path").attr("class","dci-county").attr("d",r).style("fill",(t=>(t=>{switch(t){case"Distressed":return"#e63946";case"At Risk":return"#f4a261";case"Mid-tier":return"#e9c46a";case"Comfortable":return"#2a9d8f";case"Prosperous":return"#264653";default:return"#d3d3d3"}})(t.properties.DCI))).style("stroke","white").style("stroke-width","0.5px"),o(960)}),[i]);const o=t=>{const e=[{label:"Distressed",color:"#e63946"},{label:"At Risk",color:"#f4a261"},{label:"Mid-tier",color:"#e9c46a"},{label:"Comfortable",color:"#2a9d8f"},{label:"Prosperous",color:"#264653"}],i=n.current.append("g").attr("class","dci-legend").attr("transform",`translate(${t-200}, 60)`);i.selectAll("rect").data(e).enter().append("rect").attr("x",0).attr("y",((t,e)=>25*e)).attr("width",20).attr("height",20).style("fill",(t=>t.color)),i.selectAll("text").data(e).enter().append("text").attr("x",30).attr("y",((t,e)=>25*e+15)).text((t=>t.label)).style("font-size","12px").style("fill","#333")};return(0,s.jsx)("div",{className:"dci-map-container",children:(0,s.jsx)("svg",{ref:t,id:"dci-map"})})};Qm(_y(Qf),"[email protected]","ClearloopData123!").then((t=>{Uf(Kf(Qf),"/realtime/")})).catch((t=>{console.error("Auth failed:",t)}));const Qj=Kf(Qf),tV=t=>{const[n,i]=(0,e.useState)(0),[r,o]=(0,e.useState)(0),[a,l]=(0,e.useState)({city:"",region:"",state:""}),[c,u]=(0,e.useState)(0),[h,d]=(0,e.useState)(0),[p,f]=(0,e.useState)("carbon"),g=(0,e.useRef)(null);(0,e.useEffect)((()=>{$f(Uf(Qj,`realtime/lastHour${t.database}`),(t=>{const e=t.val();i(e.co2),e.alter&&e.alter[a.region]&&o(e.alter[a.region].co2)}))}),[t.database,n,a.region]);const m=(t,e)=>{u(t),d(e)};return(0,s.jsx)("div",{className:"map-section-container",children:(0,s.jsx)(_,{children:(0,s.jsx)("div",{className:"map-container",children:(0,s.jsxs)("div",{id:"map",ref:g,className:"full-width-map",children:["carbon"===p&&(0,s.jsx)(Kj,{setHoveredState:l,alterEmissionOffset:r,setAlterEmissionOffset:o,currentEmissionOffset:n,database:t.database,displayName:t.displayName,handleHealthData:m,location:t.location,capacity:t.capacity}),"health"===p&&(0,s.jsx)(Yj,{setHoveredState:l,alterEmissionOffset:r,setAlterEmissionOffset:o,currentEmissionOffset:n,database:t.database,displayName:t.displayName,handleHealthData:m,location:t.location,capacity:t.capacity}),"dci"===p&&(0,s.jsx)(Jj,{setHoveredState:l,alterEmissionOffset:r,setAlterEmissionOffset:o,currentEmissionOffset:n,database:t.database,displayName:t.displayName,location:t.location,capacity:t.capacity})]})})})})},eV=t=>{let{data:e,minValue:n,maxValue:i,onHover:r}=t;const s=oa().domain([n,i]).range([[150,222,209],[255,67,51]]);return new VD({id:"global-polygon-layer",data:e,lineWidthMinPixels:1,pickable:!0,getPolygon:t=>t.polygon,getElevation:()=>0,getFillColor:t=>{const e=t.properties.value;return s(e)},getLineColor:[255,255,255],onHover:r})},nV={longitude:0,latitude:20,zoom:1.5,pitch:0,bearing:0};const iV=function(){const[t,n]=(0,e.useState)([]);(0,e.useEffect)((()=>{fetch("/fixed_global_region.json").then((t=>t.json())).then((t=>{n(t)})).catch((t=>console.error("Error loading converted_global_region_moer.json:",t)))}),[]);const i=U(t,(t=>t.properties.value)),r=B(t,(t=>t.properties.value)),o=[eV({data:t,minValue:i,maxValue:r,polygonBaseHeight:0,polygonScaleFactor:100,onHover:t=>{let{object:e,x:n,y:i,coordinate:r}=t;const s=document.getElementById("tooltip");
2if(e){const[t,o]=r;s.style.top=`${i}px`,s.style.left=`${n}px`,s.innerHTML=`\n <div><strong>Region:</strong> ${e.properties.region_full_name}</div>\n <div><strong>Value:</strong> ${e.properties.value}</div>\n <div><strong>Longitude:</strong> ${t.toFixed(5)}</div>\n <div><strong>Latitude:</strong> ${o.toFixed(5)}</div>\n `,s.style.display="block"}else s.style.display="none"}})];return(0,s.jsxs)("div",{children:[(0,s.jsx)(QN,{initialViewState:nV,controller:!0,layers:o,style:{width:"100%",height:"100%"},children:(0,s.jsx)(CO,{mapStyle:"mapbox://styles/mapbox/light-v10",mapboxAccessToken:"pk.eyJ1IjoibWFuZGFsaSIsImEiOiJjbHh0Z2I4YW0wNGtvMmlvYzZhM28wMTV2In0.maKcZ_aBF3G64JMJM2W1EQ",style:{width:"100%",height:"100%"}})}),(0,s.jsx)("div",{id:"tooltip",style:{position:"absolute",display:"none",pointerEvents:"none",background:"rgba(255, 255, 255, 0.9)",color:"black",padding:"5px",borderRadius:"3px",boxShadow:"0 2px 6px rgba(0,0,0,0.15)"}})]})};var rV=n(486),sV=n.n(rV);const oV={type:sV().string,tooltip:sV().bool,as:sV().elementType},aV=e.forwardRef(((t,e)=>{let{as:n="div",className:i,type:r="valid",tooltip:o=!1,...a}=t;return(0,s.jsx)(n,{...a,ref:e,className:c()(i,`${r}-${o?"tooltip":"feedback"}`)})}));aV.displayName="Feedback",aV.propTypes=oV;const lV=aV,cV=e.createContext({}),uV=e.forwardRef(((t,n)=>{let{id:i,bsPrefix:r,className:o,type:a="checkbox",isValid:l=!1,isInvalid:u=!1,as:h="input",...d}=t;const{controlId:p}=(0,e.useContext)(cV);return r=g(r,"form-check-input"),(0,s.jsx)(h,{...d,ref:n,type:a,id:i||p,className:c()(o,r,l&&"is-valid",u&&"is-invalid")})}));uV.displayName="FormCheckInput";const hV=uV,dV=e.forwardRef(((t,n)=>{let{bsPrefix:i,className:r,htmlFor:o,...a}=t;const{controlId:l}=(0,e.useContext)(cV);return i=g(i,"form-check-label"),(0,s.jsx)("label",{...a,ref:n,htmlFor:o||l,className:c()(r,i)})}));dV.displayName="FormCheckLabel";const pV=dV;const fV=e.forwardRef(((t,n)=>{let{id:i,bsPrefix:r,bsSwitchPrefix:o,inline:a=!1,reverse:l=!1,disabled:u=!1,isValid:h=!1,isInvalid:d=!1,feedbackTooltip:p=!1,feedback:f,feedbackType:m,className:_,style:y,title:v="",type:b="checkbox",label:w,children:E,as:x="input",...S}=t;r=g(r,"form-check"),o=g(o,"form-switch");const{controlId:T}=(0,e.useContext)(cV),C=(0,e.useMemo)((()=>({controlId:i||T})),[T,i]),A=!E&&null!=w&&!1!==w||function(t,n){return e.Children.toArray(t).some((t=>e.isValidElement(t)&&t.type===n))}(E,pV),P=(0,s.jsx)(hV,{...S,type:"switch"===b?"checkbox":b,ref:n,isValid:h,isInvalid:d,disabled:u,as:x});return(0,s.jsx)(cV.Provider,{value:C,children:(0,s.jsx)("div",{style:y,className:c()(_,A&&r,a&&`${r}-inline`,l&&`${r}-reverse`,"switch"===b&&o),children:E||(0,s.jsxs)(s.Fragment,{children:[P,A&&(0,s.jsx)(pV,{title:v,children:w}),f&&(0,s.jsx)(lV,{type:m,tooltip:p,children:f})]})})})}));fV.displayName="FormCheck";const gV=Object.assign(fV,{Input:hV,Label:pV});n(81);const mV=e.forwardRef(((t,n)=>{let{bsPrefix:i,type:r,size:o,htmlSize:a,id:l,className:u,isValid:h=!1,isInvalid:d=!1,plaintext:p,readOnly:f,as:m="input",..._}=t;const{controlId:y}=(0,e.useContext)(cV);return i=g(i,"form-control"),(0,s.jsx)(m,{..._,type:r,size:a,ref:n,readOnly:f,id:l||y,className:c()(u,p?`${i}-plaintext`:i,o&&`${i}-${o}`,"color"===r&&`${i}-color`,h&&"is-valid",d&&"is-invalid")})}));mV.displayName="FormControl";const _V=Object.assign(mV,{Feedback:lV}),yV=e.forwardRef(((t,e)=>{let{className:n,bsPrefix:i,as:r="div",...o}=t;return i=g(i,"form-floating"),(0,s.jsx)(r,{ref:e,className:c()(n,i),...o})}));yV.displayName="FormFloating";const vV=yV,bV=e.forwardRef(((t,n)=>{let{controlId:i,as:r="div",...o}=t;const a=(0,e.useMemo)((()=>({controlId:i})),[i]);return(0,s.jsx)(cV.Provider,{value:a,children:(0,s.jsx)(r,{...o,ref:n})})}));bV.displayName="FormGroup";const wV=bV;function EV(t){let{as:n,bsPrefix:i,className:r,...s}=t;i=g(i,"col");const o=function(){const{breakpoints:t}=(0,e.useContext)(d);return t}(),a=function(){const{minBreakpoint:t}=(0,e.useContext)(d);return t}(),l=[],u=[];return o.forEach((t=>{const e=s[t];let n,r,o;delete s[t],"object"===typeof e&&null!=e?({span:n,offset:r,order:o}=e):n=e;const c=t!==a?`-${t}`:"";n&&l.push(!0===n?`${i}${c}`:`${i}${c}-${n}`),null!=o&&u.push(`order${c}-${o}`),null!=r&&u.push(`offset${c}-${r}`)})),[{...s,className:c()(r,...l,...u)},{as:n,bsPrefix:i,spans:l}]}const xV=e.forwardRef(((t,e)=>{const[{className:n,...i},{as:r="div",bsPrefix:o,spans:a}]=EV(t);return(0,s.jsx)(r,{...i,ref:e,className:c()(n,!a.length&&o)})}));xV.displayName="Col";const SV=xV,TV=e.forwardRef(((t,n)=>{let{as:i="label",bsPrefix:r,column:o=!1,visuallyHidden:a=!1,className:l,htmlFor:u,...h}=t;const{controlId:d}=(0,e.useContext)(cV);r=g(r,"form-label");let p="col-form-label";"string"===typeof o&&(p=`${p} ${p}-${o}`);const f=c()(l,r,a&&"visually-hidden",o&&p);return u=u||d,o?(0,s.jsx)(SV,{ref:n,as:"label",className:f,htmlFor:u,...h}):(0,s.jsx)(i,{ref:n,className:f,htmlFor:u,...h})}));TV.displayName="FormLabel";const CV=TV,AV=e.forwardRef(((t,n)=>{let{bsPrefix:i,className:r,id:o,...a}=t;const{controlId:l}=(0,e.useContext)(cV);return i=g(i,"form-range"),(0,s.jsx)("input",{...a,type:"range",ref:n,className:c()(r,i),id:o||l})}));AV.displayName="FormRange";const PV=AV,RV=e.forwardRef(((t,n)=>{let{bsPrefix:i,size:r,htmlSize:o,className:a,isValid:l=!1,isInvalid:u=!1,id:h,...d}=t;const{controlId:p}=(0,e.useContext)(cV);return i=g(i,"form-select"),(0,s.jsx)("select",{...d,size:o,ref:n,className:c()(a,i,r&&`${i}-${r}`,l&&"is-valid",u&&"is-invalid"),id:h||p})}));RV.displayName="FormSelect";const MV=RV,IV=e.forwardRef(((t,e)=>{let{bsPrefix:n,className:i,as:r="small",muted:o,...a}=t;
2return n=g(n,"form-text"),(0,s.jsx)(r,{...a,ref:e,className:c()(i,n,o&&"text-muted")})}));IV.displayName="FormText";const LV=IV,kV=e.forwardRef(((t,e)=>(0,s.jsx)(gV,{...t,ref:e,type:"switch"})));kV.displayName="Switch";const NV=Object.assign(kV,{Input:gV.Input,Label:gV.Label}),OV=e.forwardRef(((t,e)=>{let{bsPrefix:n,className:i,children:r,controlId:o,label:a,...l}=t;return n=g(n,"form-floating"),(0,s.jsxs)(wV,{ref:e,className:c()(i,n),controlId:o,...l,children:[r,(0,s.jsx)("label",{htmlFor:o,children:a})]})}));OV.displayName="FloatingLabel";const DV=OV,FV={_ref:sV().any,validated:sV().bool,as:sV().elementType},BV=e.forwardRef(((t,e)=>{let{className:n,validated:i,as:r="form",...o}=t;return(0,s.jsx)(r,{...o,ref:e,className:c()(n,i&&"was-validated")})}));BV.displayName="Form",BV.propTypes=FV;const UV=Object.assign(BV,{Group:wV,Control:_V,Floating:vV,Check:gV,Switch:NV,Label:CV,Text:LV,Range:PV,Select:MV,FloatingLabel:DV}),zV=()=>{const[t,n]=(0,e.useState)("/panola1"),[i,r]=(0,e.useState)(null),o=[{plantName:"panola1",displayName:"Panola I",databaseName:"/panola1",capacity:4.75,location:"Mississippi"},{plantName:"panola2",displayName:"Panola II",databaseName:"/panola2",capacity:4.75,location:"Mississippi"},{plantName:"panola3",displayName:"Panola III",databaseName:"/panola3",capacity:3.5,location:"Mississippi"}];(0,e.useEffect)((()=>{const e=o.find((e=>e.databaseName===t));r(e)}),[t]);return(0,s.jsxs)(_,{fluid:!0,children:[(0,s.jsx)("div",{className:"dropdown-container",children:(0,s.jsxs)(UV.Group,{controlId:"plantSelect",children:[(0,s.jsx)(UV.Label,{style:{color:"black"},children:"Select Project"}),(0,s.jsx)(UV.Control,{as:"select",value:t,onChange:t=>{n(t.target.value)},children:o.map((t=>(0,s.jsx)("option",{value:t.databaseName,children:t.displayName},t.plantName)))})]})}),(0,s.jsx)("div",{className:"map-section-container",children:i&&(0,s.jsx)(tV,{database:i.databaseName,displayName:i.displayName,location:i.location,capacity:i.capacity},i.databaseName)})]})},jV=()=>{const[t,n]=(0,e.useState)("/panola1"),[i,r]=(0,e.useState)(null),o=[{plantName:"panola1",displayName:"Panola I",databaseName:"/panola1",capacity:4.75,location:"Mississippi"},{plantName:"panola2",displayName:"Panola II",databaseName:"/panola2",capacity:4.75,location:"Mississippi"},{plantName:"panola3",displayName:"Panola III",databaseName:"/panola3",capacity:3.5,location:"Mississippi"}];(0,e.useEffect)((()=>{const e=o.find((e=>e.databaseName===t));r(e)}),[t]);return(0,s.jsx)("div",{className:"non-scrollable-container",children:(0,s.jsxs)(_,{fluid:!0,children:[(0,s.jsx)("div",{className:"dropdown-container",children:(0,s.jsxs)(UV.Group,{controlId:"plantSelect",children:[(0,s.jsx)(UV.Label,{style:{color:"black"},children:"Select Project"}),(0,s.jsx)(UV.Control,{as:"select",value:t,onChange:t=>{n(t.target.value)},children:o.map((t=>(0,s.jsx)("option",{value:t.databaseName,children:t.displayName},t.plantName)))})]})}),(0,s.jsx)("div",{className:"big-dial-container",children:i&&(0,s.jsx)(Ey,{database:i.databaseName,displayName:i.displayName,location:i.location,capacity:i.capacity,plant:i.plantName},i.databaseName)})]})})},VV=()=>{const[t,n]=(0,e.useState)("/panola1"),[i,r]=(0,e.useState)(null),o=[{plantName:"panola1",displayName:"Panola I",databaseName:"/panola1",capacity:4.75,location:"Mississippi"},{plantName:"panola2",displayName:"Panola II",databaseName:"/panola2",capacity:4.75,location:"Mississippi"},{plantName:"panola3",displayName:"Panola III",databaseName:"/panola3",capacity:4.75,location:"Mississippi"}];(0,e.useEffect)((()=>{const e=o.find((e=>e.databaseName===t));r(e)}),[t]);return(0,s.jsxs)(_,{fluid:!0,children:[(0,s.jsx)("div",{className:"dropdown-container-monthly",children:(0,s.jsxs)(UV.Group,{controlId:"plantSelect",className:"form-inline",children:[(0,s.jsx)(UV.Label,{className:"dropdown-label",children:"Select Project: "}),(0,s.jsx)(UV.Control,{as:"select",className:"dropdown-select",value:t,onChange:t=>{n(t.target.value)},children:o.map((t=>(0,s.jsx)("option",{value:t.databaseName,children:t.displayName},t.plantName)))})]})}),(0,s.jsx)("div",{className:"monthly-output-container",children:i&&(0,s.jsx)(Cy,{database:i.databaseName,displayName:i.displayName,location:i.location,capacity:i.capacity},i.databaseName)})]})},WV=t=>{var e;let{currentEmissionOffset:n,MAX_CO2:i,alterEmissionOffset:r,alter:o=!1}=t;
2const a=180*(o?r/i:n/i),l=[100,100],c=[50+50*Math.cos((180+a)*Math.PI/180),50+50*Math.sin((180+a)*Math.PI/180)],u=[50+50*Math.cos(a*Math.PI/180),50+50*Math.sin(a*Math.PI/180)];return(0,s.jsxs)("svg",{viewBox:`0 0 ${l[0]} ${l[1]}`,xmlns:"http://www.w3.org/2000/svg",id:"carbon-svg",children:[(0,s.jsx)("text",{x:"13",y:"56",fontSize:"3",fill:"#100B32",children:"0"})," ",(0,s.jsxs)("text",{x:"82",y:"56",fontSize:"3",fill:"#100B32",children:[i,"+"]}),(0,s.jsxs)("g",{"transform-origin":"50 50",transform:"translate(0,2.5) scale(1.15)",children:[(0,s.jsx)("image",{href:y,width:"100",height:"100"}),(0,s.jsxs)("mask",{id:"dark-mask",children:[(0,s.jsx)("path",{d:`\n M ${l[0]/2} ${l[1]/2} \n L ${c[0]} ${c[1]} \n L ${l[0]/2} 0\n L 0 0\n L 0 ${l[1]/2}\n Z`,fill:"white",style:{transition:"d 1s"}}),(0,s.jsx)("path",{d:`\n M ${l[0]/2} ${l[1]/2} \n L ${u[0]} ${u[1]} \n L ${l[0]/2} ${l[1]} \n L ${l[0]} ${l[1]} \n L ${l[0]} ${l[1]/2} \n Z`,fill:"white",style:{transition:"d 1s"}})]}),(0,s.jsx)("image",{href:w,width:"100",height:"100",mask:"url(#dark-mask)"}),(0,s.jsx)("image",{href:T,width:"100",height:"100"}),(0,s.jsxs)("g",{x:"50",y:"50",width:"100",height:"100",transform:`\n rotate(${null!==a&&void 0!==a?a:0})\n translate(-30,${a<90?"-9":"9"})\n rotate(${null!==(e=-1*a)&&void 0!==e?e:0})\n `,style:{transition:"transform 1s"},children:[(0,s.jsx)("image",{href:A,width:"100",height:"100"}),(0,s.jsx)("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"2",className:"call-out-text",children:o?Math.floor(r):Math.floor(n)})]}),(0,s.jsx)("image",{href:x,id:"needle",className:"globe-element",style:{transform:"rotate("+a+"deg)",transition:"transform 1s"},alt:"needle pointing at values"})]})]})},$V=t=>{var e,n;let{alterEmissionOffset:i,MAX_CO2:r}=t;let o=180*(i/r);o>180&&(o=180);const a=[100,100],l=[50+50*Math.cos((180+o)*Math.PI/180),50+50*Math.sin((180+o)*Math.PI/180)],c=[50+
250*Math.cos(o*Math.PI/180),50+50*Math.sin(o*Math.PI/180)];return(0,s.jsxs)("svg",{viewBox:`0 0 ${a[0]} ${a[1]}`,xmlns:"http://www.w3.org/2000/svg",id:"alt-svg",children:[(0,s.jsx)("text",{x:"13",y:"56",fontSize:"3",fill:"#100B32",children:"0"})," ",(0,s.jsxs)("text",{x:"82",y:"56",fontSize:"3",fill:"#100B32",children:[r,"+"]}),(0,s.jsxs)("g",{"transform-origin":"50 50",transform:"translate(0,2.5) scale(1.15)",children:[(0,s.jsx)("image",{href:y,width:"100",height:"100"}),(0,s.jsxs)("mask",{id:"alt-mask",children:[(0,s.jsx)("path",{d:`\n M ${a[0]/2} ${a[1]/2} \n L ${l[0]} ${l[1]} \n L ${a[0]/2} 0\n L 0 0\n L 0 ${a[1]/2}\n Z`,fill:"white",style:{transition:"d 1s"}}),(0,s.jsx)("path",{d:`\n M ${a[0]/2} ${a[1]/2} \n L ${c[0]} ${c[1]} \n L ${a[0]/2} ${a[1]} \n L ${a[0]} ${a[1]} \n L ${a[0]} ${a[1]/2} \n Z`,fill:"white",style:{transition:"d 1s"}})]}),(0,s.jsx)("image",{href:w,width:"100",height:"100",mask:"url(#alt-mask)"}),(0,s.jsx)("image",{href:T,width:"100",height:"100"}),(0,s.jsxs)("g",{x:"50",y:"50",width:"100",height:"100",transform:`\n rotate(${null!==(e=o)&&void 0!==e?e:0})\n translate(-30,${o<90?"-9":"9"})\n rotate(${null!==(n=-1*o)&&void 0!==n?n:0})\n `,style:{transition:"transform 1s"},children:[(0,s.jsx)("image",{href:A,width:"100",height:"100"}),(0,s.jsx)("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"2",className:"call-out-text",children:Math.floor(i)})]}),(0,s.jsx)("image",{href:x,id:"needle",className:"globe-element",style:{transform:"rotate("+o+"deg)",transition:"transform 1s"},alt:"needle pointing at values"})]})]})};Qm(_y(Qf),"[email protected]","ClearloopData123!").then((t=>{Uf(Kf(Qf),"/realtime/")})).catch((t=>{console.error("Auth failed:",t)}));const GV=Kf(Qf),HV=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];const qV=function(t){const[n,i]=(0,e.useState)(0),[r,o]=(0,e.useState)("0"),[a,l]=(0,e.useState)(["Loading data...",""]),[c,u]=(0,e.useState)(!0),[h,d]=(0,e.useState)(0),[p,f]=(0,e.useState)(""),[g,m]=(0,e.useState)(""),y=(0,e.useMemo)((()=>1175*t.capacity),[t.capacity]);return(0,e.useEffect)((()=>{const t=()=>u(window.innerWidth>768);return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)}),[]),(0,e.useEffect)((()=>{if(t.hoveredState&&t.hoveredState.region){$f(Uf(GV,`realtime/lastHour${t.database}/alter/${t.hoveredState.region}`),(e=>{const n=e.val();d((null===n||void 0===n?void 0:n.co2)||0),f(t.hoveredState.city),m(t.hoveredState.state)}))}else d(0),f(""),m("")}),[t.hoveredState,t.database]),(0,e.useEffect)((()=>{$f(Uf(GV,`realtime/lastHour${t.database}`),(t=>{const e=t.val();if(e){const t=new Date,n=`${HV[t.getMonth()]} ${t.getDate()}, ${t.getFullYear()}`,r=t.getHours()>12?t.getHours()%12:t.getHours(),s=t.getHours()>=12?"PM":"AM",a=t.getMinutes().toString().padStart(2,"0");l([n,`${r}:${a} ${s}`]),o(e.mwh.toFixed(2)),i(e.co2)}}))}),[t.database]),(0,s.jsx)("div",{className:"carbon-dial-in-tooltip",children:c?(0,s.jsx)(_,{children:(0,s.jsxs)("div",{id:"carbon-canvas-container",className:"flex-row justify-between align-center",children:[(0,s.jsxs)("div",{id:"localization-text",children:[(0,s.jsx)("p",{className:"time-text",children:"Realtime Carbon"}),(0,s.jsx)("div",{className:"vert-div"}),(0,s.jsx)("p",{className:"time-text",children:a[0]}),(0,s.jsx)("div",{className:"circle-div"}),(0,s.jsx)("p",{className:"time-text",children:a[1]})]}),(0,s.jsxs)("div",{className:"flex-row text-container",children:[(0,s.jsx)("h1",{id:"map-city-name",children:`${t.displayName||"Jackson"}, ${t.location||"Tennessee"}`}),p&&g&&(0,s.jsx)("h1",{id:"map-city-name",children:`${p}, ${g}`})]}),(0,s.jsxs)("div",{className:"flex-row carbon-dial-container",children:[(0,s.jsx)(WV,{currentEmissionOffset:n,MAX_CO2:y}),(0,s.jsx)($V,{alterEmissionOffset:h,MAX_CO2:y})]})]})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"mobile-view-alt",children:(0,s.jsx)($V,{alterEmissionOffset:h,MAX_CO2:y})})})})},ZV=n.p+"static/media/clearloop-logo-plant.945c9e5fab9f6175fe6c.png";const XV=t=>{let{data:e,minValue:n,maxValue:i,onHover:r}=t;const s=oa().domain([0,.5]).range([[234,234,239,200],[44,49,74,200]]),o=fa((t=>s(t))).domain([n,i]);return new VD({id:"global-carbon-polygon-layer",data:e,lineWidthMinPixels:.5,pickable:!0,getPolygon:t=>t.polygon,getElevation:()=>0,getFillColor:t=>{let e=t.properties.value;return e>i&&(e=i),o(e)},getLineColor:[255,255,255],onHover:r})},KV={longitude:-98.5795,latitude:37.8283,zoom:3.7,pitch:0,bearing:0};const YV=function(t){const[n,i]=(0,e.useState)([]),[r,o]=(0,e.useState)([]),[a,l]=(0,e.useState)(null),[c,u]=(0,e.useState)(null),[h,d]=(0,e.useState)(KV);(0,e.useEffect)((()=>{fetch("/fixed_global_region_static.json").then((t=>t.json())).then((t=>i(t))).catch((t=>console.error("Error loading converted_global_region_moer.json:",t)))}),[]),(0,e.useEffect)((()=>{t.searchLocation&&d({...h,longitude:t.searchLocation.longitude,latitude:t.searchLocation.latitude,zoom:6,transitionDuration:1e3})}),[t.searchLocation]),(0,e.useEffect)((()=>{fetch("/full_city_region_polygon.json").then((t=>t.json())).then((t=>{const e=Object.entries(t).map((t=>{let[e,n]=t;return{city:e,...n}}));o(e)})).catch((t=>console.error("Error loading city data:",t)))}),[]),(0,e.useEffect)((()=>{fetch("/location.json").then((t=>t.json())).then((e=>{const n=t.database.startsWith("/")?t.database.slice(1):t.database;e[n]&&u({name:t.displayName,coords:e[n]})})).catch((t=>console.error("Error loading plant location:",t)))}),[t.database,t.displayName]);const p=U(n,(t=>t.properties.value));B(n,(t=>t.properties.value)),console.log("Check Plant Location: ",c);const f=new gF({id:"plant-background-layer",data:[c],getPosition:t=>[t.coords[1],t.coords[0]],getRadius:12e4,getFillColor:[255,255,255,255],stroked:!1,filled:!0,opacity:1}),g=new dF({id:"city-icon-layer",data:r,pickable:!0,iconAtlas:Yf,iconMapping:{default:{x:0,y:0,width:800,height:800,anchorY:800},selected:{x:0,y:0,width:800,height:800,anchorY:800}},sizeScale:8,getPosition:t=>[t.lng,t.lat],getIcon:t=>a===t.city?null:"default",getSize:3.5,getColor:[255,255,255],onHover:e=>{let{object:n,x:i,y:r}=e;const o=document.getElementById("pin-overlay"),a=document.getElementById("pin-tooltip");if(o&&a)if(n){l(n.city),o.style.display="block",o.style.left=i-15+"px",o.style.top=r-20+"px",o.src=Jf;let e=i+10,c=r-10;i>.5*window.innerWidth&&(e=i-510),r>.5*window.innerHeight&&(c=r-360),a.style.display="block",a.style.left=`${e}px`,a.style.top=`${c}px`,a.style.borderRadius="5px";Py.createRoot(a).render((0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{className:"pin-tooltip-text",children:[n.city,", ",n.state," ",(0,s.jsx)("br",{})," Balance Authority: ",n.region_full_name]}),(0,s.jsx)(qV,{hoveredState:{city:n.city,region:n.region,state:n.state},database:t.database,displayName:t.displayName,location:t.location,capacity:t.capacity})]}))}else l(null),o.style.display="none",a.style.display="none"},onClick:t=>{let{object:e}=t;e&&l(e.city)}}),m=c?new dF({id:"plant-location-layer",data:[c],pickable:!0,iconAtlas:ZV,iconMapping:{plant:{x:0,y:0,width:550,height:550,anchorY:270}},sizeScale:10,getPosition:t=>[t.coords[1],t.coords[0]],getIcon:t=>"plant",getSize:5,onHover:t=>{let{object:e,x:n,y:i}=t;const r=document.getElementById("plant-tooltip");r&&(e?(r.style.display="block",r.style.left=`${n}px`,r.style.top=i-50+"px",r.innerHTML=`\n <div><strong>Plant:</strong> ${e.name}</div>\n <div><strong>Latitude:</strong> ${e.coords[0]}</div>\n <div><strong>Longitude:</strong> ${e.coords[1]}</div>\n `):r.style.display="none")},onClick:t=>{let{object:e}=t;e&&alert(`Plant: ${e.name}`)}}):null,_=t.searchLocation?new dF({id:"search-pin-layer",data:[t.searchLocation],pickable:!0,iconAtlas:Jf,iconMapping:{pin:{x:0,y:0,width:800,height:800,anchorY:800}},sizeScale:8,getPosition:t=>[t.longitude,t.latitude],getIcon:()=>"pin",getSize:3.5,onHover:e=>{let{object:n,x:i,y:r}=e;const o=document.getElementById("pin-overlay"),a=document.getElementById("pin-tooltip");if(o&&a)if(n){l(n.city),o.style.display="block",o.style.left=i-15+"px",o.style.top=r-20+"px",o.src=Jf;let e=i+10,c=r-10;i>.5*window.innerWidth&&(e=i-510),r>.5*window.innerHeight&&(c=r-360),a.style.display="block",a.style.left=`${e}px`,a.style.top=`${c}px`,a.style.borderRadius="5px";Py.createRoot(a).render((0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{className:"pin-tooltip-text",children:[n.city,", ",n.state," ",(0,s.jsx)("br",{})," Balance Authority: ",n.region_full_name]}),(0,s.jsx)(qV,{hoveredState:{city:n.city,region:n.region,state:n.state},database:t.database,displayName:t.displayName,location:t.location,capacity:t.capacity})]}))}else l(null),o.style.display="none",a.style.display="none"},onClick:t=>{let{object:e}=t;e&&alert(`Searched City: ${e.city}, ${e.state}`)}}):null,y=[XV({data:n,minValue:p,maxValue:2100,range:[[255,255,255],[16,11,50]],pol
2ygonBaseHeight:0,polygonScaleFactor:100,onHover:t=>{let{object:e,x:n,y:i,coordinate:r}=t;const s=document.getElementById("region-tooltip");if(s)if(e){const[t,o]=r;s.style.top=`${i}px`,s.style.left=`${n}px`,s.innerHTML=`\n <div><strong>Region:</strong> ${e.properties.region_full_name}</div>\n <div><strong>Value:</strong> ${e.properties.value}</div>\n <div><strong>Longitude:</strong> ${t.toFixed(5)}</div>\n <div><strong>Latitude:</strong> ${o.toFixed(5)}</div>\n `,s.style.display="block"}else s.style.display="none"}}),f,m,g,_],v=window.innerWidth<768;return(0,s.jsxs)("div",{children:[(0,s.jsx)(QN,{initialViewState:h,controller:!0,layers:y,style:{width:"100%",height:"100%"},children:(0,s.jsx)(CO,{mapStyle:"mapbox://styles/mapbox/light-v10",mapboxAccessToken:"pk.eyJ1IjoibWFuZGFsaSIsImEiOiJjbHh0Z2I4YW0wNGtvMmlvYzZhM28wMTV2In0.maKcZ_aBF3G64JMJM2W1EQ",style:{width:"100%",height:"100%"}})}),(0,s.jsxs)("div",{style:{position:"absolute",top:"80px",right:"10px",background:"white",borderRadius:"10px",padding:"10px",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.2)",zIndex:1e3,width:"200px"},children:[(0,s.jsx)("h3",{style:{margin:0,fontSize:"14px",fontWeight:"bold",textAlign:"center"},children:(0,s.jsx)("a",{href:"https://watttime.org/data-science/data-signals/marginal-co2/",target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",color:"black",fontWeight:"bold"},children:"CO2 MOER Annual Average (lbs/MWh)"})}),(0,s.jsx)("p",{style:{fontSize:"13px"},children:"CO2 MOER (Marginal Operating Emissions Rate) represents the emissions rate of electricity generators responding to real-time changes in grid demand, measured in lbs/MWh, and helps optimize energy usage to reduce carbon emissions."}),(0,s.jsxs)("div",{style:{marginTop:"10px",display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,s.jsx)("div",{style:{width:"200px",height:"20px",background:"linear-gradient(to right, rgba(234, 234, 239, 255), rgba(44, 49, 74, 255))",borderRadius:"5px"}}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",width:"200px",marginTop:"5px"},children:[(0,s.jsx)("span",{style:{fontSize:"12px",color:"black"},children:"Low"}),(0,s.jsx)("span",{style:{fontSize:"12px",color:"black"},children:"High"})]})]})]}),(0,s.jsx)("img",{id:"pin-overlay",style:{display:"none",position:"absolute",width:"30px",height:"40px",zIndex:1e3},alt:"Selected City Pin"}),(0,s.jsx)("div",{id:"region-tooltip",style:{position:"absolute",display:"none",pointerEvents:"none",background:"rgba(255, 255, 255, 0.9)",color:"black",padding:"5px",borderRadius:"3px",boxShadow:"0 2px 6px rgba(0,0,0,0.15)",zIndex:999}}),(0,s.jsx)("div",{id:"pin-tooltip",style:{position:"absolute",display:"none",pointerEvents:"none",background:"rgba(255, 255, 255, 0.95)",color:"black",width:v?"70vw":"500px",height:v?"auto":"350px",borderRadius:"10px",zIndex:1e3}}),(0,s.jsx)("div",{id:"plant-tooltip",style:{position:"absolute",display:"none",pointerEvents:"none",background:"rgba(255, 255, 255, 0.9)",color:"black",padding:"5px",borderRadius:"3px",boxShadow:"0 2px 6px rgba(0,0,0,0.15)",zIndex:2e3}})]})};function JV(t,e){return function(){return t.apply(e,arguments)}}const{toString:QV}=Object.prototype,{getPrototypeOf:tW}=Object,eW=(t=>e=>{const n=QV.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),nW=t=>(t=t.toLowerCase(),e=>eW(e)===t),iW=t=>e=>typeof e===t,{isArray:rW}=Array,sW=iW("undefined");const oW=nW("ArrayBuffer");const aW=iW("string"),lW=iW("function"),cW=iW("number"),uW=t=>null!==t&&"object"===typeof t,hW=t=>{if("object"!==eW(t))return!1;const e=tW(t);return(null===e||e===Object.prototype||null===Object.getPrototypeOf(e))&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},dW=nW("Date"),pW=nW("File"),fW=nW("Blob"),gW=nW("FileList"),mW=nW("URLSearchParams"),[_W,yW,vW,bW]=["ReadableStream","Request","Response","Headers"].map(nW);function wW(t,e){let n,i,{allOwnKeys:r=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null!==t&&"undefined"!==typeof t)if("object"!==typeof t&&(t=[t]),rW(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{const i=r?Object.getOwnPropertyNames(t):Object.keys(t),s=i.length;let o;for(n=0;n<s;n++)o=i[n],e.call(null,t[o],o,t)}}function EW(t,e){e=e.toLowerCase();const n=Object.keys(t);let i,r=n.length;for(;r-- >0;)if(i=n[r],e===i.toLowerCase())return i;return null}const xW="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof self?self:"undefined"!==typeof window?window:global,SW=t=>!sW(t)&&t!==xW;const TW=(CW="undefined"!==typeof Uint8Array&&tW(Uint8Array),t=>CW&&t instanceof CW);var CW;const AW=nW("HTMLFormElement"),PW=(t=>{let{hasOwnProperty:e}=t;return(t,n)=>e.call(t,n)})(Object.prototype),RW=nW("RegExp"),MW=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),i={};wW(n,((n,r)=>{let s;!1!==(s=e(n,r,t))&&(i[r]=s||n)})),Object.defineProperties(t,i)};const IW=nW("AsyncFunction"),LW=((t,e)=>{return t?setImmediate:e?(n=`axios@${Math.random()}`,i=[],xW.addEventListener("message",(t=>{let{source:e,data:r}=t;e===xW&&r===n&&i.length&&i.shift()()}),!1),t=>{i.push(t),xW.postMessage(n,"*")}):t=>setTimeout(t);var n,i})("function"===typeof setImmediate,lW(xW.postMessage)),kW="undefined"!==typeof queueMicrotask?queueMicrotask.bind(xW):"undefined"!==typeof process&&process.nextTick||LW,NW={isArray:rW,isArrayBuffer:oW,isBuffer:function(t){return null!==t&&!sW(t)&&null!==t.constructor&&!sW(t.constructor)&&lW(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"===typeof FormData&&t instanceof FormData||lW(t.append)&&("formdata"===(e=eW(t))||"object"===e&&lW(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!==typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&oW(t.buffer),e},isString:aW,isNumber:cW,isBoolean:t=>!0===t||!1===t,isObject:uW,isPlainObject:hW,isReadableStream:_W,isRequest:yW,isResponse:vW,isHeaders:bW,isUndefined:sW,isDate:dW,isFile:pW,isBlob:fW,isRegExp:RW,isFunction:lW,isStream:t=>uW(t)&&lW(t.pipe),isURLSearchParams:mW,isTypedArray:TW,isFileList:gW,forEach:wW,merge:function t(){const{caseless:e}=SW(this)&&this||{},n={},i=(i,r)=>{const s=e&&EW(n,r)||r;hW(n[s])&&hW(i)?n[s]=t(n[s],i):hW(i)?n[s]=t({},i):rW(i)?n[s]=i.slice():n[s]=i};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&wW(arguments[r],i);return n},extend:function(t,e,n){let{allOwnKeys:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return wW(e,((e,i)=>{n&&lW(e)?t[i]=JV(e,n):t[i]=e}),{allOwnKeys:i}),t},trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,i)=>
vendor: 5,009 bytes, line 2
2{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,i)=>{let r,s,o;const a={};if(e=e||{},null==t)return e;do{for(r=Object.getOwnPropertyNames(t),s=r.length;s-- >0;)o=r[s],i&&!i(o,t,e)||a[o]||(e[o]=t[o],a[o]=!0);t=!1!==n&&tW(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:eW,kindOfTest:nW,endsWith:(t,e,n)=>{t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const i=t.indexOf(e,n);return-1!==i&&i===n},toArray:t=>{if(!t)return null;if(rW(t))return t;let e=t.length;if(!cW(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=n.next())&&!i.done;){const n=i.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const i=[];for(;null!==(n=t.exec(e));)i.push(n);return i},isHTMLForm:AW,hasOwnProperty:PW,hasOwnProp:PW,reduceDescriptors:MW,freezeMethods:t=>{MW(t,((e,n)=>{if(lW(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const i=t[n];lW(i)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(t,e)=>{const n={},i=t=>{t.forEach((t=>{n[t]=!0}))};return rW(t)?i(t):i(String(t).split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,n){return e.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:EW,global:xW,isContextDefined:SW,isSpecCompliantForm:function(t){return!!(t&&lW(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),n=(t,i)=>{if(uW(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[i]=t;const r=rW(t)?[]:{};return wW(t,((t,e)=>{const s=n(t,i+1);!sW(s)&&(r[e]=s)})),e[i]=void 0,r}}return t};return n(t,0)},isAsyncFn:IW,isThenable:t=>t&&(uW(t)||lW(t))&&lW(t.then)&&lW(t.catch),setImmediate:LW,asap:kW};function OW(t,e,n,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r,this.status=r.status?r.status:null)}NW.inherits(OW,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:NW.toJSONObject(this.config),code:this.code,status:this.status}}});const DW=OW.prototype,FW={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{FW[t]={value:t}})),Object.defineProperties(OW,FW),Object.defineProperty(DW,"isAxiosError",{value:!0}),OW.from=(t,e,n,i,r,s)=>{const o=Object.create(DW);return NW.toFlatObject(t,o,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),OW.call(o,t.message,e,n,i,r),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const BW=OW;function UW(t){return NW.isPlainObject(t)||NW.isArray(t)}function zW(t){return NW.endsWith(t,"[]")?t.slice(0,-2):t}function jW(t,e,n){return t?t.concat(e).map((function(t,e){return t=zW(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}const VW=NW.toFlatObject(NW,{},null,(function(t){return/^is[A-Z]/.test(t)}));const WW=function(t,e,n){if(!NW.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=NW.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!NW.isUndefined(e[t])}));const i=n.metaTokens,r=n.visitor||c,s=n.dots,o=n.indexes,a=(n.Blob||"undefined"!==typeof Blob&&Blob)&&NW.isSpecCompliantForm(e);if(!NW.isFunction(r))throw new TypeError("visitor must be a function");function l(t){if(null===t)return"";if(NW.isDate(t))return t.toISOString();if(!a&&NW.isBlob(t))throw new BW("Blob is not supported. Use a Buffer instead.");return NW.isArrayBuffer(t)||NW.isTypedArray(t)?a&&"function"===typeof Blob?new Blob([t]):Buffer.from(t):t}function c(t,n,r){let a=t;if(t&&!r&&"object"===typeof t)if(NW.endsWith(n,"{}"))n=i?n:n.slice(0,-2),t=JSON.stringify(t);else if(NW.isArray(t)&&function(t){return NW.isArray(t)&&!t.some(UW)}(t)||(NW.isFileList(t)||NW.endsWith(n,"[]"))&&(a=NW.toArray(t)))return n=zW(n),a.forEach((function(t,i){!NW.isUndefined(t)&&null!==t&&e.append(!0===o?jW([n],i,s):null===o?n:n+"[]",l(t))})),!1;return!!UW(t)||(e.append(jW(r,n,s),l(t)),!1)}const u=[],h=Object.assign(VW,{defaultVisitor:c,convertValue:l,isVisitable:UW});if(!NW.isObject(t))throw new TypeError("data must be an object");return function t(n,i){if(!NW.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+i.join("."));u.push(n),NW.forEach(n,(function(n,s){!0===(!(NW.isUndefined(n)||null===n)&&r.call(e,n,NW.isString(s)?s.trim():s,i,h))&&t(n,i?i.concat(s):[s])})),u.pop()}}(t),e};
vendor: 6,147 bytes, line 2
2function $W(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function GW(t,e){this._pairs=[],t&&WW(t,this,e)}const HW=GW.prototype;HW.append=function(t,e){this._pairs.push([t,e])},HW.toString=function(t){const e=t?function(e){return t.call(this,e,$W)}:$W;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const qW=GW;function ZW(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function XW(t,e,n){if(!e)return t;const i=n&&n.encode||ZW;NW.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let s;if(s=r?r(e,n):NW.isURLSearchParams(e)?e.toString():new qW(e,n).toString(i),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}const KW=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){NW.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},YW={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},JW={isBrowser:!0,classes:{URLSearchParams:"undefined"!==typeof URLSearchParams?URLSearchParams:qW,FormData:"undefined"!==typeof FormData?FormData:null,Blob:"undefined"!==typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},QW="undefined"!==typeof window&&"undefined"!==typeof document,t$="object"===typeof navigator&&navigator||void 0,e$=QW&&(!t$||["ReactNative","NativeScript","NS"].indexOf(t$.product)<0),n$="undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"===typeof self.importScripts,i$=QW&&window.location.href||"http://localhost",r$={...t,...JW};const s$=function(t){function e(t,n,i,r){let s=t[r++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),a=r>=t.length;if(s=!s&&NW.isArray(i)?i.length:s,a)return NW.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!o;i[s]&&NW.isObject(i[s])||(i[s]=[]);return e(t,n,i[s],r)&&NW.isArray(i[s])&&(i[s]=function(t){const e={},n=Object.keys(t);let i;const r=n.length;let s;for(i=0;i<r;i++)s=n[i],e[s]=t[s];return e}(i[s])),!o}if(NW.isFormData(t)&&NW.isFunction(t.entries)){const n={};return NW.forEachEntry(t,((t,i)=>{e(function(t){return NW.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),i,n,0)})),n}return null};const o$={transitional:YW,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",i=n.indexOf("application/json")>-1,r=NW.isObject(t);r&&NW.isHTMLForm(t)&&(t=new FormData(t));if(NW.isFormData(t))return i?JSON.stringify(s$(t)):t;if(NW.isArrayBuffer(t)||NW.isBuffer(t)||NW.isStream(t)||NW.isFile(t)||NW.isBlob(t)||NW.isReadableStream(t))return t;if(NW.isArrayBufferView(t))return t.buffer;if(NW.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(r){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return WW(t,new r$.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,i){return r$.isNode&&NW.isBuffer(t)?(this.append(e,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((s=NW.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return WW(s?{"files[]":t}:t,e&&new e,this.formSerializer)}}return r||i?(e.setContentType("application/json",!1),function(t,e,n){if(NW.isString(t))try{return(e||JSON.parse)(t),NW.trim(t)}catch(_G){if("SyntaxError"!==_G.name)throw _G}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||o$.transitional,n=e&&e.forcedJSONParsing,i="json"===this.responseType;if(NW.isResponse(t)||NW.isReadableStream(t))return t;if(t&&NW.isString(t)&&(n&&!this.responseType||i)){const n=!(e&&e.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(_G){if(n){if("SyntaxError"===_G.name)throw BW.from(_G,BW.ERR_BAD_RESPONSE,this,null,this.response);throw _G}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:r$.classes.FormData,Blob:r$.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};NW.forEach(["delete","get","head","post","put","patch"],(t=>{o$.headers[t]={}}));const a$=o$,l$=NW.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),c$=Symbol("internals");function u$(t){return t&&String(t).trim().toLowerCase()}function h$(t){return!1===t||null==t?t:NW.isArray(t)?t.map(h$):String(t)}function d$(t,e,n,i,r){return NW.isFunction(i)?i.call(this,e,n):(r&&(e=n),NW.isString(e)?NW.isString(i)?-1!==e.indexOf(i):NW.isRegExp(i)?i.test(e):void 0:void 0)}class p${constructor(t){t&&this.set(t)}set(t,e,n){const i=this;function r(t,e,n){const r=u$(e);if(!r)throw new Error("header name must be a non-empty string");const s=NW.findKey(i,r);(!s||void 0===i[s]||!0===n||void 0===n&&!1!==i[s])&&(i[s||e]=h$(t))}const s=(t,e)=>NW.forEach(t,((t,n)=>r(t,n,e)));if(NW.isPlainObject(t)||t instanceof this.constructor)s(t,e);else if(NW.isString(t)&&(t=t.trim())&&!(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))(t))s((t=>{const e={};let n,i,r;return t&&t.split("\n").forEach((function(t){r=t.indexOf(":"),n=t.substring(0,r).trim().toLowerCase(),i=t.substring(r+1).trim(),!n||e[n]&&l$[n]||("set-cookie"===n?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i)})),e})(t),e);else if(NW.isHeaders(t))for(const[o,a]of t.entries())r(a,o,n);else null!=t&&r(e,t,n);return this}get(t,e){if(t=u$(t)){const n=NW.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;
2=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}(t);if(NW.isFunction(e))return e.call(this,t,n);if(NW.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=u$(t)){const n=NW.findKey(this,t);return!(!n||void 0===this[n]||e&&!d$(0,this[n],n,e))}return!1}delete(t,e){const n=this;let i=!1;function r(t){if(t=u$(t)){const r=NW.findKey(n,t);!r||e&&!d$(0,n[r],r,e)||(delete n[r],i=!0)}}return NW.isArray(t)?t.forEach(r):r(t),i}clear(t){const e=Object.keys(this);let n=e.length,i=!1;for(;n--;){const r=e[n];t&&!d$(0,this[r],r,t,!0)||(delete this[r],i=!0)}return i}normalize(t){const e=this,n={};return NW.forEach(this,((i,r)=>{const s=NW.findKey(n,r);if(s)return e[s]=h$(i),void delete e[r];const o=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}(r):String(r).trim();o!==r&&delete e[r],e[o]=h$(i),n[o]=!0})),this}concat(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.constructor.concat(this,...e)}toJSON(t){const e=Object.create(null);return NW.forEach(this,((n,i)=>{null!=n&&!1!==n&&(e[i]=t&&NW.isArray(n)?n.join(", "):n)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((t=>{let[e,n]=t;return e+": "+n})).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t){const e=new this(t);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return i.forEach((t=>e.set(t))),e}static accessor(t){const e=(this[c$]=this[c$]={accessors:{}}).accessors,n=this.prototype;function i(t){const i=u$(t);e[i]||(!function(t,e){const n=NW.toCamelCase(" "+e);["get","set","has"].forEach((i=>{Object.defineProperty(t,i+n,{value:function(t,n,r){return this[i].call(this,e,t,n,r)},configurable:!0})}))}(n,t),e[i]=!0)}return NW.isArray(t)?t.forEach(i):i(t),this}}p$.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),NW.reduceDescriptors(p$.prototype,((t,e)=>{let{value:n}=t,i=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(t){this[i]=t}}})),NW.freezeMethods(p$);const f$=p$;function g$(t,e){const n=this||a$,i=e||n,r=f$.from(i.headers);let s=i.data;return NW.forEach(t,(function(t){s=t.call(n,s,r.normalize(),e?e.status:void 0)})),r.normalize(),s}function m$(t){return!(!t||!t.__CANCEL__)}function _$(t,e,n){BW.call(this,null==t?"canceled":t,BW.ERR_CANCELED,e,n),this.name="CanceledError"}NW.inherits(_$,BW,{__CANCEL__:!0});const y$=_$;function v$(t,e,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(new BW("Request failed with status code "+n.status,[BW.ERR_BAD_REQUEST,BW.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}const b$=function(t,e){t=t||10;const n=new Array(t),i=new Array(t);let r,s=0,o=0;return e=void 0!==e?e:1e3,function(a){const l=Date.now(),c=i[o];r||(r=l),n[s]=a,i[s]=l;let u=o,h=0;for(;u!==s;)h+=n[u++],u%=t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),l-r<e)return;const d=c&&l-c;return d?Math.round(1e3*h/d):void 0}};const w$=function(t,e){let n,i,r=0,s=1e3/e;const o=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();r=s,n=null,i&&(clearTimeout(i),i=null),t.apply(null,e)};return[function(){const t=Date.now(),e=t-r;for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];e>=s?o(l,t):(n=l,i||(i=setTimeout((()=>{i=null,o(n)}),s-e)))},()=>n&&o(n)]},E$=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,i=0;const r=b$(50,250);return w$((n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,a=s-i,l=r(a);i=s;t({loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&s<=o?(o-s)/l:void 0,event:n,lengthComputable:null!=o,[e?"download":"upload"]:!0})}),n)},x$=(t,e)=>{const n=null!=t;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},S$=t=>function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return NW.asap((()=>t(...n)))},T$=r$.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,r$.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(r$.origin),r$.navigator&&/(msie|trident)/i.test(r$.navigator.userAgent)):()=>!0,C$=r$.hasStandardBrowserEnv?{write(t,e,n,i,r,s){const o=[t+"="+encodeURIComponent(e)];NW.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),NW.isString(i)&&o.push("path="+i),NW.isString(r)&&o.push("domain="+r),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function A$(t,e,n){let i=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(i||0==n)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const P$=t=>t instanceof f$?{...t}:t;function R$(t,e){e=e||{};const n={};function i(t,e,n,i){return NW.isPlainObject(t)&&NW.isPlainObject(e)?NW.merge.call({caseless:i},t,e):NW.isPlainObject(e)?NW.merge({},e):NW.isArray(e)?e.slice():e}function r(t,e,n,r){return NW.isUndefined(e)?NW.isUndefined(t)?void 0:i(void 0,t,0,r):i(t,e,0,r)}function s(t,e){if(!NW.isUndefined(e))return i(void 0,e)}function o(t,e){return NW.isUndefined(e)?NW.isUndefined(t)?void 0:i(void 0,t):i(void 0,e)}function a(n,r,s){return s in e?i(n,r):s in t?i(void 0,n):void 0}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBo
vendor: 2,936 bytes, line 2
2dyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(t,e,n)=>r(P$(t),P$(e),0,!0)};return NW.forEach(Object.keys(Object.assign({},t,e)),(function(i){const s=l[i]||r,o=s(t[i],e[i],i);NW.isUndefined(o)&&s!==a||(n[i]=o)})),n}const M$=t=>{const e=R$({},t);let n,{data:i,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:a,auth:l}=e;if(e.headers=a=f$.from(a),e.url=XW(A$(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),NW.isFormData(i))if(r$.hasStandardBrowserEnv||r$.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[t,...e]=n?n.split(";").map((t=>t.trim())).filter(Boolean):[];a.setContentType([t||"multipart/form-data",...e].join("; "))}if(r$.hasStandardBrowserEnv&&(r&&NW.isFunction(r)&&(r=r(e)),r||!1!==r&&T$(e.url))){const t=s&&o&&C$.read(o);t&&a.set(s,t)}return e},I$="undefined"!==typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){const i=M$(t);let r=i.data;const s=f$.from(i.headers).normalize();let o,a,l,c,u,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=i;function f(){c&&c(),u&&u(),i.cancelToken&&i.cancelToken.unsubscribe(o),i.signal&&i.signal.removeEventListener("abort",o)}let g=new XMLHttpRequest;function m(){if(!g)return;const i=f$.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());v$((function(t){e(t),f()}),(function(t){n(t),f()}),{data:h&&"text"!==h&&"json"!==h?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:i,config:t,request:g}),g=null}g.open(i.method.toUpperCase(),i.url,!0),g.timeout=i.timeout,"onloadend"in g?g.onloadend=m:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(m)},g.onabort=function(){g&&(n(new BW("Request aborted",BW.ECONNABORTED,t,g)),g=null)},g.onerror=function(){n(new BW("Network Error",BW.ERR_NETWORK,t,g)),g=null},g.ontimeout=function(){let e=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const r=i.transitional||YW;i.timeoutErrorMessage&&(e=i.timeoutErrorMessage),n(new BW(e,r.clarifyTimeoutError?BW.ETIMEDOUT:BW.ECONNABORTED,t,g)),g=null},void 0===r&&s.setContentType(null),"setRequestHeader"in g&&NW.forEach(s.toJSON(),(function(t,e){g.setRequestHeader(e,t)})),NW.isUndefined(i.withCredentials)||(g.withCredentials=!!i.withCredentials),h&&"json"!==h&&(g.responseType=i.responseType),p&&([l,u]=E$(p,!0),g.addEventListener("progress",l)),d&&g.upload&&([a,c]=E$(d),g.upload.addEventListener("progress",a),g.upload.addEventListener("loadend",c)),(i.cancelToken||i.signal)&&(o=e=>{g&&(n(!e||e.type?new y$(null,t,g):e),g.abort(),g=null)},i.cancelToken&&i.cancelToken.subscribe(o),i.signal&&(i.signal.aborted?o():i.signal.addEventListener("abort",o))
vendor: 4,924 bytes, line 2
2);const _=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(i.url);_&&-1===r$.protocols.indexOf(_)?n(new BW("Unsupported protocol "+_+":",BW.ERR_BAD_REQUEST,t)):g.send(r||null)}))},L$=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let n,i=new AbortController;const r=function(t){if(!n){n=!0,o();const e=t instanceof Error?t:this.reason;i.abort(e instanceof BW?e:new y$(e instanceof Error?e.message:e))}};let s=e&&setTimeout((()=>{s=null,r(new BW(`timeout ${e} of ms exceeded`,BW.ETIMEDOUT))}),e);const o=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach((t=>{t.unsubscribe?t.unsubscribe(r):t.removeEventListener("abort",r)})),t=null)};t.forEach((t=>t.addEventListener("abort",r)));const{signal:a}=i;return a.unsubscribe=()=>NW.asap(o),a}},k$=function*(t,e){let n=t.byteLength;if(!e||n<e)return void(yield t);let i,r=0;for(;r<n;)i=r+e,yield t.slice(r,i),r=i},N$=async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},O$=(t,e,n,i)=>{const r=async function*(t,e){for await(const n of N$(t))yield*k$(n,e)}(t,e);let s,o=0,a=t=>{s||(s=!0,i&&i(t))};return new ReadableStream({async pull(t){try{const{done:e,value:i}=await r.next();if(e)return a(),void t.close();let s=i.byteLength;if(n){let t=o+=s;n(t)}t.enqueue(new Uint8Array(i))}catch(yG){throw a(yG),yG}},cancel:t=>(a(t),r.return())},{highWaterMark:2})},D$="function"===typeof fetch&&"function"===typeof Request&&"function"===typeof Response,F$=D$&&"function"===typeof ReadableStream,B$=D$&&("function"===typeof TextEncoder?(U$=new TextEncoder,t=>U$.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var U$;const z$=function(t){try{for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return!!t(...n)}catch(_G){return!1}},j$=F$&&z$((()=>{let t=!1;const e=new Request(r$.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e})),V$=F$&&z$((()=>NW.isReadableStream(new Response("").body))),W$={stream:V$&&(t=>t.body)};var $$;D$&&($$=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!W$[t]&&(W$[t]=NW.isFunction($$[t])?e=>e[t]():(e,n)=>{throw new BW(`Response type '${t}' is not supported`,BW.ERR_NOT_SUPPORT,n)})})));const G$=async(t,e)=>{const n=NW.toFiniteNumber(t.getContentLength());return null==n?(async t=>{if(null==t)return 0;if(NW.isBlob(t))return t.size;if(NW.isSpecCompliantForm(t)){const e=new Request(r$.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return NW.isArrayBufferView(t)||NW.isArrayBuffer(t)?t.byteLength:(NW.isURLSearchParams(t)&&(t+=""),NW.isString(t)?(await B$(t)).byteLength:void 0)})(e):n},H$=D$&&(async t=>{let{url:e,method:n,data:i,signal:r,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:u,withCredentials:h="same-origin",fetchOptions:d}=M$(t);c=c?(c+"").toLowerCase():"text";let p,f=L$([r,s&&s.toAbortSignal()],o);const g=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let m;try{if(l&&j$&&"get"!==n&&"head"!==n&&0!==(m=await G$(u,i))){let t,n=new Request(e,{method:"POST",body:i,duplex:"half"});if(NW.isFormData(i)&&(t=n.headers.get("content-type"))&&u.setContentType(t),n.body){const[t,e]=x$(m,E$(S$(l)));i=O$(n.body,65536,t,e)}}NW.isString(h)||(h=h?"include":"omit");const r="credentials"in Request.prototype;p=new Request(e,{...d,signal:f,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:i,duplex:"half",credentials:r?h:void 0});let s=await fetch(p);const o=V$&&("stream"===c||"response"===c);if(V$&&(a||o&&g)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=s[e]}));const e=NW.toFiniteNumber(s.headers.get("content-length")),[n,i]=a&&x$(e,E$(S$(a),!0))||[];s=new Response(O$(s.body,65536,n,(()=>{i&&i(),g&&g()})),t)}c=c||"text";let _=await W$[NW.findKey(W$,c)||"text"](s,t);return!o&&g&&g(),await new Promise(((e,n)=>{v$(e,n,{data:_,headers:f$.from(s.headers),status:s.status,statusText:s.statusText,config:t,request:p})}))}catch(yG){if(g&&g(),yG&&"TypeError"===yG.name&&/fetch/i.test(yG.message))throw Object.assign(new BW("Network Error",BW.ERR_NETWORK,t,p),{cause:yG.cause||yG});throw BW.from(yG,yG&&yG.code,t,p)}}),q$={http:null,xhr:I$,fetch:H$};NW.forEach(q$,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(_G){}Object.defineProperty(t,"adapterName",{value:e})}}));const Z$=t=>`- ${t}`,X$=t=>NW.isFunction(t)||null===t||!1===t,K$=t=>{t=NW.isArray(t)?t:[t];const{length:e}=t;let n,i;const r={};for(let s=0;s<e;s++){let e;if(n=t[s],i=n,!X$(n)&&(i=q$[(e=String(n)).toLowerCase()],void 0===i))throw new BW(`Unknown adapter '${e}'`);if(i)break;r[e||"#"+s]=i}if(!i){const t=Object.entries(r).map((t=>{let[e,n]=t;return`adapter ${e} `+(!1===n?"is not supported by the environment":"is not available in the build")}));let n=e?t.length>
vendor: 4,888 bytes, line 2
21?"since :\n"+t.map(Z$).join("\n"):" "+Z$(t[0]):"as no adapter specified";throw new BW("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return i};function Y$(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new y$(null,t)}function J$(t){Y$(t),t.headers=f$.from(t.headers),t.data=g$.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return K$(t.adapter||a$.adapter)(t).then((function(e){return Y$(t),e.data=g$.call(t,t.transformResponse,e),e.headers=f$.from(e.headers),e}),(function(e){return m$(e)||(Y$(t),e&&e.response&&(e.response.data=g$.call(t,t.transformResponse,e.response),e.response.headers=f$.from(e.response.headers))),Promise.reject(e)}))}const Q$="1.8.4",tG={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{tG[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const eG={};tG.transitional=function(t,e,n){function i(t,e){return"[Axios v1.8.4] Transitional option '"+t+"'"+e+(n?". "+n:"")}return(n,r,s)=>{if(!1===t)throw new BW(i(r," has been removed"+(e?" in "+e:"")),BW.ERR_DEPRECATED);return e&&!eG[r]&&(eG[r]=!0,console.warn(i(r," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,r,s)}},tG.spelling=function(t){return(e,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};const nG={assertOptions:function(t,e,n){if("object"!==typeof t)throw new BW("options must be an object",BW.ERR_BAD_OPTION_VALUE);const i=Object.keys(t);let r=i.length;for(;r-- >0;){const s=i[r],o=e[s];if(o){const e=t[s],n=void 0===e||o(e,s,t);if(!0!==n)throw new BW("option "+s+" must be "+n,BW.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new BW("Unknown option "+s,BW.ERR_BAD_OPTION)}},validators:tG},iG=nG.validators;class rG{constructor(t){this.defaults=t,this.interceptors={request:new KW,response:new KW}}async request(t,e){try{return await this._request(t,e)}catch(yG){if(yG instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const n=e.stack?e.stack.replace(/^.+\n/,""):"";try{yG.stack?n&&!String(yG.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(yG.stack+="\n"+n):yG.stack=n}catch(_G){}}throw yG}}_request(t,e){"string"===typeof t?(e=e||{}).url=t:e=t||{},e=R$(this.defaults,e);const{transitional:n,paramsSerializer:i,headers:r}=e;void 0!==n&&nG.assertOptions(n,{silentJSONParsing:iG.transitional(iG.boolean),forcedJSONParsing:iG.transitional(iG.boolean),clarifyTimeoutError:iG.transitional(iG.boolean)},!1),null!=i&&(NW.isFunction(i)?e.paramsSerializer={serialize:i}:nG.assertOptions(i,{encode:iG.function,serialize:iG.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),nG.assertOptions(e,{baseUrl:iG.spelling("baseURL"),withXsrfToken:iG.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let s=r&&NW.merge(r.common,r[e.method]);r&&NW.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete r[t]})),e.headers=f$.concat(s,r);const o=[];let a=!0;this.interceptors.request.forEach((function(t){"function"===typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,o.unshift(t.fulfilled,t.rejected))}));const l=[];let c;this.interceptors.response.forEach((function(t){l.push(t.fulfilled,t.rejected)}));let u,h=0;if(!a){const t=[J$.bind(this),void 0];for(t.unshift.apply(t,o),t.push.apply(t,l),u=t.length,c=Promise.resolve(e);h<u;)c=c.then(t[h++],t[h++]);return c}u=o.length;let d=e;for(h=0;h<u;){const t=o[h++],e=o[h++];try{d=t(d)}catch($c){e.call(this,$c);break}}try{c=J$.call(this,d)}catch($c){return Promise.reject($c)}for(h=0,u=l.length;h<u;)c=c.then(l[h++],l[h++]);return c}getUri(t){return XW(A$((t=R$(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}NW.forEach(["delete","get","head","options"],(function(t){rG.prototype[t]=function(e,n){return this.request(R$(n||{},{method:t,url:e,data:(n||{}).data}))}})),NW.forEach(["post","put","patch"],(function(t){function e(e){return function(n,i,r){return this.request(R$(r||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}rG.prototype[t]=e(),rG.prototype[t+"Form"]=e(!0)}));const sG=rG;class oG{constructor(t){if("function"!==typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const n=this;this.promise.then((t=>{if(!n._listeners)return;let e=n._listeners.length;for(;e-- >0;)n._listeners[e](t);n._listeners=null})),this.promise.then=t=>{let e;const i=new Promise((t=>{n.subscribe(t),e=t})).then(t);return i.cancel=function(){n.unsubscribe(e)},i},t((function(t,i,r){n.reason||(n.reason=new y$(t,i,r),e(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}
vendor: 2,287 bytes, line 2
2subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new oG((function(e){t=e})),cancel:t}}}const aG=oG;const lG={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(lG).forEach((t=>{let[e,n]=t;lG[n]=e}));const cG=lG;const uG=function t(e){const n=new sG(e),i=JV(sG.prototype.request,n);return NW.extend(i,sG.prototype,n,{allOwnKeys:!0}),NW.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return t(R$(e,n))},i}(a$);uG.Axios=sG,uG.CanceledError=y$,uG.CancelToken=aG,uG.isCancel=m$,uG.VERSION=Q$,uG.toFormData=WW,uG.AxiosError=BW,uG.Cancel=uG.CanceledError,uG.all=function(t){return Promise.all(t)},uG.spread=function(t){return function(e){return t.apply(null,e)}},uG.isAxiosError=function(t){return NW.isObject(t)&&!0===t.isAxiosError},uG.mergeConfig=R$,uG.AxiosHeaders=f$,uG.formToJSON=t=>
2s$(NW.isHTMLForm(t)?new FormData(t):t),uG.getAdapter=K$,uG.HttpStatusCode=cG,uG.default=uG;const hG=uG,dG={searchBarContainer:{position:"absolute",top:"10px",left:"10px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:"rgba(255, 255, 255, 0.9)",padding:"10px 20px",borderRadius:"8px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",zIndex:1e4},input:{padding:"8px",fontSize:"14px",borderRadius:"5px",border:"1px solid #ccc",width:"120px"},button:{padding:"8px 12px",fontSize:"14px",borderRadius:"5px",border:"none",backgroundColor:"#007BFF",color:"white",cursor:"pointer"},error:{color:"red",fontSize:"12px",marginTop:"5px"}},pG=t=>{let{onLocationSelect:n}=t;const[i,r]=(0,e.useState)(""),[o,a]=(0,e.useState)(""),[l,c]=(0,e.useState)(null),[u,h]=(0,e.useState)(""),d={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_FIREBASE_PASSWORD:"ClearloopData123!",REACT_APP_OPENWEATHER_API_KEY:"03c641fb2401c9014257bab115dd66ad",REACT_APP_FIREBASE_EMAIL:"[email protected]",REACT_APP_MAPBOX_TOKEN:"pk.eyJ1IjoibWFuZGFsaSIsImEiOiJjbHh0Z2I4YW0wNGtvMmlvYzZhM28wMTV2In0.maKcZ_aBF3G64JMJM2W1EQ"}.REACT_APP_CITY_LOC_API_KEY;return(0,s.jsxs)("div",{style:dG.searchBarContainer,children:[(0,s.jsx)("input",{type:"text",placeholder:"City: e.g. Boston",value:i,onChange:t=>r(t.target.value),style:dG.input}),(0,s.jsx)("input",{type:"text",placeholder:"State: e.g. MA",value:o,onChange:t=>a(t.target.value),style:dG.input}),(0,s.jsx)("button",{onClick:async()=>{if(i&&o)try{const t=`${i}, ${o}, USA`,e=await hG.get(`https://api.opencagedata.com/geocode/v1/json?q=${encodeURIComponent(t)}&key=${d}`);if(e.data.results.length>0){const{lat:t,lng:r}=e.data.results[0].geometry,s=await hG.get("https://gvja36z5c3.execute-api.us-east-2.amazonaws.com/Test/get-ba",{params:{lat:t,lng:r}});console.log(s);const a=s.data.region,l=s.data.region_full_name;c({latitude:t,longitude:r}),n({city:i,state:o,latitude:t,longitude:r,region:a,region_full_name:l}),h("")}else h("Location not found. Please check your input."),c(null)}catch(yG){h("An error occurred while fetching the location."),c(null)}else h("Please enter both city and state.")},style:dG.button,children:"Search"}),u&&(0,s.jsx)("p",{style:dG.error,children:u})]})};Qm(_y(Qf),"[email protected]","ClearloopData123!").then((t=>{Uf(Kf(Qf),"/realtime/")})).catch((t=>{console.error("Auth failed:",t)}));const fG=Kf(Qf),gG=t=>{const[n,i]=(0,e.useState)(0),[r,o]=(0,e.useState)(0),[a,l]=(0,e.useState)({city:"",region:"",state:""}),[c,u]=(0,e.useState)(null);return(0,e.useEffect)((()=>{$f(Uf(fG,`realtime/lastHour${t.database}`),(t=>{const e=t.val();i(e.co2),e.alter&&e.alter[a.region]&&o(e.alter[a.region].co2)}))}),[t.database,n,a.region]),(0,s.jsxs)("div",{className:"carbon-map-section-container",children:[(0,s.jsx)("div",{className:"search-bar-container",children:(0,s.jsx)(pG,{onLocationSelect:u})}),(0,s.jsx)(_,{children:(0,s.jsx)("div",{className:"carbon-map-container",children:(0,s.jsx)(YV,{setHoveredState:l,alterEmissionOffset:r,setAlterEmissionOffset:o,currentEmissionOffset:n,database:t.database,displayName:t.displayName,location:t.location,capacity:t.capacity,searchLocation:c})})})]})},mG=()=>{const[t,n]=(0,e.useState)("/panola1"),[i,r]=(0,e.useState)(null),o=[{plantName:"panola1",displayName:"Panola I",databaseName:"/panola1",capacity:4.75,location:"Mississippi"},{plantName:"panola2",displayName:"Panola II",databaseName:"/panola2",capacity:4.75,location:"Mississippi"},{plantName:"panola3",displayName:"Panola III",databaseName:"/panola3",capacity:3.5,location:"Mississippi"}];(0,e.useEffect)((()=>{const e=o.find((e=>e.databaseName===t));r(e)}),[t]);return(0,s.jsxs)(_,{fluid:!0,children:[(0,s.jsx)("div",{className:"dropdown-container",children:(0,s.jsxs)(UV.Group,{controlId:"carbonPlantSelect",children:[(0,s.jsx)(UV.Label,{style:{color:"black"},children:"Select Carbon Project"}),(0,s.jsx)(UV.Control,{as:"select",value:t,onChange:t=>{n(t.target.value)},children:o.map((t=>(0,s.jsx)("option",{value:t.databaseName,children:t.displayName},t.plantName)))})]})}),(0,s.jsx)("div",{className:"map-section-container",children:i&&(0,s.jsx)(gG,{database:i.databaseName,displayName:i.displayName,location:i.location,capacity:i.capacity},i.databaseName)})]})};r.createRoot(document.getElementById("root")).render((0,s.jsx)(Mv,{children:(0,s.jsxs)(Av,{children:[(0,s.jsx)(Tv,{path:"/",exact:!0,element:(0,s.jsx)(o,{})}),(0,s.jsx)(Tv,{path:"big-dial",exact:!0,element:(0,s.jsx)(Ey,{brightGlobe:kv[0].brightGlobe,database:""})}),kv.map(((t,n)=>(0,s.jsxs)(e.Fragment,{children:[(0,s.jsx)(Tv,{path:`/${t.location}/${t.name.plantName}/big-dial`,exact:!0,element:(0,s.jsx)(Ey,{brightGlobe:t.brightGlobe,database:t.name.databaseName,displayName:t.name.displayName,location:t.displayLocation,capacity:t.capacity,plant:t.
2name.plantName})}),(0,s.jsx)(Tv,{path:`/${t.location}/${t.name.plantName}/monthly-output`,exact:!0,element:(0,s.jsx)(Cy,{database:t.name.databaseName,displayName:t.name.displayName,capacity:t.capacity,location:t.displayLocation})}),(0,s.jsx)(Tv,{path:`/${t.location}/${t.name.plantName}/dial-map`,exact:!0,element:(0,s.jsx)(tV,{database:t.name.databaseName,displayName:t.name.displayName,location:t.displayLocation,capacity:t.capacity,brightGlobe:t.brightGlobe})}),(0,s.jsx)(Tv,{path:`/${t.location}/${t.name.plantName}/carbon-map`,exact:!0,element:(0,s.jsx)(gG,{database:t.name.databaseName,displayName:t.name.displayName,location:t.displayLocation,capacity:t.capacity,brightGlobe:t.brightGlobe})}),(0,s.jsx)(Tv,{path:`/${t.location}/${t.name.plantName}/location`,exact:!0,element:(0,s.jsx)(og,{plant:t.name.plantName})})]},n))),(0,s.jsx)(Tv,{path:"monthly-output",exact:!0,element:(0,s.jsx)(Cy,{database:""})}),(0,s.jsx)(Tv,{path:"health-damage",exact:!0,element:(0,s.jsx)(Wv,{})}),(0,s.jsx)(Tv,{path:"comparison-chart",exact:!0,element:(0,s.jsx)(db,{})}),(0,s.jsx)(Tv,{path:"detailed-map",exact:!0,element:(0,s.jsx)(fj,{})}),(0,s.jsx)(Tv,{path:"global-map",exact:!0,element:(0,s.jsx)(iV,{})}),(0,s.jsx)(Tv,{path:"carbon-map",exact:!0,element:(0,s.jsx)(gG,{})}),(0,s.jsx)(Tv,{path:"sankey-health",exact:!0,element:(0,s.jsx)(Fj,{})}),(0,s.jsx)(Tv,{path:"map-controller",exact:!0,element:(0,s.jsx)(zV,{})}),(0,s.jsx)(Tv,{path:"dial-controller",exact:!0,element:(0,s.jsx)(jV,{})}),(0,s.jsx)(Tv,{path:"monthly-controller",exact:!0,element:(0,s.jsx)(VV,{})}),(0,s.jsx)(Tv,{path:"carbon-map-controller",exact:!0,element:(0,s.jsx)(mG,{})})]})}))})()})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.