lecheminvert.tech/public/maplibre-gl-worker.mjs

6 lines
19 KiB
JavaScript
Raw Permalink Normal View History

/**
* MapLibre GL JS
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.0.0/LICENSE.txt
*/
import{$ as e,An as t,Ar as n,Cn as r,Gt as i,K as a,Kt as o,L as s,M as c,On as l,Pr as u,Q as d,Tn as f,W as p,Y as m,Yn as h,Yt as g,Zn as _,_ as v,_n as y,_t as b,ar as x,c as S,cn as C,d as w,fr as ee,gt as T,i as E,in as D,it as O,j as k,ji as A,jt as j,l as M,ln as te,m as N,n as ne,nt as P,o as F,p as I,rr as L,tt as R,ur as z,ut as B,vn as V,xn as H}from"./maplibre-gl-shared.mjs";var U=class{constructor(e,t){this.keyCache={},e&&this.replace(e,t)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(e,t,n){for(let t of e){this._layerConfigs[t.id]=t;let e=this._layers[t.id]=c(t,n);e._featureFilter=C(e.filter,`layers[${t.id}].filter`,n),this.keyCache[t.id]&&delete this.keyCache[t.id]}for(let e of t)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};let r=te(Object.values(this._layerConfigs),this.keyCache);for(let e of r){let t=e.map(e=>this._layers[e.id]),n=t[0];if(n.isHidden())continue;let r=n.source||``,i=this.familiesBySource[r];i||=this.familiesBySource[r]={};let a=n.sourceLayer||`_geojsonTileLayer`,o=i[a];o||=i[a]=[],o.push(t)}}},W=class{constructor(e){let t={},n=[];for(let r in e){let i=e[r],a=t[r]={};for(let e in i){let t=i[+e];if(!t||t.bitmap.width===0||t.bitmap.height===0)continue;let r={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};n.push(r),a[e]={rect:r,metrics:t.metrics}}}let{w:r,h:i}=a(n),o=new T({width:r||1,height:i||1});for(let n in e){let r=e[n];for(let e in r){let i=r[+e];if(!i||i.bitmap.width===0||i.bitmap.height===0)continue;let a=t[n][e].rect;T.copy(i.bitmap,o,{x:0,y:0},{x:a.x+1,y:a.y+1},i.bitmap)}}this.image=o,this.positions=t}};g(`GlyphAtlas`,W);var G=class{constructor(e){this.tileID=new v(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[]}async parse(e,t,r,i,a){this.status=`parsing`,this.data=e,this.collisionBoxArray=new j;let o=new w(Object.keys(e.layers).sort()),c=new S(this.tileID,this.promoteId);c.bucketLayerIDs=[];let l={},u={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:r,subdivisionGranularity:a},f=t.familiesBySource[this.source];for(let t in f){let i=e.layers[t];if(!i)continue;i.version===1&&n(`Vector tile source "${this.source}" layer "${t}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let a=o.encode(t),s=[];for(let e=0;e<i.length;e++){let n=i.feature(e),r=c.getId(n,t);s.push({feature:n,id:r,index:e,sourceLayerIndex:a})}for(let e of f[t]){let t=e[0];t.source!==this.source&&n(`layer.source = ${t.source} does not equal this.source = ${this.source}`),!t.isHidden(this.zoom,!0)&&(K(e,this.zoom,r),(l[t.id]=t.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:a,sourceID:this.source})).populate(s,u,this.tileID.canonical),c.bucketLayerIDs.push(e.map(e=>e.id)))}}let m=ee(u.glyphDependencies,e=>Object.keys(e).map(Number));for(let e of this.inFlightDependencies)e?.abort();this.inFlightDependencies=[];let h=Promise.resolve({});if(Object.keys(m).length){let e=new AbortController;this.inFlightDependencies.push(e),h=i.sendAsync({type:`GG`,data:{stacks:m,source:this.source,tileID:this.tileID,type:`glyphs`}},e)}let g=Object.keys(u.iconDependencies),_=Promise.resolve({});if(g.length){let e=new AbortController;this.inFlightDependencies.push(e),_=i.sendAsync({type:`GI`,data:{icons:g,source:this.source,tileID:this.tileID,type:`icons`}},e)}let v=Object.keys(u.patternDependencies),y=Promise.resolve({});if(v.length){let e=new AbortController;this.inFlightDependencies.push(e),y=i.sendAsync({type:`GI`,data:{
//# sourceMappingURL=maplibre-gl-worker.mjs.map