2 lines
47 KiB
JavaScript
2 lines
47 KiB
JavaScript
|
|
import{bx as e,du as t,fj as s,G as i,fk as o,fl as n,w as r,aP as a,aZ as l,b3 as c,fm as h,fn as u,fo as d,fp as f,fq as p,fr as g,B as m,fs as y,I as w,bb as b,ft as x,ac as v,fu as S,fv as I,b4 as M,fw as P,fx as T,fy as _,ba as k,ea as L,E as z,aL as C,aK as D,aM as j,fz as O,bt as F,fA as A,bs as Z,bu as B,am as N,P as E,fB as R,aG as Y,aJ as X,c4 as J,U as G,m as $,fC as V,fD as U,fE as q,d6 as W,fF as H,fG as Q,x as K,cm as ee,z as te,fH as se,fI as ie,fJ as oe}from"./shared.js";function ne(e){const t=e?e.url.toString():void 0;return t?performance.getEntriesByName(t):[]}function re(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const s of e)t+=`${re(s)},`;return`${t}]`}let t="{";for(const s of Object.keys(e).sort())t+=`${s}:${re(e[s])},`;return`${t}}`}function ae(t){let s="";for(const i of e)s+=`/${re(t[i])}`;return s}class le{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(e,s,i){this._options=i;for(const s of e)this._layerConfigs[s.id]=s,(this._layers[s.id]=t(s,this.scope,null,this._options)).compileFilter(i),this.keyCache[s.id]&&delete this.keyCache[s.id];for(const e of s)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const o=function(e,t){const s={};for(let i=0;i<e.length;i++){const o=e[i];let n=t&&t[o.id];n||("symbol"===o.type?n=o.id:(n=ae(o),"line"===o.type&&o.paint&&function e(t){return"string"==typeof t&&"line-progress"===t||(Array.isArray(t)?t.some(e):!(!t||"object"!=typeof t)&&Object.values(t).some(e))}(o.paint["line-width"])&&(n+=`/${re(o.paint["line-width"])}`))),t&&(t[o.id]=n);let r=s[n];r||(r=s[n]=[]),r.push(o)}const i=[];for(const e in s)i.push(s[e]);return i}(Object.values(this._layerConfigs),this.keyCache);for(const e of o){const t=e.map((e=>this._layers[e.id])),s=t[0];if("none"===s.visibility)continue;const i=s.source||"";let o=this.familiesBySource[i];o||(o=this.familiesBySource[i]={});const n=s.sourceLayer||"_geojsonTileLayer";let r=o[n];r||(r=o[n]=[]),r.push(t)}}}const ce=1*n;class he{constructor(e){const t={},s=[];for(const i in e){const o=e[i],n=t[i]={};for(const e in o.glyphs){const t=o.glyphs[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i=t.metrics.localGlyph?ce:1,r={x:0,y:0,w:t.bitmap.width+2*i,h:t.bitmap.height+2*i};s.push(r),n[e]=r}}const{w:n,h:r}=i(s),a=new o({width:n||1,height:r||1});for(const s in e){const i=e[s];for(const e in i.glyphs){const n=i.glyphs[+e];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const r=t[s][e],l=n.metrics.localGlyph?ce:1;o.copy(n.bitmap,a,{x:0,y:0},{x:r.x+l,y:r.y+l},n.bitmap)}}this.image=a,this.positions=t}}function ue(e,t,s){e[t]?s&&(e[t].center=s):e[t]={floorIds:new Set,center:s||[0,0],floors:{}}}function de(e,t,s,i){for(const o of t)ue(e,o),e[o].floors[s]=i,e[o].floorIds.add(s)}function fe(e){return{id:e.properties.id.toString(),center:e.properties.center.toString().split(";").map(Number)}}function pe(e){return{id:e.properties.id.toString(),isDefault:!!e.properties.is_default&&e.properties.is_default,connections:e.properties.connected_floor_ids?new Set(e.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:e.properties.conflicted_floor_ids?new Set(e.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:e.properties.building_ids?new Set(e.properties.building_ids.toString().split(";")):new Set,name:e.properties.name.toString(),zIndex:e.properties.z_index}}function ge(e,t){return t.every((t=>e.properties&&null!=e.properties[t]))}function me(e){return ge(e,["type","id","name"])&&"building"===e.properties.type}function ye(e){return ge(e,["type","id","name","z_index"])&&"floor"===e.properties.type}s(he,"GlyphAtlas");class we{constructor(e){this.tileID=new a(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.tileZoom=e.tileZoom,this.uid=e.uid,this.zoom=e.zoom,this.lut=e.lut,this.canon
|