@phila/layerboard 3.0.0-beta.36 → 3.0.0-beta.38

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.
@@ -97,6 +97,8 @@ declare function __VLS_template(): {
97
97
  label: string;
98
98
  width?: number | undefined;
99
99
  radius?: number | undefined;
100
+ outlineColor?: string | undefined;
101
+ outlineWidth?: number | undefined;
100
102
  }[];
101
103
  popup: {
102
104
  title: string;
@@ -179,6 +181,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
179
181
  label: string;
180
182
  width?: number | undefined;
181
183
  radius?: number | undefined;
184
+ outlineColor?: string | undefined;
185
+ outlineWidth?: number | undefined;
182
186
  }[];
183
187
  popup: {
184
188
  title: string;
@@ -225,6 +229,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
225
229
  label: string;
226
230
  width?: number | undefined;
227
231
  radius?: number | undefined;
232
+ outlineColor?: string | undefined;
233
+ outlineWidth?: number | undefined;
228
234
  }[];
229
235
  popup: {
230
236
  title: string;
@@ -17,6 +17,8 @@ export declare function useLayerConfig(): {
17
17
  label: string;
18
18
  width?: number | undefined;
19
19
  radius?: number | undefined;
20
+ outlineColor?: string | undefined;
21
+ outlineWidth?: number | undefined;
20
22
  }[];
21
23
  popup: {
22
24
  title: string;
@@ -41,6 +41,8 @@ export declare function useLayerboard(config: LayerboardConfig): {
41
41
  readonly label: string;
42
42
  readonly width?: number | undefined;
43
43
  readonly radius?: number | undefined;
44
+ readonly outlineColor?: string | undefined;
45
+ readonly outlineWidth?: number | undefined;
44
46
  }[];
45
47
  readonly popup: {
46
48
  readonly title: string;
@@ -85,6 +87,8 @@ export declare function useLayerboard(config: LayerboardConfig): {
85
87
  readonly label: string;
86
88
  readonly width?: number | undefined;
87
89
  readonly radius?: number | undefined;
90
+ readonly outlineColor?: string | undefined;
91
+ readonly outlineWidth?: number | undefined;
88
92
  }[];
89
93
  readonly popup: {
90
94
  readonly title: string;
@@ -142,6 +146,8 @@ export declare function useLayerboard(config: LayerboardConfig): {
142
146
  label: string;
143
147
  width?: number | undefined;
144
148
  radius?: number | undefined;
149
+ outlineColor?: string | undefined;
150
+ outlineWidth?: number | undefined;
145
151
  }[];
146
152
  popup: {
147
153
  title: string;
@@ -184,6 +190,8 @@ export declare function useLayerboard(config: LayerboardConfig): {
184
190
  label: string;
185
191
  width?: number | undefined;
186
192
  radius?: number | undefined;
193
+ outlineColor?: string | undefined;
194
+ outlineWidth?: number | undefined;
187
195
  }[];
188
196
  popup: {
189
197
  title: string;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),K=require("@phila/phila-ui-map-core"),j=require("@phila/phila-ui-core");var Ce=typeof document<"u"?document.currentScript:null;const Ct={class:"map-panel"},Bt=e.defineComponent({__name:"MapPanel",props:{visibleLayers:{},layerOpacities:{},layerList:{},tiledLayers:{default:void 0},visibleTiledLayers:{default:void 0},tiledLayerOpacities:{default:void 0},cyclomediaConfig:{default:void 0},pictometryCredentials:{default:void 0},basemapControlPosition:{default:"top-right"},navigationControlPosition:{default:"bottom-right"},geolocationControlPosition:{default:"bottom-right"},searchControlPosition:{default:"top-left"},drawControlPosition:{default:"bottom-left"},cyclomediaButtonPosition:{default:"top-right"},pictometryButtonPosition:{default:"top-right"},initialZoom:{default:void 0},initialCenter:{default:void 0}},emits:["zoom","layerLoading","layerError"],setup(t,{emit:a}){const r=t,n=a,s=e.ref(null),i=e.ref(null),d=e.ref(0);function b(o){n("zoom",o),i.value&&(d.value=p(i.value))}function p(o){const u=o.getZoom(),v=o.getCenter().lat,S=559082264028e-3,E=v*Math.PI/180;return S*Math.cos(E)/Math.pow(2,u)}const w=e.ref({}),m=e.ref(null),y=e.ref(new Set);async function l(o,u,c,v,S){const E=encodeURIComponent(v||"1=1"),P=JSON.stringify({xmin:u.west,ymin:u.south,xmax:u.east,ymax:u.north,spatialReference:{wkid:4326}}),U=S!==void 0&&S<14?`&maxAllowableOffset=${360/(Math.pow(2,S)*512)}`:"",_=2e3;let oe=0,re=[],X=!0;for(;X;){const W=`${o}/query?where=${E}&geometry=${encodeURIComponent(P)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&resultRecordCount=${_}&resultOffset=${oe}${U}&f=geojson`,T=await fetch(W);if(!T.ok)throw new Error(`HTTP ${T.status}: ${T.statusText}`);const D=await T.json();D.features&&D.features.length>0?(re=re.concat(D.features),oe+=D.features.length,X=D.features.length===_):X=!1}return re=re.map(W=>{if(W.properties){const T={};for(const D of Object.keys(W.properties))T[D.toLowerCase()]=W.properties[D];return{...W,properties:T}}return W}),{type:"FeatureCollection",features:re}}async function g(o,u,c){const v=u.map(async S=>{const E=r.layerList.find(P=>P.config.id===S)?.config;if(E){n("layerLoading",S,!0);try{const P=await l(E.url,o,S,E.where,c);w.value={...w.value,[S]:P},n("layerError",S,null)}catch(P){const U=P instanceof Error?P.message:"Failed to load";n("layerError",S,U)}finally{n("layerLoading",S,!1)}}});await Promise.all(v)}function f(o){const u=new Set(o);for(const c of r.layerList)c.config.parentId&&u.has(c.config.parentId)&&u.add(c.config.id);return[...u]}async function L(o,u){const c=f([...r.visibleLayers]);await g(o,c,u)}function k(o){m.value=o.bounds,L(o.bounds,o.zoom)}function $(o){i.value=o;const u=o.getBounds();m.value={west:u.getWest(),south:u.getSouth(),east:u.getEast(),north:u.getNorth()};const c=o.getZoom();n("zoom",c),d.value=p(o),L(m.value,c)}e.watch(()=>r.visibleLayers,async()=>{if(Q.value.length>0&&ye(),m.value){const o=new Set(r.visibleLayers),u=[...o].filter(v=>!y.value.has(v));y.value=new Set(o);const c=f(u);if(c.length>0){const v=i.value?.getZoom();await g(m.value,c,v)}}});function B(o){if(r.visibleLayers.has(o))return!0;const u=r.layerList.find(c=>c.config.id===o)?.config;return!!u?.parentId&&r.visibleLayers.has(u.parentId)}function F(o){return!!w.value[o.id]}const x=e.computed(()=>r.layerList.filter(o=>o.config.type==="circle"&&B(o.config.id)&&F(o.config)).map(o=>o.config)),V=e.computed(()=>r.layerList.filter(o=>o.config.type==="fill"&&B(o.config.id)&&F(o.config)).map(o=>o.config)),M=e.computed(()=>r.layerList.filter(o=>o.config.type==="fill"&&o.config.outlinePaint&&B(o.config.id)&&F(o.config)).map(o=>o.config)),Z=e.computed(()=>r.layerList.filter(o=>o.config.type==="line"&&B(o.config.id)&&F(o.config)).map(o=>o.config));e.watch(Z,async o=>{if(o.length<2)return;await e.nextTick();const u=i.value;if(u)for(let c=o.length-1;c>=0;c--){const v=c<o.length-1?o[c+1].id:"highlight-lines";try{u.getLayer(o[c].id)&&u.moveLayer(o[c].id,v)}catch{}}});function z(o){return r.visibleTiledLayers?.has(o)??!1}function ee(o){return r.tiledLayerOpacities?.[o]??1}function ae(o){return`${o.replace(/\/$/,"")}/tile/{z}/{y}/{x}`}function je(o){return{type:"raster",tiles:[ae(o.url)],tileSize:256,attribution:o.attribution||""}}const Be=e.ref({}),Te=e.ref(new Set);async function xe(o){if(!Te.value.has(o.id)){Te.value.add(o.id);try{const u=o.url.replace(/\/$/,""),c=await fetch(`${u}?f=json`);if(!c.ok)return;const v=await c.json(),S=v.minScale||0;let E=v.maxScale||0;if(v.layers&&v.layers.length>0)for(const P of v.layers)P.maxScale&&P.maxScale>0&&(E===0||P.maxScale<E)&&(E=P.maxScale);E===0&&(E=72e3),Be.value={...Be.value,[o.id]:{minScale:S,maxScale:E}}}catch{}}}e.onMounted(()=>{if(r.tiledLayers)for(const o of r.tiledLayers)o.scaleBasedRendering&&xe(o)});function Pe(o){if(!o.scaleBasedRendering)return"tiled";const u=Be.value[o.id];if(!u)return"tiled";const c=d.value;return c===0||c>u.maxScale?"tiled":"dynamic"}const qe=e.computed(()=>r.tiledLayers?r.tiledLayers.filter(o=>z(o.id)?o.scaleBasedRendering?Pe(o)==="tiled":!0:!1):[]),he=e.computed(()=>r.tiledLayers?r.tiledLayers.filter(o=>z(o.id)&&o.scaleBasedRendering?Pe(o)==="dynamic":!1):[]);function Ee(o){return{type:"raster",tiles:[`${o.url.replace(/\/$/,"")}/export?bbox={bbox-epsg-3857}&bboxSR=3857&imageSR=3857&size=256,256&format=png32&transparent=true&f=image`],tileSize:256,attribution:o.attribution||""}}function ue(o){return{type:"geojson",data:w.value[o.id],tolerance:0}}function pe(o){return r.layerOpacities[o]??1}function $e(o){const u=pe(o.id),c=o.type==="circle"?"circle-opacity":o.type==="fill"?"fill-opacity":"line-opacity";if(o.type==="fill"&&o.paint["fill-opacity"]===0)return{...o.paint,"fill-opacity":0};const v=o.type==="circle"?"circle-color":o.type==="fill"?"fill-color":"line-color",S={...o.paint},E=S[v],P=S[c]===1,U=typeof E=="string"&&E.startsWith("rgba(");if(P&&U){if(u===1)return S;{const _=E.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(_&&_[4]){const[,oe,re,X,W]=_,T=parseFloat(W)*u;S[v]=`rgba(${oe}, ${re}, ${X}, ${T})`,S[c]=1}return S}}if(U){const _=E.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(_){const[,oe,re,X]=_;S[v]=`rgb(${oe}, ${re}, ${X})`}}return S[c]=u,S}function Ge(o){const u=pe(o.id);return{...o.outlinePaint,"line-opacity":u}}const Q=e.ref([]),me=e.ref(null),q=e.ref(0);function ve(o){const u=o.replace(/-outline$/,"");return r.layerList.find(v=>v.config.id===u)?.config}function Fe(o,u){return o.replace(/\{([^}]+)\}/g,(c,v)=>{const S=u[v];return S==null?"":String(S)})}function le(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ve(o,u,c){if(o==null)return"-";if(u?.dateFormat&&typeof o=="number"){const v=new Date(o);if(c&&u.dateFormat==="shortDateShortTime")return v.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"});switch(u.dateFormat){case"shortDateShortTime":return v.toLocaleDateString();case"longMonthDayYear":return v.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"});case"shortDate":return v.toLocaleDateString();case"longDate":return v.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"});default:return v.toLocaleDateString()}}if(typeof o=="number"){if(o>1e12&&!u)return new Date(o).toLocaleDateString();const v=u?.places,S=u?.digitSeparator??!0;if(v!==void 0){if(Number.isInteger(o)&&v>=0)return String(o);const E=o.toFixed(v);if(S){const P=E.split("."),U=P[0]||"0",_=P[1],oe=U.replace(/\B(?=(\d{3})+(?!\d))/g,",");return _?`${oe}.${_}`:oe}return E}return Number.isInteger(o)?String(o):S?o.toLocaleString():String(o)}return String(o)}function Ie(o){const u=new Set;return o.filter(c=>{const S=`${c.layer.id.replace(/-outline$/,"")}:${JSON.stringify(c.properties)}`;return u.has(S)?!1:(u.add(S),!0)})}function ie(o,u){const c=w.value[o];if(!c?.features)return null;const v=u.objectid??u.OBJECTID??u.FID;if(v!=null){const S=c.features.find(E=>(E.properties?.objectid??E.properties?.OBJECTID??E.properties?.FID)===v);if(S)return S.geometry}return null}function He(o,u){const c=new Map;return u.forEach((v,S)=>{c.set(v.id,S)}),o.sort((v,S)=>{const E=v.layer.id.replace(/-outline$/,""),P=S.layer.id.replace(/-outline$/,""),U=c.get(E)??-1;return(c.get(P)??-1)-U})}function G(o){const u=i.value;if(!u)return;const c=[];r.layerList.forEach(T=>{const D=T.config;B(D.id)&&(c.push(D.id),D.outlinePaint&&c.push(`${D.id}-outline`))});const v=c.filter(T=>u.getLayer(T));if(v.length===0)return;const S=u.project([o.lngLat.lng,o.lngLat.lat]),E=10,P=[[S.x-E,S.y-E],[S.x+E,S.y+E]],U=u.queryRenderedFeatures(P,{layers:v});if(U.length===0)return;const _=Ie(U),oe=r.layerList.map(T=>T.config),X=He(_,oe).map(T=>{const D=T.layer.id.replace(/-outline$/,""),Y=ve(D);if(!Y)return null;const Ke=ie(Y.id,T.properties||{});return{layerId:Y.id,layerTitle:Y.title,properties:T.properties||{},geometry:Ke||T.geometry,popupConfig:Y.popup}}).filter(T=>T!==null);if(X.length===0)return;X.sort((T,D)=>{const Y=T.popupConfig?.popupSortField,Ke=D.popupConfig?.popupSortField;if(!Y||Y!==Ke)return 0;const Qe=T.properties[Y],Xe=D.properties[Y];if(Qe==null||Xe==null)return 0;const st=T.popupConfig?.popupSortOrder!=="asc";return Qe<Xe?st?1:-1:Qe>Xe?st?-1:1:0}),Q.value=X,q.value=0,me.value=[o.lngLat.lng,o.lngLat.lat];const W=X[0];if(W){const T=ve(W.layerId);if(T){const D=O(W.geometry),Y=I(T.id,T.type);C.value={geometry:W.geometry,geometryType:D,layerId:T.id,properties:W.properties,originalStyle:Y}}}}function ye(){Q.value=[],me.value=null,q.value=0,C.value=null}function ge(o){if(Q.value.length===0)return;const u=o.target;if(!(u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable))switch(o.key){case"ArrowLeft":case"ArrowUp":o.preventDefault(),ze();break;case"ArrowRight":case"ArrowDown":o.preventDefault(),te();break;case"Escape":o.preventDefault(),ye();break}}e.onMounted(()=>{window.addEventListener("keydown",ge)}),e.onUnmounted(()=>{window.removeEventListener("keydown",ge)});function te(){const o=Q.value.length;o<=1||q.value>=o-1||(q.value=q.value+1)}function ze(){Q.value.length<=1||q.value<=0||(q.value=q.value-1)}const H=e.computed(()=>Q.value.length===0?null:Q.value[q.value]),be=e.computed(()=>{const o=H.value;return!o||!o.popupConfig?o?.layerTitle||"":Fe(o.popupConfig.title,o.properties)}),Le=e.computed(()=>{const o=H.value;if(!o)return"";let u='<div class="popup-content">';if(u+=`<h3 class="popup-title">${le(be.value)}</h3>`,o.popupConfig?.fields?.length){u+=`<table class="popup-table" aria-label="${le(be.value)}">`;for(const c of o.popupConfig.fields){const v=Ve(o.properties[c.field],c.format,o.popupConfig.showTime),S=c.label.toLowerCase(),E=S.includes("url")||S.includes("website"),P=v.startsWith("http://")||v.startsWith("https://")||v.startsWith("www.")||E&&v.includes("."),U=v.startsWith("http://")||v.startsWith("https://")?v:`https://${v}`,_=P?`<a href="${le(U)}" target="_blank" rel="noopener noreferrer">${le(v)}</a>`:le(v);u+=`<tr><th scope="row">${le(c.label)}</th><td>${_}</td></tr>`}u+="</table>"}return u+="</div>",u}),J=e.ref({type:"FeatureCollection",features:[]}),ke=e.ref({type:"FeatureCollection",features:[]}),we=e.ref({type:"FeatureCollection",features:[]}),Je={"circle-radius":["get","highlightRadius"],"circle-color":"#00FFFF","circle-opacity":.8,"circle-stroke-width":2,"circle-stroke-color":"#FFFFFF"},De={"line-width":["get","highlightWidth"],"line-color":"#00FFFF","line-opacity":.9},h={"fill-color":"#808080","fill-opacity":.5},C=e.ref(null);function O(o){return o.type}function I(o,u){const c=ve(o);if(!c)return{radius:5,width:2};const v=c.paint||{};if(u==="circle"){const S=v["circle-radius"];return typeof S=="number"?{radius:S}:{radius:5}}if(u==="line"||u==="fill"){const S=v["line-width"];if(typeof S=="number")return{width:S};if(c.outlinePaint&&c.outlinePaint["line-width"]){const E=c.outlinePaint["line-width"];if(typeof E=="number")return{width:E}}return{width:2}}return{radius:5,width:2}}function R(o){return!o||o.length===0?[]:o[0]??[]}function se(o){const{geometry:u,geometryType:c,originalStyle:v}=o;if(c==="Point"||c==="MultiPoint"){const E=(v.radius||5)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:u,properties:{highlightRadius:E}}]}}if(c==="LineString"||c==="MultiLineString"){const E=(v.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:u,properties:{highlightWidth:E}}]}}if(c==="Polygon"){const S=u.coordinates,E=R(S),U=(v.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:E},properties:{highlightWidth:U}}]}}if(c==="MultiPolygon"){const S=u.coordinates,P=(v.width||2)+3;return{type:"FeatureCollection",features:S.map(_=>({type:"Feature",geometry:{type:"LineString",coordinates:R(_)},properties:{highlightWidth:P}}))}}return{type:"FeatureCollection",features:[]}}function Se(o){const{geometry:u,geometryType:c}=o;return c==="Polygon"||c==="MultiPolygon"?{type:"FeatureCollection",features:[{type:"Feature",geometry:u,properties:{}}]}:{type:"FeatureCollection",features:[]}}function kt(o){if(!o){wt();return}const u=se(o);o.geometryType==="Point"||o.geometryType==="MultiPoint"?(J.value=u,ke.value={type:"FeatureCollection",features:[]},we.value={type:"FeatureCollection",features:[]}):(ke.value=u,J.value={type:"FeatureCollection",features:[]},we.value=Se(o))}function wt(){J.value={type:"FeatureCollection",features:[]},ke.value={type:"FeatureCollection",features:[]},we.value={type:"FeatureCollection",features:[]}}e.watch(C,o=>{kt(o)}),e.watch(()=>r.visibleLayers,o=>{C.value&&!o.has(C.value.layerId)&&(C.value=null,ye())},{deep:!0}),e.watch(q,()=>{const o=H.value;if(!o){C.value=null;return}const u=ve(o.layerId);if(u){const c=O(o.geometry),v=I(u.id,u.type);C.value={geometry:o.geometry,geometryType:c,layerId:u.id,properties:o.properties,originalStyle:v}}});const it=e.ref(null);function St(o){const[u,c]=o.geometry.coordinates;it.value=[u,c]}return(o,u)=>(e.openBlock(),e.createElementBlock("div",Ct,[e.createVNode(e.unref(K.Map),{ref_key:"mapRef",ref:s,zoom:r.initialZoom,center:r.initialCenter,"navigation-controls":{position:r.navigationControlPosition},"geolocation-control":{position:r.geolocationControlPosition},"basemap-change-controls":{toggle:!0,dropdown:!0,position:r.basemapControlPosition},"map-search-control":{position:r.searchControlPosition},"enable-cyclomedia":!0,"cyclomedia-config":r.cyclomediaConfig,"cyclomedia-button-position":r.cyclomediaButtonPosition,"enable-pictometry":!0,"pictometry-credentials":r.pictometryCredentials,"pictometry-button-position":r.pictometryButtonPosition,"tool-panel-layout":"vertical","tool-panel-split-ratio":50,onZoom:b,onClick:ye,onMoveend:k,onLoad:$,onSearchResult:St},{default:e.withCtx(()=>[r.drawControlPosition!==null?(e.openBlock(),e.createBlock(e.unref(K.DrawTool),{key:0,position:r.drawControlPosition},null,8,["position"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(qe.value,c=>(e.openBlock(),e.createBlock(e.unref(K.RasterLayer),{id:"tiled-"+c.id,key:"tiled-"+c.id,source:je(c),paint:{"raster-opacity":ee(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles"},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(he.value,c=>(e.openBlock(),e.createBlock(e.unref(K.RasterLayer),{id:"dynamic-"+c.id,key:"dynamic-"+c.id,source:Ee(c),paint:{"raster-opacity":ee(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles"},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,c=>(e.openBlock(),e.createBlock(e.unref(K.CircleLayer),{id:c.id,key:c.id,source:ue(c),paint:$e(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,c=>(e.openBlock(),e.createBlock(e.unref(K.FillLayer),{id:c.id,key:c.id,source:ue(c),paint:$e(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,c=>(e.openBlock(),e.createBlock(e.unref(K.LineLayer),{id:c.id+"-outline",key:c.id+"-outline",source:ue(c),paint:Ge(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.value,c=>(e.openBlock(),e.createBlock(e.unref(K.LineLayer),{id:c.id,key:c.id,source:ue(c),paint:$e(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),e.createVNode(e.unref(K.CircleLayer),{id:"highlight-circles",key:"highlight-circles-layer",source:{type:"geojson",data:J.value},paint:Je},null,8,["source"]),e.createVNode(e.unref(K.FillLayer),{id:"highlight-fill",key:"highlight-fill-layer",source:{type:"geojson",data:we.value},paint:h},null,8,["source"]),e.createVNode(e.unref(K.LineLayer),{id:"highlight-lines",key:"highlight-lines-layer",source:{type:"geojson",data:ke.value},paint:De},null,8,["source"]),e.createVNode(e.unref(K.MapMarker),{"lng-lat":it.value,color:"#2176d2"},null,8,["lng-lat"]),H.value&&me.value?(e.openBlock(),e.createBlock(e.unref(K.MapPopup),{key:1,"lng-lat":me.value,html:Le.value,"close-on-click":!1,offset:[0,-15],"show-navigation":Q.value.length>1,"current-feature-index":q.value,"total-features":Q.value.length,"layer-name":H.value.layerTitle,onClose:ye,onNext:te,onPrevious:ze},null,8,["lng-lat","html","show-navigation","current-feature-index","total-features","layer-name"])):e.createCommentVNode("",!0)]),_:1},8,["zoom","center","navigation-controls","geolocation-control","basemap-change-controls","map-search-control","cyclomedia-config","cyclomedia-button-position","pictometry-credentials","pictometry-button-position"])]))}}),ce=(t,a)=>{const r=t.__vccOpts||t;for(const[n,s]of a)r[n]=s;return r},mt=ce(Bt,[["__scopeId","data-v-1f8b1f59"]]);function Ye(t){let a=t.split("?")[0]||t;return a=a.replace(/\/query$/,""),a=a.replace(/\/$/,""),a=a.replace(/^https?:\/\//,""),a.toLowerCase()}const xt=["disabled"],Et=e.defineComponent({inheritAttrs:!1,__name:"PhlButton",props:{href:{},to:{},target:{},rel:{},disabled:{type:Boolean,default:!1},clickTarget:{},variant:{default:"primary"},size:{default:"medium"},iconOnly:{type:Boolean,default:!1},iconRight:{type:Boolean},text:{},className:{},iconDefinition:{},iconClass:{},src:{},svgRaw:{}},setup(t){const a=t,r=d=>"href"in d&&d.href!==void 0||"to"in d&&d.to!==void 0,n=e.computed(()=>j.cn("phila-button",`phila-button--${a.variant}`,a.size&&`is-${a.size}`,a.iconOnly&&"icon-button",a.iconOnly&&a.variant==="standard"&&"icon-button--standard",a.className)),s=e.computed(()=>r(a)?"to"in a&&a.to!==void 0?{to:a.to,disabled:a.disabled,className:n.value}:{href:a.href,target:a.target,rel:a.rel,disabled:a.disabled,className:n.value}:{}),i=e.computed(()=>({iconDefinition:a.iconDefinition,iconClass:a.iconClass,src:a.src,iconRight:a.iconRight,iconOnly:a.iconOnly,text:a.text,size:a.size}));return(d,b)=>r(a)?(e.openBlock(),e.createBlock(e.unref(j.BaseLink),e.mergeProps({key:0},{...s.value,...d.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(j.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(a.text),1)])]),_:3},16)]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:1,type:"button",disabled:a.disabled,class:n.value},d.$attrs),[e.createVNode(e.unref(j.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(a.text),1)])]),_:3},16)],16,xt))}});var $t={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"]},Vt=$t,Nt={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},Mt=Nt;const Tt=["for"],Pt={class:"state-layer"},Ft={class:"content"},It={class:"input-text-container"},zt=["id","placeholder","aria-label"],Dt={key:1,class:"has-text-body-small phila-supporting-text"},Ot={key:2,class:"has-text-body-small phila-error-text"},Rt=e.defineComponent({inheritAttrs:!1,__name:"TextField",props:{modelValue:{default:void 0},className:{default:""},label:{default:""},id:{default:`phila-text-field-${Math.random().toString(36).substring(2,9)}`},supportingText:{default:""},placeholder:{default:""},leadingIcon:{default:""},trailingIcon:{default:""},error:{default(){return[]}}},emits:["update:modelValue"],setup(t,{emit:a}){const r=e.useAttrs(),n=t,s=e.computed(()=>typeof n.error=="string"?n.error:n.error[0]),i=e.toRef(n,"id"),d=a,b=e.ref(""),p=e.computed({get:()=>n.modelValue!==void 0?n.modelValue:b.value,set:f=>{d("update:modelValue",f),b.value=f}}),w=e.computed(()=>{const f=["default-class"];return r.disabled!=null&&f.push("phila-input--disabled"),s.value&&f.push("phila-input--error"),r.required!=null&&f.push("phila-input--required"),j.cn(...f)}),m=e.computed(()=>{const f=[];return p.value!==""&&f.push("phila-text-field--filled"),n.className&&f.push(n.className),j.cn(...f)}),y=e.computed(()=>{if(!(n.label||r["aria-label"]))return n.placeholder||void 0}),l=e.ref(null),g=f=>{f.target.closest("button")||l.value?.focus()};return(f,L)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["phila-input",w.value])},[n.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:i.value,class:"has-text-label-small phila-label"},e.toDisplayString(n.label),9,Tt)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["phila-text-field",m.value]),onClick:g},[e.createElementVNode("div",Pt,[n.leadingIcon?(e.openBlock(),e.createBlock(e.unref(j.Icon),{key:0,"icon-class":n.leadingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.createElementVNode("div",Ft,[e.createElementVNode("div",It,[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:i.value,ref_key:"inputRef",ref:l,"onUpdate:modelValue":L[0]||(L[0]=k=>p.value=k),class:"phila-text-field-input has-text-body-default",placeholder:n.placeholder,"aria-label":y.value},e.unref(r)),null,16,zt),[[e.vModelDynamic,p.value]])])]),p.value!=""?(e.openBlock(),e.createBlock(e.unref(Et),{key:1,variant:"standard",size:"small","icon-only":"","icon-definition":e.unref(Mt),onClick:L[1]||(L[1]=k=>p.value="")},null,8,["icon-definition"])):e.createCommentVNode("",!0),n.trailingIcon?(e.openBlock(),e.createBlock(e.unref(j.Icon),{key:2,size:"small","icon-class":n.trailingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"trailing-action")])],2),n.supportingText?(e.openBlock(),e.createElementBlock("div",Dt,e.toDisplayString(n.supportingText),1)):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",Ot,[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(Vt),size:"small",inline:"",decorative:""},null,8,["icon-definition"]),e.createTextVNode(" "+e.toDisplayString(s.value),1)])):e.createCommentVNode("",!0)],2))}});var _t={prefix:"fas",iconName:"filter",icon:[512,512,[],"f0b0","M32 64C19.1 64 7.4 71.8 2.4 83.8S.2 109.5 9.4 118.6L192 301.3 192 416c0 8.5 3.4 16.6 9.4 22.6l64 64c9.2 9.2 22.9 11.9 34.9 6.9S320 492.9 320 480l0-178.7 182.6-182.6c9.2-9.2 11.9-22.9 6.9-34.9S492.9 64 480 64L32 64z"]},At={prefix:"fas",iconName:"caret-right",icon:[256,512,[],"f0da","M249.3 235.8c10.2 12.6 9.5 31.1-2.2 42.8l-128 128c-9.2 9.2-22.9 11.9-34.9 6.9S64.5 396.9 64.5 384l0-256c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l128 128 2.2 2.4z"]},Ut={prefix:"fas",iconName:"caret-left",icon:[256,512,[],"f0d9","M7.7 235.8c-10.3 12.6-9.5 31.1 2.2 42.8l128 128c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6l0-256c0-12.9-7.8-24.6-19.8-29.6s-25.7-2.2-34.9 6.9l-128 128-2.2 2.4z"]},ct={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},Zt={prefix:"fas",iconName:"bars",icon:[448,512,["navicon"],"f0c9","M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"]},Wt={prefix:"fas",iconName:"circle-info",icon:[512,512,["info-circle"],"f05a","M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zM224 160a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm-8 64l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-64-24 0c-13.3 0-24-10.7-24-24s10.7-24 24-24z"]};const jt={key:0,class:"loading-indicator",role:"status"},qt=["aria-label"],Gt={key:2,class:"zoom-indicator"},Ht=e.defineComponent({__name:"LayerStatusIndicators",props:{loading:{type:Boolean},error:{},unavailable:{type:Boolean}},setup(t){return(a,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[t.loading&&!t.unavailable?(e.openBlock(),e.createElementBlock("span",jt," Loading... ")):e.createCommentVNode("",!0),t.error?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":t.error,role:"status"}," Error ",8,qt)):e.createCommentVNode("",!0),t.unavailable?(e.openBlock(),e.createElementBlock("span",Gt," (zoom in) ")):e.createCommentVNode("",!0)],64))}}),_e=ce(Ht,[["__scopeId","data-v-19b1b402"]]),Jt={class:"opacity-control"},Kt=["for"],Qt=["id","value","aria-label"],Xt=e.defineComponent({__name:"LayerOpacitySlider",props:{layerId:{},layerName:{},opacity:{}},emits:["update:opacity"],setup(t,{emit:a}){const r=a;function n(s){const i=s.target;r("update:opacity",parseFloat(i.value))}return(s,i)=>(e.openBlock(),e.createElementBlock("div",Jt,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+t.layerId}," Opacity: "+e.toDisplayString(Math.round(t.opacity*100))+"% ",9,Kt),e.createElementVNode("input",{id:"opacity-"+t.layerId,type:"range",min:"0",max:"1",step:"0.05",value:t.opacity,"aria-label":"Opacity for "+t.layerName,class:"opacity-slider",onInput:n},null,40,Qt)]))}}),et=ce(Xt,[["__scopeId","data-v-1a025f6a"]]),Yt=["aria-label"],eo={class:"legend-label"},to=e.defineComponent({__name:"LayerLegend",props:{items:{},label:{}},setup(t){return(a,r)=>(e.openBlock(),e.createElementBlock("ul",{class:"layer-legend","aria-label":t.label},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(n,s)=>(e.openBlock(),e.createElementBlock("li",{key:s,class:"legend-item"},[n.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:n.color}),"aria-hidden":"true"},null,4)):n.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:n.color,height:`${n.width||2}px`}),"aria-hidden":"true"},null,4)):n.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:n.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",eo,e.toDisplayString(n.label),1)]))),128))],8,Yt))}}),tt=ce(to,[["__scopeId","data-v-62e210e3"]]);function ot(t){function a(d){return t().visibleLayerIds.has(d)}function r(d){return t().layerOpacities[d]??1}function n(d){return t().loadingLayerIds.has(d)}function s(d){return t().layerErrors[d]||null}function i(d){const b=t().currentZoom,p=d.minZoom,w=d.maxZoom;return!(p!==void 0&&b<p||w!==void 0&&b>w)}return{isVisible:a,getLayerOpacity:r,isLayerLoading:n,getLayerError:s,isLayerAvailableAtZoom:i}}const oo={class:"layer-panel"},no={key:0,class:"search-box"},ao={key:1,class:"topics-container"},lo={class:"layer-row"},ro=["href","aria-label"],io={key:1,class:"metadata-placeholder"},so=["checked","disabled","onChange"],co={class:"layer-title"},uo={key:0,class:"no-results"},fo=e.defineComponent({__name:"LayerPanel",props:{layerList:{},visibleLayers:{},layerOpacities:{},loadingLayers:{},layerErrors:{},currentZoom:{},searchQuery:{},layerMetadata:{},mode:{default:"flat"},showSearch:{type:Boolean,default:!0},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},searchPlaceholder:{default:"Filter layers..."}},emits:["toggleLayer","setOpacity","updateSearch"],setup(t,{emit:a}){const r=t,n=a,s=e.computed(()=>{if(!r.searchQuery.trim())return r.layerList;const f=r.searchQuery.toLowerCase();return r.layerList.filter(L=>L.config.title.toLowerCase().includes(f))});function i(f){const L=Ye(f);return r.layerMetadata[L]||null}const d=e.computed(()=>r.layerList.some(f=>i(f.config.url))),{isVisible:b,getLayerOpacity:p,isLayerLoading:w,getLayerError:m,isLayerAvailableAtZoom:y}=ot(()=>({visibleLayerIds:r.visibleLayers,layerOpacities:r.layerOpacities,loadingLayerIds:r.loadingLayers,layerErrors:r.layerErrors,currentZoom:r.currentZoom})),l=e.computed({get:()=>r.searchQuery,set:f=>n("updateSearch",f)});function g(f){n("toggleLayer",f)}return(f,L)=>(e.openBlock(),e.createElementBlock("div",oo,[t.showSearch?(e.openBlock(),e.createElementBlock("div",no,[e.createVNode(e.unref(Rt),{modelValue:l.value,"onUpdate:modelValue":L[0]||(L[0]=k=>l.value=k),placeholder:t.searchPlaceholder,"class-name":"layer-search-field"},{"trailing-action":e.withCtx(()=>[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(_t),size:"small",inline:"",decorative:""},null,8,["icon-definition"])]),_:1},8,["modelValue","placeholder"])])):e.createCommentVNode("",!0),t.mode==="topics"?(e.openBlock(),e.createElementBlock("div",ao,[e.renderSlot(f.$slots,"topics",{},()=>[L[2]||(L[2]=e.createElementVNode("div",{class:"no-topics"},' No topic components provided. Use the "topics" slot to add TopicAccordion components. ',-1))],!0)])):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["layer-list",{"has-metadata":d.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,k=>(e.openBlock(),e.createElementBlock("div",{key:k.config.id,class:"layer-item"},[e.createElementVNode("div",lo,[i(k.config.url)?(e.openBlock(),e.createElementBlock("a",{key:0,href:i(k.config.url)||"",target:"_blank",rel:"noopener noreferrer",class:"metadata-link","aria-label":"View metadata for "+k.config.title,onClick:L[1]||(L[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(Wt),size:"small",inline:"",decorative:""},null,8,["icon-definition"])],8,ro)):d.value?(e.openBlock(),e.createElementBlock("span",io)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!e.unref(y)(k.config),"layer-error":e.unref(m)(k.config.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(b)(k.config.id),disabled:!e.unref(y)(k.config),onChange:$=>g(k.config.id)},null,40,so),e.createElementVNode("span",co,[e.createTextVNode(e.toDisplayString(k.config.title)+" ",1),e.createVNode(_e,{loading:e.unref(w)(k.config.id),error:e.unref(m)(k.config.id),unavailable:!e.unref(y)(k.config)},null,8,["loading","error","unavailable"])])],2)]),t.showOpacity&&e.unref(b)(k.config.id)&&e.unref(y)(k.config)?(e.openBlock(),e.createBlock(et,{key:0,"layer-id":k.config.id,"layer-name":k.config.title,opacity:e.unref(p)(k.config.id),"onUpdate:opacity":$=>n("setOpacity",k.config.id,$)},null,8,["layer-id","layer-name","opacity","onUpdate:opacity"])):e.createCommentVNode("",!0),t.showLegend&&e.unref(b)(k.config.id)&&e.unref(y)(k.config)&&k.config.legend?.length?(e.openBlock(),e.createBlock(tt,{key:1,items:k.config.legend,label:"Legend for "+k.config.title},null,8,["items","label"])):e.createCommentVNode("",!0)]))),128)),s.value.length===0?(e.openBlock(),e.createElementBlock("div",uo,'No layers match "'+e.toDisplayString(t.searchQuery)+'"',1)):e.createCommentVNode("",!0)],2))]))}}),yt=ce(fo,[["__scopeId","data-v-e48bb978"]]),po={esriSLSSolid:null,esriSLSDash:[6,1.5],esriSLSDot:[1,1.5],esriSLSDashDot:[6,1.5,1,1.5],esriSLSDashDotDot:[6,1.5,1,1.5,1,1.5],esriSLSNull:null};function Me(t){if(t)return po[t]??void 0}function mo(t,a,r,n,s){const i=[];let d=a[0],b=[t[0]],p=0;for(let l=1;l<t.length;l++)a[l]===d?b.push(t[l]):(i.push({style:d,breaks:b,startIndex:p}),d=a[l],b=[t[l]],p=l);i.push({style:d,breaks:b,startIndex:p});const w=[],m=new Set;let y=n.minValue??0;for(let l=0;l<i.length;l++){const g=i[l],f=g.breaks,L=Me(g.style),k=l===0?null:i[l-1].breaks[i[l-1].breaks.length-1].classMaxValue,$=f[f.length-1].classMaxValue;let B;const F=!!n.defaultSymbol;k===null?B=`${!F&&n.minValue!=null?`${r} >= ${n.minValue} AND `:""}${r} <= ${$}`:l===i.length-1&&F?B=`${r} > ${k}`:B=`${r} > ${k} AND ${r} <= ${$}`;const x={"line-opacity":ne(s)};if(L&&(x["line-dasharray"]=L),f.length===1)x["line-color"]=N(f[0].symbol?.color),x["line-width"]=A(f[0].symbol?.width||2);else{const z=["step",["get",r]],ee=["step",["get",r]];z.push(N(f[0].symbol?.color)),ee.push(A(f[0].symbol?.width||2));for(let ae=1;ae<f.length;ae++)z.push(f[ae-1].classMaxValue),z.push(N(f[ae].symbol?.color)),ee.push(f[ae-1].classMaxValue),ee.push(A(f[ae].symbol?.width||2));x["line-color"]=z,x["line-width"]=ee}const V=[];for(const z of f)V.push({type:"line",color:N(z.symbol?.color),width:A(z.symbol?.width||2),label:z.label||`${y} - ${z.classMaxValue}`}),y=z.classMaxValue+1;const M=g.style.replace("esriSLS","").toLowerCase();let Z;l===0?Z="":m.has(M)?Z=`-${M}-${l}`:Z=`-${M}`,m.add(M),w.push({suffix:Z,where:B,paint:x,legend:V})}return w}function yo(t,a,r,n,s){const i=new Map;for(const w of t){const m=w.symbol?.style||"esriSLSSolid";i.has(m)||i.set(m,[]),i.get(m).push(w)}const d=[],b=new Set;let p=!0;for(const[w,m]of i){const y=Me(w),g=m.map(B=>`${a} = '${String(B.value).replace(/'/g,"''")}'`).join(" OR "),f={"line-opacity":ne(n)};if(y&&(f["line-dasharray"]=y),m.length===1)f["line-color"]=N(m[0].symbol?.color),f["line-width"]=A(m[0].symbol?.width||2);else{const B=["match",["to-string",["get",a]]];for(const F of m)B.push(Re(F.value)),B.push(N(F.symbol?.color));B.push(r?N(r.color):"rgba(0, 0, 0, 0)"),f["line-color"]=B,f["line-width"]=A(m[0].symbol?.width||2)}const L=[];for(const B of m){const F=String(B.value),V=s?.get(F)||B.label||F;L.push({type:"line",color:N(B.symbol?.color),width:A(B.symbol?.width||1),label:V})}const k=w.replace("esriSLS","").toLowerCase();let $;p?$="":b.has(k)?$=`-${k}-${d.length}`:$=`-${k}`,b.add(k),p=!1,d.push({suffix:$,where:g,paint:f,legend:L})}return d}function N(t){if(!t||!Array.isArray(t)||t.length<3)return"#888888";const a=t[0],r=t[1],n=t[2],i=(t[3]??255)/255;return i===1?`#${a.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`:`rgba(${a}, ${r}, ${n}, ${i.toFixed(2)})`}function ne(t){return t!==void 0?t:1}function A(t){return Math.round(t*(96/72)*10)/10}const go=559082264;function ut(t){return!t||t<=0?null:Math.round(Math.log2(go/t)*100)/100}function ho(t,a){const r={};if(t&&t>0){const n=ut(t);n!==null&&(r.minZoom=n)}if(a&&a>0){const n=ut(a);n!==null&&(r.maxZoom=n)}return r}function Ze(t){if(!t)return"fill";switch(t.type){case"esriSFS":return"fill";case"esriSLS":return"line";case"esriSMS":return"circle";case"esriPMS":return"circle";case"esriPFS":return"fill";default:return"fill"}}function fe(t){return!(!t||t.style==="esriSLSNull"||t.color===null||t.width===0||t.color&&t.color[3]===0)}function Re(t){return String(t)}function gt(t,a,r){const n=t.symbol,s=Ze(n);let i={},d=[],b=null;if(s==="fill"&&n){const p=n.color===null?0:n.color?.[3]??255,w=p===0?"rgba(0, 0, 0, 0)":N(n.color),m=p===0?0:p<255?1:ne(a);if(i={"fill-color":w,"fill-opacity":m},fe(n.outline)){const y=A(n.outline.width||1);b={"line-color":N(n.outline.color),"line-width":y}}d=[{type:"fill",color:N(n.color),label:t.label||"Feature"}]}else if(s==="line"&&n){i={"line-color":N(n.color),"line-width":A(n.width||1),"line-opacity":ne(a)};const p=Me(n.style);p&&(i["line-dasharray"]=p),d=[{type:"line",color:N(n.color),width:A(n.width||1),label:t.label||"Feature"}]}else if(s==="circle"&&n){const p=Math.round((n.size||6)*.71*100)/100;i={"circle-color":N(n.color),"circle-radius":p,"circle-opacity":ne(a)},fe(n.outline)&&(i["circle-stroke-color"]=N(n.outline.color),i["circle-stroke-width"]=A(n.outline.width||1)),d=[{type:"circle",color:N(n.color),label:t.label||"Feature"}]}return{paint:i,legend:d,geomType:s,outlinePaint:b}}function vo(t,a,r){const n=t.field1.toLowerCase(),s=t.uniqueValueInfos||[],i=t.defaultSymbol;if(s.length===0)return gt({...t,symbol:i},a);const d=s[0]?.symbol||i,b=Ze(d);let p={};const w=[];let m=null;if(b==="fill"){const y=["match",["to-string",["get",n]]];for(const l of s){y.push(Re(l.value)),y.push(N(l.symbol?.color));const g=String(l.value),L=r?.get(g)||l.label||g;w.push({type:"fill",color:N(l.symbol?.color),label:L})}if(y.push(i?N(i.color):"rgba(0, 0, 0, 0)"),p={"fill-color":y,"fill-opacity":ne(a)},fe(d?.outline)){const l=A(Math.max(d.outline.width||1,1));m={"line-color":N(d.outline.color),"line-width":l}}}else if(b==="line"){const y=["match",["to-string",["get",n]]];for(const f of s){y.push(Re(f.value)),y.push(N(f.symbol?.color));const L=String(f.value),$=r?.get(L)||f.label||L;w.push({type:"line",color:N(f.symbol?.color),width:A(f.symbol?.width||1),label:$})}y.push(i?N(i.color):"rgba(0, 0, 0, 0)"),p={"line-color":y,"line-width":A(d?.width||2),"line-opacity":ne(a)};const l=s.map(f=>f.symbol?.style||"esriSLSSolid"),g=[...new Set(l)];if(g.length>1){const f=yo(s,n,i,a,r);return{paint:{},legend:[],geomType:b,outlinePaint:m,splitLayers:f}}if(g.length===1){const f=Me(g[0]);f&&(p["line-dasharray"]=f)}}else if(b==="circle"){const y=["match",["to-string",["get",n]]];for(const g of s){y.push(Re(g.value)),y.push(N(g.symbol?.color));const f=String(g.value),k=r?.get(f)||g.label||f;w.push({type:"circle",color:N(g.symbol?.color),label:k})}y.push(i?N(i.color):"rgba(0, 0, 0, 0)");const l=Math.round((d?.size||6)*.71*100)/100;p={"circle-color":y,"circle-radius":l,"circle-opacity":ne(a)},fe(d?.outline)&&(p["circle-stroke-color"]=N(d.outline.color),p["circle-stroke-width"]=A(d.outline.width||1))}return{paint:p,legend:w,geomType:b,outlinePaint:m}}function bo(t,a){const r=t.field.toLowerCase(),n=t.classBreakInfos||[],s=t.visualVariables?.find(m=>m.type==="colorInfo");if(s?.stops&&s.stops.length>0)return Lo(s,r,t,a);if(n.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=n[0]?.symbol,d=Ze(i);let b={};const p=[];let w=null;if(d==="fill"){const m=["step",["get",r]];m.push(N(n[0]?.symbol?.color));for(let y=0;y<n.length;y++){const l=n[y];y>0&&(m.push(n[y-1].classMaxValue),m.push(N(l.symbol?.color))),p.push({type:"fill",color:N(l.symbol?.color),label:l.label||`${l.classMaxValue}`})}if(b={"fill-color":m,"fill-opacity":ne(a)},fe(i?.outline)){const y=A(i.outline.width||1);w={"line-color":N(i.outline.color),"line-width":y}}}else if(d==="line"){const m=n.map($=>$.symbol?.style||"esriSLSSolid"),y=[...new Set(m)];if(y.length>1){const $=mo(n,m,r,t,a);return{paint:{},legend:[],geomType:d,outlinePaint:w,splitLayers:$}}const g=["step",["get",r]];g.push(N(n[0]?.symbol?.color));let f=t.minValue??0;for(let $=0;$<n.length;$++){const B=n[$];$>0&&(g.push(n[$-1].classMaxValue),g.push(N(B.symbol?.color))),p.push({type:"line",color:N(B.symbol?.color),width:A(B.symbol?.width||i?.width||2),label:B.label||`${f} - ${B.classMaxValue}`}),f=B.classMaxValue+1}const L=A(i?.width||2);b={"line-color":g,"line-width":L,"line-opacity":ne(a)};const k=Me(y[0]);k&&(b["line-dasharray"]=k)}return{paint:b,legend:p,geomType:d,outlinePaint:w}}function Lo(t,a,r,n){const s=t.stops||[];if(s.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=r.classBreakInfos?.[0]?.symbol||r.defaultSymbol,d=Ze(i);let b={};const p=[];let w=null;if(d==="fill"){const m=["interpolate",["linear"],["get",a]];for(const l of s)m.push(l.value),m.push(N(l.color)),p.push({type:"fill",color:N(l.color),label:l.label||`${l.value}`});if(b={"fill-color":["case",["==",["get",a],null],"rgba(0, 0, 0, 0)",m],"fill-opacity":ne(n)},fe(i?.outline)){const l=A(i.outline.width||1);w={"line-color":N(i.outline.color),"line-width":l}}}return{paint:b,legend:p,geomType:d,outlinePaint:w}}function ko(t,a,r,n){if(!t?.renderer)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const s=t.renderer;switch(s.type){case"simple":return gt(s,a);case"uniqueValue":return vo(s,a,r);case"classBreaks":return bo(s,a);default:return{paint:{},legend:[],geomType:"fill",outlinePaint:null}}}function wo(t){if(!t)return null;const a=(t.title||"").replace(/\{([^}]+)\}/g,(i,d)=>`{${d.toLowerCase()}}`),n=(t.fieldInfos||[]).filter(i=>i.visible===!0).map(i=>{const d={field:i.fieldName.toLowerCase(),label:i.label||i.fieldName};return i.format&&(d.format={},i.format.dateFormat&&(d.format.dateFormat=i.format.dateFormat),i.format.digitSeparator!==void 0&&(d.format.digitSeparator=i.format.digitSeparator),i.format.places!==void 0&&(d.format.places=i.format.places),Object.keys(d.format).length===0&&delete d.format),d}),s={title:a,fields:n};return t.showTime&&(s.showTime=!0),s}function So(t){return t?.definitionExpression}function Co(t){return(t.includes("_")?t.split("_").slice(1).join(" "):t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Bo(t){return t.includes("_")?t.split("_").slice(1).join(" "):t}function xo(t){const a=new Map;if(!t)return a;const r=t.split(`
2
- `),n=/^(\d{1,3})\s+(.+)$/;for(const s of r){const i=s.trim().match(n);if(i){const[,d,b]=i;d&&b&&a.set(d,b.trim())}}return a}async function Eo(t){try{const a=await fetch(`${t}?f=json`);if(!a.ok)return null;const r=await a.json();return r.drawingInfo?{drawingInfo:r.drawingInfo,description:r.description}:null}catch{return null}}function dt(t){const a={id:t.id,title:t.title,type:t.type,url:t.url,opacity:t.opacity,paint:t.paint,legend:t.legend,popup:t.popup};return t.where&&(a.where=t.where),t.minZoom!==void 0&&(a.minZoom=t.minZoom),t.maxZoom!==void 0&&(a.maxZoom=t.maxZoom),t.outlinePaint&&(a.outlinePaint=t.outlinePaint),t.parentId&&(a.parentId=t.parentId),a}async function nt(t){const a=t.operationalLayers||[],r=[],n=["Zoning and Planning_Land Use"];for(const s of a)if(s.url&&!s.title?.toLowerCase().includes("(under construction)")&&!(s.url&&/\/MapServer(\/\d+)?$/i.test(s.url)))try{let i=s.layerDefinition?.drawingInfo,d;const b=!i||!i.renderer,p=n.includes(s.title),w=i?.renderer?.uniqueValueInfos?.[0]?.symbol?.outline||i?.renderer?.defaultSymbol?.outline;if((b||p)&&s.url){const V=await Eo(s.url);if(V){if(i=V.drawingInfo,w&&fe(w)&&i?.renderer){const M=i.renderer,Z=M.uniqueValueInfos?.[0]?.symbol?.outline||M.defaultSymbol?.outline;if(!fe(Z)){for(const z of M.uniqueValueInfos||[])z.symbol&&(z.symbol.outline=w);M.defaultSymbol&&(M.defaultSymbol.outline=w)}}V.description&&(d=xo(V.description),d.size>0)}}const{paint:m,legend:y,geomType:l,outlinePaint:g,splitLayers:f}=ko(i,s.opacity,d,s.title),L=wo(s.popupInfo),k=So(s.layerDefinition),$=ho(s.layerDefinition?.minScale,s.layerDefinition?.maxScale),B=Co(s.title),F=Bo(s.title),x=s.opacity??1;if(f&&f.length>0)for(const V of f){const M=`${B}${V.suffix}`;r.push(dt({id:M,title:F,type:l,url:s.url,opacity:x,paint:V.paint,legend:V.legend,popup:L,where:k?`(${k}) AND (${V.where})`:V.where,minZoom:$.minZoom,maxZoom:$.maxZoom,parentId:V.suffix?B:void 0}))}else r.push(dt({id:B,title:F,type:l,url:s.url,opacity:x,paint:m,legend:y,popup:L,where:k,minZoom:$.minZoom,maxZoom:$.maxZoom,outlinePaint:g}))}catch{}return r.sort((s,i)=>s.title.localeCompare(i.title)),r}const ft={},at="376af635c84643cd816a8c5d017a53aa",$o=at;function We(t,a){let r=`https://www.arcgis.com/sharing/rest/content/items/${t}/data?f=json`;return a&&(r+=`&token=${a}`),r}function Vo(){return We(at)}const Ae=new Map,Ne=new Map;function ht(t){t?(Ae.delete(t),Ne.delete(t)):(Ae.clear(),Ne.clear())}let Oe,pt=0;async function No(){const t=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:Ce&&Ce.tagName.toUpperCase()==="SCRIPT"&&Ce.src||new URL("index.js",document.baseURI).href}<"u"&&ft?.VITE_AGO_USERNAME,a=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:Ce&&Ce.tagName.toUpperCase()==="SCRIPT"&&Ce.src||new URL("index.js",document.baseURI).href}<"u"&&ft?.VITE_AGO_PASSWORD;if(!(!t||!a)){if(Oe&&Date.now()<pt-3e5)return Oe;try{const n=await(await fetch("https://www.arcgis.com/sharing/rest/generateToken",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({f:"json",username:t,password:a,referer:window.location.origin||"https://localhost",expiration:"120"})})).json();return n.error?void 0:(Oe=n.token,pt=n.expires,Oe)}catch{return}}}async function Mo(t,a){const r=We(t,a),n=await fetch(r,{cache:"no-store"});if(!n.ok)throw new Error(`Failed to fetch WebMap: ${n.status} ${n.statusText}`);const s=await n.json();if(s.error)throw new Error(`ArcGIS error: ${s.error.message||s.error.code||"Unknown error"}`);return s}async function To(t){try{const a=await No(),r=await Mo(t,a);return await nt(r)}catch(a){throw new Error(`Failed to load dynamic layer configs: ${a instanceof Error?a.message:"Unknown error"}`)}}async function Ue(t=at){const a=Ae.get(t);if(a)return a;const r=Ne.get(t);if(r)return r;const n=(async()=>{try{const s=await To(t);return Ae.set(t,s),s}finally{Ne.delete(t)}})();return Ne.set(t,n),n}function vt(t){const a=e.ref({}),r=new Map;for(const l of t)a.value[l.id]={data:null,loading:!1,error:null,lastFetched:null};async function n(l){const g=l.id;a.value={...a.value,[g]:{data:a.value[g]?.data??null,lastFetched:a.value[g]?.lastFetched??null,loading:!0,error:null}};try{let f;if(l.type==="http-get"){const L=await fetch(l.url,{method:"GET",...l.options});if(!L.ok)throw new Error(`HTTP ${L.status}: ${L.statusText}`);f=await L.json()}else if(l.type==="http-post"){const L=await fetch(l.url,{method:"POST",...l.options});if(!L.ok)throw new Error(`HTTP ${L.status}: ${L.statusText}`);f=await L.json()}else if(l.type==="esri"){const k=`${l.url.replace(/\/$/,"")}/query?where=1%3D1&outFields=*&returnGeometry=false&f=json`,$=await fetch(k,l.options);if(!$.ok)throw new Error(`HTTP ${$.status}: ${$.statusText}`);f=(await $.json()).features?.map(F=>F.attributes)||[]}else throw new Error(`Unknown data source type: ${l.type}`);l.transform&&(f=l.transform(f)),a.value={...a.value,[g]:{data:f,loading:!1,error:null,lastFetched:Date.now()}}}catch(f){const L=f instanceof Error?f.message:"Unknown error";a.value={...a.value,[g]:{data:a.value[g]?.data??null,lastFetched:a.value[g]?.lastFetched??null,loading:!1,error:L}}}}async function s(){await Promise.all(t.map(l=>n(l)))}async function i(l){const g=t.find(f=>f.id===l);g&&await n(g)}function d(l){return a.value[l]?.data??null}const b=e.computed(()=>Object.values(a.value).some(l=>l.loading));function p(l){return a.value[l]?.loading??!1}function w(l){return a.value[l]?.error??null}function m(){for(const l of t)if(l.pollInterval&&l.pollInterval>0){const g=window.setInterval(()=>{n(l)},l.pollInterval);r.set(l.id,g)}}function y(){for(const[,l]of r)window.clearInterval(l);r.clear()}return e.onMounted(()=>{s(),m()}),e.onUnmounted(()=>{y()}),{state:e.readonly(a),isLoading:b,fetchAll:s,refetch:i,getData:d,isSourceLoading:p,getError:w,stopPolling:y}}const Po={class:"layerboard-layout"},Fo=["aria-expanded"],Io={key:0,class:"layerboard-subtitle"},zo={class:"layerboard-mobile-menu-content"},Do={class:"layerboard-main"},Oo={key:0,class:"layerboard-loading",role:"status","aria-live":"polite"},Ro={key:1,class:"layerboard-error",role:"alert"},_o=["aria-expanded","aria-label"],Ao={key:0},Uo={key:1},Zo={class:"sr-only","aria-live":"polite"},Wo=e.defineComponent({__name:"Layerboard",props:{title:{},subtitle:{default:void 0},webMapId:{},themeColor:{default:"#0f4d90"},cyclomediaConfig:{default:void 0},pictometryCredentials:{default:void 0},showDefaultSidebar:{type:Boolean,default:!0},sidebarWidth:{default:"30%"},sidebarLabel:{default:"Layers"},mapLabel:{default:"Map"},fetchMetadata:{type:Boolean,default:!1},tiledLayers:{default:()=>[]},dataSources:{default:()=>[]},layerStyleOverrides:{default:()=>({})},popupOverrides:{default:()=>({})},basemapControlPosition:{default:"top-right"},navigationControlPosition:{default:"bottom-right"},geolocationControlPosition:{default:"bottom-right"},searchControlPosition:{default:"top-left"},drawControlPosition:{default:"bottom-left"},cyclomediaButtonPosition:{default:"top-right"},pictometryButtonPosition:{default:"top-right"},initialZoom:{default:void 0},initialCenter:{default:void 0}},emits:["configs-loaded","load-error","zoom"],setup(t,{expose:a,emit:r}){const n=t,s=r,i=e.ref([]),d=e.ref(!0),b=e.ref(null),p=e.ref(12),w=e.ref(""),m=e.ref(new Set),y=e.ref({}),l=e.ref(new Set),g=e.ref({}),f=e.ref({}),L=e.ref(new Set),k=e.ref({});function $(){const h={};for(const C of n.tiledLayers)h[C.id]=C.opacity??1;k.value=h}function B(h){L.value.has(h)?L.value.delete(h):L.value.add(h),L.value=new Set(L.value)}function F(h,C){C?L.value.add(h):L.value.delete(h),L.value=new Set(L.value)}function x(h,C){k.value={...k.value,[h]:C}}const V=n.dataSources.length>0?vt(n.dataSources):null,M=e.computed(()=>V?.state.value??{}),Z=e.computed(()=>V?.isLoading.value??!1);function z(h){return V?.getData(h)??null}function ee(h){return V?.refetch(h)??Promise.resolve()}e.provide("layerboard-layers",e.readonly(i)),e.provide("layerboard-visible",m),e.provide("layerboard-opacities",y),e.provide("layerboard-loading",e.readonly(l)),e.provide("layerboard-errors",e.readonly(g)),e.provide("layerboard-zoom",e.readonly(p)),e.provide("layerboard-toggle-layer",he),e.provide("layerboard-set-layer-visible",Ee),e.provide("layerboard-set-layers-visible",ue),e.provide("layerboard-set-opacity",pe),e.provide("layerboard-tiled-layers",e.readonly(e.computed(()=>n.tiledLayers))),e.provide("layerboard-visible-tiled",L),e.provide("layerboard-tiled-opacities",k),e.provide("layerboard-toggle-tiled",B),e.provide("layerboard-set-tiled-opacity",x),e.provide("layerboard-set-tiled-visible",F),e.provide("layerboard-data-sources-state",M),e.provide("layerboard-data-sources-loading",Z),e.provide("layerboard-get-data-source",z),e.provide("layerboard-refetch-data-source",ee);const ae=e.computed(()=>({backgroundColor:n.themeColor})),je=e.computed(()=>({backgroundColor:n.themeColor})),Be=e.computed(()=>({backgroundColor:n.themeColor})),Te=e.computed(()=>({width:te.value?"0":n.sidebarWidth}));async function xe(){try{d.value=!0,b.value=null;const C=(await Ue(n.webMapId)).map(I=>{let R=I;const se=n.layerStyleOverrides[I.id];se&&(R={...R,paint:se.paint??R.paint,outlinePaint:se.outlinePaint??R.outlinePaint,legend:se.legend??R.legend,type:se.type??R.type});const Se=n.popupOverrides[I.id]||(I.parentId?n.popupOverrides[I.parentId]:void 0);return Se&&R.popup&&(R={...R,popup:{...R.popup,...Se}}),R});i.value=C.map(I=>({config:I,component:I.type}));const O={};C.forEach(I=>{O[I.id]=I.opacity??1}),y.value=O,s("configs-loaded",C)}catch(h){const C=h instanceof Error?h.message:"Failed to load layer configurations";b.value=C,s("load-error",C)}finally{d.value=!1}}async function Pe(){if(n.fetchMetadata)try{const h="https://phl.carto.com/api/v2/sql?q="+encodeURIComponent("select url_text, COALESCE(representation, '') as representation from phl.knack_metadata_reps_endpoints_join WHERE ( format = 'API' OR format = 'GeoService' ) AND url_text IS NOT null"),C=await fetch(h);if(!C.ok)return;const O=await C.json(),I={};for(const R of O.rows||[])if(R.url_text&&R.representation){const se=Ye(R.url_text),Se=`https://metadata.phila.gov/#home/representationdetails/${R.representation}/`;I[se]=Se}f.value=I}catch{}}function qe(h){p.value=h,s("zoom",h)}function he(h){m.value.has(h)?m.value.delete(h):m.value.add(h),m.value=new Set(m.value)}function Ee(h,C){C?m.value.add(h):m.value.delete(h),m.value=new Set(m.value)}function ue(h,C){for(const O of h)C?m.value.add(O):m.value.delete(O);m.value=new Set(m.value)}function pe(h,C){y.value={...y.value,[h]:C}}function $e(h,C){C?l.value.add(h):l.value.delete(h),l.value=new Set(l.value)}function Ge(h,C){if(C)g.value={...g.value,[h]:C};else{const O={...g.value};delete O[h],g.value=O}}function Q(h){w.value=h}const me=e.ref(null),q=e.ref(null),ve=e.ref(null),Fe=e.ref(null),le=e.ref(null),Ve=e.ref(null),Ie=e.ref(null),ie=e.ref("sidebar");function He(){ie.value=ie.value==="sidebar"?"map":"sidebar",e.nextTick(()=>{ie.value==="sidebar"&&me.value?.focus()})}const G=e.ref(!1);function ye(){G.value=!G.value,G.value&&e.nextTick(()=>{Fe.value?.focus()})}function ge(){G.value=!1,e.nextTick(()=>{q.value?.focus()})}const te=e.ref(!1);function ze(){te.value=!te.value}const H=e.ref(!1),be=e.ref(null);function Le(){be.value=document.activeElement,H.value=!0,e.nextTick(()=>{Ie.value?.focus()})}function J(){H.value=!1,e.nextTick(()=>{be.value?.focus(),be.value=null})}function ke(h){h.target.classList.contains("layerboard-modal-backdrop")&&J()}function we(h){if(h.key==="Escape"){ge();return}if(h.key==="Tab"&&le.value){const C=Array.from(le.value.querySelectorAll('a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(C.length===0)return;const O=C[0],I=C[C.length-1];h.shiftKey?document.activeElement===O&&(h.preventDefault(),I.focus()):document.activeElement===I&&(h.preventDefault(),O.focus())}}function Je(h){if(h.key==="Escape"){J();return}if(h.key==="Tab"&&Ve.value){const C=Array.from(Ve.value.querySelectorAll('a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(C.length===0)return;const O=C[0],I=C[C.length-1];h.shiftKey?document.activeElement===O&&(h.preventDefault(),I.focus()):document.activeElement===I&&(h.preventDefault(),O.focus())}}e.provide("layerboard-open-modal",Le),e.provide("layerboard-close-modal",J),e.provide("layerboard-is-modal-open",e.readonly(H)),a({layerList:i,visibleLayers:m,layerOpacities:y,loadingLayers:l,layerErrors:g,currentZoom:p,toggleLayer:he,setLayerVisible:Ee,setLayersVisible:ue,setLayerOpacity:pe,reloadConfigs:xe,clearCache:()=>ht(n.webMapId),visibleTiledLayers:L,tiledLayerOpacities:k,toggleTiledLayer:B,setTiledLayerVisible:F,setTiledLayerOpacity:x,dataSourcesState:M,dataSourcesLoading:Z,getDataSourceData:z,refetchDataSource:ee,isModalOpen:H,openModal:Le,closeModal:J});function De(h){h.key==="Escape"&&G.value&&ge()}return e.onMounted(()=>{xe(),Pe(),$(),document.addEventListener("keydown",De)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",De)}),(h,C)=>(e.openBlock(),e.createElementBlock("div",Po,[C[5]||(C[5]=e.createElementVNode("a",{href:"#main-content",class:"skip-to-main-content-link"},"Skip to main content",-1)),e.createElementVNode("header",{class:"layerboard-header",style:e.normalizeStyle(ae.value)},[C[1]||(C[1]=e.createElementVNode("a",{href:"https://www.phila.gov/",class:"layerboard-logo layerboard-desktop-only"},[e.createElementVNode("img",{src:"https://standards.phila.gov/img/logo/city-of-philadelphia-yellow-white.png",alt:"City of Philadelphia"})],-1)),C[2]||(C[2]=e.createElementVNode("span",{class:"layerboard-header-divider layerboard-desktop-only","aria-hidden":"true"},null,-1)),e.createElementVNode("button",{ref_key:"hamburgerRef",ref:q,class:"layerboard-hamburger layerboard-mobile-only","aria-expanded":G.value,"aria-label":"Toggle menu",onClick:ye},[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(Zt),size:"medium",inline:"",decorative:""},null,8,["icon-definition"])],8,Fo),e.renderSlot(h.$slots,"header",{},()=>[e.createElementVNode("h1",null,e.toDisplayString(t.title),1),t.subtitle?(e.openBlock(),e.createElementBlock("span",Io,e.toDisplayString(t.subtitle),1)):e.createCommentVNode("",!0)],!0),G.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"mobileMenuRef",ref:le,class:"layerboard-mobile-menu",role:"dialog","aria-modal":"true","aria-label":"Site menu",style:e.normalizeStyle({backgroundColor:t.themeColor}),onKeydown:we},[e.createElementVNode("div",zo,[e.renderSlot(h.$slots,"footer",{openModal:Le,closeModal:J,isModalOpen:H.value},()=>[C[0]||(C[0]=e.createTextVNode(" City of Philadelphia ",-1))],!0)]),e.createElementVNode("button",{ref_key:"mobileMenuCloseRef",ref:Fe,class:"layerboard-mobile-menu-close","aria-label":"Close menu",onClick:ge},[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(ct),size:"medium",decorative:""},null,8,["icon-definition"])],512)],36)):e.createCommentVNode("",!0),G.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"layerboard-mobile-menu-backdrop",onClick:ge})):e.createCommentVNode("",!0)],4),e.createElementVNode("div",Do,[d.value?(e.openBlock(),e.createElementBlock("div",Oo,[e.createElementVNode("div",{class:"layerboard-spinner",style:e.normalizeStyle({borderTopColor:t.themeColor})},null,4),e.createElementVNode("p",null,"Loading "+e.toDisplayString(t.title)+"...",1)])):b.value?(e.openBlock(),e.createElementBlock("div",Ro,[C[3]||(C[3]=e.createElementVNode("h2",null,"Error Loading Layers",-1)),e.createElementVNode("p",null,e.toDisplayString(b.value),1),e.createElementVNode("button",{class:"layerboard-retry-button",style:e.normalizeStyle({backgroundColor:t.themeColor}),onClick:xe}," Retry ",4)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("aside",{id:"main-content",ref_key:"sidebarRef",ref:me,class:e.normalizeClass(["layerboard-sidebar",{"is-active":ie.value==="sidebar"}]),style:e.normalizeStyle(Te.value),"aria-label":"Map layers",tabindex:"-1"},[e.renderSlot(h.$slots,"sidebar",{layers:i.value,visibleLayers:m.value,layerOpacities:y.value,loadingLayers:l.value,layerErrors:g.value,currentZoom:p.value,toggleLayer:he,setLayerVisible:Ee,setLayersVisible:ue,setOpacity:pe,tiledLayers:t.tiledLayers,visibleTiledLayers:L.value,tiledLayerOpacities:k.value,toggleTiledLayer:B,setTiledLayerVisible:F,setTiledLayerOpacity:x,dataSourcesState:M.value,dataSourcesLoading:Z.value,getDataSource:z,refetchDataSource:ee},()=>[t.showDefaultSidebar?(e.openBlock(),e.createBlock(yt,{key:0,"layer-list":i.value,"visible-layers":m.value,"layer-opacities":y.value,"loading-layers":l.value,"layer-errors":g.value,"current-zoom":p.value,"search-query":w.value,"layer-metadata":f.value,onToggleLayer:he,onSetOpacity:pe,onUpdateSearch:Q},null,8,["layer-list","visible-layers","layer-opacities","loading-layers","layer-errors","current-zoom","search-query","layer-metadata"])):e.createCommentVNode("",!0)],!0)],6),e.createElementVNode("div",{role:"main","aria-label":"Map",class:e.normalizeClass(["layerboard-map",{"is-active":ie.value==="map"}])},[e.createVNode(mt,{"visible-layers":m.value,"layer-opacities":y.value,"layer-list":i.value,"tiled-layers":t.tiledLayers,"visible-tiled-layers":L.value,"tiled-layer-opacities":k.value,"cyclomedia-config":t.cyclomediaConfig,"pictometry-credentials":t.pictometryCredentials,"basemap-control-position":t.basemapControlPosition,"navigation-control-position":t.navigationControlPosition,"geolocation-control-position":t.geolocationControlPosition,"search-control-position":t.searchControlPosition,"draw-control-position":t.drawControlPosition,"cyclomedia-button-position":t.cyclomediaButtonPosition,"pictometry-button-position":t.pictometryButtonPosition,"initial-zoom":t.initialZoom,"initial-center":t.initialCenter,onZoom:qe,onLayerLoading:$e,onLayerError:Ge},null,8,["visible-layers","layer-opacities","layer-list","tiled-layers","visible-tiled-layers","tiled-layer-opacities","cyclomedia-config","pictometry-credentials","basemap-control-position","navigation-control-position","geolocation-control-position","search-control-position","draw-control-position","cyclomedia-button-position","pictometry-button-position","initial-zoom","initial-center"])],2),e.createElementVNode("button",{class:e.normalizeClass(["layerboard-sidebar-toggle",{"is-collapsed":te.value}]),style:e.normalizeStyle({left:te.value?"0":n.sidebarWidth}),"aria-expanded":!te.value,"aria-label":te.value?"Expand sidebar":"Collapse sidebar",onClick:ze},[e.createVNode(e.unref(j.Icon),{"icon-definition":te.value?e.unref(At):e.unref(Ut),size:"medium",decorative:""},null,8,["icon-definition"])],14,_o)],64))]),e.createElementVNode("button",{ref_key:"mobileToggleRef",ref:ve,class:"layerboard-mobile-toggle",style:e.normalizeStyle(Be.value),onClick:He},[ie.value==="map"?(e.openBlock(),e.createElementBlock("span",Ao,e.toDisplayString(t.sidebarLabel),1)):(e.openBlock(),e.createElementBlock("span",Uo,e.toDisplayString(t.mapLabel),1))],4),e.createElementVNode("footer",{class:"layerboard-footer",style:e.normalizeStyle(je.value)},[e.renderSlot(h.$slots,"footer",{openModal:Le,closeModal:J,isModalOpen:H.value},()=>[C[4]||(C[4]=e.createTextVNode(" City of Philadelphia ",-1))],!0)],4),H.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"layerboard-modal-backdrop",onClick:ke,onKeydown:Je},[e.createElementVNode("div",{ref_key:"modalRef",ref:Ve,class:"layerboard-modal",role:"dialog","aria-modal":"true","aria-label":"Application information"},[e.createElementVNode("button",{ref_key:"modalCloseRef",ref:Ie,class:"layerboard-modal-close","aria-label":"Close modal",onClick:J},[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(ct),size:"medium",decorative:""},null,8,["icon-definition"])],512),e.renderSlot(h.$slots,"modal",{closeModal:J},void 0,!0)],512)],32)):e.createCommentVNode("",!0),e.createElementVNode("span",Zo,e.toDisplayString(ie.value==="sidebar"?"Showing layers panel":"Showing map"),1)]))}}),jo=ce(Wo,[["__scopeId","data-v-b6c04107"]]),qo=["aria-expanded"],Go={key:0,class:"topic-icon"},Ho={class:"topic-title"},Jo=e.defineComponent({__name:"TopicAccordion",props:{title:{},icon:{default:void 0},expanded:{type:Boolean,default:!1},layerIds:{default:()=>[]},headerClass:{default:void 0}},emits:["toggle","layerChange"],setup(t,{emit:a}){const r=t,n=a,s=e.ref(r.expanded),i=`topic-panel-${e.useId()}`,d=`topic-header-${e.useId()}`;e.watch(()=>r.expanded,p=>{s.value=p});function b(){s.value=!s.value,n("toggle",s.value)}return(p,w)=>{const m=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["topic-accordion",{"is-expanded":s.value}])},[e.createElementVNode("button",{id:d,class:e.normalizeClass(["topic-header",t.headerClass]),type:"button","aria-expanded":s.value,"aria-controls":i,onClick:b},[t.icon||p.$slots.icon?(e.openBlock(),e.createElementBlock("span",Go,[e.renderSlot(p.$slots,"icon",{},()=>[t.icon?(e.openBlock(),e.createBlock(m,{key:0,icon:["fas",t.icon],"aria-hidden":"true"},null,8,["icon"])):e.createCommentVNode("",!0)],!0)])):e.createCommentVNode("",!0),e.createElementVNode("span",Ho,e.toDisplayString(t.title),1),e.createElementVNode("span",{class:e.normalizeClass(["topic-chevron",{"is-rotated":s.value}])},[...w[0]||(w[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])],2)],10,qo),e.withDirectives(e.createElementVNode("div",{id:i,role:"region","aria-labelledby":d,class:"topic-content"},[e.renderSlot(p.$slots,"default",{},()=>[w[1]||(w[1]=e.createElementVNode("p",{class:"topic-empty"},"No content provided for this topic.",-1))],!0)],512),[[e.vShow,s.value]])],2)}}}),Ko=ce(Jo,[["__scopeId","data-v-a2023afa"]]);function bt(t){return t.displayOptions?.shouldShowCheckbox!==!1}function lt(t,a){return a?t.displayOptions?.shouldShowSlider!==!1:!1}function rt(t,a){return a?t.displayOptions?.shouldShowLegendBox!==!1:!1}function de(t){return t.displayOptions?.layerNameChange||t.title}const Qo=["aria-label"],Xo=["checked","disabled","onChange"],Yo={class:"layer-title"},en={class:"layer-title"},tn={key:0,class:"empty-state"},on=e.defineComponent({__name:"LayerCheckboxSet",props:{layers:{},visibleLayerIds:{},layerOpacities:{default:()=>({})},loadingLayerIds:{default:()=>new Set},layerErrors:{default:()=>({})},currentZoom:{default:12},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},groupLabel:{default:void 0}},emits:["toggleLayer","setOpacity"],setup(t,{emit:a}){const r=t,n=a,{isVisible:s,getLayerOpacity:i,isLayerLoading:d,getLayerError:b,isLayerAvailableAtZoom:p}=ot(()=>r);function w(m){n("toggleLayer",m)}return(m,y)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"layer-checkbox-set",role:"group","aria-label":t.groupLabel},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,l=>(e.openBlock(),e.createElementBlock("div",{key:l.id,class:"layer-item"},[e.unref(bt)(l)?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!e.unref(p)(l),"layer-error":e.unref(b)(l.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(s)(l.id),disabled:!e.unref(p)(l),onChange:g=>w(l.id)},null,40,Xo),e.createElementVNode("span",Yo,[e.createTextVNode(e.toDisplayString(e.unref(de)(l))+" ",1),e.createVNode(_e,{loading:e.unref(d)(l.id),error:e.unref(b)(l.id),unavailable:!e.unref(p)(l)},null,8,["loading","error","unavailable"])])],2)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["layer-label-only",{"layer-unavailable":!e.unref(p)(l),"layer-error":e.unref(b)(l.id)}])},[e.createElementVNode("span",en,[e.createTextVNode(e.toDisplayString(e.unref(de)(l))+" ",1),e.createVNode(_e,{loading:e.unref(d)(l.id),error:e.unref(b)(l.id),unavailable:!e.unref(p)(l)},null,8,["loading","error","unavailable"])])],2)),e.unref(lt)(l,t.showOpacity)&&e.unref(s)(l.id)&&e.unref(p)(l)?(e.openBlock(),e.createBlock(et,{key:2,"layer-id":l.id,"layer-name":e.unref(de)(l),opacity:e.unref(i)(l.id),"onUpdate:opacity":g=>n("setOpacity",l.id,g)},null,8,["layer-id","layer-name","opacity","onUpdate:opacity"])):e.createCommentVNode("",!0),e.unref(rt)(l,t.showLegend)&&e.unref(s)(l.id)&&e.unref(p)(l)&&l.legend?.length?(e.openBlock(),e.createBlock(tt,{key:3,items:l.legend,label:"Legend for "+e.unref(de)(l)},null,8,["items","label"])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",tn,"No layers available")):e.createCommentVNode("",!0)],8,Qo))}}),nn=ce(on,[["__scopeId","data-v-bfcd7855"]]),an=["aria-label"],ln=["name","checked","disabled","onChange"],rn={class:"layer-title"},sn={key:0,class:"empty-state"},cn=e.defineComponent({__name:"LayerRadioButtonSet",props:{layers:{},visibleLayerIds:{},layerOpacities:{default:()=>({})},loadingLayerIds:{default:()=>new Set},layerErrors:{default:()=>({})},currentZoom:{default:12},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},groupName:{default:"layer-radio-group"},groupLabel:{default:void 0}},emits:["selectLayer","setOpacity"],setup(t,{emit:a}){const r=t,n=a,{isVisible:s,getLayerOpacity:i,isLayerLoading:d,getLayerError:b,isLayerAvailableAtZoom:p}=ot(()=>r);function w(m){const y=r.layers.filter(l=>r.visibleLayerIds.has(l.id)&&l.id!==m).map(l=>l.id);n("selectLayer",m,y)}return(m,y)=>(e.openBlock(),e.createElementBlock("div",{class:"layer-radio-set",role:"radiogroup","aria-label":t.groupLabel},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,l=>(e.openBlock(),e.createElementBlock("div",{key:l.id,class:"layer-item"},[e.createElementVNode("label",{class:e.normalizeClass(["layer-radio",{"layer-unavailable":!e.unref(p)(l),"layer-error":e.unref(b)(l.id)}])},[e.createElementVNode("input",{type:"radio",name:t.groupName,checked:e.unref(s)(l.id),disabled:!e.unref(p)(l),onChange:g=>w(l.id)},null,40,ln),e.createElementVNode("span",rn,[e.createTextVNode(e.toDisplayString(e.unref(de)(l))+" ",1),e.createVNode(_e,{loading:e.unref(d)(l.id),error:e.unref(b)(l.id),unavailable:!e.unref(p)(l)},null,8,["loading","error","unavailable"])])],2),e.unref(lt)(l,t.showOpacity)&&e.unref(s)(l.id)&&e.unref(p)(l)?(e.openBlock(),e.createBlock(et,{key:0,"layer-id":l.id,"layer-name":e.unref(de)(l),opacity:e.unref(i)(l.id),"onUpdate:opacity":g=>n("setOpacity",l.id,g)},null,8,["layer-id","layer-name","opacity","onUpdate:opacity"])):e.createCommentVNode("",!0),e.unref(rt)(l,t.showLegend)&&e.unref(s)(l.id)&&e.unref(p)(l)&&l.legend?.length?(e.openBlock(),e.createBlock(tt,{key:1,items:l.legend,label:"Legend for "+e.unref(de)(l)},null,8,["items","label"])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",sn,"No layers available")):e.createCommentVNode("",!0)],8,an))}}),un=ce(cn,[["__scopeId","data-v-c368d815"]]);function dn(t){const a=e.ref([]),r=e.ref(new Set),n=e.ref({}),s=e.ref(new Set),i=e.ref({}),d=e.ref(""),b=e.ref(!1),p=e.ref(!1),w=e.ref(null),m=e.computed(()=>{if(!d.value.trim())return a.value;const x=d.value.toLowerCase();return a.value.filter(V=>V.title.toLowerCase().includes(x))}),y=e.computed(()=>a.value.map(x=>({config:x,component:x.type})));async function l(){if(!p.value){b.value=!0,w.value=null;try{let x;t.mode==="dynamic"||!t.mode?t.webMapId?x=await g(t.webMapId):x=await Ue():x=await Ue(),a.value=x;const V={};x.forEach(M=>{V[M.id]=M.opacity??1}),n.value=V,p.value=!0}catch(x){w.value=x instanceof Error?x:new Error("Failed to initialize layerboard")}finally{b.value=!1}}}async function g(x){const V=We(x),M=await fetch(V,{cache:"no-store"});if(!M.ok)throw new Error(`Failed to fetch WebMap: ${M.status} ${M.statusText}`);const Z=await M.json();return nt(Z)}function f(x){const V=new Set(r.value);V.has(x)?V.delete(x):V.add(x),r.value=V}function L(x,V){n.value={...n.value,[x]:Math.max(0,Math.min(1,V))}}function k(x){d.value=x}function $(x,V){const M=new Set(s.value);V?M.add(x):M.delete(x),s.value=M}function B(x,V){if(V)i.value={...i.value,[x]:V};else{const M={...i.value};delete M[x],i.value=M}}function F(){a.value=[],r.value=new Set,n.value={},s.value=new Set,i.value={},d.value="",b.value=!1,p.value=!1,w.value=null}return{layerConfigs:e.readonly(a),visibleLayers:e.readonly(r),layerOpacities:e.readonly(n),loadingLayers:e.readonly(s),layerErrors:e.readonly(i),searchQuery:e.readonly(d),isLoading:e.readonly(b),isInitialized:e.readonly(p),error:e.readonly(w),filteredLayerConfigs:m,layerList:y,config:t,initialize:l,toggleLayer:f,setLayerOpacity:L,filterLayers:k,setLayerLoading:$,setLayerError:B,reset:F}}function fn(){const t=e.ref([]),a=e.ref(new Set),r=e.ref(new Set);function n(i){a.value.has(i)?a.value.delete(i):a.value.add(i)}function s(i){t.value=i}return{layers:e.computed(()=>t.value),visibleLayerIds:e.computed(()=>a.value),loadingLayerIds:e.computed(()=>r.value),toggleLayer:n,setLayers:s}}function Lt(t){const a=e.ref(null),r=e.ref(!1),n=e.ref(null),s=e.ref(0);async function i(p={}){r.value=!0,n.value=null;const w=t.pageSize||2e3;let m=0,y=[],l=!0;try{for(;l;){const f=t.url.replace(/\/$/,""),L=encodeURIComponent(p.where||t.where||"1=1");let k=`${f}/query?where=${L}&outFields=*&returnGeometry=true&resultRecordCount=${w}&resultOffset=${m}&f=geojson`;if(p.bounds){const F=JSON.stringify({xmin:p.bounds.west,ymin:p.bounds.south,xmax:p.bounds.east,ymax:p.bounds.north,spatialReference:{wkid:4326}});k+=`&geometry=${encodeURIComponent(F)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects`}const $=await fetch(k);if(!$.ok)throw new Error(`HTTP ${$.status}: ${$.statusText}`);const B=await $.json();B.features&&B.features.length>0?(y=y.concat(B.features),m+=B.features.length,l=B.features.length===w):l=!1}const g={type:"FeatureCollection",features:y};return a.value=g,s.value=y.length,g}catch(g){const f=g instanceof Error?g:new Error("Failed to fetch features");throw n.value=f,f}finally{r.value=!1}}function d(){a.value=null,s.value=0,n.value=null}async function b(p={}){return i(p)}return{data:e.readonly(a),isLoading:e.readonly(r),error:e.readonly(n),totalFeatures:e.readonly(s),config:t,fetch:i,refetch:b,clear:d}}function pn(t,a,r){const n=Lt(t);return e.watch(a,async s=>{if(s){const i=r(s);await n.fetch(i)}},{immediate:!0}),n}exports.LayerCheckboxSet=nn;exports.LayerPanel=yt;exports.LayerRadioButtonSet=un;exports.Layerboard=jo;exports.MapPanel=mt;exports.TopicAccordion=Ko;exports.WEBMAP_ID=$o;exports.buildWebMapUrl=We;exports.clearCache=ht;exports.getLayerConfigs=Ue;exports.getLayerDisplayName=de;exports.getWebMapUrl=Vo;exports.normalizeUrl=Ye;exports.shouldShowCheckbox=bt;exports.shouldShowLegendBox=rt;exports.shouldShowSlider=lt;exports.transformWebMapToLayerConfigs=nt;exports.useApiDataSources=vt;exports.useDataSource=Lt;exports.useLayerConfig=fn;exports.useLayerboard=dn;exports.useReactiveDataSource=pn;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),K=require("@phila/phila-ui-map-core"),j=require("@phila/phila-ui-core");var Ce=typeof document<"u"?document.currentScript:null;const Ct={class:"map-panel"},Bt=e.defineComponent({__name:"MapPanel",props:{visibleLayers:{},layerOpacities:{},layerList:{},tiledLayers:{default:void 0},visibleTiledLayers:{default:void 0},tiledLayerOpacities:{default:void 0},cyclomediaConfig:{default:void 0},pictometryCredentials:{default:void 0},basemapControlPosition:{default:"top-right"},navigationControlPosition:{default:"bottom-right"},geolocationControlPosition:{default:"bottom-right"},searchControlPosition:{default:"top-left"},drawControlPosition:{default:"bottom-left"},cyclomediaButtonPosition:{default:"top-right"},pictometryButtonPosition:{default:"top-right"},initialZoom:{default:void 0},initialCenter:{default:void 0}},emits:["zoom","layerLoading","layerError"],setup(t,{emit:l}){const r=t,n=l,s=e.ref(null),i=e.ref(null),u=e.ref(0);function b(o){n("zoom",o),i.value&&(u.value=p(i.value))}function p(o){const d=o.getZoom(),v=o.getCenter().lat,S=559082264028e-3,E=v*Math.PI/180;return S*Math.cos(E)/Math.pow(2,d)}const k=e.ref({}),m=e.ref(null),y=e.ref(new Set);async function a(o,d,c,v,S){const E=encodeURIComponent(v||"1=1"),P=JSON.stringify({xmin:d.west,ymin:d.south,xmax:d.east,ymax:d.north,spatialReference:{wkid:4326}}),U=S!==void 0&&S<14?`&maxAllowableOffset=${360/(Math.pow(2,S)*512)}`:"",A=2e3;let oe=0,re=[],X=!0;for(;X;){const W=`${o}/query?where=${E}&geometry=${encodeURIComponent(P)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&resultRecordCount=${A}&resultOffset=${oe}${U}&f=geojson`,T=await fetch(W);if(!T.ok)throw new Error(`HTTP ${T.status}: ${T.statusText}`);const O=await T.json();O.features&&O.features.length>0?(re=re.concat(O.features),oe+=O.features.length,X=O.features.length===A):X=!1}return re=re.map(W=>{if(W.properties){const T={};for(const O of Object.keys(W.properties))T[O.toLowerCase()]=W.properties[O];return{...W,properties:T}}return W}),{type:"FeatureCollection",features:re}}async function h(o,d,c){const v=d.map(async S=>{const E=r.layerList.find(P=>P.config.id===S)?.config;if(E){n("layerLoading",S,!0);try{const P=await a(E.url,o,S,E.where,c);k.value={...k.value,[S]:P},n("layerError",S,null)}catch(P){const U=P instanceof Error?P.message:"Failed to load";n("layerError",S,U)}finally{n("layerLoading",S,!1)}}});await Promise.all(v)}function f(o){const d=new Set(o);for(const c of r.layerList)c.config.parentId&&d.has(c.config.parentId)&&d.add(c.config.id);return[...d]}async function L(o,d){const c=f([...r.visibleLayers]);await h(o,c,d)}function w(o){m.value=o.bounds,L(o.bounds,o.zoom)}function $(o){i.value=o;const d=o.getBounds();m.value={west:d.getWest(),south:d.getSouth(),east:d.getEast(),north:d.getNorth()};const c=o.getZoom();n("zoom",c),u.value=p(o),L(m.value,c)}e.watch(()=>r.visibleLayers,async()=>{if(Q.value.length>0&&ye(),m.value){const o=new Set(r.visibleLayers),d=[...o].filter(v=>!y.value.has(v));y.value=new Set(o);const c=f(d);if(c.length>0){const v=i.value?.getZoom();await h(m.value,c,v)}}});function B(o){if(r.visibleLayers.has(o))return!0;const d=r.layerList.find(c=>c.config.id===o)?.config;return!!d?.parentId&&r.visibleLayers.has(d.parentId)}function F(o){return!!k.value[o.id]}const x=e.computed(()=>r.layerList.filter(o=>o.config.type==="circle"&&B(o.config.id)&&F(o.config)).map(o=>o.config)),V=e.computed(()=>r.layerList.filter(o=>o.config.type==="fill"&&B(o.config.id)&&F(o.config)).map(o=>o.config)),M=e.computed(()=>r.layerList.filter(o=>o.config.type==="fill"&&o.config.outlinePaint&&B(o.config.id)&&F(o.config)).map(o=>o.config)),Z=e.computed(()=>r.layerList.filter(o=>o.config.type==="line"&&B(o.config.id)&&F(o.config)).map(o=>o.config));e.watch(Z,async o=>{if(o.length<2)return;await e.nextTick();const d=i.value;if(d)for(let c=o.length-1;c>=0;c--){const v=c<o.length-1?o[c+1].id:"highlight-lines";try{d.getLayer(o[c].id)&&d.moveLayer(o[c].id,v)}catch{}}});function z(o){return r.visibleTiledLayers?.has(o)??!1}function ee(o){return r.tiledLayerOpacities?.[o]??1}function le(o){return`${o.replace(/\/$/,"")}/tile/{z}/{y}/{x}`}function je(o){return{type:"raster",tiles:[le(o.url)],tileSize:256,attribution:o.attribution||""}}const Be=e.ref({}),Te=e.ref(new Set);async function xe(o){if(!Te.value.has(o.id)){Te.value.add(o.id);try{const d=o.url.replace(/\/$/,""),c=await fetch(`${d}?f=json`);if(!c.ok)return;const v=await c.json(),S=v.minScale||0;let E=v.maxScale||0;if(v.layers&&v.layers.length>0)for(const P of v.layers)P.maxScale&&P.maxScale>0&&(E===0||P.maxScale<E)&&(E=P.maxScale);E===0&&(E=72e3),Be.value={...Be.value,[o.id]:{minScale:S,maxScale:E}}}catch{}}}e.onMounted(()=>{if(r.tiledLayers)for(const o of r.tiledLayers)o.scaleBasedRendering&&xe(o)});function Pe(o){if(!o.scaleBasedRendering)return"tiled";const d=Be.value[o.id];if(!d)return"tiled";const c=u.value;return c===0||c>d.maxScale?"tiled":"dynamic"}const qe=e.computed(()=>r.tiledLayers?r.tiledLayers.filter(o=>z(o.id)?o.scaleBasedRendering?Pe(o)==="tiled":!0:!1):[]),ge=e.computed(()=>r.tiledLayers?r.tiledLayers.filter(o=>z(o.id)&&o.scaleBasedRendering?Pe(o)==="dynamic":!1):[]);function Ee(o){return{type:"raster",tiles:[`${o.url.replace(/\/$/,"")}/export?bbox={bbox-epsg-3857}&bboxSR=3857&imageSR=3857&size=256,256&format=png32&transparent=true&f=image`],tileSize:256,attribution:o.attribution||""}}function de(o){return{type:"geojson",data:k.value[o.id],tolerance:0}}function pe(o){return r.layerOpacities[o]??1}function $e(o){const d=pe(o.id),c=o.type==="circle"?"circle-opacity":o.type==="fill"?"fill-opacity":"line-opacity";if(o.type==="fill"&&o.paint["fill-opacity"]===0)return{...o.paint,"fill-opacity":0};const v=o.type==="circle"?"circle-color":o.type==="fill"?"fill-color":"line-color",S={...o.paint},E=S[v],P=S[c]===1,U=typeof E=="string"&&E.startsWith("rgba(");if(P&&U){if(d===1)return S;{const A=E.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(A&&A[4]){const[,oe,re,X,W]=A,T=parseFloat(W)*d;S[v]=`rgba(${oe}, ${re}, ${X}, ${T})`,S[c]=1}return S}}if(U){const A=E.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(A){const[,oe,re,X]=A;S[v]=`rgb(${oe}, ${re}, ${X})`}}return S[c]=d,S}function Ge(o){const d=pe(o.id);return{...o.outlinePaint,"line-opacity":d}}const Q=e.ref([]),me=e.ref(null),q=e.ref(0);function ve(o){const d=o.replace(/-outline$/,"");return r.layerList.find(v=>v.config.id===d)?.config}function Fe(o,d){return o.replace(/\{([^}]+)\}/g,(c,v)=>{const S=d[v];return S==null?"":String(S)})}function ae(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ve(o,d,c){if(o==null)return"-";if(d?.dateFormat&&typeof o=="number"){const v=new Date(o);if(c&&d.dateFormat==="shortDateShortTime")return v.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"});switch(d.dateFormat){case"shortDateShortTime":return v.toLocaleDateString();case"longMonthDayYear":return v.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"});case"shortDate":return v.toLocaleDateString();case"longDate":return v.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"});default:return v.toLocaleDateString()}}if(typeof o=="number"){if(o>1e12&&!d)return new Date(o).toLocaleDateString();const v=d?.places,S=d?.digitSeparator??!0;if(v!==void 0){if(Number.isInteger(o)&&v>=0)return String(o);const E=o.toFixed(v);if(S){const P=E.split("."),U=P[0]||"0",A=P[1],oe=U.replace(/\B(?=(\d{3})+(?!\d))/g,",");return A?`${oe}.${A}`:oe}return E}return Number.isInteger(o)?String(o):S?o.toLocaleString():String(o)}return String(o)}function Ie(o){const d=new Set;return o.filter(c=>{const S=`${c.layer.id.replace(/-outline$/,"")}:${JSON.stringify(c.properties)}`;return d.has(S)?!1:(d.add(S),!0)})}function ie(o,d){const c=k.value[o];if(!c?.features)return null;const v=d.objectid??d.OBJECTID??d.FID;if(v!=null){const S=c.features.find(E=>(E.properties?.objectid??E.properties?.OBJECTID??E.properties?.FID)===v);if(S)return S.geometry}return null}function He(o,d){const c=new Map;return d.forEach((v,S)=>{c.set(v.id,S)}),o.sort((v,S)=>{const E=v.layer.id.replace(/-outline$/,""),P=S.layer.id.replace(/-outline$/,""),U=c.get(E)??-1;return(c.get(P)??-1)-U})}function G(o){const d=i.value;if(!d)return;const c=[];r.layerList.forEach(T=>{const O=T.config;B(O.id)&&(c.push(O.id),O.outlinePaint&&c.push(`${O.id}-outline`))});const v=c.filter(T=>d.getLayer(T));if(v.length===0)return;const S=d.project([o.lngLat.lng,o.lngLat.lat]),E=10,P=[[S.x-E,S.y-E],[S.x+E,S.y+E]],U=d.queryRenderedFeatures(P,{layers:v});if(U.length===0)return;const A=Ie(U),oe=r.layerList.map(T=>T.config),X=He(A,oe).map(T=>{const O=T.layer.id.replace(/-outline$/,""),Y=ve(O);if(!Y)return null;const Ke=ie(Y.id,T.properties||{});return{layerId:Y.id,layerTitle:Y.title,properties:T.properties||{},geometry:Ke||T.geometry,popupConfig:Y.popup}}).filter(T=>T!==null);if(X.length===0)return;X.sort((T,O)=>{const Y=T.popupConfig?.popupSortField,Ke=O.popupConfig?.popupSortField;if(!Y||Y!==Ke)return 0;const Qe=T.properties[Y],Xe=O.properties[Y];if(Qe==null||Xe==null)return 0;const st=T.popupConfig?.popupSortOrder!=="asc";return Qe<Xe?st?1:-1:Qe>Xe?st?-1:1:0}),Q.value=X,q.value=0,me.value=[o.lngLat.lng,o.lngLat.lat];const W=X[0];if(W){const T=ve(W.layerId);if(T){const O=R(W.geometry),Y=I(T.id,T.type);C.value={geometry:W.geometry,geometryType:O,layerId:T.id,properties:W.properties,originalStyle:Y}}}}function ye(){Q.value=[],me.value=null,q.value=0,C.value=null}function he(o){if(Q.value.length===0)return;const d=o.target;if(!(d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable))switch(o.key){case"ArrowLeft":case"ArrowUp":o.preventDefault(),ze();break;case"ArrowRight":case"ArrowDown":o.preventDefault(),te();break;case"Escape":o.preventDefault(),ye();break}}e.onMounted(()=>{window.addEventListener("keydown",he)}),e.onUnmounted(()=>{window.removeEventListener("keydown",he)});function te(){const o=Q.value.length;o<=1||q.value>=o-1||(q.value=q.value+1)}function ze(){Q.value.length<=1||q.value<=0||(q.value=q.value-1)}const H=e.computed(()=>Q.value.length===0?null:Q.value[q.value]),be=e.computed(()=>{const o=H.value;return!o||!o.popupConfig?o?.layerTitle||"":Fe(o.popupConfig.title,o.properties)}),Le=e.computed(()=>{const o=H.value;if(!o)return"";let d='<div class="popup-content">';if(d+=`<h3 class="popup-title">${ae(be.value)}</h3>`,o.popupConfig?.fields?.length){d+=`<table class="popup-table" aria-label="${ae(be.value)}">`;for(const c of o.popupConfig.fields){const v=Ve(o.properties[c.field],c.format,o.popupConfig.showTime),S=c.label.toLowerCase(),E=S.includes("url")||S.includes("website"),P=v.startsWith("http://")||v.startsWith("https://")||v.startsWith("www.")||E&&v.includes("."),U=v.startsWith("http://")||v.startsWith("https://")?v:`https://${v}`,A=P?`<a href="${ae(U)}" target="_blank" rel="noopener noreferrer">${ae(v)}</a>`:ae(v);d+=`<tr><th scope="row">${ae(c.label)}</th><td>${A}</td></tr>`}d+="</table>"}return d+="</div>",d}),J=e.ref({type:"FeatureCollection",features:[]}),ke=e.ref({type:"FeatureCollection",features:[]}),we=e.ref({type:"FeatureCollection",features:[]}),Je={"circle-radius":["get","highlightRadius"],"circle-color":"#00FFFF","circle-opacity":.8,"circle-stroke-width":2,"circle-stroke-color":"#FFFFFF"},De={"line-width":["get","highlightWidth"],"line-color":"#00FFFF","line-opacity":.9},g={"fill-color":"#808080","fill-opacity":.5},C=e.ref(null);function R(o){return o.type}function I(o,d){const c=ve(o);if(!c)return{radius:5,width:2};const v=c.paint||{};if(d==="circle"){const S=v["circle-radius"];return typeof S=="number"?{radius:S}:{radius:5}}if(d==="line"||d==="fill"){const S=v["line-width"];if(typeof S=="number")return{width:S};if(c.outlinePaint&&c.outlinePaint["line-width"]){const E=c.outlinePaint["line-width"];if(typeof E=="number")return{width:E}}return{width:2}}return{radius:5,width:2}}function _(o){return!o||o.length===0?[]:o[0]??[]}function se(o){const{geometry:d,geometryType:c,originalStyle:v}=o;if(c==="Point"||c==="MultiPoint"){const E=(v.radius||5)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:d,properties:{highlightRadius:E}}]}}if(c==="LineString"||c==="MultiLineString"){const E=(v.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:d,properties:{highlightWidth:E}}]}}if(c==="Polygon"){const S=d.coordinates,E=_(S),U=(v.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:E},properties:{highlightWidth:U}}]}}if(c==="MultiPolygon"){const S=d.coordinates,P=(v.width||2)+3;return{type:"FeatureCollection",features:S.map(A=>({type:"Feature",geometry:{type:"LineString",coordinates:_(A)},properties:{highlightWidth:P}}))}}return{type:"FeatureCollection",features:[]}}function Se(o){const{geometry:d,geometryType:c}=o;return c==="Polygon"||c==="MultiPolygon"?{type:"FeatureCollection",features:[{type:"Feature",geometry:d,properties:{}}]}:{type:"FeatureCollection",features:[]}}function kt(o){if(!o){wt();return}const d=se(o);o.geometryType==="Point"||o.geometryType==="MultiPoint"?(J.value=d,ke.value={type:"FeatureCollection",features:[]},we.value={type:"FeatureCollection",features:[]}):(ke.value=d,J.value={type:"FeatureCollection",features:[]},we.value=Se(o))}function wt(){J.value={type:"FeatureCollection",features:[]},ke.value={type:"FeatureCollection",features:[]},we.value={type:"FeatureCollection",features:[]}}e.watch(C,o=>{kt(o)}),e.watch(()=>r.visibleLayers,o=>{C.value&&!o.has(C.value.layerId)&&(C.value=null,ye())},{deep:!0}),e.watch(q,()=>{const o=H.value;if(!o){C.value=null;return}const d=ve(o.layerId);if(d){const c=R(o.geometry),v=I(d.id,d.type);C.value={geometry:o.geometry,geometryType:c,layerId:d.id,properties:o.properties,originalStyle:v}}});const it=e.ref(null);function St(o){const[d,c]=o.geometry.coordinates;it.value=[d,c]}return(o,d)=>(e.openBlock(),e.createElementBlock("div",Ct,[e.createVNode(e.unref(K.Map),{ref_key:"mapRef",ref:s,zoom:r.initialZoom,center:r.initialCenter,"navigation-controls":{position:r.navigationControlPosition},"geolocation-control":{position:r.geolocationControlPosition},"basemap-change-controls":{toggle:!0,dropdown:!0,position:r.basemapControlPosition},"map-search-control":{position:r.searchControlPosition},"enable-cyclomedia":!0,"cyclomedia-config":r.cyclomediaConfig,"cyclomedia-button-position":r.cyclomediaButtonPosition,"enable-pictometry":!0,"pictometry-credentials":r.pictometryCredentials,"pictometry-button-position":r.pictometryButtonPosition,"tool-panel-layout":"vertical","tool-panel-split-ratio":50,onZoom:b,onClick:ye,onMoveend:w,onLoad:$,onSearchResult:St},{default:e.withCtx(()=>[r.drawControlPosition!==null?(e.openBlock(),e.createBlock(e.unref(K.DrawTool),{key:0,position:r.drawControlPosition},null,8,["position"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(qe.value,c=>(e.openBlock(),e.createBlock(e.unref(K.RasterLayer),{id:"tiled-"+c.id,key:"tiled-"+c.id,source:je(c),paint:{"raster-opacity":ee(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles"},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ge.value,c=>(e.openBlock(),e.createBlock(e.unref(K.RasterLayer),{id:"dynamic-"+c.id,key:"dynamic-"+c.id,source:Ee(c),paint:{"raster-opacity":ee(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles"},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,c=>(e.openBlock(),e.createBlock(e.unref(K.CircleLayer),{id:c.id,key:c.id,source:de(c),paint:$e(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,c=>(e.openBlock(),e.createBlock(e.unref(K.FillLayer),{id:c.id,key:c.id,source:de(c),paint:$e(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,c=>(e.openBlock(),e.createBlock(e.unref(K.LineLayer),{id:c.id+"-outline",key:c.id+"-outline",source:de(c),paint:Ge(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.value,c=>(e.openBlock(),e.createBlock(e.unref(K.LineLayer),{id:c.id,key:c.id,source:de(c),paint:$e(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:G},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),e.createVNode(e.unref(K.CircleLayer),{id:"highlight-circles",key:"highlight-circles-layer",source:{type:"geojson",data:J.value},paint:Je},null,8,["source"]),e.createVNode(e.unref(K.FillLayer),{id:"highlight-fill",key:"highlight-fill-layer",source:{type:"geojson",data:we.value},paint:g},null,8,["source"]),e.createVNode(e.unref(K.LineLayer),{id:"highlight-lines",key:"highlight-lines-layer",source:{type:"geojson",data:ke.value},paint:De},null,8,["source"]),e.createVNode(e.unref(K.MapMarker),{"lng-lat":it.value,color:"#2176d2"},null,8,["lng-lat"]),H.value&&me.value?(e.openBlock(),e.createBlock(e.unref(K.MapPopup),{key:1,"lng-lat":me.value,html:Le.value,"close-on-click":!1,offset:[0,-15],"show-navigation":Q.value.length>1,"current-feature-index":q.value,"total-features":Q.value.length,"layer-name":H.value.layerTitle,onClose:ye,onNext:te,onPrevious:ze},null,8,["lng-lat","html","show-navigation","current-feature-index","total-features","layer-name"])):e.createCommentVNode("",!0)]),_:1},8,["zoom","center","navigation-controls","geolocation-control","basemap-change-controls","map-search-control","cyclomedia-config","cyclomedia-button-position","pictometry-credentials","pictometry-button-position"])]))}}),ue=(t,l)=>{const r=t.__vccOpts||t;for(const[n,s]of l)r[n]=s;return r},mt=ue(Bt,[["__scopeId","data-v-1f8b1f59"]]);function Ye(t){let l=t.split("?")[0]||t;return l=l.replace(/\/query$/,""),l=l.replace(/\/$/,""),l=l.replace(/^https?:\/\//,""),l.toLowerCase()}const xt=["disabled"],Et=e.defineComponent({inheritAttrs:!1,__name:"PhlButton",props:{href:{},to:{},target:{},rel:{},disabled:{type:Boolean,default:!1},clickTarget:{},variant:{default:"primary"},size:{default:"medium"},iconOnly:{type:Boolean,default:!1},iconRight:{type:Boolean},text:{},className:{},iconDefinition:{},iconClass:{},src:{},svgRaw:{}},setup(t){const l=t,r=u=>"href"in u&&u.href!==void 0||"to"in u&&u.to!==void 0,n=e.computed(()=>j.cn("phila-button",`phila-button--${l.variant}`,l.size&&`is-${l.size}`,l.iconOnly&&"icon-button",l.iconOnly&&l.variant==="standard"&&"icon-button--standard",l.className)),s=e.computed(()=>r(l)?"to"in l&&l.to!==void 0?{to:l.to,disabled:l.disabled,className:n.value}:{href:l.href,target:l.target,rel:l.rel,disabled:l.disabled,className:n.value}:{}),i=e.computed(()=>({iconDefinition:l.iconDefinition,iconClass:l.iconClass,src:l.src,iconRight:l.iconRight,iconOnly:l.iconOnly,text:l.text,size:l.size}));return(u,b)=>r(l)?(e.openBlock(),e.createBlock(e.unref(j.BaseLink),e.mergeProps({key:0},{...s.value,...u.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(j.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.text),1)])]),_:3},16)]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:1,type:"button",disabled:l.disabled,class:n.value},u.$attrs),[e.createVNode(e.unref(j.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.text),1)])]),_:3},16)],16,xt))}});var $t={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"]},Vt=$t,Nt={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},Mt=Nt;const Tt=["for"],Pt={class:"state-layer"},Ft={class:"content"},It={class:"input-text-container"},zt=["id","placeholder","aria-label"],Dt={key:1,class:"has-text-body-small phila-supporting-text"},Ot={key:2,class:"has-text-body-small phila-error-text"},Rt=e.defineComponent({inheritAttrs:!1,__name:"TextField",props:{modelValue:{default:void 0},className:{default:""},label:{default:""},id:{default:`phila-text-field-${Math.random().toString(36).substring(2,9)}`},supportingText:{default:""},placeholder:{default:""},leadingIcon:{default:""},trailingIcon:{default:""},error:{default(){return[]}}},emits:["update:modelValue"],setup(t,{emit:l}){const r=e.useAttrs(),n=t,s=e.computed(()=>typeof n.error=="string"?n.error:n.error[0]),i=e.toRef(n,"id"),u=l,b=e.ref(""),p=e.computed({get:()=>n.modelValue!==void 0?n.modelValue:b.value,set:f=>{u("update:modelValue",f),b.value=f}}),k=e.computed(()=>{const f=["default-class"];return r.disabled!=null&&f.push("phila-input--disabled"),s.value&&f.push("phila-input--error"),r.required!=null&&f.push("phila-input--required"),j.cn(...f)}),m=e.computed(()=>{const f=[];return p.value!==""&&f.push("phila-text-field--filled"),n.className&&f.push(n.className),j.cn(...f)}),y=e.computed(()=>{if(!(n.label||r["aria-label"]))return n.placeholder||void 0}),a=e.ref(null),h=f=>{f.target.closest("button")||a.value?.focus()};return(f,L)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["phila-input",k.value])},[n.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:i.value,class:"has-text-label-small phila-label"},e.toDisplayString(n.label),9,Tt)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["phila-text-field",m.value]),onClick:h},[e.createElementVNode("div",Pt,[n.leadingIcon?(e.openBlock(),e.createBlock(e.unref(j.Icon),{key:0,"icon-class":n.leadingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.createElementVNode("div",Ft,[e.createElementVNode("div",It,[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:i.value,ref_key:"inputRef",ref:a,"onUpdate:modelValue":L[0]||(L[0]=w=>p.value=w),class:"phila-text-field-input has-text-body-default",placeholder:n.placeholder,"aria-label":y.value},e.unref(r)),null,16,zt),[[e.vModelDynamic,p.value]])])]),p.value!=""?(e.openBlock(),e.createBlock(e.unref(Et),{key:1,variant:"standard",size:"small","icon-only":"","icon-definition":e.unref(Mt),onClick:L[1]||(L[1]=w=>p.value="")},null,8,["icon-definition"])):e.createCommentVNode("",!0),n.trailingIcon?(e.openBlock(),e.createBlock(e.unref(j.Icon),{key:2,size:"small","icon-class":n.trailingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"trailing-action")])],2),n.supportingText?(e.openBlock(),e.createElementBlock("div",Dt,e.toDisplayString(n.supportingText),1)):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",Ot,[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(Vt),size:"small",inline:"",decorative:""},null,8,["icon-definition"]),e.createTextVNode(" "+e.toDisplayString(s.value),1)])):e.createCommentVNode("",!0)],2))}});var _t={prefix:"fas",iconName:"filter",icon:[512,512,[],"f0b0","M32 64C19.1 64 7.4 71.8 2.4 83.8S.2 109.5 9.4 118.6L192 301.3 192 416c0 8.5 3.4 16.6 9.4 22.6l64 64c9.2 9.2 22.9 11.9 34.9 6.9S320 492.9 320 480l0-178.7 182.6-182.6c9.2-9.2 11.9-22.9 6.9-34.9S492.9 64 480 64L32 64z"]},At={prefix:"fas",iconName:"caret-right",icon:[256,512,[],"f0da","M249.3 235.8c10.2 12.6 9.5 31.1-2.2 42.8l-128 128c-9.2 9.2-22.9 11.9-34.9 6.9S64.5 396.9 64.5 384l0-256c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l128 128 2.2 2.4z"]},Ut={prefix:"fas",iconName:"caret-left",icon:[256,512,[],"f0d9","M7.7 235.8c-10.3 12.6-9.5 31.1 2.2 42.8l128 128c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6l0-256c0-12.9-7.8-24.6-19.8-29.6s-25.7-2.2-34.9 6.9l-128 128-2.2 2.4z"]},ct={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},Zt={prefix:"fas",iconName:"bars",icon:[448,512,["navicon"],"f0c9","M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"]},Wt={prefix:"fas",iconName:"circle-info",icon:[512,512,["info-circle"],"f05a","M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zM224 160a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm-8 64l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-64-24 0c-13.3 0-24-10.7-24-24s10.7-24 24-24z"]};const jt={key:0,class:"loading-indicator",role:"status"},qt=["aria-label"],Gt={key:2,class:"zoom-indicator"},Ht=e.defineComponent({__name:"LayerStatusIndicators",props:{loading:{type:Boolean},error:{},unavailable:{type:Boolean}},setup(t){return(l,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[t.loading&&!t.unavailable?(e.openBlock(),e.createElementBlock("span",jt," Loading... ")):e.createCommentVNode("",!0),t.error?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":t.error,role:"status"}," Error ",8,qt)):e.createCommentVNode("",!0),t.unavailable?(e.openBlock(),e.createElementBlock("span",Gt," (zoom in) ")):e.createCommentVNode("",!0)],64))}}),_e=ue(Ht,[["__scopeId","data-v-19b1b402"]]),Jt={class:"opacity-control"},Kt=["for"],Qt=["id","value","aria-label"],Xt=e.defineComponent({__name:"LayerOpacitySlider",props:{layerId:{},layerName:{},opacity:{}},emits:["update:opacity"],setup(t,{emit:l}){const r=l;function n(s){const i=s.target;r("update:opacity",parseFloat(i.value))}return(s,i)=>(e.openBlock(),e.createElementBlock("div",Jt,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+t.layerId}," Opacity: "+e.toDisplayString(Math.round(t.opacity*100))+"% ",9,Kt),e.createElementVNode("input",{id:"opacity-"+t.layerId,type:"range",min:"0",max:"1",step:"0.05",value:t.opacity,"aria-label":"Opacity for "+t.layerName,class:"opacity-slider",onInput:n},null,40,Qt)]))}}),et=ue(Xt,[["__scopeId","data-v-1a025f6a"]]),Yt=["aria-label"],eo={key:3,class:"legend-label"},to=e.defineComponent({__name:"LayerLegend",props:{items:{},label:{}},setup(t){return(l,r)=>(e.openBlock(),e.createElementBlock("ul",{class:"layer-legend","aria-label":t.label},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(n,s)=>(e.openBlock(),e.createElementBlock("li",{key:s,class:"legend-item"},[n.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:n.color}),"aria-hidden":"true"},null,4)):n.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:n.color,height:`${n.width||2}px`}),"aria-hidden":"true"},null,4)):n.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:n.color,borderColor:n.outlineColor||"#666",borderWidth:n.outlineColor?`${Math.max(n.outlineWidth||2,2)}px`:void 0}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),t.items.length>1?(e.openBlock(),e.createElementBlock("span",eo,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0)]))),128))],8,Yt))}}),tt=ue(to,[["__scopeId","data-v-3a9206ab"]]);function ot(t){function l(u){return t().visibleLayerIds.has(u)}function r(u){return t().layerOpacities[u]??1}function n(u){return t().loadingLayerIds.has(u)}function s(u){return t().layerErrors[u]||null}function i(u){const b=t().currentZoom,p=u.minZoom,k=u.maxZoom;return!(p!==void 0&&b<p||k!==void 0&&b>k)}return{isVisible:l,getLayerOpacity:r,isLayerLoading:n,getLayerError:s,isLayerAvailableAtZoom:i}}const oo={class:"layer-panel"},no={key:0,class:"search-box"},lo={key:1,class:"topics-container"},ao={class:"layer-row"},ro=["href","aria-label"],io={key:1,class:"metadata-placeholder"},so=["checked","disabled","onChange"],co={class:"layer-title"},uo={key:0,class:"no-results"},fo=e.defineComponent({__name:"LayerPanel",props:{layerList:{},visibleLayers:{},layerOpacities:{},loadingLayers:{},layerErrors:{},currentZoom:{},searchQuery:{},layerMetadata:{},mode:{default:"flat"},showSearch:{type:Boolean,default:!0},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},searchPlaceholder:{default:"Filter layers..."}},emits:["toggleLayer","setOpacity","updateSearch"],setup(t,{emit:l}){const r=t,n=l,s=e.computed(()=>{if(!r.searchQuery.trim())return r.layerList;const f=r.searchQuery.toLowerCase();return r.layerList.filter(L=>L.config.title.toLowerCase().includes(f))});function i(f){const L=Ye(f);return r.layerMetadata[L]||null}const u=e.computed(()=>r.layerList.some(f=>i(f.config.url))),{isVisible:b,getLayerOpacity:p,isLayerLoading:k,getLayerError:m,isLayerAvailableAtZoom:y}=ot(()=>({visibleLayerIds:r.visibleLayers,layerOpacities:r.layerOpacities,loadingLayerIds:r.loadingLayers,layerErrors:r.layerErrors,currentZoom:r.currentZoom})),a=e.computed({get:()=>r.searchQuery,set:f=>n("updateSearch",f)});function h(f){n("toggleLayer",f)}return(f,L)=>(e.openBlock(),e.createElementBlock("div",oo,[t.showSearch?(e.openBlock(),e.createElementBlock("div",no,[e.createVNode(e.unref(Rt),{modelValue:a.value,"onUpdate:modelValue":L[0]||(L[0]=w=>a.value=w),placeholder:t.searchPlaceholder,"class-name":"layer-search-field"},{"trailing-action":e.withCtx(()=>[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(_t),size:"small",inline:"",decorative:""},null,8,["icon-definition"])]),_:1},8,["modelValue","placeholder"])])):e.createCommentVNode("",!0),t.mode==="topics"?(e.openBlock(),e.createElementBlock("div",lo,[e.renderSlot(f.$slots,"topics",{},()=>[L[2]||(L[2]=e.createElementVNode("div",{class:"no-topics"},' No topic components provided. Use the "topics" slot to add TopicAccordion components. ',-1))],!0)])):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["layer-list",{"has-metadata":u.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,w=>(e.openBlock(),e.createElementBlock("div",{key:w.config.id,class:"layer-item"},[e.createElementVNode("div",ao,[i(w.config.url)?(e.openBlock(),e.createElementBlock("a",{key:0,href:i(w.config.url)||"",target:"_blank",rel:"noopener noreferrer",class:"metadata-link","aria-label":"View metadata for "+w.config.title,onClick:L[1]||(L[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(Wt),size:"small",inline:"",decorative:""},null,8,["icon-definition"])],8,ro)):u.value?(e.openBlock(),e.createElementBlock("span",io)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!e.unref(y)(w.config),"layer-error":e.unref(m)(w.config.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(b)(w.config.id),disabled:!e.unref(y)(w.config),onChange:$=>h(w.config.id)},null,40,so),e.createElementVNode("span",co,[e.createTextVNode(e.toDisplayString(w.config.title)+" ",1),e.createVNode(_e,{loading:e.unref(k)(w.config.id),error:e.unref(m)(w.config.id),unavailable:!e.unref(y)(w.config)},null,8,["loading","error","unavailable"])])],2)]),t.showOpacity&&e.unref(b)(w.config.id)&&e.unref(y)(w.config)?(e.openBlock(),e.createBlock(et,{key:0,"layer-id":w.config.id,"layer-name":w.config.title,opacity:e.unref(p)(w.config.id),"onUpdate:opacity":$=>n("setOpacity",w.config.id,$)},null,8,["layer-id","layer-name","opacity","onUpdate:opacity"])):e.createCommentVNode("",!0),t.showLegend&&e.unref(b)(w.config.id)&&e.unref(y)(w.config)&&w.config.legend?.length?(e.openBlock(),e.createBlock(tt,{key:1,items:w.config.legend,label:"Legend for "+w.config.title},null,8,["items","label"])):e.createCommentVNode("",!0)]))),128)),s.value.length===0?(e.openBlock(),e.createElementBlock("div",uo,'No layers match "'+e.toDisplayString(t.searchQuery)+'"',1)):e.createCommentVNode("",!0)],2))]))}}),yt=ue(fo,[["__scopeId","data-v-e48bb978"]]),po={esriSLSSolid:null,esriSLSDash:[6,1.5],esriSLSDot:[1,1.5],esriSLSDashDot:[6,1.5,1,1.5],esriSLSDashDotDot:[6,1.5,1,1.5,1,1.5],esriSLSNull:null};function Me(t){if(t)return po[t]??void 0}function mo(t,l,r,n,s){const i=[];let u=l[0],b=[t[0]],p=0;for(let a=1;a<t.length;a++)l[a]===u?b.push(t[a]):(i.push({style:u,breaks:b,startIndex:p}),u=l[a],b=[t[a]],p=a);i.push({style:u,breaks:b,startIndex:p});const k=[],m=new Set;let y=n.minValue??0;for(let a=0;a<i.length;a++){const h=i[a],f=h.breaks,L=Me(h.style),w=a===0?null:i[a-1].breaks[i[a-1].breaks.length-1].classMaxValue,$=f[f.length-1].classMaxValue;let B;const F=!!n.defaultSymbol;w===null?B=`${!F&&n.minValue!=null?`${r} >= ${n.minValue} AND `:""}${r} <= ${$}`:a===i.length-1&&F?B=`${r} > ${w}`:B=`${r} > ${w} AND ${r} <= ${$}`;const x={"line-opacity":ne(s)};if(L&&(x["line-dasharray"]=L),f.length===1)x["line-color"]=N(f[0].symbol?.color),x["line-width"]=D(f[0].symbol?.width||2);else{const z=["step",["get",r]],ee=["step",["get",r]];z.push(N(f[0].symbol?.color)),ee.push(D(f[0].symbol?.width||2));for(let le=1;le<f.length;le++)z.push(f[le-1].classMaxValue),z.push(N(f[le].symbol?.color)),ee.push(f[le-1].classMaxValue),ee.push(D(f[le].symbol?.width||2));x["line-color"]=z,x["line-width"]=ee}const V=[];for(const z of f)V.push({type:"line",color:N(z.symbol?.color),width:D(z.symbol?.width||2),label:z.label||`${y} - ${z.classMaxValue}`}),y=z.classMaxValue+1;const M=h.style.replace("esriSLS","").toLowerCase();let Z;a===0?Z="":m.has(M)?Z=`-${M}-${a}`:Z=`-${M}`,m.add(M),k.push({suffix:Z,where:B,paint:x,legend:V})}return k}function yo(t,l,r,n,s){const i=new Map;for(const k of t){const m=k.symbol?.style||"esriSLSSolid";i.has(m)||i.set(m,[]),i.get(m).push(k)}const u=[],b=new Set;let p=!0;for(const[k,m]of i){const y=Me(k),h=m.map(B=>`${l} = '${String(B.value).replace(/'/g,"''")}'`).join(" OR "),f={"line-opacity":ne(n)};if(y&&(f["line-dasharray"]=y),m.length===1)f["line-color"]=N(m[0].symbol?.color),f["line-width"]=D(m[0].symbol?.width||2);else{const B=["match",["to-string",["get",l]]];for(const F of m)B.push(Re(F.value)),B.push(N(F.symbol?.color));B.push(r?N(r.color):"rgba(0, 0, 0, 0)"),f["line-color"]=B,f["line-width"]=D(m[0].symbol?.width||2)}const L=[];for(const B of m){const F=String(B.value),V=s?.get(F)||B.label||F;L.push({type:"line",color:N(B.symbol?.color),width:D(B.symbol?.width||1),label:V})}const w=k.replace("esriSLS","").toLowerCase();let $;p?$="":b.has(w)?$=`-${w}-${u.length}`:$=`-${w}`,b.add(w),p=!1,u.push({suffix:$,where:h,paint:f,legend:L})}return u}function N(t){if(!t||!Array.isArray(t)||t.length<3)return"#888888";const l=t[0],r=t[1],n=t[2],i=(t[3]??255)/255;return i===1?`#${l.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`:`rgba(${l}, ${r}, ${n}, ${i.toFixed(2)})`}function ne(t){return t!==void 0?t:1}function D(t){return Math.round(t*(96/72)*10)/10}const ho=559082264;function ut(t){return!t||t<=0?null:Math.round(Math.log2(ho/t)*100)/100}function go(t,l){const r={};if(t&&t>0){const n=ut(t);n!==null&&(r.minZoom=n)}if(l&&l>0){const n=ut(l);n!==null&&(r.maxZoom=n)}return r}function Ze(t){if(!t)return"fill";switch(t.type){case"esriSFS":return"fill";case"esriSLS":return"line";case"esriSMS":return"circle";case"esriPMS":return"circle";case"esriPFS":return"fill";default:return"fill"}}function ce(t){return!(!t||t.style==="esriSLSNull"||t.color===null||t.width===0||t.color&&t.color[3]===0)}function Re(t){return String(t)}function ht(t,l,r){const n=t.symbol,s=Ze(n);let i={},u=[],b=null;if(s==="fill"&&n){const p=n.color===null?0:n.color?.[3]??255,k=p===0?"rgba(0, 0, 0, 0)":N(n.color),m=p===0?0:p<255?1:ne(l);if(i={"fill-color":k,"fill-opacity":m},ce(n.outline)){const y=D(n.outline.width||1);b={"line-color":N(n.outline.color),"line-width":y}}p===0&&ce(n.outline)?u=[{type:"fill",color:"transparent",outlineColor:N(n.outline.color),outlineWidth:D(n.outline.width||1),label:t.label||"Feature"}]:u=[{type:"fill",color:N(n.color),label:t.label||"Feature"}]}else if(s==="line"&&n){i={"line-color":N(n.color),"line-width":D(n.width||1),"line-opacity":ne(l)};const p=Me(n.style);p&&(i["line-dasharray"]=p),u=[{type:"line",color:N(n.color),width:D(n.width||1),label:t.label||"Feature"}]}else if(s==="circle"&&n){const p=Math.round((n.size||6)*.71*100)/100;i={"circle-color":N(n.color),"circle-radius":p,"circle-opacity":ne(l)},ce(n.outline)&&(i["circle-stroke-color"]=N(n.outline.color),i["circle-stroke-width"]=D(n.outline.width||1)),u=[{type:"circle",color:N(n.color),label:t.label||"Feature"}]}return{paint:i,legend:u,geomType:s,outlinePaint:b}}function vo(t,l,r){const n=t.field1.toLowerCase(),s=t.uniqueValueInfos||[],i=t.defaultSymbol;if(s.length===0)return ht({...t,symbol:i},l);const u=s[0]?.symbol||i,b=Ze(u);let p={};const k=[];let m=null;if(b==="fill"){const y=["match",["to-string",["get",n]]];for(const a of s){y.push(Re(a.value)),y.push(N(a.symbol?.color));const h=String(a.value),L=r?.get(h)||a.label||h;k.push({type:"fill",color:N(a.symbol?.color),label:L})}if(y.push(i?N(i.color):"rgba(0, 0, 0, 0)"),i&&k.push({type:"fill",color:N(i.color),label:t.defaultLabel||"Other"}),p={"fill-color":y,"fill-opacity":ne(l)},ce(u?.outline)){const a=D(Math.max(u.outline.width||1,1));m={"line-color":N(u.outline.color),"line-width":a}}}else if(b==="line"){const y=["match",["to-string",["get",n]]];for(const f of s){y.push(Re(f.value)),y.push(N(f.symbol?.color));const L=String(f.value),$=r?.get(L)||f.label||L;k.push({type:"line",color:N(f.symbol?.color),width:D(f.symbol?.width||1),label:$})}y.push(i?N(i.color):"rgba(0, 0, 0, 0)"),i&&k.push({type:"line",color:N(i.color),width:D(i.width||1),label:t.defaultLabel||"Other"}),p={"line-color":y,"line-width":D(u?.width||2),"line-opacity":ne(l)};const a=s.map(f=>f.symbol?.style||"esriSLSSolid"),h=[...new Set(a)];if(h.length>1){const f=yo(s,n,i,l,r);return{paint:{},legend:[],geomType:b,outlinePaint:m,splitLayers:f}}if(h.length===1){const f=Me(h[0]);f&&(p["line-dasharray"]=f)}}else if(b==="circle"){const y=["match",["to-string",["get",n]]];for(const h of s){y.push(Re(h.value)),y.push(N(h.symbol?.color));const f=String(h.value),w=r?.get(f)||h.label||f;k.push({type:"circle",color:N(h.symbol?.color),label:w})}y.push(i?N(i.color):"rgba(0, 0, 0, 0)"),i&&k.push({type:"circle",color:N(i.color),label:t.defaultLabel||"Other"});const a=Math.round((u?.size||6)*.71*100)/100;p={"circle-color":y,"circle-radius":a,"circle-opacity":ne(l)},ce(u?.outline)&&(p["circle-stroke-color"]=N(u.outline.color),p["circle-stroke-width"]=D(u.outline.width||1))}return{paint:p,legend:k,geomType:b,outlinePaint:m}}function bo(t,l){const r=t.field.toLowerCase(),n=t.classBreakInfos||[],s=t.visualVariables?.find(m=>m.type==="colorInfo");if(s?.stops&&s.stops.length>0)return Lo(s,r,t,l);if(n.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=n[0]?.symbol,u=Ze(i);let b={};const p=[];let k=null;if(u==="fill"){const m=["step",["get",r]];m.push(N(n[0]?.symbol?.color));for(let y=0;y<n.length;y++){const a=n[y];y>0&&(m.push(n[y-1].classMaxValue),m.push(N(a.symbol?.color))),p.push({type:"fill",color:N(a.symbol?.color),label:a.label||`${a.classMaxValue}`})}if(b={"fill-color":m,"fill-opacity":ne(l)},ce(i?.outline)){const y=D(i.outline.width||1);k={"line-color":N(i.outline.color),"line-width":y}}}else if(u==="line"){const m=n.map($=>$.symbol?.style||"esriSLSSolid"),y=[...new Set(m)];if(y.length>1){const $=mo(n,m,r,t,l);return{paint:{},legend:[],geomType:u,outlinePaint:k,splitLayers:$}}const h=["step",["get",r]];h.push(N(n[0]?.symbol?.color));let f=t.minValue??0;for(let $=0;$<n.length;$++){const B=n[$];$>0&&(h.push(n[$-1].classMaxValue),h.push(N(B.symbol?.color))),p.push({type:"line",color:N(B.symbol?.color),width:D(B.symbol?.width||i?.width||2),label:B.label||`${f} - ${B.classMaxValue}`}),f=B.classMaxValue+1}const L=D(i?.width||2);b={"line-color":h,"line-width":L,"line-opacity":ne(l)};const w=Me(y[0]);w&&(b["line-dasharray"]=w)}return{paint:b,legend:p,geomType:u,outlinePaint:k}}function Lo(t,l,r,n){const s=t.stops||[];if(s.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=r.classBreakInfos?.[0]?.symbol||r.defaultSymbol,u=Ze(i);let b={};const p=[];let k=null;if(u==="fill"){const m=["interpolate",["linear"],["get",l]];for(const a of s)m.push(a.value),m.push(N(a.color)),p.push({type:"fill",color:N(a.color),label:a.label||`${a.value}`});if(b={"fill-color":["case",["==",["get",l],null],"rgba(0, 0, 0, 0)",m],"fill-opacity":ne(n)},ce(i?.outline)){const a=D(i.outline.width||1);k={"line-color":N(i.outline.color),"line-width":a}}}return{paint:b,legend:p,geomType:u,outlinePaint:k}}function ko(t,l,r,n){if(!t?.renderer)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const s=t.renderer;switch(s.type){case"simple":return ht(s,l);case"uniqueValue":return vo(s,l,r);case"classBreaks":return bo(s,l);default:return{paint:{},legend:[],geomType:"fill",outlinePaint:null}}}function wo(t){if(!t)return null;const l=(t.title||"").replace(/\{([^}]+)\}/g,(i,u)=>`{${u.toLowerCase()}}`),n=(t.fieldInfos||[]).filter(i=>i.visible===!0).map(i=>{const u={field:i.fieldName.toLowerCase(),label:i.label||i.fieldName};return i.format&&(u.format={},i.format.dateFormat&&(u.format.dateFormat=i.format.dateFormat),i.format.digitSeparator!==void 0&&(u.format.digitSeparator=i.format.digitSeparator),i.format.places!==void 0&&(u.format.places=i.format.places),Object.keys(u.format).length===0&&delete u.format),u}),s={title:l,fields:n};return t.showTime&&(s.showTime=!0),s}function So(t){return t?.definitionExpression}function Co(t){return(t.includes("_")?t.split("_").slice(1).join(" "):t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Bo(t){return t.includes("_")?t.split("_").slice(1).join(" "):t}function xo(t){const l=new Map;if(!t)return l;const r=t.split(`
2
+ `),n=/^(\d{1,3})\s+(.+)$/;for(const s of r){const i=s.trim().match(n);if(i){const[,u,b]=i;u&&b&&l.set(u,b.trim())}}return l}async function Eo(t){try{const l=await fetch(`${t}?f=json`);if(!l.ok)return null;const r=await l.json();return r.drawingInfo?{drawingInfo:r.drawingInfo,description:r.description}:null}catch{return null}}function dt(t){const l={id:t.id,title:t.title,type:t.type,url:t.url,opacity:t.opacity,paint:t.paint,legend:t.legend,popup:t.popup};return t.where&&(l.where=t.where),t.minZoom!==void 0&&(l.minZoom=t.minZoom),t.maxZoom!==void 0&&(l.maxZoom=t.maxZoom),t.outlinePaint&&(l.outlinePaint=t.outlinePaint),t.parentId&&(l.parentId=t.parentId),l}async function nt(t){const l=t.operationalLayers||[],r=[],n=["Zoning and Planning_Land Use"];for(const s of l)if(s.url&&!s.title?.toLowerCase().includes("(under construction)")&&!(s.url&&/\/MapServer(\/\d+)?$/i.test(s.url)))try{let i=s.layerDefinition?.drawingInfo,u;const b=!i||!i.renderer,p=n.includes(s.title),k=i?.renderer?.uniqueValueInfos?.[0]?.symbol?.outline||i?.renderer?.defaultSymbol?.outline;if((b||p)&&s.url){const V=await Eo(s.url);if(V){if(i=V.drawingInfo,k&&ce(k)&&i?.renderer){const M=i.renderer,Z=M.uniqueValueInfos?.[0]?.symbol?.outline||M.defaultSymbol?.outline;if(!ce(Z)){for(const z of M.uniqueValueInfos||[])z.symbol&&(z.symbol.outline=k);M.defaultSymbol&&(M.defaultSymbol.outline=k)}}V.description&&(u=xo(V.description),u.size>0)}}const{paint:m,legend:y,geomType:a,outlinePaint:h,splitLayers:f}=ko(i,s.opacity,u,s.title),L=wo(s.popupInfo),w=So(s.layerDefinition),$=go(s.layerDefinition?.minScale,s.layerDefinition?.maxScale),B=Co(s.title),F=Bo(s.title),x=s.opacity??1;if(f&&f.length>0)for(const V of f){const M=`${B}${V.suffix}`;r.push(dt({id:M,title:F,type:a,url:s.url,opacity:x,paint:V.paint,legend:V.legend,popup:L,where:w?`(${w}) AND (${V.where})`:V.where,minZoom:$.minZoom,maxZoom:$.maxZoom,parentId:V.suffix?B:void 0}))}else r.push(dt({id:B,title:F,type:a,url:s.url,opacity:x,paint:m,legend:y,popup:L,where:w,minZoom:$.minZoom,maxZoom:$.maxZoom,outlinePaint:h}))}catch{}return r.sort((s,i)=>s.title.localeCompare(i.title)),r}const ft={},lt="376af635c84643cd816a8c5d017a53aa",$o=lt;function We(t,l){let r=`https://www.arcgis.com/sharing/rest/content/items/${t}/data?f=json`;return l&&(r+=`&token=${l}`),r}function Vo(){return We(lt)}const Ae=new Map,Ne=new Map;function gt(t){t?(Ae.delete(t),Ne.delete(t)):(Ae.clear(),Ne.clear())}let Oe,pt=0;async function No(){const t=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:Ce&&Ce.tagName.toUpperCase()==="SCRIPT"&&Ce.src||new URL("index.js",document.baseURI).href}<"u"&&ft?.VITE_AGO_USERNAME,l=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:Ce&&Ce.tagName.toUpperCase()==="SCRIPT"&&Ce.src||new URL("index.js",document.baseURI).href}<"u"&&ft?.VITE_AGO_PASSWORD;if(!(!t||!l)){if(Oe&&Date.now()<pt-3e5)return Oe;try{const n=await(await fetch("https://www.arcgis.com/sharing/rest/generateToken",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({f:"json",username:t,password:l,referer:window.location.origin||"https://localhost",expiration:"120"})})).json();return n.error?void 0:(Oe=n.token,pt=n.expires,Oe)}catch{return}}}async function Mo(t,l){const r=We(t,l),n=await fetch(r,{cache:"no-store"});if(!n.ok)throw new Error(`Failed to fetch WebMap: ${n.status} ${n.statusText}`);const s=await n.json();if(s.error)throw new Error(`ArcGIS error: ${s.error.message||s.error.code||"Unknown error"}`);return s}async function To(t){try{const l=await No(),r=await Mo(t,l);return await nt(r)}catch(l){throw new Error(`Failed to load dynamic layer configs: ${l instanceof Error?l.message:"Unknown error"}`)}}async function Ue(t=lt){const l=Ae.get(t);if(l)return l;const r=Ne.get(t);if(r)return r;const n=(async()=>{try{const s=await To(t);return Ae.set(t,s),s}finally{Ne.delete(t)}})();return Ne.set(t,n),n}function vt(t){const l=e.ref({}),r=new Map;for(const a of t)l.value[a.id]={data:null,loading:!1,error:null,lastFetched:null};async function n(a){const h=a.id;l.value={...l.value,[h]:{data:l.value[h]?.data??null,lastFetched:l.value[h]?.lastFetched??null,loading:!0,error:null}};try{let f;if(a.type==="http-get"){const L=await fetch(a.url,{method:"GET",...a.options});if(!L.ok)throw new Error(`HTTP ${L.status}: ${L.statusText}`);f=await L.json()}else if(a.type==="http-post"){const L=await fetch(a.url,{method:"POST",...a.options});if(!L.ok)throw new Error(`HTTP ${L.status}: ${L.statusText}`);f=await L.json()}else if(a.type==="esri"){const w=`${a.url.replace(/\/$/,"")}/query?where=1%3D1&outFields=*&returnGeometry=false&f=json`,$=await fetch(w,a.options);if(!$.ok)throw new Error(`HTTP ${$.status}: ${$.statusText}`);f=(await $.json()).features?.map(F=>F.attributes)||[]}else throw new Error(`Unknown data source type: ${a.type}`);a.transform&&(f=a.transform(f)),l.value={...l.value,[h]:{data:f,loading:!1,error:null,lastFetched:Date.now()}}}catch(f){const L=f instanceof Error?f.message:"Unknown error";l.value={...l.value,[h]:{data:l.value[h]?.data??null,lastFetched:l.value[h]?.lastFetched??null,loading:!1,error:L}}}}async function s(){await Promise.all(t.map(a=>n(a)))}async function i(a){const h=t.find(f=>f.id===a);h&&await n(h)}function u(a){return l.value[a]?.data??null}const b=e.computed(()=>Object.values(l.value).some(a=>a.loading));function p(a){return l.value[a]?.loading??!1}function k(a){return l.value[a]?.error??null}function m(){for(const a of t)if(a.pollInterval&&a.pollInterval>0){const h=window.setInterval(()=>{n(a)},a.pollInterval);r.set(a.id,h)}}function y(){for(const[,a]of r)window.clearInterval(a);r.clear()}return e.onMounted(()=>{s(),m()}),e.onUnmounted(()=>{y()}),{state:e.readonly(l),isLoading:b,fetchAll:s,refetch:i,getData:u,isSourceLoading:p,getError:k,stopPolling:y}}const Po={class:"layerboard-layout"},Fo=["aria-expanded"],Io={key:0,class:"layerboard-subtitle"},zo={class:"layerboard-mobile-menu-content"},Do={class:"layerboard-main"},Oo={key:0,class:"layerboard-loading",role:"status","aria-live":"polite"},Ro={key:1,class:"layerboard-error",role:"alert"},_o=["aria-expanded","aria-label"],Ao={key:0},Uo={key:1},Zo={class:"sr-only","aria-live":"polite"},Wo=e.defineComponent({__name:"Layerboard",props:{title:{},subtitle:{default:void 0},webMapId:{},themeColor:{default:"#0f4d90"},cyclomediaConfig:{default:void 0},pictometryCredentials:{default:void 0},showDefaultSidebar:{type:Boolean,default:!0},sidebarWidth:{default:"30%"},sidebarLabel:{default:"Layers"},mapLabel:{default:"Map"},fetchMetadata:{type:Boolean,default:!1},tiledLayers:{default:()=>[]},dataSources:{default:()=>[]},layerStyleOverrides:{default:()=>({})},popupOverrides:{default:()=>({})},basemapControlPosition:{default:"top-right"},navigationControlPosition:{default:"bottom-right"},geolocationControlPosition:{default:"bottom-right"},searchControlPosition:{default:"top-left"},drawControlPosition:{default:"bottom-left"},cyclomediaButtonPosition:{default:"top-right"},pictometryButtonPosition:{default:"top-right"},initialZoom:{default:void 0},initialCenter:{default:void 0}},emits:["configs-loaded","load-error","zoom"],setup(t,{expose:l,emit:r}){const n=t,s=r,i=e.ref([]),u=e.ref(!0),b=e.ref(null),p=e.ref(12),k=e.ref(""),m=e.ref(new Set),y=e.ref({}),a=e.ref(new Set),h=e.ref({}),f=e.ref({}),L=e.ref(new Set),w=e.ref({});function $(){const g={};for(const C of n.tiledLayers)g[C.id]=C.opacity??1;w.value=g}function B(g){L.value.has(g)?L.value.delete(g):L.value.add(g),L.value=new Set(L.value)}function F(g,C){C?L.value.add(g):L.value.delete(g),L.value=new Set(L.value)}function x(g,C){w.value={...w.value,[g]:C}}const V=n.dataSources.length>0?vt(n.dataSources):null,M=e.computed(()=>V?.state.value??{}),Z=e.computed(()=>V?.isLoading.value??!1);function z(g){return V?.getData(g)??null}function ee(g){return V?.refetch(g)??Promise.resolve()}e.provide("layerboard-layers",e.readonly(i)),e.provide("layerboard-visible",m),e.provide("layerboard-opacities",y),e.provide("layerboard-loading",e.readonly(a)),e.provide("layerboard-errors",e.readonly(h)),e.provide("layerboard-zoom",e.readonly(p)),e.provide("layerboard-toggle-layer",ge),e.provide("layerboard-set-layer-visible",Ee),e.provide("layerboard-set-layers-visible",de),e.provide("layerboard-set-opacity",pe),e.provide("layerboard-tiled-layers",e.readonly(e.computed(()=>n.tiledLayers))),e.provide("layerboard-visible-tiled",L),e.provide("layerboard-tiled-opacities",w),e.provide("layerboard-toggle-tiled",B),e.provide("layerboard-set-tiled-opacity",x),e.provide("layerboard-set-tiled-visible",F),e.provide("layerboard-data-sources-state",M),e.provide("layerboard-data-sources-loading",Z),e.provide("layerboard-get-data-source",z),e.provide("layerboard-refetch-data-source",ee);const le=e.computed(()=>({backgroundColor:n.themeColor})),je=e.computed(()=>({backgroundColor:n.themeColor})),Be=e.computed(()=>({backgroundColor:n.themeColor})),Te=e.computed(()=>({width:te.value?"0":n.sidebarWidth}));async function xe(){try{u.value=!0,b.value=null;const C=(await Ue(n.webMapId)).map(I=>{let _=I;const se=n.layerStyleOverrides[I.id];se&&(_={..._,paint:se.paint??_.paint,outlinePaint:se.outlinePaint??_.outlinePaint,legend:se.legend??_.legend,type:se.type??_.type});const Se=n.popupOverrides[I.id]||(I.parentId?n.popupOverrides[I.parentId]:void 0);return Se&&_.popup&&(_={..._,popup:{..._.popup,...Se}}),_});i.value=C.map(I=>({config:I,component:I.type}));const R={};C.forEach(I=>{R[I.id]=I.opacity??1}),y.value=R,s("configs-loaded",C)}catch(g){const C=g instanceof Error?g.message:"Failed to load layer configurations";b.value=C,s("load-error",C)}finally{u.value=!1}}async function Pe(){if(n.fetchMetadata)try{const g="https://phl.carto.com/api/v2/sql?q="+encodeURIComponent("select url_text, COALESCE(representation, '') as representation from phl.knack_metadata_reps_endpoints_join WHERE ( format = 'API' OR format = 'GeoService' ) AND url_text IS NOT null"),C=await fetch(g);if(!C.ok)return;const R=await C.json(),I={};for(const _ of R.rows||[])if(_.url_text&&_.representation){const se=Ye(_.url_text),Se=`https://metadata.phila.gov/#home/representationdetails/${_.representation}/`;I[se]=Se}f.value=I}catch{}}function qe(g){p.value=g,s("zoom",g)}function ge(g){m.value.has(g)?m.value.delete(g):m.value.add(g),m.value=new Set(m.value)}function Ee(g,C){C?m.value.add(g):m.value.delete(g),m.value=new Set(m.value)}function de(g,C){for(const R of g)C?m.value.add(R):m.value.delete(R);m.value=new Set(m.value)}function pe(g,C){y.value={...y.value,[g]:C}}function $e(g,C){C?a.value.add(g):a.value.delete(g),a.value=new Set(a.value)}function Ge(g,C){if(C)h.value={...h.value,[g]:C};else{const R={...h.value};delete R[g],h.value=R}}function Q(g){k.value=g}const me=e.ref(null),q=e.ref(null),ve=e.ref(null),Fe=e.ref(null),ae=e.ref(null),Ve=e.ref(null),Ie=e.ref(null),ie=e.ref("sidebar");function He(){ie.value=ie.value==="sidebar"?"map":"sidebar",e.nextTick(()=>{ie.value==="sidebar"&&me.value?.focus()})}const G=e.ref(!1);function ye(){G.value=!G.value,G.value&&e.nextTick(()=>{Fe.value?.focus()})}function he(){G.value=!1,e.nextTick(()=>{q.value?.focus()})}const te=e.ref(!1);function ze(){te.value=!te.value}const H=e.ref(!1),be=e.ref(null);function Le(){be.value=document.activeElement,H.value=!0,e.nextTick(()=>{Ie.value?.focus()})}function J(){H.value=!1,e.nextTick(()=>{be.value?.focus(),be.value=null})}function ke(g){g.target.classList.contains("layerboard-modal-backdrop")&&J()}function we(g){if(g.key==="Escape"){he();return}if(g.key==="Tab"&&ae.value){const C=Array.from(ae.value.querySelectorAll('a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(C.length===0)return;const R=C[0],I=C[C.length-1];g.shiftKey?document.activeElement===R&&(g.preventDefault(),I.focus()):document.activeElement===I&&(g.preventDefault(),R.focus())}}function Je(g){if(g.key==="Escape"){J();return}if(g.key==="Tab"&&Ve.value){const C=Array.from(Ve.value.querySelectorAll('a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(C.length===0)return;const R=C[0],I=C[C.length-1];g.shiftKey?document.activeElement===R&&(g.preventDefault(),I.focus()):document.activeElement===I&&(g.preventDefault(),R.focus())}}e.provide("layerboard-open-modal",Le),e.provide("layerboard-close-modal",J),e.provide("layerboard-is-modal-open",e.readonly(H)),l({layerList:i,visibleLayers:m,layerOpacities:y,loadingLayers:a,layerErrors:h,currentZoom:p,toggleLayer:ge,setLayerVisible:Ee,setLayersVisible:de,setLayerOpacity:pe,reloadConfigs:xe,clearCache:()=>gt(n.webMapId),visibleTiledLayers:L,tiledLayerOpacities:w,toggleTiledLayer:B,setTiledLayerVisible:F,setTiledLayerOpacity:x,dataSourcesState:M,dataSourcesLoading:Z,getDataSourceData:z,refetchDataSource:ee,isModalOpen:H,openModal:Le,closeModal:J});function De(g){g.key==="Escape"&&G.value&&he()}return e.onMounted(()=>{xe(),Pe(),$(),document.addEventListener("keydown",De)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",De)}),(g,C)=>(e.openBlock(),e.createElementBlock("div",Po,[C[5]||(C[5]=e.createElementVNode("a",{href:"#main-content",class:"skip-to-main-content-link"},"Skip to main content",-1)),e.createElementVNode("header",{class:"layerboard-header",style:e.normalizeStyle(le.value)},[C[1]||(C[1]=e.createElementVNode("a",{href:"https://www.phila.gov/",class:"layerboard-logo layerboard-desktop-only"},[e.createElementVNode("img",{src:"https://standards.phila.gov/img/logo/city-of-philadelphia-yellow-white.png",alt:"City of Philadelphia"})],-1)),C[2]||(C[2]=e.createElementVNode("span",{class:"layerboard-header-divider layerboard-desktop-only","aria-hidden":"true"},null,-1)),e.createElementVNode("button",{ref_key:"hamburgerRef",ref:q,class:"layerboard-hamburger layerboard-mobile-only","aria-expanded":G.value,"aria-label":"Toggle menu",onClick:ye},[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(Zt),size:"medium",inline:"",decorative:""},null,8,["icon-definition"])],8,Fo),e.renderSlot(g.$slots,"header",{},()=>[e.createElementVNode("h1",null,e.toDisplayString(t.title),1),t.subtitle?(e.openBlock(),e.createElementBlock("span",Io,e.toDisplayString(t.subtitle),1)):e.createCommentVNode("",!0)],!0),G.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"mobileMenuRef",ref:ae,class:"layerboard-mobile-menu",role:"dialog","aria-modal":"true","aria-label":"Site menu",style:e.normalizeStyle({backgroundColor:t.themeColor}),onKeydown:we},[e.createElementVNode("div",zo,[e.renderSlot(g.$slots,"footer",{openModal:Le,closeModal:J,isModalOpen:H.value},()=>[C[0]||(C[0]=e.createTextVNode(" City of Philadelphia ",-1))],!0)]),e.createElementVNode("button",{ref_key:"mobileMenuCloseRef",ref:Fe,class:"layerboard-mobile-menu-close","aria-label":"Close menu",onClick:he},[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(ct),size:"medium",decorative:""},null,8,["icon-definition"])],512)],36)):e.createCommentVNode("",!0),G.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"layerboard-mobile-menu-backdrop",onClick:he})):e.createCommentVNode("",!0)],4),e.createElementVNode("div",Do,[u.value?(e.openBlock(),e.createElementBlock("div",Oo,[e.createElementVNode("div",{class:"layerboard-spinner",style:e.normalizeStyle({borderTopColor:t.themeColor})},null,4),e.createElementVNode("p",null,"Loading "+e.toDisplayString(t.title)+"...",1)])):b.value?(e.openBlock(),e.createElementBlock("div",Ro,[C[3]||(C[3]=e.createElementVNode("h2",null,"Error Loading Layers",-1)),e.createElementVNode("p",null,e.toDisplayString(b.value),1),e.createElementVNode("button",{class:"layerboard-retry-button",style:e.normalizeStyle({backgroundColor:t.themeColor}),onClick:xe}," Retry ",4)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("aside",{id:"main-content",ref_key:"sidebarRef",ref:me,class:e.normalizeClass(["layerboard-sidebar",{"is-active":ie.value==="sidebar"}]),style:e.normalizeStyle(Te.value),"aria-label":"Map layers",tabindex:"-1"},[e.renderSlot(g.$slots,"sidebar",{layers:i.value,visibleLayers:m.value,layerOpacities:y.value,loadingLayers:a.value,layerErrors:h.value,currentZoom:p.value,toggleLayer:ge,setLayerVisible:Ee,setLayersVisible:de,setOpacity:pe,tiledLayers:t.tiledLayers,visibleTiledLayers:L.value,tiledLayerOpacities:w.value,toggleTiledLayer:B,setTiledLayerVisible:F,setTiledLayerOpacity:x,dataSourcesState:M.value,dataSourcesLoading:Z.value,getDataSource:z,refetchDataSource:ee},()=>[t.showDefaultSidebar?(e.openBlock(),e.createBlock(yt,{key:0,"layer-list":i.value,"visible-layers":m.value,"layer-opacities":y.value,"loading-layers":a.value,"layer-errors":h.value,"current-zoom":p.value,"search-query":k.value,"layer-metadata":f.value,onToggleLayer:ge,onSetOpacity:pe,onUpdateSearch:Q},null,8,["layer-list","visible-layers","layer-opacities","loading-layers","layer-errors","current-zoom","search-query","layer-metadata"])):e.createCommentVNode("",!0)],!0)],6),e.createElementVNode("div",{role:"main","aria-label":"Map",class:e.normalizeClass(["layerboard-map",{"is-active":ie.value==="map"}])},[e.createVNode(mt,{"visible-layers":m.value,"layer-opacities":y.value,"layer-list":i.value,"tiled-layers":t.tiledLayers,"visible-tiled-layers":L.value,"tiled-layer-opacities":w.value,"cyclomedia-config":t.cyclomediaConfig,"pictometry-credentials":t.pictometryCredentials,"basemap-control-position":t.basemapControlPosition,"navigation-control-position":t.navigationControlPosition,"geolocation-control-position":t.geolocationControlPosition,"search-control-position":t.searchControlPosition,"draw-control-position":t.drawControlPosition,"cyclomedia-button-position":t.cyclomediaButtonPosition,"pictometry-button-position":t.pictometryButtonPosition,"initial-zoom":t.initialZoom,"initial-center":t.initialCenter,onZoom:qe,onLayerLoading:$e,onLayerError:Ge},null,8,["visible-layers","layer-opacities","layer-list","tiled-layers","visible-tiled-layers","tiled-layer-opacities","cyclomedia-config","pictometry-credentials","basemap-control-position","navigation-control-position","geolocation-control-position","search-control-position","draw-control-position","cyclomedia-button-position","pictometry-button-position","initial-zoom","initial-center"])],2),e.createElementVNode("button",{class:e.normalizeClass(["layerboard-sidebar-toggle",{"is-collapsed":te.value}]),style:e.normalizeStyle({left:te.value?"0":n.sidebarWidth}),"aria-expanded":!te.value,"aria-label":te.value?"Expand sidebar":"Collapse sidebar",onClick:ze},[e.createVNode(e.unref(j.Icon),{"icon-definition":te.value?e.unref(At):e.unref(Ut),size:"medium",decorative:""},null,8,["icon-definition"])],14,_o)],64))]),e.createElementVNode("button",{ref_key:"mobileToggleRef",ref:ve,class:"layerboard-mobile-toggle",style:e.normalizeStyle(Be.value),onClick:He},[ie.value==="map"?(e.openBlock(),e.createElementBlock("span",Ao,e.toDisplayString(t.sidebarLabel),1)):(e.openBlock(),e.createElementBlock("span",Uo,e.toDisplayString(t.mapLabel),1))],4),e.createElementVNode("footer",{class:"layerboard-footer",style:e.normalizeStyle(je.value)},[e.renderSlot(g.$slots,"footer",{openModal:Le,closeModal:J,isModalOpen:H.value},()=>[C[4]||(C[4]=e.createTextVNode(" City of Philadelphia ",-1))],!0)],4),H.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"layerboard-modal-backdrop",onClick:ke,onKeydown:Je},[e.createElementVNode("div",{ref_key:"modalRef",ref:Ve,class:"layerboard-modal",role:"dialog","aria-modal":"true","aria-label":"Application information"},[e.createElementVNode("button",{ref_key:"modalCloseRef",ref:Ie,class:"layerboard-modal-close","aria-label":"Close modal",onClick:J},[e.createVNode(e.unref(j.Icon),{"icon-definition":e.unref(ct),size:"medium",decorative:""},null,8,["icon-definition"])],512),e.renderSlot(g.$slots,"modal",{closeModal:J},void 0,!0)],512)],32)):e.createCommentVNode("",!0),e.createElementVNode("span",Zo,e.toDisplayString(ie.value==="sidebar"?"Showing layers panel":"Showing map"),1)]))}}),jo=ue(Wo,[["__scopeId","data-v-1c88d9ba"]]),qo=["aria-expanded"],Go={key:0,class:"topic-icon"},Ho={class:"topic-title"},Jo=e.defineComponent({__name:"TopicAccordion",props:{title:{},icon:{default:void 0},expanded:{type:Boolean,default:!1},layerIds:{default:()=>[]},headerClass:{default:void 0}},emits:["toggle","layerChange"],setup(t,{emit:l}){const r=t,n=l,s=e.ref(r.expanded),i=`topic-panel-${e.useId()}`,u=`topic-header-${e.useId()}`;e.watch(()=>r.expanded,p=>{s.value=p});function b(){s.value=!s.value,n("toggle",s.value)}return(p,k)=>{const m=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["topic-accordion",{"is-expanded":s.value}])},[e.createElementVNode("button",{id:u,class:e.normalizeClass(["topic-header",t.headerClass]),type:"button","aria-expanded":s.value,"aria-controls":i,onClick:b},[t.icon||p.$slots.icon?(e.openBlock(),e.createElementBlock("span",Go,[e.renderSlot(p.$slots,"icon",{},()=>[t.icon?(e.openBlock(),e.createBlock(m,{key:0,icon:["fas",t.icon],"aria-hidden":"true"},null,8,["icon"])):e.createCommentVNode("",!0)],!0)])):e.createCommentVNode("",!0),e.createElementVNode("span",Ho,e.toDisplayString(t.title),1),e.createElementVNode("span",{class:e.normalizeClass(["topic-chevron",{"is-rotated":s.value}])},[...k[0]||(k[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])],2)],10,qo),e.withDirectives(e.createElementVNode("div",{id:i,role:"region","aria-labelledby":u,class:"topic-content"},[e.renderSlot(p.$slots,"default",{},()=>[k[1]||(k[1]=e.createElementVNode("p",{class:"topic-empty"},"No content provided for this topic.",-1))],!0)],512),[[e.vShow,s.value]])],2)}}}),Ko=ue(Jo,[["__scopeId","data-v-a2023afa"]]);function bt(t){return t.displayOptions?.shouldShowCheckbox!==!1}function at(t,l){return l?t.displayOptions?.shouldShowSlider!==!1:!1}function rt(t,l){return l?t.displayOptions?.shouldShowLegendBox!==!1:!1}function fe(t){return t.displayOptions?.layerNameChange||t.title}const Qo=["aria-label"],Xo=["checked","disabled","onChange"],Yo={class:"layer-title"},en={class:"layer-title"},tn={key:0,class:"empty-state"},on=e.defineComponent({__name:"LayerCheckboxSet",props:{layers:{},visibleLayerIds:{},layerOpacities:{default:()=>({})},loadingLayerIds:{default:()=>new Set},layerErrors:{default:()=>({})},currentZoom:{default:12},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},groupLabel:{default:void 0}},emits:["toggleLayer","setOpacity"],setup(t,{emit:l}){const r=t,n=l,{isVisible:s,getLayerOpacity:i,isLayerLoading:u,getLayerError:b,isLayerAvailableAtZoom:p}=ot(()=>r);function k(m){n("toggleLayer",m)}return(m,y)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"layer-checkbox-set",role:"group","aria-label":t.groupLabel},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,a=>(e.openBlock(),e.createElementBlock("div",{key:a.id,class:"layer-item"},[e.unref(bt)(a)?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!e.unref(p)(a),"layer-error":e.unref(b)(a.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:e.unref(s)(a.id),disabled:!e.unref(p)(a),onChange:h=>k(a.id)},null,40,Xo),e.createElementVNode("span",Yo,[e.createTextVNode(e.toDisplayString(e.unref(fe)(a))+" ",1),e.createVNode(_e,{loading:e.unref(u)(a.id),error:e.unref(b)(a.id),unavailable:!e.unref(p)(a)},null,8,["loading","error","unavailable"])])],2)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["layer-label-only",{"layer-unavailable":!e.unref(p)(a),"layer-error":e.unref(b)(a.id)}])},[e.createElementVNode("span",en,[e.createTextVNode(e.toDisplayString(e.unref(fe)(a))+" ",1),e.createVNode(_e,{loading:e.unref(u)(a.id),error:e.unref(b)(a.id),unavailable:!e.unref(p)(a)},null,8,["loading","error","unavailable"])])],2)),e.unref(at)(a,t.showOpacity)&&e.unref(s)(a.id)&&e.unref(p)(a)?(e.openBlock(),e.createBlock(et,{key:2,"layer-id":a.id,"layer-name":e.unref(fe)(a),opacity:e.unref(i)(a.id),"onUpdate:opacity":h=>n("setOpacity",a.id,h)},null,8,["layer-id","layer-name","opacity","onUpdate:opacity"])):e.createCommentVNode("",!0),e.unref(rt)(a,t.showLegend)&&e.unref(s)(a.id)&&e.unref(p)(a)&&a.legend?.length?(e.openBlock(),e.createBlock(tt,{key:3,items:a.legend,label:"Legend for "+e.unref(fe)(a)},null,8,["items","label"])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",tn,"No layers available")):e.createCommentVNode("",!0)],8,Qo))}}),nn=ue(on,[["__scopeId","data-v-bfcd7855"]]),ln=["aria-label"],an=["name","checked","disabled","onChange"],rn={class:"layer-title"},sn={key:0,class:"empty-state"},cn=e.defineComponent({__name:"LayerRadioButtonSet",props:{layers:{},visibleLayerIds:{},layerOpacities:{default:()=>({})},loadingLayerIds:{default:()=>new Set},layerErrors:{default:()=>({})},currentZoom:{default:12},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},groupName:{default:"layer-radio-group"},groupLabel:{default:void 0}},emits:["selectLayer","setOpacity"],setup(t,{emit:l}){const r=t,n=l,{isVisible:s,getLayerOpacity:i,isLayerLoading:u,getLayerError:b,isLayerAvailableAtZoom:p}=ot(()=>r);function k(m){const y=r.layers.filter(a=>r.visibleLayerIds.has(a.id)&&a.id!==m).map(a=>a.id);n("selectLayer",m,y)}return(m,y)=>(e.openBlock(),e.createElementBlock("div",{class:"layer-radio-set",role:"radiogroup","aria-label":t.groupLabel},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,a=>(e.openBlock(),e.createElementBlock("div",{key:a.id,class:"layer-item"},[e.createElementVNode("label",{class:e.normalizeClass(["layer-radio",{"layer-unavailable":!e.unref(p)(a),"layer-error":e.unref(b)(a.id)}])},[e.createElementVNode("input",{type:"radio",name:t.groupName,checked:e.unref(s)(a.id),disabled:!e.unref(p)(a),onChange:h=>k(a.id)},null,40,an),e.createElementVNode("span",rn,[e.createTextVNode(e.toDisplayString(e.unref(fe)(a))+" ",1),e.createVNode(_e,{loading:e.unref(u)(a.id),error:e.unref(b)(a.id),unavailable:!e.unref(p)(a)},null,8,["loading","error","unavailable"])])],2),e.unref(at)(a,t.showOpacity)&&e.unref(s)(a.id)&&e.unref(p)(a)?(e.openBlock(),e.createBlock(et,{key:0,"layer-id":a.id,"layer-name":e.unref(fe)(a),opacity:e.unref(i)(a.id),"onUpdate:opacity":h=>n("setOpacity",a.id,h)},null,8,["layer-id","layer-name","opacity","onUpdate:opacity"])):e.createCommentVNode("",!0),e.unref(rt)(a,t.showLegend)&&e.unref(s)(a.id)&&e.unref(p)(a)&&a.legend?.length?(e.openBlock(),e.createBlock(tt,{key:1,items:a.legend,label:"Legend for "+e.unref(fe)(a)},null,8,["items","label"])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",sn,"No layers available")):e.createCommentVNode("",!0)],8,ln))}}),un=ue(cn,[["__scopeId","data-v-c368d815"]]);function dn(t){const l=e.ref([]),r=e.ref(new Set),n=e.ref({}),s=e.ref(new Set),i=e.ref({}),u=e.ref(""),b=e.ref(!1),p=e.ref(!1),k=e.ref(null),m=e.computed(()=>{if(!u.value.trim())return l.value;const x=u.value.toLowerCase();return l.value.filter(V=>V.title.toLowerCase().includes(x))}),y=e.computed(()=>l.value.map(x=>({config:x,component:x.type})));async function a(){if(!p.value){b.value=!0,k.value=null;try{let x;t.mode==="dynamic"||!t.mode?t.webMapId?x=await h(t.webMapId):x=await Ue():x=await Ue(),l.value=x;const V={};x.forEach(M=>{V[M.id]=M.opacity??1}),n.value=V,p.value=!0}catch(x){k.value=x instanceof Error?x:new Error("Failed to initialize layerboard")}finally{b.value=!1}}}async function h(x){const V=We(x),M=await fetch(V,{cache:"no-store"});if(!M.ok)throw new Error(`Failed to fetch WebMap: ${M.status} ${M.statusText}`);const Z=await M.json();return nt(Z)}function f(x){const V=new Set(r.value);V.has(x)?V.delete(x):V.add(x),r.value=V}function L(x,V){n.value={...n.value,[x]:Math.max(0,Math.min(1,V))}}function w(x){u.value=x}function $(x,V){const M=new Set(s.value);V?M.add(x):M.delete(x),s.value=M}function B(x,V){if(V)i.value={...i.value,[x]:V};else{const M={...i.value};delete M[x],i.value=M}}function F(){l.value=[],r.value=new Set,n.value={},s.value=new Set,i.value={},u.value="",b.value=!1,p.value=!1,k.value=null}return{layerConfigs:e.readonly(l),visibleLayers:e.readonly(r),layerOpacities:e.readonly(n),loadingLayers:e.readonly(s),layerErrors:e.readonly(i),searchQuery:e.readonly(u),isLoading:e.readonly(b),isInitialized:e.readonly(p),error:e.readonly(k),filteredLayerConfigs:m,layerList:y,config:t,initialize:a,toggleLayer:f,setLayerOpacity:L,filterLayers:w,setLayerLoading:$,setLayerError:B,reset:F}}function fn(){const t=e.ref([]),l=e.ref(new Set),r=e.ref(new Set);function n(i){l.value.has(i)?l.value.delete(i):l.value.add(i)}function s(i){t.value=i}return{layers:e.computed(()=>t.value),visibleLayerIds:e.computed(()=>l.value),loadingLayerIds:e.computed(()=>r.value),toggleLayer:n,setLayers:s}}function Lt(t){const l=e.ref(null),r=e.ref(!1),n=e.ref(null),s=e.ref(0);async function i(p={}){r.value=!0,n.value=null;const k=t.pageSize||2e3;let m=0,y=[],a=!0;try{for(;a;){const f=t.url.replace(/\/$/,""),L=encodeURIComponent(p.where||t.where||"1=1");let w=`${f}/query?where=${L}&outFields=*&returnGeometry=true&resultRecordCount=${k}&resultOffset=${m}&f=geojson`;if(p.bounds){const F=JSON.stringify({xmin:p.bounds.west,ymin:p.bounds.south,xmax:p.bounds.east,ymax:p.bounds.north,spatialReference:{wkid:4326}});w+=`&geometry=${encodeURIComponent(F)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects`}const $=await fetch(w);if(!$.ok)throw new Error(`HTTP ${$.status}: ${$.statusText}`);const B=await $.json();B.features&&B.features.length>0?(y=y.concat(B.features),m+=B.features.length,a=B.features.length===k):a=!1}const h={type:"FeatureCollection",features:y};return l.value=h,s.value=y.length,h}catch(h){const f=h instanceof Error?h:new Error("Failed to fetch features");throw n.value=f,f}finally{r.value=!1}}function u(){l.value=null,s.value=0,n.value=null}async function b(p={}){return i(p)}return{data:e.readonly(l),isLoading:e.readonly(r),error:e.readonly(n),totalFeatures:e.readonly(s),config:t,fetch:i,refetch:b,clear:u}}function pn(t,l,r){const n=Lt(t);return e.watch(l,async s=>{if(s){const i=r(s);await n.fetch(i)}},{immediate:!0}),n}exports.LayerCheckboxSet=nn;exports.LayerPanel=yt;exports.LayerRadioButtonSet=un;exports.Layerboard=jo;exports.MapPanel=mt;exports.TopicAccordion=Ko;exports.WEBMAP_ID=$o;exports.buildWebMapUrl=We;exports.clearCache=gt;exports.getLayerConfigs=Ue;exports.getLayerDisplayName=fe;exports.getWebMapUrl=Vo;exports.normalizeUrl=Ye;exports.shouldShowCheckbox=bt;exports.shouldShowLegendBox=rt;exports.shouldShowSlider=at;exports.transformWebMapToLayerConfigs=nt;exports.useApiDataSources=vt;exports.useDataSource=Lt;exports.useLayerConfig=fn;exports.useLayerboard=dn;exports.useReactiveDataSource=pn;