PageSourceSearch

https://app.boostt.ai/v2/_next/static/chunks/76720-39255fdc1fa839f0.js

js boostt.ai collected 2026-10-05 11:54:21 UTC 120,650 bytes, 1,121 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[76720],{93719:function(e){function t(e,t,c){c=c||2;var h,p,m,v,x,y,b,C=t&&t.length,P=C?t[0]*c:e.length,_=i(e,0,P,c,!0),S=[];if(!_||_.next===_.prev)return S;if(C&&(_=function(e,t,r,l){var u,c,h,p,f,m=[];for(u=0,c=t.length;u<c;u++)h=t[u]*l,p=u<c-1?t[u+1]*l:e.length,(f=i(e,h,p,l,!1))===f.next&&(f.steiner=!0),m.push(function(e){var t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}(f));for(m.sort(n),u=0;u<m.length;u++)r=function(e,t){var i=function(e,t){var i,o,n,r=t,l=e.x,u=e.y,c=-1/0;do{if(u<=r.y&&u>=r.next.y&&r.next.y!==r.y){var h=r.x+(u-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=l&&h>c&&(c=h,n=r.x<r.next.x?r:r.next,h===l))return n}r=r.next}while(r!==t);if(!n)return null;var d,p=n,f=n.x,m=n.y,v=1/0;r=n;do l>=r.x&&r.x>=f&&l!==r.x&&s(u<m?l:c,u,f,m,u<m?c:l,u,r.x,r.y)&&(d=Math.abs(u-r.y)/(l-r.x),g(r,e)&&(d<v||d===v&&(r.x>n.x||r.x===n.x&&(i=n,o=r,0>a(i.prev,i,o.prev)&&0>a(o.next,i,i.next))))&&(n=r,v=d)),r=r.next;while(r!==p);return n}(e,t);if(!i)return t;var n=d(i,e);return o(n,n.next),o(i,i.next)}(m[u],r);return r}(e,t,_,c)),e.length>80*c){h=m=e[0],p=v=e[1];for(var w=c;w<P;w+=c)x=e[w],y=e[w+1],x<h&&(h=x),y<p&&(p=y),x>m&&(m=x),y>v&&(v=y);b=0!==(b=Math.max(m-h,v-p))?32767/b:0}return function e(t,i,n,c,h,p,m){if(t){!m&&p&&function(e,t,i,o){var n=e;do 0===n.z&&(n.z=r(n.x,n.y,t,i,o)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,o,n,r,s,a,l,u=1;do{for(i=e,e=null,r=null,s=0;i;){for(s++,o=i,a=0,t=0;t<u&&(a++,o=o.nextZ);t++);for(l=u;a>0||l>0&&o;)0!==a&&(0===l||!o||i.z<=o.z)?(n=i,i=i.nextZ,a--):(n=o,o=o.nextZ,l--),r?r.nextZ=n:e=n,n.prevZ=r,r=n;i=o}r.nextZ=null,u*=2}while(s>1)}(n)}(t,c,h,p);for(var v,x,y=t;t.prev!==t.next;){if(v=t.prev,x=t.next,p?function(e,t,i,o){var n=e.prev,l=e.next;if(a(n,e,l)>=0)return!1;for(var u=n.x,c=e.x,h=l.x,g=n.y,d=e.y,p=l.y,f=u<c?u<h?u:h:c<h?c:h,m=g<d?g<p?g:p:d<p?d:p,v=u>c?u>h?u:h:c>h?c:h,x=g>d?g>p?g:p:d>p?d:p,y=r(f,m,t,i,o),b=r(v,x,t,i,o),C=e.prevZ,P=e.nextZ;C&&C.z>=y&&P&&P.z<=b;){if(C.x>=f&&C.x<=v&&C.y>=m&&C.y<=x&&C!==n&&C!==l&&s(u,g,c,d,h,p,C.x,C.y)&&a(C.prev,C,C.next)>=0||(C=C.prevZ,P.x>=f&&P.x<=v&&P.y>=m&&P.y<=x&&P!==n&&P!==l&&s(u,g,c,d,h,p,P.x,P.y)&&a(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;C&&C.z>=y;){if(C.x>=f&&C.x<=v&&C.y>=m&&C.y<=x&&C!==n&&C!==l&&s(u,g,c,d,h,p,C.x,C.y)&&a(C.prev,C,C.next)>=0)return!1;C=C.prevZ}for(;P&&P.z<=b;){if(P.x>=f&&P.x<=v&&P.y>=m&&P.y<=x&&P!==n&&P!==l&&s(u,g,c,d,h,p,P.x,P.y)&&a(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}(t,c,h,p):function(e){var t=e.prev,i=e.next;if(a(t,e,i)>=0)return!1;for(var o=t.x,n=e.x,r=i.x,l=t.y,u=e.y,c=i.y,h=o<n?o<r?o:r:n<r?n:r,g=l<u?l<c?l:c:u<c?u:c,d=o>n?o>r?o:r:n>r?n:r,p=l>u?l>c?l:c:u>c?u:c,f=i.next;f!==t;){if(f.x>=h&&f.x<=d&&f.y>=g&&f.y<=p&&s(o,l,n,u,r,c,f.x,f.y)&&a(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}(t)){i.push(v.i/n|0),i.push(t.i/n|0),i.push(x.i/n|0),f(t),t=x.next,y=x.next;continue}if((t=x)===y){m?1===m?e(t=function(e,t,i){var n=e;do{var r=n.prev,s=n.next.next;!l(r,s)&&u(r,n,n.next,s)&&g(r,s)&&g(s,r)&&(t.push(r.i/i|0),t.push(n.i/i|0),t.push(s.i/i|0),f(n),f(n.next),n=e=s),n=n.next}while(n!==e);return o(n)}(o(t),i,n),i,n,c,h,p,2):2===m&&function(t,i,n,r,s,c){var h=t;do{for(var p,f,m=h.next.next;m!==h.prev;){if(h.i!==m.i&&(p=h,f=m,p.next.i!==f.i&&p.prev.i!==f.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&u(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(p,f)&&(g(p,f)&&g(f,p)&&function(e,t){var i=e,o=!1,n=(e.x+t.x)/2,r=(e.y+t.y)/2;do i.y>r!=i.next.y>r&&i.next.y!==i.y&&n<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(o=!o),i=i.next;while(i!==e);return o}(p,f)&&(a(p.prev,p,f.prev)||a(p,f.prev,f))||l(p,f)&&a(p.prev,p,p.next)>0&&a(f.prev,f,f.next)>0))){var v=d(h,m);h=o(h,h.next),v=o(v,v.next),e(h,i,n,r,s,c,0),e(v,i,n,r,s,c,0);return}m=m.next}h=h.next}while(h!==t)}(t,i,n,c,h,p):e(o(t),i,n,c,h,p,1);break}}}}(_,S,c,h,p,b,0),S}function i(e,t,i,o,n){var r,s;if(n===v(e,t,i,o)>0)for(r=t;r<i;r+=o)s=p(r,e[r],e[r+1],s);else for(r=i-o;r>=t;r-=o)s=p(r,e[r],e[r+1],s);return s&&l(s,s.next)&&(f(s),s=s.next),s}function o(e,t){if(!e)return e;t||(t=e);var i,o=e;do if(i=!1,!o.steiner&&(l(o,o.next)||0===a(o.prev,o,o.next))){if(f(o),(o=t=o.prev)===o.next)break;
1i=!0}else o=o.next;while(i||o!==t);return t}function n(e,t){return e.x-t.x}function r(e,t,i,o,n){return(e=((e=((e=((e=((e=(e-i)*n|0)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)|(t=((t=((t=((t=((t=(t-o)*n|0)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)<<1}function s(e,t,i,o,n,r,s,a){return(n-s)*(t-a)>=(e-s)*(r-a)&&(e-s)*(o-a)>=(i-s)*(t-a)&&(i-s)*(r-a)>=(n-s)*(o-a)}function a(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function l(e,t){return e.x===t.x&&e.y===t.y}function u(e,t,i,o){var n=h(a(e,t,i)),r=h(a(e,t,o)),s=h(a(i,o,e)),l=h(a(i,o,t));return!!(n!==r&&s!==l||0===n&&c(e,i,t)||0===r&&c(e,o,t)||0===s&&c(i,e,o)||0===l&&c(i,t,o))}function c(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function h(e){return e>0?1:e<0?-1:0}function g(e,t){return 0>a(e.prev,e,e.next)?a(e,t,e.next)>=0&&a(e,e.prev,t)>=0:0>a(e,t,e.prev)||0>a(e,e.next,t)}function d(e,t){var i=new m(e.i,e.x,e.y),o=new m(t.i,t.x,t.y),n=e.next,r=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,o.next=i,i.prev=o,r.next=o,o.prev=r,o}function p(e,t,i,o){var n=new m(e,t,i);return o?(n.next=o.next,n.prev=o,o.next.prev=n,o.next=n):(n.prev=n,n.next=n),n}function f(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function m(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function v(e,t,i,o){for(var n=0,r=t,s=i-o;r<i;r+=o)n+=(e[s]-e[r])*(e[r+1]+e[s+1]),s=r;return n}e.exports=t,e.exports.default=t,t.deviation=function(e,t,i,o){var n=t&&t.length,r=n?t[0]*i:e.length,s=Math.abs(v(e,0,r,i));if(n)for(var a=0,l=t.length;a<l;a++){var u=t[a]*i,c=a<l-1?t[a+1]*i:e.length;s-=Math.abs(v(e,u,c,i))}var h=0;for(a=0;a<o.length;a+=3){var g=o[a]*i,d=o[a+1]*i,p=o[a+2]*i;h+=Math.abs((e[g]-e[p])*(e[d+1]-e[g+1])-(e[g]-e[d])*(e[p+1]-e[g+1]))}return 0===s&&0===h?0:Math.abs((h-s)/s)},t.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},o=0,n=0;n<e.length;n++){for(var r=0;r<e[n].length;r++)for(var s=0;s<t;s++)i.vertices.push(e[n][r][s]);n>0&&(o+=e[n-1].length,i.holes.push(o))}return i}},68089:function(e,t,i){var o=i(24958),n=i(2782);class r extends o.Z{get isDrawable(){return!0}initializeState(){this.getAttributeManager().remove(["instancePickingColors"])}updateState(e){super.updateState(e);let t=this.getAggregatorType();if(e.changeFlags.extensionsChanged||this.state.aggregatorType!==t){this.state.aggregator?.destroy();let e=this.createAggregator(t);return e.setProps({attributes:this.getAttributeManager()?.attributes}),this.setState({aggregator:e,aggregatorType:t}),!0}return!1}finalizeState(e){super.finalizeState(e),this.state.aggregator.destroy()}updateAttributes(e){let{aggregator:t}=this.state;for(let i in t.setProps({attributes:e}),e)this.onAttributeChange(i);t.update()}draw({shaderModuleProps:e}){let{aggregator:t}=this.state;t.setProps({shaderModuleProps:e}),t.preDraw()}_getAttributeManager(){return new n.Z(this.context.device,{id:this.props.id,stats:this.context.stats})}}r.layerName="AggregationLayer",t.Z=r},50107:function(e,t,i){i.d(t,{_:function(){return a}});var o=i(47717);let n=(e,t)=>{let i=0;for(let o of e)i+=t(o);return i},r={COUNT:e=>e.length,SUM:n,MEAN:(e,t)=>0===e.length?NaN:n(e,t)/e.length,MIN:(e,t)=>{let i=1/0;for(let o of e){let e=t(o);e<i&&(i=e)}return i},MAX:(e,t)=>{let i=-1/0;for(let o of e){let e=t(o);e>i&&(i=e)}return i}};function s(e,t,i){let o={};for(let i of e.sources||[]){let e=t[i];if(e)o[i]=function(e){let t;let i=e.value,{offset:o=0,stride:n,size:r}=e.getAccessor(),s=i.BYTES_PER_ELEMENT,a=o/s,l=n?n/s:r;return 1===r?e.isConstant?()=>i[0]:e=>i[a+l*e]:e.isConstant?(t=Array.from(i),()=>t):(t=Array(r),e=>{let o=a+l*e;for(let e=0;e<r;e++)t[e]=i[o+e];return t})}(e);else throw Error(`Cannot find attribute ${i}`)}let n={};return t=>{for(let e in o)n[e]=o[e](t);return e.getValue(n,t,i)}}class a{constructor(e){this.bins=[],this.binIds=null,this.results=[],this.dimensions=e.dimensions,this.channelCount=e.getValue.length,this.props={...e,binOptions:{},pointCount:0,operations:[],customOperations:[],attributes:{}},this.needsUpdate=!0,this.setProps(e)}destroy(){}get binCount(){return this.bins.length}setProps(e){let t=this.props;if(e.binOptions&&!(0,o.v)(e.binOptions,t.binOptions,2)&&this.setNeedsUpdate(),e.operations)for(let i=0;i<this.channelCount;i++)e.operations[i]!==t.operations[i]&&this.setNeedsUpdate(i);if(e.customOperations)for(let i=0;i<this.channelCount;i++)!!e.customOperations[i]!=!!t.customOperations[i]&&this.setNeedsUpdate(i);void 0!==e.pointCount&&e.pointCount!==t.pointCount&&this.setNeedsUpdate(),e.attributes&&(e.attributes={...t.attributes,...e.attributes}),Object.assign(this.props,e)}setNeedsUpdate(e){void 0===e?this.needsUpdate=!0:!0!==this.needsUpdate&&(this.needsUpdate=this.needsUpdate||[],this.needsUpdate[e]=!0)}update(){if(!0===this.needsUpdate){this.bins=function({pointCount:e,getBinId:t}){let i=new Map;for(let o=0;o<e;o++){let e=t(o);if(null===e)continue;let n=i.get(String(e));n?n.points.push(o):(n={id:e,index:i.size,points:[o]},i.set(String(e),n))}return Array.from(i.values())}({pointCount:this.props.pointCount,getBinId:s(this.props.getBin,this.props.attributes,this.props.binOptions)});let e=function({bins:e,dimensions:t,target:i}){let o=e.length*t;(!i||i.length<o)&&(i=new Float32Array(o));for(let o=0;o<e.length;o++){let{id:n}=e[o];Array.isArray(n)?i.set(n,o*t):i[o]=n}return i}({bins:this.bins,dimensions:this.dimensions,target:this.binIds?.value});this.binIds={value:e,type:"float32",size:this.dimensions}}for(let e=0;e<this.channelCount;e++)if(!0===this.needsUpdate||this.needsUpdate[e]){let t=this.props.customOperations[e]||r[this.props.operations[e]],{value:i,domain:o}=function({bins:e,getValue:t,operation:i,target:o}){(!o||o.length<e.length)&&(o=new Float32Array(e.length));let n=1/0,r=-1/0;for(let s=0;s<e.length;s++){let{points:a}=e[s];o[s]=i(a,t),o[s]<n&&(n=o[s]),o[s]>r&&(r=o[s])}return{value:o,domain:[n,r]}}({bins:this.bins,getValue:s(this.props.getValue[e],this.props.attributes,void 0),operation:t,target:this.results[e]?.value});this.results[e]={value:i,domain:o,type:"float32",size:1},this.props.onUpdate?.({channel:e})}this.needsUpdate=!1}preDraw(){}getBins(){return this.binIds}getResult(e){return this.results[e]}getResultDomain(e){return this.results[e]?.domain??[1/0,-1/0]}getBin(e){let t=this.bins[e];if(!t)return null;let i=Array(this.channelCount);for(let t=0;t<i.length;t++){let o=this.results[t];i[t]=o?.value[e]}return{id:t.id,value:i,count:t.points.length,pointIndices:t.points}}}},84097:function(e,t,i){i.d(t,{C:function(){return p}});var o=i(68360);function n(e,t,i){return e.createFramebuffer({width:t,height:i,colorAttachments:[e.createTexture({width:t,height:i,format:"rgba32float",sampler:{minFilter:"nearest",magFilter:"nearest"}})]})}let r={name:"binSorter",vs:`\
2uniform binSorterUniforms {
3  ivec4 binIdRange;
4  ivec2 targetSize;
5} binSorter;
6`,uniformTypes:{binIdRange:"vec4<i32>",targetSize:"vec2<i32>"}},s=[1,2,4,8],a={SUM:0,MEAN:0,MIN:0,MAX:0,COUNT:0};class l{constructor(e,t){this.binsFBO=null,this.device=e,this.model=function(e,t){let i=t.vs;2===t.dimensions&&(i+=`
7void getBin(out int binId) {
8  ivec2 binId2;
9  getBin(binId2);
10  if (binId2.x < binSorter.binIdRange.x || binId2.x >= binSorter.binIdRange.y) {
11    binId = -1;
12  } else {
13    binId = (binId2.y - binSorter.binIdRange.z) * (binSorter.binIdRange.y - binSorter.binIdRange.x) + binId2.x;
14  }
15}
16`);let n=`\
17#version 300 es
18#define SHADER_NAME gpu-aggregation-sort-bins-vertex
19
20${i}
21
22out vec3 v_Value;
23
24void main() {
25  int binIndex;
26  getBin(binIndex);
27  binIndex = binIndex - binSorter.binIdRange.x;
28  if (binIndex < 0) {
29    gl_Position = vec4(0.);
30    return;
31  }
32  int row = binIndex / binSorter.targetSize.x;
33  int col = binIndex - row * binSorter.targetSize.x;
34  vec2 position = (vec2(col, row) + 0.5) / vec2(binSorter.targetSize) * 2.0 - 1.0;
35  gl_Position = vec4(position, 0.0, 1.0);
36  gl_PointSize = 1.0;
37
38#if NUM_CHANNELS == 3
39  getValue(v_Value);
40#elif NUM_CHANNELS == 2
41  getValue(v_Value.xy);
42#else
43  getValue(v_Value.x);
44#endif
45}
46`,s=`\
47#version 300 es
48#define SHADER_NAME gpu-aggregation-sort-bins-fragment
49
50precision highp float;
51
52in vec3 v_Value;
53out vec4 fragColor;
54
55void main() {
56  fragColor.xyz = v_Value;
57
58  #ifdef MODULE_GEOMETRY
59  geometry.uv = vec2(0.);
60  DECKGL_FILTER_COLOR(fragColor, geometry);
61  #endif
62
63  fragColor.w = 1.0;
64}
65`;return new o.H(e,{bufferLayout:t.bufferLayout,modules:[...t.modules||[],r],defines:{...t.defines,NON_INSTANCED_MODEL:1,NUM_CHANNELS:t.channelCount},isInstanced:!1,vs:n,fs:s,topology:"point-list",disableWarnings:!0})}(e,t)}get texture(){return this.binsFBO?this.binsFBO.colorAttachments[0].texture:null}destroy(){this.model.destroy(),this.binsFBO?.colorAttachments[0].texture.destroy(),this.binsFBO?.destroy()}getBinValues(e){return this.binsFBO?new Float32Array(this.device.readPixelsToArrayWebGL(this.binsFBO,{sourceX:e%1024,sourceY:Math.floor(e/1024),sourceWidth:1,sourceHeight:1}).buffer):null}setDimensions(e,t){let i=Math.ceil(e/1024);this.binsFBO?this.binsFBO.height<i&&this.binsFBO.resize({width:1024,height:i}):this.binsFBO=n(this.device,1024,i);let o={binIdRange:[t[0][0],t[0][1],t[1]?.[0]||0,t[1]?.[1]||0],targetSize:[this.binsFBO.width,this.binsFBO.height]};this.model.shaderInputs.setProps({binSorter:o})}setModelProps(e){let t=this.model;e.attributes&&t.setAttributes(e.attributes),e.constantAttributes&&t.setConstantAttributes(e.constantAttributes),void 0!==e.vertexCount&&t.setVertexCount(e.vertexCount),e.shaderModuleProps&&t.shaderInputs.setProps(e.shaderModuleProps)}update(e){if(!this.binsFBO)return;let t=function(e){let t={...a};for(let i=0;i<e.length;i++){let o=e[i];o&&(t[o]+=s[i])}return t}(e);this._updateBins("SUM",t.SUM+t.MEAN),this._updateBins("MIN",t.MIN),this._updateBins("MAX",t.MAX)}_updateBins(e,t){if(0===t)return;t|=8;let i=this.model,o=this.binsFBO,n="MAX"===e?-3e38:"MIN"===e?3e38:0,r=this.device.beginRenderPass({id:`gpu-aggregation-${e}`,framebuffer:o,parameters:{viewport:[0,0,o.width,o.height],colorMask:t},clearColor:[n,n,n,0],clearDepth:!1,clearStencil:!1});i.setParameters({blend:!0,blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one",blendColorOperation:"MAX"===e?"max":"MIN"===e?"min":"add",blendAlphaOperation:"add"}),i.draw(r),r.end()}}var u=i(70145);let c={name:"aggregatorTransform",vs:`\
66uniform aggregatorTransformUniforms {
67  ivec4 binIdRange;
68  bvec3 isCount;
69  bvec3 isMean;
70  float naN;
71} aggregatorTransform;
72`,uniformTypes:{binIdRange:"vec4<i32>",isCount:"vec3<f32>",isMean:"vec3<f32>"}};class h{constructor(e,t){this.binBuffer=null,this.valueBuffer=null,this._domains=null,this.device=e,this.channelCount=t.channelCount,this.transform=function(e,t){let i=`\
73#version 300 es
74#define SHADER_NAME gpu-aggregation-domain-vertex
75
76uniform sampler2D bins;
77
78#if NUM_DIMS == 1
79out float binIds;
80#else
81out vec2 binIds;
82#endif
83
84#if NUM_CHANNELS == 1
85flat out float values;
86#elif NUM_CHANNELS == 2
87flat out vec2 values;
88#else
89flat out vec3 values;
90#endif
91
92const float NAN = intBitsToFloat(-1);
93
94void main() {
95  int row = gl_VertexID / SAMPLER_WIDTH;
96  int col = gl_VertexID - row * SAMPLER_WIDTH;
97  vec4 weights = texelFetch(bins, ivec2(col, row), 0);
98  vec3 value3 = mix(
99    mix(weights.rgb, vec3(weights.a), aggregatorTransform.isCount),
100    weights.rgb / max(weights.a, 1.0),
101    aggregatorTransform.isMean
102  );
103  if (weights.a == 0.0) {
104    value3 = vec3(NAN);
105  }
106
107#if NUM_DIMS == 1
108  binIds = float(gl_VertexID + aggregatorTransform.binIdRange.x);
109#else
110  int y = gl_VertexID / (aggregatorTransform.binIdRange.y - aggregatorTransform.binIdRange.x);
111  int x = gl_VertexID - y * (aggregatorTransform.binIdRange.y - aggregatorTransform.binIdRange.x);
112  binIds.y = float(y + aggregatorTransform.binIdRange.z);
113  binIds.x = float(x + aggregatorTransform.binIdRange.x);
114#endif
115
116#if NUM_CHANNELS == 3
117  values = value3;
118#elif NUM_CHANNELS == 2
119  values = value3.xy;
120#else
121  values = value3.x;
122#endif
123
124  gl_Position = vec4(0., 0., 0., 1.);
125  // This model renders into a 2x1 texture to obtain min and max simultaneously.
126  // See comments in fragment shader
127  gl_PointSize = 2.0;
128}
129`,o=`\
130#version 300 es
131#define SHADER_NAME gpu-aggregation-domain-fragment
132
133precision highp float;
134
135#if NUM_CHANNELS == 1
136flat in float values;
137#elif NUM_CHANNELS == 2
138flat in vec2 values;
139#else
140flat in vec3 values;
141#endif
142
143out vec4 fragColor;
144
145void main() {
146  vec3 value3;
147#if NUM_CHANNELS == 3
148  value3 = values;
149#elif NUM_CHANNELS == 2
150  value3.xy = values;
151#else
152  value3.x = values;
153#endif
154  if (isnan(value3.x)) discard;
155  // This shader renders into a 2x1 texture with blending=max
156  // The left pixel yields the max value of each channel
157  // The right pixel yields the min value of each channel
158  if (gl_FragCoord.x < 1.0) {
159    fragColor = vec4(value3, 1.0);
160  } else {
161    fragColor = vec4(-value3, 1.0);
162  }
163}
164`;return new u.H(e,{vs:i,fs:o,topology:"point-list",modules:[c],parameters:{blend:!0,blendColorSrcFactor:"one",blendColorDstFactor:"one",blendColorOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one",blendAlphaOperation:"max"},defines:{NUM_DIMS:t.dimensions,NUM_CHANNELS:t.channelCount,SAMPLER_WIDTH:1024},varyings:["binIds","values"],disableWarnings:!0})}(e,t),this.domainFBO=n(e,2,1)}destroy(){this.transform.destroy(),this.binBuffer?.destroy(),this.valueBuffer?.destroy(),this.domainFBO.colorAttachments[0].texture.destroy(),this.domainFBO.destroy()}get domains(){if(!this._domains){let e=new Float32Array(this.device.readPixelsToArrayWebGL(this.domainFBO).buffer);this._domains=[[-e[4],e[0]],[-e[5],e[1]],[-e[6],e[2]]].slice(0,this.channelCount)}
164return this._domains}setDimensions(e,t){let{model:i,transformFeedback:o}=this.transform;i.setVertexCount(e);let n={binIdRange:[t[0][0],t[0][1],t[1]?.[0]||0,t[1]?.[1]||0]};i.shaderInputs.setProps({aggregatorTransform:n});let r=e*t.length*4;(!this.binBuffer||this.binBuffer.byteLength<r)&&(this.binBuffer?.destroy(),this.binBuffer=this.device.createBuffer({byteLength:r}),o.setBuffer("binIds",this.binBuffer));let s=e*this.channelCount*4;(!this.valueBuffer||this.valueBuffer.byteLength<s)&&(this.valueBuffer?.destroy(),this.valueBuffer=this.device.createBuffer({byteLength:s}),o.setBuffer("values",this.valueBuffer))}update(e,t){if(!e)return;let i=this.transform,o=this.domainFBO,n=[0,1,2].map(e=>"COUNT"===t[e]?1:0),r=[0,1,2].map(e=>"MEAN"===t[e]?1:0);i.model.shaderInputs.setProps({aggregatorTransform:{isCount:n,isMean:r,bins:e}}),i.run({id:"gpu-aggregation-domain",framebuffer:o,parameters:{viewport:[0,0,2,1]},clearColor:[-3e38,-3e38,-3e38,0],clearDepth:!1,clearStencil:!1}),this._domains=null}}var g=i(47717),d=i(12051);class p{static isSupported(e){return e.features.has("float32-renderable-webgl")&&e.features.has("texture-blend-float-webgl")}constructor(e,t){this.binCount=0,this.binIds=null,this.results=[],this.device=e,this.dimensions=t.dimensions,this.channelCount=t.channelCount,this.props={...t,pointCount:0,binIdRange:[[0,0]],operations:[],attributes:{},binOptions:{}},this.needsUpdate=Array(this.channelCount).fill(!0),this.binSorter=new l(e,t),this.aggregationTransform=new h(e,t),this.setProps(t)}getBins(){let e=this.aggregationTransform.binBuffer;return e?(this.binIds?.buffer!==e&&(this.binIds={buffer:e,type:"float32",size:this.dimensions}),this.binIds):null}getResult(e){let t=this.aggregationTransform.valueBuffer;return!t||e>=this.channelCount?null:(this.results[e]?.buffer!==t&&(this.results[e]={buffer:t,type:"float32",size:1,stride:4*this.channelCount,offset:4*e}),this.results[e])}getResultDomain(e){return this.aggregationTransform.domains[e]}getBin(e){let t;if(e<0||e>=this.binCount)return null;let{binIdRange:i}=this.props;if(1===this.dimensions)t=[e+i[0][0]];else{let[[o,n],[r]]=i,s=n-o;t=[e%s+o,Math.floor(e/s)+r]}let o=this.binSorter.getBinValues(e);if(!o)return null;let n=o[3],r=[];for(let e=0;e<this.channelCount;e++){let t=this.props.operations[e];"COUNT"===t?r[e]=n:0===n?r[e]=NaN:r[e]="MEAN"===t?o[e]/n:o[e]}return{id:t,value:r,count:n}}destroy(){this.binSorter.destroy(),this.aggregationTransform.destroy()}setProps(e){let t=this.props;if("binIdRange"in e&&!(0,g.v)(e.binIdRange,t.binIdRange,2)){let t=e.binIdRange;if(d.Z.assert(t.length===this.dimensions),1===this.dimensions){let[[e,i]]=t;this.binCount=i-e}else{let[[e,i],[o,n]]=t;this.binCount=(i-e)*(n-o)}this.binSorter.setDimensions(this.binCount,t),this.aggregationTransform.setDimensions(this.binCount,t),this.setNeedsUpdate()}if(e.operations)for(let i=0;i<this.channelCount;i++)e.operations[i]!==t.operations[i]&&this.setNeedsUpdate(i);if(void 0!==e.pointCount&&e.pointCount!==t.pointCount&&(this.binSorter.setModelProps({vertexCount:e.pointCount}),this.setNeedsUpdate()),e.binOptions&&((0,g.v)(e.binOptions,t.binOptions,2)||this.setNeedsUpdate(),this.binSorter.model.shaderInputs.setProps({binOptions:e.binOptions})),e.attributes){let t={},i={};for(let o of Object.values(e.attributes))for(let[e,n]of Object.entries(o.getValue()))ArrayBuffer.isView(n)?i[e]=n:n&&(t[e]=n);this.binSorter.setModelProps({attributes:t,constantAttributes:i})}e.shaderModuleProps&&this.binSorter.setModelProps({shaderModuleProps:e.shaderModuleProps}),Object.assign(this.props,e)}setNeedsUpdate(e){void 0===e?this.needsUpdate.fill(!0):this.needsUpdate[e]=!0}update(){}preDraw(){if(!this.needsUpdate.some(Boolean))return;let{operations:e}=this.props,t=this.needsUpdate.map((t,i)=>t?e[i]:null);this.binSorter.update(t),this.aggregationTransform.update(this.binSorter.texture,e);for(let e=0;e<this.channelCount;e++)this.needsUpdate[e]&&(this.needsUpdate[e]=!1,this.props.onUpdate?.({channel:e}))}}},99444:function(e,t,i){i.d(t,{K6:function(){return o},PI:function(){return n},UY:function(){return a},dq:function(){return s}});let o=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function n(e,t=!1,i=Float32Array){let o;if(Number.isFinite(e[0]))o=new i(e);else{o=new i(4*e.length);let t=0;for(let i=0;i<e.length;i++){let n=e[i];o[t++]=n[0],o[t++]=n[1],o[t++]=n[2],o[t++]=Number.isFinite(n[3])?n[3]:255}}if(t)for(let e=0;e<o.length;e++)o[e]/=255;return o}let r={linear:"linear",quantile:"nearest",quantize:"nearest",ordinal:"nearest"};function s(e,t){e.setSampler({minFilter:r[t],magFilter:r[t]})}function a(e,t,i="linear"){let o=n(t,!1,Uint8Array);return e.createTexture({format:"rgba8unorm",sampler:{minFilter:r[i],magFilter:r[i],addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},data:o,width:o.length/4,height:1})}},49601:function(e,t,i){i.d(t,{Z:function(){return F}});let o=new Float32Array(12);function n(e,t=2){let i=0;for(let n of e)for(let e=0;e<t;e++)o[i++]=n[e]||0;return o}var r=i(43002),s=i(68360),a=i(26296);class l{device;model;sampler;currentIndex=0;samplerTextureMap=null;bindings=[];resources={};constructor(e,t){this.device=e,this.sampler=e.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new s.H(this.device,{id:t.id||(0,a.h)("texture-transform-model"),fs:t.fs||(0,r.Ho)({input:t.targetTextureVarying,inputChannels:t.targetTextureChannels,output:"transform_output"}),vertexCount:t.vertexCount,...t}),this._initialize(t),Object.seal(this)}destroy(){for(let e of(this.model.destroy(),this.bindings))e.framebuffer?.destroy()}delete(){this.destroy()}run(e){let{framebuffer:t}=this.bindings[this.currentIndex],i=this.device.beginRenderPass({framebuffer:t,...e});this.model.draw(i),i.end(),this.device.submit()}getTargetTexture(){let{targetTexture:e}=this.bindings[this.currentIndex];return e}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}_initialize(e){this._updateBindings(e)}_updateBindings(e){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],e)}_updateBinding(e,{sourceBuffers:t,sourceTextures:i,targetTexture:o}){if(e||(e={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(e.sourceTextures,i),Object.assign(e.sourceBuffers,t),o){e.targetTexture=o;let{width:t,height:i}=o;e.framebuffer&&e.framebuffer.destroy(),e.framebuffer=this.device.createFramebuffer({
164id:"transform-framebuffer",width:t,height:i,colorAttachments:[o]}),e.framebuffer.resize({width:t,height:i})}return e}_setSourceTextureParameters(){let e=this.currentIndex,{sourceTextures:t}=this.bindings[e];for(let e in t)t[e].sampler=this.sampler}}var u=i(41569),c=i(85294),h=i(2782),g=i(12051),d=i(54334),p=`\
165#version 300 es
166#define SHADER_NAME heatp-map-layer-vertex-shader
167uniform sampler2D maxTexture;
168in vec3 positions;
169in vec2 texCoords;
170out vec2 vTexCoords;
171out float vIntensityMin;
172out float vIntensityMax;
173void main(void) {
174gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
175vTexCoords = texCoords;
176vec4 maxTexture = texture(maxTexture, vec2(0.5));
177float maxValue = triangle.aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
178float minValue = maxValue * triangle.threshold;
179if (triangle.colorDomain[1] > 0.) {
180maxValue = triangle.colorDomain[1];
181minValue = triangle.colorDomain[0];
182}
183vIntensityMax = triangle.intensity / maxValue;
184vIntensityMin = triangle.intensity / minValue;
185}
186`,f=`\
187#version 300 es
188#define SHADER_NAME triangle-layer-fragment-shader
189precision highp float;
190uniform sampler2D weightsTexture;
191uniform sampler2D colorTexture;
192in vec2 vTexCoords;
193in float vIntensityMin;
194in float vIntensityMax;
195out vec4 fragColor;
196vec4 getLinearColor(float value) {
197float factor = clamp(value * vIntensityMax, 0., 1.);
198vec4 color = texture(colorTexture, vec2(factor, 0.5));
199color.a *= min(value * vIntensityMin, 1.0);
200return color;
201}
202void main(void) {
203vec4 weights = texture(weightsTexture, vTexCoords);
204float weight = weights.r;
205if (triangle.aggregationMode > 0.5) {
206weight /= max(1.0, weights.a);
207}
208if (weight <= 0.) {
209discard;
210}
211vec4 linearColor = getLinearColor(weight);
212linearColor.a *= layer.opacity;
213fragColor = linearColor;
214}
215`;let m=`\
216uniform triangleUniforms {
217  float aggregationMode;
218  vec2 colorDomain;
219  float intensity;
220  float threshold;
221} triangle;
222`,v={name:"triangle",vs:m,fs:m,uniformTypes:{aggregationMode:"f32",colorDomain:"vec2<f32>",intensity:"f32",threshold:"f32"}};class x extends d.Z{getShaders(){return super.getShaders({vs:p,fs:f,modules:[u.Z,v]})}initializeState({device:e}){this.setState({model:this._getModel(e)})}_getModel(e){let{vertexCount:t,data:i}=this.props;return new s.H(e,{...this.getShaders(),id:this.props.id,attributes:i.attributes,bufferLayout:[{name:"positions",format:"float32x3"},{name:"texCoords",format:"float32x2"}],topology:"triangle-strip",vertexCount:t})}draw(){let{model:e}=this.state,{aggregationMode:t,colorDomain:i,intensity:o,threshold:n,colorTexture:r,maxTexture:s,weightsTexture:a}=this.props;e.shaderInputs.setProps({triangle:{aggregationMode:t,colorDomain:i,intensity:o,threshold:n,colorTexture:r,maxTexture:s,weightsTexture:a}}),e.draw(this.context.renderPass)}}x.layerName="TriangleLayer";var y=i(24958),b=i(99910);class C extends y.Z{initializeAggregationLayer(e){super.initializeState(this.context),this.setState({ignoreProps:function(e,t){let i={};for(let o in e)t.includes(o)||(i[o]=e[o]);return i}(this.constructor._propTypes,e.data.props),dimensions:e})}updateState(e){super.updateState(e);let{changeFlags:t}=e;if(t.extensionsChanged){let e=this.getShaders({});e&&e.defines&&(e.defines.NON_INSTANCED_MODEL=1),this.updateShaders(e)}this._updateAttributes()}updateAttributes(e){this.setState({changedAttributes:e})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){let{viewport:e,mousePosition:t,device:i}=this.context;return Object.assign(Object.create(this.props),{viewport:e,mousePosition:t,picking:{isActive:0},devicePixelRatio:i.canvasContext.cssToDeviceRatio()})}updateShaders(e){}isAggregationDirty(e,t={}){let{props:i,oldProps:o,changeFlags:n}=e,{compareAll:r=!1,dimension:s}=t,{ignoreProps:a}=this.state,{props:l,accessors:u=[]}=s,{updateTriggersChanged:c}=n;if(n.dataChanged)return!0;if(c){if(c.all)return!0;for(let e of u)if(c[e])return!0}if(r)return!!n.extensionsChanged||(0,b.tg)({oldProps:o,newProps:i,ignoreProps:a,propTypes:this.constructor._propTypes});for(let e of l)if(i[e]!==o[e])return!0;return!1}isAttributeChanged(e){let{changedAttributes:t}=this.state;return e?t&&void 0!==t[e]:!function(e){let t=!0;for(let i in e){t=!1;break}return t}(t)}_getAttributeManager(){return new h.Z(this.context.device,{id:this.props.id,stats:this.context.stats})}}C.layerName="AggregationLayer";var P=C,_=i(99444),S=`\
223#version 300 es
224in vec3 positions;
225in vec3 positions64Low;
226in float weights;
227out vec4 weightsTexture;
228void main()
229{
230weightsTexture = vec4(weights * weight.weightsScale, 0., 0., 1.);
231float radiusTexels = project_pixel_size(weight.radiusPixels) * weight.textureWidth / (weight.commonBounds.z - weight.commonBounds.x);
232gl_PointSize = radiusTexels * 2.;
233vec3 commonPosition = project_position(positions, positions64Low);
234gl_Position.xy = (commonPosition.xy - weight.commonBounds.xy) / (weight.commonBounds.zw - weight.commonBounds.xy) ;
235gl_Position.xy = (gl_Position.xy * 2.) - (1.);
236gl_Position.w = 1.0;
237}
238`,w=`\
239#version 300 es
240in vec4 weightsTexture;
241out vec4 fragColor;
242float gaussianKDE(float u){
243return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
244}
245void main()
246{
247float dist = length(gl_PointCoord - vec2(0.5, 0.5));
248if (dist > 0.5) {
249discard;
250}
251fragColor = weightsTexture * gaussianKDE(2. * dist);
252DECKGL_FILTER_COLOR(fragColor, geometry);
253}
254`,L=`\
255#version 300 es
256uniform sampler2D inTexture;
257out vec4 outTexture;
258void main()
259{
260int yIndex = gl_VertexID / int(maxWeight.textureSize);
261int xIndex = gl_VertexID - (yIndex * int(maxWeight.textureSize));
262vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / maxWeight.textureSize;
263outTexture = texture(inTexture, uv);
264gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
265gl_PointSize = 1.0;
266}
267`,A=`\
268#version 300 es
269in vec4 outTexture;
270out vec4 fragColor;
271void main() {
272fragColor = outTexture;
273fragColor.g = outTexture.r / max(1.0, outTexture.a);
274}
275`;let T={name:"weight",vs:`\
276uniform weightUniforms {
277  vec4 commonBounds;
278  float radiusPixels;
279  float textureWidth;
280  float weightsScale;
281} weight;
282`,uniformTypes:{commonBounds:"vec4<f32>",radiusPixels:"f32",textureWidth:"f32",weightsScale:"f32"}},M={name:"maxWeight",vs:`\
283uniform maxWeightUniforms {
284  float textureSize;
285} maxWeight;
286`,uniformTypes:{textureSize:"f32"}},I={format:"rgba8unorm",dimension:"2d",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},E=[0,0],z={SUM:0,MEAN:1},D={getPosition:{type:"accessor",value:e=>e.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50}
286,colorRange:_.K6,threshold:{type:"number",min:0,max:1,value:.05},colorDomain:{type:"array",value:null,optional:!0},aggregation:"SUM",weightsTextureSize:{type:"number",min:128,max:2048,value:2048},debounceTimeout:{type:"number",min:0,max:1e3,value:500}},N=["float32-renderable-webgl","texture-blend-float-webgl"],O={data:{props:["radiusPixels"]}};class R extends P{getShaders(e){let t=[u.Z];return e.modules&&(t=[...t,...e.modules]),super.getShaders({...e,modules:t})}initializeState(){super.initializeAggregationLayer(O),this.setState({colorDomain:E}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e),this._updateHeatmapState(e)}_updateHeatmapState(e){let{props:t,oldProps:i}=e,o=this._getChangeFlags(e);if((o.dataChanged||o.viewportChanged)&&(o.boundsChanged=this._updateBounds(o.dataChanged),this._updateTextureRenderingBounds()),o.dataChanged||o.boundsChanged){if(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0}),o.dataChanged){let e=this.getShaders({vs:S,fs:w});this._createWeightsTransform(e)}}else o.viewportZoomChanged&&this._debouncedUpdateWeightmap();t.colorRange!==i.colorRange&&this._updateColorTexture(e),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:e.context.viewport.zoom})}renderLayers(){let{weightsTexture:e,triPositionBuffer:t,triTexCoordBuffer:i,maxWeightsTexture:o,colorTexture:n,colorDomain:r}=this.state,{updateTriggers:s,intensity:a,threshold:l,aggregation:u}=this.props;return new(this.getSubLayerClass("triangle",x))(this.getSubLayerProps({id:"triangle-layer",updateTriggers:s}),{coordinateSystem:c.Df.DEFAULT,data:{attributes:{positions:t,texCoords:i}},vertexCount:4,maxTexture:o,colorTexture:n,aggregationMode:z[u]||0,weightsTexture:e,intensity:a,threshold:l,colorDomain:r})}finalizeState(e){super.finalizeState(e);let{weightsTransform:t,weightsTexture:i,maxWeightTransform:o,maxWeightsTexture:n,triPositionBuffer:r,triTexCoordBuffer:s,colorTexture:a,updateTimer:l}=this.state;t?.destroy(),i?.destroy(),o?.destroy(),n?.destroy(),r?.destroy(),s?.destroy(),a?.destroy(),l&&clearTimeout(l)}_getAttributeManager(){return new h.Z(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(e){let t={},{dimensions:i}=this.state;t.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(e,{compareAll:!0,dimension:i.data})&&"aggregation is dirty",t.viewportChanged=e.changeFlags.viewportChanged;let{zoom:o}=this.state;return e.context.viewport&&e.context.viewport.zoom===o||(t.viewportZoomChanged=!0),t}_createTextures(){let{textureSize:e,format:t}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...I,width:e,height:e,format:t}),maxWeightsTexture:this.context.device.createTexture({...I,width:1,height:1,format:t})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:e}=this.context,{weightsTextureSize:t}=this.props,i=Math.min(t,e.limits.maxTextureDimension2D),o=N.every(t=>e.features.has(t));this.setState({textureSize:i,format:o?"rgba32float":"rgba8unorm",weightsScale:o?1:1/255}),o||g.Z.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(e){let{weightsTransform:t}=this.state,{weightsTexture:i}=this.state,o=this.getAttributeManager();t?.destroy(),t=new l(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:o.getBufferLayouts(),vertexCount:1,targetTexture:i,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...e,modules:[...e.modules,T]}),this.setState({weightsTransform:t})}_setupResources(){this._createTextures();let{device:e}=this.context,{textureSize:t,weightsTexture:i,maxWeightsTexture:o}=this.state,n=this.getShaders({vs:S,fs:w});this._createWeightsTransform(n);let r=this.getShaders({vs:L,fs:A,modules:[M]}),s=new l(e,{id:`${this.id}-max-weights-transform`,targetTexture:o,...r,vertexCount:t*t,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}});s.model.shaderInputs.setProps({maxWeight:{inTexture:i,textureSize:t}}),this.setState({weightsTexture:i,maxWeightsTexture:o,maxWeightTransform:s,zoom:null,triPositionBuffer:e.createBuffer({byteLength:48}),triTexCoordBuffer:e.createBuffer({byteLength:48})})}updateShaders(e){this._createWeightsTransform({vs:S,fs:w,...e})}_updateMaxWeightValue(){let{maxWeightTransform:e}=this.state;e.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(e=!1){var t;let{viewport:i}=this.context,o=[i.unproject([0,0]),i.unproject([i.width,0]),i.unproject([0,i.height]),i.unproject([i.width,i.height])].map(e=>e.map(Math.fround)),n=function(e){let t=e.map(e=>e[0]),i=e.map(e=>e[1]),o=Math.min.apply(null,t),n=Math.max.apply(null,t);return[o,Math.min.apply(null,i),n,Math.max.apply(null,i)]}(o),r={visibleWorldBounds:n,viewportCorners:o},s=!1;if(e||!this.state.worldBounds||(t=this.state.worldBounds,!(n[0]>=t[0])||!(n[2]<=t[2])||!(n[1]>=t[1])||!(n[3]<=t[3]))){let e=this._worldToCommonBounds(n),t=this._commonToWorldBounds(e);this.props.coordinateSystem===c.Df.LNGLAT&&(t[1]=Math.max(t[1],-85.051129),t[3]=Math.min(t[3],85.051129),t[0]=Math.max(t[0],-360),t[2]=Math.min(t[2],360));let i=this._worldToCommonBounds(t);r.worldBounds=t,r.normalizedCommonBounds=i,s=!0}return this.setState(r),s}_updateTextureRenderingBounds(){let{triPositionBuffer:e,triTexCoordBuffer:t,normalizedCommonBounds:i,viewportCorners:o}=this.state,{viewport:r}=this.context;e.write(n(o,3));let s=o.map(e=>(function(e,t){let[i,o,n,r]=t;return[(e[0]-i)/(n-i),(e[1]-o)/(r-o)]})(r.projectPosition(e),i));t.write(n(s,2))}
286_updateColorTexture(e){let{colorRange:t}=e.props,{colorTexture:i}=this.state,o=(0,_.PI)(t,!1,Uint8Array);i?.destroy(),i=this.context.device.createTexture({...I,data:o,width:t.length,height:1}),this.setState({colorTexture:i})}_updateWeightmap(){let{radiusPixels:e,colorDomain:t,aggregation:i}=this.props,{worldBounds:o,textureSize:n,weightsScale:r,weightsTexture:s}=this.state,a=this.state.weightsTransform;this.state.isWeightMapDirty=!1;let l=this._worldToCommonBounds(o,{useLayerCoordinateSystem:!0});if(t&&"SUM"===i){let{viewport:e}=this.context,i=e.distanceScales.metersPerUnit[2]*(l[2]-l[0])/n;this.state.colorDomain=t.map(e=>e*i*r)}else this.state.colorDomain=t||E;let u=this.getAttributeManager().getAttributes(),c=this.getModuleSettings();this._setModelAttributes(a.model,u),a.model.setVertexCount(this.getNumInstances());let{viewport:h,devicePixelRatio:g,coordinateSystem:d,coordinateOrigin:p}=c,{modelMatrix:f}=this.props;a.model.shaderInputs.setProps({project:{viewport:h,devicePixelRatio:g,modelMatrix:f,coordinateSystem:d,coordinateOrigin:p},weight:{radiusPixels:e,commonBounds:l,textureWidth:n,weightsScale:r,weightsTexture:s}}),a.run({parameters:{viewport:[0,0,n,n]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(e=!1){let{updateTimer:t}=this.state,{debounceTimeout:i}=this.props;e?(t=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(t),t=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),i)),this.setState({updateTimer:t})}_worldToCommonBounds(e,t={}){let i,o;let{useLayerCoordinateSystem:n=!1}=t,[r,s,a,l]=e,{viewport:u}=this.context,{textureSize:h}=this.state,{coordinateSystem:g}=this.props,d=n&&(g===c.Df.LNGLAT_OFFSETS||g===c.Df.METER_OFFSETS),p=d?u.projectPosition(this.props.coordinateOrigin):[0,0],f=2*h/u.scale;return n&&!d?(i=this.projectPosition([r,s,0]),o=this.projectPosition([a,l,0])):(i=u.projectPosition([r,s,0]),o=u.projectPosition([a,l,0])),function(e,t,i){let[o,n,r,s]=e,a=r-o,l=s-n,u=a,c=l;a/l<t/i?u=t/i*l:c=i/t*a,u<t&&(u=t,c=i);let h=(r+o)/2,g=(s+n)/2;return[h-u/2,g-c/2,h+u/2,g+c/2]}([i[0]-p[0],i[1]-p[1],o[0]-p[0],o[1]-p[1]],f,f)}_commonToWorldBounds(e){let[t,i,o,n]=e,{viewport:r}=this.context,s=r.unprojectPosition([t,i]),a=r.unprojectPosition([o,n]);return s.slice(0,2).concat(a.slice(0,2))}}R.layerName="HeatmapLayer",R.defaultProps=D;var F=R},25709:function(e,t,i){i.d(t,{Z:function(){return M}});var o=i(12051),n=i(41569),r=i(88789),s=i(68824),a=i(84097),l=i(50107),u=i(68089),c=i(99444);class h{constructor(e,t){this.props={scaleType:"linear",lowerPercentile:0,upperPercentile:100},this.domain=null,this.cutoff=null,this.input=e,this.inputLength=t,this.attribute=e}getScalePercentile(){if(!this._percentile){let e=g(this.input,this.inputLength);this._percentile=function(e,t=100){let i=Array.from(e).filter(Number.isFinite).sort(d),o=0,n=Math.max(1,t),r=Array(n-1);for(;++o<n;)r[o-1]=function(e,t){let i=e.length;if(t<=0||i<2)return e[0];if(t>=1)return e[i-1];let o=(i-1)*t,n=Math.floor(o),r=e[n];return r+(e[n+1]-r)*(o-n)}(i,o/n);return{attribute:{value:e.map(e=>Number.isFinite(e)?function(e,t){let i=0,o=e.length;for(;i<o;){let n=i+o>>>1;e[n]>t?o=n:i=n+1}return i}(r,e):NaN),type:"float32",size:1},domain:r}}(e)}return this._percentile}getScaleOrdinal(){if(!this._ordinal){let e=g(this.input,this.inputLength);this._ordinal=function(e){let t=new Set;for(let i of e)Number.isFinite(i)&&t.add(i);let i=Array.from(t).sort(),o=new Map;for(let e=0;e<i.length;e++)o.set(i[e],e);return{attribute:{value:e.map(e=>Number.isFinite(e)?o.get(e):NaN),type:"float32",size:1},domain:i}}(e)}return this._ordinal}getCutoff({scaleType:e,lowerPercentile:t,upperPercentile:i}){if("quantile"===e)return[t,i-1];if(t>0||i<100){let{domain:o}=this.getScalePercentile(),n=o[Math.floor(t)-1]??-1/0,r=o[Math.floor(i)-1]??1/0;if("ordinal"===e){let{domain:e}=this.getScaleOrdinal();n=e.findIndex(e=>e>=n),-2==(r=e.findIndex(e=>e>r)-1)&&(r=e.length-1)}return[n,r]}return null}update(e){let t=this.props;if(e.scaleType!==t.scaleType)switch(e.scaleType){case"quantile":{let{attribute:e}=this.getScalePercentile();this.attribute=e,this.domain=[0,99];break}case"ordinal":{let{attribute:e,domain:t}=this.getScaleOrdinal();this.attribute=e,this.domain=[0,t.length-1];break}default:this.attribute=this.input,this.domain=null}return(e.scaleType!==t.scaleType||e.lowerPercentile!==t.lowerPercentile||e.upperPercentile!==t.upperPercentile)&&(this.cutoff=this.getCutoff(e)),this.props=e,this}}function g(e,t){let i=(e.stride??4)/4,o=(e.offset??0)/4,n=e.value;
286if(!n){let o=e.buffer?.readSyncWebGL(0,4*i*t);o&&(n=new Float32Array(o.buffer),e.value=n)}if(1===i)return n.subarray(0,t);let r=new Float32Array(t);for(let e=0;e<t;e++)r[e]=n[e*i+o];return r}function d(e,t){return e-t}var p=i(48618);let f=Math.PI/3,m=2*Math.sin(f),v=Array.from({length:6},(e,t)=>{let i=t*f;return[Math.sin(i),-Math.cos(i)]});function x([e,t],i){let o=Math.round(t=t/i/1.5),n=Math.round(e=e/i/m-(1&o)/2),r=t-o;if(3*Math.abs(r)>1){let i=e-n,s=n+(e<n?-1:1)/2,a=o+(t<o?-1:1),l=e-s,u=t-a;i*i+r*r>l*l+u*u&&(n=s+(1&o?1:-1)/2,o=a)}return[n,o]}let y=`
287const vec2 DIST = vec2(${m}, 1.5);
288
289ivec2 pointToHexbin(vec2 p, float radius) {
290  p /= radius * DIST;
291  float pj = round(p.y);
292  float pjm2 = mod(pj, 2.0);
293  p.x -= pjm2 * 0.5;
294  float pi = round(p.x);
295  vec2 d1 = p - vec2(pi, pj);
296
297  if (abs(d1.y) * 3. > 1.) {
298    vec2 v2 = step(0.0, d1) - 0.5;
299    v2.y *= 2.0;
300    vec2 d2 = d1 - v2;
301    if (dot(d1, d1) > dot(d2, d2)) {
302      pi += v2.x + pjm2 - 0.5;
303      pj += v2.y;
304    }
305  }
306  return ivec2(pi, pj);
307}
308`;function b([e,t],i){return[(e+(1&t)/2)*i*m,t*i*1.5]}let C=`
309const vec2 DIST = vec2(${m}, 1.5);
310
311vec2 hexbinCentroid(vec2 binId, float radius) {
312  binId.x += fract(binId.y * 0.5);
313  return binId * DIST * radius;
314}
315`;var P=`\
316#version 300 es
317#define SHADER_NAME hexagon-cell-layer-vertex-shader
318in vec3 positions;
319in vec3 normals;
320in vec2 instancePositions;
321in float instanceElevationValues;
322in float instanceColorValues;
323in vec3 instancePickingColors;
324uniform sampler2D colorRange;
325out vec4 vColor;
326${C}
327float interp(float value, vec2 domain, vec2 range) {
328float r = min(max((value - domain.x) / (domain.y - domain.x), 0.), 1.);
329return mix(range.x, range.y, r);
330}
331vec4 interp(float value, vec2 domain, sampler2D range) {
332float r = (value - domain.x) / (domain.y - domain.x);
333return texture(range, vec2(r, 0.5));
334}
335void main(void) {
336geometry.pickingColor = instancePickingColors;
337if (isnan(instanceColorValues) ||
338instanceColorValues < hexagon.colorDomain.z ||
339instanceColorValues > hexagon.colorDomain.w ||
340instanceElevationValues < hexagon.elevationDomain.z ||
341instanceElevationValues > hexagon.elevationDomain.w
342) {
343gl_Position = vec4(0.);
344return;
345}
346vec2 commonPosition = hexbinCentroid(instancePositions, column.radius) + (hexagon.originCommon - project.commonOrigin.xy);
347commonPosition += positions.xy * column.radius * column.coverage;
348geometry.position = vec4(commonPosition, 0.0, 1.0);
349geometry.normal = project_normal(normals);
350float elevation = 0.0;
351if (column.extruded) {
352elevation = interp(instanceElevationValues, hexagon.elevationDomain.xy, hexagon.elevationRange);
353elevation = project_size(elevation);
354geometry.position.z = (positions.z + 1.0) / 2.0 * elevation;
355}
356gl_Position = project_common_position_to_clipspace(geometry.position);
357DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
358vColor = interp(instanceColorValues, hexagon.colorDomain.xy, colorRange);
359vColor.a *= layer.opacity;
360if (column.extruded) {
361vColor.rgb = lighting_getLightColor(vColor.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
362}
363DECKGL_FILTER_COLOR(vColor, geometry);
364}
365`;let _={name:"hexagon",vs:`\
366uniform hexagonUniforms {
367  vec4 colorDomain;
368  vec4 elevationDomain;
369  vec2 elevationRange;
370  vec2 originCommon;
371} hexagon;
372`,uniformTypes:{colorDomain:"vec4<f32>",elevationDomain:"vec4<f32>",elevationRange:"vec2<f32>",originCommon:"vec2<f32>"}};class S extends p.Z{getShaders(){let e=super.getShaders();return e.modules.push(_),{...e,vs:P}}initializeState(){super.initializeState();let e=this.getAttributeManager();e.remove(["instanceElevations","instanceFillColors","instanceLineColors","instanceStrokeWidths"]),e.addInstanced({instancePositions:{size:2,type:"float32",accessor:"getBin"},instanceColorValues:{size:1,type:"float32",accessor:"getColorValue"},instanceElevationValues:{size:1,type:"float32",accessor:"getElevationValue"}})}updateState(e){super.updateState(e);let{props:t,oldProps:i}=e,o=this.state.fillModel;if(i.colorRange!==t.colorRange){this.state.colorTexture?.destroy(),this.state.colorTexture=(0,c.UY)(this.context.device,t.colorRange,t.colorScaleType);let e={colorRange:this.state.colorTexture};o.shaderInputs.setProps({hexagon:e})}else i.colorScaleType!==t.colorScaleType&&(0,c.dq)(this.state.colorTexture,t.colorScaleType)}finalizeState(e){super.finalizeState(e),this.state.colorTexture?.destroy()}draw({uniforms:e}){let{radius:t,hexOriginCommon:i,elevationRange:o,elevationScale:n,extruded:r,coverage:s,colorDomain:a,elevationDomain:l}=this.props,u=this.props.colorCutoff||[-1/0,1/0],c=this.props.elevationCutoff||[-1/0,1/0],h=this.state.fillModel;h.vertexArray.indexBuffer&&h.setIndexBuffer(null),h.setVertexCount(this.state.fillVertexCount);let g={colorDomain:[Math.max(a[0],u[0]),Math.min(a[1],u[1]),Math.max(a[0]-1,u[0]),Math.min(a[1]+1,u[1])],elevationDomain:[Math.max(l[0],c[0]),Math.min(l[1],c[1]),Math.max(l[0]-1,c[0]),Math.min(l[1]+1,c[1])],elevationRange:[o[0]*n,o[1]*n],originCommon:i};h.shaderInputs.setProps({column:{extruded:r,coverage:s,radius:t},hexagon:g}),h.draw(this.context.renderPass)}}S.layerName="HexagonCellLayer";
372let w={name:"binOptions",vs:`\
373uniform binOptionsUniforms {
374  vec2 hexOriginCommon;
375  float radiusCommon;
376} binOptions;
377`,uniformTypes:{hexOriginCommon:"vec2<f32>",radiusCommon:"f32"}};function L(){}let A={gpuAggregation:!0,colorDomain:null,colorRange:c.K6,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:L,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScaleType:"linear",onSetElevationDomain:L,radius:{type:"number",min:1,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:e=>e.position},hexagonAggregator:{type:"function",optional:!0,value:null},extruded:!1,material:!0};class T extends u.Z{getAggregatorType(){let{gpuAggregation:e,hexagonAggregator:t,getColorValue:i,getElevationValue:n}=this.props;return e&&(t||i||n)?(o.Z.warn("Features not supported by GPU aggregation, falling back to CPU")(),"cpu"):e&&a.C.isSupported(this.context.device)?"gpu":"cpu"}createAggregator(e){if("cpu"===e){let{hexagonAggregator:e,radius:t}=this.props;return new l._({dimensions:2,getBin:{sources:["positions"],getValue:({positions:i},o,n)=>{if(e)return e(i,t);let r=this.state.aggregatorViewport.projectPosition(i),{radiusCommon:s,hexOriginCommon:a}=n;return x([r[0]-a[0],r[1]-a[1]],s)}},getValue:[{sources:["colorWeights"],getValue:({colorWeights:e})=>e},{sources:["elevationWeights"],getValue:({elevationWeights:e})=>e}]})}return new a.C(this.context.device,{dimensions:2,channelCount:2,bufferLayout:this.getAttributeManager().getBufferLayouts({isInstanced:!1}),...super.getShaders({modules:[n.Z,w],vs:`
378  in vec3 positions;
379  in vec3 positions64Low;
380  in float colorWeights;
381  in float elevationWeights;
382  
383  ${y}
384
385  void getBin(out ivec2 binId) {
386    vec3 positionCommon = project_position(positions, positions64Low);
387    binId = pointToHexbin(positionCommon.xy, binOptions.radiusCommon);
388  }
389  void getValue(out vec2 value) {
390    value = vec2(colorWeights, elevationWeights);
391  }
392  `})})}initializeState(){super.initializeState(),this.getAttributeManager().add({positions:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},colorWeights:{size:1,accessor:"getColorWeight"},elevationWeights:{size:1,accessor:"getElevationWeight"}})}updateState(e){let t=super.updateState(e),{props:i,oldProps:o,changeFlags:n}=e,{aggregator:s}=this.state;if((n.dataChanged||!this.state.dataAsArray)&&(i.getColorValue||i.getElevationValue)&&(this.state.dataAsArray=Array.from((0,r.jB)(i.data).iterable)),t||n.dataChanged||i.radius!==o.radius||i.getColorValue!==o.getColorValue||i.getElevationValue!==o.getElevationValue||i.colorAggregation!==o.colorAggregation||i.elevationAggregation!==o.elevationAggregation){this._updateBinOptions();let{radiusCommon:e,hexOriginCommon:t,binIdRange:o,dataAsArray:n}=this.state;if(s.setProps({binIdRange:o,pointCount:this.getNumInstances(),operations:[i.colorAggregation,i.elevationAggregation],binOptions:{radiusCommon:e,hexOriginCommon:t},onUpdate:this._onAggregationUpdate.bind(this)}),n){let{getColorValue:e,getElevationValue:t}=this.props;s.setProps({customOperations:[e&&(t=>e(t.map(e=>n[e]),{indices:t,data:i.data})),t&&(e=>t(e.map(e=>n[e]),{indices:e,data:i.data}))]})}}return n.updateTriggersChanged&&n.updateTriggersChanged.getColorValue&&s.setNeedsUpdate(0),n.updateTriggersChanged&&n.updateTriggersChanged.getElevationValue&&s.setNeedsUpdate(1),t}_updateBinOptions(){let e=this.getBounds(),t=1,i=[0,0],o=[[0,1],[0,1]],n=this.context.viewport;if(e&&Number.isFinite(e[0][0])){let r=[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2],{radius:a}=this.props,{unitsPerMeter:l}=n.getDistanceScales(r);t=l[0]*a;
392let u=x(n.projectFlat(r),t);r=n.unprojectFlat(b(u,t));let c=n.constructor;i=[Math.fround((n=n.isGeospatial?new c({longitude:r[0],latitude:r[1],zoom:12}):new s.Z({position:[r[0],r[1],0],zoom:12})).center[0]),Math.fround(n.center[1])],o=function({dataBounds:e,getBinId:t,padding:i=0}){let o=[e[0],e[1],[e[0][0],e[1][1]],[e[1][0],e[0][1]]].map(e=>t(e)),n=Math.min(...o.map(e=>e[0]))-i,r=Math.min(...o.map(e=>e[1]))-i;return[[n,Math.max(...o.map(e=>e[0]))+i+1],[r,Math.max(...o.map(e=>e[1]))+i+1]]}({dataBounds:e,getBinId:e=>{let o=n.projectFlat(e);return o[0]-=i[0],o[1]-=i[1],x(o,t)},padding:1})}this.setState({radiusCommon:t,hexOriginCommon:i,binIdRange:o,aggregatorViewport:n})}draw(e){e.shaderModuleProps.project&&(e.shaderModuleProps.project.viewport=this.state.aggregatorViewport),super.draw(e)}_onAggregationUpdate({channel:e}){let t=this.getCurrentLayer().props,{aggregator:i}=this.state;if(0===e){let e=i.getResult(0);this.setState({colors:new h(e,i.binCount)}),t.onSetColorDomain(i.getResultDomain(0))}else if(1===e){let e=i.getResult(1);this.setState({elevations:new h(e,i.binCount)}),t.onSetElevationDomain(i.getResultDomain(1))}}onAttributeChange(e){let{aggregator:t}=this.state;switch(e){case"positions":t.setNeedsUpdate(),this._updateBinOptions();let{radiusCommon:i,hexOriginCommon:o,binIdRange:n}=this.state;t.setProps({binIdRange:n,binOptions:{radiusCommon:i,hexOriginCommon:o}});break;case"colorWeights":t.setNeedsUpdate(0);break;case"elevationWeights":t.setNeedsUpdate(1)}}renderLayers(){let{aggregator:e,radiusCommon:t,hexOriginCommon:i}=this.state,{elevationScale:o,colorRange:n,elevationRange:r,extruded:s,coverage:a,material:l,transitions:u,colorScaleType:c,lowerPercentile:h,upperPercentile:g,colorDomain:d,elevationScaleType:p,elevationLowerPercentile:f,elevationUpperPercentile:m,elevationDomain:x}=this.props,y=this.getSubLayerClass("cells",S),b=e.getBins(),C=this.state.colors?.update({scaleType:c,lowerPercentile:h,upperPercentile:g}),P=this.state.elevations?.update({scaleType:p,lowerPercentile:f,upperPercentile:m});return C&&P?new y(this.getSubLayerProps({id:"cells"}),{data:{length:e.binCount,attributes:{getBin:b,getColorValue:C.attribute,getElevationValue:P.attribute}},dataComparator:(e,t)=>e.length===t.length,updateTriggers:{getBin:[b],getColorValue:[C.attribute],getElevationValue:[P.attribute]}
392,diskResolution:6,vertices:v,radius:t,hexOriginCommon:i,elevationScale:o,colorRange:n,colorScaleType:c,elevationRange:r,extruded:s,coverage:a,material:l,colorDomain:C.domain||d||e.getResultDomain(0),elevationDomain:P.domain||x||e.getResultDomain(1),colorCutoff:C.cutoff,elevationCutoff:P.cutoff,transitions:u&&{getFillColor:u.getColorValue||u.getColorWeight,getElevation:u.getElevationValue||u.getElevationWeight},extensions:[]}):null}getPickingInfo(e){let t=e.info,{index:i}=t;if(i>=0){let e;let o=this.state.aggregator.getBin(i);if(o){let t=b(o.id,this.state.radiusCommon),i=this.context.viewport.unprojectFlat(t);e={col:o.id[0],row:o.id[1],position:i,colorValue:o.value[0],elevationValue:o.value[1],count:o.count},o.pointIndices&&(e.pointIndices=o.pointIndices,e.points=Array.isArray(this.props.data)?o.pointIndices.map(e=>this.props.data[e]):[])}t.object=e}return t}}T.layerName="HexagonLayer",T.defaultProps=A;var M=T},63648:function(e,t,i){i.d(t,{Z:function(){return y}});var o=i(41569),n=i(84097),r=i(50107),s=i(68089),a=i(68360),l=i(78882),u=i(54334),c=i(71718),h=i(99444),g=`\
393#version 300 es
394#define SHADER_NAME screen-grid-layer-vertex-shader
395#define RANGE_COUNT 6
396in vec2 positions;
397in vec2 instancePositions;
398in float instanceWeights;
399in vec3 instancePickingColors;
400uniform sampler2D colorRange;
401out vec4 vColor;
402vec4 interp(float value, vec2 domain, sampler2D range) {
403float r = (value - domain.x) / (domain.y - domain.x);
404return texture(range, vec2(r, 0.5));
405}
406void main(void) {
407if (isnan(instanceWeights)) {
408gl_Position = vec4(0.);
409return;
410}
411vec2 pos = instancePositions * screenGrid.gridSizeClipspace + positions * screenGrid.cellSizeClipspace;
412pos.x = pos.x - 1.0;
413pos.y = 1.0 - pos.y;
414gl_Position = vec4(pos, 0., 1.);
415vColor = interp(instanceWeights, screenGrid.colorDomain, colorRange);
416vColor.a *= layer.opacity;
417picking_setPickingColor(instancePickingColors);
418}
419`,d=`\
420#version 300 es
421#define SHADER_NAME screen-grid-layer-fragment-shader
422precision highp float;
423in vec4 vColor;
424out vec4 fragColor;
425void main(void) {
426fragColor = vColor;
427DECKGL_FILTER_COLOR(fragColor, geometry);
428}
429`;let p={name:"screenGrid",vs:`\
430uniform screenGridUniforms {
431  vec2 cellSizeClipspace;
432  vec2 gridSizeClipspace;
433  vec2 colorDomain;
434} screenGrid;
435`,uniformTypes:{cellSizeClipspace:"vec2<f32>",gridSizeClipspace:"vec2<f32>",colorDomain:"vec2<f32>"}};class f extends u.Z{getShaders(){return super.getShaders({vs:g,fs:d,modules:[c.Z,p]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:2,type:"float32",accessor:"getBin"},instanceWeights:{size:1,type:"float32",accessor:"getWeight"}}),this.state.model=this._getModel()}updateState(e){super.updateState(e);let{props:t,oldProps:i,changeFlags:o}=e,n=this.state.model;if(i.colorRange!==t.colorRange){this.state.colorTexture?.destroy(),this.state.colorTexture=(0,h.UY)(this.context.device,t.colorRange,t.colorScaleType);let e={colorRange:this.state.colorTexture};n.shaderInputs.setProps({screenGrid:e})}else i.colorScaleType!==t.colorScaleType&&(0,h.dq)(this.state.colorTexture,t.colorScaleType);if(i.cellMarginPixels!==t.cellMarginPixels||i.cellSizePixels!==t.cellSizePixels||o.viewportChanged){let{width:e,height:t}=this.context.viewport,{cellSizePixels:i,cellMarginPixels:o}=this.props,r=Math.max(i-o,0);n.shaderInputs.setProps({screenGrid:{gridSizeClipspace:[i/e*2,i/t*2],cellSizeClipspace:[r/e*2,r/t*2]}})}}finalizeState(e){super.finalizeState(e),this.state.colorTexture?.destroy()}draw({uniforms:e}){let t=this.props.colorDomain(),i=this.state.model;i.shaderInputs.setProps({screenGrid:{colorDomain:t}}),i.draw(this.context.renderPass)}_getModel(){return new a.H(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new l.Z({topology:"triangle-strip",attributes:{positions:{value:new Float32Array([0,0,1,0,0,1,1,1]),size:2}}}),isInstanced:!0})}}f.layerName="ScreenGridCellLayer";let m={name:"binOptions",vs:`\
436uniform binOptionsUniforms {
437  float cellSizePixels;
438} binOptions;
439`,uniformTypes:{cellSizePixels:"f32"}},v={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0},colorRange:h.K6,colorScaleType:"linear",getPosition:{type:"accessor",value:e=>e.position},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM"};class x extends s.Z{getAggregatorType(){return this.props.gpuAggregation&&n.C.isSupported(this.context.device)?"gpu":"cpu"}createAggregator(e){return"cpu"!==e&&n.C.isSupported(this.context.device)?new n.C(this.context.device,{dimensions:2,channelCount:1,bufferLayout:this.getAttributeManager().getBufferLayouts({isInstanced:!1}),...super.getShaders({modules:[o.Z,m],vs:`
440  in vec3 positions;
441  in vec3 positions64Low;
442  in float counts;
443  
444  void getBin(out ivec2 binId) {
445    vec4 pos = project_position_to_clipspace(positions, positions64Low, vec3(0.0));
446    vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize / project.devicePixelRatio;
447    vec2 gridCoords = floor(screenCoords / binOptions.cellSizePixels);
448    binId = ivec2(gridCoords);
449  }
450  void getValue(out float weight) {
451    weight = counts;
452  }
453  `})}):new r._({dimensions:2,getBin:{sources:["positions"],getValue:({positions:e},t,i)=>{let o=this.context.viewport,n=o.project(e),r=i.cellSizePixels;return n[0]<0||n[0]>=o.width||n[1]<0||n[1]>=o.height?null:[Math.floor(n[0]/r),Math.floor(n[1]/r)]}},getValue:[{sources:["counts"],getValue:({counts:e})=>e}]})}initializeState(){super.initializeState(),this.getAttributeManager().add({positions:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},counts:{size:1,accessor:"getWeight"}})}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){let t=super.updateState(e),{props:i,oldProps:o,changeFlags:r}=e,{cellSizePixels:s,aggregation:a}=i;if(t||r.dataChanged||r.updateTriggersChanged||r.viewportChanged||a!==o.aggregation||s!==o.cellSizePixels){let{width:e,height:t}=this.context.viewport,{aggregator:i}=this.state;i instanceof n.C&&i.setProps({binIdRange:[[0,Math.ceil(e/s)],[0,Math.ceil(t/s)]]}),i.setProps({pointCount:this.getNumInstances(),operations:[a],binOptions:{cellSizePixels:s}})}return r.viewportChanged&&this.state.aggregator.setNeedsUpdate(),t}onAttributeChange(e){let{aggregator:t}=this.state;switch(e){case"positions":t.setNeedsUpdate();break;
453case"counts":t.setNeedsUpdate(0)}}renderLayers(){let{aggregator:e}=this.state,t=this.getSubLayerClass("cells",f),i=e.getBins(),o=e.getResult(0);return new t(this.props,this.getSubLayerProps({id:"cell-layer"}),{data:{length:e.binCount,attributes:{getBin:i,getWeight:o}},dataComparator:(e,t)=>e.length===t.length,updateTriggers:{getBin:[i],getWeight:[o]},parameters:{depthWriteEnabled:!1,...this.props.parameters},colorDomain:()=>this.props.colorDomain||e.getResultDomain(0),extensions:[]})}getPickingInfo(e){let t=e.info,{index:i}=t;if(i>=0){let e;let o=this.state.aggregator.getBin(i);o&&(e={col:o.id[0],row:o.id[1],value:o.value[0],count:o.count},o.pointIndices&&(e.pointIndices=o.pointIndices,e.points=Array.isArray(this.props.data)?o.pointIndices.map(e=>this.props.data[e]):[])),t.object=e}return t}}x.layerName="ScreenGridLayer",x.defaultProps=v;var y=x},11411:function(e,t,i){i.d(t,{Z:function(){return a}});var o=i(88789),n=i(84650),r=i(78675),s=i(2411);class a{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;let{attributes:t={}}=e;this.typedArrayManager=n.Z,this.attributes={},this._attributeDefs=t,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);let{data:t,buffers:i={},getGeometry:o,geometryBuffer:n,positionFormat:s,dataChanged:a,normalize:l=!0}=this.opts;if(this.data=t,this.getGeometry=o,this.positionSize=n&&n.size||("XY"===s?2:3),this.buffers=i,this.normalize=l,n&&((0,r.Z)(t.startIndices),this.getGeometry=this.getGeometryFromBuffer(n),l||(i.vertexPositions=n)),this.geometryBuffer=i.vertexPositions,Array.isArray(a))for(let e of a)this._rebuildGeometry(e);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:t}){this._rebuildGeometry({startRow:e,endRow:t})}getGeometryFromBuffer(e){let t=e.value||e;return ArrayBuffer.isView(t)?(0,o.jr)(t,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,t){let{attributes:i,buffers:o,_attributeDefs:n,typedArrayManager:r}=this;for(let s in n)if(s in o)r.release(i[s]),i[s]=null;else{let o=n[s];o.copy=t,i[s]=r.allocate(i[s],e,o)}}_forEachGeometry(e,t,i){let{data:n,getGeometry:r}=this,{iterable:s,objectInfo:a}=(0,o.jB)(n,t,i);for(let t of s)a.index++,e(r?r(t,a):null,a.index)}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:t,vertexStarts:i,instanceCount:o}=this,{data:n,geometryBuffer:r}=this,{startRow:a=0,endRow:l=1/0}=e||{},u={};if(e||(t=[0],i=[0]),this.normalize||!r)this._forEachGeometry((e,t)=>{let o=e&&this.normalizeGeometry(e);u[t]=o,i[t+1]=i[t]+(o?this.getGeometrySize(o):0)},a,l),o=i[i.length-1];else if(o=(i=n.startIndices)[n.length]||0,ArrayBuffer.isView(r))o=o||r.length/this.positionSize;else if(r instanceof s.l){let e=4*this.positionSize;o=o||r.byteLength/e}else if(r.buffer){let e=r.stride||4*this.positionSize;o=o||r.buffer.byteLength/e}else if(r.value){let e=r.value,t=r.stride/e.BYTES_PER_ELEMENT||this.positionSize;o=o||e.length/t}this._allocate(o,!!e),this.indexStarts=t,this.vertexStarts=i,this.instanceCount=o;let c={};this._forEachGeometry((e,n)=>{let r=u[n]||e;c.vertexStart=i[n],c.indexStart=t[n];let s=n<i.length-1?i[n+1]:o;c.geometrySize=s-i[n],c.geometryIndex=n,this.updateGeometryAttributes(r,c)},a,l),this.vertexCount=t[t.length-1]}}},48618:function(e,t,i){i.d(t,{Z:function(){return S}});var o=i(54334),n=i(41569),r=i(71718),s=i(85294),a=i(46803),l=i(40854),u=i(15460);let c={name:"phongMaterial",dependencies:[a.h],source:l.i,vs:u._,fs:u.Z,defines:{LIGHTING_FRAGMENT:!0},uniformTypes:{ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{ambient:.35,diffuse:.6,shininess:32,specularColor:[.15,.15,.15]},getUniforms(e){let t={...e};return t.specularColor&&(t.specularColor=t.specularColor.map(e=>e/255)),{...c.defaultUniforms,...t}}};var h=i(83354),g=i(68360),d=i(12051),p=i(78882),f=i(40502);class m extends p.Z{constructor(e){let{indices:t,attributes:i}=function(e){let{radius:t,height:i=1,nradial:o=10}=e,{vertices:n}=e;n&&(d.Z.assert(n.length>=o),n=n.flatMap(e=>[e[0],e[1]]),(0,f.Ny)(n,f.wG.COUNTER_CLOCKWISE));let r=i>0,s=o+1,a=r?3*s+1:o,l=2*Math.PI/o,u=new Uint16Array(r?6*o:0),c=new Float32Array(3*a),h=new Float32Array(3*a),g=0;if(r){for(let e=0;e<s;e++){let r=e*l,s=e%o,a=Math.sin(r),u=Math.cos(r);for(let e=0;e<2;e++)c[g+0]=n?n[2*s]:u*t,c[g+1]=n?n[2*s+1]:a*t,c[g+2]=(.5-e)*i,h[g+0]=n?n[2*s]:u,h[g+1]=n?n[2*s+1]:a,g+=3}c[g+0]=c[g-3],c[g+1]=c[g-2],c[g+2]=c[g-1],g+=3}for(let e=r?0:1;e<s;e++){let r=Math.floor(e/2)*Math.sign(.5-e%2),s=r*l,a=(r+o)%o,u=Math.sin(s),d=Math.cos(s);c[g+0]=n?n[2*a]:d*t,c[g+1]=n?n[2*a+1]:u*t,c[g+2]=i/2,h[g+2]=1,g+=3}if(r){let e=0;for(let t=0;t<o;t++)u[e++]=2*t+0,u[e++]=2*t+2,u[e++]=2*t+0,u[e++]=2*t+1,u[e++]=2*t+1,u[e++]=2*t+3}return{indices:u,attributes:{POSITION:{size:3,value:c},NORMAL:{size:3,value:h}}}}(e);super({...e,indices:t,attributes:i})}}let v=`\
454uniform columnUniforms {
455  float radius;
456  float angle;
457  vec2 offset;
458  bool extruded;
459  bool stroked;
460  bool isStroke;
461  float coverage;
462  float elevationScale;
463  float edgeDistance;
464  float widthScale;
465  float widthMinPixels;
466  float widthMaxPixels;
467  highp int radiusUnits;
468  highp int widthUnits;
469} column;
470`,x={name:"column",vs:v,fs:v,uniformTypes:{radius:"f32",angle:"f32",offset:"vec2<f32>",extruded:"f32",stroked:"f32",isStroke:"f32",coverage:"f32",elevationScale:"f32",edgeDistance:"f32",widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",radiusUnits:"i32",widthUnits:"i32"}};var y=`#version 300 es
471#define SHADER_NAME column-layer-vertex-shader
472in vec3 positions;
473in vec3 normals;
474in vec3 instancePositions;
475in float instanceElevations;
476in vec3 instancePositions64Low;
477in vec4 instanceFillColors;
478in vec4 instanceLineColors;
479in float instanceStrokeWidths;
480in vec3 instancePickingColors;
481out vec4 vColor;
482#ifdef FLAT_SHADING
483out vec3 cameraPosition;
484out vec4 position_commonspace;
485#endif
486void main(void) {
487geometry.worldPosition = instancePositions;
488vec4 color = column.isStroke ? instanceLineColors : instanceFillColors;
489mat2 rotationMatrix = mat2(cos(column.angle), sin(column.angle), -sin(column.angle), cos(column.angle));
490float elevation = 0.0;
491float strokeOffsetRatio = 1.0;
492if (column.extruded) {
493elevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale;
494} else if (column.stroked) {
495float widthPixels = clamp(
496project_size_to_pixel(instanceStrokeWidths * column.widthScale, column.widthUnits),
497column.widthMinPixels, column.widthMaxPixels) / 2.0;
498float halfOffset = project_pixel_size(widthPixels) / project_size(column.edgeDistance * column.coverage * column.radius);
499if (column.isStroke) {
500strokeOffsetRatio -= sign(positions.z) * halfOffset;
501} else {
502strokeOffsetRatio -= halfOffset;
503}
504}
505float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);
506float dotRadius = column.radius * column.coverage * shouldRender;
507geometry.pickingColor = instancePickingColors;
508vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);
509vec3 centroidPosition64Low = instancePositions64Low;
510vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + column.offset) * dotRadius;
511if (column.radiusUnits == UNIT_METERS) {
512offset = project_size(offset);
513}
514vec3 pos = vec3(offset, 0.);
515DECKGL_FILTER_SIZE(pos, geometry);
516gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
517geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));
518DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
519if (column.extruded && !column.isStroke) {
520#ifdef FLAT_SHADING
521cameraPosition = project.cameraPosition;
522position_commonspace = geometry.position;
523vColor = vec4(color.rgb, color.a * layer.opacity);
524#else
525vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
526vColor = vec4(lightColor, color.a * layer.opacity);
527#endif
528} else {
529vColor = vec4(color.rgb, color.a * layer.opacity);
530}
531DECKGL_FILTER_COLOR(vColor, geometry);
532}
533`,b=`#version 300 es
534#define SHADER_NAME column-layer-fragment-shader
535precision highp float;
536out vec4 fragColor;
537in vec4 vColor;
538#ifdef FLAT_SHADING
539in vec3 cameraPosition;
540in vec4 position_commonspace;
541#endif
542void main(void) {
543fragColor = vColor;
544geometry.uv = vec2(0.);
545#ifdef FLAT_SHADING
546if (column.extruded && !column.isStroke && !bool(picking.isActive)) {
547vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
548fragColor.rgb = lighting_getLightColor(vColor.rgb, cameraPosition, position_commonspace.xyz, normal);
549}
550#endif
551DECKGL_FILTER_COLOR(fragColor, geometry);
552}
553`;let C=[0,0,0,255],P={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:e=>e.position},getFillColor:{type:"accessor",value:C},getLineColor:{type:"accessor",value:C},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0,getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class _ extends o.Z{getShaders(){let e={},{flatShading:t}=this.props;return t&&(e.FLAT_SHADING=1),super.getShaders({vs:y,fs:b,defines:e,modules:[n.Z,t?c:h.u,r.Z,x]})}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:C},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:C},instanceStrokeWidths:{size:1,accessor:"getLineWidth",transition:!0}})}updateState(e){super.updateState(e);let{props:t,oldProps:i,changeFlags:o}=e,n=o.extensionsChanged||t.flatShading!==i.flatShading;
553n&&(this.state.models?.forEach(e=>e.destroy()),this.setState(this._getModels()),this.getAttributeManager().invalidateAll());let r=this.getNumInstances();this.state.fillModel.setInstanceCount(r),this.state.wireframeModel.setInstanceCount(r),(n||t.diskResolution!==i.diskResolution||t.vertices!==i.vertices||(t.extruded||t.stroked)!==(i.extruded||i.stroked))&&this._updateGeometry(t)}getGeometry(e,t,i){let o=new m({radius:1,height:i?2:0,vertices:t,nradial:e}),n=0;if(t)for(let i=0;i<e;i++){let o=t[i];n+=Math.sqrt(o[0]*o[0]+o[1]*o[1])/e}else n=1;return this.setState({edgeDistance:Math.cos(Math.PI/e)*n}),o}_getModels(){let e=this.getShaders(),t=this.getAttributeManager().getBufferLayouts(),i=new g.H(this.context.device,{...e,id:`${this.props.id}-fill`,bufferLayout:t,isInstanced:!0}),o=new g.H(this.context.device,{...e,id:`${this.props.id}-wireframe`,bufferLayout:t,isInstanced:!0});return{fillModel:i,wireframeModel:o,models:[o,i]}}_updateGeometry({diskResolution:e,vertices:t,extruded:i,stroked:o}){let n=this.getGeometry(e,t,i||o);this.setState({fillVertexCount:n.attributes.POSITION.value.length/3});let r=this.state.fillModel,s=this.state.wireframeModel;r.setGeometry(n),r.setTopology("triangle-strip"),r.setIndexBuffer(null),s.setGeometry(n),s.setTopology("line-list")}draw({uniforms:e}){let{lineWidthUnits:t,lineWidthScale:i,lineWidthMinPixels:o,lineWidthMaxPixels:n,radiusUnits:r,elevationScale:a,extruded:l,filled:u,stroked:c,wireframe:h,offset:g,coverage:d,radius:p,angle:f}=this.props,m=this.state.fillModel,v=this.state.wireframeModel,{fillVertexCount:x,edgeDistance:y}=this.state,b={radius:p,angle:f/180*Math.PI,offset:g,extruded:l,stroked:c,coverage:d,elevationScale:a,edgeDistance:y,radiusUnits:s.iI[r],widthUnits:s.iI[t],widthScale:i,widthMinPixels:o,widthMaxPixels:n};l&&h&&(v.shaderInputs.setProps({column:{...b,isStroke:!0}}),v.draw(this.context.renderPass)),u&&(m.setVertexCount(x),m.shaderInputs.setProps({column:{...b,isStroke:!1}}),m.draw(this.context.renderPass)),!l&&c&&(m.setVertexCount(2*x/3),m.shaderInputs.setProps({column:{...b,isStroke:!0}}),m.draw(this.context.renderPass))}}_.layerName="ColumnLayer",_.defaultProps=P;var S=_},38244:function(e,t,i){i.d(t,{Z:function(){return C}});var o=i(54334),n=i(41569),r=i(71718),s=i(85294),a=i(78882),l=i(68360),u=i(11411),c=i(40502);class h extends u.Z{constructor(e){super({...e,attributes:{positions:{size:3,padding:18,initialize:!0,type:e.fp64?Float64Array:Float32Array},segmentTypes:{size:1,type:Uint8ClampedArray}}})}get(e){return this.attributes[e]}getGeometryFromBuffer(e){return this.normalize?super.getGeometryFromBuffer(e):null}normalizeGeometry(e){return this.normalize?function(e,t,i,o){let n;if(Array.isArray(e[0])){n=Array(e.length*t);for(let i=0;i<e.length;i++)for(let o=0;o<t;o++)n[i*t+o]=e[i][o]||0}else n=e;return i?(0,c.dj)(n,{size:t,gridResolution:i}):o?(0,c.ct)(n,{size:t}):n}(e,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):e}getGeometrySize(e){if(g(e)){let t=0;for(let i of e)t+=this.getGeometrySize(i);return t}let t=this.getPathLength(e);return t<2?0:this.isClosed(e)?t<3?0:t+2:t}updateGeometryAttributes(e,t){if(0!==t.geometrySize){if(e&&g(e))for(let i of e){let e=this.getGeometrySize(i);t.geometrySize=e,this.updateGeometryAttributes(i,t),t.vertexStart+=e}else this._updateSegmentTypes(e,t),this._updatePositions(e,t)}}_updateSegmentTypes(e,t){let i=this.attributes.segmentTypes,o=!!e&&this.isClosed(e),{vertexStart:n,geometrySize:r}=t;i.fill(0,n,n+r),o?(i[n]=4,i[n+r-2]=4):(i[n]+=1,i[n+r-2]+=2),i[n+r-1]=4}_updatePositions(e,t){let{positions:i}=this.attributes;if(!i||!e)return;let{vertexStart:o,geometrySize:n}=t,r=[,,,];for(let t=o,s=0;s<n;t++,s++)this.getPointOnPath(e,s,r),i[3*t]=r[0],i[3*t+1]=r[1],i[3*t+2]=r[2]}getPathLength(e){return e.length/this.positionSize}getPointOnPath(e,t,i=[]){let{positionSize:o}=this;t*o>=e.length&&(t+=1-e.length/o);let n=t*o;return i[0]=e[n],i[1]=e[n+1],i[2]=3===o&&e[n+2]||0,i}isClosed(e){if(!this.normalize)return!!this.opts.loop;let{positionSize:t}=this,i=e.length-t;return e[0]===e[i]&&e[1]===e[i+1]&&(2===t||e[2]===e[i+2])}}function g(e){return Array.isArray(e[0])}let d=`\
554uniform pathUniforms {
555  float widthScale;
556  float widthMinPixels;
557  float widthMaxPixels;
558  float jointType;
559  float capType;
560  float miterLimit;
561  bool billboard;
562  highp int widthUnits;
563} path;
564`,p={name:"path",vs:d,fs:d,uniformTypes:{widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",jointType:"f32",capType:"f32",miterLimit:"f32",billboard:"f32",widthUnits:"i32"}};var f=`\
565#version 300 es
566#define SHADER_NAME path-layer-vertex-shader
567in vec2 positions;
568in float instanceTypes;
569in vec3 instanceStartPositions;
570in vec3 instanceEndPositions;
571in vec3 instanceLeftPositions;
572in vec3 instanceRightPositions;
573in vec3 instanceLeftPositions64Low;
574in vec3 instanceStartPositions64Low;
575in vec3 instanceEndPositions64Low;
576in vec3 instanceRightPositions64Low;
577in float instanceStrokeWidths;
578in vec4 instanceColors;
579in vec3 instancePickingColors;
580uniform float opacity;
581out vec4 vColor;
582out vec2 vCornerOffset;
583out float vMiterLength;
584out vec2 vPathPosition;
585out float vPathLength;
586out float vJointType;
587const float EPSILON = 0.001;
588const vec3 ZERO_OFFSET = vec3(0.0);
589float flipIfTrue(bool flag) {
590return -(float(flag) * 2. - 1.);
591}
592vec3 getLineJoinOffset(
593vec3 prevPoint, vec3 currPoint, vec3 nextPoint,
594vec2 width
595) {
596bool isEnd = positions.x > 0.0;
597float sideOfPath = positions.y;
598float isJoint = float(sideOfPath == 0.0);
599vec3 deltaA3 = (currPoint - prevPoint);
600vec3 deltaB3 = (nextPoint - currPoint);
601mat3 rotationMatrix;
602bool needsRotation = !path.billboard && project_needs_rotation(currPoint, rotationMatrix);
603if (needsRotation) {
604deltaA3 = deltaA3 * rotationMatrix;
605deltaB3 = deltaB3 * rotationMatrix;
606}
607vec2 deltaA = deltaA3.xy / width;
608vec2 deltaB = deltaB3.xy / width;
609float lenA = length(deltaA);
610float lenB = length(deltaB);
611vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);
612vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);
613vec2 perpA = vec2(-dirA.y, dirA.x);
614vec2 perpB = vec2(-dirB.y, dirB.x);
615vec2 tangent = dirA + dirB;
616tangent = length(tangent) > 0. ? normalize(tangent) : perpA;
617vec2 miterVec = vec2(-tangent.y, tangent.x);
618vec2 dir = isEnd ? dirA : dirB;
619vec2 perp = isEnd ? perpA : perpB;
620float L = isEnd ? lenA : lenB;
621float sinHalfA = abs(dot(miterVec, perp));
622float cosHalfA = abs(dot(dirA, miterVec));
623float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);
624float cornerPosition = sideOfPath * turnDirection;
625float miterSize = 1.0 / max(sinHalfA, EPSILON);
626miterSize = mix(
627min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),
628miterSize,
629step(0.0, cornerPosition)
630);
631vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))
632* (sideOfPath + isJoint * turnDirection);
633bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));
634bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));
635bool isCap = isStartCap || isEndCap;
636if (isCap) {
637offsetVec = mix(perp * sideOfPath, dir * path.capType * 4.0 * flipIfTrue(isStartCap), isJoint);
638vJointType = path.capType;
639} else {
640vJointType = path.jointType;
641}
642vPathLength = L;
643vCornerOffset = offsetVec;
644vMiterLength = dot(vCornerOffset, miterVec * turnDirection);
645vMiterLength = isCap ? isJoint : vMiterLength;
646vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);
647vPathPosition = vec2(
648dot(offsetFromStartOfPath, perp),
649dot(offsetFromStartOfPath, dir)
650);
651geometry.uv = vPathPosition;
652float isValid = step(instanceTypes, 3.5);
653vec3 offset = vec3(offsetVec * width * isValid, 0.0);
654if (needsRotation) {
655offset = rotationMatrix * offset;
656}
657return offset;
658}
659void clipLine(inout vec4 position, vec4 refPosition) {
660if (position.w < EPSILON) {
661float r = (EPSILON - refPosition.w) / (position.w - refPosition.w);
662position = refPosition + (position - refPosition) * r;
663}
664}
665void main() {
666geometry.pickingColor = instancePickingColors;
667vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);
668float isEnd = positions.x;
669vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);
670vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);
671vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);
672vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);
673vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);
674vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);
675geometry.worldPosition = currPosition;
676vec2 widthPixels = vec2(clamp(
677project_size_to_pixel(instanceStrokeWidths * path.widthScale, path.widthUnits),
678path.widthMinPixels, path.widthMaxPixels) / 2.0);
679vec3 width;
680if (path.billboard) {
681vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);
682vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);
683vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);
684clipLine(prevPositionScreen, currPositionScreen);
685clipLine(nextPositionScreen, currPositionScreen);
686clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));
687width = vec3(widthPixels, 0.0);
688DECKGL_FILTER_SIZE(width, geometry);
689vec3 offset = getLineJoinOffset(
690prevPositionScreen.xyz / prevPositionScreen.w,
691currPositionScreen.xyz / currPositionScreen.w,
692nextPositionScreen.xyz / nextPositionScreen.w,
693project_pixel_size_to_clipspace(width.xy)
694);
695DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry);
696gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w);
697} else {
698prevPosition = project_position(prevPosition, prevPosition64Low);
699currPosition = project_position(currPosition, currPosition64Low);
700nextPosition = project_position(nextPosition, nextPosition64Low);
701width = vec3(project_pixel_size(widthPixels), 0.0);
702DECKGL_FILTER_SIZE(width, geometry);
703vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy);
704geometry.position = vec4(currPosition + offset, 1.0);
705gl_Position = project_common_position_to_clipspace(geometry.position);
706DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
707}
708DECKGL_FILTER_COLOR(vColor, geometry);
709}
710`,m=`\
711#version 300 es
712#define SHADER_NAME path-layer-fragment-shader
713precision highp float;
714in vec4 vColor;
715in vec2 vCornerOffset;
716in float vMiterLength;
717in vec2 vPathPosition;
718in float vPathLength;
719in float vJointType;
720out vec4 fragColor;
721void main(void) {
722geometry.uv = vPathPosition;
723if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {
724if (vJointType > 0.5 && length(vCornerOffset) > 1.0) {
725discard;
726}
727if (vJointType < 0.5 && vMiterLength > path.miterLimit + 1.0) {
728discard;
729}
730}
731fragColor = vColor;
732DECKGL_FILTER_COLOR(fragColor, geometry);
733}
734`;let v=[0,0,0,255],x={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:e=>e.path},getColor:{type:"accessor",value:v},getWidth:{type:"accessor",value:1}
734,rounded:{deprecatedFor:["jointRounded","capRounded"]}},y={enter:(e,t)=>t.length?t.subarray(t.length-e.length):e};class b extends o.Z{getShaders(){return super.getShaders({vs:f,fs:m,modules:[n.Z,r.Z,p]})}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:y,accessor:"getPath",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:"uint8",update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:y,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:y,defaultValue:v},instancePickingColors:{size:4,type:"uint8",accessor:(e,{index:t,target:i})=>this.encodePickingColor(e&&e.__source?e.__source.index:t,i)}}),this.setState({pathTesselator:new h({fp64:this.use64bitPositions()})})}updateState(e){super.updateState(e);let{props:t,changeFlags:i}=e,o=this.getAttributeManager();if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPath)){let{pathTesselator:e}=this.state,n=t.data.attributes||{};e.updateGeometry({data:t.data,geometryBuffer:n.getPath,buffers:n,normalize:!t._pathType,loop:"loop"===t._pathType,getGeometry:t.getPath,positionFormat:t.positionFormat,wrapLongitude:t.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:i.dataChanged}),this.setState({numInstances:e.instanceCount,startIndices:e.vertexStarts}),i.dataChanged||o.invalidateAll()}i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),o.invalidateAll())}getPickingInfo(e){let t=super.getPickingInfo(e),{index:i}=t,o=this.props.data;return o[0]&&o[0].__source&&(t.object=o.find(e=>e.__source.index===i)),t}disablePickingIndex(e){let t=this.props.data;if(t[0]&&t[0].__source)for(let i=0;i<t.length;i++)t[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{jointRounded:t,capRounded:i,billboard:o,miterLimit:n,widthUnits:r,widthScale:a,widthMinPixels:l,widthMaxPixels:u}=this.props,c=this.state.model,h={jointType:Number(t),capType:Number(i),billboard:o,widthUnits:s.iI[r],widthScale:a,miterLimit:n,widthMinPixels:l,widthMaxPixels:u};c.shaderInputs.setProps({path:h}),c.draw(this.context.renderPass)}_getModel(){return new l.H(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new a.Z({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(e){let{pathTesselator:t}=this.state;e.startIndices=t.vertexStarts,e.value=t.get("positions")}calculateSegmentTypes(e){let{pathTesselator:t}=this.state;e.startIndices=t.vertexStarts,e.value=t.get("segmentTypes")}}b.defaultProps=x,b.layerName="PathLayer";var C=b},14972:function(e,t,i){i.d(t,{Z:function(){return G}});var o=i(24958),n=i(12051),r=i(88789),s=i(54334),a=i(41569),l=i(71718),u=i(85294),c=i(68360),h=i(78882),g=i(83354),d=i(93719),p=i(40502);let f=p.wG.CLOCKWISE,m=p.wG.COUNTER_CLOCKWISE,v={isClosed:!0};function x(e){return"positions"in e?e.positions:e}function y(e){return"holeIndices"in e?e.holeIndices:null}function b(e,t,i,o,n){let r=t,s=i.length;for(let t=0;t<s;t++)for(let n=0;n<o;n++)e[r++]=i[t][n]||0;if(!function(e){let t=e[0],i=e[e.length-1];return t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]}(i))for(let t=0;t<o;t++)e[r++]=i[0][t]||0;return v.start=t,v.end=r,v.size=o,(0,p.Ny)(e,n,v),r}function C(e,t,i,o,n=0,r,s){let a=(r=r||i.length)-n;if(a<=0)return t;let l=t;for(let t=0;t<a;t++)e[l++]=i[n+t];if(!function(e,t,i,o){for(let n=0;n<t;n++)if(e[i+n]!==e[o-t+n])return!1;return!0}(i,o,n,r))for(let t=0;t<o;t++)e[l++]=i[n+t];return v.start=t,v.end=l,v.size=o,(0,p.Ny)(e,s,v),l}function P(e,t){var i;!function(e){if(!Array.isArray(e=e&&e.positions||e)&&!ArrayBuffer.isView(e))throw Error("invalid polygon")}(e);let o=[],n=[];if("positions"in e){let{positions:i,holeIndices:r}=e;if(r){let e=0;for(let s=0;s<=r.length;s++)e=C(o,e,i,t,r[s-1],r[s],0===s?f:m),n.push(e);return n.pop(),{positions:o,holeIndices:n}}e=i}if(!Array.isArray(e[0]))return C(o,0,e,t,0,o.length,f),o;if(!((i=e).length>=1&&i[0].length>=2&&Number.isFinite(i[0][0]))){let i=0;for(let[r,s]of e.entries())i=b(o,i,s,t,0===r?f:m),n.push(i);return n.pop(),{positions:o,holeIndices:n}}return b(o,0,e,t,f),o}function _(e,t,i){let o=e.length/3,n=0;for(let r=0;r<o;r++){let s=(r+1)%o;n+=e[3*r+t]*e[3*s+i],n-=e[3*s+t]*e[3*r+i]}return Math.abs(n/2)}function S(e,t,i,o){let n=e.length/3;for(let r=0;r<n;r++){let n=3*r,s=e[n+0],a=e[n+1],l=e[n+2];e[n+t]=s,e[n+i]=a,e[n+o]=l}}var w=i(11411);class L extends w.Z{constructor(e){let{fp64:t,IndexType:i=Uint32Array}=e;super({...e,attributes:{positions:{size:3,type:t?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:i,size:1}}})}get(e){let{attributes:t}=this;return"indices"===e?t.indices&&t.indices.subarray(0,this.vertexCount):t[e]}updateGeometry(e){super.updateGeometry(e);let t=this.buffers.indices;if(t)this.vertexCount=(t.value||t).length;else if(this.data&&!this.getGeometry)throw Error("missing indices buffer")}normalizeGeometry(e){if(this.normalize){let t=P(e,this.positionSize);return this.opts.resolution?(0,p.WZ)(x(t),y(t),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?(0,p.GU)(x(t),y(t),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):t}return e}getGeometrySize(e){if(A(e)){let t=0;for(let i of e)t+=this.getGeometrySize(i);return t}return x(e).length/this.positionSize}getGeometryFromBuffer(e){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(e):null}updateGeometryAttributes(e,t){if(e&&A(e))for(let i of e){let e=this.getGeometrySize(i);t.geometrySize=e,this.updateGeometryAttributes(i,t),t.vertexStart+=e,t.indexStart=this.indexStarts[t.geometryIndex+1]}else this._updateIndices(e,t),this._updatePositions(e,t),this._updateVertexValid(e,t)}
734_updateIndices(e,{geometryIndex:t,vertexStart:i,indexStart:o}){let{attributes:n,indexStarts:r,typedArrayManager:s}=this,a=n.indices;if(!a||!e)return;let l=o,u=function(e,t,i,o){let n=y(e);n&&(n=n.map(e=>e/t));let r=x(e),s=o&&3===t;if(i){let e=r.length;r=r.slice();let o=[];for(let n=0;n<e;n+=t){o[0]=r[n],o[1]=r[n+1],s&&(o[2]=r[n+2]);let e=i(o);r[n]=e[0],r[n+1]=e[1],s&&(r[n+2]=e[2])}}if(s){let e=_(r,0,1),t=_(r,0,2),o=_(r,1,2);if(!e&&!t&&!o)return[];e>t&&e>o||(t>o?(i||(r=r.slice()),S(r,0,2,1)):(i||(r=r.slice()),S(r,2,0,1)))}return d(r,n,t)}(e,this.positionSize,this.opts.preproject,this.opts.full3d);a=s.allocate(a,o+u.length,{copy:!0});for(let e=0;e<u.length;e++)a[l++]=u[e]+i;r[t+1]=o+u.length,n.indices=a}_updatePositions(e,{vertexStart:t,geometrySize:i}){let{attributes:{positions:o},positionSize:n}=this;if(!o||!e)return;let r=x(e);for(let e=t,s=0;s<i;e++,s++){let t=r[s*n],i=r[s*n+1],a=n>2?r[s*n+2]:0;o[3*e]=t,o[3*e+1]=i,o[3*e+2]=a}}_updateVertexValid(e,{vertexStart:t,geometrySize:i}){let{positionSize:o}=this,n=this.attributes.vertexValid,r=e&&y(e);if(e&&e.edgeTypes?n.set(e.edgeTypes,t):n.fill(1,t,t+i),r)for(let e=0;e<r.length;e++)n[t+r[e]/o-1]=0;n[t+i-1]=0}}function A(e){return Array.isArray(e)&&e.length>0&&!Number.isFinite(e[0])}let T=`\
735uniform solidPolygonUniforms {
736  bool extruded;
737  bool isWireframe;
738  float elevationScale;
739} solidPolygon;
740`,M={name:"solidPolygon",vs:T,fs:T,uniformTypes:{extruded:"f32",isWireframe:"f32",elevationScale:"f32"}};var I=`\
741in vec4 fillColors;
742in vec4 lineColors;
743in vec3 pickingColors;
744out vec4 vColor;
745struct PolygonProps {
746vec3 positions;
747vec3 positions64Low;
748vec3 normal;
749float elevations;
750};
751vec3 project_offset_normal(vec3 vector) {
752if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
753project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {
754return normalize(vector * project.commonUnitsPerWorldUnit);
755}
756return project_normal(vector);
757}
758void calculatePosition(PolygonProps props) {
759vec3 pos = props.positions;
760vec3 pos64Low = props.positions64Low;
761vec3 normal = props.normal;
762vec4 colors = solidPolygon.isWireframe ? lineColors : fillColors;
763geometry.worldPosition = props.positions;
764geometry.pickingColor = pickingColors;
765if (solidPolygon.extruded) {
766pos.z += props.elevations * solidPolygon.elevationScale;
767}
768gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);
769DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
770if (solidPolygon.extruded) {
771#ifdef IS_SIDE_VERTEX
772normal = project_offset_normal(normal);
773#else
774normal = project_normal(normal);
775#endif
776geometry.normal = normal;
777vec3 lightColor = lighting_getLightColor(colors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
778vColor = vec4(lightColor, colors.a * layer.opacity);
779} else {
780vColor = vec4(colors.rgb, colors.a * layer.opacity);
781}
782DECKGL_FILTER_COLOR(vColor, geometry);
783}
784`,E=`\
785#version 300 es
786#define SHADER_NAME solid-polygon-layer-vertex-shader
787in vec3 vertexPositions;
788in vec3 vertexPositions64Low;
789in float elevations;
790${I}
791void main(void) {
792PolygonProps props;
793props.positions = vertexPositions;
794props.positions64Low = vertexPositions64Low;
795props.elevations = elevations;
796props.normal = vec3(0.0, 0.0, 1.0);
797calculatePosition(props);
798}
799`,z=`\
800#version 300 es
801#define SHADER_NAME solid-polygon-layer-vertex-shader-side
802#define IS_SIDE_VERTEX
803in vec2 positions;
804in vec3 vertexPositions;
805in vec3 nextVertexPositions;
806in vec3 vertexPositions64Low;
807in vec3 nextVertexPositions64Low;
808in float elevations;
809in float instanceVertexValid;
810${I}
811void main(void) {
812if(instanceVertexValid < 0.5){
813gl_Position = vec4(0.);
814return;
815}
816PolygonProps props;
817vec3 pos;
818vec3 pos64Low;
819vec3 nextPos;
820vec3 nextPos64Low;
821#if RING_WINDING_ORDER_CW == 1
822pos = vertexPositions;
823pos64Low = vertexPositions64Low;
824nextPos = nextVertexPositions;
825nextPos64Low = nextVertexPositions64Low;
826#else
827pos = nextVertexPositions;
828pos64Low = nextVertexPositions64Low;
829nextPos = vertexPositions;
830nextPos64Low = vertexPositions64Low;
831#endif
832props.positions = mix(pos, nextPos, positions.x);
833props.positions64Low = mix(pos64Low, nextPos64Low, positions.x);
834props.normal = vec3(
835pos.y - nextPos.y + (pos64Low.y - nextPos64Low.y),
836nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x),
8370.0);
838props.elevations = elevations * positions.y;
839calculatePosition(props);
840}
841`,D=`\
842#version 300 es
843#define SHADER_NAME solid-polygon-layer-fragment-shader
844precision highp float;
845in vec4 vColor;
846out vec4 fragColor;
847void main(void) {
848fragColor = vColor;
849geometry.uv = vec2(0.);
850DECKGL_FILTER_COLOR(fragColor, geometry);
851}
852`;let N=[0,0,0,255],O={enter:(e,t)=>t.length?t.subarray(t.length-e.length):e};class R extends s.Z{getShaders(e){return super.getShaders({vs:"top"===e?E:z,fs:D,defines:{RING_WINDING_ORDER_CW:this.props._normalize||"CCW"!==this.props._windingOrder?1:0},modules:[a.Z,g.u,l.Z,M]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let e;let{viewport:t}=this.context,{coordinateSystem:i}=this.props,{_full3d:o}=this.props;t.isGeospatial&&i===u.Df.DEFAULT&&(i=u.Df.LNGLAT),i===u.Df.LNGLAT&&(e=o?t.projectPosition.bind(t):t.projectFlat.bind(t)),this.setState({numInstances:0,polygonTesselator:new L({preproject:e,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let n=this.getAttributeManager();n.remove(["instancePickingColors"]),n.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:!0},vertexPositions:{size:3,type:"float64",stepMode:"dynamic",fp64:this.use64bitPositions(),transition:O,accessor:"getPolygon",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{nextVertexPositions:{vertexOffset:1}}},instanceVertexValid:{size:1,type:"uint16",stepMode:"instance",update:this.calculateVertexValid,noAlloc:!0},elevations:{size:1,stepMode:"dynamic",transition:O,accessor:"getElevation"},fillColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:O,accessor:"getFillColor",defaultValue:N},lineColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:O,accessor:"getLineColor",defaultValue:N},pickingColors:{size:4,type:"uint8",stepMode:"dynamic",accessor:(e,{index:t,target:i})=>this.encodePickingColor(e&&e.__source?e.__source.index:t,i)}})}getPickingInfo(e){let t=super.getPickingInfo(e),{index:i}=t,o=this.props.data;return o[0]&&o[0].__source&&(t.object=o.find(e=>e.__source.index===i)),t}disablePickingIndex(e){let t=this.props.data;if(t[0]&&t[0].__source)for(let i=0;i<t.length;i++)t[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{extruded:t,filled:i,wireframe:o,elevationScale:n}=this.props,{topModel:r,sideModel:s,wireframeModel:a,polygonTesselator:l}=this.state,u={extruded:!!t,elevationScale:n,isWireframe:!1};a&&o&&(a.setInstanceCount(l.instanceCount-1),a.shaderInputs.setProps({solidPolygon:{...u,isWireframe:!0}}),a.draw(this.context.renderPass)),s&&i&&(s.setInstanceCount(l.instanceCount-1),s.shaderInputs.setProps({solidPolygon:u}),s.draw(this.context.renderPass)),r&&i&&(r.setVertexCount(l.vertexCount),r.shaderInputs.setProps({solidPolygon:u}),r.draw(this.context.renderPass))}updateState(e){super.updateState(e),this.updateGeometry(e);let{props:t,oldProps:i,changeFlags:o}=e,n=this.getAttributeManager();(o.extensionsChanged||t.filled!==i.filled||t.extruded!==i.extruded)&&(this.state.models?.forEach(e
852=>e.destroy()),this.setState(this._getModels()),n.invalidateAll())}updateGeometry({props:e,oldProps:t,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:t}=this.state,o=e.data.attributes||{};t.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:o.getPolygon,buffers:o,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(){let e,t,i;let{id:o,filled:n,extruded:r}=this.props;if(n){let t=this.getShaders("top");t.defines.NON_INSTANCED_MODEL=1;let i=this.getAttributeManager().getBufferLayouts({isInstanced:!1});e=new c.H(this.context.device,{...t,id:`${o}-top`,topology:"triangle-list",bufferLayout:i,isIndexed:!0,userData:{excludeAttributes:{instanceVertexValid:!0}}})}if(r){let e=this.getAttributeManager().getBufferLayouts({isInstanced:!0});t=new c.H(this.context.device,{...this.getShaders("side"),id:`${o}-side`,bufferLayout:e,geometry:new h.Z({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}),i=new c.H(this.context.device,{...this.getShaders("side"),id:`${o}-wireframe`,bufferLayout:e,geometry:new h.Z({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:[t,i,e].filter(Boolean),topModel:e,sideModel:t,wireframeModel:i}}calculateIndices(e){let{polygonTesselator:t}=this.state;e.startIndices=t.indexStarts,e.value=t.get("indices")}calculatePositions(e){let{polygonTesselator:t}=this.state;e.startIndices=t.vertexStarts,e.value=t.get("positions")}calculateVertexValid(e){e.value=this.state.polygonTesselator.get("vertexValid")}}R.defaultProps={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:e=>e.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:N},getLineColor:{type:"accessor",value:N},material:!0},R.layerName="SolidPolygonLayer";var F=i(38244);let B=[0,0,0,255],U={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:e=>e.polygon},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:B},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0};class V extends o.Z{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&n.Z.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:e}){let t=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(t&&Array.isArray(e.dataChanged)){let t=this.state.paths.slice(),i=e.dataChanged.map(e=>(function({data:e,getIndex:t,dataRange:i,replace:o}){let{startRow:n=0,endRow:r=1/0}=i,s=e.length,a=s,l=s;for(let i=0;i<s;i++){let o=t(e[i]);if(a>i&&o>=n&&(a=i),o>=r){l=i;break}}let u=a,c=l-a!==o.length?e.slice(l):void 0;for(let t=0;t<o.length;t++)e[u++]=o[t];if(c){for(let t=0;t<c.length;t++)e[u++]=c[t];e.length=u}return{startRow:a,endRow:a+o.length}}
852)({data:t,getIndex:e=>e.__source.index,dataRange:e,replace:this._getPaths(e)}));this.setState({paths:t,pathsDiff:i})}else t&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(e={}){let{data:t,getPolygon:i,positionFormat:o,_normalize:n}=this.props,s=[],a="XY"===o?2:3,{startRow:l,endRow:u}=e,{iterable:c,objectInfo:h}=(0,r.jB)(t,l,u);for(let e of c){h.index++;let t=i(e,h);n&&(t=P(t,a));let{holeIndices:o}=t,r=t.positions||t;if(o)for(let t=0;t<=o.length;t++){let i=r.slice(o[t-1]||0,o[t]||r.length);s.push(this.getSubLayerRow({path:i},e,h.index))}else s.push(this.getSubLayerRow({path:r},e,h.index))}return s}renderLayers(){let{data:e,_dataDiff:t,stroked:i,filled:o,extruded:n,wireframe:r,_normalize:s,_windingOrder:a,elevationScale:l,transitions:u,positionFormat:c}=this.props,{lineWidthUnits:h,lineWidthScale:g,lineWidthMinPixels:d,lineWidthMaxPixels:p,lineJointRounded:f,lineMiterLimit:m,lineDashJustified:v}=this.props,{getFillColor:x,getLineColor:y,getLineWidth:b,getLineDashArray:C,getElevation:P,getPolygon:_,updateTriggers:S,material:w}=this.props,{paths:L,pathsDiff:A}=this.state,T=this.getSubLayerClass("fill",R),M=this.getSubLayerClass("stroke",F.Z),I=this.shouldRenderSubLayer("fill",L)&&new T({_dataDiff:t,extruded:n,elevationScale:l,filled:o,wireframe:r,_normalize:s,_windingOrder:a,getElevation:P,getFillColor:x,getLineColor:n&&r?y:B,material:w,transitions:u},this.getSubLayerProps({id:"fill",updateTriggers:S&&{getPolygon:S.getPolygon,getElevation:S.getElevation,getFillColor:S.getFillColor,lineColors:n&&r,getLineColor:S.getLineColor}}),{data:e,positionFormat:c,getPolygon:_}),E=!n&&i&&this.shouldRenderSubLayer("stroke",L)&&new M({_dataDiff:A&&(()=>A),widthUnits:h,widthScale:g,widthMinPixels:d,widthMaxPixels:p,jointRounded:f,miterLimit:m,dashJustified:v,_pathType:"loop",transitions:u&&{getWidth:u.getLineWidth,getColor:u.getLineColor,getPath:u.getPolygon},getColor:this.getSubLayerAccessor(y),getWidth:this.getSubLayerAccessor(b),getDashArray:this.getSubLayerAccessor(C)}
852,this.getSubLayerProps({id:"stroke",updateTriggers:S&&{getWidth:S.getLineWidth,getColor:S.getLineColor,getDashArray:S.getLineDashArray}}),{data:L,positionFormat:c,getPath:e=>e.path});return[!n&&I,E,n&&I]}}V.layerName="PolygonLayer",V.defaultProps=U;var G=V},83354:function(e,t,i){i.d(t,{u:function(){return s}});var o=i(46803),n=i(15460),r=i(40854);let s={props:{},name:"gouraudMaterial",vs:n.Z.replace("phongMaterial","gouraudMaterial"),fs:n._.replace("phongMaterial","gouraudMaterial"),source:r.i.replaceAll("phongMaterial","gouraudMaterial"),defines:{LIGHTING_VERTEX:!0},dependencies:[o.h],uniformTypes:{ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{ambient:.35,diffuse:.6,shininess:32,specularColor:[.15,.15,.15]},getUniforms(e){let t={...e};return t.specularColor&&(t.specularColor=t.specularColor.map(e=>e/255)),{...s.defaultUniforms,...t}}}},46803:function(e,t,i){i.d(t,{h:function(){return l}});var o,n,r=i(75476);let s=`\
853precision highp int;
854
855// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
856struct AmbientLight {
857  vec3 color;
858};
859
860struct PointLight {
861  vec3 color;
862  vec3 position;
863  vec3 attenuation; // 2nd order x:Constant-y:Linear-z:Exponential
864};
865
866struct DirectionalLight {
867  vec3 color;
868  vec3 direction;
869};
870
871uniform lightingUniforms {
872  int enabled;
873  int lightType;
874
875  int directionalLightCount;
876  int pointLightCount;
877
878  vec3 ambientColor;
879
880  vec3 lightColor0;
881  vec3 lightPosition0;
882  vec3 lightDirection0;
883  vec3 lightAttenuation0;
884
885  vec3 lightColor1;
886  vec3 lightPosition1;
887  vec3 lightDirection1;
888  vec3 lightAttenuation1;
889
890  vec3 lightColor2;
891  vec3 lightPosition2;
892  vec3 lightDirection2;
893  vec3 lightAttenuation2;
894} lighting;
895
896PointLight lighting_getPointLight(int index) {
897  switch (index) {
898    case 0:
899      return PointLight(lighting.lightColor0, lighting.lightPosition0, lighting.lightAttenuation0);
900    case 1:
901      return PointLight(lighting.lightColor1, lighting.lightPosition1, lighting.lightAttenuation1);
902    case 2:
903    default:  
904      return PointLight(lighting.lightColor2, lighting.lightPosition2, lighting.lightAttenuation2);
905  }
906}
907
908DirectionalLight lighting_getDirectionalLight(int index) {
909  switch (index) {
910    case 0:
911      return DirectionalLight(lighting.lightColor0, lighting.lightDirection0);
912    case 1:
913      return DirectionalLight(lighting.lightColor1, lighting.lightDirection1);
914    case 2:
915    default:   
916      return DirectionalLight(lighting.lightColor2, lighting.lightDirection2);
917  }
918} 
919
920float getPointLightAttenuation(PointLight pointLight, float distance) {
921  return pointLight.attenuation.x
922       + pointLight.attenuation.y * distance
923       + pointLight.attenuation.z * distance * distance;
924}
925
926// #endif
927`,a=`\
928// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
929struct AmbientLight {
930  color: vec3<f32>,
931};
932
933struct PointLight {
934  color: vec3<f32>,
935  position: vec3<f32>,
936  attenuation: vec3<f32>, // 2nd order x:Constant-y:Linear-z:Exponential
937};
938
939struct DirectionalLight {
940  color: vec3<f32>,
941  direction: vec3<f32>,
942};
943
944struct lightingUniforms {
945  enabled: i32,
946  pointLightCount: i32,
947  directionalLightCount: i32,
948
949  ambientColor: vec3<f32>,
950
951  // TODO - support multiple lights by uncommenting arrays below
952  lightType: i32,
953  lightColor: vec3<f32>,
954  lightDirection: vec3<f32>,
955  lightPosition: vec3<f32>,
956  lightAttenuation: vec3<f32>,
957
958  // AmbientLight ambientLight;
959  // PointLight pointLight[MAX_LIGHTS];
960  // DirectionalLight directionalLight[MAX_LIGHTS];
961};
962
963// Binding 0:1 is reserved for lighting (Note: could go into separate bind group as it is stable across draw calls)
964@binding(1) @group(0) var<uniform> lighting : lightingUniforms;
965
966fn lighting_getPointLight(index: i32) -> PointLight {
967  return PointLight(lighting.lightColor, lighting.lightPosition, lighting.lightAttenuation);
968}
969
970fn lighting_getDirectionalLight(index: i32) -> DirectionalLight {
971  return DirectionalLight(lighting.lightColor, lighting.lightDirection);
972} 
973
974fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
975  return pointLight.attenuation.x
976       + pointLight.attenuation.y * distance
977       + pointLight.attenuation.z * distance * distance;
978}
979`;(o=n||(n={}))[o.POINT=0]="POINT",o[o.DIRECTIONAL=1]="DIRECTIONAL";let l={props:{},uniforms:{},name:"lighting",defines:{},uniformTypes:{enabled:"i32",lightType:"i32",directionalLightCount:"i32",pointLightCount:"i32",ambientColor:"vec3<f32>",lightColor0:"vec3<f32>",lightPosition0:"vec3<f32>",lightDirection0:"vec3<f32>",lightAttenuation0:"vec3<f32>",lightColor1:"vec3<f32>",lightPosition1:"vec3<f32>",lightDirection1:"vec3<f32>",lightAttenuation1:"vec3<f32>",lightColor2:"vec3<f32>",lightPosition2:"vec3<f32>",lightDirection2:"vec3<f32>",lightAttenuation2:"vec3<f32>"},defaultUniforms:{enabled:1,lightType:n.POINT,directionalLightCount:0,pointLightCount:0,ambientColor:[.1,.1,.1],lightColor0:[1,1,1],lightPosition0:[1,1,2],lightDirection0:[1,1,1],lightAttenuation0:[1,0,0],lightColor1:[1,1,1],lightPosition1:[1,1,2],lightDirection1:[1,1,1],lightAttenuation1:[1,0,0],lightColor2:[1,1,1],lightPosition2:[1,1,2],lightDirection2:[1,1,1],lightAttenuation2:[1,0,0]},source:a,vs:s,fs:s,getUniforms:function(e,t={}){if(!(e=e?{...e}:e))return{...l.defaultUniforms};e.lights&&(e={...e,...function(e){let t={pointLights:[],directionalLights:[]};for(let i of e||[])switch(i.type){case"ambient":t.ambientLight=i;break;case"directional":t.directionalLights?.push(i);break;case"point":t.pointLights?.push(i)}return t}(e.lights),lights:void 0});let{ambientLight:i,pointLights:o,directionalLights:s}=e||{};if(!(i||o&&o.length>0||s&&s.length>0))return{...l.defaultUniforms,enabled:0};let a={...l.defaultUniforms,...t,...function({ambientLight:e,pointLights:t=[],directionalLights:i=[]}){let o={};o.ambientColor=u(e);let s=0;for(let e of t){o.lightType=n.POINT;let t=s;o[`lightColor${t}`]=u(e),o[`lightPosition${t}`]=e.position,o[`lightAttenuation${t}`]=e.attenuation||[1,0,0],s++}for(let e of i){o.lightType=n.DIRECTIONAL;let t=s;o[`lightColor${t}`]=u(e),o[`lightDirection${t}`]=e.direction,s++}return s>5&&r.c.warn("MAX_LIGHTS exceeded")(),o.directionalLightCount=i.length,o.pointLightCount=t.length,o}({ambientLight:i,pointLights:o,directionalLights:s})};return void 0!==e.enabled&&(a.enabled=e.enabled?1:0),a}};function u(e={}){let{color:t=[0,0,0],intensity:i=1}=e;return t.map(e=>e*i/255)}},15460:function(e,t,i){i.d(t,{Z:function(){return n},_:function(){return o}});let o=`\
980uniform phongMaterialUniforms {
981  uniform float ambient;
982  uniform float diffuse;
983  uniform float shininess;
984  uniform vec3  specularColor;
985} material;
986`,n=`\
987#define MAX_LIGHTS 3
988
989uniform phongMaterialUniforms {
990  uniform float ambient;
991  uniform float diffuse;
992  uniform float shininess;
993  uniform vec3  specularColor;
994} material;
995
996vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {
997  vec3 halfway_direction = normalize(light_direction + view_direction);
998  float lambertian = dot(light_direction, normal_worldspace);
999  float specular = 0.0;
1000  if (lambertian > 0.0) {
1001    float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);
1002    specular = pow(specular_angle, material.shininess);
1003  }
1004  lambertian = max(lambertian, 0.0);
1005  return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color;
1006}
1007
1008vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
1009  vec3 lightColor = surfaceColor;
1010
1011  if (lighting.enabled == 0) {
1012    return lightColor;
1013  }
1014
1015  vec3 view_direction = normalize(cameraPosition - position_worldspace);
1016  lightColor = material.ambient * surfaceColor * lighting.ambientColor;
1017
1018  for (int i = 0; i < lighting.pointLightCount; i++) {
1019    PointLight pointLight = lighting_getPointLight(i);
1020    vec3 light_position_worldspace = pointLight.position;
1021    vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
1022    float light_attenuation = getPointLightAttenuation(pointLight, distance(light_position_worldspace, position_worldspace));
1023    lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color / light_attenuation);
1024  }
1025
1026  int totalLights = min(MAX_LIGHTS, lighting.pointLightCount + lighting.directionalLightCount);
1027  for (int i = lighting.pointLightCount; i < totalLights; i++) {
1028    DirectionalLight directionalLight = lighting_getDirectionalLight(i);
1029    lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
1030  }
1031  
1032  return lightColor;
1033}
1034`},40854:function(e,t,i){i.d(t,{i:function(){return o}});let o=`\
1035struct phongMaterialUniforms {
1036  ambient: f32,
1037  diffuse: f32,
1038  shininess: f32,
1039  specularColor: vec3<f32>,
1040};
1041
1042@binding(2) @group(0) var<uniform> phongMaterial : phongMaterialUniforms;
1043
1044fn lighting_getLightColor(surfaceColor: vec3<f32>, light_direction: vec3<f32>, view_direction: vec3<f32>, normal_worldspace: vec3<f32>, color: vec3<f32>) -> vec3<f32> {
1045  let halfway_direction: vec3<f32> = normalize(light_direction + view_direction);
1046  var lambertian: f32 = dot(light_direction, normal_worldspace);
1047  var specular: f32 = 0.0;
1048  if (lambertian > 0.0) {
1049    let specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);
1050    specular = pow(specular_angle, phongMaterial.shininess);
1051  }
1052  lambertian = max(lambertian, 0.0);
1053  return (lambertian * phongMaterial.diffuse * surfaceColor + specular * phongMaterial.specularColor) * color;
1054}
1055
1056fn lighting_getLightColor2(surfaceColor: vec3<f32>, cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32> {
1057  var lightColor: vec3<f32> = surfaceColor;
1058
1059  if (lighting.enabled == 0) {
1060    return lightColor;
1061  }
1062
1063  let view_direction: vec3<f32> = normalize(cameraPosition - position_worldspace);
1064  lightColor = phongMaterial.ambient * surfaceColor * lighting.ambientColor;
1065
1066  if (lighting.lightType == 0) {
1067    let pointLight: PointLight  = lighting_getPointLight(0);
1068    let light_position_worldspace: vec3<f32> = pointLight.position;
1069    let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace);
1070    lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
1071  } else if (lighting.lightType == 1) {
1072    var directionalLight: DirectionalLight = lighting_getDirectionalLight(0);
1073    lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
1074  }
1075  
1076  return lightColor;
1077  /*
1078  for (int i = 0; i < MAX_LIGHTS; i++) {
1079    if (i >= lighting.pointLightCount) {
1080      break;
1081    }
1082    PointLight pointLight = lighting.pointLight[i];
1083    vec3 light_position_worldspace = pointLight.position;
1084    vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
1085    lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
1086  }
1087
1088  for (int i = 0; i < MAX_LIGHTS; i++) {
1089    if (i >= lighting.directionalLightCount) {
1090      break;
1091    }
1092    DirectionalLight directionalLight = lighting.directionalLight[i];
1093    lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
1094  }
1095  */
1096}
1097
1098fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32>{
1099  var lightColor = vec3<f32>(0, 0, 0);
1100  let surfaceColor = vec3<f32>(0, 0, 0);
1101
1102  if (lighting.enabled == 0) {
1103    let view_direction = normalize(cameraPosition - position_worldspace);
1104
1105    switch (lighting.lightType) {
1106      case 0, default: {
1107        let pointLight: PointLight = lighting_getPointLight(0);
1108        let light_position_worldspace: vec3<f32> = pointLight.position;
1109        let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace);
1110        lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
1111      }
1112      case 1: {
1113        let directionalLight: DirectionalLight = lighting_getDirectionalLight(0);
1114        lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
1115      }
1116    }
1117  }
1118  return lightColor;
1119}
1120`},40502:function(e,t,i){i.d(t,{wG:function(){return o},WZ:function(){return g},GU:function(){return v},dj:function(){return h},ct:function(){return m},Ny:function(){return n}});let o={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function n(e,t,i={}){return function(e,t={}){return Math.sign(function(e,t={}){let{start:i=0,end:o=e.length,plane:n="xy"}
1120=t,s=t.size||2,a=0,l=r[n[0]],u=r[n[1]];for(let t=i,n=o-s;t<o;t+=s)a+=(e[t+l]-e[n+l])*(e[t+u]+e[n+u]),n=t;return a/2}(e,t))}(e,i)!==t&&(function(e,t){let{start:i=0,end:o=e.length,size:n=2}=t,r=(o-i)/n,s=Math.floor(r/2);for(let t=0;t<s;++t){let o=i+t*n,s=i+(r-1-t)*n;for(let t=0;t<n;++t){let i=e[o+t];e[o+t]=e[s+t],e[s+t]=i}}}(e,i),!0)}let r={x:0,y:1,z:2};function s(e,t,i,o,n=[]){let r,s;if(8&i)r=(o[3]-e[1])/(t[1]-e[1]),s=3;else if(4&i)r=(o[1]-e[1])/(t[1]-e[1]),s=1;else if(2&i)r=(o[2]-e[0])/(t[0]-e[0]),s=2;else{if(!(1&i))return null;r=(o[0]-e[0])/(t[0]-e[0]),s=0}for(let i=0;i<e.length;i++)n[i]=(1&s)===i?o[s]:r*(t[i]-e[i])+e[i];return n}function a(e,t){let i=0;return e[0]<t[0]?i|=1:e[0]>t[2]&&(i|=2),e[1]<t[1]?i|=4:e[1]>t[3]&&(i|=8),i}function l(e,t){let i=t.length,o=e.length;if(o>0){let n=!0;for(let r=0;r<i;r++)if(e[o-i+r]!==t[r]){n=!1;break}if(n)return!1}for(let n=0;n<i;n++)e[o+n]=t[n];return!0}function u(e,t){let i=t.length;for(let o=0;o<i;o++)e[o]=t[o]}function c(e,t,i,o,n=[]){let r=o+t*i;for(let t=0;t<i;t++)n[t]=e[r+t];return n}function h(e,t){let i,o;let{size:n=2,broken:r=!1,gridResolution:h=10,gridOffset:g=[0,0],startIndex:d=0,endIndex:f=e.length}=t||{},m=(f-d)/n,v=[],x=[v],y=c(e,0,n,d),b=p(y,h,g,[]),C=[];l(v,y);for(let t=1;t<m;t++){for(o=a(i=c(e,t,n,d,i),b);o;){var P;s(y,i,o,b,C);let e=a(C,b);e&&(s(y,C,e,b,C),o=e),l(v,C),u(y,C),8&(P=o)?(b[1]+=h,b[3]+=h):4&P?(b[1]-=h,b[3]-=h):2&P?(b[0]+=h,b[2]+=h):1&P&&(b[0]-=h,b[2]-=h),r&&v.length>n&&(v=[],x.push(v),l(v,y)),o=a(i,b)}l(v,i),u(y,i)}return r?x:x[0]}function g(e,t=null,i){if(!e.length)return[];let{size:o=2,gridResolution:n=10,gridOffset:r=[0,0],edgeTypes:s=!1}=i||{},l=[],u=[{pos:e,types:s?Array(e.length/o).fill(1):null,holes:t||[]}],c=[[],[]],h=[];for(;u.length;){let{pos:e,types:t,holes:i}=u.shift();(function(e,t,i,o){let n=1/0,r=-1/0,s=1/0,a=-1/0;for(let o=0;o<i;o+=t){let t=e[o],i=e[o+1];n=t<n?t:n,r=t>r?t:r,s=i<s?i:s,a=i>a?i:a}o[0][0]=n,o[0][1]=s,o[1][0]=r,o[1][1]=a})(e,o,i[0]||e.length,c),h=p(c[0],n,r,h);let g=a(c[1],h);if(g){let n=d(e,t,o,0,i[0]||e.length,h,g),r={pos:n[0].pos,types:n[0].types,holes:[]},a={pos:n[1].pos,types:n[1].types,holes:[]};u.push(r,a);for(let l=0;l<i.length;l++)(n=d(e,t,o,i[l],i[l+1]||e.length,h,g))[0]&&(r.holes.push(r.pos.length),r.pos=f(r.pos,n[0].pos),s&&(r.types=f(r.types,n[0].types))),n[1]&&(a.holes.push(a.pos.length),a.pos=f(a.pos,n[1].pos),s&&(a.types=f(a.types,n[1].types)))}else{let o={positions:e};s&&(o.edgeTypes=t),i.length&&(o.holeIndices=i),l.push(o)}}return l}function d(e,t,i,o,n,r,a){let h,g,d;let p=(n-o)/i,f=[],m=[],v=[],x=[],y=[],b=c(e,p-1,i,o),C=Math.sign(8&a?b[1]-r[3]:b[0]-r[2]),P=t&&t[p-1],_=0,S=0;for(let n=0;n<p;n++)h=c(e,n,i,o,h),g=Math.sign(8&a?h[1]-r[3]:h[0]-r[2]),d=t&&t[o/i+n],g&&C&&C!==g&&(s(b,h,a,r,y),l(f,y)&&v.push(P),l(m,y)&&x.push(P)),g<=0?(l(f,h)&&v.push(d),_-=g):v.length&&(v[v.length-1]=0),g>=0?(l(m,h)&&x.push(d),S+=g):x.length&&(x[x.length-1]=0),u(b,h),C=g,P=d;return[_?{pos:f,types:t&&v}:null,S?{pos:m,types:t&&x}:null]}function p(e,t,i,o){let n=Math.floor((e[0]-i[0])/t)*t+i[0],r=Math.floor((e[1]-i[1])/t)*t+i[1];return o[0]=n,o[1]=r,o[2]=n+t,o[3]=r+t,o}function f(e,t){for(let i=0;i<t.length;i++)e.push(t[i]);return e}function m(e,t){let{size:i=2,startIndex:o=0,endIndex:n=e.length,normalize:r=!0}=t||{},s=e.slice(o,n);x(s,i,0,n-o);let a=h(s,{size:i,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(r)for(let e of a)y(e,i);return a}function v(e,t=null,i){let{size:o=2,normalize:n=!0,edgeTypes:r=!1}=i||{};t=t||[];let s=[],a=[],u=0,h=0;for(let n=0;n<=t.length;n++){let r=t[n]||e.length,g=h,d=function(e,t,i,o){let n=-1,r=-1;for(let s=i+1;s<o;s+=t){let t=Math.abs(e[s]);t>n&&(n=t,r=s-1)}return r}(e,o,u,r);for(let t=d;t<r;t++)s[h++]=e[t];for(let t=u;t<d;t++)s[h++]=e[t];x(s,o,g,h),function(e,t,i,o,n=85.051129){let r=e[i],s=e[o-t];if(Math.abs(r-s)>180){let o=c(e,0,t,i);o[0]+=360*Math.round((s-r)/360),l(e,o),o[1]=Math.sign(o[1])*n,l(e,o),o[0]=r,l(e,o)}}(s,o,g,h,i?.maxLatitude),u=r,a[n]=h}a.pop();let d=g(s,a,{size:o,gridResolution:360,gridOffset:[-180,-180],edgeTypes:r});if(n)for(let e of d)y(e.positions,o);return d}function x(e,t,i,o){let n,r=e[0];for(let s=i;s<o;s+=t){let t=(n=e[s])-r;(t>180||t<-180)&&(n-=360*Math.round(t/360)),e[s]=r=n}}function y(e,t){let i;let o=e.length/t;for(let n=0;n<o&&((i=e[n*t])+180)%360==0;n++);let n=-(360*Math.round(i/360));if(0!==n)for(let i=0;i<o;i++)e[i*t]+=n}},31752:function(e,t,i){i.d(t,{X:function(){return a},Z:function(){return l}});var o={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:250826616.45599997,kilometers:6371.0088,kilometres:6371.0088,meters:6371008.8,metres:6371008.8,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:6371008.8/1852,radians:1,yards:6967335.223679999};function n(e){return e%(2*Math.PI)*180/Math.PI}function r(e){return e%360*Math.PI/180}function s(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function a(e,t,i={}){let a=i.steps||64,l=i.properties?i.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},u=[];for(let l=0;l<a;l++)u.push(function(e,t,i,a={}
1120){let l=function(e){if(!e)throw Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw Error("coord must be GeoJSON Point or an Array of numbers")}(e),u=r(l[0]),c=r(l[1]),h=r(i),g=function(e,t="kilometers"){let i=o[t];if(!i)throw Error(t+" units is invalid");return e/i}(t,a.units),d=Math.asin(Math.sin(c)*Math.cos(g)+Math.cos(c)*Math.sin(g)*Math.cos(h));return function(e,t,i={}){if(!e)throw Error("coordinates is required");if(!Array.isArray(e))throw Error("coordinates must be an Array");if(e.length<2)throw Error("coordinates must be at least 2 numbers long");if(!s(e[0])||!s(e[1]))throw Error("coordinates must contain numbers");return function(e,t,i={}){let o={type:"Feature"};return(0===i.id||i.id)&&(o.id=i.id),i.bbox&&(o.bbox=i.bbox),o.properties=t||{},o.geometry=e,o}({type:"Point",coordinates:e},t,i)}([n(u+Math.atan2(Math.sin(h)*Math.sin(g)*Math.cos(c),Math.cos(g)-Math.sin(c)*Math.sin(d))),n(d)],a.properties)}(e,t,-360*l/a,i).geometry.coordinates);return u.push(u[0]),function(e,t,i={}){for(let t of e){if(t.length<4)throw Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw Error("First and last Position are not equivalent.")}return function(e,t,i={}){let o={type:"Feature"};return(0===i.id||i.id)&&(o.id=i.id),i.bbox&&(o.bbox=i.bbox),o.properties=t||{},o.geometry=e,o}({type:"Polygon",coordinates:e},t,i)}([u],l)}var l=a}}]);
1121//# sourceMappingURL=76720-39255fdc1fa839f0.js.map

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.