物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

5247 lines
1016 KiB

import{a6 as Ht,aa as mo,p as PR,d as LR,Y as wR,t as FR,Q as BR,o as DR,b as UR}from"./index-bVOhw2NF.js";import{e as Bn,E as lp}from"./index-Cy9UOSCT.js";import{f as E,_ as kR,d as ly,e as cy,c as $R,b as zR,a as VR,g as bl}from"./defineProperty-DTM21if9.js";import{c as HR}from"./cloneDeep-C6NKQlMO.js";import"./typeof-QjJsDpFa.js";import"./_initCloneObject-K-Y0ueWp.js";import"./_getTag-BJ2nhJXz.js";var fy={},hy={},Jv=e=>hy[e],Tn=(e,t)=>{hy[e]=t},jR=e=>fy[e],ja=(e,t)=>{fy[e]=t},e0={},yh={},Th=34,Ss=10,Ah=13;function dy(e){return new Function("d","return {"+e.map(function(t,r){return JSON.stringify(t)+": d["+r+'] || ""'}).join(",")+"}")}function XR(e,t){var r=dy(e);return function(n,i){return t(r(n),i,e)}}function t0(e){var t=Object.create(null),r=[];return e.forEach(function(n){for(var i in n)i in t||r.push(t[i]=i)}),r}function un(e,t){var r=e+"",n=r.length;return n<t?new Array(t-n+1).join(0)+r:r}function WR(e){return e<0?"-"+un(-e,6):e>9999?"+"+un(e,6):un(e,4)}function GR(e){var t=e.getUTCHours(),r=e.getUTCMinutes(),n=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":WR(e.getUTCFullYear())+"-"+un(e.getUTCMonth()+1,2)+"-"+un(e.getUTCDate(),2)+(i?"T"+un(t,2)+":"+un(r,2)+":"+un(n,2)+"."+un(i,3)+"Z":n?"T"+un(t,2)+":"+un(r,2)+":"+un(n,2)+"Z":r||t?"T"+un(t,2)+":"+un(r,2)+"Z":"")}function YR(e){var t=new RegExp('["'+e+`
\r]`),r=e.charCodeAt(0);function n(c,h){var d,p,v=i(c,function(g,y){if(d)return d(g,y-1);p=g,d=h?XR(g,h):dy(g)});return v.columns=p||[],v}function i(c,h){var d=[],p=c.length,v=0,g=0,y,S=p<=0,R=!1;c.charCodeAt(p-1)===Ss&&--p,c.charCodeAt(p-1)===Ah&&--p;function x(){if(S)return yh;if(R)return R=!1,e0;var $,F=v,Y;if(c.charCodeAt(F)===Th){for(;v++<p&&c.charCodeAt(v)!==Th||c.charCodeAt(++v)===Th;);return($=v)>=p?S=!0:(Y=c.charCodeAt(v++))===Ss?R=!0:Y===Ah&&(R=!0,c.charCodeAt(v)===Ss&&++v),c.slice(F+1,$-1).replace(/""/g,'"')}for(;v<p;){if((Y=c.charCodeAt($=v++))===Ss)R=!0;else if(Y===Ah)R=!0,c.charCodeAt(v)===Ss&&++v;else if(Y!==r)continue;return c.slice(F,$)}return S=!0,c.slice(F,p)}for(;(y=x())!==yh;){for(var M=[];y!==e0&&y!==yh;)M.push(y),y=x();h&&(M=h(M,g++))==null||d.push(M)}return d}function o(c,h){return c.map(function(d){return h.map(function(p){return f(d[p])}).join(e)})}function a(c,h){return h==null&&(h=t0(c)),[h.map(f).join(e)].concat(o(c,h)).join(`
`)}function s(c,h){return h==null&&(h=t0(c)),o(c,h).join(`
`)}function u(c){return c.map(l).join(`
`)}function l(c){return c.map(f).join(e)}function f(c){return c==null?"":c instanceof Date?GR(c):t.test(c+="")?'"'+c.replace(/"/g,'""')+'"':c}return{parse:n,parseRows:i,format:a,formatBody:s,formatRows:u,formatRow:l,formatValue:f}}var ZR=YR(","),qR=ZR.parse;function cu(e,t,r){r===void 0&&(r={});var n={type:"Feature"};return(r.id===0||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function cp(e,t,r){r===void 0&&(r={});for(var n=0,i=e;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<o[o.length-1].length;a++)if(o[o.length-1][a]!==o[0][a])throw new Error("First and last Position are not equivalent.")}var s={type:"Polygon",coordinates:e};return cu(s,t,r)}function KR(e,t,r){if(r===void 0&&(r={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var n={type:"LineString",coordinates:e};return cu(n,t,r)}function QR(e,t){t===void 0&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}function JR(e,t,r){r===void 0&&(r={});var n={type:"MultiPolygon",coordinates:e};return cu(n,t,r)}function py(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function r0(e){return e.type==="Feature"?e.geometry:e}function _y(e,t,r){if(e!==null)for(var n,i,o,a,s,u,l,f=0,c=0,h,d=e.type,p=d==="FeatureCollection",v=d==="Feature",g=p?e.features.length:1,y=0;y<g;y++){l=p?e.features[y].geometry:v?e.geometry:e,h=l?l.type==="GeometryCollection":!1,s=h?l.geometries.length:1;for(var S=0;S<s;S++){var R=0,x=0;if(a=h?l.geometries[S]:l,a!==null){u=a.coordinates;var M=a.type;switch(f=0,M){case null:break;case"Point":if(t(u,c,y,R,x)===!1)return!1;c++,R++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(t(u[n],c,y,R,x)===!1)return!1;c++,M==="MultiPoint"&&R++}M==="LineString"&&R++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-f;i++){if(t(u[n][i],c,y,R,x)===!1)return!1;c++}M==="MultiLineString"&&R++,M==="Polygon"&&x++}M==="Polygon"&&R++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(x=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-f;o++){if(t(u[n][i][o],c,y,R,x)===!1)return!1;c++}x++}R++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(_y(a.geometries[n],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function e2(e,t){var r,n,i,o,a,s,u,l,f,c,h=0,d=e.type==="FeatureCollection",p=e.type==="Feature",v=d?e.features.length:1;for(r=0;r<v;r++){for(s=d?e.features[r].geometry:p?e.geometry:e,l=d?e.features[r].properties:p?e.properties:{},f=d?e.features[r].bbox:p?e.bbox:void 0,c=d?e.features[r].id:p?e.id:void 0,u=s?s.type==="GeometryCollection":!1,a=u?s.geometries.length:1,i=0;i<a;i++){if(o=u?s.geometries[i]:s,o===null){if(t(null,h,l,f,c)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,h,l,f,c)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],h,l,f,c)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function vy(e,t){e2(e,function(r,n,i,o,a){var s=r===null?null:r.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return t(cu(r,i,{bbox:o,id:a}),n,0)===!1?!1:void 0}var u;switch(s){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon";break}for(var l=0;l<r.coordinates.length;l++){var f=r.coordinates[l],c={type:u,coordinates:f};if(t(cu(c,i),n,l)===!1)return!1}})}var Gl={REGISTERED_PROTOCOLS:{}},t2=Object.defineProperty,r2=Object.defineProperties,n2=Object.getOwnPropertyDescriptors,n0=Object.getOwnPropertySymbols,i2=Object.prototype.hasOwnProperty,o2=Object.prototype.propertyIsEnumerable,i0=(e,t,r)=>t in e?t2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fp=(e,t)=>{for(var r in t||(t={}))i2.call(t,r)&&i0(e,r,t[r]);if(n0)for(var r of n0(t))o2.call(t,r)&&i0(e,r,t[r]);return e},hp=(e,t)=>r2(e,n2(t)),dp=e=>Gl.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))],a2=class extends Error{constructor(e,t,r,n){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=n}};function gy(e,t){const r=new XMLHttpRequest,n=Array.isArray(e.url)?e.url[0]:e.url;r.open(e.method||"GET",n,!0),e.type==="arrayBuffer"&&(r.responseType="arraybuffer");for(const i in e.headers)e.headers.hasOwnProperty(i)&&r.setRequestHeader(i,e.headers[i]);return e.type==="json"&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials=e.credentials==="include",r.onerror=()=>{t(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||r.status===0)&&r.response!==null){let i=r.response;if(e.type==="json")try{i=JSON.parse(r.response)}catch(o){return t(o)}t(null,i,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"),r)}else{const i=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});t(new a2(r.status,r.statusText,n.toString(),i))}},r.cancel=r.abort,r.send(e.body),r}function s2(e){return new Promise((t,r)=>{gy(e,(n,i,o,a,s)=>{n?r({err:n,data:null,xhr:s}):t({err:null,data:i,cacheControl:o,expires:a,xhr:s})})})}function pp(e,t){return gy(e,t)}var u2=(e,t)=>(dp(e.url)||pp)(hp(fp({},e),{type:"json"}),t),_p=(e,t)=>(dp(e.url)||pp)(hp(fp({},e),{type:"arrayBuffer"}),t),l2=(e,t)=>pp(hp(fp({},e),{method:"GET"}),t),o0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Ey(e,t){const r=new window.Image,n=window.URL||window.webkitURL;r.crossOrigin="anonymous",r.onload=()=>{t(null,r),n.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=o0})},r.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const i=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?n.createObjectURL(i):o0}function yy(e,t){const r=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(r).then(n=>{t(null,n)}).catch(n=>{t(new Error(`Could not load image because of ${n.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}var sd=(e,t,r)=>{const n=(i,o)=>{if(i)t(i);else if(o){const a=typeof createImageBitmap=="function",s=r?r(o):o;a?yy(s,t):Ey(s,t)}};return e.type==="json"?u2(e,n):_p(e,n)},c2=(e,t)=>{typeof createImageBitmap=="function"?yy(e,t):Ey(e,t)};function vp(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Ty(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Iu(){}var fu=.7,ac=1/fu,Sa="\\s*([+-]?\\d+)\\s*",hu="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",oi="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",f2=/^#([0-9a-f]{3,8})$/,h2=new RegExp("^rgb\\("+[Sa,Sa,Sa]+"\\)$"),d2=new RegExp("^rgb\\("+[oi,oi,oi]+"\\)$"),p2=new RegExp("^rgba\\("+[Sa,Sa,Sa,hu]+"\\)$"),_2=new RegExp("^rgba\\("+[oi,oi,oi,hu]+"\\)$"),v2=new RegExp("^hsl\\("+[hu,oi,oi]+"\\)$"),m2=new RegExp("^hsla\\("+[hu,oi,oi,hu]+"\\)$"),a0={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};vp(Iu,Pa,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:s0,formatHex:s0,formatHsl:g2,formatRgb:u0,toString:u0});function s0(){return this.rgb().formatHex()}function g2(){return Ay(this).formatHsl()}function u0(){return this.rgb().formatRgb()}function Pa(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=f2.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?l0(t):r===3?new En(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Rl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Rl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=h2.exec(e))?new En(t[1],t[2],t[3],1):(t=d2.exec(e))?new En(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=p2.exec(e))?Rl(t[1],t[2],t[3],t[4]):(t=_2.exec(e))?Rl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=v2.exec(e))?h0(t[1],t[2]/100,t[3]/100,1):(t=m2.exec(e))?h0(t[1],t[2]/100,t[3]/100,t[4]):a0.hasOwnProperty(e)?l0(a0[e]):e==="transparent"?new En(NaN,NaN,NaN,0):null}function l0(e){return new En(e>>16&255,e>>8&255,e&255,1)}function Rl(e,t,r,n){return n<=0&&(e=t=r=NaN),new En(e,t,r,n)}function E2(e){return e instanceof Iu||(e=Pa(e)),e?(e=e.rgb(),new En(e.r,e.g,e.b,e.opacity)):new En}function sc(e,t,r,n){return arguments.length===1?E2(e):new En(e,t,r,n??1)}function En(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}vp(En,sc,Ty(Iu,{brighter:function(e){return e=e==null?ac:Math.pow(ac,e),new En(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=e==null?fu:Math.pow(fu,e),new En(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:c0,formatHex:c0,formatRgb:f0,toString:f0}));function c0(){return"#"+Sh(this.r)+Sh(this.g)+Sh(this.b)}function f0(){var e=this.opacity;return e=isNaN(e)?1:Math.max(0,Math.min(1,e)),(e===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(e===1?")":", "+e+")")}function Sh(e){return e=Math.max(0,Math.min(255,Math.round(e)||0)),(e<16?"0":"")+e.toString(16)}function h0(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new ii(e,t,r,n)}function Ay(e){if(e instanceof ii)return new ii(e.h,e.s,e.l,e.opacity);if(e instanceof Iu||(e=Pa(e)),!e)return new ii;if(e instanceof ii)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),a=NaN,s=o-i,u=(o+i)/2;return s?(t===o?a=(r-n)/s+(r<n)*6:r===o?a=(n-t)/s+2:a=(t-r)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new ii(a,s,u,e.opacity)}function y2(e,t,r,n){return arguments.length===1?Ay(e):new ii(e,t,r,n??1)}function ii(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}vp(ii,y2,Ty(Iu,{brighter:function(e){return e=e==null?ac:Math.pow(ac,e),new ii(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=e==null?fu:Math.pow(fu,e),new ii(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new En(xh(e>=240?e-240:e+120,i,n),xh(e,i,n),xh(e<120?e+240:e-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return e=isNaN(e)?1:Math.max(0,Math.min(1,e)),(e===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(e===1?")":", "+e+")")}}));function xh(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}function Zt(e){const t=Pa(e),r=[0,0,0,0];return t!=null&&(r[0]=t.r/255,r[1]=t.g/255,r[2]=t.b/255,r[3]=t.opacity),r}function yo(e){const t=e&&e[0],r=e&&e[1],n=e&&e[2];return t+r*256+n*65536-1}function La(e){return[e+1&255,e+1>>8&255,e+1>>8>>8&255]}function T2(e){let t=window.document.createElement("canvas"),r=t.getContext("2d");t.width=256,t.height=1;let n=null;const i=r.createLinearGradient(0,0,256,1),o=e.positions[0],a=e.positions[e.positions.length-1];for(let s=0;s<e.colors.length;++s){const u=(e.positions[s]-o)/(a-o);i.addColorStop(u,e.colors[s])}return r.fillStyle=i,r.fillRect(0,0,256,1),n=new Uint8ClampedArray(r.getImageData(0,0,256,1).data),t=null,r=null,{data:n,width:256,height:1}}function A2(e,t){let r=window.document.createElement("canvas"),n=r.getContext("2d");r.width=256,r.height=1;const i=n.createLinearGradient(0,0,256,1),o=t[1]-t[0];for(let u=0;u<e.colors.length;++u){const l=Math.max((e.positions[u]-t[0])/o,0);i.addColorStop(l,e.colors[u])}n.fillStyle=i,n.fillRect(0,0,256,1);const a=n.getImageData(0,0,256,1).data,s=mp(n,a);return r=null,n=null,s}function S2(e){let t=window.document.createElement("canvas"),r=t.getContext("2d");t.width=256,t.height=1;const n=r.createImageData(256,1);return n.data.fill(0),e.positions.forEach((i,o)=>{const a=Zt(e.colors[o]);n.data[i*4+0]=a[0]*255,n.data[i*4+1]=a[1]*255,n.data[i*4+2]=a[2]*255,n.data[i*4+3]=a[3]*255}),t=null,r=null,n}function x2(e){let t=window.document.createElement("canvas"),r=t.getContext("2d");r.globalAlpha=1,t.width=256,t.height=1;const n=256/e.colors.length;for(let a=0;a<e.colors.length;a++)r.beginPath(),r.lineWidth=2,r.strokeStyle=e.colors[a],r.moveTo(a*n,0),r.lineTo((a+1)*n,0),r.stroke();const i=r.getImageData(0,0,256,1).data,o=mp(r,i);return t=null,r=null,o}function b2(e,t){let r=window.document.createElement("canvas"),n=r.getContext("2d");n.globalAlpha=1,r.width=256,r.height=1;const i=t[1]-t[0];e.positions.length-e.colors.length!==1&&console.warn("positions 的数字个数应当比 colors 的样式多一个,poisitions 的首尾值一般为数据的最大最新值");for(let s=0;s<e.colors.length;s++)n.beginPath(),n.lineWidth=2,n.strokeStyle=e.colors[s],n.moveTo((e.positions[s]-t[0])/i*255,0),n.lineTo((e.positions[s+1]-t[0])/i*255,0),n.stroke();const o=n.getImageData(0,0,256,1).data,a=mp(n,o);return r=null,n=null,a}function mp(e,t){const r=e.createImageData(256,1);for(let n=0;n<r.data.length;n+=4)r.data[n+0]=t[n+0],r.data[n+1]=t[n+1],r.data[n+2]=t[n+2],r.data[n+3]=t[n+3];return r}function gp(e){switch(e==null?void 0:e.type){case"cat":return[0,255];default:return[0,1]}}function R2(e,t,r){return e===e&&(r!==void 0&&(e=e<=r?e:r),t!==void 0&&(e=e>=t?e:t)),e}var C2=R2,O2=/\s/;function I2(e){for(var t=e.length;t--&&O2.test(e.charAt(t)););return t}var M2=I2,N2=M2,P2=/^\s+/;function L2(e){return e&&e.slice(0,N2(e)+1).replace(P2,"")}var w2=L2;function F2(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Dn=F2;const B2=Ht(Dn);var D2=typeof mo=="object"&&mo&&mo.Object===Object&&mo,Sy=D2,U2=Sy,k2=typeof self=="object"&&self&&self.Object===Object&&self,$2=U2||k2||Function("return this")(),Kn=$2,z2=Kn,V2=z2.Symbol,Mu=V2,d0=Mu,xy=Object.prototype,H2=xy.hasOwnProperty,j2=xy.toString,xs=d0?d0.toStringTag:void 0;function X2(e){var t=H2.call(e,xs),r=e[xs];try{e[xs]=void 0;var n=!0}catch{}var i=j2.call(e);return n&&(t?e[xs]=r:delete e[xs]),i}var W2=X2,G2=Object.prototype,Y2=G2.toString;function Z2(e){return Y2.call(e)}var q2=Z2,p0=Mu,K2=W2,Q2=q2,J2="[object Null]",e3="[object Undefined]",_0=p0?p0.toStringTag:void 0;function t3(e){return e==null?e===void 0?e3:J2:_0&&_0 in Object(e)?K2(e):Q2(e)}var yi=t3;function r3(e){return e!=null&&typeof e=="object"}var Un=r3,n3=yi,i3=Un,o3="[object Symbol]";function a3(e){return typeof e=="symbol"||i3(e)&&n3(e)==o3}var Yc=a3,s3=w2,v0=Dn,u3=Yc,m0=NaN,l3=/^[-+]0x[0-9a-f]+$/i,c3=/^0b[01]+$/i,f3=/^0o[0-7]+$/i,h3=parseInt;function d3(e){if(typeof e=="number")return e;if(u3(e))return m0;if(v0(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=v0(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=s3(e);var r=c3.test(e);return r||f3.test(e)?h3(e.slice(2),r?2:8):l3.test(e)?m0:+e}var by=d3,p3=C2,bh=by;function _3(e,t,r){return r===void 0&&(r=t,t=void 0),r!==void 0&&(r=bh(r),r=r===r?r:0),t!==void 0&&(t=bh(t),t=t===t?t:0),p3(bh(e),t,r)}var v3=_3;const m3=Ht(v3);function g3(){this.__data__=[],this.size=0}var E3=g3;function y3(e,t){return e===t||e!==e&&t!==t}var Nu=y3,T3=Nu;function A3(e,t){for(var r=e.length;r--;)if(T3(e[r][0],t))return r;return-1}var Zc=A3,S3=Zc,x3=Array.prototype,b3=x3.splice;function R3(e){var t=this.__data__,r=S3(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():b3.call(t,r,1),--this.size,!0}var C3=R3,O3=Zc;function I3(e){var t=this.__data__,r=O3(t,e);return r<0?void 0:t[r][1]}var M3=I3,N3=Zc;function P3(e){return N3(this.__data__,e)>-1}var L3=P3,w3=Zc;function F3(e,t){var r=this.__data__,n=w3(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var B3=F3,D3=E3,U3=C3,k3=M3,$3=L3,z3=B3;function Xa(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Xa.prototype.clear=D3;Xa.prototype.delete=U3;Xa.prototype.get=k3;Xa.prototype.has=$3;Xa.prototype.set=z3;var qc=Xa,V3=qc;function H3(){this.__data__=new V3,this.size=0}var j3=H3;function X3(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var W3=X3;function G3(e){return this.__data__.get(e)}var Y3=G3;function Z3(e){return this.__data__.has(e)}var q3=Z3,K3=yi,Q3=Dn,J3="[object AsyncFunction]",eC="[object Function]",tC="[object GeneratorFunction]",rC="[object Proxy]";function nC(e){if(!Q3(e))return!1;var t=K3(e);return t==eC||t==tC||t==J3||t==rC}var Kc=nC;const iC=Ht(Kc);var oC=Kn,aC=oC["__core-js_shared__"],sC=aC,Rh=sC,g0=function(){var e=/[^.]+$/.exec(Rh&&Rh.keys&&Rh.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function uC(e){return!!g0&&g0 in e}var lC=uC,cC=Function.prototype,fC=cC.toString;function hC(e){if(e!=null){try{return fC.call(e)}catch{}try{return e+""}catch{}}return""}var Ry=hC,dC=Kc,pC=lC,_C=Dn,vC=Ry,mC=/[\\^$.*+?()[\]{}|]/g,gC=/^\[object .+?Constructor\]$/,EC=Function.prototype,yC=Object.prototype,TC=EC.toString,AC=yC.hasOwnProperty,SC=RegExp("^"+TC.call(AC).replace(mC,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xC(e){if(!_C(e)||pC(e))return!1;var t=dC(e)?SC:gC;return t.test(vC(e))}var bC=xC;function RC(e,t){return e==null?void 0:e[t]}var CC=RC,OC=bC,IC=CC;function MC(e,t){var r=IC(e,t);return OC(r)?r:void 0}var Mo=MC,NC=Mo,PC=Kn,LC=NC(PC,"Map"),Ep=LC,wC=Mo,FC=wC(Object,"create"),Qc=FC,E0=Qc;function BC(){this.__data__=E0?E0(null):{},this.size=0}var DC=BC;function UC(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var kC=UC,$C=Qc,zC="__lodash_hash_undefined__",VC=Object.prototype,HC=VC.hasOwnProperty;function jC(e){var t=this.__data__;if($C){var r=t[e];return r===zC?void 0:r}return HC.call(t,e)?t[e]:void 0}var XC=jC,WC=Qc,GC=Object.prototype,YC=GC.hasOwnProperty;function ZC(e){var t=this.__data__;return WC?t[e]!==void 0:YC.call(t,e)}var qC=ZC,KC=Qc,QC="__lodash_hash_undefined__";function JC(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=KC&&t===void 0?QC:t,this}var eO=JC,tO=DC,rO=kC,nO=XC,iO=qC,oO=eO;function Wa(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Wa.prototype.clear=tO;Wa.prototype.delete=rO;Wa.prototype.get=nO;Wa.prototype.has=iO;Wa.prototype.set=oO;var aO=Wa,y0=aO,sO=qc,uO=Ep;function lO(){this.size=0,this.__data__={hash:new y0,map:new(uO||sO),string:new y0}}var cO=lO;function fO(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var hO=fO,dO=hO;function pO(e,t){var r=e.__data__;return dO(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Jc=pO,_O=Jc;function vO(e){var t=_O(this,e).delete(e);return this.size-=t?1:0,t}var mO=vO,gO=Jc;function EO(e){return gO(this,e).get(e)}var yO=EO,TO=Jc;function AO(e){return TO(this,e).has(e)}var SO=AO,xO=Jc;function bO(e,t){var r=xO(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var RO=bO,CO=cO,OO=mO,IO=yO,MO=SO,NO=RO;function Ga(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ga.prototype.clear=CO;Ga.prototype.delete=OO;Ga.prototype.get=IO;Ga.prototype.has=MO;Ga.prototype.set=NO;var yp=Ga,PO=qc,LO=Ep,wO=yp,FO=200;function BO(e,t){var r=this.__data__;if(r instanceof PO){var n=r.__data__;if(!LO||n.length<FO-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new wO(n)}return r.set(e,t),this.size=r.size,this}var DO=BO,UO=qc,kO=j3,$O=W3,zO=Y3,VO=q3,HO=DO;function Ya(e){var t=this.__data__=new UO(e);this.size=t.size}Ya.prototype.clear=kO;Ya.prototype.delete=$O;Ya.prototype.get=zO;Ya.prototype.has=VO;Ya.prototype.set=HO;var Tp=Ya;function jO(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var XO=jO,WO=Mo,GO=function(){try{var e=WO(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Cy=GO,T0=Cy;function YO(e,t,r){t=="__proto__"&&T0?T0(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var Ap=YO,ZO=Ap,qO=Nu,KO=Object.prototype,QO=KO.hasOwnProperty;function JO(e,t,r){var n=e[t];(!(QO.call(e,t)&&qO(n,r))||r===void 0&&!(t in e))&&ZO(e,t,r)}var Oy=JO,eI=Oy,tI=Ap;function rI(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],u=n?n(r[s],e[s],s,r,e):void 0;u===void 0&&(u=e[s]),i?tI(r,s,u):eI(r,s,u)}return r}var Pu=rI;function nI(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var iI=nI,oI=yi,aI=Un,sI="[object Arguments]";function uI(e){return aI(e)&&oI(e)==sI}var lI=uI,A0=lI,cI=Un,Iy=Object.prototype,fI=Iy.hasOwnProperty,hI=Iy.propertyIsEnumerable,dI=A0(function(){return arguments}())?A0:function(e){return cI(e)&&fI.call(e,"callee")&&!hI.call(e,"callee")},My=dI,pI=Array.isArray,Ti=pI,uc={exports:{}};function _I(){return!1}var vI=_I;uc.exports;(function(e,t){var r=Kn,n=vI,i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===i,s=a?r.Buffer:void 0,u=s?s.isBuffer:void 0,l=u||n;e.exports=l})(uc,uc.exports);var ef=uc.exports,mI=9007199254740991,gI=/^(?:0|[1-9]\d*)$/;function EI(e,t){var r=typeof e;return t=t??mI,!!t&&(r=="number"||r!="symbol"&&gI.test(e))&&e>-1&&e%1==0&&e<t}var Ny=EI,yI=9007199254740991;function TI(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=yI}var Py=TI,AI=yi,SI=Py,xI=Un,bI="[object Arguments]",RI="[object Array]",CI="[object Boolean]",OI="[object Date]",II="[object Error]",MI="[object Function]",NI="[object Map]",PI="[object Number]",LI="[object Object]",wI="[object RegExp]",FI="[object Set]",BI="[object String]",DI="[object WeakMap]",UI="[object ArrayBuffer]",kI="[object DataView]",$I="[object Float32Array]",zI="[object Float64Array]",VI="[object Int8Array]",HI="[object Int16Array]",jI="[object Int32Array]",XI="[object Uint8Array]",WI="[object Uint8ClampedArray]",GI="[object Uint16Array]",YI="[object Uint32Array]",rr={};rr[$I]=rr[zI]=rr[VI]=rr[HI]=rr[jI]=rr[XI]=rr[WI]=rr[GI]=rr[YI]=!0;rr[bI]=rr[RI]=rr[UI]=rr[CI]=rr[kI]=rr[OI]=rr[II]=rr[MI]=rr[NI]=rr[PI]=rr[LI]=rr[wI]=rr[FI]=rr[BI]=rr[DI]=!1;function ZI(e){return xI(e)&&SI(e.length)&&!!rr[AI(e)]}var qI=ZI;function KI(e){return function(t){return e(t)}}var tf=KI,lc={exports:{}};lc.exports;(function(e,t){var r=Sy,n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===n,a=o&&r.process,s=function(){try{var u=i&&i.require&&i.require("util").types;return u||a&&a.binding&&a.binding("util")}catch{}}();e.exports=s})(lc,lc.exports);var Sp=lc.exports,QI=qI,JI=tf,S0=Sp,x0=S0&&S0.isTypedArray,eM=x0?JI(x0):QI,rf=eM;const tM=Ht(rf);var rM=iI,nM=My,iM=Ti,oM=ef,aM=Ny,sM=rf,uM=Object.prototype,lM=uM.hasOwnProperty;function cM(e,t){var r=iM(e),n=!r&&nM(e),i=!r&&!n&&oM(e),o=!r&&!n&&!i&&sM(e),a=r||n||i||o,s=a?rM(e.length,String):[],u=s.length;for(var l in e)(t||lM.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||aM(l,u)))&&s.push(l);return s}var Ly=cM,fM=Object.prototype;function hM(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||fM;return e===r}var xp=hM;function dM(e,t){return function(r){return e(t(r))}}var wy=dM,pM=wy,_M=pM(Object.keys,Object),vM=_M,mM=xp,gM=vM,EM=Object.prototype,yM=EM.hasOwnProperty;function TM(e){if(!mM(e))return gM(e);var t=[];for(var r in Object(e))yM.call(e,r)&&r!="constructor"&&t.push(r);return t}var AM=TM,SM=Kc,xM=Py;function bM(e){return e!=null&&xM(e.length)&&!SM(e)}var nf=bM,RM=Ly,CM=AM,OM=nf;function IM(e){return OM(e)?RM(e):CM(e)}var bp=IM,MM=Pu,NM=bp;function PM(e,t){return e&&MM(t,NM(t),e)}var LM=PM;function wM(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var FM=wM,BM=Dn,DM=xp,UM=FM,kM=Object.prototype,$M=kM.hasOwnProperty;function zM(e){if(!BM(e))return UM(e);var t=DM(e),r=[];for(var n in e)n=="constructor"&&(t||!$M.call(e,n))||r.push(n);return r}var VM=zM,HM=Ly,jM=VM,XM=nf;function WM(e){return XM(e)?HM(e,!0):jM(e)}var Lu=WM,GM=Pu,YM=Lu;function ZM(e,t){return e&&GM(t,YM(t),e)}var qM=ZM,cc={exports:{}};cc.exports;(function(e,t){var r=Kn,n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===n,a=o?r.Buffer:void 0,s=a?a.allocUnsafe:void 0;function u(l,f){if(f)return l.slice();var c=l.length,h=s?s(c):new l.constructor(c);return l.copy(h),h}e.exports=u})(cc,cc.exports);var Fy=cc.exports;function KM(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Rp=KM;function QM(e,t){for(var r=-1,n=e==null?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}var JM=QM;function eN(){return[]}var By=eN,tN=JM,rN=By,nN=Object.prototype,iN=nN.propertyIsEnumerable,b0=Object.getOwnPropertySymbols,oN=b0?function(e){return e==null?[]:(e=Object(e),tN(b0(e),function(t){return iN.call(e,t)}))}:rN,Cp=oN,aN=Pu,sN=Cp;function uN(e,t){return aN(e,sN(e),t)}var lN=uN;function cN(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var Dy=cN,fN=wy,hN=fN(Object.getPrototypeOf,Object),Op=hN,dN=Dy,pN=Op,_N=Cp,vN=By,mN=Object.getOwnPropertySymbols,gN=mN?function(e){for(var t=[];e;)dN(t,_N(e)),e=pN(e);return t}:vN,Uy=gN,EN=Pu,yN=Uy;function TN(e,t){return EN(e,yN(e),t)}var AN=TN,SN=Dy,xN=Ti;function bN(e,t,r){var n=t(e);return xN(e)?n:SN(n,r(e))}var ky=bN,RN=ky,CN=Cp,ON=bp;function IN(e){return RN(e,ON,CN)}var $y=IN,MN=ky,NN=Uy,PN=Lu;function LN(e){return MN(e,PN,NN)}var wN=LN,FN=Mo,BN=Kn,DN=FN(BN,"DataView"),UN=DN,kN=Mo,$N=Kn,zN=kN($N,"Promise"),VN=zN,HN=Mo,jN=Kn,XN=HN(jN,"Set"),zy=XN,WN=Mo,GN=Kn,YN=WN(GN,"WeakMap"),ZN=YN,ud=UN,ld=Ep,cd=VN,fd=zy,hd=ZN,Vy=yi,Za=Ry,R0="[object Map]",qN="[object Object]",C0="[object Promise]",O0="[object Set]",I0="[object WeakMap]",M0="[object DataView]",KN=Za(ud),QN=Za(ld),JN=Za(cd),eP=Za(fd),tP=Za(hd),vo=Vy;(ud&&vo(new ud(new ArrayBuffer(1)))!=M0||ld&&vo(new ld)!=R0||cd&&vo(cd.resolve())!=C0||fd&&vo(new fd)!=O0||hd&&vo(new hd)!=I0)&&(vo=function(e){var t=Vy(e),r=t==qN?e.constructor:void 0,n=r?Za(r):"";if(n)switch(n){case KN:return M0;case QN:return R0;case JN:return C0;case eP:return O0;case tP:return I0}return t});var of=vo,rP=Object.prototype,nP=rP.hasOwnProperty;function iP(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&nP.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var oP=iP,aP=Kn,sP=aP.Uint8Array,Hy=sP,N0=Hy;function uP(e){var t=new e.constructor(e.byteLength);return new N0(t).set(new N0(e)),t}var Ip=uP,lP=Ip;function cP(e,t){var r=t?lP(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var fP=cP,hP=/\w*$/;function dP(e){var t=new e.constructor(e.source,hP.exec(e));return t.lastIndex=e.lastIndex,t}var pP=dP,P0=Mu,L0=P0?P0.prototype:void 0,w0=L0?L0.valueOf:void 0;function _P(e){return w0?Object(w0.call(e)):{}}var vP=_P,mP=Ip;function gP(e,t){var r=t?mP(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var jy=gP,EP=Ip,yP=fP,TP=pP,AP=vP,SP=jy,xP="[object Boolean]",bP="[object Date]",RP="[object Map]",CP="[object Number]",OP="[object RegExp]",IP="[object Set]",MP="[object String]",NP="[object Symbol]",PP="[object ArrayBuffer]",LP="[object DataView]",wP="[object Float32Array]",FP="[object Float64Array]",BP="[object Int8Array]",DP="[object Int16Array]",UP="[object Int32Array]",kP="[object Uint8Array]",$P="[object Uint8ClampedArray]",zP="[object Uint16Array]",VP="[object Uint32Array]";function HP(e,t,r){var n=e.constructor;switch(t){case PP:return EP(e);case xP:case bP:return new n(+e);case LP:return yP(e,r);case wP:case FP:case BP:case DP:case UP:case kP:case $P:case zP:case VP:return SP(e,r);case RP:return new n;case CP:case MP:return new n(e);case OP:return TP(e);case IP:return new n;case NP:return AP(e)}}var jP=HP,XP=Dn,F0=Object.create,WP=function(){function e(){}return function(t){if(!XP(t))return{};if(F0)return F0(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),GP=WP,YP=GP,ZP=Op,qP=xp;function KP(e){return typeof e.constructor=="function"&&!qP(e)?YP(ZP(e)):{}}var Xy=KP,QP=of,JP=Un,e4="[object Map]";function t4(e){return JP(e)&&QP(e)==e4}var r4=t4,n4=r4,i4=tf,B0=Sp,D0=B0&&B0.isMap,o4=D0?i4(D0):n4,a4=o4,s4=of,u4=Un,l4="[object Set]";function c4(e){return u4(e)&&s4(e)==l4}var f4=c4,h4=f4,d4=tf,U0=Sp,k0=U0&&U0.isSet,p4=k0?d4(k0):h4,_4=p4,v4=Tp,m4=XO,g4=Oy,E4=LM,y4=qM,T4=Fy,A4=Rp,S4=lN,x4=AN,b4=$y,R4=wN,C4=of,O4=oP,I4=jP,M4=Xy,N4=Ti,P4=ef,L4=a4,w4=Dn,F4=_4,B4=bp,D4=Lu,U4=1,k4=2,$4=4,Wy="[object Arguments]",z4="[object Array]",V4="[object Boolean]",H4="[object Date]",j4="[object Error]",Gy="[object Function]",X4="[object GeneratorFunction]",W4="[object Map]",G4="[object Number]",Yy="[object Object]",Y4="[object RegExp]",Z4="[object Set]",q4="[object String]",K4="[object Symbol]",Q4="[object WeakMap]",J4="[object ArrayBuffer]",eL="[object DataView]",tL="[object Float32Array]",rL="[object Float64Array]",nL="[object Int8Array]",iL="[object Int16Array]",oL="[object Int32Array]",aL="[object Uint8Array]",sL="[object Uint8ClampedArray]",uL="[object Uint16Array]",lL="[object Uint32Array]",er={};er[Wy]=er[z4]=er[J4]=er[eL]=er[V4]=er[H4]=er[tL]=er[rL]=er[nL]=er[iL]=er[oL]=er[W4]=er[G4]=er[Yy]=er[Y4]=er[Z4]=er[q4]=er[K4]=er[aL]=er[sL]=er[uL]=er[lL]=!0;er[j4]=er[Gy]=er[Q4]=!1;function Yl(e,t,r,n,i,o){var a,s=t&U4,u=t&k4,l=t&$4;if(r&&(a=i?r(e,n,i,o):r(e)),a!==void 0)return a;if(!w4(e))return e;var f=N4(e);if(f){if(a=O4(e),!s)return A4(e,a)}else{var c=C4(e),h=c==Gy||c==X4;if(P4(e))return T4(e,s);if(c==Yy||c==Wy||h&&!i){if(a=u||h?{}:M4(e),!s)return u?x4(e,y4(a,e)):S4(e,E4(a,e))}else{if(!er[c])return i?e:{};a=I4(e,c,s)}}o||(o=new v4);var d=o.get(e);if(d)return d;o.set(e,a),F4(e)?e.forEach(function(g){a.add(Yl(g,t,r,g,e,o))}):L4(e)&&e.forEach(function(g,y){a.set(y,Yl(g,t,r,y,e,o))});var p=l?u?R4:b4:u?D4:B4,v=f?void 0:p(e);return m4(v||e,function(g,y){v&&(y=g,g=e[y]),g4(a,y,Yl(g,t,r,y,e,o))}),a}var cL=Yl,fL=cL,hL=1,dL=4;function pL(e){return fL(e,hL|dL)}var _L=pL;const vL=Ht(_L);var mL=Kn,gL=function(){return mL.Date.now()},EL=gL,yL=Dn,Ch=EL,$0=by,TL="Expected a function",AL=Math.max,SL=Math.min;function xL(e,t,r){var n,i,o,a,s,u,l=0,f=!1,c=!1,h=!0;if(typeof e!="function")throw new TypeError(TL);t=$0(t)||0,yL(r)&&(f=!!r.leading,c="maxWait"in r,o=c?AL($0(r.maxWait)||0,t):o,h="trailing"in r?!!r.trailing:h);function d($){var F=n,Y=i;return n=i=void 0,l=$,a=e.apply(Y,F),a}function p($){return l=$,s=setTimeout(y,t),f?d($):a}function v($){var F=$-u,Y=$-l,ge=t-F;return c?SL(ge,o-Y):ge}function g($){var F=$-u,Y=$-l;return u===void 0||F>=t||F<0||c&&Y>=o}function y(){var $=Ch();if(g($))return S($);s=setTimeout(y,v($))}function S($){return s=void 0,h&&n?d($):(n=i=void 0,a)}function R(){s!==void 0&&clearTimeout(s),l=0,n=u=i=s=void 0}function x(){return s===void 0?a:S(Ch())}function M(){var $=Ch(),F=g($);if(n=arguments,i=this,u=$,F){if(s===void 0)return p(u);if(c)return clearTimeout(s),s=setTimeout(y,t),d(u)}return s===void 0&&(s=setTimeout(y,t)),a}return M.cancel=R,M.flush=x,M}var Zy=xL;const bL=Ht(Zy);var RL=Ti,CL=Yc,OL=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,IL=/^\w*$/;function ML(e,t){if(RL(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||CL(e)?!0:IL.test(e)||!OL.test(e)||t!=null&&e in Object(t)}var NL=ML,qy=yp,PL="Expected a function";function Mp(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(PL);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Mp.Cache||qy),r}Mp.Cache=qy;var LL=Mp,wL=LL,FL=500;function BL(e){var t=wL(e,function(n){return r.size===FL&&r.clear(),n}),r=t.cache;return t}var DL=BL,UL=DL,kL=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$L=/\\(\\)?/g,zL=UL(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(kL,function(r,n,i,o){t.push(i?o.replace($L,"$1"):n||r)}),t}),VL=zL;function HL(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var Ky=HL,z0=Mu,jL=Ky,XL=Ti,WL=Yc,GL=1/0,V0=z0?z0.prototype:void 0,H0=V0?V0.toString:void 0;function Qy(e){if(typeof e=="string")return e;if(XL(e))return jL(e,Qy)+"";if(WL(e))return H0?H0.call(e):"";var t=e+"";return t=="0"&&1/e==-GL?"-0":t}var YL=Qy,ZL=YL;function qL(e){return e==null?"":ZL(e)}var qa=qL,KL=Ti,QL=NL,JL=VL,ew=qa;function tw(e,t){return KL(e)?e:QL(e,t)?[e]:JL(ew(e))}var rw=tw,nw=Yc,iw=1/0;function ow(e){if(typeof e=="string"||nw(e))return e;var t=e+"";return t=="0"&&1/e==-iw?"-0":t}var aw=ow,sw=rw,uw=aw;function lw(e,t){t=sw(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[uw(t[r++])];return r&&r==n?e:void 0}var cw=lw,fw=cw;function hw(e,t,r){var n=e==null?void 0:fw(e,t);return n===void 0?r:n}var dw=hw;const pw=Ht(dw);var _w=yi,vw=Un,mw="[object Boolean]";function gw(e){return e===!0||e===!1||vw(e)&&_w(e)==mw}var Ew=gw;const yw=Ht(Ew);var Tw="__lodash_hash_undefined__";function Aw(e){return this.__data__.set(e,Tw),this}var Sw=Aw;function xw(e){return this.__data__.has(e)}var bw=xw,Rw=yp,Cw=Sw,Ow=bw;function fc(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Rw;++t<r;)this.add(e[t])}fc.prototype.add=fc.prototype.push=Cw;fc.prototype.has=Ow;var Jy=fc;function Iw(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Mw=Iw;function Nw(e,t){return e.has(t)}var eT=Nw,Pw=Jy,Lw=Mw,ww=eT,Fw=1,Bw=2;function Dw(e,t,r,n,i,o){var a=r&Fw,s=e.length,u=t.length;if(s!=u&&!(a&&u>s))return!1;var l=o.get(e),f=o.get(t);if(l&&f)return l==t&&f==e;var c=-1,h=!0,d=r&Bw?new Pw:void 0;for(o.set(e,t),o.set(t,e);++c<s;){var p=e[c],v=t[c];if(n)var g=a?n(v,p,c,t,e,o):n(p,v,c,e,t,o);if(g!==void 0){if(g)continue;h=!1;break}if(d){if(!Lw(t,function(y,S){if(!ww(d,S)&&(p===y||i(p,y,r,n,o)))return d.push(S)})){h=!1;break}}else if(!(p===v||i(p,v,r,n,o))){h=!1;break}}return o.delete(e),o.delete(t),h}var tT=Dw;function Uw(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var kw=Uw;function $w(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Np=$w,j0=Mu,X0=Hy,zw=Nu,Vw=tT,Hw=kw,jw=Np,Xw=1,Ww=2,Gw="[object Boolean]",Yw="[object Date]",Zw="[object Error]",qw="[object Map]",Kw="[object Number]",Qw="[object RegExp]",Jw="[object Set]",eF="[object String]",tF="[object Symbol]",rF="[object ArrayBuffer]",nF="[object DataView]",W0=j0?j0.prototype:void 0,Oh=W0?W0.valueOf:void 0;function iF(e,t,r,n,i,o,a){switch(r){case nF:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case rF:return!(e.byteLength!=t.byteLength||!o(new X0(e),new X0(t)));case Gw:case Yw:case Kw:return zw(+e,+t);case Zw:return e.name==t.name&&e.message==t.message;case Qw:case eF:return e==t+"";case qw:var s=Hw;case Jw:var u=n&Xw;if(s||(s=jw),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=Ww,a.set(e,t);var f=Vw(s(e),s(t),n,i,o,a);return a.delete(e),f;case tF:if(Oh)return Oh.call(e)==Oh.call(t)}return!1}var oF=iF,G0=$y,aF=1,sF=Object.prototype,uF=sF.hasOwnProperty;function lF(e,t,r,n,i,o){var a=r&aF,s=G0(e),u=s.length,l=G0(t),f=l.length;if(u!=f&&!a)return!1;for(var c=u;c--;){var h=s[c];if(!(a?h in t:uF.call(t,h)))return!1}var d=o.get(e),p=o.get(t);if(d&&p)return d==t&&p==e;var v=!0;o.set(e,t),o.set(t,e);for(var g=a;++c<u;){h=s[c];var y=e[h],S=t[h];if(n)var R=a?n(S,y,h,t,e,o):n(y,S,h,e,t,o);if(!(R===void 0?y===S||i(y,S,r,n,o):R)){v=!1;break}g||(g=h=="constructor")}if(v&&!g){var x=e.constructor,M=t.constructor;x!=M&&"constructor"in e&&"constructor"in t&&!(typeof x=="function"&&x instanceof x&&typeof M=="function"&&M instanceof M)&&(v=!1)}return o.delete(e),o.delete(t),v}var cF=lF,Ih=Tp,fF=tT,hF=oF,dF=cF,Y0=of,Z0=Ti,q0=ef,pF=rf,_F=1,K0="[object Arguments]",Q0="[object Array]",Cl="[object Object]",vF=Object.prototype,J0=vF.hasOwnProperty;function mF(e,t,r,n,i,o){var a=Z0(e),s=Z0(t),u=a?Q0:Y0(e),l=s?Q0:Y0(t);u=u==K0?Cl:u,l=l==K0?Cl:l;var f=u==Cl,c=l==Cl,h=u==l;if(h&&q0(e)){if(!q0(t))return!1;a=!0,f=!1}if(h&&!f)return o||(o=new Ih),a||pF(e)?fF(e,t,r,n,i,o):hF(e,t,u,r,n,i,o);if(!(r&_F)){var d=f&&J0.call(e,"__wrapped__"),p=c&&J0.call(t,"__wrapped__");if(d||p){var v=d?e.value():e,g=p?t.value():t;return o||(o=new Ih),i(v,g,r,n,o)}}return h?(o||(o=new Ih),dF(e,t,r,n,i,o)):!1}var gF=mF,EF=gF,em=Un;function rT(e,t,r,n,i){return e===t?!0:e==null||t==null||!em(e)&&!em(t)?e!==e&&t!==t:EF(e,t,r,n,rT,i)}var yF=rT,TF=yF;function AF(e,t){return TF(e,t)}var SF=AF;const xF=Ht(SF);function bF(e){return e==null}var RF=bF;const CF=Ht(RF);var OF=yi,IF=Un,MF="[object Number]";function NF(e){return typeof e=="number"||IF(e)&&OF(e)==MF}var PF=NF;const LF=Ht(PF);var wF=yi,FF=Op,BF=Un,DF="[object Object]",UF=Function.prototype,kF=Object.prototype,nT=UF.toString,$F=kF.hasOwnProperty,zF=nT.call(Object);function VF(e){if(!BF(e)||wF(e)!=DF)return!1;var t=FF(e);if(t===null)return!0;var r=$F.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&nT.call(r)==zF}var iT=VF;const HF=Ht(iT);var jF=yi,XF=Ti,WF=Un,GF="[object String]";function YF(e){return typeof e=="string"||!XF(e)&&WF(e)&&jF(e)==GF}var ZF=YF;const qF=Ht(ZF);var KF=Ap,QF=Nu;function JF(e,t,r){(r!==void 0&&!QF(e[t],r)||r===void 0&&!(t in e))&&KF(e,t,r)}var oT=JF;function eB(e){return function(t,r,n){for(var i=-1,o=Object(t),a=n(t),s=a.length;s--;){var u=a[e?s:++i];if(r(o[u],u,o)===!1)break}return t}}var tB=eB,rB=tB,nB=rB(),iB=nB,oB=nf,aB=Un;function sB(e){return aB(e)&&oB(e)}var uB=sB;function lB(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var aT=lB,cB=Pu,fB=Lu;function hB(e){return cB(e,fB(e))}var dB=hB,tm=oT,pB=Fy,_B=jy,vB=Rp,mB=Xy,rm=My,nm=Ti,gB=uB,EB=ef,yB=Kc,TB=Dn,AB=iT,SB=rf,im=aT,xB=dB;function bB(e,t,r,n,i,o,a){var s=im(e,r),u=im(t,r),l=a.get(u);if(l){tm(e,r,l);return}var f=o?o(s,u,r+"",e,t,a):void 0,c=f===void 0;if(c){var h=nm(u),d=!h&&EB(u),p=!h&&!d&&SB(u);f=u,h||d||p?nm(s)?f=s:gB(s)?f=vB(s):d?(c=!1,f=pB(u,!0)):p?(c=!1,f=_B(u,!0)):f=[]:AB(u)||rm(u)?(f=s,rm(s)?f=xB(s):(!TB(s)||yB(s))&&(f=mB(u))):c=!1}c&&(a.set(u,f),i(f,u,n,o,a),a.delete(u)),tm(e,r,f)}var RB=bB,CB=Tp,OB=oT,IB=iB,MB=RB,NB=Dn,PB=Lu,LB=aT;function sT(e,t,r,n,i){e!==t&&IB(t,function(o,a){if(i||(i=new CB),NB(o))MB(e,t,a,r,sT,n,i);else{var s=n?n(LB(e,a),o,a+"",e,t,i):void 0;s===void 0&&(s=o),OB(e,a,s)}},PB)}var uT=sT;function wB(e){return e}var lT=wB;function FB(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var BB=FB,DB=BB,om=Math.max;function UB(e,t,r){return t=om(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=om(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),DB(e,this,s)}}var kB=UB;function $B(e){return function(){return e}}var zB=$B,VB=zB,am=Cy,HB=lT,jB=am?function(e,t){return am(e,"toString",{configurable:!0,enumerable:!1,value:VB(t),writable:!0})}:HB,XB=jB,WB=800,GB=16,YB=Date.now;function ZB(e){var t=0,r=0;return function(){var n=YB(),i=GB-(n-r);if(r=n,i>0){if(++t>=WB)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var qB=ZB,KB=XB,QB=qB,JB=QB(KB),eD=JB,tD=lT,rD=kB,nD=eD;function iD(e,t){return nD(rD(e,t,tD),e+"")}var cT=iD,oD=Nu,aD=nf,sD=Ny,uD=Dn;function lD(e,t,r){if(!uD(r))return!1;var n=typeof t;return(n=="number"?aD(r)&&sD(t,r.length):n=="string"&&t in r)?oD(r[t],e):!1}var cD=lD,fD=cT,hD=cD;function dD(e){return fD(function(t,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&hD(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,o)}return t})}var fT=dD,pD=uT,_D=fT,vD=_D(function(e,t,r){pD(e,t,r)}),mD=vD;const gD=Ht(mD);var ED=uT,yD=fT,TD=yD(function(e,t,r,n){ED(e,t,r,n)}),AD=TD;const SD=Ht(AD);function xD(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}var bD=xD;function RD(e){return e!==e}var CD=RD;function OD(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var ID=OD,MD=bD,ND=CD,PD=ID;function LD(e,t,r){return t===t?PD(e,t,r):MD(e,ND,r)}var hT=LD;function wD(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}var FD=wD,BD=Ky,DD=hT,UD=FD,kD=tf,$D=Rp,zD=Array.prototype,sm=zD.splice;function VD(e,t,r,n){var i=n?UD:DD,o=-1,a=t.length,s=e;for(e===t&&(t=$D(t)),r&&(s=BD(e,kD(r)));++o<a;)for(var u=0,l=t[o],f=r?r(l):l;(u=i(s,f,u,n))>-1;)s!==e&&sm.call(s,u,1),sm.call(e,u,1);return e}var HD=VD,jD=HD;function XD(e,t){return e&&e.length&&t&&t.length?jD(e,t):e}var WD=XD,GD=cT,YD=WD,ZD=GD(YD),qD=ZD;const KD=Ht(qD);var QD=Zy,JD=Dn,e6="Expected a function";function t6(e,t,r){var n=!0,i=!0;if(typeof e!="function")throw new TypeError(e6);return JD(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),QD(e,t,{leading:n,maxWait:t,trailing:i})}var r6=t6;const n6=Ht(r6);var i6=hT;function o6(e,t){var r=e==null?0:e.length;return!!r&&i6(e,t,0)>-1}var a6=o6;function s6(e,t,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}var u6=s6;function l6(){}var c6=l6,Mh=zy,f6=c6,h6=Np,d6=1/0,p6=Mh&&1/h6(new Mh([,-0]))[1]==d6?function(e){return new Mh(e)}:f6,_6=p6,v6=Jy,m6=a6,g6=u6,E6=eT,y6=_6,T6=Np,A6=200;function S6(e,t,r){var n=-1,i=m6,o=e.length,a=!0,s=[],u=s;if(r)a=!1,i=g6;else if(o>=A6){var l=t?null:y6(e);if(l)return T6(l);a=!1,i=E6,u=new v6}else u=t?[]:s;e:for(;++n<o;){var f=e[n],c=t?t(f):f;if(f=r||f!==0?f:0,a&&c===c){for(var h=u.length;h--;)if(u[h]===c)continue e;t&&u.push(c),s.push(f)}else i(u,c,r)||(u!==s&&u.push(c),s.push(f))}return s}var x6=S6,b6=x6;function R6(e){return e&&e.length?b6(e):[]}var C6=R6;const O6=Ht(C6);function I6(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n<i;)o[n]=e[n+t];return o}var M6=I6,N6=M6;function P6(e,t,r){var n=e.length;return r=r===void 0?n:r,!t&&r>=n?e:N6(e,t,r)}var L6=P6,w6="\\ud800-\\udfff",F6="\\u0300-\\u036f",B6="\\ufe20-\\ufe2f",D6="\\u20d0-\\u20ff",U6=F6+B6+D6,k6="\\ufe0e\\ufe0f",$6="\\u200d",z6=RegExp("["+$6+w6+U6+k6+"]");function V6(e){return z6.test(e)}var dT=V6;function H6(e){return e.split("")}var j6=H6,pT="\\ud800-\\udfff",X6="\\u0300-\\u036f",W6="\\ufe20-\\ufe2f",G6="\\u20d0-\\u20ff",Y6=X6+W6+G6,Z6="\\ufe0e\\ufe0f",q6="["+pT+"]",dd="["+Y6+"]",pd="\\ud83c[\\udffb-\\udfff]",K6="(?:"+dd+"|"+pd+")",_T="[^"+pT+"]",vT="(?:\\ud83c[\\udde6-\\uddff]){2}",mT="[\\ud800-\\udbff][\\udc00-\\udfff]",Q6="\\u200d",gT=K6+"?",ET="["+Z6+"]?",J6="(?:"+Q6+"(?:"+[_T,vT,mT].join("|")+")"+ET+gT+")*",e5=ET+gT+J6,t5="(?:"+[_T+dd+"?",dd,vT,mT,q6].join("|")+")",r5=RegExp(pd+"(?="+pd+")|"+t5+e5,"g");function n5(e){return e.match(r5)||[]}var i5=n5,o5=j6,a5=dT,s5=i5;function u5(e){return a5(e)?s5(e):o5(e)}var l5=u5,c5=L6,f5=dT,h5=l5,d5=qa;function p5(e){return function(t){t=d5(t);var r=f5(t)?h5(t):void 0,n=r?r[0]:t.charAt(0),i=r?c5(r,1).join(""):t.slice(1);return n[e]()+i}}var _5=p5,v5=_5,m5=v5("toUpperCase"),yT=m5;const g5=Ht(yT);function E5(e){return e===void 0}var y5=E5;const T5=Ht(y5);var A5=qa,S5=yT;function x5(e){return S5(A5(e).toLowerCase())}var b5=x5;function R5(e,t,r,n){var i=-1,o=e==null?0:e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}var C5=R5;function O5(e){return function(t){return e==null?void 0:e[t]}}var I5=O5,M5=I5,N5={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},P5=M5(N5),L5=P5,w5=L5,F5=qa,B5=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,D5="\\u0300-\\u036f",U5="\\ufe20-\\ufe2f",k5="\\u20d0-\\u20ff",$5=D5+U5+k5,z5="["+$5+"]",V5=RegExp(z5,"g");function H5(e){return e=F5(e),e&&e.replace(B5,w5).replace(V5,"")}var j5=H5,X5=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function W5(e){return e.match(X5)||[]}var G5=W5,Y5=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Z5(e){return Y5.test(e)}var q5=Z5,TT="\\ud800-\\udfff",K5="\\u0300-\\u036f",Q5="\\ufe20-\\ufe2f",J5="\\u20d0-\\u20ff",e7=K5+Q5+J5,AT="\\u2700-\\u27bf",ST="a-z\\xdf-\\xf6\\xf8-\\xff",t7="\\xac\\xb1\\xd7\\xf7",r7="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",n7="\\u2000-\\u206f",i7=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",xT="A-Z\\xc0-\\xd6\\xd8-\\xde",o7="\\ufe0e\\ufe0f",bT=t7+r7+n7+i7,RT="['’]",um="["+bT+"]",a7="["+e7+"]",CT="\\d+",s7="["+AT+"]",OT="["+ST+"]",IT="[^"+TT+bT+CT+AT+ST+xT+"]",u7="\\ud83c[\\udffb-\\udfff]",l7="(?:"+a7+"|"+u7+")",c7="[^"+TT+"]",MT="(?:\\ud83c[\\udde6-\\uddff]){2}",NT="[\\ud800-\\udbff][\\udc00-\\udfff]",va="["+xT+"]",f7="\\u200d",lm="(?:"+OT+"|"+IT+")",h7="(?:"+va+"|"+IT+")",cm="(?:"+RT+"(?:d|ll|m|re|s|t|ve))?",fm="(?:"+RT+"(?:D|LL|M|RE|S|T|VE))?",PT=l7+"?",LT="["+o7+"]?",d7="(?:"+f7+"(?:"+[c7,MT,NT].join("|")+")"+LT+PT+")*",p7="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",_7="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",v7=LT+PT+d7,m7="(?:"+[s7,MT,NT].join("|")+")"+v7,g7=RegExp([va+"?"+OT+"+"+cm+"(?="+[um,va,"$"].join("|")+")",h7+"+"+fm+"(?="+[um,va+lm,"$"].join("|")+")",va+"?"+lm+"+"+cm,va+"+"+fm,_7,p7,CT,m7].join("|"),"g");function E7(e){return e.match(g7)||[]}var y7=E7,T7=G5,A7=q5,S7=qa,x7=y7;function b7(e,t,r){return e=S7(e),t=r?void 0:t,t===void 0?A7(e)?x7(e):T7(e):e.match(t)||[]}var R7=b7,C7=C5,O7=j5,I7=R7,M7="['’]",N7=RegExp(M7,"g");function P7(e){return function(t){return C7(I7(O7(t).replace(N7,"")),e,"")}}var L7=P7,w7=b5,F7=L7,B7=F7(function(e,t,r){return t=t.toLowerCase(),e+(r?w7(t):t)}),D7=B7;const U7=Ht(D7);var k7=qa,$7=0;function z7(e){var t=++$7;return k7(e)+t}var V7=z7;const H7=Ht(V7);var Sr={isNil:CF,merge:gD,throttle:n6,isString:qF,debounce:bL,pull:KD,isTypedArray:tM,isPlainObject:HF,isNumber:LF,isBoolean:yw,isEqual:xF,cloneDeep:vL,uniq:O6,clamp:m3,upperFirst:g5,get:pw,mergeWith:SD,isFunction:iC,isObject:B2,isUndefined:T5,camelCase:U7,uniqueId:H7};function j7(e){let t=e;return typeof e=="string"&&(t=window.document.getElementById(e)),t}function wT(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function FT(e){return wT(e).split(/\s+/)}function X7(e){var t;const r=(t=document==null?void 0:document.documentElement)==null?void 0:t.style;if(!r)return e[0];for(const n in e)if(e[n]&&e[n]in r)return e[n];return e[0]}function yn(e,t,r){const n=window.document.createElement(e);return t&&(n.className=t||""),r&&r.appendChild(n),n}function hc(e){const t=e.parentNode;t&&t.removeChild(e)}function iu(e,t){if(e.classList!==void 0){const r=FT(t);for(let n=0,i=r.length;n<i;n++)e.classList.add(r[n])}else if(!W7(e,t)){const r=Pp(e);BT(e,(r?r+" ":"")+t)}}function _d(e,t){e.classList!==void 0?FT(t).forEach(n=>{e.classList.remove(n)}):BT(e,wT((" "+Pp(e)+" ").replace(" "+t+" "," ")))}function W7(e,t){if(e.classList!==void 0)return e.classList.contains(t);const r=Pp(e);return r.length>0&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(r)}function BT(e,t){e instanceof HTMLElement?e.className=t:e.className.baseVal=t}function Pp(e){return e instanceof SVGElement&&(e=e.correspondingElement),e.className.baseVal===void 0?e.className:e.className.baseVal}X7(["transform","WebkitTransform"]);function G7(){var e;const t=window.document.querySelector('meta[name="viewport"]');if(!t)return 1;const n=((e=t.content)==null?void 0:e.split(",")).find(i=>{const[o]=i.split("=");return o==="initial-scale"});return n?n.split("=")[1]*1:1}var ln=G7()<1?1:window.devicePixelRatio;function Y7(e,t){e.setAttribute("style",`${e.style.cssText}${t}`)}function Z7(e){return Object.entries(e).map(([t,r])=>`${t}: ${r}`).join(";")}function q7(e,t){return{left:e.left-t.left,top:e.top-t.top,right:t.left+t.width-e.left-e.width,bottom:t.top+t.height-e.top-e.height}}function DT(e){e.innerHTML=""}function K7(e){e.setAttribute("draggable","false")}function Q7(e,t){var r;const n=Array.isArray(t)?t:[t];let i=e;for(;i instanceof Element&&i!==window.document.body;){if(n.find(o=>i==null?void 0:i.matches(o)))return i;i=(r=i==null?void 0:i.parentElement)!=null?r:null}}function J7(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}var vd=navigator==null?void 0:navigator.userAgent;vd.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);vd.indexOf("Android")>-1||vd.indexOf("Adr")>-1;function md(e){var t=[1/0,1/0,-1/0,-1/0];return _y(e,function(r){t[0]>r[0]&&(t[0]=r[0]),t[1]>r[1]&&(t[1]=r[1]),t[2]<r[0]&&(t[2]=r[0]),t[3]<r[1]&&(t[3]=r[1])}),t}md.default=md;function Nh(e){return typeof e=="number"}function Ir(e){return e-Math.fround(e)}var hm=2*Math.PI*6378137/2;function eU(e,t){const[r,n,i,o]=t;return e.lng>r&&e.lng<=i&&e.lat>n&&e.lat<=o}function tU(e){const t=[1/0,1/0,-1/0,-1/0];return e.forEach(r=>{const{coordinates:n}=r;UT(t,n)}),t}function UT(e,t){return Array.isArray(t[0])?t.forEach(r=>{UT(e,r)}):(e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])),e}function Zl(e,t=!0,r={enable:!0,decimal:1}){e=iU(e,t);const n=e[0],i=e[1];let o=n*hm/180,a=Math.log(Math.tan((90+i)*Math.PI/360))/(Math.PI/180);return a=a*hm/180,r.enable&&(o=Number(o.toFixed(r.decimal)),a=Number(a.toFixed(r.decimal))),e.length===3?[o,a,e[2]]:[o,a]}function rU(e){if(e==null)throw new Error("lng is required");return(e>180||e<-180)&&(e=e%360,e>180&&(e=-360+e),e<-180&&(e=360+e),e===0&&(e=0)),e}function nU(e){if(e==null)throw new Error("lat is required");return(e>90||e<-90)&&(e=e%180,e>90&&(e=-180+e),e<-90&&(e=180+e),e===0&&(e=0)),e}function iU(e,t){if(t===!1)return e;const r=rU(e[0]);let n=nU(e[1]);return n>85&&(n=85),n<-85&&(n=-85),e.length===3?[r,n,e[2]]:[r,n]}function Pn(e){const t=85.0511287798,r=Math.max(Math.min(t,e[1]),-t),n=256<<20;let i=Math.PI/180,o=e[0]*i,a=r*i;a=Math.log(Math.tan(Math.PI/4+a/2));const s=.5/Math.PI,u=.5,l=-.5/Math.PI;return i=.5,o=n*(s*o+u),a=n*(l*a+i),[Math.floor(o),Math.floor(a)]}function Ph(e,t){const r=85.0511287798,n=Math.PI/180,i=6378137;return t=Math.max(Math.min(r,t),-r),e*=n,t*=n,t=Math.log(Math.tan(Math.PI/4+t/2)),[e*i,t*i]}function Lp(e,t){const r=Math.abs(e[1][1]-e[0][1])*t,n=Math.abs(e[1][0]-e[0][0])*t;return[[e[0][0]-n,e[0][1]-r],[e[1][0]+n,e[1][1]+r]]}function kT(e,t){return e[0][0]<=t[0][0]&&e[0][1]<=t[0][1]&&e[1][0]>=t[1][0]&&e[1][1]>=t[1][1]}function dc(e){return[[e[0],e[1]],[e[2],e[3]]]}function oU(e){const t=aU(e,[0,0]);return[e[0]/t,e[1]/t]}function aU(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function Ao(e){if(Nh(e[0]))return e;if(Nh(e[0][0]))throw new Error("当前数据不支持标注");if(Nh(e[0][0][0])){const t=e;let r=0,n=0,i=0;return t.forEach(o=>{o.forEach(a=>{r+=a[0],n+=a[1],i++})}),[r/i,n/i,0]}else throw new Error("当前数据不支持标注")}function sU(e){let t=e[0],r=e[1],n=e[0],i=e[1],o=0,a=0,s=0;for(let u=0;u<e.length;u+=2){const l=e[u],f=e[u+1];l&&f&&(t=Math.max(l,t),r=Math.max(f,r),n=Math.min(l,n),i=Math.min(f,i),o+=l,a+=f,s++)}return{center:[o/s,a/s],radius:Math.sqrt(Math.pow(t-n,2)+Math.pow(r-i,2))/2}}function uU(e){return md(QR([KR(e)]))}function lU(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var cU=class{constructor(e=50,t){this.limit=e,this.destroy=t||this.defaultDestroy,this.order=[],this.clear()}clear(){this.order.forEach(e=>{this.delete(e)}),this.cache={},this.order=[]}get(e){const t=this.cache[e];return t&&(this.deleteOrder(e),this.appendOrder(e)),t}set(e,t){this.cache[e]?(this.delete(e),this.cache[e]=t,this.appendOrder(e)):(Object.keys(this.cache).length===this.limit&&this.delete(this.order[0]),this.cache[e]=t,this.appendOrder(e))}delete(e){const t=this.cache[e];t&&(this.deleteCache(e),this.deleteOrder(e),this.destroy(t,e))}deleteCache(e){delete this.cache[e]}deleteOrder(e){const t=this.order.findIndex(r=>r===e);t>=0&&this.order.splice(t,1)}appendOrder(e){this.order.push(e)}defaultDestroy(e,t){return null}};function fU(e){if(e.length===0)throw new Error("max requires at least one data point");let t=e[0];for(let r=1;r<e.length;r++)e[r]>t&&(t=e[r]);return t*1}function hU(e){if(e.length===0)throw new Error("min requires at least one data point");let t=e[0];for(let r=1;r<e.length;r++)e[r]<t&&(t=e[r]);return t*1}function $T(e){if(e.length===0)return 0;let t=e[0]*1;for(let r=1;r<e.length;r++)t+=e[r]*1;return t}function dU(e){if(e.length===0)throw new Error("mean requires at least one data point");return $T(e)/e.length}function pU(e){if(e.length===0)throw new Error("mean requires at least one data point");if(e.length<3)return e[0];e.sort();let t=e[0],r=NaN,n=0,i=1;for(let o=1;o<e.length+1;o++)e[o]!==t?(i>n&&(n=i,r=t),i=1,t=e[o]):i++;return r*1}var zT={min:hU,max:fU,mean:dU,sum:$T,mode:pU};function VT(e,t){return e.map(r=>r[t])}function _U(e,t){t===void 0&&(t={});var r=Number(e[0]),n=Number(e[1]),i=Number(e[2]),o=Number(e[3]);if(e.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var a=[r,n],s=[r,o],u=[i,o],l=[i,n];return cp([[a,l,u,s,a]],t.properties,{bbox:e,id:t.id})}var ou=(e=>(e.Realtime="realtime",e.Overlap="overlap",e.Replace="replace",e))(ou||{}),On=(e=>(e.Loading="Loading",e.Loaded="Loaded",e.Failure="Failure",e.Cancelled="Cancelled",e))(On||{}),HT=0,dm=1,af=2;function vU(e){e.forEach(t=>{t.isCurrent&&(t.isVisible=t.isLoaded)})}function mU(e){e.forEach(t=>{t.properties.state=HT}),e.forEach(t=>{t.isCurrent&&!jT(t)&&wp(t)}),e.forEach(t=>{t.isVisible=!!(t.properties.state&af)})}function gU(e){e.forEach(r=>{r.properties.state=HT}),e.forEach(r=>{r.isCurrent&&jT(r)}),e.slice().sort((r,n)=>r.z-n.z).forEach(r=>{r.isVisible=!!(r.properties.state&af),r.children.length&&(r.isVisible||r.properties.state&dm)?r.children.forEach(n=>{n.properties.state=dm}):r.isCurrent&&wp(r)})}function jT(e){for(;e;){if(e.isLoaded)return e.properties.state|=af,!0;e=e.parent}return!1}function wp(e){e.children.forEach(t=>{t.isLoaded?t.properties.state|=af:wp(t)})}var XT=[-1/0,-1/0,1/0,1/0],EU=.2,yU=5,TU={[ou.Realtime]:vU,[ou.Overlap]:mU,[ou.Replace]:gU},AU=()=>{};function gd(e,t,r){const n=Math.floor((e+180)/360*Math.pow(2,r)),i=Math.floor((1-Math.log(Math.tan(t*Math.PI/180)+1/Math.cos(t*Math.PI/180))/Math.PI)/2*Math.pow(2,r));return[n,i]}function pm(e,t,r){const n=e/Math.pow(2,r)*360-180,i=Math.PI-2*Math.PI*t/Math.pow(2,r),o=180/Math.PI*Math.atan(.5*(Math.exp(i)-Math.exp(-i)));return[n,o]}var WT=(e,t,r)=>{const[n,i]=pm(e,t,r),[o,a]=pm(e+1,t+1,r);return[n,a,o,i]};function SU({zoom:e,latLonBounds:t,maxZoom:r=1/0,minZoom:n=0,zoomOffset:i=0,extent:o=XT}){let a=Math.ceil(e)+i;if(Number.isFinite(n)&&a<n)return[];Number.isFinite(r)&&a>r&&(a=r);const[s,u,l,f]=t,c=[Math.max(s,o[0]),Math.max(u,o[1]),Math.min(l,o[2]),Math.min(f,o[3])],h=[],[d,p]=gd(c[0],c[1],a),[v,g]=gd(c[2],c[3],a);for(let x=d;x<=v;x++)for(let M=g;M<=p;M++)h.push({x,y:M,z:a});const y=(v+d)/2,S=(p+g)/2,R=(x,M)=>Math.abs(x-y)+Math.abs(M-S);return h.sort((x,M)=>R(x.x,x.y)-R(M.x,M.y)),h}var xU=(e,t,r,n=!0)=>{const i=Math.pow(2,r),o=i-1,a=i;let s=e;const u=t;return n&&(s<0?s=s+a:s>o&&(s=s%a)),{warpX:s,warpY:u}},bU=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),RU=class extends Bn.EventEmitter{constructor(e){super(),this.tileSize=256,this.isVisible=!1,this.isCurrent=!1,this.isVisibleChange=!1,this.loadedLayers=0,this.isLayerLoaded=!1,this.isLoad=!1,this.isChildLoad=!1,this.parent=null,this.children=[],this.data=null,this.properties={},this.loadDataId=0;const{x:t,y:r,z:n,tileSize:i,warp:o=!0}=e;this.x=t,this.y=r,this.z=n,this.warp=o||!0,this.tileSize=i}get isLoading(){return this.loadStatus===On.Loading}get isLoaded(){return this.loadStatus===On.Loaded}get isFailure(){return this.loadStatus===On.Failure}setTileLayerLoaded(){this.isLayerLoaded=!0}get isCancelled(){return this.loadStatus===On.Cancelled}get isDone(){return[On.Loaded,On.Cancelled,On.Failure].includes(this.loadStatus)}get bounds(){return WT(this.x,this.y,this.z)}get bboxPolygon(){const[e,t,r,n]=this.bounds,i=[(r-e)/2,(n-t)/2];return _U(this.bounds,{properties:{key:this.key,id:this.key,bbox:this.bounds,center:i,meta:`
${this.key}
`}})}get key(){return`${this.x}_${this.y}_${this.z}`}layerLoad(){this.loadedLayers++,this.emit("layerLoaded")}loadData(e){return bU(this,arguments,function*({getData:t,onLoad:r,onError:n}){this.loadDataId++;const i=this.loadDataId;this.isLoading&&this.abortLoad(),this.abortController=new AbortController,this.loadStatus=On.Loading;let o=null,a;try{const{x:s,y:u,z:l,bounds:f,tileSize:c,warp:h}=this,{warpX:d,warpY:p}=xU(s,u,l,h),{signal:v}=this.abortController;o=yield t({x:d,y:p,z:l,bounds:f,tileSize:c,signal:v,warp:h},this)}catch(s){a=s}if(i===this.loadDataId&&!(this.isCancelled&&!o)){if(a||!o){this.loadStatus=On.Failure,n(a,this);return}this.loadStatus=On.Loaded,this.data=o,r(this)}})}reloadData(e){this.isLoading&&this.abortLoad(),this.loadData(e)}abortLoad(){this.isLoaded||this.isCancelled||(this.loadStatus=On.Cancelled,this.abortController.abort(),this.xhrCancel&&this.xhrCancel())}},CU=(e,t)=>{const r=dc(e),n=Lp(r,t),i=360*3-180,o=85.0511287798065;return[Math.max(n[0][0],-i),Math.max(n[0][1],-o),Math.min(n[1][0],i),Math.min(n[1][1],o)]},OU=(e,t)=>{const r=dc(e),n=dc(t);return kT(r,n)},IU=Object.defineProperty,MU=Object.defineProperties,NU=Object.getOwnPropertyDescriptors,_m=Object.getOwnPropertySymbols,PU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,vm=(e,t,r)=>t in e?IU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,mm=(e,t)=>{for(var r in t||(t={}))PU.call(t,r)&&vm(e,r,t[r]);if(_m)for(var r of _m(t))LU.call(t,r)&&vm(e,r,t[r]);return e},wU=(e,t)=>MU(e,NU(t)),{throttle:FU}=Sr,BU=class extends lp{constructor(e){super(),this.currentTiles=[],this.cacheTiles=new Map,this.throttleUpdate=FU((t,r)=>{this.update(t,r)},16),this.onTileLoad=t=>{this.emit("tile-loaded",t),this.updateTileVisible(),this.loadFinished()},this.onTileError=(t,r)=>{this.emit("tile-error",{error:t,tile:r}),this.updateTileVisible(),this.loadFinished()},this.onTileUnload=t=>{this.emit("tile-unload",t),this.loadFinished()},this.options={tileSize:256,minZoom:0,maxZoom:1/0,zoomOffset:0,extent:XT,getTileData:AU,warp:!0,updateStrategy:ou.Replace},this.updateOptions(e)}get isLoaded(){return this.currentTiles.every(e=>e.isDone)}get tiles(){return Array.from(this.cacheTiles.values()).sort((t,r)=>t.z-r.z)}updateOptions(e){const t=e.minZoom===void 0?this.options.minZoom:Math.ceil(e.minZoom),r=e.maxZoom===void 0?this.options.maxZoom:Math.floor(e.maxZoom);this.options=wU(mm(mm({},this.options),e),{minZoom:t,maxZoom:r})}update(e,t){const r=Math.max(0,Math.ceil(e));if(this.lastViewStates&&this.lastViewStates.zoom===r&&OU(this.lastViewStates.latLonBoundsBuffer,t))return;const n=CU(t,EU);this.lastViewStates={zoom:r,latLonBounds:t,latLonBoundsBuffer:n},this.currentZoom=r;let i=!1;const o=this.getTileIndices(r,n).filter(a=>this.options.warp||a.x>=0&&a.x<Math.pow(2,r));this.emit("tiles-load-start"),this.currentTiles=o.map(({x:a,y:s,z:u})=>{let l=this.getTile(a,s,u);return l?(((l==null?void 0:l.isFailure)||(l==null?void 0:l.isCancelled))&&l.loadData({getData:this.options.getTileData,onLoad:this.onTileLoad,onError:this.onTileError}),l):(l=this.createTile(a,s,u),i=!0,l)}),i&&this.resizeCacheTiles(),this.updateTileVisible(),this.pruneRequests()}reloadAll(){for(const[e,t]of this.cacheTiles){if(!this.currentTiles.includes(t)){this.cacheTiles.delete(e),this.onTileUnload(t);return}this.onTileUnload(t),t.loadData({getData:this.options.getTileData,onLoad:this.onTileLoad,onError:this.onTileError})}}reloadTileById(e,t,r){const n=this.cacheTiles.get(`${t},${r},${e}`);n&&(this.onTileUnload(n),n.loadData({getData:this.options.getTileData,onLoad:this.onTileLoad,onError:this.onTileError}))}reloadTileByLnglat(e,t,r){const n=this.getTileByLngLat(e,t,r);n&&this.reloadTileById(n.z,n.x,n.y)}reloadTileByExtent(e,t){this.getTileIndices(t,e).forEach(n=>{this.reloadTileById(n.z,n.x,n.y)})}pruneRequests(){const e=[];for(const t of this.cacheTiles.values())t.isLoading&&!t.isCurrent&&!t.isVisible&&e.push(t);for(;e.length>0;)e.shift().abortLoad()}getTileByLngLat(e,t,r){const{zoomOffset:n}=this.options,i=Math.ceil(r)+n,o=gd(e,t,i);return this.tiles.filter(s=>s.key===`${o[0]}_${o[1]}_${i}`)[0]}getTileExtent(e,t){return this.getTileIndices(t,e)}getTileByZXY(e,t,r){return this.tiles.filter(i=>i.key===`${t}_${r}_${e}`)[0]}clear(){for(const e of this.cacheTiles.values())e.isLoading?e.abortLoad():this.onTileUnload(e);this.lastViewStates=void 0,this.cacheTiles.clear(),this.currentTiles=[]}destroy(){this.clear(),this.removeAllListeners()}updateTileVisible(){const e=this.options.updateStrategy,t=new Map;for(const i of this.cacheTiles.values())t.set(i.key,i.isVisible),i.isCurrent=!1,i.isVisible=!1;for(const i of this.currentTiles)i.isCurrent=!0,i.isVisible=!0;const r=Array.from(this.cacheTiles.values());typeof e=="function"?e(r):TU[e](r);let n=!1;Array.from(this.cacheTiles.values()).forEach(i=>{i.isVisible!==t.get(i.key)?(i.isVisibleChange=!0,n=!0):i.isVisibleChange=!1}),n&&this.emit("tile-update")}getTileIndices(e,t){const{tileSize:r,extent:n,zoomOffset:i}=this.options,o=Math.floor(this.options.maxZoom),a=Math.ceil(this.options.minZoom);return SU({maxZoom:o,minZoom:a,zoomOffset:i,tileSize:r,zoom:e,latLonBounds:t,extent:n})}getTileId(e,t,r){return`${e},${t},${r}`}loadFinished(){const e=!this.currentTiles.some(t=>!t.isDone);return e&&this.emit("tiles-load-finished"),e}getTile(e,t,r){const n=this.getTileId(e,t,r);return this.cacheTiles.get(n)}createTile(e,t,r){const n=this.getTileId(e,t,r),i=new RU({x:e,y:t,z:r,tileSize:this.options.tileSize,warp:this.options.warp});return this.cacheTiles.set(n,i),i.loadData({getData:this.options.getTileData,onLoad:this.onTileLoad,onError:this.onTileError}),i}resizeCacheTiles(){const e=yU*this.currentTiles.length;if(this.cacheTiles.size>e){for(const[r,n]of this.cacheTiles)if(!n.isVisible&&!this.currentTiles.includes(n)&&(this.cacheTiles.delete(r),this.onTileUnload(n)),this.cacheTiles.size<=e)break}this.rebuildTileTree()}rebuildTileTree(){for(const e of this.cacheTiles.values())e.parent=null,e.children.length=0;for(const e of this.cacheTiles.values()){const t=this.getNearestAncestor(e.x,e.y,e.z);e.parent=t,t!=null&&t.children&&t.children.push(e)}}getNearestAncestor(e,t,r){for(;r>this.options.minZoom;){e=Math.floor(e/2),t=Math.floor(t/2),r=r-1;const n=this.getTile(e,t,r);if(n)return n}return null}};function GT(e){const t=[];let r=/\{([a-z])-([a-z])\}/.exec(e);if(r){const n=r[1].charCodeAt(0),i=r[2].charCodeAt(0);let o;for(o=n;o<=i;++o)t.push(e.replace(r[0],String.fromCharCode(o)));return t}if(r=/\{(\d+)-(\d+)\}/.exec(e),r){const n=parseInt(r[2],10);for(let i=parseInt(r[1],10);i<=n;i++)t.push(e.replace(r[0],i.toString()));return t}return t.push(e),t}function xa(e,t){if(!e||!e.length)throw new Error("url is not allowed to be empty");const{x:r,y:n,z:i}=t,o=GT(e),a=Math.abs(r+n)%o.length;return(dp(o[a])?`${o[a]}/{z}/{x}/{y}`:o[a]).replace(/\{x\}/g,r.toString()).replace(/\{y\}/g,n.toString()).replace(/\{z\}/g,i.toString()).replace(/\{bbox\}/g,WT(r,n,i).join(",")).replace(/\{-y\}/g,(Math.pow(2,i)-n-1).toString())}function DU(e,t){const{x:r,y:n,z:i,layer:o,version:a="1.0.0",style:s="default",format:u,service:l="WMTS",tileMatrixset:f}=t,c=GT(e),h=Math.abs(r+n)%c.length;return`${c[h]}&SERVICE=${l}&REQUEST=GetTile&VERSION=${a}&LAYER=${o}&STYLE=${s}&TILEMATRIXSET=${f}&FORMAT=${u}&TILECOL=${r}&TILEROW=${n}&TILEMATRIX=${i}`}function bs(e,t){return e??t}var UU=ql;function ql(e,t){var r=e&&e.type,n;if(r==="FeatureCollection")for(n=0;n<e.features.length;n++)ql(e.features[n],t);else if(r==="GeometryCollection")for(n=0;n<e.geometries.length;n++)ql(e.geometries[n],t);else if(r==="Feature")ql(e.geometry,t);else if(r==="Polygon")gm(e.coordinates,t);else if(r==="MultiPolygon")for(n=0;n<e.coordinates.length;n++)gm(e.coordinates[n],t);return e}function gm(e,t){if(e.length!==0){Em(e[0],t);for(var r=1;r<e.length;r++)Em(e[r],!t)}}function Em(e,t){for(var r=0,n=0,i=0,o=e.length,a=o-1;i<o;a=i++){var s=(e[i][0]-e[a][0])*(e[a][1]+e[i][1]),u=r+s;n+=Math.abs(r)>=Math.abs(s)?r-u+s:s-u+r,r=u}r+n>=0!=!!t&&e.reverse()}const kU=Ht(UU);function $U(e,t){return e.map(r=>r[t]*1)}function YT(e){return Array.isArray(e)?e.length===0||typeof e[0]=="number":!1}function Ed(e){const t=Object.isFrozen(e)?Sr.cloneDeep(e):e;return kU(t,!0),t}function wu(e,t){return e||[[t[0],t[3]],[t[2],t[3]],[t[2],t[1]],[t[0],t[1]]]}var zU=Object.defineProperty,VU=Object.defineProperties,HU=Object.getOwnPropertyDescriptors,ym=Object.getOwnPropertySymbols,jU=Object.prototype.hasOwnProperty,XU=Object.prototype.propertyIsEnumerable,Tm=(e,t,r)=>t in e?zU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Am=(e,t)=>{for(var r in t||(t={}))jU.call(t,r)&&Tm(e,r,t[r]);if(ym)for(var r of ym(t))XU.call(t,r)&&Tm(e,r,t[r]);return e},Sm=(e,t)=>VU(e,HU(t));function ZT(e,t){const{x:r,y:n,x1:i,y1:o,coordinates:a,geometry:s}=t,u=[];if(!Array.isArray(e))return{dataArray:[]};if(s)return e.filter(l=>l[s]&&l[s].type&&l[s].coordinates&&l[s].coordinates.length>0).forEach((l,f)=>{const c=Ed(l[s]);vy(c,h=>{const d=py(h),p=Sm(Am({},l),{_id:f,coordinates:d});u.push(p)})}),{dataArray:u};for(let l=0;l<e.length;l++){const f=e[l];let c=[];if(a){let d="Polygon";Array.isArray(a[0])||(d="Point"),Array.isArray(a[0])&&!Array.isArray(a[0][0])&&(d="LineString"),c=Ed({type:d,coordinates:f[a]}).coordinates}else if(r&&n&&i&&o){const d=[parseFloat(f[r]),parseFloat(f[n])],p=[parseFloat(f[i]),parseFloat(f[o])];c=[d,p]}else r&&n&&(c=[parseFloat(f[r]),parseFloat(f[n])]);const h=Sm(Am({},f),{_id:l,coordinates:c});u.push(h)}return{dataArray:u}}function WU(e,t){const r=qR(e);return ZT(r,t)}var GU=Object.defineProperty,YU=Object.defineProperties,ZU=Object.getOwnPropertyDescriptors,xm=Object.getOwnPropertySymbols,qU=Object.prototype.hasOwnProperty,KU=Object.prototype.propertyIsEnumerable,bm=(e,t,r)=>t in e?GU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,QU=(e,t)=>{for(var r in t||(t={}))qU.call(t,r)&&bm(e,r,t[r]);if(xm)for(var r of xm(t))KU.call(t,r)&&bm(e,r,t[r]);return e},JU=(e,t)=>YU(e,ZU(t));function e8(e){const t=e.toString();let r=5381,n=t.length;for(;n;)r=r*33^t.charCodeAt(--n);return r>>>0}function t8(e,t){return t===void 0?null:typeof(e.properties[t]*1)=="number"?e.properties[t]*1:e.properties&&e.properties[t]?e8(e.properties[t]+"")%1000019:null}function r8(e,t){const r=[],n={};return e.features?(e.features=e.features.filter(i=>{const o=i.geometry;return i!=null&&o&&o.type&&o.coordinates&&o.coordinates.length>0}),e=Ed(e),e.features.length===0?{dataArray:[],featureKeys:n}:(vy(e,(i,o)=>{let a=t8(i,t==null?void 0:t.featureId);a===null&&(a=o);const s=a,u=py(i),l=JU(QU({},i.properties),{coordinates:u,_id:s});r.push(l)}),{dataArray:r,featureKeys:n})):(e.features=[],{dataArray:[]})}function yd(e,t,r,n){for(var i=n,o=r-t>>1,a=r-t,s,u=e[t],l=e[t+1],f=e[r],c=e[r+1],h=t+3;h<r;h+=3){var d=n8(e[h],e[h+1],u,l,f,c);if(d>i)s=h,i=d;else if(d===i){var p=Math.abs(h-o);p<a&&(s=h,a=p)}}i>n&&(s-t>3&&yd(e,t,s,n),e[s+2]=i,r-s>3&&yd(e,s,r,n))}function n8(e,t,r,n,i,o){var a=i-r,s=o-n;if(a!==0||s!==0){var u=((e-r)*a+(t-n)*s)/(a*a+s*s);u>1?(r=i,n=o):u>0&&(r+=a*u,n+=s*u)}return a=e-r,s=t-n,a*a+s*s}function du(e,t,r,n){var i={id:typeof e>"u"?null:e,type:t,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return i8(i),i}function i8(e){var t=e.geometry,r=e.type;if(r==="Point"||r==="MultiPoint"||r==="LineString")Lh(e,t);else if(r==="Polygon"||r==="MultiLineString")for(var n=0;n<t.length;n++)Lh(e,t[n]);else if(r==="MultiPolygon")for(n=0;n<t.length;n++)for(var i=0;i<t[n].length;i++)Lh(e,t[n][i])}function Lh(e,t){for(var r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function o8(e,t){var r=[];if(e.type==="FeatureCollection")for(var n=0;n<e.features.length;n++)Kl(r,e.features[n],t,n);else e.type==="Feature"?Kl(r,e,t):Kl(r,{geometry:e},t);return r}function Kl(e,t,r,n){if(t.geometry){var i=t.geometry.coordinates,o=t.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],u=t.id;if(r.promoteId?u=t.properties[r.promoteId]:r.generateId&&(u=n||0),o==="Point")Rm(i,s);else if(o==="MultiPoint")for(var l=0;l<i.length;l++)Rm(i[l],s);else if(o==="LineString")Td(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(l=0;l<i.length;l++)s=[],Td(i[l],s,a,!1),e.push(du(u,"LineString",s,t.properties));return}else wh(i,s,a,!1);else if(o==="Polygon")wh(i,s,a,!0);else if(o==="MultiPolygon")for(l=0;l<i.length;l++){var f=[];wh(i[l],f,a,!0),s.push(f)}else if(o==="GeometryCollection"){for(l=0;l<t.geometry.geometries.length;l++)Kl(e,{id:u,geometry:t.geometry.geometries[l],properties:t.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");e.push(du(u,o,s,t.properties))}}function Rm(e,t){t.push(qT(e[0])),t.push(KT(e[1])),t.push(0)}function Td(e,t,r,n){for(var i,o,a=0,s=0;s<e.length;s++){var u=qT(e[s][0]),l=KT(e[s][1]);t.push(u),t.push(l),t.push(0),s>0&&(n?a+=(i*l-u*o)/2:a+=Math.sqrt(Math.pow(u-i,2)+Math.pow(l-o,2))),i=u,o=l}var f=t.length-3;t[2]=1,yd(t,0,f,r),t[f+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function wh(e,t,r,n){for(var i=0;i<e.length;i++){var o=[];Td(e[i],o,r,n),t.push(o)}}function qT(e){return e/360+.5}function KT(e){var t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function vi(e,t,r,n,i,o,a,s){if(r/=t,n/=t,o>=r&&a<n)return e;if(a<r||o>=n)return null;for(var u=[],l=0;l<e.length;l++){var f=e[l],c=f.geometry,h=f.type,d=i===0?f.minX:f.minY,p=i===0?f.maxX:f.maxY;if(d>=r&&p<n){u.push(f);continue}else if(p<r||d>=n)continue;var v=[];if(h==="Point"||h==="MultiPoint")a8(c,v,r,n,i);else if(h==="LineString")QT(c,v,r,n,i,!1,s.lineMetrics);else if(h==="MultiLineString")Fh(c,v,r,n,i,!1);else if(h==="Polygon")Fh(c,v,r,n,i,!0);else if(h==="MultiPolygon")for(var g=0;g<c.length;g++){var y=[];Fh(c[g],y,r,n,i,!0),y.length&&v.push(y)}if(v.length){if(s.lineMetrics&&h==="LineString"){for(g=0;g<v.length;g++)u.push(du(f.id,h,v[g],f.tags));continue}(h==="LineString"||h==="MultiLineString")&&(v.length===1?(h="LineString",v=v[0]):h="MultiLineString"),(h==="Point"||h==="MultiPoint")&&(h=v.length===3?"Point":"MultiPoint"),u.push(du(f.id,h,v,f.tags))}}return u.length?u:null}function a8(e,t,r,n,i){for(var o=0;o<e.length;o+=3){var a=e[o+i];a>=r&&a<=n&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]))}}function QT(e,t,r,n,i,o,a){for(var s=Cm(e),u=i===0?s8:u8,l=e.start,f,c,h=0;h<e.length-3;h+=3){var d=e[h],p=e[h+1],v=e[h+2],g=e[h+3],y=e[h+4],S=i===0?d:p,R=i===0?g:y,x=!1;a&&(f=Math.sqrt(Math.pow(d-g,2)+Math.pow(p-y,2))),S<r?R>r&&(c=u(s,d,p,g,y,r),a&&(s.start=l+f*c)):S>n?R<n&&(c=u(s,d,p,g,y,n),a&&(s.start=l+f*c)):Bh(s,d,p,v),R<r&&S>=r&&(c=u(s,d,p,g,y,r),x=!0),R>n&&S<=n&&(c=u(s,d,p,g,y,n),x=!0),!o&&x&&(a&&(s.end=l+f*c),t.push(s),s=Cm(e)),a&&(l+=f)}var M=e.length-3;d=e[M],p=e[M+1],v=e[M+2],S=i===0?d:p,S>=r&&S<=n&&Bh(s,d,p,v),M=s.length-3,o&&M>=3&&(s[M]!==s[0]||s[M+1]!==s[1])&&Bh(s,s[0],s[1],s[2]),s.length&&t.push(s)}function Cm(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Fh(e,t,r,n,i,o){for(var a=0;a<e.length;a++)QT(e[a],t,r,n,i,o,!1)}function Bh(e,t,r,n){e.push(t),e.push(r),e.push(n)}function s8(e,t,r,n,i,o){var a=(o-t)/(n-t);return e.push(o),e.push(r+(i-r)*a),e.push(1),a}function u8(e,t,r,n,i,o){var a=(o-r)/(i-r);return e.push(t+(n-t)*a),e.push(o),e.push(1),a}function l8(e,t){var r=t.buffer/t.extent,n=e,i=vi(e,1,-1-r,r,0,-1,2,t),o=vi(e,1,1-r,2+r,0,-1,2,t);return(i||o)&&(n=vi(e,1,-r,1+r,0,-1,2,t)||[],i&&(n=Om(i,1).concat(n)),o&&(n=n.concat(Om(o,-1)))),n}function Om(e,t){for(var r=[],n=0;n<e.length;n++){var i=e[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Dh(i.geometry,t);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(var s=0;s<i.geometry.length;s++)a.push(Dh(i.geometry[s],t))}else if(o==="MultiPolygon")for(a=[],s=0;s<i.geometry.length;s++){for(var u=[],l=0;l<i.geometry[s].length;l++)u.push(Dh(i.geometry[s][l],t));a.push(u)}r.push(du(i.id,o,a,i.tags))}return r}function Dh(e,t){var r=[];r.size=e.size,e.start!==void 0&&(r.start=e.start,r.end=e.end);for(var n=0;n<e.length;n+=3)r.push(e[n]+t,e[n+1],e[n+2]);return r}function Im(e,t){if(e.transformed)return e;var r=1<<e.z,n=e.x,i=e.y,o,a,s;for(o=0;o<e.features.length;o++){var u=e.features[o],l=u.geometry,f=u.type;if(u.geometry=[],f===1)for(a=0;a<l.length;a+=2)u.geometry.push(Mm(l[a],l[a+1],t,r,n,i));else for(a=0;a<l.length;a++){var c=[];for(s=0;s<l[a].length;s+=2)c.push(Mm(l[a][s],l[a][s+1],t,r,n,i));u.geometry.push(c)}}return e.transformed=!0,e}function Mm(e,t,r,n,i,o){return[Math.round(r*(e*n-i)),Math.round(r*(t*n-o))]}function c8(e,t,r,n,i){for(var o=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<e.length;s++){a.numFeatures++,f8(a,e[s],o,i);var u=e[s].minX,l=e[s].minY,f=e[s].maxX,c=e[s].maxY;u<a.minX&&(a.minX=u),l<a.minY&&(a.minY=l),f>a.maxX&&(a.maxX=f),c>a.maxY&&(a.maxY=c)}return a}function f8(e,t,r,n){var i=t.geometry,o=t.type,a=[];if(o==="Point"||o==="MultiPoint")for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),e.numPoints++,e.numSimplified++;else if(o==="LineString")Uh(a,i,e,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(s=0;s<i.length;s++)Uh(a,i[s],e,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(var u=0;u<i.length;u++){var l=i[u];for(s=0;s<l.length;s++)Uh(a,l[s],e,r,!0,s===0)}if(a.length){var f=t.tags||null;if(o==="LineString"&&n.lineMetrics){f={};for(var c in t.tags)f[c]=t.tags[c];f.mapbox_clip_start=i.start/i.size,f.mapbox_clip_end=i.end/i.size}var h={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:f};t.id!==null&&(h.id=t.id),e.features.push(h)}}function Uh(e,t,r,n,i,o){var a=n*n;if(n>0&&t.size<(i?a:n)){r.numPoints+=t.length/3;return}for(var s=[],u=0;u<t.length;u+=3)(n===0||t[u+2]>a)&&(r.numSimplified++,s.push(t[u]),s.push(t[u+1])),r.numPoints++;i&&h8(s,o),e.push(s)}function h8(e,t){for(var r=0,n=0,i=e.length,o=i-2;n<i;o=n,n+=2)r+=(e[n]-e[o])*(e[n+1]+e[o+1]);if(r>0===t)for(n=0,i=e.length;n<i/2;n+=2){var a=e[n],s=e[n+1];e[n]=e[i-2-n],e[n+1]=e[i-1-n],e[i-2-n]=a,e[i-1-n]=s}}function d8(e,t){return new sf(e,t)}function sf(e,t){t=this.options=p8(Object.create(this.options),t);var r=t.debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=o8(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=l8(n,t),n.length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}sf.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};sf.prototype.splitTile=function(e,t,r,n,i,o,a){for(var s=[e,t,r,n],u=this.options,l=u.debug;s.length;){n=s.pop(),r=s.pop(),t=s.pop(),e=s.pop();var f=1<<t,c=Ad(t,r,n),h=this.tiles[c];if(!h&&(l>1&&console.time("creation"),h=this.tiles[c]=c8(e,t,r,n,u),this.tileCoords.push({z:t,x:r,y:n}),l)){l>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,n,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var d="z"+t;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(h.source=e,i){if(t===u.maxZoom||t===i)continue;var p=1<<i-t;if(r!==Math.floor(o/p)||n!==Math.floor(a/p))continue}else if(t===u.indexMaxZoom||h.numPoints<=u.indexMaxPoints)continue;if(h.source=null,e.length!==0){l>1&&console.time("clipping");var v=.5*u.buffer/u.extent,g=.5-v,y=.5+v,S=1+v,R,x,M,$,F,Y;R=x=M=$=null,F=vi(e,f,r-v,r+y,0,h.minX,h.maxX,u),Y=vi(e,f,r+g,r+S,0,h.minX,h.maxX,u),e=null,F&&(R=vi(F,f,n-v,n+y,1,h.minY,h.maxY,u),x=vi(F,f,n+g,n+S,1,h.minY,h.maxY,u),F=null),Y&&(M=vi(Y,f,n-v,n+y,1,h.minY,h.maxY,u),$=vi(Y,f,n+g,n+S,1,h.minY,h.maxY,u),Y=null),l>1&&console.timeEnd("clipping"),s.push(R||[],t+1,r*2,n*2),s.push(x||[],t+1,r*2,n*2+1),s.push(M||[],t+1,r*2+1,n*2),s.push($||[],t+1,r*2+1,n*2+1)}}};sf.prototype.getTile=function(e,t,r){var n=this.options,i=n.extent,o=n.debug;if(e<0||e>24)return null;var a=1<<e;t=(t%a+a)%a;var s=Ad(e,t,r);if(this.tiles[s])return Im(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",e,t,r);for(var u=e,l=t,f=r,c;!c&&u>0;)u--,l=Math.floor(l/2),f=Math.floor(f/2),c=this.tiles[Ad(u,l,f)];return!c||!c.source?null:(o>1&&console.log("found parent tile z%d-%d-%d",u,l,f),o>1&&console.time("drilling down"),this.splitTile(c.source,u,l,f,e,t,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?Im(this.tiles[s],i):null)};function Ad(e,t,r){return((1<<e)*r+t)*32+e}function p8(e,t){for(var r in t)e[r]=t[r];return e}var Ys=class{constructor(t,r,n,i){this.vectorLayerCache={},this.x=r,this.y=n,this.z=i,this.vectorTile=t}getTileData(t){return!t||!this.vectorTile.layers[t]?[]:this.vectorLayerCache[t]?this.vectorLayerCache[t]:this.vectorTile.layers[t].features}getFeatureById(){throw new Error("Method not implemented.")}},_8=Object.defineProperty,v8=Object.defineProperties,m8=Object.getOwnPropertyDescriptors,Nm=Object.getOwnPropertySymbols,g8=Object.prototype.hasOwnProperty,E8=Object.prototype.propertyIsEnumerable,Pm=(e,t,r)=>t in e?_8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,pc=(e,t)=>{for(var r in t||(t={}))g8.call(t,r)&&Pm(e,r,t[r]);if(Nm)for(var r of Nm(t))E8.call(t,r)&&Pm(e,r,t[r]);return e},y8=(e,t)=>v8(e,m8(t)),T8=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),A8={tileSize:256,minZoom:0,maxZoom:1/0,zoomOffset:0};function S8(e){let t=0;for(let r=0,n=e.length,i=n-1,o,a;r<n;i=r++)o=e[r],a=e[i],t+=(a.x-o.x)*(o.y+a.y);return t}function x8(e){const t=e.length;if(t<=1)return[e];const r=[];let n,i;for(let o=0;o<t;o++){const a=S8(e[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[e[o]]):n.push(e[o]))}return n&&r.push(n),r}var b8=["Unknown","Point","LineString","Polygon"];function R8(e,t,r,n,i){let o=i.geometry;const a=i.type,s=i.tags,u=i.id,l=e*Math.pow(2,n),f=e*t,c=e*r;let h=b8[a],d,p;function v(y){for(let S=0;S<y.length;S++){const R=y[S];if(R[3])break;const x=180-(R[1]+c)*360/l,M=(R[0]+f)*360/l-180,$=360/Math.PI*Math.atan(Math.exp(x*Math.PI/180))-90;y[S]=[M,$,0,1]}}switch(a){case 1:const y=[];for(d=0;d<o.length;d++)y[d]=o[d][0];o=y,v(o);break;case 2:for(d=0;d<o.length;d++)v(o[d]);break;case 3:for(o=x8(o),d=0;d<o.length;d++)for(p=0;p<o[d].length;p++)v(o[d][p]);break}return o.length===1?o=o[0]:h="Multi"+h,{type:"Feature",geometry:{type:h,coordinates:o},properties:s,id:u,tileOrigin:[0,0],coord:""}}var C8=(e,t,r,n)=>T8(void 0,null,function*(){return new Promise(i=>{const o=t.getTile(e.z,e.x,e.y),s={layers:{defaultLayer:{features:o?o.features.map(l=>R8(n,r.x,r.y,r.z,l)):[]}}},u=new Ys(s,e.x,e.y,e.z);i(u)})});function O8(e){const t={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!0,debug:0};return e===void 0||typeof e.geojsonvtOptions>"u"?t:pc(pc({},t),e.geojsonvtOptions)}function I8(e,t){const r=O8(t),n=r.extent||4096,i=d8(e,r),o=(s,u)=>C8(u,i,s,n),a=y8(pc(pc({},A8),t),{getTileData:o});return{data:e,dataArray:[],tilesetOptions:a,isTile:!0}}var M8=Object.defineProperty,N8=Object.defineProperties,P8=Object.getOwnPropertyDescriptors,Lm=Object.getOwnPropertySymbols,L8=Object.prototype.hasOwnProperty,w8=Object.prototype.propertyIsEnumerable,wm=(e,t,r)=>t in e?M8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fm=(e,t)=>{for(var r in t||(t={}))L8.call(t,r)&&wm(e,r,t[r]);if(Lm)for(var r of Lm(t))w8.call(t,r)&&wm(e,r,t[r]);return e},Bm=(e,t)=>N8(e,P8(t));function JT(e,t){const{extent:r=[121.168,30.2828,121.384,30.4219],coordinates:n,requestParameters:i={}}=t,o=new Promise(u=>{e instanceof HTMLImageElement||J7(e)?u([e]):F8(e,i,l=>{u(l)})}),a=wu(n,r);return{originData:e,images:o,_id:1,dataArray:[{_id:0,coordinates:a}]}}function F8(e,t,r){const n=[];if(typeof e=="string")sd(Bm(Fm({},t),{url:e}),(i,o)=>{o&&(n.push(o),r(n))});else{const i=e.length;let o=0;e.forEach(a=>{sd(Bm(Fm({},t),{url:a}),(s,u)=>{o++,u&&n.push(u),o===i&&r(n)})})}return JT}var B8=Object.defineProperty,D8=Object.defineProperties,U8=Object.getOwnPropertyDescriptors,Dm=Object.getOwnPropertySymbols,k8=Object.prototype.hasOwnProperty,$8=Object.prototype.propertyIsEnumerable,Um=(e,t,r)=>t in e?B8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eA=(e,t)=>{for(var r in t||(t={}))k8.call(t,r)&&Um(e,r,t[r]);if(Dm)for(var r of Dm(t))$8.call(t,r)&&Um(e,r,t[r]);return e},tA=(e,t)=>D8(e,U8(t)),z8=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),V8=(e,t,r,n)=>z8(void 0,null,function*(){const i={x:t.x,y:t.y,z:t.z},o=xa(e,i);return new Promise(a=>{n?n(i,(s,u)=>{if(s||!u){const l={layers:{defaultLayer:{features:[]}}},f=new Ys(l,t.x,t.y,t.z);a(f)}else{const l={layers:{defaultLayer:{features:u.features}}},f=new Ys(l,t.x,t.y,t.z);a(f)}}):l2(tA(eA({},r),{url:o}),(s,u)=>{if(s||!u){const l={layers:{defaultLayer:{features:[]}}},f=new Ys(l,t.x,t.y,t.z);a(f)}else{const f={layers:{defaultLayer:{features:JSON.parse(u)}}},c=new Ys(f,t.x,t.y,t.z);a(c)}})})});function H8(e,t){const r=(i,o)=>V8(e,o,t==null?void 0:t.requestParameters,t.getCustomData),n=tA(eA({},t),{getTileData:r});return{dataArray:[],tilesetOptions:n,isTile:!0}}var j8=ba;function ba(e,t){this.x=e,this.y=t}ba.prototype={clone:function(){return new ba(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),r=Math.sin(e),n=t*this.x-r*this.y,i=r*this.x+t*this.y;return this.x=n,this.y=i,this},_rotateAround:function(e,t){var r=Math.cos(e),n=Math.sin(e),i=t.x+r*(this.x-t.x)-n*(this.y-t.y),o=t.y+n*(this.x-t.x)+r*(this.y-t.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};ba.convert=function(e){return e instanceof ba?e:Array.isArray(e)?new ba(e[0],e[1]):e};var X8=j8,W8=wa;function wa(e,t,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=i,e.readFields(G8,this,t)}function G8(e,t,r){e==1?t.id=r.readVarint():e==2?Y8(r,t):e==3?t.type=r.readVarint():e==4&&(t._geometry=r.pos)}function Y8(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var n=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[n]=i}}wa.types=["Unknown","Point","LineString","Polygon"];wa.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,o=0,a=[],s;e.pos<t;){if(n<=0){var u=e.readVarint();r=u&7,n=u>>3}if(n--,r===1||r===2)i+=e.readSVarint(),o+=e.readSVarint(),r===1&&(s&&a.push(s),s=[]),s.push(new X8(i,o));else if(r===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+r)}return s&&a.push(s),a};wa.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,u=1/0,l=-1/0;e.pos<t;){if(n<=0){var f=e.readVarint();r=f&7,n=f>>3}if(n--,r===1||r===2)i+=e.readSVarint(),o+=e.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<u&&(u=o),o>l&&(l=o);else if(r!==7)throw new Error("unknown command "+r)}return[a,u,s,l]};wa.prototype.toGeoJSON=function(e,t,r){var n=this.extent*Math.pow(2,r),i=this.extent*e,o=this.extent*t,a=this.loadGeometry(),s=wa.types[this.type],u,l;function f(d){for(var p=0;p<d.length;p++){var v=d[p],g=180-(v.y+o)*360/n;d[p]=[(v.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(g*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(u=0;u<a.length;u++)c[u]=a[u][0];a=c,f(a);break;case 2:for(u=0;u<a.length;u++)f(a[u]);break;case 3:for(a=Z8(a),u=0;u<a.length;u++)for(l=0;l<a[u].length;l++)f(a[u][l]);break}a.length===1?a=a[0]:s="Multi"+s;var h={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(h.id=this.id),h};function Z8(e){var t=e.length;if(t<=1)return[e];for(var r=[],n,i,o=0;o<t;o++){var a=q8(e[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[e[o]]):n.push(e[o]))}return n&&r.push(n),r}function q8(e){for(var t=0,r=0,n=e.length,i=n-1,o,a;r<n;i=r++)o=e[r],a=e[i],t+=(a.x-o.x)*(o.y+a.y);return t}var K8=W8,Q8=rA;function rA(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(J8,this,t),this.length=this._features.length}function J8(e,t,r){e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(ek(r))}function ek(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}rA.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new K8(this._pbf,t,this.extent,this._keys,this._values)};var tk=Q8,rk=nk;function nk(e,t){this.layers=e.readFields(ik,{},t)}function ik(e,t,r){if(e===3){var n=new tk(r,r.readVarint()+r.pos);n.length&&(t[n.name]=n)}}var ok=rk,Fp={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Fp.read=function(e,t,r,n,i){var o,a,s=i*8-n-1,u=(1<<s)-1,l=u>>1,f=-7,c=r?i-1:0,h=r?-1:1,d=e[t+c];for(c+=h,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=o*256+e[t+c],c+=h,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=a*256+e[t+c],c+=h,f-=8);if(o===0)o=1-l;else{if(o===u)return a?NaN:(d?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-l}return(d?-1:1)*a*Math.pow(2,o-n)};Fp.write=function(e,t,r,n,i,o){var a,s,u,l=o*8-i-1,f=(1<<l)-1,c=f>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+c>=1?t+=h/u:t+=h*Math.pow(2,1-c),t*u>=2&&(a++,u/=2),a+c>=f?(s=0,a=f):a+c>=1?(s=(t*u-1)*Math.pow(2,i),a=a+c):(s=t*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=s&255,d+=p,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[r+d]=a&255,d+=p,a/=256,l-=8);e[r+d-p]|=v*128};var ak=jt,Ol=Fp;function jt(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}jt.Varint=0;jt.Fixed64=1;jt.Bytes=2;jt.Fixed32=5;var Sd=65536*65536,km=1/Sd,sk=12,nA=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");jt.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Il(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=zm(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Il(this.buf,this.pos)+Il(this.buf,this.pos+4)*Sd;return this.pos+=8,e},readSFixed64:function(){var e=Il(this.buf,this.pos)+zm(this.buf,this.pos+4)*Sd;return this.pos+=8,e},readFloat:function(){var e=Ol.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Ol.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,uk(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=sk&&nA?Ak(this.buf,t,e):Tk(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==jt.Bytes)return e.push(this.readVarint(t));var r=pi(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==jt.Bytes)return e.push(this.readSVarint());var t=pi(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==jt.Bytes)return e.push(this.readBoolean());var t=pi(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==jt.Bytes)return e.push(this.readFloat());var t=pi(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==jt.Bytes)return e.push(this.readDouble());var t=pi(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==jt.Bytes)return e.push(this.readFixed32());var t=pi(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==jt.Bytes)return e.push(this.readSFixed32());var t=pi(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==jt.Bytes)return e.push(this.readFixed64());var t=pi(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==jt.Bytes)return e.push(this.readSFixed64());var t=pi(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===jt.Varint)for(;this.buf[this.pos++]>127;);else if(t===jt.Bytes)this.pos=this.readVarint()+this.pos;else if(t===jt.Fixed32)this.pos+=4;else if(t===jt.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),sa(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),sa(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),sa(this.buf,e&-1,this.pos),sa(this.buf,Math.floor(e*km),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),sa(this.buf,e&-1,this.pos),sa(this.buf,Math.floor(e*km),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){lk(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=Sk(this.buf,e,this.pos);var r=this.pos-t;r>=128&&$m(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Ol.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Ol.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&$m(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,jt.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,hk,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,dk,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,vk,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,pk,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,_k,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,mk,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,gk,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Ek,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,yk,t)},writeBytesField:function(e,t){this.writeTag(e,jt.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,jt.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,jt.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,jt.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,jt.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,jt.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,jt.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,jt.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,jt.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,jt.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}};function uk(e,t,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return aa(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function pi(e){return e.type===jt.Bytes?e.readVarint()+e.pos:e.pos+1}function aa(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function lk(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),ck(r,n,t),fk(n,t)}function ck(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function fk(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function $m(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function hk(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function dk(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function pk(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function _k(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function vk(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function mk(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function gk(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function Ek(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function yk(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Il(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function sa(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function zm(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Tk(e,t,r){for(var n="",i=t;i<r;){var o=e[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var u,l,f;s===1?o<128&&(a=o):s===2?(u=e[i+1],(u&192)===128&&(a=(o&31)<<6|u&63,a<=127&&(a=null))):s===3?(u=e[i+1],l=e[i+2],(u&192)===128&&(l&192)===128&&(a=(o&15)<<12|(u&63)<<6|l&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(u=e[i+1],l=e[i+2],f=e[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(a=(o&15)<<18|(u&63)<<12|(l&63)<<6|f&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function Ak(e,t,r){return nA.decode(e.subarray(t,r))}function Sk(e,t,r){for(var n=0,i,o;n<t.length;n++){if(i=t.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=i;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=i&63|128)}return r}const xk=Ht(ak);var bk=Object.defineProperty,Rk=Object.defineProperties,Ck=Object.getOwnPropertyDescriptors,Vm=Object.getOwnPropertySymbols,Ok=Object.prototype.hasOwnProperty,Ik=Object.prototype.propertyIsEnumerable,Hm=(e,t,r)=>t in e?bk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,jm=(e,t)=>{for(var r in t||(t={}))Ok.call(t,r)&&Hm(e,r,t[r]);if(Vm)for(var r of Vm(t))Ik.call(t,r)&&Hm(e,r,t[r]);return e},Mk=(e,t)=>Rk(e,Ck(t)),Xm=class{constructor(e,t,r,n){this.vectorLayerCache={},this.x=t,this.y=r,this.z=n,this.vectorTile=new ok(new xk(e))}getTileData(e){if(!e||!this.vectorTile.layers[e])return[];if(this.vectorLayerCache[e])return this.vectorLayerCache[e];const t=this.vectorTile.layers[e];if(Array.isArray(t.features))return this.vectorLayerCache[e]=t.features,t.features;const r=[];for(let n=0;n<t.length;n++){const o=t.feature(n).toGeoJSON(this.x,this.y,this.z);r.push(Mk(jm({},o),{properties:jm({id:o.id},o.properties)}))}return this.vectorLayerCache[e]=r,r}getFeatureById(){throw new Error("Method not implemented.")}},Nk=Object.defineProperty,Pk=Object.defineProperties,Lk=Object.getOwnPropertyDescriptors,Wm=Object.getOwnPropertySymbols,wk=Object.prototype.hasOwnProperty,Fk=Object.prototype.propertyIsEnumerable,Gm=(e,t,r)=>t in e?Nk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xd=(e,t)=>{for(var r in t||(t={}))wk.call(t,r)&&Gm(e,r,t[r]);if(Wm)for(var r of Wm(t))Fk.call(t,r)&&Gm(e,r,t[r]);return e},iA=(e,t)=>Pk(e,Lk(t)),Bk=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),Dk={tileSize:256,minZoom:0,maxZoom:1/0,zoomOffset:0,warp:!0},Uk=(e,t,r,n,i)=>Bk(void 0,null,function*(){const o=xa(e,t);return new Promise(a=>{if(i)i({x:r.x,y:r.y,z:r.z},(s,u)=>{if(s||!u)a(void 0);else{const l=new Xm(u,r.x,r.y,r.z);a(l)}});else{const s=_p(iA(xd({},n),{url:o}),(u,l)=>{if(u||!l)a(void 0);else{const f=new Xm(l,r.x,r.y,r.z);a(f)}});r.xhrCancel=()=>s.cancel()}})});function kk(e,t){const r=Array.isArray(e)?e[0]:e,n=(o,a)=>Uk(r,o,a,t==null?void 0:t.requestParameters,t==null?void 0:t.getCustomData),i=iA(xd(xd({},Dk),t),{getTileData:n});return{data:r,dataArray:[],tilesetOptions:i,isTile:!0}}function $k(e,t,r){switch(e){case"+":return t+r;case"-":return t-r;case"*":return t*r;case"/":return t/r;case"%":return t%r;case"^":return Math.pow(t,r);case"abs":return Math.abs(t);case"floor":return Math.floor(t);case"round":return Math.round(t);case"ceil":return Math.ceil(t);case"sin":return Math.sin(t);case"cos":return Math.cos(t);case"atan":return r===-1?Math.atan(t):Math.atan2(t,r);case"min":return Math.min(t,r);case"max":return Math.max(t,r);case"log10":return Math.log(t);case"log2":return Math.log2(t);default:return console.warn("Calculate symbol err! Return default 0"),0}}function au(e,t){const{width:r,height:n}=t[0],i=t.map(u=>u.rasterData),o=r*n,a=[],s=JSON.stringify(e);for(let u=0;u<o;u++){const l=JSON.parse(s),f=oA(l,i,u);if(typeof f=="number")a.push(f);else{const c=bd(l);a.push(c)}}return a}function oA(e,t,r){if(e.length===2&&e[0]==="band"&&typeof e[1]=="number")try{return t[e[1]][r]}catch{return console.warn("Raster Data err!"),0}e.map((n,i)=>{if(Array.isArray(n)&&n.length>0)switch(n[0]){case"band":try{e[i]=t[n[1]][r]}catch{console.warn("Raster Data err!"),e[i]=0}break;default:oA(n,t,r)}})}function zk(e){const[t,r=-1,n=-1]=e;return t===void 0?(console.warn("Express err!"),["+",0,0]):[t.replace(/\s+/g,""),r,n]}function bd(e){const t=zk(e),r=t[0];let n=t[1],i=t[2];return Array.isArray(n)&&(n=bd(e[1])),Array.isArray(i)&&(i=bd(e[2])),$k(r,n,i)}var Vk={nd:{type:"operation",expression:["/",["-",["band",1],["band",0]],["+",["band",1],["band",0]]]},rgb:{type:"function",method:Hk}};function Hk(e,t){const r=e[0].rasterData,n=e[1].rasterData,i=e[2].rasterData,o=[],[a,s]=(t==null?void 0:t.countCut)||[2,98],u=(t==null?void 0:t.RMinMax)||Ra(r,a,s),l=(t==null?void 0:t.GMinMax)||Ra(n,a,s),f=(t==null?void 0:t.BMinMax)||Ra(i,a,s);for(let c=0;c<r.length;c++)o.push(Math.max(0,r[c]-u[0])),o.push(Math.max(0,n[c]-l[0])),o.push(Math.max(0,i[c]-f[0]));return{rasterData:o,rMinMax:u,gMinMax:l,bMinMax:f}}function Ra(e,t,r){const n=e.slice().sort((s,u)=>s-u),i=n.length,o=n[Math.ceil(i*t/100)],a=n[Math.ceil(i*r/100)];return[o,a]}var jk=Object.defineProperty,Xk=Object.defineProperties,Wk=Object.getOwnPropertyDescriptors,Ym=Object.getOwnPropertySymbols,Gk=Object.prototype.hasOwnProperty,Yk=Object.prototype.propertyIsEnumerable,Zm=(e,t,r)=>t in e?jk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Zk=(e,t)=>{for(var r in t||(t={}))Gk.call(t,r)&&Zm(e,r,t[r]);if(Ym)for(var r of Ym(t))Yk.call(t,r)&&Zm(e,r,t[r]);return e},qk=(e,t)=>Xk(e,Wk(t)),aA=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())});function Bp(e,t,r){return aA(this,null,function*(){if(e.length===0)return{rasterData:[0],width:1,heigh:1};const n=yield Promise.all(e.map(({data:u,bands:l=[0]})=>t(u,l))),i=[];n.forEach(u=>{Array.isArray(u)?i.push(...u):i.push(u)});const{width:o,height:a}=i[0];let s;switch(typeof r){case"function":s=r(i);break;case"object":Array.isArray(r)?s={rasterData:au(r,i)}:s=Kk(r,i);break;default:s={rasterData:i[0].rasterData}}return qk(Zk({},s),{width:o,height:a})})}function Kk(e,t){const r=Vk[e.type];if(r.type==="function")return r.method(t,e==null?void 0:e.options);if(r.type==="operation")return e.type==="rgb"?Qk(r.expression,t):{rasterData:au(r.expression,t)}}function Qk(e,t){e.r===void 0&&console.warn("Channel R lost in Operation! Use band[0] to fill!"),e.g===void 0&&console.warn("Channel G lost in Operation! Use band[0] to fill!"),e.b===void 0&&console.warn("Channel B lost in Operation! Use band[0] to fill!");const r=au(e.r||["band",0],t),n=au(e.g||["band",0],t),i=au(e.b||["band",0],t);return[r,n,i]}function Rd(e,t,r,n){return aA(this,null,function*(){const i=yield Bp(e,t,r);n(null,{data:i})})}function Jk(e,t){const{extent:r=[121.168,30.2828,121.384,30.4219],coordinates:n,width:i,height:o,min:a,max:s,format:u,operation:l}=t;let f,c,h;if(u===void 0||YT(e))f=Array.from(e),c=i,h=o;else{const v=Array.isArray(e)?e:[e];f=Bp(v,u,l)}const d=wu(n,r);return{_id:1,dataArray:[{_id:1,data:f,width:c,height:h,min:a,max:s,coordinates:d}]}}function qm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function he(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qm(Object(r),!0).forEach(function(n){E(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}let Fu=function(e){return e.Normal="normal",e.PostProcessing="post-processing",e}({}),m=function(e){return e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.MAX_EXT=32776]="MAX_EXT",e[e.MIN_EXT=32775]="MIN_EXT",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.CULL_FACE=2884]="CULL_FACE",e[e.BLEND=3042]="BLEND",e[e.DITHER=3024]="DITHER",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.RED=6403]="RED",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.TEXTURE1=33985]="TEXTURE1",e[e.TEXTURE2=33986]="TEXTURE2",e[e.TEXTURE3=33987]="TEXTURE3",e[e.TEXTURE4=33988]="TEXTURE4",e[e.TEXTURE5=33989]="TEXTURE5",e[e.TEXTURE6=33990]="TEXTURE6",e[e.TEXTURE7=33991]="TEXTURE7",e[e.TEXTURE8=33992]="TEXTURE8",e[e.TEXTURE9=33993]="TEXTURE9",e[e.TEXTURE10=33994]="TEXTURE10",e[e.TEXTURE11=33995]="TEXTURE11",e[e.TEXTURE12=33996]="TEXTURE12",e[e.TEXTURE13=33997]="TEXTURE13",e[e.TEXTURE14=33998]="TEXTURE14",e[e.TEXTURE15=33999]="TEXTURE15",e[e.TEXTURE16=34e3]="TEXTURE16",e[e.TEXTURE17=34001]="TEXTURE17",e[e.TEXTURE18=34002]="TEXTURE18",e[e.TEXTURE19=34003]="TEXTURE19",e[e.TEXTURE20=34004]="TEXTURE20",e[e.TEXTURE21=34005]="TEXTURE21",e[e.TEXTURE22=34006]="TEXTURE22",e[e.TEXTURE23=34007]="TEXTURE23",e[e.TEXTURE24=34008]="TEXTURE24",e[e.TEXTURE25=34009]="TEXTURE25",e[e.TEXTURE26=34010]="TEXTURE26",e[e.TEXTURE27=34011]="TEXTURE27",e[e.TEXTURE28=34012]="TEXTURE28",e[e.TEXTURE29=34013]="TEXTURE29",e[e.TEXTURE30=34014]="TEXTURE30",e[e.TEXTURE31=34015]="TEXTURE31",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e}({});const e9=`attribute vec2 a_Position;
varying vec2 v_UV;
void main() {
v_UV = 0.5 * (a_Position + 1.0);
gl_Position = vec4(a_Position, 0., 1.);
}`,{camelCase:t9,isNil:r9,upperFirst:n9}=Sr;class Ai{constructor(){E(this,"shaderModuleService",void 0),E(this,"rendererService",void 0),E(this,"config",void 0),E(this,"quad",e9),E(this,"enabled",!0),E(this,"renderToScreen",!1),E(this,"model",void 0),E(this,"name",void 0),E(this,"optionsToUpdate",{})}getName(){return this.name}setName(t){this.name=t}getType(){return Fu.PostProcessing}init(t,r){this.config=r,this.rendererService=t.getContainer().rendererService,this.shaderModuleService=t.getContainer().shaderModuleService;const{createAttribute:n,createBuffer:i,createModel:o}=this.rendererService,{vs:a,fs:s,uniforms:u}=this.setupShaders();this.model=o({vs:a,fs:s,attributes:{a_Position:n({buffer:i({data:[-4,-4,4,-4,0,4],type:m.FLOAT}),size:2})},uniforms:he(he({u_Texture:null},u),this.config&&this.convertOptionsToUniforms(this.config)),depth:{enable:!1},count:3,blend:{enable:this.getName()==="copy"}})}render(t,r){const n=t.multiPassRenderer.getPostProcessor(),{useFramebuffer:i,getViewportSize:o,clear:a}=this.rendererService,{width:s,height:u}=o();i(this.renderToScreen?null:n.getWriteFBO(),()=>{a({framebuffer:n.getWriteFBO(),color:[0,0,0,0],depth:1,stencil:0});const l=he({u_BloomFinal:0,u_Texture:n.getReadFBO(),u_ViewportSize:[s,u]},this.convertOptionsToUniforms(this.optionsToUpdate));r&&(l.u_BloomFinal=1,l.u_Texture2=r),this.model.draw({uniforms:l})})}isEnabled(){return this.enabled}setEnabled(t){this.enabled=t}setRenderToScreen(t){this.renderToScreen=t}updateOptions(t){this.optionsToUpdate=he(he({},this.optionsToUpdate),t)}setupShaders(){throw new Error("Method not implemented.")}convertOptionsToUniforms(t){const r={};return Object.keys(t).forEach(n=>{r9(t[n])||(r[`u_${n9(t9(n))}`]=t[n])}),r}}function i9(e){let t=0;switch(e){case"vec2":case"ivec2":t=2;break;case"vec3":case"ivec3":t=3;break;case"vec4":case"ivec4":case"mat2":t=4;break;case"mat3":t=9;break;case"mat4":t=16;break}return t}const sA=/uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g;function Km(e,t=!1){const r={};return e=e.replace(sA,(n,i,o)=>{const a=o.split(":"),s=a[0].trim();let u="";switch(a.length>1&&(u=a[1].trim()),i){case"bool":u=u==="true";break;case"float":case"int":u=Number(u);break;case"vec2":case"vec3":case"vec4":case"ivec2":case"ivec3":case"ivec4":case"mat2":case"mat3":case"mat4":u?u=u.replace("[","").replace("]","").split(",").reduce((l,f)=>(l.push(Number(f.trim())),l),[]):u=new Array(i9(i)).fill(0);break}return r[s]=u,`${t?"uniform ":""}${i} ${s};
`}),{content:e,uniforms:r}}function kh(e){let{content:t,uniforms:r}=Km(e,!0);return t=t.replace(/(\s*uniform\s*.*\s*){((?:\s*.*\s*)*?)};/g,(n,i,o)=>{o=o.trim().replace(/^.*$/gm,u=>`uniform ${u}`);const{content:a,uniforms:s}=Km(o);return Object.assign(r,s),`${i}{
${a}
};`}),{content:t,uniforms:r}}function Qm(e){const t={};return e.replace(sA,(r,n,i)=>{const o=i.trim();return t[o]?"":(t[o]=!0,`uniform ${n} ${o};
`)})}const fo={ProjectionMatrix:"u_ProjectionMatrix",ViewMatrix:"u_ViewMatrix",ViewProjectionMatrix:"u_ViewProjectionMatrix",Zoom:"u_Zoom",ZoomScale:"u_ZoomScale",FocalDistance:"u_FocalDistance",CameraPosition:"u_CameraPosition"};let _c=function(e){return e.TOPRIGHT="topright",e.TOPLEFT="topleft",e.BOTTOMRIGHT="bottomright",e.BOTTOMLEFT="bottomleft",e.TOPCENTER="topcenter",e.BOTTOMCENTER="bottomcenter",e.LEFTCENTER="leftcenter",e.RIGHTCENTER="rightcenter",e.LEFTTOP="lefttop",e.RIGHTTOP="righttop",e.LEFTBOTTOM="leftbottom",e.RIGHTBOTTOM="rightbottom",e}({}),vc=function(e){return e[e.LNGLAT=1]="LNGLAT",e[e.LNGLAT_OFFSET=2]="LNGLAT_OFFSET",e[e.VECTOR_TILE=3]="VECTOR_TILE",e[e.IDENTITY=4]="IDENTITY",e[e.METER_OFFSET=5]="METER_OFFSET",e}({});const ua={CoordinateSystem:"u_CoordinateSystem",ViewportCenter:"u_ViewportCenter",ViewportCenterProjection:"u_ViewportCenterProjection",PixelsPerDegree:"u_PixelsPerDegree",PixelsPerDegree2:"u_PixelsPerDegree2",PixelsPerMeter:"u_PixelsPerMeter"};var Fr={MapInitStart:"mapInitStart",LayerInitStart:"layerInitStart",LayerInitEnd:"layerInitEnd",SourceInitStart:"sourceInitStart",SourceInitEnd:"sourceInitEnd",ScaleInitStart:"scaleInitStart",ScaleInitEnd:"scaleInitEnd",MappingStart:"mappingStart",MappingEnd:"mappingEnd",BuildModelStart:"buildModelStart",BuildModelEnd:"buildModelEnd"};let cn=function(e){return e.Hover="hover",e.Click="click",e.Select="select",e.Active="active",e.Drag="drag",e}({}),Ui=function(e){return e.normal="normal",e.additive="additive",e.subtractive="subtractive",e.min="min",e.max="max",e.none="none",e}({}),go=function(e){return e.MULTIPLE="MULTIPLE",e.SINGLE="SINGLE",e}({}),uf=function(e){return e.AND="and",e.OR="or",e}({}),jr=function(e){return e.INIT="init",e.UPDATE="update",e}({}),Xt=function(e){return e.LINEAR="linear",e.SEQUENTIAL="sequential",e.POWER="power",e.LOG="log",e.IDENTITY="identity",e.TIME="time",e.QUANTILE="quantile",e.QUANTIZE="quantize",e.THRESHOLD="threshold",e.CAT="cat",e.DIVERGING="diverging",e.CUSTOM="threshold",e}({}),la=function(e){return e.CONSTANT="constant",e.VARIABLE="variable",e}({}),qe=function(e){return e[e.Attribute=0]="Attribute",e[e.InstancedAttribute=1]="InstancedAttribute",e[e.Uniform=2]="Uniform",e}({});const Jm=["mapload","mapchange","mapAfterFrameChange"];var Dp={exports:{}};Dp.exports=Bu;Dp.exports.default=Bu;var Ca=1e20;function Bu(e,t,r,n,i,o){this.fontSize=e||24,this.buffer=t===void 0?3:t,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=r||8;var a=this.size=this.fontSize+this.buffer*2,s=a+this.buffer*2;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textAlign="left",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s),this.useMetrics=this.ctx.measureText("A").actualBoundingBoxLeft!==void 0,this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function o9(e,t,r,n,i,o,a){o.fill(Ca,0,t*r),a.fill(0,0,t*r);for(var s=(t-n)/2,u=0;u<i;u++)for(var l=0;l<n;l++){var f=(u+s)*t+l+s,c=e.data[4*(u*n+l)+3]/255;if(c===1)o[f]=0,a[f]=Ca;else if(c===0)o[f]=Ca,a[f]=0;else{var h=Math.max(0,.5-c),d=Math.max(0,c-.5);o[f]=h*h,a[f]=d*d}}}function a9(e,t,r,n,i,o,a){for(var s=0;s<t*r;s++){var u=Math.sqrt(n[s])-Math.sqrt(i[s]);e[s]=Math.round(255-255*(u/o+a))}}Bu.prototype._draw=function(e,t){var r=this.ctx.measureText(e),n=r.width,i=2*this.buffer,o,a,s,u,l,f,c,h;t&&this.useMetrics?(l=Math.floor(r.actualBoundingBoxAscent),h=this.buffer+Math.ceil(r.actualBoundingBoxAscent),f=this.buffer,c=this.buffer,a=Math.min(this.size,Math.ceil(r.actualBoundingBoxRight-r.actualBoundingBoxLeft)),u=Math.min(this.size-f,Math.ceil(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)),o=a+i,s=u+i,this.ctx.textBaseline="alphabetic"):(o=a=this.size,s=u=this.size,l=19*this.fontSize/24,f=c=0,h=this.middle,this.ctx.textBaseline="middle");var d;a&&u&&(this.ctx.clearRect(c,f,a,u),this.ctx.fillText(e,this.buffer,h),d=this.ctx.getImageData(c,f,a,u));var p=new Uint8ClampedArray(o*s);return o9(d,o,s,a,u,this.gridOuter,this.gridInner),eg(this.gridOuter,o,s,this.f,this.v,this.z),eg(this.gridInner,o,s,this.f,this.v,this.z),a9(p,o,s,this.gridOuter,this.gridInner,this.radius,this.cutoff),{data:p,metrics:{width:a,height:u,sdfWidth:o,sdfHeight:s,top:l,left:0,advance:n}}};Bu.prototype.draw=function(e){return this._draw(e,!1).data};Bu.prototype.drawWithMetrics=function(e){return this._draw(e,!0)};function eg(e,t,r,n,i,o){for(var a=0;a<t;a++)tg(e,a,t,r,n,i,o);for(var s=0;s<r;s++)tg(e,s*t,1,t,n,i,o)}function tg(e,t,r,n,i,o,a){var s,u,l,f;for(o[0]=0,a[0]=-Ca,a[1]=Ca,s=0;s<n;s++)i[s]=e[t+s*r];for(s=1,u=0,l=0;s<n;s++){do f=o[u],l=(i[s]-i[f]+s*s-f*f)/(s-f)/2;while(l<=a[u]&&--u>-1);u++,o[u]=s,a[u]=l,a[u+1]=Ca}for(s=0,u=0;s<n;s++){for(;a[u+1]<s;)u++;f=o[u],e[t+s*r]=i[f]+(s-f)*(s-f)}}var s9=Dp.exports;const u9=Ht(s9),Rs=30;function l9({characterSet:e,getFontWidth:t,fontHeight:r,buffer:n,maxCanvasWidth:i,mapping:o={},xOffset:a=0,yOffset:s=0}){let u=0,l=a;Array.from(e).forEach((c,h)=>{if(!o[c]){const d=t(c,h);l+Rs>i&&(l=0,u++),o[c]={x:l,y:s+u*Rs,width:Rs,height:Rs,advance:d},l+=Rs}});const f=r+n*2;return{mapping:o,xOffset:l,yOffset:s+u*f,canvasHeight:uA(s+(u+1)*f)}}function c9(e,t,r){let n=0,i=0,o=0,a=[];const s={};for(const l of e)if(!s[l.id]){const{size:f}=l;n+f+t>r&&(rg(s,a,i),n=0,i=o+i+t,o=0,a=[]),a.push({icon:l,xOffset:n}),n=n+f+t,o=Math.max(o,f)}a.length>0&&rg(s,a,i);const u=uA(o+i+t);return{mapping:s,canvasHeight:u}}function rg(e,t,r){for(const n of t){const{icon:i,xOffset:o}=n;e[i.id]=he(he({},i),{},{x:o,y:r,image:i.image,width:i.width,height:i.height})}}function uA(e){return Math.pow(2,Math.ceil(Math.log2(e)))}const f9=y9(),h9="sans-serif",d9="normal",p9=24,_9=3,v9=.25,m9=8,ng=1024,g9=1,ig=1,E9=3;function y9(){const e=[];for(let t=32;t<128;t++)e.push(String.fromCharCode(t));return e}function og(e,t,r,n){e.font=`${n} ${r}px ${t}`,e.fillStyle="black",e.textBaseline="middle"}function ag(e,t){for(let r=0;r<e.length;r++)t.data[4*r+3]=e[r]}class T9 extends Bn.EventEmitter{constructor(...t){super(...t),E(this,"fontAtlas",void 0),E(this,"iconFontMap",void 0),E(this,"iconFontGlyphs",{}),E(this,"fontOptions",void 0),E(this,"key",void 0),E(this,"cache",new cU(E9))}get scale(){return ig}get canvas(){const t=this.cache.get(this.key);return t&&t.data}get mapping(){const t=this.cache.get(this.key);return t&&t.mapping||{}}getCanvasByKey(t){const r=this.cache.get(t);return r&&r.data}getMappingByKey(t){const r=this.cache.get(t);return r&&r.mapping||{}}init(){this.cache.clear(),this.fontOptions={fontFamily:h9,fontWeight:d9,characterSet:f9,fontSize:p9,buffer:_9,sdf:!0,cutoff:v9,radius:m9,iconfont:!1},this.key="",this.iconFontMap=new Map}addIconGlyphs(t){t.forEach(r=>{this.iconFontGlyphs[r.name]=r.unicode})}addIconFont(t,r){this.iconFontMap.set(t,r)}getIconFontKey(t){return this.iconFontMap.get(t)||t}getGlyph(t){return this.iconFontGlyphs[t]?String.fromCharCode(parseInt(this.iconFontGlyphs[t],16)):""}setFontOptions(t){this.fontOptions=he(he({},this.fontOptions),t),this.key=this.getKey();const r=this.getNewChars(this.key,this.fontOptions.characterSet),n=this.cache.get(this.key);if(n&&r.length===0)return;const i=this.generateFontAtlas(this.key,r,n);this.fontAtlas=i,this.cache.set(this.key,i)}addFontFace(t,r){const n=document.createElement("style");n.type="text/css",n.innerText=`
@font-face{
font-family: '${t}';
src: url('${r}') format('woff2'),
url('${r}') format('woff'),
url('${r}') format('truetype');
}`,n.onload=()=>{if(document.fonts)try{document.fonts.load(`24px ${t}`,"L7text"),document.fonts.ready.then(()=>{this.emit("fontloaded",{fontFamily:t})})}catch(i){console.warn("当前环境不支持 document.fonts !"),console.warn("当前环境不支持 iconfont !"),console.warn(i)}},document.getElementsByTagName("head")[0].appendChild(n)}destroy(){this.cache.clear(),this.iconFontMap.clear()}generateFontAtlas(t,r,n){const{fontFamily:i,fontWeight:o,fontSize:a,buffer:s,sdf:u,radius:l,cutoff:f,iconfont:c}=this.fontOptions;let h=n&&n.data;h||(h=window.document.createElement("canvas"),h.width=ng);const d=h.getContext("2d",{willReadFrequently:!0});og(d,i,a,o);const{mapping:p,canvasHeight:v,xOffset:g,yOffset:y}=l9(he({getFontWidth:R=>d.measureText(R).width,fontHeight:a*ig,buffer:s,characterSet:r,maxCanvasWidth:ng},n&&{mapping:n.mapping,xOffset:n.xOffset,yOffset:n.yOffset})),S=d.getImageData(0,0,h.width,h.height);if(h.height=v,d.putImageData(S,0,0),og(d,i,a,o),u){const R=new u9(a,s,l,f,i,o),x=d.getImageData(0,0,R.size,R.size);for(const M of r){if(c){const $=String.fromCharCode(parseInt(M.replace("&#x","").replace(";",""),16)),F=R.draw($);ag(F,x)}else ag(R.draw(M),x);d.putImageData(x,p[M].x,p[M].y)}}else for(const R of r)d.fillText(R,p[R].x,p[R].y+a*g9);return{xOffset:g,yOffset:y,mapping:p,data:h,width:h.width,height:h.height}}getKey(){const{fontFamily:t,fontWeight:r}=this.fontOptions;return`${t}_${r}`}getNewChars(t,r){const n=this.cache.get(t);if(!n)return r;const i=[],o=n.mapping,a=new Set(Object.keys(o));return new Set(r).forEach(u=>{a.has(u)||i.push(u)}),i}}function sg(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(l){return void r(l)}s.done?t(u):Promise.resolve(u).then(n,i)}function ve(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(u){sg(o,n,i,a,s,"next",u)}function s(u){sg(o,n,i,a,s,"throw",u)}a(void 0)})}}const A9=3,ug=1024,Cs=64;class S9 extends Bn.EventEmitter{constructor(...t){super(...t),E(this,"canvasHeight",128),E(this,"texture",void 0),E(this,"canvas",void 0),E(this,"iconData",void 0),E(this,"iconMap",void 0),E(this,"ctx",void 0),E(this,"loadingImageCount",0)}isLoading(){return this.loadingImageCount===0}init(){this.iconData=[],this.iconMap={},this.canvas=window.document.createElement("canvas"),this.canvas.width=128,this.canvas.height=128,this.ctx=this.canvas.getContext("2d")}addImage(t,r){var n=this;return ve(function*(){let i=new Image;n.loadingImageCount++,n.hasImage(t)?console.warn("Image Id already exists"):n.iconData.push({id:t,size:Cs}),n.updateIconMap(),i=yield n.loadImage(r);const o=n.iconData.find(a=>a.id===t);o&&(o.image=i,o.width=i.width,o.height=i.height),n.update()})()}addImageMini(t,r,n){const i=n.getSceneConfig().canvas;let o=i.createImage();if(this.loadingImageCount++,this.hasImage(t))throw new Error("Image Id already exists");this.iconData.push({id:t,size:Cs}),this.updateIconMap(),this.loadImageMini(r,i).then(a=>{o=a;const s=this.iconData.find(u=>u.id===t);s&&(s.image=o,s.width=o.width,s.height=o.height),this.update()})}getTexture(){return this.texture}getIconMap(){return this.iconMap}getCanvas(){return this.canvas}hasImage(t){return this.iconMap.hasOwnProperty(t)}removeImage(t){this.hasImage(t)&&(this.iconData=this.iconData.filter(r=>r.id!==t),delete this.iconMap[t],this.update())}destroy(){this.removeAllListeners("imageUpdate"),this.iconData=[],this.iconMap={}}loadImage(t){return new Promise((r,n)=>{if(t instanceof HTMLImageElement){r(t);return}const i=new Image;i.crossOrigin="anonymous",i.onload=()=>{r(i)},i.onerror=()=>{n(new Error("Could not load image at "+t))},i.src=t instanceof File?URL.createObjectURL(t):t})}update(){this.updateIconMap(),this.updateIconAtlas(),this.loadingImageCount--,this.loadingImageCount===0&&this.emit("imageUpdate")}updateIconAtlas(){this.canvas.width=ug,this.canvas.height=this.canvasHeight,Object.keys(this.iconMap).forEach(t=>{const{x:r,y:n,image:i,width:o=64,height:a=64}=this.iconMap[t],u=Math.max(o,a)/Cs,l=a/u,f=o/u;i&&this.ctx.drawImage(i,r+(Cs-f)/2,n+(Cs-l)/2,f,l)})}updateIconMap(){const{mapping:t,canvasHeight:r}=c9(this.iconData,A9,ug);this.iconMap=t,this.canvasHeight=r}loadImageMini(t,r){return new Promise((n,i)=>{const o=r.createImage();o.crossOrigin="anonymous",o.onload=()=>{n(o)},o.onerror=()=>{i(new Error("Could not load image at "+t))},o.src=t})}}var Wr=1e-6,Fn=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Up(){var e=new Fn(16);return Fn!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function x9(e,t,r,n,i,o,a,s,u,l,f,c,h,d,p,v){var g=new Fn(16);return g[0]=e,g[1]=t,g[2]=r,g[3]=n,g[4]=i,g[5]=o,g[6]=a,g[7]=s,g[8]=u,g[9]=l,g[10]=f,g[11]=c,g[12]=h,g[13]=d,g[14]=p,g[15]=v,g}function lA(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],l=t[7],f=t[8],c=t[9],h=t[10],d=t[11],p=t[12],v=t[13],g=t[14],y=t[15],S=r*s-n*a,R=r*u-i*a,x=r*l-o*a,M=n*u-i*s,$=n*l-o*s,F=i*l-o*u,Y=f*v-c*p,ge=f*g-h*p,q=f*y-d*p,k=c*g-h*v,G=c*y-d*v,K=h*y-d*g,ce=S*K-R*G+x*k+M*q-$*ge+F*Y;return ce?(ce=1/ce,e[0]=(s*K-u*G+l*k)*ce,e[1]=(i*G-n*K-o*k)*ce,e[2]=(v*F-g*$+y*M)*ce,e[3]=(h*$-c*F-d*M)*ce,e[4]=(u*q-a*K-l*ge)*ce,e[5]=(r*K-i*q+o*ge)*ce,e[6]=(g*x-p*F-y*R)*ce,e[7]=(f*F-h*x+d*R)*ce,e[8]=(a*G-s*q+l*Y)*ce,e[9]=(n*q-r*G-o*Y)*ce,e[10]=(p*$-v*x+y*S)*ce,e[11]=(c*x-f*$-d*S)*ce,e[12]=(s*ge-a*k-u*Y)*ce,e[13]=(r*k-n*ge+i*Y)*ce,e[14]=(v*R-p*M-g*S)*ce,e[15]=(f*M-c*R+h*S)*ce,e):null}function Oa(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],l=t[6],f=t[7],c=t[8],h=t[9],d=t[10],p=t[11],v=t[12],g=t[13],y=t[14],S=t[15],R=r[0],x=r[1],M=r[2],$=r[3];return e[0]=R*n+x*s+M*c+$*v,e[1]=R*i+x*u+M*h+$*g,e[2]=R*o+x*l+M*d+$*y,e[3]=R*a+x*f+M*p+$*S,R=r[4],x=r[5],M=r[6],$=r[7],e[4]=R*n+x*s+M*c+$*v,e[5]=R*i+x*u+M*h+$*g,e[6]=R*o+x*l+M*d+$*y,e[7]=R*a+x*f+M*p+$*S,R=r[8],x=r[9],M=r[10],$=r[11],e[8]=R*n+x*s+M*c+$*v,e[9]=R*i+x*u+M*h+$*g,e[10]=R*o+x*l+M*d+$*y,e[11]=R*a+x*f+M*p+$*S,R=r[12],x=r[13],M=r[14],$=r[15],e[12]=R*n+x*s+M*c+$*v,e[13]=R*i+x*u+M*h+$*g,e[14]=R*o+x*l+M*d+$*y,e[15]=R*a+x*f+M*p+$*S,e}function mc(e,t,r){var n=r[0],i=r[1],o=r[2],a,s,u,l,f,c,h,d,p,v,g,y;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(a=t[0],s=t[1],u=t[2],l=t[3],f=t[4],c=t[5],h=t[6],d=t[7],p=t[8],v=t[9],g=t[10],y=t[11],e[0]=a,e[1]=s,e[2]=u,e[3]=l,e[4]=f,e[5]=c,e[6]=h,e[7]=d,e[8]=p,e[9]=v,e[10]=g,e[11]=y,e[12]=a*n+f*i+p*o+t[12],e[13]=s*n+c*i+v*o+t[13],e[14]=u*n+h*i+g*o+t[14],e[15]=l*n+d*i+y*o+t[15]),e}function gc(e,t,r){var n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function kp(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[4],a=t[5],s=t[6],u=t[7],l=t[8],f=t[9],c=t[10],h=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+l*n,e[5]=a*i+f*n,e[6]=s*i+c*n,e[7]=u*i+h*n,e[8]=l*i-o*n,e[9]=f*i-a*n,e[10]=c*i-s*n,e[11]=h*i-u*n,e}function cA(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[0],a=t[1],s=t[2],u=t[3],l=t[8],f=t[9],c=t[10],h=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-l*n,e[1]=a*i-f*n,e[2]=s*i-c*n,e[3]=u*i-h*n,e[8]=o*n+l*i,e[9]=a*n+f*i,e[10]=s*n+c*i,e[11]=u*n+h*i,e}function fA(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[0],a=t[1],s=t[2],u=t[3],l=t[4],f=t[5],c=t[6],h=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i+l*n,e[1]=a*i+f*n,e[2]=s*i+c*n,e[3]=u*i+h*n,e[4]=l*i-o*n,e[5]=f*i-a*n,e[6]=c*i-s*n,e[7]=h*i-u*n,e}function b9(e,t,r,n,i){var o=1/Math.tan(t/2),a;return e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(a=1/(n-i),e[10]=(i+n)*a,e[14]=2*i*n*a):(e[10]=-1,e[14]=-2*n),e}var R9=b9;function lg(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],l=e[7],f=e[8],c=e[9],h=e[10],d=e[11],p=e[12],v=e[13],g=e[14],y=e[15],S=t[0],R=t[1],x=t[2],M=t[3],$=t[4],F=t[5],Y=t[6],ge=t[7],q=t[8],k=t[9],G=t[10],K=t[11],ce=t[12],Pe=t[13],Xe=t[14],Je=t[15];return Math.abs(r-S)<=Wr*Math.max(1,Math.abs(r),Math.abs(S))&&Math.abs(n-R)<=Wr*Math.max(1,Math.abs(n),Math.abs(R))&&Math.abs(i-x)<=Wr*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-M)<=Wr*Math.max(1,Math.abs(o),Math.abs(M))&&Math.abs(a-$)<=Wr*Math.max(1,Math.abs(a),Math.abs($))&&Math.abs(s-F)<=Wr*Math.max(1,Math.abs(s),Math.abs(F))&&Math.abs(u-Y)<=Wr*Math.max(1,Math.abs(u),Math.abs(Y))&&Math.abs(l-ge)<=Wr*Math.max(1,Math.abs(l),Math.abs(ge))&&Math.abs(f-q)<=Wr*Math.max(1,Math.abs(f),Math.abs(q))&&Math.abs(c-k)<=Wr*Math.max(1,Math.abs(c),Math.abs(k))&&Math.abs(h-G)<=Wr*Math.max(1,Math.abs(h),Math.abs(G))&&Math.abs(d-K)<=Wr*Math.max(1,Math.abs(d),Math.abs(K))&&Math.abs(p-ce)<=Wr*Math.max(1,Math.abs(p),Math.abs(ce))&&Math.abs(v-Pe)<=Wr*Math.max(1,Math.abs(v),Math.abs(Pe))&&Math.abs(g-Xe)<=Wr*Math.max(1,Math.abs(g),Math.abs(Xe))&&Math.abs(y-Je)<=Wr*Math.max(1,Math.abs(y),Math.abs(Je))}function Zs(){var e=new Fn(3);return Fn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Wn(e,t,r){var n=new Fn(3);return n[0]=e,n[1]=t,n[2]=r,n}function C9(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function O9(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function qs(e,t){var r=t[0],n=t[1],i=t[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function I9(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function M9(e,t,r){var n=t[0],i=t[1],o=t[2],a=r[0],s=r[1],u=r[2];return e[0]=i*u-o*s,e[1]=o*a-n*u,e[2]=n*s-i*a,e}function Ml(e,t,r){var n=t[0],i=t[1],o=t[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return a=a||1,e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/a,e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,e}function cg(e,t){var r=e[0],n=e[1],i=e[2],o=t[0],a=t[1],s=t[2],u=Math.sqrt(r*r+n*n+i*i),l=Math.sqrt(o*o+a*a+s*s),f=u*l,c=f&&I9(e,t)/f;return Math.acos(Math.min(Math.max(c,-1),1))}var fg=C9;(function(){var e=Zs();return function(t,r,n,i,o,a){var s,u;for(r||(r=3),n||(n=0),i?u=Math.min(i*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],o(e,e,a),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}})();function hA(){var e=new Fn(4);return Fn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function N9(e,t,r,n){var i=new Fn(4);return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i}function P9(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function $p(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,e}(function(){var e=hA();return function(t,r,n,i,o,a){var s,u;for(r||(r=4),n||(n=0),i?u=Math.min(i*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],o(e,e,a),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}})();function hn(){var e=new Fn(2);return Fn!=Float32Array&&(e[0]=0,e[1]=0),e}function Cd(e,t){var r=new Fn(2);return r[0]=e,r[1]=t,r}function $h(e,t){return e[0]=t[0],e[1]=t[1],e}function L9(e,t,r){return e[0]=t,e[1]=r,e}function ki(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function Od(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function w9(e,t){return e[0]=-t[0],e[1]=-t[1],e}function Ec(e,t){var r=t[0],n=t[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e}function Id(e,t){return e[0]*t[0]+e[1]*t[1]}function F9(e,t,r,n){var i=t[0],o=t[1];return e[0]=i+n*(r[0]-i),e[1]=o+n*(r[1]-o),e}var dA=Od;(function(){var e=hn();return function(t,r,n,i,o,a){var s,u;for(r||(r=2),n||(n=0),i?u=Math.min(i*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],o(e,e,a),t[s]=e[0],t[s+1]=e[1];return t}})();class B9{constructor(){E(this,"viewport",void 0),E(this,"overridedViewProjectionMatrix",void 0),E(this,"viewMatrixInverse",void 0),E(this,"cameraPosition",void 0)}init(){}update(t){this.viewport=t,this.viewMatrixInverse=Up(),lA(this.viewMatrixInverse,t.getViewMatrix()),this.cameraPosition=[this.viewMatrixInverse[12],this.viewMatrixInverse[13],this.viewMatrixInverse[14]]}getProjectionMatrix(){return this.viewport.getProjectionMatrix()}getModelMatrix(){return this.viewport.getModelMatrix()}getViewMatrix(){return this.viewport.getViewMatrix()}getViewMatrixUncentered(){return this.viewport.getViewMatrixUncentered()}getViewProjectionMatrixUncentered(){return this.viewport.getViewProjectionMatrixUncentered()}getViewProjectionMatrix(){return this.overridedViewProjectionMatrix||this.viewport.getViewProjectionMatrix()}getZoom(){return this.viewport.getZoom()}getZoomScale(){return this.viewport.getZoomScale()}getCenter(){const[t,r]=this.viewport.getCenter();return[t,r]}getFocalDistance(){return this.viewport.getFocalDistance()}getCameraPosition(){return this.cameraPosition}projectFlat(t,r){return this.viewport.projectFlat(t,r)}setViewProjectionMatrix(t){this.overridedViewProjectionMatrix=t}}const D9={topleft:"column",topright:"column",bottomright:"column",bottomleft:"column",leftcenter:"column",rightcenter:"column",topcenter:"row",bottomcenter:"row",lefttop:"row",righttop:"row",leftbottom:"row",rightbottom:"row"};class U9{constructor(){E(this,"container",void 0),E(this,"controlCorners",void 0),E(this,"controlContainer",void 0),E(this,"scene",void 0),E(this,"mapsService",void 0),E(this,"controls",[]),E(this,"unAddControls",[])}init(t,r){this.container=t.container,this.scene=r,this.mapsService=r.mapService,this.initControlPos()}addControl(t,r){r.mapService.map?(t.addTo(this.scene),this.controls.push(t)):this.unAddControls.push(t)}getControlByName(t){return this.controls.find(r=>r.controlOption.name===t)}removeControl(t){const r=this.controls.indexOf(t);return r>-1&&this.controls.splice(r,1),t.remove(),this}addControls(){this.unAddControls.forEach(t=>{t.addTo(this.scene),this.controls.push(t)}),this.unAddControls=[]}destroy(){for(const t of this.controls)t.remove();this.controls=[],this.clearControlPos()}initControlPos(){const t=this.controlCorners={},r="l7-",n=this.controlContainer=yn("div",r+"control-container",this.container);function i(a=[]){const s=a.map(u=>r+u).join(" ");t[a.filter(u=>!["row","column"].includes(u)).join("")]=yn("div",s,n)}function o(a){return[...a.replace(/^(top|bottom|left|right|center)/,"$1-").split("-"),D9[a]]}Object.values(_c).forEach(a=>{i(o(a))}),this.checkCornerOverlap()}clearControlPos(){for(const t in this.controlCorners)this.controlCorners[t]&&hc(this.controlCorners[t]);this.controlContainer&&hc(this.controlContainer)}checkCornerOverlap(){const t=window.MutationObserver;if(t)for(const r of Object.keys(this.controlCorners)){const n=r.match(/^(top|bottom)(left|right)$/);if(n){const[,i,o]=n,a=this.controlCorners[`${i}${o}`];new t(([{target:u}])=>{a&&(a.style[i]=u.clientHeight+"px")}).observe(this.controlCorners[`${o}${i}`],{childList:!0,attributes:!0})}}}}class k9{constructor(){E(this,"container",void 0),E(this,"scene",void 0),E(this,"mapsService",void 0),E(this,"markers",[]),E(this,"markerLayers",[]),E(this,"unAddMarkers",[]),E(this,"unAddMarkerLayers",[])}addMarkerLayer(t){this.mapsService.map&&this.mapsService.getMarkerContainer()?(this.markerLayers.push(t),t.addTo(this.scene)):this.unAddMarkerLayers.push(t)}removeMarkerLayer(t){t.destroy(),this.markerLayers.indexOf(t);const r=this.markerLayers.indexOf(t);r>-1&&this.markerLayers.splice(r,1)}addMarker(t){this.mapsService.map&&this.mapsService.getMarkerContainer()?(this.markers.push(t),t.addTo(this.scene)):this.unAddMarkers.push(t)}addMarkers(){this.unAddMarkers.forEach(t=>{t.addTo(this.scene),this.markers.push(t)}),this.unAddMarkers=[]}addMarkerLayers(){this.unAddMarkerLayers.forEach(t=>{this.markerLayers.push(t),t.addTo(this.scene)}),this.unAddMarkers=[]}removeMarker(t){t.remove(),this.markers.indexOf(t);const r=this.markers.indexOf(t);r>-1&&this.markers.splice(r,1)}removeAllMarkers(){this.destroy()}init(t){this.scene=t,this.mapsService=t.mapService}destroy(){this.markers.forEach(t=>{t.remove()}),this.markers=[],this.markerLayers.forEach(t=>{t.destroy()}),this.markerLayers=[]}removeMakerLayerMarker(t){t.destroy()}}class $9{constructor(){E(this,"scene",void 0),E(this,"mapsService",void 0),E(this,"popups",[]),E(this,"unAddPopups",[])}get isMarkerReady(){return this.mapsService.map&&this.mapsService.getMarkerContainer()}removePopup(t){t!=null&&t.isOpen()&&t.remove();const r=this.popups.indexOf(t);r>-1&&this.popups.splice(r,1);const n=this.unAddPopups.indexOf(t);n>-1&&this.unAddPopups.splice(n,1)}destroy(){this.popups.forEach(t=>t.remove())}addPopup(t){t&&t.getOptions().autoClose&&[...this.popups,...this.unAddPopups].forEach(r=>{r.getOptions().autoClose&&this.removePopup(r)}),this.isMarkerReady?(t.addTo(this.scene),this.popups.push(t)):this.unAddPopups.push(t),t.on("close",()=>{this.removePopup(t)})}initPopup(){this.unAddPopups.length&&this.unAddPopups.forEach(t=>{this.addPopup(t),this.unAddPopups=[]})}init(t){this.scene=t,this.mapsService=t.mapService}}const z9={MapToken:"您正在使用 Demo 测试 Token, 生产环境务必自行注册 Token 确保服务稳定 高德地图申请地址 https://lbs.amap.com/api/javascript-api/guide/abc/prepare Mapbox地图申请地址 https://docs.mapbox.com/help/glossary/access-token/",SDK:"请确认引入了mapbox-gl api且在L7之前引入"},{merge:V9}=Sr,H9={id:"map",logoPosition:"bottomleft",logoVisible:!0,antialias:!0,stencil:!0,preserveDrawingBuffer:!1,pickBufferScale:1,fitBoundsOptions:{animate:!1}},j9={colors:["rgb(103,0,31)","rgb(178,24,43)","rgb(214,96,77)","rgb(244,165,130)","rgb(253,219,199)","rgb(247,247,247)","rgb(209,229,240)","rgb(146,197,222)","rgb(67,147,195)","rgb(33,102,172)","rgb(5,48,97)"],size:10,shape:"circle",scales:{},shape2d:["circle","triangle","square","pentagon","hexagon","octogon","hexagram","rhombus","vesica"],shape3d:["cylinder","triangleColumn","hexagonColumn","squareColumn"],minZoom:-1,maxZoom:24,visible:!0,autoFit:!1,pickingBuffer:0,enablePropagation:!1,zIndex:0,blend:"normal",maskLayers:[],enableMask:!0,maskOperation:uf.AND,pickedFeatureID:-1,enableMultiPassRenderer:!1,enablePicking:!0,active:!1,activeColor:"#2f54eb",enableHighlight:!1,enableSelect:!1,highlightColor:"#2f54eb",activeMix:0,selectColor:"blue",selectMix:0,enableLighting:!1,animateOption:{enable:!1,interval:.2,duration:4,trailLength:.15},forward:!0};class X9{constructor(){E(this,"sceneConfigCache",{}),E(this,"layerConfigCache",{}),E(this,"layerAttributeConfigCache",{})}getSceneConfig(t){return this.sceneConfigCache[t]}getSceneWarninfo(t){return z9[t]}setSceneConfig(t,r){this.sceneConfigCache[t]=he(he({},H9),r)}getLayerConfig(t){return this.layerConfigCache[t]}setLayerConfig(t,r,n){this.layerConfigCache[r]=he({},V9({},this.sceneConfigCache[t],j9,n))}getAttributeConfig(t){return this.layerAttributeConfigCache[t]}setAttributeConfig(t,r){this.layerAttributeConfigCache[t]=he(he({},this.layerAttributeConfigCache[t]),r)}clean(){this.sceneConfigCache={},this.layerConfigCache={}}}const zh=Math.PI/180,W9=512,hg=4003e4;function dg({latitude:e=0,zoom:t=0,scale:r,highPrecision:n=!1,flipY:i=!1}){r=r!==void 0?r:Math.pow(2,t);const o={},a=W9*r,s=Math.cos(e*zh),u=a/360,l=u/s,f=a/hg/s;if(o.pixelsPerMeter=[f,-f,f],o.metersPerPixel=[1/f,-1/f,1/f],o.pixelsPerDegree=[u,-l,f],o.degreesPerPixel=[1/u,-1/l,1/f],n){const c=zh*Math.tan(e*zh)/s,h=u*c/2,d=a/hg*c,p=d/l*f;o.pixelsPerDegree2=[0,-h,d],o.pixelsPerMeter2=[p,0,p],i&&(o.pixelsPerDegree2[1]=-o.pixelsPerDegree2[1],o.pixelsPerMeter2[1]=-o.pixelsPerMeter2[1])}return i&&(o.pixelsPerMeter[1]=-o.pixelsPerMeter[1],o.metersPerPixel[1]=-o.metersPerPixel[1],o.pixelsPerDegree[1]=-o.pixelsPerDegree[1],o.degreesPerPixel[1]=-o.degreesPerPixel[1]),o}const G9=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];class Y9{constructor(t){E(this,"needRefresh",!0),E(this,"coordinateSystem",void 0),E(this,"viewportCenter",void 0),E(this,"viewportCenterProjection",void 0),E(this,"pixelsPerDegree",void 0),E(this,"pixelsPerDegree2",void 0),E(this,"pixelsPerMeter",void 0),this.cameraService=t}refresh(t){const r=this.cameraService.getZoom(),n=t||this.cameraService.getCenter(),{pixelsPerMeter:i,pixelsPerDegree:o}=dg({latitude:n[1],zoom:r});this.viewportCenter=n,this.viewportCenterProjection=[0,0,0,0],this.pixelsPerMeter=i,this.pixelsPerDegree=o,this.pixelsPerDegree2=[0,0,0],this.coordinateSystem===vc.LNGLAT?this.cameraService.setViewProjectionMatrix(void 0):this.coordinateSystem===vc.LNGLAT_OFFSET&&this.calculateLnglatOffset(n,r),this.needRefresh=!1}getCoordinateSystem(){return this.coordinateSystem}setCoordinateSystem(t){this.coordinateSystem=t}getViewportCenter(){return this.viewportCenter}getViewportCenterProjection(){return this.viewportCenterProjection}getPixelsPerDegree(){return this.pixelsPerDegree}getPixelsPerDegree2(){return this.pixelsPerDegree2}getPixelsPerMeter(){return this.pixelsPerMeter}calculateLnglatOffset(t,r,n,i){const{pixelsPerMeter:o,pixelsPerDegree:a,pixelsPerDegree2:s}=dg({latitude:t[1],zoom:r,scale:n,flipY:i,highPrecision:!0});let u=this.cameraService.getViewMatrix();const l=this.cameraService.getProjectionMatrix();let f=Oa([],l,u);const c=this.cameraService.projectFlat([Math.fround(t[0]),Math.fround(t[1])],Math.pow(2,r));this.viewportCenterProjection=$p([],[c[0],c[1],0,1],f),u=this.cameraService.getViewMatrixUncentered()||u,f=Oa([],l,u),f=Oa([],f,G9),this.cameraService.setViewProjectionMatrix(f),this.pixelsPerMeter=o,this.pixelsPerDegree=a,this.pixelsPerDegree2=s}}class Z9 extends Bn.EventEmitter{constructor(...t){super(...t),E(this,"renderMap",new Map),E(this,"enable",!1),E(this,"renderEnable",!1),E(this,"cacheLogs",{})}setEnable(t){this.enable=!!t}log(t,r){if(!this.enable)return;const n=t.split(".");let i=null;n.forEach((o,a)=>{i!==null?(i[o]||(i[o]={}),a!==n.length-1&&(i=i[o])):(this.cacheLogs[o]||(this.cacheLogs[o]={}),a!==n.length-1&&(i=this.cacheLogs[o])),a===n.length-1&&(i[o]=he(he({time:Date.now()},i[o]),r))})}getLog(t){switch(typeof t){case"string":return this.cacheLogs[t];case"object":return t.map(r=>this.cacheLogs[r]).filter(r=>r!==void 0);case"undefined":return this.cacheLogs}}removeLog(t){delete this.cacheLogs[t]}generateRenderUid(){return this.renderEnable?lU():""}renderDebug(t){this.renderEnable=t}renderStart(t){if(!this.renderEnable||!this.enable)return;const r=this.renderMap.get(t)||{};this.renderMap.set(t,he(he({},r),{},{renderUid:t,renderStart:Date.now()}))}renderEnd(t){if(!this.renderEnable||!this.enable)return;const r=this.renderMap.get(t);if(r){const n=r.renderStart,i=Date.now();this.emit("renderEnd",he(he({},r),{},{renderEnd:i,renderDuration:i-n})),this.renderMap.delete(t)}}destroy(){this.cacheLogs=null,this.renderMap.clear()}}var pA={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
* Licensed under the MIT license */(function(e){(function(t,r,n,i){var o=["","webkit","Moz","MS","ms","o"],a=r.createElement("div"),s="function",u=Math.round,l=Math.abs,f=Date.now;function c(A,O,H){return setTimeout(R(A,H),O)}function h(A,O,H){return Array.isArray(A)?(d(A,H[O],H),!0):!1}function d(A,O,H){var ue;if(A)if(A.forEach)A.forEach(O,H);else if(A.length!==i)for(ue=0;ue<A.length;)O.call(H,A[ue],ue,A),ue++;else for(ue in A)A.hasOwnProperty(ue)&&O.call(H,A[ue],ue,A)}function p(A,O,H){var ue="DEPRECATED METHOD: "+O+`
`+H+` AT
`;return function(){var Le=new Error("get-stack-trace"),Qe=Le&&Le.stack?Le.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Mt=t.console&&(t.console.warn||t.console.log);return Mt&&Mt.call(t.console,ue,Qe),A.apply(this,arguments)}}var v;typeof Object.assign!="function"?v=function(O){if(O===i||O===null)throw new TypeError("Cannot convert undefined or null to object");for(var H=Object(O),ue=1;ue<arguments.length;ue++){var Le=arguments[ue];if(Le!==i&&Le!==null)for(var Qe in Le)Le.hasOwnProperty(Qe)&&(H[Qe]=Le[Qe])}return H}:v=Object.assign;var g=p(function(O,H,ue){for(var Le=Object.keys(H),Qe=0;Qe<Le.length;)(!ue||ue&&O[Le[Qe]]===i)&&(O[Le[Qe]]=H[Le[Qe]]),Qe++;return O},"extend","Use `assign`."),y=p(function(O,H){return g(O,H,!0)},"merge","Use `assign`.");function S(A,O,H){var ue=O.prototype,Le;Le=A.prototype=Object.create(ue),Le.constructor=A,Le._super=ue,H&&v(Le,H)}function R(A,O){return function(){return A.apply(O,arguments)}}function x(A,O){return typeof A==s?A.apply(O&&O[0]||i,O):A}function M(A,O){return A===i?O:A}function $(A,O,H){d(q(O),function(ue){A.addEventListener(ue,H,!1)})}function F(A,O,H){d(q(O),function(ue){A.removeEventListener(ue,H,!1)})}function Y(A,O){for(;A;){if(A==O)return!0;A=A.parentNode}return!1}function ge(A,O){return A.indexOf(O)>-1}function q(A){return A.trim().split(/\s+/g)}function k(A,O,H){if(A.indexOf&&!H)return A.indexOf(O);for(var ue=0;ue<A.length;){if(H&&A[ue][H]==O||!H&&A[ue]===O)return ue;ue++}return-1}function G(A){return Array.prototype.slice.call(A,0)}function K(A,O,H){for(var ue=[],Le=[],Qe=0;Qe<A.length;){var Mt=A[Qe][O];k(Le,Mt)<0&&ue.push(A[Qe]),Le[Qe]=Mt,Qe++}return ue=ue.sort(function(Mr,Nr){return Mr[O]>Nr[O]}),ue}function ce(A,O){for(var H,ue,Le=O[0].toUpperCase()+O.slice(1),Qe=0;Qe<o.length;){if(H=o[Qe],ue=H?H+Le:O,ue in A)return ue;Qe++}return i}var Pe=1;function Xe(){return Pe++}function Je(A){var O=A.ownerDocument||A;return O.defaultView||O.parentWindow||t}var ft=/mobile|tablet|ip(ad|hone|od)|android/i,Ge="ontouchstart"in t,et=ce(t,"PointerEvent")!==i,vt=Ge&&ft.test(navigator.userAgent),mt="touch",It="pen",wt="mouse",gt="kinect",xr=25,Gt=1,Xr=2,le=4,ze=8,nt=1,Ae=2,Dt=4,Et=8,zt=16,Rt=Ae|Dt,ut=Et|zt,Ut=Rt|ut,$r=["x","y"],dr=["clientX","clientY"];function Jt(A,O){var H=this;this.manager=A,this.callback=O,this.element=A.element,this.target=A.options.inputTarget,this.domHandler=function(ue){x(A.options.enable,[A])&&H.handler(ue)},this.init()}Jt.prototype={handler:function(){},init:function(){this.evEl&&$(this.element,this.evEl,this.domHandler),this.evTarget&&$(this.target,this.evTarget,this.domHandler),this.evWin&&$(Je(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&F(this.element,this.evEl,this.domHandler),this.evTarget&&F(this.target,this.evTarget,this.domHandler),this.evWin&&F(Je(this.element),this.evWin,this.domHandler)}};function nn(A){var O,H=A.options.inputClass;return H?O=H:et?O=ts:vt?O=Bo:Ge?O=Do:O=Fo,new O(A,N)}function N(A,O,H){var ue=H.pointers.length,Le=H.changedPointers.length,Qe=O&Gt&&ue-Le===0,Mt=O&(le|ze)&&ue-Le===0;H.isFirst=!!Qe,H.isFinal=!!Mt,Qe&&(A.session={}),H.eventType=O,Si(A,H),A.emit("hammer.input",H),A.recognize(H),A.session.prevInput=H}function Si(A,O){var H=A.session,ue=O.pointers,Le=ue.length;H.firstInput||(H.firstInput=xi(O)),Le>1&&!H.firstMultiple?H.firstMultiple=xi(O):Le===1&&(H.firstMultiple=!1);var Qe=H.firstInput,Mt=H.firstMultiple,br=Mt?Mt.center:Qe.center,Mr=O.center=Kt(ue);O.timeStamp=f(),O.deltaTime=O.timeStamp-Qe.timeStamp,O.angle=qi(br,Mr),O.distance=on(br,Mr),wo(H,O),O.offsetDirection=$n(O.deltaX,O.deltaY);var Nr=Kr(O.deltaTime,O.deltaX,O.deltaY);O.overallVelocityX=Nr.x,O.overallVelocityY=Nr.y,O.overallVelocity=l(Nr.x)>l(Nr.y)?Nr.x:Nr.y,O.scale=Mt?Ki(Mt.pointers,ue):1,O.rotation=Mt?Br(Mt.pointers,ue):0,O.maxPointers=H.prevInput?O.pointers.length>H.prevInput.maxPointers?O.pointers.length:H.prevInput.maxPointers:O.pointers.length,ui(H,O);var xn=A.element;Y(O.srcEvent.target,xn)&&(xn=O.srcEvent.target),O.target=xn}function wo(A,O){var H=O.center,ue=A.offsetDelta||{},Le=A.prevDelta||{},Qe=A.prevInput||{};(O.eventType===Gt||Qe.eventType===le)&&(Le=A.prevDelta={x:Qe.deltaX||0,y:Qe.deltaY||0},ue=A.offsetDelta={x:H.x,y:H.y}),O.deltaX=Le.x+(H.x-ue.x),O.deltaY=Le.y+(H.y-ue.y)}function ui(A,O){var H=A.lastInterval||O,ue=O.timeStamp-H.timeStamp,Le,Qe,Mt,br;if(O.eventType!=ze&&(ue>xr||H.velocity===i)){var Mr=O.deltaX-H.deltaX,Nr=O.deltaY-H.deltaY,xn=Kr(ue,Mr,Nr);Qe=xn.x,Mt=xn.y,Le=l(xn.x)>l(xn.y)?xn.x:xn.y,br=$n(Mr,Nr),A.lastInterval=O}else Le=H.velocity,Qe=H.velocityX,Mt=H.velocityY,br=H.direction;O.velocity=Le,O.velocityX=Qe,O.velocityY=Mt,O.direction=br}function xi(A){for(var O=[],H=0;H<A.pointers.length;)O[H]={clientX:u(A.pointers[H].clientX),clientY:u(A.pointers[H].clientY)},H++;return{timeStamp:f(),pointers:O,center:Kt(O),deltaX:A.deltaX,deltaY:A.deltaY}}function Kt(A){var O=A.length;if(O===1)return{x:u(A[0].clientX),y:u(A[0].clientY)};for(var H=0,ue=0,Le=0;Le<O;)H+=A[Le].clientX,ue+=A[Le].clientY,Le++;return{x:u(H/O),y:u(ue/O)}}function Kr(A,O,H){return{x:O/A||0,y:H/A||0}}function $n(A,O){return A===O?nt:l(A)>=l(O)?A<0?Ae:Dt:O<0?Et:zt}function on(A,O,H){H||(H=$r);var ue=O[H[0]]-A[H[0]],Le=O[H[1]]-A[H[1]];return Math.sqrt(ue*ue+Le*Le)}function qi(A,O,H){H||(H=$r);var ue=O[H[0]]-A[H[0]],Le=O[H[1]]-A[H[1]];return Math.atan2(Le,ue)*180/Math.PI}function Br(A,O){return qi(O[1],O[0],dr)+qi(A[1],A[0],dr)}function Ki(A,O){return on(O[0],O[1],dr)/on(A[0],A[1],dr)}var bi={mousedown:Gt,mousemove:Xr,mouseup:le},Qa="mousedown",mf="mousemove mouseup";function Fo(){this.evEl=Qa,this.evWin=mf,this.pressed=!1,Jt.apply(this,arguments)}S(Fo,Jt,{handler:function(O){var H=bi[O.type];H&Gt&&O.button===0&&(this.pressed=!0),H&Xr&&O.which!==1&&(H=le),this.pressed&&(H&le&&(this.pressed=!1),this.callback(this.manager,H,{pointers:[O],changedPointers:[O],pointerType:wt,srcEvent:O}))}});var gf={pointerdown:Gt,pointermove:Xr,pointerup:le,pointercancel:ze,pointerout:ze},Ef={2:mt,3:It,4:wt,5:gt},Ja="pointerdown",es="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(Ja="MSPointerDown",es="MSPointerMove MSPointerUp MSPointerCancel");function ts(){this.evEl=Ja,this.evWin=es,Jt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}S(ts,Jt,{handler:function(O){var H=this.store,ue=!1,Le=O.type.toLowerCase().replace("ms",""),Qe=gf[Le],Mt=Ef[O.pointerType]||O.pointerType,br=Mt==mt,Mr=k(H,O.pointerId,"pointerId");Qe&Gt&&(O.button===0||br)?Mr<0&&(H.push(O),Mr=H.length-1):Qe&(le|ze)&&(ue=!0),!(Mr<0)&&(H[Mr]=O,this.callback(this.manager,Qe,{pointers:H,changedPointers:[O],pointerType:Mt,srcEvent:O}),ue&&H.splice(Mr,1))}});var yf={touchstart:Gt,touchmove:Xr,touchend:le,touchcancel:ze},Qr="touchstart",Tf="touchstart touchmove touchend touchcancel";function Vu(){this.evTarget=Qr,this.evWin=Tf,this.started=!1,Jt.apply(this,arguments)}S(Vu,Jt,{handler:function(O){var H=yf[O.type];if(H===Gt&&(this.started=!0),!!this.started){var ue=Af.call(this,O,H);H&(le|ze)&&ue[0].length-ue[1].length===0&&(this.started=!1),this.callback(this.manager,H,{pointers:ue[0],changedPointers:ue[1],pointerType:mt,srcEvent:O})}}});function Af(A,O){var H=G(A.touches),ue=G(A.changedTouches);return O&(le|ze)&&(H=K(H.concat(ue),"identifier")),[H,ue]}var Sf={touchstart:Gt,touchmove:Xr,touchend:le,touchcancel:ze},xf="touchstart touchmove touchend touchcancel";function Bo(){this.evTarget=xf,this.targetIds={},Jt.apply(this,arguments)}S(Bo,Jt,{handler:function(O){var H=Sf[O.type],ue=bf.call(this,O,H);ue&&this.callback(this.manager,H,{pointers:ue[0],changedPointers:ue[1],pointerType:mt,srcEvent:O})}});function bf(A,O){var H=G(A.touches),ue=this.targetIds;if(O&(Gt|Xr)&&H.length===1)return ue[H[0].identifier]=!0,[H,H];var Le,Qe,Mt=G(A.changedTouches),br=[],Mr=this.target;if(Qe=H.filter(function(Nr){return Y(Nr.target,Mr)}),O===Gt)for(Le=0;Le<Qe.length;)ue[Qe[Le].identifier]=!0,Le++;for(Le=0;Le<Mt.length;)ue[Mt[Le].identifier]&&br.push(Mt[Le]),O&(le|ze)&&delete ue[Mt[Le].identifier],Le++;if(br.length)return[K(Qe.concat(br),"identifier"),br]}var Rf=2500,rs=25;function Do(){Jt.apply(this,arguments);var A=R(this.handler,this);this.touch=new Bo(this.manager,A),this.mouse=new Fo(this.manager,A),this.primaryTouch=null,this.lastTouches=[]}S(Do,Jt,{handler:function(O,H,ue){var Le=ue.pointerType==mt,Qe=ue.pointerType==wt;if(!(Qe&&ue.sourceCapabilities&&ue.sourceCapabilities.firesTouchEvents)){if(Le)ur.call(this,H,ue);else if(Qe&&Cf.call(this,ue))return;this.callback(O,H,ue)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function ur(A,O){A&Gt?(this.primaryTouch=O.changedPointers[0].identifier,Hu.call(this,O)):A&(le|ze)&&Hu.call(this,O)}function Hu(A){var O=A.changedPointers[0];if(O.identifier===this.primaryTouch){var H={x:O.clientX,y:O.clientY};this.lastTouches.push(H);var ue=this.lastTouches,Le=function(){var Qe=ue.indexOf(H);Qe>-1&&ue.splice(Qe,1)};setTimeout(Le,Rf)}}function Cf(A){for(var O=A.srcEvent.clientX,H=A.srcEvent.clientY,ue=0;ue<this.lastTouches.length;ue++){var Le=this.lastTouches[ue],Qe=Math.abs(O-Le.x),Mt=Math.abs(H-Le.y);if(Qe<=rs&&Mt<=rs)return!0}return!1}var ju=ce(a.style,"touchAction"),Xu=ju!==i,Wu="compute",Gu="auto",ns="manipulation",li="none",Qi="pan-x",Ji="pan-y",Uo=If();function is(A,O){this.manager=A,this.set(O)}is.prototype={set:function(A){A==Wu&&(A=this.compute()),Xu&&this.manager.element.style&&Uo[A]&&(this.manager.element.style[ju]=A),this.actions=A.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var A=[];return d(this.manager.recognizers,function(O){x(O.options.enable,[O])&&(A=A.concat(O.getTouchAction()))}),Of(A.join(" "))},preventDefaults:function(A){var O=A.srcEvent,H=A.offsetDirection;if(this.manager.session.prevented){O.preventDefault();return}var ue=this.actions,Le=ge(ue,li)&&!Uo[li],Qe=ge(ue,Ji)&&!Uo[Ji],Mt=ge(ue,Qi)&&!Uo[Qi];if(Le){var br=A.pointers.length===1,Mr=A.distance<2,Nr=A.deltaTime<250;if(br&&Mr&&Nr)return}if(!(Mt&&Qe)&&(Le||Qe&&H&Rt||Mt&&H&ut))return this.preventSrc(O)},preventSrc:function(A){this.manager.session.prevented=!0,A.preventDefault()}};function Of(A){if(ge(A,li))return li;var O=ge(A,Qi),H=ge(A,Ji);return O&&H?li:O||H?O?Qi:Ji:ge(A,ns)?ns:Gu}function If(){if(!Xu)return!1;var A={},O=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(H){A[H]=O?t.CSS.supports("touch-action",H):!0}),A}var ko=1,an=2,Ri=4,Jn=8,zn=Jn,eo=16,An=32;function Vn(A){this.options=v({},this.defaults,A||{}),this.id=Xe(),this.manager=null,this.options.enable=M(this.options.enable,!0),this.state=ko,this.simultaneous={},this.requireFail=[]}Vn.prototype={defaults:{},set:function(A){return v(this.options,A),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(A){if(h(A,"recognizeWith",this))return this;var O=this.simultaneous;return A=$o(A,this),O[A.id]||(O[A.id]=A,A.recognizeWith(this)),this},dropRecognizeWith:function(A){return h(A,"dropRecognizeWith",this)?this:(A=$o(A,this),delete this.simultaneous[A.id],this)},requireFailure:function(A){if(h(A,"requireFailure",this))return this;var O=this.requireFail;return A=$o(A,this),k(O,A)===-1&&(O.push(A),A.requireFailure(this)),this},dropRequireFailure:function(A){if(h(A,"dropRequireFailure",this))return this;A=$o(A,this);var O=k(this.requireFail,A);return O>-1&&this.requireFail.splice(O,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(A){return!!this.simultaneous[A.id]},emit:function(A){var O=this,H=this.state;function ue(Le){O.manager.emit(Le,A)}H<Jn&&ue(O.options.event+Yu(H)),ue(O.options.event),A.additionalEvent&&ue(A.additionalEvent),H>=Jn&&ue(O.options.event+Yu(H))},tryEmit:function(A){if(this.canEmit())return this.emit(A);this.state=An},canEmit:function(){for(var A=0;A<this.requireFail.length;){if(!(this.requireFail[A].state&(An|ko)))return!1;A++}return!0},recognize:function(A){var O=v({},A);if(!x(this.options.enable,[this,O])){this.reset(),this.state=An;return}this.state&(zn|eo|An)&&(this.state=ko),this.state=this.process(O),this.state&(an|Ri|Jn|eo)&&this.tryEmit(O)},process:function(A){},getTouchAction:function(){},reset:function(){}};function Yu(A){return A&eo?"cancel":A&Jn?"end":A&Ri?"move":A&an?"start":""}function Zu(A){return A==zt?"down":A==Et?"up":A==Ae?"left":A==Dt?"right":""}function $o(A,O){var H=O.manager;return H?H.get(A):A}function vn(){Vn.apply(this,arguments)}S(vn,Vn,{defaults:{pointers:1},attrTest:function(A){var O=this.options.pointers;return O===0||A.pointers.length===O},process:function(A){var O=this.state,H=A.eventType,ue=O&(an|Ri),Le=this.attrTest(A);return ue&&(H&ze||!Le)?O|eo:ue||Le?H&le?O|Jn:O&an?O|Ri:an:An}});function zo(){vn.apply(this,arguments),this.pX=null,this.pY=null}S(zo,vn,{defaults:{event:"pan",threshold:10,pointers:1,direction:Ut},getTouchAction:function(){var A=this.options.direction,O=[];return A&Rt&&O.push(Ji),A&ut&&O.push(Qi),O},directionTest:function(A){var O=this.options,H=!0,ue=A.distance,Le=A.direction,Qe=A.deltaX,Mt=A.deltaY;return Le&O.direction||(O.direction&Rt?(Le=Qe===0?nt:Qe<0?Ae:Dt,H=Qe!=this.pX,ue=Math.abs(A.deltaX)):(Le=Mt===0?nt:Mt<0?Et:zt,H=Mt!=this.pY,ue=Math.abs(A.deltaY))),A.direction=Le,H&&ue>O.threshold&&Le&O.direction},attrTest:function(A){return vn.prototype.attrTest.call(this,A)&&(this.state&an||!(this.state&an)&&this.directionTest(A))},emit:function(A){this.pX=A.deltaX,this.pY=A.deltaY;var O=Zu(A.direction);O&&(A.additionalEvent=this.options.event+O),this._super.emit.call(this,A)}});function Ci(){vn.apply(this,arguments)}S(Ci,vn,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[li]},attrTest:function(A){return this._super.attrTest.call(this,A)&&(Math.abs(A.scale-1)>this.options.threshold||this.state&an)},emit:function(A){if(A.scale!==1){var O=A.scale<1?"in":"out";A.additionalEvent=this.options.event+O}this._super.emit.call(this,A)}});function Vo(){Vn.apply(this,arguments),this._timer=null,this._input=null}S(Vo,Vn,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Gu]},process:function(A){var O=this.options,H=A.pointers.length===O.pointers,ue=A.distance<O.threshold,Le=A.deltaTime>O.time;if(this._input=A,!ue||!H||A.eventType&(le|ze)&&!Le)this.reset();else if(A.eventType&Gt)this.reset(),this._timer=c(function(){this.state=zn,this.tryEmit()},O.time,this);else if(A.eventType&le)return zn;return An},reset:function(){clearTimeout(this._timer)},emit:function(A){this.state===zn&&(A&&A.eventType&le?this.manager.emit(this.options.event+"up",A):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}});function os(){vn.apply(this,arguments)}S(os,vn,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[li]},attrTest:function(A){return this._super.attrTest.call(this,A)&&(Math.abs(A.rotation)>this.options.threshold||this.state&an)}});function as(){vn.apply(this,arguments)}S(as,vn,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Rt|ut,pointers:1},getTouchAction:function(){return zo.prototype.getTouchAction.call(this)},attrTest:function(A){var O=this.options.direction,H;return O&(Rt|ut)?H=A.overallVelocity:O&Rt?H=A.overallVelocityX:O&ut&&(H=A.overallVelocityY),this._super.attrTest.call(this,A)&&O&A.offsetDirection&&A.distance>this.options.threshold&&A.maxPointers==this.options.pointers&&l(H)>this.options.velocity&&A.eventType&le},emit:function(A){var O=Zu(A.offsetDirection);O&&this.manager.emit(this.options.event+O,A),this.manager.emit(this.options.event,A)}});function ei(){Vn.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}S(ei,Vn,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ns]},process:function(A){var O=this.options,H=A.pointers.length===O.pointers,ue=A.distance<O.threshold,Le=A.deltaTime<O.time;if(this.reset(),A.eventType&Gt&&this.count===0)return this.failTimeout();if(ue&&Le&&H){if(A.eventType!=le)return this.failTimeout();var Qe=this.pTime?A.timeStamp-this.pTime<O.interval:!0,Mt=!this.pCenter||on(this.pCenter,A.center)<O.posThreshold;this.pTime=A.timeStamp,this.pCenter=A.center,!Mt||!Qe?this.count=1:this.count+=1,this._input=A;var br=this.count%O.taps;if(br===0)return this.hasRequireFailures()?(this._timer=c(function(){this.state=zn,this.tryEmit()},O.interval,this),an):zn}return An},failTimeout:function(){return this._timer=c(function(){this.state=An},this.options.interval,this),An},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==zn&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Sn(A,O){return O=O||{},O.recognizers=M(O.recognizers,Sn.defaults.preset),new ss(A,O)}Sn.VERSION="2.0.7",Sn.defaults={domEvents:!1,touchAction:Wu,enable:!0,inputTarget:null,inputClass:null,preset:[[os,{enable:!1}],[Ci,{enable:!1},["rotate"]],[as,{direction:Rt}],[zo,{direction:Rt},["swipe"]],[ei],[ei,{event:"doubletap",taps:2},["tap"]],[Vo]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var qu=1,Ho=2;function ss(A,O){this.options=v({},Sn.defaults,O||{}),this.options.inputTarget=this.options.inputTarget||A,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=A,this.input=nn(this),this.touchAction=new is(this,this.options.touchAction),Ku(this,!0),d(this.options.recognizers,function(H){var ue=this.add(new H[0](H[1]));H[2]&&ue.recognizeWith(H[2]),H[3]&&ue.requireFailure(H[3])},this)}ss.prototype={set:function(A){return v(this.options,A),A.touchAction&&this.touchAction.update(),A.inputTarget&&(this.input.destroy(),this.input.target=A.inputTarget,this.input.init()),this},stop:function(A){this.session.stopped=A?Ho:qu},recognize:function(A){var O=this.session;if(!O.stopped){this.touchAction.preventDefaults(A);var H,ue=this.recognizers,Le=O.curRecognizer;(!Le||Le&&Le.state&zn)&&(Le=O.curRecognizer=null);for(var Qe=0;Qe<ue.length;)H=ue[Qe],O.stopped!==Ho&&(!Le||H==Le||H.canRecognizeWith(Le))?H.recognize(A):H.reset(),!Le&&H.state&(an|Ri|Jn)&&(Le=O.curRecognizer=H),Qe++}},get:function(A){if(A instanceof Vn)return A;for(var O=this.recognizers,H=0;H<O.length;H++)if(O[H].options.event==A)return O[H];return null},add:function(A){if(h(A,"add",this))return this;var O=this.get(A.options.event);return O&&this.remove(O),this.recognizers.push(A),A.manager=this,this.touchAction.update(),A},remove:function(A){if(h(A,"remove",this))return this;if(A=this.get(A),A){var O=this.recognizers,H=k(O,A);H!==-1&&(O.splice(H,1),this.touchAction.update())}return this},on:function(A,O){if(A!==i&&O!==i){var H=this.handlers;return d(q(A),function(ue){H[ue]=H[ue]||[],H[ue].push(O)}),this}},off:function(A,O){if(A!==i){var H=this.handlers;return d(q(A),function(ue){O?H[ue]&&H[ue].splice(k(H[ue],O),1):delete H[ue]}),this}},emit:function(A,O){this.options.domEvents&&Mf(A,O);var H=this.handlers[A]&&this.handlers[A].slice();if(!(!H||!H.length)){O.type=A,O.preventDefault=function(){O.srcEvent.preventDefault()};for(var ue=0;ue<H.length;)H[ue](O),ue++}},destroy:function(){this.element&&Ku(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ku(A,O){var H=A.element;if(H.style){var ue;d(A.options.cssProps,function(Le,Qe){ue=ce(H.style,Qe),O?(A.oldCssProps[ue]=H.style[ue],H.style[ue]=Le):H.style[ue]=A.oldCssProps[ue]||""}),O||(A.oldCssProps={})}}function Mf(A,O){var H=r.createEvent("Event");H.initEvent(A,!0,!0),H.gesture=O,O.target.dispatchEvent(H)}v(Sn,{INPUT_START:Gt,INPUT_MOVE:Xr,INPUT_END:le,INPUT_CANCEL:ze,STATE_POSSIBLE:ko,STATE_BEGAN:an,STATE_CHANGED:Ri,STATE_ENDED:Jn,STATE_RECOGNIZED:zn,STATE_CANCELLED:eo,STATE_FAILED:An,DIRECTION_NONE:nt,DIRECTION_LEFT:Ae,DIRECTION_RIGHT:Dt,DIRECTION_UP:Et,DIRECTION_DOWN:zt,DIRECTION_HORIZONTAL:Rt,DIRECTION_VERTICAL:ut,DIRECTION_ALL:Ut,Manager:ss,Input:Jt,TouchAction:is,TouchInput:Bo,MouseInput:Fo,PointerEventInput:ts,TouchMouseInput:Do,SingleTouchInput:Vu,Recognizer:Vn,AttrRecognizer:vn,Tap:ei,Pan:zo,Swipe:as,Pinch:Ci,Rotate:os,Press:Vo,on:$,off:F,each:d,merge:y,extend:g,assign:v,inherit:S,bindFn:R,prefixed:ce});var Nf=typeof t<"u"?t:typeof self<"u"?self:{};Nf.Hammer=Sn,e.exports?e.exports=Sn:t[n]=Sn})(window,document,"Hammer")})(pA);var q9=pA.exports;const Os=Ht(q9),K9={panstart:"dragstart",panmove:"dragging",panend:"dragend",pancancel:"dragcancel"};class Q9 extends lp{get mapService(){return this.container.mapService}constructor(t){super(),E(this,"indragging",!1),E(this,"hammertime",void 0),E(this,"lastClickTime",0),E(this,"lastClickXY",[-1,-1]),E(this,"clickTimer",void 0),E(this,"$containter",void 0),E(this,"onDrag",r=>{const n=this.interactionEvent(r);n.type=K9[n.type],n.type==="dragging"?this.indragging=!0:this.indragging=!1,this.emit(cn.Drag,n)}),E(this,"onHammer",r=>{r.srcEvent.stopPropagation();const n=this.interactionEvent(r);this.emit(cn.Hover,n)}),E(this,"onTouch",r=>{const n=r.touches[0];this.onHover({clientX:n.clientX,clientY:n.clientY,type:"touchstart"})}),E(this,"onTouchEnd",r=>{if(r.changedTouches.length>0){const n=r.changedTouches[0];this.onHover({clientX:n.clientX,clientY:n.clientY,type:"touchend"})}}),E(this,"onTouchMove",r=>{const n=r.changedTouches[0];this.onHover({clientX:n.clientX,clientY:n.clientY,type:"touchmove"})}),E(this,"onHover",r=>{const{clientX:n,clientY:i}=r;let o=n,a=i;const s=r.type,u=this.mapService.getMapContainer();if(u){const{top:f,left:c}=u.getBoundingClientRect();o=o-c-u.clientLeft,a=a-f-u.clientTop}const l=this.mapService.containerToLngLat([o,a]);if(s==="click"){this.isDoubleTap(o,a,l);return}if(s==="touch"){this.isDoubleTap(o,a,l);return}s!=="click"&&s!=="dblclick"&&this.emit(cn.Hover,{x:o,y:a,lngLat:l,type:s,target:r})}),this.container=t}init(){this.addEventListenerOnMap(),this.$containter=this.mapService.getMapContainer()}destroy(){this.hammertime&&this.hammertime.destroy(),this.removeEventListenerOnMap(),this.off(cn.Hover)}triggerHover({x:t,y:r}){this.emit(cn.Hover,{x:t,y:r})}triggerSelect(t){this.emit(cn.Select,{featureId:t})}triggerActive(t){this.emit(cn.Active,{featureId:t})}addEventListenerOnMap(){const t=this.mapService.getMapContainer();if(t){const r=new Os.Manager(t);r.add(new Os.Tap({event:"dblclick",taps:2})),r.add(new Os.Tap({event:"click"})),r.add(new Os.Pan({threshold:0,pointers:0})),r.add(new Os.Press({})),r.on("dblclick click",this.onHammer),r.on("panstart panmove panend pancancel",this.onDrag),t.addEventListener("touchstart",this.onTouch),t.addEventListener("touchend",this.onTouchEnd),t.addEventListener("mousemove",this.onHover),t.addEventListener("touchmove",this.onTouchMove),t.addEventListener("mousedown",this.onHover,!0),t.addEventListener("mouseup",this.onHover),t.addEventListener("contextmenu",this.onHover),this.hammertime=r}}removeEventListenerOnMap(){const t=this.mapService.getMapContainer();t&&(t.removeEventListener("mousemove",this.onHover),this.hammertime.off("dblclick click",this.onHammer),this.hammertime.off("panstart panmove panend pancancel",this.onDrag),t.removeEventListener("touchstart",this.onTouch),t.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("mousedown",this.onHover),t.removeEventListener("mouseup",this.onHover),t.removeEventListener("contextmenu",this.onHover))}interactionEvent(t){const{type:r,pointerType:n}=t;let i,o;n==="touch"?(o=Math.floor(t.pointers[0].clientY),i=Math.floor(t.pointers[0].clientX)):(o=Math.floor(t.srcEvent.y),i=Math.floor(t.srcEvent.x));const a=this.mapService.getMapContainer();if(a){const{top:u,left:l}=a.getBoundingClientRect();i-=l,o-=u}const s=this.mapService.containerToLngLat([i,o]);return{x:i,y:o,lngLat:s,type:r,target:t.srcEvent}}isDoubleTap(t,r,n){const i=new Date().getTime();let o="click";i-this.lastClickTime<400&&Math.abs(this.lastClickXY[0]-t)<10&&Math.abs(this.lastClickXY[1]-r)<10?(this.lastClickTime=0,this.lastClickXY=[-1,-1],this.clickTimer&&clearTimeout(this.clickTimer),o="dblclick",this.emit(cn.Hover,{x:t,y:r,lngLat:n,type:o})):(this.lastClickTime=i,this.lastClickXY=[t,r],this.clickTimer=setTimeout(()=>{o="click",this.emit(cn.Hover,{x:t,y:r,lngLat:n,type:o})},400))}}let J9=0;function e$(e){let t=e;if(typeof e=="string"&&(t=document.getElementById(e)),t){const r=document.createElement("div");return r.style.cssText+=`
position: absolute;
z-index:2;
height: 100%;
width: 100%;
pointer-events: none;
`,r.id=`l7-scene-${J9++}`,r.classList.add("l7-scene"),t.appendChild(r),r}return null}function t$(e){var t;let r=!0;if((e==null||(t=e.target)===null||t===void 0?void 0:t.target)instanceof HTMLElement){var n;let o=e==null||(n=e.target)===null||n===void 0?void 0:n.target;for(;o;){var i;const a=Array.from(o.classList);if(a.includes("l7-marker")||a.includes("l7-popup")){r=!1;break}o=(i=o)===null||i===void 0?void 0:i.parentElement}}return r}let pu=function(e){return e[e.SAMPLED=0]="SAMPLED",e[e.RENDER_TARGET=1]="RENDER_TARGET",e}({});class r${constructor(t){var r=this;E(this,"pickedColors",void 0),E(this,"pickedTileLayers",[]),E(this,"pickingFBO",void 0),E(this,"width",0),E(this,"height",0),E(this,"alreadyInPicking",!1),E(this,"pickBufferScale",1),E(this,"pickFromPickingFBO",function(){var n=ve(function*(i,{x:o,y:a,lngLat:s,type:u,target:l}){var f;let c=!1;const{readPixels:h,readPixelsAsync:d,getViewportSize:p,queryVerdorInfo:v}=r.rendererService,{width:g,height:y}=p(),{enableHighlight:S,enableSelect:R}=i.getLayerConfig(),x=o*ln,M=a*ln;if(x>g-1*ln||x<0||M>y-1*ln||M<0)return!1;let $;if(v()==="WebGPU"?$=yield d({x:Math.floor(x/r.pickBufferScale),y:Math.floor((y-(a+1)*ln)/r.pickBufferScale),width:1,height:1,data:new Uint8Array(4),framebuffer:r.pickingFBO}):$=h({x:Math.floor(x/r.pickBufferScale),y:Math.floor((y-(a+1)*ln)/r.pickBufferScale),width:1,height:1,data:new Uint8Array(4),framebuffer:r.pickingFBO}),r.pickedColors=$,$[0]!==0||$[1]!==0||$[2]!==0){const Y=yo($),ge=i.layerPickService.getFeatureById(Y);Y!==i.getCurrentPickId()&&u==="mousemove"&&(u="mouseenter");const q={x:o,y:a,type:u,lngLat:s,featureId:Y,feature:ge,target:l};ge&&(c=!0,i.setCurrentPickId(Y),r.triggerHoverOnLayer(i,q))}else{const Y={x:o,y:a,lngLat:s,type:i.getCurrentPickId()!==null&&u==="mousemove"?"mouseout":"un"+u,featureId:null,target:l,feature:null};r.triggerHoverOnLayer(i,he(he({},Y),{},{type:"unpick"})),r.triggerHoverOnLayer(i,Y),i.setCurrentPickId(null)}if(S&&i.layerPickService.highlightPickedFeature($),R&&u==="click"&&((f=$)===null||f===void 0?void 0:f.toString())!==[0,0,0,0].toString()){const Y=yo($);i.getCurrentSelectedId()===null||Y!==i.getCurrentSelectedId()?(i.layerPickService.selectFeature($),i.setCurrentSelectedId(Y)):(i.layerPickService.selectFeature(new Uint8Array([0,0,0,0])),i.setCurrentSelectedId(null))}return c});return function(i,o){return n.apply(this,arguments)}}()),this.container=t}get mapService(){return this.container.mapService}get rendererService(){return this.container.rendererService}get configService(){return this.container.globalConfigService}get interactionService(){return this.container.interactionService}get layerService(){return this.container.layerService}init(t){const{createTexture2D:r,createFramebuffer:n,getViewportSize:i}=this.rendererService;let{width:o,height:a}=i();this.pickBufferScale=this.configService.getSceneConfig(t).pickBufferScale||1,o=Math.round(o/this.pickBufferScale),a=Math.round(a/this.pickBufferScale);const s=r({width:o,height:a,usage:pu.RENDER_TARGET,label:"Picking Texture"});this.pickingFBO=n({color:s,depth:!0,width:o,height:a}),this.interactionService.on(cn.Hover,this.pickingAllLayer.bind(this))}boxPickLayer(t,r,n){var i=this;return ve(function*(){const{useFramebufferAsync:o,clear:a}=i.rendererService;i.resizePickingFBO(),t.hooks.beforePickingEncode.call(),yield o(i.pickingFBO,ve(function*(){a({framebuffer:i.pickingFBO,color:[0,0,0,0],stencil:0,depth:1}),t.renderModels({ispick:!0})})),t.hooks.afterPickingEncode.call();const s=yield i.pickBox(t,r);n(s)})()}pickBox(t,r){var n=this;return ve(function*(){const[i,o,a,s]=r.map(y=>{const S=y<0?0:y;return Math.floor(S*ln/n.pickBufferScale)}),{readPixelsAsync:u,getViewportSize:l}=n.rendererService,{width:f,height:c}=l();if(i>(f-1)*ln/n.pickBufferScale||a<0||o>(c-1)*ln/n.pickBufferScale||s<0)return[];const h=Math.min(f/n.pickBufferScale,a)-i,d=Math.min(c/n.pickBufferScale,s)-o,p=yield u({x:i,y:Math.floor(c/n.pickBufferScale-(s+1)),width:h,height:d,data:new Uint8Array(h*d*4),framebuffer:n.pickingFBO}),v=[],g={};for(let y=0;y<p.length/4;y=y+1){const S=p.slice(y*4,y*4+4),R=yo(S);if(R!==-1&&!g[R]){const x=t.layerPickService.getFeatureById(R);v.push(he(he({},x),{},{pickedFeatureIdx:R})),g[R]=!0}}return v})()}handleCursor(t,r){const{cursor:n="",cursorEnabled:i}=t.getLayerConfig();if(i){const a=this.mapService.getType()==="amap"?this.mapService.getMapContainer():this.mapService.getMarkerContainer(),s=a==null?void 0:a.style.getPropertyValue("cursor");r==="unmousemove"&&s!==""?a==null||a.style.setProperty("cursor",""):r==="mousemove"&&(a==null||a.style.setProperty("cursor",n))}}destroy(){this.pickingFBO.destroy(),this.pickingFBO=null}pickingAllLayer(t){var r=this;return ve(function*(){!r.layerService.needPick(t.type)||!r.isPickingAllLayer()||(r.alreadyInPicking=!0,yield r.pickingLayers(t),r.layerService.renderLayers(),r.alreadyInPicking=!1)})()}isPickingAllLayer(){return!(this.alreadyInPicking||this.layerService.alreadyInRendering||this.interactionService.indragging||!this.layerService.getShaderPickStat())}resizePickingFBO(){const{getViewportSize:t}=this.rendererService,{width:r,height:n}=t();(this.width!==r||this.height!==n)&&(this.pickingFBO.resize({width:Math.round(r/this.pickBufferScale),height:Math.round(n/this.pickBufferScale)}),this.width=r,this.height=n)}pickingLayers(t){var r=this;return ve(function*(){const{clear:n,useFramebufferAsync:i}=r.rendererService;r.resizePickingFBO();const o=r.layerService.getRenderList();for(const a of o.filter(s=>s.needPick(t.type)).reverse()){yield i(r.pickingFBO,ve(function*(){n({framebuffer:r.pickingFBO,color:[0,0,0,0],stencil:0,depth:1}),a.layerPickService.pickRender(t)}));const s=yield r.pickFromPickingFBO(a,t);if(r.layerService.pickedLayerId=s?+a.id:-1,s&&!a.getLayerConfig().enablePropagation)break}})()}triggerHoverOnLayer(t,r){t$(r)&&(this.handleCursor(t,r.type),t.emit(r.type,r))}}class n${constructor(t=!0){E(this,"autoStart",void 0),E(this,"startTime",0),E(this,"oldTime",0),E(this,"running",!1),E(this,"elapsedTime",0),this.autoStart=t}start(){this.startTime=(typeof performance>"u"?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const r=(typeof performance>"u"?Date:performance).now();t=(r-this.oldTime)/1e3,this.oldTime=r,this.elapsedTime+=t}return t}}const{throttle:pg}=Sr;class i$ extends Bn.EventEmitter{get renderService(){return this.container.rendererService}get mapService(){return this.container.mapService}get debugService(){return this.container.debugService}constructor(t){super(),E(this,"pickedLayerId",-1),E(this,"clock",new n$),E(this,"alreadyInRendering",!1),E(this,"layers",[]),E(this,"layerList",[]),E(this,"layerRenderID",void 0),E(this,"sceneInited",!1),E(this,"animateInstanceCount",0),E(this,"shaderPicking",!0),E(this,"enableRender",!0),E(this,"reRender",pg(()=>{this.renderLayers()},32)),E(this,"throttleRenderLayers",pg(()=>{this.renderLayers()},16)),this.container=t}needPick(t){return this.updateLayerRenderList(),this.layerList.some(r=>r.needPick(t))}add(t){this.layers.push(t),this.sceneInited&&t.init().then(()=>{this.renderLayers()})}addMask(t){this.sceneInited&&t.init().then(()=>{this.renderLayers()})}initLayers(){var t=this;return ve(function*(){t.sceneInited=!0,t.layers.forEach(function(){var r=ve(function*(n){n.startInit||(yield n.init(),t.updateLayerRenderList())});return function(n){return r.apply(this,arguments)}}())})()}getSceneInited(){return this.sceneInited}getRenderList(){return this.layerList}getLayers(){return this.layers}getLayer(t){return this.layers.find(r=>r.id===t)}getLayerByName(t){return this.layers.find(r=>r.name===t)}remove(t,r){var n=this;return ve(function*(){r?r.layerChildren=r.layerChildren.filter(i=>i!==t):n.layers=n.layers.filter(i=>i!==t),t.destroy(),n.reRender(),n.emit("layerChange",n.layers)})()}removeAllLayers(){var t=this;return ve(function*(){t.destroy(),t.reRender()})()}setEnableRender(t){this.enableRender=t}renderLayers(){var t=this;return ve(function*(){if(t.alreadyInRendering||!t.enableRender)return;t.updateLayerRenderList();const r=t.debugService.generateRenderUid();t.debugService.renderStart(r),t.alreadyInRendering=!0,t.clear();for(const n of t.layerList)n.prerender();t.renderService.beginFrame();for(const n of t.layerList){const{enableMask:i}=n.getLayerConfig();n.masks.filter(o=>o.inited).length>0&&i&&t.renderMask(n.masks),n.getLayerConfig().enableMultiPassRenderer?yield n.renderMultiPass():n.render()}t.renderService.endFrame(),t.debugService.renderEnd(r),t.alreadyInRendering=!1})()}renderMask(t){let r=0;this.renderService.clear({stencil:0,depth:1,framebuffer:null});const n=t.length>1?go.MULTIPLE:go.SINGLE;for(const i of t)i.render({isStencil:!0,stencilType:n,stencilIndex:r++})}beforeRenderData(t){var r=this;return ve(function*(){(yield t.hooks.beforeRenderData.promise())&&r.renderLayers()})()}renderTileLayerMask(t){let r=0;const{enableMask:n=!0}=t.getLayerConfig();let i=t.tileMask?1:0;const o=t.masks.filter(s=>s.inited);i=i+(n?o.length:1);const a=i>1?go.MULTIPLE:go.SINGLE;if((t.tileMask||o.length&&n)&&this.renderService.clear({stencil:0,depth:1,framebuffer:null}),o.length&&n)for(const s of o)s.render({isStencil:!0,stencilType:a,stencilIndex:r++});t.tileMask&&t.tileMask.render({isStencil:!0,stencilType:a,stencilIndex:r++,stencilOperation:uf.OR})}renderTileLayer(t){var r=this;return ve(function*(){r.renderTileLayerMask(t),t.getLayerConfig().enableMultiPassRenderer?yield t.renderMultiPass():yield t.render()})()}updateLayerRenderList(){this.layerList=[],this.layers.filter(t=>t.inited).filter(t=>t.isVisible()).sort((t,r)=>t.zIndex-r.zIndex).forEach(t=>{this.layerList.push(t)})}destroy(){this.layers.forEach(t=>{t.destroy()}),this.layers=[],this.layerList=[],this.emit("layerChange",this.layers)}startAnimate(){this.animateInstanceCount++===0&&(this.clock.start(),this.runRender())}stopAnimate(){--this.animateInstanceCount===0&&(this.stopRender(),this.clock.stop())}getOESTextureFloat(){return this.renderService.extensionObject.OES_texture_float}enableShaderPick(){this.shaderPicking=!0}disableShaderPick(){this.shaderPicking=!1}getShaderPickStat(){return this.shaderPicking}clear(){const t=Zt(this.mapService.bgColor);this.renderService.clear({color:t,depth:1,stencil:0,framebuffer:null})}runRender(){this.renderLayers(),this.layerRenderID=window.requestAnimationFrame(this.runRender.bind(this))}stopRender(){window.cancelAnimationFrame(this.layerRenderID)}}function o$(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}function ai(e,t){if(e==null)return{};var r,n,i=o$(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}const{isNil:a$}=Sr;class s${constructor(t){E(this,"name",void 0),E(this,"type",void 0),E(this,"scale",void 0),E(this,"descriptor",void 0),E(this,"featureBufferLayout",[]),E(this,"needRescale",!1),E(this,"needRemapping",!1),E(this,"needRegenerateVertices",!1),E(this,"featureRange",{startIndex:0,endIndex:1/0}),E(this,"vertexAttribute",void 0),E(this,"defaultCallback",r=>{if(r.length===0){var n;return((n=this.scale)===null||n===void 0?void 0:n.defaultValues)||[]}return r.map((i,o)=>{var a;return((a=this.scale)===null||a===void 0?void 0:a.scalers[o].func)(i)})}),this.setProps(t)}setProps(t){Object.assign(this,t)}mapping(t){var r;if((r=this.scale)!==null&&r!==void 0&&r.callback){var n;const i=(n=this.scale)===null||n===void 0?void 0:n.callback(...t);if(!a$(i))return[i]}return this.defaultCallback(t)}resetDescriptor(){this.descriptor&&(this.descriptor.buffer.data=[])}}const u$=["buffer","update","name"],l$=["buffer","update","name"],c$={[m.FLOAT]:4,[m.UNSIGNED_BYTE]:1,[m.UNSIGNED_SHORT]:2};class f${constructor(t){E(this,"attributesAndIndices",void 0),E(this,"attributes",[]),E(this,"triangulation",void 0),E(this,"featureLayout",{sizePerElement:0,elements:[]}),this.rendererService=t}registerStyleAttribute(t){let r=this.getLayerStyleAttribute(t.name||"");return r?r.setProps(t):(r=new s$(t),this.attributes.push(r)),r}unRegisterStyleAttribute(t){const r=this.attributes.findIndex(n=>n.name===t);r>-1&&this.attributes.splice(r,1)}updateScaleAttribute(t){this.attributes.forEach(r=>{var n;const i=r.name,o=(n=r.scale)===null||n===void 0?void 0:n.field;(t[i]||o&&t[o])&&(r.needRescale=!0,r.needRemapping=!0,r.needRegenerateVertices=!0)})}updateStyleAttribute(t,r,n){let i=this.getLayerStyleAttribute(t);i||(i=this.registerStyleAttribute(he(he({},r),{},{name:t})));const{scale:o}=r;o&&i&&(i.scale=o,i.needRescale=!0,i.needRemapping=!0,i.needRegenerateVertices=!0,n&&n.featureRange&&(i.featureRange=n.featureRange))}getLayerStyleAttributes(){return this.attributes}getLayerStyleAttribute(t){return this.attributes.find(r=>r.name===t)}getLayerAttributeScale(t){var r;const n=this.getLayerStyleAttribute(t),i=n==null||(r=n.scale)===null||r===void 0?void 0:r.scalers;return i&&i[0]?i[0].func:null}updateAttributeByFeatureRange(t,r,n=0,i,o){const a=this.attributes.find(s=>s.name===t);if(a&&a.descriptor){const{descriptor:s}=a,{update:u,buffer:l,size:f=0}=s,c=c$[l.type||m.FLOAT];if(u){const{elements:h,sizePerElement:d}=this.featureLayout,p=h.slice(n,i);if(!p.length)return;const{offset:v}=p[0],g=v*f*c,y=p.map(({featureIdx:S,vertices:R,normals:x},M)=>{const $=R.length/d,F=[];for(let Y=0;Y<$;Y++){const ge=x?x.slice(Y*3,Y*3+3):[];F.push(...u(r[S],S,R.slice(Y*d,Y*d+d),M,ge))}return F}).flat();a.vertexAttribute.updateBuffer({data:y,offset:g}),o==null||o.emit(`legend:${t}`,o.getLegend(t))}}}createAttributesAndIndices(t,r,n,i){this.featureLayout={sizePerElement:0,elements:[]},r&&(this.triangulation=r);const o=this.attributes.map(v=>(v.resetDescriptor(),v.descriptor));let a=0,s=0;const u=[];let l=3;t.forEach((v,g)=>{const{indices:y,vertices:S,normals:R,size:x,indexes:M,count:$}=this.triangulation(v,n);typeof $=="number"&&(s+=$),y.forEach(Y=>{u.push(Y+a)}),l=x;const F=S.length/x;this.featureLayout.sizePerElement=l,this.featureLayout.elements.push({featureIdx:g,vertices:S,normals:R,offset:a}),a+=F;for(let Y=0;Y<F;Y++){const ge=(R==null?void 0:R.slice(Y*3,Y*3+3))||[],q=S.slice(Y*x,Y*x+x);let k=0;M&&M[Y]!==void 0&&(k=M[Y]),o.forEach((G,K)=>{G&&G.update&&G.buffer.data.push(...G.update(v,g,q,Y,ge,k))})}});const{createAttribute:f,createBuffer:c,createElements:h}=this.rendererService,d={};o.forEach((v,g)=>{if(v){const{buffer:y,update:S,name:R}=v,x=ai(v,u$),M=f(he({buffer:c(y)},x));d[v.name||""]=M,this.attributes[g].vertexAttribute=M}});const p=h({data:u,type:m.UNSIGNED_INT,count:u.length});return this.attributesAndIndices={attributes:d,elements:p,count:s},Object.values(this.attributes).filter(v=>v.scale).forEach(v=>{const g=v.name;i==null||i.emit(`legend:${g}`,i.getLegend(g))}),this.attributesAndIndices}createAttributes(t,r){this.featureLayout={sizePerElement:0,elements:[]},r&&(this.triangulation=r);const n=this.attributes.map(l=>(l.resetDescriptor(),l.descriptor));let i=0,o=3;t.forEach((l,f)=>{const{indices:c,vertices:h,normals:d,size:p,indexes:v}=this.triangulation(l);c.forEach(y=>{}),o=p;const g=h.length/p;this.featureLayout.sizePerElement=o,this.featureLayout.elements.push({featureIdx:f,vertices:h,normals:d,offset:i}),i+=g;for(let y=0;y<g;y++){const S=(d==null?void 0:d.slice(y*3,y*3+3))||[],R=h.slice(y*p,y*p+p);let x=0;v&&v[y]!==void 0&&(x=v[y]),n.forEach((M,$)=>{M&&M.update&&M.buffer.data.push(...M.update(l,f,R,y,S,x))})}});const{createAttribute:a,createBuffer:s}=this.rendererService,u={};return n.forEach((l,f)=>{if(l){const{buffer:c,update:h,name:d}=l,p=ai(l,l$),v=a(he({buffer:s(c)},p));u[l.name||""]=v,this.attributes[f].vertexAttribute=v}}),{attributes:u}}clearAllAttributes(){var t;this.attributes.forEach(r=>{r.vertexAttribute&&r.vertexAttribute.destroy()}),(t=this.attributesAndIndices)===null||t===void 0||t.elements.destroy(),this.attributes=[]}}function _A(e,t,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(f){try{l(n.next(f))}catch(c){a(c)}}function u(f){try{l(n.throw(f))}catch(c){a(c)}}function l(f){f.done?o(f.value):i(f.value).then(s,u)}l((n=n.apply(e,[])).next())})}function vA(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(l[0]===6&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(f){l=[6,f],i=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function zp(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function Vp(e,t,r){if(arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function mA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Md={exports:{}},yc={exports:{}},_u={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;function r(n){return n&&typeof n.length=="number"&&n.length>=0&&n.length%1===0}e.exports=t.default})(_u,_u.exports);var _n={},Nd={exports:{}},Pd={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(r){return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];var o=n.pop();return r.call(this,n,o)}},e.exports=t.default})(Pd,Pd.exports);var Yi={};Object.defineProperty(Yi,"__esModule",{value:!0});Yi.fallback=gA;Yi.wrap=EA;var h$=Yi.hasQueueMicrotask=typeof queueMicrotask=="function"&&queueMicrotask,d$=Yi.hasSetImmediate=typeof setImmediate=="function"&&setImmediate,p$=Yi.hasNextTick=typeof process=="object"&&typeof process.nextTick=="function";function gA(e){setTimeout(e,0)}function EA(e){return function(t){for(var r=[],n=arguments.length-1;n-- >0;)r[n]=arguments[n+1];return e(function(){return t.apply(void 0,r)})}}var Ks;h$?Ks=queueMicrotask:d$?Ks=setImmediate:p$?Ks=process.nextTick:Ks=gA;Yi.default=EA(Ks);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var r=Pd.exports,n=s(r),i=Yi,o=s(i),a=_n;function s(c){return c&&c.__esModule?c:{default:c}}function u(c){return(0,a.isAsync)(c)?function(){for(var h=[],d=arguments.length;d--;)h[d]=arguments[d];var p=h.pop(),v=c.apply(this,h);return l(v,p)}:(0,n.default)(function(h,d){var p;try{p=c.apply(this,h)}catch(v){return d(v)}if(p&&typeof p.then=="function")return l(p,d);d(null,p)})}function l(c,h){return c.then(function(d){f(h,null,d)},function(d){f(h,d&&d.message?d:new Error(d))})}function f(c,h,d){try{c(h,d)}catch(p){(0,o.default)(function(v){throw v},p)}}e.exports=t.default})(Nd,Nd.exports);Object.defineProperty(_n,"__esModule",{value:!0});_n.isAsyncIterable=_n.isAsyncGenerator=_n.isAsync=void 0;var _$=Nd.exports,v$=m$(_$);function m$(e){return e&&e.__esModule?e:{default:e}}function yA(e){return e[Symbol.toStringTag]==="AsyncFunction"}function g$(e){return e[Symbol.toStringTag]==="AsyncGenerator"}function E$(e){return typeof e[Symbol.asyncIterator]=="function"}function y$(e){if(typeof e!="function")throw new Error("expected a function");return yA(e)?(0,v$.default)(e):e}_n.default=y$;_n.isAsync=yA;_n.isAsyncGenerator=g$;_n.isAsyncIterable=E$;var So={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;function r(n,i){if(i===void 0&&(i=n.length),!i)throw new Error("arity is undefined");function o(){for(var a=this,s=[],u=arguments.length;u--;)s[u]=arguments[u];return typeof s[i-1]=="function"?n.apply(this,s):new Promise(function(l,f){s[i-1]=function(c){for(var h=[],d=arguments.length-1;d-- >0;)h[d]=arguments[d+1];if(c)return f(c);l(h.length>1?h:h[0])},n.apply(a,s)})}return o}e.exports=t.default})(So,So.exports);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=_u.exports,n=u(r),i=_n,o=u(i),a=So.exports,s=u(a);function u(l){return l&&l.__esModule?l:{default:l}}t.default=(0,s.default)(function(l,f,c){var h=(0,n.default)(f)?[]:{};l(f,function(d,p,v){(0,o.default)(d)(function(g){for(var y,S=[],R=arguments.length-1;R-- >0;)S[R]=arguments[R+1];S.length<2&&(y=S,S=y[0]),h[p]=S,v(g)})},function(d){return c(d,h)})},3),e.exports=t.default})(yc,yc.exports);var Ld={exports:{}},Tc={exports:{}},wd={exports:{}},vu={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;function r(n){function i(){for(var o=[],a=arguments.length;a--;)o[a]=arguments[a];if(n!==null){var s=n;n=null,s.apply(this,o)}}return Object.assign(i,n),i}e.exports=t.default})(vu,vu.exports);var Fd={exports:{}},Bd={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(r){return r[Symbol.iterator]&&r[Symbol.iterator]()},e.exports=t.default})(Bd,Bd.exports);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var r=_u.exports,n=a(r),i=Bd.exports,o=a(i);function a(c){return c&&c.__esModule?c:{default:c}}function s(c){var h=-1,d=c.length;return function(){return++h<d?{value:c[h],key:h}:null}}function u(c){var h=-1;return function(){var p=c.next();return p.done?null:(h++,{value:p.value,key:h})}}function l(c){var h=c?Object.keys(c):[],d=-1,p=h.length;return function v(){var g=h[++d];return g==="__proto__"?v():d<p?{value:c[g],key:g}:null}}function f(c){if((0,n.default)(c))return s(c);var h=(0,o.default)(c);return h?u(h):l(c)}e.exports=t.default})(Fd,Fd.exports);var mu={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;function r(n){return function(){for(var i=[],o=arguments.length;o--;)i[o]=arguments[o];if(n===null)throw new Error("Callback was already called.");var a=n;n=null,a.apply(this,i)}}e.exports=t.default})(mu,mu.exports);var Dd={exports:{}},gu={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r={};t.default=r,e.exports=t.default})(gu,gu.exports);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var r=gu.exports,n=i(r);function i(a){return a&&a.__esModule?a:{default:a}}function o(a,s,u,l){var f=!1,c=!1,h=!1,d=0,p=0;function v(){d>=s||h||f||(h=!0,a.next().then(function(S){var R=S.value,x=S.done;if(!(c||f)){if(h=!1,x){f=!0,d<=0&&l(null);return}d++,u(R,p,g),p++,v()}}).catch(y))}function g(S,R){if(d-=1,!c){if(S)return y(S);if(S===!1){f=!0,c=!0;return}if(R===n.default||f&&d<=0)return f=!0,l(null);v()}}function y(S){c||(h=!1,f=!0,l(S))}v()}e.exports=t.default})(Dd,Dd.exports);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=vu.exports,n=d(r),i=Fd.exports,o=d(i),a=mu.exports,s=d(a),u=_n,l=Dd.exports,f=d(l),c=gu.exports,h=d(c);function d(p){return p&&p.__esModule?p:{default:p}}t.default=function(p){return function(v,g,y){if(y=(0,n.default)(y),p<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!v)return y(null);if((0,u.isAsyncGenerator)(v))return(0,f.default)(v,p,g,y);if((0,u.isAsyncIterable)(v))return(0,f.default)(v[Symbol.asyncIterator](),p,g,y);var S=(0,o.default)(v),R=!1,x=!1,M=0,$=!1;function F(ge,q){if(!x)if(M-=1,ge)R=!0,y(ge);else if(ge===!1)R=!0,x=!0;else{if(q===h.default||R&&M<=0)return R=!0,y(null);$||Y()}}function Y(){for($=!0;M<p&&!R;){var ge=S();if(ge===null){R=!0,M<=0&&y(null);return}M+=1,g(ge.value,ge.key,(0,s.default)(F))}$=!1}Y()}},e.exports=t.default})(wd,wd.exports);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=wd.exports,n=u(r),i=_n,o=u(i),a=So.exports,s=u(a);function u(f){return f&&f.__esModule?f:{default:f}}function l(f,c,h,d){return(0,n.default)(c)(f,(0,o.default)(h),d)}t.default=(0,s.default)(l,4),e.exports=t.default})(Tc,Tc.exports);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=Tc.exports,n=a(r),i=So.exports,o=a(i);function a(u){return u&&u.__esModule?u:{default:u}}function s(u,l,f){return(0,n.default)(u,1,l,f)}t.default=(0,o.default)(s,3),e.exports=t.default})(Ld,Ld.exports);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var r=yc.exports,n=a(r),i=Ld.exports,o=a(i);function a(u){return u&&u.__esModule?u:{default:u}}function s(u,l){return(0,n.default)(o.default,u,l)}e.exports=t.default})(Md,Md.exports);var lf=mA(Md.exports),ni=function(){function e(){this.args=[],this.tasks=[]}return e.prototype.call=function(){for(var t=arguments,r=[],n=0;n<arguments.length;n++)r[n]=t[n];return this.args=r,lf(this.tasks)},e.prototype.tap=function(t,r){var n=this;this.tasks.push(function(i){r.apply(void 0,Vp([],zp(n.args),!1)),i(null,t)})},e}(),_g={exports:{}},Ud={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=_u.exports,n=g(r),i=gu.exports,o=g(i),a=Tc.exports,s=g(a),u=vu.exports,l=g(u),f=mu.exports,c=g(f),h=_n,d=g(h),p=So.exports,v=g(p);function g(x){return x&&x.__esModule?x:{default:x}}function y(x,M,$){$=(0,l.default)($);var F=0,Y=0,ge=x.length,q=!1;ge===0&&$(null);function k(G,K){G===!1&&(q=!0),q!==!0&&(G?$(G):(++Y===ge||K===o.default)&&$(null))}for(;F<ge;F++)M(x[F],F,(0,c.default)(k))}function S(x,M,$){return(0,s.default)(x,1/0,M,$)}function R(x,M,$){var F=(0,n.default)(x)?y:S;return F(x,(0,d.default)(M),$)}t.default=(0,v.default)(R,3),e.exports=t.default})(Ud,Ud.exports);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;var r=Ud.exports,n=a(r),i=yc.exports,o=a(i);function a(u){return u&&u.__esModule?u:{default:u}}function s(u,l){return(0,o.default)(n.default,u,l)}e.exports=t.default})(_g,_g.exports);var kd={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=vu.exports,n=f(r),i=mu.exports,o=f(i),a=_n,s=f(a),u=So.exports,l=f(u);function f(h){return h&&h.__esModule?h:{default:h}}function c(h,d){if(d=(0,n.default)(d),!Array.isArray(h))return d(new Error("First argument to waterfall must be an array of functions"));if(!h.length)return d();var p=0;function v(y){var S=(0,s.default)(h[p++]);S.apply(void 0,y.concat([(0,o.default)(g)]))}function g(y){for(var S=[],R=arguments.length-1;R-- >0;)S[R]=arguments[R+1];if(y!==!1){if(y||p===h.length)return d.apply(void 0,[y].concat(S));v(S)}}v([])}t.default=(0,l.default)(c),e.exports=t.default})(kd,kd.exports);var T$=mA(kd.exports),vg=function(){function e(){this.tasks=[]}return e.prototype.call=function(){return lf(this.tasks)},e.prototype.tap=function(t,r){this.tasks.push(function(n){var i=r();n(i,t)})},e}(),A$=function(){function e(){this.args=[],this.tasks=[]}return e.prototype.promise=function(){for(var t=arguments,r=[],n=0;n<arguments.length;n++)r[n]=t[n];return this.args=r,lf(this.tasks)},e.prototype.tapPromise=function(t,r){var n=this;this.tasks.push(function(i){return _A(n,void 0,void 0,function(){return vA(this,function(o){switch(o.label){case 0:return[4,r.apply(void 0,Vp([],zp(this.args),!1))];case 1:return o.sent(),i(null,t),[2]}})})})},e}(),S$=function(){function e(){this.args=[],this.tasks=[]}return e.prototype.promise=function(){for(var t=arguments,r=[],n=0;n<arguments.length;n++)r[n]=t[n];return this.args=r,lf(this.tasks)},e.prototype.tapPromise=function(t,r){var n=this;this.tasks.push(function(i){return _A(n,void 0,void 0,function(){var o;return vA(this,function(a){switch(a.label){case 0:return[4,r.apply(void 0,Vp([],zp(this.args),!1))];case 1:return o=a.sent(),i(o,t),[2]}})})})},e}(),x$=function(){function e(){this.tasks=[]}return e.prototype.promise=function(){return T$(this.tasks)},e.prototype.tapPromise=function(t,r){this.tasks.length===0?this.tasks.push(function(n){r().then(function(i){n(null,i)})}):this.tasks.push(function(n,i){r(n).then(function(o){i(null,o)})})},e}(),TA={exports:{}},b$=TA.exports={};b$.forEach=function(e,t){for(var r=0;r<e.length;r++){var n=t(e[r]);if(n)return n}};var AA=TA.exports,R$=function(e){var t=e.stateHandler.getState;function r(a){var s=t(a);return s&&!!s.isDetectable}function n(a){t(a).isDetectable=!0}function i(a){return!!t(a).busy}function o(a,s){t(a).busy=!!s}return{isDetectable:r,markAsDetectable:n,isBusy:i,markBusy:o}},C$=function(e){var t={};function r(a){var s=e.get(a);return s===void 0?[]:t[s]||[]}function n(a,s){var u=e.get(a);t[u]||(t[u]=[]),t[u].push(s)}function i(a,s){for(var u=r(a),l=0,f=u.length;l<f;++l)if(u[l]===s){u.splice(l,1);break}}function o(a){var s=r(a);s&&(s.length=0)}return{get:r,add:n,removeListener:i,removeAllListeners:o}},O$=function(){var e=1;function t(){return e++}return{generate:t}},I$=function(e){var t=e.idGenerator,r=e.stateHandler.getState;function n(o){var a=r(o);return a&&a.id!==void 0?a.id:null}function i(o){var a=r(o);if(!a)throw new Error("setId required the element to have a resize detection state.");var s=t.generate();return a.id=s,s}return{get:n,set:i}},M$=function(e){function t(){}var r={log:t,warn:t,error:t};if(!e&&window.console){var n=function(i,o){i[o]=function(){var s=console[o];if(s.apply)s.apply(console,arguments);else for(var u=0;u<arguments.length;u++)s(arguments[u])}};n(r,"log"),n(r,"warn"),n(r,"error")}return r},SA={exports:{}},xA=SA.exports={};xA.isIE=function(e){function t(){var n=navigator.userAgent.toLowerCase();return n.indexOf("msie")!==-1||n.indexOf("trident")!==-1||n.indexOf(" edge/")!==-1}if(!t())return!1;if(!e)return!0;var r=function(){var n,i=3,o=document.createElement("div"),a=o.getElementsByTagName("i");do o.innerHTML="<!--[if gt IE "+ ++i+"]><i></i><![endif]-->";while(a[0]);return i>4?i:n}();return e===r};xA.isLegacyOpera=function(){return!!window.opera};var bA=SA.exports,RA={exports:{}},N$=RA.exports={};N$.getOption=P$;function P$(e,t,r){var n=e[t];return n==null&&r!==void 0?r:n}var L$=RA.exports,mg=L$,w$=function(t){t=t||{};var r=t.reporter,n=mg.getOption(t,"async",!0),i=mg.getOption(t,"auto",!0);i&&!n&&(r&&r.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),n=!0);var o=gg(),a,s=!1;function u(p,v){!s&&i&&n&&o.size()===0&&c(),o.add(p,v)}function l(){for(s=!0;o.size();){var p=o;o=gg(),p.process()}s=!1}function f(p){s||(p===void 0&&(p=n),a&&(h(a),a=null),p?c():l())}function c(){a=d(l)}function h(p){var v=clearTimeout;return v(p)}function d(p){var v=function(g){return setTimeout(g,0)};return v(p)}return{add:u,force:f}};function gg(){var e={},t=0,r=0,n=0;function i(s,u){u||(u=s,s=0),s>r?r=s:s<n&&(n=s),e[s]||(e[s]=[]),e[s].push(u),t++}function o(){for(var s=n;s<=r;s++)for(var u=e[s],l=0;l<u.length;l++){var f=u[l];f()}}function a(){return t}return{add:i,process:o,size:a}}var Hp="_erd";function F$(e){return e[Hp]={},CA(e)}function CA(e){return e[Hp]}function B$(e){delete e[Hp]}var D$={initState:F$,getState:CA,cleanState:B$},Is=bA,U$=function(e){e=e||{};var t=e.reporter,r=e.batchProcessor,n=e.stateHandler.getState;if(!t)throw new Error("Missing required dependency: reporter.");function i(l,f){function c(){f(l)}if(Is.isIE(8))n(l).object={proxy:c},l.attachEvent("onresize",c);else{var h=s(l);if(!h)throw new Error("Element is not detectable by this strategy.");h.contentDocument.defaultView.addEventListener("resize",c)}}function o(l){var f=e.important?" !important; ":"; ";return(l.join(f)+f).trim()}function a(l,f,c){c||(c=f,f=l,l=null),l=l||{},l.debug;function h(d,p){var v=o(["display: block","position: absolute","top: 0","left: 0","width: 100%","height: 100%","border: none","padding: 0","margin: 0","opacity: 0","z-index: -1000","pointer-events: none"]),g=!1,y=window.getComputedStyle(d),S=d.offsetWidth,R=d.offsetHeight;n(d).startSize={width:S,height:R};function x(){function M(){if(y.position==="static"){d.style.setProperty("position","relative",l.important?"important":"");var Y=function(ge,q,k,G){function K(Pe){return Pe.replace(/[^-\d\.]/g,"")}var ce=k[G];ce!=="auto"&&K(ce)!=="0"&&(ge.warn("An element that is positioned static has style."+G+"="+ce+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+G+" will be set to 0. Element: ",q),q.style.setProperty(G,"0",l.important?"important":""))};Y(t,d,y,"top"),Y(t,d,y,"right"),Y(t,d,y,"bottom"),Y(t,d,y,"left")}}function $(){g||M();function Y(q,k){if(!q.contentDocument){var G=n(q);G.checkForObjectDocumentTimeoutId&&window.clearTimeout(G.checkForObjectDocumentTimeoutId),G.checkForObjectDocumentTimeoutId=setTimeout(function(){G.checkForObjectDocumentTimeoutId=0,Y(q,k)},100);return}k(q.contentDocument)}var ge=this;Y(ge,function(k){p(d)})}y.position!==""&&(M(),g=!0);var F=document.createElement("object");F.style.cssText=v,F.tabIndex=-1,F.type="text/html",F.setAttribute("aria-hidden","true"),F.onload=$,Is.isIE()||(F.data="about:blank"),n(d)&&(d.appendChild(F),n(d).object=F,Is.isIE()&&(F.data="about:blank"))}r?r.add(x):x()}Is.isIE(8)?c(f):h(f,c)}function s(l){return n(l).object}function u(l){if(n(l)){var f=s(l);f&&(Is.isIE(8)?l.detachEvent("onresize",f.proxy):l.removeChild(f),n(l).checkForObjectDocumentTimeoutId&&window.clearTimeout(n(l).checkForObjectDocumentTimeoutId),delete n(l).object)}}return{makeDetectable:a,addListener:i,uninstall:u}},k$=AA.forEach,$$=function(e){e=e||{};var t=e.reporter,r=e.batchProcessor,n=e.stateHandler.getState;e.stateHandler.hasState;var i=e.idHandler;if(!r)throw new Error("Missing required dependency: batchProcessor");if(!t)throw new Error("Missing required dependency: reporter.");var o=f(),a="erd_scroll_detection_scrollbar_style",s="erd_scroll_detection_container";function u(x){c(x,a,s)}u(window.document);function l(x){var M=e.important?" !important; ":"; ";return(x.join(M)+M).trim()}function f(){var x=500,M=500,$=document.createElement("div");$.style.cssText=l(["position: absolute","width: "+x*2+"px","height: "+M*2+"px","visibility: hidden","margin: 0","padding: 0"]);var F=document.createElement("div");F.style.cssText=l(["position: absolute","width: "+x+"px","height: "+M+"px","overflow: scroll","visibility: none","top: "+-x*3+"px","left: "+-M*3+"px","visibility: hidden","margin: 0","padding: 0"]),F.appendChild($),document.body.insertBefore(F,document.body.firstChild);var Y=x-F.clientWidth,ge=M-F.clientHeight;return document.body.removeChild(F),{width:Y,height:ge}}function c(x,M,$){function F(k,G){G=G||function(ce){x.head.appendChild(ce)};var K=x.createElement("style");return K.innerHTML=k,K.id=M,G(K),K}if(!x.getElementById(M)){var Y=$+"_animation",ge=$+"_animation_active",q=`/* Created by the element-resize-detector library. */
`;q+="."+$+" > div::-webkit-scrollbar { "+l(["display: none"])+` }
`,q+="."+ge+" { "+l(["-webkit-animation-duration: 0.1s","animation-duration: 0.1s","-webkit-animation-name: "+Y,"animation-name: "+Y])+` }
`,q+="@-webkit-keyframes "+Y+` { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }
`,q+="@keyframes "+Y+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }",F(q)}}function h(x){x.className+=" "+s+"_animation_active"}function d(x,M,$){if(x.addEventListener)x.addEventListener(M,$);else if(x.attachEvent)x.attachEvent("on"+M,$);else return t.error("[scroll] Don't know how to add event listeners.")}function p(x,M,$){if(x.removeEventListener)x.removeEventListener(M,$);else if(x.detachEvent)x.detachEvent("on"+M,$);else return t.error("[scroll] Don't know how to remove event listeners.")}function v(x){return n(x).container.childNodes[0].childNodes[0].childNodes[0]}function g(x){return n(x).container.childNodes[0].childNodes[0].childNodes[1]}function y(x,M){var $=n(x).listeners;if(!$.push)throw new Error("Cannot add listener to an element that is not detectable.");n(x).listeners.push(M)}function S(x,M,$){$||($=M,M=x,x=null),x=x||{};function F(){if(x.debug){var le=Array.prototype.slice.call(arguments);if(le.unshift(i.get(M),"Scroll: "),t.log.apply)t.log.apply(null,le);else for(var ze=0;ze<le.length;ze++)t.log(le[ze])}}function Y(le){function ze(nt){var Ae=nt.getRootNode&&nt.getRootNode().contains(nt);return nt===nt.ownerDocument.body||nt.ownerDocument.body.contains(nt)||Ae}return!ze(le)||window.getComputedStyle(le)===null}function ge(le){var ze=n(le).container.childNodes[0],nt=window.getComputedStyle(ze);return!nt.width||nt.width.indexOf("px")===-1}function q(){var le=window.getComputedStyle(M),ze={};return ze.position=le.position,ze.width=M.offsetWidth,ze.height=M.offsetHeight,ze.top=le.top,ze.right=le.right,ze.bottom=le.bottom,ze.left=le.left,ze.widthCSS=le.width,ze.heightCSS=le.height,ze}function k(){var le=q();n(M).startSize={width:le.width,height:le.height},F("Element start size",n(M).startSize)}function G(){n(M).listeners=[]}function K(){if(F("storeStyle invoked."),!n(M)){F("Aborting because element has been uninstalled");return}var le=q();n(M).style=le}function ce(le,ze,nt){n(le).lastWidth=ze,n(le).lastHeight=nt}function Pe(le){return v(le).childNodes[0]}function Xe(){return 2*o.width+1}function Je(){return 2*o.height+1}function ft(le){return le+10+Xe()}function Ge(le){return le+10+Je()}function et(le){return le*2+Xe()}function vt(le){return le*2+Je()}function mt(le,ze,nt){var Ae=v(le),Dt=g(le),Et=ft(ze),zt=Ge(nt),Rt=et(ze),ut=vt(nt);Ae.scrollLeft=Et,Ae.scrollTop=zt,Dt.scrollLeft=Rt,Dt.scrollTop=ut}function It(){var le=n(M).container;if(!le){le=document.createElement("div"),le.className=s,le.style.cssText=l(["visibility: hidden","display: inline","width: 0px","height: 0px","z-index: -1","overflow: hidden","margin: 0","padding: 0"]),n(M).container=le,h(le),M.appendChild(le);var ze=function(){n(M).onRendered&&n(M).onRendered()};d(le,"animationstart",ze),n(M).onAnimationStart=ze}return le}function wt(){function le(){var Kt=n(M).style;if(Kt.position==="static"){M.style.setProperty("position","relative",x.important?"important":"");var Kr=function($n,on,qi,Br){function Ki(Qa){return Qa.replace(/[^-\d\.]/g,"")}var bi=qi[Br];bi!=="auto"&&Ki(bi)!=="0"&&($n.warn("An element that is positioned static has style."+Br+"="+bi+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+Br+" will be set to 0. Element: ",on),on.style[Br]=0)};Kr(t,M,Kt,"top"),Kr(t,M,Kt,"right"),Kr(t,M,Kt,"bottom"),Kr(t,M,Kt,"left")}}function ze(Kt,Kr,$n,on){return Kt=Kt?Kt+"px":"0",Kr=Kr?Kr+"px":"0",$n=$n?$n+"px":"0",on=on?on+"px":"0",["left: "+Kt,"top: "+Kr,"right: "+on,"bottom: "+$n]}if(F("Injecting elements"),!n(M)){F("Aborting because element has been uninstalled");return}le();var nt=n(M).container;nt||(nt=It());var Ae=o.width,Dt=o.height,Et=l(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden","width: 100%","height: 100%","left: 0px","top: 0px"]),zt=l(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden"].concat(ze(-(1+Ae),-(1+Dt),-Dt,-Ae))),Rt=l(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),ut=l(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),Ut=l(["position: absolute","left: 0","top: 0"]),$r=l(["position: absolute","width: 200%","height: 200%"]),dr=document.createElement("div"),Jt=document.createElement("div"),nn=document.createElement("div"),N=document.createElement("div"),Si=document.createElement("div"),wo=document.createElement("div");dr.dir="ltr",dr.style.cssText=Et,dr.className=s,Jt.className=s,Jt.style.cssText=zt,nn.style.cssText=Rt,N.style.cssText=Ut,Si.style.cssText=ut,wo.style.cssText=$r,nn.appendChild(N),Si.appendChild(wo),Jt.appendChild(nn),Jt.appendChild(Si),dr.appendChild(Jt),nt.appendChild(dr);function ui(){var Kt=n(M);Kt&&Kt.onExpand?Kt.onExpand():F("Aborting expand scroll handler: element has been uninstalled")}function xi(){var Kt=n(M);Kt&&Kt.onShrink?Kt.onShrink():F("Aborting shrink scroll handler: element has been uninstalled")}d(nn,"scroll",ui),d(Si,"scroll",xi),n(M).onExpandScroll=ui,n(M).onShrinkScroll=xi}function gt(){function le(Rt,ut,Ut){var $r=Pe(Rt),dr=ft(ut),Jt=Ge(Ut);$r.style.setProperty("width",dr+"px",x.important?"important":""),$r.style.setProperty("height",Jt+"px",x.important?"important":"")}function ze(Rt){var ut=M.offsetWidth,Ut=M.offsetHeight,$r=ut!==n(M).lastWidth||Ut!==n(M).lastHeight;F("Storing current size",ut,Ut),ce(M,ut,Ut),r.add(0,function(){if($r){if(!n(M)){F("Aborting because element has been uninstalled");return}if(!nt()){F("Aborting because element container has not been initialized");return}if(x.debug){var Jt=M.offsetWidth,nn=M.offsetHeight;(Jt!==ut||nn!==Ut)&&t.warn(i.get(M),"Scroll: Size changed before updating detector elements.")}le(M,ut,Ut)}}),r.add(1,function(){if(!n(M)){F("Aborting because element has been uninstalled");return}if(!nt()){F("Aborting because element container has not been initialized");return}mt(M,ut,Ut)}),$r&&Rt&&r.add(2,function(){if(!n(M)){F("Aborting because element has been uninstalled");return}if(!nt()){F("Aborting because element container has not been initialized");return}Rt()})}function nt(){return!!n(M).container}function Ae(){function Rt(){return n(M).lastNotifiedWidth===void 0}F("notifyListenersIfNeeded invoked");var ut=n(M);if(Rt()&&ut.lastWidth===ut.startSize.width&&ut.lastHeight===ut.startSize.height)return F("Not notifying: Size is the same as the start size, and there has been no notification yet.");if(ut.lastWidth===ut.lastNotifiedWidth&&ut.lastHeight===ut.lastNotifiedHeight)return F("Not notifying: Size already notified");F("Current size not notified, notifying..."),ut.lastNotifiedWidth=ut.lastWidth,ut.lastNotifiedHeight=ut.lastHeight,k$(n(M).listeners,function(Ut){Ut(M)})}function Dt(){if(F("startanimation triggered."),ge(M)){F("Ignoring since element is still unrendered...");return}F("Element rendered.");var Rt=v(M),ut=g(M);(Rt.scrollLeft===0||Rt.scrollTop===0||ut.scrollLeft===0||ut.scrollTop===0)&&(F("Scrollbars out of sync. Updating detector elements..."),ze(Ae))}function Et(){if(F("Scroll detected."),ge(M)){F("Scroll event fired while unrendered. Ignoring...");return}ze(Ae)}if(F("registerListenersAndPositionElements invoked."),!n(M)){F("Aborting because element has been uninstalled");return}n(M).onRendered=Dt,n(M).onExpand=Et,n(M).onShrink=Et;var zt=n(M).style;le(M,zt.width,zt.height)}function xr(){if(F("finalizeDomMutation invoked."),!n(M)){F("Aborting because element has been uninstalled");return}var le=n(M).style;ce(M,le.width,le.height),mt(M,le.width,le.height)}function Gt(){$(M)}function Xr(){F("Installing..."),G(),k(),r.add(0,K),r.add(1,wt),r.add(2,gt),r.add(3,xr),r.add(4,Gt)}F("Making detectable..."),Y(M)?(F("Element is detached"),It(),F("Waiting until element is attached..."),n(M).onRendered=function(){F("Element is now attached"),Xr()}):Xr()}function R(x){var M=n(x);M&&(M.onExpandScroll&&p(v(x),"scroll",M.onExpandScroll),M.onShrinkScroll&&p(g(x),"scroll",M.onShrinkScroll),M.onAnimationStart&&p(M.container,"animationstart",M.onAnimationStart),M.container&&x.removeChild(M.container))}return{makeDetectable:S,addListener:y,uninstall:R,initDocument:u}},Qs=AA.forEach,z$=R$,V$=C$,H$=O$,j$=I$,X$=M$,Eg=bA,W$=w$,Li=D$,G$=U$,Y$=$$;function yg(e){return Array.isArray(e)||e.length!==void 0}function Tg(e){if(Array.isArray(e))return e;var t=[];return Qs(e,function(r){t.push(r)}),t}function Ag(e){return e&&e.nodeType===1}var Z$=function(e){e=e||{};var t;if(e.idHandler)t={get:function(S){return e.idHandler.get(S,!0)},set:e.idHandler.set};else{var r=H$(),n=j$({idGenerator:r,stateHandler:Li});t=n}var i=e.reporter;if(!i){var o=i===!1;i=X$(o)}var a=wi(e,"batchProcessor",W$({reporter:i})),s={};s.callOnAdd=!!wi(e,"callOnAdd",!0),s.debug=!!wi(e,"debug",!1);var u=V$(t),l=z$({stateHandler:Li}),f,c=wi(e,"strategy","object"),h=wi(e,"important",!1),d={reporter:i,batchProcessor:a,stateHandler:Li,idHandler:t,important:h};if(c==="scroll"&&(Eg.isLegacyOpera()?(i.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy."),c="object"):Eg.isIE(9)&&(i.warn("Scroll strategy is not supported on IE9. Changing to object strategy."),c="object")),c==="scroll")f=Y$(d);else if(c==="object")f=G$(d);else throw new Error("Invalid strategy name: "+c);var p={};function v(S,R,x){function M(k){var G=u.get(k);Qs(G,function(ce){ce(k)})}function $(k,G,K){u.add(G,K),k&&K(G)}if(x||(x=R,R=S,S={}),!R)throw new Error("At least one element required.");if(!x)throw new Error("Listener required.");if(Ag(R))R=[R];else if(yg(R))R=Tg(R);else return i.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");var F=0,Y=wi(S,"callOnAdd",s.callOnAdd),ge=wi(S,"onReady",function(){}),q=wi(S,"debug",s.debug);Qs(R,function(G){Li.getState(G)||(Li.initState(G),t.set(G));var K=t.get(G);if(q&&i.log("Attaching listener to element",K,G),!l.isDetectable(G)){if(q&&i.log(K,"Not detectable."),l.isBusy(G)){q&&i.log(K,"System busy making it detectable"),$(Y,G,x),p[K]=p[K]||[],p[K].push(function(){F++,F===R.length&&ge()});return}return q&&i.log(K,"Making detectable..."),l.markBusy(G,!0),f.makeDetectable({debug:q,important:h},G,function(Pe){if(q&&i.log(K,"onElementDetectable"),Li.getState(Pe)){l.markAsDetectable(Pe),l.markBusy(Pe,!1),f.addListener(Pe,M),$(Y,Pe,x);var Xe=Li.getState(Pe);if(Xe&&Xe.startSize){var Je=Pe.offsetWidth,ft=Pe.offsetHeight;(Xe.startSize.width!==Je||Xe.startSize.height!==ft)&&M(Pe)}p[K]&&Qs(p[K],function(Ge){Ge()})}else q&&i.log(K,"Element uninstalled before being detectable.");delete p[K],F++,F===R.length&&ge()})}q&&i.log(K,"Already detecable, adding listener."),$(Y,G,x),F++}),F===R.length&&ge()}function g(S){if(!S)return i.error("At least one element is required.");if(Ag(S))S=[S];else if(yg(S))S=Tg(S);else return i.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");Qs(S,function(R){u.removeAllListeners(R),f.uninstall(R),Li.cleanState(R)})}function y(S){f.initDocument&&f.initDocument(S)}return{listenTo:v,removeListener:u.removeListener,removeAllListeners:u.removeAllListeners,uninstall:g,initDocument:y}};function wi(e,t,r){var n=e[t];return n==null&&r!==void 0?r:n}const q$=Ht(Z$);let K$=class extends Bn.EventEmitter{get iconService(){return this.container.iconService}get fontService(){return this.container.fontService}get controlService(){return this.container.controlService}get configService(){return this.container.globalConfigService}get map(){return this.container.mapService}get coordinateSystemService(){return this.container.coordinateSystemService}get rendererService(){return this.container.rendererService}get layerService(){return this.container.layerService}get debugService(){return this.container.debugService}get cameraService(){return this.container.cameraService}get interactionService(){return this.container.interactionService}get pickingService(){return this.container.pickingService}get shaderModuleService(){return this.container.shaderModuleService}get markerService(){return this.container.markerService}get popupService(){return this.container.popupService}constructor(t){super(),E(this,"destroyed",!1),E(this,"loaded",!1),E(this,"id",void 0),E(this,"inited",!1),E(this,"rendering",!1),E(this,"$container",void 0),E(this,"canvas",void 0),E(this,"markerContainer",void 0),E(this,"resizeDetector",void 0),E(this,"hooks",void 0),E(this,"handleWindowResized",()=>{this.emit("resize"),this.$container&&(this.initContainer(),this.coordinateSystemService.needRefresh=!0,this.render())}),E(this,"handleMapCameraChanged",r=>{this.cameraService.update(r),this.render()}),this.container=t,this.hooks={init:new A$},this.id=t.id}init(t){var r=this;this.configService.setSceneConfig(this.id,t),this.shaderModuleService.registerBuiltinModules(),this.iconService.init(),this.iconService.on("imageUpdate",()=>this.render()),this.fontService.init(),this.hooks.init.tapPromise("initMap",ve(function*(){r.debugService.log("map.mapInitStart",{type:r.map.version}),yield new Promise(n=>{r.map.onCameraChanged(i=>{r.cameraService.init(),r.cameraService.update(i),n()}),r.map.init()}),r.map.onCameraChanged(r.handleMapCameraChanged),r.map.addMarkerContainer(),r.markerService.addMarkers(),r.markerService.addMarkerLayers(),r.popupService.initPopup(),r.interactionService.init(),r.interactionService.on(cn.Drag,r.addSceneEvent.bind(r))})),this.hooks.init.tapPromise("initRenderer",ve(function*(){var n;const i=((n=r.map)===null||n===void 0?void 0:n.getOverlayContainer())||void 0;if(i?r.$container=i:r.$container=e$(r.configService.getSceneConfig(r.id).id||""),r.$container){const{canvas:a}=t;if(r.canvas=a||yn("canvas","",r.$container),r.setCanvas(),yield r.rendererService.init(r.canvas,r.configService.getSceneConfig(r.id),t.gl),r.registerContextLost(),r.initContainer(),r.resizeDetector=q$({strategy:"scroll"}),r.resizeDetector.listenTo(r.$container,r.handleWindowResized),window.matchMedia){var o;(o=window.matchMedia("screen and (-webkit-min-device-pixel-ratio: 1.5)"))===null||o===void 0||o.addListener(r.handleWindowResized.bind("screen"))}}else console.error("容器 id 不存在");r.pickingService.init(r.id)})),this.render()}registerContextLost(){const t=this.rendererService.getCanvas();t&&t.addEventListener("webglcontextlost",()=>this.emit("webglcontextlost"))}addLayer(t){this.layerService.sceneService=this,this.layerService.add(t)}addMask(t){this.layerService.sceneService=this,this.layerService.addMask(t)}render(){var t=this;return ve(function*(){t.rendering||t.destroyed||(t.rendering=!0,t.inited?(yield t.layerService.initLayers(),yield t.layerService.renderLayers()):(yield t.hooks.init.promise(),t.destroyed&&t.destroy(),yield t.layerService.initLayers(),t.layerService.renderLayers(),t.controlService.addControls(),t.loaded=!0,t.emit("loaded"),t.inited=!0),t.rendering=!1)})()}addFontFace(t,r){this.fontService.addFontFace(t,r)}getSceneContainer(){return this.$container}exportPng(t){var r=this;return ve(function*(){var n;const i=(n=r.$container)===null||n===void 0?void 0:n.getElementsByTagName("canvas")[0];return yield r.render(),t==="jpg"?i==null?void 0:i.toDataURL("image/jpeg"):i==null?void 0:i.toDataURL("image/png")})()}getSceneConfig(){return this.configService.getSceneConfig(this.id)}getPointSizeRange(){return this.rendererService.getPointSizeRange()}addMarkerContainer(){const t=this.$container.parentElement;t!==null&&(this.markerContainer=yn("div","l7-marker-container",t))}getMarkerContainer(){return this.markerContainer}destroy(){var t;if(!this.inited){this.destroyed=!0;return}this.resizeDetector.removeListener(this.$container,this.handleWindowResized),this.pickingService.destroy(),this.layerService.destroy(),this.interactionService.destroy(),this.controlService.destroy(),this.markerService.destroy(),this.fontService.destroy(),this.iconService.destroy(),this.removeAllListeners(),this.inited=!1,this.map.destroy(),setTimeout(()=>{var r;(r=this.$container)===null||r===void 0||r.removeChild(this.canvas),this.canvas=null,this.rendererService.destroy()}),(t=this.$container)===null||t===void 0||(t=t.parentNode)===null||t===void 0||t.removeChild(this.$container),this.emit("destroy")}initContainer(){var t,r;const n=ln,i=((t=this.$container)===null||t===void 0?void 0:t.clientWidth)||400,o=((r=this.$container)===null||r===void 0?void 0:r.clientHeight)||300,a=this.canvas;a&&(a.width=i*n,a.height=o*n),this.rendererService.viewport({x:0,y:0,width:n*i,height:n*o})}setCanvas(){var t,r;const n=ln,i=((t=this.$container)===null||t===void 0?void 0:t.clientWidth)||400,o=((r=this.$container)===null||r===void 0?void 0:r.clientHeight)||300,a=this.canvas;a.width=i*n,a.height=o*n,a.style.width="100%",a.style.height="100%"}addSceneEvent(t){this.emit(t.type,t)}};const{uniq:Q$}=Sr,Sg="#define PI 3.14159265359",J$=`#define ambientRatio 0.5
#define diffuseRatio 0.3
#define specularRatio 0.2
float calc_lighting(vec4 pos) {
vec3 worldPos = vec3(pos * u_ModelMatrix);
vec3 worldNormal = a_Normal;
// //cal light weight
vec3 viewDir = normalize(u_CameraPosition - worldPos);
vec3 lightDir = normalize(vec3(1, -10.5, 12));
vec3 halfDir = normalize(viewDir+lightDir);
// //lambert
float lambert = dot(worldNormal, lightDir);
//specular
float specular = pow(max(0.0, dot(worldNormal, halfDir)), 32.0);
//sum to light weight
float lightWeight = ambientRatio + diffuseRatio * lambert + specularRatio * specular;
return lightWeight;
}
`,ez=`#define SHIFT_RIGHT17 1.0 / 131072.0
#define SHIFT_RIGHT18 1.0 / 262144.0
#define SHIFT_RIGHT19 1.0 / 524288.0
#define SHIFT_RIGHT20 1.0 / 1048576.0
#define SHIFT_RIGHT21 1.0 / 2097152.0
#define SHIFT_RIGHT22 1.0 / 4194304.0
#define SHIFT_RIGHT23 1.0 / 8388608.0
#define SHIFT_RIGHT24 1.0 / 16777216.0
#define SHIFT_LEFT17 131072.0
#define SHIFT_LEFT18 262144.0
#define SHIFT_LEFT19 524288.0
#define SHIFT_LEFT20 1048576.0
#define SHIFT_LEFT21 2097152.0
#define SHIFT_LEFT22 4194304.0
#define SHIFT_LEFT23 8388608.0
#define SHIFT_LEFT24 16777216.0
vec2 unpack_float(float packedValue) {
int packedIntValue = int(packedValue);
int v0 = packedIntValue / 256;
return vec2(v0, packedIntValue - v0 * 256);
}
vec4 decode_color(vec2 encodedColor) {
return vec4(
unpack_float(encodedColor[0]) / 255.0,
unpack_float(encodedColor[1]) / 255.0
);
}
`,tz=`// Blinn-Phong model
// apply lighting in vertex shader instead of fragment shader
// @see https://learnopengl.com/Advanced-Lighting/Advanced-Lighting
uniform float u_Ambient : 1.0;
uniform float u_Diffuse : 1.0;
uniform float u_Specular : 1.0;
uniform int u_NumOfDirectionalLights : 1;
uniform int u_NumOfSpotLights : 0;
#define SHININESS 32.0
#define MAX_NUM_OF_DIRECTIONAL_LIGHTS 3
#define MAX_NUM_OF_SPOT_LIGHTS 3
struct DirectionalLight {
vec3 direction;
vec3 ambient;
vec3 diffuse;
vec3 specular;
};
struct SpotLight {
vec3 position;
vec3 direction;
vec3 ambient;
vec3 diffuse;
vec3 specular;
float constant;
float linear;
float quadratic;
float angle;
float blur;
float exponent;
};
uniform DirectionalLight u_DirectionalLights[MAX_NUM_OF_DIRECTIONAL_LIGHTS];
uniform SpotLight u_SpotLights[MAX_NUM_OF_SPOT_LIGHTS];
vec3 calc_directional_light(DirectionalLight light, vec3 normal, vec3 viewDir) {
vec3 lightDir = normalize(light.direction);
// diffuse shading
float diff = max(dot(normal, lightDir), 0.0);
// Blinn-Phong specular shading
vec3 halfwayDir = normalize(lightDir + viewDir);
float spec = pow(max(dot(normal, halfwayDir), 0.0), SHININESS);
vec3 ambient = light.ambient * u_Ambient;
vec3 diffuse = light.diffuse * diff * u_Diffuse;
vec3 specular = light.specular * spec * u_Specular;
return ambient + diffuse + specular;
}
vec3 calc_lighting(vec3 position, vec3 normal, vec3 viewDir) {
vec3 weight = vec3(0.0);
for (int i = 0; i < MAX_NUM_OF_DIRECTIONAL_LIGHTS; i++) {
if (i >= u_NumOfDirectionalLights) {
break;
}
weight += calc_directional_light(u_DirectionalLights[i], normal, viewDir);
}
return weight;
}
`,rz=`
in vec4 v_PickingResult;
#pragma include "picking_uniforms"
#define PICKING_NONE 0.0
#define PICKING_ENCODE 1.0
#define PICKING_HIGHLIGHT 2.0
#define COLOR_SCALE 1. / 255.
#define HIGHLIGHT 1.0
#define SELECT 2.0
/*
* Returns highlight color if this item is selected.
*/
vec4 filterHighlightColor(vec4 color, float weight) {
float activeType = v_PickingResult.a;
if(activeType > 0.0) {
vec4 highLightColor = activeType > 1.5 ? u_SelectColor : u_HighlightColor;
highLightColor = highLightColor * COLOR_SCALE;
float highLightAlpha = highLightColor.a;
float highLightRatio = highLightAlpha / (highLightAlpha + color.a * (1.0 - highLightAlpha));
vec3 resultRGB = mix(color.rgb, highLightColor.rgb, highLightRatio);
return vec4(mix(resultRGB * weight, color.rgb, u_activeMix), color.a);
}
else {
return color;
}
}
/*
* Returns picking color if picking enabled else unmodified argument.
*/
vec4 filterPickingColor(vec4 color) {
vec3 pickingColor = v_PickingResult.rgb;
if (u_PickingStage == PICKING_ENCODE && length(pickingColor) < 0.001) {
discard;
}
return u_PickingStage == PICKING_ENCODE ? vec4(pickingColor, step(0.001,color.a)): color;
}
/*
* Returns picking color if picking is enabled if not
* highlight color if this item is selected, otherwise unmodified argument.
*/
vec4 filterColor(vec4 color) {
// 过滤多余的 shader 计算
// return color;
if(u_shaderPick < 0.5) {
return color; // 暂时去除 直接取消计算在选中时拖拽地图会有问题
} else {
return filterPickingColor(filterHighlightColor(color, 1.0));
}
}
vec4 filterColorAlpha(vec4 color, float alpha) {
// 过滤多余的 shader 计算
// return color;
if(u_shaderPick < 0.5) {
return color; // 暂时去除 直接取消计算在选中时拖拽地图会有问题
} else {
return filterPickingColor(filterHighlightColor(color, alpha));
}
}
`,nz=`layout(location = ATTRIBUTE_LOCATION_PICKING_COLOR) in vec3 a_PickingColor;
out vec4 v_PickingResult;
#pragma include "picking_uniforms"
#define PICKING_NONE 0.0
#define PICKING_ENCODE 1.0
#define PICKING_HIGHLIGHT 2.0
#define COLOR_SCALE 1. / 255.
#define NORMAL 0.0
#define HIGHLIGHT 1.0
#define SELECT 2.0
bool isVertexPicked(vec3 vertexColor) {
return distance(vertexColor,u_PickingColor.rgb) < 0.01;
}
// 判断当前点是否已经被 select 选中
bool isVertexSelected(vec3 vertexColor) {
return distance(vertexColor,u_CurrentSelectedId.rgb) < 0.01;
}
void setPickingColor(vec3 pickingColor) {
if(u_shaderPick < 0.5) {
return;
}
// compares only in highlight stage
if(u_PickingStage == PICKING_HIGHLIGHT) {
if(isVertexPicked(pickingColor)) {
v_PickingResult = vec4(pickingColor.rgb * COLOR_SCALE,HIGHLIGHT);
return;
}
if(isVertexSelected(pickingColor)) {
v_PickingResult = vec4(u_CurrentSelectedId.rgb * COLOR_SCALE,SELECT);
return;
}
} else {
v_PickingResult= vec4(pickingColor.rgb * COLOR_SCALE,NORMAL);
return;
}
// // v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && (isVertexPicked(pickingColor) || isVertexPicked(u_CurrentSelectedId)));
// // Stores the picking color so that the fragment shader can render it during picking
// v_PickingResult.rgb = pickingColor * COLOR_SCALE;
}
float setPickingSize(float x) {
return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;
}
float setPickingOrder(float z) {
bool selected = bool(v_PickingResult.a);
return selected ? z + 1. : 0.;
}
`,xg=`layout(std140) uniform PickingUniforms {
vec4 u_HighlightColor;
vec4 u_SelectColor;
vec3 u_PickingColor;
float u_PickingStage;
vec3 u_CurrentSelectedId;
float u_PickingThreshold;
float u_PickingBuffer;
float u_shaderPick;
float u_activeMix;
};`,iz=`
#define E 2.718281828459045
vec2 ProjectFlat(vec2 lnglat){
float maxs=85.0511287798;
float lat=max(min(maxs,lnglat.y),-maxs);
float scale= 268435456.;
float d=PI/180.;
float x=lnglat.x*d;
float y=lat*d;
y=log(tan((PI/4.)+(y/2.)));
float a=.5/PI,
b=.5,
c=-.5/PI;
d=.5;
x=scale*(a*x+b);
y=scale*(c*y+d);
return vec2(x,y);
}
vec2 unProjectFlat(vec2 px){
float a=.5/PI;
float b=.5;
float c=-.5/PI;
float d=.5;
float scale = 268435456.;
float x=(px.x/scale-b)/a;
float y=(px.y/scale-d)/c;
y=(atan(pow(E,y))-(PI/4.))*2.;
d=PI/180.;
float lat=y/d;
float lng=x/d;
return vec2(lng,lat);
}
float pixelDistance(vec2 from, vec2 to) {
vec2 a1 = ProjectFlat(from);
vec2 b1 = ProjectFlat(to);
return distance(a1, b1);
}
// gaode2.0
vec2 customProject(vec2 lnglat) { // 经纬度 => 平面坐标
float t = lnglat.x;
float e = lnglat.y;
float Sm = 180.0 / PI;
float Tm = 6378137.0;
float Rm = PI / 180.0;
float r = 85.0511287798;
e = max(min(r, e), -r);
t *= Rm;
e *= Rm;
e = log(tan(PI / 4.0 + e / 2.0));
return vec2(t * Tm, e * Tm);
}
vec2 unProjCustomCoord(vec2 point) { // 平面坐标 => 经纬度
float Sm = 57.29577951308232; //180 / Math.PI
float Tm = 6378137.0;
float t = point.x;
float e = point.y;
return vec2(t / Tm * Sm, (2.0 * atan(exp(e / Tm)) - PI / 2.0) * Sm);
}
float customPixelDistance(vec2 from, vec2 to) {
vec2 a1 = ProjectFlat(from);
vec2 b1 = ProjectFlat(to);
return distance(a1, b1);
}`,bg=`#define TILE_SIZE (512.0)
#define PI (3.1415926536)
#define WORLD_SCALE (TILE_SIZE / (PI * 2.0))
#define EARTH_CIRCUMFERENCE (40.03e6)
#define COORDINATE_SYSTEM_LNGLAT (1.0) // mapbox
#define COORDINATE_SYSTEM_LNGLAT_OFFSET (2.0) // mapbox offset
#define COORDINATE_SYSTEM_VECTOR_TILE (3.0)
#define COORDINATE_SYSTEM_IDENTITY (4.0)
#define COORDINATE_SYSTEM_METER_OFFSET (5.0)
#pragma include "scene_uniforms"
const vec2 ZERO_64_XY_LOW = vec2(0.0, 0.0);
// web mercator coords -> world coords
vec2 project_mercator(vec2 lnglat) {
float x = lnglat.x;
return vec2(radians(x) + PI, PI - log(tan(PI * 0.25 + radians(lnglat.y) * 0.5)));
}
float project_scale(float meters) {
return meters * u_PixelsPerMeter.z;
}
// offset coords -> world coords
vec4 project_offset(vec4 offset) {
float dy = offset.y;
dy = clamp(dy, -1.0, 1.0);
vec3 pixels_per_unit = u_PixelsPerDegree + u_PixelsPerDegree2 * dy;
return vec4(offset.xyz * pixels_per_unit, offset.w);
}
vec3 project_normal(vec3 normal) {
vec4 normal_modelspace = u_ModelMatrix * vec4(normal, 0.0);
return normalize(normal_modelspace.xyz * u_PixelsPerMeter);
}
vec3 project_offset_normal(vec3 vector) {
if (
u_CoordinateSystem < COORDINATE_SYSTEM_LNGLAT + 0.01 &&
u_CoordinateSystem > COORDINATE_SYSTEM_LNGLAT - 0.01 ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
// normals generated by the polygon tesselator are in lnglat offsets instead of meters
return normalize(vector * u_PixelsPerDegree);
}
return project_normal(vector);
}
vec4 project_position(vec4 position, vec2 position64xyLow) {
if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
float X = position.x - u_ViewportCenter.x;
float Y = position.y - u_ViewportCenter.y;
return project_offset(
vec4(X + position64xyLow.x, Y + position64xyLow.y, position.z, position.w)
);
}
if (
u_CoordinateSystem < COORDINATE_SYSTEM_LNGLAT + 0.01 &&
u_CoordinateSystem > COORDINATE_SYSTEM_LNGLAT - 0.01
) {
return vec4(
project_mercator(position.xy) * WORLD_SCALE * u_ZoomScale,
project_scale(position.z),
position.w
);
}
return position;
}
vec4 project_position(vec4 position) {
return project_position(position, ZERO_64_XY_LOW);
}
vec2 project_pixel_size_to_clipspace(vec2 pixels) {
vec2 offset = pixels / u_ViewportSize * u_DevicePixelRatio * 2.0;
return offset * u_FocalDistance;
}
// 适配纹理贴图的等像素大小
float project_pixel_texture(float pixel) {
// mapbox zoom > 12
if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
return pixel * pow(0.5, u_Zoom) * u_FocalDistance;
}
return pixel * 2.0 * u_FocalDistance;
}
// 在不论什么底图下需要统一处理的时候使用
float project_float_pixel(float pixel) {
if (
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
// mapbox 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减1
return pixel * pow(2.0, 19.0 - u_Zoom) * u_FocalDistance;
}
return pixel * u_FocalDistance;
}
// Project meter into the unit of pixel which used in the camera world space
float project_float_meter(float meter) {
if (
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
// Since the zoom level uniform is updated by mapservice and it's alread been subtracted by 1
// Not sure if we are supposed to do that again
return meter;
} else {
return project_float_pixel(meter);
}
// TODO: change the following code to make adaptations for amap
// return u_FocalDistance * TILE_SIZE * pow(2.0, u_Zoom) * meter / EARTH_CIRCUMFERENCE;
}
float project_pixel(float pixel) {
return pixel * u_FocalDistance;
}
vec2 project_pixel(vec2 pixel) {
return pixel * -1.0 * u_FocalDistance;
}
vec3 project_pixel(vec3 pixel) {
return pixel * -1.0 * u_FocalDistance;
}
vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {
if (
u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
// Needs to be divided with project_uCommonUnitsPerMeter
position.w *= u_PixelsPerMeter.z;
}
return viewProjectionMatrix * position + center;
}
// Projects from common space coordinates to clip space
vec4 project_common_position_to_clipspace(vec4 position) {
return project_common_position_to_clipspace(
position,
u_ViewProjectionMatrix,
u_ViewportCenterProjection
);
}
vec4 unproject_clipspace_to_position(vec4 clipspacePos, mat4 u_InverseViewProjectionMatrix) {
vec4 pos = u_InverseViewProjectionMatrix * (clipspacePos - u_ViewportCenterProjection);
if (
u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
// Needs to be divided with project_uCommonUnitsPerMeter
pos.w = pos.w / u_PixelsPerMeter.z;
}
return pos;
}
bool isEqual(float a, float b) {
return a < b + 0.001 && a > b - 0.001;
}
`,oz=`vec2 rotate_matrix(vec2 v, float a) {
float b = a / 180.0 * 3.1415926535897932384626433832795;
float s = sin(b);
float c = cos(b);
mat2 m = mat2(c, s, -s, c);
return m * v;
}`,Rg=`layout(std140) uniform SceneUniforms {
mat4 u_ViewMatrix;
mat4 u_ProjectionMatrix;
mat4 u_ViewProjectionMatrix;
mat4 u_ModelMatrix;
vec4 u_ViewportCenterProjection;
vec3 u_PixelsPerDegree;
float u_Zoom;
vec3 u_PixelsPerDegree2;
float u_ZoomScale;
vec3 u_PixelsPerMeter;
float u_CoordinateSystem;
vec3 u_CameraPosition;
float u_DevicePixelRatio;
vec2 u_ViewportCenter;
vec2 u_ViewportSize;
float u_FocalDistance;
};
`,az=`/**
* 2D signed distance field functions
* @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
*/
float ndot(vec2 a, vec2 b ) { return a.x*b.x - a.y*b.y; }
float sdCircle(vec2 p, float r) {
return length(p) - r;
}
float sdEquilateralTriangle(vec2 p) {
float k = sqrt(3.0);
p.x = abs(p.x) - 1.0;
p.y = p.y + 1.0/k;
if( p.x + k*p.y > 0.0 ) p = vec2(p.x-k*p.y,-k*p.x-p.y)/2.0;
p.x -= clamp( p.x, -2.0, 0.0 );
return -length(p)*sign(p.y);
}
float sdBox(vec2 p, vec2 b) {
vec2 d = abs(p)-b;
return length(max(d,vec2(0))) + min(max(d.x,d.y),0.0);
}
float sdPentagon(vec2 p, float r) {
vec3 k = vec3(0.809016994,0.587785252,0.726542528);
p.x = abs(p.x);
p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);
p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);
p -= vec2(clamp(p.x,-r*k.z,r*k.z),r);
return length(p)*sign(p.y);
}
float sdHexagon(vec2 p, float r) {
vec3 k = vec3(-0.866025404,0.5,0.577350269);
p = abs(p);
p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
return length(p)*sign(p.y);
}
float sdOctogon(vec2 p, float r) {
vec3 k = vec3(-0.9238795325, 0.3826834323, 0.4142135623 );
p = abs(p);
p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);
p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);
p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
return length(p)*sign(p.y);
}
float sdHexagram(vec2 p, float r) {
vec4 k=vec4(-0.5,0.8660254038,0.5773502692,1.7320508076);
p = abs(p);
p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
p -= 2.0*min(dot(k.yx,p),0.0)*k.yx;
p -= vec2(clamp(p.x,r*k.z,r*k.w),r);
return length(p)*sign(p.y);
}
float sdRhombus(vec2 p, vec2 b) {
vec2 q = abs(p);
float h = clamp((-2.0*ndot(q,b)+ndot(b,b))/dot(b,b),-1.0,1.0);
float d = length( q - 0.5*b*vec2(1.0-h,1.0+h) );
return d * sign( q.x*b.y + q.y*b.x - b.x*b.y );
}
float sdVesica(vec2 p, float r, float d) {
p = abs(p);
float b = sqrt(r*r-d*d); // can delay this sqrt
return ((p.y-b)*d>p.x*b)
? length(p-vec2(0.0,b))
: length(p-vec2(-d,0.0))-r;
}
`,Cg=/precision\s+(high|low|medium)p\s+float/,Og=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
`,sz=/#pragma include (["^+"]?["[a-zA-Z_0-9](.*)"]*?)/g,uz=/void\s+main\s*\([^)]*\)\s*\{\n?/;class lz{constructor(){E(this,"moduleCache",{}),E(this,"rawContentCache",{})}registerBuiltinModules(){this.destroy(),this.registerModule("common",{vs:Sg,fs:Sg}),this.registerModule("decode",{vs:ez,fs:""}),this.registerModule("scene_uniforms",{vs:Rg,fs:Rg}),this.registerModule("picking_uniforms",{vs:xg,fs:xg}),this.registerModule("projection",{vs:bg,fs:bg}),this.registerModule("project",{vs:iz,fs:""}),this.registerModule("sdf_2d",{vs:"",fs:az}),this.registerModule("lighting",{vs:tz,fs:""}),this.registerModule("light",{vs:J$,fs:""}),this.registerModule("picking",{vs:nz,fs:rz}),this.registerModule("rotation_2d",{vs:oz,fs:""})}registerModule(t,r){r.vs=r.vs.replace(/\r\n/g,`
`),r.fs=r.fs.replace(/\r\n/g,`
`);const{vs:n,fs:i,uniforms:o,defines:a,inject:s}=r,{content:u,uniforms:l}=kh(n),{content:f,uniforms:c}=kh(i);this.rawContentCache[t]={fs:f,defines:a,inject:s,uniforms:he(he(he({},l),c),o),vs:u}}getModule(t){let r=this.rawContentCache[t].vs,n=this.rawContentCache[t].fs;const{defines:i={},inject:o={}}=this.rawContentCache[t];let a={};o["vs:#decl"]&&(r=o["vs:#decl"]+r,a=kh(o["vs:#decl"]).uniforms),o["vs:#main-start"]&&(r=r.replace(uz,v=>v+o["vs:#main-start"])),o["fs:#decl"]&&(n=o["fs:#decl"]+n),r=cz(i)+r;const{content:u,includeList:l}=this.processModule(r,[],"vs"),{content:f,includeList:c}=this.processModule(n,[],"fs"),h=Q$(l.concat(c).concat(t)).reduce((v,g)=>he(he({},v),this.rawContentCache[g].uniforms),he({},a)),d=(Cg.test(f)?"":Og)+u,p=(Cg.test(f)?"":Og)+f;return this.moduleCache[t]={vs:d.trim(),fs:p.trim(),uniforms:h},this.moduleCache[t]}destroy(){this.moduleCache={},this.rawContentCache={}}processModule(t,r,n){return{content:t.replace(sz,(o,a)=>{const u=a.split(" ")[0].replace(/"/g,"");if(r.indexOf(u)>-1)return"";const l=this.rawContentCache[u][n];r.push(u);const{content:f}=this.processModule(l,r,n);return f}),includeList:r}}}function cz(e){return Object.keys(e).reduce((r,n)=>r+`#define ${n.toUpperCase()} ${e[n]}
`,`
`)}class jp{constructor(){E(this,"shaderModuleService",void 0),E(this,"rendererService",void 0),E(this,"cameraService",void 0),E(this,"mapService",void 0),E(this,"interactionService",void 0),E(this,"layerService",void 0),E(this,"config",void 0)}getName(){return""}getType(){return Fu.Normal}init(t,r){this.config=r,this.rendererService=t.getContainer().rendererService,this.cameraService=t.getContainer().cameraService,this.mapService=t.getContainer().mapService,this.interactionService=t.getContainer().interactionService,this.layerService=t.getContainer().layerService,this.shaderModuleService=t.getContainer().shaderModuleService}render(t){}}class fz extends jp{getName(){return"clear"}init(t,r){super.init(t,r)}render(){this.rendererService.clear({color:[0,0,0,0],depth:1,framebuffer:null})}}class hz{constructor(t){E(this,"passes",[]),E(this,"layer",void 0),E(this,"renderFlag",void 0),E(this,"width",0),E(this,"height",0),this.postProcessor=t}setLayer(t){this.layer=t}setRenderFlag(t){this.renderFlag=t}getRenderFlag(){return this.renderFlag}getPostProcessor(){return this.postProcessor}render(){var t=this;return ve(function*(){for(const r of t.passes)yield r.render(t.layer);yield t.postProcessor.render(t.layer)})()}resize(t,r){(this.width!==t||this.height!==r)&&(this.postProcessor.resize(t,r),this.width=t,this.height=r)}add(t,r){t.getType()===Fu.PostProcessing?this.postProcessor.add(t,this.layer,r):(t.init(this.layer,r),this.passes.push(t))}insert(t,r,n){t.init(this.layer,r),this.passes.splice(n,0,t)}destroy(){this.passes.length=0}}class dz extends jp{constructor(...t){var r;super(...t),r=this,E(this,"pickingFBO",void 0),E(this,"layer",void 0),E(this,"width",0),E(this,"height",0),E(this,"alreadyInRendering",!1),E(this,"pickFromPickingFBO",({x:n,y:i,lngLat:o,type:a})=>{if(!this.layer.isVisible()||!this.layer.needPick(a))return;const{getViewportSize:s,readPixelsAsync:u,useFramebuffer:l}=this.rendererService,{width:f,height:c}=s(),{enableHighlight:h,enableSelect:d}=this.layer.getLayerConfig(),p=n*ln,v=i*ln;if(p>f||p<0||v>c||v<0)return;let g;l(this.pickingFBO,ve(function*(){var y;if(g=yield u({x:Math.round(p),y:Math.round(c-(i+1)*ln),width:1,height:1,data:new Uint8Array(1*1*4),framebuffer:r.pickingFBO}),g[0]!==0||g[1]!==0||g[2]!==0){const S=yo(g),R=r.layer.getSource().getFeatureById(S),x={x:n,y:i,type:a,lngLat:o,featureId:S,feature:R};R&&(r.layer.setCurrentPickId(S),r.triggerHoverOnLayer(x))}else{const S={x:n,y:i,lngLat:o,type:r.layer.getCurrentPickId()===null?"un"+a:"mouseout",featureId:null,feature:null};r.triggerHoverOnLayer(he(he({},S),{},{type:"unpick"})),r.triggerHoverOnLayer(S),r.layer.setCurrentPickId(null)}h&&r.highlightPickedFeature(g),d&&a==="click"&&((y=g)===null||y===void 0?void 0:y.toString())!==[0,0,0,0].toString()&&r.selectFeature(g)}))})}getType(){return Fu.Normal}getName(){return"pixelPicking"}init(t,r){super.init(t,r),this.layer=t;const{createTexture2D:n,createFramebuffer:i,getViewportSize:o}=this.rendererService,{width:a,height:s}=o(),u=n({width:a,height:s,wrapS:m.CLAMP_TO_EDGE,wrapT:m.CLAMP_TO_EDGE,label:"Picking Texture"});this.pickingFBO=i({color:u}),this.interactionService.on(cn.Hover,this.pickFromPickingFBO),this.interactionService.on(cn.Select,this.selectFeatureHandle.bind(this)),this.interactionService.on(cn.Active,this.highlightFeatureHandle.bind(this))}render(t){if(this.alreadyInRendering)return;const{getViewportSize:r,useFramebuffer:n,clear:i}=this.rendererService,{width:o,height:a}=r();this.alreadyInRendering=!0,(this.width!==o||this.height!==a)&&(this.pickingFBO.resize({width:o,height:a}),this.width=o,this.height=a),n(this.pickingFBO,()=>{i({framebuffer:this.pickingFBO,color:[0,0,0,0],stencil:0,depth:1});const s=this.layer.multiPassRenderer.getRenderFlag();this.layer.multiPassRenderer.setRenderFlag(!1),t.hooks.beforePickingEncode.call(),t.render(),t.hooks.afterPickingEncode.call(),this.layer.multiPassRenderer.setRenderFlag(s),this.alreadyInRendering=!1})}triggerHoverOnLayer(t){this.layer.emit(t.type,t)}highlightPickedFeature(t){const[r,n,i]=t;this.layer.hooks.beforeHighlight.call([r,n,i]),this.layerService.renderLayers()}selectFeature(t){const[r,n,i]=t;this.layer.hooks.beforeSelect.call([r,n,i]),this.layerService.renderLayers()}selectFeatureHandle({featureId:t}){const r=La(t);this.selectFeature(new Uint8Array(r))}highlightFeatureHandle({featureId:t}){const r=La(t);this.highlightPickedFeature(new Uint8Array(r))}}class pz{constructor(t){E(this,"passes",[]),E(this,"readFBO",void 0),E(this,"writeFBO",void 0),this.rendererService=t,this.init()}getReadFBO(){return this.readFBO}getWriteFBO(){return this.writeFBO}getCurrentFBOTex(){const{getViewportSize:t,createTexture2D:r}=this.rendererService,{width:n,height:i}=t();return r({x:0,y:0,width:n,height:i,copy:!0})}getReadFBOTex(){var t=this;const{useFramebuffer:r}=this.rendererService;return new Promise(n=>{r(this.readFBO,ve(function*(){n(t.getCurrentFBOTex())}))})}renderBloomPass(t,r){var n=this;return ve(function*(){const i=yield n.getReadFBOTex();let o=0;for(;o<4;)yield r.render(t,i),n.swap(),o++})()}render(t){var r=this;return ve(function*(){for(let n=0;n<r.passes.length;n++){const i=r.passes[n];i.setRenderToScreen(r.isLastEnabledPass(n)),i.getName()==="bloom"?yield r.renderBloomPass(t,i):(yield i.render(t),n!==r.passes.length-1&&r.swap())}})()}resize(t,r){this.readFBO.resize({width:t,height:r}),this.writeFBO.resize({width:t,height:r})}add(t,r,n){t.init(r,n),this.passes.push(t)}insert(t,r,n,i){t.init(n,i),this.passes.splice(r,0,t)}getPostProcessingPassByName(t){return this.passes.find(r=>r.getName()===t)}init(){const{createFramebuffer:t,createTexture2D:r}=this.rendererService;this.readFBO=t({color:r({width:1,height:1,wrapS:m.CLAMP_TO_EDGE,wrapT:m.CLAMP_TO_EDGE,usage:pu.RENDER_TARGET})}),this.writeFBO=t({color:r({width:1,height:1,wrapS:m.CLAMP_TO_EDGE,wrapT:m.CLAMP_TO_EDGE,usage:pu.RENDER_TARGET})})}isLastEnabledPass(t){for(let r=t+1;r<this.passes.length;r++)if(this.passes[r].isEnabled())return!1;return!0}swap(){const t=this.readFBO;this.readFBO=this.writeFBO,this.writeFBO=t}}class _z extends jp{getType(){return Fu.Normal}getName(){return"render"}init(t,r){super.init(t,r)}render(t){const{useFramebuffer:r,clear:n}=this.rendererService,i=t.multiPassRenderer.getPostProcessor().getReadFBO();r(i,()=>{n({color:[0,0,0,0],depth:1,stencil:0,framebuffer:i}),t.multiPassRenderer.setRenderFlag(!1),t.models.forEach(o=>{o.draw({uniforms:t.layerModel.getUninforms()})}),t.multiPassRenderer.setRenderFlag(!0)})}}const vz=`varying vec2 v_UV;
uniform float u_BloomFinal: 0.0;
uniform sampler2D u_Texture;
uniform sampler2D u_Texture2;
uniform vec2 u_ViewportSize: [1.0, 1.0];
uniform float u_radius: 5.0;
uniform float u_intensity: 0.3;
uniform float u_baseRadio: 0.5;
// https://github.com/Jam3/glsl-fast-gaussian-blur/blob/master/9.glsl
vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
vec4 color = vec4(0.0);
vec2 off1 = vec2(1.3846153846) * direction;
vec2 off2 = vec2(3.2307692308) * direction;
color += texture2D(image, uv) * 0.2270270270;
color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
return color;
}
float luminance(vec4 color) {
return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b;
}
void main() {
// vec4 baseColor = texture2D(u_Texture, v_UV);
float r = sqrt(u_radius);
vec4 c1 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(u_radius, 0.0));
// c1 *= luminance(c1);
vec4 c2 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(0.0, u_radius));
// c2 *= luminance(c2);
vec4 c3 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(r, r));
// c3 *= luminance(c3);
vec4 c4 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(r, -r));
// c4 *= luminance(c4);
vec4 inbloomColor = (c1 + c2 + c3 + c4) * 0.25;
// float lum = luminance(inbloomColor);
// inbloomColor.rgb *= lum;
if(u_BloomFinal > 0.0) {
vec4 baseColor = texture2D(u_Texture2, v_UV);
float baselum = luminance(baseColor);
gl_FragColor = mix(inbloomColor, baseColor, u_baseRadio);
if(baselum <= 0.2) {
gl_FragColor = inbloomColor * u_intensity;
}
} else {
gl_FragColor = inbloomColor;
}
}`,mz=`attribute vec2 a_Position;
varying vec2 v_UV;
void main() {
v_UV = 0.5 * (a_Position + 1.0);
gl_Position = vec4(a_Position, 0., 1.);
}`,{isNil:Vh}=Sr;class gz extends Ai{setupShaders(){this.shaderModuleService.registerModule("blur-pass",{vs:mz,fs:vz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("blur-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}convertOptionsToUniforms(t){const r={};return Vh(t.bloomRadius)||(r.u_radius=t.bloomRadius),Vh(t.bloomIntensity)||(r.u_intensity=t.bloomIntensity),Vh(t.bloomBaseRadio)||(r.u_baseRadio=t.bloomBaseRadio),r}}const Ez=`varying vec2 v_UV;
uniform sampler2D u_Texture;
uniform vec2 u_ViewportSize: [1.0, 1.0];
uniform vec2 u_BlurDir: [1.0, 0.0];
// https://github.com/Jam3/glsl-fast-gaussian-blur/blob/master/9.glsl
vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
vec4 color = vec4(0.0);
vec2 off1 = vec2(1.3846153846) * direction;
vec2 off2 = vec2(3.2307692308) * direction;
color += texture2D(image, uv) * 0.2270270270;
color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
return color;
}
void main() {
gl_FragColor = blur9(u_Texture, v_UV, u_ViewportSize, u_BlurDir);
}`,yz=`attribute vec2 a_Position;
varying vec2 v_UV;
void main() {
v_UV = 0.5 * (a_Position + 1.0);
gl_Position = vec4(a_Position, 0., 1.);
}`,{isNil:Tz}=Sr;class Az extends Ai{setupShaders(){this.shaderModuleService.registerModule("blur-pass",{vs:yz,fs:Ez});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("blur-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}convertOptionsToUniforms(t){const r={};return Tz(t.blurRadius)||(r.u_BlurDir=[t.blurRadius,0]),r}}const Sz=`varying vec2 v_UV;
uniform sampler2D u_Texture;
uniform vec2 u_ViewportSize: [1.0, 1.0];
uniform vec2 u_BlurDir: [1.0, 0.0];
// https://github.com/Jam3/glsl-fast-gaussian-blur/blob/master/9.glsl
vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
vec4 color = vec4(0.0);
vec2 off1 = vec2(1.3846153846) * direction;
vec2 off2 = vec2(3.2307692308) * direction;
color += texture2D(image, uv) * 0.2270270270;
color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
return color;
}
void main() {
gl_FragColor = blur9(u_Texture, v_UV, u_ViewportSize, u_BlurDir);
}`,xz=`attribute vec2 a_Position;
varying vec2 v_UV;
void main() {
v_UV = 0.5 * (a_Position + 1.0);
gl_Position = vec4(a_Position, 0., 1.);
}`,{isNil:bz}=Sr;class Rz extends Ai{setupShaders(){this.shaderModuleService.registerModule("blur-pass",{vs:xz,fs:Sz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("blur-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}convertOptionsToUniforms(t){const r={};return bz(t.blurRadius)||(r.u_BlurDir=[0,t.blurRadius]),r}}const Cz=`varying vec2 v_UV;
uniform sampler2D u_Texture;
uniform vec2 u_ViewportSize: [1.0, 1.0];
uniform vec2 u_Center : [0.5, 0.5];
uniform float u_Angle : 0;
uniform float u_Size : 8;
#pragma include "common"
float scale = PI / u_Size;
float pattern(float u_Angle, vec2 texSize, vec2 texCoord) {
float s = sin(u_Angle), c = cos(u_Angle);
vec2 tex = texCoord * texSize - u_Center * texSize;
vec2 point = vec2(
c * tex.x - s * tex.y,
s * tex.x + c * tex.y
) * scale;
return (sin(point.x) * sin(point.y)) * 4.0;
}
// https://github.com/evanw/glfx.js/blob/master/src/filters/fun/colorhalftone.js
vec4 colorHalftone_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
vec3 cmy = 1.0 - color.rgb;
float k = min(cmy.x, min(cmy.y, cmy.z));
cmy = (cmy - k) / (1.0 - k);
cmy = clamp(
cmy * 10.0 - 3.0 + vec3(
pattern(u_Angle + 0.26179, texSize, texCoord),
pattern(u_Angle + 1.30899, texSize, texCoord),
pattern(u_Angle, texSize, texCoord)
),
0.0,
1.0
);
k = clamp(k * 10.0 - 5.0 + pattern(u_Angle + 0.78539, texSize, texCoord), 0.0, 1.0);
return vec4(1.0 - cmy - k, color.a);
}
void main() {
gl_FragColor = vec4(texture2D(u_Texture, v_UV));
gl_FragColor = colorHalftone_filterColor(gl_FragColor, u_ViewportSize, v_UV);
}`,Oz=`attribute vec2 a_Position;
varying vec2 v_UV;
void main() {
v_UV = 0.5 * (a_Position + 1.0);
gl_Position = vec4(a_Position, 0., 1.);
}`;class Iz extends Ai{setupShaders(){this.shaderModuleService.registerModule("colorhalftone-pass",{vs:Oz,fs:Cz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("colorhalftone-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}}const Mz=`varying vec2 v_UV;
uniform sampler2D u_Texture;
void main() {
gl_FragColor = vec4(texture2D(u_Texture, v_UV));
}`,Nz=`attribute vec2 a_Position;
varying vec2 v_UV;
void main() {
v_UV = 0.5 * (a_Position + 1.0);
gl_Position = vec4(a_Position, 0., 1.);
}`;class Pz extends Ai{setupShaders(){return this.shaderModuleService.registerModule("copy-pass",{vs:Nz,fs:Mz}),this.shaderModuleService.getModule("copy-pass")}}const Lz=`varying vec2 v_UV;
uniform sampler2D u_Texture;
uniform vec2 u_ViewportSize: [1.0, 1.0];
uniform vec2 u_Center : [0.5, 0.5];
uniform float u_Scale : 10;
// https://github.com/evanw/glfx.js/blob/master/src/filters/fun/hexagonalpixelate.js
vec4 hexagonalPixelate_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
vec2 tex = (texCoord * texSize - u_Center * texSize) / u_Scale;
tex.y /= 0.866025404;
tex.x -= tex.y * 0.5;
vec2 a;
if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {
a = vec2(floor(tex.x), floor(tex.y));
}
else a = vec2(ceil(tex.x), ceil(tex.y));
vec2 b = vec2(ceil(tex.x), floor(tex.y));
vec2 c = vec2(floor(tex.x), ceil(tex.y));
vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);
vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);
vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);
vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);
float alen = length(TEX - A);
float blen = length(TEX - B);
float clen = length(TEX - C);
vec2 choice;
if (alen < blen) {
if (alen < clen) choice = a;
else choice = c;
} else {
if (blen < clen) choice = b;
else choice = c;
}
choice.x += choice.y * 0.5;
choice.y *= 0.866025404;
choice *= u_Scale / texSize;
return texture2D(texture, choice + u_Center);
}
void main() {
gl_FragColor = vec4(texture2D(u_Texture, v_UV));
gl_FragColor = hexagonalPixelate_sampleColor(u_Texture, u_ViewportSize, v_UV);
}`,wz=`attribute vec2 a_Position;
varying vec2 v_UV;
void main() {
v_UV = 0.5 * (a_Position + 1.0);
gl_Position = vec4(a_Position, 0., 1.);
}`;class Fz extends Ai{setupShaders(){this.shaderModuleService.registerModule("hexagonalpixelate-pass",{vs:wz,fs:Lz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("hexagonalpixelate-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}}const Bz=`varying vec2 v_UV;
uniform sampler2D u_Texture;
uniform vec2 u_ViewportSize: [1.0, 1.0];
uniform float u_Strength : 0.6;
vec4 ink_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
vec2 dx = vec2(1.0 / texSize.x, 0.0);
vec2 dy = vec2(0.0, 1.0 / texSize.y);
vec4 color = texture2D(texture, texCoord);
float bigTotal = 0.0;
float smallTotal = 0.0;
vec3 bigAverage = vec3(0.0);
vec3 smallAverage = vec3(0.0);
for (float x = -2.0; x <= 2.0; x += 1.0) {
for (float y = -2.0; y <= 2.0; y += 1.0) {
vec3 sample = texture2D(texture, texCoord + dx * x + dy * y).rgb;
bigAverage += sample;
bigTotal += 1.0;
if (abs(x) + abs(y) < 2.0) {
smallAverage += sample;
smallTotal += 1.0;
}
}
}
vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);
float power = u_Strength * u_Strength * u_Strength * u_Strength * u_Strength;
return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);
}
void main() {
gl_FragColor = vec4(texture2D(u_Texture, v_UV));
gl_FragColor = ink_sampleColor(u_Texture, u_ViewportSize, v_UV);
}`,Dz=`attribute vec2 a_Position;
varying vec2 v_UV;
void main() {
v_UV = 0.5 * (a_Position + 1.0);
gl_Position = vec4(a_Position, 0., 1.);
}`;class Uz extends Ai{setupShaders(){this.shaderModuleService.registerModule("ink-pass",{vs:Dz,fs:Bz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("ink-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}}const kz=`varying vec2 v_UV;
uniform sampler2D u_Texture;
uniform float u_Amount : 0.5;
float rand(vec2 co) {
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
// https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js
vec4 noise_filterColor(vec4 color, vec2 texCoord) {
float diff = (rand(texCoord) - 0.5) * u_Amount;
color.r += diff;
color.g += diff;
color.b += diff;
return color;
}
void main() {
gl_FragColor = vec4(texture2D(u_Texture, v_UV));
gl_FragColor = noise_filterColor(gl_FragColor, v_UV);
}`,$z=`attribute vec2 a_Position;
varying vec2 v_UV;
void main() {
v_UV = 0.5 * (a_Position + 1.0);
gl_Position = vec4(a_Position, 0., 1.);
}`;class zz extends Ai{setupShaders(){return this.shaderModuleService.registerModule("noise-pass",{vs:$z,fs:kz}),this.shaderModuleService.getModule("noise-pass")}}const Vz=`attribute vec2 a_Position;
varying vec2 v_UV;
void main() {
v_UV = 0.5 * (a_Position + 1.0);
gl_Position = vec4(a_Position, 0., 1.);
}`,Hz=`varying vec2 v_UV;
uniform sampler2D u_Texture;
uniform float u_Amount : 0.5;
// https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/sepia.js
vec4 sepia_filterColor(vec4 color) {
float r = color.r;
float g = color.g;
float b = color.b;
color.r =
min(1.0, (r * (1.0 - (0.607 * u_Amount))) + (g * (0.769 * u_Amount)) + (b * (0.189 * u_Amount)));
color.g = min(1.0, (r * 0.349 * u_Amount) + (g * (1.0 - (0.314 * u_Amount))) + (b * 0.168 * u_Amount));
color.b = min(1.0, (r * 0.272 * u_Amount) + (g * 0.534 * u_Amount) + (b * (1.0 - (0.869 * u_Amount))));
return color;
}
void main() {
gl_FragColor = vec4(texture2D(u_Texture, v_UV));
gl_FragColor = sepia_filterColor(gl_FragColor);
}`;class jz extends Ai{setupShaders(){return this.shaderModuleService.registerModule("sepia-pass",{vs:Vz,fs:Hz}),this.shaderModuleService.getModule("sepia-pass")}}const OA=new X9;let Xz=0;function Wz(){const e=new lz,t=new Z9,r=new B9,n=new Y9(r),i=new T9,o=new S9,a=new k9,s=new $9,u=new U9,l={id:`${Xz++}`,globalConfigService:OA,shaderModuleService:e,debugService:t,cameraService:r,coordinateSystemService:n,fontService:i,iconService:o,markerService:a,popupService:s,controlService:u,customRenderService:{}},f=new i$(l);l.layerService=f;const c=new K$(l);l.sceneService=c;const h=new Q9(l);l.interactionService=h;const d=new r$(l);l.pickingService=d;const p={clear:new fz,pixelPicking:new dz,render:new _z};l.normalPassFactory=g=>p[g];const v={copy:new Pz,bloom:new gz,blurH:new Az,blurV:new Rz,noise:new zz,sepia:new jz,colorHalftone:new Iz,hexagonalPixelate:new Fz,ink:new Uz};return l.postProcessingPass=v,l.postProcessingPassFactory=g=>v[g],l}function su(e){const t=he({},e);return t.postProcessor=new pz(t.rendererService),t.multiPassRenderer=new hz(t.postProcessor),t.styleAttributeService=new f$(t.rendererService),t}const Nl=["loaded","fontloaded","maploaded","resize","destroy","dragstart","dragging","dragend","dragcancel"];let Hr=function(e){return e.IMAGE="image",e.CUSTOMIMAGE="customImage",e.ARRAYBUFFER="arraybuffer",e.RGB="rgb",e.TERRAINRGB="terrainRGB",e.CUSTOMRGB="customRGB",e.CUSTOMARRAYBUFFER="customArrayBuffer",e.CUSTOMTERRAINRGB="customTerrainRGB",e}({});var IA=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),Gz=(e,t,r,n)=>IA(void 0,null,function*(){return new Promise((i,o)=>{t({x:e.x,y:e.y,z:e.z},(a,s)=>{if(a||s.length===0){o(a);return}s&&Rd([{data:s,bands:[0]}],r,n,(u,l)=>{u?o(u):l&&i(l)})})})}),Yz=(e,t)=>IA(void 0,null,function*(){return new Promise((r,n)=>{t({x:e.x,y:e.y,z:e.z},(i,o)=>{if(i||!o){n(i);return}o instanceof ArrayBuffer?c2(o,(a,s)=>{a&&n(a),r(s)}):o instanceof HTMLImageElement?r(o):n(i)})})});function Zz(e,t){return Array.isArray(e)?typeof e[0]=="string"?e.map(r=>xa(r,t)):e.map(r=>({url:xa(r.url,t),bands:r.bands||[0]})):xa(e,t)}function qz(e){return typeof e=="string"?[{url:e,bands:[0]}]:typeof e[0]=="string"?e.map(t=>({url:t,bands:[0]})):e}function Ig(e,t){e.xhrCancel=()=>{t.map(r=>{r.abort()})}}var Kz=Object.defineProperty,Qz=Object.defineProperties,Jz=Object.getOwnPropertyDescriptors,Mg=Object.getOwnPropertySymbols,eV=Object.prototype.hasOwnProperty,tV=Object.prototype.propertyIsEnumerable,Ng=(e,t,r)=>t in e?Kz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Pg=(e,t)=>{for(var r in t||(t={}))eV.call(t,r)&&Ng(e,r,t[r]);if(Mg)for(var r of Mg(t))tV.call(t,r)&&Ng(e,r,t[r]);return e},Lg=(e,t)=>Qz(e,Jz(t)),MA=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),rV=(e,t,r,n,i)=>MA(void 0,null,function*(){const o=qz(t.url);if(o.length>1){const{rasterFiles:a,xhrList:s,errList:u}=yield nV(o,t);if(Ig(e,s),u.length>0){r(u,null);return}Rd(a,n,i,r)}else{const a=_p(t,(s,u)=>{if(s)r(s);else if(u){const l=[{data:u,bands:o[0].bands}];Rd(l,n,i,r)}});Ig(e,[a])}});function nV(e,t){return MA(this,null,function*(){const r=[],n=[],i=[];for(let o=0;o<e.length;o++){const a=e[o],s=Lg(Pg({},t),{url:a.url}),u=a.bands,{err:l,data:f,xhr:c}=yield s2(Lg(Pg({},s),{type:"arrayBuffer"}));l&&i.push(l),n.push(c),r.push({data:f,bands:u})}return{rasterFiles:r,xhrList:n,errList:i}})}var iV=Object.defineProperty,oV=Object.defineProperties,aV=Object.getOwnPropertyDescriptors,wg=Object.getOwnPropertySymbols,sV=Object.prototype.hasOwnProperty,uV=Object.prototype.propertyIsEnumerable,Fg=(e,t,r)=>t in e?iV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ql=(e,t)=>{for(var r in t||(t={}))sV.call(t,r)&&Fg(e,r,t[r]);if(wg)for(var r of wg(t))uV.call(t,r)&&Fg(e,r,t[r]);return e},NA=(e,t)=>oV(e,aV(t)),PA=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),lV=(e,t,r,n)=>PA(void 0,null,function*(){const{format:i=LA,operation:o,requestParameters:a={}}=n,s=NA(Ql({},a),{url:Zz(e,t)});return new Promise((u,l)=>{rV(r,s,(f,c)=>{f?l(f):c&&u(c)},i,o)})}),Bg=(e,t,r,n)=>PA(void 0,null,function*(){let i;const o=Array.isArray(e)?e[0]:e;return n.wmtsOptions?i=((n==null?void 0:n.getURLFromTemplate)||DU)(o,Ql(Ql({},t),n.wmtsOptions)):i=((n==null?void 0:n.getURLFromTemplate)||xa)(o,t),new Promise((a,s)=>{var u;const l=sd(NA(Ql({},n==null?void 0:n.requestParameters),{url:i,type:((u=n==null?void 0:n.requestParameters)==null?void 0:u.type)||"arrayBuffer"}),(f,c)=>{f?s(f):c&&a(c)},n.transformResponse);r.xhrCancel=()=>l.cancel()})}),LA=()=>({rasterData:new Uint8Array([0]),width:1,height:1}),cV=Object.defineProperty,fV=Object.defineProperties,hV=Object.getOwnPropertyDescriptors,Dg=Object.getOwnPropertySymbols,dV=Object.prototype.hasOwnProperty,pV=Object.prototype.propertyIsEnumerable,Ug=(e,t,r)=>t in e?cV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,kg=(e,t)=>{for(var r in t||(t={}))dV.call(t,r)&&Ug(e,r,t[r]);if(Dg)for(var r of Dg(t))pV.call(t,r)&&Ug(e,r,t[r]);return e},_V=(e,t)=>fV(e,hV(t)),vV={tileSize:256,minZoom:0,maxZoom:1/0,zoomOffset:0,warp:!0};Hr.ARRAYBUFFER,Hr.RGB;function mV(e){return!!(Array.isArray(e)&&e.length===0||!Array.isArray(e)&&typeof e!="string")}function gV(e,t={}){if(mV(e))throw new Error("tile server url is error");let r=(t==null?void 0:t.dataType)||Hr.IMAGE;r===Hr.RGB&&(r=Hr.ARRAYBUFFER);const n=(o,a)=>{switch(r){case Hr.IMAGE:return Bg(e,o,a,t);case Hr.CUSTOMIMAGE:case Hr.CUSTOMTERRAINRGB:return Yz(a,t==null?void 0:t.getCustomData);case Hr.ARRAYBUFFER:return lV(e,o,a,t);case Hr.CUSTOMARRAYBUFFER:case Hr.CUSTOMRGB:return Gz(a,t==null?void 0:t.getCustomData,(t==null?void 0:t.format)||LA,t==null?void 0:t.operation);default:return Bg(e,o,a,t)}},i=_V(kg(kg({},vV),t),{getTileData:n});return{data:e,dataArray:[],tilesetOptions:i,isTile:!0}}var EV=Object.defineProperty,yV=Object.defineProperties,TV=Object.getOwnPropertyDescriptors,Ac=Object.getOwnPropertySymbols,wA=Object.prototype.hasOwnProperty,FA=Object.prototype.propertyIsEnumerable,$g=(e,t,r)=>t in e?EV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,AV=(e,t)=>{for(var r in t||(t={}))wA.call(t,r)&&$g(e,r,t[r]);if(Ac)for(var r of Ac(t))FA.call(t,r)&&$g(e,r,t[r]);return e},SV=(e,t)=>yV(e,TV(t)),xV=(e,t)=>{var r={};for(var n in e)wA.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ac)for(var n of Ac(e))t.indexOf(n)<0&&FA.call(e,n)&&(r[n]=e[n]);return r};function bV(e,t){const r=t,{extent:n=[121.168,30.2828,121.384,30.4219],coordinates:i,width:o,height:a}=r,s=xV(r,["extent","coordinates","width","height"]);e.length<2&&console.warn("RGB解析需要2个波段的数据");const[u,l]=s.bands||[0,1],f=[e[u],e[l]],c=[];for(let p=0;p<f[0].length;p++)c.push((f[1][p]-f[0][p])/(f[1][p]+f[0][p]));const h=wu(i,n);return{_id:1,dataArray:[SV(AV({_id:1,data:c,width:o,height:a},s),{coordinates:h})]}}var RV=Object.defineProperty,CV=Object.defineProperties,OV=Object.getOwnPropertyDescriptors,Sc=Object.getOwnPropertySymbols,BA=Object.prototype.hasOwnProperty,DA=Object.prototype.propertyIsEnumerable,zg=(e,t,r)=>t in e?RV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,IV=(e,t)=>{for(var r in t||(t={}))BA.call(t,r)&&zg(e,r,t[r]);if(Sc)for(var r of Sc(t))DA.call(t,r)&&zg(e,r,t[r]);return e},MV=(e,t)=>CV(e,OV(t)),NV=(e,t)=>{var r={};for(var n in e)BA.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Sc)for(var n of Sc(e))t.indexOf(n)<0&&DA.call(e,n)&&(r[n]=e[n]);return r};function PV(e,t){const r=t,{extent:n,coordinates:i,width:o,height:a}=r,s=NV(r,["extent","coordinates","width","height"]);e.length<3&&console.warn("RGB解析需要三个波段的数据");const[u,l,f]=s.bands||[0,1,2],c=[e[u],e[l],e[f]],h=[],[d,p]=(s==null?void 0:s.countCut)||[2,98],v=(s==null?void 0:s.RMinMax)||Ra(c[0],d,p),g=(s==null?void 0:s.GMinMax)||Ra(c[1],d,p),y=(s==null?void 0:s.BMinMax)||Ra(c[2],d,p);for(let x=0;x<c[0].length;x++)h.push(Math.max(0,c[0][x]-v[0])),h.push(Math.max(0,c[1][x]-g[0])),h.push(Math.max(0,c[2][x]-y[0]));const S=wu(i,n);return{_id:1,dataArray:[MV(IV({_id:1,data:h,width:o,height:a,rMinMax:v,gMinMax:g,bMinMax:y},s),{coordinates:S})]}}var LV=Object.defineProperty,wV=Object.defineProperties,FV=Object.getOwnPropertyDescriptors,xc=Object.getOwnPropertySymbols,UA=Object.prototype.hasOwnProperty,kA=Object.prototype.propertyIsEnumerable,Vg=(e,t,r)=>t in e?LV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,BV=(e,t)=>{for(var r in t||(t={}))UA.call(t,r)&&Vg(e,r,t[r]);if(xc)for(var r of xc(t))kA.call(t,r)&&Vg(e,r,t[r]);return e},DV=(e,t)=>wV(e,FV(t)),UV=(e,t)=>{var r={};for(var n in e)UA.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&xc)for(var n of xc(e))t.indexOf(n)<0&&kA.call(e,n)&&(r[n]=e[n]);return r};function kV(e,t){const r=t,{extent:n,coordinates:i,min:o,max:a,width:s,height:u,format:l,operation:f}=r,c=UV(r,["extent","coordinates","min","max","width","height","format","operation"]);let h;if(l===void 0||YT(e))h=Array.from(e);else{const v=Array.isArray(e)?e:[e];h=Bp(v,l,f)}const d=wu(i,n);return{_id:1,dataArray:[DV(BV({_id:1,data:h,width:s,height:u},c),{min:o,max:a,coordinates:d})]}}var $V=Object.defineProperty,zV=Object.defineProperties,VV=Object.getOwnPropertyDescriptors,Hg=Object.getOwnPropertySymbols,HV=Object.prototype.hasOwnProperty,jV=Object.prototype.propertyIsEnumerable,jg=(e,t,r)=>t in e?$V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Xg=(e,t)=>{for(var r in t||(t={}))HV.call(t,r)&&jg(e,r,t[r]);if(Hg)for(var r of Hg(t))jV.call(t,r)&&jg(e,r,t[r]);return e},XV=(e,t)=>zV(e,VV(t)),WV=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),GV={tileSize:256,minZoom:0,maxZoom:1/0,zoomOffset:0},YV=e=>WV(void 0,null,function*(){return new Promise(t=>{const[r,n,i,o]=e.bounds,a={layers:{testTile:{features:[{type:"Feature",properties:{key:e.x+"/"+e.y+"/"+e.z,x:(r+i)/2,y:(n+o)/2},geometry:{type:"LineString",coordinates:[[i,o],[i,n],[r,n],[r,n]]}}]}}};t(a)})});function ZV(e,t){const r=i=>YV(i),n=XV(Xg(Xg({},GV),t),{getTileData:r});return{data:e,dataArray:[],tilesetOptions:n,isTile:!0}}var $A={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(mo,function(){function r(q,k,G,K,ce,Pe){if(!(ce-K<=G)){var Xe=K+ce>>1;n(q,k,Xe,K,ce,Pe%2),r(q,k,G,K,Xe-1,Pe+1),r(q,k,G,Xe+1,ce,Pe+1)}}function n(q,k,G,K,ce,Pe){for(;ce>K;){if(ce-K>600){var Xe=ce-K+1,Je=G-K+1,ft=Math.log(Xe),Ge=.5*Math.exp(2*ft/3),et=.5*Math.sqrt(ft*Ge*(Xe-Ge)/Xe)*(Je-Xe/2<0?-1:1),vt=Math.max(K,Math.floor(G-Je*Ge/Xe+et)),mt=Math.min(ce,Math.floor(G+(Xe-Je)*Ge/Xe+et));n(q,k,G,vt,mt,Pe)}var It=k[2*G+Pe],wt=K,gt=ce;for(i(q,k,K,G),k[2*ce+Pe]>It&&i(q,k,K,ce);wt<gt;){for(i(q,k,wt,gt),wt++,gt--;k[2*wt+Pe]<It;)wt++;for(;k[2*gt+Pe]>It;)gt--}k[2*K+Pe]===It?i(q,k,K,gt):(gt++,i(q,k,gt,ce)),gt<=G&&(K=gt+1),G<=gt&&(ce=gt-1)}}function i(q,k,G,K){o(q,G,K),o(k,2*G,2*K),o(k,2*G+1,2*K+1)}function o(q,k,G){var K=q[k];q[k]=q[G],q[G]=K}function a(q,k,G,K,ce,Pe,Xe){for(var Je=[0,q.length-1,0],ft=[],Ge,et;Je.length;){var vt=Je.pop(),mt=Je.pop(),It=Je.pop();if(mt-It<=Xe){for(var wt=It;wt<=mt;wt++)Ge=k[2*wt],et=k[2*wt+1],Ge>=G&&Ge<=ce&&et>=K&&et<=Pe&&ft.push(q[wt]);continue}var gt=Math.floor((It+mt)/2);Ge=k[2*gt],et=k[2*gt+1],Ge>=G&&Ge<=ce&&et>=K&&et<=Pe&&ft.push(q[gt]);var xr=(vt+1)%2;(vt===0?G<=Ge:K<=et)&&(Je.push(It),Je.push(gt-1),Je.push(xr)),(vt===0?ce>=Ge:Pe>=et)&&(Je.push(gt+1),Je.push(mt),Je.push(xr))}return ft}function s(q,k,G,K,ce,Pe){for(var Xe=[0,q.length-1,0],Je=[],ft=ce*ce;Xe.length;){var Ge=Xe.pop(),et=Xe.pop(),vt=Xe.pop();if(et-vt<=Pe){for(var mt=vt;mt<=et;mt++)u(k[2*mt],k[2*mt+1],G,K)<=ft&&Je.push(q[mt]);continue}var It=Math.floor((vt+et)/2),wt=k[2*It],gt=k[2*It+1];u(wt,gt,G,K)<=ft&&Je.push(q[It]);var xr=(Ge+1)%2;(Ge===0?G-ce<=wt:K-ce<=gt)&&(Xe.push(vt),Xe.push(It-1),Xe.push(xr)),(Ge===0?G+ce>=wt:K+ce>=gt)&&(Xe.push(It+1),Xe.push(et),Xe.push(xr))}return Je}function u(q,k,G,K){var ce=q-G,Pe=k-K;return ce*ce+Pe*Pe}var l=function(q){return q[0]},f=function(q){return q[1]},c=function(k,G,K,ce,Pe){G===void 0&&(G=l),K===void 0&&(K=f),ce===void 0&&(ce=64),Pe===void 0&&(Pe=Float64Array),this.nodeSize=ce,this.points=k;for(var Xe=k.length<65536?Uint16Array:Uint32Array,Je=this.ids=new Xe(k.length),ft=this.coords=new Pe(k.length*2),Ge=0;Ge<k.length;Ge++)Je[Ge]=Ge,ft[2*Ge]=G(k[Ge]),ft[2*Ge+1]=K(k[Ge]);r(Je,ft,ce,0,Je.length-1,0)};c.prototype.range=function(k,G,K,ce){return a(this.ids,this.coords,k,G,K,ce,this.nodeSize)},c.prototype.within=function(k,G,K){return s(this.ids,this.coords,k,G,K,this.nodeSize)};var h={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(q){return q}},d=Math.fround||function(q){return function(k){return q[0]=+k,q[0]}}(new Float32Array(1)),p=function(k){this.options=F(Object.create(h),k),this.trees=new Array(this.options.maxZoom+1)};p.prototype.load=function(k){var G=this.options,K=G.log,ce=G.minZoom,Pe=G.maxZoom,Xe=G.nodeSize;K&&console.time("total time");var Je="prepare "+k.length+" points";K&&console.time(Je),this.points=k;for(var ft=[],Ge=0;Ge<k.length;Ge++)k[Ge].geometry&&ft.push(g(k[Ge],Ge));this.trees[Pe+1]=new c(ft,Y,ge,Xe,Float32Array),K&&console.timeEnd(Je);for(var et=Pe;et>=ce;et--){var vt=+Date.now();ft=this._cluster(ft,et),this.trees[et]=new c(ft,Y,ge,Xe,Float32Array),K&&console.log("z%d: %d clusters in %dms",et,ft.length,+Date.now()-vt)}return K&&console.timeEnd("total time"),this},p.prototype.getClusters=function(k,G){var K=((k[0]+180)%360+360)%360-180,ce=Math.max(-90,Math.min(90,k[1])),Pe=k[2]===180?180:((k[2]+180)%360+360)%360-180,Xe=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)K=-180,Pe=180;else if(K>Pe){var Je=this.getClusters([K,ce,180,Xe],G),ft=this.getClusters([-180,ce,Pe,Xe],G);return Je.concat(ft)}for(var Ge=this.trees[this._limitZoom(G)],et=Ge.range(R(K),x(Xe),R(Pe),x(ce)),vt=[],mt=0,It=et;mt<It.length;mt+=1){var wt=It[mt],gt=Ge.points[wt];vt.push(gt.numPoints?y(gt):this.points[gt.index])}return vt},p.prototype.getChildren=function(k){var G=this._getOriginId(k),K=this._getOriginZoom(k),ce="No cluster with the specified id.",Pe=this.trees[K];if(!Pe)throw new Error(ce);var Xe=Pe.points[G];if(!Xe)throw new Error(ce);for(var Je=this.options.radius/(this.options.extent*Math.pow(2,K-1)),ft=Pe.within(Xe.x,Xe.y,Je),Ge=[],et=0,vt=ft;et<vt.length;et+=1){var mt=vt[et],It=Pe.points[mt];It.parentId===k&&Ge.push(It.numPoints?y(It):this.points[It.index])}if(Ge.length===0)throw new Error(ce);return Ge},p.prototype.getLeaves=function(k,G,K){G=G||10,K=K||0;var ce=[];return this._appendLeaves(ce,k,G,K,0),ce},p.prototype.getTile=function(k,G,K){var ce=this.trees[this._limitZoom(k)],Pe=Math.pow(2,k),Xe=this.options,Je=Xe.extent,ft=Xe.radius,Ge=ft/Je,et=(K-Ge)/Pe,vt=(K+1+Ge)/Pe,mt={features:[]};return this._addTileFeatures(ce.range((G-Ge)/Pe,et,(G+1+Ge)/Pe,vt),ce.points,G,K,Pe,mt),G===0&&this._addTileFeatures(ce.range(1-Ge/Pe,et,1,vt),ce.points,Pe,K,Pe,mt),G===Pe-1&&this._addTileFeatures(ce.range(0,et,Ge/Pe,vt),ce.points,-1,K,Pe,mt),mt.features.length?mt:null},p.prototype.getClusterExpansionZoom=function(k){for(var G=this._getOriginZoom(k)-1;G<=this.options.maxZoom;){var K=this.getChildren(k);if(G++,K.length!==1)break;k=K[0].properties.cluster_id}return G},p.prototype._appendLeaves=function(k,G,K,ce,Pe){for(var Xe=this.getChildren(G),Je=0,ft=Xe;Je<ft.length;Je+=1){var Ge=ft[Je],et=Ge.properties;if(et&&et.cluster?Pe+et.point_count<=ce?Pe+=et.point_count:Pe=this._appendLeaves(k,et.cluster_id,K,ce,Pe):Pe<ce?Pe++:k.push(Ge),k.length===K)break}return Pe},p.prototype._addTileFeatures=function(k,G,K,ce,Pe,Xe){for(var Je=0,ft=k;Je<ft.length;Je+=1){var Ge=ft[Je],et=G[Ge],vt=et.numPoints,mt=void 0,It=void 0,wt=void 0;if(vt)mt=S(et),It=et.x,wt=et.y;else{var gt=this.points[et.index];mt=gt.properties,It=R(gt.geometry.coordinates[0]),wt=x(gt.geometry.coordinates[1])}var xr={type:1,geometry:[[Math.round(this.options.extent*(It*Pe-K)),Math.round(this.options.extent*(wt*Pe-ce))]],tags:mt},Gt=void 0;vt?Gt=et.id:this.options.generateId?Gt=et.index:this.points[et.index].id&&(Gt=this.points[et.index].id),Gt!==void 0&&(xr.id=Gt),Xe.features.push(xr)}},p.prototype._limitZoom=function(k){return Math.max(this.options.minZoom,Math.min(Math.floor(+k),this.options.maxZoom+1))},p.prototype._cluster=function(k,G){for(var K=[],ce=this.options,Pe=ce.radius,Xe=ce.extent,Je=ce.reduce,ft=ce.minPoints,Ge=Pe/(Xe*Math.pow(2,G)),et=0;et<k.length;et++){var vt=k[et];if(!(vt.zoom<=G)){vt.zoom=G;for(var mt=this.trees[G+1],It=mt.within(vt.x,vt.y,Ge),wt=vt.numPoints||1,gt=wt,xr=0,Gt=It;xr<Gt.length;xr+=1){var Xr=Gt[xr],le=mt.points[Xr];le.zoom>G&&(gt+=le.numPoints||1)}if(gt>wt&&gt>=ft){for(var ze=vt.x*wt,nt=vt.y*wt,Ae=Je&&wt>1?this._map(vt,!0):null,Dt=(et<<5)+(G+1)+this.points.length,Et=0,zt=It;Et<zt.length;Et+=1){var Rt=zt[Et],ut=mt.points[Rt];if(!(ut.zoom<=G)){ut.zoom=G;var Ut=ut.numPoints||1;ze+=ut.x*Ut,nt+=ut.y*Ut,ut.parentId=Dt,Je&&(Ae||(Ae=this._map(vt,!0)),Je(Ae,this._map(ut)))}}vt.parentId=Dt,K.push(v(ze/gt,nt/gt,Dt,gt,Ae))}else if(K.push(vt),gt>1)for(var $r=0,dr=It;$r<dr.length;$r+=1){var Jt=dr[$r],nn=mt.points[Jt];nn.zoom<=G||(nn.zoom=G,K.push(nn))}}}return K},p.prototype._getOriginId=function(k){return k-this.points.length>>5},p.prototype._getOriginZoom=function(k){return(k-this.points.length)%32},p.prototype._map=function(k,G){if(k.numPoints)return G?F({},k.properties):k.properties;var K=this.points[k.index].properties,ce=this.options.map(K);return G&&ce===K?F({},ce):ce};function v(q,k,G,K,ce){return{x:d(q),y:d(k),zoom:1/0,id:G,parentId:-1,numPoints:K,properties:ce}}function g(q,k){var G=q.geometry.coordinates,K=G[0],ce=G[1];return{x:d(R(K)),y:d(x(ce)),zoom:1/0,index:k,parentId:-1}}function y(q){return{type:"Feature",id:q.id,properties:S(q),geometry:{type:"Point",coordinates:[M(q.x),$(q.y)]}}}function S(q){var k=q.numPoints,G=k>=1e4?Math.round(k/1e3)+"k":k>=1e3?Math.round(k/100)/10+"k":k;return F(F({},q.properties),{cluster:!0,cluster_id:q.id,point_count:k,point_count_abbreviated:G})}function R(q){return q/360+.5}function x(q){var k=Math.sin(q*Math.PI/180),G=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return G<0?0:G>1?1:G}function M(q){return(q-.5)*360}function $(q){var k=(180-q*360)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function F(q,k){for(var G in k)q[G]=k[G];return q}function Y(q){return q.x}function ge(q){return q.y}return p})})($A);var qV=$A.exports;const KV=Ht(qV);var QV=Object.defineProperty,Wg=Object.getOwnPropertySymbols,JV=Object.prototype.hasOwnProperty,eH=Object.prototype.propertyIsEnumerable,Gg=(e,t,r)=>t in e?QV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zA=(e,t)=>{for(var r in t||(t={}))JV.call(t,r)&&Gg(e,r,t[r]);if(Wg)for(var r of Wg(t))eH.call(t,r)&&Gg(e,r,t[r]);return e};function VA(e,t){const{radius:r=40,maxZoom:n=18,minZoom:i=0,zoom:o=2}=t;if(e.pointIndex){const u=e.pointIndex.getClusters(e.extent,Math.floor(o));return e.dataArray=tH(u),e}const a=new KV({radius:r,minZoom:i,maxZoom:n}),s={type:"FeatureCollection",features:[]};return s.features=e.dataArray.map(u=>({type:"Feature",geometry:{type:"Point",coordinates:u.coordinates},properties:zA({},u)})),a.load(s.features),a}function tH(e){return e.map((t,r)=>zA({coordinates:t.geometry.coordinates,_id:r+1},t.properties))}function rH(e){if(e.length===0)throw new Error("max requires at least one data point");let t=e[0];for(let r=1;r<e.length;r++)e[r]>t&&(t=e[r]);return t}function nH(e){if(e.length===0)throw new Error("min requires at least one data point");let t=e[0];for(let r=1;r<e.length;r++)e[r]<t&&(t=e[r]);return t}function HA(e){if(e.length===0)return 0;let t=e[0],r=0,n;for(let i=1;i<e.length;i++)n=t+e[i]*1,Math.abs(t)>=Math.abs(e[i])?r+=t-n+e[i]:r+=e[i]-n+t,t=n;return t+r*1}function iH(e){if(e.length===0)throw new Error("mean requires at least one data point");return HA(e)/e.length}var oH={min:nH,max:rH,mean:iH,sum:HA},aH=Object.defineProperty,Yg=Object.getOwnPropertySymbols,sH=Object.prototype.hasOwnProperty,uH=Object.prototype.propertyIsEnumerable,Zg=(e,t,r)=>t in e?aH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ms=(e,t)=>{for(var r in t||(t={}))sH.call(t,r)&&Zg(e,r,t[r]);if(Yg)for(var r of Yg(t))uH.call(t,r)&&Zg(e,r,t[r]);return e},qg=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),{cloneDeep:lH,isFunction:Kg,isString:cH,mergeWith:fH}=Sr;function hH(e,t){if(Array.isArray(t))return t}var dH=class extends Bn.EventEmitter{constructor(e,t){super(),this.type="source",this.isTile=!1,this.inited=!1,this.hooks={init:new ni},this.parser={type:"geojson"},this.transforms=[],this.cluster=!1,this.clusterOptions={enable:!1,radius:40,maxZoom:20,zoom:-99,method:"count"},this.invalidExtent=!1,this.dataArrayChanged=!1,this.cfg={autoRender:!0},this.originData=e,this.initCfg(t),this.init().then(()=>{this.inited=!0,this.emit("update",{type:"inited"})})}getSourceCfg(){return this.cfg}getClusters(e){return this.clusterIndex.getClusters(this.caculClusterExtent(2),e)}getClustersLeaves(e){return this.clusterIndex.getLeaves(e,1/0)}getParserType(){return this.parser.type}updateClusterData(e){const{method:t="sum",field:r}=this.clusterOptions;let n=this.clusterIndex.getClusters(this.caculClusterExtent(2),Math.floor(e));this.clusterOptions.zoom=e,n.forEach(i=>{i.id||(i.properties.point_count=1)}),(r||Kg(t))&&(n=n.map(i=>{const o=i.id;if(o){const s=this.clusterIndex.getLeaves(o,1/0).map(l=>l.properties);let u;if(cH(t)&&r){const l=$U(s,r);u=oH[t](l)}Kg(t)&&(u=t(s)),i.properties.stat=u}else i.properties.point_count=1;return i})),this.data=Jv("geojson")({type:"FeatureCollection",features:n}),this.executeTrans()}getFeatureById(e){const{type:t="geojson",geometry:r}=this.parser;if(t==="geojson"&&!this.cluster){const n=e<this.originData.features.length?this.originData.features[e]:"null",i=lH(n);if(i!=null&&i.properties&&(this.transforms.length!==0||this.dataArrayChanged)){const o=this.data.dataArray.find(a=>a._id===e);i.properties=o}return i}else return t==="json"&&r?this.data.dataArray.find(n=>n._id===e):e<this.data.dataArray.length?this.data.dataArray[e]:"null"}updateFeaturePropertiesById(e,t){this.data.dataArray=this.data.dataArray.map(r=>r._id===e?Ms(Ms({},r),t):r),this.dataArrayChanged=!0,this.emit("update",{type:"update"})}getFeatureId(e,t){const r=this.data.dataArray.find(n=>n[e]===t);return r==null?void 0:r._id}setData(e,t){this.originData=e,this.dataArrayChanged=!1,this.initCfg(t),this.init().then(()=>{this.emit("update",{type:"update"})})}reloadAllTile(){var e;(e=this.tileset)==null||e.reloadAll()}reloadTilebyId(e,t,r){var n;(n=this.tileset)==null||n.reloadTileById(e,t,r)}reloadTileByLnglat(e,t,r){var n;(n=this.tileset)==null||n.reloadTileByLnglat(e,t,r)}getTileExtent(e,t){var r;return(r=this.tileset)==null?void 0:r.getTileExtent(e,t)}getTileByZXY(e,t,r){var n;return(n=this.tileset)==null?void 0:n.getTileByZXY(e,t,r)}reloadTileByExtent(e,t){var r;(r=this.tileset)==null||r.reloadTileByExtent(e,t)}destroy(){var e;this.removeAllListeners(),this.originData=null,this.clusterIndex=null,this.data=null,(e=this.tileset)==null||e.destroy()}processData(){return qg(this,null,function*(){return new Promise((e,t)=>{try{this.excuteParser(),this.initCluster(),this.executeTrans(),e({})}catch(r){t(r)}})})}initCfg(e){this.cfg=fH(this.cfg,e,hH);const t=this.cfg;t&&(t.parser&&(this.parser=t.parser),t.transforms&&(this.transforms=t.transforms),this.cluster=t.cluster||!1,t.clusterOptions&&(this.cluster=!0,this.clusterOptions=Ms(Ms({},this.clusterOptions),t.clusterOptions)))}init(){return qg(this,null,function*(){this.inited=!1,yield this.processData(),this.inited=!0})}excuteParser(){const e=this.parser,t=e.type||"geojson",r=Jv(t);this.data=r(this.originData,e),this.tileset=this.initTileset(),!e.cancelExtent&&(this.extent=tU(this.data.dataArray),this.setCenter(this.extent),this.invalidExtent=this.extent[0]===this.extent[2]||this.extent[1]===this.extent[3])}setCenter(e){this.center=[(e[0]+e[2])/2,(e[1]+e[3])/2],(isNaN(this.center[0])||isNaN(this.center[1]))&&(this.center=[108.92361111111111,34.54083333333333])}initTileset(){const{tilesetOptions:e}=this.data;return e?(this.isTile=!0,this.tileset?(this.tileset.updateOptions(e),this.tileset):new BU(Ms({},e))):void 0}executeTrans(){this.transforms.forEach(t=>{const{type:r}=t,n=jR(r)(this.data,t);Object.assign(this.data,n)})}initCluster(){if(!this.cluster)return;const e=this.clusterOptions||{};this.clusterIndex=VA(this.data,e)}caculClusterExtent(e){let t=[[-1/0,-1/0],[1/0,1/0]];return this.invalidExtent||(t=Lp(dc(this.extent),e)),t[0].concat(t[1])}};function pH(e,t){const{callback:r}=t;return r&&(e.dataArray=e.dataArray.filter(r)),e}var Xp=6378e3;function _H(e,t){const r=e.dataArray,{size:n=10}=t,i=n/(2*Math.PI*Xp)*(256<<20)/2,{gridHash:o,gridOffset:a}=vH(r,n),s=yH(o,a,t);return{yOffset:i,xOffset:i,radius:i,type:"grid",dataArray:s}}function vH(e,t){let r=1/0,n=-1/0,i;for(const u of e)i=u.coordinates[1],Number.isFinite(i)&&(r=i<r?i:r,n=i>n?i:n);const o=(r+n)/2,a=mH(t,o);if(a.xOffset<=0||a.yOffset<=0)return{gridHash:{},gridOffset:a};const s={};for(const u of e){const l=u.coordinates[1],f=u.coordinates[0];if(Number.isFinite(l)&&Number.isFinite(f)){const c=Math.floor((l+90)/a.yOffset),h=Math.floor((f+180)/a.xOffset),d=`${c}-${h}`;s[d]=s[d]||{count:0,points:[]},s[d].count+=1,s[d].points.push(u)}}return{gridHash:s,gridOffset:a}}function mH(e,t){const r=gH(e),n=EH(t,e);return{yOffset:r,xOffset:n}}function gH(e){return e/Xp*(180/Math.PI)}function EH(e,t){return t/Xp*(180/Math.PI)/Math.cos(e*Math.PI/180)}function yH(e,t,r){return Object.keys(e).reduce((n,i,o)=>{const a=i.split("-"),s=parseInt(a[0],10),u=parseInt(a[1],10),l={};if(r.field&&r.method){const f=VT(e[i].points,r.field);l[r.method]=zT[r.method](f)}return Object.assign(l,{_id:o,coordinates:Pn([-180+t.xOffset*(u+.5),-90+t.yOffset*(s+.5)]),rawData:e[i].points,count:e[i].count}),n.push(l),n},[])}var ma=Math.PI/3,TH=[0,ma,2*ma,3*ma,4*ma,5*ma];function AH(e){return e[0]}function SH(e){return e[1]}function xH(){var e=0,t=0,r=1,n=1,i=AH,o=SH,a,s,u;function l(c){var h={},d=[],p,v=c.length;for(p=0;p<v;++p)if(!(isNaN(y=+i.call(null,g=c[p],p,c))||isNaN(S=+o.call(null,g,p,c)))){var g,y,S,R=Math.round(S=S/u),x=Math.round(y=y/s-(R&1)/2),M=S-R;if(Math.abs(M)*3>1){var $=y-x,F=x+(y<x?-1:1)/2,Y=R+(S<R?-1:1),ge=y-F,q=S-Y;$*$+M*M>ge*ge+q*q&&(x=F+(R&1?1:-1)/2,R=Y)}var k=x+"-"+R,G=h[k];G?G.push(g):(d.push(G=h[k]=[g]),G.x=(x+(R&1)/2)*s,G.y=R*u)}return d}function f(c){var h=0,d=0;return TH.map(function(p){var v=Math.sin(p)*c,g=-Math.cos(p)*c,y=v-h,S=g-d;return h=v,d=g,[y,S]})}return l.hexagon=function(c){return"m"+f(c==null?a:+c).join("l")+"z"},l.centers=function(){for(var c=[],h=Math.round(t/u),d=Math.round(e/s),p=h*u;p<n+a;p+=u,++h)for(var v=d*s+(h&1)*s/2;v<r+s/2;v+=s)c.push([v,p]);return c},l.mesh=function(){var c=f(a).slice(0,4).join("l");return l.centers().map(function(h){return"M"+h+"m"+c}).join("")},l.x=function(c){return arguments.length?(i=c,l):i},l.y=function(c){return arguments.length?(o=c,l):o},l.radius=function(c){return arguments.length?(a=+c,s=a*2*Math.sin(ma),u=a*1.5,l):a},l.size=function(c){return arguments.length?(e=t=0,r=+c[0],n=+c[1],l):[r-e,n-t]},l.extent=function(c){return arguments.length?(e=+c[0][0],t=+c[0][1],r=+c[1][0],n=+c[1][1],l):[[e,t],[r,n]]},l.radius(1)}var bH=Object.defineProperty,RH=Object.defineProperties,CH=Object.getOwnPropertyDescriptors,Qg=Object.getOwnPropertySymbols,OH=Object.prototype.hasOwnProperty,IH=Object.prototype.propertyIsEnumerable,Jg=(e,t,r)=>t in e?bH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,MH=(e,t)=>{for(var r in t||(t={}))OH.call(t,r)&&Jg(e,r,t[r]);if(Qg)for(var r of Qg(t))IH.call(t,r)&&Jg(e,r,t[r]);return e},NH=(e,t)=>RH(e,CH(t)),PH=6378e3;function LH(e,t){const r=e.dataArray,{size:n=10,method:i="sum"}=t,o=n/(2*Math.PI*PH)*(256<<20)/2,a=r.map(f=>{const[c,h]=Pn(f.coordinates);return NH(MH({},f),{coordinates:[c,h]})});return{dataArray:xH().radius(o).x(f=>f.coordinates[0]).y(f=>f.coordinates[1])(a).map((f,c)=>{if(t.field&&i){const h=VT(f,t.field);f[i]=zT[i](h)}return{[t.method]:f[i],count:f.length,rawData:f,coordinates:[f.x,f.y],_id:c}}),radius:o,xOffset:o,yOffset:o,type:"hexagon"}}var wH=Object.defineProperty,eE=Object.getOwnPropertySymbols,FH=Object.prototype.hasOwnProperty,BH=Object.prototype.propertyIsEnumerable,tE=(e,t,r)=>t in e?wH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rE=(e,t)=>{for(var r in t||(t={}))FH.call(t,r)&&tE(e,r,t[r]);if(eE)for(var r of eE(t))BH.call(t,r)&&tE(e,r,t[r]);return e};function DH(e,t){const{sourceField:r,targetField:n,data:i}=t,o={};return i.forEach(a=>{o[a[r]]=a}),e.dataArray=e.dataArray.map(a=>{const s=a[n];return rE(rE({},a),o[s])}),e}function UH(e,t){const{callback:r}=t;return r&&(e.dataArray=e.dataArray.map(r)),e}Tn("rasterTile",gV);Tn("mvt",kk);Tn("geojsonvt",I8);Tn("testTile",ZV);Tn("geojson",r8);Tn("jsonTile",H8);Tn("image",JT);Tn("csv",WU);Tn("json",ZT);Tn("raster",Jk);Tn("rasterRgb",kV);Tn("rgb",PV);Tn("ndi",bV);ja("cluster",VA);ja("filter",pH);ja("join",DH);ja("map",UH);ja("grid",_H);ja("hexagon",LH);var kH=dH;window._iconfont_svg_string_3580659='<svg><symbol id="l7-icon-area1" viewBox="0 0 1024 1024"><path d="M796.444444 56.888889a113.777778 113.777778 0 0 1 43.064889 219.136l38.798223 466.261333a113.777778 113.777778 0 1 1-133.518223 145.237334H279.210667a113.777778 113.777778 0 1 1-60.302223-137.272889L697.856 227.555556A113.777778 113.777778 0 0 1 796.444444 56.888889z m56.888889 750.933333a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z m-682.666666 0a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z m577.592889-534.072889L269.198222 796.444444c4.152889 7.168 7.509333 14.791111 10.012445 22.812445h465.578666a114.119111 114.119111 0 0 1 65.479111-71.224889l-38.798222-466.261333a112.924444 112.924444 0 0 1-23.210666-7.964445zM796.444444 125.155556a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z" ></path></symbol><symbol id="l7-icon-area" viewBox="0 0 1024 1024"><path d="M796.444444 56.888889a113.777778 113.777778 0 0 1 43.008 219.136l38.855112 466.261333a113.777778 113.777778 0 0 1-16.497778 224.540445L853.333333 967.111111a113.777778 113.777778 0 0 1-108.544-79.644444H279.210667a113.834667 113.834667 0 0 1-100.067556 79.36L170.666667 967.111111a113.777778 113.777778 0 0 1-17.066667-226.304l30.492444-351.175111a113.777778 113.777778 0 0 1 34.986667-218.680889L227.555556 170.666667a113.777778 113.777778 0 0 1 99.896888 59.221333l355.84-71.395556a113.777778 113.777778 0 0 1 104.675556-101.262222L796.444444 56.888889z m56.888889 750.933333a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z m-682.666666 0a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z m526.051555-582.314666L340.650667 296.903111a113.891556 113.891556 0 0 1-88.462223 98.645333l-30.947555 355.84c27.477333 13.653333 48.64 38.115556 58.026667 67.754667h465.521777a114.119111 114.119111 0 0 1 65.536-71.168l-38.855111-466.261333a113.948444 113.948444 0 0 1-74.752-56.206222zM227.555556 238.933333a45.511111 45.511111 0 1 0 0 91.022223 45.511111 45.511111 0 0 0 0-91.022223z m568.888888-113.777777a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z" ></path></symbol><symbol id="l7-icon-delete" viewBox="0 0 1024 1024"><path d="M705.422222 85.333333a34.133333 34.133333 0 0 1 34.133334 34.133334V227.555556h136.533333a34.133333 34.133333 0 0 1 0 68.266666h-25.543111l-24.348445 610.076445a34.133333 34.133333 0 0 1-34.133333 32.768H231.936a34.133333 34.133333 0 0 1-34.076444-32.768L173.340444 295.822222H147.911111a34.133333 34.133333 0 1 1 0-68.266666H284.444444V119.466667a34.133333 34.133333 0 0 1 34.133334-34.133334h386.844444zM241.720889 295.822222l22.983111 574.577778h494.535111l23.04-574.577778H241.720889zM671.288889 153.6H352.711111V227.555556h318.577778V153.6z" ></path></symbol><symbol id="l7-icon-color" viewBox="0 0 1024 1024"><path d="M512 56.888889c9.841778 0 19.626667 0.341333 29.354667 0.910222 69.176889 4.437333 119.068444 62.577778 124.302222 131.072l0.455111 9.386667c0.739556 44.600889 15.303111 84.935111 44.999111 114.631111 27.022222 27.022222 62.805333 41.528889 102.570667 44.430222l12.060444 0.568889c72.476444 1.194667 135.793778 52.451556 140.458667 124.757333 1.137778 18.261333 1.251556 36.807111 0.170667 55.637334-13.198222 233.585778-211.399111 424.220444-445.326223 428.714666L512 967.111111a455.111111 455.111111 0 0 1-455.054222-464.156444c4.551111-233.927111 195.185778-432.128 428.771555-445.326223C494.535111 57.116444 503.296 56.888889 512 56.888889z m0 68.266667a385.706667 385.706667 0 0 0-22.414222 0.625777C291.726222 136.988444 129.080889 305.948444 125.155556 504.263111c-4.152889 212.366222 163.100444 387.185778 372.508444 394.353778l13.425778 0.227555 8.533333-0.113777c198.371556-3.811556 367.331556-166.456889 378.538667-364.373334a396.174222 396.174222 0 0 0-0.170667-47.331555c-1.991111-31.232-29.127111-56.604444-67.128889-60.472889l-8.248889-0.455111-14.051555-0.682667c-56.547556-4.209778-107.406222-25.884444-145.806222-64.284444-38.855111-38.798222-60.416-90.225778-64.284445-145.749334l-0.910222-21.333333c-2.901333-38.001778-28.785778-66.048-60.302222-68.096A433.891556 433.891556 0 0 0 512 125.155556zM438.044444 682.666667a68.266667 68.266667 0 1 1 0 136.533333 68.266667 68.266667 0 0 1 0-136.533333z m-170.666666-227.555556a68.266667 68.266667 0 1 1 0 136.533333 68.266667 68.266667 0 0 1 0-136.533333z m142.222222-227.555555a68.266667 68.266667 0 1 1 0 136.533333 68.266667 68.266667 0 0 1 0-136.533333z" ></path></symbol><symbol id="l7-icon-base-map" viewBox="0 0 1024 1024"><path d="M923.761778 115.029333A34.133333 34.133333 0 0 1 967.111111 147.911111v624.128a34.133333 34.133333 0 0 1-22.186667 32.028445l-278.755555 103.992888a34.133333 34.133333 0 0 1-23.665778 0.056889L381.724444 812.714667a34.133333 34.133333 0 0 0-23.665777 0.113777L102.968889 908.060444a34.133333 34.133333 0 0 1-45.738667-26.965333L56.888889 876.088889V251.960889a34.133333 34.133333 0 0 1 22.186667-32.028445l278.755555-103.992888a34.133333 34.133333 0 0 1 20.992-0.967112l266.183111 72.988445a34.133333 34.133333 0 0 0 18.204445 0zM403.911111 192.625778v555.576889l216.177778 79.075555V251.960889l-216.177778-59.335111z m-68.266667 4.380444L125.155556 275.569778v551.310222l210.432-78.506667V197.006222zM898.844444 192.853333l-210.545777 58.936889v575.089778l210.545777-78.563556V192.853333z" ></path></symbol><symbol id="l7-icon-dot" viewBox="0 0 1024 1024"><path d="M341.333333 739.555556a113.777778 113.777778 0 0 1 8.533334 227.271111L341.333333 967.111111a113.777778 113.777778 0 0 1-8.533333-227.271111L341.333333 739.555556z m0 68.266666a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222zM910.222222 341.333333a113.777778 113.777778 0 0 1 8.533334 227.271111L910.222222 568.888889a113.777778 113.777778 0 0 1-8.533333-227.271111L910.222222 341.333333z m0 68.266667a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222zM227.555556 56.888889a113.777778 113.777778 0 0 1 8.533333 227.271111L227.555556 284.444444a113.777778 113.777778 0 0 1-8.533334-227.271111L227.555556 56.888889z m0 68.266667a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z" ></path></symbol><symbol id="l7-icon-display" viewBox="0 0 1024 1024"><path d="M512 170.666667c284.444444 0 455.111111 227.555556 455.111111 341.333333s-170.666667 341.333333-455.111111 341.333333-455.111111-227.555556-455.111111-341.333333 170.666667-341.333333 455.111111-341.333333z m0 68.266666C303.729778 238.933333 125.155556 401.237333 125.155556 512c0 110.762667 178.574222 273.066667 386.844444 273.066667s386.844444-162.304 386.844444-273.066667c0-110.762667-178.574222-273.066667-386.844444-273.066667zM512 341.333333a170.666667 170.666667 0 1 1 0 341.333334 170.666667 170.666667 0 0 1 0-341.333334z m0 68.266667a102.4 102.4 0 1 0 0 204.8 102.4 102.4 0 0 0 0-204.8z" ></path></symbol><symbol id="l7-icon-enlarge" viewBox="0 0 1024 1024"><path d="M546.133333 147.911111l-0.056889 329.955556H876.088889a34.133333 34.133333 0 0 1 0 68.266666H546.076444v329.955556a34.133333 34.133333 0 0 1-68.266666 0V546.133333H147.911111a34.133333 34.133333 0 1 1 0-68.266666h329.898667V147.911111a34.133333 34.133333 0 0 1 68.266666 0z" ></path></symbol><symbol id="l7-icon-export-picture" viewBox="0 0 1024 1024"><path d="M883.873684 161.684211a32.336842 32.336842 0 0 1 32.336842 32.336842v582.063158a32.336842 32.336842 0 0 1-32.336842 32.336842H86.231579a32.336842 32.336842 0 0 1-32.336842-32.336842V194.021053a32.336842 32.336842 0 0 1 32.336842-32.336842h797.642105z m-32.336842 64.673684H118.568421v517.389473h170.792421a32.175158 32.175158 0 0 1 0.431158-0.646736l3.772632-4.473264 330.320842-330.374736a32.336842 32.336842 0 0 1 38.588631-5.389474l4.473263 3.018105 184.589474 147.725474V226.357895z m-202.428631 248.131368L379.850105 743.747368H851.536842v-107.304421l-202.428631-161.953684zM323.368421 323.368421a107.789474 107.789474 0 1 1 0 215.578947 107.789474 107.789474 0 0 1 0-215.578947z m0 64.673684a43.115789 43.115789 0 1 0 0 86.231579 43.115789 43.115789 0 0 0 0-86.231579z" ></path></symbol><symbol id="l7-icon-exit-fullscreen" viewBox="0 0 1024 1024"><path d="M841.955556 591.644444a34.133333 34.133333 0 0 1 5.518222 67.811556l-5.518222 0.455111h-133.745778l192 192.056889a34.133333 34.133333 0 0 1-38.343111 55.182222l-5.176889-2.958222-4.721778-3.982222L659.911111 708.266667V841.955556a34.133333 34.133333 0 0 1-28.615111 33.678222L625.777778 876.088889a34.133333 34.133333 0 0 1-33.678222-28.615111L591.644444 841.955556V625.777778a34.133333 34.133333 0 0 1 28.615112-33.678222L625.777778 591.644444h216.177778z m-443.733334 0a34.133333 34.133333 0 0 1 33.678222 28.615112L432.355556 625.777778v216.177778a34.133333 34.133333 0 0 1-67.811556 5.518222L364.088889 841.955556v-133.745778l-192.056889 192a34.133333 34.133333 0 0 1-52.224-43.52l3.982222-4.721778L315.847111 659.911111H182.044444a34.133333 34.133333 0 0 1-33.678222-28.615111L147.911111 625.777778a34.133333 34.133333 0 0 1 28.615111-33.678222L182.044444 591.644444H398.222222zM167.310222 119.808l4.721778 3.982222L364.088889 315.847111V182.044444a34.133333 34.133333 0 0 1 28.615111-33.678222L398.222222 147.911111a34.133333 34.133333 0 0 1 33.678222 28.615111L432.355556 182.044444V398.222222a34.133333 34.133333 0 0 1-28.615112 33.678222L398.222222 432.355556H182.044444a34.133333 34.133333 0 0 1-5.518222-67.811556L182.044444 364.088889h133.802667L123.790222 172.032a34.133333 34.133333 0 0 1 43.52-52.224z m732.899556 3.982222a34.133333 34.133333 0 0 1 3.982222 43.52l-3.982222 4.721778L708.266667 364.088889H841.955556a34.133333 34.133333 0 0 1 33.678222 28.615111L876.088889 398.222222a34.133333 34.133333 0 0 1-28.615111 33.678222L841.955556 432.355556H625.777778a34.133333 34.133333 0 0 1-33.678222-28.615112L591.644444 398.222222V182.044444a34.133333 34.133333 0 0 1 67.811556-5.518222l0.455111 5.518222v133.802667l192.056889-192.056889a34.133333 34.133333 0 0 1 48.241778 0z" ></path></symbol><symbol id="l7-icon-line" viewBox="0 0 1024 1024"><path d="M853.333333 56.888889a113.777778 113.777778 0 0 1 8.533334 227.271111L853.333333 284.444444c-19.000889 0-36.864-4.664889-52.622222-12.856888l-529.123555 529.066666a113.777778 113.777778 0 0 1-92.387556 166.115556L170.666667 967.111111a113.777778 113.777778 0 0 1-8.533334-227.271111L170.666667 739.555556c19.000889 0 36.864 4.664889 52.622222 12.856888l529.123555-529.066666a113.777778 113.777778 0 0 1 92.387556-166.115556L853.333333 56.888889zM170.666667 807.822222a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z m682.666666-682.666666a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z" ></path></symbol><symbol id="l7-icon-layer" viewBox="0 0 1024 1024"><path d="M767.089778 625.777778l180.167111 82.773333a34.133333 34.133333 0 0 1 4.892444 59.278222l-4.892444 2.730667-420.977778 193.422222a34.133333 34.133333 0 0 1-22.983111 1.991111l-5.575111-1.991111-420.977778-193.422222a34.133333 34.133333 0 0 1-4.892444-59.278222l4.892444-2.730667L256.853333 625.777778l81.749334 37.546666L172.771556 739.555556 512 895.374222 851.171556 739.555556l-165.831112-76.231112 81.749334-37.546666z m0-227.555556l180.167111 82.773334a34.133333 34.133333 0 0 1 4.892444 59.278222l-4.892444 2.730666-420.977778 193.422223a34.133333 34.133333 0 0 1-22.983111 1.991111l-5.575111-1.991111-420.977778-193.422223a34.133333 34.133333 0 0 1-4.892444-59.278222l4.892444-2.730666L256.853333 398.222222l81.749334 37.546667-165.831111 76.174222L512 667.818667l339.171556-155.875556-165.831112-76.174222L767.089778 398.222222zM497.720889 60.017778a34.133333 34.133333 0 0 1 28.558222 0l420.977778 193.422222a34.133333 34.133333 0 0 1 0 62.008889l-420.977778 193.422222a34.133333 34.133333 0 0 1-28.558222 0l-420.977778-193.422222a34.133333 34.133333 0 0 1 0-62.008889zM512 128.568889L172.771556 284.387556 512 440.263111l339.171556-155.875555L512 128.568889z" ></path></symbol><symbol id="l7-icon-narrow" viewBox="0 0 1024 1024"><path d="M910.222222 512a34.133333 34.133333 0 0 1-34.133333 34.133333H147.911111a34.133333 34.133333 0 1 1 0-68.266666h728.177778a34.133333 34.133333 0 0 1 34.133333 34.133333z" ></path></symbol><symbol id="l7-icon-fullscreen" viewBox="0 0 1024 1024"><path d="M645.176889 597.674667l4.721778 3.982222L841.955556 793.6l0.056888-133.688889a34.133333 34.133333 0 0 1 28.615112-33.678222L876.088889 625.777778a34.133333 34.133333 0 0 1 33.678222 28.615111L910.222222 659.911111v216.177778a34.133333 34.133333 0 0 1-28.615111 33.678222L876.088889 910.222222h-216.177778a34.133333 34.133333 0 0 1-5.518222-67.811555l5.518222-0.455111h133.745778l-192-192.056889a34.133333 34.133333 0 0 1 43.52-52.224z m-222.833778 3.982222a34.133333 34.133333 0 0 1 3.982222 43.52l-3.982222 4.721778L230.286222 841.955556H364.088889a34.133333 34.133333 0 0 1 33.678222 28.615111L398.222222 876.088889a34.133333 34.133333 0 0 1-28.615111 33.678222L364.088889 910.222222H147.911111a34.133333 34.133333 0 0 1-33.678222-28.615111L113.777778 876.088889v-216.177778a34.133333 34.133333 0 0 1 67.811555-5.518222l0.455111 5.518222-0.056888 133.745778 192.113777-192a34.133333 34.133333 0 0 1 48.241778 0zM364.088889 113.777778a34.133333 34.133333 0 0 1 5.518222 67.811555L364.088889 182.044444H230.343111l192 192.056889a34.133333 34.133333 0 0 1-43.52 52.224l-4.721778-3.982222-192.113777-192.056889L182.044444 364.088889a34.133333 34.133333 0 0 1-28.615111 33.678222L147.911111 398.222222a34.133333 34.133333 0 0 1-33.678222-28.615111L113.777778 364.088889V147.911111a34.133333 34.133333 0 0 1 28.615111-33.678222L147.911111 113.777778h216.177778z m512 0a34.133333 34.133333 0 0 1 33.678222 28.615111L910.222222 147.911111v216.177778a34.133333 34.133333 0 0 1-67.811555 5.518222L841.955556 364.088889l-0.056889-133.745778-192 192a34.133333 34.133333 0 0 1-52.224-43.52l3.982222-4.721778L793.6 182.044444H659.911111a34.133333 34.133333 0 0 1-33.678222-28.615111L625.777778 147.911111a34.133333 34.133333 0 0 1 28.615111-33.678222L659.911111 113.777778h216.177778z" ></path></symbol><symbol id="l7-icon-hide" viewBox="0 0 1024 1024"><path d="M875.52 87.836444a34.133333 34.133333 0 0 1 7.281778 43.121778l-3.527111 5.006222-682.666667 796.444445a34.133333 34.133333 0 0 1-55.409778-39.367111l3.527111-5.006222 97.166223-113.379556C123.164444 697.969778 56.888889 582.940444 56.888889 512c0-113.777778 170.666667-341.333333 455.111111-341.333333a496.64 496.64 0 0 1 208.952889 45.112889l106.439111-124.188445a34.133333 34.133333 0 0 1 48.128-3.754667z m-38.684444 202.524445C921.031111 362.951111 967.111111 452.835556 967.111111 512c0 113.777778-170.666667 341.333333-455.111111 341.333333-50.631111 0-97.678222-7.224889-140.8-19.740444l50.232889-58.595556A417.393778 417.393778 0 0 0 512 785.066667c208.270222 0 386.844444-162.304 386.844444-273.066667 0-52.849778-40.675556-117.418667-105.813333-170.496l43.804445-51.2zM512 238.933333C303.729778 238.933333 125.155556 401.237333 125.155556 512c0 66.787556 64.853333 152.291556 162.133333 209.692444L377.173333 616.675556a170.666667 170.666667 0 0 1 217.713778-253.895112l78.620445-91.704888A432.924444 432.924444 0 0 0 512 238.933333z m166.684444 236.088889a170.666667 170.666667 0 0 1-177.664 207.303111l177.607112-207.303111zM512 409.6a102.4 102.4 0 0 0-88.746667 153.486222L548.864 416.426667A102.172444 102.172444 0 0 0 512 409.6z" ></path></symbol><symbol id="l7-icon-rectangle" viewBox="0 0 1024 1024"><path d="M170.666667 56.888889a113.777778 113.777778 0 0 1 108.544 79.644444H853.333333a34.133333 34.133333 0 0 1 33.678223 28.615111L887.466667 170.666667v574.122666a113.777778 113.777778 0 1 1-142.677334 142.734223L170.666667 887.466667a34.133333 34.133333 0 0 1-33.678223-28.615111L136.533333 853.333333V279.210667A113.777778 113.777778 0 0 1 170.666667 56.888889z m682.666666 750.933333a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z m-34.133333-603.022222H279.210667a114.062222 114.062222 0 0 1-74.353778 74.410667L204.8 819.2h539.989333a114.062222 114.062222 0 0 1 74.410667-74.410667V204.8zM170.666667 125.155556a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z" ></path></symbol><symbol id="l7-icon-ranging" viewBox="0 0 1024 1024"><path d="M723.171556 50.403556l250.424888 250.424888a31.061333 31.061333 0 0 1 0 43.918223L344.746667 973.596444a31.061333 31.061333 0 0 1-43.918223 0L50.403556 723.171556a31.061333 31.061333 0 0 1 0-43.918223L679.253333 50.403556a31.061333 31.061333 0 0 1 43.918223 0z m-21.959112 74.524444l-39.765333 39.822222 98.986667 98.872889a34.133333 34.133333 0 0 1-44.088889 51.882667l-4.209778-3.640889-98.929778-98.929778-63.886222 63.886222 62.179556 62.122667a34.133333 34.133333 0 0 1-44.088889 51.882667L563.2 387.242667 501.077333 325.063111 437.191111 388.949333l98.986667 98.929778a34.133333 34.133333 0 0 1-44.088889 51.882667l-4.209778-3.640889-98.929778-98.929778-63.886222 63.886222L387.242667 563.2a34.133333 34.133333 0 0 1-44.088889 51.882667l-4.209778-3.584-62.122667-62.179556-63.886222 63.886222 98.986667 98.929778a34.133333 34.133333 0 0 1-44.088889 51.882667l-4.209778-3.640889-98.929778-98.929778-39.765333 39.822222 197.802667 197.745778 576.284444-576.284444-197.802667-197.745778z" ></path></symbol><symbol id="l7-icon-reposition" viewBox="0 0 1024 1024"><path d="M512 56.888889a34.133333 34.133333 0 0 1 34.133333 34.133333v24.177778A398.336 398.336 0 0 1 908.856889 477.866667h24.177778a34.133333 34.133333 0 0 1 0 68.266666h-24.177778A398.336 398.336 0 0 1 546.133333 908.856889L546.133333 932.977778a34.133333 34.133333 0 0 1-68.266666 0v-24.177778A398.336 398.336 0 0 1 115.2 546.133333L91.022222 546.133333a34.133333 34.133333 0 1 1 0-68.266666h24.177778A398.336 398.336 0 0 1 477.866667 115.2V91.022222A34.133333 34.133333 0 0 1 512 56.888889z m34.190222 126.862222L546.133333 193.422222a34.133333 34.133333 0 1 1-68.266666 0v-9.671111A330.069333 330.069333 0 0 0 183.751111 477.866667h9.671111a34.133333 34.133333 0 1 1 0 68.266666l-9.671111 0.056889A330.069333 330.069333 0 0 0 477.866667 840.248889V830.577778a34.133333 34.133333 0 0 1 68.266666 0l0.056889 9.671111A330.069333 330.069333 0 0 0 840.248889 546.133333L830.577778 546.133333a34.133333 34.133333 0 0 1 0-68.266666h9.671111A330.069333 330.069333 0 0 0 546.133333 183.751111zM512 341.333333a170.666667 170.666667 0 1 1 0 341.333334 170.666667 170.666667 0 0 1 0-341.333334z m0 68.266667a102.4 102.4 0 1 0 0 204.8 102.4 102.4 0 0 0 0-204.8z" ></path></symbol><symbol id="l7-icon-round" viewBox="0 0 1024 1024"><path d="M512 56.888889a455.111111 455.111111 0 0 1 391.395556 687.502222 113.777778 113.777778 0 0 1-159.061334 158.890667A455.111111 455.111111 0 0 1 120.604444 279.608889 113.777778 113.777778 0 0 1 279.608889 120.604444 452.835556 452.835556 0 0 1 512 56.888889z m0 68.266667a384.910222 384.910222 0 0 0-191.715556 50.744888A113.777778 113.777778 0 0 1 175.957333 320.284444a386.844444 386.844444 0 0 0 527.815111 527.758223 113.777778 113.777778 0 0 1 144.270223-144.440889A386.844444 386.844444 0 0 0 512 125.155556z m299.406222 640.739555a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222zM212.593778 167.082667a45.511111 45.511111 0 1 0 0 91.022222 45.511111 45.511111 0 0 0 0-91.022222z" ></path></symbol><symbol id="l7-icon-guanbi" viewBox="0 0 1024 1024"><path d="M576 512l277.333333 277.333333-64 64-277.333333-277.333333L234.666667 853.333333 170.666667 789.333333l277.333333-277.333333L170.666667 234.666667 234.666667 170.666667l277.333333 277.333333L789.333333 170.666667 853.333333 234.666667 576 512z" ></path></symbol></svg>',function(e){try{let l=function(){s||(s=!0,o())},f=function(){try{a.documentElement.doScroll("left")}catch{return void setTimeout(f,50)}l()};var r=(r=document.getElementsByTagName("script"))[r.length-1],t=r.getAttribute("data-injectcss"),r=r.getAttribute("data-disable-injectsvg");if(!r){var n,i,o,a,s,u=function(c,h){h.parentNode.insertBefore(c,h)};if(t&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch(c){console&&console.log(c)}}n=function(){var c,h=document.createElement("div");h.innerHTML=e._iconfont_svg_string_3580659,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(c=document.body).firstChild?u(h,c.firstChild):c.appendChild(h))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(n,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),n()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(o=n,a=e.document,s=!1,f(),a.onreadystatechange=function(){a.readyState=="complete"&&(a.onreadystatechange=null,l())})}}catch{}}(window);class Eu extends lp{constructor(t){super(),E(this,"controlOption",void 0),E(this,"container",void 0),E(this,"isShow",void 0),E(this,"sceneContainer",void 0),E(this,"scene",void 0),E(this,"mapsService",void 0),E(this,"renderService",void 0),E(this,"layerService",void 0),E(this,"controlService",void 0),E(this,"configService",void 0),Eu.controlCount++,this.controlOption=he(he({},this.getDefault(t)),t||{})}getOptions(){return this.controlOption}setOptions(t){const r=this.getDefault(t);Object.entries(t).forEach(([n,i])=>{i===void 0&&(t[n]=r[n])}),"position"in t&&this.setPosition(t.position),"className"in t&&this.setClassName(t.className),"style"in t&&this.setStyle(t.style),this.controlOption=he(he({},this.controlOption),t)}addTo(t){this.mapsService=t.mapService,this.renderService=t.rendererService,this.layerService=t.layerService,this.controlService=t.controlService,this.configService=t.globalConfigService,this.scene=t.sceneService,this.sceneContainer=t,this.isShow=!0,this.container=this.onAdd(),iu(this.container,"l7-control");const{className:r,style:n}=this.controlOption;return r&&this.setClassName(r),n&&this.setStyle(n),this.insertContainer(),this.emit("add",this),this}remove(){if(!this.mapsService)return this;hc(this.container),this.onRemove(),this.emit("remove",this)}onAdd(){return yn("div")}onRemove(){}show(){const t=this.container;_d(t,"l7-control--hide"),this.isShow=!0,this.emit("show",this)}hide(){const t=this.container;iu(t,"l7-control--hide"),this.isShow=!1,this.emit("hide",this)}getDefault(t){return{position:_c.TOPRIGHT,name:`${Eu.controlCount}`}}getContainer(){return this.container}getIsShow(){return this.isShow}_refocusOnMap(t){if(this.mapsService&&t&&t.screenX>0&&t.screenY>0){const r=this.mapsService.getContainer();r!==null&&r.focus()}}setPosition(t=_c.TOPLEFT){const r=this.controlService;return r&&r.removeControl(this),this.controlOption.position=t,r&&r.addControl(this,this.sceneContainer),this}setClassName(t){const r=this.container,{className:n}=this.controlOption;n&&_d(r,n),t&&iu(r,t)}setStyle(t){const r=this.container;t?r.setAttribute("style",t):r.removeAttribute("style")}insertContainer(){const t=this.controlOption.position,r=this.container;if(t instanceof Element)t.appendChild(r);else{const n=this.controlService.controlCorners[t];["bottomleft","bottomright","righttop","rightbottom"].includes(t)?n.insertBefore(r,n.firstChild):n.appendChild(r)}}checkUpdateOption(t,r){return r.some(n=>n in t)}}E(Eu,"controlCount",0);class bc extends Bn.EventEmitter{get buttonRect(){return this.button.getBoundingClientRect()}constructor(t,r){super(),E(this,"popperDOM",void 0),E(this,"contentDOM",void 0),E(this,"button",void 0),E(this,"option",void 0),E(this,"isShow",!1),E(this,"content",void 0),E(this,"timeout",null),E(this,"show",()=>this.isShow||!this.contentDOM.innerHTML?this:(this.resetPopperPosition(),_d(this.popperDOM,"l7-popper-hide"),this.isShow=!0,this.option.unique&&bc.conflictPopperList.forEach(n=>{n!==this&&n.isShow&&n.hide()}),this.emit("show"),window.addEventListener("pointerdown",this.onPopperUnClick),this)),E(this,"hide",()=>this.isShow?(iu(this.popperDOM,"l7-popper-hide"),this.isShow=!1,this.emit("hide"),window.removeEventListener("pointerdown",this.onPopperUnClick),this):this),E(this,"setHideTimeout",()=>{this.timeout||(this.timeout=window.setTimeout(()=>{this.isShow&&(this.hide(),this.timeout=null)},300))}),E(this,"clearHideTimeout",()=>{this.timeout&&(window.clearTimeout(this.timeout),this.timeout=null)}),E(this,"onBtnClick",()=>{this.isShow?this.hide():this.show()}),E(this,"onPopperUnClick",n=>{Q7(n.target,[".l7-button-control",".l7-popper-content"])||this.hide()}),E(this,"onBtnMouseLeave",()=>{this.setHideTimeout()}),E(this,"onBtnMouseMove",()=>{this.clearHideTimeout(),!this.isShow&&this.show()}),this.button=t,this.option=r,this.init(),r.unique&&bc.conflictPopperList.push(this)}getPopperDOM(){return this.popperDOM}getIsShow(){return this.isShow}getContent(){return this.content}setContent(t){typeof t=="string"?this.contentDOM.innerHTML=t:t instanceof HTMLElement&&(DT(this.contentDOM),this.contentDOM.appendChild(t)),this.content=t}init(){const{trigger:t}=this.option;this.popperDOM=this.createPopper(),t==="click"?this.button.addEventListener("click",this.onBtnClick):(this.button.addEventListener("mousemove",this.onBtnMouseMove),this.button.addEventListener("mouseleave",this.onBtnMouseLeave),this.popperDOM.addEventListener("mousemove",this.onBtnMouseMove),this.popperDOM.addEventListener("mouseleave",this.onBtnMouseLeave))}destroy(){this.button.removeEventListener("click",this.onBtnClick),this.button.removeEventListener("mousemove",this.onBtnMouseMove),this.button.removeEventListener("mousemove",this.onBtnMouseLeave),this.popperDOM.removeEventListener("mousemove",this.onBtnMouseMove),this.popperDOM.removeEventListener("mouseleave",this.onBtnMouseLeave),hc(this.popperDOM)}resetPopperPosition(){const t={},{container:r,offset:n=[0,0],placement:i}=this.option,[o,a]=n,s=this.button.getBoundingClientRect(),u=r.getBoundingClientRect(),{left:l,right:f,top:c,bottom:h}=q7(s,u);let d=!1,p=!1;/^(left|right)/.test(i)?(i.includes("left")?t.right=`${s.width+f}px`:i.includes("right")&&(t.left=`${s.width+l}px`),i.includes("start")?t.top=`${c}px`:i.includes("end")?t.bottom=`${h}px`:(t.top=`${c+s.height/2}px`,p=!0,t.transform=`translate(${o}px, calc(${a}px - 50%))`)):/^(top|bottom)/.test(i)&&(i.includes("top")?t.bottom=`${s.height+h}px`:i.includes("bottom")&&(t.top=`${s.height+c}px`),i.includes("start")?t.left=`${l}px`:i.includes("end")?t.right=`${f}px`:(t.left=`${l+s.width/2}px`,d=!0,t.transform=`translate(calc(${o}px - 50%), ${a}px)`)),t.transform=`translate(calc(${o}px - ${d?"50%":"0%"}), calc(${a}px - ${p?"50%":"0%"})`;const v=i.split("-");v.length&&iu(this.popperDOM,v.map(g=>`l7-popper-${g}`).join(" ")),Y7(this.popperDOM,Z7(t))}createPopper(){const{container:t,className:r="",content:n}=this.option,i=yn("div",`l7-popper l7-popper-hide ${r}`),o=yn("div","l7-popper-content"),a=yn("div","l7-popper-arrow");return i.appendChild(o),i.appendChild(a),t.appendChild(i),this.popperDOM=i,this.contentDOM=o,n&&this.setContent(n),i}}E(bc,"conflictPopperList",[]);const nE=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],gi=(()=>{if(typeof document>"u")return!1;const e=nE[0],t={};for(const r of nE)if((r==null?void 0:r[1])in document){for(const[i,o]of r.entries())t[e[i]]=o;return t}return!1})(),iE={change:gi.fullscreenchange,error:gi.fullscreenerror};let Mn={request(e=document.documentElement,t){return new Promise((r,n)=>{const i=()=>{Mn.off("change",i),r()};Mn.on("change",i);const o=e[gi.requestFullscreen](t);o instanceof Promise&&o.then(i).catch(n)})},exit(){return new Promise((e,t)=>{if(!Mn.isFullscreen){e();return}const r=()=>{Mn.off("change",r),e()};Mn.on("change",r);const n=document[gi.exitFullscreen]();n instanceof Promise&&n.then(r).catch(t)})},toggle(e,t){return Mn.isFullscreen?Mn.exit():Mn.request(e,t)},onchange(e){Mn.on("change",e)},onerror(e){Mn.on("error",e)},on(e,t){const r=iE[e];r&&document.addEventListener(r,t,!1)},off(e,t){const r=iE[e];r&&document.removeEventListener(r,t,!1)},raw:gi};Object.defineProperties(Mn,{isFullscreen:{get:()=>!!document[gi.fullscreenElement]},element:{enumerable:!0,get:()=>{var e;return(e=document[gi.fullscreenElement])!==null&&e!==void 0?e:void 0}},isEnabled:{enumerable:!0,get:()=>!!document[gi.fullscreenEnabled]}});gi||(Mn={isEnabled:!1});class $H extends Eu{getDefault(){return{position:_c.BOTTOMLEFT,name:"logo",href:"https://l7.antv.antgroup.com/",img:"https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*GRb1TKp4HcMAAAAAAAAAAAAAARQnAQ"}}onAdd(){const t=yn("div","l7-control-logo");return this.setLogoContent(t),t}onRemove(){return null}setOptions(t){super.setOptions(t),this.checkUpdateOption(t,["img","href"])&&(DT(this.container),this.setLogoContent(this.container))}setLogoContent(t){const{href:r,img:n}=this.controlOption,i=yn("img");if(i.setAttribute("src",n),i.setAttribute("aria-label","AntV logo"),K7(i),r){const o=yn("a","l7-control-logo-link");o.target="_blank",o.href=r,o.rel="noopener nofollow",o.setAttribute("rel","noopener nofollow"),o.appendChild(i),t.appendChild(o)}else t.appendChild(i)}}class zH{constructor(){E(this,"mapService",void 0),E(this,"fontService",void 0)}apply(t,{styleAttributeService:r,mapService:n,fontService:i}){var o=this;this.mapService=n,this.fontService=i,t.hooks.init.tapPromise("DataMappingPlugin",ve(function*(){t.log(Fr.MappingStart,jr.INIT),o.generateMaping(t,{styleAttributeService:r}),t.log(Fr.MappingEnd,jr.INIT)})),t.hooks.beforeRenderData.tapPromise("DataMappingPlugin",function(){var a=ve(function*(s){if(!s)return s;t.dataState.dataMappingNeedUpdate=!1,t.log(Fr.MappingStart,jr.UPDATE);const u=o.generateMaping(t,{styleAttributeService:r});return t.log(Fr.MappingEnd,jr.UPDATE),u});return function(s){return a.apply(this,arguments)}}()),t.hooks.beforeRender.tap("DataMappingPlugin",()=>{const a=t.getSource();if(t.layerModelNeedUpdate||!a||!a.inited)return;const s=r.getLayerStyleAttributes()||[],u=r.getLayerStyleAttribute("filter"),{dataArray:l}=a.data;if(Array.isArray(l)&&l.length===0)return;const f=s.filter(h=>h.needRemapping);let c=l;if(u!=null&&u.needRemapping&&u!==null&&u!==void 0&&u.scale&&(c=l.filter(h=>this.applyAttributeMapping(u,h)[0])),f.length){const h=this.mapping(t,f,c,t.getEncodedData());t.setEncodedData(h)}})}generateMaping(t,{styleAttributeService:r}){const n=r.getLayerStyleAttributes()||[],i=r.getLayerStyleAttribute("filter"),{dataArray:o}=t.getSource().data;let a=o;i!=null&&i.scale&&(a=o.filter(u=>this.applyAttributeMapping(i,u)[0])),a=t.processData(a);const s=this.mapping(t,n,a,void 0);return t.setEncodedData(s),t.emit("dataUpdate",null),!0}mapping(t,r,n,i){const o=r.filter(s=>s.scale!==void 0).filter(s=>s.name!=="filter"),a=n.map((s,u)=>{const l=i?i[u]:{},f=he({id:s._id,coordinates:s.coordinates},l);return o.forEach(c=>{let h=this.applyAttributeMapping(c,s);(c.name==="color"||c.name==="stroke")&&(h=h.map(d=>Zt(d))),f[c.name]=Array.isArray(h)&&h.length===1?h[0]:h,c.name==="shape"&&(f.shape=this.fontService.getIconFontKey(f[c.name]))}),f});return r.forEach(s=>{s.needRemapping=!1}),this.adjustData2SimpleCoordinates(a),a}adjustData2SimpleCoordinates(t){t.length>0&&this.mapService.version==="SIMPLE"&&t.map(r=>{r.simpleCoordinate||(r.coordinates=this.unProjectCoordinates(r.coordinates),r.simpleCoordinate=!0)})}unProjectCoordinates(t){if(typeof t[0]=="number")return this.mapService.simpleMapCoord.unproject(t);if(t[0]&&t[0][0]instanceof Array){const r=[];return t.map(n=>{const i=[];n.map(o=>{i.push(this.mapService.simpleMapCoord.unproject(o))}),r.push(i)}),r}else{const r=[];return t.map(n=>{r.push(this.mapService.simpleMapCoord.unproject(n))}),r}}applyAttributeMapping(t,r){var n;if(!t.scale)return[];const i=(t==null||(n=t.scale)===null||n===void 0?void 0:n.scalers)||[],o=[];return i.forEach(({field:s})=>{var u;(r.hasOwnProperty(s)||((u=t.scale)===null||u===void 0?void 0:u.type)==="variable")&&o.push(r[s])}),t.mapping?t.mapping(o):[]}getArrowPoints(t,r){const n=[r[0]-t[0],r[1]-t[1]],i=oU(n);return[t[0]+i[0]*1e-4,t[1]+i[1]*1e-4]}}class VH{constructor(){E(this,"mapService",void 0)}apply(t){var r=this;this.mapService=t.getContainer().mapService,t.hooks.init.tapPromise("DataSourcePlugin",ve(function*(){t.log(Fr.SourceInitStart,jr.INIT);let n=t.getSource();if(!n){const{data:i,options:o}=t.sourceOption||t.defaultSourceConfig;n=new kH(i,o),t.setSource(n)}n.inited?(r.updateClusterData(t),t.log(Fr.SourceInitEnd,jr.INIT)):yield new Promise(i=>{n.on("update",o=>{o.type==="inited"&&(r.updateClusterData(t),t.log(Fr.SourceInitEnd,jr.INIT)),i(null)})})})),t.hooks.beforeRenderData.tapPromise("DataSourcePlugin",ve(function*(){const n=r.updateClusterData(t),i=t.dataState.dataSourceNeedUpdate;return t.dataState.dataSourceNeedUpdate=!1,n||i}))}updateClusterData(t){if(t.isTileLayer||t.tileLayer||!t.getSource())return!1;const r=t.getSource(),n=r.cluster,{zoom:i=0}=r.clusterOptions,o=this.mapService.getZoom()-1,a=t.dataState.dataSourceNeedUpdate;return n&&a&&r.updateClusterData(Math.floor(o)),n&&Math.abs(t.clusterZoom-o)>=1?(i!==Math.floor(o)&&r.updateClusterData(Math.floor(o)),t.clusterZoom=o,!0):!1}}function oE(e,t){let r,n;for(const i of e)i!=null&&(r===void 0?i>=i&&(r=n=i):(r>i&&(r=i),n<i&&(n=i)));return[r,n]}function HH(e,t,r,n,i){var o=e*e,a=o*e;return((1-3*e+3*o-a)*t+(4-6*o+3*a)*r+(1+3*e+3*o-3*a)*n+a*i)/6}function jH(e){var t=e.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),i=e[n],o=e[n+1],a=n>0?e[n-1]:2*i-o,s=n<t-1?e[n+2]:2*o-i;return HH((r-n/t)*t,a,i,o,s)}}function Wp(e){return function(){return e}}function XH(e,t){return function(r){return e+r*t}}function WH(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function GH(e){return(e=+e)==1?jA:function(t,r){return r-t?WH(t,r,e):Wp(isNaN(t)?r:t)}}function jA(e,t){var r=t-e;return r?XH(e,r):Wp(isNaN(e)?t:e)}const aE=function e(t){var r=GH(t);function n(i,o){var a=r((i=sc(i)).r,(o=sc(o)).r),s=r(i.g,o.g),u=r(i.b,o.b),l=jA(i.opacity,o.opacity);return function(f){return i.r=a(f),i.g=s(f),i.b=u(f),i.opacity=l(f),i+""}}return n.gamma=e,n}(1);function YH(e){return function(t){var r=t.length,n=new Array(r),i=new Array(r),o=new Array(r),a,s;for(a=0;a<r;++a)s=sc(t[a]),n[a]=s.r||0,i[a]=s.g||0,o[a]=s.b||0;return n=e(n),i=e(i),o=e(o),s.opacity=1,function(u){return s.r=n(u),s.g=i(u),s.b=o(u),s+""}}}var ZH=YH(jH);function qH(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(o){for(i=0;i<r;++i)n[i]=e[i]*(1-o)+t[i]*o;return n}}function KH(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function QH(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,i=new Array(n),o=new Array(r),a;for(a=0;a<n;++a)i[a]=Gp(e[a],t[a]);for(;a<r;++a)o[a]=t[a];return function(s){for(a=0;a<n;++a)o[a]=i[a](s);return o}}function JH(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Rc(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function ej(e,t){var r={},n={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?r[i]=Gp(e[i],t[i]):n[i]=t[i];return function(o){for(i in r)n[i]=r[i](o);return n}}var $d=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Hh=new RegExp($d.source,"g");function tj(e){return function(){return e}}function rj(e){return function(t){return e(t)+""}}function nj(e,t){var r=$d.lastIndex=Hh.lastIndex=0,n,i,o,a=-1,s=[],u=[];for(e=e+"",t=t+"";(n=$d.exec(e))&&(i=Hh.exec(t));)(o=i.index)>r&&(o=t.slice(r,o),s[a]?s[a]+=o:s[++a]=o),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,u.push({i:a,x:Rc(n,i)})),r=Hh.lastIndex;return r<t.length&&(o=t.slice(r),s[a]?s[a]+=o:s[++a]=o),s.length<2?u[0]?rj(u[0].x):tj(t):(t=u.length,function(l){for(var f=0,c;f<t;++f)s[(c=u[f]).i]=c.x(l);return s.join("")})}function Gp(e,t){var r=typeof t,n;return t==null||r==="boolean"?Wp(t):(r==="number"?Rc:r==="string"?(n=Pa(t))?(t=n,aE):nj:t instanceof Pa?aE:t instanceof Date?JH:KH(t)?qH:Array.isArray(t)?QH:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ej:Rc)(e,t)}function ij(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function Yp(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function XA(e){return e.length===1&&(e=oj(e)),{left:function(t,r,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var o=n+i>>>1;e(t[o],r)<0?n=o+1:i=o}return n},right:function(t,r,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var o=n+i>>>1;e(t[o],r)>0?i=o:n=o+1}return n}}}function oj(e){return function(t,r){return Yp(e(t),r)}}var aj=XA(Yp),cf=aj.right;function sj(e){return e===null?NaN:+e}var zd=Math.sqrt(50),Vd=Math.sqrt(10),Hd=Math.sqrt(2);function WA(e,t,r){var n,i=-1,o,a,s;if(t=+t,e=+e,r=+r,e===t&&r>0)return[e];if((n=t<e)&&(o=e,e=t,t=o),(s=Jl(e,t,r))===0||!isFinite(s))return[];if(s>0)for(e=Math.ceil(e/s),t=Math.floor(t/s),a=new Array(o=Math.ceil(t-e+1));++i<o;)a[i]=(e+i)*s;else for(e=Math.floor(e*s),t=Math.ceil(t*s),a=new Array(o=Math.ceil(e-t+1));++i<o;)a[i]=(e-i)/s;return n&&a.reverse(),a}function Jl(e,t,r){var n=(t-e)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),o=n/Math.pow(10,i);return i>=0?(o>=zd?10:o>=Vd?5:o>=Hd?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=zd?10:o>=Vd?5:o>=Hd?2:1)}function jd(e,t,r){var n=Math.abs(t-e)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),o=n/i;return o>=zd?i*=10:o>=Vd?i*=5:o>=Hd&&(i*=2),t<e?-i:i}function uj(e,t,r){if(r==null&&(r=sj),!!(n=e.length)){if((t=+t)<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,o=Math.floor(i),a=+r(e[o],o,e),s=+r(e[o+1],o+1,e);return a+(s-a)*(i-o)}}function Zi(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function GA(e,t){switch(arguments.length){case 0:break;case 1:this.interpolator(e);break;default:this.interpolator(t).domain(e);break}return this}var In="$";function Cc(){}Cc.prototype=Oc.prototype={constructor:Cc,has:function(e){return In+e in this},get:function(e){return this[In+e]},set:function(e,t){return this[In+e]=t,this},remove:function(e){var t=In+e;return t in this&&delete this[t]},clear:function(){for(var e in this)e[0]===In&&delete this[e]},keys:function(){var e=[];for(var t in this)t[0]===In&&e.push(t.slice(1));return e},values:function(){var e=[];for(var t in this)t[0]===In&&e.push(this[t]);return e},entries:function(){var e=[];for(var t in this)t[0]===In&&e.push({key:t.slice(1),value:this[t]});return e},size:function(){var e=0;for(var t in this)t[0]===In&&++e;return e},empty:function(){for(var e in this)if(e[0]===In)return!1;return!0},each:function(e){for(var t in this)t[0]===In&&e(this[t],t.slice(1),this)}};function Oc(e,t){var r=new Cc;if(e instanceof Cc)e.each(function(s,u){r.set(u,s)});else if(Array.isArray(e)){var n=-1,i=e.length,o;if(t==null)for(;++n<i;)r.set(n,e[n]);else for(;++n<i;)r.set(t(o=e[n],n,e),o)}else if(e)for(var a in e)r.set(a,e[a]);return r}function sE(){}var ho=Oc.prototype;sE.prototype={constructor:sE,has:ho.has,add:function(e){return e+="",this[In+e]=e,this},remove:ho.remove,clear:ho.clear,values:ho.keys,size:ho.size,empty:ho.empty,each:ho.each};var YA=Array.prototype,ZA=YA.map,xo=YA.slice,uE={name:"implicit"};function Ic(){var e=Oc(),t=[],r=[],n=uE;function i(o){var a=o+"",s=e.get(a);if(!s){if(n!==uE)return n;e.set(a,s=t.push(o))}return r[(s-1)%r.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=Oc();for(var a=-1,s=o.length,u,l;++a<s;)e.has(l=(u=o[a])+"")||e.set(l,t.push(u));return i},i.range=function(o){return arguments.length?(r=xo.call(o),i):r.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return Ic(t,r).unknown(n)},Zi.apply(i,arguments),i}function lj(e){return function(){return e}}function cj(e){return+e}var lE=[0,1];function Zr(e){return e}function Xd(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:lj(isNaN(t)?NaN:.5)}function cE(e){var t=e[0],r=e[e.length-1],n;return t>r&&(n=t,t=r,r=n),function(i){return Math.max(t,Math.min(r,i))}}function fj(e,t,r){var n=e[0],i=e[1],o=t[0],a=t[1];return i<n?(n=Xd(i,n),o=r(a,o)):(n=Xd(n,i),o=r(o,a)),function(s){return o(n(s))}}function hj(e,t,r){var n=Math.min(e.length,t.length)-1,i=new Array(n),o=new Array(n),a=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++a<n;)i[a]=Xd(e[a],e[a+1]),o[a]=r(t[a],t[a+1]);return function(s){var u=cf(e,s,1,n)-1;return o[u](i[u](s))}}function ff(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Zp(){var e=lE,t=lE,r=Gp,n,i,o,a=Zr,s,u,l;function f(){return s=Math.min(e.length,t.length)>2?hj:fj,u=l=null,c}function c(h){return isNaN(h=+h)?o:(u||(u=s(e.map(n),t,r)))(n(a(h)))}return c.invert=function(h){return a(i((l||(l=s(t,e.map(n),Rc)))(h)))},c.domain=function(h){return arguments.length?(e=ZA.call(h,cj),a===Zr||(a=cE(e)),f()):e.slice()},c.range=function(h){return arguments.length?(t=xo.call(h),f()):t.slice()},c.rangeRound=function(h){return t=xo.call(h),r=ij,f()},c.clamp=function(h){return arguments.length?(a=h?cE(e):Zr,c):a!==Zr},c.interpolate=function(h){return arguments.length?(r=h,f()):r},c.unknown=function(h){return arguments.length?(o=h,c):o},function(h,d){return n=h,i=d,f()}}function qA(e,t){return Zp()(e,t)}function dj(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Mc(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Fa(e){return e=Mc(Math.abs(e)),e?e[1]:NaN}function pj(e,t){return function(r,n){for(var i=r.length,o=[],a=0,s=e[0],u=0;i>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),o.push(r.substring(i-=s,i+s)),!((u+=s+1)>n));)s=e[a=(a+1)%e.length];return o.reverse().join(t)}}function _j(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var vj=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Nc(e){if(!(t=vj.exec(e)))throw new Error("invalid format: "+e);var t;return new qp({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Nc.prototype=qp.prototype;function qp(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}qp.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function mj(e){e:for(var t=e.length,r=1,n=-1,i;r<t;++r)switch(e[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var KA;function gj(e,t){var r=Mc(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(KA=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=n.length;return o===a?n:o>a?n+new Array(o-a+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Mc(e,Math.max(0,t+o-1))[0]}function fE(e,t){var r=Mc(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const hE={"%":function(e,t){return(e*100).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:dj,e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return fE(e*100,t)},r:fE,s:gj,X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}};function dE(e){return e}var pE=Array.prototype.map,_E=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ej(e){var t=e.grouping===void 0||e.thousands===void 0?dE:pj(pE.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?dE:_j(pE.call(e.numerals,String)),a=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"-":e.minus+"",u=e.nan===void 0?"NaN":e.nan+"";function l(c){c=Nc(c);var h=c.fill,d=c.align,p=c.sign,v=c.symbol,g=c.zero,y=c.width,S=c.comma,R=c.precision,x=c.trim,M=c.type;M==="n"?(S=!0,M="g"):hE[M]||(R===void 0&&(R=12),x=!0,M="g"),(g||h==="0"&&d==="=")&&(g=!0,h="0",d="=");var $=v==="$"?r:v==="#"&&/[boxX]/.test(M)?"0"+M.toLowerCase():"",F=v==="$"?n:/[%p]/.test(M)?a:"",Y=hE[M],ge=/[defgprs%]/.test(M);R=R===void 0?6:/[gprs]/.test(M)?Math.max(1,Math.min(21,R)):Math.max(0,Math.min(20,R));function q(k){var G=$,K=F,ce,Pe,Xe;if(M==="c")K=Y(k)+K,k="";else{k=+k;var Je=k<0||1/k<0;if(k=isNaN(k)?u:Y(Math.abs(k),R),x&&(k=mj(k)),Je&&+k==0&&p!=="+"&&(Je=!1),G=(Je?p==="("?p:s:p==="-"||p==="("?"":p)+G,K=(M==="s"?_E[8+KA/3]:"")+K+(Je&&p==="("?")":""),ge){for(ce=-1,Pe=k.length;++ce<Pe;)if(Xe=k.charCodeAt(ce),48>Xe||Xe>57){K=(Xe===46?i+k.slice(ce+1):k.slice(ce))+K,k=k.slice(0,ce);break}}}S&&!g&&(k=t(k,1/0));var ft=G.length+k.length+K.length,Ge=ft<y?new Array(y-ft+1).join(h):"";switch(S&&g&&(k=t(Ge+k,Ge.length?y-K.length:1/0),Ge=""),d){case"<":k=G+k+K+Ge;break;case"=":k=G+Ge+k+K;break;case"^":k=Ge.slice(0,ft=Ge.length>>1)+G+k+K+Ge.slice(ft);break;default:k=Ge+G+k+K;break}return o(k)}return q.toString=function(){return c+""},q}function f(c,h){var d=l((c=Nc(c),c.type="f",c)),p=Math.max(-8,Math.min(8,Math.floor(Fa(h)/3)))*3,v=Math.pow(10,-p),g=_E[8+p/3];return function(y){return d(v*y)+g}}return{format:l,formatPrefix:f}}var Pl,Kp,QA;yj({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});function yj(e){return Pl=Ej(e),Kp=Pl.format,QA=Pl.formatPrefix,Pl}function Tj(e){return Math.max(0,-Fa(Math.abs(e)))}function Aj(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Fa(t)/3)))*3-Fa(Math.abs(e)))}function Sj(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Fa(t)-Fa(e))+1}function xj(e,t,r,n){var i=jd(e,t,r),o;switch(n=Nc(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=Aj(i,a))&&(n.precision=o),QA(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=Sj(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=Tj(i))&&(n.precision=o-(n.type==="%")*2);break}}return Kp(n)}function Du(e){var t=e.domain;return e.ticks=function(r){var n=t();return WA(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return xj(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,o=n.length-1,a=n[i],s=n[o],u;return s<a&&(u=a,a=s,s=u,u=i,i=o,o=u),u=Jl(a,s,r),u>0?(a=Math.floor(a/u)*u,s=Math.ceil(s/u)*u,u=Jl(a,s,r)):u<0&&(a=Math.ceil(a*u)/u,s=Math.floor(s*u)/u,u=Jl(a,s,r)),u>0?(n[i]=Math.floor(a/u)*u,n[o]=Math.ceil(s/u)*u,t(n)):u<0&&(n[i]=Math.ceil(a*u)/u,n[o]=Math.floor(s*u)/u,t(n)),e},e}function JA(){var e=qA(Zr,Zr);return e.copy=function(){return ff(e,JA())},Zi.apply(e,arguments),Du(e)}function eS(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],o=e[n],a;return o<i&&(a=r,r=n,n=a,a=i,i=o,o=a),e[r]=t.floor(i),e[n]=t.ceil(o),e}function vE(e){return Math.log(e)}function mE(e){return Math.exp(e)}function bj(e){return-Math.log(-e)}function Rj(e){return-Math.exp(-e)}function Cj(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Oj(e){return e===10?Cj:e===Math.E?Math.exp:function(t){return Math.pow(e,t)}}function Ij(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),function(t){return Math.log(t)/e})}function gE(e){return function(t){return-e(-t)}}function Mj(e){var t=e(vE,mE),r=t.domain,n=10,i,o;function a(){return i=Ij(n),o=Oj(n),r()[0]<0?(i=gE(i),o=gE(o),e(bj,Rj)):e(vE,mE),t}return t.base=function(s){return arguments.length?(n=+s,a()):n},t.domain=function(s){return arguments.length?(r(s),a()):r()},t.ticks=function(s){var u=r(),l=u[0],f=u[u.length-1],c;(c=f<l)&&(h=l,l=f,f=h);var h=i(l),d=i(f),p,v,g,y=s==null?10:+s,S=[];if(!(n%1)&&d-h<y){if(h=Math.round(h)-1,d=Math.round(d)+1,l>0){for(;h<d;++h)for(v=1,p=o(h);v<n;++v)if(g=p*v,!(g<l)){if(g>f)break;S.push(g)}}else for(;h<d;++h)for(v=n-1,p=o(h);v>=1;--v)if(g=p*v,!(g<l)){if(g>f)break;S.push(g)}}else S=WA(h,d,Math.min(d-h,y)).map(o);return c?S.reverse():S},t.tickFormat=function(s,u){if(u==null&&(u=n===10?".0e":","),typeof u!="function"&&(u=Kp(u)),s===1/0)return u;s==null&&(s=10);var l=Math.max(1,n*s/t.ticks().length);return function(f){var c=f/o(Math.round(i(f)));return c*n<n-.5&&(c*=n),c<=l?u(f):""}},t.nice=function(){return r(eS(r(),{floor:function(s){return o(Math.floor(i(s)))},ceil:function(s){return o(Math.ceil(i(s)))}}))},t}function tS(){var e=Mj(Zp()).domain([1,10]);return e.copy=function(){return ff(e,tS()).base(e.base())},Zi.apply(e,arguments),e}function EE(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Nj(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Pj(e){return e<0?-e*e:e*e}function Lj(e){var t=e(Zr,Zr),r=1;function n(){return r===1?e(Zr,Zr):r===.5?e(Nj,Pj):e(EE(r),EE(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},Du(t)}function rS(){var e=Lj(Zp());return e.copy=function(){return ff(e,rS()).exponent(e.exponent())},Zi.apply(e,arguments),e}function nS(){var e=[],t=[],r=[],n;function i(){var a=0,s=Math.max(1,t.length);for(r=new Array(s-1);++a<s;)r[a-1]=uj(e,a/s);return o}function o(a){return isNaN(a=+a)?n:t[cf(r,a)]}return o.invertExtent=function(a){var s=t.indexOf(a);return s<0?[NaN,NaN]:[s>0?r[s-1]:e[0],s<r.length?r[s]:e[e.length-1]]},o.domain=function(a){if(!arguments.length)return e.slice();e=[];for(var s=0,u=a.length,l;s<u;++s)l=a[s],l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(Yp),i()},o.range=function(a){return arguments.length?(t=xo.call(a),i()):t.slice()},o.unknown=function(a){return arguments.length?(n=a,o):n},o.quantiles=function(){return r.slice()},o.copy=function(){return nS().domain(e).range(t).unknown(n)},Zi.apply(o,arguments)}function iS(){var e=0,t=1,r=1,n=[.5],i=[0,1],o;function a(u){return u<=u?i[cf(n,u,0,r)]:o}function s(){var u=-1;for(n=new Array(r);++u<r;)n[u]=((u+1)*t-(u-r)*e)/(r+1);return a}return a.domain=function(u){return arguments.length?(e=+u[0],t=+u[1],s()):[e,t]},a.range=function(u){return arguments.length?(r=(i=xo.call(u)).length-1,s()):i.slice()},a.invertExtent=function(u){var l=i.indexOf(u);return l<0?[NaN,NaN]:l<1?[e,n[0]]:l>=r?[n[r-1],t]:[n[l-1],n[l]]},a.unknown=function(u){return arguments.length&&(o=u),a},a.thresholds=function(){return n.slice()},a.copy=function(){return iS().domain([e,t]).range(i).unknown(o)},Zi.apply(Du(a),arguments)}function oS(){var e=[.5],t=[0,1],r,n=1;function i(o){return o<=o?t[cf(e,o,0,n)]:r}return i.domain=function(o){return arguments.length?(e=xo.call(o),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=xo.call(o),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var a=t.indexOf(o);return[e[a-1],e[a]]},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return oS().domain(e).range(t).unknown(r)},Zi.apply(i,arguments)}var jh=new Date,Xh=new Date;function rn(e,t,r,n){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=function(o){return e(o=new Date(+o)),o},i.ceil=function(o){return e(o=new Date(o-1)),t(o,1),e(o),o},i.round=function(o){var a=i(o),s=i.ceil(o);return o-a<s-o?a:s},i.offset=function(o,a){return t(o=new Date(+o),a==null?1:Math.floor(a)),o},i.range=function(o,a,s){var u=[],l;if(o=i.ceil(o),s=s==null?1:Math.floor(s),!(o<a)||!(s>0))return u;do u.push(l=new Date(+o)),t(o,s),e(o);while(l<o&&o<a);return u},i.filter=function(o){return rn(function(a){if(a>=a)for(;e(a),!o(a);)a.setTime(a-1)},function(a,s){if(a>=a)if(s<0)for(;++s<=0;)for(;t(a,-1),!o(a););else for(;--s>=0;)for(;t(a,1),!o(a););})},r&&(i.count=function(o,a){return jh.setTime(+o),Xh.setTime(+a),e(jh),e(Xh),Math.floor(r(jh,Xh))},i.every=function(o){return o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(n?function(a){return n(a)%o===0}:function(a){return i.count(0,a)%o===0}):i}),i}var Pc=rn(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});Pc.every=function(e){return e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?rn(function(t){t.setTime(Math.floor(t/e)*e)},function(t,r){t.setTime(+t+r*e)},function(t,r){return(r-t)/e}):Pc};Pc.range;var Lc=1e3,yu=6e4,yE=36e5,aS=864e5,sS=6048e5,uS=rn(function(e){e.setTime(e-e.getMilliseconds())},function(e,t){e.setTime(+e+t*Lc)},function(e,t){return(t-e)/Lc},function(e){return e.getUTCSeconds()});uS.range;var lS=rn(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*Lc)},function(e,t){e.setTime(+e+t*yu)},function(e,t){return(t-e)/yu},function(e){return e.getMinutes()});lS.range;var cS=rn(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*Lc-e.getMinutes()*yu)},function(e,t){e.setTime(+e+t*yE)},function(e,t){return(t-e)/yE},function(e){return e.getHours()});cS.range;var hf=rn(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*yu)/aS},function(e){return e.getDate()-1});hf.range;function No(e){return rn(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(t,r){t.setDate(t.getDate()+r*7)},function(t,r){return(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*yu)/sS})}var Qp=No(0),wc=No(1),wj=No(2),Fj=No(3),Ba=No(4),Bj=No(5),Dj=No(6);Qp.range;wc.range;wj.range;Fj.range;Ba.range;Bj.range;Dj.range;var fS=rn(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12},function(e){return e.getMonth()});fS.range;var Wi=rn(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()});Wi.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:rn(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,r){t.setFullYear(t.getFullYear()+r*e)})};Wi.range;var Jp=rn(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/aS},function(e){return e.getUTCDate()-1});Jp.range;function Po(e){return rn(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(t,r){t.setUTCDate(t.getUTCDate()+r*7)},function(t,r){return(r-t)/sS})}var hS=Po(0),Fc=Po(1),Uj=Po(2),kj=Po(3),Da=Po(4),$j=Po(5),zj=Po(6);hS.range;Fc.range;Uj.range;kj.range;Da.range;$j.range;zj.range;var bo=rn(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});bo.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:rn(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,r){t.setUTCFullYear(t.getUTCFullYear()+r*e)})};bo.range;function Wh(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Gh(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Ns(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function Vj(e){var t=e.dateTime,r=e.date,n=e.time,i=e.periods,o=e.days,a=e.shortDays,s=e.months,u=e.shortMonths,l=Ps(i),f=Ls(i),c=Ps(o),h=Ls(o),d=Ps(a),p=Ls(a),v=Ps(s),g=Ls(s),y=Ps(u),S=Ls(u),R={a:Je,A:ft,b:Ge,B:et,c:null,d:RE,e:RE,f:fX,g:TX,G:SX,H:uX,I:lX,j:cX,L:dS,m:hX,M:dX,p:vt,q:mt,Q:IE,s:ME,S:pX,u:_X,U:vX,V:mX,w:gX,W:EX,x:null,X:null,y:yX,Y:AX,Z:xX,"%":OE},x={a:It,A:wt,b:gt,B:xr,c:null,d:CE,e:CE,f:OX,g:UX,G:$X,H:bX,I:RX,j:CX,L:_S,m:IX,M:MX,p:Gt,q:Xr,Q:IE,s:ME,S:NX,u:PX,U:LX,V:wX,w:FX,W:BX,x:null,X:null,y:DX,Y:kX,Z:zX,"%":OE},M={a:q,A:k,b:G,B:K,c:ce,d:xE,e:xE,f:iX,g:SE,G:AE,H:bE,I:bE,j:eX,L:nX,m:Jj,M:tX,p:ge,q:Qj,Q:aX,s:sX,S:rX,u:Gj,U:Yj,V:Zj,w:Wj,W:qj,x:Pe,X:Xe,y:SE,Y:AE,Z:Kj,"%":oX};R.x=$(r,R),R.X=$(n,R),R.c=$(t,R),x.x=$(r,x),x.X=$(n,x),x.c=$(t,x);function $(le,ze){return function(nt){var Ae=[],Dt=-1,Et=0,zt=le.length,Rt,ut,Ut;for(nt instanceof Date||(nt=new Date(+nt));++Dt<zt;)le.charCodeAt(Dt)===37&&(Ae.push(le.slice(Et,Dt)),(ut=TE[Rt=le.charAt(++Dt)])!=null?Rt=le.charAt(++Dt):ut=Rt==="e"?" ":"0",(Ut=ze[Rt])&&(Rt=Ut(nt,ut)),Ae.push(Rt),Et=Dt+1);return Ae.push(le.slice(Et,Dt)),Ae.join("")}}function F(le,ze){return function(nt){var Ae=Ns(1900,void 0,1),Dt=Y(Ae,le,nt+="",0),Et,zt;if(Dt!=nt.length)return null;if("Q"in Ae)return new Date(Ae.Q);if("s"in Ae)return new Date(Ae.s*1e3+("L"in Ae?Ae.L:0));if(ze&&!("Z"in Ae)&&(Ae.Z=0),"p"in Ae&&(Ae.H=Ae.H%12+Ae.p*12),Ae.m===void 0&&(Ae.m="q"in Ae?Ae.q:0),"V"in Ae){if(Ae.V<1||Ae.V>53)return null;"w"in Ae||(Ae.w=1),"Z"in Ae?(Et=Gh(Ns(Ae.y,0,1)),zt=Et.getUTCDay(),Et=zt>4||zt===0?Fc.ceil(Et):Fc(Et),Et=Jp.offset(Et,(Ae.V-1)*7),Ae.y=Et.getUTCFullYear(),Ae.m=Et.getUTCMonth(),Ae.d=Et.getUTCDate()+(Ae.w+6)%7):(Et=Wh(Ns(Ae.y,0,1)),zt=Et.getDay(),Et=zt>4||zt===0?wc.ceil(Et):wc(Et),Et=hf.offset(Et,(Ae.V-1)*7),Ae.y=Et.getFullYear(),Ae.m=Et.getMonth(),Ae.d=Et.getDate()+(Ae.w+6)%7)}else("W"in Ae||"U"in Ae)&&("w"in Ae||(Ae.w="u"in Ae?Ae.u%7:"W"in Ae?1:0),zt="Z"in Ae?Gh(Ns(Ae.y,0,1)).getUTCDay():Wh(Ns(Ae.y,0,1)).getDay(),Ae.m=0,Ae.d="W"in Ae?(Ae.w+6)%7+Ae.W*7-(zt+5)%7:Ae.w+Ae.U*7-(zt+6)%7);return"Z"in Ae?(Ae.H+=Ae.Z/100|0,Ae.M+=Ae.Z%100,Gh(Ae)):Wh(Ae)}}function Y(le,ze,nt,Ae){for(var Dt=0,Et=ze.length,zt=nt.length,Rt,ut;Dt<Et;){if(Ae>=zt)return-1;if(Rt=ze.charCodeAt(Dt++),Rt===37){if(Rt=ze.charAt(Dt++),ut=M[Rt in TE?ze.charAt(Dt++):Rt],!ut||(Ae=ut(le,nt,Ae))<0)return-1}else if(Rt!=nt.charCodeAt(Ae++))return-1}return Ae}function ge(le,ze,nt){var Ae=l.exec(ze.slice(nt));return Ae?(le.p=f[Ae[0].toLowerCase()],nt+Ae[0].length):-1}function q(le,ze,nt){var Ae=d.exec(ze.slice(nt));return Ae?(le.w=p[Ae[0].toLowerCase()],nt+Ae[0].length):-1}function k(le,ze,nt){var Ae=c.exec(ze.slice(nt));return Ae?(le.w=h[Ae[0].toLowerCase()],nt+Ae[0].length):-1}function G(le,ze,nt){var Ae=y.exec(ze.slice(nt));return Ae?(le.m=S[Ae[0].toLowerCase()],nt+Ae[0].length):-1}function K(le,ze,nt){var Ae=v.exec(ze.slice(nt));return Ae?(le.m=g[Ae[0].toLowerCase()],nt+Ae[0].length):-1}function ce(le,ze,nt){return Y(le,t,ze,nt)}function Pe(le,ze,nt){return Y(le,r,ze,nt)}function Xe(le,ze,nt){return Y(le,n,ze,nt)}function Je(le){return a[le.getDay()]}function ft(le){return o[le.getDay()]}function Ge(le){return u[le.getMonth()]}function et(le){return s[le.getMonth()]}function vt(le){return i[+(le.getHours()>=12)]}function mt(le){return 1+~~(le.getMonth()/3)}function It(le){return a[le.getUTCDay()]}function wt(le){return o[le.getUTCDay()]}function gt(le){return u[le.getUTCMonth()]}function xr(le){return s[le.getUTCMonth()]}function Gt(le){return i[+(le.getUTCHours()>=12)]}function Xr(le){return 1+~~(le.getUTCMonth()/3)}return{format:function(le){var ze=$(le+="",R);return ze.toString=function(){return le},ze},parse:function(le){var ze=F(le+="",!1);return ze.toString=function(){return le},ze},utcFormat:function(le){var ze=$(le+="",x);return ze.toString=function(){return le},ze},utcParse:function(le){var ze=F(le+="",!0);return ze.toString=function(){return le},ze}}}var TE={"-":"",_:" ",0:"0"},kr=/^\s*\d+/,Hj=/^%/,jj=/[\\^$*+?|[\]().{}]/g;function Vt(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",o=i.length;return n+(o<r?new Array(r-o+1).join(t)+i:i)}function Xj(e){return e.replace(jj,"\\$&")}function Ps(e){return new RegExp("^(?:"+e.map(Xj).join("|")+")","i")}function Ls(e){for(var t={},r=-1,n=e.length;++r<n;)t[e[r].toLowerCase()]=r;return t}function Wj(e,t,r){var n=kr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Gj(e,t,r){var n=kr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Yj(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Zj(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function qj(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function AE(e,t,r){var n=kr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function SE(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Kj(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Qj(e,t,r){var n=kr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Jj(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function xE(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function eX(e,t,r){var n=kr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function bE(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function tX(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function rX(e,t,r){var n=kr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function nX(e,t,r){var n=kr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function iX(e,t,r){var n=kr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function oX(e,t,r){var n=Hj.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function aX(e,t,r){var n=kr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function sX(e,t,r){var n=kr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function RE(e,t){return Vt(e.getDate(),t,2)}function uX(e,t){return Vt(e.getHours(),t,2)}function lX(e,t){return Vt(e.getHours()%12||12,t,2)}function cX(e,t){return Vt(1+hf.count(Wi(e),e),t,3)}function dS(e,t){return Vt(e.getMilliseconds(),t,3)}function fX(e,t){return dS(e,t)+"000"}function hX(e,t){return Vt(e.getMonth()+1,t,2)}function dX(e,t){return Vt(e.getMinutes(),t,2)}function pX(e,t){return Vt(e.getSeconds(),t,2)}function _X(e){var t=e.getDay();return t===0?7:t}function vX(e,t){return Vt(Qp.count(Wi(e)-1,e),t,2)}function pS(e){var t=e.getDay();return t>=4||t===0?Ba(e):Ba.ceil(e)}function mX(e,t){return e=pS(e),Vt(Ba.count(Wi(e),e)+(Wi(e).getDay()===4),t,2)}function gX(e){return e.getDay()}function EX(e,t){return Vt(wc.count(Wi(e)-1,e),t,2)}function yX(e,t){return Vt(e.getFullYear()%100,t,2)}function TX(e,t){return e=pS(e),Vt(e.getFullYear()%100,t,2)}function AX(e,t){return Vt(e.getFullYear()%1e4,t,4)}function SX(e,t){var r=e.getDay();return e=r>=4||r===0?Ba(e):Ba.ceil(e),Vt(e.getFullYear()%1e4,t,4)}function xX(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Vt(t/60|0,"0",2)+Vt(t%60,"0",2)}function CE(e,t){return Vt(e.getUTCDate(),t,2)}function bX(e,t){return Vt(e.getUTCHours(),t,2)}function RX(e,t){return Vt(e.getUTCHours()%12||12,t,2)}function CX(e,t){return Vt(1+Jp.count(bo(e),e),t,3)}function _S(e,t){return Vt(e.getUTCMilliseconds(),t,3)}function OX(e,t){return _S(e,t)+"000"}function IX(e,t){return Vt(e.getUTCMonth()+1,t,2)}function MX(e,t){return Vt(e.getUTCMinutes(),t,2)}function NX(e,t){return Vt(e.getUTCSeconds(),t,2)}function PX(e){var t=e.getUTCDay();return t===0?7:t}function LX(e,t){return Vt(hS.count(bo(e)-1,e),t,2)}function vS(e){var t=e.getUTCDay();return t>=4||t===0?Da(e):Da.ceil(e)}function wX(e,t){return e=vS(e),Vt(Da.count(bo(e),e)+(bo(e).getUTCDay()===4),t,2)}function FX(e){return e.getUTCDay()}function BX(e,t){return Vt(Fc.count(bo(e)-1,e),t,2)}function DX(e,t){return Vt(e.getUTCFullYear()%100,t,2)}function UX(e,t){return e=vS(e),Vt(e.getUTCFullYear()%100,t,2)}function kX(e,t){return Vt(e.getUTCFullYear()%1e4,t,4)}function $X(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Da(e):Da.ceil(e),Vt(e.getUTCFullYear()%1e4,t,4)}function zX(){return"+0000"}function OE(){return"%"}function IE(e){return+e}function ME(e){return Math.floor(+e/1e3)}var ca,mS;VX({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function VX(e){return ca=Vj(e),mS=ca.format,ca.parse,ca.utcFormat,ca.utcParse,ca}var Js=1e3,eu=Js*60,tu=eu*60,Tu=tu*24,HX=Tu*7,NE=Tu*30,Yh=Tu*365;function jX(e){return new Date(e)}function XX(e){return e instanceof Date?+e:+new Date(+e)}function gS(e,t,r,n,i,o,a,s,u){var l=qA(Zr,Zr),f=l.invert,c=l.domain,h=u(".%L"),d=u(":%S"),p=u("%I:%M"),v=u("%I %p"),g=u("%a %d"),y=u("%b %d"),S=u("%B"),R=u("%Y"),x=[[a,1,Js],[a,5,5*Js],[a,15,15*Js],[a,30,30*Js],[o,1,eu],[o,5,5*eu],[o,15,15*eu],[o,30,30*eu],[i,1,tu],[i,3,3*tu],[i,6,6*tu],[i,12,12*tu],[n,1,Tu],[n,2,2*Tu],[r,1,HX],[t,1,NE],[t,3,3*NE],[e,1,Yh]];function M(F){return(a(F)<F?h:o(F)<F?d:i(F)<F?p:n(F)<F?v:t(F)<F?r(F)<F?g:y:e(F)<F?S:R)(F)}function $(F,Y,ge,q){if(F==null&&(F=10),typeof F=="number"){var k=Math.abs(ge-Y)/F,G=XA(function(K){return K[2]}).right(x,k);G===x.length?(q=jd(Y/Yh,ge/Yh,F),F=e):G?(G=x[k/x[G-1][2]<x[G][2]/k?G-1:G],q=G[1],F=G[0]):(q=Math.max(jd(Y,ge,F),1),F=s)}return q==null?F:F.every(q)}return l.invert=function(F){return new Date(f(F))},l.domain=function(F){return arguments.length?c(ZA.call(F,XX)):c().map(jX)},l.ticks=function(F,Y){var ge=c(),q=ge[0],k=ge[ge.length-1],G=k<q,K;return G&&(K=q,q=k,k=K),K=$(F,q,k,Y),K=K?K.range(q,k+1):[],G?K.reverse():K},l.tickFormat=function(F,Y){return Y==null?M:u(Y)},l.nice=function(F,Y){var ge=c();return(F=$(F,ge[0],ge[ge.length-1],Y))?c(eS(ge,F)):l},l.copy=function(){return ff(l,gS(e,t,r,n,i,o,a,s,u))},l}function WX(){return Zi.apply(gS(Wi,fS,Qp,hf,cS,lS,uS,Pc,mS).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function GX(){var e=0,t=1,r,n,i,o,a=Zr,s=!1,u;function l(f){return isNaN(f=+f)?u:a(i===0?.5:(f=(o(f)-r)*i,s?Math.max(0,Math.min(1,f)):f))}return l.domain=function(f){return arguments.length?(r=o(e=+f[0]),n=o(t=+f[1]),i=r===n?0:1/(n-r),l):[e,t]},l.clamp=function(f){return arguments.length?(s=!!f,l):s},l.interpolator=function(f){return arguments.length?(a=f,l):a},l.unknown=function(f){return arguments.length?(u=f,l):u},function(f){return o=f,r=f(e),n=f(t),i=r===n?0:1/(n-r),l}}function ES(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function yS(){var e=Du(GX()(Zr));return e.copy=function(){return ES(e,yS())},GA.apply(e,arguments)}function YX(){var e=0,t=.5,r=1,n,i,o,a,s,u=Zr,l,f=!1,c;function h(d){return isNaN(d=+d)?c:(d=.5+((d=+l(d))-i)*(d<i?a:s),u(f?Math.max(0,Math.min(1,d)):d))}return h.domain=function(d){return arguments.length?(n=l(e=+d[0]),i=l(t=+d[1]),o=l(r=+d[2]),a=n===i?0:.5/(i-n),s=i===o?0:.5/(o-i),h):[e,t,r]},h.clamp=function(d){return arguments.length?(f=!!d,h):f},h.interpolator=function(d){return arguments.length?(u=d,h):u},h.unknown=function(d){return arguments.length?(c=d,h):c},function(d){return l=d,n=d(e),i=d(t),o=d(r),a=n===i?0:.5/(i-n),s=i===o?0:.5/(o-i),h}}function TS(){var e=Du(YX()(Zr));return e.copy=function(){return ES(e,TS())},GA.apply(e,arguments)}function AS(e){let t,r=[];function n(i){return i??t}return n.invert=n,n.domain=n.range=i=>i?(r=i,i):r,n.unknown=i=>i?(t=i,i):t,n.copy=()=>AS().unknown(t),n}const{isNil:Zh,isString:ZX,uniq:qX}=Sr,KX=/^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]?)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/,QX={[Xt.LINEAR]:JA,[Xt.POWER]:rS,[Xt.LOG]:tS,[Xt.IDENTITY]:AS,[Xt.SEQUENTIAL]:yS,[Xt.TIME]:WX,[Xt.QUANTILE]:nS,[Xt.QUANTIZE]:iS,[Xt.THRESHOLD]:oS,[Xt.CAT]:Ic,[Xt.DIVERGING]:TS};class JX{constructor(){E(this,"scaleOptions",{})}apply(t,{styleAttributeService:r}){var n=this;t.hooks.init.tapPromise("FeatureScalePlugin",ve(function*(){var i;t.log(Fr.ScaleInitStart,jr.INIT),n.scaleOptions=t.getScaleOptions();const o=r.getLayerStyleAttributes(),a=(i=t.getSource())===null||i===void 0?void 0:i.data.dataArray;Array.isArray(a)&&a.length===0||(n.caculateScalesForAttributes(o||[],a),t.log(Fr.ScaleInitEnd,jr.INIT))})),t.hooks.beforeRenderData.tapPromise("FeatureScalePlugin",function(){var i=ve(function*(o){if(!o)return o;t.log(Fr.ScaleInitStart,jr.UPDATE),n.scaleOptions=t.getScaleOptions();const a=r.getLayerStyleAttributes(),s=t.getSource().data.dataArray;return Array.isArray(s)&&s.length===0||(n.caculateScalesForAttributes(a||[],s),t.log(Fr.ScaleInitEnd,jr.UPDATE),t.layerModelNeedUpdate=!0),!0});return function(o){return i.apply(this,arguments)}}()),t.hooks.beforeRender.tap("FeatureScalePlugin",()=>{if(t.layerModelNeedUpdate)return;this.scaleOptions=t.getScaleOptions();const i=r.getLayerStyleAttributes(),o=t.getSource().data.dataArray;if(!(Array.isArray(o)&&o.length===0)&&i){const a=i.filter(s=>s.needRescale);a.length&&this.caculateScalesForAttributes(a,o)}})}isNumber(t){return!isNaN(parseFloat(t))&&isFinite(t)}caculateScalesForAttributes(t,r){t.forEach(n=>{if(n.scale){const i=n.scale,o=n.scale.field;i.names=this.parseFields(Zh(o)?[]:o);const a=[];i.names.forEach(s=>{var u;a.push(this.createScale(s,n.name,(u=n.scale)===null||u===void 0?void 0:u.values,r))}),a.some(s=>s.type===la.VARIABLE)?(i.type=la.VARIABLE,a.forEach(s=>{if(!i.callback&&i.values!=="text"){var u;switch((u=s.option)===null||u===void 0?void 0:u.type){case Xt.LOG:case Xt.LINEAR:case Xt.POWER:if(i.values&&i.values.length>2){const f=s.scale.ticks(i.values.length);s.scale.domain(f)}i.values?s.scale.range(i.values):s.scale.range(s.option.domain);break;case Xt.QUANTILE:case Xt.QUANTIZE:case Xt.THRESHOLD:s.scale.range(i.values);break;case Xt.IDENTITY:break;case Xt.CAT:i.values?s.scale.range(i.values):s.scale.range(s.option.domain);break;case Xt.DIVERGING:case Xt.SEQUENTIAL:s.scale.interpolator(ZH(i.values));break}}if(i.values==="text"){var l;s.scale.range((l=s.option)===null||l===void 0?void 0:l.domain)}})):(i.type=la.CONSTANT,i.defaultValues=a.map((s,u)=>s.scale(i.names[u]))),i.scalers=a.map(s=>({field:s.field,func:s.scale,option:s.option})),n.needRescale=!1}})}parseFields(t){return Array.isArray(t)?t:ZX(t)?t.split("*"):[t]}createScale(t,r,n,i){var o,a;const s=this.scaleOptions[r]&&((o=this.scaleOptions[r])===null||o===void 0?void 0:o.field)===t?this.scaleOptions[r]:this.scaleOptions[t],u={field:t,scale:void 0,type:la.VARIABLE,option:s};if(!i||!i.length)return s&&s.type?u.scale=this.createDefaultScale(s):(u.scale=Ic([t]),u.type=la.CONSTANT),u;const l=(a=i.find(f=>!Zh(f[t])))===null||a===void 0?void 0:a[t];if(this.isNumber(t)||Zh(l)&&!s)u.scale=Ic([t]),u.type=la.CONSTANT;else{let f=s&&s.type||this.getDefaultType(l);n==="text"&&(f=Xt.CAT),n===void 0&&(f=Xt.IDENTITY);const c=this.createScaleConfig(f,t,s,i);u.scale=this.createDefaultScale(c),u.option=c}return u}getDefaultType(t){let r=Xt.LINEAR;return typeof t=="string"&&(r=KX.test(t)?Xt.TIME:Xt.CAT),r}createScaleConfig(t,r,n,i){const o={type:t};let a=[];if(t===Xt.QUANTILE){const s=new Map;i==null||i.forEach(u=>{s.set(u._id,u[r])}),a=Array.from(s.values())}else a=(i==null?void 0:i.map(s=>s[r]))||[];if(n!=null&&n.domain)o.domain=n==null?void 0:n.domain;else if(t===Xt.CAT||t===Xt.IDENTITY)o.domain=qX(a);else if(t===Xt.QUANTILE)o.domain=a;else if(t===Xt.DIVERGING){const s=oE(a),u=(n==null?void 0:n.neutral)!==void 0?n==null?void 0:n.neutral:(s[0]+s[1])/2;o.domain=[s[0],u,s[1]]}else o.domain=oE(a);return he(he({},o),n)}createDefaultScale({type:t,domain:r,unknown:n,clamp:i,nice:o}){const a=QX[t]();return r&&a.domain&&a.domain(r),n&&a.unknown(n),i!==void 0&&a.clamp&&a.clamp(i),o!==void 0&&a.nice&&a.nice(o),a}}class eW{apply(t){t.hooks.beforeRender.tap("LayerAnimateStylePlugin",()=>{t.animateStatus&&t.models.forEach(n=>{n.addUniforms(he({},t.layerModel.getAnimateUniforms()))})})}}let tW=class{apply(t){t.hooks.afterInit.tap("LayerMaskPlugin",()=>{const{maskLayers:r,enableMask:n}=t.getLayerConfig();!t.tileLayer&&r&&r.length>0&&t.updateLayerConfig({mask:n})})}};class rW{build(t){return ve(function*(){t.prepareBuildModel(),yield t.buildModels()})()}initLayerModel(t){var r=this;return ve(function*(){yield r.build(t),t.styleNeedUpdate=!1})()}prepareLayerModel(t){var r=this;return ve(function*(){yield r.build(t),t.styleNeedUpdate=!1})()}apply(t){var r=this;t.hooks.init.tapPromise("LayerModelPlugin",ve(function*(){if(t.getSource().isTile){t.prepareBuildModel();return}t.log(Fr.BuildModelStart,jr.INIT),yield r.initLayerModel(t),t.log(Fr.BuildModelEnd,jr.INIT)})),t.hooks.beforeRenderData.tapPromise("LayerModelPlugin",function(){var n=ve(function*(i){return!i||t.getSource().isTile?!1:(t.log(Fr.BuildModelStart,jr.UPDATE),yield r.prepareLayerModel(t),t.log(Fr.BuildModelEnd,jr.UPDATE),!0)});return function(i){return n.apply(this,arguments)}}())}}class nW{apply(t){t.hooks.afterInit.tap("LayerStylePlugin",()=>{const{autoFit:r,fitBoundsOptions:n}=t.getLayerConfig();r&&t.fitBounds(n),t.styleNeedUpdate=!1})}}const iW=["type"],PE={directional:{lights:"u_DirectionalLights",num:"u_NumOfDirectionalLights"},spot:{lights:"u_SpotLights",num:"u_NumOfSpotLights"}},oW={type:"directional",direction:[1,10.5,12],ambient:[.2,.2,.2],diffuse:[.6,.6,.6],specular:[.1,.1,.1]},aW={direction:[0,0,0],ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0]},sW={position:[0,0,0],direction:[0,0,0],ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],constant:1,linear:0,quadratic:0,angle:14,exponent:40,blur:5};function uW(e){const t={u_DirectionalLights:new Array(3).fill(he({},aW)),u_NumOfDirectionalLights:0,u_SpotLights:new Array(3).fill(he({},sW)),u_NumOfSpotLights:0};return(!e||!e.length)&&(e=[oW]),e.forEach(r=>{let{type:n="directional"}=r,i=ai(r,iW);const o=PE[n].lights,a=PE[n].num,s=t[a];t[o][s]=he(he({},t[o][s]),i),t[a]++}),t}class lW{apply(t){t.hooks.beforeRender.tap("LightingPlugin",()=>{const{enableLighting:r}=t.getLayerConfig();r&&t.models.forEach(n=>n.addUniforms(he({},uW())))})}}function SS(e){return e.map(t=>(typeof t=="string"&&(t=[t,{}]),t))}function xS(e,t,r,n){const i=e.multiPassRenderer;return i.add(n("render")),SS(t).forEach(o=>{const[a,s]=o;i.add(r(a),s)}),i.add(r("copy")),i}class cW{constructor(){E(this,"enabled",void 0)}apply(t,{rendererService:r,postProcessingPassFactory:n,normalPassFactory:i}){t.hooks.init.tapPromise("MultiPassRendererPlugin",()=>{const{enableMultiPassRenderer:o,passes:a=[]}=t.getLayerConfig();this.enabled=!!o&&t.getLayerConfig().enableMultiPassRenderer!==!1,this.enabled&&(t.multiPassRenderer=xS(t,a,n,i),t.multiPassRenderer.setRenderFlag(!0))}),t.hooks.beforeRender.tap("MultiPassRendererPlugin",()=>{if(this.enabled){const{width:o,height:a}=r.getViewportSize();t.multiPassRenderer.resize(o,a)}})}}const zi={POSITION:0,POSITION_64LOW:1,COLOR:2,PICKING_COLOR:3,STROKE:4,OPACITY:5,OFFSETS:6,ROTATION:7,MAX:8};function fW(e){switch(e){case"rotation":return{name:"Rotation",type:qe.Attribute,descriptor:{name:"a_Rotation",shaderLocation:zi.ROTATION,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{rotation:r=0}=t;return Array.isArray(r)?[r[0]]:[r]}}};case"stroke":return{name:"stroke",type:qe.Attribute,descriptor:{name:"a_Stroke",shaderLocation:zi.STROKE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:4,update:t=>{const{stroke:r=[1,1,1,1]}=t;return r}}};case"opacity":return{name:"opacity",type:qe.Attribute,descriptor:{name:"a_Opacity",shaderLocation:zi.OPACITY,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{opacity:r=1}=t;return[r]}}};case"offsets":return{name:"offsets",type:qe.Attribute,descriptor:{name:"a_Offsets",shaderLocation:zi.OFFSETS,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const{offsets:r}=t;return r}}};default:return}}const{isNumber:hW}=Sr,fa={NONE:0,ENCODE:1,HIGHLIGHT:2};class dW{constructor(){E(this,"pickingUniformMap",void 0)}pickOption2Array(){const t=[];return this.pickingUniformMap.forEach(r=>{hW(r)?t.push(r):t.push(...r)}),t}updatePickOption(t,r){Object.keys(t).forEach(a=>{this.pickingUniformMap.set(a,t[a])});const n=r.getLayerConfig().pickingBuffer||0,i=Number(r.getShaderPickStat());this.pickingUniformMap.set("u_PickingBuffer",n),this.pickingUniformMap.set("u_shaderPick",i),r.getPickingUniformBuffer().subData({offset:0,data:this.pickOption2Array()})}apply(t,{styleAttributeService:r}){this.pickingUniformMap=new Map([["u_HighlightColor",[1,0,0,1]],["u_SelectColor",[1,0,0,1]],["u_PickingColor",[0,0,0]],["u_PickingStage",0],["u_CurrentSelectedId",[0,0,0]],["u_PickingThreshold",10],["u_PickingBuffer",0],["u_shaderPick",0],["u_activeMix",0]]),t.hooks.init.tapPromise("PixelPickingPlugin",()=>{const{enablePicking:n}=t.getLayerConfig();r.registerStyleAttribute({name:"pickingColor",type:qe.Attribute,descriptor:{name:"a_PickingColor",shaderLocation:zi.PICKING_COLOR,buffer:{data:[],type:m.FLOAT},size:3,update:i=>{const{id:o}=i;return n?La(o):[0,0,0]}}})}),t.hooks.beforePickingEncode.tap("PixelPickingPlugin",()=>{const{enablePicking:n}=t.getLayerConfig();n&&t.isVisible()&&(this.updatePickOption({u_PickingStage:fa.ENCODE},t),t.models.forEach(i=>i.addUniforms({u_PickingStage:fa.ENCODE})))}),t.hooks.afterPickingEncode.tap("PixelPickingPlugin",()=>{const{enablePicking:n}=t.getLayerConfig();n&&t.isVisible()&&(this.updatePickOption({u_PickingStage:fa.HIGHLIGHT},t),t.models.forEach(i=>i.addUniforms({u_PickingStage:fa.HIGHLIGHT})))}),t.hooks.beforeHighlight.tap("PixelPickingPlugin",n=>{const{highlightColor:i,activeMix:o=0}=t.getLayerConfig(),a=typeof i=="string"?Zt(i):i||[1,0,0,1];t.updateLayerConfig({pickedFeatureID:yo(new Uint8Array(n))});const s={u_PickingStage:fa.HIGHLIGHT,u_PickingColor:n,u_HighlightColor:a.map(u=>u*255),u_activeMix:o};this.updatePickOption(s,t),t.models.forEach(u=>u.addUniforms(s))}),t.hooks.beforeSelect.tap("PixelPickingPlugin",n=>{const{selectColor:i,selectMix:o=0}=t.getLayerConfig(),a=typeof i=="string"?Zt(i):i||[1,0,0,1];t.updateLayerConfig({pickedFeatureID:yo(new Uint8Array(n))});const s={u_PickingStage:fa.HIGHLIGHT,u_PickingColor:n,u_HighlightColor:a.map(u=>u*255),u_activeMix:o,u_CurrentSelectedId:n,u_SelectColor:a.map(u=>u*255)};this.updatePickOption(s,t),t.models.forEach(u=>u.addUniforms(s))})}}const pW=["mvt","geojsonvt","testTile"];function _W(e){const t=e.getSource();return pW.includes(t.parser.type)}class vW{apply(t,{styleAttributeService:r}){t.hooks.init.tapPromise("RegisterStyleAttributePlugin",()=>{_W(t)||this.registerBuiltinAttributes(r,t)})}registerBuiltinAttributes(t,r){if(r.type==="MaskLayer"){this.registerPositionAttribute(t);return}this.registerPositionAttribute(t),this.registerColorAttribute(t)}registerPositionAttribute(t){t.registerStyleAttribute({name:"position",type:qe.Attribute,descriptor:{name:"a_Position",shaderLocation:zi.POSITION,buffer:{data:[],type:m.FLOAT},size:3,update:(r,n,i)=>i.length===2?[i[0],i[1],0]:[i[0],i[1],i[2]]}})}registerColorAttribute(t){t.registerStyleAttribute({name:"color",type:qe.Attribute,descriptor:{name:"a_Color",shaderLocation:zi.COLOR,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:4,update:r=>{const{color:n}=r;return!n||!n.length?[1,1,1,1]:n}}})}}class mW{constructor(){E(this,"cameraService",void 0),E(this,"coordinateSystemService",void 0),E(this,"rendererService",void 0),E(this,"mapService",void 0),E(this,"layerService",void 0)}apply(t,{rendererService:r,mapService:n,layerService:i,coordinateSystemService:o,cameraService:a}){this.rendererService=r,this.mapService=n,this.layerService=i,this.coordinateSystemService=o,this.cameraService=a;let s;this.rendererService.uniformBuffers[0]||(s=this.rendererService.createBuffer({data:new Float32Array(16*4+4*7),isUBO:!0,label:"renderUniformBuffer"}),this.rendererService.uniformBuffers[0]=s),t.hooks.beforeRender.tap("ShaderUniformPlugin",()=>{const u=t.getLayerConfig().tileOrigin;this.coordinateSystemService.refresh(u);const{width:l,height:f}=this.rendererService.getViewportSize(),{data:c,uniforms:h}=this.generateUBO(l,f);this.layerService.alreadyInRendering&&this.rendererService.uniformBuffers[0]&&this.rendererService.uniformBuffers[0].subData({offset:0,data:c}),this.rendererService.queryVerdorInfo()==="WebGL1"&&t.models.forEach(p=>{p.addUniforms(he(he({},h),{},{u_PickingBuffer:t.getLayerConfig().pickingBuffer||0,u_shaderPick:Number(t.getShaderPickStat())}))})})}generateUBO(t,r){const n=this.cameraService.getProjectionMatrix(),i=this.cameraService.getViewMatrix(),o=this.cameraService.getViewProjectionMatrix(),a=this.cameraService.getModelMatrix(),s=this.coordinateSystemService.getViewportCenterProjection(),u=this.coordinateSystemService.getPixelsPerDegree(),l=this.cameraService.getZoom(),f=this.coordinateSystemService.getPixelsPerDegree2(),c=this.cameraService.getZoomScale(),h=this.coordinateSystemService.getPixelsPerMeter(),d=this.coordinateSystemService.getCoordinateSystem(),p=this.cameraService.getCameraPosition(),v=window.devicePixelRatio,g=this.coordinateSystemService.getViewportCenter(),y=[t,r],S=this.cameraService.getFocalDistance();return{data:[...i,...n,...o,...a,...s,...u,l,...f,c,...h,d,...p,v,...g,...y,S,0,0,0],uniforms:{[fo.ProjectionMatrix]:n,[fo.ViewMatrix]:i,[fo.ViewProjectionMatrix]:o,[fo.Zoom]:l,[fo.ZoomScale]:c,[fo.FocalDistance]:S,[fo.CameraPosition]:p,[ua.CoordinateSystem]:d,[ua.ViewportCenter]:g,[ua.ViewportCenterProjection]:s,[ua.PixelsPerDegree]:u,[ua.PixelsPerDegree2]:f,[ua.PixelsPerMeter]:h,u_ViewportSize:y,u_ModelMatrix:a,u_DevicePixelRatio:v}}}}class gW{apply(t){t.hooks.beforeRender.tap("UpdateModelPlugin",()=>{t.layerModel&&t.layerModel.needUpdate().then(r=>{r&&t.renderLayers()})}),t.hooks.afterRender.tap("UpdateModelPlugin",()=>{t.layerModelNeedUpdate=!1})}}class EW{apply(t,{styleAttributeService:r}){t.hooks.init.tapPromise("UpdateStyleAttributePlugin",()=>{this.initStyleAttribute(t,{styleAttributeService:r})}),t.hooks.beforeRender.tap("UpdateStyleAttributePlugin",()=>{t.layerModelNeedUpdate||t.inited&&this.updateStyleAttribute(t,{styleAttributeService:r})})}updateStyleAttribute(t,{styleAttributeService:r}){const n=r.getLayerStyleAttributes()||[],i=r.getLayerStyleAttribute("filter");if(i&&i.needRegenerateVertices){t.layerModelNeedUpdate=!0,n.forEach(o=>o.needRegenerateVertices=!1);return}n.filter(o=>o.needRegenerateVertices).forEach(o=>{r.updateAttributeByFeatureRange(o.name,t.getEncodedData(),o.featureRange.startIndex,o.featureRange.endIndex,t),o.needRegenerateVertices=!1})}initStyleAttribute(t,{styleAttributeService:r}){(r.getLayerStyleAttributes()||[]).filter(i=>i.needRegenerateVertices).forEach(i=>{r.updateAttributeByFeatureRange(i.name,t.getEncodedData(),i.featureRange.startIndex,i.featureRange.endIndex),i.needRegenerateVertices=!1})}}function yW(){return[new VH,new vW,new JX,new zH,new nW,new tW,new EW,new gW,new cW,new mW,new eW,new lW,new dW,new rW]}const bS={[Ui.additive]:{enable:!0,func:{srcRGB:m.ONE,dstRGB:m.ONE,srcAlpha:1,dstAlpha:1}},[Ui.none]:{enable:!1},[Ui.normal]:{enable:!0,func:{srcRGB:m.SRC_ALPHA,dstRGB:m.ONE_MINUS_SRC_ALPHA,srcAlpha:1,dstAlpha:1}},[Ui.subtractive]:{enable:!0,func:{srcRGB:m.ONE,dstRGB:m.ONE,srcAlpha:m.ZERO,dstAlpha:m.ONE_MINUS_SRC_COLOR},equation:{rgb:m.FUNC_SUBTRACT,alpha:m.FUNC_SUBTRACT}},[Ui.max]:{enable:!0,func:{srcRGB:m.ONE,dstRGB:m.ONE},equation:{rgb:m.MAX_EXT}},[Ui.min]:{enable:!0,func:{srcRGB:m.ONE,dstRGB:m.ONE},equation:{rgb:m.MIN_EXT}}};class TW{constructor(t){E(this,"layer",void 0),this.layer=t}pickRender(t){const n=this.layer.getContainer().layerService,i=this.layer;if(i.tileLayer)return i.tileLayer.pickRender(t);i.hooks.beforePickingEncode.call(),n.renderTileLayerMask(i),i.renderModels({ispick:!0}),i.hooks.afterPickingEncode.call()}pick(t,r){var n=this;return ve(function*(){const o=n.layer.getContainer().pickingService;return t.type==="RasterLayer"?n.pickRasterLayer(t,r):(n.pickRender(r),o.pickFromPickingFBO(t,r))})()}pickRasterLayer(t,r,n){const i=this.layer.getContainer(),o=i.pickingService,a=i.mapService,s=this.layer.getSource().extent,u=eU(r.lngLat,s),l={x:r.x,y:r.y,type:r.type,lngLat:r.lngLat,target:r,rasterValue:null},f=n||t;if(u){const c=this.readRasterValue(t,s,a,r.x,r.y);return l.rasterValue=c,o.triggerHoverOnLayer(f,l),!0}else return l.type=r.type==="mousemove"?"mouseout":"un"+r.type,o.triggerHoverOnLayer(f,he(he({},l),{},{type:"unpick"})),o.triggerHoverOnLayer(f,l),!1}readRasterValue(t,r,n,i,o){const a=t.getSource().data.dataArray[0],[s=0,u=0,l=10,f=-10]=r,c=n.lngLatToContainer([s,u]),h=n.lngLatToContainer([l,f]),d=h.x-c.x,p=c.y-h.y,v=[(i-c.x)/d,(o-h.y)/p],g=a.width||1,y=a.height||1,S=Math.floor(v[0]*g),R=Math.floor(v[1]*y),x=Math.max(0,R-1)*g+S;return a.data[x]}selectFeature(t){const r=this.layer,[n,i,o]=t;r.hooks.beforeSelect.call([n,i,o])}highlightPickedFeature(t){const[r,n,i]=t;this.layer.hooks.beforeHighlight.call([r,n,i])}getFeatureById(t){return this.layer.getSource().getFeatureById(t)}}class AW{constructor(t){E(this,"layer",void 0),E(this,"rendererService",void 0),E(this,"colorTexture",void 0),E(this,"key",void 0),this.layer=t;const r=this.layer.getContainer();this.rendererService=r.rendererService}getColorTexture(t,r){const n=this.getTextureKey(t,r);return this.key===n?this.colorTexture:(this.createColorTexture(t,r),this.key=n,this.colorTexture)}createColorTexture(t,r){const{createTexture2D:n}=this.rendererService,i=this.getColorRampBar(t,r),o=n({data:new Uint8Array(i.data),width:i.width,height:i.height,flipY:!1,unorm:!0});return this.colorTexture=o,o}setColorTexture(t,r,n){this.key=this.getTextureKey(r,n),this.colorTexture=t}destroy(){var t;(t=this.colorTexture)===null||t===void 0||t.destroy()}getColorRampBar(t,r){switch(t.type){case"cat":return S2(t);case"quantize":return x2(t);case"custom":return b2(t,r);case"linear":return A2(t,r);default:return T2(t)}}getTextureKey(t,r){var n;return`${t.colors.join("_")}_${t==null||(n=t.positions)===null||n===void 0?void 0:n.join("_")}_${t.type}_${r==null?void 0:r.join("_")}`}}const SW=["passes"],xW=["moduleName","vertexShader","fragmentShader","defines","inject","triangulation","styleOption","pickingEnabled"],{isEqual:qh,isFunction:LE,isNumber:wE,isObject:Vr,isPlainObject:bW,isUndefined:RW}=Sr;let FE=0;class Ka extends Bn.EventEmitter{get shaderModuleService(){return this.container.shaderModuleService}get cameraService(){return this.container.cameraService}get coordinateService(){return this.container.coordinateSystemService}get iconService(){return this.container.iconService}get fontService(){return this.container.fontService}get pickingService(){return this.container.pickingService}get rendererService(){return this.container.rendererService}get layerService(){return this.container.layerService}get debugService(){return this.container.debugService}get interactionService(){return this.container.interactionService}get mapService(){var t;return(t=this.container)===null||t===void 0?void 0:t.mapService}get normalPassFactory(){return this.container.normalPassFactory}constructor(t={}){super(),E(this,"id",`${FE++}`),E(this,"name",`${FE}`),E(this,"parent",void 0),E(this,"coordCenter",void 0),E(this,"type",void 0),E(this,"visible",!0),E(this,"zIndex",0),E(this,"minZoom",void 0),E(this,"maxZoom",void 0),E(this,"inited",!1),E(this,"layerModelNeedUpdate",!1),E(this,"pickedFeatureID",null),E(this,"selectedFeatureID",null),E(this,"styleNeedUpdate",!1),E(this,"rendering",void 0),E(this,"forceRender",!1),E(this,"clusterZoom",0),E(this,"layerType",void 0),E(this,"triangulation",void 0),E(this,"layerPickService",void 0),E(this,"textureService",void 0),E(this,"defaultSourceConfig",{data:[],options:{parser:{type:"json"}}}),E(this,"dataState",{dataSourceNeedUpdate:!1,dataMappingNeedUpdate:!1,filterNeedUpdate:!1,featureScaleNeedUpdate:!1,StyleAttrNeedUpdate:!1}),E(this,"hooks",{init:new S$,afterInit:new vg,beforeRender:new vg,beforeRenderData:new x$,afterRender:new ni,beforePickingEncode:new ni,afterPickingEncode:new ni,beforeHighlight:new ni(["pickedColor"]),afterHighlight:new ni,beforeSelect:new ni(["pickedColor"]),afterSelect:new ni,beforeDestroy:new ni,afterDestroy:new ni}),E(this,"models",[]),E(this,"multiPassRenderer",void 0),E(this,"plugins",void 0),E(this,"startInit",!1),E(this,"sourceOption",void 0),E(this,"layerModel",void 0),E(this,"shapeOption",void 0),E(this,"tileLayer",void 0),E(this,"layerChildren",[]),E(this,"masks",[]),E(this,"configService",OA),E(this,"styleAttributeService",void 0),E(this,"layerSource",void 0),E(this,"postProcessingPassFactory",void 0),E(this,"animateOptions",{enable:!1}),E(this,"container",void 0),E(this,"encodedData",void 0),E(this,"currentPickId",null),E(this,"rawConfig",void 0),E(this,"needUpdateConfig",void 0),E(this,"encodeStyleAttribute",{}),E(this,"enableShaderEncodeStyles",[]),E(this,"enableDataEncodeStyles",[]),E(this,"pendingStyleAttributes",[]),E(this,"scaleOptions",{}),E(this,"animateStartTime",void 0),E(this,"animateStatus",!1),E(this,"isDestroyed",!1),E(this,"uniformBuffers",[]),E(this,"encodeDataLength",0),E(this,"sourceEvent",()=>{this.dataState.dataSourceNeedUpdate=!0;const r=this.getLayerConfig();r&&r.autoFit&&this.fitBounds(r.fitBoundsOptions),this.layerSource.getSourceCfg().autoRender&&setTimeout(()=>{this.reRender()},10)}),this.name=t.name||this.id,this.zIndex=t.zIndex||0,this.rawConfig=t,this.masks=t.maskLayers||[]}addMask(t){this.masks.push(t),this.updateLayerConfig({maskLayers:this.masks}),this.enableMask()}removeMask(t){const r=this.masks.indexOf(t);r>-1&&this.masks.splice(r,1),this.updateLayerConfig({maskLayers:this.masks})}disableMask(){this.updateLayerConfig({enableMask:!1})}enableMask(){this.updateLayerConfig({enableMask:!0})}addMaskLayer(t){this.masks.push(t)}removeMaskLayer(t){const r=this.masks.indexOf(t);r>-1&&this.masks.splice(r,1),t.destroy()}getAttribute(t){return this.styleAttributeService.getLayerStyleAttribute(t)}getLayerConfig(){return this.configService.getLayerConfig(this.id)}updateLayerConfig(t){if(Object.keys(t).map(r=>{r in this.rawConfig&&(this.rawConfig[r]=t[r])}),!this.startInit)this.needUpdateConfig=he(he({},this.needUpdateConfig),t);else{const r=this.container.id;this.configService.setLayerConfig(r,this.id,he(he(he({},this.configService.getLayerConfig(this.id)),this.needUpdateConfig),t)),this.needUpdateConfig={}}}setContainer(t){this.container=t}getContainer(){return this.container}addPlugin(t){return this.plugins.push(t),this}init(){var t=this;return ve(function*(){const r=t.container.id;t.startInit=!0,t.configService.setLayerConfig(r,t.id,t.rawConfig),t.layerType=t.rawConfig.layerType;const{enableMultiPassRenderer:n,passes:i}=t.getLayerConfig();n&&i!==null&&i!==void 0&&i.length&&i.length>0&&t.mapService.on("mapAfterFrameChange",()=>{t.renderLayers()}),t.postProcessingPassFactory=t.container.postProcessingPassFactory,t.styleAttributeService=t.container.styleAttributeService,n&&(t.multiPassRenderer=t.container.multiPassRenderer,t.multiPassRenderer.setLayer(t)),t.pendingStyleAttributes.forEach(({attributeName:o,attributeField:a,attributeValues:s,updateOptions:u})=>{t.styleAttributeService.updateStyleAttribute(o,{scale:he({field:a},t.splitValuesAndCallbackInAttribute(s,a?void 0:t.getLayerConfig()[o]))},u)}),t.pendingStyleAttributes=[],t.plugins=yW();for(const o of t.plugins)o.apply(t,t.container);t.layerPickService=new TW(t),t.textureService=new AW(t),t.log(Fr.LayerInitStart),yield t.hooks.init.promise(),t.log(Fr.LayerInitEnd),t.inited=!0,t.emit("inited",{target:t,type:"inited"}),t.emit("add",{target:t,type:"add"}),t.hooks.afterInit.call()})()}log(t,r="init"){var n;if(this.tileLayer||this.isTileLayer)return;const i=`${this.id}.${r}.${t}`,o={id:this.id,type:this.type};(n=this.debugService)===null||n===void 0||n.log(i,o)}updateModelData(t){t.attributes&&t.elements?this.models.map(r=>{r.updateAttributesAndElements(t.attributes,t.elements)}):console.warn("data error")}setLayerPickService(t){this.layerPickService=t}prepareBuildModel(){Object.keys(this.needUpdateConfig||{}).length!==0&&this.updateLayerConfig({});const{animateOption:t}=this.getLayerConfig();t!=null&&t.enable&&(this.layerService.startAnimate(),this.animateStatus=!0)}color(t,r,n){return this.updateStyleAttribute("color",t,r,n),this}texture(t,r,n){return this.updateStyleAttribute("texture",t,r,n),this}rotate(t,r,n){return this.updateStyleAttribute("rotate",t,r,n),this}size(t,r,n){return this.updateStyleAttribute("size",t,r,n),this}filter(t,r,n){const i=this.updateStyleAttribute("filter",t,r,n);return this.dataState.dataSourceNeedUpdate=i&&this.inited,this}shape(t,r,n){this.shapeOption={field:t,values:r};const i=this.updateStyleAttribute("shape",t,r,n);return this.dataState.dataSourceNeedUpdate=i&&this.inited,this}label(t,r,n){return this.pendingStyleAttributes.push({attributeName:"label",attributeField:t,attributeValues:r,updateOptions:n}),this}animate(t){let r={};return Vr(t)?(r.enable=!0,r=he(he({},r),t)):r.enable=t,this.updateLayerConfig({animateOption:r}),this}source(t,r){return(t==null?void 0:t.type)==="source"?(this.setSource(t),this):(this.sourceOption={data:t,options:r},this.clusterZoom=0,this)}setData(t,r){return this.inited?(this.dataUpdatelog(),this.layerSource.setData(t,r)):this.on("inited",()=>{this.dataUpdatelog(),this.layerSource.setData(t,r)}),this}dataUpdatelog(){this.log(Fr.SourceInitStart,jr.UPDATE),this.layerSource.once("update",()=>{this.log(Fr.SourceInitEnd,jr.UPDATE)})}style(t){const{passes:r}=t,n=ai(t,SW);r&&SS(r).forEach(o=>{const a=this.multiPassRenderer.getPostProcessor().getPostProcessingPassByName(o[0]);a&&a.updateOptions(o[1])}),n.borderColor&&(n.stroke=n.borderColor),n.borderWidth&&(n.strokeWidth=n.borderWidth);const i=n;return Object.keys(n).forEach(o=>{const a=n[o];Array.isArray(a)&&a.length===2&&!wE(a[0])&&!wE(a[1])&&(i[o]={field:a[0],value:a[1]})}),this.encodeStyle(i),this.updateLayerConfig(i),this}encodeStyle(t){Object.keys(t).forEach(r=>{[...this.enableShaderEncodeStyles,...this.enableDataEncodeStyles].includes(r)&&bW(t[r])&&(t[r].field||t[r].value)&&!qh(this.encodeStyleAttribute[r],t[r])?(this.encodeStyleAttribute[r]=t[r],this.updateStyleAttribute(r,t[r].field,t[r].value),this.inited&&(this.dataState.dataMappingNeedUpdate=!0)):this.encodeStyleAttribute[r]&&(delete this.encodeStyleAttribute[r],this.dataState.dataSourceNeedUpdate=!0)})}scale(t,r){const n=he({},this.scaleOptions);if(Vr(t)?this.scaleOptions=he(he({},this.scaleOptions),t):this.scaleOptions[t]=r,this.styleAttributeService&&!qh(n,this.scaleOptions)){const i=Vr(t)?t:{[t]:r};this.styleAttributeService.updateScaleAttribute(i)}return this}renderLayers(){this.rendering=!0,this.layerService.reRender(),this.rendering=!1}prerender(){}render(t={}){return this.tileLayer?(this.tileLayer.render(),this):(this.layerService.beforeRenderData(this),this.encodeDataLength<=0&&!this.forceRender?this:(this.renderModels(t),this))}renderMultiPass(){var t=this;return ve(function*(){t.encodeDataLength<=0&&!t.forceRender||(t.multiPassRenderer&&t.multiPassRenderer.getRenderFlag()?yield t.multiPassRenderer.render():t.renderModels())})()}active(t){const r={};return r.enableHighlight=Vr(t)?!0:t,Vr(t)?(r.enableHighlight=!0,t.color&&(r.highlightColor=t.color),t.mix&&(r.activeMix=t.mix)):r.enableHighlight=!!t,this.updateLayerConfig(r),this}setActive(t,r){if(Vr(t)){const{x:n=0,y:i=0}=t;this.updateLayerConfig({highlightColor:Vr(r)?r.color:this.getLayerConfig().highlightColor,activeMix:Vr(r)?r.mix:this.getLayerConfig().activeMix}),this.pick({x:n,y:i})}else this.updateLayerConfig({pickedFeatureID:t,highlightColor:Vr(r)?r.color:this.getLayerConfig().highlightColor,activeMix:Vr(r)?r.mix:this.getLayerConfig().activeMix}),this.hooks.beforeHighlight.call(La(t)).then(()=>{setTimeout(()=>{this.reRender()},1)})}select(t){const r={};return r.enableSelect=Vr(t)?!0:t,Vr(t)?(r.enableSelect=!0,t.color&&(r.selectColor=t.color),t.mix&&(r.selectMix=t.mix)):r.enableSelect=!!t,this.updateLayerConfig(r),this}setSelect(t,r){if(Vr(t)){const{x:n=0,y:i=0}=t;this.updateLayerConfig({selectColor:Vr(r)?r.color:this.getLayerConfig().selectColor,selectMix:Vr(r)?r.mix:this.getLayerConfig().selectMix}),this.pick({x:n,y:i})}else this.updateLayerConfig({pickedFeatureID:t,selectColor:Vr(r)?r.color:this.getLayerConfig().selectColor,selectMix:Vr(r)?r.mix:this.getLayerConfig().selectMix}),this.hooks.beforeSelect.call(La(t)).then(()=>{setTimeout(()=>{this.reRender()},1)})}setBlend(t){return this.updateLayerConfig({blend:t}),this.reRender(),this}show(){return this.updateLayerConfig({visible:!0}),this.reRender(),this.emit("show"),this}hide(){return this.updateLayerConfig({visible:!1}),this.reRender(),this.emit("hide"),this}setIndex(t){return this.zIndex=t,this.layerService.updateLayerRenderList(),this.layerService.renderLayers(),this}setCurrentPickId(t){this.currentPickId=t}getCurrentPickId(){return this.currentPickId}setCurrentSelectedId(t){this.selectedFeatureID=t}getCurrentSelectedId(){return this.selectedFeatureID}isVisible(){const t=this.mapService.getZoom(),{visible:r,minZoom:n=-1/0,maxZoom:i=1/0}=this.getLayerConfig();return!!r&&t>=n&&t<i}setMultiPass(t,r){if(this.updateLayerConfig({enableMultiPassRenderer:t}),r&&this.updateLayerConfig({passes:r}),t){const{passes:n=[]}=this.getLayerConfig();this.multiPassRenderer=xS(this,n,this.postProcessingPassFactory,this.normalPassFactory),this.multiPassRenderer.setRenderFlag(!0);const{width:i,height:o}=this.rendererService.getViewportSize();this.multiPassRenderer.resize(i,o)}return this}setMinZoom(t){return this.updateLayerConfig({minZoom:t}),this}getMinZoom(){const{minZoom:t}=this.getLayerConfig();return t}getMaxZoom(){const{maxZoom:t}=this.getLayerConfig();return t}get(t){return this.getLayerConfig()[t]}setMaxZoom(t){return this.updateLayerConfig({maxZoom:t}),this}setAutoFit(t){return this.updateLayerConfig({autoFit:t}),this}fitBounds(t){if(!this.inited)return this.updateLayerConfig({autoFit:!0}),this;const n=this.getSource().extent;return n.some(o=>Math.abs(o)===1/0)?this:(this.mapService.fitBounds([[n[0],n[1]],[n[2],n[3]]],t),this)}destroy(t=!0){var r,n,i,o,a;if(this.isDestroyed)return;(r=this.layerModel)===null||r===void 0||r.uniformBuffers.forEach(u=>{u.destroy()}),this.layerChildren.map(u=>u.destroy(!1)),this.layerChildren=[];const{maskfence:s}=this.getLayerConfig();s&&(this.masks.map(u=>u.destroy(!1)),this.masks=[]),this.hooks.beforeDestroy.call(),this.layerSource.off("update",this.sourceEvent),(n=this.multiPassRenderer)===null||n===void 0||n.destroy(),this.textureService.destroy(),this.styleAttributeService.clearAllAttributes(),this.hooks.afterDestroy.call(),(i=this.layerModel)===null||i===void 0||i.clearModels(t),(o=this.tileLayer)===null||o===void 0||o.destroy(),this.models=[],(a=this.debugService)===null||a===void 0||a.removeLog(this.id),this.emit("remove",{target:this,type:"remove"}),this.emit("destroy",{target:this,type:"destroy"}),this.removeAllListeners(),this.isDestroyed=!0}clear(){this.styleAttributeService.clearAllAttributes()}clearModels(){var t;this.models.forEach(r=>r.destroy()),(t=this.layerModel)===null||t===void 0||t.clearModels(),this.models=[]}isDirty(){return!!(this.styleAttributeService.getLayerStyleAttributes()||[]).filter(t=>t.needRescale||t.needRemapping||t.needRegenerateVertices).length}setSource(t){if(this.layerSource&&this.layerSource.off("update",this.sourceEvent),this.layerSource=t,this.clusterZoom=0,this.inited&&this.layerSource.cluster){const r=this.mapService.getZoom();this.layerSource.updateClusterData(r)}this.layerSource.inited&&this.sourceEvent(),this.layerSource.on("update",({type:r})=>{if(this.coordCenter===void 0){const n=this.layerSource.center;this.coordCenter=n}if(r==="update"){if(this.tileLayer){this.tileLayer.reload();return}this.sourceEvent()}})}getSource(){return this.layerSource}getScaleOptions(){return this.scaleOptions}setEncodedData(t){this.encodedData=t,this.encodeDataLength=t.length}getEncodedData(){return this.encodedData}getScale(t){return this.styleAttributeService.getLayerAttributeScale(t)}getLegend(t){var r,n,i;const o=this.styleAttributeService.getLayerStyleAttribute(t);return{type:(n=((o==null||(r=o.scale)===null||r===void 0?void 0:r.scalers)||[])[0])===null||n===void 0||(n=n.option)===null||n===void 0?void 0:n.type,field:o==null||(i=o.scale)===null||i===void 0?void 0:i.field,items:this.getLegendItems(t)}}getLegendItems(t){const r=this.styleAttributeService.getLayerAttributeScale(t);return r?r.invertExtent?r.range().map(i=>({value:r.invertExtent(i),[t]:i})):r.ticks?r.ticks().map(i=>({value:i,[t]:r(i)})):r!=null&&r.domain?r.domain().filter(i=>!RW(i)).map(i=>({value:i,[t]:r(i)})):[]:[]}pick({x:t,y:r}){this.interactionService.triggerHover({x:t,y:r})}boxSelect(t,r){this.pickingService.boxPickLayer(this,t,r)}buildLayerModel(t){var r=this;return ve(function*(){const{moduleName:n,vertexShader:i,fragmentShader:o,defines:a,inject:s,triangulation:u,styleOption:l,pickingEnabled:f=!0}=t,c=ai(t,xW);r.shaderModuleService.registerModule(n,{vs:i,fs:o,defines:a,inject:s});const{vs:h,fs:d,uniforms:p}=r.shaderModuleService.getModule(n),{createModel:v}=r.rendererService;return new Promise(g=>{const{attributes:y,elements:S,count:R}=r.styleAttributeService.createAttributesAndIndices(r.encodedData,u,l,r),x=[...r.layerModel.uniformBuffers,...r.rendererService.uniformBuffers];f&&x.push(r.getPickingUniformBuffer());const M=he({attributes:y,uniforms:p,fs:d,vs:h,elements:S,blend:bS[Ui.normal],uniformBuffers:x,textures:r.layerModel.textures},c);R&&(M.count=R);const $=v(M);g($)})})()}createAttributes(t){const{triangulation:r}=t,{attributes:n}=this.styleAttributeService.createAttributes(this.encodedData,r);return n}getTime(){return this.layerService.clock.getDelta()}setAnimateStartTime(){this.animateStartTime=this.layerService.clock.getElapsedTime()}stopAnimate(){this.animateStatus&&(this.layerService.stopAnimate(),this.animateStatus=!1,this.updateLayerConfig({animateOption:{enable:!1}}))}getLayerAnimateTime(){return this.layerService.clock.getElapsedTime()-this.animateStartTime}needPick(t){const{enableHighlight:r=!0,enableSelect:n=!0}=this.getLayerConfig();let i=this.eventNames().indexOf(t)!==-1||this.eventNames().indexOf("un"+t)!==-1;return(t==="click"||t==="dblclick")&&n&&(i=!0),t==="mousemove"&&(r||this.eventNames().indexOf("mouseenter")!==-1||this.eventNames().indexOf("unmousemove")!==-1||this.eventNames().indexOf("mouseout")!==-1)&&(i=!0),this.isVisible()&&i}buildModels(){return ve(function*(){throw new Error("Method not implemented.")})()}rebuildModels(){var t=this;return ve(function*(){yield t.buildModels()})()}renderMulPass(t){return ve(function*(){yield t.render()})()}renderModels(t={}){return this.encodeDataLength<=0&&!this.forceRender?(this.clearModels(),this):(this.hooks.beforeRender.call(),this.models.forEach(r=>{r.draw({uniforms:this.layerModel.getUninforms(),blend:this.layerModel.getBlend(),stencil:this.layerModel.getStencil(t),textures:this.layerModel.textures},(t==null?void 0:t.ispick)||!1)}),this.hooks.afterRender.call(),this)}updateStyleAttribute(t,r,n,i){const o=this.configService.getAttributeConfig(this.id)||{};return qh(o[t],{field:r,values:n})?!1:(["color","size","texture","rotate","filter","label","shape"].indexOf(t)!==-1&&this.configService.setAttributeConfig(this.id,{[t]:{field:r,values:n}}),this.startInit?this.styleAttributeService.updateStyleAttribute(t,{scale:he({field:r},this.splitValuesAndCallbackInAttribute(n,this.getLayerConfig()[r]))},i):this.pendingStyleAttributes.push({attributeName:t,attributeField:r,attributeValues:n,updateOptions:i}),!0)}getLayerAttributeConfig(){return this.configService.getAttributeConfig(this.id)}getShaderPickStat(){return this.layerService.getShaderPickStat()}setEarthTime(t){console.warn("empty fn")}processData(t){return t}getModelType(){throw new Error("Method not implemented.")}getDefaultConfig(){return{}}initLayerModels(){var t=this;return ve(function*(){t.models.forEach(n=>n.destroy()),t.models=[],t.uniformBuffers.forEach(n=>{n.destroy()}),t.uniformBuffers=[];const r=t.rendererService.createBuffer({data:new Float32Array(20).fill(0),isUBO:!0,label:"pickingUniforms"});t.uniformBuffers.push(r),t.models=yield t.layerModel.initModels()})()}getPickingUniformBuffer(){return this.uniformBuffers[0]}reRender(){this.inited&&this.layerService.reRender()}splitValuesAndCallbackInAttribute(t){return{values:LE(t)?void 0:t,callback:LE(t)?t:void 0}}}function CW(e,t){return{enable:e,mask:255,func:{cmp:m.EQUAL,ref:t?1:0,mask:1}}}function BE(e){return e.maskOperation===uf.OR?{enable:!0,mask:255,func:{cmp:m.ALWAYS,ref:1,mask:255},opFront:{fail:m.KEEP,zfail:m.REPLACE,zpass:m.REPLACE}}:{enable:!0,mask:255,func:{cmp:e.stencilType===go.SINGLE||e.stencilIndex===0?m.ALWAYS:m.LESS,ref:e.stencilType===go.SINGLE?1:e.stencilIndex===0?2:1,mask:255},opFront:{fail:m.KEEP,zfail:m.REPLACE,zpass:m.REPLACE}}}const OW={opacity:1,stroke:[1,0,0,1],offsets:[0,0],rotation:0,extrusionBase:0,strokeOpacity:1,thetaOffset:.314},Ll={opacity:"float",stroke:"vec4",offsets:"vec2",textOffset:"vec2",rotation:"float",extrusionBase:"float",strokeOpacity:"float",thetaOffset:"float"};var e_={exports:{}};e_.exports=df;e_.exports.default=df;function df(e,t,r){r=r||2;var n=t&&t.length,i=n?t[0]*r:e.length,o=RS(e,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s,u,l,f,c,h,d;if(n&&(o=LW(e,t,o,r)),e.length>80*r){s=l=e[0],u=f=e[1];for(var p=r;p<i;p+=r)c=e[p],h=e[p+1],c<s&&(s=c),h<u&&(u=h),c>l&&(l=c),h>f&&(f=h);d=Math.max(l-s,f-u),d=d!==0?32767/d:0}return Au(o,a,r,s,u,d,0),a}function RS(e,t,r,n,i){var o,a;if(i===Yd(e,t,r,n)>0)for(o=t;o<r;o+=n)a=DE(o,e[o],e[o+1],a);else for(o=r-n;o>=t;o-=n)a=DE(o,e[o],e[o+1],a);return a&&pf(a,a.next)&&(xu(a),a=a.next),a}function Ro(e,t){if(!e)return e;t||(t=e);var r=e,n;do if(n=!1,!r.steiner&&(pf(r,r.next)||hr(r.prev,r,r.next)===0)){if(xu(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function Au(e,t,r,n,i,o,a){if(e){!a&&o&&UW(e,n,i,o);for(var s=e,u,l;e.prev!==e.next;){if(u=e.prev,l=e.next,o?MW(e,n,i,o):IW(e)){t.push(u.i/r|0),t.push(e.i/r|0),t.push(l.i/r|0),xu(e),e=l.next,s=l.next;continue}if(e=l,e===s){a?a===1?(e=NW(Ro(e),t,r),Au(e,t,r,n,i,o,2)):a===2&&PW(e,t,r,n,i,o):Au(Ro(e),t,r,n,i,o,1);break}}}}function IW(e){var t=e.prev,r=e,n=e.next;if(hr(t,r,n)>=0)return!1;for(var i=t.x,o=r.x,a=n.x,s=t.y,u=r.y,l=n.y,f=i<o?i<a?i:a:o<a?o:a,c=s<u?s<l?s:l:u<l?u:l,h=i>o?i>a?i:a:o>a?o:a,d=s>u?s>l?s:l:u>l?u:l,p=n.next;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=c&&p.y<=d&&Ea(i,s,o,u,a,l,p.x,p.y)&&hr(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function MW(e,t,r,n){var i=e.prev,o=e,a=e.next;if(hr(i,o,a)>=0)return!1;for(var s=i.x,u=o.x,l=a.x,f=i.y,c=o.y,h=a.y,d=s<u?s<l?s:l:u<l?u:l,p=f<c?f<h?f:h:c<h?c:h,v=s>u?s>l?s:l:u>l?u:l,g=f>c?f>h?f:h:c>h?c:h,y=Wd(d,p,t,r,n),S=Wd(v,g,t,r,n),R=e.prevZ,x=e.nextZ;R&&R.z>=y&&x&&x.z<=S;){if(R.x>=d&&R.x<=v&&R.y>=p&&R.y<=g&&R!==i&&R!==a&&Ea(s,f,u,c,l,h,R.x,R.y)&&hr(R.prev,R,R.next)>=0||(R=R.prevZ,x.x>=d&&x.x<=v&&x.y>=p&&x.y<=g&&x!==i&&x!==a&&Ea(s,f,u,c,l,h,x.x,x.y)&&hr(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;R&&R.z>=y;){if(R.x>=d&&R.x<=v&&R.y>=p&&R.y<=g&&R!==i&&R!==a&&Ea(s,f,u,c,l,h,R.x,R.y)&&hr(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;x&&x.z<=S;){if(x.x>=d&&x.x<=v&&x.y>=p&&x.y<=g&&x!==i&&x!==a&&Ea(s,f,u,c,l,h,x.x,x.y)&&hr(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function NW(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!pf(i,o)&&CS(i,n,n.next,o)&&Su(i,o)&&Su(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),xu(n),xu(n.next),n=e=o),n=n.next}while(n!==e);return Ro(n)}function PW(e,t,r,n,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&zW(a,s)){var u=OS(a,s);a=Ro(a,a.next),u=Ro(u,u.next),Au(a,t,r,n,i,o,0),Au(u,t,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==e)}function LW(e,t,r,n){var i=[],o,a,s,u,l;for(o=0,a=t.length;o<a;o++)s=t[o]*n,u=o<a-1?t[o+1]*n:e.length,l=RS(e,s,u,n,!1),l===l.next&&(l.steiner=!0),i.push($W(l));for(i.sort(wW),o=0;o<i.length;o++)r=FW(i[o],r);return r}function wW(e,t){return e.x-t.x}function FW(e,t){var r=BW(e,t);if(!r)return t;var n=OS(r,e);return Ro(n,n.next),Ro(r,r.next)}function BW(e,t){var r=t,n=e.x,i=e.y,o=-1/0,a;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,a=r.x<r.next.x?r:r.next,s===n))return a}r=r.next}while(r!==t);if(!a)return null;var u=a,l=a.x,f=a.y,c=1/0,h;r=a;do n>=r.x&&r.x>=l&&n!==r.x&&Ea(i<f?n:o,i,l,f,i<f?o:n,i,r.x,r.y)&&(h=Math.abs(i-r.y)/(n-r.x),Su(r,e)&&(h<c||h===c&&(r.x>a.x||r.x===a.x&&DW(a,r)))&&(a=r,c=h)),r=r.next;while(r!==u);return a}function DW(e,t){return hr(e.prev,e,t.prev)<0&&hr(t.next,e,e.next)<0}function UW(e,t,r,n){var i=e;do i.z===0&&(i.z=Wd(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,kW(i)}function kW(e){var t,r,n,i,o,a,s,u,l=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;t<l&&(s++,n=n.nextZ,!!n);t++);for(u=l;s>0||u>0&&n;)s!==0&&(u===0||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(a>1);return e}function Wd(e,t,r,n,i){return e=(e-r)*i|0,t=(t-n)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function $W(e){var t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Ea(e,t,r,n,i,o,a,s){return(i-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(n-s)>=(r-a)*(t-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function zW(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!VW(e,t)&&(Su(e,t)&&Su(t,e)&&HW(e,t)&&(hr(e.prev,e,t.prev)||hr(e,t.prev,t))||pf(e,t)&&hr(e.prev,e,e.next)>0&&hr(t.prev,t,t.next)>0)}function hr(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function pf(e,t){return e.x===t.x&&e.y===t.y}function CS(e,t,r,n){var i=Fl(hr(e,t,r)),o=Fl(hr(e,t,n)),a=Fl(hr(r,n,e)),s=Fl(hr(r,n,t));return!!(i!==o&&a!==s||i===0&&wl(e,r,t)||o===0&&wl(e,n,t)||a===0&&wl(r,e,n)||s===0&&wl(r,t,n))}function wl(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Fl(e){return e>0?1:e<0?-1:0}function VW(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&CS(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function Su(e,t){return hr(e.prev,e,e.next)<0?hr(e,t,e.next)>=0&&hr(e,e.prev,t)>=0:hr(e,t,e.prev)<0||hr(e,e.next,t)<0}function HW(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function OS(e,t){var r=new Gd(e.i,e.x,e.y),n=new Gd(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function DE(e,t,r,n){var i=new Gd(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function xu(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 Gd(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}df.deviation=function(e,t,r,n){var i=t&&t.length,o=i?t[0]*r:e.length,a=Math.abs(Yd(e,0,o,r));if(i)for(var s=0,u=t.length;s<u;s++){var l=t[s]*r,f=s<u-1?t[s+1]*r:e.length;a-=Math.abs(Yd(e,l,f,r))}var c=0;for(s=0;s<n.length;s+=3){var h=n[s]*r,d=n[s+1]*r,p=n[s+2]*r;c+=Math.abs((e[h]-e[p])*(e[d+1]-e[h+1])-(e[h]-e[d])*(e[p+1]-e[h+1]))}return a===0&&c===0?0:Math.abs((c-a)/a)};function Yd(e,t,r,n){for(var i=0,o=t,a=r-n;o<r;o+=n)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}df.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var a=0;a<t;a++)r.vertices.push(e[i][o][a]);i>0&&(n+=e[i-1].length,r.holes.push(n))}return r};var jW=e_.exports;const bu=Ht(jW);function UE(e){return Math.max(Math.ceil(e/4)*4,4)}function IS(e,t,r,n=!0){const i=r===3;if(n){e=e.slice();const a=[];for(let s=0;s<e.length;s+=r){a[0]=e[s],a[1]=e[s+1],i&&(a[2]=e[s+2]);const u=Zl(a,!0,{enable:!1,decimal:1});e[s]=u[0],e[s+1]=u[1],i&&(e[s+2]=u[2])}}return bu(e,t,r)}const MS="ATTRIBUTE_LOCATION_";class Qt{get attributeLocation(){return he({},zi)}constructor(t){E(this,"triangulation",void 0),E(this,"uniformBuffers",[]),E(this,"textures",[]),E(this,"createTexture2D",void 0),E(this,"preStyleAttribute",{}),E(this,"encodeStyleAttribute",{}),E(this,"layer",void 0),E(this,"dataTexture",void 0),E(this,"DATA_TEXTURE_WIDTH",void 0),E(this,"dataTextureTest",void 0),E(this,"configService",void 0),E(this,"shaderModuleService",void 0),E(this,"rendererService",void 0),E(this,"iconService",void 0),E(this,"fontService",void 0),E(this,"styleAttributeService",void 0),E(this,"mapService",void 0),E(this,"cameraService",void 0),E(this,"layerService",void 0),E(this,"pickingService",void 0),E(this,"attributeUnifoms",void 0),E(this,"commonUnifoms",void 0),this.layer=t,this.configService=t.getContainer().globalConfigService,this.rendererService=t.getContainer().rendererService,this.pickingService=t.getContainer().pickingService,this.shaderModuleService=t.getContainer().shaderModuleService,this.styleAttributeService=t.getContainer().styleAttributeService,this.mapService=t.getContainer().mapService,this.iconService=t.getContainer().iconService,this.fontService=t.getContainer().fontService,this.cameraService=t.getContainer().cameraService,this.layerService=t.getContainer().layerService,this.registerStyleAttribute(),this.registerBuiltinAttributes(),this.startModelAnimate();const{createTexture2D:r}=this.rendererService;this.createTexture2D=r}getBlend(){const{blend:t="normal"}=this.layer.getLayerConfig();return bS[Ui[t]]}getStencil(t){const{mask:r=!1,maskInside:n=!0,enableMask:i,maskOperation:o=uf.AND}=this.layer.getLayerConfig();if(this.layer.type==="MaskLayer")return BE({isStencil:!0,stencilType:go.SINGLE});if(t.isStencil)return BE(he(he({},t),{},{maskOperation:o}));const a=r||i&&this.layer.masks.length!==0||this.layer.tileMask!==void 0;return CW(a,n)}getDefaultStyle(){return{}}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());this.updateStyleUnifoms();const n=he(he({},r.uniformsOption),t.uniformsOption);return Object.keys(n).forEach(i=>{typeof n[i]=="boolean"&&(n[i]=n[i]?1:0)}),!this.rendererService.hasOwnProperty("device")&&this.textures&&this.textures.length===1&&(n.u_texture=this.textures[0]),n}getAnimateUniforms(){return{}}needUpdate(){return ve(function*(){return!1})()}buildModels(){return ve(function*(){throw new Error("Method not implemented.")})()}initModels(){return ve(function*(){throw new Error("Method not implemented.")})()}clearModels(t=!0){}getAttribute(){throw new Error("Method not implemented.")}prerender(){}render(t){throw new Error("Method not implemented.")}registerBuiltinAttributes(){throw new Error("Method not implemented.")}animateOption2Array(t){return[t.enable?0:1,t.duration||4,t.interval||.2,t.trailLength||.1]}startModelAnimate(){const{animateOption:t}=this.layer.getLayerConfig();t.enable&&this.layer.setAnimateStartTime()}getInject(){return XW(this.layer.enableShaderEncodeStyles,this.layer.encodeStyleAttribute)}getDefines(){const t=Object.keys(this.attributeLocation).reduce((r,n)=>{const i=MS+n;return r[i]=this.attributeLocation[n],r},{});return he({},t)}getStyleAttribute(){const t={};return this.layer.enableShaderEncodeStyles.forEach(r=>{if(!this.layer.encodeStyleAttribute[r]){const n=this.layer.getLayerConfig()[r];let i=typeof n>"u"?OW[r]:n;r==="stroke"&&(i=Zt(i)),t["u_"+r]=i}}),t}registerStyleAttribute(){Object.keys(this.layer.encodeStyleAttribute).forEach(t=>{const r=fW(t);r&&this.styleAttributeService.registerStyleAttribute(r)})}registerPosition64LowAttribute(t=!0){this.styleAttributeService.registerStyleAttribute({name:"position64Low",type:qe.Attribute,descriptor:{name:"a_Position64Low",shaderLocation:this.attributeLocation.POSITION_64LOW,buffer:{data:[],type:m.FLOAT},size:2,update:(r,n,i)=>t?[Ir(i[0]),Ir(i[1])]:[0,0]}})}updateEncodeAttribute(t,r){this.encodeStyleAttribute[t]=r}initUniformsBuffer(){const t=this.getUniformsBufferInfo(this.getStyleAttribute()),r=this.getCommonUniformsInfo();t.uniformsLength!==0&&(this.attributeUnifoms=this.rendererService.createBuffer({data:new Float32Array(UE(t.uniformsLength)).fill(0),isUBO:!0,label:"layerModelAttributeUnifoms"}),this.uniformBuffers.push(this.attributeUnifoms)),r.uniformsLength!==0&&(this.commonUnifoms=this.rendererService.createBuffer({data:new Float32Array(UE(r.uniformsLength)).fill(0),isUBO:!0,label:"layerModelCommonUnifoms"}),this.uniformBuffers.push(this.commonUnifoms))}getUniformsBufferInfo(t){let r=0;const n=[];return Object.values(t).forEach(i=>{Array.isArray(i)?(n.push(...i),r+=i.length):typeof i=="number"?(n.push(i),r+=1):typeof i=="boolean"&&(n.push(Number(i)),r+=1)}),{uniformsOption:t,uniformsLength:r,uniformsArray:n}}getCommonUniformsInfo(){return{uniformsLength:0,uniformsArray:[],uniformsOption:{}}}updateStyleUnifoms(){var t,r;const{uniformsArray:n}=this.getUniformsBufferInfo(this.getStyleAttribute()),{uniformsArray:i}=this.getCommonUniformsInfo();(t=this.attributeUnifoms)===null||t===void 0||t.subData({offset:0,data:new Uint8Array(new Float32Array(n).buffer)}),(r=this.commonUnifoms)===null||r===void 0||r.subData({offset:0,data:new Uint8Array(new Float32Array(i).buffer)})}}function XW(e,t){const r=[];let n="";e.forEach(a=>{const s=a.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase(),u=MS+s;t[a]?n+=`#define USE_ATTRIBUTE_${s} 0.0
`:r.push(` ${Ll[a]} u_${a};`),n+=`
#ifdef USE_ATTRIBUTE_${s}
layout(location = ${u}) in ${Ll[a]} a_${a.charAt(0).toUpperCase()+a.slice(1)};
#endif
`});const i=r.length?`
layout(std140) uniform AttributeUniforms {
${r.join(`
`)}
};
`:"";n+=i;let o="";return e.forEach(a=>{const s=a.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase();o+=`
#ifdef USE_ATTRIBUTE_${s}
${Ll[a]} ${a} = a_${a.charAt(0).toUpperCase()+a.slice(1)};
#else
${Ll[a]} ${a} = u_${a};
#endif
`}),{"vs:#decl":n,"fs:#decl":i,"vs:#main-start":o}}let kE=function(e){return e.VERTICAL="vertical",e.HORIZONTAL="horizontal",e}({}),WW=function(e){return e.NORMAL="normal",e.REPLACE="replace",e}({}),t_=function(e){return e[e.pixel=0]="pixel",e[e.meter=1]="meter",e}({});const NS=100;function $E(e){return e/180*Math.acos(-1)}function PS(e){const t=$E(e[0])+Math.PI/2,r=$E(e[1]),n=NS+Math.random()*.4,i=n*Math.cos(r)*Math.cos(t),o=n*Math.cos(r)*Math.sin(t),a=n*Math.sin(r);return[o,a,i]}const zE=hn();hn();const Cn=hn(),ws=hn(),Bl=hn();function VE(e,t,r,n,i){ki(e,r,n),Ec(e,e),t=Cd(-e[1],e[0]);const o=Cd(-r[1],r[0]);return[i/Id(t,o),t]}function Fs(e,t){return L9(e,-t[1],t[0])}function Dl(e,t,r){return dA(e,t,r),Ec(e,e),e}function HE(e,t){return e[0]===t[0]&&e[1]===t[1]}class GW{constructor(t={}){E(this,"complex",void 0),E(this,"join",void 0),E(this,"cap",void 0),E(this,"miterLimit",void 0),E(this,"thickness",void 0),E(this,"normal",void 0),E(this,"lastFlip",-1),E(this,"miter",Cd(0,0)),E(this,"started",!1),E(this,"dash",!1),E(this,"totalDistance",0),E(this,"currentIndex",0),this.join=t.join||"miter",this.cap=t.cap||"butt",this.miterLimit=t.miterLimit||10,this.thickness=t.thickness||1,this.dash=t.dash||!1,this.complex={positions:[],indices:[],normals:[],startIndex:0,indexes:[]}}simpleExtrude(t){const r=this.complex;if(t.length<=1)return r;this.lastFlip=-1,this.started=!1,this.normal=null,this.totalDistance=0;const n=t.length;let i=r.startIndex;for(let o=1;o<n;o++){const a=t[o-1],s=t[o],u=o<t.length-1?t[o+1]:null,l=this.simpleSegment(r,i,a,s,u);i+=l}if(this.dash)for(let o=0;o<r.positions.length/6;o++)r.positions[o*6+5]=this.totalDistance;return r.startIndex=r.positions.length/6,r}extrude(t){const r=this.complex;if(t.length<=1)return r;this.lastFlip=-1,this.started=!1,this.normal=null,this.totalDistance=0;const n=t.length;let i=r.startIndex;for(let o=1;o<n;o++){const a=t[o-1],s=t[o],u=o<t.length-1?t[o+1]:null,l=this.segment(r,i,a,s,u);i+=l}if(this.dash)for(let o=0;o<r.positions.length/6;o++)r.positions[o*6+5]=this.totalDistance;return r.startIndex=r.positions.length/6,r}simpleSegment(t,r,n,i,o){let a=0;const s=t.indices,u=t.positions,l=t.normals,f=Pn([i[0],i[1]]),c=Pn([n[0],n[1]]);Dl(Cn,f,c);let h=0;if(this.dash&&(h=this.lineSegmentDistance(f,c),this.totalDistance+=h),this.normal||(this.normal=hn(),Fs(this.normal,Cn)),this.started||(this.started=!0,this.extrusions(u,l,n,this.normal,this.thickness,this.totalDistance-h)),s.push(r+0,r+1,r+2),!o)Fs(this.normal,Cn),this.extrusions(u,l,i,this.normal,this.thickness,this.totalDistance),s.push(...this.lastFlip===1?[r,r+2,r+3]:[r+2,r+1,r+3]),a+=2;else{const d=Pn([o[0],o[1]]);HE(f,d)&&ki(d,f,Ec(d,Od(d,f,c))),Dl(ws,d,f);const[p,v]=VE(Bl,hn(),Cn,ws,this.thickness);let g=Id(Bl,this.normal)<0?-1:1;this.extrusions(u,l,i,v,p,this.totalDistance),s.push(...this.lastFlip===1?[r,r+2,r+3]:[r+2,r+1,r+3]),g=-1,$h(this.normal,v),a+=2,this.lastFlip=g}return a}segment(t,r,n,i,o){let a=0;const s=t.indices,u=t.positions,l=t.normals,f=this.cap==="square",c=this.join==="bevel",h=Pn([i[0],i[1]]),d=Pn([n[0],n[1]]);Dl(Cn,h,d);let p=0;if(this.dash&&(p=this.lineSegmentDistance(h,d),this.totalDistance+=p),this.normal||(this.normal=hn(),Fs(this.normal,Cn)),!this.started)if(this.started=!0,f){const v=hn(),g=hn();ki(v,this.normal,Cn),ki(g,this.normal,Cn),l.push(g[0],g[1],0),l.push(v[0],v[1],0),u.push(n[0],n[1],n[2]|0,this.totalDistance-p,-this.thickness,n[2]|0),this.complex.indexes.push(this.currentIndex),u.push(n[0],n[1],n[2]|0,this.totalDistance-p,this.thickness,n[2]|0),this.complex.indexes.push(this.currentIndex),this.currentIndex++}else this.extrusions(u,l,n,this.normal,this.thickness,this.totalDistance-p);if(s.push(r+0,r+1,r+2),o){const v=Pn([o[0],o[1]]);HE(h,v)&&ki(v,h,Ec(v,Od(v,h,d))),Dl(ws,v,h);const[g,y]=VE(Bl,hn(),Cn,ws,this.thickness);let S=Id(Bl,this.normal)<0?-1:1,R=c;!R&&this.join==="miter"&&g>this.miterLimit&&(R=!0),R?(l.push(this.normal[0],this.normal[1],0),l.push(y[0],y[1],0),u.push(i[0],i[1],i[2]|0,this.totalDistance,-this.thickness*S,i[2]|0),this.complex.indexes.push(this.currentIndex),u.push(i[0],i[1],i[2]|0,this.totalDistance,this.thickness*S,i[2]|0),this.complex.indexes.push(this.currentIndex),this.currentIndex++,s.push(...this.lastFlip!==-S?[r,r+2,r+3]:[r+2,r+1,r+3]),s.push(r+2,r+3,r+4),Fs(zE,ws),$h(this.normal,zE),l.push(this.normal[0],this.normal[1],0),u.push(i[0],i[1],i[2]|0,this.totalDistance,-this.thickness*S,i[2]|0),this.complex.indexes.push(this.currentIndex),this.currentIndex++,a+=3):(this.extrusions(u,l,i,y,g,this.totalDistance),s.push(...this.lastFlip===1?[r,r+2,r+3]:[r+2,r+1,r+3]),S=-1,$h(this.normal,y),a+=2),this.lastFlip=S}else{if(Fs(this.normal,Cn),f){const v=hn(),g=hn();dA(g,Cn,this.normal),ki(v,Cn,this.normal),l.push(g[0],g[1],0),l.push(v[0],v[1],0),u.push(i[0],i[1],i[2]|0,this.totalDistance,this.thickness,i[2]|0),this.complex.indexes.push(this.currentIndex),u.push(i[0],i[1],i[2]|0,this.totalDistance,this.thickness,i[2]|0),this.complex.indexes.push(this.currentIndex),this.currentIndex++}else this.extrusions(u,l,i,this.normal,this.thickness,this.totalDistance);s.push(...this.lastFlip===1?[r,r+2,r+3]:[r+2,r+1,r+3]),a+=2}return a}extrusions(t,r,n,i,o,a){r.push(i[0],i[1],0),r.push(i[0],i[1],0),t.push(n[0],n[1],n[2]|0,a,-o,n[2]|0),this.complex.indexes.push(this.currentIndex),t.push(n[0],n[1],n[2]|0,a,o,n[2]|0),this.complex.indexes.push(this.currentIndex),this.currentIndex++}lineSegmentDistance(t,r){const n=r[0]-t[0],i=r[1]-t[1];return Math.sqrt(n*n+i*i)}}let Bs=function(e){return e.CYLINDER="cylinder",e.SQUARECOLUMN="squareColumn",e.TRIANGLECOLUMN="triangleColumn",e.HEXAGONCOLUMN="hexagonColumn",e.PENTAGONCOLUMN="pentagonColumn",e}({}),Ds=function(e){return e.CIRCLE="circle",e.SQUARE="square",e.TRIANGLE="triangle",e.HEXAGON="hexagon",e.PENTAGON="pentagon",e}({});function Uu(e,t=0){const r=Math.PI*2/e,n=[];for(let o=0;o<e;o++)n.push(r*o+t*Math.PI/12);return n.map(o=>{const a=Math.sin(o+Math.PI/4),s=Math.cos(o+Math.PI/4);return[a,s,0]})}function Zd(){return Uu(30)}function jE(){return Uu(4)}function XE(){return Uu(3)}function WE(){return Uu(6,1)}function GE(){return Uu(5)}const Kh={[Ds.CIRCLE]:Zd,[Ds.HEXAGON]:WE,[Ds.TRIANGLE]:XE,[Ds.SQUARE]:jE,[Ds.PENTAGON]:GE,[Bs.CYLINDER]:Zd,[Bs.HEXAGONCOLUMN]:WE,[Bs.TRIANGLECOLUMN]:XE,[Bs.SQUARECOLUMN]:jE,[Bs.PENTAGONCOLUMN]:GE};function LS(e,t=!1){const r=e[0][0],n=e[0][e[0].length-1];r[0]===n[0]&&r[1]===n[1]&&(e[0]=e[0].slice(0,e[0].length-1));const i=e[0].length,o=bu.flatten(e),{vertices:a,dimensions:s,holes:u}=o,l=[],f=[],c=[];for(let d=0;d<a.length/s;d++)l.push(a[d*s],a[d*s+1],1,-1,-1),c.push(0,0,1);const h=IS(a,u,s,t);f.push(...h);for(let d=0;d<i;d++){const p=o.vertices.slice(d*s,(d+1)*s);let v=o.vertices.slice((d+1)*s,(d+2)*s);v.length===0&&(v=o.vertices.slice(0,s));const g=l.length/5;l.push(p[0],p[1],1,0,0,v[0],v[1],1,.1,0,p[0],p[1],0,0,.8,v[0],v[1],0,.1,.8);const y=YW([v[0],v[1],1],[p[0],p[1],0],[p[0],p[1],1],t);c.push(...y,...y,...y,...y),f.push(...[1,2,0,3,2,1].map(S=>S+g))}return{positions:l,index:f,normals:c}}function YW(e,t,r,n=!1){const i=Zs(),o=Zs(),a=Zs();n&&(e=Zl(e),t=Zl(t),r=Zl(r));const s=Wn(...e),u=Wn(...t),l=Wn(...r);fg(i,l,u),fg(o,s,u),M9(a,i,o);const f=Zs();return qs(f,a),f}const Ul={};function To(e){const t=Ao(e.coordinates);return{vertices:[...t,...t,...t,...t],indices:[0,1,2,2,3,0],size:t.length}}function YE(e){const t=Ao(e.coordinates),r=PS(t);return{vertices:[...r,...r,...r,...r],indices:[0,1,2,2,3,0],size:r.length}}function wS(e){const{shape:t}=e,{positions:r,index:n,normals:i}=eG(t,!1);return{vertices:r,indices:n,normals:i,size:5}}function ZW(e){const t=Ao(e.coordinates);return{vertices:[...t],indices:[0],size:t.length}}function qd(e){const{coordinates:t}=e,r=new GW({dash:!0,join:"bevel"});let n=t;n[0]&&!Array.isArray(n[0][0])&&(n=[t]),n.forEach(o=>{r.extrude(o)});const i=r.complex;return{vertices:i.positions,indices:i.indices,normals:i.normals,indexes:i.indexes,size:6}}function qW(e){const{coordinates:t}=e,r=[];if(!Array.isArray(t[0]))return{vertices:[],indices:[],normals:[],size:6,count:0};const{results:n,totalDistance:i}=KW(t);return n.map(o=>{r.push(o[0],o[1],o[2],o[3],0,i)}),{vertices:r,indices:[],normals:[],size:6,count:n.length}}function ZE(e,t){const r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function Qh(e,t){return e.length<3&&e.push(0),t!==void 0&&e.push(t),e}function KW(e){let t=e;Array.isArray(t)&&Array.isArray(t[0])&&Array.isArray(t[0][0])&&(t=e.flat());let r=0;if(t.length<2)return{results:t,totalDistance:0};{const n=[],i=Qh(t[0],r);n.push(i);for(let a=1;a<t.length-1;a++){const s=ZE(Pn(t[a-1]),Pn(t[a]));r+=s;const u=Qh(t[a],r);n.push(u),n.push(u)}const o=ZE(Pn(t[t.length-2]),Pn(t[t.length-1]));return r+=o,n.push(Qh(t[t.length-1],r)),{results:n,totalDistance:r}}}function ku(e){const{coordinates:t}=e,r=bu.flatten(t),{vertices:n,dimensions:i,holes:o}=r;return{indices:IS(n,o,i),vertices:n,size:i}}function QW(e){const{indices:t,vertices:r,size:n}=ku(e);return{indices:t,vertices:JW(r),size:n+4}}function JW(e){const t=[],{center:r,radius:n}=sU(e);for(let i=0;i<e.length;i+=2){const o=e[i],a=e[i+1];t.push(o,a,0,...r,n)}return t}function FS(e){const t=e.coordinates,{positions:r,index:n,normals:i}=LS(t,!0);return{vertices:r,indices:n,normals:i,size:5}}function _f(e){const t=e.coordinates;return{vertices:[...t[0],0,0,0,...t[1],0,1,0,...t[2],0,1,1,...t[3],0,0,1],indices:[0,1,2,0,2,3],size:5}}function r_(e,t){const{segmentNumber:r=30}=t,n=e.coordinates,i=[],o=[];for(let a=0;a<r;a++)i.push(a,1,a,n[0][0],n[0][1],n[1][0],n[1][1],a,-1,a,n[0][0],n[0][1],n[1][0],n[1][1]),a!==r-1&&o.push(...[0,1,2,1,3,2].map(s=>a*2+s));return{vertices:i,indices:o,size:7}}function eG(e,t=!1){if(Ul&&Ul[e])return Ul[e];const r=Kh[e]?Kh[e]():Kh.cylinder(),n=LS([r],t);return Ul[e]=n,n}function tG(e,t){return{type:e.type,field:"value",items:e.positions.map((r,n)=>({[t]:n>=e.colors.length?null:e.colors[n],value:r}))}}const rG=`uniform sampler2D u_texture;
layout(std140) uniform commonUniforms {
float u_opacity:1.0;
float u_brightness:1.0;
float u_contrast:1.0;
float u_saturation:1.0;
float u_gamma:1.0;
};
in vec2 v_texCoord;
out vec4 outputColor;
vec3 setContrast(vec3 rgb, float contrast) {
vec3 color = mix(vec3(0.5), rgb, contrast);
color = clamp(color, 0.0, 1.0);
return color;
}
vec3 setSaturation(vec3 rgb, float adjustment) {
const vec3 grayVector = vec3(0.2125, 0.7154, 0.0721);
vec3 intensity = vec3(dot(rgb, grayVector));
vec3 color = mix(intensity, rgb, adjustment);
color = clamp(color, 0.0, 1.0);
return color;
}
void main() {
vec4 color = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y));
//brightness
color.rgb = mix(vec3(0.0, 0.0, 0.0), color.rgb, u_brightness);
//contrast
color.rgb = setContrast(color.rgb, u_contrast);
// saturation
color.rgb = setSaturation(color.rgb, u_saturation);
// gamma
color.rgb = pow(color.rgb, vec3(u_gamma));
outputColor = color;
outputColor.a *= u_opacity;
if(outputColor.a < 0.01)
discard;
}
`,nG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
layout(std140) uniform commonUniforms {
float u_opacity:1.0;
float u_brightness:1.0;
float u_contrast:1.0;
float u_saturation:1.0;
float u_gamma:1.0;
};
out vec2 v_texCoord;
#pragma include "projection"
void main() {
v_texCoord = a_Uv;
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
}
`;let iG=class extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getCommonUniformsInfo(){const{opacity:t,brightness:r,contrast:n,saturation:i,gamma:o}=this.layer.getLayerConfig(),a={u_opacity:bs(t,1),u_brightness:bs(r,1),u_contrast:bs(n,1),u_saturation:bs(i,1),u_gamma:bs(o,1)};return this.textures=[this.texture],this.getUniformsBufferInfo(a)}initModels(){var t=this;return ve(function*(){return yield t.loadTexture(),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}loadTexture(){var t=this;return ve(function*(){const{createTexture2D:r}=t.rendererService,i=yield t.layer.getSource().data.images;t.texture=r({data:i[0],width:i[0].width,height:i[0].height,mag:m.LINEAR,min:m.LINEAR})})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"rasterImage",vertexShader:nG,fragmentShader:rG,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,blend:{enable:!0},depth:{enable:!1},pickingEnabled:!1})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}};const oG={image:iG};class aG extends Ka{constructor(...t){super(...t),E(this,"type","ImageLayer")}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new oG[r](t),yield t.initLayerModels()})()}getDefaultConfig(){const t=this.getModelType();return{image:{}}[t]}getModelType(){return"image"}}const sG=`
#define Animate 0.0
#define LineTexture 1.0
uniform sampler2D u_texture;
layout(std140) uniform commonUniorm {
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
vec4 u_dash_array;
vec4 u_sourceColor;
vec4 u_targetColor;
vec2 u_textSize;
float segmentNumber;
float u_lineDir: 1.0;
float u_icon_step: 100;
float u_line_texture: 0.0;
float u_textureBlend;
float u_blur : 0.9;
float u_line_type: 0.0;
float u_time;
float u_linearColor: 0.0;
};
in vec4 v_color;
in vec2 v_iconMapUV;
in vec4 v_lineData;
//dash
in vec4 v_dash_array;
in float v_distance_ratio;
out vec4 outputColor;
#pragma include "picking"
void main() {
if(u_dash_array!=vec4(0.0)){
float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);
if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {
discard;
};
}
float animateSpeed = 0.0; // 运动速度
outputColor = v_color;
if(u_animate.x == Animate && u_line_texture != LineTexture) {
animateSpeed = u_time / u_animate.y;
float alpha =1.0 - fract( mod(1.0- v_lineData.b, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
// alpha = smoothstep(0., 1., alpha);
alpha = clamp(alpha, 0.0, 1.0);
outputColor.a *= alpha;
}
// 当存在贴图时在底色上贴上贴图
if(u_line_texture == LineTexture) { // while load texture
float arcRadio = smoothstep( 0.0, 1.0, (v_lineData.r / segmentNumber));
// float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);
float count = v_lineData.g; // 贴图在弧线上重复的数量
float time = 0.0;
if(u_animate.x == Animate) {
time = u_time / u_animate.y;
}
float redioCount = arcRadio * count;
float u = fract(redioCount - time);
float v = v_lineData.a; // 横向 v
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
if(u_animate.x == Animate) {
float currentPlane = floor(redioCount - time);
float textureStep = floor(count * u_animate.z);
float a = mod(currentPlane, textureStep);
if(a < textureStep - 1.0) {
pattern = vec4(0.0);
}
}
if(u_textureBlend == 0.0) { // normal
pattern.a = 0.0;
outputColor = filterColor(outputColor + pattern);
} else { // replace
pattern.a *= v_color.a;
if(outputColor.a <= 0.0) {
pattern.a = 0.0;
}
outputColor = filterColor(pattern);
}
} else {
outputColor = filterColor(outputColor);
}
}`,uG=`#define Animate (0.0)
#define LineTexture (1.0)
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;
layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
layout(std140) uniform commonUniorm {
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
vec4 u_dash_array;
vec4 u_sourceColor;
vec4 u_targetColor;
vec2 u_textSize;
float segmentNumber;
float u_lineDir: 1.0;
float u_icon_step: 100;
float u_line_texture: 0.0;
float u_textureBlend;
float u_blur : 0.9;
float u_line_type: 0.0;
float u_time;
float u_linearColor: 0.0;
};
out vec4 v_color;
out vec2 v_iconMapUV;
out vec4 v_lineData;
//dash
out vec4 v_dash_array;
out float v_distance_ratio;
#pragma include "projection"
#pragma include "project"
#pragma include "picking"
float bezier3(vec3 arr, float t) {
float ut = 1.0 - t;
return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;
}
vec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {
vec2 center = target - source;
float r = length(center);
float theta = atan(center.y, center.x);
float thetaOffset = arcThetaOffset;
float r2 = r / 2.0 / cos(thetaOffset);
float theta2 = theta + thetaOffset;
vec2 mid = vec2(r2 * cos(theta2) + source.x, r2 * sin(theta2) + source.y);
if (u_lineDir == 1.0) {
// 正向
return mid;
} else {
// 逆向
// (mid + vmin)/2 = (s + t)/2
vec2 vmid = source + target - mid;
return vmid;
}
// return mid;
}
float getSegmentRatio(float index) {
// dash: index / (segmentNumber - 1.);
// normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));
// return index / (segmentNumber - 1.);
}
vec2 interpolate(vec2 source, vec2 target, float t, float arcThetaOffset) {
// if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation
vec2 mid = midPoint(source, target, arcThetaOffset);
vec3 x = vec3(source.x, mid.x, target.x);
vec3 y = vec3(source.y, mid.y, target.y);
return vec2(bezier3(x, t), bezier3(y, t));
}
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {
// normalized direction of the line
vec2 dir_screenspace = normalize(line_clipspace);
// rotate by 90 degrees
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;
return offset;
}
vec2 getNormal(vec2 line_clipspace, float offset_direction) {
// normalized direction of the line
vec2 dir_screenspace = normalize(line_clipspace);
// rotate by 90 degrees
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
return dir_screenspace.xy * sign(offset_direction);
}
void main() {
//vs中计算渐变色
if (u_linearColor == 1.0) {
float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex / segmentNumber);
} else {
v_color = a_Color;
}
v_color.a = v_color.a * opacity;
vec2 source_world = a_Instance.rg; // 起始点
vec2 target_world = a_Instance.ba; // 终点
float segmentIndex = a_Position.x;
float segmentRatio = getSegmentRatio(segmentIndex);
// 计算 dashArray 和 distanceRatio 输出到片元
float total_Distance = pixelDistance(source_world, target_world) / 2.0 * PI;
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;
v_distance_ratio = segmentIndex / segmentNumber;
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
float d_distance_ratio;
if(u_animate.x == Animate) {
d_distance_ratio = segmentIndex / segmentNumber;
if(u_lineDir != 1.0) {
d_distance_ratio = 1.0 - d_distance_ratio;
}
}
v_lineData.b = d_distance_ratio;
vec4 source = project_position(vec4(source_world, 0, 1.), a_Instance64Low.xy);
vec4 target = project_position(vec4(target_world, 0, 1.), a_Instance64Low.zw);
vec2 currPos = interpolate(source.xy, target.xy, segmentRatio, thetaOffset);
vec2 nextPos = interpolate(source.xy, target.xy, nextSegmentRatio, thetaOffset);
vec2 offset = project_pixel(
getExtrusionOffset((nextPos.xy - currPos.xy) * indexDir, a_Position.y)
);
float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
v_lineData.r = d_segmentIndex;
if(LineTexture == u_line_texture) { // 开启贴图模式
float arcDistrance = length(source - target); // 起始点和终点的距离
arcDistrance = project_pixel(arcDistrance);
v_iconMapUV = a_iconMapUV;
float pixelLen = project_pixel_texture(u_icon_step); // 贴图沿弧线方向的长度 - 随地图缩放改变
float texCount = floor(arcDistrance / pixelLen); // 贴图在弧线上重复的数量
v_lineData.g = texCount;
float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
float linePixelSize = project_pixel(a_Size); // 定点位置偏移
v_lineData.a = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值
}
gl_Position = project_common_position_to_clipspace(vec4(currPos.xy + offset, 0, 1.0));
setPickingColor(a_PickingColor);
}
`,lG={solid:0,dash:1};class cG extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,UV:12,THETA_OFFSET:13})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5],forward:a=!0,lineTexture:s=!1,iconStep:u=100,segmentNumber:l=30}=this.layer.getLayerConfig(),{animateOption:f}=this.layer.getLayerConfig();let c=o;i!=="dash"&&(c=[0,0]),c.length===2&&c.push(0,0);let h=0,d=[0,0,0,0],p=[0,0,0,0];if(t&&r&&(d=Zt(t),p=Zt(r),h=1),this.rendererService.getDirty()){var v;(v=this.texture)===null||v===void 0||v.bind()}const g={u_animate:this.animateOption2Array(f),u_dash_array:c,u_sourceColor:d,u_targetColor:p,u_textSize:[1024,this.iconService.canvasHeight||128],segmentNumber:l,u_lineDir:a?1:-1,u_icon_step:u,u_line_texture:s?1:0,u_textureBlend:n==="normal"?0:1,u_blur:.9,u_line_type:lG[i||"solid"],u_time:this.layer.getLayerAnimateTime()||0,u_linearColor:h};return this.getUniformsBufferInfo(g)}initModels(){var t=this;return ve(function*(){return t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}getShaders(){return{frag:sG,vert:uG,type:""}}buildModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const{segmentNumber:r=30}=t.layer.getLayerConfig(),{frag:n,vert:i,type:o}=t.getShaders();return[yield t.layer.buildLayerModel({moduleName:"lineArc2d"+o,vertexShader:i,fragmentShader:n,defines:t.getDefines(),inject:t.getInject(),triangulation:r_,depth:{enable:!1},styleOption:{segmentNumber:r}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}}),this.styleAttributeService.registerStyleAttribute({name:"thetaOffset",type:qe.Attribute,descriptor:{name:"a_ThetaOffset",shaderLocation:this.attributeLocation.THETA_OFFSET,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{thetaOffset:r=1}=t;return[r]}}})}}const fG=`#define LineTypeSolid 0.0
#define LineTypeDash 1.0
#define Animate 0.0
#define LineTexture 1.0
uniform sampler2D u_texture;
layout(std140) uniform commonUniorm {
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
vec4 u_dash_array: [10.0, 5., 0, 0];
vec4 u_sourceColor;
vec4 u_targetColor;
vec2 u_textSize;
float u_globel;
float u_globel_radius;
float u_global_height: 10;
float segmentNumber;
float u_line_type: 0.0;
float u_icon_step: 100;
float u_line_texture: 0.0;
float u_textureBlend;
float u_time;
float u_linearColor: 0.0;
};
in vec4 v_color;
in vec4 v_dash_array;
in float v_segmentIndex;
in vec2 v_iconMapUV;
in vec4 v_line_data;
out vec4 outputColor;
#pragma include "picking"
void main() {
float animateSpeed = 0.0; // 运动速度
float d_distance_ratio = v_line_data.g; // 当前点位距离占线总长的比例
outputColor = v_color;
if(u_line_type == LineTypeDash) {
float flag = 0.;
float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);
if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {
flag = 1.;
}
outputColor.a *=flag;
}
if(u_animate.x == Animate && u_line_texture != LineTexture) {
animateSpeed = u_time / u_animate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
// alpha = smoothstep(0., 1., alpha);
alpha = clamp(alpha, 0.0, 1.0);
outputColor.a *= alpha;
// u_animate
// x enable
// y duration
// z interval
// w trailLength
}
if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture
// float arcRadio = smoothstep( 0.0, 1.0, (v_segmentIndex / segmentNumber));
float arcRadio = v_segmentIndex / (segmentNumber - 1.0);
float count = v_line_data.b; // // 贴图在弧线上重复的数量
float time = 0.0;
if(u_animate.x == Animate) {
time = u_time / u_animate.y;
}
float redioCount = arcRadio * count;
float u = fract(redioCount - time);
float v = v_line_data.a; // 线图层贴图部分的 v 坐标值
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
if(u_animate.x == Animate) {
float currentPlane = floor(redioCount - time);
float textureStep = floor(count * u_animate.z);
float a = mod(currentPlane, textureStep);
if(a < textureStep - 1.0) {
pattern = vec4(0.0);
}
}
if(u_textureBlend == 0.0) { // normal
pattern.a = 0.0;
outputColor = filterColor(outputColor + pattern);
} else { // replace
pattern.a *= v_color.a;
if(outputColor.a <= 0.0) {
pattern.a = 0.0;
discard;
} else {
outputColor = filterColor(pattern);
}
}
} else {
outputColor = filterColor(outputColor);
}
}
`,hG=`#define LineTypeSolid 0.0
#define LineTypeDash 1.0
#define Animate 0.0
#define LineTexture 1.0
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;
layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
layout(std140) uniform commonUniorm {
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
vec4 u_dash_array: [10.0, 5., 0, 0];
vec4 u_sourceColor;
vec4 u_targetColor;
vec2 u_textSize;
float u_globel;
float u_globel_radius;
float u_global_height: 10;
float segmentNumber;
float u_line_type: 0.0;
float u_icon_step: 100;
float u_line_texture: 0.0;
float u_textureBlend;
float u_time;
float u_linearColor: 0.0;
};
out vec4 v_color;
out vec4 v_dash_array;
out float v_segmentIndex;
out vec2 v_iconMapUV;
out vec4 v_line_data;
#pragma include "projection"
#pragma include "project"
#pragma include "picking"
float maps (float value, float start1, float stop1, float start2, float stop2) {
return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
}
float getSegmentRatio(float index) {
return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));
}
float paraboloid(vec2 source, vec2 target, float ratio) {
vec2 x = mix(source, target, ratio);
vec2 center = mix(source, target, 0.5);
float dSourceCenter = distance(source, center);
float dXCenter = distance(x, center);
return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);
}
vec3 getPos(vec2 source, vec2 target, float segmentRatio) {
float vertex_height = paraboloid(source, target, segmentRatio);
return vec3(
mix(source, target, segmentRatio),
sqrt(max(0.0, vertex_height))
);
}
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {
// normalized direction of the line
vec2 dir_screenspace = normalize(line_clipspace);
// rotate by 90 degrees
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;
return offset;
}
vec2 getNormal(vec2 line_clipspace, float offset_direction) {
// normalized direction of the line
vec2 dir_screenspace = normalize(line_clipspace);
// rotate by 90 degrees
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
return dir_screenspace.xy * sign(offset_direction);
}
float torad(float deg) {
return (deg / 180.0) * acos(-1.0);
}
vec3 lglt2xyz(vec2 lnglat) {
float pi = 3.1415926;
// + Math.PI/2 是为了对齐坐标
float lng = torad(lnglat.x) + pi / 2.0;
float lat = torad(lnglat.y);
// 手动增加一些偏移,减轻面的冲突
float radius = u_globel_radius;
float z = radius * cos(lat) * cos(lng);
float x = radius * cos(lat) * sin(lng);
float y = radius * sin(lat);
return vec3(x, y, z);
}
void main() {
//vs中计算渐变色
if(u_linearColor==1.0){
float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);
}
else{
v_color = a_Color;
}
v_color.a = v_color.a * opacity;
vec2 source = project_position(vec4(a_Instance.rg, 0, 0), a_Instance64Low.xy).xy;
vec2 target = project_position(vec4(a_Instance.ba, 0, 0), a_Instance64Low.zw).xy;
float segmentIndex = a_Position.x;
float segmentRatio = getSegmentRatio(segmentIndex);
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
float d_distance_ratio;
if(u_line_type == LineTypeDash) {
d_distance_ratio = segmentIndex / segmentNumber;
float total_Distance = pixelDistance(source, target) / 2.0 * PI;
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);
}
if(u_animate.x == Animate) {
d_distance_ratio = segmentIndex / segmentNumber;
}
v_line_data.g = d_distance_ratio; // 当前点位距离占线总长的比例
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
vec3 curr = getPos(source, target, segmentRatio);
vec3 next = getPos(source, target, nextSegmentRatio);
vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y);
// v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
v_segmentIndex = a_Position.x;
if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { // 开启贴图模式
float arcDistrance = length(source - target);
float pixelLen = project_pixel_texture(u_icon_step);
v_line_data.b = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量
vec2 projectOffset = project_pixel(offset);
float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // 线横向偏移的距离
float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
v_line_data.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
v_iconMapUV = a_iconMapUV;
}
gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z * thetaOffset, 1.0));
// 地球模式
if(u_globel > 0.0) {
vec3 startLngLat = lglt2xyz(a_Instance.rg);
vec3 endLngLat = lglt2xyz(a_Instance.ba);
float globalRadius = length(startLngLat);
vec3 lineDir = normalize(endLngLat - startLngLat);
vec3 midPointDir = normalize((startLngLat + endLngLat)/2.0);
// 线的偏移
vec3 lnglatOffset = cross(lineDir, midPointDir) * a_Position.y;
// 计算起始点和终止点的距离
float lnglatLength = length(a_Instance.rg - a_Instance.ba)/50.0;
// 计算飞线各个节点相应的高度
float lineHeight = u_global_height * (-4.0*segmentRatio*segmentRatio + 4.0 * segmentRatio) * lnglatLength;
// 地球点位
vec3 globalPoint = normalize(mix(startLngLat, endLngLat, segmentRatio)) * (globalRadius + lineHeight) + lnglatOffset * a_Size;
gl_Position = u_ViewProjectionMatrix * vec4(globalPoint, 1.0);
}
setPickingColor(a_PickingColor);
}
`,dG={solid:0,dash:1};class qE extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,UV:12,THETA_OFFSET:13})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5],lineTexture:a=!1,iconStep:s=100,segmentNumber:u=30,globalArcHeight:l=10}=this.layer.getLayerConfig(),{animateOption:f}=this.layer.getLayerConfig();o.length===2&&o.push(0,0);let c=0,h=[0,0,0,0],d=[0,0,0,0];if(t&&r&&(h=Zt(t),d=Zt(r),c=1),this.rendererService.getDirty()){var p;(p=this.texture)===null||p===void 0||p.bind()}const v={u_animate:this.animateOption2Array(f),u_dash_array:o,u_sourceColor:h,u_targetColor:d,u_textSize:[1024,this.iconService.canvasHeight||128],u_globel:this.mapService.version==="GLOBEL"?1:0,u_globel_radius:NS,u_global_height:l,segmentNumber:u,u_line_type:dG[i]||0,u_icon_step:s,u_line_texture:a?1:0,u_textureBlend:n==="normal"?0:1,u_time:this.layer.getLayerAnimateTime()||0,u_linearColor:c};return this.getUniformsBufferInfo(v)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}getShaders(){return{frag:fG,vert:hG,type:""}}buildModels(){var t=this;return ve(function*(){const{segmentNumber:r=30}=t.layer.getLayerConfig(),{frag:n,vert:i,type:o}=t.getShaders();return[yield t.layer.buildLayerModel({moduleName:"lineArc3d"+o,vertexShader:i,fragmentShader:n,defines:t.getDefines(),inject:t.getInject(),triangulation:r_,styleOption:{segmentNumber:r}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}}),this.styleAttributeService.registerStyleAttribute({name:"thetaOffset",type:qe.Attribute,descriptor:{name:"a_ThetaOffset",shaderLocation:this.attributeLocation.THETA_OFFSET,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{thetaOffset:r=1}=t;return[r]}}})}}const KE={circle:2,triangle:2,diamond:4,rect:2,classic:3,halfTriangle:2,none:0},dn=1/2;function pG(e,t){const{width:r=2,height:n=1}=t;return{vertices:[0,dn*e,1*e*r,-(n+dn)*e,1*e*r,(n-dn)*e,0,dn*e,1*e*r,-(n+dn)*e,1*e*r,(n-dn)*e],indices:[3,4,5],outLineIndices:[0,1,2],normals:[1*e,-2*e,1,-2*e,1.5*e,1,1*e,1.5*e,1,0,0,0,0,0,0,0,0,0],dimensions:2}}function _G(e,t){const{width:r=2,height:n=3}=t;return{vertices:[0,0,1*e*r,1*n,1*e*r,-1*n,0,0,1*e*r,1*n,1*e*r,-1*n],outLineIndices:[0,1,2],indices:[3,4,5],normals:[0,-1.5*e,1,2,1*e,1,-2,1*e,1,0,0,0,0,0,0,0,0,0],dimensions:2}}function vG(e,t){const{width:r=2,height:n=2}=t;return{vertices:[0,n/2,e*r*1,n/2,e*r*1,-n/2,0,-n/2,0,n/2,e*r*1,n/2,e*r*1,-n/2,0,-n/2],dimensions:2,indices:[4,5,6,4,6,7],outLineIndices:[0,1,2,0,2,3],normals:[0,-e,1,1,0,1,0,-e,1,-1,-0,1,0,0,0,0,0,0,0,0,0,0,0,0]}}function mG(e,t){const{width:r=2,height:n=3}=t;return{vertices:[0,0,1*r*e,.5*n,2*r*e,0,1*r*e,-.5*n,0,0,1*r*e,.5*n,2*r*e,0,1*r*e,-.5*n],dimensions:2,indices:[4,5,6,4,6,7],outLineIndices:[0,1,2,0,2,3],normals:[0,-e,1,1,0,1,0,-e,1,-1,-0,1,0,0,0,0,0,0,0,0,0,0,0,0]}}function gG(e,t){const{width:r=2,height:n=3}=t;return{vertices:[0,0,2*e*r,1*n,1.5*e*r,0,2*e*r,-1*n,0,0,2*e*r,1*n,1.5*e*r,0,2*e*r,-1*n],dimensions:2,indices:[4,5,6,4,6,7],outLineIndices:[0,1,2,0,2,3],normals:[0,-e,1,1,0,1,0,-e,1,-1,-0,1,0,0,0,0,0,0,0,0,0,0,0,0]}}function EG(e,t){const{width:r=2,height:n=2}=t,i=Zd(),o=bu.flatten([i]),a=bu(o.vertices,o.holes,o.dimensions),s=i.map(u=>[u[0]*r*e,u[1]*n]).flat();return{vertices:[...s,...s],dimensions:2,indices:a.map(u=>u+i.length),outLineIndices:a,normals:[...i.map(u=>[u[1]*n,u[0]*r*e,1]).flat(),...new Array(i.length*3).fill(0)]}}function yG(e,t=0,r){const n=typeof r.source=="object"?r.source.type:r.source,i=typeof r.target=="object"?r.target.type:r.target,{width:o=n?KE[n]:0}=typeof r.source=="object"?r.source:{},{width:a=i?KE[i]:0}=typeof r.target=="object"?r.target:{};return{vertices:[0,dn,1*o,...e,1,dn,-1*a,...e,1,-dn,-1*a,...e,0,-dn,1*o,...e,0,dn,1*o,...e,1,dn,-1*a,...e,1,-dn,-1*a,...e,0,-dn,1*o,...e],outLineIndices:[0,1,2,0,2,3].map(s=>s+t),indices:[4,5,6,4,6,7].map(s=>s+t),normals:[1,-1,1,1,1,1,-1,0,1,-1,0,1,0,0,0,0,0,0,0,0,0,0,0,0],dimensions:2}}function QE(e,t){const r=typeof e=="object"?e.type:e,n=t==="source"?1:-1,i=typeof e=="object"?e:{};switch(r){case"circle":return EG(n,i);case"triangle":return _G(n,i);case"diamond":return mG(n,i);case"rect":return vG(n,i);case"classic":return gG(n,i);case"halfTriangle":return pG(n,i);default:return{vertices:[],indices:[],normals:[],dimensions:2,outLineIndices:[],outLineNormals:[]}}}function TG(e){const t=e.coordinates.flat(),r=1,n=1;return{vertices:[1,0,0,...t,1,2,-3,...t,1,1,-3,...t,0,1,0,...t,0,0,0,...t,1,0,0,...t,1,2,-3,...t,1,1,-3,...t,0,1,0,...t,0,0,0,...t],normals:[-r,2*n,1,2*n,-n,1,n,-n,1,n,-n,1,-r,-n,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],indices:[0,1,2,0,2,3,0,3,4,5,6,7,5,7,8,5,8,9],size:7}}function AG(e,t){return t?SG(e,t):TG(e)}function SG(e,t){const r=e.coordinates.flat(),{target:n="classic",source:i="circle"}=t,o=JE(QE(i,"source"),r,0,0),a=yG(r,o.vertices.length/7,t),s=JE(QE(n,"target"),r,1,o.vertices.length/7+a.vertices.length/7);return{vertices:[...o.vertices,...a.vertices,...s.vertices],indices:[...o.outLineIndices,...a.outLineIndices,...s.outLineIndices,...o.indices,...a.indices,...s.indices],normals:[...o.normals,...a.normals,...s.normals],size:7}}function JE(e,t,r=1,n=0){const i=[],{vertices:o,indices:a,dimensions:s,outLineIndices:u}=e;for(let l=0;l<o.length;l+=s)i.push(r,o[l+1],o[l],...t);return he(he({},e),{},{vertices:i,indices:a.map(l=>l+n),outLineIndices:u.map(l=>l+n)})}const xG=`// #extension GL_OES_standard_derivatives : enable
in vec4 v_color;
out vec4 outputColor;
// line texture
#pragma include "picking"
void main() {
outputColor = v_color;
outputColor = filterColor(outputColor);
}
`,bG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;
layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;
layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
layout(std140) uniform commonUniorm {
float u_gap_width: 1.0;
float u_stroke_width: 1.0;
float u_stroke_opacity: 1.0;
};
#pragma include "projection"
#pragma include "project"
#pragma include "picking"
out vec4 v_color;
vec2 project_pixel_offset(vec2 offsets) {
vec2 data = project_pixel(offsets);
return vec2(data.x, -data.y);
}
vec2 line_dir(vec2 target, vec2 source) {
return normalize(ProjectFlat(target) - ProjectFlat(source));
}
void main() {
// 透明度计算
vec2 source_world = a_Instance.rg; // 起点
vec2 target_world = a_Instance.ba; // 终点
vec2 flowlineDir = line_dir(target_world, source_world);
vec2 perpendicularDir = vec2(-flowlineDir.y, flowlineDir.x);
vec2 position = mix(source_world, target_world, a_Position.x);
vec2 position64Low = mix(a_Instance64Low.rg, a_Instance64Low.ba, a_Position.x);
float lengthCommon = length(
project_position(vec4(target_world, 0, 1)) - project_position(vec4(source_world, 0, 1))
);
vec2 offsetDistances = a_Size.x * project_pixel_offset(vec2(a_Position.y, a_Position.z)); // Mapbox || 高德
vec2 limitedOffsetDistances = clamp(
offsetDistances,
project_pixel(-lengthCommon * 0.2),
project_pixel(lengthCommon * 0.2)
);
float startOffsetCommon = project_pixel(offsets[0]);
float endOffsetCommon = project_pixel(offsets[1]);
float endpointOffset = mix(
clamp(startOffsetCommon, 0.0, lengthCommon * 0.2),
-clamp(endOffsetCommon, 0.0, lengthCommon * 0.2),
a_Position.x
);
vec2 normalsCommon = u_stroke_width * project_pixel_offset(vec2(a_Normal.x, a_Normal.y));
float gapCommon = -1. * project_pixel(u_gap_width);
vec3 offsetCommon = vec3(
flowlineDir * (limitedOffsetDistances[1] + normalsCommon.y + endpointOffset * 1.05) -
perpendicularDir * (limitedOffsetDistances[0] + gapCommon + normalsCommon.x),
0.0
);
vec4 project_pos = project_position(vec4(position.xy, 0, 1.0), position64Low);
vec4 fillColor = vec4(a_Color.rgb, a_Color.a * opacity);
v_color = mix(fillColor, vec4(u_stroke.xyz, u_stroke.w * fillColor.w * u_stroke_opacity), a_Normal.z);
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offsetCommon.xy, 0., 1.0));
setPickingColor(a_PickingColor);
}
`;class RG extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,NORMAL:12})}getCommonUniformsInfo(){const{gapWidth:t=2,strokeWidth:r=1,strokeOpacity:n=1}=this.layer.getLayerConfig(),i={u_gap_width:t,u_stroke_width:r,u_stroke_opacity:n};return this.getUniformsBufferInfo(i)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return[yield t.layer.buildLayerModel({moduleName:"flow_line",vertexShader:bG,fragmentShader:xG,defines:t.getDefines(),inject:t.getInject(),triangulation:AG,styleOption:t.layer.getLayerConfig().symbol,primitive:m.TRIANGLES,depth:{enable:!1},pick:!1})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0],r[1]]:[r,0]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}})}}const CG=`#define LineTypeSolid 0.0
#define LineTypeDash 1.0
#define Animate 0.0
#define LineTexture 1.0
uniform sampler2D u_texture;
layout(std140) uniform commonUniorm {
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
vec4 u_dash_array: [10.0, 5., 0, 0];
vec4 u_sourceColor;
vec4 u_targetColor;
vec2 u_textSize;
float segmentNumber;
float u_line_type: 0.0;
float u_icon_step: 100;
float u_line_texture: 0.0;
float u_textureBlend;
float u_time;
float u_linearColor: 0;
};
in vec4 v_dash_array;
in vec4 v_color;
in vec2 v_iconMapUV;
in vec4 v_line_data;
in float v_distance_ratio;
out vec4 outputColor;
#pragma include "picking"
#pragma include "project"
#pragma include "projection"
void main() {
float animateSpeed = 0.0;
float d_segmentIndex = v_line_data.g;
// 设置弧线的底色
if(u_linearColor == 1.0) { // 使用渐变颜色
outputColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);
outputColor.a *= v_color.a;
} else { // 使用 color 方法传入的颜色
outputColor = v_color;
}
// float blur = 1.- smoothstep(u_blur, 1., length(v_normal.xy));
// float blur = smoothstep(1.0, u_blur, length(v_normal.xy));
if(u_line_type == LineTypeDash) {
float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);
if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {
// 实线部分
} else {
// 虚线部分
discard;
};
}
// 设置弧线的动画模式
if(u_animate.x == Animate) {
animateSpeed = u_time / u_animate.y;
float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
alpha = smoothstep(0., 1., alpha);
outputColor.a *= alpha;
}
// 设置弧线的贴图
if(LineTexture == u_line_texture && u_line_type != LineTypeDash) {
float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / (segmentNumber - 1.0)));
// float arcRadio = d_segmentIndex / (segmentNumber - 1.0);
float count = v_line_data.b; // 贴图在弧线上重复的数量
float u = fract(arcRadio * count - animateSpeed * count);
// float u = fract(arcRadio * count - animateSpeed);
if(u_animate.x == Animate) {
u = outputColor.a/v_color.a;
}
float v = v_line_data.a; // 线图层贴图部分的 v 坐标值
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
// 设置贴图和底色的叠加模式
if(u_textureBlend == 0.0) { // normal
pattern.a = 0.0;
outputColor = filterColor(outputColor + pattern);
} else { // replace
pattern.a *= v_color.a;
if(outputColor.a <= 0.0) {
pattern.a = 0.0;
}
outputColor = filterColor(pattern);
}
} else {
outputColor = filterColor(outputColor);
}
// gl_FragColor = filterColor(gl_FragColor);
}
`,OG=`#define LineTypeSolid (0.0)
#define LineTypeDash (1.0)
#define Animate (0.0)
#define LineTexture (1.0)
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;
layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
layout(std140) uniform commonUniorm {
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
vec4 u_dash_array: [10.0, 5., 0, 0];
vec4 u_sourceColor;
vec4 u_targetColor;
vec2 u_textSize;
float segmentNumber;
float u_line_type: 0.0;
float u_icon_step: 100;
float u_line_texture: 0.0;
float u_textureBlend;
float u_time;
float u_linearColor: 0;
};
out vec4 v_dash_array;
out vec4 v_color;
out vec2 v_iconMapUV;
out vec4 v_line_data;
out float v_distance_ratio;
#pragma include "projection"
#pragma include "project"
#pragma include "picking"
float maps(float value, float start1, float stop1, float start2, float stop2) {
return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
}
float getSegmentRatio(float index) {
return index / (segmentNumber - 1.0);
}
float paraboloid(vec2 source, vec2 target, float ratio) {
vec2 x = mix(source, target, ratio);
vec2 center = mix(source, target, 0.5);
float dSourceCenter = distance(source, center);
float dXCenter = distance(x, center);
return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);
}
vec3 getPos(vec2 source, vec2 target, float segmentRatio) {
float vertex_height = paraboloid(source, target, segmentRatio);
return vec3(mix(source, target, segmentRatio), sqrt(max(0.0, vertex_height)));
}
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {
// normalized direction of the line
vec2 dir_screenspace = normalize(line_clipspace);
// rotate by 90 degrees
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;
return offset;
}
vec2 getNormal(vec2 line_clipspace, float offset_direction) {
// normalized direction of the line
vec2 dir_screenspace = normalize(line_clipspace);
// rotate by 90 degrees
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
return dir_screenspace.xy * sign(offset_direction);
}
float getAngularDist(vec2 source, vec2 target) {
vec2 delta = source - target;
vec2 sin_half_delta = sin(delta / 2.0);
float a =
sin_half_delta.y * sin_half_delta.y +
cos(source.y) * cos(target.y) * sin_half_delta.x * sin_half_delta.x;
return 2.0 * atan(sqrt(a), sqrt(1.0 - a));
}
vec2 midPoint(vec2 source, vec2 target) {
vec2 center = target - source;
float r = length(center);
float theta = atan(center.y, center.x);
float thetaOffset = 0.314;
float r2 = r / 2.0 / cos(thetaOffset);
float theta2 = theta + thetaOffset;
vec2 mid = vec2(r2 * cos(theta2) + source.x, r2 * sin(theta2) + source.y);
return mid;
}
float bezier3(vec3 arr, float t) {
float ut = 1.0 - t;
return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;
}
vec2 interpolate(vec2 source, vec2 target, float angularDist, float t) {
if (abs(angularDist - PI) < 0.001) {
return (1.0 - t) * source + t * target;
}
float a = sin((1.0 - t) * angularDist) / sin(angularDist);
float b = sin(t * angularDist) / sin(angularDist);
vec2 sin_source = sin(source);
vec2 cos_source = cos(source);
vec2 sin_target = sin(target);
vec2 cos_target = cos(target);
float x = a * cos_source.y * cos_source.x + b * cos_target.y * cos_target.x;
float y = a * cos_source.y * sin_source.x + b * cos_target.y * sin_target.x;
float z = a * sin_source.y + b * sin_target.y;
return vec2(atan(y, x), atan(z, sqrt(x * x + y * y)));
}
void main() {
v_color = a_Color;
v_color.a = v_color.a * opacity;
vec2 source = radians(a_Instance.rg);
vec2 target = radians(a_Instance.ba);
float angularDist = getAngularDist(source, target);
float segmentIndex = a_Position.x;
float segmentRatio = getSegmentRatio(segmentIndex);
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
if (u_line_type == LineTypeDash) {
v_distance_ratio = segmentIndex / segmentNumber;
float total_Distance = pixelDistance(source, target) / 2.0 * PI;
total_Distance = total_Distance * 16.0; // total_Distance*16.0 调整默认的效果
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;
}
if (u_animate.x == Animate) {
v_distance_ratio = segmentIndex / segmentNumber;
}
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
v_distance_ratio = segmentIndex / segmentNumber;
vec4 curr = project_position(vec4(degrees(interpolate(source, target, angularDist, segmentRatio)), 0.0, 1.0), a_Instance64Low.xy);
vec4 next = project_position(vec4(degrees(interpolate(source, target, angularDist, nextSegmentRatio)), 0.0, 1.0), a_Instance64Low.zw);
// v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));
// vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0));
// gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, curr.z, 1.0));
v_line_data.g = a_Position.x; // 该顶点在弧线上的分段排序
if (LineTexture == u_line_texture) {
float d_arcDistrance = length(source - target);
d_arcDistrance = project_pixel(d_arcDistrance);
float d_pixelLen = project_pixel(u_icon_step) / 8.0;
v_line_data.b = floor(d_arcDistrance / d_pixelLen); // 贴图在弧线上重复的数量
float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
v_line_data.a = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值
v_iconMapUV = a_iconMapUV;
}
gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));
setPickingColor(a_PickingColor);
}
`,IG={solid:0,dash:1};class MG extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,UV:12})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5],lineTexture:a=!1,iconStep:s=100,segmentNumber:u=30}=this.layer.getLayerConfig(),{animateOption:l}=this.layer.getLayerConfig();if(o.length===2&&o.push(0,0),this.rendererService.getDirty()){var f;(f=this.texture)===null||f===void 0||f.bind()}let c=0,h=[0,0,0,0],d=[0,0,0,0];t&&r&&(h=Zt(t),d=Zt(r),c=1);let p=this.layer.getLayerAnimateTime();isNaN(p)&&(p=0);const v={u_animate:this.animateOption2Array(l),u_dash_array:o,u_sourceColor:h,u_targetColor:d,u_textSize:[1024,this.iconService.canvasHeight||128],segmentNumber:u,u_line_type:IG[i]||0,u_icon_step:s,u_line_texture:a?1:0,u_textureBlend:n==="normal"?0:1,u_time:p,u_linearColor:c};return this.getUniformsBufferInfo(v)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){const{segmentNumber:r=30}=t.layer.getLayerConfig();return[yield t.layer.buildLayerModel({moduleName:"lineGreatCircle",vertexShader:OG,fragmentShader:CG,triangulation:r_,styleOption:{segmentNumber:r},defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}})}}const NG=`// #extension GL_OES_standard_derivatives : enable
#define Animate 0.0
#define LineTexture 1.0
uniform sampler2D u_texture;
layout(std140) uniform commonUniorm {
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
vec4 u_dash_array;
vec4 u_blur;
vec4 u_sourceColor;
vec4 u_targetColor;
vec2 u_textSize;
float u_icon_step: 100;
float u_heightfixed: 0.0;
float u_vertexScale: 1.0;
float u_raisingHeight: 0.0;
float u_strokeWidth: 0.0;
float u_textureBlend;
float u_line_texture;
float u_linearDir: 1.0;
float u_linearColor: 0;
float u_time;
};
in vec4 v_color;
in vec4 v_stroke;
// dash
in vec4 v_dash_array;
in float v_d_distance_ratio;
in vec2 v_iconMapUV;
in vec4 v_texture_data;
out vec4 outputColor;
#pragma include "picking"
// [animate, duration, interval, trailLength],
void main() {
if(u_dash_array!=vec4(0.0)){
float dashLength = mod(v_d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);
if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {
// 虚线部分
discard;
};
}
float animateSpeed = 0.0; // 运动速度
float d_distance_ratio = v_texture_data.r; // 当前点位距离占线总长的比例
if(u_linearDir < 1.0) {
d_distance_ratio = v_texture_data.a;
}
if(u_linearColor == 1.0) { // 使用渐变颜色
outputColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);
outputColor.a *= v_color.a;
} else { // 使用 color 方法传入的颜色
outputColor = v_color;
}
// anti-alias
// float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));
if(u_animate.x == Animate) {
animateSpeed = u_time / u_animate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
alpha = smoothstep(0., 1., alpha);
outputColor.a *= alpha;
}
if(u_line_texture == LineTexture) { // while load texture
float aDistance = v_texture_data.g; // 当前顶点的距离
float d_texPixelLen = v_texture_data.b; // 贴图的像素长度,根据地图层级缩放
float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);
float v = v_texture_data.a; // 线图层贴图部分的 v 坐标值
// v = max(smoothstep(0.95, 1.0, v), v);
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
if(u_textureBlend == 0.0) { // normal
pattern.a = 0.0;
outputColor += pattern;
} else { // replace
pattern.a *= v_color.a;
if(outputColor.a <= 0.0) {
pattern.a = 0.0;
}
outputColor = pattern;
}
}
float v = v_texture_data.a;
float strokeWidth = min(0.5, u_strokeWidth);
// 绘制 border
if(strokeWidth > 0.01) {
float borderOuterWidth = strokeWidth / 2.0;
if(v >= 1.0 - strokeWidth || v <= strokeWidth) {
if(v > strokeWidth) { // 外侧
float linear = smoothstep(0.0, 1.0, (v - (1.0 - strokeWidth))/strokeWidth);
// float linear = step(0.0, (v - (1.0 - borderWidth))/borderWidth);
outputColor.rgb = mix(outputColor.rgb, v_stroke.rgb, linear);
} else if(v <= strokeWidth) {
float linear = smoothstep(0.0, 1.0, v/strokeWidth);
outputColor.rgb = mix(v_stroke.rgb, outputColor.rgb, linear);
}
}
if(v < borderOuterWidth) {
outputColor.a = mix(0.0, outputColor.a, v/borderOuterWidth);
} else if(v > 1.0 - borderOuterWidth) {
outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);
}
}
// blur
float blurV = v_texture_data.a;
if(blurV < 0.5) {
outputColor.a *= mix(u_blur.r, u_blur.g, blurV/0.5);
} else {
outputColor.a *= mix(u_blur.g, u_blur.b, (blurV - 0.5)/0.5);
}
outputColor = filterColor(outputColor);
}
`,PG=`#define Animate (0.0)
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;
layout(location = ATTRIBUTE_LOCATION_DISTANCE_INDEX) in vec3 a_DistanceAndIndexAndMiter;
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec4 a_Normal_Total_Distance;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
layout(std140) uniform commonUniorm {
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
vec4 u_dash_array;
vec4 u_blur;
vec4 u_sourceColor;
vec4 u_targetColor;
vec2 u_textSize;
float u_icon_step: 100;
float u_heightfixed: 0.0;
float u_vertexScale: 1.0;
float u_raisingHeight: 0.0;
float u_strokeWidth: 0.0;
float u_textureBlend;
float u_line_texture;
float u_linearDir: 1.0;
float u_linearColor: 0;
float u_time;
};
out vec4 v_color;
out vec4 v_stroke;
//dash
out vec4 v_dash_array;
out float v_d_distance_ratio;
// texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
out vec2 v_iconMapUV;
out vec4 v_texture_data;
#pragma include "projection"
#pragma include "picking"
void main() {
vec2 a_DistanceAndIndex = a_DistanceAndIndexAndMiter.xy;
float a_Miter = a_DistanceAndIndexAndMiter.z;
vec3 a_Normal = a_Normal_Total_Distance.xyz;
float a_Total_Distance = a_Normal_Total_Distance.w;
//dash输出
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;
v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;
// cal style mapping - 数据纹理映射部分的计算
float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
v_iconMapUV = a_iconMapUV;
d_texPixelLen = project_float_pixel(u_icon_step);
v_color = a_Color;
v_color.a *= opacity;
v_stroke = stroke;
vec3 size = a_Miter * setPickingSize(a_Size.x) * a_Normal;
vec2 offset = project_pixel(size.xy);
float lineDistance = a_DistanceAndIndex.x;
float currentLinePointRatio = lineDistance / a_Total_Distance;
float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // 线横向偏移的距离(向两侧偏移的和)
float linePixelSize = project_pixel(a_Size.x) * 2.0; // 定点位置偏移,按地图等级缩放后的距离 单侧 * 2
float texV = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值
v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);
// 设置数据集的参数
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));
float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况 vertex height
float lineHeight = a_Size.y; // size 第二个参数代表的高度 [linewidth, lineheight]
// 兼容 mapbox 在线高度上的效果表现基本一致
if (
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
// mapbox
// 保持高度相对不变
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
h *= mapboxZoomScale;
h += u_raisingHeight * mapboxZoomScale;
if (u_heightfixed > 0.0) {
lineHeight *= mapboxZoomScale;
}
}
gl_Position = project_common_position_to_clipspace(
vec4(project_pos.xy + offset, lineHeight + h, 1.0)
);
setPickingColor(a_PickingColor);
}
`;class BS extends Qt{constructor(...t){super(...t),E(this,"textureEventFlag",!1),E(this,"texture",this.createTexture2D({data:new Uint8Array([0,0,0,0]),width:1,height:1})),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.textures.length===0&&(this.textures=[this.texture]),this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128})})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,DISTANCE_INDEX:10,NORMAL:11,UV:12})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5,0,0],lineTexture:a=!1,iconStep:s=100,vertexHeightScale:u=20,strokeWidth:l=0,raisingHeight:f=0,heightfixed:c=!1,linearDir:h=kE.VERTICAL,blur:d=[1,1,1,0]}=this.layer.getLayerConfig();let p=o;if(i!=="dash"&&(p=[0,0,0,0]),p.length===2&&p.push(0,0),this.rendererService.getDirty()&&this.texture){var v;(v=this.texture)===null||v===void 0||v.bind()}const{animateOption:g}=this.layer.getLayerConfig();let y=0,S=[0,0,0,0],R=[0,0,0,0];t&&r&&(S=Zt(t),R=Zt(r),y=1);const x={u_animate:this.animateOption2Array(g),u_dash_array:p,u_blur:d,u_sourceColor:S,u_targetColor:R,u_textSize:[1024,this.iconService.canvasHeight||128],u_icon_step:s,u_heightfixed:Number(c),u_vertexScale:u,u_raisingHeight:Number(f),u_strokeWidth:l,u_textureBlend:n===WW.NORMAL?0:1,u_line_texture:a?1:0,u_linearDir:h===kE.VERTICAL?1:0,u_linearColor:y,u_time:this.layer.getLayerAnimateTime()||0};return this.getUniformsBufferInfo(x)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.textureEventFlag||(t.textureEventFlag=!0,t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture)),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){const{depth:r=!1}=t.layer.getLayerConfig(),{frag:n,vert:i,type:o}=t.getShaders();return t.layer.triangulation=qd,[yield t.layer.buildLayerModel({moduleName:"line"+o,vertexShader:i,fragmentShader:n,triangulation:qd,defines:t.getDefines(),inject:t.getInject(),depth:{enable:r}})]})()}getShaders(){return{frag:NG,vert:PG,type:""}}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"distanceAndIndex",type:qe.Attribute,descriptor:{name:"a_DistanceAndIndexAndMiter",shaderLocation:this.attributeLocation.DISTANCE_INDEX,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o,a)=>a===void 0?[n[3],10,n[4]]:[n[3],a,n[4]]}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0],r[1]]:[r,0]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal_total_distance",type:qe.Attribute,descriptor:{name:"a_Normal_Total_Distance",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n,i,o)=>[...o,n[5]]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}})}}const LG=`
layout(std140) uniform commonUniorm {
vec4 u_sourceColor;
vec4 u_targetColor;
vec4 u_dash_array;
float u_vertexScale: 1.0;
float u_linearColor: 0;
};
in float v_distanceScale;
in vec4 v_color;
//dash
in vec4 v_dash_array;
out vec4 outputColor;
void main() {
if(u_dash_array!=vec4(0.0)){
float dashLength = mod(v_distanceScale, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);
if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {
// 虚线部分
discard;
};
}
if(u_linearColor==1.0){
outputColor = mix(u_sourceColor, u_targetColor, v_distanceScale);
outputColor.a *= v_color.a; // 全局透明度
}
else{
outputColor = v_color;
}
}
`,wG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in vec4 a_SizeDistanceAndTotalDistance;
layout(std140) uniform commonUniorm {
vec4 u_sourceColor;
vec4 u_targetColor;
vec4 u_dash_array;
float u_vertexScale: 1.0;
float u_linearColor: 0;
};
#pragma include "projection"
#pragma include "picking"
out vec4 v_color;
out float v_distanceScale;
out vec4 v_dash_array;
void main() {
//dash输出
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_SizeDistanceAndTotalDistance.a;
v_color = a_Color;
v_distanceScale = a_SizeDistanceAndTotalDistance.b / a_SizeDistanceAndTotalDistance.a;
v_color.a = v_color.a * opacity;
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况
float lineHeight = a_SizeDistanceAndTotalDistance.y;
// 兼容 mapbox 在线高度上的效果表现基本一致
if (
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
// 保持高度相对不变
h *= 2.0 / pow(2.0, 20.0 - u_Zoom);
}
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));
gl_PointSize = 10.0;
}
`;class FG extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,lineType:n="solid",dashArray:i=[10,5,0,0],vertexHeightScale:o=20}=this.layer.getLayerConfig();let a=i;n!=="dash"&&(a=[0,0,0,0]),a.length===2&&a.push(0,0);let s=0,u=[0,0,0,0],l=[0,0,0,0];t&&r&&(u=Zt(t),l=Zt(r),s=1);const f={u_sourceColor:u,u_targetColor:l,u_dash_array:a,u_vertexScale:o,u_linearColor:s};return this.getUniformsBufferInfo(f)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}getShaders(){return{frag:LG,vert:wG,type:"lineSimpleNormal"}}buildModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const{frag:r,vert:n,type:i}=t.getShaders();return[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,triangulation:qW,defines:t.getDefines(),inject:t.getInject(),primitive:m.LINES,depth:{enable:!1},pick:!1})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"sizeDistanceAndTotalDistance",type:qe.Attribute,descriptor:{name:"a_SizeDistanceAndTotalDistance",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>{const{size:i=1}=t,o=Array.isArray(i)?[i[0],i[1]]:[i,0];return[o[0],o[1],n[3],n[5]]}}})}}const BG=`#define Animate 0.0
#define LineTexture 1.0
// line texture
uniform sampler2D u_texture;
layout(std140) uniform commonUniorm {
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
vec4 u_sourceColor;
vec4 u_targetColor;
vec2 u_textSize;
float u_icon_step: 100;
float u_heightfixed;
float u_linearColor: 0;
float u_line_texture;
float u_textureBlend;
float u_iconStepCount;
float u_time;
};
in vec2 v_iconMapUV;
in vec4 v_color;
in float v_blur;
in vec4 v_dataset;
out vec4 outputColor;
#pragma include "picking"
void main() {
float animateSpeed = 0.0; // 运动速度
float d_distance_ratio = v_dataset.r; // 当前点位距离占线总长的比例
float v = v_dataset.a;
if(u_linearColor == 1.0) { // 使用渐变颜色
outputColor = mix(u_sourceColor, u_targetColor, v);
} else { // 使用 color 方法传入的颜色
outputColor = v_color;
}
outputColor.a *= v_color.a; // 全局透明度
if(u_animate.x == Animate) {
animateSpeed = u_time / u_animate.y;
float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);
alpha = (alpha + u_animate.w -1.0) / u_animate.w;
alpha = smoothstep(0., 1., alpha);
outputColor.a *= alpha;
}
if(u_line_texture == LineTexture) { // while load texture
float aDistance = v_dataset.g; // 当前顶点的距离
float d_texPixelLen = v_dataset.b; // 贴图的像素长度,根据地图层级缩放
float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);
float v = v_dataset.a; // 线图层贴图部分的 v 坐标值
// 计算纹理间隔 start
float flag = 0.0;
if(u > 1.0/u_iconStepCount) {
flag = 1.0;
}
u = fract(u*u_iconStepCount);
// 计算纹理间隔 end
vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
// Tip: 判断纹理间隔
if(flag > 0.0) {
pattern = vec4(0.0);
}
if(u_textureBlend == 0.0) { // normal
pattern.a = 0.0;
outputColor = filterColor(outputColor + pattern);
} else { // replace
pattern.a *= v_color.a;
if(outputColor.a <= 0.0) {
pattern.a = 0.0;
}
outputColor = filterColor(pattern);
}
}
// blur - AA
if(v < v_blur) {
outputColor.a = mix(0.0, outputColor.a, v/v_blur);
} else if(v > 1.0 - v_blur) {
outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);
}
outputColor = filterColor(outputColor);
}
`,DG=`#define Animate 0.0
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
layout(location = ATTRIBUTE_LOCATION_DISTANCE_MITER_TOTAL) in vec3 a_Distance_Total_Miter;
layout(std140) uniform commonUniorm {
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
vec4 u_sourceColor;
vec4 u_targetColor;
vec2 u_textSize;
float u_icon_step: 100;
float u_heightfixed;
float u_linearColor: 0;
float u_line_texture;
float u_textureBlend;
float u_iconStepCount;
float u_time;
};
// texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
out vec2 v_iconMapUV;
out vec4 v_color;
out float v_blur;
out vec4 v_dataset;
#pragma include "projection"
#pragma include "light"
#pragma include "picking"
void main() {
float a_Distance = a_Distance_Total_Miter.x;
float a_Miter = a_Distance_Total_Miter.y;
float a_Total_Distance = a_Distance_Total_Miter.z;
float d_distance_ratio; // 当前点位距离占线总长的比例
float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
v_iconMapUV = a_iconMapUV;
if (u_heightfixed < 1.0) {
// 高度随 zoom 调整
d_texPixelLen = project_pixel(u_icon_step);
} else {
d_texPixelLen = u_icon_step;
}
if (u_animate.x == Animate || u_linearColor == 1.0) {
d_distance_ratio = a_Distance / a_Total_Distance;
}
float miter = (a_Miter + 1.0) / 2.0;
// 设置数据集的参数
v_dataset[0] = d_distance_ratio; // 当前点位距离占线总长的比例
v_dataset[1] = a_Distance; // 当前顶点的距离
v_dataset[2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
v_dataset[3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
float originSize = a_Size.x; // 固定高度
if (u_heightfixed < 1.0) {
originSize = project_float_meter(a_Size.x); // 高度随 zoom 调整
}
float wallHeight = originSize * miter;
float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));
v_blur = min(project_float_pixel(2.0) / originSize, 0.05);
v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);
// 兼容 mapbox 在线高度上的效果表现基本一致
if (
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
// mapbox
// 保持高度相对不变
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
if (u_heightfixed > 0.0) {
wallHeight *= mapboxZoomScale;
}
}
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
setPickingColor(a_PickingColor);
}
`;class UG extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,NORMAL:12,UV:13,DISTANCE_MITER_TOTAL:15})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",heightfixed:i=!1,lineTexture:o=!1,iconStep:a=100,iconStepCount:s=1}=this.layer.getLayerConfig(),{animateOption:u}=this.layer.getLayerConfig();if(this.rendererService.getDirty()){var l;(l=this.texture)===null||l===void 0||l.bind()}let f=0,c=[0,0,0,0],h=[0,0,0,0];t&&r&&(c=Zt(t),h=Zt(r),f=1);const d={u_animate:this.animateOption2Array(u),u_sourceColor:c,u_targetColor:h,u_textSize:[1024,this.iconService.canvasHeight||128],u_icon_step:a,u_heightfixed:Number(i),u_linearColor:f,u_line_texture:o?1:0,u_textureBlend:n==="normal"?0:1,u_iconStepCount:s,u_time:this.layer.getLayerAnimateTime()||0};return this.getUniformsBufferInfo(d)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){return[yield t.layer.buildLayerModel({moduleName:"lineWall",vertexShader:DG,fragmentShader:BG,triangulation:qd,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1},blend:t.getBlend()})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0],r[1]]:[r,0]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"distanceAndTotalAndMiter",type:qe.Attribute,descriptor:{name:"a_Distance_Total_Miter",shaderLocation:this.attributeLocation.DISTANCE_MITER_TOTAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n)=>[n[3],n[4],n[5]]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}})}}const kG={arc:cG,arc3d:qE,greatcircle:MG,wall:UG,line:BS,simple:FG,flowline:RG,earthArc3d:qE};class DS extends Ka{constructor(...t){super(...t),E(this,"type","LineLayer"),E(this,"enableShaderEncodeStyles",["stroke","offsets","opacity","thetaOffset"]),E(this,"arrowInsertCount",0),E(this,"defaultSourceConfig",{data:[{lng1:100,lat1:30,lng2:130,lat2:30}],options:{parser:{type:"json",x:"lng1",y:"lat1",x1:"lng2",y1:"lat2"}}})}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new kG[r](t),yield t.initLayerModels()})()}getDefaultConfig(){const t=this.getModelType();return{line:{},linearline:{},simple:{},wall:{},arc3d:{blend:"additive"},arc:{blend:"additive"},greatcircle:{blend:"additive"},tileLine:{},earthArc3d:{},flowline:{},arrow:{}}[t]}getModelType(){var t;if(this.layerType)return this.layerType;const r=this.styleAttributeService.getLayerStyleAttribute("shape");return(r==null||(t=r.scale)===null||t===void 0?void 0:t.field)||"line"}processData(t){if(this.getModelType()!=="simple")return t;const r=[];return t.map(n=>{if(Array.isArray(n.coordinates)&&Array.isArray(n.coordinates[0])&&Array.isArray(n.coordinates[0][0])){const i=he({},n);n.coordinates.map(o=>{r.push(he(he({},i),{},{coordinates:o}))})}else r.push(n)}),r}}const $G=`
layout(std140) uniform commonUniorm {
vec4 u_stroke_color;
float u_additive;
float u_stroke_opacity;
float u_stroke_width;
};
in vec4 v_color;
in float v_blur;
in float v_innerRadius;
out vec4 outputColor;
#pragma include "picking"
void main() {
vec2 center = vec2(0.5);
// Tip: 片元到中心点的距离 0 - 1
float fragmengTocenter = distance(center, gl_PointCoord) * 2.0;
// Tip: 片元的剪切成圆形
float circleClipOpacity = 1.0 - smoothstep(v_blur, 1.0, fragmengTocenter);
if(v_innerRadius < 0.99) {
// 当存在 stroke 且 stroke > 0.01
float blurWidth = (1.0 - v_blur)/2.0;
vec4 stroke = vec4(u_stroke_color.rgb, u_stroke_opacity);
if(fragmengTocenter > v_innerRadius + blurWidth) {
outputColor = stroke;
} else if(fragmengTocenter > v_innerRadius - blurWidth){
float mixR = (fragmengTocenter - (v_innerRadius - blurWidth)) / (blurWidth * 2.0);
outputColor = mix(v_color, stroke, mixR);
} else {
outputColor = v_color;
}
} else {
// 当不存在 stroke 或 stroke <= 0.01
outputColor = v_color;
}
outputColor = filterColor(outputColor);
if(u_additive > 0.0) {
outputColor *= circleClipOpacity;
} else {
outputColor.a *= circleClipOpacity;
}
}
`,zG=`
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(std140) uniform commonUniorm {
vec4 u_stroke_color;
float u_additive;
float u_stroke_opacity;
float u_stroke_width;
};
out vec4 v_color;
out float v_blur;
out float v_innerRadius;
#pragma include "projection"
#pragma include "picking"
#pragma include "project"
void main() {
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
v_blur = 1.0 - max(2.0 / a_Size, 0.05);
v_innerRadius = max((a_Size - u_stroke_width) / a_Size, 0.0);
vec2 offset = project_pixel(u_offsets);
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy+offset),project_pos.z,project_pos.w));
gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
setPickingColor(a_PickingColor);
}
`;function e1(e){const t=e.coordinates;return{vertices:[...t],indices:[0],size:t.length}}class VG extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9})}getDefaultStyle(){return{blend:"additive"}}getCommonUniformsInfo(){const{blend:t,strokeOpacity:r=1,strokeWidth:n=0,stroke:i="#fff"}=this.layer.getLayerConfig(),o={u_stroke_color:Zt(i),u_additive:t==="additive"?1:0,u_stroke_opacity:r,u_stroke_width:n};return this.getUniformsBufferInfo(o)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.layer.triangulation=e1,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointSimple",vertexShader:zG,fragmentShader:$G,defines:t.getDefines(),inject:t.getInject(),triangulation:e1,depth:{enable:!1},primitive:m.POINTS})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}const HG=`precision highp float;
in vec4 v_color;
#pragma include "picking"
layout(std140) uniform commonUniform {
vec4 u_sourceColor;
vec4 u_targetColor;
float u_linearColor: 0;
float u_heightfixed: 0.0; // 默认不固定
float u_globel;
float u_r;
float u_pickLight: 0.0;
float u_opacitylinear: 0.0;
float u_opacitylinear_dir: 1.0;
float u_lightEnable: 1.0;
};
in float v_lightWeight;
in float v_barLinearZ;
out vec4 outputColor;
void main() {
outputColor = v_color;
// 开启透明度渐变
if(u_opacitylinear > 0.0) {
outputColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - v_barLinearZ): v_barLinearZ;
}
// picking
if(u_pickLight > 0.0) {
outputColor = filterColorAlpha(outputColor, v_lightWeight);
} else {
outputColor = filterColor(outputColor);
}
}
`,jG=`precision highp float;
#define pi 3.1415926535
#define ambientRatio 0.5
#define diffuseRatio 0.3
#define specularRatio 0.2
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in vec3 a_Size;
layout(location = ATTRIBUTE_LOCATION_POS) in vec3 a_Pos;
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
layout(std140) uniform commonUniform {
vec4 u_sourceColor;
vec4 u_targetColor;
float u_linearColor: 0;
float u_heightfixed: 0.0; // 默认不固定
float u_globel;
float u_r;
float u_pickLight: 0.0;
float u_opacitylinear: 0.0;
float u_opacitylinear_dir: 1.0;
float u_lightEnable: 1.0;
};
out vec4 v_color;
out float v_lightWeight;
out float v_barLinearZ;
// 用于将在顶点着色器中计算好的样式值传递给片元
#pragma include "projection"
#pragma include "light"
#pragma include "picking"
float getYRadian(float x, float z) {
if(x > 0.0 && z > 0.0) {
return atan(x/z);
} else if(x > 0.0 && z <= 0.0){
return atan(-z/x) + pi/2.0;
} else if(x <= 0.0 && z <= 0.0) {
return pi + atan(x/z); //atan(x/z) +
} else {
return atan(z/-x) + pi*3.0/2.0;
}
}
float getXRadian(float y, float r) {
return atan(y/r);
}
void main() {
// cal style mapping - 数据纹理映射部分的计算
vec3 size = a_Size * a_Position;
// a_Position.z 是在构建网格的时候传入的标准值 0 - 1,在插值器插值可以获取 0~1 线性渐变的值
v_barLinearZ = a_Position.z;
vec3 offset = size; // 控制圆柱体的大小 - 从标准单位圆柱体进行偏移
if(u_heightfixed < 1.0) { // 圆柱体不固定高度
//
} else {// 圆柱体固定高度 ( 处理 mapbox )
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
offset *= 4.0/pow(2.0, 21.0 - u_Zoom);
}
}
vec4 project_pos = project_position(vec4(a_Pos.xy, 0., 1.0));
// u_r 控制圆柱的生长
vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0);
// 圆柱光照效果
float lightWeight = 1.0;
if(u_lightEnable > 0.0) { // 取消三元表达式,增强健壮性
lightWeight = calc_lighting(pos);
}
v_lightWeight = lightWeight;
// 设置圆柱的底色
if(u_linearColor == 1.0) { // 使用渐变颜色
v_color = mix(u_sourceColor, u_targetColor, v_barLinearZ);
v_color.rgb *= lightWeight;
} else { // 使用 color 方法传入的颜色
v_color = a_Color;
}
v_color.a *= u_opacity;
// 在地球模式下,将原本垂直于 xy 平面的圆柱调整姿态到适应圆的角度
//旋转矩阵mx,创建绕x轴旋转矩阵
float r = sqrt(a_Pos.z*a_Pos.z + a_Pos.x*a_Pos.x);
float xRadian = getXRadian(a_Pos.y, r);
float xcos = cos(xRadian);//求解旋转角度余弦值
float xsin = sin(xRadian);//求解旋转角度正弦值
mat4 mx = mat4(
1,0,0,0,
0,xcos,-xsin,0,
0,xsin,xcos,0,
0,0,0,1);
//旋转矩阵my,创建绕y轴旋转矩阵
float yRadian = getYRadian(a_Pos.x, a_Pos.z);
float ycos = cos(yRadian);//求解旋转角度余弦值
float ysin = sin(yRadian);//求解旋转角度正弦值
mat4 my = mat4(
ycos,0,-ysin,0,
0,1,0,0,
ysin,0,ycos,0,
0,0,0,1);
gl_Position = u_ViewProjectionMatrix * vec4(( my * mx * vec4(a_Position * a_Size, 1.0)).xyz + a_Pos, 1.0);
setPickingColor(a_PickingColor);
}
`,{isNumber:XG}=Sr;let WG=class extends Qt{constructor(...t){super(...t),E(this,"raiseCount",0),E(this,"raiseRepeat",0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,POS:10,NORMAL:11})}getCommonUniformsInfo(){const{animateOption:t={enable:!1,speed:.01,repeat:!1},opacity:r=1,sourceColor:n,targetColor:i,pickLight:o=!1,heightfixed:a=!0,opacityLinear:s={enable:!1,dir:"up"},lightEnable:u=!0}=this.layer.getLayerConfig();let l=0,f=[0,0,0,0],c=[0,0,0,0];if(n&&i&&(f=Zt(n),c=Zt(i),l=1),this.raiseCount<1&&this.raiseRepeat>0&&t.enable){const{speed:p=.01}=t;this.raiseCount+=p,this.raiseCount>=1&&(this.raiseRepeat>1?(this.raiseCount=0,this.raiseRepeat--):this.raiseCount=1)}const h={u_sourceColor:f,u_targetColor:c,u_linearColor:l,u_pickLight:Number(o),u_heightfixed:Number(a),u_r:t.enable&&this.raiseRepeat>0?this.raiseCount:1,u_opacity:XG(r)?r:1,u_opacitylinear:Number(s.enable),u_opacitylinear_dir:s.dir==="up"?1:0,u_lightEnable:Number(u)};return this.getUniformsBufferInfo(h)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{animateOption:{repeat:r=1}}=t.layer.getLayerConfig();return t.raiseRepeat=r,[yield t.layer.buildLayerModel({moduleName:"pointEarthExtrude",vertexShader:jG,fragmentShader:HG,triangulation:wS,depth:{enable:!0},defines:t.getDefines(),inject:t.getInject(),cull:{enable:!0,face:m.FRONT},blend:t.getBlend()})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:t=>{const{size:r}=t;if(r){let n=[];return Array.isArray(r)&&(n=r.length===2?[r[0],r[0],r[1]]:r),Array.isArray(r)||(n=[r,r,r]),n}else return[2,2,2]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"pos",type:qe.Attribute,descriptor:{name:"a_Pos",shaderLocation:this.attributeLocation.POS,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:t=>{const r=Ao(t.coordinates);return PS([r[0],r[1]])}}})}};const GG=`in vec4 v_data;
in vec4 v_color;
in float v_radius;
layout(std140) uniform commonUniform {
float u_additive;
float u_stroke_opacity : 1;
float u_stroke_width : 2;
float u_blur : 0.0;
};
#pragma include "sdf_2d"
#pragma include "picking"
out vec4 outputColor;
void main() {
int shape = int(floor(v_data.w + 0.5));
vec4 strokeColor = u_stroke == vec4(0.0) ? v_color : u_stroke;
lowp float antialiasblur = v_data.z;
float r = v_radius / (v_radius + u_stroke_width);
float outer_df;
float inner_df;
// 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'
if (shape == 0) {
outer_df = sdCircle(v_data.xy, 1.0);
inner_df = sdCircle(v_data.xy, r);
} else if (shape == 1) {
outer_df = sdEquilateralTriangle(1.1 * v_data.xy);
inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);
} else if (shape == 2) {
outer_df = sdBox(v_data.xy, vec2(1.));
inner_df = sdBox(v_data.xy, vec2(r));
} else if (shape == 3) {
outer_df = sdPentagon(v_data.xy, 0.8);
inner_df = sdPentagon(v_data.xy, r * 0.8);
} else if (shape == 4) {
outer_df = sdHexagon(v_data.xy, 0.8);
inner_df = sdHexagon(v_data.xy, r * 0.8);
} else if (shape == 5) {
outer_df = sdOctogon(v_data.xy, 1.0);
inner_df = sdOctogon(v_data.xy, r);
} else if (shape == 6) {
outer_df = sdHexagram(v_data.xy, 0.52);
inner_df = sdHexagram(v_data.xy, r * 0.52);
} else if (shape == 7) {
outer_df = sdRhombus(v_data.xy, vec2(1.0));
inner_df = sdRhombus(v_data.xy, vec2(r));
} else if (shape == 8) {
outer_df = sdVesica(v_data.xy, 1.1, 0.8);
inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);
}
if(outer_df > antialiasblur + 0.018) discard;
float opacity_t = smoothstep(0.0, antialiasblur, outer_df);
float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(
antialiasblur,
0.0,
inner_df
);
if(u_stroke_width < 0.01) {
outputColor = vec4(v_color.rgb, v_color.a * u_opacity);
} else {
outputColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t);
}
if(u_additive > 0.0) {
outputColor *= opacity_t;
outputColor = filterColorAlpha(outputColor, outputColor.a);
} else {
outputColor.a *= opacity_t;
outputColor = filterColor(outputColor);
}
}
`,YG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_SHAPE) in float a_Shape;
layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
layout(std140) uniform commonUniform {
float u_additive;
float u_stroke_opacity : 1;
float u_stroke_width : 2;
float u_blur : 0.0;
};
out vec4 v_data;
out vec4 v_color;
out float v_radius;
#pragma include "projection"
#pragma include "picking"
void main() {
vec3 extrude = a_Extrude;
float shape_type = a_Shape;
/*
* setPickingSize 设置拾取大小
*/
float newSize = setPickingSize(a_Size);
// float newSize = setPickingSize(a_Size) * 0.00001038445708445579;
// unpack color(vec2)
v_color = a_Color;
// radius(16-bit)
v_radius = newSize;
// anti-alias
// float antialiased_blur = -max(u_blur, antialiasblur);
float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);
// TODP: /abs(extrude.x) 是为了兼容地球模式
v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);
gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1 + vec3(u_offsets,0.0), 1.0);
setPickingColor(a_PickingColor);
}
`;let ZG=class extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,SHAPE:10,EXTRUDE:11})}getCommonUniformsInfo(){const{strokeOpacity:t=1,strokeWidth:r=0,blend:n,blur:i=0}=this.layer.getLayerConfig();this.layer.getLayerConfig();const o={u_additive:n==="additive"?1:0,u_stroke_opacity:t,u_stroke_width:r,u_blur:i};return this.getUniformsBufferInfo(o)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.layer.triangulation=YE,[yield t.layer.buildLayerModel({moduleName:"pointEarthFill",vertexShader:YG,fragmentShader:GG,triangulation:YE,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!0},blend:t.getBlend()})]})()}animateOption2Array(t){return[t.enable?0:1,t.speed||1,t.rings||3,0]}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i)=>{const[o,a,s]=n,u=Wn(0,0,1),l=Wn(o,0,s),f=o>=0?cg(u,l):Math.PI*2-cg(u,l),c=Math.PI*2-Math.asin(a/100),h=Up();cA(h,h,f),kp(h,h,c);const d=Wn(1,1,0);Ml(d,d,h),qs(d,d);const p=Wn(-1,1,0);Ml(p,p,h),qs(p,p);const v=Wn(-1,-1,0);Ml(v,v,h),qs(v,v);const g=Wn(1,-1,0);Ml(g,g,h),qs(g,g);const y=[...d,...p,...v,...g],S=i%4*3;return[y[S],y[S+1],y[S+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"shape",type:qe.Attribute,descriptor:{name:"a_Shape",shaderLocation:this.attributeLocation.SHAPE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{shape:r=2}=t;return[this.layer.getLayerConfig().shape2d.indexOf(r)]}}})}};const qG=`
in vec4 v_color;
in float v_lightWeight;
out vec4 outputColor;
layout(std140) uniform commonUniforms {
float u_pickLight;
float u_heightfixed;
float u_r;
float u_linearColor;
vec4 u_sourceColor;
vec4 u_targetColor;
float u_opacitylinear;
float u_opacitylinear_dir;
float u_lightEnable;
};
#pragma include "scene_uniforms"
#pragma include "picking"
void main() {
outputColor = v_color;
// 开启透明度渐变
// picking
if(u_pickLight > 0.0) {
outputColor = filterColorAlpha(outputColor, v_lightWeight);
} else {
outputColor = filterColor(outputColor);
}
}
`,KG=`#define pi (3.1415926535)
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in vec3 a_Size;
layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec4 a_Extrude;
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
layout(std140) uniform commonUniforms {
float u_pickLight;
float u_heightfixed;
float u_r;
float u_linearColor;
vec4 u_sourceColor;
vec4 u_targetColor;
float u_opacitylinear;
float u_opacitylinear_dir;
float u_lightEnable;
};
out vec4 v_color;
out float v_lightWeight;
#pragma include "projection"
#pragma include "light"
#pragma include "picking"
float getYRadian(float x, float z) {
if (x > 0.0 && z > 0.0) {
return atan(x / z);
} else if (x > 0.0 && z <= 0.0) {
return atan(-z / x) + pi / 2.0;
} else if (x <= 0.0 && z <= 0.0) {
return pi + atan(x / z); //atan(x/z) +
} else {
return atan(z / -x) + pi * 3.0 / 2.0;
}
}
float getXRadian(float y, float r) {
return atan(y / r);
}
void main() {
vec3 size = a_Size * a_Position;
vec3 offset = size; // 控制圆柱体的大小 - 从标准单位圆柱体进行偏移
if (u_heightfixed < 1.0) {
// 圆柱体不固定高度
} else {
// 圆柱体固定高度 ( 处理 mapbox )
if (
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
offset *= 4.0 / pow(2.0, 21.0 - u_Zoom);
}
}
vec2 positions = a_Extrude.xy;
vec2 positions64Low = a_Extrude.zw;
vec4 project_pos = project_position(vec4(positions, 0.0, 1.0), positions64Low);
// u_r 控制圆柱的生长
vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0);
// // 圆柱光照效果
float lightWeight = 1.0;
if (u_lightEnable > 0.0) {
// 取消三元表达式,增强健壮性
lightWeight = calc_lighting(pos);
}
v_lightWeight = lightWeight;
v_color = a_Color;
// 设置圆柱的底色
if (u_linearColor == 1.0) {
// 使用渐变颜色
v_color = mix(u_sourceColor, u_targetColor, a_Position.z);
v_color.a = v_color.a * opacity;
} else {
v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);
}
if (u_opacitylinear > 0.0) {
v_color.a *= u_opacitylinear_dir > 0.0 ? 1.0 - a_Position.z : a_Position.z;
}
gl_Position = project_common_position_to_clipspace(pos);
setPickingColor(a_PickingColor);
}
`;let US=class extends Qt{constructor(...t){super(...t),E(this,"raiseCount",0),E(this,"raiseRepeat",0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,EXTRUDE:10,NORMAL:11})}getCommonUniformsInfo(){const{animateOption:t={enable:!1,speed:.01,repeat:!1},sourceColor:r,targetColor:n,pickLight:i=!1,heightfixed:o=!1,opacityLinear:a={enable:!1,dir:"up"},lightEnable:s=!0}=this.layer.getLayerConfig();let u=0,l=[0,0,0,0],f=[0,0,0,0];if(r&&n&&(l=Zt(r),f=Zt(n),u=1),this.raiseCount<1&&this.raiseRepeat>0&&t.enable){const{speed:d=.01}=t;this.raiseCount+=d,this.raiseCount>=1&&(this.raiseRepeat>1?(this.raiseCount=0,this.raiseRepeat--):this.raiseCount=1)}const c={u_pickLight:Number(i),u_heightfixed:Number(o),u_r:t.enable&&this.raiseRepeat>0?this.raiseCount:1,u_linearColor:u,u_sourceColor:l,u_targetColor:f,u_opacitylinear:Number(a.enable),u_opacitylinear_dir:a.dir==="up"?1:0,u_lightEnable:Number(s)};return this.getUniformsBufferInfo(c)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{depth:r=!0,animateOption:{repeat:n=1}}=t.layer.getLayerConfig();return t.raiseRepeat=n,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointExtrude",vertexShader:KG,fragmentShader:qG,triangulation:wS,defines:t.getDefines(),inject:t.getInject(),cull:{enable:!0,face:m.FRONT},depth:{enable:r}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:t=>{const{size:r}=t;if(r){let n=[];return Array.isArray(r)&&(n=r.length===2?[r[0],r[0],r[1]]:r),Array.isArray(r)||(n=[r,r,r]),n}else return[2,2,2]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:4,update:t=>{const r=Ao(t.coordinates);return[r[0],r[1],Ir(r[0]),Ir(r[1])]}}})}};const QG=`
layout(std140) uniform commonUniforms {
vec3 u_blur_height_fixed;
float u_stroke_width;
float u_additive;
float u_stroke_opacity;
float u_size_unit;
float u_time;
vec4 u_animate;
};
in vec4 v_color;
in vec4 v_stroke;
in vec4 v_data;
in float v_radius;
#pragma include "scene_uniforms"
#pragma include "sdf_2d"
#pragma include "picking"
out vec4 outputColor;
void main() {
int shape = int(floor(v_data.w + 0.5));
lowp float antialiasblur = v_data.z;
float r = v_radius / (v_radius + u_stroke_width);
float outer_df;
float inner_df;
// 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'
if (shape == 0) {
outer_df = sdCircle(v_data.xy, 1.0);
inner_df = sdCircle(v_data.xy, r);
} else if (shape == 1) {
outer_df = sdEquilateralTriangle(1.1 * v_data.xy);
inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);
} else if (shape == 2) {
outer_df = sdBox(v_data.xy, vec2(1.));
inner_df = sdBox(v_data.xy, vec2(r));
} else if (shape == 3) {
outer_df = sdPentagon(v_data.xy, 0.8);
inner_df = sdPentagon(v_data.xy, r * 0.8);
} else if (shape == 4) {
outer_df = sdHexagon(v_data.xy, 0.8);
inner_df = sdHexagon(v_data.xy, r * 0.8);
} else if (shape == 5) {
outer_df = sdOctogon(v_data.xy, 1.0);
inner_df = sdOctogon(v_data.xy, r);
} else if (shape == 6) {
outer_df = sdHexagram(v_data.xy, 0.52);
inner_df = sdHexagram(v_data.xy, r * 0.52);
} else if (shape == 7) {
outer_df = sdRhombus(v_data.xy, vec2(1.0));
inner_df = sdRhombus(v_data.xy, vec2(r));
} else if (shape == 8) {
outer_df = sdVesica(v_data.xy, 1.1, 0.8);
inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);
}
float opacity_t = smoothstep(0.0, antialiasblur, outer_df);
float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(
antialiasblur,
0.0,
inner_df
);
float PI = 3.14159;
float N_RINGS = 3.0;
float FREQ = 1.0;
if(u_stroke_width < 0.01) {
outputColor = v_color;
} else {
outputColor = mix(v_color, v_stroke * u_stroke_opacity, color_t);
}
float intensity = 1.0;
if(u_time!=-1.0){
//wave相关逻辑
float d = length(v_data.xy);
if(d > 0.5) {
discard;
}
intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_animate.z - u_animate.y * u_time)), 0.0, 1.0);
}
if(u_additive > 0.0) {
outputColor *= opacity_t;
outputColor *= intensity;//wave
outputColor = filterColorAlpha(outputColor, outputColor.a);
} else {
outputColor.a *= opacity_t;
outputColor.a *= intensity;//wave
outputColor = filterColor(outputColor);
}
// 作为 mask 模板时需要丢弃透明的像素
if(outputColor.a < 0.01) {
discard;
}
}
`,JG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_SHAPE) in float a_Shape;
layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
layout(std140) uniform commonUniforms {
vec3 u_blur_height_fixed;
float u_stroke_width;
float u_additive;
float u_stroke_opacity;
float u_size_unit;
float u_time;
vec4 u_animate;
};
out vec4 v_color;
out vec4 v_stroke;
out vec4 v_data;
out float v_radius;
#pragma include "projection"
#pragma include "picking"
#pragma include "rotation_2d"
void main() {
// 透明度计算
v_stroke = stroke;
vec3 extrude = a_Extrude;
float shape_type = a_Shape;
/*
* setPickingSize 设置拾取大小
* u_meter2coord 在等面积大小的时候设置单位
*/
float newSize = setPickingSize(a_Size);
// float newSize = setPickingSize(a_Size) * 0.00001038445708445579;
// unpack color(vec2)
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
if(u_size_unit == 1.0) {
newSize = newSize * u_PixelsPerMeter.z;
}
v_radius = newSize;
// anti-alias
// float antialiased_blur = -max(u_blur, antialiasblur);
float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur_height_fixed.x);
vec2 offset = (extrude.xy * (newSize + u_stroke_width) + u_offsets);
offset = project_pixel(offset);
offset = rotate_matrix(offset,rotation);
// TODP: /abs(extrude.x) 是为了兼容地球模式
v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);
vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
float raisingHeight = u_blur_height_fixed.y;
if(u_blur_height_fixed.z < 1.0) { // false
raisingHeight = project_pixel(u_blur_height_fixed.y);
} else {
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
raisingHeight = u_blur_height_fixed.y * mapboxZoomScale;
}
}
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
setPickingColor(a_PickingColor);
}
`;let kS=class extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,SHAPE:10,EXTRUDE:11})}getCommonUniformsInfo(){const{strokeOpacity:t=1,strokeWidth:r=0,blend:n,blur:i=0,raisingHeight:o=0,heightfixed:a=!1,unit:s="pixel"}=this.layer.getLayerConfig();let u=this.getAnimateUniforms().u_time;isNaN(u)&&(u=-1);const l={u_blur_height_fixed:[i,Number(o),Number(a)],u_stroke_width:r,u_additive:n==="additive"?1:0,u_stroke_opacity:t,u_size_unit:t_[s],u_time:u,u_animate:this.getAnimateUniforms().u_animate};return this.getUniformsBufferInfo(l)}getAnimateUniforms(){const{animateOption:t={enable:!1}}=this.layer.getLayerConfig();return{u_animate:this.animateOption2Array(t),u_time:this.layer.getLayerAnimateTime()}}getAttribute(){return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(),To)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,type:i}=t.getShaders();return t.layer.triangulation=To,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,defines:t.getDefines(),inject:t.getInject(),triangulation:To,depth:{enable:!1}})]})()}getShaders(){return{frag:QG,vert:JG,type:"pointFill"}}animateOption2Array(t){return[t.enable?0:1,t.speed||1,t.rings||3,0]}registerBuiltinAttributes(){const t=this.layer.getLayerConfig().shape2d;this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(r,n,i,o)=>{const a=[1,1,0,-1,1,0,-1,-1,0,1,-1,0],s=o%4*3;return[a[s],a[s+1],a[s+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:r=>{const{size:n=5}=r;return Array.isArray(n)?[n[0]]:[n]}}}),this.styleAttributeService.registerStyleAttribute({name:"shape",type:qe.Attribute,descriptor:{name:"a_Shape",shaderLocation:this.attributeLocation.SHAPE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:r=>{const{shape:n=2}=r;return[t.indexOf(n)]}}})}};const eY=`in vec2 v_uv;// 本身的 uv 坐标
in vec2 v_Iconuv;
in float v_opacity;
out vec4 outputColor;
uniform sampler2D u_texture;
layout(std140) uniform commonUniform {
vec2 u_textSize;
float u_heightfixed: 0.0;
float u_raisingHeight: 0.0;
float u_size_unit;
};
#pragma include "scene_uniforms"
#pragma include "sdf_2d"
#pragma include "picking"
void main() {
vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;
outputColor = texture(SAMPLER_2D(u_texture), pos);
outputColor.a *= v_opacity;
outputColor = filterColor(outputColor);
}
`,tY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
layout(std140) uniform commonUniform {
vec2 u_textSize;
float u_heightfixed;
float u_raisingHeight;
float u_size_unit;
};
out vec2 v_uv;
out vec2 v_Iconuv;
out float v_opacity;
#pragma include "projection"
#pragma include "picking"
#pragma include "rotation_2d"
void main() {
vec3 extrude = a_Extrude;
v_uv = (a_Extrude.xy + 1.0) / 2.0;
v_uv.y = 1.0 - v_uv.y;
v_Iconuv = a_Uv;
v_opacity = opacity;
float newSize = a_Size;
if (u_size_unit == 1.0) {
newSize = newSize * u_PixelsPerMeter.z;
}
// vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);
vec2 offset = extrude.xy * newSize + offsets;
offset = rotate_matrix(offset, rotation);
offset = project_pixel(offset);
vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
setPickingColor(a_PickingColor);
}
`;class rY extends Qt{constructor(...t){super(...t),E(this,"meter2coord",1),E(this,"texture",void 0),E(this,"isMeter",!1),E(this,"radian",0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas(),mag:"linear",min:"linear mipmap nearest",mipmap:!0}),this.layerService.throttleRenderLayers();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.LINEAR,min:m.LINEAR_MIPMAP_LINEAR,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128,mipmap:!0}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,EXTRUDE:10,UV:11})}getCommonUniformsInfo(){const{raisingHeight:t=0,heightfixed:r=!1,unit:n="pixel"}=this.layer.getLayerConfig();if(this.rendererService.getDirty()){var i;(i=this.texture)===null||i===void 0||i.bind()}const o={u_textSize:[1024,this.iconService.canvasHeight||128],u_heightfixed:Number(r),u_raisingHeight:Number(t),u_size_unit:t_[n]};return this.getUniformsBufferInfo(o)}getAttribute(){return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(),To)}initModels(){var t=this;return ve(function*(){return t.iconService.on("imageUpdate",t.updateTexture),t.updateTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointFillImage",vertexShader:tY,fragmentShader:eY,triangulation:To,depth:{enable:!1},defines:t.getDefines(),inject:t.getInject(),cull:{enable:!0,face:m.FRONT}})]})()}clearModels(){var t;this.iconService.off("imageUpdate",this.updateTexture),(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{shape:n}=t,{x:i,y:o}=r[n]||{x:-64,y:-64};return[i,o]}}}),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i)=>{const o=[1,1,0,-1,1,0,-1,-1,0,1,-1,0],a=i%4*3;return[o[a],o[a+1],o[a+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}const nY=`layout(std140) uniform commonUniforms {
vec2 u_textSize;
float u_raisingHeight;
float u_heightfixed;
};
uniform sampler2D u_texture;
in vec4 v_color;
in vec2 v_uv;
in float v_opacity;
#pragma include "picking"
out vec4 outputColor;
void main(){
vec2 pos = v_uv / u_textSize + gl_PointCoord / u_textSize * 64.;
vec4 textureColor;
// Y = 0.299R + 0.587G + 0.114B // 亮度提取
textureColor = texture(SAMPLER_2D(u_texture), pos);
// Tip: 去除边缘部分 mipmap 导致的混合变暗
float fragmengTocenter = distance(vec2(0.5), gl_PointCoord);
if(fragmengTocenter >= 0.5) {
float luma = 0.299 * textureColor.r + 0.587 * textureColor.g + 0.114 * textureColor.b;
textureColor.a *= luma;
}
if(all(lessThan(v_color, vec4(1.0+0.00001))) && all(greaterThan(v_color, vec4(1.0-0.00001))) || v_color==vec4(1.0)){
outputColor= textureColor;
}else {
outputColor= step(0.01, textureColor.z) * v_color;
}
outputColor.a *= v_opacity;
if (outputColor.a < 0.01) {
discard;
}
outputColor = filterColor(outputColor);
}
`,iY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
layout(std140) uniform commonUniforms {
vec2 u_textSize;
float u_raisingHeight;
float u_heightfixed;
};
out vec4 v_color;
out vec2 v_uv;
out float v_opacity;
#pragma include "projection"
#pragma include "picking"
void main() {
// cal style mapping - 数据纹理映射部分的计算
v_color = a_Color;
v_opacity = opacity;
v_uv = a_Uv;
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
vec2 offset = project_pixel(offsets);
float raisingHeight = u_raisingHeight;
if (u_heightfixed < 1.0) {
// false
raisingHeight = project_pixel(u_raisingHeight);
} else {
if (
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
raisingHeight = u_raisingHeight * mapboxZoomScale;
}
}
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
setPickingColor(a_PickingColor);
}
`;class $S extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas(),mag:"linear",min:"linear mipmap nearest",mipmap:!0}),setTimeout(()=>{this.layerService.throttleRenderLayers()});return}this.texture=r({data:this.iconService.getCanvas(),mag:m.LINEAR,min:m.LINEAR_MIPMAP_LINEAR,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128,mipmap:!0})})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,UV:10})}getUninforms(){if(this.rendererService.getDirty()){var t;(t=this.texture)===null||t===void 0||t.bind()}const r=this.getCommonUniformsInfo(),n=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},r.uniformsOption),n.uniformsOption)}getCommonUniformsInfo(){const{raisingHeight:t=0,heightfixed:r=!1}=this.layer.getLayerConfig(),n={u_textSize:[1024,this.iconService.canvasHeight||128],u_raisingHeight:Number(t),u_heightfixed:Number(r),u_texture:this.texture};return this.textures=[this.texture],this.getUniformsBufferInfo(n)}initModels(){var t=this;return ve(function*(){return t.iconService.on("imageUpdate",t.updateTexture),t.updateTexture(),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointImage",vertexShader:iY,fragmentShader:nY,triangulation:ZW,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1},primitive:m.POINTS})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{shape:n}=t,{x:i,y:o}=r[n]||{x:-64,y:-64};return[i,o]}}})}}const oY=`in vec4 v_color;
out vec4 outputColor;
void main() {
outputColor = v_color;
}`,aY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(std140) uniform u_Common {
float u_size_scale;
};
out vec4 v_color;
#pragma include "projection"
#pragma include "project"
void main() {
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
gl_Position = project_common_position_to_clipspace(project_pos);
gl_PointSize = a_Size * u_size_scale * 2.0 * u_DevicePixelRatio;
}
`;function t1(e){const t=e.coordinates;return{vertices:[...t],indices:[0],size:t.length}}class zS extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9})}getDefaultStyle(){return{blend:"additive"}}getCommonUniformsInfo(){const t={u_size_scale:.5};return this.getUniformsBufferInfo(t)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.layer.triangulation=t1,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointNormal",vertexShader:aY,fragmentShader:oY,triangulation:t1,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1},primitive:m.POINTS,pick:!1})]})()}clearModels(){}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}const sY=`
layout(std140) uniform commonUniorm{
float u_additive;
float u_size_unit;
float u_speed: 1.0;
float u_time;
};
in vec4 v_data;
in vec4 v_color;
in float v_radius;
in vec2 v_extrude;
#pragma include "sdf_2d"
#pragma include "picking"
out vec4 outputColor;
void main() {
lowp float antialiasblur = v_data.z;
float r = v_radius / (v_radius);
float outer_df = sdCircle(v_data.xy, 1.0);
float inner_df = sdCircle(v_data.xy, r);
float opacity_t = smoothstep(0.0, antialiasblur, outer_df);
outputColor = vec4(v_color.rgb, v_color.a);
if(u_additive > 0.0) {
outputColor *= opacity_t;
} else {
outputColor.a *= opacity_t;
}
if(outputColor.a > 0.0) {
outputColor = filterColor(outputColor);
}
vec2 extrude = v_extrude;
vec2 dir = normalize(extrude);
vec2 baseDir = vec2(1.0, 0.0);
float pi = 3.14159265359;
float flag = sign(dir.y);
float rades = dot(dir, baseDir);
float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;
// simple AA
if(radar_v > 0.99) {
radar_v = 1.0 - (radar_v - 0.99)/0.01;
}
outputColor.a *= radar_v;
}
`,uY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
layout(std140) uniform commonUniorm {
float u_additive;
float u_size_unit;
float u_speed: 1.0;
float u_time;
};
out vec4 v_data;
out vec4 v_color;
out float v_radius;
out vec2 v_extrude;
#pragma include "projection"
#pragma include "picking"
void main() {
float newSize = setPickingSize(a_Size);
float time = u_time * u_speed;
mat2 rotateMatrix = mat2(
cos(time), sin(time),
-sin(time), cos(time)
);
v_extrude = rotateMatrix * a_Extrude.xy;
v_color = a_Color;
v_color.a *= opacity;
float blur = 0.0;
float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);
if(u_size_unit == 1.) {
newSize = newSize * u_PixelsPerMeter.z;
}
v_radius = newSize;
vec2 offset = (a_Extrude.xy * (newSize));
offset = project_pixel(offset);
v_data = vec4(a_Extrude.x, a_Extrude.y, antialiasblur, -1.0);
vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
setPickingColor(a_PickingColor);
}
`;class lY extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,EXTRUDE:10})}getCommonUniformsInfo(){const{blend:t,speed:r=1,unit:n="pixel"}=this.layer.getLayerConfig(),i={u_additive:t==="additive"?1:0,u_size_unit:t_[n],u_speed:r,u_time:this.layer.getLayerAnimateTime()};return this.getUniformsBufferInfo(i)}getAnimateUniforms(){return{}}getAttribute(){return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(),To)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointRadar",vertexShader:uY,fragmentShader:sY,triangulation:To,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1}})]})()}animateOption2Array(t){return[t.enable?0:1,t.speed||1,t.rings||3,0]}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i)=>{const o=[1,1,0,-1,1,0,-1,-1,0,1,-1,0],a=i%4*3;return[o[a],o[a+1],o[a+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{shaderLocation:this.attributeLocation.SIZE,name:"a_Size",buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}class cY{constructor(t,r,n){E(this,"boxCells",[]),E(this,"xCellCount",void 0),E(this,"yCellCount",void 0),E(this,"boxKeys",void 0),E(this,"bboxes",void 0),E(this,"width",void 0),E(this,"height",void 0),E(this,"xScale",void 0),E(this,"yScale",void 0),E(this,"boxUid",void 0);const i=this.boxCells;this.xCellCount=Math.ceil(t/n),this.yCellCount=Math.ceil(r/n);for(let o=0;o<this.xCellCount*this.yCellCount;o++)i.push([]);this.boxKeys=[],this.bboxes=[],this.width=t,this.height=r,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/r,this.boxUid=0}insert(t,r,n,i,o){this.forEachCell(r,n,i,o,this.insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}query(t,r,n,i,o){return this.queryHitTest(t,r,n,i,!1,o)}hitTest(t,r,n,i,o){return this.queryHitTest(t,r,n,i,!0,o)}insertBoxCell(t,r,n,i,o,a){this.boxCells[o].push(a)}queryHitTest(t,r,n,i,o,a){if(n<0||t>this.width||i<0||r>this.height)return o?!1:[];const s=[];if(t<=0&&r<=0&&this.width<=n&&this.height<=i){if(o)return!0;for(let l=0;l<this.boxKeys.length;l++)s.push({key:this.boxKeys[l],x1:this.bboxes[l*4],y1:this.bboxes[l*4+1],x2:this.bboxes[l*4+2],y2:this.bboxes[l*4+3]});return a?s.filter(a):s}const u={hitTest:o,seenUids:{box:{},circle:{}}};return this.forEachCell(t,r,n,i,this.queryCell,s,u,a),o?s.length>0:s}queryCell(t,r,n,i,o,a,s,u){const l=s.seenUids,f=this.boxCells[o];if(f!==null){const c=this.bboxes;for(const h of f)if(!l.box[h]){l.box[h]=!0;const d=h*4;if(t<=c[d+2]&&r<=c[d+3]&&n>=c[d+0]&&i>=c[d+1]&&(!u||u(this.boxKeys[h]))){if(s.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[h],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}return!1}forEachCell(t,r,n,i,o,a,s,u){const l=this.convertToXCellCoord(t),f=this.convertToYCellCoord(r),c=this.convertToXCellCoord(n),h=this.convertToYCellCoord(i);for(let d=l;d<=c;d++)for(let p=f;p<=h;p++){const v=this.xCellCount*p+d;if(o.call(this,t,r,n,i,v,a,s,u))return}}convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}}class fY{constructor(t,r){E(this,"width",void 0),E(this,"height",void 0),E(this,"grid",void 0),E(this,"viewportPadding",100),E(this,"screenRightBoundary",void 0),E(this,"screenBottomBoundary",void 0),E(this,"gridRightBoundary",void 0),E(this,"gridBottomBoundary",void 0),this.width=t,this.height=r,this.viewportPadding=Math.max(t,r),this.grid=new cY(t+this.viewportPadding,r+this.viewportPadding,25),this.screenRightBoundary=t+this.viewportPadding,this.screenBottomBoundary=r+this.viewportPadding,this.gridRightBoundary=t+2*this.viewportPadding,this.gridBottomBoundary=r+2*this.viewportPadding}placeCollisionBox(t){const r=t.x1+t.anchorPointX+this.viewportPadding,n=t.y1+t.anchorPointY+this.viewportPadding,i=t.x2+t.anchorPointX+this.viewportPadding,o=t.y2+t.anchorPointY+this.viewportPadding;return!this.isInsideGrid(r,n,i,o)||this.grid.hitTest(r,n,i,o)?{box:[]}:{box:[r,n,i,o]}}insertCollisionBox(t,r){const n={featureIndex:r};this.grid.insert(n,t[0],t[1],t[2],t[3])}project(t,r,n){const i=N9(r,n,0,1),o=hA(),a=x9(...t);return $p(o,i,a),{x:(o[0]/o[3]+1)/2*this.width+this.viewportPadding,y:(-o[1]/o[3]+1)/2*this.height+this.viewportPadding}}isInsideGrid(t,r,n,i){return n>=0&&t<this.gridRightBoundary&&i>=0&&r<this.gridBottomBoundary}}function VS(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0;break;default:t=.5}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0;break;default:r=.5}return{horizontalAlign:t,verticalAlign:r}}function HS(e,t,r,n,i,o,a){const s=(t-r)*i,u=(-n*a+.5)*o;for(const l of e)l.x+=s,l.y+=u}function hY(e,t,r,n,i,o,a){let u=0,l=-8,f=0;const c=e.positionedGlyphs,h=0,d=c.length;r.forEach(y=>{if(y.split("").forEach(S=>{const R=t[S];R&&(c.push({glyph:S,x:u,y:l+0,vertical:!1,scale:1,metrics:R}),u+=R.advance+a)}),c.length!==d){const S=u-a;f=Math.max(S,f),c.length-1}u=0,l-=n+5});const{horizontalAlign:p,verticalAlign:v}=VS(i);HS(c,h,p,v,f,n,r.length);const g=l- -8;e.top+=-v*g,e.bottom=e.top-g,e.left+=-p*f,e.right=e.left+f}function dY(e,t,r,n,i,o,a){let u=0,l=-8,f=0;const c=e.positionedGlyphs,h=0,d=c.length;r.forEach(y=>{const S=t[y];if(S&&(c.push({glyph:y,x:S.advance/2,y:l+0,vertical:!1,scale:1,metrics:S}),u+=S.advance+a),c.length!==d){const x=u-a;f=Math.max(x,f),c.length-1}u=0,l-=n+5});const{horizontalAlign:p,verticalAlign:v}=VS(i);HS(c,h,p,v,f,n,r.length);const g=l- -8;e.top+=-v*g,e.bottom=e.top-g,e.left+=-p*f,e.right=e.left+f}function pY(e,t,r,n,i,o,a=[0,0],s){const u=e.split(`
`),l=[],f={positionedGlyphs:l,top:a[1],bottom:a[1],left:a[0],right:a[0],lineCount:u.length,text:e};return s?dY(f,t,u,r,n,i,o):hY(f,t,u,r,n,i,o),l.length?f:!1}function _Y(e,t=[0,0],r){const{positionedGlyphs:n=[]}=e,i=[];for(const o of n){const a=o.metrics,s=4,u=a.advance*o.scale/2,l=[0,0],f=[o.x+u+t[0],o.y+t[1]],c=(0-s)*o.scale-u+f[0],h=(0-s)*o.scale+f[1],d=c+a.width*o.scale,p=h+a.height*o.scale,v={x:c,y:h},g={x:d,y:h},y={x:c,y:p},S={x:d,y:p};i.push({tl:v,tr:g,bl:y,br:S,tex:a,glyphOffset:l})}return i}const r1=`#define SDF_PX 8.0
#define EDGE_GAMMA 0.105
#define FONT_SIZE 48.0
uniform sampler2D u_sdf_map;
layout(std140) uniform commonUniforms {
vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
vec2 u_sdf_map_size;
float u_raisingHeight: 0.0;
float u_stroke_width : 2;
float u_gamma_scale : 0.5;
float u_halo_blur : 0.5;
};
in vec2 v_uv;
in float v_gamma_scale;
in vec4 v_color;
in vec4 v_stroke_color;
in float v_fontScale;
out vec4 outputColor;
#pragma include "picking"
void main() {
// get style data mapping
// get sdf from atlas
float dist = texture(SAMPLER_2D(u_sdf_map), v_uv).a;
lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;
highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;
highp float gamma_scaled = gamma * v_gamma_scale;
highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
outputColor = mix(v_color, v_stroke_color, smoothstep(0., 0.5, 1.- dist));
outputColor.a *= alpha;
// 作为 mask 模板时需要丢弃透明的像素
if (outputColor.a < 0.01) {
discard;
}
outputColor = filterColor(outputColor);
}
`,n1=`#define SDF_PX 8.0
#define EDGE_GAMMA 0.105
#define FONT_SIZE 24.0
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_TEXT_OFFSETS) in vec2 a_textOffsets;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_tex;
layout(std140) uniform commonUniforms {
vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
vec2 u_sdf_map_size;
float u_raisingHeight: 0.0;
float u_stroke_width : 2;
float u_gamma_scale : 0.5;
float u_halo_blur : 0.5;
};
out vec2 v_uv;
out float v_gamma_scale;
out vec4 v_color;
out vec4 v_stroke_color;
out float v_fontScale;
#pragma include "projection"
#pragma include "picking"
#pragma include "rotation_2d"
void main() {
// cal style mapping - 数据纹理映射部分的计算
v_uv = a_tex / u_sdf_map_size;
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
v_stroke_color = vec4(u_stroke_color.xyz, u_stroke_color.w * opacity);
// 文本缩放比例
float fontScale = a_Size / FONT_SIZE;
v_fontScale = fontScale;
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
// vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
vec2 offset = rotate_matrix(a_textOffsets,rotation);
// gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);
float raiseHeight = u_raisingHeight;
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
raiseHeight = u_raisingHeight * mapboxZoomScale;
}
vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));
gl_Position = vec4(
projected_position.xy / projected_position.w + offset * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);
v_gamma_scale = gl_Position.w;
setPickingColor(a_PickingColor);
}
`,{isEqual:Us}=Sr;function i1(e){const t=this,r=e.id,n=[],i=[];if(!t.glyphInfoMap||!t.glyphInfoMap[r])return{vertices:[],indices:[],size:7};const o=t.glyphInfoMap[r].centroid,a=o.length===2?[o[0],o[1],0]:o;return t.glyphInfoMap[r].glyphQuads.forEach((s,u)=>{n.push(...a,s.tex.x,s.tex.y+s.tex.height,s.tl.x,s.tl.y,...a,s.tex.x+s.tex.width,s.tex.y+s.tex.height,s.tr.x,s.tr.y,...a,s.tex.x+s.tex.width,s.tex.y,s.br.x,s.br.y,...a,s.tex.x,s.tex.y,s.bl.x,s.bl.y),i.push(0+u*4,1+u*4,2+u*4,2+u*4,3+u*4,0+u*4)}),{vertices:n,indices:i,size:7}}class jS extends Qt{constructor(...t){var r;super(...t),r=this,E(this,"glyphInfo",void 0),E(this,"glyphInfoMap",{}),E(this,"rawEncodeData",void 0),E(this,"texture",void 0),E(this,"currentZoom",-1),E(this,"extent",void 0),E(this,"textureHeight",0),E(this,"textCount",0),E(this,"preTextStyle",{}),E(this,"mapping",ve(function*(){r.initGlyph(),r.updateTexture(),yield r.reBuildModel()}))}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,TEXT_OFFSETS:10,UV:11})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he(he({},t.uniformsOption),r.uniformsOption),{u_sdf_map:this.textures[0]})}getCommonUniformsInfo(){const{stroke:t="#fff",strokeWidth:r=0,halo:n=.5,gamma:i=2,raisingHeight:o=0}=this.layer.getLayerConfig(),a=this.getFontServiceMapping(),s=this.getFontServiceCanvas();a&&Object.keys(a).length!==this.textCount&&s&&(this.updateTexture(),this.textCount=Object.keys(a).length),this.preTextStyle=this.getTextStyle();const u={u_stroke_color:Zt(t),u_sdf_map_size:[(s==null?void 0:s.width)||1,(s==null?void 0:s.height)||1],u_raisingHeight:Number(o),u_stroke_width:r,u_gamma_scale:i,u_halo_blur:n};return this.getUniformsBufferInfo(u)}initModels(){var t=this;return ve(function*(){return t.bindEvent(),t.extent=t.textExtent(),t.rawEncodeData=t.layer.getEncodedData(),t.preTextStyle=t.getTextStyle(),t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{textAllowOverlap:r=!1}=t.layer.getLayerConfig();return t.initGlyph(),t.updateTexture(),r||t.filterGlyphs(),[yield t.layer.buildLayerModel({moduleName:"pointText",vertexShader:n1,fragmentShader:r1,defines:t.getDefines(),inject:t.getInject(),triangulation:i1.bind(t),depth:{enable:!1}})]})()}needUpdate(){var t=this;return ve(function*(){const{textAllowOverlap:r=!1,textAnchor:n="center",textOffset:i,padding:o,fontFamily:a,fontWeight:s}=t.getTextStyle();if(!Us(o,t.preTextStyle.padding)||!Us(i,t.preTextStyle.textOffset)||!Us(n,t.preTextStyle.textAnchor)||!Us(a,t.preTextStyle.fontFamily)||!Us(s,t.preTextStyle.fontWeight))return yield t.mapping(),!0;if(r)return!1;const u=t.mapService.getZoom(),l=t.mapService.getBounds(),f=kT(t.extent,l);return Math.abs(t.currentZoom-u)>.5||!f||r!==t.preTextStyle.textAllowOverlap?(yield t.reBuildModel(),!0):!1})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.layer.off("remapping",this.mapping)}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"textOffsets",type:qe.Attribute,descriptor:{shaderLocation:this.attributeLocation.TEXT_OFFSETS,name:"a_textOffsets",buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"textUv",type:qe.Attribute,descriptor:{name:"a_tex",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=12}=t;return Array.isArray(r)?[r[0]]:[r]}}})}bindEvent(){this.layer.isTileLayer||this.layer.on("remapping",this.mapping)}textExtent(){const t=this.mapService.getBounds();return Lp(t,.5)}initTextFont(){const{fontWeight:t,fontFamily:r}=this.getTextStyle(),n=this.rawEncodeData,i=[];n.forEach(o=>{let{shape:a=""}=o;a=a.toString();for(const s of a)i.indexOf(s)===-1&&i.push(s)}),this.fontService.setFontOptions({characterSet:i,fontWeight:t,fontFamily:r,iconfont:!1})}initIconFontTex(){const{fontWeight:t,fontFamily:r}=this.getTextStyle(),n=this.rawEncodeData,i=[];n.forEach(o=>{let{shape:a=""}=o;a=`${a}`,i.indexOf(a)===-1&&i.push(a)}),this.fontService.setFontOptions({characterSet:i,fontWeight:t,fontFamily:r,iconfont:!0})}getTextStyle(){const{fontWeight:t="400",fontFamily:r="sans-serif",textAllowOverlap:n=!1,padding:i=[0,0],textAnchor:o="center",textOffset:a=[0,0],opacity:s=1,strokeOpacity:u=1,strokeWidth:l=0,stroke:f="#000"}=this.layer.getLayerConfig();return{fontWeight:t,fontFamily:r,textAllowOverlap:n,padding:i,textAnchor:o,textOffset:a,opacity:s,strokeOpacity:u,strokeWidth:l,stroke:f}}generateGlyphLayout(t){const r=this.getFontServiceMapping(),{spacing:n=2,textAnchor:i="center",textOffset:o}=this.layer.getLayerConfig(),a=this.rawEncodeData;this.glyphInfo=a.map(s=>{const{shape:u="",id:l,size:f=1}=s,c=s.textOffset?s.textOffset:o||[0,0],h=s.textAnchor?s.textAnchor:i||"center",d=pY(u.toString(),r,f,h,"left",n,c,t),p=_Y(d,c);return s.shaping=d,s.glyphQuads=p,s.centroid=Ao(s.coordinates),this.glyphInfoMap[l]={shaping:d,glyphQuads:p,centroid:Ao(s.coordinates)},s})}getFontServiceMapping(){const{fontWeight:t="400",fontFamily:r="sans-serif"}=this.layer.getLayerConfig();return this.fontService.getMappingByKey(`${r}_${t}`)}getFontServiceCanvas(){const{fontWeight:t="400",fontFamily:r="sans-serif"}=this.layer.getLayerConfig();return this.fontService.getCanvasByKey(`${r}_${t}`)}filterGlyphs(){const{padding:t=[0,0],textAllowOverlap:r=!1}=this.layer.getLayerConfig();if(r)return;this.glyphInfoMap={},this.currentZoom=this.mapService.getZoom(),this.extent=this.textExtent();const{width:n,height:i}=this.rendererService.getViewportSize(),o=new fY(n,i);this.glyphInfo.filter(s=>{const{shaping:u,id:l=0}=s,f=s.centroid,h=s.size/16,d=this.mapService.lngLatToContainer(f),{box:p}=o.placeCollisionBox({x1:u.left*h-t[0],x2:u.right*h+t[0],y1:u.top*h-t[1],y2:u.bottom*h+t[1],anchorPointX:d.x,anchorPointY:d.y});return p&&p.length?(o.insertCollisionBox(p,l),!0):!1}).forEach(s=>{this.glyphInfoMap[s.id]=s})}initGlyph(){const{iconfont:t=!1}=this.layer.getLayerConfig();t?this.initIconFontTex():this.initTextFont(),this.generateGlyphLayout(t)}updateTexture(){const{createTexture2D:t}=this.rendererService,r=this.getFontServiceCanvas();this.textureHeight=r.height,this.texture&&this.texture.destroy(),this.texture=t({data:r,mag:m.LINEAR,min:m.LINEAR,width:r.width,height:r.height}),this.textures=[this.texture]}reBuildModel(){var t=this;return ve(function*(){t.filterGlyphs();const r=yield t.layer.buildLayerModel({moduleName:"pointText",vertexShader:n1,fragmentShader:r1,triangulation:i1.bind(t),defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1}});t.layer.models=[r]})()}}const vY={fillImage:rY,fill:kS,radar:lY,image:$S,normal:zS,simplePoint:VG,extrude:US,text:jS,earthFill:ZG,earthExtrude:WG};class Kd extends Ka{constructor(...t){super(...t),E(this,"type","PointLayer"),E(this,"enableShaderEncodeStyles",["stroke","offsets","opacity","rotation"]),E(this,"enableDataEncodeStyles",["textOffset","textAnchor"]),E(this,"defaultSourceConfig",{data:[],options:{parser:{type:"json",x:"lng",y:"lat"}}})}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel&&t.layerModel.clearModels(),t.layerModel=new vY[r](t),yield t.initLayerModels()})()}rebuildModels(){var t=this;return ve(function*(){yield t.buildModels()})()}getModelTypeWillEmptyData(){if(this.shapeOption){const{field:t,values:r}=this.shapeOption,{shape2d:n}=this.getLayerConfig(),i=this.iconService.getIconMap();if(t&&(n==null?void 0:n.indexOf(t))!==-1)return"fill";if(r==="text")return"text";if(r&&r instanceof Array){for(const o of r)if(typeof o=="string"&&i.hasOwnProperty(o))return"image"}}return"normal"}getDefaultConfig(){const t=this.getModelType();return{fillImage:{},normal:{blend:"additive"},radar:{},simplePoint:{},fill:{blend:"normal"},extrude:{},image:{},text:{blend:"normal"},tile:{},tileText:{},earthFill:{},earthExtrude:{}}[t]}getModelType(){const t=this.getEncodedData(),{shape2d:r,shape3d:n,billboard:i=!0}=this.getLayerConfig(),o=this.iconService.getIconMap(),a=t.find(s=>s.hasOwnProperty("shape"));if(a){const s=a.shape;return s==="dot"?"normal":s==="simple"?"simplePoint":s==="radar"?"radar":this.layerType==="fillImage"||i===!1?"fillImage":(r==null?void 0:r.indexOf(s))!==-1?this.mapService.version==="GLOBEL"?"earthFill":"fill":(n==null?void 0:n.indexOf(s))!==-1?this.mapService.version==="GLOBEL"?"earthExtrude":"extrude":o.hasOwnProperty(s)?"image":"text"}else return this.getModelTypeWillEmptyData()}}function mY(e){return Qd.apply(this,arguments)}function Qd(){return Qd=ve(function*(e){if(window.createImageBitmap){const t=yield fetch(e);return yield createImageBitmap(yield t.blob())}else{const t=new window.Image;return new Promise(r=>{t.onload=()=>r(t),t.src=e,t.crossOrigin="Anonymous"})}}),Qd.apply(this,arguments)}const gY=`layout(std140) uniform commonUniforms {
vec4 u_sourceColor;
vec4 u_targetColor;
float u_linearColor;
float u_topsurface;
float u_sidesurface;
float u_heightfixed; // 默认不固定
float u_raisingHeight;
};
in vec4 v_Color;
#pragma include "scene_uniforms"
#pragma include "picking"
out vec4 outputColor;
void main() {
// top face
if(u_topsurface < 1.0) {
discard;
}
outputColor = v_Color;
outputColor = filterColor(outputColor);
}
`,EY=`
layout(std140) uniform commonUniforms {
vec4 u_sourceColor;
vec4 u_targetColor;
float u_linearColor;
float u_topsurface;
float u_sidesurface;
float u_heightfixed; // 默认不固定
float u_raisingHeight;
};
in vec4 v_Color;
in vec3 v_uvs;
in vec2 v_texture_data;
out vec4 outputColor;
#pragma include "scene_uniforms"
#pragma include "picking"
void main() {
float isSide = v_texture_data.x;
float sidey = v_uvs[2];
float lightWeight = v_texture_data.y;
// Tip: 部分机型 GPU 计算精度兼容
if(isSide < 0.999) {
// side face
if(u_sidesurface < 1.0) {
discard;
}
if( u_linearColor == 1.0) {
// side use linear
vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
linearColor.rgb *= lightWeight;
outputColor = linearColor;
} else {
// side notuse linear
outputColor = v_Color;
}
} else {
// top face
if(u_topsurface < 1.0) {
discard;
}
outputColor = v_Color;
}
outputColor = filterColorAlpha(outputColor, lightWeight);
}
`,yY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
layout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs;
layout(std140) uniform commonUniforms {
vec4 u_sourceColor;
vec4 u_targetColor;
float u_linearColor;
float u_topsurface;
float u_sidesurface;
float u_heightfixed; // 默认不固定
float u_raisingHeight;
};
out vec4 v_Color;
out vec3 v_uvs;
out vec2 v_texture_data;
#pragma include "projection"
#pragma include "light"
#pragma include "picking"
void main() {
v_uvs = a_uvs;
// cal style mapping - 数据纹理映射部分的计算
vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
vec4 project_pos = project_position(pos, a_Position64Low);
if (u_heightfixed > 0.0) {
// 判断几何体是否固定高度
project_pos.z = a_Position.z * a_Size;
project_pos.z += u_raisingHeight;
if (
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
project_pos.z *= mapboxZoomScale;
project_pos.z += u_raisingHeight * mapboxZoomScale;
}
}
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
float lightWeight = calc_lighting(project_pos);
v_texture_data = vec2(a_Position.z, lightWeight);
v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);
setPickingColor(a_PickingColor);
}
`,TY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
layout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs;
layout(std140) uniform commonUniforms {
vec4 u_sourceColor;
vec4 u_targetColor;
float u_linearColor;
float u_topsurface;
float u_sidesurface;
float u_heightfixed; // 默认不固定
float u_raisingHeight;
};
out vec4 v_Color;
#pragma include "projection"
#pragma include "light"
#pragma include "picking"
void main() {
float isSide = a_Position.z;
float topU = a_uvs[0];
float topV = 1.0 - a_uvs[1];
float sidey = a_uvs[2];
vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
vec4 project_pos = project_position(pos, a_Position64Low);
float lightWeight = calc_lighting(project_pos);
if (u_heightfixed > 0.0) {
// 判断几何体是否固定高度
project_pos.z = a_Position.z * a_Size;
project_pos.z += u_raisingHeight;
if (
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
project_pos.z *= mapboxZoomScale;
project_pos.z += u_raisingHeight * mapboxZoomScale;
}
}
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
// Tip: 部分机型 GPU 计算精度兼容
if (isSide < 0.999) {
// side face
// if(u_sidesurface < 1.0) {
// discard;
// }
if (u_linearColor == 1.0) {
vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
linearColor.rgb *= lightWeight;
v_Color = linearColor;
} else {
v_Color = a_Color;
}
} else {
v_Color = a_Color;
}
v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);
setPickingColor(a_PickingColor);
}
`,AY=`uniform sampler2D u_texture;
layout(std140) uniform commonUniforms {
vec4 u_sourceColor;
vec4 u_targetColor;
float u_linearColor;
float u_topsurface;
float u_sidesurface;
float u_heightfixed; // 默认不固定
float u_raisingHeight;
};
in vec4 v_Color;
in vec3 v_uvs;
in vec2 v_texture_data;
#pragma include "scene_uniforms"
#pragma include "picking"
out vec4 outputColor;
void main() {
float opacity = u_opacity;
float isSide = v_texture_data.x;
float lightWeight = v_texture_data.y;
float topU = v_uvs[0];
float topV = 1.0 - v_uvs[1];
float sidey = v_uvs[2];
outputColor = texture(SAMPLER_2D(u_texture), vec2(topU, topV));
// Tip: 部分机型 GPU 计算精度兼容
if (isSide < 0.999) {// 是否是边缘
// side face
if (u_sidesurface < 1.0) {
discard;
}
if (u_linearColor == 1.0) {
vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
linearColor.rgb *= lightWeight;
outputColor = linearColor;
} else {
outputColor = v_Color;
}
} else {
// top face
if (u_topsurface < 1.0) {
discard;
}
}
outputColor.a *= opacity;
outputColor = filterColor(outputColor);
}
`,SY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
layout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs;
layout(std140) uniform commonUniforms {
vec4 u_sourceColor;
vec4 u_targetColor;
float u_linearColor;
float u_topsurface;
float u_sidesurface;
float u_heightfixed; // 默认不固定
float u_raisingHeight;
};
out vec4 v_Color;
out vec3 v_uvs;
out vec2 v_texture_data;
#pragma include "projection"
#pragma include "light"
#pragma include "picking"
void main() {
vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
vec4 project_pos = project_position(pos, a_Position64Low);
float lightWeight = calc_lighting(project_pos);
v_uvs = a_uvs;
v_Color = a_Color;
v_Color.a *= opacity;
v_texture_data = vec2(a_Position.z, lightWeight);
if (u_heightfixed > 0.0) {
// 判断几何体是否固定高度
project_pos.z = a_Position.z * a_Size;
project_pos.z += u_raisingHeight;
if (
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
project_pos.z *= mapboxZoomScale;
project_pos.z += u_raisingHeight * mapboxZoomScale;
}
}
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
setPickingColor(a_PickingColor);
}
`;class xY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,NORMAL:10,UV:11})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{mapTexture:t,heightfixed:r=!1,raisingHeight:n=0,topsurface:i=!0,sidesurface:o=!0,sourceColor:a,targetColor:s}=this.layer.getLayerConfig();let u=0,l=[1,1,1,1],f=[1,1,1,1];a&&s&&(l=Zt(a),f=Zt(s),u=1);const c={u_sourceColor:l,u_targetColor:f,u_linearColor:u,u_topsurface:Number(i),u_sidesurface:Number(o),u_heightfixed:Number(r),u_raisingHeight:Number(n)};return t&&this.texture&&(c.u_texture=this.texture,this.textures=[this.texture]),this.getUniformsBufferInfo(c)}initModels(){var t=this;return ve(function*(){return yield t.loadTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,type:i}=t.getShaders();return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,depth:{enable:!0},defines:t.getDefines(),inject:t.getInject(),triangulation:FS})]})()}getShaders(){const{pickLight:t,mapTexture:r}=this.layer.getLayerConfig();return r?{frag:AY,vert:SY,type:"polygonExtrudeTexture"}:t?{frag:EY,vert:yY,type:"polygonExtrudePickLight"}:{frag:gY,vert:TY,type:"polygonExtrude"}}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.textures=[]}registerBuiltinAttributes(){const t=this.layer.getSource().extent,r=t[2]-t[0],n=t[3]-t[1];this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uvs",type:qe.Attribute,descriptor:{name:"a_uvs",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(i,o,a)=>{const s=a[0],u=a[1];return[(s-t[0])/r,(u-t[1])/n,a[4]]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(i,o,a,s,u)=>u}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:i=>{const{size:o=10}=i;return Array.isArray(o)?[o[0]]:[o]}}})}loadTexture(){var t=this;return ve(function*(){const{mapTexture:r}=t.layer.getLayerConfig(),{createTexture2D:n}=t.rendererService;if(t.texture=n({height:1,width:1}),r){const i=yield mY(r);t.texture=n({data:i,width:i.width,height:i.height,wrapS:m.CLAMP_TO_EDGE,wrapT:m.CLAMP_TO_EDGE,min:m.LINEAR,mag:m.LINEAR})}})()}}const bY=`
in vec4 v_Color;
#pragma include "scene_uniforms"
#pragma include "picking"
out vec4 outputColor;
void main() {
outputColor = v_Color;
outputColor = filterColor(outputColor);
}
`,RY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
out vec4 v_Color;
#pragma include "projection"
#pragma include "light"
#pragma include "picking"
void main() {
vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);
vec4 project_pos = project_position(pos, a_Position64Low);
float lightWeight = calc_lighting(project_pos);
v_Color = a_Color;
v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
setPickingColor(a_PickingColor);
}
`;class CY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,NORMAL:10,EXTRUSION_BASE:11})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const t={};return this.getUniformsBufferInfo(t)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,type:i}=t.getShaders();return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,defines:t.getDefines(),inject:t.getInject(),triangulation:FS,depth:{enable:!0}})]})()}getShaders(){return{frag:bY,vert:RY,type:"polygonExtrude"}}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=10}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"extrusionBase",type:qe.Attribute,descriptor:{name:"a_ExtrusionBase",shaderLocation:this.attributeLocation.EXTRUSION_BASE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{extrusionBase:r=0}=t;return[r]}}})}}const OY=`in vec4 v_color;
#pragma include "scene_uniforms"
#pragma include "picking"
out vec4 outputColor;
void main() {
outputColor = v_color;
outputColor = filterColor(outputColor);
}
`,IY=`
layout(std140) uniform commonUniforms {
float u_raisingHeight;
float u_opacitylinear;
float u_dir;
};
in vec4 v_color;
in vec3 v_linear;
in vec2 v_pos;
out vec4 outputColor;
#pragma include "scene_uniforms"
#pragma include "picking"
void main() {
outputColor = v_color;
if (u_opacitylinear > 0.0) {
outputColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;
}
outputColor = filterColor(outputColor);
}
`,MY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_LINEAR) in vec3 a_linear;
layout(std140) uniform commonUniforms {
float u_raisingHeight;
float u_opacitylinear;
float u_dir;
};
out vec4 v_color;
out vec3 v_linear;
out vec2 v_pos;
#pragma include "projection"
#pragma include "picking"
void main() {
if (u_opacitylinear > 0.0) {
v_linear = a_linear;
v_pos = a_Position.xy;
}
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
project_pos.z += u_raisingHeight;
if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
project_pos.z *= mapboxZoomScale;
project_pos.z += u_raisingHeight * mapboxZoomScale;
}
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
setPickingColor(a_PickingColor);
}
`,NY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(std140) uniform commonUniforms {
float u_raisingHeight;
};
out vec4 v_color;
#pragma include "projection"
#pragma include "picking"
void main() {
// cal style mapping - 数据纹理映射部分的计算
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
project_pos.z += u_raisingHeight;
if (
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
) {
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
project_pos.z *= mapboxZoomScale;
project_pos.z += u_raisingHeight * mapboxZoomScale;
}
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
setPickingColor(a_PickingColor);
}
`;class PY extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,LINEAR:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{raisingHeight:t=0,opacityLinear:r={enable:!1,dir:"in"}}=this.layer.getLayerConfig(),n={u_raisingHeight:Number(t),u_opacitylinear:Number(r.enable),u_dir:r.dir==="in"?1:0};return this.getUniformsBufferInfo(n)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,triangulation:i,type:o}=t.getModelParams();return t.initUniformsBuffer(),t.layer.triangulation=i,[yield t.layer.buildLayerModel({moduleName:o,vertexShader:n,fragmentShader:r,defines:t.getDefines(),inject:t.getInject(),triangulation:i,primitive:m.TRIANGLES,depth:{enable:!1}})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute();const{opacityLinear:t={enable:!1,dir:"in"}}=this.layer.getLayerConfig();t.enable&&this.styleAttributeService.registerStyleAttribute({name:"linear",type:qe.Attribute,descriptor:{name:"a_linear",shaderLocation:this.attributeLocation.LINEAR,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(r,n,i)=>[i[3],i[4],i[5]]}})}getModelParams(){const{opacityLinear:t={enable:!1}}=this.layer.getLayerConfig();return t.enable?{frag:IY,vert:MY,type:"polygonLinear",triangulation:QW}:{frag:OY,vert:NY,type:"polygonFill",triangulation:ku}}}const LY=`
layout(std140) uniform commonUniforms {
vec4 u_watercolor;
vec4 u_watercolor2;
float u_time;
};
in vec2 v_uv;
in float v_opacity;
out vec4 outputColor;
float coast2water_fadedepth = 0.10;
float large_waveheight = .750; // change to adjust the "heavy" waves
float large_wavesize = 3.4; // factor to adjust the large wave size
float small_waveheight = 0.6; // change to adjust the small random waves
float small_wavesize = 0.5; // factor to ajust the small wave size
float water_softlight_fact = 15.; // range [1..200] (should be << smaller than glossy-fact)
float water_glossylight_fact= 120.; // range [1..200]
float particle_amount = 70.;
vec3 water_specularcolor = vec3(1.3, 1.3, 0.9); // specular Color (RGB) of the water-highlights
#define light vec3(-0., sin(u_time*0.5)*.5 + .35, 2.8) // position of the sun
uniform sampler2D u_texture1;
uniform sampler2D u_texture2;
uniform sampler2D u_texture3;
float hash( float n ) {
return fract(sin(n)*43758.5453123);
}
// 2d noise function
float noise1( in vec2 x ) {
vec2 p = floor(x);
vec2 f = smoothstep(0.0, 1.0, fract(x));
float n = p.x + p.y*57.0;
return mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x),
mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y);
}
float noise(vec2 p) {
return texture(SAMPLER_2D(u_texture2),p*vec2(1./256.)).x;
}
vec4 highness(vec2 p) {
vec4 t = texture(SAMPLER_2D(u_texture1),fract(p));
float clipped = -2.0-smoothstep(3.,10.,t.a)*6.9-smoothstep(10.,100.,t.a)*89.9-smoothstep(0.,10000.,t.a)*10000.0;
return clamp(t, 0.0,3.0)+clamp(t/3.0-1.0, 0.0,1.0)+clamp(t/16.0-1.0, 0.0,1.0);
}
float height_map( vec2 p ) {
vec4 height=highness(p);
/*
height = -0.5+
0.5*smoothstep(-100.,0.,-height)+
2.75*smoothstep(0.,2.,height)+
1.75*smoothstep(2.,4.,height)+
2.75*smoothstep(4.,16.,height)+
1.5*smoothstep(16.,1000.,height);
*/
mat2 m = mat2( 0.9563*1.4, -0.2924*1.4, 0.2924*1.4, 0.9563*1.4 );
//p = p*6.;
float f = 0.6000*noise1( p ); p = m*p*1.1*6.;
f += 0.2500*noise( p ); p = m*p*1.32;
f += 0.1666*noise( p ); p = m*p*1.11;
f += 0.0834*noise( p ); p = m*p*1.12;
f += 0.0634*noise( p ); p = m*p*1.13;
f += 0.0444*noise( p ); p = m*p*1.14;
f += 0.0274*noise( p ); p = m*p*1.15;
f += 0.0134*noise( p ); p = m*p*1.16;
f += 0.0104*noise( p ); p = m*p*1.17;
f += 0.0084*noise( p );
f = .25*f+dot(height,vec4(-.03125,-.125,.25,.25))*.5;
const float FLAT_LEVEL = 0.92525;
//f = f*0.25+height*0.75;
if (f<FLAT_LEVEL)
f = f;
else
f = pow((f-FLAT_LEVEL)/(1.-FLAT_LEVEL), 2.)*(1.-FLAT_LEVEL)*2.0+FLAT_LEVEL; // makes a smooth coast-increase
return clamp(f, 0., 10.);
}
vec3 plasma_quintic( float x ) {
x = clamp( x, 0.0, 1.0);
vec4 x1 = vec4( 1.0, x, x * x, x * x * x ); // 1 x x2 x3
vec4 x2 = x1 * x1.w * x; // x4 x5 x6 x7
return vec3(
dot( x1.xyzw, vec4( +0.063861086, +1.992659096, -1.023901152, -0.490832805 ) ) + dot( x2.xy, vec2( +1.308442123, -0.914547012 ) ),
dot( x1.xyzw, vec4( +0.049718590, -0.791144343, +2.892305078, +0.811726816 ) ) + dot( x2.xy, vec2( -4.686502417, +2.717794514 ) ),
dot( x1.xyzw, vec4( +0.513275779, +1.580255060, -5.164414457, +4.559573646 ) ) + dot( x2.xy, vec2( -1.916810682, +0.570638854 ) ) );
}
vec4 color(vec2 p){
vec4 c1 = vec4(1.7,1.6,.9,1);
vec4 c2 = vec4(.2,.94,.1,1);
vec4 c3 = vec4(.3,.2,.0,1);
vec4 c4 = vec4(.99,.99,1.6,1);
vec4 v = highness(p);
float los = smoothstep(0.1,1.1,v.b);
float his = smoothstep(3.5,6.5,v.b);
float ces = smoothstep(1.,5.,v.a);
vec4 lo = mix(c1,c2,los);
vec4 hi = mix(c3,c4,his);
vec4 ce = mix(lo,hi,ces);
return vec4(plasma_quintic(ces),1).ragb;
}
vec3 terrain_map( vec2 p )
{
return color(p).rgb*0.75+0.25*vec3(0.7, .55, .4)+texture(SAMPLER_2D(u_texture3), fract(p*5.)).rgb*.5; // test-terrain is simply 'sandstone'
}
const mat2 m = mat2( 0.72, -1.60, 1.60, 0.72 );
float water_map( vec2 p, float height ) {
vec2 p2 = p*large_wavesize;
vec2 shift1 = 0.001*vec2( u_time*160.0*2.0, u_time*120.0*2.0 );
vec2 shift2 = 0.001*vec2( u_time*190.0*2.0, -u_time*130.0*2.0 );
// coarse crossing 'ocean' waves...
float f = 0.6000*noise( p );
f += 0.2500*noise( p*m );
f += 0.1666*noise( p*m*m );
float wave = sin(p2.x*0.622+p2.y*0.622+shift2.x*4.269)*large_waveheight*f*height*height ;
p *= small_wavesize;
f = 0.;
float amp = 1.0, s = .5;
for (int i=0; i<9; i++)
{ p = m*p*.947; f -= amp*abs(sin((noise( p+shift1*s )-.5)*2.)); amp = amp*.59; s*=-1.329; }
return wave+f*small_waveheight;
}
float nautic(vec2 p) {
p *= 18.;
float f = 0.;
float amp = 1.0, s = .5;
for (int i=0; i<3; i++)
{ p = m*p*1.2; f += amp*abs(smoothstep(0., 1., noise( p+u_time*s ))-.5); amp = amp*.5; s*=-1.227; }
return pow(1.-f, 5.);
}
float particles(vec2 p) {
p *= 200.;
float f = 0.;
float amp = 1.0, s = 1.5;
for (int i=0; i<3; i++)
{ p = m*p*1.2; f += amp*noise( p+u_time*s ); amp = amp*.5; s*=-1.227; }
return pow(f*.35, 7.)*particle_amount;
}
float test_shadow( vec2 xy, float height) {
vec3 r0 = vec3(xy, height);
vec3 rd = normalize( light - r0 );
float hit = 1.0;
float t = 0.001;
for (int j=1; j<25; j++)
{
vec3 p = r0 + t*rd;
float h = height_map( p.xy );
float height_diff = p.z - h;
if (height_diff<0.0)
{
return 0.0;
}
t += 0.01+height_diff*.02;
hit = min(hit, 2.*height_diff/t); // soft shaddow
}
return hit;
}
vec3 CalcTerrain(vec2 uv, float height) {
vec3 col = terrain_map( uv );
vec2 iResolution = vec2(512.);
float h1 = height_map(uv-vec2(0., 0.5)/ iResolution.xy);
float h2 = height_map(uv+vec2(0., 0.5)/ iResolution.xy);
float h3 = height_map(uv-vec2(0.5, 0.)/ iResolution.xy);
float h4 = height_map(uv+vec2(0.5, 0.)/ iResolution.xy);
vec3 norm = normalize(vec3(h3-h4, h1-h2, 1.));
vec3 r0 = vec3(uv, height);
vec3 rd = normalize( light - r0 );
float grad = dot(norm, rd);
col *= grad+pow(grad, 8.);
float terrainshade = test_shadow( uv, height );
col = mix(col*.25, col, terrainshade);
return col;
}
void main() {
vec3 watercolor = u_watercolor.rgb;
vec3 watercolor2 = u_watercolor2.rgb;
vec2 uv = v_uv;
float WATER_LEVEL = 0.84; // Water level (range: 0.0 - 2.0)
float deepwater_fadedepth = 0.4 + coast2water_fadedepth;
float height = height_map( uv );
vec3 col;
float waveheight = clamp(WATER_LEVEL*3.-1.5, 0., 1.);
float level = WATER_LEVEL + .2*water_map(uv*15. + vec2(u_time*.1), waveheight);
if (height > level)
{
col = CalcTerrain(uv, height);
}
if (height <= level)
{
vec2 dif = vec2(.0, .01);
vec2 pos = uv*15. + vec2(u_time*.01);
float h1 = water_map(pos-dif,waveheight);
float h2 = water_map(pos+dif,waveheight);
float h3 = water_map(pos-dif.yx,waveheight);
float h4 = water_map(pos+dif.yx,waveheight);
vec3 normwater = normalize(vec3(h3-h4, h1-h2, .125)); // norm-vector of the 'bumpy' water-plane
uv += normwater.xy*.002*(level-height);
col = CalcTerrain(uv, height);
float coastfade = clamp((level-height)/coast2water_fadedepth, 0., 1.);
float coastfade2= clamp((level-height)/deepwater_fadedepth, 0., 1.);
float intensity = col.r*.2126+col.g*.7152+col.b*.0722;
watercolor = mix(watercolor*intensity, watercolor2, smoothstep(0., 1., coastfade2));
vec3 r0 = vec3(uv, WATER_LEVEL);
vec3 rd = normalize( light - r0 ); // ray-direction to the light from water-position
float grad = dot(normwater, rd); // dot-product of norm-vector and light-direction
float specular = pow(grad, water_softlight_fact); // used for soft highlights
float specular2= pow(grad, water_glossylight_fact); // used for glossy highlights
float gradpos = dot(vec3(0., 0., 1.), rd);
float specular1= smoothstep(0., 1., pow(gradpos, 5.)); // used for diffusity (some darker corona around light's specular reflections...)
float watershade = test_shadow( uv, level );
watercolor *= 2.2+watershade;
watercolor += (.2+.8*watershade) * ((grad-1.0)*.5+specular) * .25;
watercolor /= (1.+specular1*1.25);
watercolor += watershade*specular2*water_specularcolor;
watercolor += watershade*coastfade*(1.-coastfade2)*(vec3(.5, .6, .7)*nautic(uv)+vec3(1., 1., 1.)*particles(uv));
col = mix(col, watercolor, coastfade);
}
outputColor = vec4(col, v_opacity);
}
`,wY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_uv;
layout(std140) uniform commonUniforms {
vec4 u_watercolor;
vec4 u_watercolor2;
float u_time;
};
out vec2 v_uv;
out float v_opacity;
#pragma include "projection"
void main() {
v_uv = a_uv;
v_opacity = opacity;
vec4 project_pos = project_position(vec4(a_Position, 1.0));
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
}
`;class FY extends Qt{constructor(...t){super(...t),E(this,"texture1",void 0),E(this,"texture2",void 0),E(this,"texture3",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{watercolor:t="#6D99A8",watercolor2:r="#0F121C"}=this.layer.getLayerConfig(),n={u_watercolor:Zt(t),u_watercolor2:Zt(r),u_time:this.layer.getLayerAnimateTime(),u_texture1:this.texture1,u_texture2:this.texture2,u_texture3:this.texture3};return this.textures=[this.texture1,this.texture2,this.texture3],this.getUniformsBufferInfo(n)}getAnimateUniforms(){return{u_time:this.layer.getLayerAnimateTime()}}initModels(){var t=this;return ve(function*(){return t.loadTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"polygonOcean",vertexShader:wY,fragmentShader:LY,defines:t.getDefines(),inject:t.getInject(),triangulation:ku,primitive:m.TRIANGLES,depth:{enable:!1}})]})()}clearModels(){var t,r,n;(t=this.texture1)===null||t===void 0||t.destroy(),(r=this.texture2)===null||r===void 0||r.destroy(),(n=this.texture3)===null||n===void 0||n.destroy()}registerBuiltinAttributes(){const t=this.layer.getSource().extent,[r,n,i,o]=t,a=i-r,s=o-n;this.styleAttributeService.registerStyleAttribute({name:"oceanUv",type:qe.Attribute,descriptor:{name:"a_uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:2,update:(u,l,f)=>{const[c,h]=f;return[(c-r)/a,(h-n)/s]}}})}loadTexture(){const{createTexture2D:t}=this.rendererService,r={height:0,width:0};this.texture1=t(r),this.texture2=t(r),this.texture3=t(r),n(o=>{this.texture1=i(o[0]),this.texture2=i(o[1]),this.texture3=i(o[2]),this.layerService.reRender()});function n(o){let a=0;const s=[];["https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*EojwT4VzSiYAAAAAAAAAAAAAARQnAQ","https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*MJ22QbpuCzIAAAAAAAAAAAAAARQnAQ","https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*-z2HSIVDsHIAAAAAAAAAAAAAARQnAQ"].map(l=>{const f=new Image;f.crossOrigin="",f.src=l,s.push(f),f.onload=()=>{a++,a===3&&o(s)}})}function i(o){return t({data:o,width:o.width,height:o.height,wrapS:m.MIRRORED_REPEAT,wrapT:m.MIRRORED_REPEAT,min:m.LINEAR,mag:m.LINEAR})}}}const BY=`uniform sampler2D u_texture;
layout(std140) uniform commonUniforms {
float u_speed;
float u_time;
};
out vec4 outputColor;
in vec4 v_Color;
in vec2 v_uv;
float rand(vec2 n) { return 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453); }
float water(vec3 p) {
float t = u_time * u_speed;
p.z += t * 2.; p.x += t * 2.;
vec3 c1 = texture(SAMPLER_2D(u_texture), p.xz / 30.).xyz;
p.z += t * 3.; p.x += t * 0.52;
vec3 c2 = texture(SAMPLER_2D(u_texture), p.xz / 30.).xyz;
p.z += t * 4.; p.x += t * 0.8;
vec3 c3 = texture(SAMPLER_2D(u_texture), p.xz / 30.).xyz;
c1 += c2 - c3;
float z = (c1.x + c1.y + c1.z) / 3.;
return p.y + z / 4.;
}
float map(vec3 p) {
float d = 100.0;
d = water(p);
return d;
}
float intersect(vec3 ro, vec3 rd) {
float d = 0.0;
for (int i = 0; i <= 100; i++) {
float h = map(ro + rd * d);
if (h < 0.1) return d;
d += h;
}
return 0.0;
}
vec3 norm(vec3 p) {
float eps = .1;
return normalize(vec3(
map(p + vec3(eps, 0, 0)) - map(p + vec3(-eps, 0, 0)),
map(p + vec3(0, eps, 0)) - map(p + vec3(0, -eps, 0)),
map(p + vec3(0, 0, eps)) - map(p + vec3(0, 0, -eps))
));
}
float calSpc() {
vec3 l1 = normalize(vec3(1, 1, 1));
vec3 ro = vec3(-3, 20, -8);
vec3 rc = vec3(0, 0, 0);
vec3 ww = normalize(rc - ro);
vec3 uu = normalize(cross(vec3(0,1,0), ww));
vec3 vv = normalize(cross(rc - ro, uu));
vec3 rd = normalize(uu * v_uv.x + vv * v_uv.y + ww);
float d = intersect(ro, rd);
vec3 p = ro + rd * d;
vec3 n = norm(p);
float spc = pow(max(0.0, dot(reflect(l1, n), rd)), 30.0);
return spc;
}
void main() {
outputColor = v_Color;
float spc = calSpc();
outputColor += spc * 0.4;
}
`,DY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_uv;
layout(std140) uniform commonUniforms {
float u_speed;
float u_time;
};
out vec4 v_Color;
out vec2 v_uv;
#pragma include "projection"
void main() {
v_uv = a_uv;
v_Color = a_Color;
v_Color.a *= opacity;
vec4 project_pos = project_position(vec4(a_Position, 1.0));
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
}
`;class UY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{speed:t=.5}=this.layer.getLayerConfig(),r={u_speed:t,u_time:this.layer.getLayerAnimateTime(),u_texture:this.texture};return this.textures=[this.texture],this.getUniformsBufferInfo(r)}getAnimateUniforms(){return{u_time:this.layer.getLayerAnimateTime()}}initModels(){var t=this;return ve(function*(){return t.loadTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"polygonWater",vertexShader:DY,fragmentShader:BY,triangulation:ku,defines:t.getDefines(),inject:t.getInject(),primitive:m.TRIANGLES,depth:{enable:!1},pickingEnabled:!1,diagnosticDerivativeUniformityEnabled:!1})]})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){const t=this.layer.getSource().extent,[r,n,i,o]=t,a=i-r,s=o-n;this.styleAttributeService.registerStyleAttribute({name:"waterUv",type:qe.Attribute,descriptor:{name:"a_uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:2,update:(u,l,f)=>{const[c,h]=f;return[(c-r)/a,(h-n)/s]}}})}loadTexture(){const{waterTexture:t}=this.layer.getLayerConfig(),{createTexture2D:r}=this.rendererService;this.texture=r({height:1,width:1});const n=new Image;n.crossOrigin="",t?(console.warn("L7 recommend:https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*EojwT4VzSiYAAAAAAAAAAAAAARQnAQ"),n.src=t):n.src="https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*EojwT4VzSiYAAAAAAAAAAAAAARQnAQ",n.onload=()=>{this.texture=r({data:n,width:n.width,height:n.height,wrapS:m.MIRRORED_REPEAT,wrapT:m.MIRRORED_REPEAT,min:m.LINEAR,mag:m.LINEAR}),this.layerService.reRender()}}}const kY={fill:PY,line:BS,extrude:xY,text:jS,point_fill:kS,point_image:$S,point_normal:zS,point_extrude:US,water:UY,ocean:FY,extrusion:CY};class XS extends Ka{constructor(...t){super(...t),E(this,"type","PolygonLayer"),E(this,"enableShaderEncodeStyles",["opacity","extrusionBase","rotation","offsets","stroke"])}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new kY[r](t),yield t.initLayerModels()})()}getModelType(){var t;const r=this.styleAttributeService.getLayerStyleAttribute("shape"),n=r==null||(t=r.scale)===null||t===void 0?void 0:t.field;return n==="fill"||!n?"fill":n==="extrude"?"extrude":n==="extrusion"?"extrusion":n==="water"?"water":n==="ocean"?"ocean":n==="line"?"line":this.getPointModelType()}getPointModelType(){const t=this.getEncodedData(),{shape2d:r,shape3d:n}=this.getLayerConfig(),i=this.iconService.getIconMap(),o=t.find(a=>a.hasOwnProperty("shape"));if(o){const a=o.shape;return a==="dot"?"point_normal":(r==null?void 0:r.indexOf(a))!==-1?"point_fill":(n==null?void 0:n.indexOf(a))!==-1?"point_extrude":i.hasOwnProperty(a)?"point_image":"text"}else return"fill"}}const $Y=`layout(std140) uniform commonUniforms {
vec2 u_domain;
float u_opacity;
float u_noDataValue;
float u_clampLow;
float u_clampHigh;
};
uniform sampler2D u_rasterTexture;
uniform sampler2D u_colorTexture;
in vec2 v_texCoord;
bool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }
out vec4 outputColor;
void main() {
// Can use any component here since u_rasterTexture is under luminance format.
float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r;
if (value == u_noDataValue || isnan_emu(value)) {
discard;
} else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) {
discard;
} else {
float normalisedValue =(value - u_domain[0]) / (u_domain[1] - u_domain[0]);
vec4 color = texture(SAMPLER_2D(u_colorTexture), vec2(normalisedValue, 0));
outputColor = color;
outputColor.a = outputColor.a * u_opacity ;
if (outputColor.a < 0.01)
discard;
}
}
`,zY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
layout(std140) uniform commonUniforms {
vec2 u_domain;
float u_opacity;
float u_noDataValue;
float u_clampLow;
float u_clampHigh;
};
out vec2 v_texCoord;
#pragma include "projection"
void main() {
v_texCoord = a_Uv;
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
}
`;let o1=class extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"colorTexture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{opacity:t=1,clampLow:r=!0,clampHigh:n=!0,noDataValue:i=-9999999,domain:o,rampColors:a}=this.layer.getLayerConfig(),s=o||gp(a);this.colorTexture=this.layer.textureService.getColorTexture(a,s);const u={u_domain:s,u_opacity:t||1,u_noDataValue:i,u_clampLow:r?1:0,u_clampHigh:(typeof n<"u"?n:r)?1:0,u_rasterTexture:this.texture,u_colorTexture:this.colorTexture};return this.textures=[this.texture,this.colorTexture],this.getUniformsBufferInfo(u)}getRasterData(t){return ve(function*(){if(Array.isArray(t.data))return{data:t.data,width:t.width,height:t.height};{const{rasterData:r,width:n,height:i}=yield t.data;return{data:Array.from(r),width:n,height:i}}})()}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const r=t.layer.getSource(),{createTexture2D:n,queryVerdorInfo:i}=t.rendererService,o=r.data.dataArray[0],{data:a,width:s,height:u}=yield t.getRasterData(o);return t.texture=n({data:new Float32Array(a),width:s,height:u,format:i()==="WebGL1"?m.LUMINANCE:m.RED,type:m.FLOAT,alignment:1}),[yield t.layer.buildLayerModel({moduleName:"rasterImageData",vertexShader:zY,fragmentShader:$Y,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,depth:{enable:!1},pickingEnabled:!1})]})()}clearModels(){var t,r;(t=this.texture)===null||t===void 0||t.destroy(),(r=this.colorTexture)===null||r===void 0||r.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{shaderLocation:this.attributeLocation.UV,name:"a_Uv",buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}};const VY=["data"],HY=["rasterData"],jY=`uniform sampler2D u_texture;
layout(std140) uniform commonUniforms {
vec2 u_rminmax;
vec2 u_gminmax;
vec2 u_bminmax;
float u_opacity;
float u_noDataValue;
};
in vec2 v_texCoord;
out vec4 outputColor;
void main() {
vec3 rgb = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y)).rgb;
if(rgb == vec3(u_noDataValue)) {
outputColor = vec4(0.0, 0, 0, 0.0);
} else {
outputColor = vec4(rgb.r / (u_rminmax.y -u_rminmax.x), rgb.g /(u_gminmax.y -u_gminmax.x), rgb.b/ (u_bminmax.y - u_bminmax.x), u_opacity);
}
if(outputColor.a < 0.01)
discard;
}`,XY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
layout(std140) uniform commonUniforms {
vec2 u_rminmax;
vec2 u_gminmax;
vec2 u_bminmax;
float u_opacity;
float u_noDataValue;
};
out vec2 v_texCoord;
#pragma include "projection"
void main() {
v_texCoord = a_Uv;
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
}
`;class WY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"dataOption",{})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{opacity:t=1,noDataValue:r=0}=this.layer.getLayerConfig(),{rMinMax:n=[0,255],gMinMax:i=[0,255],bMinMax:o=[0,255]}=this.dataOption,a={u_rminmax:n,u_gminmax:i,u_bminmax:o,u_opacity:t||1,u_noDataValue:r,u_texture:this.texture};return this.textures=[this.texture],this.getUniformsBufferInfo(a)}getRasterData(t){var r=this;return ve(function*(){if(Array.isArray(t.data)){const{data:a}=t,s=ai(t,VY);return r.dataOption=s,he({data:a},s)}const n=yield t.data,{rasterData:i}=n,o=ai(n,HY);return r.dataOption=o,Array.isArray(i)?he({data:i},o):he({data:Array.from(i)},o)})()}initModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const r=t.layer.getSource(),{createTexture2D:n}=t.rendererService,i=r.data.dataArray[0],{data:o,width:a,height:s}=yield t.getRasterData(i);return t.texture=n({data:new Float32Array(o),width:a,height:s,format:m.RGB,type:m.FLOAT}),[yield t.layer.buildLayerModel({moduleName:"rasterImageDataRGBA",vertexShader:XY,fragmentShader:jY,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,depth:{enable:!1},pickingEnabled:!1})]})()}buildModels(){var t=this;return ve(function*(){return t.initModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}}const GY=`uniform sampler2D u_texture;
uniform sampler2D u_colorTexture;
layout(std140) uniform commonUniforms {
vec4 u_unpack;
vec2 u_domain;
float u_opacity;
float u_noDataValue;
float u_clampLow;
float u_clampHigh;
};
in vec2 v_texCoord;
out vec4 outputColor;
float getElevation(vec2 coord, float bias) {
// Convert encoded elevation value to meters
vec4 data = texture(SAMPLER_2D(u_texture), coord,bias) * 255.0;
data.a = -1.0;
return dot(data, u_unpack);
}
vec4 getColor(float value) {
float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]);
vec2 coord = vec2(normalisedValue, 0);
return texture(SAMPLER_2D(u_colorTexture), coord);
}
void main() {
float value = getElevation(v_texCoord,0.0);
if (value == u_noDataValue) {
outputColor = vec4(0.0, 0, 0, 0.0);
} else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) {
outputColor = vec4(0.0, 0, 0, 0.0);
} else {
outputColor = getColor(value);
outputColor.a = outputColor.a * u_opacity ;
if(outputColor.a < 0.01)
discard;
}
}
`,YY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
layout(std140) uniform commonUniforms {
vec4 u_unpack;
vec2 u_domain;
float u_opacity;
float u_noDataValue;
float u_clampLow;
float u_clampHigh;
};
out vec2 v_texCoord;
#pragma include "projection"
void main() {
v_texCoord = a_Uv;
vec4 project_pos = project_position(vec4(a_Position, 1.0));
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
}
`;class ZY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getCommonUniformsInfo(){const{opacity:t,clampLow:r=!0,clampHigh:n=!0,noDataValue:i=-9999999,domain:o,rampColors:a,colorTexture:s,rScaler:u=6553.6,gScaler:l=25.6,bScaler:f=.1,offset:c=1e4}=this.layer.getLayerConfig(),h=o||gp(a);let d=s;s?this.layer.textureService.setColorTexture(s,a,h):d=this.layer.textureService.getColorTexture(a,h);const p={u_unpack:[u,l,f,c],u_domain:h,u_opacity:t||1,u_noDataValue:i,u_clampLow:r,u_clampHigh:typeof n<"u"?n:r,u_texture:this.texture,u_colorTexture:d};return this.textures=[this.texture,d],this.getUniformsBufferInfo(p)}initModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const r=t.layer.getSource(),{createTexture2D:n}=t.rendererService,i=yield r.data.images;return t.texture=n({data:i[0],width:i[0].width,height:i[0].height,min:m.LINEAR,mag:m.LINEAR}),[yield t.layer.buildLayerModel({moduleName:"RasterTileDataImage",vertexShader:YY,fragmentShader:GY,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,depth:{enable:!1}})]})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}buildModels(){var t=this;return ve(function*(){return t.initModels()})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}}const qY={raster:o1,rasterRgb:WY,raster3d:o1,rasterTerrainRgb:ZY};class n_ extends Ka{constructor(...t){super(...t),E(this,"type","RasterLayer")}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new qY[r](t),yield t.initLayerModels()})()}getDefaultConfig(){const t=this.getModelType();return{raster:{},rasterRgb:{},raster3d:{},rasterTerrainRgb:{}}[t]}getModelType(){switch(this.layerSource.getParserType()){case"raster":return"raster";case"rasterRgb":return"rasterRgb";case"rgb":return"rasterRgb";case"image":return"rasterTerrainRgb";default:return"raster"}}getLegend(t){if(t!=="color")return{type:void 0,field:void 0,items:[]};const r=this.getLayerConfig().rampColors;return tG(r,t)}}class KY{constructor({rendererService:t,layerService:r,parent:n}){E(this,"tileResource",new Map),E(this,"rendererService",void 0),E(this,"layerService",void 0),E(this,"parent",void 0),E(this,"layerTiles",[]),this.rendererService=t,this.layerService=r,this.parent=n}get tiles(){return this.layerTiles}hasTile(t){return this.layerTiles.some(r=>r.key===t)}addTile(t){this.layerTiles.push(t)}getTile(t){return this.layerTiles.find(r=>r.key===t)}getVisibleTileBylngLat(t){return this.layerTiles.find(r=>r.isLoaded&&r.visible&&r.lnglatInBounds(t))}removeTile(t){const r=this.layerTiles.findIndex(i=>i.key===t),n=this.layerTiles.splice(r,1);n[0]&&n[0].destroy()}updateTileVisible(t){const r=this.getTile(t.key);if(t.isVisible)if(t.parent){const n=this.isChildrenLoaded(t.parent);r==null||r.updateVisible(n)}else r==null||r.updateVisible(!0);else if(t.parent){const n=this.isChildrenLoaded(t.parent);r==null||r.updateVisible(!n)}else r==null||r.updateVisible(!1)}isParentLoaded(t){const r=t.parent;if(!r)return!0;const n=this.getTile(r==null?void 0:r.key);return!!(n!=null&&n.isLoaded)}isChildrenLoaded(t){const r=t==null?void 0:t.children;return r.length===0?!0:r.every(n=>{const i=this.getTile(n==null?void 0:n.key);return i?(i==null?void 0:i.isLoaded)===!0:!0})}render(){var t=this;return ve(function*(){const n=t.getRenderLayers().map(function(){var i=ve(function*(o){yield t.layerService.renderTileLayer(o)});return function(o){return i.apply(this,arguments)}}());yield Promise.all(n)})()}getRenderLayers(){const t=this.layerTiles.filter(n=>n.visible&&n.isLoaded),r=[];return t.map(n=>r.push(...n.getLayers())),r}getLayers(){const t=this.layerTiles.filter(n=>n.isLoaded),r=[];return t.map(n=>r.push(...n.getLayers())),r}getTiles(){return this.layerTiles}destroy(){this.layerTiles.forEach(t=>t.destroy()),this.tileResource.clear()}}/**
* splaytree v3.1.2
* Fast Splay tree for Node and browser
*
* @author Alexander Milevski <info@w8r.name>
* @license MIT
* @preserve
*//*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function QY(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(l[0]===6&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(f){l=[6,f],i=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}var Gi=function(){function e(t,r){this.next=null,this.key=t,this.data=r,this.left=null,this.right=null}return e}();function JY(e,t){return e>t?1:e<t?-1:0}function $i(e,t,r){for(var n=new Gi(null,null),i=n,o=n;;){var a=r(e,t.key);if(a<0){if(t.left===null)break;if(r(e,t.left.key)<0){var s=t.left;if(t.left=s.right,s.right=t,t=s,t.left===null)break}o.left=t,o=t,t=t.left}else if(a>0){if(t.right===null)break;if(r(e,t.right.key)>0){var s=t.right;if(t.right=s.left,s.left=t,t=s,t.right===null)break}i.right=t,i=t,t=t.right}else break}return i.right=t.left,o.left=t.right,t.left=n.right,t.right=n.left,t}function Jh(e,t,r,n){var i=new Gi(e,t);if(r===null)return i.left=i.right=null,i;r=$i(e,r,n);var o=n(e,r.key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function a1(e,t,r){var n=null,i=null;if(t){t=$i(e,t,r);var o=r(t.key,e);o===0?(n=t.left,i=t.right):o<0?(i=t.right,t.right=null,n=t):(n=t.left,t.left=null,i=t)}return{left:n,right:i}}function eZ(e,t,r){return t===null?e:(e===null||(t=$i(e.key,t,r),t.left=e),t)}function Jd(e,t,r,n,i){if(e){n(""+t+(r?"└── ":"├── ")+i(e)+`
`);var o=t+(r?" ":"│ ");e.left&&Jd(e.left,o,!1,n,i),e.right&&Jd(e.right,o,!0,n,i)}}var i_=function(){function e(t){t===void 0&&(t=JY),this._root=null,this._size=0,this._comparator=t}return e.prototype.insert=function(t,r){return this._size++,this._root=Jh(t,r,this._root,this._comparator)},e.prototype.add=function(t,r){var n=new Gi(t,r);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var i=this._comparator,o=$i(t,this._root,i),a=i(t,o.key);return a===0?this._root=o:(a<0?(n.left=o.left,n.right=o,o.left=null):a>0&&(n.right=o.right,n.left=o,o.right=null),this._size++,this._root=n),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,r,n){var i;if(r===null)return null;r=$i(t,r,n);var o=n(t,r.key);return o===0?(r.left===null?i=r.right:(i=$i(t,r.left,n),i.right=r.right),this._size--,i):r},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=$i(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},e.prototype.findStatic=function(t){for(var r=this._root,n=this._comparator;r;){var i=n(t,r.key);if(i===0)return r;i<0?r=r.left:r=r.right}return null},e.prototype.find=function(t){return this._root&&(this._root=$i(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},e.prototype.contains=function(t){for(var r=this._root,n=this._comparator;r;){var i=n(t,r.key);if(i===0)return!0;i<0?r=r.left:r=r.right}return!1},e.prototype.forEach=function(t,r){for(var n=this._root,i=[],o=!1;!o;)n!==null?(i.push(n),n=n.left):i.length!==0?(n=i.pop(),t.call(r,n),n=n.right):o=!0;return this},e.prototype.range=function(t,r,n,i){for(var o=[],a=this._comparator,s=this._root,u;o.length!==0||s;)if(s)o.push(s),s=s.left;else{if(s=o.pop(),u=a(s.key,r),u>0)break;if(a(s.key,t)>=0&&n.call(i,s))return this;s=s.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(r){var n=r.key;return t.push(n)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(r){var n=r.data;return t.push(n)}),t},e.prototype.min=function(){return this._root?this.minNode(this._root).key:null},e.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},e.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},e.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},e.prototype.at=function(t){for(var r=this._root,n=!1,i=0,o=[];!n;)if(r)o.push(r),r=r.left;else if(o.length>0){if(r=o.pop(),i===t)return r;i++,r=r.right}else n=!0;return null},e.prototype.next=function(t){var r=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var i=this._comparator;r;){var o=i(t.key,r.key);if(o===0)break;o<0?(n=r,r=r.left):r=r.right}return n},e.prototype.prev=function(t){var r=this._root,n=null;if(t.left!==null){for(n=t.left;n.right;)n=n.right;return n}for(var i=this._comparator;r;){var o=i(t.key,r.key);if(o===0)break;o<0?r=r.left:(n=r,r=r.right)}return n},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return rZ(this._root)},e.prototype.load=function(t,r,n){r===void 0&&(r=[]),n===void 0&&(n=!1);var i=t.length,o=this._comparator;if(n&&rp(t,r,0,i-1,o),this._root===null)this._root=ep(t,r,0,i),this._size=i;else{var a=nZ(this.toList(),tZ(t,r),o);i=this._size+i,this._root=tp({head:a},0,i)}return this},e.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){t===void 0&&(t=function(n){return String(n.key)});var r=[];return Jd(this._root,"",!0,function(n){return r.push(n)},t),r.join("")},e.prototype.update=function(t,r,n){var i=this._comparator,o=a1(t,this._root,i),a=o.left,s=o.right;i(t,r)<0?s=Jh(r,n,s,i):a=Jh(r,n,a,i),this._root=eZ(a,s,i)},e.prototype.split=function(t){return a1(t,this._root,this._comparator)},e.prototype[Symbol.iterator]=function(){var t,r,n;return QY(this,function(i){switch(i.label){case 0:t=this._root,r=[],n=!1,i.label=1;case 1:return n?[3,6]:t===null?[3,2]:(r.push(t),t=t.left,[3,5]);case 2:return r.length===0?[3,4]:(t=r.pop(),[4,t]);case 3:return i.sent(),t=t.right,[3,5];case 4:n=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},e}();function ep(e,t,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),a=e[o],s=t[o],u=new Gi(a,s);return u.left=ep(e,t,r,o),u.right=ep(e,t,o+1,n),u}return null}function tZ(e,t){for(var r=new Gi(null,null),n=r,i=0;i<e.length;i++)n=n.next=new Gi(e[i],t[i]);return n.next=null,r.next}function rZ(e){for(var t=e,r=[],n=!1,i=new Gi(null,null),o=i;!n;)t?(r.push(t),t=t.left):r.length>0?(t=o=o.next=r.pop(),t=t.right):n=!0;return o.next=null,i.next}function tp(e,t,r){var n=r-t;if(n>0){var i=t+Math.floor(n/2),o=tp(e,t,i),a=e.head;return a.left=o,e.head=e.head.next,a.right=tp(e,i+1,r),a}return null}function nZ(e,t,r){for(var n=new Gi(null,null),i=n,o=e,a=t;o!==null&&a!==null;)r(o.key,a.key)<0?(i.next=o,o=o.next):(i.next=a,a=a.next),i=i.next;return o!==null?i.next=o:a!==null&&(i.next=a),n.next}function rp(e,t,r,n,i){if(!(r>=n)){for(var o=e[r+n>>1],a=r-1,s=n+1;;){do a++;while(i(e[a],o)<0);do s--;while(i(e[s],o)>0);if(a>=s)break;var u=e[a];e[a]=e[s],e[s]=u,u=t[a],t[a]=t[s],t[s]=u}rp(e,t,r,s,i),rp(e,t,s+1,n,i)}}const Ei=11102230246251565e-32,Gr=134217729,iZ=(3+8*Ei)*Ei;function ed(e,t,r,n,i){let o,a,s,u,l=t[0],f=n[0],c=0,h=0;f>l==f>-l?(o=l,l=t[++c]):(o=f,f=n[++h]);let d=0;if(c<e&&h<r)for(f>l==f>-l?(a=l+o,s=o-(a-l),l=t[++c]):(a=f+o,s=o-(a-f),f=n[++h]),o=a,s!==0&&(i[d++]=s);c<e&&h<r;)f>l==f>-l?(a=o+l,u=a-o,s=o-(a-u)+(l-u),l=t[++c]):(a=o+f,u=a-o,s=o-(a-u)+(f-u),f=n[++h]),o=a,s!==0&&(i[d++]=s);for(;c<e;)a=o+l,u=a-o,s=o-(a-u)+(l-u),l=t[++c],o=a,s!==0&&(i[d++]=s);for(;h<r;)a=o+f,u=a-o,s=o-(a-u)+(f-u),f=n[++h],o=a,s!==0&&(i[d++]=s);return(o!==0||d===0)&&(i[d++]=o),d}function oZ(e,t){let r=t[0];for(let n=1;n<e;n++)r+=t[n];return r}function $u(e){return new Float64Array(e)}const aZ=(3+16*Ei)*Ei,sZ=(2+12*Ei)*Ei,uZ=(9+64*Ei)*Ei*Ei,ha=$u(4),s1=$u(8),u1=$u(12),l1=$u(16),Jr=$u(4);function lZ(e,t,r,n,i,o,a){let s,u,l,f,c,h,d,p,v,g,y,S,R,x,M,$,F,Y;const ge=e-i,q=r-i,k=t-o,G=n-o;x=ge*G,h=Gr*ge,d=h-(h-ge),p=ge-d,h=Gr*G,v=h-(h-G),g=G-v,M=p*g-(x-d*v-p*v-d*g),$=k*q,h=Gr*k,d=h-(h-k),p=k-d,h=Gr*q,v=h-(h-q),g=q-v,F=p*g-($-d*v-p*v-d*g),y=M-F,c=M-y,ha[0]=M-(y+c)+(c-F),S=x+y,c=S-x,R=x-(S-c)+(y-c),y=R-$,c=R-y,ha[1]=R-(y+c)+(c-$),Y=S+y,c=Y-S,ha[2]=S-(Y-c)+(y-c),ha[3]=Y;let K=oZ(4,ha),ce=sZ*a;if(K>=ce||-K>=ce||(c=e-ge,s=e-(ge+c)+(c-i),c=r-q,l=r-(q+c)+(c-i),c=t-k,u=t-(k+c)+(c-o),c=n-G,f=n-(G+c)+(c-o),s===0&&u===0&&l===0&&f===0)||(ce=uZ*a+iZ*Math.abs(K),K+=ge*f+G*s-(k*l+q*u),K>=ce||-K>=ce))return K;x=s*G,h=Gr*s,d=h-(h-s),p=s-d,h=Gr*G,v=h-(h-G),g=G-v,M=p*g-(x-d*v-p*v-d*g),$=u*q,h=Gr*u,d=h-(h-u),p=u-d,h=Gr*q,v=h-(h-q),g=q-v,F=p*g-($-d*v-p*v-d*g),y=M-F,c=M-y,Jr[0]=M-(y+c)+(c-F),S=x+y,c=S-x,R=x-(S-c)+(y-c),y=R-$,c=R-y,Jr[1]=R-(y+c)+(c-$),Y=S+y,c=Y-S,Jr[2]=S-(Y-c)+(y-c),Jr[3]=Y;const Pe=ed(4,ha,4,Jr,s1);x=ge*f,h=Gr*ge,d=h-(h-ge),p=ge-d,h=Gr*f,v=h-(h-f),g=f-v,M=p*g-(x-d*v-p*v-d*g),$=k*l,h=Gr*k,d=h-(h-k),p=k-d,h=Gr*l,v=h-(h-l),g=l-v,F=p*g-($-d*v-p*v-d*g),y=M-F,c=M-y,Jr[0]=M-(y+c)+(c-F),S=x+y,c=S-x,R=x-(S-c)+(y-c),y=R-$,c=R-y,Jr[1]=R-(y+c)+(c-$),Y=S+y,c=Y-S,Jr[2]=S-(Y-c)+(y-c),Jr[3]=Y;const Xe=ed(Pe,s1,4,Jr,u1);x=s*f,h=Gr*s,d=h-(h-s),p=s-d,h=Gr*f,v=h-(h-f),g=f-v,M=p*g-(x-d*v-p*v-d*g),$=u*l,h=Gr*u,d=h-(h-u),p=u-d,h=Gr*l,v=h-(h-l),g=l-v,F=p*g-($-d*v-p*v-d*g),y=M-F,c=M-y,Jr[0]=M-(y+c)+(c-F),S=x+y,c=S-x,R=x-(S-c)+(y-c),y=R-$,c=R-y,Jr[1]=R-(y+c)+(c-$),Y=S+y,c=Y-S,Jr[2]=S-(Y-c)+(y-c),Jr[3]=Y;const Je=ed(Xe,u1,4,Jr,l1);return l1[Je-1]}function cZ(e,t,r,n,i,o){const a=(t-o)*(r-i),s=(e-i)*(n-o),u=a-s,l=Math.abs(a+s);return Math.abs(u)>=aZ*l?u:-lZ(e,t,r,n,i,o,l)}var WS={};const ks=(e,t)=>e.ll.x<=t.x&&t.x<=e.ur.x&&e.ll.y<=t.y&&t.y<=e.ur.y,np=(e,t)=>{if(t.ur.x<e.ll.x||e.ur.x<t.ll.x||t.ur.y<e.ll.y||e.ur.y<t.ll.y)return null;const r=e.ll.x<t.ll.x?t.ll.x:e.ll.x,n=e.ur.x<t.ur.x?e.ur.x:t.ur.x,i=e.ll.y<t.ll.y?t.ll.y:e.ll.y,o=e.ur.y<t.ur.y?e.ur.y:t.ur.y;return{ll:{x:r,y:i},ur:{x:n,y:o}}};let Vi=Number.EPSILON;Vi===void 0&&(Vi=Math.pow(2,-52));const fZ=Vi*Vi,c1=(e,t)=>{if(-Vi<e&&e<Vi&&-Vi<t&&t<Vi)return 0;const r=e-t;return r*r<fZ*e*t?0:e<t?-1:1};class hZ{constructor(){this.reset()}reset(){this.xRounder=new f1,this.yRounder=new f1}round(t,r){return{x:this.xRounder.round(t),y:this.yRounder.round(r)}}}class f1{constructor(){this.tree=new i_,this.round(0)}round(t){const r=this.tree.add(t),n=this.tree.prev(r);if(n!==null&&c1(r.key,n.key)===0)return this.tree.remove(t),n.key;const i=this.tree.next(r);return i!==null&&c1(r.key,i.key)===0?(this.tree.remove(t),i.key):t}}const Ru=new hZ,ec=(e,t)=>e.x*t.y-e.y*t.x,GS=(e,t)=>e.x*t.x+e.y*t.y,h1=(e,t,r)=>{const n=cZ(e.x,e.y,t.x,t.y,r.x,r.y);return n>0?-1:n<0?1:0},Bc=e=>Math.sqrt(GS(e,e)),dZ=(e,t,r)=>{const n={x:t.x-e.x,y:t.y-e.y},i={x:r.x-e.x,y:r.y-e.y};return ec(i,n)/Bc(i)/Bc(n)},pZ=(e,t,r)=>{const n={x:t.x-e.x,y:t.y-e.y},i={x:r.x-e.x,y:r.y-e.y};return GS(i,n)/Bc(i)/Bc(n)},d1=(e,t,r)=>t.y===0?null:{x:e.x+t.x/t.y*(r-e.y),y:r},p1=(e,t,r)=>t.x===0?null:{x:r,y:e.y+t.y/t.x*(r-e.x)},_Z=(e,t,r,n)=>{if(t.x===0)return p1(r,n,e.x);if(n.x===0)return p1(e,t,r.x);if(t.y===0)return d1(r,n,e.y);if(n.y===0)return d1(e,t,r.y);const i=ec(t,n);if(i==0)return null;const o={x:r.x-e.x,y:r.y-e.y},a=ec(o,t)/i,s=ec(o,n)/i,u=e.x+s*t.x,l=r.x+a*n.x,f=e.y+s*t.y,c=r.y+a*n.y,h=(u+l)/2,d=(f+c)/2;return{x:h,y:d}};class Nn{static compare(t,r){const n=Nn.comparePoints(t.point,r.point);return n!==0?n:(t.point!==r.point&&t.link(r),t.isLeft!==r.isLeft?t.isLeft?1:-1:ji.compare(t.segment,r.segment))}static comparePoints(t,r){return t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0}constructor(t,r){t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=r}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const r=t.point.events;for(let n=0,i=r.length;n<i;n++){const o=r[n];this.point.events.push(o),o.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let r=0;r<t;r++){const n=this.point.events[r];if(n.segment.consumedBy===void 0)for(let i=r+1;i<t;i++){const o=this.point.events[i];o.consumedBy===void 0&&n.otherSE.point.events===o.otherSE.point.events&&n.segment.consume(o.segment)}}}getAvailableLinkedEvents(){const t=[];for(let r=0,n=this.point.events.length;r<n;r++){const i=this.point.events[r];i!==this&&!i.segment.ringOut&&i.segment.isInResult()&&t.push(i)}return t}getLeftmostComparator(t){const r=new Map,n=i=>{const o=i.otherSE;r.set(i,{sine:dZ(this.point,t.point,o.point),cosine:pZ(this.point,t.point,o.point)})};return(i,o)=>{r.has(i)||n(i),r.has(o)||n(o);const{sine:a,cosine:s}=r.get(i),{sine:u,cosine:l}=r.get(o);return a>=0&&u>=0?s<l?1:s>l?-1:0:a<0&&u<0?s<l?-1:s>l?1:0:u<a?-1:u>a?1:0}}}let vZ=0;class ji{static compare(t,r){const n=t.leftSE.point.x,i=r.leftSE.point.x,o=t.rightSE.point.x,a=r.rightSE.point.x;if(a<n)return 1;if(o<i)return-1;const s=t.leftSE.point.y,u=r.leftSE.point.y,l=t.rightSE.point.y,f=r.rightSE.point.y;if(n<i){if(u<s&&u<l)return 1;if(u>s&&u>l)return-1;const c=t.comparePoint(r.leftSE.point);if(c<0)return 1;if(c>0)return-1;const h=r.comparePoint(t.rightSE.point);return h!==0?h:-1}if(n>i){if(s<u&&s<f)return-1;if(s>u&&s>f)return 1;const c=r.comparePoint(t.leftSE.point);if(c!==0)return c;const h=t.comparePoint(r.rightSE.point);return h<0?1:h>0?-1:1}if(s<u)return-1;if(s>u)return 1;if(o<a){const c=r.comparePoint(t.rightSE.point);if(c!==0)return c}if(o>a){const c=t.comparePoint(r.rightSE.point);if(c<0)return 1;if(c>0)return-1}if(o!==a){const c=l-s,h=o-n,d=f-u,p=a-i;if(c>h&&d<p)return 1;if(c<h&&d>p)return-1}return o>a?1:o<a||l<f?-1:l>f?1:t.id<r.id?-1:t.id>r.id?1:0}constructor(t,r,n,i){this.id=++vZ,this.leftSE=t,t.segment=this,t.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=t,this.rings=n,this.windings=i}static fromRing(t,r,n){let i,o,a;const s=Nn.comparePoints(t,r);if(s<0)i=t,o=r,a=1;else if(s>0)i=r,o=t,a=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const u=new Nn(i,!0),l=new Nn(o,!1);return new ji(u,l,[n],[a])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,r=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<r?t:r},ur:{x:this.rightSE.point.x,y:t>r?t:r}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const r=this.leftSE.point,n=this.rightSE.point,i=this.vector();if(r.x===n.x)return t.x===r.x?0:t.x<r.x?1:-1;const o=(t.y-r.y)/i.y,a=r.x+o*i.x;if(t.x===a)return 0;const s=(t.x-r.x)/i.x,u=r.y+s*i.y;return t.y===u?0:t.y<u?-1:1}getIntersection(t){const r=this.bbox(),n=t.bbox(),i=np(r,n);if(i===null)return null;const o=this.leftSE.point,a=this.rightSE.point,s=t.leftSE.point,u=t.rightSE.point,l=ks(r,s)&&this.comparePoint(s)===0,f=ks(n,o)&&t.comparePoint(o)===0,c=ks(r,u)&&this.comparePoint(u)===0,h=ks(n,a)&&t.comparePoint(a)===0;if(f&&l)return h&&!c?a:!h&&c?u:null;if(f)return c&&o.x===u.x&&o.y===u.y?null:o;if(l)return h&&a.x===s.x&&a.y===s.y?null:s;if(h&&c)return null;if(h)return a;if(c)return u;const d=_Z(o,this.vector(),s,t.vector());return d===null||!ks(i,d)?null:Ru.round(d.x,d.y)}split(t){const r=[],n=t.events!==void 0,i=new Nn(t,!0),o=new Nn(t,!1),a=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);const s=new ji(i,a,this.rings.slice(),this.windings.slice());return Nn.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),Nn.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let r=0,n=this.windings.length;r<n;r++)this.windings[r]*=-1}consume(t){let r=this,n=t;for(;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const i=ji.compare(r,n);if(i!==0){if(i>0){const o=r;r=n,n=o}if(r.prev===n){const o=r;r=n,n=o}for(let o=0,a=n.rings.length;o<a;o++){const s=n.rings[o],u=n.windings[o],l=r.rings.indexOf(s);l===-1?(r.rings.push(s),r.windings.push(u)):r.windings[l]+=u}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const r=this._afterState.rings,n=this._afterState.windings,i=this._afterState.multiPolys;for(let s=0,u=this.rings.length;s<u;s++){const l=this.rings[s],f=this.windings[s],c=r.indexOf(l);c===-1?(r.push(l),n.push(f)):n[c]+=f}const o=[],a=[];for(let s=0,u=r.length;s<u;s++){if(n[s]===0)continue;const l=r[s],f=l.poly;if(a.indexOf(f)===-1)if(l.isExterior)o.push(f);else{a.indexOf(f)===-1&&a.push(f);const c=o.indexOf(l.poly);c!==-1&&o.splice(c,1)}}for(let s=0,u=o.length;s<u;s++){const l=o[s].multiPoly;i.indexOf(l)===-1&&i.push(l)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const t=this.beforeState().multiPolys,r=this.afterState().multiPolys;switch(Gn.type){case"union":{const n=t.length===0,i=r.length===0;this._isInResult=n!==i;break}case"intersection":{let n,i;t.length<r.length?(n=t.length,i=r.length):(n=r.length,i=t.length),this._isInResult=i===Gn.numMultiPolys&&n<i;break}case"xor":{const n=Math.abs(t.length-r.length);this._isInResult=n%2===1;break}case"difference":{const n=i=>i.length===1&&i[0].isSubject;this._isInResult=n(t)!==n(r);break}default:throw new Error(`Unrecognized operation type found ${Gn.type}`)}return this._isInResult}}class _1{constructor(t,r,n){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const i=Ru.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};let o=i;for(let a=1,s=t.length;a<s;a++){if(typeof t[a][0]!="number"||typeof t[a][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let u=Ru.round(t[a][0],t[a][1]);u.x===o.x&&u.y===o.y||(this.segments.push(ji.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}(i.x!==o.x||i.y!==o.y)&&this.segments.push(ji.fromRing(o,i,this))}getSweepEvents(){const t=[];for(let r=0,n=this.segments.length;r<n;r++){const i=this.segments[r];t.push(i.leftSE),t.push(i.rightSE)}return t}}class mZ{constructor(t,r){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new _1(t[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let n=1,i=t.length;n<i;n++){const o=new _1(t[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let r=0,n=this.interiorRings.length;r<n;r++){const i=this.interiorRings[r].getSweepEvents();for(let o=0,a=i.length;o<a;o++)t.push(i[o])}return t}}class v1{constructor(t,r){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let n=0,i=t.length;n<i;n++){const o=new mZ(t[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}getSweepEvents(){const t=[];for(let r=0,n=this.polys.length;r<n;r++){const i=this.polys[r].getSweepEvents();for(let o=0,a=i.length;o<a;o++)t.push(i[o])}return t}}class Dc{static factory(t){const r=[];for(let n=0,i=t.length;n<i;n++){const o=t[n];if(!o.isInResult()||o.ringOut)continue;let a=null,s=o.leftSE,u=o.rightSE;const l=[s],f=s.point,c=[];for(;a=s,s=u,l.push(s),s.point!==f;)for(;;){const h=s.getAvailableLinkedEvents();if(h.length===0){const v=l[0].point,g=l[l.length-1].point;throw new Error(`Unable to complete output ring starting at [${v.x}, ${v.y}]. Last matching segment found ends at [${g.x}, ${g.y}].`)}if(h.length===1){u=h[0].otherSE;break}let d=null;for(let v=0,g=c.length;v<g;v++)if(c[v].point===s.point){d=v;break}if(d!==null){const v=c.splice(d)[0],g=l.splice(v.index);g.unshift(g[0].otherSE),r.push(new Dc(g.reverse()));continue}c.push({index:l.length,point:s.point});const p=s.getLeftmostComparator(a);u=h.sort(p)[0].otherSE;break}r.push(new Dc(l))}return r}constructor(t){this.events=t;for(let r=0,n=t.length;r<n;r++)t[r].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const r=[t];for(let l=1,f=this.events.length-1;l<f;l++){const c=this.events[l].point,h=this.events[l+1].point;h1(c,t,h)!==0&&(r.push(c),t=c)}if(r.length===1)return null;const n=r[0],i=r[1];h1(n,t,i)===0&&r.shift(),r.push(r[0]);const o=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:r.length-1,s=this.isExteriorRing()?r.length:-1,u=[];for(let l=a;l!=s;l+=o)u.push([r[l].x,r[l].y]);return u}isExteriorRing(){if(this._isExteriorRing===void 0){const t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let i=1,o=this.events.length;i<o;i++){const a=this.events[i];Nn.compare(t,a)>0&&(t=a)}let r=t.segment.prevInResult(),n=r?r.prevInResult():null;for(;;){if(!r)return null;if(!n)return r.ringOut;if(n.ringOut!==r.ringOut)return n.ringOut.enclosingRing()!==r.ringOut?r.ringOut:r.ringOut.enclosingRing();r=n.prevInResult(),n=r?r.prevInResult():null}}}class m1{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(let r=0,n=this.interiorRings.length;r<n;r++){const i=this.interiorRings[r].getGeom();i!==null&&t.push(i)}return t}}class gZ{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let r=0,n=this.polys.length;r<n;r++){const i=this.polys[r].getGeom();i!==null&&t.push(i)}return t}_composePolys(t){const r=[];for(let n=0,i=t.length;n<i;n++){const o=t[n];if(!o.poly)if(o.isExteriorRing())r.push(new m1(o));else{const a=o.enclosingRing();a.poly||r.push(new m1(a)),a.poly.addInterior(o)}}return r}}class EZ{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ji.compare;this.queue=t,this.tree=new i_(r),this.segments=[]}process(t){const r=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(r),n;const i=t.isLeft?this.tree.add(r):this.tree.find(r);if(!i)throw new Error(`Unable to find segment #${r.id} [${r.leftSE.point.x}, ${r.leftSE.point.y}] -> [${r.rightSE.point.x}, ${r.rightSE.point.y}] in SweepLine tree.`);let o=i,a=i,s,u;for(;s===void 0;)o=this.tree.prev(o),o===null?s=null:o.key.consumedBy===void 0&&(s=o.key);for(;u===void 0;)a=this.tree.next(a),a===null?u=null:a.key.consumedBy===void 0&&(u=a.key);if(t.isLeft){let l=null;if(s){const c=s.getIntersection(r);if(c!==null&&(r.isAnEndpoint(c)||(l=c),!s.isAnEndpoint(c))){const h=this._splitSafely(s,c);for(let d=0,p=h.length;d<p;d++)n.push(h[d])}}let f=null;if(u){const c=u.getIntersection(r);if(c!==null&&(r.isAnEndpoint(c)||(f=c),!u.isAnEndpoint(c))){const h=this._splitSafely(u,c);for(let d=0,p=h.length;d<p;d++)n.push(h[d])}}if(l!==null||f!==null){let c=null;l===null?c=f:f===null?c=l:c=Nn.comparePoints(l,f)<=0?l:f,this.queue.remove(r.rightSE),n.push(r.rightSE);const h=r.split(c);for(let d=0,p=h.length;d<p;d++)n.push(h[d])}n.length>0?(this.tree.remove(r),n.push(t)):(this.segments.push(r),r.prev=s)}else{if(s&&u){const l=s.getIntersection(u);if(l!==null){if(!s.isAnEndpoint(l)){const f=this._splitSafely(s,l);for(let c=0,h=f.length;c<h;c++)n.push(f[c])}if(!u.isAnEndpoint(l)){const f=this._splitSafely(u,l);for(let c=0,h=f.length;c<h;c++)n.push(f[c])}}}this.tree.remove(r)}return n}_splitSafely(t,r){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const i=t.split(r);return i.push(n),t.consumedBy===void 0&&this.tree.add(t),i}}const g1=typeof process<"u"&&WS.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,yZ=typeof process<"u"&&WS.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class TZ{run(t,r,n){Gn.type=t,Ru.reset();const i=[new v1(r,!0)];for(let c=0,h=n.length;c<h;c++)i.push(new v1(n[c],!1));if(Gn.numMultiPolys=i.length,Gn.type==="difference"){const c=i[0];let h=1;for(;h<i.length;)np(i[h].bbox,c.bbox)!==null?h++:i.splice(h,1)}if(Gn.type==="intersection")for(let c=0,h=i.length;c<h;c++){const d=i[c];for(let p=c+1,v=i.length;p<v;p++)if(np(d.bbox,i[p].bbox)===null)return[]}const o=new i_(Nn.compare);for(let c=0,h=i.length;c<h;c++){const d=i[c].getSweepEvents();for(let p=0,v=d.length;p<v;p++)if(o.insert(d[p]),o.size>g1)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const a=new EZ(o);let s=o.size,u=o.pop();for(;u;){const c=u.key;if(o.size===s){const d=c.segment;throw new Error(`Unable to pop() ${c.isLeft?"left":"right"} SweepEvent [${c.point.x}, ${c.point.y}] from segment #${d.id} [${d.leftSE.point.x}, ${d.leftSE.point.y}] -> [${d.rightSE.point.x}, ${d.rightSE.point.y}] from queue.`)}if(o.size>g1)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(a.segments.length>yZ)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const h=a.process(c);for(let d=0,p=h.length;d<p;d++){const v=h[d];v.consumedBy===void 0&&o.insert(v)}s=o.size,u=o.pop()}Ru.reset();const l=Dc.factory(a.segments);return new gZ(l).getGeom()}}const Gn=new TZ,AZ=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Gn.run("union",e,r)},SZ=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Gn.run("intersection",e,r)},xZ=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Gn.run("xor",e,r)},bZ=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Gn.run("difference",e,r)};var RZ={union:AZ,intersection:SZ,xor:xZ,difference:bZ};function CZ(e,t,r){r===void 0&&(r={});var n=r0(e),i=r0(t),o=RZ.union(n.coordinates,i.coordinates);return o.length===0?null:o.length===1?cp(o[0],r.properties):JR(o,r.properties)}class OZ{getCombineFeature(t){let r=null;const n=t[0];return t.map(i=>{const o=cp(i.coordinates);r===null?r=o:r=CZ(r,o)}),n&&(r.properties=he({},n)),r}}const $s="select",zs="active";class IZ{constructor({layerService:t,tileLayerService:r,parent:n}){E(this,"layerService",void 0),E(this,"tileLayerService",void 0),E(this,"tileSourceService",void 0),E(this,"parent",void 0),E(this,"tilePickID",new Map),this.layerService=t,this.tileLayerService=r,this.parent=n,this.tileSourceService=new OZ}pickRender(t){const r=this.tileLayerService.getVisibleTileBylngLat(t.lngLat);if(r){const n=r.getMainLayer();n==null||n.layerPickService.pickRender(t)}}pick(t,r){var n=this;return ve(function*(){const o=n.parent.getContainer().pickingService;if(t.type==="RasterLayer"){const a=n.tileLayerService.getVisibleTileBylngLat(r.lngLat);if(a&&a.getMainLayer()!==void 0){const s=a.getMainLayer();return s.layerPickService.pickRasterLayer(s,r,n.parent)}return!1}return n.pickRender(r),o.pickFromPickingFBO(t,r)})()}selectFeature(t){const[r,n,i]=t,o=this.color2PickId(r,n,i);this.tilePickID.set($s,o),this.updateHighLight(r,n,i,$s)}highlightPickedFeature(t){const[r,n,i]=t,o=this.color2PickId(r,n,i);this.tilePickID.set(zs,o),this.updateHighLight(r,n,i,zs)}updateHighLight(t,r,n,i){this.tileLayerService.tiles.map(o=>{const a=o.getMainLayer();switch(i){case $s:a==null||a.hooks.beforeSelect.call([t,r,n]);break;case zs:a==null||a.hooks.beforeHighlight.call([t,r,n]);break}})}setPickState(){const t=this.tilePickID.get($s),r=this.tilePickID.get(zs);if(t){const[n,i,o]=this.pickId2Color(t);this.updateHighLight(n,i,o,$s);return}if(r){const[n,i,o]=this.pickId2Color(r);this.updateHighLight(n,i,o,zs);return}}color2PickId(t,r,n){return yo(new Uint8Array([t,r,n]))}pickId2Color(t){return La(t)}getFeatureById(t){const r=this.tileLayerService.getTiles().filter(i=>i.visible),n=[];return r.forEach(i=>{n.push(...i.getFeatureById(t))}),n}pickRasterLayer(){return!1}}function MZ(e){return e==="PolygonLayer"?XS:e==="LineLayer"?DS:Kd}function NZ(e){return["PolygonLayer","LineLayer"].indexOf(e)!==-1}class Lo extends Bn.EventEmitter{constructor(t,r){super(),E(this,"x",void 0),E(this,"y",void 0),E(this,"z",void 0),E(this,"key",void 0),E(this,"parent",void 0),E(this,"sourceTile",void 0),E(this,"visible",!0),E(this,"layers",[]),E(this,"isLoaded",!1),E(this,"tileMaskLayers",[]),E(this,"tileMask",void 0),this.parent=r,this.sourceTile=t,this.x=t.x,this.y=t.y,this.z=t.z,this.key=`${this.x}_${this.y}_${this.z}`}getLayers(){return this.layers}styleUpdate(...t){}lnglatInBounds(t){const[r,n,i,o]=this.sourceTile.bounds,{lng:a,lat:s}=t;return a>=r&&a<=i&&s>=n&&s<=o}getLayerOptions(){var t;const r=this.parent.getLayerConfig();return he(he({},r),{},{textAllowOverlap:!0,autoFit:!1,maskLayers:this.getMaskLayer(),tileMask:NZ(this.parent.type),mask:r.mask||((t=r.maskLayers)===null||t===void 0?void 0:t.length)!==0&&r.enableMask})}getMaskLayer(){const{maskLayers:t}=this.parent.getLayerConfig(),r=[];return t==null||t.forEach(n=>{if(!n.tileLayer)return r.push(n),n;const o=n.tileLayer.getTile(this.sourceTile.key),a=o==null?void 0:o.getLayers()[0];a&&r.push(a)}),r}addTileMask(){var t=this;return ve(function*(){const r=new XS({name:"mask",visible:!0,enablePicking:!1}).source({type:"FeatureCollection",features:[t.sourceTile.bboxPolygon]},{parser:{type:"geojson",featureId:"id"}}).shape("fill").color("#0f0").style({opacity:.5}),n=su(t.parent.container);r.setContainer(n),yield r.init(),t.tileMask=r;const i=t.getMainLayer();return i!==void 0&&(i.tileMask=r),r})()}addMask(t,r){var n=this;return ve(function*(){const i=su(n.parent.container);r.setContainer(i),yield r.init(),t.addMask(r),n.tileMaskLayers.push(r)})()}addLayer(t){var r=this;return ve(function*(){t.isTileLayer=!0;const n=su(r.parent.container);t.setContainer(n),r.layers.push(t),yield t.init()})()}updateVisible(t){this.visible=t,this.updateOptions("visible",t)}updateOptions(t,r){this.layers.forEach(n=>{n.updateLayerConfig({[t]:r})})}getMainLayer(){return this.layers[0]}getFeatures(t){return[]}getFeatureById(t){return[]}destroy(){var t;(t=this.tileMask)===null||t===void 0||t.destroy(),this.layers.forEach(r=>r.destroy())}}class PZ extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.getSourceOption(),n=r.data.features[0].properties,i=new DS().source(r.data,r.options).size(1).shape("line").color("red"),o=new Kd({minZoom:t.z-1,maxZoom:t.z+1,textAllowOverlap:!0}).source([n],{parser:{type:"json",x:"x",y:"y"}}).size(20).color("red").shape(t.key).style({stroke:"#fff",strokeWidth:2});yield t.addLayer(i),yield t.addLayer(o),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource();return{data:{type:"FeatureCollection",features:this.sourceTile.data.layers.testTile.features},options:{parser:{type:"geojson"},transforms:t.transforms}}}}class LZ extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),o=new aG(he({},n)).source(i.data,i.options);r&&Object.keys(r).forEach(a=>{var s,u;const l=a;o[l]((s=r[l])===null||s===void 0?void 0:s.field,(u=r[l])===null||u===void 0?void 0:u.values)}),yield t.addLayer(o),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource();return{data:this.sourceTile.data,options:{parser:{type:"image",extent:this.sourceTile.bounds},transforms:t.transforms}}}}const wZ=`layout(std140) uniform commonUniorm {
vec4 u_color;
float u_opacity;
};
out vec4 outputColor;
void main() {
outputColor = u_color;
outputColor.a *= u_opacity;
}
`,FZ=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
layout(std140) uniform commonUniorm {
vec4 u_color;
float u_opacity;
};
#pragma include "projection"
void main() {
vec4 project_pos = project_position(vec4(a_Position, 1.0));
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
}
`;class BZ extends Qt{getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{opacity:t=1,color:r="#000"}=this.layer.getLayerConfig(),n={u_color:Zt(r),u_opacity:t||1};return this.getUniformsBufferInfo(n)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"mask",vertexShader:FZ,fragmentShader:wZ,defines:t.getDefines(),triangulation:ku,depth:{enable:!1},pick:!1})]})()}clearModels(t=!0){t&&this.layerService.clear()}registerBuiltinAttributes(){return""}}const DZ={fill:BZ};class YS extends Ka{constructor(...t){super(...t),E(this,"type","MaskLayer")}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new DZ[r](t),yield t.initLayerModels()})()}getModelType(){return"fill"}}class UZ extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),o=new YS(he({},n)).source(i.data,i.options);r&&Object.keys(r).forEach(a=>{var s,u;const l=a;o[l]((s=r[l])===null||s===void 0?void 0:s.field,(u=r[l])===null||u===void 0?void 0:u.values)}),yield t.addLayer(o),t.isLoaded=!0})()}getFeatures(t){return t?this.sourceTile.data.getTileData(t):[]}getSourceOption(){const t=this.parent.getSource(),{sourceLayer:r,featureId:n}=this.parent.getLayerConfig();return{data:{type:"FeatureCollection",features:this.getFeatures(r)},options:{parser:{type:"geojson",featureId:n},transforms:t.transforms}}}}const kZ=["rasterData"];let $Z=class extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),o=new n_(he({},n)).source(i.data,i.options);r&&Object.keys(r).forEach(a=>{var s,u;const l=a;o[l]((s=r[l])===null||s===void 0?void 0:s.field,(u=r[l])===null||u===void 0?void 0:u.values)}),yield t.addLayer(o),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource(),r=this.sourceTile.data.data,{rasterData:n}=r,i=ai(r,kZ);return{data:n,options:{parser:he({type:"rasterRgb",extent:this.sourceTile.bounds},i),transforms:t.transforms}}}};class zZ extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),o=new n_(he({},n)).source(i.data,i.options);r&&Object.keys(r).forEach(a=>{var s,u;const l=a;o[l]((s=r[l])===null||s===void 0?void 0:s.field,(u=r[l])===null||u===void 0?void 0:u.values)}),yield t.addLayer(o),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource();return{data:this.sourceTile.data,options:{parser:{type:"image",extent:this.sourceTile.bounds},transforms:t.transforms}}}}const VZ=["rasterData"],HZ={positions:[0,1],colors:["#000","#fff"]};class jZ extends Lo{constructor(...t){super(...t),E(this,"colorTexture",void 0)}initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),{rampColors:o,domain:a}=t.getLayerOptions();t.colorTexture=t.parent.textureService.getColorTexture(o,a);const s=new n_(he(he({},n),{},{colorTexture:t.colorTexture})).source(i.data,i.options);r&&Object.keys(r).forEach(u=>{var l,f;const c=u;s[c]((l=r[c])===null||l===void 0?void 0:l.field,(f=r[c])===null||f===void 0?void 0:f.values)}),yield t.addLayer(s),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource(),r=this.sourceTile.data.data,{rasterData:n}=r,i=ai(r,VZ);return{data:n,options:{parser:he({type:"raster",extent:this.sourceTile.bounds},i),transforms:t.transforms}}}styleUpdate(...t){const{rampColors:r=HZ,domain:n}=t;this.colorTexture=this.parent.textureService.getColorTexture(r,n||gp(r)),this.layers.forEach(i=>i.style({colorTexture:this.colorTexture}))}destroy(){this.layers.forEach(t=>t.destroy())}}class kl extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=MZ(t.parent.type),o=t.getSourceOption();if(!o){t.isLoaded=!0,t.emit("loaded");return}const a=new i(he({},n)).source(o.data,o.options);Object.keys(r).forEach(s=>{var u,l;const f=s;a[f]((u=r[f])===null||u===void 0?void 0:u.field,(l=r[f])===null||l===void 0?void 0:l.values)}),yield t.addLayer(a),n.tileMask&&(yield t.addTileMask()),t.setLayerMinMaxZoom(a),t.isLoaded=!0,t.emit("loaded")})()}getSourceOption(){const t=this.parent.getSource(),{sourceLayer:r="defaultLayer",featureId:n="id"}=this.parent.getLayerConfig();return{data:{type:"FeatureCollection",features:this.getFeatures(r)},options:{parser:{type:"geojson",featureId:n},transforms:t.transforms}}}setLayerMinMaxZoom(t){t.getModelType()==="text"&&t.updateLayerConfig({maxZoom:this.z+1,minZoom:this.z-1})}getFeatures(t){return this.sourceTile.data.getTileData(t)}getFeatureById(t){const r=this.getMainLayer();return r?r.getSource().data.dataArray.filter(i=>i._id===t):[]}}function XZ(e){switch(e.type){case"PolygonLayer":return kl;case"LineLayer":return kl;case"PointLayer":return kl;case"TileDebugLayer":return PZ;case"MaskLayer":return UZ;case"RasterLayer":const{dataType:r}=e.getSource().parser;switch(r){case Hr.RGB:case Hr.CUSTOMRGB:return $Z;case Hr.ARRAYBUFFER:case Hr.CUSTOMARRAYBUFFER:return jZ;case Hr.TERRAINRGB:case Hr.CUSTOMTERRAINRGB:return zZ;default:return LZ}default:return kl}}const WZ=["shape","color","size","style","animate","filter","rotate","scale","setBlend","setSelect","setActive","disableMask","enableMask","addMask","removeMask"],{debounce:GZ}=Sr;class YZ{constructor(t){E(this,"parent",void 0),E(this,"tileLayerService",void 0),E(this,"mapService",void 0),E(this,"layerService",void 0),E(this,"rendererService",void 0),E(this,"pickingService",void 0),E(this,"tilePickService",void 0),E(this,"tilesetManager",void 0),E(this,"initedTileset",!1),E(this,"lastViewStates",void 0),E(this,"mapchange",()=>{var n;if(this.parent.isVisible()===!1)return;const{latLonBounds:i,zoom:o}=this.getCurrentView();this.lastViewStates&&this.lastViewStates.zoom===o&&this.lastViewStates.latLonBounds.toString()===i.toString()||(this.lastViewStates={zoom:o,latLonBounds:i},(n=this.tilesetManager)===null||n===void 0||n.throttleUpdate(o,i))}),E(this,"viewchange",GZ(this.mapchange,24)),this.parent=t;const r=this.parent.getContainer();this.rendererService=r.rendererService,this.layerService=r.layerService,this.mapService=r.mapService,this.pickingService=r.pickingService,this.tileLayerService=new KY({rendererService:this.rendererService,layerService:this.layerService,parent:t}),this.tilePickService=new IZ({tileLayerService:this.tileLayerService,layerService:this.layerService,parent:t}),this.parent.setLayerPickService(this.tilePickService),this.proxy(t),this.initTileSetManager()}initTileSetManager(){var t;const r=this.parent.getSource();if(this.tilesetManager=r.tileset,this.initedTileset||(this.bindTilesetEvent(),this.initedTileset=!0),this.parent.isVisible()===!1)return;const{latLonBounds:n,zoom:i}=this.getCurrentView();(t=this.tilesetManager)===null||t===void 0||t.update(i,n)}getCurrentView(){const t=this.mapService.getBounds(),r=[t[0][0],t[0][1],t[1][0],t[1][1]],n=this.mapService.getZoom();return{latLonBounds:r,zoom:n}}bindTilesetEvent(){this.tilesetManager.on("tile-loaded",t=>{}),this.tilesetManager.on("tile-unload",t=>{this.tileUnLoad(t)}),this.tilesetManager.on("tile-error",(t,r)=>{this.tileError(t)}),this.tilesetManager.on("tile-update",()=>{this.tileUpdate()}),this.mapService.on("zoomend",this.mapchange),this.mapService.on("moveend",this.viewchange)}render(){this.tileLayerService.render()}getLayers(){return this.tileLayerService.getLayers()}getTiles(){return this.tileLayerService.getTiles()}getTile(t){return this.tileLayerService.getTile(t)}tileLoaded(t){}tileError(t){console.warn("error:",t)}destroy(){var t;this.mapService.off("zoomend",this.mapchange),this.mapService.off("moveend",this.viewchange),(t=this.tilesetManager)===null||t===void 0||t.destroy(),this.tileLayerService.destroy()}reload(){var t;this.tilesetManager.clear();const{latLonBounds:r,zoom:n}=this.getCurrentView();(t=this.tilesetManager)===null||t===void 0||t.update(n,r)}tileUnLoad(t){this.tileLayerService.removeTile(t.key)}tileUpdate(){var t=this;return ve(function*(){if(!t.tilesetManager)return;const r=t.parent.getMinZoom(),n=t.parent.getMaxZoom(),i=t.tilesetManager.tiles.filter(o=>o.isLoaded).filter(o=>o.isVisibleChange).filter(o=>o.data).filter(o=>o.z>=r&&o.z<n);yield Promise.all(i.map(function(){var o=ve(function*(a){if(t.tileLayerService.hasTile(a.key))t.tileLayerService.updateTileVisible(a),t.tilePickService.setPickState(),t.layerService.reRender();else{const s=XZ(t.parent),u=new s(a,t.parent);yield u.initTileLayer(),t.tilePickService.setPickState(),u.getLayers().length!==0&&(t.tileLayerService.addTile(u),t.tileLayerService.updateTileVisible(a),t.layerService.reRender())}});return function(a){return o.apply(this,arguments)}}())),t.tilesetManager.isLoaded&&t.parent.emit("tiles-loaded",t.tilesetManager.currentTiles)})()}setPickState(t){}pickRender(t){this.tilePickService.pickRender(t)}selectFeature(t){this.tilePickService.selectFeature(t)}highlightPickedFeature(t){this.tilePickService.highlightPickedFeature(t)}proxy(t){WZ.forEach(r=>{const n=t[r].bind(t);t[r]=(...i)=>(n(...i),this.getLayers().map(o=>{o[r](...i)}),r==="style"&&this.getTiles().forEach(o=>o.styleUpdate(...i)),t)})}}function ZZ(e,t){var r=typeof my<"u"&&!!my&&typeof my.showToast=="function"&&my.isFRM!==!0,n=typeof wx<"u"&&wx!==null&&(typeof wx.request<"u"||typeof wx.miniProgram<"u");if(!(r||n)&&(t||(t=document),!!t)){var i=t.head||t.getElementsByTagName("head")[0];if(!i){i=t.createElement("head");var o=t.body||t.getElementsByTagName("body")[0];o?o.parentNode.insertBefore(i,o):t.documentElement.appendChild(i)}var a=t.createElement("style");return a.type="text/css",a.styleSheet?a.styleSheet.cssText=e:a.appendChild(t.createTextNode(e)),i.appendChild(a),a}}ZZ(`.l7-marker-container {
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
}
.l7-marker {
position: absolute !important;
top: 0;
left: 0;
z-index: 5;
cursor: pointer;
}
.l7-marker-cluster {
width: 40px;
height: 40px;
background-color: rgba(181, 226, 140, 0.6);
background-clip: padding-box;
border-radius: 20px;
}
.l7-marker-cluster div {
width: 30px;
height: 30px;
margin-top: 5px;
margin-left: 5px;
font:
12px 'Helvetica Neue',
Arial,
Helvetica,
sans-serif;
text-align: center;
background-color: rgba(110, 204, 57, 0.6);
border-radius: 15px;
}
.l7-marker-cluster span {
line-height: 30px;
}
.l7-touch .l7-control-attribution,
.l7-touch .l7-control-layers,
.l7-touch .l7-bar {
box-shadow: none;
}
.l7-touch .l7-control-layers,
.l7-touch .l7-bar {
background-clip: padding-box;
border: 2px solid rgba(0, 0, 0, 0.2);
}
.mapboxgl-ctrl-logo,
.amap-logo {
display: none !important;
}
.l7-select-box {
border: 3px dashed gray;
border-radius: 2px;
position: absolute;
z-index: 999;
box-sizing: border-box;
}
.l7-control-container {
font:
12px/1.5 'Helvetica Neue',
Arial,
Helvetica,
sans-serif;
}
.l7-control-container .l7-control {
position: relative;
z-index: 999;
float: left;
clear: both;
color: #595959;
font-size: 12px;
pointer-events: visiblePainted;
/* IE 9-10 doesn't have auto */
pointer-events: auto;
}
.l7-control-container .l7-control.l7-control--hide {
display: none;
}
.l7-control-container .l7-top {
top: 0;
display: flex;
position: absolute;
z-index: 999;
pointer-events: none;
}
.l7-control-container .l7-top .l7-control:not(.l7-control--hide) {
margin-top: 8px;
}
.l7-control-container .l7-right {
right: 0;
display: flex;
position: absolute;
z-index: 999;
pointer-events: none;
}
.l7-control-container .l7-right .l7-control:not(.l7-control--hide) {
margin-right: 8px;
}
.l7-control-container .l7-bottom {
bottom: 0;
display: flex;
position: absolute;
z-index: 999;
pointer-events: none;
}
.l7-control-container .l7-bottom .l7-control:not(.l7-control--hide) {
margin-bottom: 8px;
}
.l7-control-container .l7-left {
left: 0;
display: flex;
position: absolute;
z-index: 999;
pointer-events: none;
}
.l7-control-container .l7-left .l7-control:not(.l7-control--hide) {
margin-left: 8px;
}
.l7-control-container .l7-center {
position: absolute;
display: flex;
justify-content: center;
}
.l7-control-container .l7-center.l7-top,
.l7-control-container .l7-center.l7-bottom {
width: 100%;
}
.l7-control-container .l7-center.l7-left,
.l7-control-container .l7-center.l7-right {
height: 100%;
}
.l7-control-container .l7-center .l7-control {
margin-right: 8px;
margin-bottom: 8px;
}
.l7-control-container .l7-row {
flex-direction: row;
}
.l7-control-container .l7-row.l7-top {
align-items: flex-start;
}
.l7-control-container .l7-row.l7-bottom {
align-items: flex-end;
}
.l7-control-container .l7-column {
flex-direction: column;
}
.l7-control-container .l7-column.l7-left {
align-items: flex-start;
}
.l7-control-container .l7-column.l7-right {
align-items: flex-end;
}
.l7-button-control {
min-width: 28px;
height: 28px;
background-color: #fff;
border-width: 0;
border-radius: 2px;
outline: 0;
cursor: pointer;
transition: all 0.2s;
display: flex;
justify-content: center;
align-items: center;
padding: 0 6px;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);
line-height: 16px;
}
.l7-button-control .l7-iconfont {
fill: #595959;
color: #595959;
width: 16px;
height: 16px;
}
.l7-button-control.l7-button-control--row {
padding: 0 16px 0 13px;
}
.l7-button-control.l7-button-control--row * + .l7-button-control__text {
margin-left: 8px;
}
.l7-button-control.l7-button-control--column {
height: 44px;
flex-direction: column;
}
.l7-button-control.l7-button-control--column .l7-iconfont {
margin-top: 3px;
}
.l7-button-control.l7-button-control--column .l7-button-control__text {
margin-top: 3px;
font-size: 10px;
-webkit-transform: scale(0.83333);
transform: scale(0.83333);
}
.l7-button-control:not(:disabled):hover {
background-color: #f3f3f3;
}
.l7-button-control:not(:disabled):active {
background-color: #f3f3f3;
}
.l7-button-control:disabled {
background-color: #fafafa;
color: #bdbdbd;
cursor: not-allowed;
}
.l7-button-control:disabled .l7-iconfont {
fill: #bdbdbd;
color: #bdbdbd;
}
.l7-button-control:disabled:hover {
background-color: #fafafa;
}
.l7-button-control:disabled:active {
background-color: #fafafa;
}
.l7-popper {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
z-index: 5;
color: #595959;
}
.l7-popper.l7-popper-hide {
display: none;
}
.l7-popper .l7-popper-content {
min-height: 28px;
background: #fff;
border-radius: 2px;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);
}
.l7-popper .l7-popper-arrow {
width: 0;
height: 0;
border-width: 4px;
border-style: solid;
border-top-color: transparent;
border-bottom-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);
}
.l7-popper.l7-popper-left {
flex-direction: row;
}
.l7-popper.l7-popper-left .l7-popper-arrow {
border-left-color: #fff;
margin: 10px 0;
}
.l7-popper.l7-popper-right {
flex-direction: row-reverse;
}
.l7-popper.l7-popper-right .l7-popper-arrow {
border-right-color: #fff;
margin: 10px 0;
}
.l7-popper.l7-popper-top {
flex-direction: column;
}
.l7-popper.l7-popper-top .l7-popper-arrow {
border-top-color: #fff;
margin: 0 10px;
}
.l7-popper.l7-popper-bottom {
flex-direction: column-reverse;
}
.l7-popper.l7-popper-bottom .l7-popper-arrow {
border-bottom-color: #fff;
margin: 0 10px;
}
.l7-popper.l7-popper-start {
align-items: flex-start;
}
.l7-popper.l7-popper-end {
align-items: flex-end;
}
.l7-select-control--normal {
padding: 4px 0;
}
.l7-select-control--normal .l7-select-control-item {
display: flex;
align-items: center;
height: 24px;
padding: 0 16px;
font-size: 12px;
line-height: 24px;
}
.l7-select-control--normal .l7-select-control-item > * + * {
margin-left: 6px;
}
.l7-select-control--normal .l7-select-control-item input[type='checkbox'] {
width: 14px;
height: 14px;
}
.l7-select-control--normal .l7-select-control-item:hover {
background-color: #f3f3f3;
}
.l7-select-control--image {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
box-sizing: content-box;
max-width: 460px;
max-height: 400px;
margin: 12px 0 0 12px;
overflow-x: hidden;
overflow-y: auto;
}
.l7-select-control--image .l7-select-control-item {
position: relative;
display: flex;
flex: 0 0 calc((100% - (12px + 9px) * 2) / 3);
flex-direction: column;
justify-content: center;
box-sizing: content-box;
margin-right: 12px;
margin-bottom: 12px;
overflow: hidden;
font-size: 12px;
border: 1px solid #fff;
border-radius: 2px;
}
.l7-select-control--image .l7-select-control-item img {
width: 100%;
height: 80px;
}
.l7-select-control--image .l7-select-control-item input[type='checkbox'] {
position: absolute;
top: 0;
right: 0;
}
.l7-select-control--image .l7-select-control-item .l7-select-control-item-row {
display: flex;
align-items: center;
justify-content: center;
line-height: 26px;
}
.l7-select-control--image .l7-select-control-item .l7-select-control-item-row > * + * {
margin-left: 8px;
}
.l7-select-control--image .l7-select-control-item.l7-select-control-item-active {
border-color: #0370fe;
}
.l7-select-control-item {
cursor: pointer;
}
.l7-select-control-item input[type='checkbox'] {
margin: 0;
cursor: pointer;
}
.l7-select-control--multiple .l7-select-control-item:hover {
background-color: transparent;
}
.l7-control-logo {
width: 89px;
height: 16px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.l7-control-logo img {
height: 100%;
width: 100%;
}
.l7-control-logo .l7-control-logo-link {
display: block;
cursor: pointer;
}
.l7-control-logo .l7-control-logo-link img {
cursor: pointer;
}
.l7-control-mouse-location {
background-color: #fff;
border-radius: 2px;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);
padding: 2px 4px;
min-width: 130px;
}
.l7-control-zoom {
overflow: hidden;
border-radius: 2px;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);
}
.l7-control-zoom .l7-button-control {
font-size: 16px;
border-bottom: 1px solid #f0f0f0;
border-radius: 0;
box-shadow: 0 0 0;
}
.l7-control-zoom .l7-button-control .l7-iconfont {
width: 14px;
height: 14px;
}
.l7-control-zoom .l7-button-control:last-child {
border-bottom: 0;
}
.l7-control-zoom .l7-control-zoom__number {
color: #595959;
padding: 0;
}
.l7-control-zoom .l7-control-zoom__number:hover {
background-color: #fff;
}
.l7-control-scale {
display: flex;
flex-direction: column;
}
.l7-control-scale .l7-control-scale-line {
box-sizing: border-box;
padding: 2px 5px 1px;
overflow: hidden;
color: #595959;
font-size: 10px;
line-height: 1.1;
white-space: nowrap;
background: #fff;
border: 2px solid #000;
border-top: 0;
transition: width 0.1s;
}
.l7-control-scale .l7-control-scale-line + .l7-control-scale .l7-control-scale-line {
margin-top: -2px;
border-top: 2px solid #777;
border-bottom: none;
}
.l7-right .l7-control-scale {
display: flex;
align-items: flex-end;
}
.l7-right .l7-control-scale .l7-control-scale-line {
text-align: right;
}
.l7-popup {
position: absolute;
top: 0;
left: 0;
z-index: 5;
display: flex;
will-change: transform;
pointer-events: none;
}
.l7-popup.l7-popup-hide {
display: none;
}
.l7-popup .l7-popup-content {
position: relative;
padding: 16px;
font-size: 14px;
background: #fff;
border-radius: 3px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.l7-popup .l7-popup-content .l7-popup-content__title {
margin-bottom: 8px;
font-weight: bold;
}
.l7-popup .l7-popup-content .l7-popup-close-button,
.l7-popup .l7-popup-content .l7-popup-content__title,
.l7-popup .l7-popup-content .l7-popup-content__panel {
white-space: normal;
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
pointer-events: initial;
}
.l7-popup .l7-popup-content .l7-popup-close-button {
position: absolute;
top: 0;
right: 0;
width: 18px;
height: 18px;
padding: 0;
font-size: 14px;
line-height: 18px;
text-align: center;
background-color: transparent;
border: 0;
border-radius: 0 3px 0 0;
cursor: pointer;
}
.l7-popup .l7-popup-tip {
position: relative;
z-index: 1;
width: 0;
height: 0;
border: 10px solid transparent;
}
.l7-popup.l7-popup-anchor-bottom,
.l7-popup.l7-popup-anchor-bottom-left,
.l7-popup.l7-popup-anchor-bottom-right {
flex-direction: column-reverse;
}
.l7-popup.l7-popup-anchor-bottom .l7-popup-tip,
.l7-popup.l7-popup-anchor-bottom-left .l7-popup-tip,
.l7-popup.l7-popup-anchor-bottom-right .l7-popup-tip {
bottom: 1px;
}
.l7-popup.l7-popup-anchor-top,
.l7-popup.l7-popup-anchor-top-left,
.l7-popup.l7-popup-anchor-top-right {
flex-direction: column;
}
.l7-popup.l7-popup-anchor-top .l7-popup-tip,
.l7-popup.l7-popup-anchor-top-left .l7-popup-tip,
.l7-popup.l7-popup-anchor-top-right .l7-popup-tip {
top: 1px;
}
.l7-popup.l7-popup-anchor-left {
flex-direction: row;
}
.l7-popup.l7-popup-anchor-right {
flex-direction: row-reverse;
}
.l7-popup-anchor-top .l7-popup-tip {
position: relative;
align-self: center;
border-top: none;
border-bottom-color: #fff;
}
.l7-popup-anchor-top-left .l7-popup-tip {
align-self: flex-start;
border-top: none;
border-bottom-color: #fff;
border-left: none;
}
.l7-popup-anchor-top-right .l7-popup-tip {
align-self: flex-end;
border-top: none;
border-right: none;
border-bottom-color: #fff;
}
.l7-popup-anchor-bottom .l7-popup-tip {
align-self: center;
border-top-color: #fff;
border-bottom: none;
}
.l7-popup-anchor-bottom-left .l7-popup-tip {
align-self: flex-start;
border-top-color: #fff;
border-bottom: none;
border-left: none;
}
.l7-popup-anchor-bottom-right .l7-popup-tip {
align-self: flex-end;
border-top-color: #fff;
border-right: none;
border-bottom: none;
}
.l7-popup-anchor-left .l7-popup-tip {
align-self: center;
border-right-color: #fff;
border-left: none;
}
.l7-popup-anchor-right .l7-popup-tip {
right: 1px;
align-self: center;
border-right: none;
border-left-color: #fff;
}
.l7-popup-anchor-top-left .l7-popup-content {
border-top-left-radius: 0;
}
.l7-popup-anchor-top-right .l7-popup-content {
border-top-right-radius: 0;
}
.l7-popup-anchor-bottom-left .l7-popup-content {
border-bottom-left-radius: 0;
}
.l7-popup-anchor-bottom-right .l7-popup-content {
border-bottom-right-radius: 0;
}
.l7-popup-track-pointer {
display: none;
}
.l7-popup-track-pointer * {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
}
.l7-map:hover .l7-popup-track-pointer {
display: flex;
}
.l7-map:active .l7-popup-track-pointer {
display: none;
}
.l7-layer-popup__row {
font-size: 12px;
}
.l7-layer-popup__row + .l7-layer-popup__row {
margin-top: 4px;
}
.l7-control-swipe {
position: absolute;
top: 50%;
left: 50%;
z-index: 6;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
touch-action: none;
}
.l7-control-swipe_hide {
display: none;
}
.l7-control-swipe:before {
position: absolute;
top: -5000px;
bottom: -5000px;
left: 50%;
z-index: -1;
width: 4px;
background: #fff;
-webkit-transform: translate(-2px, 0);
transform: translate(-2px, 0);
content: '';
}
.l7-control-swipe.horizontal:before {
top: 50%;
right: -5000px;
bottom: auto;
left: -5000px;
width: auto;
height: 4px;
}
.l7-control-swipe__button {
display: block;
width: 28px;
height: 28px;
margin: 0;
padding: 0;
color: #595959;
font-weight: bold;
font-size: inherit;
text-align: center;
text-decoration: none;
background-color: #fff;
border: none;
border-radius: 2px;
outline: none;
}
.l7-control-swipe,
.l7-control-swipe__button {
cursor: ew-resize;
}
.l7-control-swipe.horizontal,
.l7-control-swipe.horizontal button {
cursor: ns-resize;
}
.l7-control-swipe:after,
.l7-control-swipe__button:before,
.l7-control-swipe__button:after {
position: absolute;
top: 25%;
bottom: 25%;
left: 50%;
width: 2px;
background: currentColor;
-webkit-transform: translate(-1px, 0);
transform: translate(-1px, 0);
content: '';
}
.l7-control-swipe__button:after {
-webkit-transform: translateX(4px);
transform: translateX(4px);
}
.l7-control-swipe__button:before {
-webkit-transform: translateX(-6px);
transform: translateX(-6px);
}
`);class qZ{constructor(t){E(this,"configService",void 0),E(this,"config",void 0),this.config=t}setContainer(t,r){this.configService=t.globalConfigService,t.mapConfig=he(he({},this.config),{},{id:r}),t.mapService=new(this.getServiceConstructor())(t)}getServiceConstructor(){throw new Error("Method not implemented.")}}var ZS={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(mo,function(){function r(c){var h=[];return c.AMapUI&&h.push(n(c.AMapUI)),c.Loca&&h.push(i(c.Loca)),Promise.all(h)}function n(c){return new Promise(function(h,d){var p=[];if(c.plugins)for(var v=0;v<c.plugins.length;v+=1)a.AMapUI.plugins.indexOf(c.plugins[v])==-1&&p.push(c.plugins[v]);if(s.AMapUI===o.failed)d("前次请求 AMapUI 失败");else if(s.AMapUI===o.notload){s.AMapUI=o.loading,a.AMapUI.version=c.version||a.AMapUI.version,v=a.AMapUI.version;var g=document.body||document.head,y=document.createElement("script");y.type="text/javascript",y.src="https://webapi.amap.com/ui/"+v+"/main.js",y.onerror=function(S){s.AMapUI=o.failed,d("请求 AMapUI 失败")},y.onload=function(){if(s.AMapUI=o.loaded,p.length)window.AMapUI.loadUI(p,function(){for(var S=0,R=p.length;S<R;S++){var x=p[S].split("/").slice(-1)[0];window.AMapUI[x]=arguments[S]}for(h();u.AMapUI.length;)u.AMapUI.splice(0,1)[0]()});else for(h();u.AMapUI.length;)u.AMapUI.splice(0,1)[0]()},g.appendChild(y)}else s.AMapUI===o.loaded?c.version&&c.version!==a.AMapUI.version?d("不允许多个版本 AMapUI 混用"):p.length?window.AMapUI.loadUI(p,function(){for(var S=0,R=p.length;S<R;S++){var x=p[S].split("/").slice(-1)[0];window.AMapUI[x]=arguments[S]}h()}):h():c.version&&c.version!==a.AMapUI.version?d("不允许多个版本 AMapUI 混用"):u.AMapUI.push(function(S){S?d(S):p.length?window.AMapUI.loadUI(p,function(){for(var R=0,x=p.length;R<x;R++){var M=p[R].split("/").slice(-1)[0];window.AMapUI[M]=arguments[R]}h()}):h()})})}function i(c){return new Promise(function(h,d){if(s.Loca===o.failed)d("前次请求 Loca 失败");else if(s.Loca===o.notload){s.Loca=o.loading,a.Loca.version=c.version||a.Loca.version;var p=a.Loca.version,v=a.AMap.version.startsWith("2"),g=p.startsWith("2");if(v&&!g||!v&&g)d("JSAPI 与 Loca 版本不对应!!");else{v=a.key,g=document.body||document.head;var y=document.createElement("script");y.type="text/javascript",y.src="https://webapi.amap.com/loca?v="+p+"&key="+v,y.onerror=function(S){s.Loca=o.failed,d("请求 AMapUI 失败")},y.onload=function(){for(s.Loca=o.loaded,h();u.Loca.length;)u.Loca.splice(0,1)[0]()},g.appendChild(y)}}else s.Loca===o.loaded?c.version&&c.version!==a.Loca.version?d("不允许多个版本 Loca 混用"):h():c.version&&c.version!==a.Loca.version?d("不允许多个版本 Loca 混用"):u.Loca.push(function(S){S?d(S):d()})})}if(!window)throw Error("AMap JSAPI can only be used in Browser.");var o;(function(c){c.notload="notload",c.loading="loading",c.loaded="loaded",c.failed="failed"})(o||(o={}));var a={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},s={AMap:o.notload,AMapUI:o.notload,Loca:o.notload},u={AMap:[],AMapUI:[],Loca:[]},l=[],f=function(c){typeof c=="function"&&(s.AMap===o.loaded?c(window.AMap):l.push(c))};return{load:function(c){return new Promise(function(h,d){if(s.AMap==o.failed)d("");else if(s.AMap==o.notload){var p=c.key,v=c.version,g=c.plugins;p?(window.AMap&&location.host!=="lbs.amap.com"&&d("禁止多种API加载方式混用"),a.key=p,a.AMap.version=v||a.AMap.version,a.AMap.plugins=g||a.AMap.plugins,s.AMap=o.loading,v=document.body||document.head,window.___onAPILoaded=function(S){if(delete window.___onAPILoaded,S)s.AMap=o.failed,d(S);else for(s.AMap=o.loaded,r(c).then(function(){h(window.AMap)}).catch(d);l.length;)l.splice(0,1)[0]()},g=document.createElement("script"),g.type="text/javascript",g.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+a.AMap.version+"&key="+p+"&plugin="+a.AMap.plugins.join(","),g.onerror=function(S){s.AMap=o.failed,d(S)},v.appendChild(g)):d("请填写key")}else if(s.AMap==o.loaded)if(c.key&&c.key!==a.key)d("多个不一致的 key");else if(c.version&&c.version!==a.AMap.version)d("不允许多个版本 JSAPI 混用");else{if(p=[],c.plugins)for(v=0;v<c.plugins.length;v+=1)a.AMap.plugins.indexOf(c.plugins[v])==-1&&p.push(c.plugins[v]);p.length?window.AMap.plugin(p,function(){r(c).then(function(){h(window.AMap)}).catch(d)}):r(c).then(function(){h(window.AMap)}).catch(d)}else if(c.key&&c.key!==a.key)d("多个不一致的 key");else if(c.version&&c.version!==a.AMap.version)d("不允许多个版本 JSAPI 混用");else{var y=[];if(c.plugins)for(v=0;v<c.plugins.length;v+=1)a.AMap.plugins.indexOf(c.plugins[v])==-1&&y.push(c.plugins[v]);f(function(){y.length?window.AMap.plugin(y,function(){r(c).then(function(){h(window.AMap)}).catch(d)}):r(c).then(function(){h(window.AMap)}).catch(d)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,a={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},s={AMap:o.notload,AMapUI:o.notload,Loca:o.notload},u={AMap:[],AMapUI:[],Loca:[]}}}})})(ZS);var KZ=ZS.exports;const QZ=Ht(KZ);class JZ{constructor(t){E(this,"size",1e4),this.size=t||1e4}setSize(t){this.size=t}getSize(){return[this.size,this.size]}mercatorXfromLng(t){return(180+t)/360*this.size}mercatorYfromLat(t){return(1-(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360)*this.size}lngFromMercatorX(t){return t/this.size*360-180}latFromMercatorY(t){const r=180-(1-t/this.size)*360;return 360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90}project(t){const r=this.mercatorXfromLng(t[0]),n=this.mercatorYfromLat(t[1]);return[r,n]}unproject(t){const r=this.lngFromMercatorX(t[0]),n=this.latFromMercatorY(t[1]);return[r,n]}}const eq=12;class tq{constructor(t){E(this,"map",void 0),E(this,"simpleMapCoord",new JZ),E(this,"bgColor","rgba(0.0, 0.0, 0.0, 0.0)"),E(this,"config",void 0),E(this,"configService",void 0),E(this,"coordinateSystemService",void 0),E(this,"eventEmitter",void 0),E(this,"markerContainer",void 0),E(this,"mapContainer",void 0),E(this,"cameraChangedCallback",void 0),this.config=t.mapConfig,this.configService=t.globalConfigService,this.coordinateSystemService=t.coordinateSystemService,this.eventEmitter=new Bn.EventEmitter}onCameraChanged(t){this.cameraChangedCallback=t}updateView(t){var r;this.emit("mapchange"),this.viewport.syncWithMapCamera({bearing:t.bearing,center:t.center,viewportHeight:t.viewportHeight,pitch:t.pitch,viewportWidth:t.viewportWidth,zoom:t.zoom}),this.updateCoordinateSystemService(),(r=this.cameraChangedCallback)===null||r===void 0||r.call(this,this.viewport)}updateCoordinateSystemService(){const{offsetCoordinate:t=!0}=this.config;this.viewport.getZoom()>eq&&t?this.coordinateSystemService.setCoordinateSystem(vc.LNGLAT_OFFSET):this.coordinateSystemService.setCoordinateSystem(vc.LNGLAT)}creatMapContainer(t){let r;return typeof t=="string"?r=document.getElementById(t):r=t,r}getMapStyleValue(t){var r;return(r=this.getMapStyleConfig()[t])!==null&&r!==void 0?r:t}setBgColor(t){this.bgColor=t}getMapContainer(){return this.mapContainer}getMarkerContainer(){return this.markerContainer}getOverlayContainer(){}getCanvasOverlays(){}emit(t,...r){this.eventEmitter.emit(t,...r)}once(t,r){this.eventEmitter.once(t,r)}meterToCoord(t,r){return 1}destroy(){this.eventEmitter.removeAllListeners()}}function rq(e){if(Array.isArray(e))return e}function nq(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,s=[],u=!0,l=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(f){l=!0,i=f}finally{try{if(!u&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}function iq(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ln(e,t){return rq(e)||nq(e,t)||kR(e,t)||iq()}function uu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function tc(e,t){var r=$p([],t,e);return P9(r,r,1/r[3]),r}function Co(e,t){if(!e)throw new Error(t||"viewport-mercator-project: assertion failed.")}var Yn=Math.PI,qS=Yn/4,Xi=Yn/180,E1=180/Yn,o_=512,y1=4003e4,oq=1.5;function KS(e){return Math.pow(2,e)}function td(e,t){var r=Ln(e,2),n=r[0],i=r[1];Co(Number.isFinite(n)&&Number.isFinite(t)),Co(Number.isFinite(i)&&i>=-90&&i<=90,"invalid latitude"),t*=o_;var o=n*Xi,a=i*Xi,s=t*(o+Yn)/(2*Yn),u=t*(Yn-Math.log(Math.tan(qS+a*.5)))/(2*Yn);return[s,u]}function T1(e,t){var r=Ln(e,2),n=r[0],i=r[1];t*=o_;var o=n/t*(2*Yn)-Yn,a=2*(Math.atan(Math.exp(Yn-i/t*(2*Yn)))-qS);return[o*E1,a*E1]}function aq(e){var t=e.latitude,r=e.longitude,n=e.zoom,i=e.scale,o=e.highPrecision,a=o===void 0?!1:o;i=i!==void 0?i:KS(n),Co(Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(i));var s={},u=o_*i,l=Math.cos(t*Xi),f=u/360,c=f/l,h=u/y1/l;if(s.pixelsPerMeter=[h,-h,h],s.metersPerPixel=[1/h,-1/h,1/h],s.pixelsPerDegree=[f,-c,h],s.degreesPerPixel=[1/f,-1/c,1/h],a){var d=Xi*Math.tan(t*Xi)/l,p=f*d/2,v=u/y1*d,g=v/c*h;s.pixelsPerDegree2=[0,-p,v],s.pixelsPerMeter2=[g,0,g]}return s}function sq(e){var t=e.height,r=e.pitch,n=e.bearing,i=e.altitude,o=e.center,a=o===void 0?null:o,s=e.flipY,u=s===void 0?!1:s,l=uu();return mc(l,l,[0,0,-i]),gc(l,l,[1,1,1/t]),kp(l,l,-r*Xi),fA(l,l,n*Xi),u&&gc(l,l,[1,-1,1]),a&&mc(l,l,O9([],a)),l}function uq(e){var t=e.width,r=e.height,n=e.altitude,i=n===void 0?oq:n,o=e.pitch,a=o===void 0?0:o,s=e.nearZMultiplier,u=s===void 0?1:s,l=e.farZMultiplier,f=l===void 0?1:l,c=a*Xi,h=Math.atan(.5/i),d=Math.sin(h)*i/Math.sin(Math.PI/2-c-h),p=Math.cos(Math.PI/2-c)*d+i;return{fov:2*Math.atan(r/2/i),aspect:t/r,focalDistance:i,near:u,far:p*f}}function lq(e){var t=e.width,r=e.height,n=e.pitch,i=e.altitude,o=e.nearZMultiplier,a=e.farZMultiplier,s=uq({width:t,height:r,altitude:i,pitch:n,nearZMultiplier:o,farZMultiplier:a}),u=s.fov,l=s.aspect,f=s.near,c=s.far,h=R9([],u,l,f,c);return h}function cq(e,t){var r=Ln(e,3),n=r[0],i=r[1],o=r[2],a=o===void 0?0:o;return Co(Number.isFinite(n)&&Number.isFinite(i)&&Number.isFinite(a)),tc(t,[n,i,a,1])}function QS(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=Ln(e,3),i=n[0],o=n[1],a=n[2];if(Co(Number.isFinite(i)&&Number.isFinite(o),"invalid pixel coordinate"),Number.isFinite(a)){var s=tc(t,[i,o,a,1]);return s}var u=tc(t,[i,o,0,1]),l=tc(t,[i,o,1,1]),f=u[2],c=l[2],h=f===c?0:((r||0)-f)/(c-f);return F9([],u,l,h)}var A1=uu(),fq=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.width,n=t.height,i=t.viewMatrix,o=i===void 0?A1:i,a=t.projectionMatrix,s=a===void 0?A1:a;cy(this,e),this.width=r||1,this.height=n||1,this.scale=1,this.pixelsPerMeter=1,this.viewMatrix=o,this.projectionMatrix=s;var u=uu();Oa(u,u,this.projectionMatrix),Oa(u,u,this.viewMatrix),this.viewProjectionMatrix=u;var l=uu();gc(l,l,[this.width/2,-this.height/2,1]),mc(l,l,[1,-1,0]),Oa(l,l,this.viewProjectionMatrix);var f=lA(uu(),l);if(!f)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=l,this.pixelUnprojectionMatrix=f,this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}return ly(e,[{key:"equals",value:function(r){return r instanceof e?r.width===this.width&&r.height===this.height&&lg(r.projectionMatrix,this.projectionMatrix)&&lg(r.viewMatrix,this.viewMatrix):!1}},{key:"project",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.topLeft,o=i===void 0?!0:i,a=this.projectPosition(r),s=cq(a,this.pixelProjectionMatrix),u=Ln(s,2),l=u[0],f=u[1],c=o?f:this.height-f;return r.length===2?[l,c]:[l,c,s[2]]}},{key:"unproject",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.topLeft,o=i===void 0?!0:i,a=n.targetZ,s=Ln(r,3),u=s[0],l=s[1],f=s[2],c=o?l:this.height-l,h=a&&a*this.pixelsPerMeter,d=QS([u,c,f],this.pixelUnprojectionMatrix,h),p=this.unprojectPosition(d),v=Ln(p,3),g=v[0],y=v[1],S=v[2];return Number.isFinite(f)?[g,y,S]:Number.isFinite(a)?[g,y,a]:[g,y]}},{key:"projectPosition",value:function(r){var n=this.projectFlat(r),i=Ln(n,2),o=i[0],a=i[1],s=(r[2]||0)*this.pixelsPerMeter;return[o,a,s]}},{key:"unprojectPosition",value:function(r){var n=this.unprojectFlat(r),i=Ln(n,2),o=i[0],a=i[1],s=(r[2]||0)/this.pixelsPerMeter;return[o,a,s]}},{key:"projectFlat",value:function(r){return arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.scale,r}},{key:"unprojectFlat",value:function(r){return arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.scale,r}}]),e}();function hq(e){var t=e.width,r=e.height,n=e.bounds,i=e.minExtent,o=i===void 0?0:i,a=e.maxZoom,s=a===void 0?24:a,u=e.padding,l=u===void 0?0:u,f=e.offset,c=f===void 0?[0,0]:f,h=Ln(n,2),d=Ln(h[0],2),p=d[0],v=d[1],g=Ln(h[1],2),y=g[0],S=g[1];if(Number.isFinite(l)){var R=l;l={top:R,bottom:R,left:R,right:R}}else Co(Number.isFinite(l.top)&&Number.isFinite(l.bottom)&&Number.isFinite(l.left)&&Number.isFinite(l.right));var x=new ip({width:t,height:r,longitude:0,latitude:0,zoom:0}),M=x.project([p,S]),$=x.project([y,v]),F=[Math.max(Math.abs($[0]-M[0]),o),Math.max(Math.abs($[1]-M[1]),o)],Y=[t-l.left-l.right-Math.abs(c[0])*2,r-l.top-l.bottom-Math.abs(c[1])*2];Co(Y[0]>0&&Y[1]>0);var ge=Y[0]/F[0],q=Y[1]/F[1],k=(l.right-l.left)/2/ge,G=(l.bottom-l.top)/2/q,K=[($[0]+M[0])/2+k,($[1]+M[1])/2+G],ce=x.unproject(K),Pe=x.zoom+Math.log2(Math.abs(Math.min(ge,q)));return{longitude:ce[0],latitude:ce[1],zoom:Math.min(Pe,s)}}var ip=function(e){$R(t,e);function t(){var r,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.width,o=n.height,a=n.latitude,s=a===void 0?0:a,u=n.longitude,l=u===void 0?0:u,f=n.zoom,c=f===void 0?0:f,h=n.pitch,d=h===void 0?0:h,p=n.bearing,v=p===void 0?0:p,g=n.altitude,y=g===void 0?1.5:g,S=n.nearZMultiplier,R=n.farZMultiplier;cy(this,t),i=i||1,o=o||1;var x=KS(c);y=Math.max(.75,y);var M=td([l,s],x);M[2]=0;var $=lq({width:i,height:o,pitch:d,bearing:v,altitude:y,nearZMultiplier:S||1/o,farZMultiplier:R||1.01}),F=sq({height:o,center:M,pitch:d,bearing:v,altitude:y,flipY:!0});return r=zR(this,VR(t).call(this,{width:i,height:o,viewMatrix:F,projectionMatrix:$})),r.latitude=s,r.longitude=l,r.zoom=c,r.pitch=d,r.bearing=v,r.altitude=y,r.scale=x,r.center=M,r.pixelsPerMeter=aq(bl(bl(r))).pixelsPerMeter[2],Object.freeze(bl(bl(r))),r}return ly(t,[{key:"projectFlat",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.scale;return td(n,i)}},{key:"unprojectFlat",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.scale;return T1(n,i)}},{key:"getMapCenterByLngLatPosition",value:function(n){var i=n.lngLat,o=n.pos,a=QS(o,this.pixelUnprojectionMatrix),s=td(i,this.scale),u=ki([],s,w9([],a)),l=ki([],this.center,u);return T1(l,this.scale)}},{key:"getLocationAtPoint",value:function(n){var i=n.lngLat,o=n.pos;return this.getMapCenterByLngLatPosition({lngLat:i,pos:o})}},{key:"fitBounds",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=this.width,a=this.height,s=hq(Object.assign({width:o,height:a,bounds:n},i)),u=s.longitude,l=s.latitude,f=s.zoom;return new t({width:o,height:a,longitude:u,latitude:l,zoom:f})}}]),t}(fq);class dq{constructor(){E(this,"viewport",new ip)}syncWithMapCamera(t){const{center:r,zoom:n,pitch:i,bearing:o,viewportHeight:a,viewportWidth:s}=t,u={width:this.viewport.width,height:this.viewport.height,longitude:this.viewport.center[0],latitude:this.viewport.center[1],zoom:this.viewport.zoom,pitch:this.viewport.pitch,bearing:this.viewport.bearing};this.viewport=new ip(he(he({},u),{},{width:s,height:a,longitude:r&&r[0],latitude:r&&r[1],zoom:n,pitch:i,bearing:o}))}getZoom(){return this.viewport.zoom}getZoomScale(){return Math.pow(2,this.getZoom())}getCenter(){return[this.viewport.longitude,this.viewport.latitude]}getProjectionMatrix(){return this.viewport.projectionMatrix}getModelMatrix(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}getViewMatrix(){return this.viewport.viewMatrix}getViewMatrixUncentered(){return this.viewport.viewMatrixUncentered}getViewProjectionMatrix(){return this.viewport.viewProjectionMatrix}getViewProjectionMatrixUncentered(){return this.viewport.viewProjectionMatrix}getFocalDistance(){return 1}projectFlat(t,r){return this.viewport.projectFlat(t,r)}}let pq=function(e){return e.GAODE="GAODE",e.MAPBOX="MAPBOX",e.DEFAULT="DEFAUlTMAP",e.SIMPLE="SIMPLE",e.GLOBEL="GLOBEL",e}({});function S1(e={}){const t={top:0,right:0,bottom:0,left:0};if(typeof e=="number")return{top:e,right:e,bottom:e,left:e};if(Array.isArray(e)){if(e.length===4)return{top:e[0],right:e[1],bottom:e[2],left:e[3]};if(e.length===2)return{top:e[0],right:e[1],bottom:e[0],left:e[1]}}return he(he({},t),e)}const _q={normal:"amap://styles/normal",light:"amap://styles/c422f5c0cfced5be9fe3a83f05f28a68?isPublic=true",dark:"amap://styles/c9f1d10cae34f8ab05e425462c5a58d7?isPublic=true",blank:"amap://styles/07c17002b38775b32a7a76c66cf90e99?isPublic=true",fresh:"amap://styles/fresh",grey:"amap://styles/grey",graffiti:"amap://styles/graffiti",macaron:"amap://styles/macaron",darkblue:"amap://styles/darkblue",wine:"amap://styles/wine"},vq=["id","style","minZoom","maxZoom","token","mapInstance","plugin"];function mq(e,t){var r=typeof my<"u"&&!!my&&typeof my.showToast=="function"&&my.isFRM!==!0,n=typeof wx<"u"&&wx!==null&&(typeof wx.request<"u"||typeof wx.miniProgram<"u");if(!(r||n)&&(t||(t=document),!!t)){var i=t.head||t.getElementsByTagName("head")[0];if(!i){i=t.createElement("head");var o=t.body||t.getElementsByTagName("body")[0];o?o.parentNode.insertBefore(i,o):t.documentElement.appendChild(i)}var a=t.createElement("style");return a.type="text/css",a.styleSheet?a.styleSheet.cssText=e:a.appendChild(t.createTextNode(e)),i.appendChild(a),a}}mq(`.amap-logo {
display: none !important;
}
.amap-copyright {
display: none !important;
}
.amap-overlays {
z-index: 3 !important;
}
`);const gq="2.0",x1="f59bcf249433f8b05caaee19f349b3d7",po=1,b1={contextmenu:"rightclick",camerachange:"viewchange"};class Eq extends tq{constructor(...t){super(...t),E(this,"viewport",new dq),E(this,"version",pq.GAODE),E(this,"handleCameraChanged",()=>{const r=this.getViewState();this.updateView(r)})}getType(){return"amap"}init(){var t=this;return ve(function*(){const r=t.config,{id:n,style:i="light",minZoom:o=0,maxZoom:a=24,token:s=x1,mapInstance:u,plugin:l=[]}=r,f=ai(r,vq);if(window.AMap||u||(l.push("Map3D"),yield QZ.load({key:s,version:gq,plugins:l})),u)t.map=u,t.mapContainer=t.map.getContainer(),t.map.on("viewchange",t.handleCameraChanged);else{const c=he({mapStyle:t.getMapStyleValue(i),zooms:[o,a],viewMode:"3D"},f);if(c.zoom&&(c.zoom+=po),s===x1&&(window._AMapSecurityConfig={securityJsCode:"2653011adeb04230b3a26cc9a780a800"},console.warn(`%c${t.configService.getSceneWarninfo("MapToken")}!`,"color: #873bf4;font-weigh:900;font-size: 16px;")),!n)throw Error("No container id specified");window.forceWebGL=!0,t.mapContainer=t.creatMapContainer(n);const h=new AMap.Map(t.mapContainer,c);t.map=h,h.on("viewchange",t.handleCameraChanged)}t.syncInitViewPort()})()}syncInitViewPort(){const t=this.getViewState();this.updateView(t)}getViewState(){const{center:t,zoom:r}=yq(this.map);return{center:t,viewportWidth:this.map.getContainer().clientWidth,viewportHeight:this.map.getContainer().clientHeight,bearing:-this.map.getRotation(),pitch:this.map.getPitch(),zoom:r-po}}creatMapContainer(t){const r=super.creatMapContainer(t),n=document.createElement("div");return n.style.cssText+=`
position: absolute;
top: 0;
height: 100%;
width: 100%;
`,n.id=Sr.uniqueId("l7_amap_div"),r.appendChild(n),n}getContainer(){return this.map.getContainer()}addMarkerContainer(){if(!this.map)return;const t=this.map.getContainer();if(t!==null){const r=t.getElementsByClassName("amap-maps")[0];r.style.zIndex="auto",this.markerContainer=yn("div","l7-marker-container2",r)}}getMarkerContainer(){return this.markerContainer}getCanvasOverlays(){var t;return(t=this.mapContainer)===null||t===void 0?void 0:t.querySelector(".amap-overlays")}on(t,r){Jm.indexOf(t)!==-1?this.eventEmitter.on(t,r):this.map.on(b1[t]||t,r)}off(t,r){Jm.indexOf(t)!==-1?this.eventEmitter.off(t,r):this.map.off(b1[t]||t,r)}getSize(){const t=this.map.getSize();return[t.getWidth(),t.getHeight()]}getMinZoom(){return this.map.getZooms()[0]-po}getMaxZoom(){return this.map.getZooms()[1]-po}getZoom(){return this.map.getZoom()-po}getCenter(t){if(t!=null&&t.padding){const n=this.getCenter(),i=S1(t.padding),o=this.lngLatToPixel([n.lng,n.lat]),a=[(i.right-i.left)/2,(i.bottom-i.top)/2];return this.pixelToLngLat([o.x-a[0],o.y-a[1]])}const r=this.map.getCenter();return{lng:r.getLng(),lat:r.getLat()}}getPitch(){return this.map.getPitch()}getRotation(){return 360-this.map.getRotation()}getBounds(){const t=this.map.getBounds(),r=t.getNorthEast(),n=t.getSouthWest(),i=this.getCenter(),o=i.lng>r.getLng()||i.lng<n.getLng()?180-r.getLng():r.getLng();return[[i.lng<n.getLng()?n.getLng()-180:n.getLng(),n.getLat()],[o,r.getLat()]]}getMapContainer(){return this.mapContainer}getMapCanvasContainer(){var t;return(t=this.map.getContainer())===null||t===void 0?void 0:t.getElementsByClassName("amap-maps")[0]}getMapStyleConfig(){return _q}getMapStyleValue(t){return this.getMapStyleConfig()[t]||t}getMapStyle(){return this.map.getMapStyle()}setMapStyle(t){this.map.setMapStyle(this.getMapStyleValue(t))}setRotation(t){return this.map.setRotation(t)}zoomIn(){this.map.zoomIn()}zoomOut(){this.map.zoomOut()}panTo(t){this.map.panTo(t)}panBy(t=0,r=0){this.map.panBy(t,r)}fitBounds(t){this.map.setBounds(new AMap.Bounds([t[0][0],t[0][1],t[1][0],t[1][1]]),!0)}setZoomAndCenter(t,r){this.map.setZoomAndCenter(t+po,r)}setCenter(t,r){if(r!=null&&r.padding){const n=S1(r.padding),i=this.lngLatToPixel(t),o=[(n.right-n.left)/2,(n.bottom-n.top)/2],a=this.pixelToLngLat([i.x+o[0],i.y+o[1]]);this.map.setCenter([a.lng,a.lat])}else this.map.setCenter(t)}setPitch(t){return this.map.setPitch(t)}setZoom(t){return this.map.setZoom(t+po)}setMaxZoom(t){throw new Error("Method not implemented.")}setMinZoom(t){throw new Error("Method not implemented.")}setMapStatus(t){this.map.setStatus(t)}meterToCoord(t,r){const n=AMap.GeometryUtil.distance(new AMap.LngLat(...t),new AMap.LngLat(...r)),[i,o]=Ph(...t),[a,s]=Ph(...r);return Math.sqrt(Math.pow(i-a,2)+Math.pow(o-s,2))/n}pixelToLngLat(t){const r=this.map.pixelToLngLat(new AMap.Pixel(t[0],t[1]));return{lng:r.getLng(),lat:r.getLat()}}lngLatToPixel(t){const r=this.map.lnglatToPixel(t);return{x:r.getX(),y:r.getY()}}containerToLngLat(t){const r=new AMap.Pixel(t[0],t[1]),n=this.map.containerToLngLat(r);return{lng:n==null?void 0:n.getLng(),lat:n==null?void 0:n.getLat()}}lngLatToContainer(t){const r=this.map.lngLatToContainer(t);return{x:r.getX(),y:r.getY()}}lngLatToMercator([t,r],n){const[i,o]=Ph(t,r);return{x:i,y:o,z:n}}getModelMatrix(t,r,n,i=[1,1,1]){const o=this.viewport.projectFlat(t),a=Up();return mc(a,a,Wn(o[0],o[1],r)),gc(a,a,Wn(i[0],i[1],i[2])),kp(a,a,n[0]),cA(a,a,n[1]),fA(a,a,n[2]),a}exportMap(t){var r;const n=(r=this.getContainer())===null||r===void 0?void 0:r.getElementsByClassName("amap-layer")[0];return t==="jpg"?n==null?void 0:n.toDataURL("image/jpeg"):n==null?void 0:n.toDataURL("image/png")}destroy(){var t;super.destroy(),(t=this.mapContainer)===null||t===void 0||(t=t.parentNode)===null||t===void 0||t.removeChild(this.mapContainer),delete window.initAMap;const r=document.getElementById("amap-script");r&&document.head.removeChild(r),this.map.destroy()}}function yq(e){const t=e._view.getOptions(),r=t.center,n=t.zoom;return{center:r,zoom:n}}class Tq extends qZ{getServiceConstructor(){return Eq}}const R1=Tq;var wn=function(e){return e==null},Aq={}.toString,Sq=function(e,t){return Aq.call(e)==="[object "+t+"]"},xq=function(e,t,r){return e<t?t:e>r?r:e},ya=function(e){return Sq(e,"Number")},op=function(e,t){return op=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},op(e,t)};function sr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");op(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var nr=function(){return nr=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},nr.apply(this,arguments)};function bq(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function Ia(e,t,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(f){try{l(n.next(f))}catch(c){a(c)}}function u(f){try{l(n.throw(f))}catch(c){a(c)}}function l(f){f.done?o(f.value):i(f.value).then(s,u)}l((n=n.apply(e,t||[])).next())})}function Ma(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(l[0]===6&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(f){l=[6,f],i=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Oo(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Xn(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function Vs(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}var JS={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,l,f){this.fn=u,this.context=l,this.once=f||!1}function o(u,l,f,c,h){if(typeof f!="function")throw new TypeError("The listener must be a function");var d=new i(f,c||u,h),p=r?r+l:l;return u._events[p]?u._events[p].fn?u._events[p]=[u._events[p],d]:u._events[p].push(d):(u._events[p]=d,u._eventsCount++),u}function a(u,l){--u._eventsCount===0?u._events=new n:delete u._events[l]}function s(){this._events=new n,this._eventsCount=0}s.prototype.eventNames=function(){var l=[],f,c;if(this._eventsCount===0)return l;for(c in f=this._events)t.call(f,c)&&l.push(r?c.slice(1):c);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(f)):l},s.prototype.listeners=function(l){var f=r?r+l:l,c=this._events[f];if(!c)return[];if(c.fn)return[c.fn];for(var h=0,d=c.length,p=new Array(d);h<d;h++)p[h]=c[h].fn;return p},s.prototype.listenerCount=function(l){var f=r?r+l:l,c=this._events[f];return c?c.fn?1:c.length:0},s.prototype.emit=function(l,f,c,h,d,p){var v=r?r+l:l;if(!this._events[v])return!1;var g=this._events[v],y=arguments.length,S,R;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,f),!0;case 3:return g.fn.call(g.context,f,c),!0;case 4:return g.fn.call(g.context,f,c,h),!0;case 5:return g.fn.call(g.context,f,c,h,d),!0;case 6:return g.fn.call(g.context,f,c,h,d,p),!0}for(R=1,S=new Array(y-1);R<y;R++)S[R-1]=arguments[R];g.fn.apply(g.context,S)}else{var x=g.length,M;for(R=0;R<x;R++)switch(g[R].once&&this.removeListener(l,g[R].fn,void 0,!0),y){case 1:g[R].fn.call(g[R].context);break;case 2:g[R].fn.call(g[R].context,f);break;case 3:g[R].fn.call(g[R].context,f,c);break;case 4:g[R].fn.call(g[R].context,f,c,h);break;default:if(!S)for(M=1,S=new Array(y-1);M<y;M++)S[M-1]=arguments[M];g[R].fn.apply(g[R].context,S)}}return!0},s.prototype.on=function(l,f,c){return o(this,l,f,c,!1)},s.prototype.once=function(l,f,c){return o(this,l,f,c,!0)},s.prototype.removeListener=function(l,f,c,h){var d=r?r+l:l;if(!this._events[d])return this;if(!f)return a(this,d),this;var p=this._events[d];if(p.fn)p.fn===f&&(!h||p.once)&&(!c||p.context===c)&&a(this,d);else{for(var v=0,g=[],y=p.length;v<y;v++)(p[v].fn!==f||h&&!p[v].once||c&&p[v].context!==c)&&g.push(p[v]);g.length?this._events[d]=g.length===1?g[0]:g:a(this,d)}return this},s.prototype.removeAllListeners=function(l){var f;return l?(f=r?r+l:l,this._events[f]&&a(this,f)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s})(JS);var Rq=JS.exports;const ex=Ht(Rq);var w;(function(e){e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.ALWAYS=519]="ALWAYS",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.GEQUAL=518]="GEQUAL",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",e[e.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",e[e.RGBA32F_EXT=34836]="RGBA32F_EXT",e[e.RGB32F_EXT=34837]="RGB32F_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",e[e.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",e[e.MIN_EXT=32775]="MIN_EXT",e[e.MAX_EXT=32776]="MAX_EXT",e[e.SRGB_EXT=35904]="SRGB_EXT",e[e.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",e[e.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",e[e.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",e[e.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",e[e.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",e[e.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",e[e.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",e[e.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",e[e.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",e[e.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",e[e.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",e[e.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",e[e.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",e[e.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",e[e.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",e[e.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",e[e.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",e[e.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",e[e.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",e[e.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",e[e.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",e[e.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",e[e.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",e[e.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",e[e.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",e[e.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",e[e.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",e[e.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",e[e.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",e[e.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",e[e.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",e[e.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",e[e.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",e[e.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",e[e.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",e[e.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",e[e.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT"})(w||(w={}));var Lt;(function(e){e[e.Buffer=0]="Buffer",e[e.Texture=1]="Texture",e[e.RenderTarget=2]="RenderTarget",e[e.Sampler=3]="Sampler",e[e.Program=4]="Program",e[e.Bindings=5]="Bindings",e[e.InputLayout=6]="InputLayout",e[e.RenderPipeline=7]="RenderPipeline",e[e.ComputePipeline=8]="ComputePipeline",e[e.Readback=9]="Readback",e[e.QueryPool=10]="QueryPool",e[e.RenderBundle=11]="RenderBundle"})(Lt||(Lt={}));var kt;(function(e){e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS"})(kt||(kt={}));var Cu;(function(e){e[e.CCW=2305]="CCW",e[e.CW=2304]="CW"})(Cu||(Cu={}));var pn;(function(e){e[e.NONE=0]="NONE",e[e.FRONT=1]="FRONT",e[e.BACK=2]="BACK",e[e.FRONT_AND_BACK=3]="FRONT_AND_BACK"})(pn||(pn={}));var xt;(function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC=768]="SRC",e[e.ONE_MINUS_SRC=769]="ONE_MINUS_SRC",e[e.DST=774]="DST",e[e.ONE_MINUS_DST=775]="ONE_MINUS_DST",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.CONST=32769]="CONST",e[e.ONE_MINUS_CONSTANT=32770]="ONE_MINUS_CONSTANT",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE"})(xt||(xt={}));var wr;(function(e){e[e.ADD=32774]="ADD",e[e.SUBSTRACT=32778]="SUBSTRACT",e[e.REVERSE_SUBSTRACT=32779]="REVERSE_SUBSTRACT",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX"})(wr||(wr={}));var tn;(function(e){e[e.CLAMP_TO_EDGE=0]="CLAMP_TO_EDGE",e[e.REPEAT=1]="REPEAT",e[e.MIRRORED_REPEAT=2]="MIRRORED_REPEAT"})(tn||(tn={}));var lr;(function(e){e[e.POINT=0]="POINT",e[e.BILINEAR=1]="BILINEAR"})(lr||(lr={}));var Or;(function(e){e[e.NO_MIP=0]="NO_MIP",e[e.NEAREST=1]="NEAREST",e[e.LINEAR=2]="LINEAR"})(Or||(Or={}));var gr;(function(e){e[e.POINTS=0]="POINTS",e[e.TRIANGLES=1]="TRIANGLES",e[e.TRIANGLE_STRIP=2]="TRIANGLE_STRIP",e[e.LINES=3]="LINES",e[e.LINE_STRIP=4]="LINE_STRIP"})(gr||(gr={}));var Wt;(function(e){e[e.MAP_READ=1]="MAP_READ",e[e.MAP_WRITE=2]="MAP_WRITE",e[e.COPY_SRC=4]="COPY_SRC",e[e.COPY_DST=8]="COPY_DST",e[e.INDEX=16]="INDEX",e[e.VERTEX=32]="VERTEX",e[e.UNIFORM=64]="UNIFORM",e[e.STORAGE=128]="STORAGE",e[e.INDIRECT=256]="INDIRECT",e[e.QUERY_RESOLVE=512]="QUERY_RESOLVE"})(Wt||(Wt={}));var qn;(function(e){e[e.STATIC=1]="STATIC",e[e.DYNAMIC=2]="DYNAMIC"})(qn||(qn={}));var Io;(function(e){e[e.VERTEX=1]="VERTEX",e[e.INSTANCE=2]="INSTANCE"})(Io||(Io={}));var C1;(function(e){e.LOADED="loaded"})(C1||(C1={}));var bt;(function(e){e[e.TEXTURE_2D=0]="TEXTURE_2D",e[e.TEXTURE_2D_ARRAY=1]="TEXTURE_2D_ARRAY",e[e.TEXTURE_3D=2]="TEXTURE_3D",e[e.TEXTURE_CUBE_MAP=3]="TEXTURE_CUBE_MAP"})(bt||(bt={}));var qr;(function(e){e[e.SAMPLED=1]="SAMPLED",e[e.RENDER_TARGET=2]="RENDER_TARGET",e[e.STORAGE=4]="STORAGE"})(qr||(qr={}));var Lr;(function(e){e[e.NONE=0]="NONE",e[e.RED=1]="RED",e[e.GREEN=2]="GREEN",e[e.BLUE=4]="BLUE",e[e.ALPHA=8]="ALPHA",e[e.RGB=7]="RGB",e[e.ALL=15]="ALL"})(Lr||(Lr={}));var ar;(function(e){e[e.KEEP=7680]="KEEP",e[e.ZERO=0]="ZERO",e[e.REPLACE=7681]="REPLACE",e[e.INVERT=5386]="INVERT",e[e.INCREMENT_CLAMP=7682]="INCREMENT_CLAMP",e[e.DECREMENT_CLAMP=7683]="DECREMENT_CLAMP",e[e.INCREMENT_WRAP=34055]="INCREMENT_WRAP",e[e.DECREMENT_WRAP=34056]="DECREMENT_WRAP"})(ar||(ar={}));var or;(function(e){e[e.Float=0]="Float",e[e.UnfilterableFloat=1]="UnfilterableFloat",e[e.Uint=2]="Uint",e[e.Sint=3]="Sint",e[e.Depth=4]="Depth"})(or||(or={}));var Zn;(function(e){e[e.LOWER_LEFT=0]="LOWER_LEFT",e[e.UPPER_LEFT=1]="UPPER_LEFT"})(Zn||(Zn={}));var Ua;(function(e){e[e.NEGATIVE_ONE=0]="NEGATIVE_ONE",e[e.ZERO=1]="ZERO"})(Ua||(Ua={}));var Uc;(function(e){e[e.OcclusionConservative=0]="OcclusionConservative"})(Uc||(Uc={}));var de;(function(e){e[e.U8=1]="U8",e[e.U16=2]="U16",e[e.U32=3]="U32",e[e.S8=4]="S8",e[e.S16=5]="S16",e[e.S32=6]="S32",e[e.F16=7]="F16",e[e.F32=8]="F32",e[e.BC1=65]="BC1",e[e.BC2=66]="BC2",e[e.BC3=67]="BC3",e[e.BC4_UNORM=68]="BC4_UNORM",e[e.BC4_SNORM=69]="BC4_SNORM",e[e.BC5_UNORM=70]="BC5_UNORM",e[e.BC5_SNORM=71]="BC5_SNORM",e[e.U16_PACKED_5551=97]="U16_PACKED_5551",e[e.U16_PACKED_565=98]="U16_PACKED_565",e[e.D24=129]="D24",e[e.D32F=130]="D32F",e[e.D24S8=131]="D24S8",e[e.D32FS8=132]="D32FS8"})(de||(de={}));var We;(function(e){e[e.R=1]="R",e[e.RG=2]="RG",e[e.RGB=3]="RGB",e[e.RGBA=4]="RGBA",e[e.A=5]="A"})(We||(We={}));var $e;(function(e){e[e.None=0]="None",e[e.Normalized=1]="Normalized",e[e.sRGB=2]="sRGB",e[e.Depth=4]="Depth",e[e.Stencil=8]="Stencil",e[e.RenderTarget=16]="RenderTarget",e[e.Luminance=32]="Luminance"})($e||($e={}));function rt(e,t,r){return e<<16|t<<8|r}var X;(function(e){e[e.ALPHA=rt(de.U8,We.A,$e.None)]="ALPHA",e[e.U8_LUMINANCE=rt(de.U8,We.A,$e.Luminance)]="U8_LUMINANCE",e[e.F16_LUMINANCE=rt(de.F16,We.A,$e.Luminance)]="F16_LUMINANCE",e[e.F32_LUMINANCE=rt(de.F32,We.A,$e.Luminance)]="F32_LUMINANCE",e[e.F16_R=rt(de.F16,We.R,$e.None)]="F16_R",e[e.F16_RG=rt(de.F16,We.RG,$e.None)]="F16_RG",e[e.F16_RGB=rt(de.F16,We.RGB,$e.None)]="F16_RGB",e[e.F16_RGBA=rt(de.F16,We.RGBA,$e.None)]="F16_RGBA",e[e.F32_R=rt(de.F32,We.R,$e.None)]="F32_R",e[e.F32_RG=rt(de.F32,We.RG,$e.None)]="F32_RG",e[e.F32_RGB=rt(de.F32,We.RGB,$e.None)]="F32_RGB",e[e.F32_RGBA=rt(de.F32,We.RGBA,$e.None)]="F32_RGBA",e[e.U8_R=rt(de.U8,We.R,$e.None)]="U8_R",e[e.U8_R_NORM=rt(de.U8,We.R,$e.Normalized)]="U8_R_NORM",e[e.U8_RG=rt(de.U8,We.RG,$e.None)]="U8_RG",e[e.U8_RG_NORM=rt(de.U8,We.RG,$e.Normalized)]="U8_RG_NORM",e[e.U8_RGB=rt(de.U8,We.RGB,$e.None)]="U8_RGB",e[e.U8_RGB_NORM=rt(de.U8,We.RGB,$e.Normalized)]="U8_RGB_NORM",e[e.U8_RGB_SRGB=rt(de.U8,We.RGB,$e.sRGB|$e.Normalized)]="U8_RGB_SRGB",e[e.U8_RGBA=rt(de.U8,We.RGBA,$e.None)]="U8_RGBA",e[e.U8_RGBA_NORM=rt(de.U8,We.RGBA,$e.Normalized)]="U8_RGBA_NORM",e[e.U8_RGBA_SRGB=rt(de.U8,We.RGBA,$e.sRGB|$e.Normalized)]="U8_RGBA_SRGB",e[e.U16_R=rt(de.U16,We.R,$e.None)]="U16_R",e[e.U16_R_NORM=rt(de.U16,We.R,$e.Normalized)]="U16_R_NORM",e[e.U16_RG_NORM=rt(de.U16,We.RG,$e.Normalized)]="U16_RG_NORM",e[e.U16_RGBA_NORM=rt(de.U16,We.RGBA,$e.Normalized)]="U16_RGBA_NORM",e[e.U16_RGBA=rt(de.U16,We.RGBA,$e.None)]="U16_RGBA",e[e.U16_RGB=rt(de.U16,We.RGB,$e.None)]="U16_RGB",e[e.U16_RG=rt(de.U16,We.RG,$e.None)]="U16_RG",e[e.U32_R=rt(de.U32,We.R,$e.None)]="U32_R",e[e.U32_RG=rt(de.U32,We.RG,$e.None)]="U32_RG",e[e.U32_RGB=rt(de.U32,We.RGB,$e.None)]="U32_RGB",e[e.U32_RGBA=rt(de.U32,We.RGBA,$e.None)]="U32_RGBA",e[e.S8_R=rt(de.S8,We.R,$e.None)]="S8_R",e[e.S8_R_NORM=rt(de.S8,We.R,$e.Normalized)]="S8_R_NORM",e[e.S8_RG_NORM=rt(de.S8,We.RG,$e.Normalized)]="S8_RG_NORM",e[e.S8_RGB_NORM=rt(de.S8,We.RGB,$e.Normalized)]="S8_RGB_NORM",e[e.S8_RGBA_NORM=rt(de.S8,We.RGBA,$e.Normalized)]="S8_RGBA_NORM",e[e.S16_R=rt(de.S16,We.R,$e.None)]="S16_R",e[e.S16_RG=rt(de.S16,We.RG,$e.None)]="S16_RG",e[e.S16_RG_NORM=rt(de.S16,We.RG,$e.Normalized)]="S16_RG_NORM",e[e.S16_RGB_NORM=rt(de.S16,We.RGB,$e.Normalized)]="S16_RGB_NORM",e[e.S16_RGBA=rt(de.S16,We.RGBA,$e.None)]="S16_RGBA",e[e.S16_RGBA_NORM=rt(de.S16,We.RGBA,$e.Normalized)]="S16_RGBA_NORM",e[e.S32_R=rt(de.S32,We.R,$e.None)]="S32_R",e[e.S32_RG=rt(de.S32,We.RG,$e.None)]="S32_RG",e[e.S32_RGB=rt(de.S32,We.RGB,$e.None)]="S32_RGB",e[e.S32_RGBA=rt(de.S32,We.RGBA,$e.None)]="S32_RGBA",e[e.U16_RGBA_5551=rt(de.U16_PACKED_5551,We.RGBA,$e.Normalized)]="U16_RGBA_5551",e[e.U16_RGB_565=rt(de.U16_PACKED_565,We.RGB,$e.Normalized)]="U16_RGB_565",e[e.BC1=rt(de.BC1,We.RGBA,$e.Normalized)]="BC1",e[e.BC1_SRGB=rt(de.BC1,We.RGBA,$e.Normalized|$e.sRGB)]="BC1_SRGB",e[e.BC2=rt(de.BC2,We.RGBA,$e.Normalized)]="BC2",e[e.BC2_SRGB=rt(de.BC2,We.RGBA,$e.Normalized|$e.sRGB)]="BC2_SRGB",e[e.BC3=rt(de.BC3,We.RGBA,$e.Normalized)]="BC3",e[e.BC3_SRGB=rt(de.BC3,We.RGBA,$e.Normalized|$e.sRGB)]="BC3_SRGB",e[e.BC4_UNORM=rt(de.BC4_UNORM,We.R,$e.Normalized)]="BC4_UNORM",e[e.BC4_SNORM=rt(de.BC4_SNORM,We.R,$e.Normalized)]="BC4_SNORM",e[e.BC5_UNORM=rt(de.BC5_UNORM,We.RG,$e.Normalized)]="BC5_UNORM",e[e.BC5_SNORM=rt(de.BC5_SNORM,We.RG,$e.Normalized)]="BC5_SNORM",e[e.D24=rt(de.D24,We.R,$e.Depth)]="D24",e[e.D24_S8=rt(de.D24S8,We.RG,$e.Depth|$e.Stencil)]="D24_S8",e[e.D32F=rt(de.D32F,We.R,$e.Depth)]="D32F",e[e.D32F_S8=rt(de.D32FS8,We.RG,$e.Depth|$e.Stencil)]="D32F_S8",e[e.U8_RGB_RT=rt(de.U8,We.RGB,$e.RenderTarget|$e.Normalized)]="U8_RGB_RT",e[e.U8_RGBA_RT=rt(de.U8,We.RGBA,$e.RenderTarget|$e.Normalized)]="U8_RGBA_RT",e[e.U8_RGBA_RT_SRGB=rt(de.U8,We.RGBA,$e.RenderTarget|$e.Normalized|$e.sRGB)]="U8_RGBA_RT_SRGB"})(X||(X={}));function a_(e){return e>>>8&255}function si(e){return e>>>16&255}function ka(e){return e&255}function tx(e){switch(e){case de.F32:case de.U32:case de.S32:return 4;case de.U16:case de.S16:case de.F16:return 2;case de.U8:case de.S8:return 1;default:throw new Error("whoops")}}function rx(e){return tx(si(e))}function Cq(e){var t=tx(si(e)),r=a_(e);return t*r}function nx(e){var t=ka(e);if(t&$e.Depth)return or.Depth;if(t&$e.Normalized)return or.Float;var r=si(e);if(r===de.F16||r===de.F32)return or.Float;if(r===de.U8||r===de.U16||r===de.U32)return or.Uint;if(r===de.S8||r===de.S16||r===de.S32)return or.Sint;throw new Error("whoops")}function ht(e,t){if(t===void 0&&(t=""),!e)throw new Error("Assert fail: ".concat(t))}function Eo(e){if(e!=null)return e;throw new Error("Missing object")}function ix(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}function ox(e,t){e.r=t.r,e.g=t.g,e.b=t.b,e.a=t.a}function ax(e){var t=e.r,r=e.g,n=e.b,i=e.a;return{r:t,g:r,b:n,a:i}}function zu(e,t,r,n){return n===void 0&&(n=1),{r:e,g:t,b:r,a:n}}var vf=zu(0,0,0,0);zu(0,0,0,1);var Oq=zu(1,1,1,0);zu(1,1,1,1);function kc(e){return!!(e&&!(e&e-1))}function Fi(e,t){return e??t}function Iq(e){return e===void 0?null:e}function $c(e,t){var r=t-1;return e+r&~r}function Mq(e,t){for(var r=new Array(e),n=0;n<e;n++)r[n]=t();return r}function Nq(e,t){t===void 0&&(t=1);var r=e.split(`
`);return r.map(function(n,i){return"".concat(Pq(""+(t+i),4," ")," ").concat(n)}).join(`
`)}function Pq(e,t,r){for(;e.length<t;)e="".concat(r).concat(e);return e}function O1(e,t){e.blendDstFactor=t.blendDstFactor,e.blendSrcFactor=t.blendSrcFactor,e.blendMode=t.blendMode}function zc(e,t){return e===void 0&&(e={}),e.compare=t.compare,e.depthFailOp=t.depthFailOp,e.passOp=t.passOp,e.failOp=t.failOp,e.mask=t.mask,e}function sx(e,t){return e===void 0&&(e={rgbBlendState:{},alphaBlendState:{},channelWriteMask:0}),O1(e.rgbBlendState,t.rgbBlendState),O1(e.alphaBlendState,t.alphaBlendState),e.channelWriteMask=t.channelWriteMask,e}function ux(e,t){e.length!==t.length&&(e.length=t.length);for(var r=0;r<t.length;r++)e[r]=sx(e[r],t[r])}function Lq(e,t){t.attachmentsState!==void 0&&ux(e.attachmentsState,t.attachmentsState),e.blendConstant&&t.blendConstant&&ox(e.blendConstant,t.blendConstant),e.depthCompare=Fi(t.depthCompare,e.depthCompare),e.depthWrite=Fi(t.depthWrite,e.depthWrite),e.stencilWrite=Fi(t.stencilWrite,e.stencilWrite),e.stencilFront&&t.stencilFront&&zc(e.stencilFront,t.stencilFront),e.stencilBack&&t.stencilBack&&zc(e.stencilBack,t.stencilBack),e.cullMode=Fi(t.cullMode,e.cullMode),e.frontFace=Fi(t.frontFace,e.frontFace),e.polygonOffset=Fi(t.polygonOffset,e.polygonOffset),e.polygonOffsetFactor=Fi(t.polygonOffsetFactor,e.polygonOffsetFactor),e.polygonOffsetUnits=Fi(t.polygonOffsetUnits,e.polygonOffsetUnits)}function $a(e){var t=Object.assign({},e);return t.attachmentsState=[],ux(t.attachmentsState,e.attachmentsState),t.blendConstant=t.blendConstant&&ax(t.blendConstant),t.stencilFront=zc(void 0,e.stencilFront),t.stencilBack=zc(void 0,e.stencilBack),t}var I1={blendMode:wr.ADD,blendSrcFactor:xt.ONE,blendDstFactor:xt.ZERO},za={attachmentsState:[{channelWriteMask:Lr.ALL,rgbBlendState:I1,alphaBlendState:I1}],blendConstant:ax(vf),depthWrite:!0,depthCompare:kt.LEQUAL,stencilWrite:!1,stencilFront:{compare:kt.ALWAYS,passOp:ar.KEEP,depthFailOp:ar.KEEP,failOp:ar.KEEP},stencilBack:{compare:kt.ALWAYS,passOp:ar.KEEP,depthFailOp:ar.KEEP,failOp:ar.KEEP},cullMode:pn.NONE,frontFace:Cu.CCW,polygonOffset:!1,polygonOffsetFactor:0,polygonOffsetUnits:0};function wq(e,t){e===void 0&&(e=null),t===void 0&&(t=za);var r=$a(t);return e!==null&&Lq(r,e),r}wq({depthCompare:kt.ALWAYS,depthWrite:!1},za);var lx={texture:null,sampler:null,formatKind:or.Float,dimension:bt.TEXTURE_2D};function Hi(e,t,r){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1;return!0}function Ta(e,t){for(var r=Array(e.length),n=0;n<e.length;n++)r[n]=t(e[n]);return r}function Fq(e,t){return e.texture===t.texture&&e.binding===t.binding}function M1(e,t){return e.buffer===t.buffer&&e.size===t.size&&e.binding===t.binding&&e.offset===t.offset}function Bq(e,t){return e===null?t===null:t===null?!1:e.sampler===t.sampler&&e.texture===t.texture&&e.dimension===t.dimension&&e.formatKind===t.formatKind&&e.comparison===t.comparison}function Dq(e,t){return e.samplerBindings=e.samplerBindings||[],e.uniformBufferBindings=e.uniformBufferBindings||[],e.storageBufferBindings=e.storageBufferBindings||[],e.storageTextureBindings=e.storageTextureBindings||[],t.samplerBindings=t.samplerBindings||[],t.uniformBufferBindings=t.uniformBufferBindings||[],t.storageBufferBindings=t.storageBufferBindings||[],t.storageTextureBindings=t.storageTextureBindings||[],!(e.samplerBindings.length!==t.samplerBindings.length||!Hi(e.samplerBindings,t.samplerBindings,Bq)||!Hi(e.uniformBufferBindings,t.uniformBufferBindings,M1)||!Hi(e.storageBufferBindings,t.storageBufferBindings,M1)||!Hi(e.storageTextureBindings,t.storageTextureBindings,Fq))}function N1(e,t){return e.blendMode==t.blendMode&&e.blendSrcFactor===t.blendSrcFactor&&e.blendDstFactor===t.blendDstFactor}function Uq(e,t){return!(!N1(e.rgbBlendState,t.rgbBlendState)||!N1(e.alphaBlendState,t.alphaBlendState)||e.channelWriteMask!==t.channelWriteMask)}function Vc(e,t){return e.compare==t.compare&&e.depthFailOp===t.depthFailOp&&e.failOp===t.failOp&&e.passOp===t.passOp&&e.mask===t.mask}function kq(e,t){return!Hi(e.attachmentsState,t.attachmentsState,Uq)||e.blendConstant&&t.blendConstant&&!ix(e.blendConstant,t.blendConstant)||e.stencilFront&&t.stencilFront&&!Vc(e.stencilFront,t.stencilFront)||e.stencilBack&&t.stencilBack&&!Vc(e.stencilBack,t.stencilBack)?!1:e.depthCompare===t.depthCompare&&e.depthWrite===t.depthWrite&&e.stencilWrite===t.stencilWrite&&e.cullMode===t.cullMode&&e.frontFace===t.frontFace&&e.polygonOffset===t.polygonOffset&&e.polygonOffsetFactor===t.polygonOffsetFactor&&e.polygonOffsetUnits===t.polygonOffsetUnits}function cx(e,t){return e.id===t.id}function $q(e,t){return e===t}function zq(e,t){return!(e.topology!==t.topology||e.inputLayout!==t.inputLayout||e.sampleCount!==t.sampleCount||e.megaStateDescriptor&&t.megaStateDescriptor&&!kq(e.megaStateDescriptor,t.megaStateDescriptor)||!cx(e.program,t.program)||!Hi(e.colorAttachmentFormats,t.colorAttachmentFormats,$q)||e.depthStencilAttachmentFormat!==t.depthStencilAttachmentFormat)}function Vq(e,t){return e.offset===t.offset&&e.shaderLocation===t.shaderLocation&&e.format===t.format&&e.divisor===t.divisor}function Hq(e,t){return wn(e)?wn(t):wn(t)?!1:e.arrayStride===t.arrayStride&&e.stepMode===t.stepMode&&Hi(e.attributes,t.attributes,Vq)}function jq(e,t){return!(e.indexBufferFormat!==t.indexBufferFormat||!Hi(e.vertexBufferDescriptors,t.vertexBufferDescriptors,Hq)||!cx(e.program,t.program))}function Xq(e){var t=e.sampler,r=e.texture,n=e.dimension,i=e.formatKind,o=e.comparison;return{sampler:t,texture:r,dimension:n,formatKind:i,comparison:o}}function P1(e){var t=e.buffer,r=e.size,n=e.binding,i=e.offset;return{binding:n,buffer:t,offset:i,size:r}}function Wq(e){var t=e.binding,r=e.texture;return{binding:t,texture:r}}function Gq(e){var t=e.samplerBindings&&Ta(e.samplerBindings,Xq),r=e.uniformBufferBindings&&Ta(e.uniformBufferBindings,P1),n=e.storageBufferBindings&&Ta(e.storageBufferBindings,P1),i=e.storageTextureBindings&&Ta(e.storageTextureBindings,Wq);return{samplerBindings:t,uniformBufferBindings:r,storageBufferBindings:n,storageTextureBindings:i,pipeline:e.pipeline}}function Yq(e){var t=e.inputLayout,r=e.program,n=e.topology,i=e.megaStateDescriptor&&$a(e.megaStateDescriptor),o=e.colorAttachmentFormats.slice(),a=e.depthStencilAttachmentFormat,s=e.sampleCount;return{inputLayout:t,megaStateDescriptor:i,program:r,topology:n,colorAttachmentFormats:o,depthStencilAttachmentFormat:a,sampleCount:s}}function Zq(e){var t=e.shaderLocation,r=e.format,n=e.offset,i=e.divisor;return{shaderLocation:t,format:r,offset:n,divisor:i}}function qq(e){if(wn(e))return e;var t=e.arrayStride,r=e.stepMode,n=Ta(e.attributes,Zq);return{arrayStride:t,stepMode:r,attributes:n}}function Kq(e){var t=Ta(e.vertexBufferDescriptors,qq),r=e.indexBufferFormat,n=e.program;return{vertexBufferDescriptors:t,indexBufferFormat:r,program:n}}var Ot,Qq=/([^[]*)(\[[0-9]+\])?/;function Jq(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};var t=e.match(Qq);if(!t||t.length<2)throw new Error("Failed to parse GLSL uniform name ".concat(e));return{name:t[1],length:Number(t[2])||1,isArray:!!t[2]}}function en(){var e=null;return function(t,r,n){var i=e!==n;return i&&(t.uniform1i(r,n),e=n),i}}function tr(e,t,r,n){var i=null,o=null;return function(a,s,u){var l=t(u,r),f=l.length,c=!1;if(i===null)i=new Float32Array(f),o=f,c=!0;else{ht(o===f,"Uniform length cannot change.");for(var h=0;h<f;++h)if(l[h]!==i[h]){c=!0;break}}return c&&(n(a,e,s,l),i.set(l)),c}}function Yr(e,t,r,n){e[t](r,n)}function _i(e,t,r,n){e[t](r,!1,n)}var eK={},tK={},rK={},L1=[0];function s_(e,t,r,n){t===1&&typeof e=="boolean"&&(e=e?1:0),Number.isFinite(e)&&(L1[0]=e,e=L1);var i=e.length;if(e instanceof r)return e;var o=n[i];o||(o=new r(i),n[i]=o);for(var a=0;a<i;a++)o[a]=e[a];return o}function gn(e,t){return s_(e,t,Float32Array,eK)}function Bi(e,t){return s_(e,t,Int32Array,tK)}function $l(e,t){return s_(e,t,Uint32Array,rK)}var nK=(Ot={},Ot[w.FLOAT]=tr.bind(null,"uniform1fv",gn,1,Yr),Ot[w.FLOAT_VEC2]=tr.bind(null,"uniform2fv",gn,2,Yr),Ot[w.FLOAT_VEC3]=tr.bind(null,"uniform3fv",gn,3,Yr),Ot[w.FLOAT_VEC4]=tr.bind(null,"uniform4fv",gn,4,Yr),Ot[w.INT]=tr.bind(null,"uniform1iv",Bi,1,Yr),Ot[w.INT_VEC2]=tr.bind(null,"uniform2iv",Bi,2,Yr),Ot[w.INT_VEC3]=tr.bind(null,"uniform3iv",Bi,3,Yr),Ot[w.INT_VEC4]=tr.bind(null,"uniform4iv",Bi,4,Yr),Ot[w.BOOL]=tr.bind(null,"uniform1iv",Bi,1,Yr),Ot[w.BOOL_VEC2]=tr.bind(null,"uniform2iv",Bi,2,Yr),Ot[w.BOOL_VEC3]=tr.bind(null,"uniform3iv",Bi,3,Yr),Ot[w.BOOL_VEC4]=tr.bind(null,"uniform4iv",Bi,4,Yr),Ot[w.FLOAT_MAT2]=tr.bind(null,"uniformMatrix2fv",gn,4,_i),Ot[w.FLOAT_MAT3]=tr.bind(null,"uniformMatrix3fv",gn,9,_i),Ot[w.FLOAT_MAT4]=tr.bind(null,"uniformMatrix4fv",gn,16,_i),Ot[w.UNSIGNED_INT]=tr.bind(null,"uniform1uiv",$l,1,Yr),Ot[w.UNSIGNED_INT_VEC2]=tr.bind(null,"uniform2uiv",$l,2,Yr),Ot[w.UNSIGNED_INT_VEC3]=tr.bind(null,"uniform3uiv",$l,3,Yr),Ot[w.UNSIGNED_INT_VEC4]=tr.bind(null,"uniform4uiv",$l,4,Yr),Ot[w.FLOAT_MAT2x3]=tr.bind(null,"uniformMatrix2x3fv",gn,6,_i),Ot[w.FLOAT_MAT2x4]=tr.bind(null,"uniformMatrix2x4fv",gn,8,_i),Ot[w.FLOAT_MAT3x2]=tr.bind(null,"uniformMatrix3x2fv",gn,6,_i),Ot[w.FLOAT_MAT3x4]=tr.bind(null,"uniformMatrix3x4fv",gn,12,_i),Ot[w.FLOAT_MAT4x2]=tr.bind(null,"uniformMatrix4x2fv",gn,8,_i),Ot[w.FLOAT_MAT4x3]=tr.bind(null,"uniformMatrix4x3fv",gn,12,_i),Ot[w.SAMPLER_2D]=en,Ot[w.SAMPLER_CUBE]=en,Ot[w.SAMPLER_3D]=en,Ot[w.SAMPLER_2D_SHADOW]=en,Ot[w.SAMPLER_2D_ARRAY]=en,Ot[w.SAMPLER_2D_ARRAY_SHADOW]=en,Ot[w.SAMPLER_CUBE_SHADOW]=en,Ot[w.INT_SAMPLER_2D]=en,Ot[w.INT_SAMPLER_3D]=en,Ot[w.INT_SAMPLER_CUBE]=en,Ot[w.INT_SAMPLER_2D_ARRAY]=en,Ot[w.UNSIGNED_INT_SAMPLER_2D]=en,Ot[w.UNSIGNED_INT_SAMPLER_3D]=en,Ot[w.UNSIGNED_INT_SAMPLER_CUBE]=en,Ot[w.UNSIGNED_INT_SAMPLER_2D_ARRAY]=en,Ot);function w1(e,t,r){var n=nK[r.type];if(!n)throw new Error("Unknown GLSL uniform type ".concat(r.type));return n().bind(null,e,t)}var iK={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121};function oK(e){return Object.prototype.toString.call(e)in iK}function Hs(e,t){return"#define ".concat(e," ").concat(t)}function aK(e){var t={};return e.replace(/^\s*#define\s*(\S*)\s*(\S*)\s*$/gm,function(r,n,i){var o=Number(i);return t[n]=isNaN(o)?i:o,""}),t}function sK(e,t){var r=[];return e.replace(/^\s*layout\(location\s*=\s*(\S*)\)\s*in\s+\S+\s*(.*);$/gm,function(n,i,o){var a=Number(i);return r.push({location:isNaN(a)?t[i]:a,name:o}),""}),r}function F1(e){if(e===void 0)return null;var t=/binding\s*=\s*(\d+)/.exec(e);if(t!==null){var r=parseInt(t[1],10);if(!Number.isNaN(r))return r}return null}function B1(e){var t="",r=e;return[r,t]}function Va(e,t,r,n,i){var o;n===void 0&&(n=null),i===void 0&&(i=!0);var a=e.glslVersion==="#version 100",s=t==="frag"&&((o=r.match(/^\s*layout\(location\s*=\s*\d*\)\s*out\s+vec4\s*(.*);$/gm))===null||o===void 0?void 0:o.length)>1,u=r.replace(`\r
`,`
`).split(`
`).map(function($){return $.replace(/[/][/].*$/,"")}).filter(function($){var F=!$||/^\s+$/.test($);return!F}),l="";n!==null&&(l=Object.keys(n).map(function($){return Hs($,n[$])}).join(`
`));var f=u.find(function($){return $.startsWith("precision")})||"precision mediump float;",c=i?u.filter(function($){return!$.startsWith("precision")}).join(`
`):u.join(`
`),h="";if(e.viewportOrigin===Zn.UPPER_LEFT&&(h+="".concat(Hs("VIEWPORT_ORIGIN_TL","1"),`
`)),e.clipSpaceNearZ===Ua.ZERO&&(h+="".concat(Hs("CLIPSPACE_NEAR_ZERO","1"),`
`)),e.explicitBindingLocations){var d=0,p=0,v=0;c=c.replace(/^\s*(layout\((.*)\))?\s*uniform(.+{)$/gm,function($,F,Y,ge){var q=Y?"".concat(Y,", "):"";return"layout(".concat(q,"set = ").concat(d,", binding = ").concat(p++,") uniform ").concat(ge)}),d++,p=0,ht(e.separateSamplerTextures),c=c.replace(/^\s*(layout\((.*)\))?\s*uniform sampler(\w+) (.*);/gm,function($,F,Y,ge,q){var k=F1(Y);k===null&&(k=p++);var G=Xn(B1(ge),2),K=G[0],ce=G[1];return t==="frag"?`
layout(set = `.concat(d,", binding = ").concat(k*2+0,") uniform texture").concat(K," T_").concat(q,`;
layout(set = `).concat(d,", binding = ").concat(k*2+1,") uniform sampler").concat(ce," S_").concat(q,";").trim():""}),c=c.replace(t==="frag"?/^\s*\b(varying|in)\b/gm:/^\s*\b(varying|out)\b/gm,function($,F){return"layout(location = ".concat(v++,") ").concat(F)}),h+="".concat(Hs("gl_VertexID","gl_VertexIndex"),`
`),h+="".concat(Hs("gl_InstanceID","gl_InstanceIndex"),`
`),f=f.replace(/^precision (.*) sampler(.*);$/gm,"")}else{var g=0;c=c.replace(/^\s*(layout\((.*)\))?\s*uniform sampler(\w+) (.*);/gm,function($,F,Y,ge,q){var k=F1(Y);return k===null&&(k=g++),"uniform sampler".concat(ge," ").concat(q,"; // BINDING=").concat(k)})}if(c=c.replace(/\bPU_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"SAMPLER_".concat(F,"(P_").concat(Y,")")}),c=c.replace(/\bPF_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"PP_SAMPLER_".concat(F,"(P_").concat(Y,")")}),c=c.replace(/\bPU_TEXTURE\((.*?)\)/g,function($,F){return"TEXTURE(P_".concat(F,")")}),e.separateSamplerTextures)c=c.replace(/\bPD_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){var ge=Xn(B1(F),2),q=ge[0],k=ge[1];return"texture".concat(q," T_P_").concat(Y,", sampler").concat(k," S_P_").concat(Y)}),c=c.replace(/\bPP_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"T_".concat(Y,", S_").concat(Y)}),c=c.replace(/\bSAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"sampler".concat(F,"(T_").concat(Y,", S_").concat(Y,")")}),c=c.replace(/\bTEXTURE\((.*?)\)/g,function($,F){return"T_".concat(F)});else{var y=[];c=c.replace(/\bPD_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"sampler".concat(F," P_").concat(Y)}),c=c.replace(/\bPP_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return Y}),c=c.replace(/\bSAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return y.push([Y,F]),Y}),a&&y.forEach(function($){var F=Xn($,2),Y=F[0],ge=F[1];c=c.replace(new RegExp("texture\\(".concat(Y),"g"),function(){return"texture".concat(ge,"(").concat(Y)})}),c=c.replace(/\bTEXTURE\((.*?)\)/g,function($,F){return F})}var S="".concat(a?"":e.glslVersion,`
`).concat(a&&s?`#extension GL_EXT_draw_buffers : require
`:"",`
`).concat(a&&t==="frag"?`#extension GL_OES_standard_derivatives : enable
`:"").concat(i?f:"",`
`).concat(h||"").concat(l?l+`
`:"",`
`).concat(c,`
`).trim();if(e.explicitBindingLocations&&t==="frag"&&(S=S.replace(/^\b(out)\b/g,function($,F){return"layout(location = 0) ".concat(F)})),a){if(t==="frag"&&(S=S.replace(/^\s*in\s+(\S+)\s*(.*);$/gm,function($,F,Y){return"varying ".concat(F," ").concat(Y,`;
`)})),t==="vert"&&(S=S.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,function($,F,Y){return"varying ".concat(F," ").concat(Y,`;
`)}),S=S.replace(/^\s*layout\(location\s*=\s*\S*\)\s*in\s+(\S+)\s*(.*);$/gm,function($,F,Y){return"attribute ".concat(F," ").concat(Y,`;
`)})),S=S.replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,function($,F){return F.trim().replace(/^.*$/gm,function(Y){var ge=Y.trim();return ge.startsWith("#")?ge:Y?"uniform ".concat(ge):""})}),t==="frag")if(s){var R=[];S=S.replace(/^\s*layout\(location\s*=\s*\d*\)\s*out\s+vec4\s*(.*);$/gm,function($,F){return R.push(F),"vec4 ".concat(F,`;
`)});var x=S.lastIndexOf("}");S=S.substring(0,x)+`
`.concat(R.map(function($,F){return"gl_FragData[".concat(F,"] = ").concat($,`;
`)}).join(`
`))+S.substring(x)}else{var M;if(S=S.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,function($,F,Y){return M=Y,"".concat(F," ").concat(Y,`;
`)}),M){var x=S.lastIndexOf("}");S=S.substring(0,x)+`
gl_FragColor = vec4(`.concat(M,`);
`)+S.substring(x)}}S=S.replace(/^\s*layout\((.*)\)/gm,"")}return S}var kn=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=e.call(this)||this;return o.id=n,o.device=i,o.device.resourceCreationTracker!==null&&o.device.resourceCreationTracker.trackResourceCreated(o),o}return t.prototype.destroy=function(){this.device.resourceCreationTracker!==null&&this.device.resourceCreationTracker.trackResourceDestroyed(this)},t}(ex),uK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.Bindings;var s=o.uniformBufferBindings,u=o.samplerBindings;return a.uniformBufferBindings=s||[],a.samplerBindings=u||[],a.bindingLayouts=a.createBindingLayouts(),a}return t.prototype.createBindingLayouts=function(){var r=0,n=0,i=[],o=this.uniformBufferBindings.length,a=this.samplerBindings.length;return i.push({firstUniformBuffer:r,numUniformBuffers:o,firstSampler:n,numSamplers:a}),r+=o,n+=a,{numUniformBuffers:r,numSamplers:n,bindingLayoutTables:i}},t}(kn);function Ye(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:!!(e&&e._version===2)}function fx(e){var t=si(e);switch(t){case de.BC1:case de.BC2:case de.BC3:case de.BC4_UNORM:case de.BC4_SNORM:case de.BC5_UNORM:case de.BC5_SNORM:return!0;default:return!1}}function hx(e){var t=ka(e);if(t&$e.Normalized)return!1;var r=si(e);return r===de.S8||r===de.S16||r===de.S32||r===de.U8||r===de.U16||r===de.U32}function lK(e){switch(e){case qn.STATIC:return w.STATIC_DRAW;case qn.DYNAMIC:return w.DYNAMIC_DRAW}}function D1(e){if(e&Wt.INDEX)return w.ELEMENT_ARRAY_BUFFER;if(e&Wt.VERTEX)return w.ARRAY_BUFFER;if(e&Wt.UNIFORM)return w.UNIFORM_BUFFER}function cK(e){switch(e){case gr.TRIANGLES:return w.TRIANGLES;case gr.POINTS:return w.POINTS;case gr.TRIANGLE_STRIP:return w.TRIANGLE_STRIP;case gr.LINES:return w.LINES;case gr.LINE_STRIP:return w.LINE_STRIP;default:throw new Error("Unknown primitive topology mode")}}function fK(e){switch(e){case de.U8:return w.UNSIGNED_BYTE;case de.U16:return w.UNSIGNED_SHORT;case de.U32:return w.UNSIGNED_INT;case de.S8:return w.BYTE;case de.S16:return w.SHORT;case de.S32:return w.INT;case de.F16:return w.HALF_FLOAT;case de.F32:return w.FLOAT;default:throw new Error("whoops")}}function hK(e){switch(e){case We.R:return 1;case We.RG:return 2;case We.RGB:return 3;case We.RGBA:return 4;default:return 1}}function dK(e){var t=si(e),r=a_(e),n=ka(e),i=fK(t),o=hK(r),a=!!(n&$e.Normalized);return{size:o,type:i,normalized:a}}function pK(e){switch(e){case X.U8_R:return w.UNSIGNED_BYTE;case X.U16_R:return w.UNSIGNED_SHORT;case X.U32_R:return w.UNSIGNED_INT;default:throw new Error("whoops")}}function js(e){switch(e){case tn.CLAMP_TO_EDGE:return w.CLAMP_TO_EDGE;case tn.REPEAT:return w.REPEAT;case tn.MIRRORED_REPEAT:return w.MIRRORED_REPEAT;default:throw new Error("whoops")}}function zl(e,t){if(t===Or.LINEAR&&e===lr.BILINEAR)return w.LINEAR_MIPMAP_LINEAR;if(t===Or.LINEAR&&e===lr.POINT)return w.NEAREST_MIPMAP_LINEAR;if(t===Or.NEAREST&&e===lr.BILINEAR)return w.LINEAR_MIPMAP_NEAREST;if(t===Or.NEAREST&&e===lr.POINT)return w.NEAREST_MIPMAP_NEAREST;if(t===Or.NO_MIP&&e===lr.BILINEAR)return w.LINEAR;if(t===Or.NO_MIP&&e===lr.POINT)return w.NEAREST;throw new Error("Unknown texture filter mode")}function Na(e,t){t===void 0&&(t=0);var r=e;return r.gl_buffer_pages[t/r.pageByteSize|0]}function ga(e){var t=e;return t.gl_texture}function ap(e){var t=e;return t.gl_sampler}function Xs(e,t){e.name=t,e.__SPECTOR_Metadata={name:t}}function U1(e,t){for(var r=[];;){var n=t.exec(e);if(!n)break;r.push(n)}return r}function Di(e){return e.blendMode==wr.ADD&&e.blendSrcFactor==xt.ONE&&e.blendDstFactor===xt.ZERO}function _K(e){switch(e){case Uc.OcclusionConservative:return w.ANY_SAMPLES_PASSED_CONSERVATIVE;default:throw new Error("whoops")}}function vK(e){if(e===bt.TEXTURE_2D)return w.TEXTURE_2D;if(e===bt.TEXTURE_2D_ARRAY)return w.TEXTURE_2D_ARRAY;if(e===bt.TEXTURE_CUBE_MAP)return w.TEXTURE_CUBE_MAP;if(e===bt.TEXTURE_3D)return w.TEXTURE_3D;throw new Error("whoops")}function rd(e,t,r,n){return!(e%r!==0||t%n!==0)}var mK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.Buffer;var s=o.viewOrSize,u=o.usage,l=o.hint,f=l===void 0?qn.STATIC:l,c=i.uniformBufferMaxPageByteSize,h=i.gl,d=u&Wt.UNIFORM;d||(Ye(h)?h.bindVertexArray(null):i.OES_vertex_array_object.bindVertexArrayOES(null));var p=ya(s)?$c(s,4):$c(s.byteLength,4);a.gl_buffer_pages=[];var v;if(d){for(var g=p;g>0;)a.gl_buffer_pages.push(a.createBufferPage(Math.min(g,c),u,f)),g-=c;v=c}else a.gl_buffer_pages.push(a.createBufferPage(p,u,f)),v=p;return a.pageByteSize=v,a.byteSize=p,a.usage=u,a.gl_target=D1(u),ya(s)||a.setSubData(0,new Uint8Array(s.buffer)),d||(Ye(h)?h.bindVertexArray(a.device.currentBoundVAO):i.OES_vertex_array_object.bindVertexArrayOES(a.device.currentBoundVAO)),a}return t.prototype.setSubData=function(r,n,i,o){i===void 0&&(i=0),o===void 0&&(o=n.byteLength-i);for(var a=this.device.gl,s=this.pageByteSize,u=r+o,l=r,f=r%s;l<u;){var c=Ye(a)?a.COPY_WRITE_BUFFER:this.gl_target,h=Na(this,l);if(h.ubo)return;a.bindBuffer(c,h),Ye(a)?a.bufferSubData(c,f,n,i,Math.min(u-l,s)):a.bufferSubData(c,f,n),l+=s,f=0,i+=s,this.device.debugGroupStatisticsBufferUpload()}},t.prototype.destroy=function(){e.prototype.destroy.call(this);for(var r=0;r<this.gl_buffer_pages.length;r++)this.gl_buffer_pages[r].ubo||this.device.gl.deleteBuffer(this.gl_buffer_pages[r]);this.gl_buffer_pages=[]},t.prototype.createBufferPage=function(r,n,i){var o=this.device.gl,a=n&Wt.UNIFORM;if(!Ye(o)&&a)return{ubo:!0};var s=this.device.ensureResourceExists(o.createBuffer()),u=D1(n),l=lK(i);return o.bindBuffer(u,s),o.bufferData(u,r,l),s},t}(kn),gK=function(e){sr(t,e);function t(r){var n,i,o,a,s=r.id,u=r.device,l=r.descriptor,f,c=e.call(this,{id:s,device:u})||this;c.type=Lt.InputLayout;var h=l.vertexBufferDescriptors,d=l.indexBufferFormat,p=l.program;ht(d===X.U16_R||d===X.U32_R||d===null);var v=d!==null?pK(d):null,g=d!==null?rx(d):null,y=c.device.gl,S=c.device.ensureResourceExists(Ye(y)?y.createVertexArray():u.OES_vertex_array_object.createVertexArrayOES());Ye(y)?y.bindVertexArray(S):u.OES_vertex_array_object.bindVertexArrayOES(S),y.bindBuffer(y.ARRAY_BUFFER,Na(c.device.fallbackVertexBuffer));try{for(var R=Oo(l.vertexBufferDescriptors),x=R.next();!x.done;x=R.next()){var M=x.value,$=M.stepMode,F=M.attributes;try{for(var Y=(o=void 0,Oo(F)),ge=Y.next();!ge.done;ge=Y.next()){var q=ge.value,k=q.shaderLocation,G=q.format,K=q.divisor,ce=K===void 0?1:K,Pe=Ye(y)?k:(f=p.attributes[k])===null||f===void 0?void 0:f.location,Xe=dK(G);if(q.vertexFormat=Xe,!wn(Pe)){hx(G);var Je=Xe.size,ft=Xe.type,Ge=Xe.normalized;y.vertexAttribPointer(Pe,Je,ft,Ge,0,0),$===Io.INSTANCE&&(Ye(y)?y.vertexAttribDivisor(Pe,ce):u.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(Pe,ce)),y.enableVertexAttribArray(Pe)}}}catch(et){o={error:et}}finally{try{ge&&!ge.done&&(a=Y.return)&&a.call(Y)}finally{if(o)throw o.error}}}}catch(et){n={error:et}}finally{try{x&&!x.done&&(i=R.return)&&i.call(R)}finally{if(n)throw n.error}}return Ye(y)?y.bindVertexArray(null):u.OES_vertex_array_object.bindVertexArrayOES(null),c.vertexBufferDescriptors=h,c.vao=S,c.indexBufferFormat=d,c.indexBufferType=v,c.indexBufferCompByteSize=g,c.program=p,c}return t.prototype.destroy=function(){e.prototype.destroy.call(this),this.device.currentBoundVAO===this.vao&&(Ye(this.device.gl)?(this.device.gl.bindVertexArray(null),this.device.gl.deleteVertexArray(this.vao)):(this.device.OES_vertex_array_object.bindVertexArrayOES(null),this.device.OES_vertex_array_object.deleteVertexArrayOES(this.vao)),this.device.currentBoundVAO=null)},t}(kn),sp=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=r.fake,s=e.call(this,{id:n,device:i})||this;s.type=Lt.Texture,o=nr({dimension:bt.TEXTURE_2D,depthOrArrayLayers:1,mipLevelCount:1},o);var u=s.device.gl,l,f,c=s.clampmipLevelCount(o);if(s.immutable=o.usage===qr.RENDER_TARGET,s.pixelStore=o.pixelStore,s.format=o.format,s.dimension=o.dimension,s.formatKind=nx(o.format),s.width=o.width,s.height=o.height,s.depthOrArrayLayers=o.depthOrArrayLayers,s.mipmaps=c>=1,!a){f=s.device.ensureResourceExists(u.createTexture());var h=s.device.translateTextureType(o.format),d=s.device.translateTextureInternalFormat(o.format);if(s.device.setActiveTexture(u.TEXTURE0),s.device.currentTextures[0]=null,s.preprocessImage(),o.dimension===bt.TEXTURE_2D){if(l=w.TEXTURE_2D,u.bindTexture(l,f),s.immutable)if(Ye(u))u.texStorage2D(l,c,d,o.width,o.height);else{var p=(d===w.DEPTH_COMPONENT||s.isNPOT(),0);(s.format===X.D32F||s.format===X.D24_S8)&&!Ye(u)&&!i.WEBGL_depth_texture||(u.texImage2D(l,p,d,o.width,o.height,0,d,h,null),s.mipmaps&&(s.mipmaps=!1,u.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.LINEAR),u.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,w.CLAMP_TO_EDGE),u.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,w.CLAMP_TO_EDGE)))}ht(o.depthOrArrayLayers===1)}else if(o.dimension===bt.TEXTURE_2D_ARRAY)l=w.TEXTURE_2D_ARRAY,u.bindTexture(l,f),s.immutable&&Ye(u)&&u.texStorage3D(l,c,d,o.width,o.height,o.depthOrArrayLayers);else if(o.dimension===bt.TEXTURE_3D)l=w.TEXTURE_3D,u.bindTexture(l,f),s.immutable&&Ye(u)&&u.texStorage3D(l,c,d,o.width,o.height,o.depthOrArrayLayers);else if(o.dimension===bt.TEXTURE_CUBE_MAP)l=w.TEXTURE_CUBE_MAP,u.bindTexture(l,f),s.immutable&&Ye(u)&&u.texStorage2D(l,c,d,o.width,o.height),ht(o.depthOrArrayLayers===6);else throw new Error("whoops")}return s.gl_texture=f,s.gl_target=l,s.mipLevelCount=c,s}return t.prototype.setImageData=function(r,n){n===void 0&&(n=0);var i=this.device.gl;fx(this.format);var o=this.gl_target===w.TEXTURE_3D||this.gl_target===w.TEXTURE_2D_ARRAY,a=this.gl_target===w.TEXTURE_CUBE_MAP,s=oK(r[0]);this.device.setActiveTexture(i.TEXTURE0),this.device.currentTextures[0]=null;var u=r[0],l,f;s?(l=this.width,f=this.height):(l=u.width,f=u.height,this.width=l,this.height=f),i.bindTexture(this.gl_target,this.gl_texture);var c=this.device.translateTextureFormat(this.format),h=Ye(i)?this.device.translateInternalTextureFormat(this.format):c,d=this.device.translateTextureType(this.format);this.preprocessImage();for(var p=0;p<this.depthOrArrayLayers;p++){var v=r[p],g=this.gl_target;a&&(g=w.TEXTURE_CUBE_MAP_POSITIVE_X+p%6),this.immutable?i.texSubImage2D(g,n,0,0,l,f,c,d,v):Ye(i)?o?i.texImage3D(g,n,h,l,f,this.depthOrArrayLayers,0,c,d,v):i.texImage2D(g,n,h,l,f,0,c,d,v):s?i.texImage2D(g,n,c,l,f,0,c,d,v):i.texImage2D(g,n,c,c,d,v)}this.mipmaps&&this.generateMipmap(o)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.device.gl.deleteTexture(ga(this))},t.prototype.clampmipLevelCount=function(r){if(r.dimension===bt.TEXTURE_2D_ARRAY&&r.depthOrArrayLayers>1){var n=si(r.format);if(n===de.BC1)for(var i=r.width,o=r.height,a=0;a<r.mipLevelCount;a++){if(i<=2||o<=2)return a-1;i=Math.max(i/2|0,1),o=Math.max(o/2|0,1)}}return r.mipLevelCount},t.prototype.preprocessImage=function(){var r=this.device.gl;this.pixelStore&&(this.pixelStore.unpackFlipY&&r.pixelStorei(w.UNPACK_FLIP_Y_WEBGL,!0),this.pixelStore.packAlignment&&r.pixelStorei(w.PACK_ALIGNMENT,this.pixelStore.packAlignment),this.pixelStore.unpackAlignment&&r.pixelStorei(w.UNPACK_ALIGNMENT,this.pixelStore.unpackAlignment))},t.prototype.generateMipmap=function(r){r===void 0&&(r=!1);var n=this.device.gl;return!Ye(n)&&this.isNPOT()?this:(this.gl_texture&&this.gl_target&&(n.bindTexture(this.gl_target,this.gl_texture),r?(n.texParameteri(this.gl_target,w.TEXTURE_BASE_LEVEL,0),n.texParameteri(this.gl_target,w.TEXTURE_MAX_LEVEL,Math.log2(this.width)),n.texParameteri(this.gl_target,w.TEXTURE_MIN_FILTER,w.LINEAR_MIPMAP_LINEAR),n.texParameteri(this.gl_target,w.TEXTURE_MAG_FILTER,w.LINEAR)):n.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.NEAREST_MIPMAP_LINEAR),n.generateMipmap(this.gl_target),n.bindTexture(this.gl_target,null)),this)},t.prototype.isNPOT=function(){var r=this.device.gl;return Ye(r)?!1:!kc(this.width)||!kc(this.height)},t}(kn),EK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.RenderTarget,a.gl_renderbuffer=null,a.texture=null;var s=a.device.gl,u=o.format,l=o.width,f=o.height,c=o.sampleCount,h=c===void 0?1:c,d=o.texture,p=!1;if((u===X.D32F||u===X.D24_S8)&&d&&!Ye(s)&&!i.WEBGL_depth_texture&&(d.destroy(),a.texture=null,p=!0),!p&&d)a.texture=d;else{a.gl_renderbuffer=a.device.ensureResourceExists(s.createRenderbuffer()),s.bindRenderbuffer(s.RENDERBUFFER,a.gl_renderbuffer);var v=a.device.translateTextureInternalFormat(u,!0);Ye(s)&&h>1?s.renderbufferStorageMultisample(w.RENDERBUFFER,h,v,l,f):s.renderbufferStorage(w.RENDERBUFFER,v,l,f)}return a.format=u,a.width=l,a.height=f,a.sampleCount=h,a}return t.prototype.destroy=function(){e.prototype.destroy.call(this),this.gl_renderbuffer!==null&&this.device.gl.deleteRenderbuffer(this.gl_renderbuffer),this.texture&&this.texture.destroy()},t}(kn),fn;(function(e){e[e.NeedsCompile=0]="NeedsCompile",e[e.Compiling=1]="Compiling",e[e.NeedsBind=2]="NeedsBind",e[e.ReadyToUse=3]="ReadyToUse"})(fn||(fn={}));var yK=function(e){sr(t,e);function t(r,n){var i=r.id,o=r.device,a=r.descriptor,s=e.call(this,{id:i,device:o})||this;s.rawVertexGLSL=n,s.type=Lt.Program,s.uniformSetters={},s.attributes=[];var u=s.device.gl;return s.descriptor=a,s.gl_program=s.device.ensureResourceExists(u.createProgram()),s.gl_shader_vert=null,s.gl_shader_frag=null,s.compileState=fn.NeedsCompile,s.tryCompileProgram(),s}return t.prototype.destroy=function(){e.prototype.destroy.call(this),this.device.gl.deleteProgram(this.gl_program),this.device.gl.deleteShader(this.gl_shader_vert),this.device.gl.deleteShader(this.gl_shader_frag)},t.prototype.tryCompileProgram=function(){ht(this.compileState===fn.NeedsCompile);var r=this.descriptor,n=r.vertex,i=r.fragment,o=this.device.gl;n!=null&&n.glsl&&(i!=null&&i.glsl)&&(this.gl_shader_vert=this.compileShader(n.postprocess?n.postprocess(n.glsl):n.glsl,o.VERTEX_SHADER),this.gl_shader_frag=this.compileShader(i.postprocess?i.postprocess(i.glsl):i.glsl,o.FRAGMENT_SHADER),o.attachShader(this.gl_program,this.gl_shader_vert),o.attachShader(this.gl_program,this.gl_shader_frag),o.linkProgram(this.gl_program),this.compileState=fn.Compiling,Ye(o)||(this.readUniformLocationsFromLinkedProgram(),this.readAttributesFromLinkedProgram()))},t.prototype.readAttributesFromLinkedProgram=function(){for(var r,n=this.device.gl,i=n.getProgramParameter(this.gl_program,n.ACTIVE_ATTRIBUTES),o=aK(this.descriptor.vertex.glsl),a=sK(this.rawVertexGLSL,o),s=function(f){var c=n.getActiveAttrib(u.gl_program,f),h=c.name,d=c.type,p=c.size,v=n.getAttribLocation(u.gl_program,h),g=(r=a.find(function(y){return y.name===h}))===null||r===void 0?void 0:r.location;v>=0&&!wn(g)&&(u.attributes[g]={name:h,location:v,type:d,size:p})},u=this,l=0;l<i;l++)s(l)},t.prototype.readUniformLocationsFromLinkedProgram=function(){for(var r=this.device.gl,n=r.getProgramParameter(this.gl_program,r.ACTIVE_UNIFORMS),i=0;i<n;i++){var o=r.getActiveUniform(this.gl_program,i),a=Jq(o.name).name,s=r.getUniformLocation(this.gl_program,a);if(this.uniformSetters[a]=w1(r,s,o),o&&o.size>1)for(var u=0;u<o.size;u++)s=r.getUniformLocation(this.gl_program,"".concat(a,"[").concat(u,"]")),this.uniformSetters["".concat(a,"[").concat(u,"]")]=w1(r,s,o)}},t.prototype.compileShader=function(r,n){var i=this.device.gl,o=this.device.ensureResourceExists(i.createShader(n));return i.shaderSource(o,r),i.compileShader(o),o},t.prototype.setUniformsLegacy=function(r){r===void 0&&(r={});var n=this.device.gl;if(!Ye(n)){var i=!1;for(var o in r){i||(n.useProgram(this.gl_program),i=!0);var a=r[o],s=this.uniformSetters[o];if(s){var u=a;u instanceof sp&&(u=u.textureIndex),s(u)}}}return this},t}(kn),TK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.QueryPool;var s=a.device.gl;if(Ye(s)){var u=o.elemCount,l=o.type;a.gl_query=Mq(u,function(){return a.device.ensureResourceExists(s.createQuery())}),a.gl_query_type=_K(l)}return a}return t.prototype.queryResultOcclusion=function(r){var n=this.device.gl;if(Ye(n)){var i=this.gl_query[r];return n.getQueryParameter(i,n.QUERY_RESULT_AVAILABLE)?!!n.getQueryParameter(i,n.QUERY_RESULT):null}return null},t.prototype.destroy=function(){e.prototype.destroy.call(this);var r=this.device.gl;if(Ye(r))for(var n=0;n<this.gl_query.length;n++)r.deleteQuery(this.gl_query[n])},t}(kn),AK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=e.call(this,{id:n,device:i})||this;return o.type=Lt.Readback,o.gl_pbo=null,o.gl_sync=null,o}return t.prototype.clientWaitAsync=function(r,n,i){n===void 0&&(n=0),i===void 0&&(i=10);var o=this.device.gl;return new Promise(function(a,s){function u(){var l=o.clientWaitSync(r,n,0);if(l==o.WAIT_FAILED){s();return}if(l==o.TIMEOUT_EXPIRED){setTimeout(u,xq(i,0,o.MAX_CLIENT_WAIT_TIMEOUT_WEBGL));return}a()}u()})},t.prototype.getBufferSubDataAsync=function(r,n,i,o,a,s){return Ia(this,void 0,void 0,function(){var u;return Ma(this,function(l){switch(l.label){case 0:return u=this.device.gl,Ye(u)?(this.gl_sync=u.fenceSync(u.SYNC_GPU_COMMANDS_COMPLETE,0),u.flush(),[4,this.clientWaitAsync(this.gl_sync,0,10)]):[3,2];case 1:return l.sent(),u.bindBuffer(r,n),u.getBufferSubData(r,i,o,a,s),u.bindBuffer(r,null),[2,o];case 2:return[2]}})})},t.prototype.readTexture=function(r,n,i,o,a,s,u,l){return u===void 0&&(u=0),l===void 0&&(l=s.byteLength||0),Ia(this,void 0,void 0,function(){var f,c,h,d,p;return Ma(this,function(v){return f=this.device.gl,c=r,h=this.device.translateTextureFormat(c.format),d=this.device.translateTextureType(c.format),p=Cq(c.format),Ye(f)?(this.gl_pbo=this.device.ensureResourceExists(f.createBuffer()),f.bindBuffer(f.PIXEL_PACK_BUFFER,this.gl_pbo),f.bufferData(f.PIXEL_PACK_BUFFER,l,f.STREAM_READ),f.bindBuffer(f.PIXEL_PACK_BUFFER,null),f.bindFramebuffer(w.READ_FRAMEBUFFER,this.device.readbackFramebuffer),f.framebufferTexture2D(w.READ_FRAMEBUFFER,w.COLOR_ATTACHMENT0,w.TEXTURE_2D,c.gl_texture,0),f.bindBuffer(f.PIXEL_PACK_BUFFER,this.gl_pbo),f.readPixels(n,i,o,a,h,d,u*p),f.bindBuffer(f.PIXEL_PACK_BUFFER,null),[2,this.getBufferSubDataAsync(f.PIXEL_PACK_BUFFER,this.gl_pbo,0,s,u,0)]):[2,this.readTextureSync(r,n,i,o,a,s,u,l)]})})},t.prototype.readTextureSync=function(r,n,i,o,a,s,u,l){l===void 0&&(l=s.byteLength||0);var f=this.device.gl,c=r,h=this.device.translateTextureType(c.format);return f.bindFramebuffer(w.FRAMEBUFFER,this.device.readbackFramebuffer),f.framebufferTexture2D(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,w.TEXTURE_2D,c.gl_texture,0),f.pixelStorei(f.PACK_ALIGNMENT,4),f.readPixels(n,i,o,a,f.RGBA,h,s),s},t.prototype.readBuffer=function(r,n,i,o,a){return Ia(this,void 0,void 0,function(){var s;return Ma(this,function(u){return s=this.device.gl,Ye(s)?[2,this.getBufferSubDataAsync(s.ARRAY_BUFFER,Na(r,n),n,i,o,a)]:[2,Promise.reject()]})})},t.prototype.destroy=function(){e.prototype.destroy.call(this),Ye(this.device.gl)&&(this.gl_sync!==null&&this.device.gl.deleteSync(this.gl_sync),this.gl_pbo!==null&&this.device.gl.deleteBuffer(this.gl_pbo))},t}(kn),SK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a,s,u=e.call(this,{id:n,device:i})||this;return u.type=Lt.RenderPipeline,u.drawMode=cK((a=o.topology)!==null&&a!==void 0?a:gr.TRIANGLES),u.program=o.program,u.inputLayout=o.inputLayout,u.megaState=nr(nr({},$a(za)),o.megaStateDescriptor),u.colorAttachmentFormats=o.colorAttachmentFormats.slice(),u.depthStencilAttachmentFormat=o.depthStencilAttachmentFormat,u.sampleCount=(s=o.sampleCount)!==null&&s!==void 0?s:1,u}return t}(kn),xK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;return a.type=Lt.ComputePipeline,a.descriptor=o,a}return t}(kn),bK=function(){function e(){this.liveObjects=new Set,this.creationStacks=new Map,this.deletionStacks=new Map}return e.prototype.trackResourceCreated=function(t){this.creationStacks.set(t,new Error().stack),this.liveObjects.add(t)},e.prototype.trackResourceDestroyed=function(t){this.deletionStacks.has(t)&&console.warn("Object double freed:",t,`
Creation stack: `,this.creationStacks.get(t),`
Deletion stack: `,this.deletionStacks.get(t),`
This stack: `,new Error().stack),this.deletionStacks.set(t,new Error().stack),this.liveObjects.delete(t)},e.prototype.checkForLeaks=function(){var t,r;try{for(var n=Oo(this.liveObjects.values()),i=n.next();!i.done;i=n.next()){var o=i.value;console.warn("Object leaked:",o,"Creation stack:",this.creationStacks.get(o))}}catch(a){t={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.prototype.setResourceLeakCheck=function(t,r){r?this.liveObjects.add(t):this.liveObjects.delete(t)},e}(),RK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a,s,u=e.call(this,{id:n,device:i})||this;u.type=Lt.Sampler;var l=u.device.gl;if(Ye(l)){var f=u.device.ensureResourceExists(l.createSampler());l.samplerParameteri(f,w.TEXTURE_WRAP_S,js(o.addressModeU)),l.samplerParameteri(f,w.TEXTURE_WRAP_T,js(o.addressModeV)),l.samplerParameteri(f,w.TEXTURE_WRAP_R,js((a=o.addressModeW)!==null&&a!==void 0?a:o.addressModeU)),l.samplerParameteri(f,w.TEXTURE_MIN_FILTER,zl(o.minFilter,o.mipmapFilter)),l.samplerParameteri(f,w.TEXTURE_MAG_FILTER,zl(o.magFilter,Or.NO_MIP)),o.lodMinClamp!==void 0&&l.samplerParameterf(f,w.TEXTURE_MIN_LOD,o.lodMinClamp),o.lodMaxClamp!==void 0&&l.samplerParameterf(f,w.TEXTURE_MAX_LOD,o.lodMaxClamp),o.compareFunction!==void 0&&(l.samplerParameteri(f,l.TEXTURE_COMPARE_MODE,l.COMPARE_REF_TO_TEXTURE),l.samplerParameteri(f,l.TEXTURE_COMPARE_FUNC,o.compareFunction));var c=(s=o.maxAnisotropy)!==null&&s!==void 0?s:1;c>1&&u.device.EXT_texture_filter_anisotropic!==null&&(ht(o.minFilter===lr.BILINEAR&&o.magFilter===lr.BILINEAR&&o.mipmapFilter===Or.LINEAR),l.samplerParameterf(f,u.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c)),u.gl_sampler=f}else u.descriptor=o;return u}return t.prototype.setTextureParameters=function(r,n,i){var o,a=this.device.gl,s=this.descriptor;this.isNPOT(n,i)?a.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.LINEAR):a.texParameteri(r,w.TEXTURE_MIN_FILTER,zl(s.minFilter,s.mipmapFilter)),a.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,js(s.addressModeU)),a.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,js(s.addressModeV)),a.texParameteri(r,w.TEXTURE_MAG_FILTER,zl(s.magFilter,Or.NO_MIP));var u=(o=s.maxAnisotropy)!==null&&o!==void 0?o:1;u>1&&this.device.EXT_texture_filter_anisotropic!==null&&(ht(s.minFilter===lr.BILINEAR&&s.magFilter===lr.BILINEAR&&s.mipmapFilter===Or.LINEAR),a.texParameteri(r,this.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u))},t.prototype.destroy=function(){e.prototype.destroy.call(this),Ye(this.device.gl)&&this.device.gl.deleteSampler(ap(this))},t.prototype.isNPOT=function(r,n){return!kc(r)||!kc(n)},t}(kn),CK=function(){function e(){}return e.prototype.dispatchWorkgroups=function(t,r,n){},e.prototype.dispatchWorkgroupsIndirect=function(t,r){},e.prototype.setPipeline=function(t){},e.prototype.setBindings=function(t){},e.prototype.pushDebugGroup=function(t){},e.prototype.popDebugGroup=function(){},e.prototype.insertDebugMarker=function(t){},e}(),OK=function(e){sr(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Lt.RenderBundle,r.commands=[],r}return t.prototype.push=function(r){this.commands.push(r)},t.prototype.replay=function(){this.commands.forEach(function(r){return r()})},t}(kn),k1=65536,IK=/uniform(?:\s+)(\w+)(?:\s?){([^]*?)}/g,MK=function(){function e(t,r){r===void 0&&(r={}),this.shaderDebug=!1,this.OES_vertex_array_object=null,this.ANGLE_instanced_arrays=null,this.OES_texture_float=null,this.OES_draw_buffers_indexed=null,this.WEBGL_draw_buffers=null,this.WEBGL_depth_texture=null,this.WEBGL_color_buffer_float=null,this.EXT_color_buffer_half_float=null,this.WEBGL_compressed_texture_s3tc=null,this.WEBGL_compressed_texture_s3tc_srgb=null,this.EXT_texture_compression_rgtc=null,this.EXT_texture_filter_anisotropic=null,this.KHR_parallel_shader_compile=null,this.EXT_texture_norm16=null,this.EXT_color_buffer_float=null,this.OES_texture_float_linear=null,this.OES_texture_half_float_linear=null,this.scTexture=null,this.scPlatformFramebuffer=null,this.currentActiveTexture=null,this.currentBoundVAO=null,this.currentProgram=null,this.resourceCreationTracker=null,this.resourceUniqueId=0,this.currentColorAttachments=[],this.currentColorAttachmentLevels=[],this.currentColorResolveTos=[],this.currentColorResolveToLevels=[],this.currentSampleCount=-1,this.currentIndexBufferByteOffset=null,this.currentMegaState=$a(za),this.currentSamplers=[],this.currentTextures=[],this.currentUniformBuffers=[],this.currentUniformBufferByteOffsets=[],this.currentUniformBufferByteSizes=[],this.currentScissorEnabled=!1,this.currentStencilRef=null,this.currentRenderPassDescriptor=null,this.currentRenderPassDescriptorStack=[],this.debugGroupStack=[],this.resolveColorAttachmentsChanged=!1,this.resolveDepthStencilAttachmentsChanged=!1,this.explicitBindingLocations=!1,this.separateSamplerTextures=!1,this.viewportOrigin=Zn.LOWER_LEFT,this.clipSpaceNearZ=Ua.NEGATIVE_ONE,this.supportMRT=!1,this.inBlitRenderPass=!1,this.supportedSampleCounts=[],this.occlusionQueriesRecommended=!1,this.computeShadersSupported=!1,this.gl=t,this.contextAttributes=Eo(t.getContextAttributes()),Ye(t)?(this.EXT_texture_norm16=t.getExtension("EXT_texture_norm16"),this.EXT_color_buffer_float=t.getExtension("EXT_color_buffer_float")):(this.OES_vertex_array_object=t.getExtension("OES_vertex_array_object"),this.ANGLE_instanced_arrays=t.getExtension("ANGLE_instanced_arrays"),this.OES_texture_float=t.getExtension("OES_texture_float"),this.WEBGL_draw_buffers=t.getExtension("WEBGL_draw_buffers"),this.WEBGL_depth_texture=t.getExtension("WEBGL_depth_texture"),this.WEBGL_color_buffer_float=t.getExtension("WEBGL_color_buffer_float"),this.EXT_color_buffer_half_float=t.getExtension("EXT_color_buffer_half_float"),t.getExtension("EXT_frag_depth"),t.getExtension("OES_element_index_uint"),t.getExtension("OES_standard_derivatives")),this.WEBGL_compressed_texture_s3tc=t.getExtension("WEBGL_compressed_texture_s3tc"),this.WEBGL_compressed_texture_s3tc_srgb=t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),this.EXT_texture_compression_rgtc=t.getExtension("EXT_texture_compression_rgtc"),this.EXT_texture_filter_anisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.EXT_texture_norm16=t.getExtension("EXT_texture_norm16"),this.OES_texture_float_linear=t.getExtension("OES_texture_float_linear"),this.OES_texture_half_float_linear=t.getExtension("OES_texture_half_float_linear"),this.KHR_parallel_shader_compile=t.getExtension("KHR_parallel_shader_compile"),Ye(t)?(this.platformString="WebGL2",this.glslVersion="#version 300 es"):(this.platformString="WebGL1",this.glslVersion="#version 100"),this.scTexture=new sp({id:this.getNextUniqueId(),device:this,descriptor:{width:0,height:0,depthOrArrayLayers:1,dimension:bt.TEXTURE_2D,mipLevelCount:1,usage:qr.RENDER_TARGET,format:this.contextAttributes.alpha===!1?X.U8_RGB_RT:X.U8_RGBA_RT},fake:!0}),this.scTexture.formatKind=or.Float,this.scTexture.gl_target=null,this.scTexture.gl_texture=null,this.resolveColorReadFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveColorDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveDepthStencilReadFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.resolveDepthStencilDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.renderPassDrawFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.readbackFramebuffer=this.ensureResourceExists(t.createFramebuffer()),this.fallbackTexture2D=this.createFallbackTexture(bt.TEXTURE_2D,or.Float),this.fallbackTexture2DDepth=this.createFallbackTexture(bt.TEXTURE_2D,or.Depth),this.fallbackVertexBuffer=this.createBuffer({viewOrSize:1,usage:Wt.VERTEX,hint:qn.STATIC}),Ye(t)&&(this.fallbackTexture2DArray=this.createFallbackTexture(bt.TEXTURE_2D_ARRAY,or.Float),this.fallbackTexture3D=this.createFallbackTexture(bt.TEXTURE_3D,or.Float),this.fallbackTextureCube=this.createFallbackTexture(bt.TEXTURE_CUBE_MAP,or.Float)),this.currentMegaState.depthCompare=kt.LESS,this.currentMegaState.depthWrite=!1,this.currentMegaState.attachmentsState[0].channelWriteMask=Lr.ALL,t.enable(t.DEPTH_TEST),t.enable(t.STENCIL_TEST),this.checkLimits(),r.shaderDebug&&(this.shaderDebug=!0),r.trackResources&&(this.resourceCreationTracker=new bK)}return e.prototype.destroy=function(){this.blitBindings&&this.blitBindings.destroy(),this.blitInputLayout&&this.blitInputLayout.destroy(),this.blitRenderPipeline&&this.blitRenderPipeline.destroy(),this.blitVertexBuffer&&this.blitVertexBuffer.destroy(),this.blitProgram&&this.blitProgram.destroy()},e.prototype.createFallbackTexture=function(t,r){var n=t===bt.TEXTURE_CUBE_MAP?6:1,i=r===or.Depth?X.D32F:X.U8_RGBA_NORM,o=this.createTexture({dimension:t,format:i,usage:qr.SAMPLED,width:1,height:1,depthOrArrayLayers:n,mipLevelCount:1});return r===or.Float&&o.setImageData([new Uint8Array(4*n)]),ga(o)},e.prototype.getNextUniqueId=function(){return++this.resourceUniqueId},e.prototype.checkLimits=function(){var t=this.gl;if(this.maxVertexAttribs=t.getParameter(w.MAX_VERTEX_ATTRIBS),Ye(t)){this.uniformBufferMaxPageByteSize=Math.min(t.getParameter(w.MAX_UNIFORM_BLOCK_SIZE),k1),this.uniformBufferWordAlignment=t.getParameter(t.UNIFORM_BUFFER_OFFSET_ALIGNMENT)/4;var r=t.getInternalformatParameter(t.RENDERBUFFER,t.DEPTH32F_STENCIL8,t.SAMPLES);this.supportedSampleCounts=r?Vs([],Xn(r),!1):[],this.occlusionQueriesRecommended=!0}else this.uniformBufferWordAlignment=64,this.uniformBufferMaxPageByteSize=k1;this.uniformBufferMaxPageWordSize=this.uniformBufferMaxPageByteSize/4,this.supportedSampleCounts.includes(1)||this.supportedSampleCounts.push(1),this.supportedSampleCounts.sort(function(n,i){return n-i})},e.prototype.configureSwapChain=function(t,r,n){var i=this.scTexture;i.width=t,i.height=r,this.scPlatformFramebuffer=Iq(n)},e.prototype.getDevice=function(){return this},e.prototype.getCanvas=function(){return this.gl.canvas},e.prototype.getOnscreenTexture=function(){return this.scTexture},e.prototype.beginFrame=function(){},e.prototype.endFrame=function(){},e.prototype.translateTextureInternalFormat=function(t,r){switch(r===void 0&&(r=!1),t){case X.ALPHA:return w.ALPHA;case X.U8_LUMINANCE:case X.F16_LUMINANCE:case X.F32_LUMINANCE:return w.LUMINANCE;case X.F16_R:return w.R16F;case X.F16_RG:return w.RG16F;case X.F16_RGB:return w.RGB16F;case X.F16_RGBA:return w.RGBA16F;case X.F32_R:return w.R32F;case X.F32_RG:return w.RG32F;case X.F32_RGB:return w.RGB32F;case X.F32_RGBA:return Ye(this.gl)?w.RGBA32F:r?this.WEBGL_color_buffer_float.RGBA32F_EXT:w.RGBA;case X.U8_R_NORM:return w.R8;case X.U8_RG_NORM:return w.RG8;case X.U8_RGB_NORM:case X.U8_RGB_RT:return w.RGB8;case X.U8_RGB_SRGB:return w.SRGB8;case X.U8_RGBA_NORM:case X.U8_RGBA_RT:return Ye(this.gl)?w.RGBA8:r?w.RGBA4:w.RGBA;case X.U8_RGBA:return w.RGBA;case X.U8_RGBA_SRGB:case X.U8_RGBA_RT_SRGB:return w.SRGB8_ALPHA8;case X.U16_R:return w.R16UI;case X.U16_R_NORM:return this.EXT_texture_norm16.R16_EXT;case X.U16_RG_NORM:return this.EXT_texture_norm16.RG16_EXT;case X.U16_RGBA_NORM:return this.EXT_texture_norm16.RGBA16_EXT;case X.U16_RGBA_5551:return w.RGB5_A1;case X.U16_RGB_565:return w.RGB565;case X.U32_R:return w.R32UI;case X.S8_RGBA_NORM:return w.RGBA8_SNORM;case X.S8_RG_NORM:return w.RG8_SNORM;case X.BC1:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT;case X.BC1_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case X.BC2:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT;case X.BC2_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case X.BC3:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT;case X.BC3_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case X.BC4_UNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_RED_RGTC1_EXT;case X.BC4_SNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT;case X.BC5_UNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT;case X.BC5_SNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;case X.D32F_S8:return Ye(this.gl)?w.DEPTH32F_STENCIL8:this.WEBGL_depth_texture?w.DEPTH_STENCIL:w.DEPTH_COMPONENT16;case X.D24_S8:return Ye(this.gl)?w.DEPTH24_STENCIL8:this.WEBGL_depth_texture?w.DEPTH_STENCIL:w.DEPTH_COMPONENT16;case X.D32F:return Ye(this.gl)?w.DEPTH_COMPONENT32F:this.WEBGL_depth_texture?w.DEPTH_COMPONENT:w.DEPTH_COMPONENT16;case X.D24:return Ye(this.gl)?w.DEPTH_COMPONENT24:this.WEBGL_depth_texture?w.DEPTH_COMPONENT:w.DEPTH_COMPONENT16;default:throw new Error("whoops")}},e.prototype.translateTextureType=function(t){var r=si(t);switch(r){case de.U8:return w.UNSIGNED_BYTE;case de.U16:return w.UNSIGNED_SHORT;case de.U32:return w.UNSIGNED_INT;case de.S8:return w.BYTE;case de.F16:return w.HALF_FLOAT;case de.F32:return w.FLOAT;case de.U16_PACKED_5551:return w.UNSIGNED_SHORT_5_5_5_1;case de.D32F:return Ye(this.gl)?w.FLOAT:this.WEBGL_depth_texture?w.UNSIGNED_INT:w.UNSIGNED_BYTE;case de.D24:return Ye(this.gl)?w.UNSIGNED_INT_24_8:this.WEBGL_depth_texture?w.UNSIGNED_SHORT:w.UNSIGNED_BYTE;case de.D24S8:return Ye(this.gl)?w.UNSIGNED_INT_24_8:this.WEBGL_depth_texture?w.UNSIGNED_INT_24_8_WEBGL:w.UNSIGNED_BYTE;case de.D32FS8:return w.FLOAT_32_UNSIGNED_INT_24_8_REV;default:throw new Error("whoops")}},e.prototype.translateInternalTextureFormat=function(t){switch(t){case X.F32_R:return w.R32F;case X.F32_RG:return w.RG32F;case X.F32_RGB:return w.RGB32F;case X.F32_RGBA:return w.RGBA32F;case X.F16_R:return w.R16F;case X.F16_RG:return w.RG16F;case X.F16_RGB:return w.RGB16F;case X.F16_RGBA:return w.RGBA16F}return this.translateTextureFormat(t)},e.prototype.translateTextureFormat=function(t){if(fx(t)||t===X.F32_LUMINANCE||t===X.U8_LUMINANCE)return this.translateTextureInternalFormat(t);var r=Ye(this.gl)||!Ye(this.gl)&&!!this.WEBGL_depth_texture;switch(t){case X.D24_S8:case X.D32F_S8:return r?w.DEPTH_STENCIL:w.RGBA;case X.D24:case X.D32F:return r?w.DEPTH_COMPONENT:w.RGBA}var n=hx(t),i=a_(t);switch(i){case We.A:return w.ALPHA;case We.R:return n?w.RED_INTEGER:w.RED;case We.RG:return n?w.RG_INTEGER:w.RG;case We.RGB:return n?w.RGB_INTEGER:w.RGB;case We.RGBA:return w.RGBA}},e.prototype.setActiveTexture=function(t){this.currentActiveTexture!==t&&(this.gl.activeTexture(t),this.currentActiveTexture=t)},e.prototype.bindVAO=function(t){this.currentBoundVAO!==t&&(Ye(this.gl)?this.gl.bindVertexArray(t):this.OES_vertex_array_object.bindVertexArrayOES(t),this.currentBoundVAO=t)},e.prototype.programCompiled=function(t){ht(t.compileState!==fn.NeedsCompile),t.compileState===fn.Compiling&&(t.compileState=fn.NeedsBind,this.shaderDebug&&this.checkProgramCompilationForErrors(t))},e.prototype.useProgram=function(t){this.currentProgram!==t&&(this.programCompiled(t),this.gl.useProgram(t.gl_program),this.currentProgram=t)},e.prototype.ensureResourceExists=function(t){if(t===null){var r=this.gl.getError();throw new Error("Created resource is null; GL error encountered: ".concat(r))}else return t},e.prototype.createBuffer=function(t){return new mK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createTexture=function(t){return new sp({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createSampler=function(t){return new RK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createRenderTarget=function(t){return new EK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createRenderTargetFromTexture=function(t){var r=t,n=r.format,i=r.width,o=r.height,a=r.mipLevelCount;return ht(a===1),this.createRenderTarget({format:n,width:i,height:o,sampleCount:1,texture:t})},e.prototype.createProgram=function(t){var r,n,i,o=(r=t.vertex)===null||r===void 0?void 0:r.glsl;return!((n=t.vertex)===null||n===void 0)&&n.glsl&&(t.vertex.glsl=Va(this.queryVendorInfo(),"vert",t.vertex.glsl)),!((i=t.fragment)===null||i===void 0)&&i.glsl&&(t.fragment.glsl=Va(this.queryVendorInfo(),"frag",t.fragment.glsl)),this.createProgramSimple(t,o)},e.prototype.createProgramSimple=function(t,r){var n=new yK({id:this.getNextUniqueId(),device:this,descriptor:t},r);return n},e.prototype.createBindings=function(t){return new uK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createInputLayout=function(t){return new gK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createRenderPipeline=function(t){return new SK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createComputePass=function(){return new CK},e.prototype.createComputePipeline=function(t){return new xK({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createReadback=function(){return new AK({id:this.getNextUniqueId(),device:this})},e.prototype.createQueryPool=function(t,r){return new TK({id:this.getNextUniqueId(),device:this,descriptor:{type:t,elemCount:r}})},e.prototype.formatRenderPassDescriptor=function(t){var r,n,i,o,a,s,u=t.colorAttachment;t.depthClearValue=(r=t.depthClearValue)!==null&&r!==void 0?r:"load",t.stencilClearValue=(n=t.stencilClearValue)!==null&&n!==void 0?n:"load";for(var l=0;l<u.length;l++)t.colorAttachmentLevel||(t.colorAttachmentLevel=[]),t.colorAttachmentLevel[l]=(i=t.colorAttachmentLevel[l])!==null&&i!==void 0?i:0,t.colorResolveToLevel||(t.colorResolveToLevel=[]),t.colorResolveToLevel[l]=(o=t.colorResolveToLevel[l])!==null&&o!==void 0?o:0,t.colorClearColor||(t.colorClearColor=[]),t.colorClearColor[l]=(a=t.colorClearColor[l])!==null&&a!==void 0?a:"load",t.colorStore||(t.colorStore=[]),t.colorStore[l]=(s=t.colorStore[l])!==null&&s!==void 0?s:!1},e.prototype.createRenderBundle=function(){return new OK({id:this.getNextUniqueId(),device:this})},e.prototype.beginBundle=function(t){this.renderBundle=t},e.prototype.endBundle=function(){this.renderBundle=void 0},e.prototype.executeBundles=function(t){t.forEach(function(r){r.replay()})},e.prototype.createRenderPass=function(t){this.currentRenderPassDescriptor!==null&&this.currentRenderPassDescriptorStack.push(this.currentRenderPassDescriptor),this.currentRenderPassDescriptor=t,this.formatRenderPassDescriptor(t);var r=t.colorAttachment,n=t.colorAttachmentLevel,i=t.colorClearColor,o=t.colorResolveTo,a=t.colorResolveToLevel,s=t.depthStencilAttachment,u=t.depthClearValue,l=t.stencilClearValue,f=t.depthStencilResolveTo,c=o&&o.length===1&&o[0]===this.scTexture;this.setRenderPassParametersBegin(r.length,c);for(var h=0;h<r.length;h++)this.setRenderPassParametersColor(h,r[h],n[h],o[h],a[h],c);this.setRenderPassParametersDepthStencil(s,f,c),this.validateCurrentAttachments();for(var h=0;h<r.length;h++){var d=i[h];d!=="load"&&this.setRenderPassParametersClearColor(h,d.r,d.g,d.b,d.a)}return this.setRenderPassParametersClearDepthStencil(u,l),this},e.prototype.submitPass=function(t){ht(this.currentRenderPassDescriptor!==null),this.endPass(),this.currentRenderPassDescriptorStack.length?this.currentRenderPassDescriptor=this.currentRenderPassDescriptorStack.pop():this.currentRenderPassDescriptor=null},e.prototype.copySubTexture2D=function(t,r,n,i,o,a){var s=this.gl,u=t,l=i;if(ht(l.mipLevelCount===1),ht(u.mipLevelCount===1),Ye(s))u===this.scTexture?s.bindFramebuffer(s.DRAW_FRAMEBUFFER,this.scPlatformFramebuffer):(s.bindFramebuffer(s.DRAW_FRAMEBUFFER,this.resolveColorDrawFramebuffer),this.bindFramebufferAttachment(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,u,0)),s.bindFramebuffer(s.READ_FRAMEBUFFER,this.resolveColorReadFramebuffer),this.bindFramebufferAttachment(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,l,0),s.blitFramebuffer(o,a,o+l.width,a+l.height,r,n,r+l.width,n+l.height,s.COLOR_BUFFER_BIT,s.LINEAR),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null);else if(u===this.scTexture){var f=this.createRenderTargetFromTexture(i);this.submitBlitRenderPass(f,u)}},e.prototype.queryLimits=function(){return this},e.prototype.queryTextureFormatSupported=function(t,r,n){switch(t){case X.BC1_SRGB:case X.BC2_SRGB:case X.BC3_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb!==null?rd(r,n,4,4):!1;case X.BC1:case X.BC2:case X.BC3:return this.WEBGL_compressed_texture_s3tc!==null?rd(r,n,4,4):!1;case X.BC4_UNORM:case X.BC4_SNORM:case X.BC5_UNORM:case X.BC5_SNORM:return this.EXT_texture_compression_rgtc!==null?rd(r,n,4,4):!1;case X.U16_R_NORM:case X.U16_RG_NORM:case X.U16_RGBA_NORM:return this.EXT_texture_norm16!==null;case X.F32_R:case X.F32_RG:case X.F32_RGB:case X.F32_RGBA:return this.OES_texture_float_linear!==null;case X.F16_R:case X.F16_RG:case X.F16_RGB:case X.F16_RGBA:return this.OES_texture_half_float_linear!==null;default:return!0}},e.prototype.queryProgramReady=function(t){var r=this.gl;if(t.compileState===fn.NeedsCompile)throw new Error("whoops");if(t.compileState===fn.Compiling){var n=void 0;return this.KHR_parallel_shader_compile!==null?n=r.getProgramParameter(t.gl_program,this.KHR_parallel_shader_compile.COMPLETION_STATUS_KHR):n=!0,n&&this.programCompiled(t),n}return t.compileState===fn.NeedsBind||t.compileState===fn.ReadyToUse},e.prototype.queryPlatformAvailable=function(){return this.gl.isContextLost()},e.prototype.queryVendorInfo=function(){return this},e.prototype.queryRenderPass=function(t){return this.currentRenderPassDescriptor},e.prototype.queryRenderTarget=function(t){var r=t;return r},e.prototype.setResourceName=function(t,r){if(t.name=r,t.type===Lt.Buffer)for(var n=t.gl_buffer_pages,i=0;i<n.length;i++)Xs(n[i],"".concat(r," Page ").concat(i));else if(t.type===Lt.Texture)Xs(ga(t),r);else if(t.type===Lt.Sampler)Xs(ap(t),r);else if(t.type===Lt.RenderTarget){var o=t.gl_renderbuffer;o!==null&&Xs(o,r)}else t.type===Lt.InputLayout&&Xs(t.vao,r)},e.prototype.setResourceLeakCheck=function(t,r){this.resourceCreationTracker!==null&&this.resourceCreationTracker.setResourceLeakCheck(t,r)},e.prototype.checkForLeaks=function(){this.resourceCreationTracker!==null&&this.resourceCreationTracker.checkForLeaks()},e.prototype.pushDebugGroup=function(t){},e.prototype.popDebugGroup=function(){},e.prototype.insertDebugMarker=function(t){},e.prototype.programPatched=function(t,r){ht(this.shaderDebug)},e.prototype.getBufferData=function(t,r,n){n===void 0&&(n=0);var i=this.gl;Ye(i)&&(i.bindBuffer(i.COPY_READ_BUFFER,Na(t,n*4)),i.getBufferSubData(i.COPY_READ_BUFFER,n*4,r))},e.prototype.debugGroupStatisticsDrawCall=function(t){t===void 0&&(t=1);for(var r=this.debugGroupStack.length-1;r>=0;r--)this.debugGroupStack[r].drawCallCount+=t},e.prototype.debugGroupStatisticsBufferUpload=function(t){t===void 0&&(t=1);for(var r=this.debugGroupStack.length-1;r>=0;r--)this.debugGroupStack[r].bufferUploadCount+=t},e.prototype.debugGroupStatisticsTextureBind=function(t){t===void 0&&(t=1);for(var r=this.debugGroupStack.length-1;r>=0;r--)this.debugGroupStack[r].textureBindCount+=t},e.prototype.debugGroupStatisticsTriangles=function(t){for(var r=this.debugGroupStack.length-1;r>=0;r--)this.debugGroupStack[r].triangleCount+=t},e.prototype.reportShaderError=function(t,r){var n=this.gl,i=n.getShaderParameter(t,n.COMPILE_STATUS);if(!i){console.error(Nq(r));var o=n.getExtension("WEBGL_debug_shaders");o&&console.error(o.getTranslatedShaderSource(t)),console.error(n.getShaderInfoLog(t))}return i},e.prototype.checkProgramCompilationForErrors=function(t){var r=this.gl,n=t.gl_program;if(!r.getProgramParameter(n,r.LINK_STATUS)){var i=t.descriptor;if(!this.reportShaderError(t.gl_shader_vert,i.vertex.glsl)||!this.reportShaderError(t.gl_shader_frag,i.fragment.glsl))return;console.error(r.getProgramInfoLog(t.gl_program))}},e.prototype.bindFramebufferAttachment=function(t,r,n,i){var o=this.gl;if(wn(n))o.framebufferRenderbuffer(t,r,o.RENDERBUFFER,null);else if(n.type===Lt.RenderTarget)n.gl_renderbuffer!==null?o.framebufferRenderbuffer(t,r,o.RENDERBUFFER,n.gl_renderbuffer):n.texture!==null&&o.framebufferTexture2D(t,r,w.TEXTURE_2D,ga(n.texture),i);else if(n.type===Lt.Texture){var a=ga(n);n.dimension===bt.TEXTURE_2D?o.framebufferTexture2D(t,r,w.TEXTURE_2D,a,i):Ye(o)&&(n.dimension,bt.TEXTURE_2D_ARRAY)}},e.prototype.bindFramebufferDepthStencilAttachment=function(t,r){var n=this.gl,i=wn(r)?$e.Depth|$e.Stencil:ka(r.format),o=!!(i&$e.Depth),a=!!(i&$e.Stencil);if(o&&a){var s=Ye(this.gl)||!Ye(this.gl)&&!!this.WEBGL_depth_texture;s?this.bindFramebufferAttachment(t,n.DEPTH_STENCIL_ATTACHMENT,r,0):this.bindFramebufferAttachment(t,n.DEPTH_ATTACHMENT,r,0)}else o?(this.bindFramebufferAttachment(t,n.DEPTH_ATTACHMENT,r,0),this.bindFramebufferAttachment(t,n.STENCIL_ATTACHMENT,null,0)):a&&(this.bindFramebufferAttachment(t,n.STENCIL_ATTACHMENT,r,0),this.bindFramebufferAttachment(t,n.DEPTH_ATTACHMENT,null,0))},e.prototype.validateCurrentAttachments=function(){for(var t=-1,r=-1,n=-1,i=0;i<this.currentColorAttachments.length;i++){var o=this.currentColorAttachments[i];o!==null&&(t===-1?(t=o.sampleCount,r=o.width,n=o.height):(ht(t===o.sampleCount),ht(r===o.width),ht(n===o.height)))}this.currentDepthStencilAttachment&&(t===-1?t=this.currentDepthStencilAttachment.sampleCount:(ht(t===this.currentDepthStencilAttachment.sampleCount),ht(r===this.currentDepthStencilAttachment.width),ht(n===this.currentDepthStencilAttachment.height))),this.currentSampleCount=t},e.prototype.setRenderPassParametersBegin=function(t,r){r===void 0&&(r=!1);var n=this.gl;if(r)n.bindFramebuffer(w.FRAMEBUFFER,null);else if(Ye(n)?n.bindFramebuffer(w.DRAW_FRAMEBUFFER,this.renderPassDrawFramebuffer):this.inBlitRenderPass||n.bindFramebuffer(w.FRAMEBUFFER,this.renderPassDrawFramebuffer),Ye(n)?n.drawBuffers([w.COLOR_ATTACHMENT0,w.COLOR_ATTACHMENT1,w.COLOR_ATTACHMENT2,w.COLOR_ATTACHMENT3]):!this.inBlitRenderPass&&this.WEBGL_draw_buffers&&this.WEBGL_draw_buffers.drawBuffersWEBGL([w.COLOR_ATTACHMENT0_WEBGL,w.COLOR_ATTACHMENT1_WEBGL,w.COLOR_ATTACHMENT2_WEBGL,w.COLOR_ATTACHMENT3_WEBGL]),!this.inBlitRenderPass)for(var i=t;i<this.currentColorAttachments.length;i++){var o=Ye(n)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,a=Ye(n)?w.COLOR_ATTACHMENT0:w.COLOR_ATTACHMENT0_WEBGL;n.framebufferRenderbuffer(o,a+i,w.RENDERBUFFER,null),n.framebufferTexture2D(o,a+i,w.TEXTURE_2D,null,0)}this.currentColorAttachments.length=t},e.prototype.setRenderPassParametersColor=function(t,r,n,i,o,a){a===void 0&&(a=!1);var s=this.gl,u=Ye(s);(this.currentColorAttachments[t]!==r||this.currentColorAttachmentLevels[t]!==n)&&(this.currentColorAttachments[t]=r,this.currentColorAttachmentLevels[t]=n,!a&&(u||!u&&this.WEBGL_draw_buffers)&&this.bindFramebufferAttachment(u?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,(u?w.COLOR_ATTACHMENT0:w.COLOR_ATTACHMENT0_WEBGL)+t,r,n),this.resolveColorAttachmentsChanged=!0),(this.currentColorResolveTos[t]!==i||this.currentColorResolveToLevels[t]!==o)&&(this.currentColorResolveTos[t]=i,this.currentColorResolveToLevels[t]=o,i!==null&&(this.resolveColorAttachmentsChanged=!0))},e.prototype.setRenderPassParametersDepthStencil=function(t,r,n){n===void 0&&(n=!1);var i=this.gl;this.currentDepthStencilAttachment!==t&&(this.currentDepthStencilAttachment=t,!n&&!this.inBlitRenderPass&&this.bindFramebufferDepthStencilAttachment(Ye(i)?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.currentDepthStencilAttachment),this.resolveDepthStencilAttachmentsChanged=!0),this.currentDepthStencilResolveTo!==r&&(this.currentDepthStencilResolveTo=r,r&&(this.resolveDepthStencilAttachmentsChanged=!0))},e.prototype.setRenderPassParametersClearColor=function(t,r,n,i,o){var a=this.gl;if(this.OES_draw_buffers_indexed!==null){var s=this.currentMegaState.attachmentsState[t];s&&s.channelWriteMask!==Lr.ALL&&(this.OES_draw_buffers_indexed.colorMaskiOES(t,!0,!0,!0,!0),s.channelWriteMask=Lr.ALL)}else{var s=this.currentMegaState.attachmentsState[0];s&&s.channelWriteMask!==Lr.ALL&&(a.colorMask(!0,!0,!0,!0),s.channelWriteMask=Lr.ALL)}this.setScissorRectEnabled(!1),Ye(a)?a.clearBufferfv(a.COLOR,t,[r,n,i,o]):(a.clearColor(r,n,i,o),a.clear(a.COLOR_BUFFER_BIT))},e.prototype.setRenderPassParametersClearDepthStencil=function(t,r){t===void 0&&(t="load"),r===void 0&&(r="load");var n=this.gl;t!=="load"&&(ht(!!this.currentDepthStencilAttachment),this.currentMegaState.depthWrite||(n.depthMask(!0),this.currentMegaState.depthWrite=!0),Ye(n)?n.clearBufferfv(n.DEPTH,0,[t]):(n.clearDepth(t),n.clear(n.DEPTH_BUFFER_BIT))),r!=="load"&&(ht(!!this.currentDepthStencilAttachment),this.currentMegaState.stencilWrite||(n.enable(n.STENCIL_TEST),n.stencilMask(255),this.currentMegaState.stencilWrite=!0),Ye(n)?n.clearBufferiv(n.STENCIL,0,[r]):(n.clearStencil(r),n.clear(n.STENCIL_BUFFER_BIT)))},e.prototype.setBindings=function(t){var r=this,n;if(this.renderBundle){this.renderBundle.push(function(){return r.setBindings(t)});return}var i=this.gl,o=t,a=o.uniformBufferBindings,s=o.samplerBindings,u=o.bindingLayouts;ht(0<u.bindingLayoutTables.length);var l=u.bindingLayoutTables[0];ht(a.length>=l.numUniformBuffers),ht(s.length>=l.numSamplers);for(var f=0;f<a.length;f++){var c=a[f];if(c.size!==0){var h=l.firstUniformBuffer+f,d=c.buffer,p=c.offset||0,v=c.size||d.byteSize;if(d!==this.currentUniformBuffers[h]||p!==this.currentUniformBufferByteOffsets[h]||v!==this.currentUniformBufferByteSizes[h]){var g=p%d.pageByteSize,y=d.gl_buffer_pages[p/d.pageByteSize|0];ht(g+v<=d.pageByteSize),Ye(i)&&i.bindBufferRange(i.UNIFORM_BUFFER,h,y,g,v),this.currentUniformBuffers[h]=d,this.currentUniformBufferByteOffsets[h]=p,this.currentUniformBufferByteSizes[h]=v}}}for(var f=0;f<l.numSamplers;f++){var c=s[f],S=l.firstSampler+f,R=c!==null&&c.sampler!==null?ap(c.sampler):null,x=c!==null&&c.texture!==null?ga(c.texture):null;if(this.currentSamplers[S]!==R&&(Ye(i)&&i.bindSampler(S,R),this.currentSamplers[S]=R),this.currentTextures[S]!==x){if(this.setActiveTexture(i.TEXTURE0+S),x!==null){var M=Eo(c).texture,$=M.gl_target,F=M.width,Y=M.height;c.texture.textureIndex=S,i.bindTexture($,x),Ye(i)||(n=c.sampler)===null||n===void 0||n.setTextureParameters($,F,Y),this.debugGroupStatisticsTextureBind()}else{var ge=nr(nr({},c),lx),q=ge.dimension,k=ge.formatKind,$=vK(q);i.bindTexture($,this.getFallbackTexture(nr({gl_target:$,formatKind:k},ge)))}this.currentTextures[S]=x}}},e.prototype.setViewport=function(t,r,n,i){var o=this.gl;o.viewport(t,r,n,i)},e.prototype.setScissorRect=function(t,r,n,i){var o=this.gl;this.setScissorRectEnabled(!0),o.scissor(t,r,n,i)},e.prototype.applyAttachmentStateIndexed=function(t,r,n){var i=this.gl,o=this.OES_draw_buffers_indexed;r.channelWriteMask!==n.channelWriteMask&&(o.colorMaskiOES(t,!!(n.channelWriteMask&Lr.RED),!!(n.channelWriteMask&Lr.GREEN),!!(n.channelWriteMask&Lr.BLUE),!!(n.channelWriteMask&Lr.ALPHA)),r.channelWriteMask=n.channelWriteMask);var a=r.rgbBlendState.blendMode!==n.rgbBlendState.blendMode||r.alphaBlendState.blendMode!==n.alphaBlendState.blendMode,s=r.rgbBlendState.blendSrcFactor!==n.rgbBlendState.blendSrcFactor||r.alphaBlendState.blendSrcFactor!==n.alphaBlendState.blendSrcFactor||r.rgbBlendState.blendDstFactor!==n.rgbBlendState.blendDstFactor||r.alphaBlendState.blendDstFactor!==n.alphaBlendState.blendDstFactor;(s||a)&&(Di(r.rgbBlendState)&&Di(r.alphaBlendState)?o.enableiOES(t,i.BLEND):Di(n.rgbBlendState)&&Di(n.alphaBlendState)&&o.disableiOES(t,i.BLEND)),a&&(o.blendEquationSeparateiOES(t,n.rgbBlendState.blendMode,n.alphaBlendState.blendMode),r.rgbBlendState.blendMode=n.rgbBlendState.blendMode,r.alphaBlendState.blendMode=n.alphaBlendState.blendMode),s&&(o.blendFuncSeparateiOES(t,n.rgbBlendState.blendSrcFactor,n.rgbBlendState.blendDstFactor,n.alphaBlendState.blendSrcFactor,n.alphaBlendState.blendDstFactor),r.rgbBlendState.blendSrcFactor=n.rgbBlendState.blendSrcFactor,r.alphaBlendState.blendSrcFactor=n.alphaBlendState.blendSrcFactor,r.rgbBlendState.blendDstFactor=n.rgbBlendState.blendDstFactor,r.alphaBlendState.blendDstFactor=n.alphaBlendState.blendDstFactor)},e.prototype.applyAttachmentState=function(t,r){var n=this.gl;t.channelWriteMask!==r.channelWriteMask&&(n.colorMask(!!(r.channelWriteMask&Lr.RED),!!(r.channelWriteMask&Lr.GREEN),!!(r.channelWriteMask&Lr.BLUE),!!(r.channelWriteMask&Lr.ALPHA)),t.channelWriteMask=r.channelWriteMask);var i=t.rgbBlendState.blendMode!==r.rgbBlendState.blendMode||t.alphaBlendState.blendMode!==r.alphaBlendState.blendMode,o=t.rgbBlendState.blendSrcFactor!==r.rgbBlendState.blendSrcFactor||t.alphaBlendState.blendSrcFactor!==r.alphaBlendState.blendSrcFactor||t.rgbBlendState.blendDstFactor!==r.rgbBlendState.blendDstFactor||t.alphaBlendState.blendDstFactor!==r.alphaBlendState.blendDstFactor;(o||i)&&(Di(t.rgbBlendState)&&Di(t.alphaBlendState)?n.enable(n.BLEND):Di(r.rgbBlendState)&&Di(r.alphaBlendState)&&n.disable(n.BLEND)),i&&(n.blendEquationSeparate(r.rgbBlendState.blendMode,r.alphaBlendState.blendMode),t.rgbBlendState.blendMode=r.rgbBlendState.blendMode,t.alphaBlendState.blendMode=r.alphaBlendState.blendMode),o&&(n.blendFuncSeparate(r.rgbBlendState.blendSrcFactor,r.rgbBlendState.blendDstFactor,r.alphaBlendState.blendSrcFactor,r.alphaBlendState.blendDstFactor),t.rgbBlendState.blendSrcFactor=r.rgbBlendState.blendSrcFactor,t.alphaBlendState.blendSrcFactor=r.alphaBlendState.blendSrcFactor,t.rgbBlendState.blendDstFactor=r.rgbBlendState.blendDstFactor,t.alphaBlendState.blendDstFactor=r.alphaBlendState.blendDstFactor)},e.prototype.setMegaState=function(t){var r=this.gl,n=this.currentMegaState;if(this.OES_draw_buffers_indexed!==null)for(var i=0;i<t.attachmentsState.length;i++)this.applyAttachmentStateIndexed(i,n.attachmentsState[0],t.attachmentsState[0]);else ht(t.attachmentsState.length===1),this.applyAttachmentState(n.attachmentsState[0],t.attachmentsState[0]);ix(n.blendConstant,t.blendConstant)||(r.blendColor(t.blendConstant.r,t.blendConstant.g,t.blendConstant.b,t.blendConstant.a),ox(n.blendConstant,t.blendConstant)),n.depthCompare!==t.depthCompare&&(r.depthFunc(t.depthCompare),n.depthCompare=t.depthCompare),!!n.depthWrite!=!!t.depthWrite&&(r.depthMask(t.depthWrite),n.depthWrite=t.depthWrite),!!n.stencilWrite!=!!t.stencilWrite&&(r.stencilMask(t.stencilWrite?255:0),n.stencilWrite=t.stencilWrite);var o=!1;if(!Vc(n.stencilFront,t.stencilFront)){o=!0;var a=t.stencilFront,s=a.passOp,u=a.failOp,l=a.depthFailOp,f=a.compare;(n.stencilFront.passOp!==s||n.stencilFront.failOp!==u||n.stencilFront.depthFailOp!==l)&&(r.stencilOpSeparate(r.FRONT,u,l,s),n.stencilFront.passOp=s,n.stencilFront.failOp=u,n.stencilFront.depthFailOp=l),n.stencilFront.compare!==f&&(this.setStencilReference(0),n.stencilFront.compare=f)}if(!Vc(n.stencilBack,t.stencilBack)){o=!0;var c=t.stencilBack,s=c.passOp,u=c.failOp,l=c.depthFailOp,f=c.compare;(n.stencilBack.passOp!==s||n.stencilBack.failOp!==u||n.stencilBack.depthFailOp!==l)&&(r.stencilOpSeparate(r.BACK,u,l,s),n.stencilBack.passOp=s,n.stencilBack.failOp=u,n.stencilBack.depthFailOp=l),n.stencilBack.compare!==f&&(this.setStencilReference(0),n.stencilBack.compare=f)}(n.stencilFront.mask!==t.stencilFront.mask||n.stencilBack.mask!==t.stencilBack.mask)&&(o=!0,n.stencilFront.mask=t.stencilFront.mask,n.stencilBack.mask=t.stencilBack.mask),o&&this.applyStencil(),n.cullMode!==t.cullMode&&(n.cullMode===pn.NONE?r.enable(r.CULL_FACE):t.cullMode===pn.NONE&&r.disable(r.CULL_FACE),t.cullMode===pn.BACK?r.cullFace(r.BACK):t.cullMode===pn.FRONT?r.cullFace(r.FRONT):t.cullMode===pn.FRONT_AND_BACK&&r.cullFace(r.FRONT_AND_BACK),n.cullMode=t.cullMode),n.frontFace!==t.frontFace&&(r.frontFace(t.frontFace),n.frontFace=t.frontFace),n.polygonOffset!==t.polygonOffset&&(t.polygonOffset?r.enable(r.POLYGON_OFFSET_FILL):r.disable(r.POLYGON_OFFSET_FILL),n.polygonOffset=t.polygonOffset),(n.polygonOffsetFactor!==t.polygonOffsetFactor||n.polygonOffsetUnits!==t.polygonOffsetUnits)&&(r.polygonOffset(t.polygonOffsetFactor,t.polygonOffsetUnits),n.polygonOffsetFactor=t.polygonOffsetFactor,n.polygonOffsetUnits=t.polygonOffsetUnits)},e.prototype.validatePipelineFormats=function(t){for(var r=0;r<this.currentColorAttachments.length;r++)var n=this.currentColorAttachments[r];this.currentDepthStencilAttachment&&ht(this.currentDepthStencilAttachment.format===t.depthStencilAttachmentFormat),this.currentSampleCount!==-1&&ht(this.currentSampleCount===t.sampleCount)},e.prototype.setPipeline=function(t){var r=this;if(this.renderBundle){this.renderBundle.push(function(){return r.setPipeline(t)});return}this.currentPipeline=t,this.validatePipelineFormats(this.currentPipeline),this.setMegaState(this.currentPipeline.megaState);var n=this.currentPipeline.program;if(this.useProgram(n),n.compileState===fn.NeedsBind){var i=this.gl,o=n.gl_program,a=n.descriptor,s=U1(a.vertex.glsl,IK);if(Ye(i))for(var u=0;u<s.length;u++){var l=Xn(s[u],2),f=l[1],c=i.getUniformBlockIndex(o,f);c!==-1&&c!==4294967295&&i.uniformBlockBinding(o,c,u)}for(var h=U1(a.fragment.glsl,/^uniform .*sampler\S+ (\w+);\s* \/\/ BINDING=(\d+)$/gm),u=0;u<h.length;u++){var d=Xn(h[u],3),p=d[1],v=d[2],g=i.getUniformLocation(o,p);i.uniform1i(g,parseInt(v))}n.compileState=fn.ReadyToUse}},e.prototype.setVertexInput=function(t,r,n){var i,o,a=this,s;if(this.renderBundle){this.renderBundle.push(function(){return a.setVertexInput(t,r,n)});return}if(t!==null){ht(this.currentPipeline.inputLayout===t);var u=t;this.bindVAO(u.vao);for(var l=this.gl,f=0;f<u.vertexBufferDescriptors.length;f++){var c=u.vertexBufferDescriptors[f],h=c.arrayStride,d=c.attributes;try{for(var p=(i=void 0,Oo(d)),v=p.next();!v.done;v=p.next()){var g=v.value,y=g.shaderLocation,S=g.offset,R=Ye(l)?y:(s=u.program.attributes[y])===null||s===void 0?void 0:s.location;if(!wn(R)){var x=r[f];if(x===null)continue;var M=g.vertexFormat;l.bindBuffer(l.ARRAY_BUFFER,Na(x.buffer));var $=(x.offset||0)+S;l.vertexAttribPointer(R,M.size,M.type,M.normalized,h,$)}}}catch(Y){i={error:Y}}finally{try{v&&!v.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}if(ht(n!==null==(u.indexBufferFormat!==null)),n!==null){var F=n.buffer;ht(F.usage===Wt.INDEX),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,Na(F)),this.currentIndexBufferByteOffset=n.offset||0}else this.currentIndexBufferByteOffset=null}else ht(this.currentPipeline.inputLayout===null),ht(n===null),this.bindVAO(null),this.currentIndexBufferByteOffset=0},e.prototype.setStencilReference=function(t){this.currentStencilRef!==t&&(this.currentStencilRef=t,this.applyStencil())},e.prototype.draw=function(t,r,n,i){var o,a=this;if(this.renderBundle){this.renderBundle.push(function(){return a.draw(t,r,n,i)});return}var s=this.gl,u=this.currentPipeline;if(r){var l=[u.drawMode,n||0,t,r];Ye(s)?s.drawArraysInstanced.apply(s,Vs([],Xn(l),!1)):(o=this.ANGLE_instanced_arrays).drawArraysInstancedANGLE.apply(o,Vs([],Xn(l),!1))}else s.drawArrays(u.drawMode,n,t);this.debugGroupStatisticsDrawCall(),this.debugGroupStatisticsTriangles(t/3*Math.max(r,1))},e.prototype.drawIndexed=function(t,r,n,i,o){var a,s=this;if(this.renderBundle){this.renderBundle.push(function(){return s.drawIndexed(t,r,n,i,o)});return}var u=this.gl,l=this.currentPipeline,f=Eo(l.inputLayout),c=Eo(this.currentIndexBufferByteOffset)+n*f.indexBufferCompByteSize;if(r){var h=[l.drawMode,t,f.indexBufferType,c,r];Ye(u)?u.drawElementsInstanced.apply(u,Vs([],Xn(h),!1)):(a=this.ANGLE_instanced_arrays).drawElementsInstancedANGLE.apply(a,Vs([],Xn(h),!1))}else u.drawElements(l.drawMode,t,f.indexBufferType,c);this.debugGroupStatisticsDrawCall(),this.debugGroupStatisticsTriangles(t/3*Math.max(r,1))},e.prototype.drawIndirect=function(t,r){},e.prototype.drawIndexedIndirect=function(t,r){},e.prototype.beginOcclusionQuery=function(t){var r=this.gl;if(Ye(r)){var n=this.currentRenderPassDescriptor.occlusionQueryPool;r.beginQuery(n.gl_query_type,n.gl_query[t])}},e.prototype.endOcclusionQuery=function(){var t=this.gl;if(Ye(t)){var r=this.currentRenderPassDescriptor.occlusionQueryPool;t.endQuery(r.gl_query_type)}},e.prototype.pipelineQueryReady=function(t){var r=t;return this.queryProgramReady(r.program)},e.prototype.pipelineForceReady=function(t){},e.prototype.endPass=function(){for(var t=this.gl,r=Ye(t),n=this.currentColorResolveTos.length===1&&this.currentColorResolveTos[0]===this.scTexture,i=!1,o=0;o<this.currentColorAttachments.length;o++){var a=this.currentColorAttachments[o];if(a!==null){var s=this.currentColorResolveTos[o],u=!1;s!==null&&(ht(a.width===s.width&&a.height===s.height),this.setScissorRectEnabled(!1),n||(r&&t.bindFramebuffer(t.READ_FRAMEBUFFER,this.resolveColorReadFramebuffer),this.resolveColorAttachmentsChanged&&r&&this.bindFramebufferAttachment(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,a,this.currentColorAttachmentLevels[o])),u=!0,n||(s===this.scTexture?t.bindFramebuffer(r?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.scPlatformFramebuffer):(t.bindFramebuffer(r?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveColorDrawFramebuffer),this.resolveColorAttachmentsChanged&&t.framebufferTexture2D(r?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s.gl_texture,this.currentColorResolveToLevels[o]))),n||(r?(t.blitFramebuffer(0,0,a.width,a.height,0,0,s.width,s.height,t.COLOR_BUFFER_BIT,t.LINEAR),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null)):this.submitBlitRenderPass(a,s)),i=!0),this.currentRenderPassDescriptor.colorStore[o]||!n&&!u&&(t.bindFramebuffer(r?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveColorReadFramebuffer),this.resolveColorAttachmentsChanged&&this.bindFramebufferAttachment(r?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,t.COLOR_ATTACHMENT0,a,this.currentColorAttachmentLevels[o])),n||t.bindFramebuffer(r?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,null)}}this.resolveColorAttachmentsChanged=!1;var l=this.currentDepthStencilAttachment;if(l){var f=this.currentDepthStencilResolveTo,u=!1;f&&(ht(l.width===f.width&&l.height===f.height),this.setScissorRectEnabled(!1),n||(t.bindFramebuffer(r?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveDepthStencilReadFramebuffer),t.bindFramebuffer(r?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveDepthStencilDrawFramebuffer),this.resolveDepthStencilAttachmentsChanged&&(this.bindFramebufferDepthStencilAttachment(r?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,l),this.bindFramebufferDepthStencilAttachment(r?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,f))),u=!0,n||(r&&t.blitFramebuffer(0,0,l.width,l.height,0,0,f.width,f.height,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(r?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,null)),i=!0),!n&&!this.currentRenderPassDescriptor.depthStencilStore&&(u||(t.bindFramebuffer(r?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,this.resolveDepthStencilReadFramebuffer),this.resolveDepthStencilAttachmentsChanged&&this.bindFramebufferDepthStencilAttachment(r?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,l),u=!0),r&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[t.DEPTH_STENCIL_ATTACHMENT])),!n&&u&&t.bindFramebuffer(r?w.READ_FRAMEBUFFER:w.FRAMEBUFFER,null),this.resolveDepthStencilAttachmentsChanged=!1}!n&&!i&&t.bindFramebuffer(r?w.DRAW_FRAMEBUFFER:w.FRAMEBUFFER,null)},e.prototype.setScissorRectEnabled=function(t){if(this.currentScissorEnabled!==t){var r=this.gl;t?r.enable(r.SCISSOR_TEST):r.disable(r.SCISSOR_TEST),this.currentScissorEnabled=t}},e.prototype.applyStencil=function(){wn(this.currentStencilRef)||(this.gl.stencilFuncSeparate(w.FRONT,this.currentMegaState.stencilFront.compare,this.currentStencilRef,this.currentMegaState.stencilFront.mask||255),this.gl.stencilFuncSeparate(w.BACK,this.currentMegaState.stencilBack.compare,this.currentStencilRef,this.currentMegaState.stencilBack.mask||255))},e.prototype.getFallbackTexture=function(t){var r=t.gl_target,n=t.formatKind;if(r===w.TEXTURE_2D)return n===or.Depth?this.fallbackTexture2DDepth:this.fallbackTexture2D;if(r===w.TEXTURE_2D_ARRAY)return this.fallbackTexture2DArray;if(r===w.TEXTURE_3D)return this.fallbackTexture3D;if(r===w.TEXTURE_CUBE_MAP)return this.fallbackTextureCube;throw new Error("whoops")},e.prototype.submitBlitRenderPass=function(t,r){this.blitRenderPipeline||(this.blitProgram=this.createProgram({vertex:{glsl:`layout(location = 0) in vec2 a_Position;
out vec2 v_TexCoord;
void main() {
v_TexCoord = 0.5 * (a_Position + 1.0);
gl_Position = vec4(a_Position, 0., 1.);
#ifdef VIEWPORT_ORIGIN_TL
v_TexCoord.y = 1.0 - v_TexCoord.y;
#endif
}`},fragment:{glsl:`uniform sampler2D u_Texture;
in vec2 v_TexCoord;
out vec4 outputColor;
void main() {
outputColor = texture(SAMPLER_2D(u_Texture), v_TexCoord);
}`}}),this.blitVertexBuffer=this.createBuffer({usage:Wt.VERTEX|Wt.COPY_DST,viewOrSize:new Float32Array([-4,-4,4,-4,0,4])}),this.blitInputLayout=this.createInputLayout({vertexBufferDescriptors:[{arrayStride:4*2,stepMode:Io.VERTEX,attributes:[{format:X.F32_RG,offset:4*0,shaderLocation:0}]}],indexBufferFormat:null,program:this.blitProgram}),this.blitRenderPipeline=this.createRenderPipeline({topology:gr.TRIANGLES,sampleCount:1,program:this.blitProgram,colorAttachmentFormats:[X.U8_RGBA_RT],depthStencilAttachmentFormat:null,inputLayout:this.blitInputLayout,megaStateDescriptor:$a(za)}),this.blitBindings=this.createBindings({samplerBindings:[{sampler:null,texture:t.texture}],uniformBufferBindings:[]}),this.blitProgram.setUniformsLegacy({u_Texture:t}));var n=this.currentRenderPassDescriptor;this.currentRenderPassDescriptor=null,this.inBlitRenderPass=!0;var i=this.createRenderPass({colorAttachment:[t],colorResolveTo:[r],colorClearColor:[Oq]}),o=this.getCanvas(),a=o.width,s=o.height;i.setPipeline(this.blitRenderPipeline),i.setBindings(this.blitBindings),i.setVertexInput(this.blitInputLayout,[{buffer:this.blitVertexBuffer}],null),i.setViewport(0,0,a,s),this.gl.disable(this.gl.BLEND),i.draw(3,0),this.gl.enable(this.gl.BLEND),this.currentRenderPassDescriptor=n,this.inBlitRenderPass=!1},e}(),NK=function(){function e(t){this.pluginOptions=t}return e.prototype.createSwapChain=function(t){return Ia(this,void 0,void 0,function(){var r,n,i,o,a,s,u,l,f,c,h,d,p;return Ma(this,function(v){return r=this.pluginOptions,n=r.targets,i=r.xrCompatible,o=r.antialias,a=o===void 0?!1:o,s=r.preserveDrawingBuffer,u=s===void 0?!1:s,l=r.premultipliedAlpha,f=l===void 0?!0:l,c=r.shaderDebug,h=r.trackResources,d={antialias:a,preserveDrawingBuffer:u,stencil:!0,premultipliedAlpha:f,xrCompatible:i},this.handleContextEvents(t),n.includes("webgl2")&&(p=t.getContext("webgl2",d)||t.getContext("experimental-webgl2",d)),!p&&n.includes("webgl1")&&(p=t.getContext("webgl",d)||t.getContext("experimental-webgl",d)),[2,new MK(p,{shaderDebug:c,trackResources:h})]})})},e.prototype.handleContextEvents=function(t){var r=this.pluginOptions,n=r.onContextLost,i=r.onContextRestored,o=r.onContextCreationError;o&&t.addEventListener("webglcontextcreationerror",o,!1),n&&t.addEventListener("webglcontextlost",n,!1),i&&t.addEventListener("webglcontextrestored",i,!1)},e}();let ir;const dx=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&dx.decode();let ru=null;function rc(){return(ru===null||ru.byteLength===0)&&(ru=new Uint8Array(ir.memory.buffer)),ru}function Hc(e,t){return e=e>>>0,dx.decode(rc().subarray(e,e+t))}const mi=new Array(128).fill(void 0);mi.push(void 0,null,!0,!1);let lu=mi.length;function PK(e){lu===mi.length&&mi.push(mi.length+1);const t=lu;return lu=mi[t],mi[t]=e,t}function nc(e){return mi[e]}function LK(e){e<132||(mi[e]=lu,lu=e)}function wK(e){const t=nc(e);return LK(e),t}let Ha=0;const ic=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},FK=typeof ic.encodeInto=="function"?function(e,t){return ic.encodeInto(e,t)}:function(e,t){const r=ic.encode(e);return t.set(r),{read:e.length,written:r.length}};function jc(e,t,r){if(r===void 0){const s=ic.encode(e),u=t(s.length,1)>>>0;return rc().subarray(u,u+s.length).set(s),Ha=s.length,u}let n=e.length,i=t(n,1)>>>0;const o=rc();let a=0;for(;a<n;a++){const s=e.charCodeAt(a);if(s>127)break;o[i+a]=s}if(a!==n){a!==0&&(e=e.slice(a)),i=r(i,n,n=a+e.length*3,1)>>>0;const s=rc().subarray(i+a,i+n),u=FK(e,s);a+=u.written}return Ha=a,i}let nu=null;function Xc(){return(nu===null||nu.byteLength===0)&&(nu=new Int32Array(ir.memory.buffer)),nu}function BK(e,t,r){let n,i;try{const s=ir.__wbindgen_add_to_stack_pointer(-16),u=jc(e,ir.__wbindgen_malloc,ir.__wbindgen_realloc),l=Ha,f=jc(t,ir.__wbindgen_malloc,ir.__wbindgen_realloc),c=Ha;ir.glsl_compile(s,u,l,f,c,r);var o=Xc()[s/4+0],a=Xc()[s/4+1];return n=o,i=a,Hc(o,a)}finally{ir.__wbindgen_add_to_stack_pointer(16),ir.__wbindgen_free(n,i,1)}}class Ou{static __wrap(t){t=t>>>0;const r=Object.create(Ou.prototype);return r.__wbg_ptr=t,r}__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();ir.__wbg_wgslcomposer_free(t)}constructor(){const t=ir.wgslcomposer_new();return Ou.__wrap(t)}load_composable(t){const r=jc(t,ir.__wbindgen_malloc,ir.__wbindgen_realloc),n=Ha;ir.wgslcomposer_load_composable(this.__wbg_ptr,r,n)}wgsl_compile(t){let r,n;try{const a=ir.__wbindgen_add_to_stack_pointer(-16),s=jc(t,ir.__wbindgen_malloc,ir.__wbindgen_realloc),u=Ha;ir.wgslcomposer_wgsl_compile(a,this.__wbg_ptr,s,u);var i=Xc()[a/4+0],o=Xc()[a/4+1];return r=i,n=o,Hc(i,o)}finally{ir.__wbindgen_add_to_stack_pointer(16),ir.__wbindgen_free(r,n,1)}}}async function DK(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(n){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}const r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{const r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function UK(){const e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(t,r){const n=Hc(t,r);return PK(n)},e.wbg.__wbindgen_object_drop_ref=function(t){wK(t)},e.wbg.__wbg_log_1d3ae0273d8f4f8a=function(t){console.log(nc(t))},e.wbg.__wbg_log_576ca876af0d4a77=function(t,r){console.log(nc(t),nc(r))},e.wbg.__wbindgen_throw=function(t,r){throw new Error(Hc(t,r))},e}function kK(e,t){return ir=e.exports,px.__wbindgen_wasm_module=t,nu=null,ru=null,ir}async function px(e){if(ir!==void 0)return ir;const t=UK();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:r,module:n}=await DK(await e,t);return kK(r,n)}var Cr;(function(e){e[e.COPY_SRC=1]="COPY_SRC",e[e.COPY_DST=2]="COPY_DST",e[e.TEXTURE_BINDING=4]="TEXTURE_BINDING",e[e.STORAGE_BINDING=8]="STORAGE_BINDING",e[e.STORAGE=8]="STORAGE",e[e.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"})(Cr||(Cr={}));var up;(function(e){e[e.READ=1]="READ",e[e.WRITE=2]="WRITE"})(up||(up={}));function $K(e){var t=0;return e&qr.SAMPLED&&(t|=Cr.TEXTURE_BINDING|Cr.COPY_DST|Cr.COPY_SRC),e&qr.STORAGE&&(t|=Cr.TEXTURE_BINDING|Cr.STORAGE_BINDING|Cr.COPY_SRC|Cr.COPY_DST),e&qr.RENDER_TARGET&&(t|=Cr.RENDER_ATTACHMENT|Cr.TEXTURE_BINDING|Cr.COPY_SRC|Cr.COPY_DST),t}function u_(e){if(e===X.U8_R_NORM)return"r8unorm";if(e===X.S8_R_NORM)return"r8snorm";if(e===X.U8_RG_NORM)return"rg8unorm";if(e===X.S8_RG_NORM)return"rg8snorm";if(e===X.U32_R)return"r32uint";if(e===X.S32_R)return"r32sint";if(e===X.F32_R)return"r32float";if(e===X.U16_RG)return"rg16uint";if(e===X.S16_RG)return"rg16sint";if(e===X.F16_RG)return"rg16float";if(e===X.U8_RGBA_RT)return"bgra8unorm";if(e===X.U8_RGBA_RT_SRGB)return"bgra8unorm-srgb";if(e===X.U8_RGBA_NORM)return"rgba8unorm";if(e===X.U8_RGBA_SRGB)return"rgba8unorm-srgb";if(e===X.S8_RGBA_NORM)return"rgba8snorm";if(e===X.U32_RG)return"rg32uint";if(e===X.S32_RG)return"rg32sint";if(e===X.F32_RG)return"rg32float";if(e===X.U16_RGBA)return"rgba16uint";if(e===X.S16_RGBA)return"rgba16sint";if(e===X.F16_RGBA)return"rgba16float";if(e===X.F32_RGBA)return"rgba32float";if(e===X.U32_RGBA)return"rgba32uint";if(e===X.S32_RGBA)return"rgba32sint";if(e===X.D24)return"depth24plus";if(e===X.D24_S8)return"depth24plus-stencil8";if(e===X.D32F)return"depth32float";if(e===X.D32F_S8)return"depth32float-stencil8";if(e===X.BC1)return"bc1-rgba-unorm";if(e===X.BC1_SRGB)return"bc1-rgba-unorm-srgb";if(e===X.BC2)return"bc2-rgba-unorm";if(e===X.BC2_SRGB)return"bc2-rgba-unorm-srgb";if(e===X.BC3)return"bc3-rgba-unorm";if(e===X.BC3_SRGB)return"bc3-rgba-unorm-srgb";if(e===X.BC4_SNORM)return"bc4-r-snorm";if(e===X.BC4_UNORM)return"bc4-r-unorm";if(e===X.BC5_SNORM)return"bc5-rg-snorm";if(e===X.BC5_UNORM)return"bc5-rg-unorm";throw"whoops"}function zK(e){if(e===bt.TEXTURE_2D)return"2d";if(e===bt.TEXTURE_CUBE_MAP)return"2d";if(e===bt.TEXTURE_2D_ARRAY)return"2d";if(e===bt.TEXTURE_3D)return"3d";throw new Error("whoops")}function VK(e){if(e===bt.TEXTURE_2D)return"2d";if(e===bt.TEXTURE_CUBE_MAP)return"cube";if(e===bt.TEXTURE_2D_ARRAY)return"2d-array";if(e===bt.TEXTURE_3D)return"3d";throw new Error("whoops")}function HK(e){var t=0;return e&Wt.INDEX&&(t|=GPUBufferUsage.INDEX),e&Wt.VERTEX&&(t|=GPUBufferUsage.VERTEX),e&Wt.UNIFORM&&(t|=GPUBufferUsage.UNIFORM),e&Wt.STORAGE&&(t|=GPUBufferUsage.STORAGE),e&Wt.COPY_SRC&&(t|=GPUBufferUsage.COPY_SRC),e&Wt.INDIRECT&&(t|=GPUBufferUsage.INDIRECT),t|=GPUBufferUsage.COPY_DST,t}function nd(e){if(e===tn.CLAMP_TO_EDGE)return"clamp-to-edge";if(e===tn.REPEAT)return"repeat";if(e===tn.MIRRORED_REPEAT)return"mirror-repeat";throw new Error("whoops")}function $1(e){if(e===lr.BILINEAR)return"linear";if(e===lr.POINT)return"nearest";throw new Error("whoops")}function jK(e){if(e===Or.LINEAR)return"linear";if(e===Or.NEAREST)return"nearest";if(e===Or.NO_MIP)return"nearest";throw new Error("whoops")}function Aa(e){var t=e;return t.gpuBuffer}function XK(e){var t=e;return t.gpuSampler}function WK(e){var t=e;return t.querySet}function GK(e){if(e===Uc.OcclusionConservative)return"occlusion";throw new Error("whoops")}function YK(e){switch(e){case gr.TRIANGLES:return"triangle-list";case gr.POINTS:return"point-list";case gr.TRIANGLE_STRIP:return"triangle-strip";case gr.LINES:return"line-list";case gr.LINE_STRIP:return"line-strip";default:throw new Error("Unknown primitive topology mode")}}function ZK(e){if(e===pn.NONE)return"none";if(e===pn.FRONT)return"front";if(e===pn.BACK)return"back";throw new Error("whoops")}function qK(e){if(e===Cu.CCW)return"ccw";if(e===Cu.CW)return"cw";throw new Error("whoops")}function KK(e,t){return{topology:YK(e),cullMode:ZK(t.cullMode),frontFace:qK(t.frontFace)}}function z1(e){if(e===xt.ZERO)return"zero";if(e===xt.ONE)return"one";if(e===xt.SRC)return"src";if(e===xt.ONE_MINUS_SRC)return"one-minus-src";if(e===xt.DST)return"dst";if(e===xt.ONE_MINUS_DST)return"one-minus-dst";if(e===xt.SRC_ALPHA)return"src-alpha";if(e===xt.ONE_MINUS_SRC_ALPHA)return"one-minus-src-alpha";if(e===xt.DST_ALPHA)return"dst-alpha";if(e===xt.ONE_MINUS_DST_ALPHA)return"one-minus-dst-alpha";if(e===xt.CONST)return"constant";if(e===xt.ONE_MINUS_CONSTANT)return"one-minus-constant";if(e===xt.SRC_ALPHA_SATURATE)return"src-alpha-saturated";throw new Error("whoops")}function QK(e){if(e===wr.ADD)return"add";if(e===wr.SUBSTRACT)return"subtract";if(e===wr.REVERSE_SUBSTRACT)return"reverse-subtract";if(e===wr.MIN)return"min";if(e===wr.MAX)return"max";throw new Error("whoops")}function V1(e){return{operation:QK(e.blendMode),srcFactor:z1(e.blendSrcFactor),dstFactor:z1(e.blendDstFactor)}}function H1(e){return e.blendMode===wr.ADD&&e.blendSrcFactor===xt.ONE&&e.blendDstFactor===xt.ZERO}function JK(e){if(!(H1(e.rgbBlendState)&&H1(e.alphaBlendState)))return{color:V1(e.rgbBlendState),alpha:V1(e.alphaBlendState)}}function eQ(e,t){return{format:u_(t),blend:JK(e),writeMask:e.channelWriteMask}}function tQ(e,t){return t.attachmentsState.map(function(r,n){return eQ(r,e[n])})}function oc(e){if(e===kt.NEVER)return"never";if(e===kt.LESS)return"less";if(e===kt.EQUAL)return"equal";if(e===kt.LEQUAL)return"less-equal";if(e===kt.GREATER)return"greater";if(e===kt.NOTEQUAL)return"not-equal";if(e===kt.GEQUAL)return"greater-equal";if(e===kt.ALWAYS)return"always";throw new Error("whoops")}function da(e){if(e===ar.KEEP)return"keep";if(e===ar.REPLACE)return"replace";if(e===ar.ZERO)return"zero";if(e===ar.DECREMENT_CLAMP)return"decrement-clamp";if(e===ar.DECREMENT_WRAP)return"decrement-wrap";if(e===ar.INCREMENT_CLAMP)return"increment-clamp";if(e===ar.INCREMENT_WRAP)return"increment-wrap";if(e===ar.INVERT)return"invert";throw new Error("whoops")}function rQ(e,t){if(!wn(e))return{format:u_(e),depthWriteEnabled:!!t.depthWrite,depthCompare:oc(t.depthCompare),depthBias:t.polygonOffset?t.polygonOffsetUnits:0,depthBiasSlopeScale:t.polygonOffset?t.polygonOffsetFactor:0,stencilFront:{compare:oc(t.stencilFront.compare),passOp:da(t.stencilFront.passOp),failOp:da(t.stencilFront.failOp),depthFailOp:da(t.stencilFront.depthFailOp)},stencilBack:{compare:oc(t.stencilBack.compare),passOp:da(t.stencilBack.passOp),failOp:da(t.stencilBack.failOp),depthFailOp:da(t.stencilBack.depthFailOp)},stencilReadMask:4294967295,stencilWriteMask:4294967295}}function nQ(e){if(e!==null){if(e===X.U16_R)return"uint16";if(e===X.U32_R)return"uint32";throw new Error("whoops")}}function iQ(e){if(e===Io.VERTEX)return"vertex";if(e===Io.INSTANCE)return"instance";throw new Error("whoops")}function oQ(e){if(e===X.U8_R)return"uint8x2";if(e===X.U8_RG)return"uint8x2";if(e===X.U8_RGB)return"uint8x4";if(e===X.U8_RGBA)return"uint8x4";if(e===X.U8_RG_NORM)return"unorm8x2";if(e===X.U8_RGBA_NORM)return"unorm8x4";if(e===X.S8_RGB_NORM)return"snorm8x4";if(e===X.S8_RGBA_NORM)return"snorm8x4";if(e===X.U16_RG_NORM)return"unorm16x2";if(e===X.U16_RGBA_NORM)return"unorm16x4";if(e===X.S16_RG_NORM)return"snorm16x2";if(e===X.S16_RGBA_NORM)return"snorm16x4";if(e===X.S16_RG)return"uint16x2";if(e===X.F16_RG)return"float16x2";if(e===X.F16_RGBA)return"float16x4";if(e===X.F32_R)return"float32";if(e===X.F32_RG)return"float32x2";if(e===X.F32_RGB)return"float32x3";if(e===X.F32_RGBA)return"float32x4";throw"whoops"}function aQ(e){var t=si(e);switch(t){case de.BC1:case de.BC2:case de.BC3:case de.BC4_SNORM:case de.BC4_UNORM:case de.BC5_SNORM:case de.BC5_UNORM:return!0;default:return!1}}function sQ(e){var t=si(e);switch(t){case de.BC1:case de.BC2:case de.BC3:case de.BC4_SNORM:case de.BC4_UNORM:case de.BC5_SNORM:case de.BC5_UNORM:return 4;default:return 1}}function j1(e,t,r,n){switch(r===void 0&&(r=!1),e){case X.S8_R:case X.S8_R_NORM:case X.S8_RG_NORM:case X.S8_RGB_NORM:case X.S8_RGBA_NORM:{var i=t instanceof ArrayBuffer?new Int8Array(t):new Int8Array(t);return n&&i.set(new Int8Array(n)),i}case X.U8_R:case X.U8_R_NORM:case X.U8_RG:case X.U8_RG_NORM:case X.U8_RGB:case X.U8_RGB_NORM:case X.U8_RGB_SRGB:case X.U8_RGBA:case X.U8_RGBA_NORM:case X.U8_RGBA_SRGB:{var o=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t);return n&&o.set(new Uint8Array(n)),o}case X.S16_R:case X.S16_RG:case X.S16_RG_NORM:case X.S16_RGB_NORM:case X.S16_RGBA:case X.S16_RGBA_NORM:{var a=t instanceof ArrayBuffer?new Int16Array(t):new Int16Array(r?t/2:t);return n&&a.set(new Int16Array(n)),a}case X.U16_R:case X.U16_RGB:case X.U16_RGBA_5551:case X.U16_RGBA_NORM:case X.U16_RG_NORM:case X.U16_R_NORM:{var s=t instanceof ArrayBuffer?new Uint16Array(t):new Uint16Array(r?t/2:t);return n&&s.set(new Uint16Array(n)),s}case X.S32_R:{var u=t instanceof ArrayBuffer?new Int32Array(t):new Int32Array(r?t/4:t);return n&&u.set(new Int32Array(n)),u}case X.U32_R:case X.U32_RG:{var l=t instanceof ArrayBuffer?new Uint32Array(t):new Uint32Array(r?t/4:t);return n&&l.set(new Uint32Array(n)),l}case X.F32_R:case X.F32_RG:case X.F32_RGB:case X.F32_RGBA:{var f=t instanceof ArrayBuffer?new Float32Array(t):new Float32Array(r?t/4:t);return n&&f.set(new Float32Array(n)),f}}var c=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t);return n&&c.set(new Uint8Array(n)),c}function uQ(e){var t=(e&32768)>>15,r=(e&31744)>>10,n=e&1023;return r===0?(t?-1:1)*Math.pow(2,-14)*(n/Math.pow(2,10)):r==31?n?NaN:(t?-1:1)*(1/0):(t?-1:1)*Math.pow(2,r-15)*(1+n/Math.pow(2,10))}function _x(e){switch(e){case"r8unorm":case"r8snorm":case"r8uint":case"r8sint":return{width:1,height:1,length:1};case"r16uint":case"r16sint":case"r16float":case"rg8unorm":case"rg8snorm":case"rg8uint":case"rg8sint":return{width:1,height:1,length:2};case"r32uint":case"r32sint":case"r32float":case"rg16uint":case"rg16sint":case"rg16float":case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8snorm":case"rgba8uint":case"rgba8sint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgb9e5ufloat":case"rgb10a2unorm":case"rg11b10ufloat":return{width:1,height:1,length:4};case"rg32uint":case"rg32sint":case"rg32float":case"rgba16uint":case"rgba16sint":case"rgba16float":return{width:1,height:1,length:8};case"rgba32uint":case"rgba32sint":case"rgba32float":return{width:1,height:1,length:16};case"stencil8":throw new Error("No fixed size for Stencil8 format!");case"depth16unorm":return{width:1,height:1,length:2};case"depth24plus":throw new Error("No fixed size for Depth24Plus format!");case"depth24plus-stencil8":throw new Error("No fixed size for Depth24PlusStencil8 format!");case"depth32float":return{width:1,height:1,length:4};case"depth32float-stencil8":return{width:1,height:1,length:5};case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":case"bc6h-rgb-ufloat":case"bc6h-rgb-float":case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc5-rg-unorm":case"bc5-rg-snorm":return{width:4,height:4,length:16};case"bc4-r-unorm":case"bc4-r-snorm":case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":return{width:4,height:4,length:8};default:return{width:1,height:1,length:4}}}var Qn=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=e.call(this)||this;return o.id=n,o.device=i,o}return t.prototype.destroy=function(){},t}(ex),lQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a,s,u=e.call(this,{id:n,device:i})||this;u.type=Lt.Bindings;var l=o.pipeline;ht(!!l);var f=o.uniformBufferBindings,c=o.storageBufferBindings,h=o.samplerBindings,d=o.storageTextureBindings;u.numUniformBuffers=(f==null?void 0:f.length)||0;var p=[[],[],[],[]],v=0;if(f&&f.length)for(var g=0;g<f.length;g++){var y=o.uniformBufferBindings[g],S=y.binding,R=y.size,x=y.offset,M=y.buffer,$={buffer:Aa(M),offset:x??0,size:R};p[0].push({binding:S??v++,resource:$})}if(h&&h.length){v=0;for(var g=0;g<h.length;g++){var F=nr(nr({},h[g]),lx),S=o.samplerBindings[g],Y=S.texture!==null?S.texture:u.device.getFallbackTexture(F);F.dimension=Y.dimension,F.formatKind=nx(Y.format);var ge=Y.gpuTextureView;if(p[1].push({binding:(a=S.textureBinding)!==null&&a!==void 0?a:v++,resource:ge}),S.samplerBinding!==-1){var q=S.sampler!==null?S.sampler:u.device.getFallbackSampler(F),k=XK(q);p[1].push({binding:(s=S.samplerBinding)!==null&&s!==void 0?s:v++,resource:k})}}}if(c&&c.length){v=0;for(var g=0;g<c.length;g++){var G=o.storageBufferBindings[g],S=G.binding,R=G.size,x=G.offset,M=G.buffer,$={buffer:Aa(M),offset:x??0,size:R};p[2].push({binding:S??v++,resource:$})}}if(d&&d.length){v=0;for(var g=0;g<d.length;g++){var K=o.storageTextureBindings[g],S=K.binding,Y=K.texture,ge=Y.gpuTextureView;p[3].push({binding:S??v++,resource:ge})}}var ce=p.findLastIndex(function(Pe){return!!Pe.length});return u.gpuBindGroup=p.map(function(Pe,Xe){return Xe<=ce&&u.device.device.createBindGroup({layout:l.getBindGroupLayout(Xe),entries:Pe})}),u}return t}(Qn),cQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.Buffer;var s=o.usage,u=o.viewOrSize,l=!!(s&Wt.MAP_READ);a.usage=HK(s),l&&(a.usage=Wt.MAP_READ|Wt.COPY_DST);var f=!ya(u);if(a.view=ya(u)?null:u,a.size=ya(u)?$c(u,4):$c(u.byteLength,4),ya(u))a.gpuBuffer=a.device.device.createBuffer({usage:a.usage,size:a.size,mappedAtCreation:l?f:!1});else{a.gpuBuffer=a.device.device.createBuffer({usage:a.usage,size:a.size,mappedAtCreation:!0});var c=u&&u.constructor||Float32Array;new c(a.gpuBuffer.getMappedRange()).set(u),a.gpuBuffer.unmap()}return a}return t.prototype.setSubData=function(r,n,i,o){i===void 0&&(i=0),o===void 0&&(o=0);var a=this.gpuBuffer;o=o||n.byteLength,o=Math.min(o,this.size-r);var s=n.byteOffset+i,u=s+o,l=o+3&-4;if(l!==o){var f=new Uint8Array(n.buffer.slice(s,u));n=new Uint8Array(l),n.set(f),i=0,s=0,u=l,o=l}for(var c=1024*1024*15,h=0;u-(s+h)>c;)this.device.device.queue.writeBuffer(a,r+h,n.buffer,s+h,c),h+=c;this.device.device.queue.writeBuffer(a,r+h,n.buffer,s+h,o-h)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.gpuBuffer.destroy()},t}(Qn),X1=function(){function e(){this.gpuComputePassEncoder=null}return e.prototype.dispatchWorkgroups=function(t,r,n){this.gpuComputePassEncoder.dispatchWorkgroups(t,r,n)},e.prototype.dispatchWorkgroupsIndirect=function(t,r){this.gpuComputePassEncoder.dispatchWorkgroupsIndirect(t.gpuBuffer,r)},e.prototype.finish=function(){this.gpuComputePassEncoder.end(),this.gpuComputePassEncoder=null,this.frameCommandEncoder=null},e.prototype.beginComputePass=function(t){ht(this.gpuComputePassEncoder===null),this.frameCommandEncoder=t,this.gpuComputePassEncoder=this.frameCommandEncoder.beginComputePass(this.gpuComputePassDescriptor)},e.prototype.setPipeline=function(t){var r=t,n=Eo(r.gpuComputePipeline);this.gpuComputePassEncoder.setPipeline(n)},e.prototype.setBindings=function(t){var r=this,n=t;n.gpuBindGroup.forEach(function(i,o){i&&r.gpuComputePassEncoder.setBindGroup(o,n.gpuBindGroup[o])})},e.prototype.pushDebugGroup=function(t){this.gpuComputePassEncoder.pushDebugGroup(t)},e.prototype.popDebugGroup=function(){this.gpuComputePassEncoder.popDebugGroup()},e.prototype.insertDebugMarker=function(t){this.gpuComputePassEncoder.insertDebugMarker(t)},e}(),fQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.ComputePipeline,a.gpuComputePipeline=null,a.descriptor=o;var s=o.program,u=s.computeStage;if(u===null)return a;var l={layout:"auto",compute:nr({},u)};return a.gpuComputePipeline=a.device.device.createComputePipeline(l),a.name!==void 0&&(a.gpuComputePipeline.label=a.name),a}return t.prototype.getBindGroupLayout=function(r){return this.gpuComputePipeline.getBindGroupLayout(r)},t}(Qn),hQ=function(e){sr(t,e);function t(r){var n,i,o,a,s=r.id,u=r.device,l=r.descriptor,f=e.call(this,{id:s,device:u})||this;f.type=Lt.InputLayout;var c=[];try{for(var h=Oo(l.vertexBufferDescriptors),d=h.next();!d.done;d=h.next()){var p=d.value,v=p.arrayStride,g=p.stepMode,y=p.attributes;c.push({arrayStride:v,stepMode:iQ(g),attributes:[]});try{for(var S=(o=void 0,Oo(y)),R=S.next();!R.done;R=S.next()){var x=R.value,M=x.shaderLocation,$=x.format,F=x.offset;c[c.length-1].attributes.push({shaderLocation:M,format:oQ($),offset:F})}}catch(Y){o={error:Y}}finally{try{R&&!R.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}}}catch(Y){n={error:Y}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return f.indexFormat=nQ(l.indexBufferFormat),f.buffers=c,f}return t}(Qn),W1=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;return a.type=Lt.Program,a.vertexStage=null,a.fragmentStage=null,a.computeStage=null,a.descriptor=o,o.vertex&&(a.vertexStage=a.createShaderStage(o.vertex,"vertex")),o.fragment&&(a.fragmentStage=a.createShaderStage(o.fragment,"fragment")),o.compute&&(a.computeStage=a.createShaderStage(o.compute,"compute")),a}return t.prototype.setUniformsLegacy=function(r){},t.prototype.createShaderStage=function(r,n){var i,o,a=r.glsl,s=r.wgsl,u=r.entryPoint,l=r.postprocess,f=!1,c=s;if(!c)try{c=this.device.glsl_compile(a,n,f)}catch(y){throw console.error(y,a),new Error("whoops")}var h=function(y){if(!c.includes(y))return"continue";c=c.replace("var T_".concat(y,": texture_2d<f32>;"),"var T_".concat(y,": texture_depth_2d;")),c=c.replace(new RegExp("textureSample\\(T_".concat(y,"(.*)\\);$"),"gm"),function(S,R){return"vec4<f32>(textureSample(T_".concat(y).concat(R,"), 0.0, 0.0, 0.0);")})};try{for(var d=Oo(["u_TextureFramebufferDepth"]),p=d.next();!p.done;p=d.next()){var v=p.value;h(v)}}catch(y){i={error:y}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}l&&(c=l(c));var g=this.device.device.createShaderModule({code:c});return{module:g,entryPoint:u||"main"}},t}(Qn),dQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.QueryPool;var s=o.elemCount,u=o.type;return a.querySet=a.device.device.createQuerySet({type:GK(u),count:s}),a.resolveBuffer=a.device.device.createBuffer({size:s*8,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),a.cpuBuffer=a.device.device.createBuffer({size:s*8,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),a.results=null,a}return t.prototype.queryResultOcclusion=function(r){return this.results===null?null:this.results[r]!==BigInt(0)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.querySet.destroy(),this.resolveBuffer.destroy(),this.cpuBuffer.destroy()},t}(Qn),pQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=e.call(this,{id:n,device:i})||this;return o.type=Lt.Readback,o}return t.prototype.readTexture=function(r,n,i,o,a,s,u,l){return u===void 0&&(u=0),Ia(this,void 0,void 0,function(){var f,c,h,d,p,v,g,y;return Ma(this,function(S){return f=r,c=0,h=_x(f.gpuTextureformat),d=Math.ceil(o/h.width)*h.length,p=Math.ceil(d/256)*256,v=p*a,g=this.device.createBuffer({usage:Wt.STORAGE|Wt.MAP_READ|Wt.COPY_DST,hint:qn.STATIC,viewOrSize:v}),y=this.device.device.createCommandEncoder(),y.copyTextureToBuffer({texture:f.gpuTexture,mipLevel:0,origin:{x:n,y:i,z:Math.max(c,0)}},{buffer:g.gpuBuffer,offset:0,bytesPerRow:p},{width:o,height:a,depthOrArrayLayers:1}),this.device.device.queue.submit([y.finish()]),[2,this.readBuffer(g,0,s.byteLength===v?s:null,u,v,f.format,!0,!1,d,p,a)]})})},t.prototype.readTextureSync=function(r,n,i,o,a,s,u,l){throw new Error("ERROR_MSG_METHOD_NOT_IMPLEMENTED")},t.prototype.readBuffer=function(r,n,i,o,a,s,u,l,f,c,h){var d=this;n===void 0&&(n=0),i===void 0&&(i=null),a===void 0&&(a=0),s===void 0&&(s=X.U8_RGB),u===void 0&&(u=!1),f===void 0&&(f=0),c===void 0&&(c=0),h===void 0&&(h=0);var p=r,v=a||p.size,g=i||p.view,y=g&&g.constructor&&g.constructor.BYTES_PER_ELEMENT||rx(s),S=p;if(!(p.usage&Wt.MAP_READ&&p.usage&Wt.COPY_DST)){var R=this.device.device.createCommandEncoder();S=this.device.createBuffer({usage:Wt.STORAGE|Wt.MAP_READ|Wt.COPY_DST,hint:qn.STATIC,viewOrSize:v}),R.copyBufferToBuffer(p.gpuBuffer,n,S.gpuBuffer,0,v),this.device.device.queue.submit([R.finish()])}return new Promise(function(x,M){S.gpuBuffer.mapAsync(up.READ,n,v).then(function(){var $=S.gpuBuffer.getMappedRange(n,v),F=g;if(u)F===null?F=j1(s,v,!0,$):F=j1(s,F.buffer,void 0,$);else if(F===null)switch(y){case 1:F=new Uint8Array(v),F.set(new Uint8Array($));break;case 2:F=d.getHalfFloatAsFloatRGBAArrayBuffer(v/2,$);break;case 4:F=new Float32Array(v/4),F.set(new Float32Array($));break}else switch(y){case 1:F=new Uint8Array(F.buffer),F.set(new Uint8Array($));break;case 2:F=d.getHalfFloatAsFloatRGBAArrayBuffer(v/2,$,g);break;case 4:var Y=g&&g.constructor||Float32Array;F=new Y(F.buffer),F.set(new Y($));break}if(f!==c){y===1&&!u&&(f*=2,c*=2);for(var ge=new Uint8Array(F.buffer),q=f,k=0,G=1;G<h;++G){k=G*c;for(var K=0;K<f;++K)ge[q++]=ge[k++]}y!==0&&!u?F=new Float32Array(ge.buffer,0,q/4):F=new Uint8Array(ge.buffer,0,q)}S.gpuBuffer.unmap(),x(F)},function($){return M($)})})},t.prototype.getHalfFloatAsFloatRGBAArrayBuffer=function(r,n,i){i||(i=new Float32Array(r));for(var o=new Uint16Array(n);r--;)i[r]=uQ(o[r]);return i},t}(Qn),G1=function(){function e(t){this.device=t,this.gpuRenderPassEncoder=null,this.gfxColorAttachment=[],this.gfxColorAttachmentLevel=[],this.gfxColorResolveTo=[],this.gfxColorResolveToLevel=[],this.gfxDepthStencilAttachment=null,this.gfxDepthStencilResolveTo=null,this.gpuColorAttachments=[],this.gpuDepthStencilAttachment={view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},this.gpuRenderPassDescriptor={colorAttachments:this.gpuColorAttachments,depthStencilAttachment:this.gpuDepthStencilAttachment}}return e.prototype.getEncoder=function(){var t;return((t=this.renderBundle)===null||t===void 0?void 0:t.renderBundleEncoder)||this.gpuRenderPassEncoder},e.prototype.getTextureView=function(t,r){return ht(r<t.mipLevelCount),t.mipLevelCount===1?t.gpuTextureView:t.gpuTexture.createView({baseMipLevel:r,mipLevelCount:1})},e.prototype.setRenderPassDescriptor=function(t){var r,n,i,o,a,s;this.descriptor=t,this.gpuRenderPassDescriptor.colorAttachments=this.gpuColorAttachments;var u=t.colorAttachment.length;this.gfxColorAttachment.length=u,this.gfxColorResolveTo.length=u;for(var l=0;l<t.colorAttachment.length;l++){var f=t.colorAttachment[l],c=t.colorResolveTo[l];if(f===null&&c!==null&&(f=c,c=null),this.gfxColorAttachment[l]=f,this.gfxColorResolveTo[l]=c,this.gfxColorAttachmentLevel[l]=((r=t.colorAttachmentLevel)===null||r===void 0?void 0:r[l])||0,this.gfxColorResolveToLevel[l]=((n=t.colorResolveToLevel)===null||n===void 0?void 0:n[l])||0,f!==null){this.gpuColorAttachments[l]===void 0&&(this.gpuColorAttachments[l]={});var h=this.gpuColorAttachments[l];h.view=this.getTextureView(f,((i=this.gfxColorAttachmentLevel)===null||i===void 0?void 0:i[l])||0);var d=(a=(o=t.colorClearColor)===null||o===void 0?void 0:o[l])!==null&&a!==void 0?a:"load";d==="load"?h.loadOp="load":(h.loadOp="clear",h.clearValue=d),h.storeOp=!((s=t.colorStore)===null||s===void 0)&&s[l]?"store":"discard",h.resolveTarget=void 0,c!==null&&(f.sampleCount>1?h.resolveTarget=this.getTextureView(c,this.gfxColorResolveToLevel[l]):h.storeOp="store")}else{this.gpuColorAttachments.length=l,this.gfxColorAttachment.length=l,this.gfxColorResolveTo.length=l;break}}if(this.gfxDepthStencilAttachment=t.depthStencilAttachment,this.gfxDepthStencilResolveTo=t.depthStencilResolveTo,t.depthStencilAttachment){var p=t.depthStencilAttachment,h=this.gpuDepthStencilAttachment;h.view=p.gpuTextureView;var v=!!(ka(p.format)&$e.Depth);v?(t.depthClearValue==="load"?h.depthLoadOp="load":(h.depthLoadOp="clear",h.depthClearValue=t.depthClearValue),t.depthStencilStore||this.gfxDepthStencilResolveTo!==null?h.depthStoreOp="store":h.depthStoreOp="discard"):(h.depthLoadOp=void 0,h.depthStoreOp=void 0);var g=!!(ka(p.format)&$e.Stencil);g?(t.stencilClearValue==="load"?h.stencilLoadOp="load":(h.stencilLoadOp="clear",h.stencilClearValue=t.stencilClearValue),t.depthStencilStore||this.gfxDepthStencilResolveTo!==null?h.stencilStoreOp="store":h.stencilStoreOp="discard"):(h.stencilLoadOp=void 0,h.stencilStoreOp=void 0),this.gpuRenderPassDescriptor.depthStencilAttachment=this.gpuDepthStencilAttachment}else this.gpuRenderPassDescriptor.depthStencilAttachment=void 0;this.gpuRenderPassDescriptor.occlusionQuerySet=wn(t.occlusionQueryPool)?void 0:WK(t.occlusionQueryPool)},e.prototype.beginRenderPass=function(t,r){ht(this.gpuRenderPassEncoder===null),this.setRenderPassDescriptor(r),this.frameCommandEncoder=t,this.gpuRenderPassEncoder=this.frameCommandEncoder.beginRenderPass(this.gpuRenderPassDescriptor)},e.prototype.flipY=function(t,r){var n=this.device.swapChainHeight;return n-t-r},e.prototype.setViewport=function(t,r,n,i,o,a){o===void 0&&(o=0),a===void 0&&(a=1),this.gpuRenderPassEncoder.setViewport(t,this.flipY(r,i),n,i,o,a)},e.prototype.setScissorRect=function(t,r,n,i){this.gpuRenderPassEncoder.setScissorRect(t,this.flipY(r,i),n,i)},e.prototype.setPipeline=function(t){var r=t,n=Eo(r.gpuRenderPipeline);this.getEncoder().setPipeline(n)},e.prototype.setVertexInput=function(t,r,n){if(t!==null){var i=this.getEncoder(),o=t;n!==null&&i.setIndexBuffer(Aa(n.buffer),Eo(o.indexFormat),n.offset);for(var a=0;a<r.length;a++){var s=r[a];s!==null&&i.setVertexBuffer(a,Aa(s.buffer),s.offset)}}},e.prototype.setBindings=function(t){var r=t,n=this.getEncoder();r.gpuBindGroup.forEach(function(i,o){i&&n.setBindGroup(o,r.gpuBindGroup[o])})},e.prototype.setStencilReference=function(t){this.gpuRenderPassEncoder.setStencilReference(t)},e.prototype.draw=function(t,r,n,i){this.getEncoder().draw(t,r,n,i)},e.prototype.drawIndexed=function(t,r,n,i,o){this.getEncoder().drawIndexed(t,r,n,i,o)},e.prototype.drawIndirect=function(t,r){this.getEncoder().drawIndirect(Aa(t),r)},e.prototype.drawIndexedIndirect=function(t,r){this.getEncoder().drawIndexedIndirect(Aa(t),r)},e.prototype.beginOcclusionQuery=function(t){this.gpuRenderPassEncoder.beginOcclusionQuery(t)},e.prototype.endOcclusionQuery=function(){this.gpuRenderPassEncoder.endOcclusionQuery()},e.prototype.pushDebugGroup=function(t){this.gpuRenderPassEncoder.pushDebugGroup(t)},e.prototype.popDebugGroup=function(){this.gpuRenderPassEncoder.popDebugGroup()},e.prototype.insertDebugMarker=function(t){this.gpuRenderPassEncoder.insertDebugMarker(t)},e.prototype.beginBundle=function(t){this.renderBundle=t},e.prototype.endBundle=function(){this.renderBundle.finish()},e.prototype.executeBundles=function(t){this.gpuRenderPassEncoder.executeBundles(t.map(function(r){return r.renderBundle}))},e.prototype.finish=function(){var t;(t=this.gpuRenderPassEncoder)===null||t===void 0||t.end(),this.gpuRenderPassEncoder=null;for(var r=0;r<this.gfxColorAttachment.length;r++){var n=this.gfxColorAttachment[r],i=this.gfxColorResolveTo[r];n!==null&&i!==null&&n.sampleCount===1&&this.copyAttachment(i,this.gfxColorAttachmentLevel[r],n,this.gfxColorResolveToLevel[r])}this.gfxDepthStencilAttachment&&this.gfxDepthStencilResolveTo&&(this.gfxDepthStencilAttachment.sampleCount>1||this.copyAttachment(this.gfxDepthStencilResolveTo,0,this.gfxDepthStencilAttachment,0)),this.frameCommandEncoder=null},e.prototype.copyAttachment=function(t,r,n,i){ht(n.sampleCount===1);var o={texture:n.gpuTexture,mipLevel:i},a={texture:t.gpuTexture,mipLevel:r};ht(n.width>>>i===t.width>>>r),ht(n.height>>>i===t.height>>>r),ht(!!(n.usage&Cr.COPY_SRC)),ht(!!(t.usage&Cr.COPY_DST)),this.frameCommandEncoder.copyTextureToTexture(o,a,[t.width,t.height,1])},e}(),_Q=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;return a.type=Lt.RenderPipeline,a.isCreatingAsync=!1,a.gpuRenderPipeline=null,a.descriptor=o,a.device.createRenderPipelineInternal(a,!1),a}return t.prototype.getBindGroupLayout=function(r){return this.gpuRenderPipeline.getBindGroupLayout(r)},t}(Qn),vQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a,s,u=e.call(this,{id:n,device:i})||this;u.type=Lt.Sampler;var l=o.lodMinClamp,f=o.mipmapFilter===Or.NO_MIP?o.lodMinClamp:o.lodMaxClamp,c=(a=o.maxAnisotropy)!==null&&a!==void 0?a:1;return c>1&&ht(o.minFilter===lr.BILINEAR&&o.magFilter===lr.BILINEAR&&o.mipmapFilter===Or.LINEAR),u.gpuSampler=u.device.device.createSampler({addressModeU:nd(o.addressModeU),addressModeV:nd(o.addressModeV),addressModeW:nd((s=o.addressModeW)!==null&&s!==void 0?s:o.addressModeU),lodMinClamp:l,lodMaxClamp:f,minFilter:$1(o.minFilter),magFilter:$1(o.magFilter),mipmapFilter:jK(o.mipmapFilter),compare:o.compareFunction!==void 0?oc(o.compareFunction):void 0,maxAnisotropy:c}),u}return t}(Qn),Vl=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=r.skipCreate,s=r.sampleCount,u=e.call(this,{id:n,device:i})||this;u.type=Lt.Texture,u.flipY=!1;var l=o.format,f=o.dimension,c=o.width,h=o.height,d=o.depthOrArrayLayers,p=o.mipLevelCount,v=o.usage,g=o.pixelStore;return u.flipY=!!(g!=null&&g.unpackFlipY),u.device.createTextureShared({format:l,dimension:f??bt.TEXTURE_2D,width:c,height:h,depthOrArrayLayers:d??1,mipLevelCount:p??1,usage:v,sampleCount:s??1},u,a),u}return t.prototype.textureFromImageBitmapOrCanvas=function(r,n,i){for(var o=n[0].width,a=n[0].height,s={size:{width:o,height:a,depthOrArrayLayers:i},format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT},u=r.createTexture(s),l=0;l<n.length;l++)r.queue.copyExternalImageToTexture({source:n[l],flipY:this.flipY},{texture:u,origin:[0,0,l]},[o,a]);return[u,o,a]},t.prototype.isImageBitmapOrCanvases=function(r){var n=r[0];return n instanceof ImageBitmap||n instanceof HTMLCanvasElement||n instanceof OffscreenCanvas},t.prototype.isVideo=function(r){var n=r[0];return n instanceof HTMLVideoElement},t.prototype.setImageData=function(r,n){var i,o=this,a=this.device.device,s,u,l;if(this.isImageBitmapOrCanvases(r))i=Xn(this.textureFromImageBitmapOrCanvas(a,r,this.depthOrArrayLayers),3),s=i[0],u=i[1],l=i[2];else if(this.isVideo(r))s=a.importExternalTexture({source:r[0]});else{var f=_x(this.gpuTextureformat),c=Math.ceil(this.width/f.width)*f.length;r.forEach(function(h){a.queue.writeTexture({texture:o.gpuTexture},h,{bytesPerRow:c},{width:o.width,height:o.height})})}this.width=u,this.height=l,s&&(this.gpuTexture=s),this.gpuTextureView=this.gpuTexture.createView({dimension:VK(this.dimension)})},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.gpuTexture.destroy()},t}(Qn),mQ=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=e.call(this,{id:n,device:i})||this;return o.type=Lt.RenderBundle,o.renderBundleEncoder=o.device.device.createRenderBundleEncoder({colorFormats:[o.device.swapChainFormat]}),o}return t.prototype.finish=function(){this.renderBundle=this.renderBundleEncoder.finish()},t}(Qn),gQ=function(){function e(t,r,n,i,o,a){this.swapChainWidth=0,this.swapChainHeight=0,this.swapChainTextureUsage=Cr.RENDER_ATTACHMENT|Cr.COPY_DST,this._resourceUniqueId=0,this.renderPassPool=[],this.computePassPool=[],this.frameCommandEncoderPool=[],this.featureTextureCompressionBC=!1,this.platformString="WebGPU",this.glslVersion="#version 440",this.explicitBindingLocations=!0,this.separateSamplerTextures=!0,this.viewportOrigin=Zn.UPPER_LEFT,this.clipSpaceNearZ=Ua.ZERO,this.supportsSyncPipelineCompilation=!1,this.supportMRT=!0,this.device=r,this.canvas=n,this.canvasContext=i,this.glsl_compile=o,this.WGSLComposer=a,this.fallbackTexture2D=this.createFallbackTexture(bt.TEXTURE_2D,or.Float),this.setResourceName(this.fallbackTexture2D,"Fallback Texture2D"),this.fallbackTexture2DDepth=this.createFallbackTexture(bt.TEXTURE_2D,or.Depth),this.setResourceName(this.fallbackTexture2DDepth,"Fallback Depth Texture2D"),this.fallbackTexture2DArray=this.createFallbackTexture(bt.TEXTURE_2D_ARRAY,or.Float),this.setResourceName(this.fallbackTexture2DArray,"Fallback Texture2DArray"),this.fallbackTexture3D=this.createFallbackTexture(bt.TEXTURE_3D,or.Float),this.setResourceName(this.fallbackTexture3D,"Fallback Texture3D"),this.fallbackTextureCube=this.createFallbackTexture(bt.TEXTURE_CUBE_MAP,or.Float),this.setResourceName(this.fallbackTextureCube,"Fallback TextureCube"),this.fallbackSamplerFiltering=this.createSampler({addressModeU:tn.REPEAT,addressModeV:tn.REPEAT,minFilter:lr.POINT,magFilter:lr.POINT,mipmapFilter:Or.NEAREST}),this.setResourceName(this.fallbackSamplerFiltering,"Fallback Sampler Filtering"),this.fallbackSamplerComparison=this.createSampler({addressModeU:tn.REPEAT,addressModeV:tn.REPEAT,minFilter:lr.POINT,magFilter:lr.POINT,mipmapFilter:Or.NEAREST,compareFunction:kt.ALWAYS}),this.setResourceName(this.fallbackSamplerComparison,"Fallback Sampler Comparison Filtering"),this.device.features&&(this.featureTextureCompressionBC=this.device.features.has("texture-compression-bc")),this.device.onuncapturederror=function(s){console.error(s.error)},this.swapChainFormat=navigator.gpu.getPreferredCanvasFormat(),this.canvasContext.configure({device:this.device,format:this.swapChainFormat,usage:this.swapChainTextureUsage,alphaMode:"premultiplied"})}return e.prototype.destroy=function(){},e.prototype.configureSwapChain=function(t,r){this.swapChainWidth===t&&this.swapChainHeight===r||(this.swapChainWidth=t,this.swapChainHeight=r)},e.prototype.getOnscreenTexture=function(){var t=this.canvasContext.getCurrentTexture(),r=t.createView(),n=new Vl({id:0,device:this,descriptor:{format:X.U8_RGBA_RT,width:this.swapChainWidth,height:this.swapChainHeight,depthOrArrayLayers:0,dimension:bt.TEXTURE_2D,mipLevelCount:1,usage:this.swapChainTextureUsage},skipCreate:!0});return n.depthOrArrayLayers=1,n.sampleCount=1,n.gpuTexture=t,n.gpuTextureView=r,n.name="Onscreen",this.setResourceName(n,"Onscreen Texture"),n},e.prototype.getDevice=function(){return this},e.prototype.getCanvas=function(){return this.canvas},e.prototype.beginFrame=function(){ht(this.frameCommandEncoderPool.length===0)},e.prototype.endFrame=function(){ht(this.frameCommandEncoderPool.every(function(t){return t!==null})),this.device.queue.submit(this.frameCommandEncoderPool.map(function(t){return t.finish()})),this.frameCommandEncoderPool=[]},e.prototype.getNextUniqueId=function(){return++this._resourceUniqueId},e.prototype.createBuffer=function(t){return new cQ({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createTexture=function(t){return new Vl({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createSampler=function(t){return new vQ({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createRenderTarget=function(t){var r=new Vl({id:this.getNextUniqueId(),device:this,descriptor:nr(nr({},t),{dimension:bt.TEXTURE_2D,mipLevelCount:1,depthOrArrayLayers:1,usage:qr.RENDER_TARGET}),sampleCount:t.sampleCount});return r.depthOrArrayLayers=1,r.type=Lt.RenderTarget,r},e.prototype.createRenderTargetFromTexture=function(t){var r=t,n=r.format,i=r.width,o=r.height,a=r.depthOrArrayLayers,s=r.sampleCount,u=r.mipLevelCount,l=r.gpuTexture,f=r.gpuTextureView,c=r.usage;ht(!!(c&Cr.RENDER_ATTACHMENT));var h=new Vl({id:this.getNextUniqueId(),device:this,descriptor:{format:n,width:i,height:o,depthOrArrayLayers:a,dimension:bt.TEXTURE_2D,mipLevelCount:u,usage:c},skipCreate:!0});return h.depthOrArrayLayers=a,h.sampleCount=s,h.gpuTexture=l,h.gpuTextureView=f,h},e.prototype.createProgram=function(t){var r,n;return!((r=t.vertex)===null||r===void 0)&&r.glsl&&(t.vertex.glsl=Va(this.queryVendorInfo(),"vert",t.vertex.glsl)),!((n=t.fragment)===null||n===void 0)&&n.glsl&&(t.fragment.glsl=Va(this.queryVendorInfo(),"frag",t.fragment.glsl)),new W1({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createProgramSimple=function(t){return new W1({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createTextureShared=function(t,r,n){var i={width:t.width,height:t.height,depthOrArrayLayers:t.depthOrArrayLayers},o=t.mipLevelCount,a=u_(t.format),s=zK(t.dimension),u=$K(t.usage);if(r.gpuTextureformat=a,r.dimension=t.dimension,r.format=t.format,r.width=t.width,r.height=t.height,r.depthOrArrayLayers=t.depthOrArrayLayers,r.mipLevelCount=o,r.usage=u,r.sampleCount=t.sampleCount,!n){var l=this.device.createTexture({size:i,mipLevelCount:o,format:a,dimension:s,sampleCount:t.sampleCount,usage:u}),f=l.createView();r.gpuTexture=l,r.gpuTextureView=f}},e.prototype.getFallbackSampler=function(t){var r=t.formatKind;return r===or.Depth&&t.comparison?this.fallbackSamplerComparison:this.fallbackSamplerFiltering},e.prototype.getFallbackTexture=function(t){var r=t.dimension,n=t.formatKind;if(r===bt.TEXTURE_2D)return n===or.Depth?this.fallbackTexture2DDepth:this.fallbackTexture2D;if(r===bt.TEXTURE_2D_ARRAY)return this.fallbackTexture2DArray;if(r===bt.TEXTURE_3D)return this.fallbackTexture3D;if(r===bt.TEXTURE_CUBE_MAP)return this.fallbackTextureCube;throw new Error("whoops")},e.prototype.createFallbackTexture=function(t,r){var n=t===bt.TEXTURE_CUBE_MAP?6:1,i=r===or.Float?X.U8_RGBA_NORM:X.D24;return this.createTexture({dimension:t,format:i,usage:qr.SAMPLED,width:1,height:1,depthOrArrayLayers:n,mipLevelCount:1})},e.prototype.createBindings=function(t){return new lQ({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createInputLayout=function(t){return new hQ({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createComputePipeline=function(t){return new fQ({id:this.getNextUniqueId(),device:this,descriptor:t})},e.prototype.createRenderPipeline=function(t){return new _Q({id:this.getNextUniqueId(),device:this,descriptor:nr({},t)})},e.prototype.createQueryPool=function(t,r){return new dQ({id:this.getNextUniqueId(),device:this,descriptor:{type:t,elemCount:r}})},e.prototype.createRenderPipelineInternal=function(t,r){var n;if(t.gpuRenderPipeline===null){var i=t.descriptor,o=i.program,a=o.vertexStage,s=o.fragmentStage;if(!(a===null||s===null)){var u=i.megaStateDescriptor||{},l=u.stencilBack,f=u.stencilFront,c=bq(u,["stencilBack","stencilFront"]),h=$a(za);i.megaStateDescriptor=nr(nr(nr({},h),{stencilBack:nr(nr({},h.stencilBack),l),stencilFront:nr(nr({},h.stencilFront),f)}),c);var d=i.megaStateDescriptor.attachmentsState[0];i.colorAttachmentFormats.forEach(function(x,M){i.megaStateDescriptor.attachmentsState[M]||(i.megaStateDescriptor.attachmentsState[M]=sx(void 0,d))});var p=KK((n=i.topology)!==null&&n!==void 0?n:gr.TRIANGLES,i.megaStateDescriptor),v=tQ(i.colorAttachmentFormats,i.megaStateDescriptor),g=rQ(i.depthStencilAttachmentFormat,i.megaStateDescriptor),y=void 0;i.inputLayout!==null&&(y=i.inputLayout.buffers);var S=i.sampleCount,R={layout:"auto",vertex:nr(nr({},a),{buffers:y}),primitive:p,depthStencil:g,multisample:{count:S},fragment:nr(nr({},s),{targets:v})};t.gpuRenderPipeline=this.device.createRenderPipeline(R)}}},e.prototype.createReadback=function(){return new pQ({id:this.getNextUniqueId(),device:this})},e.prototype.createRenderBundle=function(){return new mQ({id:this.getNextUniqueId(),device:this})},e.prototype.createRenderPass=function(t){var r=this.renderPassPool.pop();r===void 0&&(r=new G1(this));var n=this.frameCommandEncoderPool.pop();return n===void 0&&(n=this.device.createCommandEncoder()),r.beginRenderPass(n,t),r},e.prototype.createComputePass=function(){var t=this.computePassPool.pop();t===void 0&&(t=new X1);var r=this.frameCommandEncoderPool.pop();return r===void 0&&(r=this.device.createCommandEncoder()),t.beginComputePass(r),t},e.prototype.submitPass=function(t){var r=t;r instanceof G1?(this.frameCommandEncoderPool.push(r.frameCommandEncoder),r.finish(),this.renderPassPool.push(r)):r instanceof X1&&(this.frameCommandEncoderPool.push(r.frameCommandEncoder),r.finish(),this.computePassPool.push(r))},e.prototype.copySubTexture2D=function(t,r,n,i,o,a,s){var u=this.device.createCommandEncoder(),l=t,f=i,c={texture:f.gpuTexture,origin:[o,a,0],mipLevel:0,aspect:"all"},h={texture:l.gpuTexture,origin:[r,n,0],mipLevel:0,aspect:"all"};ht(!!(f.usage&Cr.COPY_SRC)),ht(!!(l.usage&Cr.COPY_DST)),u.copyTextureToTexture(c,h,[f.width,f.height,s||1]),this.device.queue.submit([u.finish()])},e.prototype.queryLimits=function(){return{uniformBufferMaxPageWordSize:this.device.limits.maxUniformBufferBindingSize>>>2,uniformBufferWordAlignment:this.device.limits.minUniformBufferOffsetAlignment>>>2,supportedSampleCounts:[1],occlusionQueriesRecommended:!0,computeShadersSupported:!0}},e.prototype.queryTextureFormatSupported=function(t,r,n){if(aQ(t)){if(!this.featureTextureCompressionBC)return!1;var i=sQ(t);return r%i!==0||n%i!==0?!1:this.featureTextureCompressionBC}switch(t){case X.U16_RGBA_NORM:return!1;case X.F32_RGBA:return!1}return!0},e.prototype.queryPlatformAvailable=function(){return!0},e.prototype.queryVendorInfo=function(){return this},e.prototype.queryRenderPass=function(t){var r=t;return r.descriptor},e.prototype.queryRenderTarget=function(t){var r=t;return r},e.prototype.setResourceName=function(t,r){if(t.name=r,t.type===Lt.Buffer){var n=t;n.gpuBuffer.label=r}else if(t.type===Lt.Texture){var n=t;n.gpuTexture.label=r,n.gpuTextureView.label=r}else if(t.type===Lt.RenderTarget){var n=t;n.gpuTexture.label=r,n.gpuTextureView.label=r}else if(t.type===Lt.Sampler){var n=t;n.gpuSampler.label=r}else if(t.type===Lt.RenderPipeline){var n=t;n.gpuRenderPipeline!==null&&(n.gpuRenderPipeline.label=r)}},e.prototype.setResourceLeakCheck=function(t,r){},e.prototype.checkForLeaks=function(){},e.prototype.programPatched=function(t){},e.prototype.pipelineQueryReady=function(t){var r=t;return r.gpuRenderPipeline!==null},e.prototype.pipelineForceReady=function(t){var r=t;this.createRenderPipelineInternal(r,!1)},e}(),EQ=function(){function e(t){this.pluginOptions=t}return e.prototype.createSwapChain=function(t){return Ia(this,void 0,void 0,function(){var r,n,i,o,a,s,u,l;return Ma(this,function(f){switch(f.label){case 0:if(globalThis.navigator.gpu===void 0)return[2,null];r=null,f.label=1;case 1:return f.trys.push([1,3,,4]),n=this.pluginOptions.xrCompatible,[4,globalThis.navigator.gpu.requestAdapter({xrCompatible:n})];case 2:return r=f.sent(),[3,4];case 3:return i=f.sent(),console.log(i),[3,4];case 4:return r===null?[2,null]:(o=["depth32float-stencil8","texture-compression-bc","float32-filterable"],a=o.filter(function(c){return r.features.has(c)}),[4,r.requestDevice({requiredFeatures:a})]);case 5:if(s=f.sent(),s&&(u=this.pluginOptions.onContextLost,s.lost.then(function(){u&&u()})),s===null)return[2,null];if(l=t.getContext("webgpu"),!l)return[2,null];f.label=6;case 6:return f.trys.push([6,8,,9]),[4,px(this.pluginOptions.shaderCompilerPath)];case 7:return f.sent(),[3,9];case 8:return f.sent(),[3,9];case 9:return[2,new gQ(r,s,t,l,BK,Ou&&new Ou)]}})})},e}(),yQ=class{constructor(e,t){const{buffer:r,offset:n,stride:i,normalized:o,size:a,divisor:s,shaderLocation:u}=t;this.buffer=r,this.attribute={shaderLocation:u,buffer:r.get(),offset:n||0,stride:i||0,normalized:o||!1,divisor:s||0},a&&(this.attribute.size=a)}get(){return this.buffer}updateBuffer(e){this.buffer.subData(e)}destroy(){this.buffer.destroy()}},Wc={[m.FLOAT]:Float32Array,[m.UNSIGNED_BYTE]:Uint8Array,[m.SHORT]:Int16Array,[m.UNSIGNED_SHORT]:Uint16Array,[m.INT]:Int32Array,[m.UNSIGNED_INT]:Uint32Array},TQ={[m.POINTS]:gr.POINTS,[m.LINES]:gr.LINES,[m.LINE_LOOP]:gr.LINES,[m.LINE_STRIP]:gr.LINE_STRIP,[m.TRIANGLES]:gr.TRIANGLES,[m.TRIANGLE_FAN]:gr.TRIANGLES,[m.TRIANGLE_STRIP]:gr.TRIANGLE_STRIP},AQ={1:X.F32_R,2:X.F32_RG,3:X.F32_RGB,4:X.F32_RGBA},SQ={[m.STATIC_DRAW]:qn.STATIC,[m.DYNAMIC_DRAW]:qn.DYNAMIC,[m.STREAM_DRAW]:qn.DYNAMIC},Y1={[m.REPEAT]:tn.REPEAT,[m.CLAMP_TO_EDGE]:tn.CLAMP_TO_EDGE,[m.MIRRORED_REPEAT]:tn.MIRRORED_REPEAT},xQ={[m.NEVER]:kt.NEVER,[m.ALWAYS]:kt.ALWAYS,[m.LESS]:kt.LESS,[m.LEQUAL]:kt.LEQUAL,[m.GREATER]:kt.GREATER,[m.GEQUAL]:kt.GEQUAL,[m.EQUAL]:kt.EQUAL,[m.NOTEQUAL]:kt.NOTEQUAL},bQ={[m.FRONT]:pn.FRONT,[m.BACK]:pn.BACK},Z1={[m.FUNC_ADD]:wr.ADD,[m.MIN_EXT]:wr.MIN,[m.MAX_EXT]:wr.MAX,[m.FUNC_SUBTRACT]:wr.SUBSTRACT,[m.FUNC_REVERSE_SUBTRACT]:wr.REVERSE_SUBSTRACT},Hl={[m.ZERO]:xt.ZERO,[m.ONE]:xt.ONE,[m.SRC_COLOR]:xt.SRC,[m.ONE_MINUS_SRC_COLOR]:xt.ONE_MINUS_SRC,[m.SRC_ALPHA]:xt.SRC_ALPHA,[m.ONE_MINUS_SRC_ALPHA]:xt.ONE_MINUS_SRC_ALPHA,[m.DST_COLOR]:xt.DST,[m.ONE_MINUS_DST_COLOR]:xt.ONE_MINUS_DST,[m.DST_ALPHA]:xt.DST_ALPHA,[m.ONE_MINUS_DST_ALPHA]:xt.ONE_MINUS_DST_ALPHA,[m.CONSTANT_COLOR]:xt.CONST,[m.ONE_MINUS_CONSTANT_COLOR]:xt.ONE_MINUS_CONSTANT,[m.CONSTANT_ALPHA]:xt.CONST,[m.ONE_MINUS_CONSTANT_ALPHA]:xt.ONE_MINUS_CONSTANT,[m.SRC_ALPHA_SATURATE]:xt.SRC_ALPHA_SATURATE},pa={[m.REPLACE]:ar.REPLACE,[m.KEEP]:ar.KEEP,[m.ZERO]:ar.ZERO,[m.INVERT]:ar.INVERT,[m.INCR]:ar.INCREMENT_CLAMP,[m.DECR]:ar.DECREMENT_CLAMP,[m.INCR_WRAP]:ar.INCREMENT_WRAP,[m.DECR_WRAP]:ar.DECREMENT_WRAP},RQ={[m.ALWAYS]:kt.ALWAYS,[m.EQUAL]:kt.EQUAL,[m.GEQUAL]:kt.GEQUAL,[m.GREATER]:kt.GREATER,[m.LEQUAL]:kt.LEQUAL,[m.LESS]:kt.LESS,[m.NEVER]:kt.NEVER,[m.NOTEQUAL]:kt.NOTEQUAL},CQ={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121};function Gc(e){return Object.prototype.toString.call(e)in CQ}function OQ(e,t){const r=e.length,n=Math.ceil(r/3),i=r+n,o=new Float32Array(i);for(let a=0;a<i;a+=4)o[a]=e[a/4*3],o[a+1]=e[a/4*3+1],o[a+2]=e[a/4*3+2],o[a+3]=t;return o}var IQ=class{constructor(e,t){this.isDestroyed=!1;const{data:r,usage:n,type:i,isUBO:o,label:a}=t;let s;Gc(r)?s=r:s=new Wc[this.type||m.FLOAT](r),this.type=i,this.size=s.byteLength,this.buffer=e.createBuffer({viewOrSize:s,usage:o?Wt.UNIFORM:Wt.VERTEX,hint:SQ[n||m.STATIC_DRAW]}),a&&e.setResourceName(this.buffer,a)}get(){return this.buffer}destroy(){this.isDestroyed||this.buffer.destroy(),this.isDestroyed=!0}subData({data:e,offset:t}){let r;Gc(e)?r=e:r=new Wc[this.type||m.FLOAT](e),this.buffer.setSubData(t,new Uint8Array(r.buffer))}};function $t(e,t=0){return e+=t,e+=e<<10,e+=e>>>6,e>>>0}function vx(e){return e+=e<<3,e^=e>>>11,e+=e<<15,e>>>0}function q1(){return 0}var MQ=class{constructor(){this.keys=[],this.values=[]}},jl=class{constructor(e,t){this.keyEqualFunc=e,this.keyHashFunc=t,this.buckets=new Map}findBucketIndex(e,t){for(let r=0;r<e.keys.length;r++)if(this.keyEqualFunc(t,e.keys[r]))return r;return-1}findBucket(e){const t=this.keyHashFunc(e);return this.buckets.get(t)}get(e){const t=this.findBucket(e);if(t===void 0)return null;const r=this.findBucketIndex(t,e);return r<0?null:t.values[r]}add(e,t){const r=this.keyHashFunc(e);this.buckets.get(r)===void 0&&this.buckets.set(r,new MQ);const n=this.buckets.get(r);n.keys.push(e),n.values.push(t)}delete(e){const t=this.findBucket(e);if(t===void 0)return;const r=this.findBucketIndex(t,e);r!==-1&&(t.keys.splice(r,1),t.values.splice(r,1))}clear(){this.buckets.clear()}size(){let e=0;for(const t of this.buckets.values())e+=t.values.length;return e}*values(){for(const e of this.buckets.values())for(let t=e.values.length-1;t>=0;t--)yield e.values[t]}};function K1(e,t){return e=$t(e,t.blendMode),e=$t(e,t.blendSrcFactor),e=$t(e,t.blendDstFactor),e}function NQ(e,t){return e=K1(e,t.rgbBlendState),e=K1(e,t.alphaBlendState),e=$t(e,t.channelWriteMask),e}function PQ(e,t){return e=$t(e,t.r<<24|t.g<<16|t.b<<8|t.a),e}function LQ(e,t){var r,n,i,o,a,s,u,l;for(let f=0;f<t.attachmentsState.length;f++)e=NQ(e,t.attachmentsState[f]);return e=PQ(e,t.blendConstant||vf),e=$t(e,t.depthCompare),e=$t(e,t.depthWrite?1:0),e=$t(e,(r=t.stencilFront)==null?void 0:r.compare),e=$t(e,(n=t.stencilFront)==null?void 0:n.passOp),e=$t(e,(i=t.stencilFront)==null?void 0:i.failOp),e=$t(e,(o=t.stencilFront)==null?void 0:o.depthFailOp),e=$t(e,(a=t.stencilBack)==null?void 0:a.compare),e=$t(e,(s=t.stencilBack)==null?void 0:s.passOp),e=$t(e,(u=t.stencilBack)==null?void 0:u.failOp),e=$t(e,(l=t.stencilBack)==null?void 0:l.depthFailOp),e=$t(e,t.stencilWrite?1:0),e=$t(e,t.cullMode),e=$t(e,t.frontFace?1:0),e=$t(e,t.polygonOffset?1:0),e}function wQ(e){let t=0;t=$t(t,e.program.id),e.inputLayout!==null&&(t=$t(t,e.inputLayout.id)),t=LQ(t,e.megaStateDescriptor);for(let r=0;r<e.colorAttachmentFormats.length;r++)t=$t(t,e.colorAttachmentFormats[r]||0);return t=$t(t,e.depthStencilAttachmentFormat||0),vx(t)}function FQ(e){let t=0;if(e.samplerBindings)for(let r=0;r<e.samplerBindings.length;r++){const n=e.samplerBindings[r];n!==null&&n.texture!==null&&(t=$t(t,n.texture.id))}if(e.uniformBufferBindings)for(let r=0;r<e.uniformBufferBindings.length;r++){const n=e.uniformBufferBindings[r];n!==null&&n.buffer!==null&&(t=$t(t,n.buffer.id),t=$t(t,n.binding),t=$t(t,n.offset),t=$t(t,n.size))}if(e.storageBufferBindings)for(let r=0;r<e.storageBufferBindings.length;r++){const n=e.storageBufferBindings[r];n!==null&&n.buffer!==null&&(t=$t(t,n.buffer.id),t=$t(t,n.binding),t=$t(t,n.offset),t=$t(t,n.size))}if(e.storageTextureBindings)for(let r=0;r<e.storageTextureBindings.length;r++){const n=e.storageTextureBindings[r];n!==null&&n.texture!==null&&(t=$t(t,n.texture.id),t=$t(t,n.binding))}return vx(t)}function BQ(e,t){var r,n,i,o;return((r=e.vertex)==null?void 0:r.glsl)===((n=t.vertex)==null?void 0:n.glsl)&&((i=e.fragment)==null?void 0:i.glsl)===((o=t.fragment)==null?void 0:o.glsl)}function DQ(e){var t,r;return{vertex:{glsl:(t=e.vertex)==null?void 0:t.glsl},fragment:{glsl:(r=e.fragment)==null?void 0:r.glsl}}}var UQ=class{constructor(e){this.device=e,this.bindingsCache=new jl(Dq,FQ),this.renderPipelinesCache=new jl(zq,wQ),this.inputLayoutsCache=new jl(jq,q1),this.programCache=new jl(BQ,q1)}createBindings(e){var t;let r=this.bindingsCache.get(e);if(r===null){const n=Gq(e);n.uniformBufferBindings=(t=n.uniformBufferBindings)==null?void 0:t.filter(({size:i})=>i&&i>0),r=this.device.createBindings(n),this.bindingsCache.add(n,r)}return r}createRenderPipeline(e){let t=this.renderPipelinesCache.get(e);if(t===null){const r=Yq(e);r.colorAttachmentFormats=r.colorAttachmentFormats.filter(n=>n),t=this.device.createRenderPipeline(r),this.renderPipelinesCache.add(r,t)}return t}createInputLayout(e){e.vertexBufferDescriptors=e.vertexBufferDescriptors.filter(r=>!!r);let t=this.inputLayoutsCache.get(e);if(t===null){const r=Kq(e);t=this.device.createInputLayout(r),this.inputLayoutsCache.add(r,t)}return t}createProgram(e){let t=this.programCache.get(e);if(t===null){const r=DQ(e);t=this.device.createProgram(e),this.programCache.add(r,t)}return t}destroy(){for(const e of this.bindingsCache.values())e.destroy();for(const e of this.renderPipelinesCache.values())e.destroy();for(const e of this.inputLayoutsCache.values())e.destroy();for(const e of this.programCache.values())e.destroy();this.bindingsCache.clear(),this.renderPipelinesCache.clear(),this.inputLayoutsCache.clear(),this.programCache.clear()}},kQ=class{constructor(e,t){const{data:r,type:n,count:i=0}=t;let o;Gc(r)?o=r:o=new Wc[this.type||m.UNSIGNED_INT](r),this.type=n,this.count=i,this.indexBuffer=e.createBuffer({viewOrSize:o,usage:Wt.INDEX})}get(){return this.indexBuffer}subData({data:e}){let t;Gc(e)?t=e:t=new Wc[this.type||m.UNSIGNED_INT](e),this.indexBuffer.setSubData(0,new Uint8Array(t.buffer))}destroy(){this.indexBuffer.destroy()}};function Q1(e){return!!(e&&e.texture)}var mx=class{constructor(e,t){this.device=e,this.options=t,this.isDestroy=!1;const{wrapS:r=m.CLAMP_TO_EDGE,wrapT:n=m.CLAMP_TO_EDGE,aniso:i,mag:o=m.NEAREST,min:a=m.NEAREST}=t;this.createTexture(t),this.sampler=e.createSampler({addressModeU:Y1[r],addressModeV:Y1[n],minFilter:a===m.NEAREST?lr.POINT:lr.BILINEAR,magFilter:o===m.NEAREST?lr.POINT:lr.BILINEAR,mipmapFilter:Or.NO_MIP,maxAnisotropy:i})}createTexture(e){const{type:t=m.UNSIGNED_BYTE,width:r,height:n,flipY:i=!1,format:o=m.RGBA,alignment:a=1,usage:s=pu.SAMPLED,unorm:u=!1,label:l}=e;let{data:f}=e;this.width=r,this.height=n;let c=X.U8_RGBA_RT;if(t===m.UNSIGNED_BYTE&&o===m.RGBA)c=u?X.U8_RGBA_NORM:X.U8_RGBA_RT;else if(t===m.UNSIGNED_BYTE&&o===m.LUMINANCE)c=X.U8_LUMINANCE;else if(t===m.FLOAT&&o===m.LUMINANCE)c=X.F32_LUMINANCE;else if(t===m.FLOAT&&o===m.RGB)this.device.queryVendorInfo().platformString==="WebGPU"?(f&&(f=OQ(f,0)),c=X.F32_RGBA):c=X.F32_RGB;else if(t===m.FLOAT&&o===m.RGBA)c=X.F32_RGBA;else if(t===m.FLOAT&&o===m.RED)c=X.F32_R;else throw new Error(`create texture error, type: ${t}, format: ${o}`);this.texture=this.device.createTexture({format:c,width:r,height:n,usage:s===pu.SAMPLED?qr.SAMPLED:qr.RENDER_TARGET,pixelStore:{unpackFlipY:i,packAlignment:a},mipLevelCount:1}),l&&this.device.setResourceName(this.texture,l),f&&this.texture.setImageData([f])}get(){return this.texture}update(e){const{data:t}=e;this.texture.setImageData([t])}bind(){}resize({width:e,height:t}){(this.width!==e||this.height!==t)&&this.destroy(),this.options.width=e,this.options.height=t,this.createTexture(this.options),this.isDestroy=!1}getSize(){return[this.width,this.height]}destroy(){var e;!this.isDestroy&&!this.texture.destroyed&&((e=this.texture)==null||e.destroy()),this.isDestroy=!0}},gx=class{constructor(e,t){this.device=e,this.options=t,this.createColorRenderTarget(),this.createDepthRenderTarget()}createColorRenderTarget(e=!1){const{width:t,height:r,color:n}=this.options;n&&(Q1(n)?(e&&n.resize({width:t,height:r}),this.colorTexture=n.get(),this.colorRenderTarget=this.device.createRenderTargetFromTexture(this.colorTexture),this.width=n.width,this.height=n.height):t&&r&&(this.colorTexture=this.device.createTexture({format:X.U8_RGBA_RT,usage:qr.RENDER_TARGET,width:t,height:r}),this.colorRenderTarget=this.device.createRenderTargetFromTexture(this.colorTexture),this.width=t,this.height=r))}createDepthRenderTarget(e=!1){const{width:t,height:r,depth:n}=this.options;n&&(Q1(n)?(e&&n.resize({width:t,height:r}),this.depthTexture=n.get(),this.depthRenderTarget=this.device.createRenderTargetFromTexture(this.depthTexture),this.width=n.width,this.height=n.height):t&&r&&(this.depthTexture=this.device.createTexture({format:X.D24_S8,usage:qr.RENDER_TARGET,width:t,height:r}),this.depthRenderTarget=this.device.createRenderTargetFromTexture(this.depthTexture),this.width=t,this.height=r))}get(){return this.colorRenderTarget}destroy(){var e,t;(e=this.colorRenderTarget)==null||e.destroy(),(t=this.depthRenderTarget)==null||t.destroy()}resize({width:e,height:t}){(this.width!==e||this.height!==t)&&(this.destroy(),this.colorTexture.destroyed=!0,this.depthTexture.destroyed=!0,this.options.width=e,this.options.height=t,this.createColorRenderTarget(!0),this.createDepthRenderTarget(!0))}},$Q=Object.defineProperty,zQ=Object.defineProperties,VQ=Object.getOwnPropertyDescriptors,J1=Object.getOwnPropertySymbols,HQ=Object.prototype.hasOwnProperty,jQ=Object.prototype.propertyIsEnumerable,ey=(e,t,r)=>t in e?$Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_o=(e,t)=>{for(var r in t||(t={}))HQ.call(t,r)&&ey(e,r,t[r]);if(J1)for(var r of J1(t))jQ.call(t,r)&&ey(e,r,t[r]);return e},XQ=(e,t)=>zQ(e,VQ(t)),{isPlainObject:WQ,isTypedArray:GQ,isNil:ty}=Sr,YQ=class{constructor(e,t,r){this.device=e,this.options=t,this.service=r,this.destroyed=!1,this.uniforms={},this.vertexBuffers=[];const{vs:n,fs:i,attributes:o,uniforms:a,count:s,elements:u,diagnosticDerivativeUniformityEnabled:l}=t;this.options=t;const f=l?"":this.service.viewportOrigin===Zn.UPPER_LEFT?"diagnostic(off,derivative_uniformity);":"";this.program=r.renderCache.createProgram({vertex:{glsl:n},fragment:{glsl:i,postprocess:p=>f+p}}),a&&(this.uniforms=this.extractUniforms(a));const c=[];let h=0;Object.keys(o).forEach(p=>{const v=o[p],g=v.get();this.vertexBuffers.push(g.get());const{offset:y=0,stride:S=0,size:R=1,divisor:x=0,shaderLocation:M=0}=v.attribute;c.push({arrayStride:S||R*4,stepMode:Io.VERTEX,attributes:[{format:AQ[R],shaderLocation:M,offset:y,divisor:x}]}),h=g.size/R}),s||(this.options.count=h),u&&(this.indexBuffer=u.get());const d=r.renderCache.createInputLayout({vertexBufferDescriptors:c,indexBufferFormat:u?X.U32_R:null,program:this.program});this.inputLayout=d,this.pipeline=this.createPipeline(t)}createPipeline(e,t){var r;const{primitive:n=m.TRIANGLES,depth:i,cull:o,blend:a,stencil:s}=e,u=this.initDepthDrawParams({depth:i}),l=!!(u&&u.enable),f=this.initCullDrawParams({cull:o}),c=!!(f&&f.enable),h=this.getBlendDrawParams({blend:a}),d=!!(h&&h.enable),p=this.getStencilDrawParams({stencil:s}),v=!!(p&&p.enable),g=this.device.createRenderPipeline({inputLayout:this.inputLayout,program:this.program,topology:TQ[n],colorAttachmentFormats:[X.U8_RGBA_RT],depthStencilAttachmentFormat:X.D24_S8,megaStateDescriptor:{attachmentsState:[t?{channelWriteMask:Lr.ALL,rgbBlendState:{blendMode:wr.ADD,blendSrcFactor:xt.ONE,blendDstFactor:xt.ZERO},alphaBlendState:{blendMode:wr.ADD,blendSrcFactor:xt.ONE,blendDstFactor:xt.ZERO}}:{channelWriteMask:v&&p.opFront.zpass===ar.REPLACE?Lr.NONE:Lr.ALL,rgbBlendState:{blendMode:d&&h.equation.rgb||wr.ADD,blendSrcFactor:d&&h.func.srcRGB||xt.SRC_ALPHA,blendDstFactor:d&&h.func.dstRGB||xt.ONE_MINUS_SRC_ALPHA},alphaBlendState:{blendMode:d&&h.equation.alpha||wr.ADD,blendSrcFactor:d&&h.func.srcAlpha||xt.ONE,blendDstFactor:d&&h.func.dstAlpha||xt.ONE}}],blendConstant:d?vf:void 0,depthWrite:l,depthCompare:l&&u.func||kt.LESS,cullMode:c&&f.face||pn.NONE,stencilWrite:v,stencilFront:{compare:v?p.func.cmp:kt.ALWAYS,passOp:p.opFront.zpass,failOp:p.opFront.fail,depthFailOp:p.opFront.zfail,mask:p.opFront.mask},stencilBack:{compare:v?p.func.cmp:kt.ALWAYS,passOp:p.opBack.zpass,failOp:p.opBack.fail,depthFailOp:p.opBack.zfail,mask:p.opBack.mask}}});return v&&!ty((r=s==null?void 0:s.func)==null?void 0:r.ref)&&(g.stencilFuncReference=s.func.ref),g}updateAttributesAndElements(){}updateAttributes(){}addUniforms(e){this.uniforms=_o(_o({},this.uniforms),this.extractUniforms(e))}draw(e,t){const r=_o(_o({},this.options),e),{count:n=0,instances:i,elements:o,uniforms:a={},uniformBuffers:s,textures:u}=r;this.uniforms=_o(_o({},this.uniforms),this.extractUniforms(a));const{renderPass:l,currentFramebuffer:f,width:c,height:h}=this.service;this.pipeline=this.createPipeline(r,t);const d=this.service.device,p=d.swapChainHeight;if(d.swapChainHeight=(f==null?void 0:f.height)||h,l.setViewport(0,0,(f==null?void 0:f.width)||c,(f==null?void 0:f.height)||h),d.swapChainHeight=p,l.setPipeline(this.pipeline),ty(this.pipeline.stencilFuncReference)||l.setStencilReference(this.pipeline.stencilFuncReference),l.setVertexInput(this.inputLayout,this.vertexBuffers.map(v=>({buffer:v})),o?{buffer:this.indexBuffer,offset:0}:null),s&&(this.bindings=d.createBindings({pipeline:this.pipeline,uniformBufferBindings:s.map((v,g)=>{const y=v;return{binding:g,buffer:y.get(),size:y.size}}),samplerBindings:u==null?void 0:u.map(v=>({texture:v.texture,sampler:v.sampler}))})),this.bindings&&(l.setBindings(this.bindings),Object.keys(this.uniforms).forEach(v=>{const g=this.uniforms[v];g instanceof mx?this.uniforms[v]=g.get():g instanceof gx&&(this.uniforms[v]=g.get().texture)}),this.program.setUniformsLegacy(this.uniforms)),o){const v=o.count;v===0?l.draw(n,i):l.drawIndexed(v,i)}else l.draw(n,i)}destroy(){var e,t,r;(e=this.vertexBuffers)==null||e.forEach(n=>n.destroy()),(t=this.indexBuffer)==null||t.destroy(),(r=this.bindings)==null||r.destroy(),this.pipeline.destroy(),this.destroyed=!0}initDepthDrawParams({depth:e}){if(e)return{enable:e.enable===void 0?!0:!!e.enable,mask:e.mask===void 0?!0:!!e.mask,func:xQ[e.func||m.LESS],range:e.range||[0,1]}}getBlendDrawParams({blend:e}){const{enable:t,func:r,equation:n,color:i=[0,0,0,0]}=e||{};return{enable:!!t,func:{srcRGB:Hl[r&&r.srcRGB||m.SRC_ALPHA],srcAlpha:Hl[r&&r.srcAlpha||m.SRC_ALPHA],dstRGB:Hl[r&&r.dstRGB||m.ONE_MINUS_SRC_ALPHA],dstAlpha:Hl[r&&r.dstAlpha||m.ONE_MINUS_SRC_ALPHA]},equation:{rgb:Z1[n&&n.rgb||m.FUNC_ADD],alpha:Z1[n&&n.alpha||m.FUNC_ADD]},color:i}}getStencilDrawParams({stencil:e}){const{enable:t,mask:r=4294967295,func:n={cmp:m.ALWAYS,ref:0,mask:4294967295},opFront:i={fail:m.KEEP,zfail:m.KEEP,zpass:m.KEEP},opBack:o={fail:m.KEEP,zfail:m.KEEP,zpass:m.KEEP}}=e||{};return{enable:!!t,mask:r,func:XQ(_o({},n),{cmp:RQ[n.cmp]}),opFront:{fail:pa[i.fail],zfail:pa[i.zfail],zpass:pa[i.zpass],mask:n.mask},opBack:{fail:pa[o.fail],zfail:pa[o.zfail],zpass:pa[o.zpass],mask:n.mask}}}initCullDrawParams({cull:e}){if(e){const{enable:t,face:r=m.BACK}=e;return{enable:!!t,face:bQ[r]}}}extractUniforms(e){const t={};return Object.keys(e).forEach(r=>{this.extractUniformsRecursively(r,e[r],t,"")}),t}extractUniformsRecursively(e,t,r,n){if(t===null||typeof t=="number"||typeof t=="boolean"||Array.isArray(t)&&typeof t[0]=="number"||GQ(t)||t===""||"resize"in t){r[`${n&&n+"."}${e}`]=t;return}WQ(t)&&Object.keys(t).forEach(i=>{this.extractUniformsRecursively(i,t[i],r,`${n&&n+"."}${e}`)}),Array.isArray(t)&&t.forEach((i,o)=>{Object.keys(i).forEach(a=>{this.extractUniformsRecursively(a,i[a],r,`${n&&n+"."}${e}[${o}]`)})})}};function ZQ(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:!!(e&&e._version===2)}var id=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),{isUndefined:Xl}=Sr,qQ=class{constructor(){this.uniformBuffers=[],this.queryVerdorInfo=()=>this.device.queryVendorInfo().platformString,this.createModel=e=>new YQ(this.device,e,this),this.createAttribute=e=>new yQ(this.device,e),this.createBuffer=e=>new IQ(this.device,e),this.createElements=e=>new kQ(this.device,e),this.createTexture2D=e=>new mx(this.device,e),this.createFramebuffer=e=>new gx(this.device,e),this.useFramebuffer=(e,t)=>{this.currentFramebuffer=e,this.beginFrame(),t(),this.endFrame(),this.currentFramebuffer=null},this.useFramebufferAsync=(e,t)=>id(this,null,function*(){this.currentFramebuffer=e,this.preRenderPass=this.renderPass,this.beginFrame(),yield t(),this.endFrame(),this.currentFramebuffer=null,this.renderPass=this.preRenderPass}),this.clear=e=>{const{color:t,depth:r,stencil:n,framebuffer:i=null}=e;if(i)i.clearOptions={color:t,depth:r,stencil:n};else{const o=this.queryVerdorInfo();if(o==="WebGL1"){const a=this.getGLContext();Xl(n)?Xl(r)||(a.clearDepth(r),a.clear(a.DEPTH_BUFFER_BIT)):(a.clearStencil(n),a.clear(a.STENCIL_BUFFER_BIT))}else if(o==="WebGL2"){const a=this.getGLContext();Xl(n)?Xl(r)||a.clearBufferfv(a.DEPTH,0,[r]):a.clearBufferiv(a.STENCIL,0,[n])}}},this.viewport=({width:e,height:t})=>{this.swapChain.configureSwapChain(e,t),this.createMainColorDepthRT(e,t),this.width=e,this.height=t},this.readPixels=e=>{const{framebuffer:t,x:r,y:n,width:i,height:o}=e,a=this.device.createReadback(),s=t.colorTexture,u=a.readTextureSync(s,r,this.viewportOrigin===Zn.LOWER_LEFT?n:this.height-n,i,o,new Uint8Array(i*o*4));if(this.viewportOrigin!==Zn.LOWER_LEFT)for(let l=0;l<u.length;l+=4){const f=u[l];u[l]=u[l+2],u[l+2]=f}return a.destroy(),u},this.readPixelsAsync=e=>id(this,null,function*(){const{framebuffer:t,x:r,y:n,width:i,height:o}=e,a=this.device.createReadback(),s=t.colorTexture,u=yield a.readTexture(s,r,this.viewportOrigin===Zn.LOWER_LEFT?n:this.height-n,i,o,new Uint8Array(i*o*4));if(this.viewportOrigin!==Zn.LOWER_LEFT)for(let l=0;l<u.length;l+=4){const f=u[l];u[l]=u[l+2],u[l+2]=f}return a.destroy(),u}),this.getViewportSize=()=>({width:this.width,height:this.height}),this.getContainer=()=>{var e;return(e=this.canvas)==null?void 0:e.parentElement},this.getCanvas=()=>this.canvas,this.getGLContext=()=>this.device.gl,this.destroy=()=>{var e;this.canvas=null,(e=this.uniformBuffers)==null||e.forEach(t=>{t.destroy()}),this.device.destroy(),this.renderCache.destroy()}}init(e,t){return id(this,null,function*(){const{enableWebGPU:r,shaderCompilerPath:n,antialias:i}=t;this.canvas=e;const a=yield(r?new EQ({shaderCompilerPath:n}):new NK({targets:["webgl2","webgl1"],antialias:i,onContextLost(u){console.warn("context lost",u)},onContextCreationError(u){console.warn("context creation error",u)},onContextRestored(u){console.warn("context restored",u)}})).createSwapChain(e);a.configureSwapChain(e.width,e.height),this.device=a.getDevice(),this.swapChain=a,this.renderCache=new UQ(this.device),this.currentFramebuffer=null,this.viewportOrigin=this.device.queryVendorInfo().viewportOrigin;const s=this.device.gl;this.extensionObject={OES_texture_float:!ZQ(s)&&this.device.OES_texture_float},this.createMainColorDepthRT(e.width,e.height)})}createMainColorDepthRT(e,t){this.mainColorRT&&this.mainColorRT.destroy(),this.mainDepthRT&&this.mainDepthRT.destroy(),this.mainColorRT=this.device.createRenderTargetFromTexture(this.device.createTexture({format:X.U8_RGBA_RT,width:e,height:t,usage:qr.RENDER_TARGET})),this.mainDepthRT=this.device.createRenderTargetFromTexture(this.device.createTexture({format:X.D24_S8,width:e,height:t,usage:qr.RENDER_TARGET}))}beginFrame(){this.device.beginFrame();const{currentFramebuffer:e,swapChain:t,mainColorRT:r,mainDepthRT:n}=this,i=e?e.colorRenderTarget:r,o=e?null:t.getOnscreenTexture(),a=e?e.depthRenderTarget:n,{color:s=[0,0,0,0],depth:u=1,stencil:l=0}=(e==null?void 0:e.clearOptions)||{},f=i?zu(s[0]*255,s[1]*255,s[2]*255,s[3]):vf,c=a?u:void 0,h=a?l:void 0,d=this.device.createRenderPass({colorAttachment:[i],colorResolveTo:[o],colorClearColor:[f],colorStore:[!0],depthStencilAttachment:a,depthClearValue:c,stencilClearValue:h});this.renderPass=d}endFrame(){this.device.submitPass(this.renderPass),this.device.endFrame()}getPointSizeRange(){const e=this.device.gl;return e.getParameter(e.ALIASED_POINT_SIZE_RANGE)}testExtension(e){return!!this.getGLContext().getExtension(e)}setState(){}setBaseState(){}setCustomLayerDefaults(){}setDirty(e){this.isDirty=e}getDirty(){return this.isDirty}},Ex={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(mo,function(){var r=function(_){return _ instanceof Uint8Array||_ instanceof Uint16Array||_ instanceof Uint32Array||_ instanceof Int8Array||_ instanceof Int16Array||_ instanceof Int32Array||_ instanceof Float32Array||_ instanceof Float64Array||_ instanceof Uint8ClampedArray},n=function(_,b){for(var D=Object.keys(b),te=0;te<D.length;++te)_[D[te]]=b[D[te]];return _},i=`
`;function o(_){return typeof atob<"u"?atob(_):"base64:"+_}function a(_){var b=new Error("(regl) "+_);throw console.error(b),b}function s(_,b){_||a(b)}function u(_){return _?": "+_:""}function l(_,b,D){_ in b||a("unknown parameter ("+_+")"+u(D)+". possible values: "+Object.keys(b).join())}function f(_,b){r(_)||a("invalid parameter type"+u(b)+". must be a typed array")}function c(_,b){switch(b){case"number":return typeof _=="number";case"object":return typeof _=="object";case"string":return typeof _=="string";case"boolean":return typeof _=="boolean";case"function":return typeof _=="function";case"undefined":return typeof _>"u";case"symbol":return typeof _=="symbol"}}function h(_,b,D){c(_,b)||a("invalid parameter type"+u(D)+". expected "+b+", got "+typeof _)}function d(_,b){_>=0&&(_|0)===_||a("invalid parameter type, ("+_+")"+u(b)+". must be a nonnegative integer")}function p(_,b,D){b.indexOf(_)<0&&a("invalid value"+u(D)+". must be one of: "+b)}var v=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function g(_){Object.keys(_).forEach(function(b){v.indexOf(b)<0&&a('invalid regl constructor argument "'+b+'". must be one of '+v)})}function y(_,b){for(_=_+"";_.length<b;)_=" "+_;return _}function S(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function R(_,b){this.number=_,this.line=b,this.errors=[]}function x(_,b,D){this.file=_,this.line=b,this.message=D}function M(){var _=new Error,b=(_.stack||_).toString(),D=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(b);if(D)return D[1];var te=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(b);return te?te[1]:"unknown"}function $(){var _=new Error,b=(_.stack||_).toString(),D=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(b);if(D)return D[1];var te=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(b);return te?te[1]:"unknown"}function F(_,b){var D=_.split(`
`),te=1,fe=0,re={unknown:new S,0:new S};re.unknown.name=re[0].name=b||M(),re.unknown.lines.push(new R(0,""));for(var ae=0;ae<D.length;++ae){var xe=D[ae],Re=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(xe);if(Re)switch(Re[1]){case"line":var we=/(\d+)(\s+\d+)?/.exec(Re[2]);we&&(te=we[1]|0,we[2]&&(fe=we[2]|0,fe in re||(re[fe]=new S)));break;case"define":var Ie=/SHADER_NAME(_B64)?\s+(.*)$/.exec(Re[2]);Ie&&(re[fe].name=Ie[1]?o(Ie[2]):Ie[2]);break}re[fe].lines.push(new R(te++,xe))}return Object.keys(re).forEach(function(Me){var Fe=re[Me];Fe.lines.forEach(function(Te){Fe.index[Te.number]=Te})}),re}function Y(_){var b=[];return _.split(`
`).forEach(function(D){if(!(D.length<5)){var te=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(D);te?b.push(new x(te[1]|0,te[2]|0,te[3].trim())):D.length>0&&b.push(new x("unknown",0,D))}}),b}function ge(_,b){b.forEach(function(D){var te=_[D.file];if(te){var fe=te.index[D.line];if(fe){fe.errors.push(D),te.hasErrors=!0;return}}_.unknown.hasErrors=!0,_.unknown.lines[0].errors.push(D)})}function q(_,b,D,te,fe){if(!_.getShaderParameter(b,_.COMPILE_STATUS)){var re=_.getShaderInfoLog(b),ae=te===_.FRAGMENT_SHADER?"fragment":"vertex";Je(D,"string",ae+" shader source must be a string",fe);var xe=F(D,fe),Re=Y(re);ge(xe,Re),Object.keys(xe).forEach(function(we){var Ie=xe[we];if(!Ie.hasErrors)return;var Me=[""],Fe=[""];function Te(Ne,Z){Me.push(Ne),Fe.push(Z||"")}Te("file number "+we+": "+Ie.name+`
`,"color:red;text-decoration:underline;font-weight:bold"),Ie.lines.forEach(function(Ne){if(Ne.errors.length>0){Te(y(Ne.number,4)+"| ","background-color:yellow; font-weight:bold"),Te(Ne.line+i,"color:red; background-color:yellow; font-weight:bold");var Z=0;Ne.errors.forEach(function(oe){var be=oe.message,De=/^\s*'(.*)'\s*:\s*(.*)$/.exec(be);if(De){var me=De[1];switch(be=De[2],me){case"assign":me="=";break}Z=Math.max(Ne.line.indexOf(me,Z),0)}else Z=0;Te(y("| ",6)),Te(y("^^^",Z+3)+i,"font-weight:bold"),Te(y("| ",6)),Te(be+i,"font-weight:bold")}),Te(y("| ",6)+i)}else Te(y(Ne.number,4)+"| "),Te(Ne.line+i,"color:red")}),typeof document<"u"&&!window.chrome?(Fe[0]=Me.join("%c"),console.log.apply(console,Fe)):console.log(Me.join(""))}),s.raise("Error compiling "+ae+" shader, "+xe[0].name)}}function k(_,b,D,te,fe){if(!_.getProgramParameter(b,_.LINK_STATUS)){var re=_.getProgramInfoLog(b),ae=F(D,fe),xe=F(te,fe),Re='Error linking program with vertex shader, "'+xe[0].name+'", and fragment shader "'+ae[0].name+'"';typeof document<"u"?console.log("%c"+Re+i+"%c"+re,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Re+i+re),s.raise(Re)}}function G(_){_._commandRef=M()}function K(_,b,D,te){G(_);function fe(Re){return Re?te.id(Re):0}_._fragId=fe(_.static.frag),_._vertId=fe(_.static.vert);function re(Re,we){Object.keys(we).forEach(function(Ie){Re[te.id(Ie)]=!0})}var ae=_._uniformSet={};re(ae,b.static),re(ae,b.dynamic);var xe=_._attributeSet={};re(xe,D.static),re(xe,D.dynamic),_._hasCount="count"in _.static||"count"in _.dynamic||"elements"in _.static||"elements"in _.dynamic}function ce(_,b){var D=$();a(_+" in command "+(b||M())+(D==="unknown"?"":" called from "+D))}function Pe(_,b,D){_||ce(b,D||M())}function Xe(_,b,D,te){_ in b||ce("unknown parameter ("+_+")"+u(D)+". possible values: "+Object.keys(b).join(),te||M())}function Je(_,b,D,te){c(_,b)||ce("invalid parameter type"+u(D)+". expected "+b+", got "+typeof _,te||M())}function ft(_){_()}function Ge(_,b,D){_.texture?p(_.texture._texture.internalformat,b,"unsupported texture format for attachment"):p(_.renderbuffer._renderbuffer.format,D,"unsupported renderbuffer format for attachment")}var et=33071,vt=9728,mt=9984,It=9985,wt=9986,gt=9987,xr=5120,Gt=5121,Xr=5122,le=5123,ze=5124,nt=5125,Ae=5126,Dt=32819,Et=32820,zt=33635,Rt=34042,ut=36193,Ut={};Ut[xr]=Ut[Gt]=1,Ut[Xr]=Ut[le]=Ut[ut]=Ut[zt]=Ut[Dt]=Ut[Et]=2,Ut[ze]=Ut[nt]=Ut[Ae]=Ut[Rt]=4;function $r(_,b){return _===Et||_===Dt||_===zt?2:_===Rt?4:Ut[_]*b}function dr(_){return!(_&_-1)&&!!_}function Jt(_,b,D){var te,fe=b.width,re=b.height,ae=b.channels;s(fe>0&&fe<=D.maxTextureSize&&re>0&&re<=D.maxTextureSize,"invalid texture shape"),(_.wrapS!==et||_.wrapT!==et)&&s(dr(fe)&&dr(re),"incompatible wrap mode for texture, both width and height must be power of 2"),b.mipmask===1?fe!==1&&re!==1&&s(_.minFilter!==mt&&_.minFilter!==wt&&_.minFilter!==It&&_.minFilter!==gt,"min filter requires mipmap"):(s(dr(fe)&&dr(re),"texture must be a square power of 2 to support mipmapping"),s(b.mipmask===(fe<<1)-1,"missing or incomplete mipmap data")),b.type===Ae&&(D.extensions.indexOf("oes_texture_float_linear")<0&&s(_.minFilter===vt&&_.magFilter===vt,"filter not supported, must enable oes_texture_float_linear"),s(!_.genMipmaps,"mipmap generation not supported with float textures"));var xe=b.images;for(te=0;te<16;++te)if(xe[te]){var Re=fe>>te,we=re>>te;s(b.mipmask&1<<te,"missing mipmap data");var Ie=xe[te];if(s(Ie.width===Re&&Ie.height===we,"invalid shape for mip images"),s(Ie.format===b.format&&Ie.internalformat===b.internalformat&&Ie.type===b.type,"incompatible type for mip image"),!Ie.compressed)if(Ie.data){var Me=Math.ceil($r(Ie.type,ae)*Re/Ie.unpackAlignment)*Ie.unpackAlignment;s(Ie.data.byteLength===Me*we,"invalid data for image, buffer size is inconsistent with image format")}else Ie.element||Ie.copy}else _.genMipmaps||s((b.mipmask&1<<te)===0,"extra mipmap data");b.compressed&&s(!_.genMipmaps,"mipmap generation for compressed images not supported")}function nn(_,b,D,te){var fe=_.width,re=_.height,ae=_.channels;s(fe>0&&fe<=te.maxTextureSize&&re>0&&re<=te.maxTextureSize,"invalid texture shape"),s(fe===re,"cube map must be square"),s(b.wrapS===et&&b.wrapT===et,"wrap mode not supported by cube map");for(var xe=0;xe<D.length;++xe){var Re=D[xe];s(Re.width===fe&&Re.height===re,"inconsistent cube map face shape"),b.genMipmaps&&(s(!Re.compressed,"can not generate mipmap for compressed textures"),s(Re.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var we=Re.images,Ie=0;Ie<16;++Ie){var Me=we[Ie];if(Me){var Fe=fe>>Ie,Te=re>>Ie;s(Re.mipmask&1<<Ie,"missing mipmap data"),s(Me.width===Fe&&Me.height===Te,"invalid shape for mip images"),s(Me.format===_.format&&Me.internalformat===_.internalformat&&Me.type===_.type,"incompatible type for mip image"),Me.compressed||(Me.data?s(Me.data.byteLength===Fe*Te*Math.max($r(Me.type,ae),Me.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):Me.element||Me.copy)}}}}var N=n(s,{optional:ft,raise:a,commandRaise:ce,command:Pe,parameter:l,commandParameter:Xe,constructor:g,type:h,commandType:Je,isTypedArray:f,nni:d,oneOf:p,shaderError:q,linkError:k,callSite:$,saveCommandRef:G,saveDrawInfo:K,framebufferFormat:Ge,guessCommand:M,texture2D:Jt,textureCube:nn}),Si=0,wo=0;function ui(_,b){this.id=Si++,this.type=_,this.data=b}function xi(_){return _.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Kt(_){if(_.length===0)return[];var b=_.charAt(0),D=_.charAt(_.length-1);if(_.length>1&&b===D&&(b==='"'||b==="'"))return['"'+xi(_.substr(1,_.length-2))+'"'];var te=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(_);if(te)return Kt(_.substr(0,te.index)).concat(Kt(te[1])).concat(Kt(_.substr(te.index+te[0].length)));var fe=_.split(".");if(fe.length===1)return['"'+xi(_)+'"'];for(var re=[],ae=0;ae<fe.length;++ae)re=re.concat(Kt(fe[ae]));return re}function Kr(_){return"["+Kt(_).join("][")+"]"}function $n(_,b){return new ui(_,Kr(b+""))}function on(_){return typeof _=="function"&&!_._reglType||_ instanceof ui}function qi(_,b){return typeof _=="function"?new ui(wo,_):_}var Br={DynamicVariable:ui,define:$n,isDynamic:on,unbox:qi,accessor:Kr},Ki={next:typeof requestAnimationFrame=="function"?function(_){return requestAnimationFrame(_)}:function(_){return setTimeout(_,16)},cancel:typeof cancelAnimationFrame=="function"?function(_){return cancelAnimationFrame(_)}:clearTimeout},bi=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function Qa(){var _={"":0},b=[""];return{id:function(D){var te=_[D];return te||(te=_[D]=b.length,b.push(D),te)},str:function(D){return b[D]}}}function mf(_,b,D){var te=document.createElement("canvas");n(te.style,{border:0,margin:0,padding:0,top:0,left:0}),_.appendChild(te),_===document.body&&(te.style.position="absolute",n(_.style,{margin:0,padding:0}));function fe(){var xe=window.innerWidth,Re=window.innerHeight;if(_!==document.body){var we=_.getBoundingClientRect();xe=we.right-we.left,Re=we.bottom-we.top}te.width=D*xe,te.height=D*Re,n(te.style,{width:xe+"px",height:Re+"px"})}var re;_!==document.body&&typeof ResizeObserver=="function"?(re=new ResizeObserver(function(){setTimeout(fe)}),re.observe(_)):window.addEventListener("resize",fe,!1);function ae(){re?re.disconnect():window.removeEventListener("resize",fe),_.removeChild(te)}return fe(),{canvas:te,onDestroy:ae}}function Fo(_,b){function D(te){try{return _.getContext(te,b)}catch{return null}}return D("webgl")||D("experimental-webgl")||D("webgl-experimental")}function gf(_){return typeof _.nodeName=="string"&&typeof _.appendChild=="function"&&typeof _.getBoundingClientRect=="function"}function Ef(_){return typeof _.drawArrays=="function"||typeof _.drawElements=="function"}function Ja(_){return typeof _=="string"?_.split():(N(Array.isArray(_),"invalid extension array"),_)}function es(_){return typeof _=="string"?(N(typeof document<"u","not supported outside of DOM"),document.querySelector(_)):_}function ts(_){var b=_||{},D,te,fe,re,ae={},xe=[],Re=[],we=typeof window>"u"?1:window.devicePixelRatio,Ie=!1,Me=function(Ne){Ne&&N.raise(Ne)},Fe=function(){};if(typeof b=="string"?(N(typeof document<"u","selector queries only supported in DOM enviroments"),D=document.querySelector(b),N(D,"invalid query string for element")):typeof b=="object"?gf(b)?D=b:Ef(b)?(re=b,fe=re.canvas):(N.constructor(b),"gl"in b?re=b.gl:"canvas"in b?fe=es(b.canvas):"container"in b&&(te=es(b.container)),"attributes"in b&&(ae=b.attributes,N.type(ae,"object","invalid context attributes")),"extensions"in b&&(xe=Ja(b.extensions)),"optionalExtensions"in b&&(Re=Ja(b.optionalExtensions)),"onDone"in b&&(N.type(b.onDone,"function","invalid or missing onDone callback"),Me=b.onDone),"profile"in b&&(Ie=!!b.profile),"pixelRatio"in b&&(we=+b.pixelRatio,N(we>0,"invalid pixel ratio"))):N.raise("invalid arguments to regl"),D&&(D.nodeName.toLowerCase()==="canvas"?fe=D:te=D),!re){if(!fe){N(typeof document<"u","must manually specify webgl context outside of DOM environments");var Te=mf(te||document.body,Me,we);if(!Te)return null;fe=Te.canvas,Fe=Te.onDestroy}ae.premultipliedAlpha===void 0&&(ae.premultipliedAlpha=!0),re=Fo(fe,ae)}return re?{gl:re,canvas:fe,container:te,extensions:xe,optionalExtensions:Re,pixelRatio:we,profile:Ie,onDone:Me,onDestroy:Fe}:(Fe(),Me("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function yf(_,b){var D={};function te(ae){N.type(ae,"string","extension name must be string");var xe=ae.toLowerCase(),Re;try{Re=D[xe]=_.getExtension(xe)}catch{}return!!Re}for(var fe=0;fe<b.extensions.length;++fe){var re=b.extensions[fe];if(!te(re))return b.onDestroy(),b.onDone('"'+re+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return b.optionalExtensions.forEach(te),{extensions:D,restore:function(){Object.keys(D).forEach(function(ae){if(D[ae]&&!te(ae))throw new Error("(regl): error restoring extension "+ae)})}}}function Qr(_,b){for(var D=Array(_),te=0;te<_;++te)D[te]=b(te);return D}var Tf=5120,Vu=5121,Af=5122,Sf=5123,xf=5124,Bo=5125,bf=5126;function Rf(_){for(var b=16;b<=1<<28;b*=16)if(_<=b)return b;return 0}function rs(_){var b,D;return b=(_>65535)<<4,_>>>=b,D=(_>255)<<3,_>>>=D,b|=D,D=(_>15)<<2,_>>>=D,b|=D,D=(_>3)<<1,_>>>=D,b|=D,b|_>>1}function Do(){var _=Qr(8,function(){return[]});function b(re){var ae=Rf(re),xe=_[rs(ae)>>2];return xe.length>0?xe.pop():new ArrayBuffer(ae)}function D(re){_[rs(re.byteLength)>>2].push(re)}function te(re,ae){var xe=null;switch(re){case Tf:xe=new Int8Array(b(ae),0,ae);break;case Vu:xe=new Uint8Array(b(ae),0,ae);break;case Af:xe=new Int16Array(b(2*ae),0,ae);break;case Sf:xe=new Uint16Array(b(2*ae),0,ae);break;case xf:xe=new Int32Array(b(4*ae),0,ae);break;case Bo:xe=new Uint32Array(b(4*ae),0,ae);break;case bf:xe=new Float32Array(b(4*ae),0,ae);break;default:return null}return xe.length!==ae?xe.subarray(0,ae):xe}function fe(re){D(re.buffer)}return{alloc:b,free:D,allocType:te,freeType:fe}}var ur=Do();ur.zero=Do();var Hu=3408,Cf=3410,ju=3411,Xu=3412,Wu=3413,Gu=3414,ns=3415,li=33901,Qi=33902,Ji=3379,Uo=3386,is=34921,Of=36347,If=36348,ko=35661,an=35660,Ri=34930,Jn=36349,zn=34076,eo=34024,An=7936,Vn=7937,Yu=7938,Zu=35724,$o=34047,vn=36063,zo=34852,Ci=3553,Vo=34067,os=34069,as=33984,ei=6408,Sn=5126,qu=5121,Ho=36160,ss=36053,Ku=36064,Mf=16384,Nf=function(_,b){var D=1;b.ext_texture_filter_anisotropic&&(D=_.getParameter($o));var te=1,fe=1;b.webgl_draw_buffers&&(te=_.getParameter(zo),fe=_.getParameter(vn));var re=!!b.oes_texture_float;if(re){var ae=_.createTexture();_.bindTexture(Ci,ae),_.texImage2D(Ci,0,ei,1,1,0,ei,Sn,null);var xe=_.createFramebuffer();if(_.bindFramebuffer(Ho,xe),_.framebufferTexture2D(Ho,Ku,Ci,ae,0),_.bindTexture(Ci,null),_.checkFramebufferStatus(Ho)!==ss)re=!1;else{_.viewport(0,0,1,1),_.clearColor(1,0,0,1),_.clear(Mf);var Re=ur.allocType(Sn,4);_.readPixels(0,0,1,1,ei,Sn,Re),_.getError()?re=!1:(_.deleteFramebuffer(xe),_.deleteTexture(ae),re=Re[0]===1),ur.freeType(Re)}}var we=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),Ie=!0;if(!we){var Me=_.createTexture(),Fe=ur.allocType(qu,36);_.activeTexture(as),_.bindTexture(Vo,Me),_.texImage2D(os,0,ei,3,3,0,ei,qu,Fe),ur.freeType(Fe),_.bindTexture(Vo,null),_.deleteTexture(Me),Ie=!_.getError()}return{colorBits:[_.getParameter(Cf),_.getParameter(ju),_.getParameter(Xu),_.getParameter(Wu)],depthBits:_.getParameter(Gu),stencilBits:_.getParameter(ns),subpixelBits:_.getParameter(Hu),extensions:Object.keys(b).filter(function(Te){return!!b[Te]}),maxAnisotropic:D,maxDrawbuffers:te,maxColorAttachments:fe,pointSizeDims:_.getParameter(li),lineWidthDims:_.getParameter(Qi),maxViewportDims:_.getParameter(Uo),maxCombinedTextureUnits:_.getParameter(ko),maxCubeMapSize:_.getParameter(zn),maxRenderbufferSize:_.getParameter(eo),maxTextureUnits:_.getParameter(Ri),maxTextureSize:_.getParameter(Ji),maxAttributes:_.getParameter(is),maxVertexUniforms:_.getParameter(Of),maxVertexTextureUnits:_.getParameter(an),maxVaryingVectors:_.getParameter(If),maxFragmentUniforms:_.getParameter(Jn),glsl:_.getParameter(Zu),renderer:_.getParameter(Vn),vendor:_.getParameter(An),version:_.getParameter(Yu),readFloat:re,npotTextureCube:Ie}};function A(_){return!!_&&typeof _=="object"&&Array.isArray(_.shape)&&Array.isArray(_.stride)&&typeof _.offset=="number"&&_.shape.length===_.stride.length&&(Array.isArray(_.data)||r(_.data))}var O=function(_){return Object.keys(_).map(function(b){return _[b]})},H={shape:Mr,flatten:br};function ue(_,b,D){for(var te=0;te<b;++te)D[te]=_[te]}function Le(_,b,D,te){for(var fe=0,re=0;re<b;++re)for(var ae=_[re],xe=0;xe<D;++xe)te[fe++]=ae[xe]}function Qe(_,b,D,te,fe,re){for(var ae=re,xe=0;xe<b;++xe)for(var Re=_[xe],we=0;we<D;++we)for(var Ie=Re[we],Me=0;Me<te;++Me)fe[ae++]=Ie[Me]}function Mt(_,b,D,te,fe){for(var re=1,ae=D+1;ae<b.length;++ae)re*=b[ae];var xe=b[D];if(b.length-D===4){var Re=b[D+1],we=b[D+2],Ie=b[D+3];for(ae=0;ae<xe;++ae)Qe(_[ae],Re,we,Ie,te,fe),fe+=re}else for(ae=0;ae<xe;++ae)Mt(_[ae],b,D+1,te,fe),fe+=re}function br(_,b,D,te){var fe=1;if(b.length)for(var re=0;re<b.length;++re)fe*=b[re];else fe=0;var ae=te||ur.allocType(D,fe);switch(b.length){case 0:break;case 1:ue(_,b[0],ae);break;case 2:Le(_,b[0],b[1],ae);break;case 3:Qe(_,b[0],b[1],b[2],ae,0);break;default:Mt(_,b,0,ae,0)}return ae}function Mr(_){for(var b=[],D=_;D.length;D=D[0])b.push(D.length);return b}var Nr={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},xn=5120,Tx=5122,Ax=5124,Sx=5121,xx=5123,bx=5125,Rx=5126,Cx=5126,to={int8:xn,int16:Tx,int32:Ax,uint8:Sx,uint16:xx,uint32:bx,float:Rx,float32:Cx},Ox=35048,Ix=35040,Qu={dynamic:Ox,stream:Ix,static:35044},Pf=H.flatten,c_=H.shape,f_=35044,Mx=35040,Lf=5121,wf=5126,Oi=[];Oi[5120]=1,Oi[5122]=2,Oi[5124]=4,Oi[5121]=1,Oi[5123]=2,Oi[5125]=4,Oi[5126]=4;function Ju(_){return Nr[Object.prototype.toString.call(_)]|0}function h_(_,b){for(var D=0;D<b.length;++D)_[D]=b[D]}function d_(_,b,D,te,fe,re,ae){for(var xe=0,Re=0;Re<D;++Re)for(var we=0;we<te;++we)_[xe++]=b[fe*Re+re*we+ae]}function Nx(_,b,D,te){var fe=0,re={};function ae(Z){this.id=fe++,this.buffer=_.createBuffer(),this.type=Z,this.usage=f_,this.byteLength=0,this.dimension=1,this.dtype=Lf,this.persistentData=null,D.profile&&(this.stats={size:0})}ae.prototype.bind=function(){_.bindBuffer(this.type,this.buffer)},ae.prototype.destroy=function(){Fe(this)};var xe=[];function Re(Z,oe){var be=xe.pop();return be||(be=new ae(Z)),be.bind(),Me(be,oe,Mx,0,1,!1),be}function we(Z){xe.push(Z)}function Ie(Z,oe,be){Z.byteLength=oe.byteLength,_.bufferData(Z.type,oe,be)}function Me(Z,oe,be,De,me,Ve){var Ce;if(Z.usage=be,Array.isArray(oe)){if(Z.dtype=De||wf,oe.length>0){var ke;if(Array.isArray(oe[0])){Ce=c_(oe);for(var Ee=1,Be=1;Be<Ce.length;++Be)Ee*=Ce[Be];Z.dimension=Ee,ke=Pf(oe,Ce,Z.dtype),Ie(Z,ke,be),Ve?Z.persistentData=ke:ur.freeType(ke)}else if(typeof oe[0]=="number"){Z.dimension=me;var tt=ur.allocType(Z.dtype,oe.length);h_(tt,oe),Ie(Z,tt,be),Ve?Z.persistentData=tt:ur.freeType(tt)}else r(oe[0])?(Z.dimension=oe[0].length,Z.dtype=De||Ju(oe[0])||wf,ke=Pf(oe,[oe.length,oe[0].length],Z.dtype),Ie(Z,ke,be),Ve?Z.persistentData=ke:ur.freeType(ke)):N.raise("invalid buffer data")}}else if(r(oe))Z.dtype=De||Ju(oe),Z.dimension=me,Ie(Z,oe,be),Ve&&(Z.persistentData=new Uint8Array(new Uint8Array(oe.buffer)));else if(A(oe)){Ce=oe.shape;var at=oe.stride,Ue=oe.offset,Oe=0,pe=0,st=0,Ct=0;Ce.length===1?(Oe=Ce[0],pe=1,st=at[0],Ct=0):Ce.length===2?(Oe=Ce[0],pe=Ce[1],st=at[0],Ct=at[1]):N.raise("invalid shape"),Z.dtype=De||Ju(oe.data)||wf,Z.dimension=pe;var Ze=ur.allocType(Z.dtype,Oe*pe);d_(Ze,oe.data,Oe,pe,st,Ct,Ue),Ie(Z,Ze,be),Ve?Z.persistentData=Ze:ur.freeType(Ze)}else oe instanceof ArrayBuffer?(Z.dtype=Lf,Z.dimension=me,Ie(Z,oe,be),Ve&&(Z.persistentData=new Uint8Array(new Uint8Array(oe)))):N.raise("invalid buffer data")}function Fe(Z){b.bufferCount--,te(Z);var oe=Z.buffer;N(oe,"buffer must not be deleted already"),_.deleteBuffer(oe),Z.buffer=null,delete re[Z.id]}function Te(Z,oe,be,De){b.bufferCount++;var me=new ae(oe);re[me.id]=me;function Ve(Ee){var Be=f_,tt=null,at=0,Ue=0,Oe=1;return Array.isArray(Ee)||r(Ee)||A(Ee)||Ee instanceof ArrayBuffer?tt=Ee:typeof Ee=="number"?at=Ee|0:Ee&&(N.type(Ee,"object","buffer arguments must be an object, a number or an array"),"data"in Ee&&(N(tt===null||Array.isArray(tt)||r(tt)||A(tt),"invalid data for buffer"),tt=Ee.data),"usage"in Ee&&(N.parameter(Ee.usage,Qu,"invalid buffer usage"),Be=Qu[Ee.usage]),"type"in Ee&&(N.parameter(Ee.type,to,"invalid buffer type"),Ue=to[Ee.type]),"dimension"in Ee&&(N.type(Ee.dimension,"number","invalid dimension"),Oe=Ee.dimension|0),"length"in Ee&&(N.nni(at,"buffer length must be a nonnegative integer"),at=Ee.length|0)),me.bind(),tt?Me(me,tt,Be,Ue,Oe,De):(at&&_.bufferData(me.type,at,Be),me.dtype=Ue||Lf,me.usage=Be,me.dimension=Oe,me.byteLength=at),D.profile&&(me.stats.size=me.byteLength*Oi[me.dtype]),Ve}function Ce(Ee,Be){N(Be+Ee.byteLength<=me.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+Ee.byteLength+" starting from offset "+Be+" to a buffer of size "+me.byteLength),_.bufferSubData(me.type,Be,Ee)}function ke(Ee,Be){var tt=(Be||0)|0,at;if(me.bind(),r(Ee)||Ee instanceof ArrayBuffer)Ce(Ee,tt);else if(Array.isArray(Ee)){if(Ee.length>0)if(typeof Ee[0]=="number"){var Ue=ur.allocType(me.dtype,Ee.length);h_(Ue,Ee),Ce(Ue,tt),ur.freeType(Ue)}else if(Array.isArray(Ee[0])||r(Ee[0])){at=c_(Ee);var Oe=Pf(Ee,at,me.dtype);Ce(Oe,tt),ur.freeType(Oe)}else N.raise("invalid buffer data")}else if(A(Ee)){at=Ee.shape;var pe=Ee.stride,st=0,Ct=0,Ze=0,yt=0;at.length===1?(st=at[0],Ct=1,Ze=pe[0],yt=0):at.length===2?(st=at[0],Ct=at[1],Ze=pe[0],yt=pe[1]):N.raise("invalid shape");var lt=Array.isArray(Ee.data)?me.dtype:Ju(Ee.data),_t=ur.allocType(lt,st*Ct);d_(_t,Ee.data,st,Ct,Ze,yt,Ee.offset),Ce(_t,tt),ur.freeType(_t)}else N.raise("invalid data for buffer subdata");return Ve}return be||Ve(Z),Ve._reglType="buffer",Ve._buffer=me,Ve.subdata=ke,D.profile&&(Ve.stats=me.stats),Ve.destroy=function(){Fe(me)},Ve}function Ne(){O(re).forEach(function(Z){Z.buffer=_.createBuffer(),_.bindBuffer(Z.type,Z.buffer),_.bufferData(Z.type,Z.persistentData||Z.byteLength,Z.usage)})}return D.profile&&(b.getTotalBufferSize=function(){var Z=0;return Object.keys(re).forEach(function(oe){Z+=re[oe].stats.size}),Z}),{create:Te,createStream:Re,destroyStream:we,clear:function(){O(re).forEach(Fe),xe.forEach(Fe)},getBuffer:function(Z){return Z&&Z._buffer instanceof ae?Z._buffer:null},restore:Ne,_initBuffer:Me}}var Px=0,Lx=0,Fx=1,Bx=1,Dx=4,Ux=4,jo={points:Px,point:Lx,lines:Fx,line:Bx,triangles:Dx,triangle:Ux,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},kx=0,$x=1,us=4,zx=5120,Xo=5121,p_=5122,Wo=5123,__=5124,ro=5125,Ff=34963,Vx=35040,Hx=35044;function jx(_,b,D,te){var fe={},re=0,ae={uint8:Xo,uint16:Wo};b.oes_element_index_uint&&(ae.uint32=ro);function xe(Ne){this.id=re++,fe[this.id]=this,this.buffer=Ne,this.primType=us,this.vertCount=0,this.type=0}xe.prototype.bind=function(){this.buffer.bind()};var Re=[];function we(Ne){var Z=Re.pop();return Z||(Z=new xe(D.create(null,Ff,!0,!1)._buffer)),Me(Z,Ne,Vx,-1,-1,0,0),Z}function Ie(Ne){Re.push(Ne)}function Me(Ne,Z,oe,be,De,me,Ve){Ne.buffer.bind();var Ce;if(Z){var ke=Ve;!Ve&&(!r(Z)||A(Z)&&!r(Z.data))&&(ke=b.oes_element_index_uint?ro:Wo),D._initBuffer(Ne.buffer,Z,oe,ke,3)}else _.bufferData(Ff,me,oe),Ne.buffer.dtype=Ce||Xo,Ne.buffer.usage=oe,Ne.buffer.dimension=3,Ne.buffer.byteLength=me;if(Ce=Ve,!Ve){switch(Ne.buffer.dtype){case Xo:case zx:Ce=Xo;break;case Wo:case p_:Ce=Wo;break;case ro:case __:Ce=ro;break;default:N.raise("unsupported type for element array")}Ne.buffer.dtype=Ce}Ne.type=Ce,N(Ce!==ro||!!b.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Ee=De;Ee<0&&(Ee=Ne.buffer.byteLength,Ce===Wo?Ee>>=1:Ce===ro&&(Ee>>=2)),Ne.vertCount=Ee;var Be=be;if(be<0){Be=us;var tt=Ne.buffer.dimension;tt===1&&(Be=kx),tt===2&&(Be=$x),tt===3&&(Be=us)}Ne.primType=Be}function Fe(Ne){te.elementsCount--,N(Ne.buffer!==null,"must not double destroy elements"),delete fe[Ne.id],Ne.buffer.destroy(),Ne.buffer=null}function Te(Ne,Z){var oe=D.create(null,Ff,!0),be=new xe(oe._buffer);te.elementsCount++;function De(me){if(!me)oe(),be.primType=us,be.vertCount=0,be.type=Xo;else if(typeof me=="number")oe(me),be.primType=us,be.vertCount=me|0,be.type=Xo;else{var Ve=null,Ce=Hx,ke=-1,Ee=-1,Be=0,tt=0;Array.isArray(me)||r(me)||A(me)?Ve=me:(N.type(me,"object","invalid arguments for elements"),"data"in me&&(Ve=me.data,N(Array.isArray(Ve)||r(Ve)||A(Ve),"invalid data for element buffer")),"usage"in me&&(N.parameter(me.usage,Qu,"invalid element buffer usage"),Ce=Qu[me.usage]),"primitive"in me&&(N.parameter(me.primitive,jo,"invalid element buffer primitive"),ke=jo[me.primitive]),"count"in me&&(N(typeof me.count=="number"&&me.count>=0,"invalid vertex count for elements"),Ee=me.count|0),"type"in me&&(N.parameter(me.type,ae,"invalid buffer type"),tt=ae[me.type]),"length"in me?Be=me.length|0:(Be=Ee,tt===Wo||tt===p_?Be*=2:(tt===ro||tt===__)&&(Be*=4))),Me(be,Ve,Ce,ke,Ee,Be,tt)}return De}return De(Ne),De._reglType="elements",De._elements=be,De.subdata=function(me,Ve){return oe.subdata(me,Ve),De},De.destroy=function(){Fe(be)},De}return{create:Te,createStream:we,destroyStream:Ie,getElements:function(Ne){return typeof Ne=="function"&&Ne._elements instanceof xe?Ne._elements:null},clear:function(){O(fe).forEach(Fe)}}}var v_=new Float32Array(1),Xx=new Uint32Array(v_.buffer),Wx=5123;function m_(_){for(var b=ur.allocType(Wx,_.length),D=0;D<_.length;++D)if(isNaN(_[D]))b[D]=65535;else if(_[D]===1/0)b[D]=31744;else if(_[D]===-1/0)b[D]=64512;else{v_[0]=_[D];var te=Xx[0],fe=te>>>31<<15,re=(te<<1>>>24)-127,ae=te>>13&1023;if(re<-24)b[D]=fe;else if(re<-14){var xe=-14-re;b[D]=fe+(ae+1024>>xe)}else re>15?b[D]=fe+31744:b[D]=fe+(re+15<<10)+ae}return b}function cr(_){return Array.isArray(_)||r(_)}var g_=function(_){return!(_&_-1)&&!!_},Gx=34467,ci=3553,E_=34067,el=34069,no=6408,Bf=6406,tl=6407,ls=6409,rl=6410,y_=32854,Df=32855,T_=36194,Yx=32819,Zx=32820,qx=33635,Kx=34042,Uf=6402,nl=34041,kf=35904,$f=35906,Go=36193,zf=33776,Vf=33777,Hf=33778,jf=33779,A_=35986,S_=35987,x_=34798,b_=35840,R_=35841,C_=35842,O_=35843,I_=36196,Yo=5121,Xf=5123,Wf=5125,cs=5126,Qx=10242,Jx=10243,eb=10497,Gf=33071,tb=33648,rb=10240,nb=10241,Yf=9728,ib=9729,Zf=9984,M_=9985,N_=9986,qf=9987,ob=33170,il=4352,ab=4353,sb=4354,ub=34046,lb=3317,cb=37440,fb=37441,hb=37443,P_=37444,ol=33984,db=[Zf,N_,M_,qf],al=[0,ls,rl,tl,no],bn={};bn[ls]=bn[Bf]=bn[Uf]=1,bn[nl]=bn[rl]=2,bn[tl]=bn[kf]=3,bn[no]=bn[$f]=4;function Zo(_){return"[object "+_+"]"}var L_=Zo("HTMLCanvasElement"),w_=Zo("OffscreenCanvas"),F_=Zo("CanvasRenderingContext2D"),B_=Zo("ImageBitmap"),D_=Zo("HTMLImageElement"),U_=Zo("HTMLVideoElement"),pb=Object.keys(Nr).concat([L_,w_,F_,B_,D_,U_]),qo=[];qo[Yo]=1,qo[cs]=4,qo[Go]=2,qo[Xf]=2,qo[Wf]=4;var Dr=[];Dr[y_]=2,Dr[Df]=2,Dr[T_]=2,Dr[nl]=4,Dr[zf]=.5,Dr[Vf]=.5,Dr[Hf]=1,Dr[jf]=1,Dr[A_]=.5,Dr[S_]=1,Dr[x_]=1,Dr[b_]=.5,Dr[R_]=.25,Dr[C_]=.5,Dr[O_]=.25,Dr[I_]=.5;function k_(_){return Array.isArray(_)&&(_.length===0||typeof _[0]=="number")}function $_(_){if(!Array.isArray(_))return!1;var b=_.length;return!(b===0||!cr(_[0]))}function io(_){return Object.prototype.toString.call(_)}function z_(_){return io(_)===L_}function V_(_){return io(_)===w_}function _b(_){return io(_)===F_}function vb(_){return io(_)===B_}function mb(_){return io(_)===D_}function gb(_){return io(_)===U_}function Kf(_){if(!_)return!1;var b=io(_);return pb.indexOf(b)>=0?!0:k_(_)||$_(_)||A(_)}function H_(_){return Nr[Object.prototype.toString.call(_)]|0}function Eb(_,b){var D=b.length;switch(_.type){case Yo:case Xf:case Wf:case cs:var te=ur.allocType(_.type,D);te.set(b),_.data=te;break;case Go:_.data=m_(b);break;default:N.raise("unsupported texture type, must specify a typed array")}}function j_(_,b){return ur.allocType(_.type===Go?cs:_.type,b)}function X_(_,b){_.type===Go?(_.data=m_(b),ur.freeType(b)):_.data=b}function yb(_,b,D,te,fe,re){for(var ae=_.width,xe=_.height,Re=_.channels,we=ae*xe*Re,Ie=j_(_,we),Me=0,Fe=0;Fe<xe;++Fe)for(var Te=0;Te<ae;++Te)for(var Ne=0;Ne<Re;++Ne)Ie[Me++]=b[D*Te+te*Fe+fe*Ne+re];X_(_,Ie)}function sl(_,b,D,te,fe,re){var ae;if(typeof Dr[_]<"u"?ae=Dr[_]:ae=bn[_]*qo[b],re&&(ae*=6),fe){for(var xe=0,Re=D;Re>=1;)xe+=ae*Re*Re,Re/=2;return xe}else return ae*D*te}function Tb(_,b,D,te,fe,re,ae){var xe={"don't care":il,"dont care":il,nice:sb,fast:ab},Re={repeat:eb,clamp:Gf,mirror:tb},we={nearest:Yf,linear:ib},Ie=n({mipmap:qf,"nearest mipmap nearest":Zf,"linear mipmap nearest":M_,"nearest mipmap linear":N_,"linear mipmap linear":qf},we),Me={none:0,browser:P_},Fe={uint8:Yo,rgba4:Yx,rgb565:qx,"rgb5 a1":Zx},Te={alpha:Bf,luminance:ls,"luminance alpha":rl,rgb:tl,rgba:no,rgba4:y_,"rgb5 a1":Df,rgb565:T_},Ne={};b.ext_srgb&&(Te.srgb=kf,Te.srgba=$f),b.oes_texture_float&&(Fe.float32=Fe.float=cs),b.oes_texture_half_float&&(Fe.float16=Fe["half float"]=Go),b.webgl_depth_texture&&(n(Te,{depth:Uf,"depth stencil":nl}),n(Fe,{uint16:Xf,uint32:Wf,"depth stencil":Kx})),b.webgl_compressed_texture_s3tc&&n(Ne,{"rgb s3tc dxt1":zf,"rgba s3tc dxt1":Vf,"rgba s3tc dxt3":Hf,"rgba s3tc dxt5":jf}),b.webgl_compressed_texture_atc&&n(Ne,{"rgb atc":A_,"rgba atc explicit alpha":S_,"rgba atc interpolated alpha":x_}),b.webgl_compressed_texture_pvrtc&&n(Ne,{"rgb pvrtc 4bppv1":b_,"rgb pvrtc 2bppv1":R_,"rgba pvrtc 4bppv1":C_,"rgba pvrtc 2bppv1":O_}),b.webgl_compressed_texture_etc1&&(Ne["rgb etc1"]=I_);var Z=Array.prototype.slice.call(_.getParameter(Gx));Object.keys(Ne).forEach(function(P){var ie=Ne[P];Z.indexOf(ie)>=0&&(Te[P]=ie)});var oe=Object.keys(Te);D.textureFormats=oe;var be=[];Object.keys(Te).forEach(function(P){var ie=Te[P];be[ie]=P});var De=[];Object.keys(Fe).forEach(function(P){var ie=Fe[P];De[ie]=P});var me=[];Object.keys(we).forEach(function(P){var ie=we[P];me[ie]=P});var Ve=[];Object.keys(Ie).forEach(function(P){var ie=Ie[P];Ve[ie]=P});var Ce=[];Object.keys(Re).forEach(function(P){var ie=Re[P];Ce[ie]=P});var ke=oe.reduce(function(P,ie){var Q=Te[ie];return Q===ls||Q===Bf||Q===ls||Q===rl||Q===Uf||Q===nl||b.ext_srgb&&(Q===kf||Q===$f)?P[Q]=Q:Q===Df||ie.indexOf("rgba")>=0?P[Q]=no:P[Q]=tl,P},{});function Ee(){this.internalformat=no,this.format=no,this.type=Yo,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=P_,this.width=0,this.height=0,this.channels=0}function Be(P,ie){P.internalformat=ie.internalformat,P.format=ie.format,P.type=ie.type,P.compressed=ie.compressed,P.premultiplyAlpha=ie.premultiplyAlpha,P.flipY=ie.flipY,P.unpackAlignment=ie.unpackAlignment,P.colorSpace=ie.colorSpace,P.width=ie.width,P.height=ie.height,P.channels=ie.channels}function tt(P,ie){if(!(typeof ie!="object"||!ie)){if("premultiplyAlpha"in ie&&(N.type(ie.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),P.premultiplyAlpha=ie.premultiplyAlpha),"flipY"in ie&&(N.type(ie.flipY,"boolean","invalid texture flip"),P.flipY=ie.flipY),"alignment"in ie&&(N.oneOf(ie.alignment,[1,2,4,8],"invalid texture unpack alignment"),P.unpackAlignment=ie.alignment),"colorSpace"in ie&&(N.parameter(ie.colorSpace,Me,"invalid colorSpace"),P.colorSpace=Me[ie.colorSpace]),"type"in ie){var Q=ie.type;N(b.oes_texture_float||!(Q==="float"||Q==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),N(b.oes_texture_half_float||!(Q==="half float"||Q==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),N(b.webgl_depth_texture||!(Q==="uint16"||Q==="uint32"||Q==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),N.parameter(Q,Fe,"invalid texture type"),P.type=Fe[Q]}var He=P.width,Tt=P.height,Yt=P.channels,T=!1;"shape"in ie?(N(Array.isArray(ie.shape)&&ie.shape.length>=2,"shape must be an array"),He=ie.shape[0],Tt=ie.shape[1],ie.shape.length===3&&(Yt=ie.shape[2],N(Yt>0&&Yt<=4,"invalid number of channels"),T=!0),N(He>=0&&He<=D.maxTextureSize,"invalid width"),N(Tt>=0&&Tt<=D.maxTextureSize,"invalid height")):("radius"in ie&&(He=Tt=ie.radius,N(He>=0&&He<=D.maxTextureSize,"invalid radius")),"width"in ie&&(He=ie.width,N(He>=0&&He<=D.maxTextureSize,"invalid width")),"height"in ie&&(Tt=ie.height,N(Tt>=0&&Tt<=D.maxTextureSize,"invalid height")),"channels"in ie&&(Yt=ie.channels,N(Yt>0&&Yt<=4,"invalid number of channels"),T=!0)),P.width=He|0,P.height=Tt|0,P.channels=Yt|0;var I=!1;if("format"in ie){var B=ie.format;N(b.webgl_depth_texture||!(B==="depth"||B==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),N.parameter(B,Te,"invalid texture format");var J=P.internalformat=Te[B];P.format=ke[J],B in Fe&&("type"in ie||(P.type=Fe[B])),B in Ne&&(P.compressed=!0),I=!0}!T&&I?P.channels=bn[P.format]:T&&!I?P.channels!==al[P.format]&&(P.format=P.internalformat=al[P.channels]):I&&T&&N(P.channels===bn[P.format],"number of channels inconsistent with specified format")}}function at(P){_.pixelStorei(cb,P.flipY),_.pixelStorei(fb,P.premultiplyAlpha),_.pixelStorei(hb,P.colorSpace),_.pixelStorei(lb,P.unpackAlignment)}function Ue(){Ee.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function Oe(P,ie){var Q=null;if(Kf(ie)?Q=ie:ie&&(N.type(ie,"object","invalid pixel data type"),tt(P,ie),"x"in ie&&(P.xOffset=ie.x|0),"y"in ie&&(P.yOffset=ie.y|0),Kf(ie.data)&&(Q=ie.data)),N(!P.compressed||Q instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),ie.copy){N(!Q,"can not specify copy and data field for the same texture");var He=fe.viewportWidth,Tt=fe.viewportHeight;P.width=P.width||He-P.xOffset,P.height=P.height||Tt-P.yOffset,P.needsCopy=!0,N(P.xOffset>=0&&P.xOffset<He&&P.yOffset>=0&&P.yOffset<Tt&&P.width>0&&P.width<=He&&P.height>0&&P.height<=Tt,"copy texture read out of bounds")}else if(!Q)P.width=P.width||1,P.height=P.height||1,P.channels=P.channels||4;else if(r(Q))P.channels=P.channels||4,P.data=Q,!("type"in ie)&&P.type===Yo&&(P.type=H_(Q));else if(k_(Q))P.channels=P.channels||4,Eb(P,Q),P.alignment=1,P.needsFree=!0;else if(A(Q)){var Yt=Q.data;!Array.isArray(Yt)&&P.type===Yo&&(P.type=H_(Yt));var T=Q.shape,I=Q.stride,B,J,ee,U,j,W;T.length===3?(ee=T[2],W=I[2]):(N(T.length===2,"invalid ndarray pixel data, must be 2 or 3D"),ee=1,W=1),B=T[0],J=T[1],U=I[0],j=I[1],P.alignment=1,P.width=B,P.height=J,P.channels=ee,P.format=P.internalformat=al[ee],P.needsFree=!0,yb(P,Yt,U,j,W,Q.offset)}else if(z_(Q)||V_(Q)||_b(Q))z_(Q)||V_(Q)?P.element=Q:P.element=Q.canvas,P.width=P.element.width,P.height=P.element.height,P.channels=4;else if(vb(Q))P.element=Q,P.width=Q.width,P.height=Q.height,P.channels=4;else if(mb(Q))P.element=Q,P.width=Q.naturalWidth,P.height=Q.naturalHeight,P.channels=4;else if(gb(Q))P.element=Q,P.width=Q.videoWidth,P.height=Q.videoHeight,P.channels=4;else if($_(Q)){var L=P.width||Q[0].length,z=P.height||Q.length,C=P.channels;cr(Q[0][0])?C=C||Q[0][0].length:C=C||1;for(var V=H.shape(Q),ne=1,se=0;se<V.length;++se)ne*=V[se];var ye=j_(P,ne);H.flatten(Q,V,"",ye),X_(P,ye),P.alignment=1,P.width=L,P.height=z,P.channels=C,P.format=P.internalformat=al[C],P.needsFree=!0}P.type===cs?N(D.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):P.type===Go&&N(D.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function pe(P,ie,Q){var He=P.element,Tt=P.data,Yt=P.internalformat,T=P.format,I=P.type,B=P.width,J=P.height;at(P),He?_.texImage2D(ie,Q,T,T,I,He):P.compressed?_.compressedTexImage2D(ie,Q,Yt,B,J,0,Tt):P.needsCopy?(te(),_.copyTexImage2D(ie,Q,T,P.xOffset,P.yOffset,B,J,0)):_.texImage2D(ie,Q,T,B,J,0,T,I,Tt||null)}function st(P,ie,Q,He,Tt){var Yt=P.element,T=P.data,I=P.internalformat,B=P.format,J=P.type,ee=P.width,U=P.height;at(P),Yt?_.texSubImage2D(ie,Tt,Q,He,B,J,Yt):P.compressed?_.compressedTexSubImage2D(ie,Tt,Q,He,I,ee,U,T):P.needsCopy?(te(),_.copyTexSubImage2D(ie,Tt,Q,He,P.xOffset,P.yOffset,ee,U)):_.texSubImage2D(ie,Tt,Q,He,ee,U,B,J,T)}var Ct=[];function Ze(){return Ct.pop()||new Ue}function yt(P){P.needsFree&&ur.freeType(P.data),Ue.call(P),Ct.push(P)}function lt(){Ee.call(this),this.genMipmaps=!1,this.mipmapHint=il,this.mipmask=0,this.images=Array(16)}function _t(P,ie,Q){var He=P.images[0]=Ze();P.mipmask=1,He.width=P.width=ie,He.height=P.height=Q,He.channels=P.channels=4}function Pt(P,ie){var Q=null;if(Kf(ie))Q=P.images[0]=Ze(),Be(Q,P),Oe(Q,ie),P.mipmask=1;else if(tt(P,ie),Array.isArray(ie.mipmap))for(var He=ie.mipmap,Tt=0;Tt<He.length;++Tt)Q=P.images[Tt]=Ze(),Be(Q,P),Q.width>>=Tt,Q.height>>=Tt,Oe(Q,He[Tt]),P.mipmask|=1<<Tt;else Q=P.images[0]=Ze(),Be(Q,P),Oe(Q,ie),P.mipmask=1;Be(P,P.images[0]),P.compressed&&(P.internalformat===zf||P.internalformat===Vf||P.internalformat===Hf||P.internalformat===jf)&&N(P.width%4===0&&P.height%4===0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function _r(P,ie){for(var Q=P.images,He=0;He<Q.length;++He){if(!Q[He])return;pe(Q[He],ie,He)}}var Rr=[];function St(){var P=Rr.pop()||new lt;Ee.call(P),P.mipmask=0;for(var ie=0;ie<16;++ie)P.images[ie]=null;return P}function Er(P){for(var ie=P.images,Q=0;Q<ie.length;++Q)ie[Q]&&yt(ie[Q]),ie[Q]=null;Rr.push(P)}function qt(){this.minFilter=Yf,this.magFilter=Yf,this.wrapS=Gf,this.wrapT=Gf,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=il}function vr(P,ie){if("min"in ie){var Q=ie.min;N.parameter(Q,Ie),P.minFilter=Ie[Q],db.indexOf(P.minFilter)>=0&&!("faces"in ie)&&(P.genMipmaps=!0)}if("mag"in ie){var He=ie.mag;N.parameter(He,we),P.magFilter=we[He]}var Tt=P.wrapS,Yt=P.wrapT;if("wrap"in ie){var T=ie.wrap;typeof T=="string"?(N.parameter(T,Re),Tt=Yt=Re[T]):Array.isArray(T)&&(N.parameter(T[0],Re),N.parameter(T[1],Re),Tt=Re[T[0]],Yt=Re[T[1]])}else{if("wrapS"in ie){var I=ie.wrapS;N.parameter(I,Re),Tt=Re[I]}if("wrapT"in ie){var B=ie.wrapT;N.parameter(B,Re),Yt=Re[B]}}if(P.wrapS=Tt,P.wrapT=Yt,"anisotropic"in ie){var J=ie.anisotropic;N(typeof J=="number"&&J>=1&&J<=D.maxAnisotropic,"aniso samples must be between 1 and "),P.anisotropic=ie.anisotropic}if("mipmap"in ie){var ee=!1;switch(typeof ie.mipmap){case"string":N.parameter(ie.mipmap,xe,"invalid mipmap hint"),P.mipmapHint=xe[ie.mipmap],P.genMipmaps=!0,ee=!0;break;case"boolean":ee=P.genMipmaps=ie.mipmap;break;case"object":N(Array.isArray(ie.mipmap),"invalid mipmap type"),P.genMipmaps=!1,ee=!0;break;default:N.raise("invalid mipmap type")}ee&&!("min"in ie)&&(P.minFilter=Zf)}}function yr(P,ie){_.texParameteri(ie,nb,P.minFilter),_.texParameteri(ie,rb,P.magFilter),_.texParameteri(ie,Qx,P.wrapS),_.texParameteri(ie,Jx,P.wrapT),b.ext_texture_filter_anisotropic&&_.texParameteri(ie,ub,P.anisotropic),P.genMipmaps&&(_.hint(ob,P.mipmapHint),_.generateMipmap(ie))}var Tr=0,Pr={},zr=D.maxTextureUnits,Ar=Array(zr).map(function(){return null});function dt(P){Ee.call(this),this.mipmask=0,this.internalformat=no,this.id=Tr++,this.refCount=1,this.target=P,this.texture=_.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new qt,ae.profile&&(this.stats={size:0})}function Ur(P){_.activeTexture(ol),_.bindTexture(P.target,P.texture)}function Bt(){var P=Ar[0];P?_.bindTexture(P.target,P.texture):_.bindTexture(ci,null)}function it(P){var ie=P.texture;N(ie,"must not double destroy texture");var Q=P.unit,He=P.target;Q>=0&&(_.activeTexture(ol+Q),_.bindTexture(He,null),Ar[Q]=null),_.deleteTexture(ie),P.texture=null,P.params=null,P.pixels=null,P.refCount=0,delete Pr[P.id],re.textureCount--}n(dt.prototype,{bind:function(){var P=this;P.bindCount+=1;var ie=P.unit;if(ie<0){for(var Q=0;Q<zr;++Q){var He=Ar[Q];if(He){if(He.bindCount>0)continue;He.unit=-1}Ar[Q]=P,ie=Q;break}ie>=zr&&N.raise("insufficient number of texture units"),ae.profile&&re.maxTextureUnits<ie+1&&(re.maxTextureUnits=ie+1),P.unit=ie,_.activeTexture(ol+ie),_.bindTexture(P.target,P.texture)}return ie},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&it(this)}});function At(P,ie){var Q=new dt(ci);Pr[Q.id]=Q,re.textureCount++;function He(T,I){var B=Q.texInfo;qt.call(B);var J=St();return typeof T=="number"?typeof I=="number"?_t(J,T|0,I|0):_t(J,T|0,T|0):T?(N.type(T,"object","invalid arguments to regl.texture"),vr(B,T),Pt(J,T)):_t(J,1,1),B.genMipmaps&&(J.mipmask=(J.width<<1)-1),Q.mipmask=J.mipmask,Be(Q,J),N.texture2D(B,J,D),Q.internalformat=J.internalformat,He.width=J.width,He.height=J.height,Ur(Q),_r(J,ci),yr(B,ci),Bt(),Er(J),ae.profile&&(Q.stats.size=sl(Q.internalformat,Q.type,J.width,J.height,B.genMipmaps,!1)),He.format=be[Q.internalformat],He.type=De[Q.type],He.mag=me[B.magFilter],He.min=Ve[B.minFilter],He.wrapS=Ce[B.wrapS],He.wrapT=Ce[B.wrapT],He}function Tt(T,I,B,J){N(!!T,"must specify image data");var ee=I|0,U=B|0,j=J|0,W=Ze();return Be(W,Q),W.width=0,W.height=0,Oe(W,T),W.width=W.width||(Q.width>>j)-ee,W.height=W.height||(Q.height>>j)-U,N(Q.type===W.type&&Q.format===W.format&&Q.internalformat===W.internalformat,"incompatible format for texture.subimage"),N(ee>=0&&U>=0&&ee+W.width<=Q.width&&U+W.height<=Q.height,"texture.subimage write out of bounds"),N(Q.mipmask&1<<j,"missing mipmap data"),N(W.data||W.element||W.needsCopy,"missing image data"),Ur(Q),st(W,ci,ee,U,j),Bt(),yt(W),He}function Yt(T,I){var B=T|0,J=I|0||B;if(B===Q.width&&J===Q.height)return He;He.width=Q.width=B,He.height=Q.height=J,Ur(Q);for(var ee=0;Q.mipmask>>ee;++ee){var U=B>>ee,j=J>>ee;if(!U||!j)break;_.texImage2D(ci,ee,Q.format,U,j,0,Q.format,Q.type,null)}return Bt(),ae.profile&&(Q.stats.size=sl(Q.internalformat,Q.type,B,J,!1,!1)),He}return He(P,ie),He.subimage=Tt,He.resize=Yt,He._reglType="texture2d",He._texture=Q,ae.profile&&(He.stats=Q.stats),He.destroy=function(){Q.decRef()},He}function Nt(P,ie,Q,He,Tt,Yt){var T=new dt(E_);Pr[T.id]=T,re.cubeCount++;var I=new Array(6);function B(U,j,W,L,z,C){var V,ne=T.texInfo;for(qt.call(ne),V=0;V<6;++V)I[V]=St();if(typeof U=="number"||!U){var se=U|0||1;for(V=0;V<6;++V)_t(I[V],se,se)}else if(typeof U=="object")if(j)Pt(I[0],U),Pt(I[1],j),Pt(I[2],W),Pt(I[3],L),Pt(I[4],z),Pt(I[5],C);else if(vr(ne,U),tt(T,U),"faces"in U){var ye=U.faces;for(N(Array.isArray(ye)&&ye.length===6,"cube faces must be a length 6 array"),V=0;V<6;++V)N(typeof ye[V]=="object"&&!!ye[V],"invalid input for cube map face"),Be(I[V],T),Pt(I[V],ye[V])}else for(V=0;V<6;++V)Pt(I[V],U);else N.raise("invalid arguments to cube map");for(Be(T,I[0]),D.npotTextureCube||N(g_(T.width)&&g_(T.height),"your browser does not support non power or two texture dimensions"),ne.genMipmaps?T.mipmask=(I[0].width<<1)-1:T.mipmask=I[0].mipmask,N.textureCube(T,ne,I,D),T.internalformat=I[0].internalformat,B.width=I[0].width,B.height=I[0].height,Ur(T),V=0;V<6;++V)_r(I[V],el+V);for(yr(ne,E_),Bt(),ae.profile&&(T.stats.size=sl(T.internalformat,T.type,B.width,B.height,ne.genMipmaps,!0)),B.format=be[T.internalformat],B.type=De[T.type],B.mag=me[ne.magFilter],B.min=Ve[ne.minFilter],B.wrapS=Ce[ne.wrapS],B.wrapT=Ce[ne.wrapT],V=0;V<6;++V)Er(I[V]);return B}function J(U,j,W,L,z){N(!!j,"must specify image data"),N(typeof U=="number"&&U===(U|0)&&U>=0&&U<6,"invalid face");var C=W|0,V=L|0,ne=z|0,se=Ze();return Be(se,T),se.width=0,se.height=0,Oe(se,j),se.width=se.width||(T.width>>ne)-C,se.height=se.height||(T.height>>ne)-V,N(T.type===se.type&&T.format===se.format&&T.internalformat===se.internalformat,"incompatible format for texture.subimage"),N(C>=0&&V>=0&&C+se.width<=T.width&&V+se.height<=T.height,"texture.subimage write out of bounds"),N(T.mipmask&1<<ne,"missing mipmap data"),N(se.data||se.element||se.needsCopy,"missing image data"),Ur(T),st(se,el+U,C,V,ne),Bt(),yt(se),B}function ee(U){var j=U|0;if(j!==T.width){B.width=T.width=j,B.height=T.height=j,Ur(T);for(var W=0;W<6;++W)for(var L=0;T.mipmask>>L;++L)_.texImage2D(el+W,L,T.format,j>>L,j>>L,0,T.format,T.type,null);return Bt(),ae.profile&&(T.stats.size=sl(T.internalformat,T.type,B.width,B.height,!1,!0)),B}}return B(P,ie,Q,He,Tt,Yt),B.subimage=J,B.resize=ee,B._reglType="textureCube",B._texture=T,ae.profile&&(B.stats=T.stats),B.destroy=function(){T.decRef()},B}function fr(){for(var P=0;P<zr;++P)_.activeTexture(ol+P),_.bindTexture(ci,null),Ar[P]=null;O(Pr).forEach(it),re.cubeCount=0,re.textureCount=0}ae.profile&&(re.getTotalTextureSize=function(){var P=0;return Object.keys(Pr).forEach(function(ie){P+=Pr[ie].stats.size}),P});function ri(){for(var P=0;P<zr;++P){var ie=Ar[P];ie&&(ie.bindCount=0,ie.unit=-1,Ar[P]=null)}O(Pr).forEach(function(Q){Q.texture=_.createTexture(),_.bindTexture(Q.target,Q.texture);for(var He=0;He<32;++He)if(Q.mipmask&1<<He)if(Q.target===ci)_.texImage2D(ci,He,Q.internalformat,Q.width>>He,Q.height>>He,0,Q.internalformat,Q.type,null);else for(var Tt=0;Tt<6;++Tt)_.texImage2D(el+Tt,He,Q.internalformat,Q.width>>He,Q.height>>He,0,Q.internalformat,Q.type,null);yr(Q.texInfo,Q.target)})}return{create2D:At,createCube:Nt,clear:fr,getTexture:function(P){return null},restore:ri}}var Ii=36161,ul=32854,W_=32855,G_=36194,Y_=33189,Z_=36168,q_=34041,K_=35907,Q_=34836,J_=34842,ev=34843,Hn=[];Hn[ul]=2,Hn[W_]=2,Hn[G_]=2,Hn[Y_]=2,Hn[Z_]=1,Hn[q_]=4,Hn[K_]=4,Hn[Q_]=16,Hn[J_]=8,Hn[ev]=6;function tv(_,b,D){return Hn[_]*b*D}var Ab=function(_,b,D,te,fe){var re={rgba4:ul,rgb565:G_,"rgb5 a1":W_,depth:Y_,stencil:Z_,"depth stencil":q_};b.ext_srgb&&(re.srgba=K_),b.ext_color_buffer_half_float&&(re.rgba16f=J_,re.rgb16f=ev),b.webgl_color_buffer_float&&(re.rgba32f=Q_);var ae=[];Object.keys(re).forEach(function(Te){var Ne=re[Te];ae[Ne]=Te});var xe=0,Re={};function we(Te){this.id=xe++,this.refCount=1,this.renderbuffer=Te,this.format=ul,this.width=0,this.height=0,fe.profile&&(this.stats={size:0})}we.prototype.decRef=function(){--this.refCount<=0&&Ie(this)};function Ie(Te){var Ne=Te.renderbuffer;N(Ne,"must not double destroy renderbuffer"),_.bindRenderbuffer(Ii,null),_.deleteRenderbuffer(Ne),Te.renderbuffer=null,Te.refCount=0,delete Re[Te.id],te.renderbufferCount--}function Me(Te,Ne){var Z=new we(_.createRenderbuffer());Re[Z.id]=Z,te.renderbufferCount++;function oe(De,me){var Ve=0,Ce=0,ke=ul;if(typeof De=="object"&&De){var Ee=De;if("shape"in Ee){var Be=Ee.shape;N(Array.isArray(Be)&&Be.length>=2,"invalid renderbuffer shape"),Ve=Be[0]|0,Ce=Be[1]|0}else"radius"in Ee&&(Ve=Ce=Ee.radius|0),"width"in Ee&&(Ve=Ee.width|0),"height"in Ee&&(Ce=Ee.height|0);"format"in Ee&&(N.parameter(Ee.format,re,"invalid renderbuffer format"),ke=re[Ee.format])}else typeof De=="number"?(Ve=De|0,typeof me=="number"?Ce=me|0:Ce=Ve):De?N.raise("invalid arguments to renderbuffer constructor"):Ve=Ce=1;if(N(Ve>0&&Ce>0&&Ve<=D.maxRenderbufferSize&&Ce<=D.maxRenderbufferSize,"invalid renderbuffer size"),!(Ve===Z.width&&Ce===Z.height&&ke===Z.format))return oe.width=Z.width=Ve,oe.height=Z.height=Ce,Z.format=ke,_.bindRenderbuffer(Ii,Z.renderbuffer),_.renderbufferStorage(Ii,ke,Ve,Ce),N(_.getError()===0,"invalid render buffer format"),fe.profile&&(Z.stats.size=tv(Z.format,Z.width,Z.height)),oe.format=ae[Z.format],oe}function be(De,me){var Ve=De|0,Ce=me|0||Ve;return Ve===Z.width&&Ce===Z.height||(N(Ve>0&&Ce>0&&Ve<=D.maxRenderbufferSize&&Ce<=D.maxRenderbufferSize,"invalid renderbuffer size"),oe.width=Z.width=Ve,oe.height=Z.height=Ce,_.bindRenderbuffer(Ii,Z.renderbuffer),_.renderbufferStorage(Ii,Z.format,Ve,Ce),N(_.getError()===0,"invalid render buffer format"),fe.profile&&(Z.stats.size=tv(Z.format,Z.width,Z.height))),oe}return oe(Te,Ne),oe.resize=be,oe._reglType="renderbuffer",oe._renderbuffer=Z,fe.profile&&(oe.stats=Z.stats),oe.destroy=function(){Z.decRef()},oe}fe.profile&&(te.getTotalRenderbufferSize=function(){var Te=0;return Object.keys(Re).forEach(function(Ne){Te+=Re[Ne].stats.size}),Te});function Fe(){O(Re).forEach(function(Te){Te.renderbuffer=_.createRenderbuffer(),_.bindRenderbuffer(Ii,Te.renderbuffer),_.renderbufferStorage(Ii,Te.format,Te.width,Te.height)}),_.bindRenderbuffer(Ii,null)}return{create:Me,clear:function(){O(Re).forEach(Ie)},restore:Fe}},fi=36160,Qf=36161,oo=3553,ll=34069,rv=36064,nv=36096,iv=36128,ov=33306,av=36053,Sb=36054,xb=36055,bb=36057,Rb=36061,Cb=36193,Ob=5121,Ib=5126,sv=6407,uv=6408,Mb=6402,Nb=[sv,uv],Jf=[];Jf[uv]=4,Jf[sv]=3;var cl=[];cl[Ob]=1,cl[Ib]=4,cl[Cb]=2;var Pb=32854,Lb=32855,wb=36194,Fb=33189,Bb=36168,lv=34041,Db=35907,Ub=34836,kb=34842,$b=34843,zb=[Pb,Lb,wb,Db,kb,$b,Ub],Ko={};Ko[av]="complete",Ko[Sb]="incomplete attachment",Ko[bb]="incomplete dimensions",Ko[xb]="incomplete, missing attachment",Ko[Rb]="unsupported";function Vb(_,b,D,te,fe,re){var ae={cur:null,next:null,dirty:!1,setFBO:null},xe=["rgba"],Re=["rgba4","rgb565","rgb5 a1"];b.ext_srgb&&Re.push("srgba"),b.ext_color_buffer_half_float&&Re.push("rgba16f","rgb16f"),b.webgl_color_buffer_float&&Re.push("rgba32f");var we=["uint8"];b.oes_texture_half_float&&we.push("half float","float16"),b.oes_texture_float&&we.push("float","float32");function Ie(Ue,Oe,pe){this.target=Ue,this.texture=Oe,this.renderbuffer=pe;var st=0,Ct=0;Oe?(st=Oe.width,Ct=Oe.height):pe&&(st=pe.width,Ct=pe.height),this.width=st,this.height=Ct}function Me(Ue){Ue&&(Ue.texture&&Ue.texture._texture.decRef(),Ue.renderbuffer&&Ue.renderbuffer._renderbuffer.decRef())}function Fe(Ue,Oe,pe){if(Ue)if(Ue.texture){var st=Ue.texture._texture,Ct=Math.max(1,st.width),Ze=Math.max(1,st.height);N(Ct===Oe&&Ze===pe,"inconsistent width/height for supplied texture"),st.refCount+=1}else{var yt=Ue.renderbuffer._renderbuffer;N(yt.width===Oe&&yt.height===pe,"inconsistent width/height for renderbuffer"),yt.refCount+=1}}function Te(Ue,Oe){Oe&&(Oe.texture?_.framebufferTexture2D(fi,Ue,Oe.target,Oe.texture._texture.texture,0):_.framebufferRenderbuffer(fi,Ue,Qf,Oe.renderbuffer._renderbuffer.renderbuffer))}function Ne(Ue){var Oe=oo,pe=null,st=null,Ct=Ue;typeof Ue=="object"&&(Ct=Ue.data,"target"in Ue&&(Oe=Ue.target|0)),N.type(Ct,"function","invalid attachment data");var Ze=Ct._reglType;return Ze==="texture2d"?(pe=Ct,N(Oe===oo)):Ze==="textureCube"?(pe=Ct,N(Oe>=ll&&Oe<ll+6,"invalid cube map target")):Ze==="renderbuffer"?(st=Ct,Oe=Qf):N.raise("invalid regl object for attachment"),new Ie(Oe,pe,st)}function Z(Ue,Oe,pe,st,Ct){if(pe){var Ze=te.create2D({width:Ue,height:Oe,format:st,type:Ct});return Ze._texture.refCount=0,new Ie(oo,Ze,null)}else{var yt=fe.create({width:Ue,height:Oe,format:st});return yt._renderbuffer.refCount=0,new Ie(Qf,null,yt)}}function oe(Ue){return Ue&&(Ue.texture||Ue.renderbuffer)}function be(Ue,Oe,pe){Ue&&(Ue.texture?Ue.texture.resize(Oe,pe):Ue.renderbuffer&&Ue.renderbuffer.resize(Oe,pe),Ue.width=Oe,Ue.height=pe)}var De=0,me={};function Ve(){this.id=De++,me[this.id]=this,this.framebuffer=_.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function Ce(Ue){Ue.colorAttachments.forEach(Me),Me(Ue.depthAttachment),Me(Ue.stencilAttachment),Me(Ue.depthStencilAttachment)}function ke(Ue){var Oe=Ue.framebuffer;N(Oe,"must not double destroy framebuffer"),_.deleteFramebuffer(Oe),Ue.framebuffer=null,re.framebufferCount--,delete me[Ue.id]}function Ee(Ue){var Oe;_.bindFramebuffer(fi,Ue.framebuffer);var pe=Ue.colorAttachments;for(Oe=0;Oe<pe.length;++Oe)Te(rv+Oe,pe[Oe]);for(Oe=pe.length;Oe<D.maxColorAttachments;++Oe)_.framebufferTexture2D(fi,rv+Oe,oo,null,0);_.framebufferTexture2D(fi,ov,oo,null,0),_.framebufferTexture2D(fi,nv,oo,null,0),_.framebufferTexture2D(fi,iv,oo,null,0),Te(nv,Ue.depthAttachment),Te(iv,Ue.stencilAttachment),Te(ov,Ue.depthStencilAttachment);var st=_.checkFramebufferStatus(fi);!_.isContextLost()&&st!==av&&N.raise("framebuffer configuration not supported, status = "+Ko[st]),_.bindFramebuffer(fi,ae.next?ae.next.framebuffer:null),ae.cur=ae.next,_.getError()}function Be(Ue,Oe){var pe=new Ve;re.framebufferCount++;function st(Ze,yt){var lt;N(ae.next!==pe,"can not update framebuffer which is currently in use");var _t=0,Pt=0,_r=!0,Rr=!0,St=null,Er=!0,qt="rgba",vr="uint8",yr=1,Tr=null,Pr=null,zr=null,Ar=!1;if(typeof Ze=="number")_t=Ze|0,Pt=yt|0||_t;else if(!Ze)_t=Pt=1;else{N.type(Ze,"object","invalid arguments for framebuffer");var dt=Ze;if("shape"in dt){var Ur=dt.shape;N(Array.isArray(Ur)&&Ur.length>=2,"invalid shape for framebuffer"),_t=Ur[0],Pt=Ur[1]}else"radius"in dt&&(_t=Pt=dt.radius),"width"in dt&&(_t=dt.width),"height"in dt&&(Pt=dt.height);("color"in dt||"colors"in dt)&&(St=dt.color||dt.colors,Array.isArray(St)&&N(St.length===1||b.webgl_draw_buffers,"multiple render targets not supported")),St||("colorCount"in dt&&(yr=dt.colorCount|0,N(yr>0,"invalid color buffer count")),"colorTexture"in dt&&(Er=!!dt.colorTexture,qt="rgba4"),"colorType"in dt&&(vr=dt.colorType,Er?(N(b.oes_texture_float||!(vr==="float"||vr==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),N(b.oes_texture_half_float||!(vr==="half float"||vr==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):vr==="half float"||vr==="float16"?(N(b.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),qt="rgba16f"):(vr==="float"||vr==="float32")&&(N(b.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),qt="rgba32f"),N.oneOf(vr,we,"invalid color type")),"colorFormat"in dt&&(qt=dt.colorFormat,xe.indexOf(qt)>=0?Er=!0:Re.indexOf(qt)>=0?Er=!1:Er?N.oneOf(dt.colorFormat,xe,"invalid color format for texture"):N.oneOf(dt.colorFormat,Re,"invalid color format for renderbuffer"))),("depthTexture"in dt||"depthStencilTexture"in dt)&&(Ar=!!(dt.depthTexture||dt.depthStencilTexture),N(!Ar||b.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in dt&&(typeof dt.depth=="boolean"?_r=dt.depth:(Tr=dt.depth,Rr=!1)),"stencil"in dt&&(typeof dt.stencil=="boolean"?Rr=dt.stencil:(Pr=dt.stencil,_r=!1)),"depthStencil"in dt&&(typeof dt.depthStencil=="boolean"?_r=Rr=dt.depthStencil:(zr=dt.depthStencil,_r=!1,Rr=!1))}var Bt=null,it=null,At=null,Nt=null;if(Array.isArray(St))Bt=St.map(Ne);else if(St)Bt=[Ne(St)];else for(Bt=new Array(yr),lt=0;lt<yr;++lt)Bt[lt]=Z(_t,Pt,Er,qt,vr);N(b.webgl_draw_buffers||Bt.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),N(Bt.length<=D.maxColorAttachments,"too many color attachments, not supported"),_t=_t||Bt[0].width,Pt=Pt||Bt[0].height,Tr?it=Ne(Tr):_r&&!Rr&&(it=Z(_t,Pt,Ar,"depth","uint32")),Pr?At=Ne(Pr):Rr&&!_r&&(At=Z(_t,Pt,!1,"stencil","uint8")),zr?Nt=Ne(zr):!Tr&&!Pr&&Rr&&_r&&(Nt=Z(_t,Pt,Ar,"depth stencil","depth stencil")),N(!!Tr+!!Pr+!!zr<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var fr=null;for(lt=0;lt<Bt.length;++lt)if(Fe(Bt[lt],_t,Pt),N(!Bt[lt]||Bt[lt].texture&&Nb.indexOf(Bt[lt].texture._texture.format)>=0||Bt[lt].renderbuffer&&zb.indexOf(Bt[lt].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+lt+" is invalid"),Bt[lt]&&Bt[lt].texture){var ri=Jf[Bt[lt].texture._texture.format]*cl[Bt[lt].texture._texture.type];fr===null?fr=ri:N(fr===ri,"all color attachments much have the same number of bits per pixel.")}return Fe(it,_t,Pt),N(!it||it.texture&&it.texture._texture.format===Mb||it.renderbuffer&&it.renderbuffer._renderbuffer.format===Fb,"invalid depth attachment for framebuffer object"),Fe(At,_t,Pt),N(!At||At.renderbuffer&&At.renderbuffer._renderbuffer.format===Bb,"invalid stencil attachment for framebuffer object"),Fe(Nt,_t,Pt),N(!Nt||Nt.texture&&Nt.texture._texture.format===lv||Nt.renderbuffer&&Nt.renderbuffer._renderbuffer.format===lv,"invalid depth-stencil attachment for framebuffer object"),Ce(pe),pe.width=_t,pe.height=Pt,pe.colorAttachments=Bt,pe.depthAttachment=it,pe.stencilAttachment=At,pe.depthStencilAttachment=Nt,st.color=Bt.map(oe),st.depth=oe(it),st.stencil=oe(At),st.depthStencil=oe(Nt),st.width=pe.width,st.height=pe.height,Ee(pe),st}function Ct(Ze,yt){N(ae.next!==pe,"can not resize a framebuffer which is currently in use");var lt=Math.max(Ze|0,1),_t=Math.max(yt|0||lt,1);if(lt===pe.width&&_t===pe.height)return st;for(var Pt=pe.colorAttachments,_r=0;_r<Pt.length;++_r)be(Pt[_r],lt,_t);return be(pe.depthAttachment,lt,_t),be(pe.stencilAttachment,lt,_t),be(pe.depthStencilAttachment,lt,_t),pe.width=st.width=lt,pe.height=st.height=_t,Ee(pe),st}return st(Ue,Oe),n(st,{resize:Ct,_reglType:"framebuffer",_framebuffer:pe,destroy:function(){ke(pe),Ce(pe)},use:function(Ze){ae.setFBO({framebuffer:st},Ze)}})}function tt(Ue){var Oe=Array(6);function pe(Ct){var Ze;N(Oe.indexOf(ae.next)<0,"can not update framebuffer which is currently in use");var yt={color:null},lt=0,_t=null,Pt="rgba",_r="uint8",Rr=1;if(typeof Ct=="number")lt=Ct|0;else if(!Ct)lt=1;else{N.type(Ct,"object","invalid arguments for framebuffer");var St=Ct;if("shape"in St){var Er=St.shape;N(Array.isArray(Er)&&Er.length>=2,"invalid shape for framebuffer"),N(Er[0]===Er[1],"cube framebuffer must be square"),lt=Er[0]}else"radius"in St&&(lt=St.radius|0),"width"in St?(lt=St.width|0,"height"in St&&N(St.height===lt,"must be square")):"height"in St&&(lt=St.height|0);("color"in St||"colors"in St)&&(_t=St.color||St.colors,Array.isArray(_t)&&N(_t.length===1||b.webgl_draw_buffers,"multiple render targets not supported")),_t||("colorCount"in St&&(Rr=St.colorCount|0,N(Rr>0,"invalid color buffer count")),"colorType"in St&&(N.oneOf(St.colorType,we,"invalid color type"),_r=St.colorType),"colorFormat"in St&&(Pt=St.colorFormat,N.oneOf(St.colorFormat,xe,"invalid color format for texture"))),"depth"in St&&(yt.depth=St.depth),"stencil"in St&&(yt.stencil=St.stencil),"depthStencil"in St&&(yt.depthStencil=St.depthStencil)}var qt;if(_t)if(Array.isArray(_t))for(qt=[],Ze=0;Ze<_t.length;++Ze)qt[Ze]=_t[Ze];else qt=[_t];else{qt=Array(Rr);var vr={radius:lt,format:Pt,type:_r};for(Ze=0;Ze<Rr;++Ze)qt[Ze]=te.createCube(vr)}for(yt.color=Array(qt.length),Ze=0;Ze<qt.length;++Ze){var yr=qt[Ze];N(typeof yr=="function"&&yr._reglType==="textureCube","invalid cube map"),lt=lt||yr.width,N(yr.width===lt&&yr.height===lt,"invalid cube map shape"),yt.color[Ze]={target:ll,data:qt[Ze]}}for(Ze=0;Ze<6;++Ze){for(var Tr=0;Tr<qt.length;++Tr)yt.color[Tr].target=ll+Ze;Ze>0&&(yt.depth=Oe[0].depth,yt.stencil=Oe[0].stencil,yt.depthStencil=Oe[0].depthStencil),Oe[Ze]?Oe[Ze](yt):Oe[Ze]=Be(yt)}return n(pe,{width:lt,height:lt,color:qt})}function st(Ct){var Ze,yt=Ct|0;if(N(yt>0&&yt<=D.maxCubeMapSize,"invalid radius for cube fbo"),yt===pe.width)return pe;var lt=pe.color;for(Ze=0;Ze<lt.length;++Ze)lt[Ze].resize(yt);for(Ze=0;Ze<6;++Ze)Oe[Ze].resize(yt);return pe.width=pe.height=yt,pe}return pe(Ue),n(pe,{faces:Oe,resize:st,_reglType:"framebufferCube",destroy:function(){Oe.forEach(function(Ct){Ct.destroy()})}})}function at(){ae.cur=null,ae.next=null,ae.dirty=!0,O(me).forEach(function(Ue){Ue.framebuffer=_.createFramebuffer(),Ee(Ue)})}return n(ae,{getFramebuffer:function(Ue){if(typeof Ue=="function"&&Ue._reglType==="framebuffer"){var Oe=Ue._framebuffer;if(Oe instanceof Ve)return Oe}return null},create:Be,createCube:tt,clear:function(){O(me).forEach(ke)},restore:at})}var Hb=5126,cv=34962;function eh(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=Hb,this.offset=0,this.stride=0,this.divisor=0}function jb(_,b,D,te,fe){for(var re=D.maxAttributes,ae=new Array(re),xe=0;xe<re;++xe)ae[xe]=new eh;var Re=0,we={},Ie={Record:eh,scope:{},state:ae,currentVAO:null,targetVAO:null,restore:Fe()?me:function(){},createVAO:Ve,getVAO:Ne,destroyBuffer:Me,setVAO:Fe()?Z:oe,clear:Fe()?be:function(){}};function Me(Ce){for(var ke=0;ke<ae.length;++ke){var Ee=ae[ke];Ee.buffer===Ce&&(_.disableVertexAttribArray(ke),Ee.buffer=null)}}function Fe(){return b.oes_vertex_array_object}function Te(){return b.angle_instanced_arrays}function Ne(Ce){return typeof Ce=="function"&&Ce._vao?Ce._vao:null}function Z(Ce){if(Ce!==Ie.currentVAO){var ke=Fe();Ce?ke.bindVertexArrayOES(Ce.vao):ke.bindVertexArrayOES(null),Ie.currentVAO=Ce}}function oe(Ce){if(Ce!==Ie.currentVAO){if(Ce)Ce.bindAttrs();else for(var ke=Te(),Ee=0;Ee<ae.length;++Ee){var Be=ae[Ee];Be.buffer?(_.enableVertexAttribArray(Ee),_.vertexAttribPointer(Ee,Be.size,Be.type,Be.normalized,Be.stride,Be.offfset),ke&&ke.vertexAttribDivisorANGLE(Ee,Be.divisor)):(_.disableVertexAttribArray(Ee),_.vertexAttrib4f(Ee,Be.x,Be.y,Be.z,Be.w))}Ie.currentVAO=Ce}}function be(){O(we).forEach(function(Ce){Ce.destroy()})}function De(){this.id=++Re,this.attributes=[];var Ce=Fe();Ce?this.vao=Ce.createVertexArrayOES():this.vao=null,we[this.id]=this,this.buffers=[]}De.prototype.bindAttrs=function(){for(var Ce=Te(),ke=this.attributes,Ee=0;Ee<ke.length;++Ee){var Be=ke[Ee];Be.buffer?(_.enableVertexAttribArray(Ee),_.bindBuffer(cv,Be.buffer.buffer),_.vertexAttribPointer(Ee,Be.size,Be.type,Be.normalized,Be.stride,Be.offset),Ce&&Ce.vertexAttribDivisorANGLE(Ee,Be.divisor)):(_.disableVertexAttribArray(Ee),_.vertexAttrib4f(Ee,Be.x,Be.y,Be.z,Be.w))}for(var tt=ke.length;tt<re;++tt)_.disableVertexAttribArray(tt)},De.prototype.refresh=function(){var Ce=Fe();Ce&&(Ce.bindVertexArrayOES(this.vao),this.bindAttrs(),Ie.currentVAO=this)},De.prototype.destroy=function(){if(this.vao){var Ce=Fe();this===Ie.currentVAO&&(Ie.currentVAO=null,Ce.bindVertexArrayOES(null)),Ce.deleteVertexArrayOES(this.vao),this.vao=null}we[this.id]&&(delete we[this.id],te.vaoCount-=1)};function me(){var Ce=Fe();Ce&&O(we).forEach(function(ke){ke.refresh()})}function Ve(Ce){var ke=new De;te.vaoCount+=1;function Ee(Be){N(Array.isArray(Be),"arguments to vertex array constructor must be an array"),N(Be.length<re,"too many attributes"),N(Be.length>0,"must specify at least one attribute");for(var tt=0;tt<ke.buffers.length;++tt)ke.buffers[tt].destroy();ke.buffers.length=0;var at=ke.attributes;at.length=Be.length;for(var Ue=0;Ue<Be.length;++Ue){var Oe=Be[Ue],pe=at[Ue]=new eh;if(Array.isArray(Oe)||r(Oe)||A(Oe)){var st=fe.create(Oe,cv,!1,!0);pe.buffer=fe.getBuffer(st),pe.size=pe.buffer.dimension|0,pe.normalized=!1,pe.type=pe.buffer.dtype,pe.offset=0,pe.stride=0,pe.divisor=0,pe.state=1,ke.buffers.push(st)}else fe.getBuffer(Oe)?(pe.buffer=fe.getBuffer(Oe),pe.size=pe.buffer.dimension|0,pe.normalized=!1,pe.type=pe.buffer.dtype,pe.offset=0,pe.stride=0,pe.divisor=0,pe.state=1):fe.getBuffer(Oe.buffer)?(pe.buffer=fe.getBuffer(Oe.buffer),pe.size=(+Oe.size||pe.buffer.dimension)|0,pe.normalized=!!Oe.normalized||!1,"type"in Oe?(N.parameter(Oe.type,to,"invalid buffer type"),pe.type=to[Oe.type]):pe.type=pe.buffer.dtype,pe.offset=(Oe.offset||0)|0,pe.stride=(Oe.stride||0)|0,pe.divisor=(Oe.divisor||0)|0,pe.state=1,N(pe.size>=1&&pe.size<=4,"size must be between 1 and 4"),N(pe.offset>=0,"invalid offset"),N(pe.stride>=0&&pe.stride<=255,"stride must be between 0 and 255"),N(pe.divisor>=0,"divisor must be positive"),N(!pe.divisor||!!b.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in Oe?(N(Ue>0,"first attribute must not be a constant"),pe.x=+Oe.x||0,pe.y=+Oe.y||0,pe.z=+Oe.z||0,pe.w=+Oe.w||0,pe.state=2):N(!1,"invalid attribute spec for location "+Ue)}return ke.refresh(),Ee}return Ee.destroy=function(){ke.destroy()},Ee._vao=ke,Ee._reglType="vao",Ee(Ce)}return Ie}var fv=35632,Xb=35633,Wb=35718,Gb=35721;function Yb(_,b,D,te){var fe={},re={};function ae(Z,oe,be,De){this.name=Z,this.id=oe,this.location=be,this.info=De}function xe(Z,oe){for(var be=0;be<Z.length;++be)if(Z[be].id===oe.id){Z[be].location=oe.location;return}Z.push(oe)}function Re(Z,oe,be){var De=Z===fv?fe:re,me=De[oe];if(!me){var Ve=b.str(oe);me=_.createShader(Z),_.shaderSource(me,Ve),_.compileShader(me),N.shaderError(_,me,Ve,Z,be),De[oe]=me}return me}var we={},Ie=[],Me=0;function Fe(Z,oe){this.id=Me++,this.fragId=Z,this.vertId=oe,this.program=null,this.uniforms=[],this.attributes=[],te.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function Te(Z,oe,be){var De,me,Ve=Re(fv,Z.fragId),Ce=Re(Xb,Z.vertId),ke=Z.program=_.createProgram();if(_.attachShader(ke,Ve),_.attachShader(ke,Ce),be)for(De=0;De<be.length;++De){var Ee=be[De];_.bindAttribLocation(ke,Ee[0],Ee[1])}_.linkProgram(ke),N.linkError(_,ke,b.str(Z.fragId),b.str(Z.vertId),oe);var Be=_.getProgramParameter(ke,Wb);te.profile&&(Z.stats.uniformsCount=Be);var tt=Z.uniforms;for(De=0;De<Be;++De)if(me=_.getActiveUniform(ke,De),me)if(me.size>1)for(var at=0;at<me.size;++at){var Ue=me.name.replace("[0]","["+at+"]");xe(tt,new ae(Ue,b.id(Ue),_.getUniformLocation(ke,Ue),me))}else xe(tt,new ae(me.name,b.id(me.name),_.getUniformLocation(ke,me.name),me));var Oe=_.getProgramParameter(ke,Gb);te.profile&&(Z.stats.attributesCount=Oe);var pe=Z.attributes;for(De=0;De<Oe;++De)me=_.getActiveAttrib(ke,De),me&&xe(pe,new ae(me.name,b.id(me.name),_.getAttribLocation(ke,me.name),me))}te.profile&&(D.getMaxUniformsCount=function(){var Z=0;return Ie.forEach(function(oe){oe.stats.uniformsCount>Z&&(Z=oe.stats.uniformsCount)}),Z},D.getMaxAttributesCount=function(){var Z=0;return Ie.forEach(function(oe){oe.stats.attributesCount>Z&&(Z=oe.stats.attributesCount)}),Z});function Ne(){fe={},re={};for(var Z=0;Z<Ie.length;++Z)Te(Ie[Z],null,Ie[Z].attributes.map(function(oe){return[oe.location,oe.name]}))}return{clear:function(){var Z=_.deleteShader.bind(_);O(fe).forEach(Z),fe={},O(re).forEach(Z),re={},Ie.forEach(function(oe){_.deleteProgram(oe.program)}),Ie.length=0,we={},D.shaderCount=0},program:function(Z,oe,be,De){N.command(Z>=0,"missing vertex shader",be),N.command(oe>=0,"missing fragment shader",be);var me=we[oe];me||(me=we[oe]={});var Ve=me[Z];if(Ve&&!De)return Ve;var Ce=new Fe(oe,Z);return D.shaderCount++,Te(Ce,be,De),Ve||(me[Z]=Ce),Ie.push(Ce),Ce},restore:Ne,shader:Re,frag:-1,vert:-1}}var Zb=6408,fs=5121,qb=3333,fl=5126;function Kb(_,b,D,te,fe,re,ae){function xe(Ie){var Me;b.next===null?(N(fe.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),Me=fs):(N(b.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),Me=b.next.colorAttachments[0].texture._texture.type,re.oes_texture_float?(N(Me===fs||Me===fl,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),Me===fl&&N(ae.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):N(Me===fs,"Reading from a framebuffer is only allowed for the type 'uint8'"));var Fe=0,Te=0,Ne=te.framebufferWidth,Z=te.framebufferHeight,oe=null;r(Ie)?oe=Ie:Ie&&(N.type(Ie,"object","invalid arguments to regl.read()"),Fe=Ie.x|0,Te=Ie.y|0,N(Fe>=0&&Fe<te.framebufferWidth,"invalid x offset for regl.read"),N(Te>=0&&Te<te.framebufferHeight,"invalid y offset for regl.read"),Ne=(Ie.width||te.framebufferWidth-Fe)|0,Z=(Ie.height||te.framebufferHeight-Te)|0,oe=Ie.data||null),oe&&(Me===fs?N(oe instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):Me===fl&&N(oe instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),N(Ne>0&&Ne+Fe<=te.framebufferWidth,"invalid width for read pixels"),N(Z>0&&Z+Te<=te.framebufferHeight,"invalid height for read pixels"),D();var be=Ne*Z*4;return oe||(Me===fs?oe=new Uint8Array(be):Me===fl&&(oe=oe||new Float32Array(be))),N.isTypedArray(oe,"data buffer for regl.read() must be a typedarray"),N(oe.byteLength>=be,"data buffer for regl.read() too small"),_.pixelStorei(qb,4),_.readPixels(Fe,Te,Ne,Z,Zb,Me,oe),oe}function Re(Ie){var Me;return b.setFBO({framebuffer:Ie.framebuffer},function(){Me=xe(Ie)}),Me}function we(Ie){return!Ie||!("framebuffer"in Ie)?xe(Ie):Re(Ie)}return we}function Qo(_){return Array.prototype.slice.call(_)}function Jo(_){return Qo(_).join("")}function Qb(){var _=0,b=[],D=[];function te(Me){for(var Fe=0;Fe<D.length;++Fe)if(D[Fe]===Me)return b[Fe];var Te="g"+_++;return b.push(Te),D.push(Me),Te}function fe(){var Me=[];function Fe(){Me.push.apply(Me,Qo(arguments))}var Te=[];function Ne(){var Z="v"+_++;return Te.push(Z),arguments.length>0&&(Me.push(Z,"="),Me.push.apply(Me,Qo(arguments)),Me.push(";")),Z}return n(Fe,{def:Ne,toString:function(){return Jo([Te.length>0?"var "+Te.join(",")+";":"",Jo(Me)])}})}function re(){var Me=fe(),Fe=fe(),Te=Me.toString,Ne=Fe.toString;function Z(oe,be){Fe(oe,be,"=",Me.def(oe,be),";")}return n(function(){Me.apply(Me,Qo(arguments))},{def:Me.def,entry:Me,exit:Fe,save:Z,set:function(oe,be,De){Z(oe,be),Me(oe,be,"=",De,";")},toString:function(){return Te()+Ne()}})}function ae(){var Me=Jo(arguments),Fe=re(),Te=re(),Ne=Fe.toString,Z=Te.toString;return n(Fe,{then:function(){return Fe.apply(Fe,Qo(arguments)),this},else:function(){return Te.apply(Te,Qo(arguments)),this},toString:function(){var oe=Z();return oe&&(oe="else{"+oe+"}"),Jo(["if(",Me,"){",Ne(),"}",oe])}})}var xe=fe(),Re={};function we(Me,Fe){var Te=[];function Ne(){var me="a"+Te.length;return Te.push(me),me}Fe=Fe||0;for(var Z=0;Z<Fe;++Z)Ne();var oe=re(),be=oe.toString,De=Re[Me]=n(oe,{arg:Ne,toString:function(){return Jo(["function(",Te.join(),"){",be(),"}"])}});return De}function Ie(){var Me=['"use strict";',xe,"return {"];Object.keys(Re).forEach(function(Ne){Me.push('"',Ne,'":',Re[Ne].toString(),",")}),Me.push("}");var Fe=Jo(Me).replace(/;/g,`;
`).replace(/}/g,`}
`).replace(/{/g,`{
`),Te=Function.apply(null,b.concat(Fe));return Te.apply(null,D)}return{global:xe,link:te,block:fe,proc:we,scope:re,cond:ae,compile:Ie}}var ea="xyzw".split(""),hv=5121,ta=1,th=2,dv=0,pv=1,_v=2,vv=3,rh=4,mv="dither",gv="blend.enable",Ev="blend.color",nh="blend.equation",ih="blend.func",yv="depth.enable",Tv="depth.func",Av="depth.range",Sv="depth.mask",oh="colorMask",xv="cull.enable",bv="cull.face",ah="frontFace",sh="lineWidth",Rv="polygonOffset.enable",uh="polygonOffset.offset",Cv="sample.alpha",Ov="sample.enable",lh="sample.coverage",Iv="stencil.enable",Mv="stencil.mask",ch="stencil.func",fh="stencil.opFront",hs="stencil.opBack",Nv="scissor.enable",hl="scissor.box",hi="viewport",ds="profile",ao="framebuffer",ps="vert",_s="frag",so="elements",uo="primitive",lo="count",dl="offset",pl="instances",vs="vao",hh="Width",dh="Height",ra=ao+hh,na=ao+dh,Jb=hi+hh,eR=hi+dh,Pv="drawingBuffer",Lv=Pv+hh,wv=Pv+dh,tR=[ih,nh,ch,fh,hs,lh,hi,hl,uh],ia=34962,rR=34963,nR=35632,iR=35633,Fv=3553,oR=34067,aR=2884,sR=3042,uR=3024,lR=2960,cR=2929,fR=3089,hR=32823,dR=32926,pR=32928,ph=5126,_l=35664,vl=35665,ml=35666,_h=5124,gl=35667,El=35668,yl=35669,vh=35670,Tl=35671,Al=35672,Sl=35673,ms=35674,gs=35675,Es=35676,ys=35678,Ts=35680,Bv=4,As=1028,co=1029,Dv=2304,mh=2305,_R=32775,vR=32776,mR=519,Mi=7680,Uv=0,kv=1,$v=32774,gR=513,zv=36160,ER=36064,ti={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Vv=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],oa={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Ni={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Hv={frag:nR,vert:iR},gh={cw:Dv,ccw:mh};function xl(_){return Array.isArray(_)||r(_)||A(_)}function jv(_){return _.sort(function(b,D){return b===hi?-1:D===hi?1:b<D?-1:1})}function mn(_,b,D,te){this.thisDep=_,this.contextDep=b,this.propDep=D,this.append=te}function Pi(_){return _&&!(_.thisDep||_.contextDep||_.propDep)}function pr(_){return new mn(!1,!1,!1,_)}function sn(_,b){var D=_.type;if(D===dv){var te=_.data.length;return new mn(!0,te>=1,te>=2,b)}else if(D===rh){var fe=_.data;return new mn(fe.thisDep,fe.contextDep,fe.propDep,b)}else return new mn(D===vv,D===_v,D===pv,b)}var Xv=new mn(!1,!1,!1,function(){});function yR(_,b,D,te,fe,re,ae,xe,Re,we,Ie,Me,Fe,Te,Ne){var Z=we.Record,oe={add:32774,subtract:32778,"reverse subtract":32779};D.ext_blend_minmax&&(oe.min=_R,oe.max=vR);var be=D.angle_instanced_arrays,De=D.webgl_draw_buffers,me={dirty:!0,profile:Ne.profile},Ve={},Ce=[],ke={},Ee={};function Be(T){return T.replace(".","_")}function tt(T,I,B){var J=Be(T);Ce.push(T),Ve[J]=me[J]=!!B,ke[J]=I}function at(T,I,B){var J=Be(T);Ce.push(T),Array.isArray(B)?(me[J]=B.slice(),Ve[J]=B.slice()):me[J]=Ve[J]=B,Ee[J]=I}tt(mv,uR),tt(gv,sR),at(Ev,"blendColor",[0,0,0,0]),at(nh,"blendEquationSeparate",[$v,$v]),at(ih,"blendFuncSeparate",[kv,Uv,kv,Uv]),tt(yv,cR,!0),at(Tv,"depthFunc",gR),at(Av,"depthRange",[0,1]),at(Sv,"depthMask",!0),at(oh,oh,[!0,!0,!0,!0]),tt(xv,aR),at(bv,"cullFace",co),at(ah,ah,mh),at(sh,sh,1),tt(Rv,hR),at(uh,"polygonOffset",[0,0]),tt(Cv,dR),tt(Ov,pR),at(lh,"sampleCoverage",[1,!1]),tt(Iv,lR),at(Mv,"stencilMask",-1),at(ch,"stencilFunc",[mR,0,-1]),at(fh,"stencilOpSeparate",[As,Mi,Mi,Mi]),at(hs,"stencilOpSeparate",[co,Mi,Mi,Mi]),tt(Nv,fR),at(hl,"scissor",[0,0,_.drawingBufferWidth,_.drawingBufferHeight]),at(hi,hi,[0,0,_.drawingBufferWidth,_.drawingBufferHeight]);var Ue={gl:_,context:Fe,strings:b,next:Ve,current:me,draw:Me,elements:re,buffer:fe,shader:Ie,attributes:we.state,vao:we,uniforms:Re,framebuffer:xe,extensions:D,timer:Te,isBufferArgs:xl},Oe={primTypes:jo,compareFuncs:oa,blendFuncs:ti,blendEquations:oe,stencilOps:Ni,glTypes:to,orientationType:gh};N.optional(function(){Ue.isArrayLike=cr}),De&&(Oe.backBuffer=[co],Oe.drawBuffer=Qr(te.maxDrawbuffers,function(T){return T===0?[0]:Qr(T,function(I){return ER+I})}));var pe=0;function st(){var T=Qb(),I=T.link,B=T.global;T.id=pe++,T.batchId="0";var J=I(Ue),ee=T.shared={props:"a0"};Object.keys(Ue).forEach(function(z){ee[z]=B.def(J,".",z)}),N.optional(function(){T.CHECK=I(N),T.commandStr=N.guessCommand(),T.command=I(T.commandStr),T.assert=function(z,C,V){z("if(!(",C,"))",this.CHECK,".commandRaise(",I(V),",",this.command,");")},Oe.invalidBlendCombinations=Vv});var U=T.next={},j=T.current={};Object.keys(Ee).forEach(function(z){Array.isArray(me[z])&&(U[z]=B.def(ee.next,".",z),j[z]=B.def(ee.current,".",z))});var W=T.constants={};Object.keys(Oe).forEach(function(z){W[z]=B.def(JSON.stringify(Oe[z]))}),T.invoke=function(z,C){switch(C.type){case dv:var V=["this",ee.context,ee.props,T.batchId];return z.def(I(C.data),".call(",V.slice(0,Math.max(C.data.length+1,4)),")");case pv:return z.def(ee.props,C.data);case _v:return z.def(ee.context,C.data);case vv:return z.def("this",C.data);case rh:return C.data.append(T,z),C.data.ref}},T.attribCache={};var L={};return T.scopeAttrib=function(z){var C=b.id(z);if(C in L)return L[C];var V=we.scope[C];V||(V=we.scope[C]=new Z);var ne=L[C]=I(V);return ne},T}function Ct(T){var I=T.static,B=T.dynamic,J;if(ds in I){var ee=!!I[ds];J=pr(function(j,W){return ee}),J.enable=ee}else if(ds in B){var U=B[ds];J=sn(U,function(j,W){return j.invoke(W,U)})}return J}function Ze(T,I){var B=T.static,J=T.dynamic;if(ao in B){var ee=B[ao];return ee?(ee=xe.getFramebuffer(ee),N.command(ee,"invalid framebuffer object"),pr(function(j,W){var L=j.link(ee),z=j.shared;W.set(z.framebuffer,".next",L);var C=z.context;return W.set(C,"."+ra,L+".width"),W.set(C,"."+na,L+".height"),L})):pr(function(j,W){var L=j.shared;W.set(L.framebuffer,".next","null");var z=L.context;return W.set(z,"."+ra,z+"."+Lv),W.set(z,"."+na,z+"."+wv),"null"})}else if(ao in J){var U=J[ao];return sn(U,function(j,W){var L=j.invoke(W,U),z=j.shared,C=z.framebuffer,V=W.def(C,".getFramebuffer(",L,")");N.optional(function(){j.assert(W,"!"+L+"||"+V,"invalid framebuffer object")}),W.set(C,".next",V);var ne=z.context;return W.set(ne,"."+ra,V+"?"+V+".width:"+ne+"."+Lv),W.set(ne,"."+na,V+"?"+V+".height:"+ne+"."+wv),V})}else return null}function yt(T,I,B){var J=T.static,ee=T.dynamic;function U(L){if(L in J){var z=J[L];N.commandType(z,"object","invalid "+L,B.commandStr);var C=!0,V=z.x|0,ne=z.y|0,se,ye;return"width"in z?(se=z.width|0,N.command(se>=0,"invalid "+L,B.commandStr)):C=!1,"height"in z?(ye=z.height|0,N.command(ye>=0,"invalid "+L,B.commandStr)):C=!1,new mn(!C&&I&&I.thisDep,!C&&I&&I.contextDep,!C&&I&&I.propDep,function(Ke,pt){var je=Ke.shared.context,ot=se;"width"in z||(ot=pt.def(je,".",ra,"-",V));var ct=ye;return"height"in z||(ct=pt.def(je,".",na,"-",ne)),[V,ne,ot,ct]})}else if(L in ee){var _e=ee[L],Se=sn(_e,function(Ke,pt){var je=Ke.invoke(pt,_e);N.optional(function(){Ke.assert(pt,je+"&&typeof "+je+'==="object"',"invalid "+L)});var ot=Ke.shared.context,ct=pt.def(je,".x|0"),Ft=pt.def(je,".y|0"),mr=pt.def('"width" in ',je,"?",je,".width|0:","(",ot,".",ra,"-",ct,")"),jn=pt.def('"height" in ',je,"?",je,".height|0:","(",ot,".",na,"-",Ft,")");return N.optional(function(){Ke.assert(pt,mr+">=0&&"+jn+">=0","invalid "+L)}),[ct,Ft,mr,jn]});return I&&(Se.thisDep=Se.thisDep||I.thisDep,Se.contextDep=Se.contextDep||I.contextDep,Se.propDep=Se.propDep||I.propDep),Se}else return I?new mn(I.thisDep,I.contextDep,I.propDep,function(Ke,pt){var je=Ke.shared.context;return[0,0,pt.def(je,".",ra),pt.def(je,".",na)]}):null}var j=U(hi);if(j){var W=j;j=new mn(j.thisDep,j.contextDep,j.propDep,function(L,z){var C=W.append(L,z),V=L.shared.context;return z.set(V,"."+Jb,C[2]),z.set(V,"."+eR,C[3]),C})}return{viewport:j,scissor_box:U(hl)}}function lt(T,I){var B=T.static,J=typeof B[_s]=="string"&&typeof B[ps]=="string";if(J){if(Object.keys(I.dynamic).length>0)return null;var ee=I.static,U=Object.keys(ee);if(U.length>0&&typeof ee[U[0]]=="number"){for(var j=[],W=0;W<U.length;++W)N(typeof ee[U[W]]=="number","must specify all vertex attribute locations when using vaos"),j.push([ee[U[W]]|0,U[W]]);return j}}return null}function _t(T,I,B){var J=T.static,ee=T.dynamic;function U(C){if(C in J){var V=b.id(J[C]);N.optional(function(){Ie.shader(Hv[C],V,N.guessCommand())});var ne=pr(function(){return V});return ne.id=V,ne}else if(C in ee){var se=ee[C];return sn(se,function(ye,_e){var Se=ye.invoke(_e,se),Ke=_e.def(ye.shared.strings,".id(",Se,")");return N.optional(function(){_e(ye.shared.shader,".shader(",Hv[C],",",Ke,",",ye.command,");")}),Ke})}return null}var j=U(_s),W=U(ps),L=null,z;return Pi(j)&&Pi(W)?(L=Ie.program(W.id,j.id,null,B),z=pr(function(C,V){return C.link(L)})):z=new mn(j&&j.thisDep||W&&W.thisDep,j&&j.contextDep||W&&W.contextDep,j&&j.propDep||W&&W.propDep,function(C,V){var ne=C.shared.shader,se;j?se=j.append(C,V):se=V.def(ne,".",_s);var ye;W?ye=W.append(C,V):ye=V.def(ne,".",ps);var _e=ne+".program("+ye+","+se;return N.optional(function(){_e+=","+C.command}),V.def(_e+")")}),{frag:j,vert:W,progVar:z,program:L}}function Pt(T,I){var B=T.static,J=T.dynamic;function ee(){if(so in B){var C=B[so];xl(C)?C=re.getElements(re.create(C,!0)):C&&(C=re.getElements(C),N.command(C,"invalid elements",I.commandStr));var V=pr(function(se,ye){if(C){var _e=se.link(C);return se.ELEMENTS=_e,_e}return se.ELEMENTS=null,null});return V.value=C,V}else if(so in J){var ne=J[so];return sn(ne,function(se,ye){var _e=se.shared,Se=_e.isBufferArgs,Ke=_e.elements,pt=se.invoke(ye,ne),je=ye.def("null"),ot=ye.def(Se,"(",pt,")"),ct=se.cond(ot).then(je,"=",Ke,".createStream(",pt,");").else(je,"=",Ke,".getElements(",pt,");");return N.optional(function(){se.assert(ct.else,"!"+pt+"||"+je,"invalid elements")}),ye.entry(ct),ye.exit(se.cond(ot).then(Ke,".destroyStream(",je,");")),se.ELEMENTS=je,je})}return null}var U=ee();function j(){if(uo in B){var C=B[uo];return N.commandParameter(C,jo,"invalid primitve",I.commandStr),pr(function(ne,se){return jo[C]})}else if(uo in J){var V=J[uo];return sn(V,function(ne,se){var ye=ne.constants.primTypes,_e=ne.invoke(se,V);return N.optional(function(){ne.assert(se,_e+" in "+ye,"invalid primitive, must be one of "+Object.keys(jo))}),se.def(ye,"[",_e,"]")})}else if(U)return Pi(U)?U.value?pr(function(ne,se){return se.def(ne.ELEMENTS,".primType")}):pr(function(){return Bv}):new mn(U.thisDep,U.contextDep,U.propDep,function(ne,se){var ye=ne.ELEMENTS;return se.def(ye,"?",ye,".primType:",Bv)});return null}function W(C,V){if(C in B){var ne=B[C]|0;return N.command(!V||ne>=0,"invalid "+C,I.commandStr),pr(function(ye,_e){return V&&(ye.OFFSET=ne),ne})}else if(C in J){var se=J[C];return sn(se,function(ye,_e){var Se=ye.invoke(_e,se);return V&&(ye.OFFSET=Se,N.optional(function(){ye.assert(_e,Se+">=0","invalid "+C)})),Se})}else if(V&&U)return pr(function(ye,_e){return ye.OFFSET="0",0});return null}var L=W(dl,!0);function z(){if(lo in B){var C=B[lo]|0;return N.command(typeof C=="number"&&C>=0,"invalid vertex count",I.commandStr),pr(function(){return C})}else if(lo in J){var V=J[lo];return sn(V,function(ye,_e){var Se=ye.invoke(_e,V);return N.optional(function(){ye.assert(_e,"typeof "+Se+'==="number"&&'+Se+">=0&&"+Se+"===("+Se+"|0)","invalid vertex count")}),Se})}else if(U)if(Pi(U)){if(U)return L?new mn(L.thisDep,L.contextDep,L.propDep,function(ye,_e){var Se=_e.def(ye.ELEMENTS,".vertCount-",ye.OFFSET);return N.optional(function(){ye.assert(_e,Se+">=0","invalid vertex offset/element buffer too small")}),Se}):pr(function(ye,_e){return _e.def(ye.ELEMENTS,".vertCount")});var ne=pr(function(){return-1});return N.optional(function(){ne.MISSING=!0}),ne}else{var se=new mn(U.thisDep||L.thisDep,U.contextDep||L.contextDep,U.propDep||L.propDep,function(ye,_e){var Se=ye.ELEMENTS;return ye.OFFSET?_e.def(Se,"?",Se,".vertCount-",ye.OFFSET,":-1"):_e.def(Se,"?",Se,".vertCount:-1")});return N.optional(function(){se.DYNAMIC=!0}),se}return null}return{elements:U,primitive:j(),count:z(),instances:W(pl,!1),offset:L}}function _r(T,I){var B=T.static,J=T.dynamic,ee={};return Ce.forEach(function(U){var j=Be(U);function W(L,z){if(U in B){var C=L(B[U]);ee[j]=pr(function(){return C})}else if(U in J){var V=J[U];ee[j]=sn(V,function(ne,se){return z(ne,se,ne.invoke(se,V))})}}switch(U){case xv:case gv:case mv:case Iv:case yv:case Nv:case Rv:case Cv:case Ov:case Sv:return W(function(L){return N.commandType(L,"boolean",U,I.commandStr),L},function(L,z,C){return N.optional(function(){L.assert(z,"typeof "+C+'==="boolean"',"invalid flag "+U,L.commandStr)}),C});case Tv:return W(function(L){return N.commandParameter(L,oa,"invalid "+U,I.commandStr),oa[L]},function(L,z,C){var V=L.constants.compareFuncs;return N.optional(function(){L.assert(z,C+" in "+V,"invalid "+U+", must be one of "+Object.keys(oa))}),z.def(V,"[",C,"]")});case Av:return W(function(L){return N.command(cr(L)&&L.length===2&&typeof L[0]=="number"&&typeof L[1]=="number"&&L[0]<=L[1],"depth range is 2d array",I.commandStr),L},function(L,z,C){N.optional(function(){L.assert(z,L.shared.isArrayLike+"("+C+")&&"+C+".length===2&&typeof "+C+'[0]==="number"&&typeof '+C+'[1]==="number"&&'+C+"[0]<="+C+"[1]","depth range must be a 2d array")});var V=z.def("+",C,"[0]"),ne=z.def("+",C,"[1]");return[V,ne]});case ih:return W(function(L){N.commandType(L,"object","blend.func",I.commandStr);var z="srcRGB"in L?L.srcRGB:L.src,C="srcAlpha"in L?L.srcAlpha:L.src,V="dstRGB"in L?L.dstRGB:L.dst,ne="dstAlpha"in L?L.dstAlpha:L.dst;return N.commandParameter(z,ti,j+".srcRGB",I.commandStr),N.commandParameter(C,ti,j+".srcAlpha",I.commandStr),N.commandParameter(V,ti,j+".dstRGB",I.commandStr),N.commandParameter(ne,ti,j+".dstAlpha",I.commandStr),N.command(Vv.indexOf(z+", "+V)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+z+", "+V+")",I.commandStr),[ti[z],ti[V],ti[C],ti[ne]]},function(L,z,C){var V=L.constants.blendFuncs;N.optional(function(){L.assert(z,C+"&&typeof "+C+'==="object"',"invalid blend func, must be an object")});function ne(je,ot){var ct=z.def('"',je,ot,'" in ',C,"?",C,".",je,ot,":",C,".",je);return N.optional(function(){L.assert(z,ct+" in "+V,"invalid "+U+"."+je+ot+", must be one of "+Object.keys(ti))}),ct}var se=ne("src","RGB"),ye=ne("dst","RGB");N.optional(function(){var je=L.constants.invalidBlendCombinations;L.assert(z,je+".indexOf("+se+'+", "+'+ye+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var _e=z.def(V,"[",se,"]"),Se=z.def(V,"[",ne("src","Alpha"),"]"),Ke=z.def(V,"[",ye,"]"),pt=z.def(V,"[",ne("dst","Alpha"),"]");return[_e,Ke,Se,pt]});case nh:return W(function(L){if(typeof L=="string")return N.commandParameter(L,oe,"invalid "+U,I.commandStr),[oe[L],oe[L]];if(typeof L=="object")return N.commandParameter(L.rgb,oe,U+".rgb",I.commandStr),N.commandParameter(L.alpha,oe,U+".alpha",I.commandStr),[oe[L.rgb],oe[L.alpha]];N.commandRaise("invalid blend.equation",I.commandStr)},function(L,z,C){var V=L.constants.blendEquations,ne=z.def(),se=z.def(),ye=L.cond("typeof ",C,'==="string"');return N.optional(function(){function _e(Se,Ke,pt){L.assert(Se,pt+" in "+V,"invalid "+Ke+", must be one of "+Object.keys(oe))}_e(ye.then,U,C),L.assert(ye.else,C+"&&typeof "+C+'==="object"',"invalid "+U),_e(ye.else,U+".rgb",C+".rgb"),_e(ye.else,U+".alpha",C+".alpha")}),ye.then(ne,"=",se,"=",V,"[",C,"];"),ye.else(ne,"=",V,"[",C,".rgb];",se,"=",V,"[",C,".alpha];"),z(ye),[ne,se]});case Ev:return W(function(L){return N.command(cr(L)&&L.length===4,"blend.color must be a 4d array",I.commandStr),Qr(4,function(z){return+L[z]})},function(L,z,C){return N.optional(function(){L.assert(z,L.shared.isArrayLike+"("+C+")&&"+C+".length===4","blend.color must be a 4d array")}),Qr(4,function(V){return z.def("+",C,"[",V,"]")})});case Mv:return W(function(L){return N.commandType(L,"number",j,I.commandStr),L|0},function(L,z,C){return N.optional(function(){L.assert(z,"typeof "+C+'==="number"',"invalid stencil.mask")}),z.def(C,"|0")});case ch:return W(function(L){N.commandType(L,"object",j,I.commandStr);var z=L.cmp||"keep",C=L.ref||0,V="mask"in L?L.mask:-1;return N.commandParameter(z,oa,U+".cmp",I.commandStr),N.commandType(C,"number",U+".ref",I.commandStr),N.commandType(V,"number",U+".mask",I.commandStr),[oa[z],C,V]},function(L,z,C){var V=L.constants.compareFuncs;N.optional(function(){function _e(){L.assert(z,Array.prototype.join.call(arguments,""),"invalid stencil.func")}_e(C+"&&typeof ",C,'==="object"'),_e('!("cmp" in ',C,")||(",C,".cmp in ",V,")")});var ne=z.def('"cmp" in ',C,"?",V,"[",C,".cmp]",":",Mi),se=z.def(C,".ref|0"),ye=z.def('"mask" in ',C,"?",C,".mask|0:-1");return[ne,se,ye]});case fh:case hs:return W(function(L){N.commandType(L,"object",j,I.commandStr);var z=L.fail||"keep",C=L.zfail||"keep",V=L.zpass||"keep";return N.commandParameter(z,Ni,U+".fail",I.commandStr),N.commandParameter(C,Ni,U+".zfail",I.commandStr),N.commandParameter(V,Ni,U+".zpass",I.commandStr),[U===hs?co:As,Ni[z],Ni[C],Ni[V]]},function(L,z,C){var V=L.constants.stencilOps;N.optional(function(){L.assert(z,C+"&&typeof "+C+'==="object"',"invalid "+U)});function ne(se){return N.optional(function(){L.assert(z,'!("'+se+'" in '+C+")||("+C+"."+se+" in "+V+")","invalid "+U+"."+se+", must be one of "+Object.keys(Ni))}),z.def('"',se,'" in ',C,"?",V,"[",C,".",se,"]:",Mi)}return[U===hs?co:As,ne("fail"),ne("zfail"),ne("zpass")]});case uh:return W(function(L){N.commandType(L,"object",j,I.commandStr);var z=L.factor|0,C=L.units|0;return N.commandType(z,"number",j+".factor",I.commandStr),N.commandType(C,"number",j+".units",I.commandStr),[z,C]},function(L,z,C){N.optional(function(){L.assert(z,C+"&&typeof "+C+'==="object"',"invalid "+U)});var V=z.def(C,".factor|0"),ne=z.def(C,".units|0");return[V,ne]});case bv:return W(function(L){var z=0;return L==="front"?z=As:L==="back"&&(z=co),N.command(!!z,j,I.commandStr),z},function(L,z,C){return N.optional(function(){L.assert(z,C+'==="front"||'+C+'==="back"',"invalid cull.face")}),z.def(C,'==="front"?',As,":",co)});case sh:return W(function(L){return N.command(typeof L=="number"&&L>=te.lineWidthDims[0]&&L<=te.lineWidthDims[1],"invalid line width, must be a positive number between "+te.lineWidthDims[0]+" and "+te.lineWidthDims[1],I.commandStr),L},function(L,z,C){return N.optional(function(){L.assert(z,"typeof "+C+'==="number"&&'+C+">="+te.lineWidthDims[0]+"&&"+C+"<="+te.lineWidthDims[1],"invalid line width")}),C});case ah:return W(function(L){return N.commandParameter(L,gh,j,I.commandStr),gh[L]},function(L,z,C){return N.optional(function(){L.assert(z,C+'==="cw"||'+C+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),z.def(C+'==="cw"?'+Dv+":"+mh)});case oh:return W(function(L){return N.command(cr(L)&&L.length===4,"color.mask must be length 4 array",I.commandStr),L.map(function(z){return!!z})},function(L,z,C){return N.optional(function(){L.assert(z,L.shared.isArrayLike+"("+C+")&&"+C+".length===4","invalid color.mask")}),Qr(4,function(V){return"!!"+C+"["+V+"]"})});case lh:return W(function(L){N.command(typeof L=="object"&&L,j,I.commandStr);var z="value"in L?L.value:1,C=!!L.invert;return N.command(typeof z=="number"&&z>=0&&z<=1,"sample.coverage.value must be a number between 0 and 1",I.commandStr),[z,C]},function(L,z,C){N.optional(function(){L.assert(z,C+"&&typeof "+C+'==="object"',"invalid sample.coverage")});var V=z.def('"value" in ',C,"?+",C,".value:1"),ne=z.def("!!",C,".invert");return[V,ne]})}}),ee}function Rr(T,I){var B=T.static,J=T.dynamic,ee={};return Object.keys(B).forEach(function(U){var j=B[U],W;if(typeof j=="number"||typeof j=="boolean")W=pr(function(){return j});else if(typeof j=="function"){var L=j._reglType;L==="texture2d"||L==="textureCube"?W=pr(function(z){return z.link(j)}):L==="framebuffer"||L==="framebufferCube"?(N.command(j.color.length>0,'missing color attachment for framebuffer sent to uniform "'+U+'"',I.commandStr),W=pr(function(z){return z.link(j.color[0])})):N.commandRaise('invalid data for uniform "'+U+'"',I.commandStr)}else cr(j)?W=pr(function(z){var C=z.global.def("[",Qr(j.length,function(V){return N.command(typeof j[V]=="number"||typeof j[V]=="boolean","invalid uniform "+U,z.commandStr),j[V]}),"]");return C}):N.commandRaise('invalid or missing data for uniform "'+U+'"',I.commandStr);W.value=j,ee[U]=W}),Object.keys(J).forEach(function(U){var j=J[U];ee[U]=sn(j,function(W,L){return W.invoke(L,j)})}),ee}function St(T,I){var B=T.static,J=T.dynamic,ee={};return Object.keys(B).forEach(function(U){var j=B[U],W=b.id(U),L=new Z;if(xl(j))L.state=ta,L.buffer=fe.getBuffer(fe.create(j,ia,!1,!0)),L.type=0;else{var z=fe.getBuffer(j);if(z)L.state=ta,L.buffer=z,L.type=0;else if(N.command(typeof j=="object"&&j,"invalid data for attribute "+U,I.commandStr),"constant"in j){var C=j.constant;L.buffer="null",L.state=th,typeof C=="number"?L.x=C:(N.command(cr(C)&&C.length>0&&C.length<=4,"invalid constant for attribute "+U,I.commandStr),ea.forEach(function(Ke,pt){pt<C.length&&(L[Ke]=C[pt])}))}else{xl(j.buffer)?z=fe.getBuffer(fe.create(j.buffer,ia,!1,!0)):z=fe.getBuffer(j.buffer),N.command(!!z,'missing buffer for attribute "'+U+'"',I.commandStr);var V=j.offset|0;N.command(V>=0,'invalid offset for attribute "'+U+'"',I.commandStr);var ne=j.stride|0;N.command(ne>=0&&ne<256,'invalid stride for attribute "'+U+'", must be integer betweeen [0, 255]',I.commandStr);var se=j.size|0;N.command(!("size"in j)||se>0&&se<=4,'invalid size for attribute "'+U+'", must be 1,2,3,4',I.commandStr);var ye=!!j.normalized,_e=0;"type"in j&&(N.commandParameter(j.type,to,"invalid type for attribute "+U,I.commandStr),_e=to[j.type]);var Se=j.divisor|0;"divisor"in j&&(N.command(Se===0||be,'cannot specify divisor for attribute "'+U+'", instancing not supported',I.commandStr),N.command(Se>=0,'invalid divisor for attribute "'+U+'"',I.commandStr)),N.optional(function(){var Ke=I.commandStr,pt=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(j).forEach(function(je){N.command(pt.indexOf(je)>=0,'unknown parameter "'+je+'" for attribute pointer "'+U+'" (valid parameters are '+pt+")",Ke)})}),L.buffer=z,L.state=ta,L.size=se,L.normalized=ye,L.type=_e||z.dtype,L.offset=V,L.stride=ne,L.divisor=Se}}ee[U]=pr(function(Ke,pt){var je=Ke.attribCache;if(W in je)return je[W];var ot={isStream:!1};return Object.keys(L).forEach(function(ct){ot[ct]=L[ct]}),L.buffer&&(ot.buffer=Ke.link(L.buffer),ot.type=ot.type||ot.buffer+".dtype"),je[W]=ot,ot})}),Object.keys(J).forEach(function(U){var j=J[U];function W(L,z){var C=L.invoke(z,j),V=L.shared,ne=L.constants,se=V.isBufferArgs,ye=V.buffer;N.optional(function(){L.assert(z,C+"&&(typeof "+C+'==="object"||typeof '+C+'==="function")&&('+se+"("+C+")||"+ye+".getBuffer("+C+")||"+ye+".getBuffer("+C+".buffer)||"+se+"("+C+'.buffer)||("constant" in '+C+"&&(typeof "+C+'.constant==="number"||'+V.isArrayLike+"("+C+".constant))))",'invalid dynamic attribute "'+U+'"')});var _e={isStream:z.def(!1)},Se=new Z;Se.state=ta,Object.keys(Se).forEach(function(ot){_e[ot]=z.def(""+Se[ot])});var Ke=_e.buffer,pt=_e.type;z("if(",se,"(",C,")){",_e.isStream,"=true;",Ke,"=",ye,".createStream(",ia,",",C,");",pt,"=",Ke,".dtype;","}else{",Ke,"=",ye,".getBuffer(",C,");","if(",Ke,"){",pt,"=",Ke,".dtype;",'}else if("constant" in ',C,"){",_e.state,"=",th,";","if(typeof "+C+'.constant === "number"){',_e[ea[0]],"=",C,".constant;",ea.slice(1).map(function(ot){return _e[ot]}).join("="),"=0;","}else{",ea.map(function(ot,ct){return _e[ot]+"="+C+".constant.length>"+ct+"?"+C+".constant["+ct+"]:0;"}).join(""),"}}else{","if(",se,"(",C,".buffer)){",Ke,"=",ye,".createStream(",ia,",",C,".buffer);","}else{",Ke,"=",ye,".getBuffer(",C,".buffer);","}",pt,'="type" in ',C,"?",ne.glTypes,"[",C,".type]:",Ke,".dtype;",_e.normalized,"=!!",C,".normalized;");function je(ot){z(_e[ot],"=",C,".",ot,"|0;")}return je("size"),je("offset"),je("stride"),je("divisor"),z("}}"),z.exit("if(",_e.isStream,"){",ye,".destroyStream(",Ke,");","}"),_e}ee[U]=sn(j,W)}),ee}function Er(T,I){var B=T.static,J=T.dynamic;if(vs in B){var ee=B[vs];return ee!==null&&we.getVAO(ee)===null&&(ee=we.createVAO(ee)),pr(function(j){return j.link(we.getVAO(ee))})}else if(vs in J){var U=J[vs];return sn(U,function(j,W){var L=j.invoke(W,U);return W.def(j.shared.vao+".getVAO("+L+")")})}return null}function qt(T){var I=T.static,B=T.dynamic,J={};return Object.keys(I).forEach(function(ee){var U=I[ee];J[ee]=pr(function(j,W){return typeof U=="number"||typeof U=="boolean"?""+U:j.link(U)})}),Object.keys(B).forEach(function(ee){var U=B[ee];J[ee]=sn(U,function(j,W){return j.invoke(W,U)})}),J}function vr(T,I,B,J,ee){var U=T.static,j=T.dynamic;N.optional(function(){var je=[ao,ps,_s,so,uo,dl,lo,pl,ds,vs].concat(Ce);function ot(ct){Object.keys(ct).forEach(function(Ft){N.command(je.indexOf(Ft)>=0,'unknown parameter "'+Ft+'"',ee.commandStr)})}ot(U),ot(j)});var W=lt(T,I),L=Ze(T),z=yt(T,L,ee),C=Pt(T,ee),V=_r(T,ee),ne=_t(T,ee,W);function se(je){var ot=z[je];ot&&(V[je]=ot)}se(hi),se(Be(hl));var ye=Object.keys(V).length>0,_e={framebuffer:L,draw:C,shader:ne,state:V,dirty:ye,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(_e.profile=Ct(T),_e.uniforms=Rr(B,ee),_e.drawVAO=_e.scopeVAO=Er(T),!_e.drawVAO&&ne.program&&!W&&D.angle_instanced_arrays){var Se=!0,Ke=ne.program.attributes.map(function(je){var ot=I.static[je];return Se=Se&&!!ot,ot});if(Se&&Ke.length>0){var pt=we.getVAO(we.createVAO(Ke));_e.drawVAO=new mn(null,null,null,function(je,ot){return je.link(pt)}),_e.useVAO=!0}}return W?_e.useVAO=!0:_e.attributes=St(I,ee),_e.context=qt(J),_e}function yr(T,I,B){var J=T.shared,ee=J.context,U=T.scope();Object.keys(B).forEach(function(j){I.save(ee,"."+j);var W=B[j];U(ee,".",j,"=",W.append(T,I),";")}),I(U)}function Tr(T,I,B,J){var ee=T.shared,U=ee.gl,j=ee.framebuffer,W;De&&(W=I.def(ee.extensions,".webgl_draw_buffers"));var L=T.constants,z=L.drawBuffer,C=L.backBuffer,V;B?V=B.append(T,I):V=I.def(j,".next"),J||I("if(",V,"!==",j,".cur){"),I("if(",V,"){",U,".bindFramebuffer(",zv,",",V,".framebuffer);"),De&&I(W,".drawBuffersWEBGL(",z,"[",V,".colorAttachments.length]);"),I("}else{",U,".bindFramebuffer(",zv,",null);"),De&&I(W,".drawBuffersWEBGL(",C,");"),I("}",j,".cur=",V,";"),J||I("}")}function Pr(T,I,B){var J=T.shared,ee=J.gl,U=T.current,j=T.next,W=J.current,L=J.next,z=T.cond(W,".dirty");Ce.forEach(function(C){var V=Be(C);if(!(V in B.state)){var ne,se;if(V in j){ne=j[V],se=U[V];var ye=Qr(me[V].length,function(Se){return z.def(ne,"[",Se,"]")});z(T.cond(ye.map(function(Se,Ke){return Se+"!=="+se+"["+Ke+"]"}).join("||")).then(ee,".",Ee[V],"(",ye,");",ye.map(function(Se,Ke){return se+"["+Ke+"]="+Se}).join(";"),";"))}else{ne=z.def(L,".",V);var _e=T.cond(ne,"!==",W,".",V);z(_e),V in ke?_e(T.cond(ne).then(ee,".enable(",ke[V],");").else(ee,".disable(",ke[V],");"),W,".",V,"=",ne,";"):_e(ee,".",Ee[V],"(",ne,");",W,".",V,"=",ne,";")}}}),Object.keys(B.state).length===0&&z(W,".dirty=false;"),I(z)}function zr(T,I,B,J){var ee=T.shared,U=T.current,j=ee.current,W=ee.gl;jv(Object.keys(B)).forEach(function(L){var z=B[L];if(!(J&&!J(z))){var C=z.append(T,I);if(ke[L]){var V=ke[L];Pi(z)?C?I(W,".enable(",V,");"):I(W,".disable(",V,");"):I(T.cond(C).then(W,".enable(",V,");").else(W,".disable(",V,");")),I(j,".",L,"=",C,";")}else if(cr(C)){var ne=U[L];I(W,".",Ee[L],"(",C,");",C.map(function(se,ye){return ne+"["+ye+"]="+se}).join(";"),";")}else I(W,".",Ee[L],"(",C,");",j,".",L,"=",C,";")}})}function Ar(T,I){be&&(T.instancing=I.def(T.shared.extensions,".angle_instanced_arrays"))}function dt(T,I,B,J,ee){var U=T.shared,j=T.stats,W=U.current,L=U.timer,z=B.profile;function C(){return typeof performance>"u"?"Date.now()":"performance.now()"}var V,ne;function se(je){V=I.def(),je(V,"=",C(),";"),typeof ee=="string"?je(j,".count+=",ee,";"):je(j,".count++;"),Te&&(J?(ne=I.def(),je(ne,"=",L,".getNumPendingQueries();")):je(L,".beginQuery(",j,");"))}function ye(je){je(j,".cpuTime+=",C(),"-",V,";"),Te&&(J?je(L,".pushScopeStats(",ne,",",L,".getNumPendingQueries(),",j,");"):je(L,".endQuery();"))}function _e(je){var ot=I.def(W,".profile");I(W,".profile=",je,";"),I.exit(W,".profile=",ot,";")}var Se;if(z){if(Pi(z)){z.enable?(se(I),ye(I.exit),_e("true")):_e("false");return}Se=z.append(T,I),_e(Se)}else Se=I.def(W,".profile");var Ke=T.block();se(Ke),I("if(",Se,"){",Ke,"}");var pt=T.block();ye(pt),I.exit("if(",Se,"){",pt,"}")}function Ur(T,I,B,J,ee){var U=T.shared;function j(L){switch(L){case _l:case gl:case Tl:return 2;case vl:case El:case Al:return 3;case ml:case yl:case Sl:return 4;default:return 1}}function W(L,z,C){var V=U.gl,ne=I.def(L,".location"),se=I.def(U.attributes,"[",ne,"]"),ye=C.state,_e=C.buffer,Se=[C.x,C.y,C.z,C.w],Ke=["buffer","normalized","offset","stride"];function pt(){I("if(!",se,".buffer){",V,".enableVertexAttribArray(",ne,");}");var ot=C.type,ct;if(C.size?ct=I.def(C.size,"||",z):ct=z,I("if(",se,".type!==",ot,"||",se,".size!==",ct,"||",Ke.map(function(mr){return se+"."+mr+"!=="+C[mr]}).join("||"),"){",V,".bindBuffer(",ia,",",_e,".buffer);",V,".vertexAttribPointer(",[ne,ct,ot,C.normalized,C.stride,C.offset],");",se,".type=",ot,";",se,".size=",ct,";",Ke.map(function(mr){return se+"."+mr+"="+C[mr]+";"}).join(""),"}"),be){var Ft=C.divisor;I("if(",se,".divisor!==",Ft,"){",T.instancing,".vertexAttribDivisorANGLE(",[ne,Ft],");",se,".divisor=",Ft,";}")}}function je(){I("if(",se,".buffer){",V,".disableVertexAttribArray(",ne,");",se,".buffer=null;","}if(",ea.map(function(ot,ct){return se+"."+ot+"!=="+Se[ct]}).join("||"),"){",V,".vertexAttrib4f(",ne,",",Se,");",ea.map(function(ot,ct){return se+"."+ot+"="+Se[ct]+";"}).join(""),"}")}ye===ta?pt():ye===th?je():(I("if(",ye,"===",ta,"){"),pt(),I("}else{"),je(),I("}"))}J.forEach(function(L){var z=L.name,C=B.attributes[z],V;if(C){if(!ee(C))return;V=C.append(T,I)}else{if(!ee(Xv))return;var ne=T.scopeAttrib(z);N.optional(function(){T.assert(I,ne+".state","missing attribute "+z)}),V={},Object.keys(new Z).forEach(function(se){V[se]=I.def(ne,".",se)})}W(T.link(L),j(L.info.type),V)})}function Bt(T,I,B,J,ee){for(var U=T.shared,j=U.gl,W,L=0;L<J.length;++L){var z=J[L],C=z.name,V=z.info.type,ne=B.uniforms[C],se=T.link(z),ye=se+".location",_e;if(ne){if(!ee(ne))continue;if(Pi(ne)){var Se=ne.value;if(N.command(Se!==null&&typeof Se<"u",'missing uniform "'+C+'"',T.commandStr),V===ys||V===Ts){N.command(typeof Se=="function"&&(V===ys&&(Se._reglType==="texture2d"||Se._reglType==="framebuffer")||V===Ts&&(Se._reglType==="textureCube"||Se._reglType==="framebufferCube")),"invalid texture for uniform "+C,T.commandStr);var Ke=T.link(Se._texture||Se.color[0]._texture);I(j,".uniform1i(",ye,",",Ke+".bind());"),I.exit(Ke,".unbind();")}else if(V===ms||V===gs||V===Es){N.optional(function(){N.command(cr(Se),"invalid matrix for uniform "+C,T.commandStr),N.command(V===ms&&Se.length===4||V===gs&&Se.length===9||V===Es&&Se.length===16,"invalid length for matrix uniform "+C,T.commandStr)});var pt=T.global.def("new Float32Array(["+Array.prototype.slice.call(Se)+"])"),je=2;V===gs?je=3:V===Es&&(je=4),I(j,".uniformMatrix",je,"fv(",ye,",false,",pt,");")}else{switch(V){case ph:N.commandType(Se,"number","uniform "+C,T.commandStr),W="1f";break;case _l:N.command(cr(Se)&&Se.length===2,"uniform "+C,T.commandStr),W="2f";break;case vl:N.command(cr(Se)&&Se.length===3,"uniform "+C,T.commandStr),W="3f";break;case ml:N.command(cr(Se)&&Se.length===4,"uniform "+C,T.commandStr),W="4f";break;case vh:N.commandType(Se,"boolean","uniform "+C,T.commandStr),W="1i";break;case _h:N.commandType(Se,"number","uniform "+C,T.commandStr),W="1i";break;case Tl:N.command(cr(Se)&&Se.length===2,"uniform "+C,T.commandStr),W="2i";break;case gl:N.command(cr(Se)&&Se.length===2,"uniform "+C,T.commandStr),W="2i";break;case Al:N.command(cr(Se)&&Se.length===3,"uniform "+C,T.commandStr),W="3i";break;case El:N.command(cr(Se)&&Se.length===3,"uniform "+C,T.commandStr),W="3i";break;case Sl:N.command(cr(Se)&&Se.length===4,"uniform "+C,T.commandStr),W="4i";break;case yl:N.command(cr(Se)&&Se.length===4,"uniform "+C,T.commandStr),W="4i";break}I(j,".uniform",W,"(",ye,",",cr(Se)?Array.prototype.slice.call(Se):Se,");")}continue}else _e=ne.append(T,I)}else{if(!ee(Xv))continue;_e=I.def(U.uniforms,"[",b.id(C),"]")}V===ys?I("if(",_e,"&&",_e,'._reglType==="framebuffer"){',_e,"=",_e,".color[0];","}"):V===Ts&&I("if(",_e,"&&",_e,'._reglType==="framebufferCube"){',_e,"=",_e,".color[0];","}"),N.optional(function(){function jn(di,Qv){T.assert(I,di,'bad data or missing for uniform "'+C+'". '+Qv)}function Eh(di){jn("typeof "+_e+'==="'+di+'"',"invalid type, expected "+di)}function Rn(di,Qv){jn(U.isArrayLike+"("+_e+")&&"+_e+".length==="+di,"invalid vector, should have length "+di,T.commandStr)}function Kv(di){jn("typeof "+_e+'==="function"&&'+_e+'._reglType==="texture'+(di===Fv?"2d":"Cube")+'"',"invalid texture type",T.commandStr)}switch(V){case _h:Eh("number");break;case gl:Rn(2);break;case El:Rn(3);break;case yl:Rn(4);break;case ph:Eh("number");break;case _l:Rn(2);break;case vl:Rn(3);break;case ml:Rn(4);break;case vh:Eh("boolean");break;case Tl:Rn(2);break;case Al:Rn(3);break;case Sl:Rn(4);break;case ms:Rn(4);break;case gs:Rn(9);break;case Es:Rn(16);break;case ys:Kv(Fv);break;case Ts:Kv(oR);break}});var ot=1;switch(V){case ys:case Ts:var ct=I.def(_e,"._texture");I(j,".uniform1i(",ye,",",ct,".bind());"),I.exit(ct,".unbind();");continue;case _h:case vh:W="1i";break;case gl:case Tl:W="2i",ot=2;break;case El:case Al:W="3i",ot=3;break;case yl:case Sl:W="4i",ot=4;break;case ph:W="1f";break;case _l:W="2f",ot=2;break;case vl:W="3f",ot=3;break;case ml:W="4f",ot=4;break;case ms:W="Matrix2fv";break;case gs:W="Matrix3fv";break;case Es:W="Matrix4fv";break}if(I(j,".uniform",W,"(",ye,","),W.charAt(0)==="M"){var Ft=Math.pow(V-ms+2,2),mr=T.global.def("new Float32Array(",Ft,")");I("false,(Array.isArray(",_e,")||",_e," instanceof Float32Array)?",_e,":(",Qr(Ft,function(jn){return mr+"["+jn+"]="+_e+"["+jn+"]"}),",",mr,")")}else ot>1?I(Qr(ot,function(jn){return _e+"["+jn+"]"})):I(_e);I(");")}}function it(T,I,B,J){var ee=T.shared,U=ee.gl,j=ee.draw,W=J.draw;function L(){var ct=W.elements,Ft,mr=I;return ct?((ct.contextDep&&J.contextDynamic||ct.propDep)&&(mr=B),Ft=ct.append(T,mr)):Ft=mr.def(j,".",so),Ft&&mr("if("+Ft+")"+U+".bindBuffer("+rR+","+Ft+".buffer.buffer);"),Ft}function z(){var ct=W.count,Ft,mr=I;return ct?((ct.contextDep&&J.contextDynamic||ct.propDep)&&(mr=B),Ft=ct.append(T,mr),N.optional(function(){ct.MISSING&&T.assert(I,"false","missing vertex count"),ct.DYNAMIC&&T.assert(mr,Ft+">=0","missing vertex count")})):(Ft=mr.def(j,".",lo),N.optional(function(){T.assert(mr,Ft+">=0","missing vertex count")})),Ft}var C=L();function V(ct){var Ft=W[ct];return Ft?Ft.contextDep&&J.contextDynamic||Ft.propDep?Ft.append(T,B):Ft.append(T,I):I.def(j,".",ct)}var ne=V(uo),se=V(dl),ye=z();if(typeof ye=="number"){if(ye===0)return}else B("if(",ye,"){"),B.exit("}");var _e,Se;be&&(_e=V(pl),Se=T.instancing);var Ke=C+".type",pt=W.elements&&Pi(W.elements);function je(){function ct(){B(Se,".drawElementsInstancedANGLE(",[ne,ye,Ke,se+"<<(("+Ke+"-"+hv+")>>1)",_e],");")}function Ft(){B(Se,".drawArraysInstancedANGLE(",[ne,se,ye,_e],");")}C?pt?ct():(B("if(",C,"){"),ct(),B("}else{"),Ft(),B("}")):Ft()}function ot(){function ct(){B(U+".drawElements("+[ne,ye,Ke,se+"<<(("+Ke+"-"+hv+")>>1)"]+");")}function Ft(){B(U+".drawArrays("+[ne,se,ye]+");")}C?pt?ct():(B("if(",C,"){"),ct(),B("}else{"),Ft(),B("}")):Ft()}be&&(typeof _e!="number"||_e>=0)?typeof _e=="string"?(B("if(",_e,">0){"),je(),B("}else if(",_e,"<0){"),ot(),B("}")):je():ot()}function At(T,I,B,J,ee){var U=st(),j=U.proc("body",ee);return N.optional(function(){U.commandStr=I.commandStr,U.command=U.link(I.commandStr)}),be&&(U.instancing=j.def(U.shared.extensions,".angle_instanced_arrays")),T(U,j,B,J),U.compile().body}function Nt(T,I,B,J){Ar(T,I),B.useVAO?B.drawVAO?I(T.shared.vao,".setVAO(",B.drawVAO.append(T,I),");"):I(T.shared.vao,".setVAO(",T.shared.vao,".targetVAO);"):(I(T.shared.vao,".setVAO(null);"),Ur(T,I,B,J.attributes,function(){return!0})),Bt(T,I,B,J.uniforms,function(){return!0}),it(T,I,I,B)}function fr(T,I){var B=T.proc("draw",1);Ar(T,B),yr(T,B,I.context),Tr(T,B,I.framebuffer),Pr(T,B,I),zr(T,B,I.state),dt(T,B,I,!1,!0);var J=I.shader.progVar.append(T,B);if(B(T.shared.gl,".useProgram(",J,".program);"),I.shader.program)Nt(T,B,I,I.shader.program);else{B(T.shared.vao,".setVAO(null);");var ee=T.global.def("{}"),U=B.def(J,".id"),j=B.def(ee,"[",U,"]");B(T.cond(j).then(j,".call(this,a0);").else(j,"=",ee,"[",U,"]=",T.link(function(W){return At(Nt,T,I,W,1)}),"(",J,");",j,".call(this,a0);"))}Object.keys(I.state).length>0&&B(T.shared.current,".dirty=true;")}function ri(T,I,B,J){T.batchId="a1",Ar(T,I);function ee(){return!0}Ur(T,I,B,J.attributes,ee),Bt(T,I,B,J.uniforms,ee),it(T,I,I,B)}function P(T,I,B,J){Ar(T,I);var ee=B.contextDep,U=I.def(),j="a0",W="a1",L=I.def();T.shared.props=L,T.batchId=U;var z=T.scope(),C=T.scope();I(z.entry,"for(",U,"=0;",U,"<",W,";++",U,"){",L,"=",j,"[",U,"];",C,"}",z.exit);function V(Ke){return Ke.contextDep&&ee||Ke.propDep}function ne(Ke){return!V(Ke)}if(B.needsContext&&yr(T,C,B.context),B.needsFramebuffer&&Tr(T,C,B.framebuffer),zr(T,C,B.state,V),B.profile&&V(B.profile)&&dt(T,C,B,!1,!0),J)B.useVAO?B.drawVAO?V(B.drawVAO)?C(T.shared.vao,".setVAO(",B.drawVAO.append(T,C),");"):z(T.shared.vao,".setVAO(",B.drawVAO.append(T,z),");"):z(T.shared.vao,".setVAO(",T.shared.vao,".targetVAO);"):(z(T.shared.vao,".setVAO(null);"),Ur(T,z,B,J.attributes,ne),Ur(T,C,B,J.attributes,V)),Bt(T,z,B,J.uniforms,ne),Bt(T,C,B,J.uniforms,V),it(T,z,C,B);else{var se=T.global.def("{}"),ye=B.shader.progVar.append(T,C),_e=C.def(ye,".id"),Se=C.def(se,"[",_e,"]");C(T.shared.gl,".useProgram(",ye,".program);","if(!",Se,"){",Se,"=",se,"[",_e,"]=",T.link(function(Ke){return At(ri,T,B,Ke,2)}),"(",ye,");}",Se,".call(this,a0[",U,"],",U,");")}}function ie(T,I){var B=T.proc("batch",2);T.batchId="0",Ar(T,B);var J=!1,ee=!0;Object.keys(I.context).forEach(function(se){J=J||I.context[se].propDep}),J||(yr(T,B,I.context),ee=!1);var U=I.framebuffer,j=!1;U?(U.propDep?J=j=!0:U.contextDep&&J&&(j=!0),j||Tr(T,B,U)):Tr(T,B,null),I.state.viewport&&I.state.viewport.propDep&&(J=!0);function W(se){return se.contextDep&&J||se.propDep}Pr(T,B,I),zr(T,B,I.state,function(se){return!W(se)}),(!I.profile||!W(I.profile))&&dt(T,B,I,!1,"a1"),I.contextDep=J,I.needsContext=ee,I.needsFramebuffer=j;var L=I.shader.progVar;if(L.contextDep&&J||L.propDep)P(T,B,I,null);else{var z=L.append(T,B);if(B(T.shared.gl,".useProgram(",z,".program);"),I.shader.program)P(T,B,I,I.shader.program);else{B(T.shared.vao,".setVAO(null);");var C=T.global.def("{}"),V=B.def(z,".id"),ne=B.def(C,"[",V,"]");B(T.cond(ne).then(ne,".call(this,a0,a1);").else(ne,"=",C,"[",V,"]=",T.link(function(se){return At(P,T,I,se,2)}),"(",z,");",ne,".call(this,a0,a1);"))}}Object.keys(I.state).length>0&&B(T.shared.current,".dirty=true;")}function Q(T,I){var B=T.proc("scope",3);T.batchId="a2";var J=T.shared,ee=J.current;yr(T,B,I.context),I.framebuffer&&I.framebuffer.append(T,B),jv(Object.keys(I.state)).forEach(function(j){var W=I.state[j],L=W.append(T,B);cr(L)?L.forEach(function(z,C){B.set(T.next[j],"["+C+"]",z)}):B.set(J.next,"."+j,L)}),dt(T,B,I,!0,!0),[so,dl,lo,pl,uo].forEach(function(j){var W=I.draw[j];W&&B.set(J.draw,"."+j,""+W.append(T,B))}),Object.keys(I.uniforms).forEach(function(j){B.set(J.uniforms,"["+b.id(j)+"]",I.uniforms[j].append(T,B))}),Object.keys(I.attributes).forEach(function(j){var W=I.attributes[j].append(T,B),L=T.scopeAttrib(j);Object.keys(new Z).forEach(function(z){B.set(L,"."+z,W[z])})}),I.scopeVAO&&B.set(J.vao,".targetVAO",I.scopeVAO.append(T,B));function U(j){var W=I.shader[j];W&&B.set(J.shader,"."+j,W.append(T,B))}U(ps),U(_s),Object.keys(I.state).length>0&&(B(ee,".dirty=true;"),B.exit(ee,".dirty=true;")),B("a1(",T.shared.context,",a0,",T.batchId,");")}function He(T){if(!(typeof T!="object"||cr(T))){for(var I=Object.keys(T),B=0;B<I.length;++B)if(Br.isDynamic(T[I[B]]))return!0;return!1}}function Tt(T,I,B){var J=I.static[B];if(!J||!He(J))return;var ee=T.global,U=Object.keys(J),j=!1,W=!1,L=!1,z=T.global.def("{}");U.forEach(function(V){var ne=J[V];if(Br.isDynamic(ne)){typeof ne=="function"&&(ne=J[V]=Br.unbox(ne));var se=sn(ne,null);j=j||se.thisDep,L=L||se.propDep,W=W||se.contextDep}else{switch(ee(z,".",V,"="),typeof ne){case"number":ee(ne);break;case"string":ee('"',ne,'"');break;case"object":Array.isArray(ne)&&ee("[",ne.join(),"]");break;default:ee(T.link(ne));break}ee(";")}});function C(V,ne){U.forEach(function(se){var ye=J[se];if(Br.isDynamic(ye)){var _e=V.invoke(ne,ye);ne(z,".",se,"=",_e,";")}})}I.dynamic[B]=new Br.DynamicVariable(rh,{thisDep:j,contextDep:W,propDep:L,ref:z,append:C}),delete I.static[B]}function Yt(T,I,B,J,ee){var U=st();U.stats=U.link(ee),Object.keys(I.static).forEach(function(W){Tt(U,I,W)}),tR.forEach(function(W){Tt(U,T,W)});var j=vr(T,I,B,J,U);return fr(U,j),Q(U,j),ie(U,j),U.compile()}return{next:Ve,current:me,procs:function(){var T=st(),I=T.proc("poll"),B=T.proc("refresh"),J=T.block();I(J),B(J);var ee=T.shared,U=ee.gl,j=ee.next,W=ee.current;J(W,".dirty=false;"),Tr(T,I),Tr(T,B,null,!0);var L;be&&(L=T.link(be)),D.oes_vertex_array_object&&B(T.link(D.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var z=0;z<te.maxAttributes;++z){var C=B.def(ee.attributes,"[",z,"]"),V=T.cond(C,".buffer");V.then(U,".enableVertexAttribArray(",z,");",U,".bindBuffer(",ia,",",C,".buffer.buffer);",U,".vertexAttribPointer(",z,",",C,".size,",C,".type,",C,".normalized,",C,".stride,",C,".offset);").else(U,".disableVertexAttribArray(",z,");",U,".vertexAttrib4f(",z,",",C,".x,",C,".y,",C,".z,",C,".w);",C,".buffer=null;"),B(V),be&&B(L,".vertexAttribDivisorANGLE(",z,",",C,".divisor);")}return B(T.shared.vao,".currentVAO=null;",T.shared.vao,".setVAO(",T.shared.vao,".targetVAO);"),Object.keys(ke).forEach(function(ne){var se=ke[ne],ye=J.def(j,".",ne),_e=T.block();_e("if(",ye,"){",U,".enable(",se,")}else{",U,".disable(",se,")}",W,".",ne,"=",ye,";"),B(_e),I("if(",ye,"!==",W,".",ne,"){",_e,"}")}),Object.keys(Ee).forEach(function(ne){var se=Ee[ne],ye=me[ne],_e,Se,Ke=T.block();if(Ke(U,".",se,"("),cr(ye)){var pt=ye.length;_e=T.global.def(j,".",ne),Se=T.global.def(W,".",ne),Ke(Qr(pt,function(je){return _e+"["+je+"]"}),");",Qr(pt,function(je){return Se+"["+je+"]="+_e+"["+je+"];"}).join("")),I("if(",Qr(pt,function(je){return _e+"["+je+"]!=="+Se+"["+je+"]"}).join("||"),"){",Ke,"}")}else _e=J.def(j,".",ne),Se=J.def(W,".",ne),Ke(_e,");",W,".",ne,"=",_e,";"),I("if(",_e,"!==",Se,"){",Ke,"}");B(Ke)}),T.compile()}(),compile:Yt}}function TR(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var AR=34918,SR=34919,Wv=35007,xR=function(_,b){if(!b.ext_disjoint_timer_query)return null;var D=[];function te(){return D.pop()||b.ext_disjoint_timer_query.createQueryEXT()}function fe(be){D.push(be)}var re=[];function ae(be){var De=te();b.ext_disjoint_timer_query.beginQueryEXT(Wv,De),re.push(De),Te(re.length-1,re.length,be)}function xe(){b.ext_disjoint_timer_query.endQueryEXT(Wv)}function Re(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var we=[];function Ie(){return we.pop()||new Re}function Me(be){we.push(be)}var Fe=[];function Te(be,De,me){var Ve=Ie();Ve.startQueryIndex=be,Ve.endQueryIndex=De,Ve.sum=0,Ve.stats=me,Fe.push(Ve)}var Ne=[],Z=[];function oe(){var be,De,me=re.length;if(me!==0){Z.length=Math.max(Z.length,me+1),Ne.length=Math.max(Ne.length,me+1),Ne[0]=0,Z[0]=0;var Ve=0;for(be=0,De=0;De<re.length;++De){var Ce=re[De];b.ext_disjoint_timer_query.getQueryObjectEXT(Ce,SR)?(Ve+=b.ext_disjoint_timer_query.getQueryObjectEXT(Ce,AR),fe(Ce)):re[be++]=Ce,Ne[De+1]=Ve,Z[De+1]=be}for(re.length=be,be=0,De=0;De<Fe.length;++De){var ke=Fe[De],Ee=ke.startQueryIndex,Be=ke.endQueryIndex;ke.sum+=Ne[Be]-Ne[Ee];var tt=Z[Ee],at=Z[Be];at===tt?(ke.stats.gpuTime+=ke.sum/1e6,Me(ke)):(ke.startQueryIndex=tt,ke.endQueryIndex=at,Fe[be++]=ke)}Fe.length=be}}return{beginQuery:ae,endQuery:xe,pushScopeStats:Te,update:oe,getNumPendingQueries:function(){return re.length},clear:function(){D.push.apply(D,re);for(var be=0;be<D.length;be++)b.ext_disjoint_timer_query.deleteQueryEXT(D[be]);re.length=0,D.length=0},restore:function(){re.length=0,D.length=0}}},bR=16384,RR=256,CR=1024,OR=34962,Gv="webglcontextlost",Yv="webglcontextrestored",Zv=1,IR=2,MR=3;function qv(_,b){for(var D=0;D<_.length;++D)if(_[D]===b)return D;return-1}function NR(_){var b=ts(_);if(!b)return null;var D=b.gl,te=D.getContextAttributes(),fe=D.isContextLost(),re=yf(D,b);if(!re)return null;var ae=Qa(),xe=TR(),Re=re.extensions,we=xR(D,Re),Ie=bi(),Me=D.drawingBufferWidth,Fe=D.drawingBufferHeight,Te={tick:0,time:0,viewportWidth:Me,viewportHeight:Fe,framebufferWidth:Me,framebufferHeight:Fe,drawingBufferWidth:Me,drawingBufferHeight:Fe,pixelRatio:b.pixelRatio},Ne={},Z={elements:null,primitive:4,count:-1,offset:0,instances:-1},oe=Nf(D,Re),be=Nx(D,xe,b,me),De=jb(D,Re,oe,xe,be);function me(it){return De.destroyBuffer(it)}var Ve=jx(D,Re,be,xe),Ce=Yb(D,ae,xe,b),ke=Tb(D,Re,oe,function(){tt.procs.poll()},Te,xe,b),Ee=Ab(D,Re,oe,xe,b),Be=Vb(D,Re,oe,ke,Ee,xe),tt=yR(D,ae,Re,oe,be,Ve,ke,Be,Ne,De,Ce,Z,Te,we,b),at=Kb(D,Be,tt.procs.poll,Te,te,Re,oe),Ue=tt.next,Oe=D.canvas,pe=[],st=[],Ct=[],Ze=[b.onDestroy],yt=null;function lt(){if(pe.length===0){we&&we.update(),yt=null;return}yt=Ki.next(lt),zr();for(var it=pe.length-1;it>=0;--it){var At=pe[it];At&&At(Te,null,0)}D.flush(),we&&we.update()}function _t(){!yt&&pe.length>0&&(yt=Ki.next(lt))}function Pt(){yt&&(Ki.cancel(lt),yt=null)}function _r(it){it.preventDefault(),fe=!0,Pt(),st.forEach(function(At){At()})}function Rr(it){D.getError(),fe=!1,re.restore(),Ce.restore(),be.restore(),ke.restore(),Ee.restore(),Be.restore(),De.restore(),we&&we.restore(),tt.procs.refresh(),_t(),Ct.forEach(function(At){At()})}Oe&&(Oe.addEventListener(Gv,_r,!1),Oe.addEventListener(Yv,Rr,!1));function St(){pe.length=0,Pt(),Oe&&(Oe.removeEventListener(Gv,_r),Oe.removeEventListener(Yv,Rr)),Ce.clear(),Be.clear(),Ee.clear(),ke.clear(),Ve.clear(),be.clear(),De.clear(),we&&we.clear(),Ze.forEach(function(it){it()})}function Er(it){N(!!it,"invalid args to regl({...})"),N.type(it,"object","invalid args to regl({...})");function At(ee){var U=n({},ee);delete U.uniforms,delete U.attributes,delete U.context,delete U.vao,"stencil"in U&&U.stencil.op&&(U.stencil.opBack=U.stencil.opFront=U.stencil.op,delete U.stencil.op);function j(W){if(W in U){var L=U[W];delete U[W],Object.keys(L).forEach(function(z){U[W+"."+z]=L[z]})}}return j("blend"),j("depth"),j("cull"),j("stencil"),j("polygonOffset"),j("scissor"),j("sample"),"vao"in ee&&(U.vao=ee.vao),U}function Nt(ee){var U={},j={};return Object.keys(ee).forEach(function(W){var L=ee[W];Br.isDynamic(L)?j[W]=Br.unbox(L,W):U[W]=L}),{dynamic:j,static:U}}var fr=Nt(it.context||{}),ri=Nt(it.uniforms||{}),P=Nt(it.attributes||{}),ie=Nt(At(it)),Q={gpuTime:0,cpuTime:0,count:0},He=tt.compile(ie,P,ri,fr,Q),Tt=He.draw,Yt=He.batch,T=He.scope,I=[];function B(ee){for(;I.length<ee;)I.push(null);return I}function J(ee,U){var j;if(fe&&N.raise("context lost"),typeof ee=="function")return T.call(this,null,ee,0);if(typeof U=="function")if(typeof ee=="number")for(j=0;j<ee;++j)T.call(this,null,U,j);else if(Array.isArray(ee))for(j=0;j<ee.length;++j)T.call(this,ee[j],U,j);else return T.call(this,ee,U,0);else if(typeof ee=="number"){if(ee>0)return Yt.call(this,B(ee|0),ee|0)}else if(Array.isArray(ee)){if(ee.length)return Yt.call(this,ee,ee.length)}else return Tt.call(this,ee)}return n(J,{stats:Q})}var qt=Be.setFBO=Er({framebuffer:Br.define.call(null,Zv,"framebuffer")});function vr(it,At){var Nt=0;tt.procs.poll();var fr=At.color;fr&&(D.clearColor(+fr[0]||0,+fr[1]||0,+fr[2]||0,+fr[3]||0),Nt|=bR),"depth"in At&&(D.clearDepth(+At.depth),Nt|=RR),"stencil"in At&&(D.clearStencil(At.stencil|0),Nt|=CR),N(!!Nt,"called regl.clear with no buffer specified"),D.clear(Nt)}function yr(it){if(N(typeof it=="object"&&it,"regl.clear() takes an object as input"),"framebuffer"in it)if(it.framebuffer&&it.framebuffer_reglType==="framebufferCube")for(var At=0;At<6;++At)qt(n({framebuffer:it.framebuffer.faces[At]},it),vr);else qt(it,vr);else vr(null,it)}function Tr(it){N.type(it,"function","regl.frame() callback must be a function"),pe.push(it);function At(){var Nt=qv(pe,it);N(Nt>=0,"cannot cancel a frame twice");function fr(){var ri=qv(pe,fr);pe[ri]=pe[pe.length-1],pe.length-=1,pe.length<=0&&Pt()}pe[Nt]=fr}return _t(),{cancel:At}}function Pr(){var it=Ue.viewport,At=Ue.scissor_box;it[0]=it[1]=At[0]=At[1]=0,Te.viewportWidth=Te.framebufferWidth=Te.drawingBufferWidth=it[2]=At[2]=D.drawingBufferWidth,Te.viewportHeight=Te.framebufferHeight=Te.drawingBufferHeight=it[3]=At[3]=D.drawingBufferHeight}function zr(){Te.tick+=1,Te.time=dt(),Pr(),tt.procs.poll()}function Ar(){Pr(),tt.procs.refresh(),we&&we.update()}function dt(){return(bi()-Ie)/1e3}Ar();function Ur(it,At){N.type(At,"function","listener callback must be a function");var Nt;switch(it){case"frame":return Tr(At);case"lost":Nt=st;break;case"restore":Nt=Ct;break;case"destroy":Nt=Ze;break;default:N.raise("invalid event, must be one of frame,lost,restore,destroy")}return Nt.push(At),{cancel:function(){for(var fr=0;fr<Nt.length;++fr)if(Nt[fr]===At){Nt[fr]=Nt[Nt.length-1],Nt.pop();return}}}}var Bt=n(Er,{clear:yr,prop:Br.define.bind(null,Zv),context:Br.define.bind(null,IR),this:Br.define.bind(null,MR),draw:Er({}),buffer:function(it){return be.create(it,OR,!1,!1)},elements:function(it){return Ve.create(it,!1)},texture:ke.create2D,cube:ke.createCube,renderbuffer:Ee.create,framebuffer:Be.create,framebufferCube:Be.createCube,vao:De.createVAO,attributes:te,frame:Tr,on:Ur,limits:oe,hasExtension:function(it){return oe.extensions.indexOf(it.toLowerCase())>=0},read:at,destroy:St,_gl:D,_refresh:Ar,poll:function(){zr(),we&&we.update()},now:dt,stats:xe});return b.onDone(null,Bt),Bt}return NR})})(Ex);var KQ=Ex.exports;const QQ=Ht(KQ);var JQ=class{constructor(e,t){const{buffer:r,offset:n,stride:i,normalized:o,size:a,divisor:s}=t;this.buffer=r,this.attribute={buffer:r.get(),offset:n||0,stride:i||0,normalized:o||!1,divisor:s||0},a&&(this.attribute.size=a)}get(){return this.attribute}updateBuffer(e){this.buffer.subData(e)}destroy(){this.buffer.destroy()}},eJ={[m.POINTS]:"points",[m.LINES]:"lines",[m.LINE_LOOP]:"line loop",[m.LINE_STRIP]:"line strip",[m.TRIANGLES]:"triangles",[m.TRIANGLE_FAN]:"triangle fan",[m.TRIANGLE_STRIP]:"triangle strip"},yx={[m.STATIC_DRAW]:"static",[m.DYNAMIC_DRAW]:"dynamic",[m.STREAM_DRAW]:"stream"},l_={[m.BYTE]:"int8",[m.INT]:"int32",[m.UNSIGNED_BYTE]:"uint8",[m.UNSIGNED_SHORT]:"uint16",[m.UNSIGNED_INT]:"uint32",[m.FLOAT]:"float"},tJ={[m.ALPHA]:"alpha",[m.LUMINANCE]:"luminance",[m.LUMINANCE_ALPHA]:"luminance alpha",[m.RGB]:"rgb",[m.RGBA]:"rgba",[m.RGBA4]:"rgba4",[m.RGB5_A1]:"rgb5 a1",[m.RGB565]:"rgb565",[m.DEPTH_COMPONENT]:"depth",[m.DEPTH_STENCIL]:"depth stencil"},rJ={[m.DONT_CARE]:"dont care",[m.NICEST]:"nice",[m.FASTEST]:"fast"},ry={[m.NEAREST]:"nearest",[m.LINEAR]:"linear",[m.LINEAR_MIPMAP_LINEAR]:"mipmap",[m.NEAREST_MIPMAP_LINEAR]:"nearest mipmap linear",[m.LINEAR_MIPMAP_NEAREST]:"linear mipmap nearest",[m.NEAREST_MIPMAP_NEAREST]:"nearest mipmap nearest"},ny={[m.REPEAT]:"repeat",[m.CLAMP_TO_EDGE]:"clamp",[m.MIRRORED_REPEAT]:"mirror"},nJ={[m.NONE]:"none",[m.BROWSER_DEFAULT_WEBGL]:"browser"},iJ={[m.NEVER]:"never",[m.ALWAYS]:"always",[m.LESS]:"less",[m.LEQUAL]:"lequal",[m.GREATER]:"greater",[m.GEQUAL]:"gequal",[m.EQUAL]:"equal",[m.NOTEQUAL]:"notequal"},iy={[m.FUNC_ADD]:"add",[m.MIN_EXT]:"min",[m.MAX_EXT]:"max",[m.FUNC_SUBTRACT]:"subtract",[m.FUNC_REVERSE_SUBTRACT]:"reverse subtract"},Wl={[m.ZERO]:"zero",[m.ONE]:"one",[m.SRC_COLOR]:"src color",[m.ONE_MINUS_SRC_COLOR]:"one minus src color",[m.SRC_ALPHA]:"src alpha",[m.ONE_MINUS_SRC_ALPHA]:"one minus src alpha",[m.DST_COLOR]:"dst color",[m.ONE_MINUS_DST_COLOR]:"one minus dst color",[m.DST_ALPHA]:"dst alpha",[m.ONE_MINUS_DST_ALPHA]:"one minus dst alpha",[m.CONSTANT_COLOR]:"constant color",[m.ONE_MINUS_CONSTANT_COLOR]:"one minus constant color",[m.CONSTANT_ALPHA]:"constant alpha",[m.ONE_MINUS_CONSTANT_ALPHA]:"one minus constant alpha",[m.SRC_ALPHA_SATURATE]:"src alpha saturate"},oJ={[m.NEVER]:"never",[m.ALWAYS]:"always",[m.LESS]:"less",[m.LEQUAL]:"lequal",[m.GREATER]:"greater",[m.GEQUAL]:"gequal",[m.EQUAL]:"equal",[m.NOTEQUAL]:"notequal"},_a={[m.ZERO]:"zero",[m.KEEP]:"keep",[m.REPLACE]:"replace",[m.INVERT]:"invert",[m.INCR]:"increment",[m.DECR]:"decrement",[m.INCR_WRAP]:"increment wrap",[m.DECR_WRAP]:"decrement wrap"},aJ={[m.FRONT]:"front",[m.BACK]:"back"},sJ=class{constructor(e,t){this.isDestroyed=!1;const{data:r,usage:n,type:i}=t;this.buffer=e.buffer({data:r,usage:yx[n||m.STATIC_DRAW],type:l_[i||m.UNSIGNED_BYTE]})}get(){return this.buffer}destroy(){this.isDestroyed||this.buffer.destroy(),this.isDestroyed=!0}subData({data:e,offset:t}){this.buffer.subdata(e,t)}},uJ=class{constructor(e,t){const{data:r,usage:n,type:i,count:o}=t;this.elements=e.elements({data:r,usage:yx[n||m.STATIC_DRAW],type:l_[i||m.UNSIGNED_BYTE],count:o})}get(){return this.elements}subData({data:e}){this.elements.subdata(e)}destroy(){}},lJ=class{constructor(e,t){const{width:r,height:n,color:i,colors:o}=t,a={width:r,height:n};Array.isArray(o)&&(a.colors=o.map(s=>s.get())),i&&typeof i!="boolean"&&(a.color=i.get()),this.framebuffer=e.framebuffer(a)}get(){return this.framebuffer}destroy(){this.framebuffer.destroy()}resize({width:e,height:t}){this.framebuffer.resize(e,t)}},cJ=Object.defineProperty,fJ=Object.defineProperties,hJ=Object.getOwnPropertyDescriptors,oy=Object.getOwnPropertySymbols,dJ=Object.prototype.hasOwnProperty,pJ=Object.prototype.propertyIsEnumerable,ay=(e,t,r)=>t in e?cJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ws=(e,t)=>{for(var r in t||(t={}))dJ.call(t,r)&&ay(e,r,t[r]);if(oy)for(var r of oy(t))pJ.call(t,r)&&ay(e,r,t[r]);return e},_J=(e,t)=>fJ(e,hJ(t)),{isPlainObject:vJ,isTypedArray:mJ}=Sr,gJ=class{constructor(e,t){this.destroyed=!1,this.uniforms={},this.reGl=e;const{vs:r,fs:n,attributes:i,uniforms:o,primitive:a,count:s,elements:u,depth:l,cull:f,instances:c}=t,h={platformString:"WebGL1",glslVersion:"#version 100",explicitBindingLocations:!1,separateSamplerTextures:!1,viewportOrigin:Zn.LOWER_LEFT,clipSpaceNearZ:Ua.NEGATIVE_ONE,supportMRT:!1},d={};this.options=t,o&&(this.uniforms=this.extractUniforms(o),Object.keys(o).forEach(S=>{d[S]=e.prop(S)}));const p={};Object.keys(i).forEach(S=>{p[S]=i[S].get()});const v=Qm(Va(h,"frag",n,null,!1)),g=Qm(Va(h,"vert",r,null,!1)),y={attributes:p,frag:v,uniforms:d,vert:g,colorMask:e.prop("colorMask"),lineWidth:1,blend:{enable:e.prop("blend.enable"),func:e.prop("blend.func"),equation:e.prop("blend.equation"),color:e.prop("blend.color")},stencil:{enable:e.prop("stencil.enable"),mask:e.prop("stencil.mask"),func:e.prop("stencil.func"),opFront:e.prop("stencil.opFront"),opBack:e.prop("stencil.opBack")},primitive:eJ[a===void 0?m.TRIANGLES:a]};c&&(y.instances=c),s?y.count=s:u&&(y.elements=u.get()),this.initDepthDrawParams({depth:l},y),this.initCullDrawParams({cull:f},y),this.drawCommand=e(y),this.drawParams=y}updateAttributesAndElements(e,t){const r={};Object.keys(e).forEach(n=>{r[n]=e[n].get()}),this.drawParams.attributes=r,this.drawParams.elements=t.get(),this.drawCommand=this.reGl(this.drawParams)}updateAttributes(e){const t={};Object.keys(e).forEach(r=>{t[r]=e[r].get()}),this.drawParams.attributes=t,this.drawCommand=this.reGl(this.drawParams)}addUniforms(e){this.uniforms=Ws(Ws({},this.uniforms),this.extractUniforms(e))}draw(e,t){if(this.drawParams.attributes&&Object.keys(this.drawParams.attributes).length===0)return;const r=Ws(Ws({},this.uniforms),this.extractUniforms(e.uniforms||{})),n={};Object.keys(r).forEach(i=>{const o=typeof r[i];o==="boolean"||o==="number"||Array.isArray(r[i])||r[i].BYTES_PER_ELEMENT?n[i]=r[i]:n[i]=r[i].get()}),n.blend=t?this.getBlendDrawParams({blend:{enable:!1}}):this.getBlendDrawParams(e),n.stencil=this.getStencilDrawParams(e),n.colorMask=this.getColorMaskDrawParams(e,t),this.drawCommand(n)}destroy(){var e,t;(t=(e=this.drawParams)==null?void 0:e.elements)==null||t.destroy(),this.options.attributes&&Object.values(this.options.attributes).forEach(r=>{r==null||r.destroy()}),this.destroyed=!0}initDepthDrawParams({depth:e},t){e&&(t.depth={enable:e.enable===void 0?!0:!!e.enable,mask:e.mask===void 0?!0:!!e.mask,func:iJ[e.func||m.LESS],range:e.range||[0,1]})}getBlendDrawParams({blend:e}){const{enable:t,func:r,equation:n,color:i=[0,0,0,0]}=e||{};return{enable:!!t,func:{srcRGB:Wl[r&&r.srcRGB||m.SRC_ALPHA],srcAlpha:Wl[r&&r.srcAlpha||m.SRC_ALPHA],dstRGB:Wl[r&&r.dstRGB||m.ONE_MINUS_SRC_ALPHA],dstAlpha:Wl[r&&r.dstAlpha||m.ONE_MINUS_SRC_ALPHA]},equation:{rgb:iy[n&&n.rgb||m.FUNC_ADD],alpha:iy[n&&n.alpha||m.FUNC_ADD]},color:i}}getStencilDrawParams({stencil:e}){const{enable:t,mask:r=-1,func:n={cmp:m.ALWAYS,ref:0,mask:-1},opFront:i={fail:m.KEEP,zfail:m.KEEP,zpass:m.KEEP},opBack:o={fail:m.KEEP,zfail:m.KEEP,zpass:m.KEEP}}=e||{};return{enable:!!t,mask:r,func:_J(Ws({},n),{cmp:oJ[n.cmp]}),opFront:{fail:_a[i.fail],zfail:_a[i.zfail],zpass:_a[i.zpass]},opBack:{fail:_a[o.fail],zfail:_a[o.zfail],zpass:_a[o.zpass]}}}getColorMaskDrawParams({stencil:e},t){return e!=null&&e.enable&&e.opFront&&!t?[!1,!1,!1,!1]:[!0,!0,!0,!0]}initCullDrawParams({cull:e},t){if(e){const{enable:r,face:n=m.BACK}=e;t.cull={enable:!!r,face:aJ[n]}}}extractUniforms(e){const t={};return Object.keys(e).forEach(r=>{this.extractUniformsRecursively(r,e[r],t,"")}),t}extractUniformsRecursively(e,t,r,n){if(t===null||typeof t=="number"||typeof t=="boolean"||Array.isArray(t)&&typeof t[0]=="number"||mJ(t)||t===""||"resize"in t){r[`${n&&n+"."}${e}`]=t;return}vJ(t)&&Object.keys(t).forEach(i=>{this.extractUniformsRecursively(i,t[i],r,`${n&&n+"."}${e}`)}),Array.isArray(t)&&t.forEach((i,o)=>{Object.keys(i).forEach(a=>{this.extractUniformsRecursively(a,i[a],r,`${n&&n+"."}${e}[${o}]`)})})}},EJ=class{constructor(e,t){this.isDestroy=!1;const{data:r,type:n=m.UNSIGNED_BYTE,width:i,height:o,flipY:a=!1,format:s=m.RGBA,mipmap:u=!1,wrapS:l=m.CLAMP_TO_EDGE,wrapT:f=m.CLAMP_TO_EDGE,aniso:c=0,alignment:h=1,premultiplyAlpha:d=!1,mag:p=m.NEAREST,min:v=m.NEAREST,colorSpace:g=m.BROWSER_DEFAULT_WEBGL,x:y=0,y:S=0,copy:R=!1}=t;this.width=i,this.height=o;const x={width:i,height:o,type:l_[n],format:tJ[s],wrapS:ny[l],wrapT:ny[f],mag:ry[p],min:ry[v],alignment:h,flipY:a,colorSpace:nJ[g],premultiplyAlpha:d,aniso:c,x:y,y:S,copy:R};r&&(x.data=r),typeof u=="number"?x.mipmap=rJ[u]:typeof u=="boolean"&&(x.mipmap=u),this.texture=e.texture(x)}get(){return this.texture}update(e={}){this.texture(e)}bind(){this.texture._texture.bind()}resize({width:e,height:t}){this.texture.resize(e,t),this.width=e,this.height=t}getSize(){return[this.width,this.height]}destroy(){var e;this.isDestroy||(e=this.texture)==null||e.destroy(),this.isDestroy=!0}},od=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),yJ=class{constructor(){this.uniformBuffers=[],this.queryVerdorInfo=()=>"WebGL1",this.createModel=e=>new gJ(this.gl,e),this.createAttribute=e=>new JQ(this.gl,e),this.createBuffer=e=>new sJ(this.gl,e),this.createElements=e=>new uJ(this.gl,e),this.createTexture2D=e=>new EJ(this.gl,e),this.createFramebuffer=e=>new lJ(this.gl,e),this.useFramebuffer=(e,t)=>{this.gl({framebuffer:e?e.get():null})(t)},this.useFramebufferAsync=(e,t)=>od(this,null,function*(){this.gl({framebuffer:e?e.get():null})(t)}),this.clear=e=>{var t;const{color:r,depth:n,stencil:i,framebuffer:o=null}=e,a={color:r,depth:n,stencil:i};a.framebuffer=o===null?o:o.get(),(t=this.gl)==null||t.clear(a)},this.viewport=({x:e,y:t,width:r,height:n})=>{this.gl._gl.viewport(e,t,r,n),this.width=r,this.height=n,this.gl._refresh()},this.readPixels=e=>{const{framebuffer:t,x:r,y:n,width:i,height:o}=e,a={x:r,y:n,width:i,height:o};return t&&(a.framebuffer=t.get()),this.gl.read(a)},this.readPixelsAsync=e=>od(this,null,function*(){return this.readPixels(e)}),this.getViewportSize=()=>({width:this.gl._gl.drawingBufferWidth,height:this.gl._gl.drawingBufferHeight}),this.getContainer=()=>{var e;return(e=this.canvas)==null?void 0:e.parentElement},this.getCanvas=()=>this.canvas,this.getGLContext=()=>this.gl._gl,this.destroy=()=>{var e,t,r;this.canvas=null,(r=(t=(e=this.gl)==null?void 0:e._gl)==null?void 0:t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),this.gl.destroy(),this.gl=null}}init(e,t,r){return od(this,null,function*(){this.canvas=e,r?this.gl=r:this.gl=yield new Promise((n,i)=>{QQ({canvas:this.canvas,attributes:{alpha:!0,antialias:t.antialias,premultipliedAlpha:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,stencil:t.stencil},extensions:["OES_element_index_uint","OES_standard_derivatives","ANGLE_instanced_arrays"],optionalExtensions:["oes_texture_float_linear","OES_texture_float","EXT_texture_filter_anisotropic","EXT_blend_minmax","WEBGL_depth_texture","WEBGL_lose_context"],profile:!0,onDone:(o,a)=>{(o||!a)&&i(o),n(a)}})}),this.extensionObject={OES_texture_float:this.testExtension("OES_texture_float")}})}getPointSizeRange(){return this.gl._gl.getParameter(this.gl._gl.ALIASED_POINT_SIZE_RANGE)}testExtension(e){return!!this.getGLContext().getExtension(e)}setState(){this.gl({cull:{enable:!1,face:"back"},viewport:{x:0,y:0,height:this.width,width:this.height},blend:{enable:!0,equation:"add"},framebuffer:null}),this.gl._refresh()}setBaseState(){this.gl({cull:{enable:!1,face:"back"},viewport:{x:0,y:0,height:this.width,width:this.height},blend:{enable:!1,equation:"add"},framebuffer:null}),this.gl._refresh()}setCustomLayerDefaults(){const e=this.getGLContext();e.disable(e.CULL_FACE)}setDirty(e){this.isDirty=e}getDirty(){return this.isDirty}beginFrame(){}endFrame(){}},ad=["selectstart","selecting","selectend"],TJ=class extends Bn.EventEmitter{constructor(e,t={}){super(),this.isEnable=!1,this.onDragStart=r=>{this.box.style.display="block",this.startEvent=this.endEvent=r,this.syncBoxBound(),this.emit("selectstart",this.getLngLatBox(),this.startEvent,this.endEvent)},this.onDragging=r=>{this.endEvent=r,this.syncBoxBound(),this.emit("selecting",this.getLngLatBox(),this.startEvent,this.endEvent)},this.onDragEnd=r=>{this.endEvent=r,this.box.style.display="none",this.emit("selectend",this.getLngLatBox(),this.startEvent,this.endEvent)},this.scene=e,this.options=t}get container(){return this.scene.getMapService().getMarkerContainer()}enable(){if(this.isEnable)return;const{className:e}=this.options;if(this.scene.setMapStatus({dragEnable:!1}),this.container.style.cursor="crosshair",!this.box){const t=yn("div",void 0,this.container);t.classList.add("l7-select-box"),e&&t.classList.add(e),t.style.display="none",this.box=t}this.scene.on("dragstart",this.onDragStart),this.scene.on("dragging",this.onDragging),this.scene.on("dragend",this.onDragEnd),this.isEnable=!0}disable(){this.isEnable&&(this.scene.setMapStatus({dragEnable:!0}),this.container.style.cursor="auto",this.scene.off("dragstart",this.onDragStart),this.scene.off("dragging",this.onDragging),this.scene.off("dragend",this.onDragEnd),this.isEnable=!1)}syncBoxBound(){const{x:e,y:t}=this.startEvent,{x:r,y:n}=this.endEvent,i=Math.min(e,r),o=Math.min(t,n),a=Math.abs(e-r),s=Math.abs(t-n);this.box.style.top=`${o}px`,this.box.style.left=`${i}px`,this.box.style.width=`${a}px`,this.box.style.height=`${s}px`}getLngLatBox(){const{lngLat:{lng:e,lat:t}}=this.startEvent,{lngLat:{lng:r,lat:n}}=this.endEvent;return uU([[e,t],[r,n]])}},AJ=Object.defineProperty,SJ=Object.defineProperties,xJ=Object.getOwnPropertyDescriptors,sy=Object.getOwnPropertySymbols,bJ=Object.prototype.hasOwnProperty,RJ=Object.prototype.propertyIsEnumerable,uy=(e,t,r)=>t in e?AJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,CJ=(e,t)=>{for(var r in t||(t={}))bJ.call(t,r)&&uy(e,r,t[r]);if(sy)for(var r of sy(t))RJ.call(t,r)&&uy(e,r,t[r]);return e},OJ=(e,t)=>SJ(e,xJ(t)),Gs=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),IJ=class{constructor(e){const{id:t,map:r,renderer:n="device"}=e,i=Wz();this.container=i,r.setContainer(i,t),n==="regl"?i.rendererService=new yJ:i.rendererService=new qQ,this.sceneService=i.sceneService,this.mapService=i.mapService,this.iconService=i.iconService,this.fontService=i.fontService,this.controlService=i.controlService,this.layerService=i.layerService,this.debugService=i.debugService,this.debugService.setEnable(e.debug),this.markerService=i.markerService,this.interactionService=i.interactionService,this.popupService=i.popupService,this.boxSelect=new TJ(this,{}),this.initComponent(t),this.sceneService.init(e),this.initControl()}get map(){return this.mapService.map}get loaded(){return this.sceneService.loaded}getServiceContainer(){return this.container}getSize(){return this.mapService.getSize()}getMinZoom(){return this.mapService.getMinZoom()}getMaxZoom(){return this.mapService.getMaxZoom()}getType(){return this.mapService.getType()}getMapContainer(){return this.mapService.getMapContainer()}getMapCanvasContainer(){return this.mapService.getMapCanvasContainer()}getMapService(){return this.mapService}getDebugService(){return this.debugService}exportPng(e){return Gs(this,null,function*(){return this.sceneService.exportPng(e)})}exportMap(e){return Gs(this,null,function*(){return this.sceneService.exportPng(e)})}registerRenderService(e){this.sceneService.loaded?new e(this).init():this.on("loaded",()=>{new e(this).init()})}setBgColor(e){this.mapService.setBgColor(e)}addLayer(e){this.loaded?this.preAddLayer(e):this.once("loaded",()=>{this.preAddLayer(e)})}preAddLayer(e){const t=su(this.container);if(e.setContainer(t),this.sceneService.addLayer(e),e.inited){this.initTileLayer(e);const r=this.initMask(e);this.addMask(r,e.id)}else e.on("inited",()=>{this.initTileLayer(e);const r=this.initMask(e);this.addMask(r,e.id)})}initMask(e){const{mask:t,maskfence:r,maskColor:n="#000",maskOpacity:i=0}=e.getLayerConfig();return!t||!r?void 0:new YS().source(r).shape("fill").style({color:n,opacity:i})}addMask(e,t){if(!e)return;const r=this.getLayer(t);if(r){const n=su(this.container);e.setContainer(n),r.addMaskLayer(e),this.sceneService.addMask(e)}else console.warn("parent layer not find!")}getPickedLayer(){return this.layerService.pickedLayerId}getLayers(){return this.layerService.getLayers()}getLayer(e){return this.layerService.getLayer(e)}getLayerByName(e){return this.layerService.getLayerByName(e)}removeLayer(e,t){return Gs(this,null,function*(){yield this.layerService.remove(e,t)})}removeAllLayer(){return Gs(this,null,function*(){yield this.layerService.removeAllLayers()})}render(){this.sceneService.render()}setEnableRender(e){this.layerService.setEnableRender(e)}addIconFont(e,t){this.fontService.addIconFont(e,t)}addIconFonts(e){e.forEach(([t,r])=>{this.fontService.addIconFont(t,r)})}addFontFace(e,t){this.fontService.once("fontloaded",r=>{this.emit("fontloaded",r)}),this.fontService.addFontFace(e,t)}addImage(e,t){return Gs(this,null,function*(){yield this.iconService.addImage(e,t)})}hasImage(e){return this.iconService.hasImage(e)}removeImage(e){this.iconService.removeImage(e)}addIconFontGlyphs(e,t){this.fontService.addIconGlyphs(t)}addControl(e){this.controlService.addControl(e,this.container)}removeControl(e){this.controlService.removeControl(e)}getControlByName(e){return this.controlService.getControlByName(e)}addMarker(e){this.markerService.addMarker(e)}addMarkerLayer(e){this.markerService.addMarkerLayer(e)}removeMarkerLayer(e){this.markerService.removeMarkerLayer(e)}removeAllMarkers(){this.markerService.removeAllMarkers()}removeAllMakers(){console.warn("removeAllMakers 已废弃,请使用 removeAllMarkers"),this.markerService.removeAllMarkers()}addPopup(e){this.popupService.addPopup(e)}removePopup(e){this.popupService.removePopup(e)}on(e,t){var r;ad.includes(e)?(r=this.boxSelect)==null||r.on(e,t):Nl.includes(e)?this.sceneService.on(e,t):this.mapService.on(e,t)}once(e,t){var r;ad.includes(e)?(r=this.boxSelect)==null||r.once(e,t):Nl.includes(e)?this.sceneService.once(e,t):this.mapService.once(e,t)}emit(e,t){Nl.indexOf(e)===-1?this.mapService.on(e,t):this.sceneService.emit(e,t)}off(e,t){var r;ad.includes(e)?(r=this.boxSelect)==null||r.off(e,t):Nl.includes(e)?this.sceneService.off(e,t):this.mapService.off(e,t)}getZoom(){return this.mapService.getZoom()}getCenter(e){return this.mapService.getCenter(e)}setCenter(e,t){return this.mapService.setCenter(e,t)}getPitch(){return this.mapService.getPitch()}setPitch(e){return this.mapService.setPitch(e)}getRotation(){return this.mapService.getRotation()}getBounds(){return this.mapService.getBounds()}setRotation(e){this.mapService.setRotation(e)}zoomIn(){this.mapService.zoomIn()}zoomOut(){this.mapService.zoomOut()}panTo(e){this.mapService.panTo(e)}panBy(e,t){this.mapService.panBy(e,t)}getContainer(){return this.mapService.getContainer()}setZoom(e){this.mapService.setZoom(e)}fitBounds(e,t){const{fitBoundsOptions:r,animate:n}=this.sceneService.getSceneConfig();this.mapService.fitBounds(e,t||OJ(CJ({},r),{animate:n}))}setZoomAndCenter(e,t){this.mapService.setZoomAndCenter(e,t)}setMapStyle(e){this.mapService.setMapStyle(e)}setMapStatus(e){this.mapService.setMapStatus(e)}pixelToLngLat(e){return this.mapService.pixelToLngLat(e)}lngLatToPixel(e){return this.mapService.lngLatToPixel(e)}containerToLngLat(e){return this.mapService.containerToLngLat(e)}lngLatToContainer(e){return this.mapService.lngLatToContainer(e)}destroy(){this.sceneService.destroy()}registerPostProcessingPass(e){this.container.postProcessingPass.name=new e}enableShaderPick(){this.layerService.enableShaderPick()}diasbleShaderPick(){this.layerService.disableShaderPick()}enableBoxSelect(e=!0){this.boxSelect.enable(),e&&this.boxSelect.once("selectend",()=>{this.disableBoxSelect()})}disableBoxSelect(){this.boxSelect.disable()}static addProtocol(e,t){Gl.REGISTERED_PROTOCOLS[e]=t}static removeProtocol(e){delete Gl.REGISTERED_PROTOCOLS[e]}getProtocol(e){return Gl.REGISTERED_PROTOCOLS[e]}startAnimate(){this.layerService.startAnimate()}stopAnimate(){this.layerService.stopAnimate()}getPointSizeRange(){return this.sceneService.getPointSizeRange()}initComponent(e){this.controlService.init({container:j7(e)},this.container),this.markerService.init(this.container),this.popupService.init(this.container)}initControl(){const{logoVisible:e,logoPosition:t}=this.sceneService.getSceneConfig();e&&this.addControl(new $H({position:t}))}initTileLayer(e){e.getSource().isTile&&(e.tileLayer=new YZ(e))}};const MJ=LR({name:"EsAreaMap",components:{},props:{options:{type:Object,default:()=>({})},datasets:{type:[Array,Object,String],default:()=>[]},eventData:{type:[String,Boolean,Number],default:""},element:{type:Object,default:()=>({})}},setup(e){const t=wR(null);function r(n,i){const{theme:o,token:a,zoom:s,viewMode:u,codeConfig:l,center:f}=i;t.value&&t.value.destroy(),t.value=new IJ({id:`chart-${e.element.id}`,map:new R1({style:o,center:f,zoom:s,token:a,viewMode:u}),logoVisible:!1});const c=Array.isArray(n.values)?n.values:n;new Function("option","datas","l7Instance","GaodeMap",l)(HR(i),c,t.value,R1)}return FR([()=>e.datasets,()=>e.options],([n,i])=>{BR(()=>{r(n,i)})},{immediate:!0,deep:!0}),{myChart:t}}}),NJ=["id"];function PJ(e,t,r,n,i,o){return DR(),UR("div",{id:`chart-${e.element.id}`,style:{width:"100%",height:"100%","background-color":"transparent"}},null,8,NJ)}const qJ=PR(MJ,[["render",PJ]]);export{qJ as default};