PageSourceSearch

https://trailmaps.app/dte/vendor/maplibre-contour.js

js trailmaps.app collected 2026-10-04 07:02:37 UTC 31,240 bytes, 15 lines download raw bytes

1!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).mlcontour=e()}(this,(function(){"use strict";var t,e,i;function r(r,s){if(t)if(e){var n="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",o={};t(o),i=s(o),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([n],{type:"text/javascript"})))}else e=s;else t=s}return r(0,(function(t){class e{constructor(t,e){this.start=t,this.end=e,this.points=[],this.append=this.append.bind(this),this.prepend=this.prepend.bind(this)}append(t,e){this.points.push(Math.round(t),Math.round(e))}prepend(t,e){this.points.splice(0,0,Math.round(t),Math.round(e))}lineString(){return this.toArray()}isEmpty(){return this.points.length<2}appendFragment(t){this.points.push(...t.points),this.end=t.end}toArray(){return this.points}}const i=[[],[[[1,2],[0,1]]],[[[2,1],[1,2]]],[[[2,1],[0,1]]],[[[1,0],[2,1]]],[[[1,2],[0,1]],[[1,0],[2,1]]],[[[1,0],[1,2]]],[[[1,0],[0,1]]],[[[0,1],[1,0]]],[[[1,2],[1,0]]],[[[0,1],[1,0]],[[2,1],[1,2]]],[[[2,1],[1,0]]],[[[0,1],[2,1]]],[[[1,2],[2,1]]],[[[0,1],[1,2]]],[]];function r(t,e,i,r){return(e=2*e+r[0])+(i=2*i+r[1])*(t+1)*2}function s(t,e,i){return(e-t)/(i-t)}function n(t,n,o=4096,a=1){if(!t)return{};const h=o/(n.width-1);let l,c,d,u,f,p;const w={},g=new Map,m=new Map;function b(t,e,i){0===t[0]?i(h*(p-1),h*(f-s(d,e,l))):2===t[0]?i(h*p,h*(f-s(u,e,c))):0===t[1]?i(h*(p-s(c,e,l)),h*(f-1)):i(h*(p-s(u,e,d)),h*f)}for(f=1-a;f<n.height+a;f++){c=n.get(0,f-1),u=n.get(0,f);let s=Math.min(c,u),o=Math.max(c,u);for(p=1-a;p<n.width+a;p++){l=c,d=u,c=n.get(p,f-1),u=n.get(p,f);const a=s,h=o;if(s=Math.min(c,u),o=Math.max(c,u),isNaN(l)||isNaN(c)||isNaN(u)||isNaN(d))continue;const y=Math.min(a,s),v=Math.max(h,o),x=Math.ceil(y/t)*t,P=Math.floor(v/t)*t;for(let s=x;s<=P;s+=t){const t=l>s,o=c>s,a=d>s,h=u>s;for(const l of i[(t?8:0)|(o?4:0)|(h?2:0)|(a?1:0)]){let t=g.get(s);t||g.set(s,t=new Map);let i=m.get(s);i||m.set(s,i=new Map);const o=l[0],a=l[1],h=r(n.width,p,f,o),c=r(n.width,p,f,a);let d,u;if(d=i.get(h))if(i.delete(h),u=t.get(c))if(t.delete(c),d===u){if(b(a,s,d.append),!d.isEmpty()){let t=w[s];t||(w[s]=t=[]),t.push(d.lineString())}}else d.appendFragment(u),i.set(d.end=u.end,d);else b(a,s,d.append),i.set(d.end=c,d);else if(d=t.get(c))t.delete(c),b(o,s,d.prepend),t.set(d.start=h,d);else{const r=new e(h,c);b(o,s,r.append),b(a,s,r.append),t.set(h,r),i.set(c,r)}}}}}for(const[t,e]of g.entries()){let i=null;for(const r of e.values())r.isEmpty()||(null==i&&(i=w[t]||(w[t]=[])),i.push(r.lineString()))}return w}
2/*! *****************************************************************************
3    Copyright (c) Microsoft Corporation.
4
5    Permission to use, copy, modify, and/or distribute this software for any
6    purpose with or without fee is hereby granted.
7
8    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14    PERFORMANCE OF THIS SOFTWARE.
15    ***************************************************************************** */function o(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(i[r[s]]=t[r[s]])}return i}function a(t,e,i,r){return new(i||(i=Promise))((function(s,n){function o(t){try{h(r.next(t))}catch(t){n(t)}}function a(t){try{h(r.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((r=r.apply(t,e||[])).next())}))}function h(t){const e=Object.entries(t);return e.sort((([t],[e])=>t<e?-1:t>e?1:0)),e}function l(t){return h(t).map((([t,e])=>[t,..."number"==typeof e?[e]:e].join("*"))).join("~")}function c(t){return h(t).map((([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`)).join(",")}function d(t){const e=new ArrayBuffer(t.byteLength);return new Uint8Array(e).set(new Uint8Array(t)),e}let u=null;function f(){return null==u&&(u="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),u||!1}let p=null;function w(t,e,i){let r=()=>{};const s=setTimeout((()=>{r(new Error("timed out")),null==i||i.abort()}),t);g(i,(()=>{r(new Error("aborted")),clearTimeout(s)}));const n=new Promise(((t,e)=>{r=e}));return Promise.race([n,e.finally((()=>clearTimeout(s)))])}function g(t,e){e&&(null==t||t.signal.addEventListener("abort",e))}function m(t){var e;return Boolean(null===(e=null==t?void 0:t.signal)||void 0===e?void 0:e.aborted)}let b,y,v,x,P=0;class F{constructor(t=100){this.size=()=>this.items.size,this.get=(t,e,i)=>{let r=this.items.get(t);if(r)r.lastUsed=++P,r.waiting++;else{const i=new AbortController,s=e(t,i);r={abortController:i,item:s,lastUsed:++P,waiting:1},this.items.set(t,r),this.prune()}const s=this.items,n=r.item.then((t=>t),(e=>(s.delete(t),Promise.reject(e))));let o=!1;return g(i,(()=>{var e;r&&r.abortController&&!o&&(o=!0,--r.waiting<=0&&(null===(e=r.abortController)||void 0===e||e.abort(),s.delete(t)))})),n},this.clear=()=>this.items.clear(),this.maxSize=t,this.items=new Map}
15prune(){if(this.items.size>this.maxSize){let t,e=1/0;this.items.forEach(((i,r)=>{i.lastUsed<e&&(e=i.lastUsed,t=r)})),void 0!==t&&this.items.delete(t)}}}function k(t,e){return b||(b=new OffscreenCanvas(t.width,t.height),y=b.getContext("2d",{willReadFrequently:!0})),M(t,e,b,y)}const V=function(){if(null==p&&(p=!1,f()&&"undefined"!=typeof VideoFrame)){const t=5,e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i<t*t;i++){const r=4*i;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(i%t,Math.floor(i/t),1,1)}const i=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&i[e]!==e){p=!0;break}}}return p||!1}()?function(t,e,i){return a(this,void 0,void 0,(function*(){var r,s,n;const o=yield createImageBitmap(t);if(m(i))return null;const a=new VideoFrame(o,{timestamp:0});try{if(!((null===(r=null==a?void 0:a.format)||void 0===r?void 0:r.startsWith("BGR"))||(null===(s=null==a?void 0:a.format)||void 0===s?void 0:s.startsWith("RGB"))))throw new Error(`Unrecognized format: ${null==a?void 0:a.format}`);const t=null===(n=null==a?void 0:a.format)||void 0===n?void 0:n.startsWith("BGR"),i=a.allocationSize(),h=new Uint8ClampedArray(i);if(yield a.copyTo(h),t)for(let t=0;t<h.length;t+=4){const e=h[t];h[t]=h[t+2],h[t+2]=e}return S(o.width,o.height,e,h)}catch(t){return m(i)?null:k(o,e)}finally{a.close()}}))}:f()?function(t,e,i){return a(this,void 0,void 0,(function*(){const r=yield createImageBitmap(t);return m(i)?null:k(r,e)}))}:"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope?function(t,e,i){return self.actor.send("decodeImage",[],i,void 0,t,e)}:function(t,e,i){return a(this,void 0,void 0,(function*(){v||(v=document.createElement("canvas"),x=v.getContext("2d",{willReadFrequently:!0}));const r=new Image;g(i,(()=>r.src=""));return M(yield new Promise(((e,s)=>{r.onload=()=>{m(i)||e(r),URL.revokeObjectURL(r.src),r.onload=null},r.onerror=()=>s(new Error("Could not load image.")),r.src=t.size?URL.createObjectURL(t):""})),e,v,x)}))};function M(t,e,i,r){if(i.width=t.width,i.height=t.height,!r)throw new Error("failed to get context");r.drawImage(t,0,0,t.width,t.height);const s=r.getImageData(0,0,t.width,t.height).data;return S(t.width,t.height,e,s)}function S(t,e,i,r){const s="mapbox"===i?(t,e,i)=>.1*(256*t*256+256*e+i)-1e4:(t,e,i)=>256*t+e+i/256-32768,n=new Float32Array(t*e);for(let t=0;t<r.length;t+=4)n[t/4]=s(r[t],r[t+1],r[t+2]);return{width:t,height:e,data:n}}class T{constructor(t,e,i){this.split=(t,e,i)=>{if(0===t)return this;const r=1<<t,s=e*this.width/r,n=i*this.height/r;return new T(this.width/r,this.height/r,((t,e)=>this.get(t+s,e+n)))},this.subsamplePixelCenters=t=>{const e=(t,e,i)=>isNaN(t)?e:isNaN(e)?t:t+(e-t)*i;if(t<=1)return this;const i=.5-1/(2*t);return new T(this.width*t,this.height*t,((r,s)=>{const n=r/t-i,o=s/t-i,a=Math.floor(n),h=Math.floor(o),l=this.get(a,h),c=this.get(a+1,h),d=this.get(a,h+1),u=this.get(a+1,h+1),f=n-a,p=o-h,w=e(l,c,f),g=e(d,u,f);return e(w,g,p)}))},this.averagePixelCentersToGrid=(t=1)=>new T(this.width+1,this.height+1,((e,i)=>{let r=0,s=0,n=0;for(let o=e-t;o<e+t;o++)for(let e=i-t;e<i+t;e++)isNaN(n=this.get(o,e))||(s++,r+=n);return 0===s?NaN:r/s})),this.scaleElevation=t=>1===t?this:new T(this.width,this.height,((e,i)=>this.get(e,i)*t)),this.materialize=(t=2)=>{const e=this.width+2*t,i=new Float32Array(e*(this.height+2*t));let r=0;for(let e=-t;e<this.height+t;e++)for(let s=-t;s<this.width+t;s++)i[r++]=this.get(s,e);return new T(this.width,this.height,((r,s)=>i[(s+t)*e+r+t]))},this.get=i,this.width=t,this.height=e}static fromRawDem(t){return new T(t.width,t.height,((e,i)=>{const r=t.data[i*t.width+e];return s=r,!isNaN(s)&&s>=-12e3&&s<=9e3?r:NaN;var s}))}
vendor: 4,711 bytes, line 15
15static combineNeighbors(t){if(9!==t.length)throw new Error("Must include a tile plus 8 neighbors");const e=t[4];if(!e)return;const i=e.width,r=e.height;return new T(i,r,((e,s)=>{let n=0;s<0?s+=r:s<r?n+=3:(s-=r,n+=6),e<0?e+=i:e<i?n+=1:(e-=i,n+=2);const o=t[n];return o?o.get(e,s):NaN}))}}const N=4294967296,C=1/N,O="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class I{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos<i;){const i=this.readVarint(),r=i>>3,s=this.pos;this.type=7&i,t(r,e,this),this.pos===s&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*N;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*N;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,r;return r=e[this.pos++],i=127&r,r<128?i:(r=e[this.pos++],i|=(127&r)<<7,r<128?i:(r=e[this.pos++],i|=(127&r)<<14,r<128?i:(r=e[this.pos++],i|=(127&r)<<21,r<128?i:(r=e[this.pos],i|=(15&r)<<28,function(t,e,i){const r=i.buf;let s,n;if(n=r[i.pos++],s=(112&n)>>4,n<128)return E(t,s,e);if(n=r[i.pos++],s|=(127&n)<<3,n<128)return E(t,s,e);if(n=r[i.pos++],s|=(127&n)<<10,n<128)return E(t,s,e);if(n=r[i.pos++],s|=(127&n)<<17,n<128)return E(t,s,e);if(n=r[i.pos++],s|=(127&n)<<24,n<128)return E(t,s,e);if(n=r[i.pos++],s|=(1&n)<<31,n<128)return E(t,s,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&O?O.decode(this.buf.subarray(e,t)):function(t,e,i){let r="",s=e;for(;s<i;){const e=t[s];let n,o,a,h=null,l=e>239?4:e>223?3:e>191?2:1;if(s+l>i)break;1===l?e<128&&(h=e):2===l?(n=t[s+1],128==(192&n)&&(h=(31&e)<<6|63&n,h<=127&&(h=null))):3===l?(n=t[s+1],o=t[s+2],128==(192&n)&&128==(192&o)&&(h=(15&e)<<12|(63&n)<<6|63&o,(h<=2047||h>=55296&&h<=57343)&&(h=null))):4===l&&(n=t[s+1],o=t[s+2],a=t[s+3],128==(192&n)&&128==(192&o)&&128==(192&a)&&(h=(15&e)<<18|(63&n)<<12|(63&o)<<6|63&a,(h<=65535||h>=1114112)&&(h=null))),null===h?(h=65533,l=1):h>65535&&(h-=65536,r+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),r+=String.fromCharCode(h),s+=l}return r}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}
vendor: 4,433 bytes, line 15
15writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*C),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*C),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let i,r;t>=0?(i=t%4294967296|0,r=t/4294967296|0):(i=~(-t%4294967296),r=~(-t/4294967296),4294967295^i?i=i+1|0:(i=0,r=r+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){const i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let r,s,n=0;n<e.length;n++){if(r=e.charCodeAt(n),r>55295&&r<57344){if(!s){r>56319||n+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):s=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,s=r;continue}r=s-55296<<10|r-56320|65536,s=null}else s&&(t[i++]=239,t[i++]=191,t[i++]=189,s=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&U(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=t[i]}writeRawMessage(t,e){this.pos++;const i=this.pos;t(e,this);const r=this.pos-i;r>=128&&U(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,B,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,A,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,z,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,D,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,j,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,R,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,$,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,L,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,G,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function E(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function U(t,e,i){const r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(let e=i.pos-1;e>=t;e--)i.buf[e+r]=i.buf[e]}function B(t,e){for(let i=0;i<t.length;i++)e.writeVarint(t[i])}function A(t,e){for(let i=0;i<t.length;i++)e.writeSVarint(t[i])}function D(t,e){for(let i=0;i<t.length;i++)e.writeFloat(t[i])}function j(t,e){for(let i=0;i<t.length;i++)e.writeDouble(t[i])}function z(t,e){for(let i=0;i<t.length;i++)e.writeBoolean(t[i])}function R(t,e){for(let i=0;i<t.length;i++)e.writeFixed32(t[i])}function $(t,e){for(let i=0;i<t.length;i++)e.writeSFixed32(t[i])}function L(t,e){for(let i=0;i<t.length;
15i++)e.writeFixed64(t[i])}function G(t,e){for(let i=0;i<t.length;i++)e.writeSFixed64(t[i])}var W;function q(t,e){if(!e)throw new Error("pbf undefined");e.writeStringField(1,t.id||"");const i={keys:[],values:[],keycache:{},valuecache:{}};for(const r of t.features)i.feature=r,e.writeMessage(2,K,i);for(const t of i.keys)e.writeStringField(3,t);for(const t of i.values)e.writeMessage(4,Q,t);e.writeVarintField(5,t.extent||4096),e.writeVarintField(15,2)}function K(t,e){const i=t.feature;if(!i||!e)throw new Error;e.writeMessage(2,Y,t),e.writeVarintField(3,i.type),e.writeMessage(4,J,i)}function Y(t,e){const i=t.feature;if(!i||!e)throw new Error;const r=t.keys,s=t.values,n=t.keycache,o=t.valuecache;for(const t in i.properties){let a=i.properties[t],h=n[t];if(null===a)continue;void 0===h&&(r.push(t),h=r.length-1,n[t]=h),e.writeVarint(h);const l=typeof a;"string"!==l&&"boolean"!==l&&"number"!==l&&(a=JSON.stringify(a));const c=`${l}:${a}`;let d=o[c];void 0===d&&(s.push(a),d=s.length-1,o[c]=d),e.writeVarint(d)}}function _(t,e){return(e<<3)+(7&t)}function H(t){return t<<1^t>>31}function J(t,e){if(!e)throw new Error;const i=t.geometry,r=t.type;let s=0,n=0;for(const t of i){let i=1;r===W.POINT&&(i=t.length/2),e.writeVarint(_(1,i));const o=t.length/2,a=r===W.POLYGON?o-1:o;for(let i=0;i<a;i++){1===i&&1!==r&&e.writeVarint(_(2,a-1));const o=t[2*i]-s,h=t[2*i+1]-n;e.writeVarint(H(o)),e.writeVarint(H(h)),s+=o,n+=h}r===W.POLYGON&&e.writeVarint(_(7,1))}}function Q(t,e){if(!e)throw new Error;"string"==typeof t?e.writeStringField(1,t):"boolean"==typeof t?e.writeBooleanField(7,t):"number"==typeof t&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.POINT=1]="POINT",t[t.LINESTRING=2]="LINESTRING",t[t.POLYGON=3]="POLYGON"}(W||(W={}));const X="undefined"!=typeof performance?performance:void 0,Z=X?X.timeOrigin||(new Date).getTime()-X.now():(new Date).getTime();function tt(t){var e;return JSON.parse(JSON.stringify((null===(e=null==X?void 0:X.getEntriesByName)||void 0===e?void 0:e.call(X,t))||[]))}function et(){return X?X.now():(new Date).getTime()}function it(t){const e=[];for(const i of t)e.push(...i);return e}class rt{constructor(t){this.marks={},this.urls=[],this.fetched=[],this.resources=[],this.tilesFetched=0,this.timeOrigin=Z,this.finish=t=>{this.markFinish();const e=t=>{const e=this.marks[t]||[],i=Math.max(...e.map((t=>Math.max(...t)))),r=Math.min(...e.map((t=>Math.min(...t))));return Number.isFinite(i)?i-r:void 0},i=e("main")||0,r=e("fetch"),s=e("decode"),n=e("isoline");return{url:t,tilesUsed:this.tilesFetched,origin:this.timeOrigin,marks:this.marks,resources:[...this.resources,...it(this.fetched.map(tt))],duration:i,fetch:r,decode:s,process:n,wait:i-(r||0)-(s||0)-(n||0)}},this.error=t=>Object.assign(Object.assign({},this.finish(t)),{error:!0}),this.marker=t=>{var e;this.marks[t]||(this.marks[t]=[]);const i=[et()];return null===(e=this.marks[t])||void 0===e||e.push(i),()=>i.push(et())},this.useTile=t=>{this.urls.indexOf(t)<0&&(this.urls.push(t),this.tilesFetched++)},this.fetchTile=t=>{this.fetched.indexOf(t)<0&&this.fetched.push(t)},this.addAll=t=>{var e;this.tilesFetched+=t.tilesUsed;const i=t.origin-this.timeOrigin;for(const r in t.marks){const s=r;(this.marks[s]||(this.marks[s]=[])).push(...(null===(e=t.marks[s])||void 0===e?void 0:e.map((t=>t.map((t=>t+i)))))||[])}this.resources.push(...t.resources.map((t=>function(t,e){const i={};for(const r in t)0!==t[r]&&st.test(r)?i[r]=Number(t[r])+e:i[r]=t[r];return i}(t,i))))},this.markFinish=this.marker(t)}}const st=/(Start$|End$|^start|^end)/;const nt=(t,e)=>a(void 0,void 0,void 0,(function*(){const i={signal:e.signal},r=yield fetch(t,i);if(!r.ok)throw new Error(`Bad response: ${r.status} for ${t}`);return{data:yield r.blob(),expires:r.headers.get("expires")||void 0,cacheControl:r.headers.get("cache-control")||void 0}}));let ot=0;t.A=class{constructor(t,e,i=2e4){this.callbacks={},this.cancels={},this.dest=t,this.timeoutMs=i,this.dest.onmessage=t=>a(this,[t],void 0,(function*({data:t}){const i=t;if("cancel"===i.type){const t=this.cancels[i.id];delete this.cancels[i.id],null==t||t.abort()}else if("response"===i.type){const t=this.callbacks[i.id];delete this.callbacks[i.id],t&&t(i.error?new Error(i.error):void 0,i.response,i.timings)}else if("request"===i.type){const t=new rt("worker"),r=e[i.name],s=new AbortController,n=r.apply(r,[...i.args,s,t]),o=`${i.name}_${i.id}`;if(i.id&&n){this.cancels[i.id]=s;try{const e=yield n,r=null==e?void 0:e.transferrables;this.postMessage({id:i.id,type:"response",response:e,timings:t.finish(o)},r)}catch(e){this.postMessage({id:i.id,type:"response",error:(null==e?void 0:e.toString())||"error",timings:t.finish(o)})}delete this.cancels[i.id]}}}))}postMessage(t,e){this.dest.postMessage(t,e||[])}send(t,e,i,r,...s){const n=++ot,o=new Promise(((i,o)=>{this.postMessage({id:n,type:"request",name:t,args:s},e),this.callbacks[n]=(t,e,s)=>{null==r||r.addAll(s),t?o(t):i(e)}}));return g(i,(()=>{delete this.callbacks[n],this.postMessage({id:n,type:"cancel"})})),w(this.timeoutMs,o,i)}},t.H=T,t.L=class{constructor(t){this.loaded=Promise.resolve(),this.fetchAndParseTile=(t,e,i,r,s)=>{const n=this,o=this.demUrlPattern.replace("{z}",t.toString()).replace("{x}",e.toString()).replace("{y}",i.toString());return null==s||s.useTile(o),this.parsedCache.get(o,((r,o)=>a(this,void 0,void 0,(function*(){const r=yield n.fetchTile(t,e,i,o,s);if(m(o))throw new Error("canceled");const a=n.decodeImage(r.data,n.encoding,o),h=null==s?void 0:s.marker("decode"),l=yield a;return null==h||h(),l}))),r)},this.tileCache=new F(t.cacheSize),this.parsedCache=new F(t.cacheSize),this.contourCache=new F(t.cacheSize),this.timeoutMs=t.timeoutMs,this.demUrlPattern=t.demUrlPattern,this.encoding=t.encoding,this.maxzoom=t.maxzoom,this.decodeImage=t.decodeImage||V,this.getTile=t.getTile||nt}fetchTile(t,e,i,r,s){const n=this.demUrlPattern.replace("{z}",t.toString()).replace("{x}",e.toString()).replace("{y}",i.toString());return null==s||s.useTile(n),this.tileCache.get(n,((t,e)=>{null==s||s.fetchTile(n);const i=null==s?void 0:s.marker("fetch");return w(this.timeoutMs,this.getTile(n,e).finally((()=>null==i?void 0:i())),e)}),r)}fetchDem(t,e,i,r,s,n){return a(this,void 0,void 0,(function*(){const o=Math.max(0,Math.min(t-(r.overzoom||0),this.maxzoom)),a=t-o,h=1<<a,l=Math.floor(e/h),c=Math.floor(i/h),d=yield this.fetchAndParseTile(o,l,c,s,n);return T.fromRawDem(d).split(a,e%h,i%h)}))}fetchContourTile(t,e,i,r,s,o){const{levels:h,multiplier:l=1,buffer:u=1,extent:f=4096,contourLayer:p="contours",elevationKey:w="ele",levelKey:g="level",subsampleBelow:b=100}=r;if(!h||0===h.length)return Promise.resolve({arrayBuffer:new ArrayBuffer(0)});const y=[t,e,i,c(r)].join("/"),v=this.contourCache.get(y,((s,c)=>a(this,void 0,void 0,(function*(){const s=1<<t,a=[];for(let n=i-1;n<=i+1;n++)for(let i=e-1;i<=e+1;i++)a.push(n<0||n>=s?void 0:this.fetchDem(t,(i+s)%s,n,r,c,o));const d=yield Promise.all(a);let y=T.combineNeighbors(d);if(!y||m(c))return{arrayBuffer:(new Uint8Array).buffer};const v=null==o?void 0:o.marker("isoline");if(y.width>=b)y=y.materialize(2);else for(;y.width<b;)y=y.subsamplePixelCenters(2).materialize(2);y=y.averagePixelCentersToGrid().scaleElevation(l).materialize(1);const x=n(h[0],y,f,u);null==v||v();const P=function(t){const e=new I;
15for(const i in t.layers){const r=t.layers[i];r.extent||(r.extent=t.extent),e.writeMessage(3,q,Object.assign(Object.assign({},r),{id:i}))}return e.finish()}({extent:f,layers:{[p]:{features:Object.entries(x).map((([t,e])=>{const i=Number(t);return{type:W.LINESTRING,geometry:e,properties:{[w]:i,[g]:Math.max(...h.map(((t,e)=>i%t==0?e:0)))}}}))}}});return null==v||v(),{arrayBuffer:P.slice().buffer}}))),s);return v.then((({arrayBuffer:t})=>({arrayBuffer:d(t)})))}},t.T=rt,t._=a,t.a=function(t){const[,e,i,r]=/\/\/(\d+)\/(\d+)\/(\d+)/.exec(t)||[];return[Number(e),Number(i),Number(r)]},t.b=function(t){return Object.fromEntries(t.replace(/^.*\?/,"").split("&").map((t=>{const e=t.split("=").map(decodeURIComponent),i=e[0];let r=e[1];switch(i){case"thresholds":s=r,r=Object.fromEntries(s.split("~").map((t=>t.split("*").map(Number))).map((([t,...e])=>[t,e])));break;case"extent":case"multiplier":case"overzoom":case"buffer":r=Number(r)}var s;return[i,r]})))},t.c=S,t.d=V,t.e=function(t){var{thresholds:e}=t,i=o(t,["thresholds"]);return h(Object.assign({thresholds:l(e)},i)).map((([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`)).join("&")},t.f=n,t.g=function(t,e){const{thresholds:i}=t,r=o(t,["thresholds"]);let s=[],n=-1/0;return Object.entries(i).forEach((([t,i])=>{const r=Number(t);r<=e&&r>n&&(n=r,s="number"==typeof i?[i]:i)})),Object.assign({levels:s},r)},t.h=function(t){return t.then((({arrayBuffer:t})=>({arrayBuffer:t,transferrables:[t]})))},t.p=function(t,e){return t.then((t=>{var{data:i}=t,r=o(t,["data"]);let s=i;return e&&(s=new Float32Array(i.length),s.set(i)),Object.assign(Object.assign({},r),{data:s,transferrables:[s.buffer]})}))}})),r(0,(function(t){const e=t=>Promise.reject(new Error(`No manager registered for ${t}`));const i="undefined"!=typeof self?self:"undefined"!=typeof window?window:global;i.actor=new t.A(i,new class{constructor(){this.managers={},this.init=(e,i)=>(this.managers[e.managerId]=new t.L(e),Promise.resolve()),this.fetchTile=(t,i,r,s,n,o)=>{var a;return(null===(a=this.managers[t])||void 0===a?void 0:a.fetchTile(i,r,s,n,o))||e(t)},this.fetchAndParseTile=(i,r,s,n,o,a)=>{var h;return t.p((null===(h=this.managers[i])||void 0===h?void 0:h.fetchAndParseTile(r,s,n,o,a))||e(i),!0)},this.fetchContourTile=(i,r,s,n,o,a,h)=>{var l;return t.h((null===(l=this.managers[i])||void 0===l?void 0:l.fetchContourTile(r,s,n,o,a,h))||e(i))}}})})),r(0,(function(t){const e={workerUrl:""};let i,r=0;class s{constructor(){this.decodeImage=(e,i,r)=>t.p(t.d(e,i,r),!1)}}class n{constructor(n){this.fetchTile=(t,e,i,r,s)=>this.actor.send("fetchTile",[],r,s,this.managerId,t,e,i),this.fetchAndParseTile=(t,e,i,r,s)=>this.actor.send("fetchAndParseTile",[],r,s,this.managerId,t,e,i),this.fetchContourTile=(t,e,i,r,s,n)=>this.actor.send("fetchContourTile",[],s,n,this.managerId,t,e,i,r);const o=this.managerId=++r;this.actor=n.actor||function(){if(!i){const r=new Worker(e.workerUrl),n=new s;i=new t.A(r,n)}return i}(),this.loaded=this.actor.send("init",[],new AbortController,void 0,Object.assign(Object.assign({},n),{managerId:o}))}}Blob.prototype.arrayBuffer||(Blob.prototype.arrayBuffer=function(){return new Promise(((t,e)=>{const i=new FileReader;i.onload=e=>{var i;return t(null===(i=e.target)||void 0===i?void 0:i.result)},i.onerror=e,i.readAsArrayBuffer(this)}))});const o=t=>(e,i)=>{if(i instanceof AbortController)return t(e,i);{const r=new AbortController;return t(e,r).then((t=>i(void 0,t.data,t.cacheControl,t.expires)),(t=>i(t))).catch((t=>i(t))),{cancel:()=>r.abort()}}},a=new Set;const h={generateIsolines:t.f,DemSource:class{constructor({url:e,cacheSize:i=100,id:r="dem",encoding:s="terrarium",maxzoom:h=12,worker:l=!0,timeoutMs:c=1e4,actor:d}){this.timingCallbacks=[],this.onTiming=t=>{this.timingCallbacks.push(t)},this.setupMaplibre=t=>{t.addProtocol(this.sharedDemProtocolId,this.sharedDemProtocol),t.addProtocol(this.contourProtocolId,this.contourProtocol)},this.sharedDemProtocolV4=(e,i)=>t._(this,void 0,void 0,(function*(){const[r,s,n]=t.a(e.url),o=new t.T("main");let a;try{const t=yield this.manager.fetchTile(r,s,n,i,o);a=o.finish(e.url);return{data:yield t.data.arrayBuffer(),cacheControl:t.cacheControl,expires:t.expires}}catch(t){throw a=o.error(e.url),t}finally{this.timingCallbacks.forEach((t=>t(a)))}})),this.contourProtocolV4=(e,i)=>t._(this,void 0,void 0,(function*(){const r=new t.T("main");let s;try{const[n,o,a]=t.a(e.url),h=t.b(e.url),l=yield this.manager.fetchContourTile(n,o,a,t.g(h,n),i,r);return s=r.finish(e.url),{data:l.arrayBuffer}}catch(t){throw s=r.error(e.url),t}finally{this.timingCallbacks.forEach((t=>t(s)))}})),this.contourProtocol=o(this.contourProtocolV4),this.sharedDemProtocol=o(this.sharedDemProtocolV4),this.contourProtocolUrl=e=>`${this.contourProtocolUrlBase}?${t.e(e)}`;let u=r,f=1;for(;a.has(u);)u=r+f++;a.add(u),this.sharedDemProtocolId=`${u}-shared`,this.contourProtocolId=`${u}-contour`,this.sharedDemProtocolUrl=`${this.sharedDemProtocolId}://{z}/{x}/{y}`,this.contourProtocolUrlBase=`${this.contourProtocolId}://{z}/{x}/{y}`;const p=l?n:t.L;this.manager=new p({demUrlPattern:e,cacheSize:i,encoding:s,maxzoom:h,timeoutMs:c,actor:d})}getDemTile(t,e,i,r){return this.manager.fetchAndParseTile(t,e,i,r||new AbortController)}},HeightTile:t.H,LocalDemManager:t.L,decodeParsedImage:t.c,set workerUrl(t){e.workerUrl=t},get workerUrl(){return e.workerUrl}};return h})),i}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.