mapicgc-gl-js 0.0.94 → 0.0.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56596,7 +56596,7 @@ function(n) {
56596
56596
  */
56597
56597
  function(n) {
56598
56598
  function e() {
56599
- return (Rn.canvg ? Promise.resolve(Rn.canvg) : import("./index.es-BWyxJuJN-ugfVcPBC.mjs")).catch(function(t) {
56599
+ return (Rn.canvg ? Promise.resolve(Rn.canvg) : import("./index.es-BWyxJuJN-NjlKhAaH.mjs")).catch(function(t) {
56600
56600
  return Promise.reject(new Error("Could not load canvg: " + t));
56601
56601
  }).then(function(t) {
56602
56602
  return t.default ? t.default : t;
@@ -62575,28 +62575,42 @@ let xh, ep, Si, hr, BW = class {
62575
62575
  */
62576
62576
  setSky(e) {
62577
62577
  try {
62578
- e === void 0 && (this.map.options.style.includes("orto") && (e = {
62578
+ e === void 0 && (this.map.style.stylesheet.id.includes("orto") ? e = {
62579
62579
  "sky-color": "#86bbd5",
62580
62580
  "sky-horizon-blend": 0.3,
62581
62581
  "horizon-color": "#ffffff33",
62582
62582
  "horizon-fog-blend": 0.1,
62583
62583
  "fog-ground-blend": 0.75,
62584
62584
  "fog-color": "#c5d6d6"
62585
- }), this.map.options.style.includes("mapa_estandard_general") && (e = {
62585
+ } : this.map.style.stylesheet.id.includes("mapa_estandard_general") ? e = {
62586
62586
  "sky-color": "#a5f0f0",
62587
62587
  "sky-horizon-blend": 0.3,
62588
62588
  "horizon-color": "#e1e3e3",
62589
62589
  "horizon-fog-blend": 0.9,
62590
62590
  "fog-ground-blend": 0.85,
62591
62591
  "fog-color": "#c5d6d6"
62592
- }), this.map.options.style.includes("fosc") && (e = {
62592
+ } : this.map.style.stylesheet.id.includes("icgc_mapa_vissir") ? e = {
62593
+ "sky-color": "#a5f0f0",
62594
+ "sky-horizon-blend": 0.3,
62595
+ "horizon-color": "#e1e3e3",
62596
+ "horizon-fog-blend": 0.9,
62597
+ "fog-ground-blend": 0.85,
62598
+ "fog-color": "#c5d6d6"
62599
+ } : this.map.style.stylesheet.id.includes("fosc") ? e = {
62593
62600
  "sky-color": "#232423",
62594
62601
  "sky-horizon-blend": 0.3,
62595
62602
  "horizon-color": "#969996",
62596
62603
  "horizon-fog-blend": 0.9,
62597
62604
  "fog-ground-blend": 0.85,
62598
62605
  "fog-color": "#383838"
62599
- })), this.map.setSky(e);
62606
+ } : e = {
62607
+ "sky-color": "#86bbd5",
62608
+ "sky-horizon-blend": 0.3,
62609
+ "horizon-color": "#ffffff33",
62610
+ "horizon-fog-blend": 0.1,
62611
+ "fog-ground-blend": 0.75,
62612
+ "fog-color": "#c5d6d6"
62613
+ }), this.map.setSky(e);
62600
62614
  } catch (t) {
62601
62615
  console.error(`Error setting sky properties: ${t.message}`);
62602
62616
  }
@@ -1,4 +1,4 @@
1
- import { p as Ui } from "./index-D3-Uc9f8.mjs";
1
+ import { p as Ui } from "./index-DMlHD4NY.mjs";
2
2
  var Zt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
3
3
  function No(i) {
4
4
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
@@ -2579,7 +2579,7 @@ end`};t.events.push(["putFont",function(s){(function(a){var o=a.font,d=a.out,f=a
2579
2579
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t){const e=new this(t);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return i.forEach(a=>e.set(a)),e}static accessor(t){const n=(this[bM]=this[bM]={accessors:{}}).accessors,i=this.prototype;function s(a){const o=Yg(a);n[o]||(fst(i,a),n[o]=!0)}return fe.isArray(t)?t.forEach(s):s(t),this}}pa.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(pa.prototype,(r,t)=>{let{value:e}=r,n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[n]=i}}}),fe.freezeMethods(pa);function Ax(r,t){const e=this||Jg,n=t||e,i=pa.from(n.headers);let s=n.data;return fe.forEach(r,function(o){s=o.call(e,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function wM(r){return!!(r&&r.__CANCEL__)}function Hf(r,t,e){ln.call(this,r??"canceled",ln.ERR_CANCELED,t,e),this.name="CanceledError"}fe.inherits(Hf,ln,{__CANCEL__:!0});function xM(r,t,e){const n=e.config.validateStatus;!e.status||!n||n(e.status)?r(e):t(new ln("Request failed with status code "+e.status,[ln.ERR_BAD_REQUEST,ln.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}function pst(r){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return t&&t[1]||""}function gst(r,t){r=r||10;const e=new Array(r),n=new Array(r);let i=0,s=0,a;return t=t!==void 0?t:1e3,function(d){const f=Date.now(),_=n[s];a||(a=f),e[i]=d,n[i]=f;let w=s,x=0;for(;w!==i;)x+=e[w++],w=w%r;if(i=(i+1)%r,i===s&&(s=(s+1)%r),f-a<t)return;const B=_&&f-_;return B?Math.round(x*1e3/B):void 0}}function mst(r,t){let e=0,n=1e3/t,i,s;const a=function(f){e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Date.now(),i=null,s&&(clearTimeout(s),s=null),r.apply(null,f)};return[function(){const f=Date.now(),_=f-e;for(var w=arguments.length,x=new Array(w),B=0;B<w;B++)x[B]=arguments[B];_>=n?a(x,f):(i=x,s||(s=setTimeout(()=>{s=null,a(i)},n-_)))},()=>i&&a(i)]}const r1=function(r,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:3,n=0;const i=gst(50,250);return mst(s=>{const a=s.loaded,o=s.lengthComputable?s.total:void 0,d=a-n,f=i(d),_=a<=o;n=a;const w={loaded:a,total:o,progress:o?a/o:void 0,bytes:d,rate:f||void 0,estimated:f&&o&&_?(o-a)/f:void 0,event:s,lengthComputable:o!=null,[t?"download":"upload"]:!0};r(w)},e)},BM=(r,t)=>{const e=r!=null;return[n=>t[0]({lengthComputable:e,total:r,loaded:n}),t[1]]},CM=r=>function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return fe.asap(()=>r(...e))},yst=sc.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let n;function i(s){let a=s;return t&&(e.setAttribute("href",a),a=e.href),e.setAttribute("href",a),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return n=i(window.location.href),function(a){const o=fe.isString(a)?i(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}(),_st=sc.hasStandardBrowserEnv?{write(r,t,e,n,i,s){const a=[r+"="+encodeURIComponent(t)];fe.isNumber(e)&&a.push("expires="+new Date(e).toGMTString()),fe.isString(n)&&a.push("path="+n),fe.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(r){const t=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function vst(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function bst(r,t){return t?r.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):r}function EM(r,t){return r&&!vst(t)?bst(r,t):t}const SM=r=>r instanceof pa?{...r}:r;function nd(r,t){t=t||{};const e={};function n(f,_,w){return fe.isPlainObject(f)&&fe.isPlainObject(_)?fe.merge.call({caseless:w},f,_):fe.isPlainObject(_)?fe.merge({},_):fe.isArray(_)?_.slice():_}function i(f,_,w){if(fe.isUndefined(_)){if(!fe.isUndefined(f))return n(void 0,f,w)}else return n(f,_,w)}function s(f,_){if(!fe.isUndefined(_))return n(void 0,_)}function a(f,_){if(fe.isUndefined(_)){if(!fe.isUndefined(f))return n(void 0,f)}else return n(void 0,_)}function o(f,_,w){if(w in t)return n(f,_);if(w in r)return n(void 0,f)}const d={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(f,_)=>i(SM(f),SM(_),!0)};return fe.forEach(Object.keys(Object.assign({},r,t)),function(_){const w=d[_]||i,x=w(r[_],t[_],_);fe.isUndefined(x)&&w!==o||(e[_]=x)}),e}const TM=r=>{const t=nd({},r);let{data:e,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:o}=t;t.headers=a=pa.from(a),t.url=mM(EM(t.baseURL,t.url),r.params,r.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let d;if(fe.isFormData(e)){if(sc.hasStandardBrowserEnv||sc.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((d=a.getContentType())!==!1){const[f,..._]=d?d.split(";").map(w=>w.trim()).filter(Boolean):[];a.setContentType([f||"multipart/form-data",..._].join("; "))}}if(sc.hasStandardBrowserEnv&&(n&&fe.isFunction(n)&&(n=n(t)),n||n!==!1&&yst(t.url))){const f=i&&s&&_st.read(s);f&&a.set(i,f)}return t},wst=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(e,n){const i=TM(r);let s=i.data;const a=pa.from(i.headers).normalize();let{responseType:o,onUploadProgress:d,onDownloadProgress:f}=i,_,w,x,B,P;function R(){B&&B(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(_),i.signal&&i.signal.removeEventListener("abort",_)}let N=new XMLHttpRequest;N.open(i.method.toUpperCase(),i.url,!0),N.timeout=i.timeout;function Q(){if(!N)return;const K=pa.from("getAllResponseHeaders"in N&&N.getAllResponseHeaders()),dt={data:!o||o==="text"||o==="json"?N.responseText:N.response,status:N.status,statusText:N.statusText,headers:K,config:r,request:N};xM(function(pt){e(pt),R()},function(pt){n(pt),R()},dt),N=null}"onloadend"in N?N.onloadend=Q:N.onreadystatechange=function(){!N||N.readyState!==4||N.status===0&&!(N.responseURL&&N.responseURL.indexOf("file:")===0)||setTimeout(Q)},N.onabort=function(){N&&(n(new ln("Request aborted",ln.ECONNABORTED,r,N)),N=null)},N.onerror=function(){n(new ln("Network Error",ln.ERR_NETWORK,r,N)),N=null},N.ontimeout=function(){let et=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const dt=i.transitional||_M;i.timeoutErrorMessage&&(et=i.timeoutErrorMessage),n(new ln(et,dt.clarifyTimeoutError?ln.ETIMEDOUT:ln.ECONNABORTED,r,N)),N=null},s===void 0&&a.setContentType(null),"setRequestHeader"in N&&fe.forEach(a.toJSON(),function(et,dt){N.setRequestHeader(dt,et)}),fe.isUndefined(i.withCredentials)||(N.withCredentials=!!i.withCredentials),o&&o!=="json"&&(N.responseType=i.responseType),f&&([x,P]=r1(f,!0),N.addEventListener("progress",x)),d&&N.upload&&([w,B]=r1(d),N.upload.addEventListener("progress",w),N.upload.addEventListener("loadend",B)),(i.cancelToken||i.signal)&&(_=K=>{N&&(n(!K||K.type?new Hf(null,r,N):K),N.abort(),N=null)},i.cancelToken&&i.cancelToken.subscribe(_),i.signal&&(i.signal.aborted?_():i.signal.addEventListener("abort",_)));const V=pst(i.url);if(V&&sc.protocols.indexOf(V)===-1){n(new ln("Unsupported protocol "+V+":",ln.ERR_BAD_REQUEST,r));return}N.send(s||null)})},xst=(r,t)=>{let e=new AbortController,n;const i=function(d){if(!n){n=!0,a();const f=d instanceof Error?d:this.reason;e.abort(f instanceof ln?f:new Hf(f instanceof Error?f.message:f))}};let s=t&&setTimeout(()=>{i(new ln(`timeout ${t} of ms exceeded`,ln.ETIMEDOUT))},t);const a=()=>{r&&(s&&clearTimeout(s),s=null,r.forEach(d=>{d&&(d.removeEventListener?d.removeEventListener("abort",i):d.unsubscribe(i))}),r=null)};r.forEach(d=>d&&d.addEventListener&&d.addEventListener("abort",i));const{signal:o}=e;return o.unsubscribe=a,[o,()=>{s&&clearTimeout(s),s=null}]},Bst=function*(r,t){let e=r.byteLength;if(e<t){yield r;return}let n=0,i;for(;n<e;)i=n+t,yield r.slice(n,i),n=i},Cst=async function*(r,t,e){for await(const n of r)yield*Bst(ArrayBuffer.isView(n)?n:await e(String(n)),t)},IM=(r,t,e,n,i)=>{const s=Cst(r,t,i);let a=0,o,d=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:_,value:w}=await s.next();if(_){d(),f.close();return}let x=w.byteLength;if(e){let B=a+=x;e(B)}f.enqueue(new Uint8Array(w))}catch(_){throw d(_),_}},cancel(f){return d(f),s.return()}},{highWaterMark:2})},n1=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",FM=n1&&typeof ReadableStream=="function",hx=n1&&(typeof TextEncoder=="function"?(r=>t=>r.encode(t))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),LM=function(r){try{for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return!!r(...e)}catch{return!1}},Est=FM&&LM(()=>{let r=!1;const t=new Request(sc.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!t}),PM=64*1024,dx=FM&&LM(()=>fe.isReadableStream(new Response("").body)),i1={stream:dx&&(r=>r.body)};n1&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!i1[t]&&(i1[t]=fe.isFunction(r[t])?e=>e[t]():(e,n)=>{throw new ln(`Response type '${t}' is not supported`,ln.ERR_NOT_SUPPORT,n)})})})(new Response);const Sst=async r=>{if(r==null)return 0;if(fe.isBlob(r))return r.size;if(fe.isSpecCompliantForm(r))return(await new Request(r).arrayBuffer()).byteLength;if(fe.isArrayBufferView(r)||fe.isArrayBuffer(r))return r.byteLength;if(fe.isURLSearchParams(r)&&(r=r+""),fe.isString(r))return(await hx(r)).byteLength},Tst=async(r,t)=>{const e=fe.toFiniteNumber(r.getContentLength());return e??Sst(t)},fx={http:Jit,xhr:wst,fetch:n1&&(async r=>{let{url:t,method:e,data:n,signal:i,cancelToken:s,timeout:a,onDownloadProgress:o,onUploadProgress:d,responseType:f,headers:_,withCredentials:w="same-origin",fetchOptions:x}=TM(r);f=f?(f+"").toLowerCase():"text";let[B,P]=i||s||a?xst([i,s],a):[],R,N;const Q=()=>{!R&&setTimeout(()=>{B&&B.unsubscribe()}),R=!0};let V;try{if(d&&Est&&e!=="get"&&e!=="head"&&(V=await Tst(_,n))!==0){let At=new Request(t,{method:"POST",body:n,duplex:"half"}),pt;if(fe.isFormData(n)&&(pt=At.headers.get("content-type"))&&_.setContentType(pt),At.body){const[ht,Tt]=BM(V,r1(CM(d)));n=IM(At.body,PM,ht,Tt,hx)}}fe.isString(w)||(w=w?"include":"omit"),N=new Request(t,{...x,signal:B,method:e.toUpperCase(),headers:_.normalize().toJSON(),body:n,duplex:"half",credentials:w});let K=await fetch(N);const et=dx&&(f==="stream"||f==="response");if(dx&&(o||et)){const At={};["status","statusText","headers"].forEach(St=>{At[St]=K[St]});const pt=fe.toFiniteNumber(K.headers.get("content-length")),[ht,Tt]=o&&BM(pt,r1(CM(o),!0))||[];K=new Response(IM(K.body,PM,ht,()=>{Tt&&Tt(),et&&Q()},hx),At)}f=f||"text";let dt=await i1[fe.findKey(i1,f)||"text"](K,r);return!et&&Q(),P&&P(),await new Promise((At,pt)=>{xM(At,pt,{data:dt,headers:pa.from(K.headers),status:K.status,statusText:K.statusText,config:r,request:N})})}catch(K){throw Q(),K&&K.name==="TypeError"&&/fetch/i.test(K.message)?Object.assign(new ln("Network Error",ln.ERR_NETWORK,r,N),{cause:K.cause||K}):ln.from(K,K&&K.code,r,N)}})};fe.forEach(fx,(r,t)=>{if(r){try{Object.defineProperty(r,"name",{value:t})}catch{}Object.defineProperty(r,"adapterName",{value:t})}});const MM=r=>`- ${r}`,Ist=r=>fe.isFunction(r)||r===null||r===!1,RM={getAdapter:r=>{r=fe.isArray(r)?r:[r];const{length:t}=r;let e,n;const i={};for(let s=0;s<t;s++){e=r[s];let a;if(n=e,!Ist(e)&&(n=fx[(a=String(e)).toLowerCase()],n===void 0))throw new ln(`Unknown adapter '${a}'`);if(n)break;i[a||"#"+s]=n}if(!n){const s=Object.entries(i).map(o=>{let[d,f]=o;return`adapter ${d} `+(f===!1?"is not supported by the environment":"is not available in the build")});let a=t?s.length>1?`since :
2580
2580
  `+s.map(MM).join(`
2581
2581
  `):" "+MM(s[0]):"as no adapter specified";throw new ln("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:fx};function px(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Hf(null,r)}function UM(r){return px(r),r.headers=pa.from(r.headers),r.data=Ax.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),RM.getAdapter(r.adapter||Jg.adapter)(r).then(function(n){return px(r),n.data=Ax.call(r,r.transformResponse,n),n.headers=pa.from(n.headers),n},function(n){return wM(n)||(px(r),n&&n.response&&(n.response.data=Ax.call(r,r.transformResponse,n.response),n.response.headers=pa.from(n.response.headers))),Promise.reject(n)})}const OM="1.7.4",gx={};["object","boolean","number","function","string","symbol"].forEach((r,t)=>{gx[r]=function(n){return typeof n===r||"a"+(t<1?"n ":" ")+r}});const DM={};gx.transitional=function(t,e,n){function i(s,a){return"[Axios v"+OM+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return(s,a,o)=>{if(t===!1)throw new ln(i(a," has been removed"+(e?" in "+e:"")),ln.ERR_DEPRECATED);return e&&!DM[a]&&(DM[a]=!0,console.warn(i(a," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,a,o):!0}};function Fst(r,t,e){if(typeof r!="object")throw new ln("options must be an object",ln.ERR_BAD_OPTION_VALUE);const n=Object.keys(r);let i=n.length;for(;i-- >0;){const s=n[i],a=t[s];if(a){const o=r[s],d=o===void 0||a(o,s,r);if(d!==!0)throw new ln("option "+s+" must be "+d,ln.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new ln("Unknown option "+s,ln.ERR_BAD_OPTION)}}const mx={assertOptions:Fst,validators:gx},YA=mx.validators;class id{constructor(t){this.defaults=t,this.interceptors={request:new yM,response:new yM}}async request(t,e){try{return await this._request(t,e)}catch(n){if(n instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
2582
- `+s):n.stack=s}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=nd(this.defaults,e);const{transitional:n,paramsSerializer:i,headers:s}=e;n!==void 0&&mx.assertOptions(n,{silentJSONParsing:YA.transitional(YA.boolean),forcedJSONParsing:YA.transitional(YA.boolean),clarifyTimeoutError:YA.transitional(YA.boolean)},!1),i!=null&&(fe.isFunction(i)?e.paramsSerializer={serialize:i}:mx.assertOptions(i,{encode:YA.function,serialize:YA.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&fe.merge(s.common,s[e.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),e.headers=pa.concat(a,s);const o=[];let d=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(e)===!1||(d=d&&R.synchronous,o.unshift(R.fulfilled,R.rejected))});const f=[];this.interceptors.response.forEach(function(R){f.push(R.fulfilled,R.rejected)});let _,w=0,x;if(!d){const P=[UM.bind(this),void 0];for(P.unshift.apply(P,o),P.push.apply(P,f),x=P.length,_=Promise.resolve(e);w<x;)_=_.then(P[w++],P[w++]);return _}x=o.length;let B=e;for(w=0;w<x;){const P=o[w++],R=o[w++];try{B=P(B)}catch(N){R.call(this,N);break}}try{_=UM.call(this,B)}catch(P){return Promise.reject(P)}for(w=0,x=f.length;w<x;)_=_.then(f[w++],f[w++]);return _}getUri(t){t=nd(this.defaults,t);const e=EM(t.baseURL,t.url);return mM(e,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){id.prototype[t]=function(e,n){return this.request(nd(n||{},{method:t,url:e,data:(n||{}).data}))}}),fe.forEach(["post","put","patch"],function(t){function e(n){return function(s,a,o){return this.request(nd(o||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}id.prototype[t]=e(),id.prototype[t+"Form"]=e(!0)});class yx{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(s){e=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(i);return a.cancel=function(){n.unsubscribe(s)},a},t(function(s,a,o){n.reason||(n.reason=new Hf(s,a,o),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new yx(function(i){t=i}),cancel:t}}}function Lst(r){return function(e){return r.apply(null,e)}}function Pst(r){return fe.isObject(r)&&r.isAxiosError===!0}const _x={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(_x).forEach(r=>{let[t,e]=r;_x[e]=t});function NM(r){const t=new id(r),e=eM(id.prototype.request,t);return fe.extend(e,id.prototype,t,{allOwnKeys:!0}),fe.extend(e,t,null,{allOwnKeys:!0}),e.create=function(i){return NM(nd(r,i))},e}const is=NM(Jg);is.Axios=id,is.CanceledError=Hf,is.CancelToken=yx,is.isCancel=wM,is.VERSION=OM,is.toFormData=t1,is.AxiosError=ln,is.Cancel=is.CanceledError,is.all=function(t){return Promise.all(t)},is.spread=Lst,is.isAxiosError=Pst,is.mergeConfig=nd,is.AxiosHeaders=pa,is.formToJSON=r=>vM(fe.isHTMLForm(r)?new FormData(r):r),is.getAdapter=RM.getAdapter,is.HttpStatusCode=_x,is.default=is;const Mst="https://eines.icgc.cat/recursos/mapicgc-gl-js/mapicgc-config.json",Rst=5e3;class kM{static async getConfigICGC(){try{const t=await is.get(Mst,{timeout:Rst});return t.data?t.data:(console.log("Resposta sense dades:",t),ed)}catch(t){return t.response?(console.error("Error de resposta:",t.response.data),console.error("Codi d'estat:",t.response.status)):t.request?console.error("No s'ha rebut resposta del servidor:",t.request):console.error("Error:",t.message),ed}}}const Ust={cobertesSol:{"fill-opacity":["interpolate",["exponential",.5],["zoom"],13.5,1,18,.4],"fill-outline-color":"rgba(0,0, 0, 0)","fill-color":["interpolate",["cubic-bezier",.5,1,1,1],["get","nivell_2"],0,"#ffffff",111,"#ffff00",112,"#ccff33",113,"#af5b15",114,"#808000",115,"#cdcd00",116,"#ffffcc",221,"#33cc33",222,"#66ff33",223,"#689018",224,"#967d5f",225,"#19e61e",226,"#b4ff9b",227,"#aaa500",228,"#c3c3a0",229,"#00ff9b",230,"#ff9632",231,"#282828",232,"#79797a",233,"#f5df78",234,"#3296ff",341,"#ff007d",342,"#ff53cd",343,"#ffa4e2",344,"#ffc8e2",345,"#ffb4b4",346,"#0f3700",347,"#730055",348,"#6200c4",349,"#4a9595",350,"#ff00f0",351,"#adaaca",352,"#ffe6e6",353,"#67629a",354,"#4a466e",355,"#2f2d46",461,"#6f6fff",462,"#0000dc",463,"#000064",464,"#185f94",465,"#12466d",466,"#000080"]}},Ost="lines",s1="labels";let sd,Zg,ki,Ln,Dst=class{constructor(t){kM.getConfigICGC().then(e=>{sd={...e.Styles},ki={...e.Layers},Zg={...e.Terrains},Ln={...e.defaultOptions},this.initTheMap(t)}).catch(e=>{console.info("Configuracio per defecte",e),sd={...ed.Styles},ki={...ed.Layers},Zg={...ed.Terrains},Ln={...ed.defaultOptions},this.initTheMap(t)})}initTheMap(t){if(!t)t=Ln.mapOptions;else for(const n in Ln.mapOptions){let i=[Ln.mapOptions.center[0],Ln.mapOptions.center[1]];Ln.mapOptions.center=i,t.hasOwnProperty(n)||(t[n]=Ln.mapOptions[n])}t.maxPitch=85,t.maplibreLogo=!1,t.attributionControl=!1;const e=t.style.includes("https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/");e?(this.map=new Ps.Map({container:t.container,center:t.center,zoom:t.zoom,pitch:t.pitch||0,hash:t.hash||!1,style:{version:8,sources:{},layers:[]}}),this.map.on("load",()=>{this.map.addSource("raster-source",{type:"raster",tiles:[t.style],tileSize:256}),this.map.addLayer({id:"raster-layer",type:"raster",source:"raster-source"})})):this.map=new Ps.Map(t),this.map.on("load",()=>{if(!e){const n=this.map.getStyle().name,i=t.style;this.map.addControl(new ait({color:i.indexOf("orto")===-1,defaultOptions:Ln}),"bottom-left"),this._dealOrto3dStyle(n)}})}addGeocoderICGC(t){try{t===void 0&&(t="top-right");let e={collapsed:!0,marker:!0,popup:!0,showResultMarkers:!0,maplibregl:Ps,showResultsWhileTyping:!0,minLength:2};const n={forwardGeocode:async s=>{const a=[];try{const o=Ln.geocoder.peliasUrl1+encodeURIComponent(s.query)+Ln.geocoder.peliasUrl2,f=await(await fetch(o)).json();for(const _ of f.features){const w=_.geometry.coordinates,x={type:"Feature",geometry:{type:"Point",coordinates:w},place_name:_.properties.etiqueta,properties:_.properties,text:_.properties.etiqueta,place_type:["place"],center:w};a.push(x)}}catch(o){console.error(`Failed to forwardGeocode with error: ${o}`)}return{features:a}}};this.map.addControl(new oit(n,e),t);let i=document.getElementsByClassName("maplibregl-ctrl-geocoder--input");i[0].attributes[2].nodeValue="Cerca...",i[0].addEventListener("input",function(s){s.target.value.length>3})}catch(e){console.error(`Error adding ICGC geocoder: ${e.message}`)}}async loadImage(t){try{return this.map.loadImage(t)}catch(e){console.error(`Error getting loadImage: ${e.message}`)}}getConfigStyles(){try{let t=[];for(const e of sd)t.push(e.name);return t}catch(t){console.error(`Error retrieving base styles: ${t.message}`)}}getConfigWMSLayers(){try{let t=[];for(const e in ki.WMS)ki.WMS.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving WMS layers: ${t.message}`)}}getConfigOrtoLayers(){try{let t=[];for(const e in ki.Orto)ki.Orto.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving orto image layers: ${t.message}`)}}getConfigVectorLayers(){try{let t=[];for(const e in ki.Vector)ki.Vector.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving vector layers: ${t.message}`)}}getConfigVectorAdminLayers(){try{let t=[];for(const e in ki.VectorAdmin)ki.VectorAdmin.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving vectorAdmin layers: ${t.message}`)}}getConfigFGBAdminLayers(){try{let t=[];for(const e in ki.FGBAdmin)ki.FGBAdmin.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving FGBAdmin layers: ${t.message}`)}}async fetchData(t,e,n){try{(!n||n===void 0)&&(n={type:"line",layout:{visibility:"visible"},paint:{"line-color":"grey","line-width":2},layerPosition:"top"});let i=n.layerPosition;if(t.includes(".fgb"))this.addFGBLayerICGC(t,e,n);else{const a=await(await fetch(t)).json();let o=e,d=this._dealOrderLayer(i),f=a.features[0].geometry.type;f.includes("ine")&&(n!==void 0?this.map.addLayer({id:o,type:"line",source:{type:"geojson",data:a},layout:n.layout||{},paint:n.paint||{}},d):this.map.addLayer({id:o,type:"line",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"line-color":"black","line-width":2,"line-opacity":1}},d)),f.includes("olygon")&&(n!==void 0?this.map.addLayer({id:o,type:"fill",source:{type:"geojson",data:a},layout:n.layout,paint:n.paint},d):this.map.addLayer({id:o,type:"fill",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"fill-color":"blue","fill-opacity":.6}},d)),f.includes("oint")&&(n!==void 0?this.map.addLayer({id:o,type:"circle",source:{type:"geojson",data:a},layout:n.layout,paint:n.paint},d):this.map.addLayer({id:o,type:"circle",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"circle-color":"red","circle-opacity":.85}},d))}}catch(i){console.error(`Error fetching data: ${i.message}`)}}async fetchDataAndMenu(t,e,n,i){try{let s;i!==null?s=i.layerPosition:s=s1;let a,o=document.getElementById("map");if(document.getElementById("menu-group")?a=document.getElementById("menu-group"):(a=document.createElement("nav"),a.id="menu-group",a.classList.add="filter-group",o.appendChild(a)),a!==null){let d="visible",f=this._dealOrderLayer(s),_;if(t.includes(".fgb")){let x=this._getKeyByUrlFGB(t);x===null&&(x="userFGB");const B=await fetch(t),P={type:"FeatureCollection",features:[]};for await(const N of HS(B.body))P.features.push(N);_=P;let R=e;if(this.map.addSource(R,{type:"geojson",data:P}),t.includes("text"))i!==void 0?this.map.addLayer({id:e,type:"symbol",source:R,layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"symbol",source:R,layout:{"text-letter-spacing":.1,"text-size":{base:1.2,stops:[[8,0],[12,14],[15,15]]},"text-font":["FiraSans-Regular"],"text-field":["get","NOM_AC"],"text-transform":"none","text-max-width":25,visibility:d,"text-justify":"right","text-anchor":"top","text-allow-overlap":!1,"symbol-spacing":2,"text-line-height":1},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f);else{let N=e+"Text";this.map.addLayer({id:N,type:"symbol",source:R,layout:{"text-letter-spacing":.1,"text-size":{base:1.2,stops:[[8,0],[12,14],[15,15]]},"text-font":["FiraSans-Regular"],"text-field":["get","NOM_AC"],"text-transform":"none","text-max-width":25,visibility:d,"text-justify":"right","text-anchor":"top","text-allow-overlap":!1,"symbol-spacing":2,"text-line-height":1},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f)}}else _=await(await fetch(t)).json();if(n!=="all"){const x=document.createElement("div");x.id="titleDivMenu",x.textContent=e,a.appendChild(x);const B=document.createElement("div");B.id="titleDivMenuSub",B.textContent=`📂 ${n}`,a.appendChild(B)}let w;if(i.type?w=i.type:w=_.features[0].geometry.type,n==="all")w.includes("ine")&&(i!==void 0?this.map.addLayer({id:e,type:"line",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"line",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"line-color":"black","line-width":2,"line-opacity":1}},f)),w.includes("olygon")&&(i!==void 0?this.map.addLayer({id:e,type:"fill",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"fill",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"fill-color":"#0000FF","fill-opacity":0}},f)),w.includes("oint")&&(i!==void 0?this.map.addLayer({id:e,type:"circle",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"circle",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"circle-color":"red","circle-opacity":.85}},f)),w.includes("ymbol")&&(i!==void 0?this.map.addLayer({id:e,type:"symbol",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"symbol",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f)),this.addMenuItem(e);else{let x=n;const B={};_.features.forEach(P=>{const R=P.properties[x],N=R+"-userFieldFilter-"+e;R!==null&&(B[N]||(w.includes("ine")&&(i!==void 0?this.map.addLayer({id:N,type:"line",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint,filter:["==",`${x}`,R]},f):this.map.addLayer({id:N,type:"line",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"line-color":"black","line-width":2,"line-opacity":1}},f)),w.includes("olygon")&&(i!==void 0?this.map.addLayer({id:N,type:"fill",source:{type:"geojson",data:_},filter:["==",`${x}`,R],layout:i.layout,paint:i.paint},f):this.map.addLayer({id:N,type:"fill",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"fill-color":"blue","fill-opacity":.6}},f)),w.includes("oint")&&(i!==void 0?this.map.addLayer({id:N,type:"circle",source:{type:"geojson",data:_},filter:["==",`${x}`,R],layout:i.layout,paint:i.paint},f):this.map.addLayer({id:N,type:"circle",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"circle-color":"red","circle-opacity":.85}},f)),B[N]=!0,this.addMenuItem(N)))})}}}catch(s){console.error(`Error fetching data: ${s.message}`)}}on(t,e){setTimeout(()=>{try{return this.map.on(t,e)}catch(n){console.error(`Error adding event ON listener: ${n.message}`)}},100)}setStyle(t,e){try{e!==void 0?this.map.setStyle(t,e):this.map.setStyle(t),this.map.on("styledata",()=>{if(window.document.querySelector(".maplibregl-compact-show")){var n=window.document.querySelector(".maplibregl-compact-show");n.classList.remove("maplibregl-compact-show")}this._dealOrto3dStyle(this.map.getStyle().name)})}catch(n){console.error(`Error setting style: ${n.message}`)}}addControl(t,e){try{e===void 0&&(e="top-right"),this.map.addControl(t,e)}catch(n){console.error(`Error adding control: ${n.message}`)}}setSky(t){try{t===void 0&&(this.map.options.style.includes("orto")&&(t={"sky-color":"#86bbd5","sky-horizon-blend":.3,"horizon-color":"#ffffff33","horizon-fog-blend":.1,"fog-ground-blend":.75,"fog-color":"#c5d6d6"}),this.map.options.style.includes("mapa_estandard_general")&&(t={"sky-color":"#a5f0f0","sky-horizon-blend":.3,"horizon-color":"#e1e3e3","horizon-fog-blend":.9,"fog-ground-blend":.85,"fog-color":"#c5d6d6"}),this.map.options.style.includes("fosc")&&(t={"sky-color":"#232423","sky-horizon-blend":.3,"horizon-color":"#969996","horizon-fog-blend":.9,"fog-ground-blend":.85,"fog-color":"#383838"})),this.map.setSky(t)}catch(e){console.error(`Error setting sky properties: ${e.message}`)}}addMouseCoordControl(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"bottom-left";try{this.map.addControl(new Ait(t),e)}catch(n){console.error(`Error adding mouse coordinate control: ${n.message}`)}}addGeolocateControl(t,e){try{e===void 0&&(e="top-right"),t===void 0?this.map.addControl(new Ps.GeolocateControl({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!0}),e):this.map.addControl(new Ps.GeolocateControl(t),e)}catch(n){console.error(`Error adding geolocate control: ${n.message}`)}}addFullscreenControl(t,e){try{e===void 0&&(e="top-right"),t===void 0?this.map.addControl(new Ps.FullscreenControl({container:HTMLElement}),e):this.map.addControl(new Ps.FullscreenControl(t),e)}catch(n){console.error(`Error adding fullscreen control: ${n.message}`)}}addLayer(t,e){try{this.map.addLayer(t,e)}catch(n){console.error(`Error adding layer: ${n.message}`)}}addImage(t,e,n){try{this.map.addImage(t,e,n)}catch(i){console.error(`Error adding image: ${i.message}`)}return this}addSource(t,e){try{this.map.addSource(t,e)}catch(n){console.error(`Error adding source: ${n.message}`)}return this}addSprite(t,e,n){try{this.map.addSprite(t,e,n)}catch(i){console.error(`Error adding sprite: ${i.message}`)}return this}areTilesLoaded(){return this.map.areTilesLoaded()}cameraForBounds(t,e){return this.map.cameraForBounds(t,e)}easeTo(t,e){return this.map.easeTo(t,e),this}fitBounds(t,e,n){return this.map.fitBounds(t,e,n),this}fitScreenCoordinates(t,e,n,i,s){return this.map.fitScreenCoordinates(t,e,n,i,s),this}flyTo(t,e){return this.map.flyTo(t,e),this}getBearing(){return this.map.getBearing()}getBounds(){return this.map.getBounds()}getCameraTargetElevation(){return this.map.getCameraTargetElevation()}getCanvas(){return this.map.getCanvas()}getCanvasContainer(){return this.map.getCanvasContainer()}getCenter(){return this.map.getCenter()}getContainer(){return this.map.getContainer()}getFeatureState(t){return this.map.getFeatureState(t)}getFilter(t){return this.map.getFilter(t)}getGlyphs(){return this.map.getGlyphs()}getImage(t){return this.map.getImage(t)}getLayer(t){return this.map.getLayer(t)}getLayersOrder(){return this.map.getLayersOrder()}getLayoutProperty(t,e){return this.map.getLayoutProperty(t,e)}getLight(){return this.map.getLight()}getMaxBounds(){return this.map.getMaxBounds()}getMaxPitch(){return this.map.getMaxPitch()}getMaxZoom(){return this.map.getMaxZoom()}getMinPitch(){return this.map.getMinPitch()}getMinZoom(){return this.map.getMinZoom()}getPadding(){return this.map.getPadding()}getPaintProperty(t,e){return this.map.getPaintProperty(t,e)}getPitch(){return this.map.getPitch()}getPixelRatio(){return this.map.getPixelRatio()}getRenderWorldCopies(){return this.map.getRenderWorldCopies()}getSource(t){return this.map.getSource(t)}getSprite(){return this.map.getSprite()}getStyle(){return this.map.getStyle()}getTerrain(){return this.map.getTerrain()}getZoom(){return this.map.getZoom()}hasControl(t){return this.map.hasControl(t)}hasImage(t){return this.map.hasImage(t)}isMoving(){return this.map.isMoving()}isRotating(){return this.map.isRotating()}isSourceLoaded(t){return this.map.isSourceLoaded(t)}isStyleLoaded(){return this.map.isStyleLoaded()}isZooming(){return this.map.isZooming()}jumpTo(t,e){return this.map.jumpTo(t,e)}listImages(){return this.map.listImages()}listens(t){return this.map.listens(t)}loadImage(t){return this.map.loadImage(t)}loaded(){return this.map.loaded()}LngLatBounds(t,e){return new Ps.LngLatBounds(t,e)}addProtocol(t,e){return this.map.addProtocol(t,e)}moveLayer(t,e){return this.map.moveLayer(t,e)}panBy(t,e,n){return this.map.panBy(t,e,n)}panTo(t,e,n){return this.map.panTo(t,e,n)}project(t){return this.map.project(t)}queryRenderedFeatures(t,e){return this.map.queryRenderedFeatures(t,e)}querySourceFeatures(t,e){return this.map.querySourceFeatures(t,e)}queryTerrainElevation(t){return this.map.queryTerrainElevation(t)}redraw(){return this.map.redraw()}remove(){return this.map.remove()}removeControl(t){return this.map.removeControl(t)}removeFeatureState(t,e){return this.map.removeFeatureState(t,e)}removeImage(t){return this.map.removeImage(t)}removeLayer(t){try{this.map.removeLayer(t)}catch(e){console.error(`Error removing layer: ${e.message}`)}}removeSource(t){try{this.map.removeSource(t)}catch(e){console.error(`Error removing source: ${e.message}`)}}removeSprite(t){return this.map.removeSprite(t)}resetNorth(t,e){return this.map.resetNorth(t,e)}resetNorthPitch(t,e){return this.map.resetNorthPitch(t,e)}resize(t){return this.map.resize(t)}rotateTo(t,e,n){return this.map.rotateTo(t,e,n)}setBearing(t,e){return this.map.setBearing(t,e)}setCenter(t,e){return this.map.setCenter(t,e)}setEventedParent(t,e){return this.map.setEventedParent(t,e)}setFeatureState(t,e){return this.map.setFeatureState(t,e)}setFilter(t,e,n){return this.map.setFilter(t,e,n)}setGlyphs(t,e){return this.map.setGlyphs(t,e)}setLayerZoomRange(t,e,n){return this.map.setLayerZoomRange(t,e,n)}setLayoutProperty(t,e,n,i){return this.map.setLayoutProperty(t,e,n,i)}setLight(t,e){return this.map.setLight(t,e)}setMaxBounds(t){return this.map.setMaxBounds(t)}setMaxPitch(t){return this.map.setMaxPitch(t)}setMaxZoom(t){return this.map.setMaxZoom(t)}setMinPitch(t){return this.map.setMinPitch(t)}setMinZoom(t){return this.map.setMinZoom(t)}setPadding(t,e){return this.map.setPadding(t,e)}setPaintProperty(t,e,n,i){return this.map.setPaintProperty(t,e,n,i)}setPitch(t,e){return this.map.setPitch(t,e)}setPixelRatio(t){return this.map.setPixelRatio(t)}setRenderWorldCopies(t){return this.map.setRenderWorldCopies(t)}setSprite(t,e){return this.map.setSprite(t,e)}setTerrain(t){return this.map.setTerrain(t)}setTransformRequest(t){return this.map.setTransformRequest(t)}setZoom(t,e){return this.map.setZoom(t,e)}snapToNorth(t,e){return this.map.snapToNorth(t,e)}stop(){return this.map.stop()}triggerRepaint(){return this.map.triggerRepaint()}unproject(t){return this.map.unproject(t)}updateImage(t,e){return this.map.updateImage(t,e)}zoomIn(t,e){return this.map.zoomIn(t,e)}zoomOut(t,e){return this.map.zoomOut(t,e)}zoomTo(t,e,n){return this.map.zoomTo(t,e,n)}addLayerGeoJSON(t,e){try{let n=this._dealOrderLayer(e);this.map.addSource(`${t.id}`,{type:"geojson",data:t.data}),this.map.addLayer({id:`${t.id}-layerIcgcMap`,type:t.type,source:`${t.id}`,layout:t.layout,paint:t.paint},n)}catch(n){console.error(`Error adding GeoJSON layer: ${n.message}`)}}addLayerWMS(t,e,n){try{let i=this._dealOrderLayer(n.layerPosition);n?(this.map.addSource(`${e}`,{type:"raster",tiles:[t],tileSize:256},i),this.map.addLayer({id:e,type:"raster",source:e,layout:n.layout,paint:n.paint},i)):(this.map.addSource(`${e}`,{type:"raster",tiles:[t],tileSize:256},i),this.map.addLayer({id:e,type:"raster",source:e,paint:{}},i))}catch(i){console.error(`Error adding WMS layer: ${i.message}`)}}addLogo(t){try{let e=document.getElementById("map"),n;n=document.createElement("div"),n.id="logos",e.appendChild(n);const i=document.createElement("img");i.src=t.url,i.style.height=t.height;const s=document.getElementById("logos"),a=document.createElement("a");a.id=t.id,a.href=t.href,a.target="_blank",a.style.position="relative",a.style.bottom="1px",a.appendChild(i),s.appendChild(a)}catch(e){console.error(`Error adding logo: ${e.message}`)}}addBasemapsICGC(t){try{const e=a=>{this.map.setStyle(a)};let n=document.getElementById("map"),i;i=document.createElement("div"),i.id="basemap-group",i.classList.add="filter-group",n.appendChild(i);const s=document.getElementById("basemap-group");for(const a of t)for(const o of Object.keys(Ln.baseStyles)){const d=Ln.baseStyles[o];if(a===d.url){const f=document.createElement("div");f.className="basemap-item",f.title=d.key,f.style.backgroundImage=`url('${d.image}')`,s.appendChild(f),f.addEventListener("click",()=>e(d.url))}}}catch(e){console.error(`Error adding basemaps: ${e.message}`)}}addBasemaps(t){try{const e=a=>{map.setStyle(a.url)};let n=document.getElementById("map"),i;i=document.createElement("div"),i.id="basemap-group",i.classList.add="basemap-group",n.appendChild(i);const s=document.getElementById("basemap-group");t.forEach(a=>{const o=document.createElement("div");o.className="basemap-item",o.title=a.label,o.style.backgroundImage=`url('${a.image}')`,s.appendChild(o),o.addEventListener("click",()=>e(a))})}catch(e){console.error(`Error adding basemaps: ${e.message}`)}}addFeatureQuery(t,e,n){try{let i;this.map.on("mouseenter",t,()=>{this.map.getCanvas().style.cursor="pointer"}),this.map.on("mouseleave",t,()=>{this.map.getCanvas().style.cursor=""}),this.map.on("click",s=>{let a=this.map.queryRenderedFeatures(s.point);if(a&&a[0].source.includes(t)){let o=[s.lngLat.lng,s.lngLat.lat];if(e!==void 0&&e.length>0&&e!=="all"){if(e!==null){let d="";e.forEach(f=>{let _=a[0].properties[f];d=d+`<h4>${_}</h4>`}),i=d,this.addPopup(o,i,n)}}else{let d="";for(const f in a[0].properties)d+="<b>"+f+"</b>:"+a[0].properties[f]+"<br>";i=d,this.addPopup(o,i,n)}}})}catch(i){console.error(`Error adding feature query: ${i.message}`)}}addScaleControl(t,e){try{var n=new Ps.ScaleControl(t);this.map.addControl(n,e)}catch(i){console.error(`Error adding scale: ${i.message}`)}}addExportControl(t,e){try{typeof t=="string"&&(e=t,t=void 0),t===void 0&&(t={PageSize:Xh.A4,PageOrientation:Vg.Landscape,Format:Ku.PNG,DPI:I2[300],Crosshair:!0,PrintableArea:!0,Local:"ca"},e="top-right"),this.map.addControl(new gnt(t),e)}catch(n){console.error(`Error adding export control: ${n.message}`)}}addMarker(t){try{let e,n;return t.text===void 0?e=new Ps.Marker(t.options).setLngLat(t.coord).addTo(this.map):(n=new Ps.Popup({offset:t.textOffset}).setHTML(t.text),e=new Ps.Marker(t.options).setLngLat(t.coord).setPopup(n).addTo(this.map)),e}catch(e){return console.error(`Error adding marker: ${e.message}`),null}}addPopup(t,e,n){try{return n.image===void 0?new Ps.Popup().setLngLat(t).setHTML(`
2582
+ `+s):n.stack=s}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=nd(this.defaults,e);const{transitional:n,paramsSerializer:i,headers:s}=e;n!==void 0&&mx.assertOptions(n,{silentJSONParsing:YA.transitional(YA.boolean),forcedJSONParsing:YA.transitional(YA.boolean),clarifyTimeoutError:YA.transitional(YA.boolean)},!1),i!=null&&(fe.isFunction(i)?e.paramsSerializer={serialize:i}:mx.assertOptions(i,{encode:YA.function,serialize:YA.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&fe.merge(s.common,s[e.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),e.headers=pa.concat(a,s);const o=[];let d=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(e)===!1||(d=d&&R.synchronous,o.unshift(R.fulfilled,R.rejected))});const f=[];this.interceptors.response.forEach(function(R){f.push(R.fulfilled,R.rejected)});let _,w=0,x;if(!d){const P=[UM.bind(this),void 0];for(P.unshift.apply(P,o),P.push.apply(P,f),x=P.length,_=Promise.resolve(e);w<x;)_=_.then(P[w++],P[w++]);return _}x=o.length;let B=e;for(w=0;w<x;){const P=o[w++],R=o[w++];try{B=P(B)}catch(N){R.call(this,N);break}}try{_=UM.call(this,B)}catch(P){return Promise.reject(P)}for(w=0,x=f.length;w<x;)_=_.then(f[w++],f[w++]);return _}getUri(t){t=nd(this.defaults,t);const e=EM(t.baseURL,t.url);return mM(e,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){id.prototype[t]=function(e,n){return this.request(nd(n||{},{method:t,url:e,data:(n||{}).data}))}}),fe.forEach(["post","put","patch"],function(t){function e(n){return function(s,a,o){return this.request(nd(o||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}id.prototype[t]=e(),id.prototype[t+"Form"]=e(!0)});class yx{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(s){e=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(i);return a.cancel=function(){n.unsubscribe(s)},a},t(function(s,a,o){n.reason||(n.reason=new Hf(s,a,o),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new yx(function(i){t=i}),cancel:t}}}function Lst(r){return function(e){return r.apply(null,e)}}function Pst(r){return fe.isObject(r)&&r.isAxiosError===!0}const _x={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(_x).forEach(r=>{let[t,e]=r;_x[e]=t});function NM(r){const t=new id(r),e=eM(id.prototype.request,t);return fe.extend(e,id.prototype,t,{allOwnKeys:!0}),fe.extend(e,t,null,{allOwnKeys:!0}),e.create=function(i){return NM(nd(r,i))},e}const is=NM(Jg);is.Axios=id,is.CanceledError=Hf,is.CancelToken=yx,is.isCancel=wM,is.VERSION=OM,is.toFormData=t1,is.AxiosError=ln,is.Cancel=is.CanceledError,is.all=function(t){return Promise.all(t)},is.spread=Lst,is.isAxiosError=Pst,is.mergeConfig=nd,is.AxiosHeaders=pa,is.formToJSON=r=>vM(fe.isHTMLForm(r)?new FormData(r):r),is.getAdapter=RM.getAdapter,is.HttpStatusCode=_x,is.default=is;const Mst="https://eines.icgc.cat/recursos/mapicgc-gl-js/mapicgc-config.json",Rst=5e3;class kM{static async getConfigICGC(){try{const t=await is.get(Mst,{timeout:Rst});return t.data?t.data:(console.log("Resposta sense dades:",t),ed)}catch(t){return t.response?(console.error("Error de resposta:",t.response.data),console.error("Codi d'estat:",t.response.status)):t.request?console.error("No s'ha rebut resposta del servidor:",t.request):console.error("Error:",t.message),ed}}}const Ust={cobertesSol:{"fill-opacity":["interpolate",["exponential",.5],["zoom"],13.5,1,18,.4],"fill-outline-color":"rgba(0,0, 0, 0)","fill-color":["interpolate",["cubic-bezier",.5,1,1,1],["get","nivell_2"],0,"#ffffff",111,"#ffff00",112,"#ccff33",113,"#af5b15",114,"#808000",115,"#cdcd00",116,"#ffffcc",221,"#33cc33",222,"#66ff33",223,"#689018",224,"#967d5f",225,"#19e61e",226,"#b4ff9b",227,"#aaa500",228,"#c3c3a0",229,"#00ff9b",230,"#ff9632",231,"#282828",232,"#79797a",233,"#f5df78",234,"#3296ff",341,"#ff007d",342,"#ff53cd",343,"#ffa4e2",344,"#ffc8e2",345,"#ffb4b4",346,"#0f3700",347,"#730055",348,"#6200c4",349,"#4a9595",350,"#ff00f0",351,"#adaaca",352,"#ffe6e6",353,"#67629a",354,"#4a466e",355,"#2f2d46",461,"#6f6fff",462,"#0000dc",463,"#000064",464,"#185f94",465,"#12466d",466,"#000080"]}},Ost="lines",s1="labels";let sd,Zg,ki,Ln,Dst=class{constructor(t){kM.getConfigICGC().then(e=>{sd={...e.Styles},ki={...e.Layers},Zg={...e.Terrains},Ln={...e.defaultOptions},this.initTheMap(t)}).catch(e=>{console.info("Configuracio per defecte",e),sd={...ed.Styles},ki={...ed.Layers},Zg={...ed.Terrains},Ln={...ed.defaultOptions},this.initTheMap(t)})}initTheMap(t){if(!t)t=Ln.mapOptions;else for(const n in Ln.mapOptions){let i=[Ln.mapOptions.center[0],Ln.mapOptions.center[1]];Ln.mapOptions.center=i,t.hasOwnProperty(n)||(t[n]=Ln.mapOptions[n])}t.maxPitch=85,t.maplibreLogo=!1,t.attributionControl=!1;const e=t.style.includes("https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/");e?(this.map=new Ps.Map({container:t.container,center:t.center,zoom:t.zoom,pitch:t.pitch||0,hash:t.hash||!1,style:{version:8,sources:{},layers:[]}}),this.map.on("load",()=>{this.map.addSource("raster-source",{type:"raster",tiles:[t.style],tileSize:256}),this.map.addLayer({id:"raster-layer",type:"raster",source:"raster-source"})})):this.map=new Ps.Map(t),this.map.on("load",()=>{if(!e){const n=this.map.getStyle().name,i=t.style;this.map.addControl(new ait({color:i.indexOf("orto")===-1,defaultOptions:Ln}),"bottom-left"),this._dealOrto3dStyle(n)}})}addGeocoderICGC(t){try{t===void 0&&(t="top-right");let e={collapsed:!0,marker:!0,popup:!0,showResultMarkers:!0,maplibregl:Ps,showResultsWhileTyping:!0,minLength:2};const n={forwardGeocode:async s=>{const a=[];try{const o=Ln.geocoder.peliasUrl1+encodeURIComponent(s.query)+Ln.geocoder.peliasUrl2,f=await(await fetch(o)).json();for(const _ of f.features){const w=_.geometry.coordinates,x={type:"Feature",geometry:{type:"Point",coordinates:w},place_name:_.properties.etiqueta,properties:_.properties,text:_.properties.etiqueta,place_type:["place"],center:w};a.push(x)}}catch(o){console.error(`Failed to forwardGeocode with error: ${o}`)}return{features:a}}};this.map.addControl(new oit(n,e),t);let i=document.getElementsByClassName("maplibregl-ctrl-geocoder--input");i[0].attributes[2].nodeValue="Cerca...",i[0].addEventListener("input",function(s){s.target.value.length>3})}catch(e){console.error(`Error adding ICGC geocoder: ${e.message}`)}}async loadImage(t){try{return this.map.loadImage(t)}catch(e){console.error(`Error getting loadImage: ${e.message}`)}}getConfigStyles(){try{let t=[];for(const e of sd)t.push(e.name);return t}catch(t){console.error(`Error retrieving base styles: ${t.message}`)}}getConfigWMSLayers(){try{let t=[];for(const e in ki.WMS)ki.WMS.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving WMS layers: ${t.message}`)}}getConfigOrtoLayers(){try{let t=[];for(const e in ki.Orto)ki.Orto.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving orto image layers: ${t.message}`)}}getConfigVectorLayers(){try{let t=[];for(const e in ki.Vector)ki.Vector.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving vector layers: ${t.message}`)}}getConfigVectorAdminLayers(){try{let t=[];for(const e in ki.VectorAdmin)ki.VectorAdmin.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving vectorAdmin layers: ${t.message}`)}}getConfigFGBAdminLayers(){try{let t=[];for(const e in ki.FGBAdmin)ki.FGBAdmin.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving FGBAdmin layers: ${t.message}`)}}async fetchData(t,e,n){try{(!n||n===void 0)&&(n={type:"line",layout:{visibility:"visible"},paint:{"line-color":"grey","line-width":2},layerPosition:"top"});let i=n.layerPosition;if(t.includes(".fgb"))this.addFGBLayerICGC(t,e,n);else{const a=await(await fetch(t)).json();let o=e,d=this._dealOrderLayer(i),f=a.features[0].geometry.type;f.includes("ine")&&(n!==void 0?this.map.addLayer({id:o,type:"line",source:{type:"geojson",data:a},layout:n.layout||{},paint:n.paint||{}},d):this.map.addLayer({id:o,type:"line",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"line-color":"black","line-width":2,"line-opacity":1}},d)),f.includes("olygon")&&(n!==void 0?this.map.addLayer({id:o,type:"fill",source:{type:"geojson",data:a},layout:n.layout,paint:n.paint},d):this.map.addLayer({id:o,type:"fill",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"fill-color":"blue","fill-opacity":.6}},d)),f.includes("oint")&&(n!==void 0?this.map.addLayer({id:o,type:"circle",source:{type:"geojson",data:a},layout:n.layout,paint:n.paint},d):this.map.addLayer({id:o,type:"circle",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"circle-color":"red","circle-opacity":.85}},d))}}catch(i){console.error(`Error fetching data: ${i.message}`)}}async fetchDataAndMenu(t,e,n,i){try{let s;i!==null?s=i.layerPosition:s=s1;let a,o=document.getElementById("map");if(document.getElementById("menu-group")?a=document.getElementById("menu-group"):(a=document.createElement("nav"),a.id="menu-group",a.classList.add="filter-group",o.appendChild(a)),a!==null){let d="visible",f=this._dealOrderLayer(s),_;if(t.includes(".fgb")){let x=this._getKeyByUrlFGB(t);x===null&&(x="userFGB");const B=await fetch(t),P={type:"FeatureCollection",features:[]};for await(const N of HS(B.body))P.features.push(N);_=P;let R=e;if(this.map.addSource(R,{type:"geojson",data:P}),t.includes("text"))i!==void 0?this.map.addLayer({id:e,type:"symbol",source:R,layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"symbol",source:R,layout:{"text-letter-spacing":.1,"text-size":{base:1.2,stops:[[8,0],[12,14],[15,15]]},"text-font":["FiraSans-Regular"],"text-field":["get","NOM_AC"],"text-transform":"none","text-max-width":25,visibility:d,"text-justify":"right","text-anchor":"top","text-allow-overlap":!1,"symbol-spacing":2,"text-line-height":1},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f);else{let N=e+"Text";this.map.addLayer({id:N,type:"symbol",source:R,layout:{"text-letter-spacing":.1,"text-size":{base:1.2,stops:[[8,0],[12,14],[15,15]]},"text-font":["FiraSans-Regular"],"text-field":["get","NOM_AC"],"text-transform":"none","text-max-width":25,visibility:d,"text-justify":"right","text-anchor":"top","text-allow-overlap":!1,"symbol-spacing":2,"text-line-height":1},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f)}}else _=await(await fetch(t)).json();if(n!=="all"){const x=document.createElement("div");x.id="titleDivMenu",x.textContent=e,a.appendChild(x);const B=document.createElement("div");B.id="titleDivMenuSub",B.textContent=`📂 ${n}`,a.appendChild(B)}let w;if(i.type?w=i.type:w=_.features[0].geometry.type,n==="all")w.includes("ine")&&(i!==void 0?this.map.addLayer({id:e,type:"line",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"line",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"line-color":"black","line-width":2,"line-opacity":1}},f)),w.includes("olygon")&&(i!==void 0?this.map.addLayer({id:e,type:"fill",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"fill",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"fill-color":"#0000FF","fill-opacity":0}},f)),w.includes("oint")&&(i!==void 0?this.map.addLayer({id:e,type:"circle",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"circle",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"circle-color":"red","circle-opacity":.85}},f)),w.includes("ymbol")&&(i!==void 0?this.map.addLayer({id:e,type:"symbol",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"symbol",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f)),this.addMenuItem(e);else{let x=n;const B={};_.features.forEach(P=>{const R=P.properties[x],N=R+"-userFieldFilter-"+e;R!==null&&(B[N]||(w.includes("ine")&&(i!==void 0?this.map.addLayer({id:N,type:"line",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint,filter:["==",`${x}`,R]},f):this.map.addLayer({id:N,type:"line",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"line-color":"black","line-width":2,"line-opacity":1}},f)),w.includes("olygon")&&(i!==void 0?this.map.addLayer({id:N,type:"fill",source:{type:"geojson",data:_},filter:["==",`${x}`,R],layout:i.layout,paint:i.paint},f):this.map.addLayer({id:N,type:"fill",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"fill-color":"blue","fill-opacity":.6}},f)),w.includes("oint")&&(i!==void 0?this.map.addLayer({id:N,type:"circle",source:{type:"geojson",data:_},filter:["==",`${x}`,R],layout:i.layout,paint:i.paint},f):this.map.addLayer({id:N,type:"circle",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"circle-color":"red","circle-opacity":.85}},f)),B[N]=!0,this.addMenuItem(N)))})}}}catch(s){console.error(`Error fetching data: ${s.message}`)}}on(t,e){setTimeout(()=>{try{return this.map.on(t,e)}catch(n){console.error(`Error adding event ON listener: ${n.message}`)}},100)}setStyle(t,e){try{e!==void 0?this.map.setStyle(t,e):this.map.setStyle(t),this.map.on("styledata",()=>{if(window.document.querySelector(".maplibregl-compact-show")){var n=window.document.querySelector(".maplibregl-compact-show");n.classList.remove("maplibregl-compact-show")}this._dealOrto3dStyle(this.map.getStyle().name)})}catch(n){console.error(`Error setting style: ${n.message}`)}}addControl(t,e){try{e===void 0&&(e="top-right"),this.map.addControl(t,e)}catch(n){console.error(`Error adding control: ${n.message}`)}}setSky(t){try{t===void 0&&(this.map.style.stylesheet.id.includes("orto")?t={"sky-color":"#86bbd5","sky-horizon-blend":.3,"horizon-color":"#ffffff33","horizon-fog-blend":.1,"fog-ground-blend":.75,"fog-color":"#c5d6d6"}:this.map.style.stylesheet.id.includes("mapa_estandard_general")?t={"sky-color":"#a5f0f0","sky-horizon-blend":.3,"horizon-color":"#e1e3e3","horizon-fog-blend":.9,"fog-ground-blend":.85,"fog-color":"#c5d6d6"}:this.map.style.stylesheet.id.includes("icgc_mapa_vissir")?t={"sky-color":"#a5f0f0","sky-horizon-blend":.3,"horizon-color":"#e1e3e3","horizon-fog-blend":.9,"fog-ground-blend":.85,"fog-color":"#c5d6d6"}:this.map.style.stylesheet.id.includes("fosc")?t={"sky-color":"#232423","sky-horizon-blend":.3,"horizon-color":"#969996","horizon-fog-blend":.9,"fog-ground-blend":.85,"fog-color":"#383838"}:t={"sky-color":"#86bbd5","sky-horizon-blend":.3,"horizon-color":"#ffffff33","horizon-fog-blend":.1,"fog-ground-blend":.75,"fog-color":"#c5d6d6"}),this.map.setSky(t)}catch(e){console.error(`Error setting sky properties: ${e.message}`)}}addMouseCoordControl(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"bottom-left";try{this.map.addControl(new Ait(t),e)}catch(n){console.error(`Error adding mouse coordinate control: ${n.message}`)}}addGeolocateControl(t,e){try{e===void 0&&(e="top-right"),t===void 0?this.map.addControl(new Ps.GeolocateControl({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!0}),e):this.map.addControl(new Ps.GeolocateControl(t),e)}catch(n){console.error(`Error adding geolocate control: ${n.message}`)}}addFullscreenControl(t,e){try{e===void 0&&(e="top-right"),t===void 0?this.map.addControl(new Ps.FullscreenControl({container:HTMLElement}),e):this.map.addControl(new Ps.FullscreenControl(t),e)}catch(n){console.error(`Error adding fullscreen control: ${n.message}`)}}addLayer(t,e){try{this.map.addLayer(t,e)}catch(n){console.error(`Error adding layer: ${n.message}`)}}addImage(t,e,n){try{this.map.addImage(t,e,n)}catch(i){console.error(`Error adding image: ${i.message}`)}return this}addSource(t,e){try{this.map.addSource(t,e)}catch(n){console.error(`Error adding source: ${n.message}`)}return this}addSprite(t,e,n){try{this.map.addSprite(t,e,n)}catch(i){console.error(`Error adding sprite: ${i.message}`)}return this}areTilesLoaded(){return this.map.areTilesLoaded()}cameraForBounds(t,e){return this.map.cameraForBounds(t,e)}easeTo(t,e){return this.map.easeTo(t,e),this}fitBounds(t,e,n){return this.map.fitBounds(t,e,n),this}fitScreenCoordinates(t,e,n,i,s){return this.map.fitScreenCoordinates(t,e,n,i,s),this}flyTo(t,e){return this.map.flyTo(t,e),this}getBearing(){return this.map.getBearing()}getBounds(){return this.map.getBounds()}getCameraTargetElevation(){return this.map.getCameraTargetElevation()}getCanvas(){return this.map.getCanvas()}getCanvasContainer(){return this.map.getCanvasContainer()}getCenter(){return this.map.getCenter()}getContainer(){return this.map.getContainer()}getFeatureState(t){return this.map.getFeatureState(t)}getFilter(t){return this.map.getFilter(t)}getGlyphs(){return this.map.getGlyphs()}getImage(t){return this.map.getImage(t)}getLayer(t){return this.map.getLayer(t)}getLayersOrder(){return this.map.getLayersOrder()}getLayoutProperty(t,e){return this.map.getLayoutProperty(t,e)}getLight(){return this.map.getLight()}getMaxBounds(){return this.map.getMaxBounds()}getMaxPitch(){return this.map.getMaxPitch()}getMaxZoom(){return this.map.getMaxZoom()}getMinPitch(){return this.map.getMinPitch()}getMinZoom(){return this.map.getMinZoom()}getPadding(){return this.map.getPadding()}getPaintProperty(t,e){return this.map.getPaintProperty(t,e)}getPitch(){return this.map.getPitch()}getPixelRatio(){return this.map.getPixelRatio()}getRenderWorldCopies(){return this.map.getRenderWorldCopies()}getSource(t){return this.map.getSource(t)}getSprite(){return this.map.getSprite()}getStyle(){return this.map.getStyle()}getTerrain(){return this.map.getTerrain()}getZoom(){return this.map.getZoom()}hasControl(t){return this.map.hasControl(t)}hasImage(t){return this.map.hasImage(t)}isMoving(){return this.map.isMoving()}isRotating(){return this.map.isRotating()}isSourceLoaded(t){return this.map.isSourceLoaded(t)}isStyleLoaded(){return this.map.isStyleLoaded()}isZooming(){return this.map.isZooming()}jumpTo(t,e){return this.map.jumpTo(t,e)}listImages(){return this.map.listImages()}listens(t){return this.map.listens(t)}loadImage(t){return this.map.loadImage(t)}loaded(){return this.map.loaded()}LngLatBounds(t,e){return new Ps.LngLatBounds(t,e)}addProtocol(t,e){return this.map.addProtocol(t,e)}moveLayer(t,e){return this.map.moveLayer(t,e)}panBy(t,e,n){return this.map.panBy(t,e,n)}panTo(t,e,n){return this.map.panTo(t,e,n)}project(t){return this.map.project(t)}queryRenderedFeatures(t,e){return this.map.queryRenderedFeatures(t,e)}querySourceFeatures(t,e){return this.map.querySourceFeatures(t,e)}queryTerrainElevation(t){return this.map.queryTerrainElevation(t)}redraw(){return this.map.redraw()}remove(){return this.map.remove()}removeControl(t){return this.map.removeControl(t)}removeFeatureState(t,e){return this.map.removeFeatureState(t,e)}removeImage(t){return this.map.removeImage(t)}removeLayer(t){try{this.map.removeLayer(t)}catch(e){console.error(`Error removing layer: ${e.message}`)}}removeSource(t){try{this.map.removeSource(t)}catch(e){console.error(`Error removing source: ${e.message}`)}}removeSprite(t){return this.map.removeSprite(t)}resetNorth(t,e){return this.map.resetNorth(t,e)}resetNorthPitch(t,e){return this.map.resetNorthPitch(t,e)}resize(t){return this.map.resize(t)}rotateTo(t,e,n){return this.map.rotateTo(t,e,n)}setBearing(t,e){return this.map.setBearing(t,e)}setCenter(t,e){return this.map.setCenter(t,e)}setEventedParent(t,e){return this.map.setEventedParent(t,e)}setFeatureState(t,e){return this.map.setFeatureState(t,e)}setFilter(t,e,n){return this.map.setFilter(t,e,n)}setGlyphs(t,e){return this.map.setGlyphs(t,e)}setLayerZoomRange(t,e,n){return this.map.setLayerZoomRange(t,e,n)}setLayoutProperty(t,e,n,i){return this.map.setLayoutProperty(t,e,n,i)}setLight(t,e){return this.map.setLight(t,e)}setMaxBounds(t){return this.map.setMaxBounds(t)}setMaxPitch(t){return this.map.setMaxPitch(t)}setMaxZoom(t){return this.map.setMaxZoom(t)}setMinPitch(t){return this.map.setMinPitch(t)}setMinZoom(t){return this.map.setMinZoom(t)}setPadding(t,e){return this.map.setPadding(t,e)}setPaintProperty(t,e,n,i){return this.map.setPaintProperty(t,e,n,i)}setPitch(t,e){return this.map.setPitch(t,e)}setPixelRatio(t){return this.map.setPixelRatio(t)}setRenderWorldCopies(t){return this.map.setRenderWorldCopies(t)}setSprite(t,e){return this.map.setSprite(t,e)}setTerrain(t){return this.map.setTerrain(t)}setTransformRequest(t){return this.map.setTransformRequest(t)}setZoom(t,e){return this.map.setZoom(t,e)}snapToNorth(t,e){return this.map.snapToNorth(t,e)}stop(){return this.map.stop()}triggerRepaint(){return this.map.triggerRepaint()}unproject(t){return this.map.unproject(t)}updateImage(t,e){return this.map.updateImage(t,e)}zoomIn(t,e){return this.map.zoomIn(t,e)}zoomOut(t,e){return this.map.zoomOut(t,e)}zoomTo(t,e,n){return this.map.zoomTo(t,e,n)}addLayerGeoJSON(t,e){try{let n=this._dealOrderLayer(e);this.map.addSource(`${t.id}`,{type:"geojson",data:t.data}),this.map.addLayer({id:`${t.id}-layerIcgcMap`,type:t.type,source:`${t.id}`,layout:t.layout,paint:t.paint},n)}catch(n){console.error(`Error adding GeoJSON layer: ${n.message}`)}}addLayerWMS(t,e,n){try{let i=this._dealOrderLayer(n.layerPosition);n?(this.map.addSource(`${e}`,{type:"raster",tiles:[t],tileSize:256},i),this.map.addLayer({id:e,type:"raster",source:e,layout:n.layout,paint:n.paint},i)):(this.map.addSource(`${e}`,{type:"raster",tiles:[t],tileSize:256},i),this.map.addLayer({id:e,type:"raster",source:e,paint:{}},i))}catch(i){console.error(`Error adding WMS layer: ${i.message}`)}}addLogo(t){try{let e=document.getElementById("map"),n;n=document.createElement("div"),n.id="logos",e.appendChild(n);const i=document.createElement("img");i.src=t.url,i.style.height=t.height;const s=document.getElementById("logos"),a=document.createElement("a");a.id=t.id,a.href=t.href,a.target="_blank",a.style.position="relative",a.style.bottom="1px",a.appendChild(i),s.appendChild(a)}catch(e){console.error(`Error adding logo: ${e.message}`)}}addBasemapsICGC(t){try{const e=a=>{this.map.setStyle(a)};let n=document.getElementById("map"),i;i=document.createElement("div"),i.id="basemap-group",i.classList.add="filter-group",n.appendChild(i);const s=document.getElementById("basemap-group");for(const a of t)for(const o of Object.keys(Ln.baseStyles)){const d=Ln.baseStyles[o];if(a===d.url){const f=document.createElement("div");f.className="basemap-item",f.title=d.key,f.style.backgroundImage=`url('${d.image}')`,s.appendChild(f),f.addEventListener("click",()=>e(d.url))}}}catch(e){console.error(`Error adding basemaps: ${e.message}`)}}addBasemaps(t){try{const e=a=>{map.setStyle(a.url)};let n=document.getElementById("map"),i;i=document.createElement("div"),i.id="basemap-group",i.classList.add="basemap-group",n.appendChild(i);const s=document.getElementById("basemap-group");t.forEach(a=>{const o=document.createElement("div");o.className="basemap-item",o.title=a.label,o.style.backgroundImage=`url('${a.image}')`,s.appendChild(o),o.addEventListener("click",()=>e(a))})}catch(e){console.error(`Error adding basemaps: ${e.message}`)}}addFeatureQuery(t,e,n){try{let i;this.map.on("mouseenter",t,()=>{this.map.getCanvas().style.cursor="pointer"}),this.map.on("mouseleave",t,()=>{this.map.getCanvas().style.cursor=""}),this.map.on("click",s=>{let a=this.map.queryRenderedFeatures(s.point);if(a&&a[0].source.includes(t)){let o=[s.lngLat.lng,s.lngLat.lat];if(e!==void 0&&e.length>0&&e!=="all"){if(e!==null){let d="";e.forEach(f=>{let _=a[0].properties[f];d=d+`<h4>${_}</h4>`}),i=d,this.addPopup(o,i,n)}}else{let d="";for(const f in a[0].properties)d+="<b>"+f+"</b>:"+a[0].properties[f]+"<br>";i=d,this.addPopup(o,i,n)}}})}catch(i){console.error(`Error adding feature query: ${i.message}`)}}addScaleControl(t,e){try{var n=new Ps.ScaleControl(t);this.map.addControl(n,e)}catch(i){console.error(`Error adding scale: ${i.message}`)}}addExportControl(t,e){try{typeof t=="string"&&(e=t,t=void 0),t===void 0&&(t={PageSize:Xh.A4,PageOrientation:Vg.Landscape,Format:Ku.PNG,DPI:I2[300],Crosshair:!0,PrintableArea:!0,Local:"ca"},e="top-right"),this.map.addControl(new gnt(t),e)}catch(n){console.error(`Error adding export control: ${n.message}`)}}addMarker(t){try{let e,n;return t.text===void 0?e=new Ps.Marker(t.options).setLngLat(t.coord).addTo(this.map):(n=new Ps.Popup({offset:t.textOffset}).setHTML(t.text),e=new Ps.Marker(t.options).setLngLat(t.coord).setPopup(n).addTo(this.map)),e}catch(e){return console.error(`Error adding marker: ${e.message}`),null}}addPopup(t,e,n){try{return n.image===void 0?new Ps.Popup().setLngLat(t).setHTML(`
2583
2583
  <div class="popupBody">
2584
2584
  <div class="popupTop">
2585
2585
  ${n.title}
@@ -1,4 +1,4 @@
1
- import { C as p, a as s, M as r } from "./index-D3-Uc9f8.mjs";
1
+ import { C as p, a as s, M as r } from "./index-DMlHD4NY.mjs";
2
2
  export {
3
3
  p as CompareMaps,
4
4
  s as Config,
@@ -2579,7 +2579,7 @@ end`};t.events.push(["putFont",function(s){(function(a){var o=a.font,d=a.out,f=a
2579
2579
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t){const e=new this(t);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return i.forEach(a=>e.set(a)),e}static accessor(t){const n=(this[bM]=this[bM]={accessors:{}}).accessors,i=this.prototype;function s(a){const o=Yg(a);n[o]||(fst(i,a),n[o]=!0)}return fe.isArray(t)?t.forEach(s):s(t),this}}pa.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(pa.prototype,(r,t)=>{let{value:e}=r,n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[n]=i}}}),fe.freezeMethods(pa);function Ax(r,t){const e=this||Jg,n=t||e,i=pa.from(n.headers);let s=n.data;return fe.forEach(r,function(o){s=o.call(e,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function wM(r){return!!(r&&r.__CANCEL__)}function Hf(r,t,e){ln.call(this,r??"canceled",ln.ERR_CANCELED,t,e),this.name="CanceledError"}fe.inherits(Hf,ln,{__CANCEL__:!0});function xM(r,t,e){const n=e.config.validateStatus;!e.status||!n||n(e.status)?r(e):t(new ln("Request failed with status code "+e.status,[ln.ERR_BAD_REQUEST,ln.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}function pst(r){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return t&&t[1]||""}function gst(r,t){r=r||10;const e=new Array(r),n=new Array(r);let i=0,s=0,a;return t=t!==void 0?t:1e3,function(d){const f=Date.now(),_=n[s];a||(a=f),e[i]=d,n[i]=f;let w=s,x=0;for(;w!==i;)x+=e[w++],w=w%r;if(i=(i+1)%r,i===s&&(s=(s+1)%r),f-a<t)return;const B=_&&f-_;return B?Math.round(x*1e3/B):void 0}}function mst(r,t){let e=0,n=1e3/t,i,s;const a=function(f){e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Date.now(),i=null,s&&(clearTimeout(s),s=null),r.apply(null,f)};return[function(){const f=Date.now(),_=f-e;for(var w=arguments.length,x=new Array(w),B=0;B<w;B++)x[B]=arguments[B];_>=n?a(x,f):(i=x,s||(s=setTimeout(()=>{s=null,a(i)},n-_)))},()=>i&&a(i)]}const r1=function(r,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:3,n=0;const i=gst(50,250);return mst(s=>{const a=s.loaded,o=s.lengthComputable?s.total:void 0,d=a-n,f=i(d),_=a<=o;n=a;const w={loaded:a,total:o,progress:o?a/o:void 0,bytes:d,rate:f||void 0,estimated:f&&o&&_?(o-a)/f:void 0,event:s,lengthComputable:o!=null,[t?"download":"upload"]:!0};r(w)},e)},BM=(r,t)=>{const e=r!=null;return[n=>t[0]({lengthComputable:e,total:r,loaded:n}),t[1]]},CM=r=>function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return fe.asap(()=>r(...e))},yst=sc.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let n;function i(s){let a=s;return t&&(e.setAttribute("href",a),a=e.href),e.setAttribute("href",a),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return n=i(window.location.href),function(a){const o=fe.isString(a)?i(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}(),_st=sc.hasStandardBrowserEnv?{write(r,t,e,n,i,s){const a=[r+"="+encodeURIComponent(t)];fe.isNumber(e)&&a.push("expires="+new Date(e).toGMTString()),fe.isString(n)&&a.push("path="+n),fe.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(r){const t=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function vst(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function bst(r,t){return t?r.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):r}function EM(r,t){return r&&!vst(t)?bst(r,t):t}const SM=r=>r instanceof pa?{...r}:r;function nd(r,t){t=t||{};const e={};function n(f,_,w){return fe.isPlainObject(f)&&fe.isPlainObject(_)?fe.merge.call({caseless:w},f,_):fe.isPlainObject(_)?fe.merge({},_):fe.isArray(_)?_.slice():_}function i(f,_,w){if(fe.isUndefined(_)){if(!fe.isUndefined(f))return n(void 0,f,w)}else return n(f,_,w)}function s(f,_){if(!fe.isUndefined(_))return n(void 0,_)}function a(f,_){if(fe.isUndefined(_)){if(!fe.isUndefined(f))return n(void 0,f)}else return n(void 0,_)}function o(f,_,w){if(w in t)return n(f,_);if(w in r)return n(void 0,f)}const d={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(f,_)=>i(SM(f),SM(_),!0)};return fe.forEach(Object.keys(Object.assign({},r,t)),function(_){const w=d[_]||i,x=w(r[_],t[_],_);fe.isUndefined(x)&&w!==o||(e[_]=x)}),e}const TM=r=>{const t=nd({},r);let{data:e,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:o}=t;t.headers=a=pa.from(a),t.url=mM(EM(t.baseURL,t.url),r.params,r.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let d;if(fe.isFormData(e)){if(sc.hasStandardBrowserEnv||sc.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((d=a.getContentType())!==!1){const[f,..._]=d?d.split(";").map(w=>w.trim()).filter(Boolean):[];a.setContentType([f||"multipart/form-data",..._].join("; "))}}if(sc.hasStandardBrowserEnv&&(n&&fe.isFunction(n)&&(n=n(t)),n||n!==!1&&yst(t.url))){const f=i&&s&&_st.read(s);f&&a.set(i,f)}return t},wst=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(e,n){const i=TM(r);let s=i.data;const a=pa.from(i.headers).normalize();let{responseType:o,onUploadProgress:d,onDownloadProgress:f}=i,_,w,x,B,P;function R(){B&&B(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(_),i.signal&&i.signal.removeEventListener("abort",_)}let N=new XMLHttpRequest;N.open(i.method.toUpperCase(),i.url,!0),N.timeout=i.timeout;function Q(){if(!N)return;const K=pa.from("getAllResponseHeaders"in N&&N.getAllResponseHeaders()),dt={data:!o||o==="text"||o==="json"?N.responseText:N.response,status:N.status,statusText:N.statusText,headers:K,config:r,request:N};xM(function(pt){e(pt),R()},function(pt){n(pt),R()},dt),N=null}"onloadend"in N?N.onloadend=Q:N.onreadystatechange=function(){!N||N.readyState!==4||N.status===0&&!(N.responseURL&&N.responseURL.indexOf("file:")===0)||setTimeout(Q)},N.onabort=function(){N&&(n(new ln("Request aborted",ln.ECONNABORTED,r,N)),N=null)},N.onerror=function(){n(new ln("Network Error",ln.ERR_NETWORK,r,N)),N=null},N.ontimeout=function(){let et=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const dt=i.transitional||_M;i.timeoutErrorMessage&&(et=i.timeoutErrorMessage),n(new ln(et,dt.clarifyTimeoutError?ln.ETIMEDOUT:ln.ECONNABORTED,r,N)),N=null},s===void 0&&a.setContentType(null),"setRequestHeader"in N&&fe.forEach(a.toJSON(),function(et,dt){N.setRequestHeader(dt,et)}),fe.isUndefined(i.withCredentials)||(N.withCredentials=!!i.withCredentials),o&&o!=="json"&&(N.responseType=i.responseType),f&&([x,P]=r1(f,!0),N.addEventListener("progress",x)),d&&N.upload&&([w,B]=r1(d),N.upload.addEventListener("progress",w),N.upload.addEventListener("loadend",B)),(i.cancelToken||i.signal)&&(_=K=>{N&&(n(!K||K.type?new Hf(null,r,N):K),N.abort(),N=null)},i.cancelToken&&i.cancelToken.subscribe(_),i.signal&&(i.signal.aborted?_():i.signal.addEventListener("abort",_)));const V=pst(i.url);if(V&&sc.protocols.indexOf(V)===-1){n(new ln("Unsupported protocol "+V+":",ln.ERR_BAD_REQUEST,r));return}N.send(s||null)})},xst=(r,t)=>{let e=new AbortController,n;const i=function(d){if(!n){n=!0,a();const f=d instanceof Error?d:this.reason;e.abort(f instanceof ln?f:new Hf(f instanceof Error?f.message:f))}};let s=t&&setTimeout(()=>{i(new ln(`timeout ${t} of ms exceeded`,ln.ETIMEDOUT))},t);const a=()=>{r&&(s&&clearTimeout(s),s=null,r.forEach(d=>{d&&(d.removeEventListener?d.removeEventListener("abort",i):d.unsubscribe(i))}),r=null)};r.forEach(d=>d&&d.addEventListener&&d.addEventListener("abort",i));const{signal:o}=e;return o.unsubscribe=a,[o,()=>{s&&clearTimeout(s),s=null}]},Bst=function*(r,t){let e=r.byteLength;if(e<t){yield r;return}let n=0,i;for(;n<e;)i=n+t,yield r.slice(n,i),n=i},Cst=async function*(r,t,e){for await(const n of r)yield*Bst(ArrayBuffer.isView(n)?n:await e(String(n)),t)},IM=(r,t,e,n,i)=>{const s=Cst(r,t,i);let a=0,o,d=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:_,value:w}=await s.next();if(_){d(),f.close();return}let x=w.byteLength;if(e){let B=a+=x;e(B)}f.enqueue(new Uint8Array(w))}catch(_){throw d(_),_}},cancel(f){return d(f),s.return()}},{highWaterMark:2})},n1=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",FM=n1&&typeof ReadableStream=="function",hx=n1&&(typeof TextEncoder=="function"?(r=>t=>r.encode(t))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),LM=function(r){try{for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return!!r(...e)}catch{return!1}},Est=FM&&LM(()=>{let r=!1;const t=new Request(sc.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!t}),PM=64*1024,dx=FM&&LM(()=>fe.isReadableStream(new Response("").body)),i1={stream:dx&&(r=>r.body)};n1&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!i1[t]&&(i1[t]=fe.isFunction(r[t])?e=>e[t]():(e,n)=>{throw new ln(`Response type '${t}' is not supported`,ln.ERR_NOT_SUPPORT,n)})})})(new Response);const Sst=async r=>{if(r==null)return 0;if(fe.isBlob(r))return r.size;if(fe.isSpecCompliantForm(r))return(await new Request(r).arrayBuffer()).byteLength;if(fe.isArrayBufferView(r)||fe.isArrayBuffer(r))return r.byteLength;if(fe.isURLSearchParams(r)&&(r=r+""),fe.isString(r))return(await hx(r)).byteLength},Tst=async(r,t)=>{const e=fe.toFiniteNumber(r.getContentLength());return e??Sst(t)},fx={http:Jit,xhr:wst,fetch:n1&&(async r=>{let{url:t,method:e,data:n,signal:i,cancelToken:s,timeout:a,onDownloadProgress:o,onUploadProgress:d,responseType:f,headers:_,withCredentials:w="same-origin",fetchOptions:x}=TM(r);f=f?(f+"").toLowerCase():"text";let[B,P]=i||s||a?xst([i,s],a):[],R,N;const Q=()=>{!R&&setTimeout(()=>{B&&B.unsubscribe()}),R=!0};let V;try{if(d&&Est&&e!=="get"&&e!=="head"&&(V=await Tst(_,n))!==0){let At=new Request(t,{method:"POST",body:n,duplex:"half"}),pt;if(fe.isFormData(n)&&(pt=At.headers.get("content-type"))&&_.setContentType(pt),At.body){const[ht,Tt]=BM(V,r1(CM(d)));n=IM(At.body,PM,ht,Tt,hx)}}fe.isString(w)||(w=w?"include":"omit"),N=new Request(t,{...x,signal:B,method:e.toUpperCase(),headers:_.normalize().toJSON(),body:n,duplex:"half",credentials:w});let K=await fetch(N);const et=dx&&(f==="stream"||f==="response");if(dx&&(o||et)){const At={};["status","statusText","headers"].forEach(St=>{At[St]=K[St]});const pt=fe.toFiniteNumber(K.headers.get("content-length")),[ht,Tt]=o&&BM(pt,r1(CM(o),!0))||[];K=new Response(IM(K.body,PM,ht,()=>{Tt&&Tt(),et&&Q()},hx),At)}f=f||"text";let dt=await i1[fe.findKey(i1,f)||"text"](K,r);return!et&&Q(),P&&P(),await new Promise((At,pt)=>{xM(At,pt,{data:dt,headers:pa.from(K.headers),status:K.status,statusText:K.statusText,config:r,request:N})})}catch(K){throw Q(),K&&K.name==="TypeError"&&/fetch/i.test(K.message)?Object.assign(new ln("Network Error",ln.ERR_NETWORK,r,N),{cause:K.cause||K}):ln.from(K,K&&K.code,r,N)}})};fe.forEach(fx,(r,t)=>{if(r){try{Object.defineProperty(r,"name",{value:t})}catch{}Object.defineProperty(r,"adapterName",{value:t})}});const MM=r=>`- ${r}`,Ist=r=>fe.isFunction(r)||r===null||r===!1,RM={getAdapter:r=>{r=fe.isArray(r)?r:[r];const{length:t}=r;let e,n;const i={};for(let s=0;s<t;s++){e=r[s];let a;if(n=e,!Ist(e)&&(n=fx[(a=String(e)).toLowerCase()],n===void 0))throw new ln(`Unknown adapter '${a}'`);if(n)break;i[a||"#"+s]=n}if(!n){const s=Object.entries(i).map(o=>{let[d,f]=o;return`adapter ${d} `+(f===!1?"is not supported by the environment":"is not available in the build")});let a=t?s.length>1?`since :
2580
2580
  `+s.map(MM).join(`
2581
2581
  `):" "+MM(s[0]):"as no adapter specified";throw new ln("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:fx};function px(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Hf(null,r)}function UM(r){return px(r),r.headers=pa.from(r.headers),r.data=Ax.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),RM.getAdapter(r.adapter||Jg.adapter)(r).then(function(n){return px(r),n.data=Ax.call(r,r.transformResponse,n),n.headers=pa.from(n.headers),n},function(n){return wM(n)||(px(r),n&&n.response&&(n.response.data=Ax.call(r,r.transformResponse,n.response),n.response.headers=pa.from(n.response.headers))),Promise.reject(n)})}const OM="1.7.4",gx={};["object","boolean","number","function","string","symbol"].forEach((r,t)=>{gx[r]=function(n){return typeof n===r||"a"+(t<1?"n ":" ")+r}});const DM={};gx.transitional=function(t,e,n){function i(s,a){return"[Axios v"+OM+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return(s,a,o)=>{if(t===!1)throw new ln(i(a," has been removed"+(e?" in "+e:"")),ln.ERR_DEPRECATED);return e&&!DM[a]&&(DM[a]=!0,console.warn(i(a," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,a,o):!0}};function Fst(r,t,e){if(typeof r!="object")throw new ln("options must be an object",ln.ERR_BAD_OPTION_VALUE);const n=Object.keys(r);let i=n.length;for(;i-- >0;){const s=n[i],a=t[s];if(a){const o=r[s],d=o===void 0||a(o,s,r);if(d!==!0)throw new ln("option "+s+" must be "+d,ln.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new ln("Unknown option "+s,ln.ERR_BAD_OPTION)}}const mx={assertOptions:Fst,validators:gx},YA=mx.validators;class id{constructor(t){this.defaults=t,this.interceptors={request:new yM,response:new yM}}async request(t,e){try{return await this._request(t,e)}catch(n){if(n instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
2582
- `+s):n.stack=s}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=nd(this.defaults,e);const{transitional:n,paramsSerializer:i,headers:s}=e;n!==void 0&&mx.assertOptions(n,{silentJSONParsing:YA.transitional(YA.boolean),forcedJSONParsing:YA.transitional(YA.boolean),clarifyTimeoutError:YA.transitional(YA.boolean)},!1),i!=null&&(fe.isFunction(i)?e.paramsSerializer={serialize:i}:mx.assertOptions(i,{encode:YA.function,serialize:YA.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&fe.merge(s.common,s[e.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),e.headers=pa.concat(a,s);const o=[];let d=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(e)===!1||(d=d&&R.synchronous,o.unshift(R.fulfilled,R.rejected))});const f=[];this.interceptors.response.forEach(function(R){f.push(R.fulfilled,R.rejected)});let _,w=0,x;if(!d){const P=[UM.bind(this),void 0];for(P.unshift.apply(P,o),P.push.apply(P,f),x=P.length,_=Promise.resolve(e);w<x;)_=_.then(P[w++],P[w++]);return _}x=o.length;let B=e;for(w=0;w<x;){const P=o[w++],R=o[w++];try{B=P(B)}catch(N){R.call(this,N);break}}try{_=UM.call(this,B)}catch(P){return Promise.reject(P)}for(w=0,x=f.length;w<x;)_=_.then(f[w++],f[w++]);return _}getUri(t){t=nd(this.defaults,t);const e=EM(t.baseURL,t.url);return mM(e,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){id.prototype[t]=function(e,n){return this.request(nd(n||{},{method:t,url:e,data:(n||{}).data}))}}),fe.forEach(["post","put","patch"],function(t){function e(n){return function(s,a,o){return this.request(nd(o||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}id.prototype[t]=e(),id.prototype[t+"Form"]=e(!0)});class yx{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(s){e=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(i);return a.cancel=function(){n.unsubscribe(s)},a},t(function(s,a,o){n.reason||(n.reason=new Hf(s,a,o),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new yx(function(i){t=i}),cancel:t}}}function Lst(r){return function(e){return r.apply(null,e)}}function Pst(r){return fe.isObject(r)&&r.isAxiosError===!0}const _x={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(_x).forEach(r=>{let[t,e]=r;_x[e]=t});function NM(r){const t=new id(r),e=eM(id.prototype.request,t);return fe.extend(e,id.prototype,t,{allOwnKeys:!0}),fe.extend(e,t,null,{allOwnKeys:!0}),e.create=function(i){return NM(nd(r,i))},e}const is=NM(Jg);is.Axios=id,is.CanceledError=Hf,is.CancelToken=yx,is.isCancel=wM,is.VERSION=OM,is.toFormData=t1,is.AxiosError=ln,is.Cancel=is.CanceledError,is.all=function(t){return Promise.all(t)},is.spread=Lst,is.isAxiosError=Pst,is.mergeConfig=nd,is.AxiosHeaders=pa,is.formToJSON=r=>vM(fe.isHTMLForm(r)?new FormData(r):r),is.getAdapter=RM.getAdapter,is.HttpStatusCode=_x,is.default=is;const Mst="https://eines.icgc.cat/recursos/mapicgc-gl-js/mapicgc-config.json",Rst=5e3;class kM{static async getConfigICGC(){try{const t=await is.get(Mst,{timeout:Rst});return t.data?t.data:(console.log("Resposta sense dades:",t),ed)}catch(t){return t.response?(console.error("Error de resposta:",t.response.data),console.error("Codi d'estat:",t.response.status)):t.request?console.error("No s'ha rebut resposta del servidor:",t.request):console.error("Error:",t.message),ed}}}const Ust={cobertesSol:{"fill-opacity":["interpolate",["exponential",.5],["zoom"],13.5,1,18,.4],"fill-outline-color":"rgba(0,0, 0, 0)","fill-color":["interpolate",["cubic-bezier",.5,1,1,1],["get","nivell_2"],0,"#ffffff",111,"#ffff00",112,"#ccff33",113,"#af5b15",114,"#808000",115,"#cdcd00",116,"#ffffcc",221,"#33cc33",222,"#66ff33",223,"#689018",224,"#967d5f",225,"#19e61e",226,"#b4ff9b",227,"#aaa500",228,"#c3c3a0",229,"#00ff9b",230,"#ff9632",231,"#282828",232,"#79797a",233,"#f5df78",234,"#3296ff",341,"#ff007d",342,"#ff53cd",343,"#ffa4e2",344,"#ffc8e2",345,"#ffb4b4",346,"#0f3700",347,"#730055",348,"#6200c4",349,"#4a9595",350,"#ff00f0",351,"#adaaca",352,"#ffe6e6",353,"#67629a",354,"#4a466e",355,"#2f2d46",461,"#6f6fff",462,"#0000dc",463,"#000064",464,"#185f94",465,"#12466d",466,"#000080"]}},Ost="lines",s1="labels";let sd,Zg,ki,Ln,Dst=class{constructor(t){kM.getConfigICGC().then(e=>{sd={...e.Styles},ki={...e.Layers},Zg={...e.Terrains},Ln={...e.defaultOptions},this.initTheMap(t)}).catch(e=>{console.info("Configuracio per defecte",e),sd={...ed.Styles},ki={...ed.Layers},Zg={...ed.Terrains},Ln={...ed.defaultOptions},this.initTheMap(t)})}initTheMap(t){if(!t)t=Ln.mapOptions;else for(const n in Ln.mapOptions){let i=[Ln.mapOptions.center[0],Ln.mapOptions.center[1]];Ln.mapOptions.center=i,t.hasOwnProperty(n)||(t[n]=Ln.mapOptions[n])}t.maxPitch=85,t.maplibreLogo=!1,t.attributionControl=!1;const e=t.style.includes("https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/");e?(this.map=new Ps.Map({container:t.container,center:t.center,zoom:t.zoom,pitch:t.pitch||0,hash:t.hash||!1,style:{version:8,sources:{},layers:[]}}),this.map.on("load",()=>{this.map.addSource("raster-source",{type:"raster",tiles:[t.style],tileSize:256}),this.map.addLayer({id:"raster-layer",type:"raster",source:"raster-source"})})):this.map=new Ps.Map(t),this.map.on("load",()=>{if(!e){const n=this.map.getStyle().name,i=t.style;this.map.addControl(new ait({color:i.indexOf("orto")===-1,defaultOptions:Ln}),"bottom-left"),this._dealOrto3dStyle(n)}})}addGeocoderICGC(t){try{t===void 0&&(t="top-right");let e={collapsed:!0,marker:!0,popup:!0,showResultMarkers:!0,maplibregl:Ps,showResultsWhileTyping:!0,minLength:2};const n={forwardGeocode:async s=>{const a=[];try{const o=Ln.geocoder.peliasUrl1+encodeURIComponent(s.query)+Ln.geocoder.peliasUrl2,f=await(await fetch(o)).json();for(const _ of f.features){const w=_.geometry.coordinates,x={type:"Feature",geometry:{type:"Point",coordinates:w},place_name:_.properties.etiqueta,properties:_.properties,text:_.properties.etiqueta,place_type:["place"],center:w};a.push(x)}}catch(o){console.error(`Failed to forwardGeocode with error: ${o}`)}return{features:a}}};this.map.addControl(new oit(n,e),t);let i=document.getElementsByClassName("maplibregl-ctrl-geocoder--input");i[0].attributes[2].nodeValue="Cerca...",i[0].addEventListener("input",function(s){s.target.value.length>3})}catch(e){console.error(`Error adding ICGC geocoder: ${e.message}`)}}async loadImage(t){try{return this.map.loadImage(t)}catch(e){console.error(`Error getting loadImage: ${e.message}`)}}getConfigStyles(){try{let t=[];for(const e of sd)t.push(e.name);return t}catch(t){console.error(`Error retrieving base styles: ${t.message}`)}}getConfigWMSLayers(){try{let t=[];for(const e in ki.WMS)ki.WMS.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving WMS layers: ${t.message}`)}}getConfigOrtoLayers(){try{let t=[];for(const e in ki.Orto)ki.Orto.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving orto image layers: ${t.message}`)}}getConfigVectorLayers(){try{let t=[];for(const e in ki.Vector)ki.Vector.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving vector layers: ${t.message}`)}}getConfigVectorAdminLayers(){try{let t=[];for(const e in ki.VectorAdmin)ki.VectorAdmin.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving vectorAdmin layers: ${t.message}`)}}getConfigFGBAdminLayers(){try{let t=[];for(const e in ki.FGBAdmin)ki.FGBAdmin.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving FGBAdmin layers: ${t.message}`)}}async fetchData(t,e,n){try{(!n||n===void 0)&&(n={type:"line",layout:{visibility:"visible"},paint:{"line-color":"grey","line-width":2},layerPosition:"top"});let i=n.layerPosition;if(t.includes(".fgb"))this.addFGBLayerICGC(t,e,n);else{const a=await(await fetch(t)).json();let o=e,d=this._dealOrderLayer(i),f=a.features[0].geometry.type;f.includes("ine")&&(n!==void 0?this.map.addLayer({id:o,type:"line",source:{type:"geojson",data:a},layout:n.layout||{},paint:n.paint||{}},d):this.map.addLayer({id:o,type:"line",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"line-color":"black","line-width":2,"line-opacity":1}},d)),f.includes("olygon")&&(n!==void 0?this.map.addLayer({id:o,type:"fill",source:{type:"geojson",data:a},layout:n.layout,paint:n.paint},d):this.map.addLayer({id:o,type:"fill",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"fill-color":"blue","fill-opacity":.6}},d)),f.includes("oint")&&(n!==void 0?this.map.addLayer({id:o,type:"circle",source:{type:"geojson",data:a},layout:n.layout,paint:n.paint},d):this.map.addLayer({id:o,type:"circle",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"circle-color":"red","circle-opacity":.85}},d))}}catch(i){console.error(`Error fetching data: ${i.message}`)}}async fetchDataAndMenu(t,e,n,i){try{let s;i!==null?s=i.layerPosition:s=s1;let a,o=document.getElementById("map");if(document.getElementById("menu-group")?a=document.getElementById("menu-group"):(a=document.createElement("nav"),a.id="menu-group",a.classList.add="filter-group",o.appendChild(a)),a!==null){let d="visible",f=this._dealOrderLayer(s),_;if(t.includes(".fgb")){let x=this._getKeyByUrlFGB(t);x===null&&(x="userFGB");const B=await fetch(t),P={type:"FeatureCollection",features:[]};for await(const N of HS(B.body))P.features.push(N);_=P;let R=e;if(this.map.addSource(R,{type:"geojson",data:P}),t.includes("text"))i!==void 0?this.map.addLayer({id:e,type:"symbol",source:R,layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"symbol",source:R,layout:{"text-letter-spacing":.1,"text-size":{base:1.2,stops:[[8,0],[12,14],[15,15]]},"text-font":["FiraSans-Regular"],"text-field":["get","NOM_AC"],"text-transform":"none","text-max-width":25,visibility:d,"text-justify":"right","text-anchor":"top","text-allow-overlap":!1,"symbol-spacing":2,"text-line-height":1},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f);else{let N=e+"Text";this.map.addLayer({id:N,type:"symbol",source:R,layout:{"text-letter-spacing":.1,"text-size":{base:1.2,stops:[[8,0],[12,14],[15,15]]},"text-font":["FiraSans-Regular"],"text-field":["get","NOM_AC"],"text-transform":"none","text-max-width":25,visibility:d,"text-justify":"right","text-anchor":"top","text-allow-overlap":!1,"symbol-spacing":2,"text-line-height":1},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f)}}else _=await(await fetch(t)).json();if(n!=="all"){const x=document.createElement("div");x.id="titleDivMenu",x.textContent=e,a.appendChild(x);const B=document.createElement("div");B.id="titleDivMenuSub",B.textContent=`📂 ${n}`,a.appendChild(B)}let w;if(i.type?w=i.type:w=_.features[0].geometry.type,n==="all")w.includes("ine")&&(i!==void 0?this.map.addLayer({id:e,type:"line",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"line",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"line-color":"black","line-width":2,"line-opacity":1}},f)),w.includes("olygon")&&(i!==void 0?this.map.addLayer({id:e,type:"fill",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"fill",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"fill-color":"#0000FF","fill-opacity":0}},f)),w.includes("oint")&&(i!==void 0?this.map.addLayer({id:e,type:"circle",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"circle",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"circle-color":"red","circle-opacity":.85}},f)),w.includes("ymbol")&&(i!==void 0?this.map.addLayer({id:e,type:"symbol",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"symbol",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f)),this.addMenuItem(e);else{let x=n;const B={};_.features.forEach(P=>{const R=P.properties[x],N=R+"-userFieldFilter-"+e;R!==null&&(B[N]||(w.includes("ine")&&(i!==void 0?this.map.addLayer({id:N,type:"line",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint,filter:["==",`${x}`,R]},f):this.map.addLayer({id:N,type:"line",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"line-color":"black","line-width":2,"line-opacity":1}},f)),w.includes("olygon")&&(i!==void 0?this.map.addLayer({id:N,type:"fill",source:{type:"geojson",data:_},filter:["==",`${x}`,R],layout:i.layout,paint:i.paint},f):this.map.addLayer({id:N,type:"fill",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"fill-color":"blue","fill-opacity":.6}},f)),w.includes("oint")&&(i!==void 0?this.map.addLayer({id:N,type:"circle",source:{type:"geojson",data:_},filter:["==",`${x}`,R],layout:i.layout,paint:i.paint},f):this.map.addLayer({id:N,type:"circle",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"circle-color":"red","circle-opacity":.85}},f)),B[N]=!0,this.addMenuItem(N)))})}}}catch(s){console.error(`Error fetching data: ${s.message}`)}}on(t,e){setTimeout(()=>{try{return this.map.on(t,e)}catch(n){console.error(`Error adding event ON listener: ${n.message}`)}},100)}setStyle(t,e){try{e!==void 0?this.map.setStyle(t,e):this.map.setStyle(t),this.map.on("styledata",()=>{if(window.document.querySelector(".maplibregl-compact-show")){var n=window.document.querySelector(".maplibregl-compact-show");n.classList.remove("maplibregl-compact-show")}this._dealOrto3dStyle(this.map.getStyle().name)})}catch(n){console.error(`Error setting style: ${n.message}`)}}addControl(t,e){try{e===void 0&&(e="top-right"),this.map.addControl(t,e)}catch(n){console.error(`Error adding control: ${n.message}`)}}setSky(t){try{t===void 0&&(this.map.options.style.includes("orto")&&(t={"sky-color":"#86bbd5","sky-horizon-blend":.3,"horizon-color":"#ffffff33","horizon-fog-blend":.1,"fog-ground-blend":.75,"fog-color":"#c5d6d6"}),this.map.options.style.includes("mapa_estandard_general")&&(t={"sky-color":"#a5f0f0","sky-horizon-blend":.3,"horizon-color":"#e1e3e3","horizon-fog-blend":.9,"fog-ground-blend":.85,"fog-color":"#c5d6d6"}),this.map.options.style.includes("fosc")&&(t={"sky-color":"#232423","sky-horizon-blend":.3,"horizon-color":"#969996","horizon-fog-blend":.9,"fog-ground-blend":.85,"fog-color":"#383838"})),this.map.setSky(t)}catch(e){console.error(`Error setting sky properties: ${e.message}`)}}addMouseCoordControl(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"bottom-left";try{this.map.addControl(new Ait(t),e)}catch(n){console.error(`Error adding mouse coordinate control: ${n.message}`)}}addGeolocateControl(t,e){try{e===void 0&&(e="top-right"),t===void 0?this.map.addControl(new Ps.GeolocateControl({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!0}),e):this.map.addControl(new Ps.GeolocateControl(t),e)}catch(n){console.error(`Error adding geolocate control: ${n.message}`)}}addFullscreenControl(t,e){try{e===void 0&&(e="top-right"),t===void 0?this.map.addControl(new Ps.FullscreenControl({container:HTMLElement}),e):this.map.addControl(new Ps.FullscreenControl(t),e)}catch(n){console.error(`Error adding fullscreen control: ${n.message}`)}}addLayer(t,e){try{this.map.addLayer(t,e)}catch(n){console.error(`Error adding layer: ${n.message}`)}}addImage(t,e,n){try{this.map.addImage(t,e,n)}catch(i){console.error(`Error adding image: ${i.message}`)}return this}addSource(t,e){try{this.map.addSource(t,e)}catch(n){console.error(`Error adding source: ${n.message}`)}return this}addSprite(t,e,n){try{this.map.addSprite(t,e,n)}catch(i){console.error(`Error adding sprite: ${i.message}`)}return this}areTilesLoaded(){return this.map.areTilesLoaded()}cameraForBounds(t,e){return this.map.cameraForBounds(t,e)}easeTo(t,e){return this.map.easeTo(t,e),this}fitBounds(t,e,n){return this.map.fitBounds(t,e,n),this}fitScreenCoordinates(t,e,n,i,s){return this.map.fitScreenCoordinates(t,e,n,i,s),this}flyTo(t,e){return this.map.flyTo(t,e),this}getBearing(){return this.map.getBearing()}getBounds(){return this.map.getBounds()}getCameraTargetElevation(){return this.map.getCameraTargetElevation()}getCanvas(){return this.map.getCanvas()}getCanvasContainer(){return this.map.getCanvasContainer()}getCenter(){return this.map.getCenter()}getContainer(){return this.map.getContainer()}getFeatureState(t){return this.map.getFeatureState(t)}getFilter(t){return this.map.getFilter(t)}getGlyphs(){return this.map.getGlyphs()}getImage(t){return this.map.getImage(t)}getLayer(t){return this.map.getLayer(t)}getLayersOrder(){return this.map.getLayersOrder()}getLayoutProperty(t,e){return this.map.getLayoutProperty(t,e)}getLight(){return this.map.getLight()}getMaxBounds(){return this.map.getMaxBounds()}getMaxPitch(){return this.map.getMaxPitch()}getMaxZoom(){return this.map.getMaxZoom()}getMinPitch(){return this.map.getMinPitch()}getMinZoom(){return this.map.getMinZoom()}getPadding(){return this.map.getPadding()}getPaintProperty(t,e){return this.map.getPaintProperty(t,e)}getPitch(){return this.map.getPitch()}getPixelRatio(){return this.map.getPixelRatio()}getRenderWorldCopies(){return this.map.getRenderWorldCopies()}getSource(t){return this.map.getSource(t)}getSprite(){return this.map.getSprite()}getStyle(){return this.map.getStyle()}getTerrain(){return this.map.getTerrain()}getZoom(){return this.map.getZoom()}hasControl(t){return this.map.hasControl(t)}hasImage(t){return this.map.hasImage(t)}isMoving(){return this.map.isMoving()}isRotating(){return this.map.isRotating()}isSourceLoaded(t){return this.map.isSourceLoaded(t)}isStyleLoaded(){return this.map.isStyleLoaded()}isZooming(){return this.map.isZooming()}jumpTo(t,e){return this.map.jumpTo(t,e)}listImages(){return this.map.listImages()}listens(t){return this.map.listens(t)}loadImage(t){return this.map.loadImage(t)}loaded(){return this.map.loaded()}LngLatBounds(t,e){return new Ps.LngLatBounds(t,e)}addProtocol(t,e){return this.map.addProtocol(t,e)}moveLayer(t,e){return this.map.moveLayer(t,e)}panBy(t,e,n){return this.map.panBy(t,e,n)}panTo(t,e,n){return this.map.panTo(t,e,n)}project(t){return this.map.project(t)}queryRenderedFeatures(t,e){return this.map.queryRenderedFeatures(t,e)}querySourceFeatures(t,e){return this.map.querySourceFeatures(t,e)}queryTerrainElevation(t){return this.map.queryTerrainElevation(t)}redraw(){return this.map.redraw()}remove(){return this.map.remove()}removeControl(t){return this.map.removeControl(t)}removeFeatureState(t,e){return this.map.removeFeatureState(t,e)}removeImage(t){return this.map.removeImage(t)}removeLayer(t){try{this.map.removeLayer(t)}catch(e){console.error(`Error removing layer: ${e.message}`)}}removeSource(t){try{this.map.removeSource(t)}catch(e){console.error(`Error removing source: ${e.message}`)}}removeSprite(t){return this.map.removeSprite(t)}resetNorth(t,e){return this.map.resetNorth(t,e)}resetNorthPitch(t,e){return this.map.resetNorthPitch(t,e)}resize(t){return this.map.resize(t)}rotateTo(t,e,n){return this.map.rotateTo(t,e,n)}setBearing(t,e){return this.map.setBearing(t,e)}setCenter(t,e){return this.map.setCenter(t,e)}setEventedParent(t,e){return this.map.setEventedParent(t,e)}setFeatureState(t,e){return this.map.setFeatureState(t,e)}setFilter(t,e,n){return this.map.setFilter(t,e,n)}setGlyphs(t,e){return this.map.setGlyphs(t,e)}setLayerZoomRange(t,e,n){return this.map.setLayerZoomRange(t,e,n)}setLayoutProperty(t,e,n,i){return this.map.setLayoutProperty(t,e,n,i)}setLight(t,e){return this.map.setLight(t,e)}setMaxBounds(t){return this.map.setMaxBounds(t)}setMaxPitch(t){return this.map.setMaxPitch(t)}setMaxZoom(t){return this.map.setMaxZoom(t)}setMinPitch(t){return this.map.setMinPitch(t)}setMinZoom(t){return this.map.setMinZoom(t)}setPadding(t,e){return this.map.setPadding(t,e)}setPaintProperty(t,e,n,i){return this.map.setPaintProperty(t,e,n,i)}setPitch(t,e){return this.map.setPitch(t,e)}setPixelRatio(t){return this.map.setPixelRatio(t)}setRenderWorldCopies(t){return this.map.setRenderWorldCopies(t)}setSprite(t,e){return this.map.setSprite(t,e)}setTerrain(t){return this.map.setTerrain(t)}setTransformRequest(t){return this.map.setTransformRequest(t)}setZoom(t,e){return this.map.setZoom(t,e)}snapToNorth(t,e){return this.map.snapToNorth(t,e)}stop(){return this.map.stop()}triggerRepaint(){return this.map.triggerRepaint()}unproject(t){return this.map.unproject(t)}updateImage(t,e){return this.map.updateImage(t,e)}zoomIn(t,e){return this.map.zoomIn(t,e)}zoomOut(t,e){return this.map.zoomOut(t,e)}zoomTo(t,e,n){return this.map.zoomTo(t,e,n)}addLayerGeoJSON(t,e){try{let n=this._dealOrderLayer(e);this.map.addSource(`${t.id}`,{type:"geojson",data:t.data}),this.map.addLayer({id:`${t.id}-layerIcgcMap`,type:t.type,source:`${t.id}`,layout:t.layout,paint:t.paint},n)}catch(n){console.error(`Error adding GeoJSON layer: ${n.message}`)}}addLayerWMS(t,e,n){try{let i=this._dealOrderLayer(n.layerPosition);n?(this.map.addSource(`${e}`,{type:"raster",tiles:[t],tileSize:256},i),this.map.addLayer({id:e,type:"raster",source:e,layout:n.layout,paint:n.paint},i)):(this.map.addSource(`${e}`,{type:"raster",tiles:[t],tileSize:256},i),this.map.addLayer({id:e,type:"raster",source:e,paint:{}},i))}catch(i){console.error(`Error adding WMS layer: ${i.message}`)}}addLogo(t){try{let e=document.getElementById("map"),n;n=document.createElement("div"),n.id="logos",e.appendChild(n);const i=document.createElement("img");i.src=t.url,i.style.height=t.height;const s=document.getElementById("logos"),a=document.createElement("a");a.id=t.id,a.href=t.href,a.target="_blank",a.style.position="relative",a.style.bottom="1px",a.appendChild(i),s.appendChild(a)}catch(e){console.error(`Error adding logo: ${e.message}`)}}addBasemapsICGC(t){try{const e=a=>{this.map.setStyle(a)};let n=document.getElementById("map"),i;i=document.createElement("div"),i.id="basemap-group",i.classList.add="filter-group",n.appendChild(i);const s=document.getElementById("basemap-group");for(const a of t)for(const o of Object.keys(Ln.baseStyles)){const d=Ln.baseStyles[o];if(a===d.url){const f=document.createElement("div");f.className="basemap-item",f.title=d.key,f.style.backgroundImage=`url('${d.image}')`,s.appendChild(f),f.addEventListener("click",()=>e(d.url))}}}catch(e){console.error(`Error adding basemaps: ${e.message}`)}}addBasemaps(t){try{const e=a=>{map.setStyle(a.url)};let n=document.getElementById("map"),i;i=document.createElement("div"),i.id="basemap-group",i.classList.add="basemap-group",n.appendChild(i);const s=document.getElementById("basemap-group");t.forEach(a=>{const o=document.createElement("div");o.className="basemap-item",o.title=a.label,o.style.backgroundImage=`url('${a.image}')`,s.appendChild(o),o.addEventListener("click",()=>e(a))})}catch(e){console.error(`Error adding basemaps: ${e.message}`)}}addFeatureQuery(t,e,n){try{let i;this.map.on("mouseenter",t,()=>{this.map.getCanvas().style.cursor="pointer"}),this.map.on("mouseleave",t,()=>{this.map.getCanvas().style.cursor=""}),this.map.on("click",s=>{let a=this.map.queryRenderedFeatures(s.point);if(a&&a[0].source.includes(t)){let o=[s.lngLat.lng,s.lngLat.lat];if(e!==void 0&&e.length>0&&e!=="all"){if(e!==null){let d="";e.forEach(f=>{let _=a[0].properties[f];d=d+`<h4>${_}</h4>`}),i=d,this.addPopup(o,i,n)}}else{let d="";for(const f in a[0].properties)d+="<b>"+f+"</b>:"+a[0].properties[f]+"<br>";i=d,this.addPopup(o,i,n)}}})}catch(i){console.error(`Error adding feature query: ${i.message}`)}}addScaleControl(t,e){try{var n=new Ps.ScaleControl(t);this.map.addControl(n,e)}catch(i){console.error(`Error adding scale: ${i.message}`)}}addExportControl(t,e){try{typeof t=="string"&&(e=t,t=void 0),t===void 0&&(t={PageSize:Xh.A4,PageOrientation:Vg.Landscape,Format:Ku.PNG,DPI:I2[300],Crosshair:!0,PrintableArea:!0,Local:"ca"},e="top-right"),this.map.addControl(new gnt(t),e)}catch(n){console.error(`Error adding export control: ${n.message}`)}}addMarker(t){try{let e,n;return t.text===void 0?e=new Ps.Marker(t.options).setLngLat(t.coord).addTo(this.map):(n=new Ps.Popup({offset:t.textOffset}).setHTML(t.text),e=new Ps.Marker(t.options).setLngLat(t.coord).setPopup(n).addTo(this.map)),e}catch(e){return console.error(`Error adding marker: ${e.message}`),null}}addPopup(t,e,n){try{return n.image===void 0?new Ps.Popup().setLngLat(t).setHTML(`
2582
+ `+s):n.stack=s}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=nd(this.defaults,e);const{transitional:n,paramsSerializer:i,headers:s}=e;n!==void 0&&mx.assertOptions(n,{silentJSONParsing:YA.transitional(YA.boolean),forcedJSONParsing:YA.transitional(YA.boolean),clarifyTimeoutError:YA.transitional(YA.boolean)},!1),i!=null&&(fe.isFunction(i)?e.paramsSerializer={serialize:i}:mx.assertOptions(i,{encode:YA.function,serialize:YA.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&fe.merge(s.common,s[e.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete s[P]}),e.headers=pa.concat(a,s);const o=[];let d=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(e)===!1||(d=d&&R.synchronous,o.unshift(R.fulfilled,R.rejected))});const f=[];this.interceptors.response.forEach(function(R){f.push(R.fulfilled,R.rejected)});let _,w=0,x;if(!d){const P=[UM.bind(this),void 0];for(P.unshift.apply(P,o),P.push.apply(P,f),x=P.length,_=Promise.resolve(e);w<x;)_=_.then(P[w++],P[w++]);return _}x=o.length;let B=e;for(w=0;w<x;){const P=o[w++],R=o[w++];try{B=P(B)}catch(N){R.call(this,N);break}}try{_=UM.call(this,B)}catch(P){return Promise.reject(P)}for(w=0,x=f.length;w<x;)_=_.then(f[w++],f[w++]);return _}getUri(t){t=nd(this.defaults,t);const e=EM(t.baseURL,t.url);return mM(e,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){id.prototype[t]=function(e,n){return this.request(nd(n||{},{method:t,url:e,data:(n||{}).data}))}}),fe.forEach(["post","put","patch"],function(t){function e(n){return function(s,a,o){return this.request(nd(o||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}id.prototype[t]=e(),id.prototype[t+"Form"]=e(!0)});class yx{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(s){e=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(i);return a.cancel=function(){n.unsubscribe(s)},a},t(function(s,a,o){n.reason||(n.reason=new Hf(s,a,o),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new yx(function(i){t=i}),cancel:t}}}function Lst(r){return function(e){return r.apply(null,e)}}function Pst(r){return fe.isObject(r)&&r.isAxiosError===!0}const _x={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(_x).forEach(r=>{let[t,e]=r;_x[e]=t});function NM(r){const t=new id(r),e=eM(id.prototype.request,t);return fe.extend(e,id.prototype,t,{allOwnKeys:!0}),fe.extend(e,t,null,{allOwnKeys:!0}),e.create=function(i){return NM(nd(r,i))},e}const is=NM(Jg);is.Axios=id,is.CanceledError=Hf,is.CancelToken=yx,is.isCancel=wM,is.VERSION=OM,is.toFormData=t1,is.AxiosError=ln,is.Cancel=is.CanceledError,is.all=function(t){return Promise.all(t)},is.spread=Lst,is.isAxiosError=Pst,is.mergeConfig=nd,is.AxiosHeaders=pa,is.formToJSON=r=>vM(fe.isHTMLForm(r)?new FormData(r):r),is.getAdapter=RM.getAdapter,is.HttpStatusCode=_x,is.default=is;const Mst="https://eines.icgc.cat/recursos/mapicgc-gl-js/mapicgc-config.json",Rst=5e3;class kM{static async getConfigICGC(){try{const t=await is.get(Mst,{timeout:Rst});return t.data?t.data:(console.log("Resposta sense dades:",t),ed)}catch(t){return t.response?(console.error("Error de resposta:",t.response.data),console.error("Codi d'estat:",t.response.status)):t.request?console.error("No s'ha rebut resposta del servidor:",t.request):console.error("Error:",t.message),ed}}}const Ust={cobertesSol:{"fill-opacity":["interpolate",["exponential",.5],["zoom"],13.5,1,18,.4],"fill-outline-color":"rgba(0,0, 0, 0)","fill-color":["interpolate",["cubic-bezier",.5,1,1,1],["get","nivell_2"],0,"#ffffff",111,"#ffff00",112,"#ccff33",113,"#af5b15",114,"#808000",115,"#cdcd00",116,"#ffffcc",221,"#33cc33",222,"#66ff33",223,"#689018",224,"#967d5f",225,"#19e61e",226,"#b4ff9b",227,"#aaa500",228,"#c3c3a0",229,"#00ff9b",230,"#ff9632",231,"#282828",232,"#79797a",233,"#f5df78",234,"#3296ff",341,"#ff007d",342,"#ff53cd",343,"#ffa4e2",344,"#ffc8e2",345,"#ffb4b4",346,"#0f3700",347,"#730055",348,"#6200c4",349,"#4a9595",350,"#ff00f0",351,"#adaaca",352,"#ffe6e6",353,"#67629a",354,"#4a466e",355,"#2f2d46",461,"#6f6fff",462,"#0000dc",463,"#000064",464,"#185f94",465,"#12466d",466,"#000080"]}},Ost="lines",s1="labels";let sd,Zg,ki,Ln,Dst=class{constructor(t){kM.getConfigICGC().then(e=>{sd={...e.Styles},ki={...e.Layers},Zg={...e.Terrains},Ln={...e.defaultOptions},this.initTheMap(t)}).catch(e=>{console.info("Configuracio per defecte",e),sd={...ed.Styles},ki={...ed.Layers},Zg={...ed.Terrains},Ln={...ed.defaultOptions},this.initTheMap(t)})}initTheMap(t){if(!t)t=Ln.mapOptions;else for(const n in Ln.mapOptions){let i=[Ln.mapOptions.center[0],Ln.mapOptions.center[1]];Ln.mapOptions.center=i,t.hasOwnProperty(n)||(t[n]=Ln.mapOptions[n])}t.maxPitch=85,t.maplibreLogo=!1,t.attributionControl=!1;const e=t.style.includes("https://geoserveis.icgc.cat/servei/catalunya/mapa-base/wmts/");e?(this.map=new Ps.Map({container:t.container,center:t.center,zoom:t.zoom,pitch:t.pitch||0,hash:t.hash||!1,style:{version:8,sources:{},layers:[]}}),this.map.on("load",()=>{this.map.addSource("raster-source",{type:"raster",tiles:[t.style],tileSize:256}),this.map.addLayer({id:"raster-layer",type:"raster",source:"raster-source"})})):this.map=new Ps.Map(t),this.map.on("load",()=>{if(!e){const n=this.map.getStyle().name,i=t.style;this.map.addControl(new ait({color:i.indexOf("orto")===-1,defaultOptions:Ln}),"bottom-left"),this._dealOrto3dStyle(n)}})}addGeocoderICGC(t){try{t===void 0&&(t="top-right");let e={collapsed:!0,marker:!0,popup:!0,showResultMarkers:!0,maplibregl:Ps,showResultsWhileTyping:!0,minLength:2};const n={forwardGeocode:async s=>{const a=[];try{const o=Ln.geocoder.peliasUrl1+encodeURIComponent(s.query)+Ln.geocoder.peliasUrl2,f=await(await fetch(o)).json();for(const _ of f.features){const w=_.geometry.coordinates,x={type:"Feature",geometry:{type:"Point",coordinates:w},place_name:_.properties.etiqueta,properties:_.properties,text:_.properties.etiqueta,place_type:["place"],center:w};a.push(x)}}catch(o){console.error(`Failed to forwardGeocode with error: ${o}`)}return{features:a}}};this.map.addControl(new oit(n,e),t);let i=document.getElementsByClassName("maplibregl-ctrl-geocoder--input");i[0].attributes[2].nodeValue="Cerca...",i[0].addEventListener("input",function(s){s.target.value.length>3})}catch(e){console.error(`Error adding ICGC geocoder: ${e.message}`)}}async loadImage(t){try{return this.map.loadImage(t)}catch(e){console.error(`Error getting loadImage: ${e.message}`)}}getConfigStyles(){try{let t=[];for(const e of sd)t.push(e.name);return t}catch(t){console.error(`Error retrieving base styles: ${t.message}`)}}getConfigWMSLayers(){try{let t=[];for(const e in ki.WMS)ki.WMS.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving WMS layers: ${t.message}`)}}getConfigOrtoLayers(){try{let t=[];for(const e in ki.Orto)ki.Orto.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving orto image layers: ${t.message}`)}}getConfigVectorLayers(){try{let t=[];for(const e in ki.Vector)ki.Vector.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving vector layers: ${t.message}`)}}getConfigVectorAdminLayers(){try{let t=[];for(const e in ki.VectorAdmin)ki.VectorAdmin.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving vectorAdmin layers: ${t.message}`)}}getConfigFGBAdminLayers(){try{let t=[];for(const e in ki.FGBAdmin)ki.FGBAdmin.hasOwnProperty(e)&&t.push(e);return t}catch(t){console.error(`Error retrieving FGBAdmin layers: ${t.message}`)}}async fetchData(t,e,n){try{(!n||n===void 0)&&(n={type:"line",layout:{visibility:"visible"},paint:{"line-color":"grey","line-width":2},layerPosition:"top"});let i=n.layerPosition;if(t.includes(".fgb"))this.addFGBLayerICGC(t,e,n);else{const a=await(await fetch(t)).json();let o=e,d=this._dealOrderLayer(i),f=a.features[0].geometry.type;f.includes("ine")&&(n!==void 0?this.map.addLayer({id:o,type:"line",source:{type:"geojson",data:a},layout:n.layout||{},paint:n.paint||{}},d):this.map.addLayer({id:o,type:"line",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"line-color":"black","line-width":2,"line-opacity":1}},d)),f.includes("olygon")&&(n!==void 0?this.map.addLayer({id:o,type:"fill",source:{type:"geojson",data:a},layout:n.layout,paint:n.paint},d):this.map.addLayer({id:o,type:"fill",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"fill-color":"blue","fill-opacity":.6}},d)),f.includes("oint")&&(n!==void 0?this.map.addLayer({id:o,type:"circle",source:{type:"geojson",data:a},layout:n.layout,paint:n.paint},d):this.map.addLayer({id:o,type:"circle",source:{type:"geojson",data:a},layout:{visibility:"visible"},paint:{"circle-color":"red","circle-opacity":.85}},d))}}catch(i){console.error(`Error fetching data: ${i.message}`)}}async fetchDataAndMenu(t,e,n,i){try{let s;i!==null?s=i.layerPosition:s=s1;let a,o=document.getElementById("map");if(document.getElementById("menu-group")?a=document.getElementById("menu-group"):(a=document.createElement("nav"),a.id="menu-group",a.classList.add="filter-group",o.appendChild(a)),a!==null){let d="visible",f=this._dealOrderLayer(s),_;if(t.includes(".fgb")){let x=this._getKeyByUrlFGB(t);x===null&&(x="userFGB");const B=await fetch(t),P={type:"FeatureCollection",features:[]};for await(const N of HS(B.body))P.features.push(N);_=P;let R=e;if(this.map.addSource(R,{type:"geojson",data:P}),t.includes("text"))i!==void 0?this.map.addLayer({id:e,type:"symbol",source:R,layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"symbol",source:R,layout:{"text-letter-spacing":.1,"text-size":{base:1.2,stops:[[8,0],[12,14],[15,15]]},"text-font":["FiraSans-Regular"],"text-field":["get","NOM_AC"],"text-transform":"none","text-max-width":25,visibility:d,"text-justify":"right","text-anchor":"top","text-allow-overlap":!1,"symbol-spacing":2,"text-line-height":1},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f);else{let N=e+"Text";this.map.addLayer({id:N,type:"symbol",source:R,layout:{"text-letter-spacing":.1,"text-size":{base:1.2,stops:[[8,0],[12,14],[15,15]]},"text-font":["FiraSans-Regular"],"text-field":["get","NOM_AC"],"text-transform":"none","text-max-width":25,visibility:d,"text-justify":"right","text-anchor":"top","text-allow-overlap":!1,"symbol-spacing":2,"text-line-height":1},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f)}}else _=await(await fetch(t)).json();if(n!=="all"){const x=document.createElement("div");x.id="titleDivMenu",x.textContent=e,a.appendChild(x);const B=document.createElement("div");B.id="titleDivMenuSub",B.textContent=`📂 ${n}`,a.appendChild(B)}let w;if(i.type?w=i.type:w=_.features[0].geometry.type,n==="all")w.includes("ine")&&(i!==void 0?this.map.addLayer({id:e,type:"line",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"line",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"line-color":"black","line-width":2,"line-opacity":1}},f)),w.includes("olygon")&&(i!==void 0?this.map.addLayer({id:e,type:"fill",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"fill",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"fill-color":"#0000FF","fill-opacity":0}},f)),w.includes("oint")&&(i!==void 0?this.map.addLayer({id:e,type:"circle",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"circle",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"circle-color":"red","circle-opacity":.85}},f)),w.includes("ymbol")&&(i!==void 0?this.map.addLayer({id:e,type:"symbol",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint},f):this.map.addLayer({id:e,type:"symbol",source:{type:"geojson",data:_},layout:{visibility:"visible"},paint:{"text-halo-blur":.5,"text-color":"rgba(90, 7, 7, 1)","text-halo-width":2,"text-halo-color":"rgba(255, 255, 255,0.8)"}},f)),this.addMenuItem(e);else{let x=n;const B={};_.features.forEach(P=>{const R=P.properties[x],N=R+"-userFieldFilter-"+e;R!==null&&(B[N]||(w.includes("ine")&&(i!==void 0?this.map.addLayer({id:N,type:"line",source:{type:"geojson",data:_},layout:i.layout,paint:i.paint,filter:["==",`${x}`,R]},f):this.map.addLayer({id:N,type:"line",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"line-color":"black","line-width":2,"line-opacity":1}},f)),w.includes("olygon")&&(i!==void 0?this.map.addLayer({id:N,type:"fill",source:{type:"geojson",data:_},filter:["==",`${x}`,R],layout:i.layout,paint:i.paint},f):this.map.addLayer({id:N,type:"fill",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"fill-color":"blue","fill-opacity":.6}},f)),w.includes("oint")&&(i!==void 0?this.map.addLayer({id:N,type:"circle",source:{type:"geojson",data:_},filter:["==",`${x}`,R],layout:i.layout,paint:i.paint},f):this.map.addLayer({id:N,type:"circle",source:{type:"geojson",data:_},layout:{visibility:"visible"},filter:["==",`${x}`,R],paint:{"circle-color":"red","circle-opacity":.85}},f)),B[N]=!0,this.addMenuItem(N)))})}}}catch(s){console.error(`Error fetching data: ${s.message}`)}}on(t,e){setTimeout(()=>{try{return this.map.on(t,e)}catch(n){console.error(`Error adding event ON listener: ${n.message}`)}},100)}setStyle(t,e){try{e!==void 0?this.map.setStyle(t,e):this.map.setStyle(t),this.map.on("styledata",()=>{if(window.document.querySelector(".maplibregl-compact-show")){var n=window.document.querySelector(".maplibregl-compact-show");n.classList.remove("maplibregl-compact-show")}this._dealOrto3dStyle(this.map.getStyle().name)})}catch(n){console.error(`Error setting style: ${n.message}`)}}addControl(t,e){try{e===void 0&&(e="top-right"),this.map.addControl(t,e)}catch(n){console.error(`Error adding control: ${n.message}`)}}setSky(t){try{t===void 0&&(this.map.style.stylesheet.id.includes("orto")?t={"sky-color":"#86bbd5","sky-horizon-blend":.3,"horizon-color":"#ffffff33","horizon-fog-blend":.1,"fog-ground-blend":.75,"fog-color":"#c5d6d6"}:this.map.style.stylesheet.id.includes("mapa_estandard_general")?t={"sky-color":"#a5f0f0","sky-horizon-blend":.3,"horizon-color":"#e1e3e3","horizon-fog-blend":.9,"fog-ground-blend":.85,"fog-color":"#c5d6d6"}:this.map.style.stylesheet.id.includes("icgc_mapa_vissir")?t={"sky-color":"#a5f0f0","sky-horizon-blend":.3,"horizon-color":"#e1e3e3","horizon-fog-blend":.9,"fog-ground-blend":.85,"fog-color":"#c5d6d6"}:this.map.style.stylesheet.id.includes("fosc")?t={"sky-color":"#232423","sky-horizon-blend":.3,"horizon-color":"#969996","horizon-fog-blend":.9,"fog-ground-blend":.85,"fog-color":"#383838"}:t={"sky-color":"#86bbd5","sky-horizon-blend":.3,"horizon-color":"#ffffff33","horizon-fog-blend":.1,"fog-ground-blend":.75,"fog-color":"#c5d6d6"}),this.map.setSky(t)}catch(e){console.error(`Error setting sky properties: ${e.message}`)}}addMouseCoordControl(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"bottom-left";try{this.map.addControl(new Ait(t),e)}catch(n){console.error(`Error adding mouse coordinate control: ${n.message}`)}}addGeolocateControl(t,e){try{e===void 0&&(e="top-right"),t===void 0?this.map.addControl(new Ps.GeolocateControl({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!0}),e):this.map.addControl(new Ps.GeolocateControl(t),e)}catch(n){console.error(`Error adding geolocate control: ${n.message}`)}}addFullscreenControl(t,e){try{e===void 0&&(e="top-right"),t===void 0?this.map.addControl(new Ps.FullscreenControl({container:HTMLElement}),e):this.map.addControl(new Ps.FullscreenControl(t),e)}catch(n){console.error(`Error adding fullscreen control: ${n.message}`)}}addLayer(t,e){try{this.map.addLayer(t,e)}catch(n){console.error(`Error adding layer: ${n.message}`)}}addImage(t,e,n){try{this.map.addImage(t,e,n)}catch(i){console.error(`Error adding image: ${i.message}`)}return this}addSource(t,e){try{this.map.addSource(t,e)}catch(n){console.error(`Error adding source: ${n.message}`)}return this}addSprite(t,e,n){try{this.map.addSprite(t,e,n)}catch(i){console.error(`Error adding sprite: ${i.message}`)}return this}areTilesLoaded(){return this.map.areTilesLoaded()}cameraForBounds(t,e){return this.map.cameraForBounds(t,e)}easeTo(t,e){return this.map.easeTo(t,e),this}fitBounds(t,e,n){return this.map.fitBounds(t,e,n),this}fitScreenCoordinates(t,e,n,i,s){return this.map.fitScreenCoordinates(t,e,n,i,s),this}flyTo(t,e){return this.map.flyTo(t,e),this}getBearing(){return this.map.getBearing()}getBounds(){return this.map.getBounds()}getCameraTargetElevation(){return this.map.getCameraTargetElevation()}getCanvas(){return this.map.getCanvas()}getCanvasContainer(){return this.map.getCanvasContainer()}getCenter(){return this.map.getCenter()}getContainer(){return this.map.getContainer()}getFeatureState(t){return this.map.getFeatureState(t)}getFilter(t){return this.map.getFilter(t)}getGlyphs(){return this.map.getGlyphs()}getImage(t){return this.map.getImage(t)}getLayer(t){return this.map.getLayer(t)}getLayersOrder(){return this.map.getLayersOrder()}getLayoutProperty(t,e){return this.map.getLayoutProperty(t,e)}getLight(){return this.map.getLight()}getMaxBounds(){return this.map.getMaxBounds()}getMaxPitch(){return this.map.getMaxPitch()}getMaxZoom(){return this.map.getMaxZoom()}getMinPitch(){return this.map.getMinPitch()}getMinZoom(){return this.map.getMinZoom()}getPadding(){return this.map.getPadding()}getPaintProperty(t,e){return this.map.getPaintProperty(t,e)}getPitch(){return this.map.getPitch()}getPixelRatio(){return this.map.getPixelRatio()}getRenderWorldCopies(){return this.map.getRenderWorldCopies()}getSource(t){return this.map.getSource(t)}getSprite(){return this.map.getSprite()}getStyle(){return this.map.getStyle()}getTerrain(){return this.map.getTerrain()}getZoom(){return this.map.getZoom()}hasControl(t){return this.map.hasControl(t)}hasImage(t){return this.map.hasImage(t)}isMoving(){return this.map.isMoving()}isRotating(){return this.map.isRotating()}isSourceLoaded(t){return this.map.isSourceLoaded(t)}isStyleLoaded(){return this.map.isStyleLoaded()}isZooming(){return this.map.isZooming()}jumpTo(t,e){return this.map.jumpTo(t,e)}listImages(){return this.map.listImages()}listens(t){return this.map.listens(t)}loadImage(t){return this.map.loadImage(t)}loaded(){return this.map.loaded()}LngLatBounds(t,e){return new Ps.LngLatBounds(t,e)}addProtocol(t,e){return this.map.addProtocol(t,e)}moveLayer(t,e){return this.map.moveLayer(t,e)}panBy(t,e,n){return this.map.panBy(t,e,n)}panTo(t,e,n){return this.map.panTo(t,e,n)}project(t){return this.map.project(t)}queryRenderedFeatures(t,e){return this.map.queryRenderedFeatures(t,e)}querySourceFeatures(t,e){return this.map.querySourceFeatures(t,e)}queryTerrainElevation(t){return this.map.queryTerrainElevation(t)}redraw(){return this.map.redraw()}remove(){return this.map.remove()}removeControl(t){return this.map.removeControl(t)}removeFeatureState(t,e){return this.map.removeFeatureState(t,e)}removeImage(t){return this.map.removeImage(t)}removeLayer(t){try{this.map.removeLayer(t)}catch(e){console.error(`Error removing layer: ${e.message}`)}}removeSource(t){try{this.map.removeSource(t)}catch(e){console.error(`Error removing source: ${e.message}`)}}removeSprite(t){return this.map.removeSprite(t)}resetNorth(t,e){return this.map.resetNorth(t,e)}resetNorthPitch(t,e){return this.map.resetNorthPitch(t,e)}resize(t){return this.map.resize(t)}rotateTo(t,e,n){return this.map.rotateTo(t,e,n)}setBearing(t,e){return this.map.setBearing(t,e)}setCenter(t,e){return this.map.setCenter(t,e)}setEventedParent(t,e){return this.map.setEventedParent(t,e)}setFeatureState(t,e){return this.map.setFeatureState(t,e)}setFilter(t,e,n){return this.map.setFilter(t,e,n)}setGlyphs(t,e){return this.map.setGlyphs(t,e)}setLayerZoomRange(t,e,n){return this.map.setLayerZoomRange(t,e,n)}setLayoutProperty(t,e,n,i){return this.map.setLayoutProperty(t,e,n,i)}setLight(t,e){return this.map.setLight(t,e)}setMaxBounds(t){return this.map.setMaxBounds(t)}setMaxPitch(t){return this.map.setMaxPitch(t)}setMaxZoom(t){return this.map.setMaxZoom(t)}setMinPitch(t){return this.map.setMinPitch(t)}setMinZoom(t){return this.map.setMinZoom(t)}setPadding(t,e){return this.map.setPadding(t,e)}setPaintProperty(t,e,n,i){return this.map.setPaintProperty(t,e,n,i)}setPitch(t,e){return this.map.setPitch(t,e)}setPixelRatio(t){return this.map.setPixelRatio(t)}setRenderWorldCopies(t){return this.map.setRenderWorldCopies(t)}setSprite(t,e){return this.map.setSprite(t,e)}setTerrain(t){return this.map.setTerrain(t)}setTransformRequest(t){return this.map.setTransformRequest(t)}setZoom(t,e){return this.map.setZoom(t,e)}snapToNorth(t,e){return this.map.snapToNorth(t,e)}stop(){return this.map.stop()}triggerRepaint(){return this.map.triggerRepaint()}unproject(t){return this.map.unproject(t)}updateImage(t,e){return this.map.updateImage(t,e)}zoomIn(t,e){return this.map.zoomIn(t,e)}zoomOut(t,e){return this.map.zoomOut(t,e)}zoomTo(t,e,n){return this.map.zoomTo(t,e,n)}addLayerGeoJSON(t,e){try{let n=this._dealOrderLayer(e);this.map.addSource(`${t.id}`,{type:"geojson",data:t.data}),this.map.addLayer({id:`${t.id}-layerIcgcMap`,type:t.type,source:`${t.id}`,layout:t.layout,paint:t.paint},n)}catch(n){console.error(`Error adding GeoJSON layer: ${n.message}`)}}addLayerWMS(t,e,n){try{let i=this._dealOrderLayer(n.layerPosition);n?(this.map.addSource(`${e}`,{type:"raster",tiles:[t],tileSize:256},i),this.map.addLayer({id:e,type:"raster",source:e,layout:n.layout,paint:n.paint},i)):(this.map.addSource(`${e}`,{type:"raster",tiles:[t],tileSize:256},i),this.map.addLayer({id:e,type:"raster",source:e,paint:{}},i))}catch(i){console.error(`Error adding WMS layer: ${i.message}`)}}addLogo(t){try{let e=document.getElementById("map"),n;n=document.createElement("div"),n.id="logos",e.appendChild(n);const i=document.createElement("img");i.src=t.url,i.style.height=t.height;const s=document.getElementById("logos"),a=document.createElement("a");a.id=t.id,a.href=t.href,a.target="_blank",a.style.position="relative",a.style.bottom="1px",a.appendChild(i),s.appendChild(a)}catch(e){console.error(`Error adding logo: ${e.message}`)}}addBasemapsICGC(t){try{const e=a=>{this.map.setStyle(a)};let n=document.getElementById("map"),i;i=document.createElement("div"),i.id="basemap-group",i.classList.add="filter-group",n.appendChild(i);const s=document.getElementById("basemap-group");for(const a of t)for(const o of Object.keys(Ln.baseStyles)){const d=Ln.baseStyles[o];if(a===d.url){const f=document.createElement("div");f.className="basemap-item",f.title=d.key,f.style.backgroundImage=`url('${d.image}')`,s.appendChild(f),f.addEventListener("click",()=>e(d.url))}}}catch(e){console.error(`Error adding basemaps: ${e.message}`)}}addBasemaps(t){try{const e=a=>{map.setStyle(a.url)};let n=document.getElementById("map"),i;i=document.createElement("div"),i.id="basemap-group",i.classList.add="basemap-group",n.appendChild(i);const s=document.getElementById("basemap-group");t.forEach(a=>{const o=document.createElement("div");o.className="basemap-item",o.title=a.label,o.style.backgroundImage=`url('${a.image}')`,s.appendChild(o),o.addEventListener("click",()=>e(a))})}catch(e){console.error(`Error adding basemaps: ${e.message}`)}}addFeatureQuery(t,e,n){try{let i;this.map.on("mouseenter",t,()=>{this.map.getCanvas().style.cursor="pointer"}),this.map.on("mouseleave",t,()=>{this.map.getCanvas().style.cursor=""}),this.map.on("click",s=>{let a=this.map.queryRenderedFeatures(s.point);if(a&&a[0].source.includes(t)){let o=[s.lngLat.lng,s.lngLat.lat];if(e!==void 0&&e.length>0&&e!=="all"){if(e!==null){let d="";e.forEach(f=>{let _=a[0].properties[f];d=d+`<h4>${_}</h4>`}),i=d,this.addPopup(o,i,n)}}else{let d="";for(const f in a[0].properties)d+="<b>"+f+"</b>:"+a[0].properties[f]+"<br>";i=d,this.addPopup(o,i,n)}}})}catch(i){console.error(`Error adding feature query: ${i.message}`)}}addScaleControl(t,e){try{var n=new Ps.ScaleControl(t);this.map.addControl(n,e)}catch(i){console.error(`Error adding scale: ${i.message}`)}}addExportControl(t,e){try{typeof t=="string"&&(e=t,t=void 0),t===void 0&&(t={PageSize:Xh.A4,PageOrientation:Vg.Landscape,Format:Ku.PNG,DPI:I2[300],Crosshair:!0,PrintableArea:!0,Local:"ca"},e="top-right"),this.map.addControl(new gnt(t),e)}catch(n){console.error(`Error adding export control: ${n.message}`)}}addMarker(t){try{let e,n;return t.text===void 0?e=new Ps.Marker(t.options).setLngLat(t.coord).addTo(this.map):(n=new Ps.Popup({offset:t.textOffset}).setHTML(t.text),e=new Ps.Marker(t.options).setLngLat(t.coord).setPopup(n).addTo(this.map)),e}catch(e){return console.error(`Error adding marker: ${e.message}`),null}}addPopup(t,e,n){try{return n.image===void 0?new Ps.Popup().setLngLat(t).setHTML(`
2583
2583
  <div class="popupBody">
2584
2584
  <div class="popupTop">
2585
2585
  ${n.title}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mapicgc-gl-js",
3
3
  "homepage": "https://openicgc.github.io/mapicgc-doc/",
4
- "version": "0.0.94",
4
+ "version": "0.0.95",
5
5
  "description": "mapicgc-gl-js library",
6
6
  "author": "Institut Cartogràfic i Geològic de Catalunya",
7
7
  "license": "BSD-3-Clause",
package/src/map/Map.js CHANGED
@@ -972,7 +972,8 @@ export default class Map {
972
972
  setSky(options) {
973
973
  try {
974
974
  if (options === undefined) {
975
- if (this.map.options.style.includes("orto")) {
975
+
976
+ if (this.map.style.stylesheet.id.includes("orto")) {
976
977
  options = {
977
978
  'sky-color': '#86bbd5',
978
979
  'sky-horizon-blend': 0.3,
@@ -982,7 +983,17 @@ setSky(options) {
982
983
  'fog-color': '#c5d6d6'
983
984
  };
984
985
  }
985
- if (this.map.options.style.includes("mapa_estandard_general")) {
986
+ else if (this.map.style.stylesheet.id.includes("mapa_estandard_general")) {
987
+ options = {
988
+ "sky-color": "#a5f0f0",
989
+ "sky-horizon-blend": 0.3,
990
+ "horizon-color": "#e1e3e3",
991
+ "horizon-fog-blend": 0.9,
992
+ "fog-ground-blend": 0.85,
993
+ "fog-color": "#c5d6d6",
994
+ };
995
+ }
996
+ else if (this.map.style.stylesheet.id.includes("icgc_mapa_vissir")) {
986
997
  options = {
987
998
  "sky-color": "#a5f0f0",
988
999
  "sky-horizon-blend": 0.3,
@@ -992,7 +1003,7 @@ setSky(options) {
992
1003
  "fog-color": "#c5d6d6",
993
1004
  };
994
1005
  }
995
- if (this.map.options.style.includes("fosc")) {
1006
+ else if (this.map.style.stylesheet.id.includes("fosc")) {
996
1007
  options = {
997
1008
  "sky-color": "#232423",
998
1009
  "sky-horizon-blend": 0.3,
@@ -1002,6 +1013,16 @@ setSky(options) {
1002
1013
  "fog-color": "#383838",
1003
1014
  };
1004
1015
  }
1016
+ else{
1017
+ options = {
1018
+ 'sky-color': '#86bbd5',
1019
+ 'sky-horizon-blend': 0.3,
1020
+ 'horizon-color': '#ffffff33',
1021
+ 'horizon-fog-blend': 0.1,
1022
+ 'fog-ground-blend': 0.75,
1023
+ 'fog-color': '#c5d6d6'
1024
+ };
1025
+ }
1005
1026
  }
1006
1027
 
1007
1028
 
@@ -40,7 +40,6 @@
40
40
 
41
41
  async function initMap() {
42
42
  const data = await mapicgcgl.Config.getConfigICGC();
43
-
44
43
  const map = new mapicgcgl.Map({
45
44
  container: "map",
46
45
  style: data.Styles.ORTO, // <-- add style basemap here
@@ -51,7 +50,9 @@
51
50
  pitch: 0,
52
51
  });
53
52
  map.on("load", () => {
53
+
54
54
  //add multiple ICGC basemaps and get a style menu component
55
+
55
56
  map.addFullscreenControl();
56
57
  let basemapsicgc = [data.Styles.ORTO, data.Styles.TOPO];
57
58
  map.addBasemapsICGC(basemapsicgc);