@phila/layerboard 3.0.0-beta.11 → 3.0.0-beta.12

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.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),H=require("@phila/phila-ui-map-core"),Z=require("@phila/phila-ui-core");var me=typeof document<"u"?document.currentScript:null;function ze(t,a,o={}){const n={type:"Feature"};return(o.id===0||o.id)&&(n.id=o.id),o.bbox&&(n.bbox=o.bbox),n.properties=a||{},n.geometry=t,n}function rt(t,a,o={}){for(const r of t){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let i=0;i<r[r.length-1].length;i++)if(r[r.length-1][i]!==r[0][i])throw new Error("First and last Position are not equivalent.")}return ze({type:"Polygon",coordinates:t},a,o)}function it(t,a,o={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return ze({type:"LineString",coordinates:t},a,o)}function st(t,a,o={}){return ze({type:"MultiLineString",coordinates:t},a,o)}function ct(t,a,o={}){return ze({type:"MultiPolygon",coordinates:t},a,o)}function ut(t){return t.type==="Feature"?t.geometry:t}function dt(t,a,o){var n=t.length,r=ye(t[0],a),i=[],d,v,m;let S,h;for(o||(o=[]),d=1;d<n;d++){for(S=t[d-1],h=t[d],v=m=ye(h,a);;)if(r|v){if(r&v)break;r?(S=je(S,h,r,a),r=ye(S,a)):(h=je(S,h,v,a),v=ye(h,a))}else{i.push(S),v!==m?(i.push(h),d<n-1&&(o.push(i),i=[])):d===n-1&&i.push(h);break}r=m}return i.length&&o.push(i),o}function ft(t,a){var o,n,r,i,d,v,m;for(n=1;n<=8;n*=2){for(o=[],r=t[t.length-1],i=!(ye(r,a)&n),d=0;d<t.length;d++)v=t[d],m=!(ye(v,a)&n),m!==i&&o.push(je(r,v,n,a)),m&&o.push(v),r=v,i=m;if(t=o,!t.length)break}return o}function je(t,a,o,n){return o&8?[t[0]+(a[0]-t[0])*(n[3]-t[1])/(a[1]-t[1]),n[3]]:o&4?[t[0]+(a[0]-t[0])*(n[1]-t[1])/(a[1]-t[1]),n[1]]:o&2?[n[2],t[1]+(a[1]-t[1])*(n[2]-t[0])/(a[0]-t[0])]:o&1?[n[0],t[1]+(a[1]-t[1])*(n[0]-t[0])/(a[0]-t[0])]:null}function ye(t,a){var o=0;return t[0]<a[0]?o|=1:t[0]>a[2]&&(o|=2),t[1]<a[1]?o|=4:t[1]>a[3]&&(o|=8),o}function pt(t,a){const o=ut(t),n=o.type,r=t.type==="Feature"?t.properties:{};let i=o.coordinates;switch(n){case"LineString":case"MultiLineString":{const d=[];return n==="LineString"&&(i=[i]),i.forEach(v=>{dt(v,a,d)}),d.length===1?it(d[0],r):st(d,r)}case"Polygon":return rt(Ke(i,a),r);case"MultiPolygon":return ct(i.map(d=>Ke(d,a)),r);default:throw new Error("geometry "+n+" not supported")}}function Ke(t,a){const o=[];for(const n of t){const r=ft(n,a);r.length>0&&((r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1])&&r.push(r[0]),r.length>=4&&o.push(r))}return o}var mt=pt;const yt={class:"map-panel"},gt=e.defineComponent({__name:"MapPanel",props:{visibleLayers:{},layerOpacities:{},layerList:{},tiledLayers:{},visibleTiledLayers:{},tiledLayerOpacities:{},cyclomediaConfig:{},pictometryCredentials:{},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:{},initialCenter:{}},emits:["zoom","layerLoading","layerError"],setup(t,{emit:a}){const o=t,n=a,r=e.ref(null),i=e.ref(null),d=e.ref(0);function v(l){n("zoom",l),i.value&&(d.value=m(i.value))}function m(l){const p=l.getZoom(),B=l.getCenter().lat,E=559082264028e-3,x=B*Math.PI/180;return E*Math.cos(x)/Math.pow(2,p)}const S=e.ref({}),h=e.ref(null),w=e.ref(new Set),s=["fema-100-year-floodplain","fema-500-year-floodplain"];async function g(l,p,c,B){const E=encodeURIComponent(B||"1=1"),x=JSON.stringify({xmin:p.west,ymin:p.south,xmax:p.east,ymax:p.north,spatialReference:{wkid:4326}}),$=2e3;let M=0,F=[],U=!0;for(;U;){const O=`${l}/query?where=${E}&geometry=${encodeURIComponent(x)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&resultRecordCount=${$}&resultOffset=${M}&f=geojson`,_=await fetch(O);if(!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);const R=await _.json();R.features&&R.features.length>0?(F=F.concat(R.features),M+=R.features.length,U=R.features.length===$):U=!1}if(s.includes(c)){const O=[p.west,p.south,p.east,p.north];F=F.map(_=>{if(_.geometry&&(_.geometry.type==="Polygon"||_.geometry.type==="MultiPolygon"))try{return mt(_,O)}catch{return _}return _})}return{type:"FeatureCollection",features:F}}async function b(l,p){const c=p.map(async B=>{const E=o.layerList.find(x=>x.config.id===B)?.config;if(E){n("layerLoading",B,!0);try{const x=await g(E.url,l,B,E.where);S.value={...S.value,[B]:x},n("layerError",B,null)}catch(x){const $=x instanceof Error?x.message:"Failed to load";n("layerError",B,$)}finally{n("layerLoading",B,!1)}}});await Promise.all(c)}async function y(l){const p=[...o.visibleLayers];await b(l,p)}function f(l){h.value=l.bounds,y(l.bounds)}function u(l){i.value=l;const p=l.getBounds();h.value={west:p.getWest(),south:p.getSouth(),east:p.getEast(),north:p.getNorth()};const c=l.getZoom();n("zoom",c),d.value=m(l),y(h.value)}e.watch(()=>o.visibleLayers.size,async()=>{if(q.value.length>0&&se(),h.value){const l=new Set(o.visibleLayers),p=[...l].filter(c=>!w.value.has(c));w.value=new Set(l),p.length>0&&await b(h.value,p)}});function L(l){return o.visibleLayers.has(l)}function V(l){return!!S.value[l.id]}const N=e.computed(()=>o.layerList.filter(l=>l.config.type==="circle"&&L(l.config.id)&&V(l.config)).map(l=>l.config)),T=e.computed(()=>o.layerList.filter(l=>l.config.type==="fill"&&L(l.config.id)&&V(l.config)).map(l=>l.config)),I=e.computed(()=>o.layerList.filter(l=>l.config.type==="fill"&&l.config.outlinePaint&&L(l.config.id)&&V(l.config)).map(l=>l.config)),X=e.computed(()=>o.layerList.filter(l=>l.config.type==="line"&&L(l.config.id)&&V(l.config)).map(l=>l.config));function ue(l){return o.visibleTiledLayers?.has(l)??!1}function de(l){return o.tiledLayerOpacities?.[l]??1}function Fe(l){return`${l.replace(/\/$/,"")}/tile/{z}/{y}/{x}`}function Ie(l){return{type:"raster",tiles:[Fe(l.url)],tileSize:256,attribution:l.attribution||""}}const ve=e.ref({}),Se=e.ref(new Set);async function be(l){if(!Se.value.has(l.id)){Se.value.add(l.id);try{const p=l.url.replace(/\/$/,""),c=await fetch(`${p}?f=json`);if(!c.ok)return;const B=await c.json();let E=B.minScale||0,x=B.maxScale||0;if(B.layers&&B.layers.length>0)for(const $ of B.layers)$.maxScale&&$.maxScale>0&&(x===0||$.maxScale<x)&&(x=$.maxScale);x===0&&(x=72e3),ve.value={...ve.value,[l.id]:{minScale:E,maxScale:x}}}catch{}}}e.onMounted(()=>{if(o.tiledLayers)for(const l of o.tiledLayers)l.scaleBasedRendering&&be(l)});function Ee(l){if(!l.scaleBasedRendering)return"tiled";const p=ve.value[l.id];if(!p)return"tiled";const c=d.value;return c===0||c>p.maxScale?"tiled":"dynamic"}const Oe=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(l=>ue(l.id)?l.scaleBasedRendering?Ee(l)==="tiled":!0:!1):[]),De=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(l=>ue(l.id)&&l.scaleBasedRendering?Ee(l)==="dynamic":!1):[]);function fe(l){return{type:"raster",tiles:[`${l.url.replace(/\/$/,"")}/export?bbox={bbox-epsg-3857}&bboxSR=3857&imageSR=3857&size=256,256&format=png32&transparent=true&f=image`],tileSize:256,attribution:l.attribution||""}}function oe(l){return{type:"geojson",data:S.value[l.id]}}function pe(l){return o.layerOpacities[l]??1}function ne(l){const p=pe(l.id),c=l.type==="circle"?"circle-opacity":l.type==="fill"?"fill-opacity":"line-opacity";if(l.type==="fill"&&l.paint["fill-opacity"]===0)return{...l.paint,"fill-opacity":0};const B=l.type==="circle"?"circle-color":l.type==="fill"?"fill-color":"line-color",E={...l.paint},x=E[B],$=E[c]===1,M=typeof x=="string"&&x.startsWith("rgba(");if($&&M){if(p===1)return E;{const F=x.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(F&&F[4]){const[,U,O,_,R]=F,We=parseFloat(R)*p;E[B]=`rgba(${U}, ${O}, ${_}, ${We})`,E[c]=1}return E}}if(M){const F=x.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(F){const[,U,O,_]=F;E[B]=`rgb(${U}, ${O}, ${_})`}}return E[c]=p,E}function Re(l){const p=pe(l.id);return{...l.outlinePaint,"line-opacity":p}}const q=e.ref([]),le=e.ref(null),j=e.ref(0);function re(l){const p=l.replace(/-outline$/,"");return o.layerList.find(B=>B.config.id===p)?.config}function Ze(l,p){return l.replace(/\{([^}]+)\}/g,(c,B)=>{const E=p[B];return E==null?"":String(E)})}function ie(l){return l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ke(l,p){if(l==null)return"-";if(p?.dateFormat&&typeof l=="number"){const c=new Date(l);switch(p.dateFormat){case"shortDateShortTime":return c.toLocaleString();case"longMonthDayYear":return c.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"});case"shortDate":return c.toLocaleDateString();case"longDate":return c.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"});default:return c.toLocaleDateString()}}if(typeof l=="number"){if(l>1e12&&!p)return new Date(l).toLocaleDateString();const c=p?.places,B=p?.digitSeparator??!0;if(c!==void 0){const E=l.toFixed(c);if(B){const x=E.split("."),$=x[0]||"0",M=x[1],F=$.replace(/\B(?=(\d{3})+(?!\d))/g,",");return M?`${F}.${M}`:F}return E}return B?l.toLocaleString():String(l)}return String(l)}function Le(l){const p=new Set;return l.filter(c=>{const E=`${c.layer.id.replace(/-outline$/,"")}:${JSON.stringify(c.properties)}`;return p.has(E)?!1:(p.add(E),!0)})}function Be(l,p){const c=new Map;return p.forEach((B,E)=>{c.set(B.id,E)}),l.sort((B,E)=>{const x=B.layer.id.replace(/-outline$/,""),$=E.layer.id.replace(/-outline$/,""),M=c.get(x)??-1;return(c.get($)??-1)-M})}function G(l){const p=i.value;if(!p)return;const c=[];o.layerList.forEach(O=>{const _=O.config;o.visibleLayers.has(_.id)&&(c.push(_.id),_.outlinePaint&&c.push(`${_.id}-outline`))});const B=p.project([l.lngLat.lng,l.lngLat.lat]),E=p.queryRenderedFeatures(B,{layers:c});if(E.length===0)return;const x=Le(E),$=o.layerList.map(O=>O.config),M=Be(x,$),F=M.map(O=>{const _=O.layer.id.replace(/-outline$/,""),R=re(_);return R?{layerId:R.id,layerTitle:R.title,properties:O.properties||{},popupConfig:R.popup}:null}).filter(O=>O!==null);if(F.length===0)return;q.value=F,j.value=0,le.value=[l.lngLat.lng,l.lngLat.lat];const U=M[0];if(U&&U.geometry){const O=U.layer.id.replace(/-outline$/,""),_=re(O);if(_){const R=Ve(U.geometry),We=we(_.id,_.type);Q.value={geometry:U.geometry,geometryType:R,layerId:_.id,properties:U.properties||{},originalStyle:We}}}}function se(){q.value=[],le.value=null,j.value=0,Q.value=null}function K(l){if(q.value.length===0)return;const p=l.target;if(!(p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable))switch(l.key){case"ArrowLeft":case"ArrowUp":l.preventDefault(),ce();break;case"ArrowRight":case"ArrowDown":l.preventDefault(),xe();break;case"Escape":l.preventDefault(),se();break}}e.onMounted(()=>{window.addEventListener("keydown",K)}),e.onUnmounted(()=>{window.removeEventListener("keydown",K)});function xe(){const l=q.value.length;l<=1||(j.value=(j.value+1)%l)}function ce(){const l=q.value.length;l<=1||(j.value=(j.value-1+l)%l)}const A=e.computed(()=>q.value.length===0?null:q.value[j.value]),Ne=e.computed(()=>{const l=A.value;return!l||!l.popupConfig?l?.layerTitle||"":Ze(l.popupConfig.title,l.properties)}),Y=e.computed(()=>{const l=A.value;if(!l)return"";let p='<div class="popup-content">';if(p+=`<h3 class="popup-title">${ie(Ne.value)}</h3>`,l.popupConfig?.fields?.length){p+=`<table class="popup-table" aria-label="${ie(Ne.value)}">`;for(const c of l.popupConfig.fields){const B=ke(l.properties[c.field],c.format);p+=`<tr><th>${ie(c.label)}</th><td>${ie(B)}</td></tr>`}p+="</table>"}else p+='<p class="popup-no-fields">No additional information available.</p>';return p+="</div>",p}),ae=e.ref({type:"FeatureCollection",features:[]}),ee=e.ref({type:"FeatureCollection",features:[]}),J={"circle-radius":["get","highlightRadius"],"circle-color":"#00FFFF","circle-opacity":.8,"circle-stroke-width":2,"circle-stroke-color":"#FFFFFF"},Ae={"line-width":["get","highlightWidth"],"line-color":"#00FFFF","line-opacity":.9},Q=e.ref(null);function Ve(l){return l.type}function we(l,p){const c=re(l);if(!c)return{radius:5,width:2};const B=c.paint||{};if(p==="circle"){const E=B["circle-radius"];return typeof E=="number"?{radius:E}:{radius:5}}if(p==="line"||p==="fill"){const E=B["line-width"];if(typeof E=="number")return{width:E};if(c.outlinePaint&&c.outlinePaint["line-width"]){const x=c.outlinePaint["line-width"];if(typeof x=="number")return{width:x}}return{width:2}}return{radius:5,width:2}}function k(l){return!l||l.length===0?[]:l[0]??[]}function C(l){const{geometry:p,geometryType:c,originalStyle:B}=l;if(c==="Point"||c==="MultiPoint"){const x=(B.radius||5)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:p,properties:{highlightRadius:x}}]}}if(c==="LineString"||c==="MultiLineString"){const x=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:p,properties:{highlightWidth:x}}]}}if(c==="Polygon"){const E=p.coordinates,x=k(E),M=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:x},properties:{highlightWidth:M}}]}}if(c==="MultiPolygon"){const E=p.coordinates,$=(B.width||2)+3;return{type:"FeatureCollection",features:E.map(F=>({type:"Feature",geometry:{type:"LineString",coordinates:k(F)},properties:{highlightWidth:$}}))}}return{type:"FeatureCollection",features:[]}}function D(l){if(!l){z();return}const p=C(l);l.geometryType==="Point"||l.geometryType==="MultiPoint"?(ae.value=p,ee.value={type:"FeatureCollection",features:[]}):(ee.value=p,ae.value={type:"FeatureCollection",features:[]})}function z(){ae.value={type:"FeatureCollection",features:[]},ee.value={type:"FeatureCollection",features:[]}}e.watch(Q,l=>{D(l)}),e.watch(()=>o.visibleLayers,l=>{Q.value&&!l.has(Q.value.layerId)&&(Q.value=null,se())},{deep:!0}),e.watch(j,()=>{const l=A.value;if(!l){Q.value=null;return}const p=i.value;if(!p||!le.value)return;const c=[];o.layerList.forEach($=>{const M=$.config;o.visibleLayers.has(M.id)&&(c.push(M.id),M.outlinePaint&&c.push(`${M.id}-outline`))});const B=p.project(le.value),x=p.queryRenderedFeatures(B,{layers:c}).find($=>$.layer.id.replace(/-outline$/,"")===l.layerId&&JSON.stringify($.properties)===JSON.stringify(l.properties));if(x&&x.geometry){const $=re(l.layerId);if($){const M=Ve(x.geometry),F=we($.id,$.type);Q.value={geometry:x.geometry,geometryType:M,layerId:$.id,properties:x.properties||{},originalStyle:F}}}});const W=e.ref(null);function Ue(l){const[p,c]=l.geometry.coordinates;W.value=[p,c]}return(l,p)=>(e.openBlock(),e.createElementBlock("div",yt,[e.createVNode(e.unref(H.Map),{ref_key:"mapRef",ref:r,zoom:o.initialZoom,center:o.initialCenter,"navigation-controls":{position:o.navigationControlPosition},"geolocation-control":{position:o.geolocationControlPosition},"basemap-change-controls":{toggle:!0,dropdown:!0,position:o.basemapControlPosition},"map-search-control":{position:o.searchControlPosition},"enable-cyclomedia":!0,"cyclomedia-config":o.cyclomediaConfig,"cyclomedia-button-position":o.cyclomediaButtonPosition,"enable-pictometry":!0,"pictometry-credentials":o.pictometryCredentials,"pictometry-button-position":o.pictometryButtonPosition,"tool-panel-layout":"vertical","tool-panel-split-ratio":50,onZoom:v,onClick:se,onMoveend:f,onLoad:u,onSearchResult:Ue},{default:e.withCtx(()=>[o.drawControlPosition!==null?(e.openBlock(),e.createBlock(e.unref(H.DrawTool),{key:0,position:o.drawControlPosition},null,8,["position"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Oe.value,c=>(e.openBlock(),e.createBlock(e.unref(H.RasterLayer),{key:"tiled-"+c.id,id:"tiled-"+c.id,source:Ie(c),paint:{"raster-opacity":de(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(De.value,c=>(e.openBlock(),e.createBlock(e.unref(H.RasterLayer),{key:"dynamic-"+c.id,id:"dynamic-"+c.id,source:fe(c),paint:{"raster-opacity":de(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,c=>(e.openBlock(),e.createBlock(e.unref(H.CircleLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(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(T.value,c=>(e.openBlock(),e.createBlock(e.unref(H.FillLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(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(I.value,c=>(e.openBlock(),e.createBlock(e.unref(H.LineLayer),{key:c.id+"-outline",id:c.id+"-outline",source:oe(c),paint:Re(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(X.value,c=>(e.openBlock(),e.createBlock(e.unref(H.LineLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(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(H.CircleLayer),{key:"highlight-circles-layer",id:"highlight-circles",source:{type:"geojson",data:ae.value},paint:J},null,8,["source"]),e.createVNode(e.unref(H.LineLayer),{key:"highlight-lines-layer",id:"highlight-lines",source:{type:"geojson",data:ee.value},paint:Ae},null,8,["source"]),e.createVNode(e.unref(H.MapMarker),{"lng-lat":W.value,color:"#2176d2"},null,8,["lng-lat"]),A.value&&le.value?(e.openBlock(),e.createBlock(e.unref(H.MapPopup),{key:1,"lng-lat":le.value,html:Y.value,"close-on-click":!1,"show-navigation":q.value.length>1,"current-feature-index":j.value,"total-features":q.value.length,"layer-name":A.value.layerTitle,onClose:se,onNext:xe,onPrevious:ce},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"])]))}}),he=(t,a)=>{const o=t.__vccOpts||t;for(const[n,r]of a)o[n]=r;return o},et=he(gt,[["__scopeId","data-v-823ed331"]]),ht=["disabled"],vt=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,o=d=>"href"in d&&d.href!==void 0||"to"in d&&d.to!==void 0,n=e.computed(()=>Z.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)),r=e.computed(()=>o(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,v)=>o(a)?(e.openBlock(),e.createBlock(e.unref(Z.BaseLink),e.mergeProps({key:0},{...r.value,...d.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(Z.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(Z.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,ht))}});var bt={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"]},kt=bt,Lt={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"]},wt=Lt;const Ct=["for"],St={class:"state-layer"},Et={class:"content"},Bt={class:"input-text-container"},xt=["id","placeholder"],Nt={key:1,class:"has-text-body-small phila-supporting-text"},Vt={key:2,class:"has-text-body-small phila-error-text"},$t=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 o=e.useAttrs(),n=t,r=e.computed(()=>typeof n.error=="string"?n.error:n.error[0]),i=e.toRef(n,"id"),d=a,v=e.ref(""),m=e.computed({get:()=>n.modelValue!==void 0?n.modelValue:v.value,set:g=>{d("update:modelValue",g),v.value=g}}),S=e.computed(()=>{const g=["default-class"];return o.disabled!=null&&g.push("phila-input--disabled"),r.value&&g.push("phila-input--error"),o.required!=null&&g.push("phila-input--required"),Z.cn(...g)}),h=e.computed(()=>{const g=[];return m.value!==""&&g.push("phila-text-field--filled"),n.className&&g.push(n.className),Z.cn(...g)}),w=e.ref(null),s=g=>{g.target.closest("button")||w.value?.focus()};return(g,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["phila-input",S.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,Ct)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["phila-text-field",h.value]),onClick:s},[e.createElementVNode("div",St,[n.leadingIcon?(e.openBlock(),e.createBlock(e.unref(Z.Icon),{key:0,"icon-class":n.leadingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.createElementVNode("div",Et,[e.createElementVNode("div",Bt,[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:i.value,ref_key:"inputRef",ref:w,"onUpdate:modelValue":b[0]||(b[0]=y=>m.value=y),class:"phila-text-field-input has-text-body-default",placeholder:n.placeholder},e.unref(o)),null,16,xt),[[e.vModelDynamic,m.value]])])]),m.value!=""?(e.openBlock(),e.createBlock(e.unref(vt),{key:1,variant:"standard",size:"small","icon-only":"","icon-definition":e.unref(wt),onClick:b[1]||(b[1]=y=>m.value="")},null,8,["icon-definition"])):e.createCommentVNode("",!0),n.trailingIcon?(e.openBlock(),e.createBlock(e.unref(Z.Icon),{key:2,size:"small","icon-class":n.trailingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.renderSlot(g.$slots,"trailing-action")])],2),n.supportingText?(e.openBlock(),e.createElementBlock("div",Nt,e.toDisplayString(n.supportingText),1)):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("div",Vt,[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(kt),size:"small",inline:"",decorative:""},null,8,["icon-definition"]),e.createTextVNode(" "+e.toDisplayString(r.value),1)])):e.createCommentVNode("",!0)],2))}});var Pt={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"]},_t={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"]},zt={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"]},Je={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"]},Tt={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"]},Mt={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 Ft={class:"layer-panel"},It={key:0,class:"search-box"},Ot={key:1,class:"topics-container"},Dt={class:"layer-row"},Rt=["href","aria-label"],Zt={key:1,class:"metadata-placeholder"},At=["checked","disabled","onChange"],Ut={class:"layer-title"},Wt={key:0,class:"loading-indicator",role:"status"},qt=["aria-label"],jt={key:2,class:"zoom-indicator"},Gt={key:0,class:"opacity-control"},Ht=["for"],Kt=["id","value","aria-label","onInput"],Jt={key:1,class:"layer-legend"},Qt={class:"legend-label"},Xt={key:0,class:"no-results"},Yt=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 o=t,n=a,r=e.computed(()=>{if(!o.searchQuery.trim())return o.layerList;const f=o.searchQuery.toLowerCase();return o.layerList.filter(u=>u.config.title.toLowerCase().includes(f))});function i(f){let u=f.split("?")[0]||f;return u=u.replace(/\/query$/,""),u=u.replace(/\/$/,""),u.toLowerCase()}function d(f){const u=i(f);return o.layerMetadata[u]||null}const v=e.computed(()=>o.layerList.some(f=>d(f.config.url)));function m(f){return o.visibleLayers.has(f)}function S(f){return o.layerOpacities[f]??1}function h(f){return o.loadingLayers.has(f)}function w(f){return o.layerErrors[f]||null}function s(f){const u=o.currentZoom,L=f.minZoom,V=f.maxZoom;return!(L!==void 0&&u<L||V!==void 0&&u>V)}const g=e.computed({get:()=>o.searchQuery,set:f=>n("updateSearch",f)});function b(f){n("toggleLayer",f)}function y(f,u){const L=u.target,V=parseFloat(L.value);n("setOpacity",f,V)}return(f,u)=>(e.openBlock(),e.createElementBlock("div",Ft,[t.showSearch?(e.openBlock(),e.createElementBlock("div",It,[e.createVNode(e.unref($t),{modelValue:g.value,"onUpdate:modelValue":u[0]||(u[0]=L=>g.value=L),placeholder:t.searchPlaceholder,"class-name":"layer-search-field"},{"trailing-action":e.withCtx(()=>[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Pt),size:"small",inline:"",decorative:""},null,8,["icon-definition"])]),_:1},8,["modelValue","placeholder"])])):e.createCommentVNode("",!0),t.mode==="topics"?(e.openBlock(),e.createElementBlock("div",Ot,[e.renderSlot(f.$slots,"topics",{},()=>[u[2]||(u[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":v.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,L=>(e.openBlock(),e.createElementBlock("div",{key:L.config.id,class:"layer-item"},[e.createElementVNode("div",Dt,[d(L.config.url)?(e.openBlock(),e.createElementBlock("a",{key:0,href:d(L.config.url)||"",target:"_blank",rel:"noopener noreferrer",class:"metadata-link","aria-label":"View metadata for "+L.config.title,onClick:u[1]||(u[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Mt),size:"small",inline:"",decorative:""},null,8,["icon-definition"])],8,Rt)):v.value?(e.openBlock(),e.createElementBlock("span",Zt)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!s(L.config),"layer-error":w(L.config.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:m(L.config.id),disabled:!s(L.config),onChange:V=>b(L.config.id)},null,40,At),e.createElementVNode("span",Ut,[e.createTextVNode(e.toDisplayString(L.config.title)+" ",1),h(L.config.id)?(e.openBlock(),e.createElementBlock("span",Wt," Loading... ")):e.createCommentVNode("",!0),w(L.config.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":w(L.config.id)||"Error",role:"status"}," Error ",8,qt)):e.createCommentVNode("",!0),s(L.config)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",jt," (zoom in) "))])],2)]),t.showOpacity&&m(L.config.id)?(e.openBlock(),e.createElementBlock("div",Gt,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+L.config.id}," Opacity: "+e.toDisplayString(Math.round(S(L.config.id)*100))+"% ",9,Ht),e.createElementVNode("input",{id:"opacity-"+L.config.id,type:"range",min:"0",max:"1",step:"0.05",value:S(L.config.id),"aria-label":"Opacity for "+L.config.title,class:"opacity-slider",onInput:V=>y(L.config.id,V)},null,40,Kt)])):e.createCommentVNode("",!0),t.showLegend&&m(L.config.id)&&L.config.legend?.length?(e.openBlock(),e.createElementBlock("ul",Jt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.config.legend,(V,N)=>(e.openBlock(),e.createElementBlock("li",{key:N,class:"legend-item"},[V.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:V.color}),"aria-hidden":"true"},null,4)):V.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:V.color,height:`${V.width||2}px`}),"aria-hidden":"true"},null,4)):V.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:V.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Qt,e.toDisplayString(V.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("div",Xt,' No layers match "'+e.toDisplayString(t.searchQuery)+'" ',1)):e.createCommentVNode("",!0)],2))]))}}),tt=he(Yt,[["__scopeId","data-v-bd7d8852"]]);function P(t){if(!t||!Array.isArray(t)||t.length<3)return"#888888";const a=t[0],o=t[1],n=t[2],i=(t[3]??255)/255;return i===1?`#${a.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`:`rgba(${a}, ${o}, ${n}, ${i.toFixed(2)})`}function te(t){return t!==void 0?t:1}const eo=559082264;function Qe(t){return!t||t<=0?null:Math.round(Math.log2(eo/t)*100)/100}function to(t,a){const o={};if(t&&t>0){const n=Qe(t);n!==null&&(o.minZoom=n)}if(a&&a>0){const n=Qe(a);n!==null&&(o.maxZoom=n)}return o}function Te(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 ge(t){return!(!t||t.style==="esriSLSNull"||t.color===null||t.width===0||t.color&&t.color[3]===0)}function qe(t){return String(t)}function ot(t,a,o){const n=t.symbol,r=Te(n);let i={},d=[],v=null;if(r==="fill"&&n){const m=n.color===null?0:n.color?.[3]??255,S=m===0?"rgba(0, 0, 0, 0)":P(n.color),h=m===0?0:m<255?1:te(a);if(i={"fill-color":S,"fill-opacity":h},ge(n.outline)){const w=n.outline.width||1,s=P(n.outline.color);m!==0&&(i["fill-outline-color"]=s),(w>1||m===0)&&(v={"line-color":s,"line-width":w})}d=[{type:"fill",color:P(n.color),label:t.label||"Feature"}]}else if(r==="line"&&n)i={"line-color":P(n.color),"line-width":n.width||1,"line-opacity":te(a)},d=[{type:"line",color:P(n.color),width:n.width||1,label:t.label||"Feature"}];else if(r==="circle"&&n){const m=Math.round((n.size||6)*.71*100)/100;i={"circle-color":P(n.color),"circle-radius":m,"circle-opacity":te(a)},ge(n.outline)&&(i["circle-stroke-color"]=P(n.outline.color),i["circle-stroke-width"]=n.outline.width||1),d=[{type:"circle",color:P(n.color),label:t.label||"Feature"}]}return{paint:i,legend:d,geomType:r,outlinePaint:v}}function oo(t,a,o){const n=t.field1,r=t.uniqueValueInfos||[],i=t.defaultSymbol;if(r.length===0)return ot({...t,symbol:i},a);const d=r[0]?.symbol||i,v=Te(d);let m={},S=[],h=null;if(v==="fill"){const w=["match",["to-string",["get",n]]];for(const s of r){w.push(qe(s.value)),w.push(P(s.symbol?.color));const g=String(s.value),y=o?.get(g)||s.label||g;S.push({type:"fill",color:P(s.symbol?.color),label:y})}if(w.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"fill-color":w,"fill-opacity":te(a)},ge(d?.outline)){const s=d.outline.width||1,g=P(d.outline.color);m["fill-outline-color"]=g,s>1&&(h={"line-color":g,"line-width":s})}}else if(v==="line"){const w=["match",["to-string",["get",n]]];for(const s of r){w.push(qe(s.value)),w.push(P(s.symbol?.color));const g=String(s.value),y=o?.get(g)||s.label||g;S.push({type:"line",color:P(s.symbol?.color),width:s.symbol?.width||1,label:y})}w.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"line-color":w,"line-width":d?.width||2,"line-opacity":te(a)}}else if(v==="circle"){const w=["match",["to-string",["get",n]]];for(const g of r){w.push(qe(g.value)),w.push(P(g.symbol?.color));const b=String(g.value),f=o?.get(b)||g.label||b;S.push({type:"circle",color:P(g.symbol?.color),label:f})}w.push(i?P(i.color):"rgba(0, 0, 0, 0)");const s=Math.round((d?.size||6)*.71*100)/100;m={"circle-color":w,"circle-radius":s,"circle-opacity":te(a)},ge(d?.outline)&&(m["circle-stroke-color"]=P(d.outline.color),m["circle-stroke-width"]=d.outline.width||1)}return{paint:m,legend:S,geomType:v,outlinePaint:h}}function no(t,a){const o=t.field,n=t.classBreakInfos||[],r=t.visualVariables?.find(h=>h.type==="colorInfo");if(r?.stops&&r.stops.length>0)return lo(r,o,t,a);if(n.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=n[0]?.symbol,d=Te(i);let v={},m=[],S=null;if(d==="fill"){const h=["step",["get",o]];h.push(P(n[0]?.symbol?.color));for(let w=0;w<n.length;w++){const s=n[w];w>0&&(h.push(n[w-1].classMaxValue),h.push(P(s.symbol?.color))),m.push({type:"fill",color:P(s.symbol?.color),label:s.label||`${s.classMaxValue}`})}if(v={"fill-color":h,"fill-opacity":te(a)},ge(i?.outline)){const w=i.outline.width||1,s=P(i.outline.color);v["fill-outline-color"]=s,w>1&&(S={"line-color":s,"line-width":w})}}else if(d==="line"){const h=["step",["get",o]];h.push(P(n[0]?.symbol?.color));let w=t.minValue??0;for(let g=0;g<n.length;g++){const b=n[g];g>0&&(h.push(n[g-1].classMaxValue),h.push(P(b.symbol?.color))),m.push({type:"line",color:P(b.symbol?.color),width:b.symbol?.width||i?.width||2,label:b.label||`${w} - ${b.classMaxValue}`}),w=b.classMaxValue+1}const s=i?.width||2;v={"line-color":h,"line-width":s,"line-opacity":te(a)}}return{paint:v,legend:m,geomType:d,outlinePaint:S}}function lo(t,a,o,n){const r=t.stops||[];if(r.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=o.classBreakInfos?.[0]?.symbol||o.defaultSymbol,d=Te(i);let v={},m=[],S=null;if(d==="fill"){const h=["interpolate",["linear"],["get",a]];for(const s of r)h.push(s.value),h.push(P(s.color)),m.push({type:"fill",color:P(s.color),label:s.label||`${s.value}`});if(v={"fill-color":["case",["==",["get",a],null],"rgba(0, 0, 0, 0)",h],"fill-opacity":te(n)},ge(i?.outline)){const s=i.outline.width||1,g=P(i.outline.color);v["fill-outline-color"]=g,s>1&&(S={"line-color":g,"line-width":s})}}return{paint:v,legend:m,geomType:d,outlinePaint:S}}function ao(t,a,o,n){if(!t?.renderer)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const r=t.renderer;switch(r.type){case"simple":return ot(r,a);case"uniqueValue":return oo(r,a,o);case"classBreaks":return no(r,a);default:return{paint:{},legend:[],geomType:"fill",outlinePaint:null}}}function ro(t){if(!t)return null;const a=t.title||"",n=(t.fieldInfos||[]).filter(r=>r.visible===!0).map(r=>{const i={field:r.fieldName,label:r.label||r.fieldName};return r.format&&(i.format={},r.format.dateFormat&&(i.format.dateFormat=r.format.dateFormat),r.format.digitSeparator!==void 0&&(i.format.digitSeparator=r.format.digitSeparator),r.format.places!==void 0&&(i.format.places=r.format.places),Object.keys(i.format).length===0&&delete i.format),i});return{title:a,fields:n}}function io(t){return t?.definitionExpression}function so(t){return(t.includes("_")?t.split("_").slice(1).join(" "):t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function co(t){return t.includes("_")?t.split("_").slice(1).join(" "):t}function uo(t){const a=new Map;if(!t)return a;const o=t.split(`
2
- `),n=/^(\d{1,3})\s+(.+)$/;for(const r of o){const i=r.trim().match(n);if(i){const[,d,v]=i;d&&v&&a.set(d,v.trim())}}return a}async function fo(t){try{const a=await fetch(`${t}?f=json`);if(!a.ok)return null;const o=await a.json();return o.drawingInfo?{drawingInfo:o.drawingInfo,description:o.description}:null}catch{return null}}async function Ge(t){const a=t.operationalLayers||[],o=[],n=["Zoning and Planning_Land Use"];for(const r of a)if(r.url&&r.itemId!=="4f39b829b96d437da9231727d9c91fab")try{let i=r.layerDefinition?.drawingInfo,d;const v=!i||!i.renderer,m=n.includes(r.title);if((v||m)&&r.url){const N=await fo(r.url);N&&(i=N.drawingInfo,N.description&&(d=uo(N.description),d.size>0))}const{paint:S,legend:h,geomType:w,outlinePaint:s}=ao(i,r.opacity,d,r.title),g=ro(r.popupInfo),b=io(r.layerDefinition),y=to(r.layerDefinition?.minScale,r.layerDefinition?.maxScale),f=so(r.title),u=co(r.title);let L=r.opacity??1;const V={id:f,title:u,type:w,url:r.url,opacity:L,paint:S,legend:h,popup:g};b&&(V.where=b),y.minZoom!==void 0&&(V.minZoom=y.minZoom),y.maxZoom!==void 0&&(V.maxZoom=y.maxZoom),s&&(V.outlinePaint=s),o.push(V)}catch{}return o.sort((r,i)=>r.title.localeCompare(i.title)),o}const Xe={},He="376af635c84643cd816a8c5d017a53aa",po=He;function Me(t,a){let o=`https://www.arcgis.com/sharing/rest/content/items/${t}/data?f=json`;return a&&(o+=`&token=${a}`),o}function mo(){return Me(He)}const Pe=new Map,Ce=new Map;function nt(t){t?(Pe.delete(t),Ce.delete(t)):(Pe.clear(),Ce.clear())}let $e,Ye=0;async function yo(){const t=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:me&&me.tagName.toUpperCase()==="SCRIPT"&&me.src||new URL("index.js",document.baseURI).href}<"u"&&Xe?.VITE_AGO_USERNAME,a=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:me&&me.tagName.toUpperCase()==="SCRIPT"&&me.src||new URL("index.js",document.baseURI).href}<"u"&&Xe?.VITE_AGO_PASSWORD;if(!(!t||!a)){if($e&&Date.now()<Ye-3e5)return $e;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:($e=n.token,Ye=n.expires,$e)}catch{return}}}async function go(t,a){const o=Me(t,a),n=await fetch(o);if(!n.ok)throw new Error(`Failed to fetch WebMap: ${n.status} ${n.statusText}`);const r=await n.json();if(r.error)throw new Error(`ArcGIS error: ${r.error.message||r.error.code||"Unknown error"}`);return r}async function ho(t){try{const a=await yo(),o=await go(t,a);return await Ge(o)}catch(a){throw new Error(`Failed to load dynamic layer configs: ${a instanceof Error?a.message:"Unknown error"}`)}}async function _e(t=He){const a=Pe.get(t);if(a)return a;const o=Ce.get(t);if(o)return o;const n=(async()=>{try{const r=await ho(t);return Pe.set(t,r),r}finally{Ce.delete(t)}})();return Ce.set(t,n),n}function lt(t){const a=e.ref({}),o=new Map;for(const s of t)a.value[s.id]={data:null,loading:!1,error:null,lastFetched:null};async function n(s){const g=s.id;a.value={...a.value,[g]:{data:a.value[g]?.data??null,lastFetched:a.value[g]?.lastFetched??null,loading:!0,error:null}};try{let b;if(s.type==="http-get"){const y=await fetch(s.url,{method:"GET",...s.options});if(!y.ok)throw new Error(`HTTP ${y.status}: ${y.statusText}`);b=await y.json()}else if(s.type==="http-post"){const y=await fetch(s.url,{method:"POST",...s.options});if(!y.ok)throw new Error(`HTTP ${y.status}: ${y.statusText}`);b=await y.json()}else if(s.type==="esri"){const f=`${s.url.replace(/\/$/,"")}/query?where=1%3D1&outFields=*&returnGeometry=false&f=json`,u=await fetch(f,s.options);if(!u.ok)throw new Error(`HTTP ${u.status}: ${u.statusText}`);b=(await u.json()).features?.map(V=>V.attributes)||[]}else throw new Error(`Unknown data source type: ${s.type}`);s.transform&&(b=s.transform(b)),a.value={...a.value,[g]:{data:b,loading:!1,error:null,lastFetched:Date.now()}}}catch(b){const y=b instanceof Error?b.message:"Unknown error";a.value={...a.value,[g]:{data:a.value[g]?.data??null,lastFetched:a.value[g]?.lastFetched??null,loading:!1,error:y}}}}async function r(){await Promise.all(t.map(s=>n(s)))}async function i(s){const g=t.find(b=>b.id===s);g&&await n(g)}function d(s){return a.value[s]?.data??null}const v=e.computed(()=>Object.values(a.value).some(s=>s.loading));function m(s){return a.value[s]?.loading??!1}function S(s){return a.value[s]?.error??null}function h(){for(const s of t)if(s.pollInterval&&s.pollInterval>0){const g=window.setInterval(()=>{n(s)},s.pollInterval);o.set(s.id,g)}}function w(){for(const[,s]of o)window.clearInterval(s);o.clear()}return e.onMounted(()=>{r(),h()}),e.onUnmounted(()=>{w()}),{state:e.readonly(a),isLoading:v,fetchAll:r,refetch:i,getData:d,isSourceLoading:m,getError:S,stopPolling:w}}const vo={class:"layerboard-layout"},bo=["aria-expanded"],ko={key:0,class:"layerboard-subtitle"},Lo={class:"layerboard-mobile-menu-content"},wo={class:"layerboard-main"},Co={key:0,class:"layerboard-loading",role:"status","aria-live":"polite"},So={key:1,class:"layerboard-error",role:"alert"},Eo=["aria-expanded","aria-label"],Bo={key:0},xo={key:1},No={class:"sr-only","aria-live":"polite"},Vo=e.defineComponent({__name:"Layerboard",props:{title:{},subtitle:{},webMapId:{},themeColor:{default:"#0f4d90"},cyclomediaConfig:{},pictometryCredentials:{},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:()=>({})},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:{},initialCenter:{}},emits:["configs-loaded","load-error","zoom"],setup(t,{expose:a,emit:o}){const n=t,r=o,i=e.ref([]),d=e.ref(!0),v=e.ref(null),m=e.ref(12),S=e.ref(""),h=e.ref(new Set),w=e.ref({}),s=e.ref(new Set),g=e.ref({}),b=e.ref({}),y=e.ref(new Set),f=e.ref({});function u(){const k={};for(const C of n.tiledLayers)k[C.id]=C.opacity??1;f.value=k}function L(k){y.value.has(k)?y.value.delete(k):y.value.add(k),y.value=new Set(y.value)}function V(k,C){C?y.value.add(k):y.value.delete(k),y.value=new Set(y.value)}function N(k,C){f.value={...f.value,[k]:C}}const T=n.dataSources.length>0?lt(n.dataSources):null,I=e.computed(()=>T?.state.value??{}),X=e.computed(()=>T?.isLoading.value??!1);function ue(k){return T?.getData(k)??null}function de(k){return T?.refetch(k)??Promise.resolve()}e.provide("layerboard-layers",e.readonly(i)),e.provide("layerboard-visible",h),e.provide("layerboard-opacities",w),e.provide("layerboard-loading",e.readonly(s)),e.provide("layerboard-errors",e.readonly(g)),e.provide("layerboard-zoom",e.readonly(m)),e.provide("layerboard-toggle-layer",fe),e.provide("layerboard-set-layer-visible",oe),e.provide("layerboard-set-layers-visible",pe),e.provide("layerboard-set-opacity",ne),e.provide("layerboard-tiled-layers",e.readonly(e.computed(()=>n.tiledLayers))),e.provide("layerboard-visible-tiled",y),e.provide("layerboard-tiled-opacities",f),e.provide("layerboard-toggle-tiled",L),e.provide("layerboard-set-tiled-opacity",N),e.provide("layerboard-set-tiled-visible",V),e.provide("layerboard-data-sources-state",I),e.provide("layerboard-data-sources-loading",X),e.provide("layerboard-get-data-source",ue),e.provide("layerboard-refetch-data-source",de);const Fe=e.computed(()=>({backgroundColor:n.themeColor})),Ie=e.computed(()=>({backgroundColor:n.themeColor})),ve=e.computed(()=>({backgroundColor:n.themeColor})),Se=e.computed(()=>({width:A.value?"0":n.sidebarWidth}));async function be(){try{d.value=!0,v.value=null;const C=(await _e(n.webMapId)).map(z=>{const W=n.layerStyleOverrides[z.id];return W?{...z,paint:W.paint??z.paint,outlinePaint:W.outlinePaint??z.outlinePaint,legend:W.legend??z.legend,type:W.type??z.type}:z});i.value=C.map(z=>({config:z,component:z.type}));const D={};C.forEach(z=>{D[z.id]=z.opacity??1}),w.value=D,r("configs-loaded",C)}catch(k){const C=k instanceof Error?k.message:"Failed to load layer configurations";v.value=C,r("load-error",C)}finally{d.value=!1}}function Ee(k){let C=k.split("?")[0]||k;return C=C.replace(/\/query$/,""),C=C.replace(/\/$/,""),C.toLowerCase()}async function Oe(){if(n.fetchMetadata)try{const k="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(k);if(!C.ok)return;const D=await C.json(),z={};for(const W of D.rows||[])if(W.url_text&&W.representation){const Ue=Ee(W.url_text),l=`https://metadata.phila.gov/#home/representationdetails/${W.representation}/`;z[Ue]=l}b.value=z}catch{}}function De(k){m.value=k,r("zoom",k)}function fe(k){h.value.has(k)?h.value.delete(k):h.value.add(k),h.value=new Set(h.value)}function oe(k,C){C?h.value.add(k):h.value.delete(k),h.value=new Set(h.value)}function pe(k,C){for(const D of k)C?h.value.add(D):h.value.delete(D);h.value=new Set(h.value)}function ne(k,C){w.value={...w.value,[k]:C}}function Re(k,C){C?s.value.add(k):s.value.delete(k),s.value=new Set(s.value)}function q(k,C){if(C)g.value={...g.value,[k]:C};else{const{[k]:D,...z}=g.value;g.value=z}}function le(k){S.value=k}const j=e.ref(null),re=e.ref(null),Ze=e.ref(null),ie=e.ref(null),ke=e.ref(null),Le=e.ref(null),Be=e.ref(null),G=e.ref("map");function se(){G.value=G.value==="sidebar"?"map":"sidebar",e.nextTick(()=>{G.value==="sidebar"&&j.value?.focus()})}const K=e.ref(!1);function xe(){K.value=!K.value,K.value&&e.nextTick(()=>{ie.value?.focus()})}function ce(){K.value=!1,e.nextTick(()=>{re.value?.focus()})}const A=e.ref(!1);function Ne(){A.value=!A.value}const Y=e.ref(!1),ae=e.ref(null);function ee(){ae.value=document.activeElement,Y.value=!0,e.nextTick(()=>{Be.value?.focus()})}function J(){Y.value=!1,e.nextTick(()=>{ae.value?.focus(),ae.value=null})}function Ae(k){k.target.classList.contains("layerboard-modal-backdrop")&&J()}function Q(k){if(k.key==="Escape"){ce();return}if(k.key==="Tab"&&ke.value){const C=Array.from(ke.value.querySelectorAll('a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(C.length===0)return;const D=C[0],z=C[C.length-1];k.shiftKey?document.activeElement===D&&(k.preventDefault(),z.focus()):document.activeElement===z&&(k.preventDefault(),D.focus())}}function Ve(k){if(k.key==="Escape"){J();return}if(k.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 D=C[0],z=C[C.length-1];k.shiftKey?document.activeElement===D&&(k.preventDefault(),z.focus()):document.activeElement===z&&(k.preventDefault(),D.focus())}}e.provide("layerboard-open-modal",ee),e.provide("layerboard-close-modal",J),e.provide("layerboard-is-modal-open",e.readonly(Y)),a({layerList:i,visibleLayers:h,layerOpacities:w,loadingLayers:s,layerErrors:g,currentZoom:m,toggleLayer:fe,setLayerVisible:oe,setLayersVisible:pe,setLayerOpacity:ne,reloadConfigs:be,clearCache:()=>nt(n.webMapId),visibleTiledLayers:y,tiledLayerOpacities:f,toggleTiledLayer:L,setTiledLayerVisible:V,setTiledLayerOpacity:N,dataSourcesState:I,dataSourcesLoading:X,getDataSourceData:ue,refetchDataSource:de,isModalOpen:Y,openModal:ee,closeModal:J});function we(k){k.key==="Escape"&&K.value&&ce()}return e.onMounted(()=>{be(),Oe(),u(),document.addEventListener("keydown",we)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",we)}),(k,C)=>(e.openBlock(),e.createElementBlock("div",vo,[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(Fe.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:re,class:"layerboard-hamburger layerboard-mobile-only","aria-expanded":K.value,onClick:xe,"aria-label":"Toggle menu"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Tt),size:"medium",decorative:""},null,8,["icon-definition"])],8,bo),e.renderSlot(k.$slots,"header",{},()=>[e.createElementVNode("h1",null,e.toDisplayString(t.title),1),t.subtitle?(e.openBlock(),e.createElementBlock("span",ko,e.toDisplayString(t.subtitle),1)):e.createCommentVNode("",!0)],!0),K.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"mobileMenuRef",ref:ke,class:"layerboard-mobile-menu",style:e.normalizeStyle({backgroundColor:t.themeColor}),onKeydown:Q},[e.createElementVNode("div",Lo,[e.renderSlot(k.$slots,"footer",{openModal:ee,closeModal:J,isModalOpen:Y.value},()=>[C[0]||(C[0]=e.createTextVNode(" City of Philadelphia ",-1))],!0)]),e.createElementVNode("button",{ref_key:"mobileMenuCloseRef",ref:ie,class:"layerboard-mobile-menu-close",onClick:ce,"aria-label":"Close menu"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Je),size:"medium",decorative:""},null,8,["icon-definition"])],512)],36)):e.createCommentVNode("",!0),K.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"layerboard-mobile-menu-backdrop",onClick:ce})):e.createCommentVNode("",!0)],4),e.createElementVNode("div",wo,[d.value?(e.openBlock(),e.createElementBlock("div",Co,[e.createElementVNode("div",{class:"layerboard-spinner",style:e.normalizeStyle({borderTopColor:t.themeColor})},null,4),e.createElementVNode("p",null,"Loading "+e.toDisplayString(t.title)+"...",1)])):v.value?(e.openBlock(),e.createElementBlock("div",So,[C[3]||(C[3]=e.createElementVNode("h2",null,"Error Loading Layers",-1)),e.createElementVNode("p",null,e.toDisplayString(v.value),1),e.createElementVNode("button",{class:"layerboard-retry-button",style:e.normalizeStyle({backgroundColor:t.themeColor}),onClick:be}," Retry ",4)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("aside",{ref_key:"sidebarRef",ref:j,id:"main-content",class:e.normalizeClass(["layerboard-sidebar",{"is-active":G.value==="sidebar"}]),style:e.normalizeStyle(Se.value),"aria-label":"Map layers",tabindex:"-1"},[e.renderSlot(k.$slots,"sidebar",{layers:i.value,visibleLayers:h.value,layerOpacities:w.value,loadingLayers:s.value,layerErrors:g.value,currentZoom:m.value,toggleLayer:fe,setLayerVisible:oe,setLayersVisible:pe,setOpacity:ne,tiledLayers:t.tiledLayers,visibleTiledLayers:y.value,tiledLayerOpacities:f.value,toggleTiledLayer:L,setTiledLayerVisible:V,setTiledLayerOpacity:N,dataSourcesState:I.value,dataSourcesLoading:X.value,getDataSource:ue,refetchDataSource:de},()=>[t.showDefaultSidebar?(e.openBlock(),e.createBlock(tt,{key:0,"layer-list":i.value,"visible-layers":h.value,"layer-opacities":w.value,"loading-layers":s.value,"layer-errors":g.value,"current-zoom":m.value,"search-query":S.value,"layer-metadata":b.value,onToggleLayer:fe,onSetOpacity:ne,onUpdateSearch:le},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":G.value==="map"}])},[e.createVNode(et,{"visible-layers":h.value,"layer-opacities":w.value,"layer-list":i.value,"tiled-layers":t.tiledLayers,"visible-tiled-layers":y.value,"tiled-layer-opacities":f.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:De,onLayerLoading:Re,onLayerError:q},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":A.value}]),style:e.normalizeStyle({left:A.value?"0":n.sidebarWidth}),onClick:Ne,"aria-expanded":!A.value,"aria-label":A.value?"Expand sidebar":"Collapse sidebar"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":A.value?e.unref(_t):e.unref(zt),size:"medium",decorative:""},null,8,["icon-definition"])],14,Eo)],64))]),e.createElementVNode("button",{ref_key:"mobileToggleRef",ref:Ze,class:"layerboard-mobile-toggle",style:e.normalizeStyle(ve.value),onClick:se},[G.value==="map"?(e.openBlock(),e.createElementBlock("span",Bo,e.toDisplayString(t.sidebarLabel),1)):(e.openBlock(),e.createElementBlock("span",xo,e.toDisplayString(t.mapLabel),1))],4),e.createElementVNode("footer",{class:"layerboard-footer",style:e.normalizeStyle(Ie.value)},[e.renderSlot(k.$slots,"footer",{openModal:ee,closeModal:J,isModalOpen:Y.value},()=>[C[4]||(C[4]=e.createTextVNode(" City of Philadelphia ",-1))],!0)],4),Y.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"layerboard-modal-backdrop",onClick:Ae,onKeydown:Ve},[e.createElementVNode("div",{ref_key:"modalRef",ref:Le,class:"layerboard-modal",role:"dialog","aria-modal":"true","aria-label":"Application information"},[e.createElementVNode("button",{ref_key:"modalCloseRef",ref:Be,class:"layerboard-modal-close",onClick:J,"aria-label":"Close modal"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Je),size:"medium",decorative:""},null,8,["icon-definition"])],512),e.renderSlot(k.$slots,"modal",{closeModal:J},void 0,!0)],512)],32)):e.createCommentVNode("",!0),e.createElementVNode("span",No,e.toDisplayString(G.value==="sidebar"?"Showing layers panel":"Showing map"),1)]))}}),$o=he(Vo,[["__scopeId","data-v-0348ae97"]]),Po=["aria-expanded"],_o={key:0,class:"topic-icon"},zo={class:"topic-title"},To=e.defineComponent({__name:"TopicAccordion",props:{title:{},icon:{},expanded:{type:Boolean,default:!1},layerIds:{default:()=>[]},headerClass:{}},emits:["toggle","layerChange"],setup(t,{emit:a}){const o=t,n=a,r=e.ref(o.expanded),i=`topic-panel-${e.useId()}`,d=`topic-header-${e.useId()}`;e.watch(()=>o.expanded,m=>{r.value=m});function v(){r.value=!r.value,n("toggle",r.value)}return(m,S)=>{const h=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["topic-accordion",{"is-expanded":r.value}])},[e.createElementVNode("button",{id:d,class:e.normalizeClass(["topic-header",t.headerClass]),type:"button","aria-expanded":r.value,"aria-controls":i,onClick:v},[t.icon||m.$slots.icon?(e.openBlock(),e.createElementBlock("span",_o,[e.renderSlot(m.$slots,"icon",{},()=>[t.icon?(e.openBlock(),e.createBlock(h,{key:0,icon:["fas",t.icon],"aria-hidden":"true"},null,8,["icon"])):e.createCommentVNode("",!0)],!0)])):e.createCommentVNode("",!0),e.createElementVNode("span",zo,e.toDisplayString(t.title),1),e.createElementVNode("span",{class:e.normalizeClass(["topic-chevron",{"is-rotated":r.value}])},[...S[0]||(S[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,Po),e.withDirectives(e.createElementVNode("div",{id:i,role:"region","aria-labelledby":d,class:"topic-content"},[e.renderSlot(m.$slots,"default",{},()=>[S[1]||(S[1]=e.createElementVNode("p",{class:"topic-empty"},"No content provided for this topic.",-1))],!0)],512),[[e.vShow,r.value]])],2)}}}),Mo=he(To,[["__scopeId","data-v-7339d8d1"]]),Fo={class:"layer-checkbox-set",role:"group"},Io=["checked","disabled","onChange"],Oo={class:"layer-title"},Do={key:0,class:"loading-indicator",role:"status"},Ro=["aria-label"],Zo={key:2,class:"zoom-indicator"},Ao={class:"layer-title"},Uo={key:0,class:"loading-indicator",role:"status"},Wo=["aria-label"],qo={key:2,class:"zoom-indicator"},jo={key:2,class:"opacity-control"},Go=["for"],Ho=["id","value","aria-label","onInput"],Ko={key:3,class:"layer-legend"},Jo={class:"legend-label"},Qo={key:0,class:"empty-state"},Xo=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}},emits:["toggleLayer","setOpacity"],setup(t,{emit:a}){const o=t,n=a;function r(y){return o.visibleLayerIds.has(y)}function i(y){return o.layerOpacities[y]??1}function d(y){return o.loadingLayerIds.has(y)}function v(y){return o.layerErrors[y]||null}function m(y){const f=o.currentZoom,u=y.minZoom,L=y.maxZoom;return!(u!==void 0&&f<u||L!==void 0&&f>L)}function S(y){return y.displayOptions?.shouldShowCheckbox!==!1}function h(y){return o.showOpacity?y.displayOptions?.shouldShowSlider!==!1:!1}function w(y){return o.showLegend?y.displayOptions?.shouldShowLegendBox!==!1:!1}function s(y){return y.displayOptions?.layerNameChange||y.title}function g(y){n("toggleLayer",y)}function b(y,f){const u=f.target;n("setOpacity",y,parseFloat(u.value))}return(y,f)=>(e.openBlock(),e.createElementBlock("fieldset",Fo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,u=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:"layer-item"},[S(u)?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!m(u),"layer-error":v(u.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:r(u.id),disabled:!m(u),onChange:L=>g(u.id)},null,40,Io),e.createElementVNode("span",Oo,[e.createTextVNode(e.toDisplayString(s(u))+" ",1),d(u.id)?(e.openBlock(),e.createElementBlock("span",Do," Loading... ")):e.createCommentVNode("",!0),v(u.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(u.id)||"Error",role:"status"}," Error ",8,Ro)):e.createCommentVNode("",!0),m(u)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Zo," (zoom in) "))])],2)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["layer-label-only",{"layer-unavailable":!m(u),"layer-error":v(u.id)}])},[e.createElementVNode("span",Ao,[e.createTextVNode(e.toDisplayString(s(u))+" ",1),d(u.id)?(e.openBlock(),e.createElementBlock("span",Uo," Loading... ")):e.createCommentVNode("",!0),v(u.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(u.id)||"Error",role:"status"}," Error ",8,Wo)):e.createCommentVNode("",!0),m(u)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",qo," (zoom in) "))])],2)),h(u)&&r(u.id)?(e.openBlock(),e.createElementBlock("div",jo,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+u.id}," Opacity: "+e.toDisplayString(Math.round(i(u.id)*100))+"% ",9,Go),e.createElementVNode("input",{id:"opacity-"+u.id,type:"range",min:"0",max:"1",step:"0.05",value:i(u.id),"aria-label":"Opacity for "+s(u),class:"opacity-slider",onInput:L=>b(u.id,L)},null,40,Ho)])):e.createCommentVNode("",!0),w(u)&&r(u.id)&&u.legend?.length?(e.openBlock(),e.createElementBlock("ul",Ko,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.legend,(L,V)=>(e.openBlock(),e.createElementBlock("li",{key:V,class:"legend-item"},[L.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:L.color}),"aria-hidden":"true"},null,4)):L.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:L.color,height:`${L.width||2}px`}),"aria-hidden":"true"},null,4)):L.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:L.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Jo,e.toDisplayString(L.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",Qo," No layers available ")):e.createCommentVNode("",!0)]))}}),Yo=he(Xo,[["__scopeId","data-v-d069e7e9"]]),en={class:"layer-radio-set",role:"radiogroup"},tn=["name","checked","disabled","onChange"],on={class:"layer-title"},nn={key:0,class:"loading-indicator",role:"status"},ln=["aria-label"],an={key:2,class:"zoom-indicator"},rn={key:0,class:"opacity-control"},sn=["for"],cn=["id","value","aria-label","onInput"],un={key:1,class:"layer-legend"},dn={class:"legend-label"},fn={key:0,class:"empty-state"},pn=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"}},emits:["selectLayer","setOpacity"],setup(t,{emit:a}){const o=t,n=a;function r(b){return o.visibleLayerIds.has(b)}function i(b){return o.layerOpacities[b]??1}function d(b){return o.loadingLayerIds.has(b)}function v(b){return o.layerErrors[b]||null}function m(b){const y=o.currentZoom,f=b.minZoom,u=b.maxZoom;return!(f!==void 0&&y<f||u!==void 0&&y>u)}function S(b){return o.showOpacity?b.displayOptions?.shouldShowSlider!==!1:!1}function h(b){return o.showLegend?b.displayOptions?.shouldShowLegendBox!==!1:!1}function w(b){return b.displayOptions?.layerNameChange||b.title}function s(b){const y=o.layers.filter(f=>o.visibleLayerIds.has(f.id)&&f.id!==b).map(f=>f.id);n("selectLayer",b,y)}function g(b,y){const f=y.target;n("setOpacity",b,parseFloat(f.value))}return(b,y)=>(e.openBlock(),e.createElementBlock("div",en,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,f=>(e.openBlock(),e.createElementBlock("div",{key:f.id,class:"layer-item"},[e.createElementVNode("label",{class:e.normalizeClass(["layer-radio",{"layer-unavailable":!m(f),"layer-error":v(f.id)}])},[e.createElementVNode("input",{type:"radio",name:t.groupName,checked:r(f.id),disabled:!m(f),onChange:u=>s(f.id)},null,40,tn),e.createElementVNode("span",on,[e.createTextVNode(e.toDisplayString(w(f))+" ",1),d(f.id)?(e.openBlock(),e.createElementBlock("span",nn," Loading... ")):e.createCommentVNode("",!0),v(f.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(f.id)||"Error",role:"status"}," Error ",8,ln)):e.createCommentVNode("",!0),m(f)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",an," (zoom in) "))])],2),S(f)&&r(f.id)?(e.openBlock(),e.createElementBlock("div",rn,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+f.id}," Opacity: "+e.toDisplayString(Math.round(i(f.id)*100))+"% ",9,sn),e.createElementVNode("input",{id:"opacity-"+f.id,type:"range",min:"0",max:"1",step:"0.05",value:i(f.id),"aria-label":"Opacity for "+w(f),class:"opacity-slider",onInput:u=>g(f.id,u)},null,40,cn)])):e.createCommentVNode("",!0),h(f)&&r(f.id)&&f.legend?.length?(e.openBlock(),e.createElementBlock("ul",un,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.legend,(u,L)=>(e.openBlock(),e.createElementBlock("li",{key:L,class:"legend-item"},[u.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:u.color}),"aria-hidden":"true"},null,4)):u.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:u.color,height:`${u.width||2}px`}),"aria-hidden":"true"},null,4)):u.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:u.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",dn,e.toDisplayString(u.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",fn," No layers available ")):e.createCommentVNode("",!0)]))}}),mn=he(pn,[["__scopeId","data-v-1a127b6c"]]);function yn(t){const a=e.ref([]),o=e.ref(new Set),n=e.ref({}),r=e.ref(new Set),i=e.ref({}),d=e.ref(""),v=e.ref(!1),m=e.ref(!1),S=e.ref(null),h=e.computed(()=>{if(!d.value.trim())return a.value;const N=d.value.toLowerCase();return a.value.filter(T=>T.title.toLowerCase().includes(N))}),w=e.computed(()=>a.value.map(N=>({config:N,component:N.type})));async function s(){if(!m.value){v.value=!0,S.value=null;try{let N;t.mode==="dynamic"||!t.mode?t.webMapId?N=await g(t.webMapId):N=await _e():N=await _e(),a.value=N;const T={};N.forEach(I=>{T[I.id]=I.opacity??1}),n.value=T,m.value=!0}catch(N){S.value=N instanceof Error?N:new Error("Failed to initialize layerboard")}finally{v.value=!1}}}async function g(N){const T=Me(N),I=await fetch(T);if(!I.ok)throw new Error(`Failed to fetch WebMap: ${I.status} ${I.statusText}`);const X=await I.json();return Ge(X)}function b(N){const T=new Set(o.value);T.has(N)?T.delete(N):T.add(N),o.value=T}function y(N,T){n.value={...n.value,[N]:Math.max(0,Math.min(1,T))}}function f(N){d.value=N}function u(N,T){const I=new Set(r.value);T?I.add(N):I.delete(N),r.value=I}function L(N,T){if(T)i.value={...i.value,[N]:T};else{const{[N]:I,...X}=i.value;i.value=X}}function V(){a.value=[],o.value=new Set,n.value={},r.value=new Set,i.value={},d.value="",v.value=!1,m.value=!1,S.value=null}return{layerConfigs:e.readonly(a),visibleLayers:e.readonly(o),layerOpacities:e.readonly(n),loadingLayers:e.readonly(r),layerErrors:e.readonly(i),searchQuery:e.readonly(d),isLoading:e.readonly(v),isInitialized:e.readonly(m),error:e.readonly(S),filteredLayerConfigs:h,layerList:w,config:t,initialize:s,toggleLayer:b,setLayerOpacity:y,filterLayers:f,setLayerLoading:u,setLayerError:L,reset:V}}function gn(){const t=e.ref([]),a=e.ref(new Set),o=e.ref(new Set);function n(i){a.value.has(i)?a.value.delete(i):a.value.add(i)}function r(i){t.value=i}return{layers:e.computed(()=>t.value),visibleLayerIds:e.computed(()=>a.value),loadingLayerIds:e.computed(()=>o.value),toggleLayer:n,setLayers:r}}function at(t){const a=e.ref(null),o=e.ref(!1),n=e.ref(null),r=e.ref(0);async function i(m={}){o.value=!0,n.value=null;const S=t.pageSize||2e3;let h=0,w=[],s=!0;try{for(;s;){const b=t.url.replace(/\/$/,""),y=encodeURIComponent(m.where||t.where||"1=1");let f=`${b}/query?where=${y}&outFields=*&returnGeometry=true&resultRecordCount=${S}&resultOffset=${h}&f=geojson`;if(m.bounds){const V=JSON.stringify({xmin:m.bounds.west,ymin:m.bounds.south,xmax:m.bounds.east,ymax:m.bounds.north,spatialReference:{wkid:4326}});f+=`&geometry=${encodeURIComponent(V)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects`}const u=await fetch(f);if(!u.ok)throw new Error(`HTTP ${u.status}: ${u.statusText}`);const L=await u.json();L.features&&L.features.length>0?(w=w.concat(L.features),h+=L.features.length,s=L.features.length===S):s=!1}const g={type:"FeatureCollection",features:w};return a.value=g,r.value=w.length,g}catch(g){const b=g instanceof Error?g:new Error("Failed to fetch features");throw n.value=b,b}finally{o.value=!1}}function d(){a.value=null,r.value=0,n.value=null}async function v(m={}){return i(m)}return{data:e.readonly(a),isLoading:e.readonly(o),error:e.readonly(n),totalFeatures:e.readonly(r),config:t,fetch:i,refetch:v,clear:d}}function hn(t,a,o){const n=at(t);return e.watch(a,async r=>{if(r){const i=o(r);await n.fetch(i)}},{immediate:!0}),n}exports.LayerCheckboxSet=Yo;exports.LayerPanel=tt;exports.LayerRadioButtonSet=mn;exports.Layerboard=$o;exports.MapPanel=et;exports.TopicAccordion=Mo;exports.WEBMAP_ID=po;exports.buildWebMapUrl=Me;exports.clearCache=nt;exports.getLayerConfigs=_e;exports.getWebMapUrl=mo;exports.transformWebMapToLayerConfigs=Ge;exports.useApiDataSources=lt;exports.useDataSource=at;exports.useLayerConfig=gn;exports.useLayerboard=yn;exports.useReactiveDataSource=hn;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),H=require("@phila/phila-ui-map-core"),Z=require("@phila/phila-ui-core");var me=typeof document<"u"?document.currentScript:null;function ze(t,a,o={}){const n={type:"Feature"};return(o.id===0||o.id)&&(n.id=o.id),o.bbox&&(n.bbox=o.bbox),n.properties=a||{},n.geometry=t,n}function rt(t,a,o={}){for(const r of t){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let i=0;i<r[r.length-1].length;i++)if(r[r.length-1][i]!==r[0][i])throw new Error("First and last Position are not equivalent.")}return ze({type:"Polygon",coordinates:t},a,o)}function it(t,a,o={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return ze({type:"LineString",coordinates:t},a,o)}function st(t,a,o={}){return ze({type:"MultiLineString",coordinates:t},a,o)}function ct(t,a,o={}){return ze({type:"MultiPolygon",coordinates:t},a,o)}function ut(t){return t.type==="Feature"?t.geometry:t}function dt(t,a,o){var n=t.length,r=ye(t[0],a),i=[],d,v,m;let S,h;for(o||(o=[]),d=1;d<n;d++){for(S=t[d-1],h=t[d],v=m=ye(h,a);;)if(r|v){if(r&v)break;r?(S=je(S,h,r,a),r=ye(S,a)):(h=je(S,h,v,a),v=ye(h,a))}else{i.push(S),v!==m?(i.push(h),d<n-1&&(o.push(i),i=[])):d===n-1&&i.push(h);break}r=m}return i.length&&o.push(i),o}function ft(t,a){var o,n,r,i,d,v,m;for(n=1;n<=8;n*=2){for(o=[],r=t[t.length-1],i=!(ye(r,a)&n),d=0;d<t.length;d++)v=t[d],m=!(ye(v,a)&n),m!==i&&o.push(je(r,v,n,a)),m&&o.push(v),r=v,i=m;if(t=o,!t.length)break}return o}function je(t,a,o,n){return o&8?[t[0]+(a[0]-t[0])*(n[3]-t[1])/(a[1]-t[1]),n[3]]:o&4?[t[0]+(a[0]-t[0])*(n[1]-t[1])/(a[1]-t[1]),n[1]]:o&2?[n[2],t[1]+(a[1]-t[1])*(n[2]-t[0])/(a[0]-t[0])]:o&1?[n[0],t[1]+(a[1]-t[1])*(n[0]-t[0])/(a[0]-t[0])]:null}function ye(t,a){var o=0;return t[0]<a[0]?o|=1:t[0]>a[2]&&(o|=2),t[1]<a[1]?o|=4:t[1]>a[3]&&(o|=8),o}function pt(t,a){const o=ut(t),n=o.type,r=t.type==="Feature"?t.properties:{};let i=o.coordinates;switch(n){case"LineString":case"MultiLineString":{const d=[];return n==="LineString"&&(i=[i]),i.forEach(v=>{dt(v,a,d)}),d.length===1?it(d[0],r):st(d,r)}case"Polygon":return rt(Ke(i,a),r);case"MultiPolygon":return ct(i.map(d=>Ke(d,a)),r);default:throw new Error("geometry "+n+" not supported")}}function Ke(t,a){const o=[];for(const n of t){const r=ft(n,a);r.length>0&&((r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1])&&r.push(r[0]),r.length>=4&&o.push(r))}return o}var mt=pt;const yt={class:"map-panel"},gt=e.defineComponent({__name:"MapPanel",props:{visibleLayers:{},layerOpacities:{},layerList:{},tiledLayers:{},visibleTiledLayers:{},tiledLayerOpacities:{},cyclomediaConfig:{},pictometryCredentials:{},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:{},initialCenter:{}},emits:["zoom","layerLoading","layerError"],setup(t,{emit:a}){const o=t,n=a,r=e.ref(null),i=e.ref(null),d=e.ref(0);function v(l){n("zoom",l),i.value&&(d.value=m(i.value))}function m(l){const p=l.getZoom(),B=l.getCenter().lat,E=559082264028e-3,x=B*Math.PI/180;return E*Math.cos(x)/Math.pow(2,p)}const S=e.ref({}),h=e.ref(null),w=e.ref(new Set),s=["fema-100-year-floodplain","fema-500-year-floodplain"];async function g(l,p,c,B){const E=encodeURIComponent(B||"1=1"),x=JSON.stringify({xmin:p.west,ymin:p.south,xmax:p.east,ymax:p.north,spatialReference:{wkid:4326}}),$=2e3;let M=0,F=[],U=!0;for(;U;){const O=`${l}/query?where=${E}&geometry=${encodeURIComponent(x)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&resultRecordCount=${$}&resultOffset=${M}&f=geojson`,_=await fetch(O);if(!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);const R=await _.json();R.features&&R.features.length>0?(F=F.concat(R.features),M+=R.features.length,U=R.features.length===$):U=!1}if(s.includes(c)){const O=[p.west,p.south,p.east,p.north];F=F.map(_=>{if(_.geometry&&(_.geometry.type==="Polygon"||_.geometry.type==="MultiPolygon"))try{return mt(_,O)}catch{return _}return _})}return{type:"FeatureCollection",features:F}}async function b(l,p){const c=p.map(async B=>{const E=o.layerList.find(x=>x.config.id===B)?.config;if(E){n("layerLoading",B,!0);try{const x=await g(E.url,l,B,E.where);S.value={...S.value,[B]:x},n("layerError",B,null)}catch(x){const $=x instanceof Error?x.message:"Failed to load";n("layerError",B,$)}finally{n("layerLoading",B,!1)}}});await Promise.all(c)}async function y(l){const p=[...o.visibleLayers];await b(l,p)}function f(l){h.value=l.bounds,y(l.bounds)}function u(l){i.value=l;const p=l.getBounds();h.value={west:p.getWest(),south:p.getSouth(),east:p.getEast(),north:p.getNorth()};const c=l.getZoom();n("zoom",c),d.value=m(l),y(h.value)}e.watch(()=>o.visibleLayers.size,async()=>{if(q.value.length>0&&se(),h.value){const l=new Set(o.visibleLayers),p=[...l].filter(c=>!w.value.has(c));w.value=new Set(l),p.length>0&&await b(h.value,p)}});function L(l){return o.visibleLayers.has(l)}function V(l){return!!S.value[l.id]}const N=e.computed(()=>o.layerList.filter(l=>l.config.type==="circle"&&L(l.config.id)&&V(l.config)).map(l=>l.config)),T=e.computed(()=>o.layerList.filter(l=>l.config.type==="fill"&&L(l.config.id)&&V(l.config)).map(l=>l.config)),I=e.computed(()=>o.layerList.filter(l=>l.config.type==="fill"&&l.config.outlinePaint&&L(l.config.id)&&V(l.config)).map(l=>l.config)),X=e.computed(()=>o.layerList.filter(l=>l.config.type==="line"&&L(l.config.id)&&V(l.config)).map(l=>l.config));function ue(l){return o.visibleTiledLayers?.has(l)??!1}function de(l){return o.tiledLayerOpacities?.[l]??1}function Fe(l){return`${l.replace(/\/$/,"")}/tile/{z}/{y}/{x}`}function Ie(l){return{type:"raster",tiles:[Fe(l.url)],tileSize:256,attribution:l.attribution||""}}const ve=e.ref({}),Se=e.ref(new Set);async function be(l){if(!Se.value.has(l.id)){Se.value.add(l.id);try{const p=l.url.replace(/\/$/,""),c=await fetch(`${p}?f=json`);if(!c.ok)return;const B=await c.json();let E=B.minScale||0,x=B.maxScale||0;if(B.layers&&B.layers.length>0)for(const $ of B.layers)$.maxScale&&$.maxScale>0&&(x===0||$.maxScale<x)&&(x=$.maxScale);x===0&&(x=72e3),ve.value={...ve.value,[l.id]:{minScale:E,maxScale:x}}}catch{}}}e.onMounted(()=>{if(o.tiledLayers)for(const l of o.tiledLayers)l.scaleBasedRendering&&be(l)});function Ee(l){if(!l.scaleBasedRendering)return"tiled";const p=ve.value[l.id];if(!p)return"tiled";const c=d.value;return c===0||c>p.maxScale?"tiled":"dynamic"}const Oe=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(l=>ue(l.id)?l.scaleBasedRendering?Ee(l)==="tiled":!0:!1):[]),De=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(l=>ue(l.id)&&l.scaleBasedRendering?Ee(l)==="dynamic":!1):[]);function fe(l){return{type:"raster",tiles:[`${l.url.replace(/\/$/,"")}/export?bbox={bbox-epsg-3857}&bboxSR=3857&imageSR=3857&size=256,256&format=png32&transparent=true&f=image`],tileSize:256,attribution:l.attribution||""}}function oe(l){return{type:"geojson",data:S.value[l.id]}}function pe(l){return o.layerOpacities[l]??1}function ne(l){const p=pe(l.id),c=l.type==="circle"?"circle-opacity":l.type==="fill"?"fill-opacity":"line-opacity";if(l.type==="fill"&&l.paint["fill-opacity"]===0)return{...l.paint,"fill-opacity":0};const B=l.type==="circle"?"circle-color":l.type==="fill"?"fill-color":"line-color",E={...l.paint},x=E[B],$=E[c]===1,M=typeof x=="string"&&x.startsWith("rgba(");if($&&M){if(p===1)return E;{const F=x.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(F&&F[4]){const[,U,O,_,R]=F,We=parseFloat(R)*p;E[B]=`rgba(${U}, ${O}, ${_}, ${We})`,E[c]=1}return E}}if(M){const F=x.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(F){const[,U,O,_]=F;E[B]=`rgb(${U}, ${O}, ${_})`}}return E[c]=p,E}function Re(l){const p=pe(l.id);return{...l.outlinePaint,"line-opacity":p}}const q=e.ref([]),le=e.ref(null),j=e.ref(0);function re(l){const p=l.replace(/-outline$/,"");return o.layerList.find(B=>B.config.id===p)?.config}function Ze(l,p){return l.replace(/\{([^}]+)\}/g,(c,B)=>{const E=p[B];return E==null?"":String(E)})}function ie(l){return l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ke(l,p){if(l==null)return"-";if(p?.dateFormat&&typeof l=="number"){const c=new Date(l);switch(p.dateFormat){case"shortDateShortTime":return c.toLocaleString();case"longMonthDayYear":return c.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"});case"shortDate":return c.toLocaleDateString();case"longDate":return c.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"});default:return c.toLocaleDateString()}}if(typeof l=="number"){if(l>1e12&&!p)return new Date(l).toLocaleDateString();const c=p?.places,B=p?.digitSeparator??!0;if(c!==void 0){const E=l.toFixed(c);if(B){const x=E.split("."),$=x[0]||"0",M=x[1],F=$.replace(/\B(?=(\d{3})+(?!\d))/g,",");return M?`${F}.${M}`:F}return E}return B?l.toLocaleString():String(l)}return String(l)}function Le(l){const p=new Set;return l.filter(c=>{const E=`${c.layer.id.replace(/-outline$/,"")}:${JSON.stringify(c.properties)}`;return p.has(E)?!1:(p.add(E),!0)})}function Be(l,p){const c=new Map;return p.forEach((B,E)=>{c.set(B.id,E)}),l.sort((B,E)=>{const x=B.layer.id.replace(/-outline$/,""),$=E.layer.id.replace(/-outline$/,""),M=c.get(x)??-1;return(c.get($)??-1)-M})}function G(l){const p=i.value;if(!p)return;const c=[];o.layerList.forEach(O=>{const _=O.config;o.visibleLayers.has(_.id)&&(c.push(_.id),_.outlinePaint&&c.push(`${_.id}-outline`))});const B=p.project([l.lngLat.lng,l.lngLat.lat]),E=p.queryRenderedFeatures(B,{layers:c});if(E.length===0)return;const x=Le(E),$=o.layerList.map(O=>O.config),M=Be(x,$),F=M.map(O=>{const _=O.layer.id.replace(/-outline$/,""),R=re(_);return R?{layerId:R.id,layerTitle:R.title,properties:O.properties||{},popupConfig:R.popup}:null}).filter(O=>O!==null);if(F.length===0)return;q.value=F,j.value=0,le.value=[l.lngLat.lng,l.lngLat.lat];const U=M[0];if(U&&U.geometry){const O=U.layer.id.replace(/-outline$/,""),_=re(O);if(_){const R=Ve(U.geometry),We=we(_.id,_.type);Q.value={geometry:U.geometry,geometryType:R,layerId:_.id,properties:U.properties||{},originalStyle:We}}}}function se(){q.value=[],le.value=null,j.value=0,Q.value=null}function K(l){if(q.value.length===0)return;const p=l.target;if(!(p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable))switch(l.key){case"ArrowLeft":case"ArrowUp":l.preventDefault(),ce();break;case"ArrowRight":case"ArrowDown":l.preventDefault(),xe();break;case"Escape":l.preventDefault(),se();break}}e.onMounted(()=>{window.addEventListener("keydown",K)}),e.onUnmounted(()=>{window.removeEventListener("keydown",K)});function xe(){const l=q.value.length;l<=1||(j.value=(j.value+1)%l)}function ce(){const l=q.value.length;l<=1||(j.value=(j.value-1+l)%l)}const A=e.computed(()=>q.value.length===0?null:q.value[j.value]),Ne=e.computed(()=>{const l=A.value;return!l||!l.popupConfig?l?.layerTitle||"":Ze(l.popupConfig.title,l.properties)}),Y=e.computed(()=>{const l=A.value;if(!l)return"";let p='<div class="popup-content">';if(p+=`<h3 class="popup-title">${ie(Ne.value)}</h3>`,l.popupConfig?.fields?.length){p+=`<table class="popup-table" aria-label="${ie(Ne.value)}">`;for(const c of l.popupConfig.fields){const B=ke(l.properties[c.field],c.format);p+=`<tr><th scope="row">${ie(c.label)}</th><td>${ie(B)}</td></tr>`}p+="</table>"}else p+='<p class="popup-no-fields">No additional information available.</p>';return p+="</div>",p}),ae=e.ref({type:"FeatureCollection",features:[]}),ee=e.ref({type:"FeatureCollection",features:[]}),J={"circle-radius":["get","highlightRadius"],"circle-color":"#00FFFF","circle-opacity":.8,"circle-stroke-width":2,"circle-stroke-color":"#FFFFFF"},Ae={"line-width":["get","highlightWidth"],"line-color":"#00FFFF","line-opacity":.9},Q=e.ref(null);function Ve(l){return l.type}function we(l,p){const c=re(l);if(!c)return{radius:5,width:2};const B=c.paint||{};if(p==="circle"){const E=B["circle-radius"];return typeof E=="number"?{radius:E}:{radius:5}}if(p==="line"||p==="fill"){const E=B["line-width"];if(typeof E=="number")return{width:E};if(c.outlinePaint&&c.outlinePaint["line-width"]){const x=c.outlinePaint["line-width"];if(typeof x=="number")return{width:x}}return{width:2}}return{radius:5,width:2}}function k(l){return!l||l.length===0?[]:l[0]??[]}function C(l){const{geometry:p,geometryType:c,originalStyle:B}=l;if(c==="Point"||c==="MultiPoint"){const x=(B.radius||5)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:p,properties:{highlightRadius:x}}]}}if(c==="LineString"||c==="MultiLineString"){const x=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:p,properties:{highlightWidth:x}}]}}if(c==="Polygon"){const E=p.coordinates,x=k(E),M=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:x},properties:{highlightWidth:M}}]}}if(c==="MultiPolygon"){const E=p.coordinates,$=(B.width||2)+3;return{type:"FeatureCollection",features:E.map(F=>({type:"Feature",geometry:{type:"LineString",coordinates:k(F)},properties:{highlightWidth:$}}))}}return{type:"FeatureCollection",features:[]}}function D(l){if(!l){z();return}const p=C(l);l.geometryType==="Point"||l.geometryType==="MultiPoint"?(ae.value=p,ee.value={type:"FeatureCollection",features:[]}):(ee.value=p,ae.value={type:"FeatureCollection",features:[]})}function z(){ae.value={type:"FeatureCollection",features:[]},ee.value={type:"FeatureCollection",features:[]}}e.watch(Q,l=>{D(l)}),e.watch(()=>o.visibleLayers,l=>{Q.value&&!l.has(Q.value.layerId)&&(Q.value=null,se())},{deep:!0}),e.watch(j,()=>{const l=A.value;if(!l){Q.value=null;return}const p=i.value;if(!p||!le.value)return;const c=[];o.layerList.forEach($=>{const M=$.config;o.visibleLayers.has(M.id)&&(c.push(M.id),M.outlinePaint&&c.push(`${M.id}-outline`))});const B=p.project(le.value),x=p.queryRenderedFeatures(B,{layers:c}).find($=>$.layer.id.replace(/-outline$/,"")===l.layerId&&JSON.stringify($.properties)===JSON.stringify(l.properties));if(x&&x.geometry){const $=re(l.layerId);if($){const M=Ve(x.geometry),F=we($.id,$.type);Q.value={geometry:x.geometry,geometryType:M,layerId:$.id,properties:x.properties||{},originalStyle:F}}}});const W=e.ref(null);function Ue(l){const[p,c]=l.geometry.coordinates;W.value=[p,c]}return(l,p)=>(e.openBlock(),e.createElementBlock("div",yt,[e.createVNode(e.unref(H.Map),{ref_key:"mapRef",ref:r,zoom:o.initialZoom,center:o.initialCenter,"navigation-controls":{position:o.navigationControlPosition},"geolocation-control":{position:o.geolocationControlPosition},"basemap-change-controls":{toggle:!0,dropdown:!0,position:o.basemapControlPosition},"map-search-control":{position:o.searchControlPosition},"enable-cyclomedia":!0,"cyclomedia-config":o.cyclomediaConfig,"cyclomedia-button-position":o.cyclomediaButtonPosition,"enable-pictometry":!0,"pictometry-credentials":o.pictometryCredentials,"pictometry-button-position":o.pictometryButtonPosition,"tool-panel-layout":"vertical","tool-panel-split-ratio":50,onZoom:v,onClick:se,onMoveend:f,onLoad:u,onSearchResult:Ue},{default:e.withCtx(()=>[o.drawControlPosition!==null?(e.openBlock(),e.createBlock(e.unref(H.DrawTool),{key:0,position:o.drawControlPosition},null,8,["position"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Oe.value,c=>(e.openBlock(),e.createBlock(e.unref(H.RasterLayer),{key:"tiled-"+c.id,id:"tiled-"+c.id,source:Ie(c),paint:{"raster-opacity":de(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(De.value,c=>(e.openBlock(),e.createBlock(e.unref(H.RasterLayer),{key:"dynamic-"+c.id,id:"dynamic-"+c.id,source:fe(c),paint:{"raster-opacity":de(c.id)},minzoom:c.minZoom,maxzoom:c.maxZoom},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,c=>(e.openBlock(),e.createBlock(e.unref(H.CircleLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(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(T.value,c=>(e.openBlock(),e.createBlock(e.unref(H.FillLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(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(I.value,c=>(e.openBlock(),e.createBlock(e.unref(H.LineLayer),{key:c.id+"-outline",id:c.id+"-outline",source:oe(c),paint:Re(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(X.value,c=>(e.openBlock(),e.createBlock(e.unref(H.LineLayer),{key:c.id,id:c.id,source:oe(c),paint:ne(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(H.CircleLayer),{key:"highlight-circles-layer",id:"highlight-circles",source:{type:"geojson",data:ae.value},paint:J},null,8,["source"]),e.createVNode(e.unref(H.LineLayer),{key:"highlight-lines-layer",id:"highlight-lines",source:{type:"geojson",data:ee.value},paint:Ae},null,8,["source"]),e.createVNode(e.unref(H.MapMarker),{"lng-lat":W.value,color:"#2176d2"},null,8,["lng-lat"]),A.value&&le.value?(e.openBlock(),e.createBlock(e.unref(H.MapPopup),{key:1,"lng-lat":le.value,html:Y.value,"close-on-click":!1,"show-navigation":q.value.length>1,"current-feature-index":j.value,"total-features":q.value.length,"layer-name":A.value.layerTitle,onClose:se,onNext:xe,onPrevious:ce},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"])]))}}),he=(t,a)=>{const o=t.__vccOpts||t;for(const[n,r]of a)o[n]=r;return o},et=he(gt,[["__scopeId","data-v-669444d6"]]),ht=["disabled"],vt=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,o=d=>"href"in d&&d.href!==void 0||"to"in d&&d.to!==void 0,n=e.computed(()=>Z.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)),r=e.computed(()=>o(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,v)=>o(a)?(e.openBlock(),e.createBlock(e.unref(Z.BaseLink),e.mergeProps({key:0},{...r.value,...d.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(Z.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(Z.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,ht))}});var bt={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"]},kt=bt,Lt={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"]},wt=Lt;const Ct=["for"],St={class:"state-layer"},Et={class:"content"},Bt={class:"input-text-container"},xt=["id","placeholder"],Nt={key:1,class:"has-text-body-small phila-supporting-text"},Vt={key:2,class:"has-text-body-small phila-error-text"},$t=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 o=e.useAttrs(),n=t,r=e.computed(()=>typeof n.error=="string"?n.error:n.error[0]),i=e.toRef(n,"id"),d=a,v=e.ref(""),m=e.computed({get:()=>n.modelValue!==void 0?n.modelValue:v.value,set:g=>{d("update:modelValue",g),v.value=g}}),S=e.computed(()=>{const g=["default-class"];return o.disabled!=null&&g.push("phila-input--disabled"),r.value&&g.push("phila-input--error"),o.required!=null&&g.push("phila-input--required"),Z.cn(...g)}),h=e.computed(()=>{const g=[];return m.value!==""&&g.push("phila-text-field--filled"),n.className&&g.push(n.className),Z.cn(...g)}),w=e.ref(null),s=g=>{g.target.closest("button")||w.value?.focus()};return(g,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["phila-input",S.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,Ct)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["phila-text-field",h.value]),onClick:s},[e.createElementVNode("div",St,[n.leadingIcon?(e.openBlock(),e.createBlock(e.unref(Z.Icon),{key:0,"icon-class":n.leadingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.createElementVNode("div",Et,[e.createElementVNode("div",Bt,[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:i.value,ref_key:"inputRef",ref:w,"onUpdate:modelValue":b[0]||(b[0]=y=>m.value=y),class:"phila-text-field-input has-text-body-default",placeholder:n.placeholder},e.unref(o)),null,16,xt),[[e.vModelDynamic,m.value]])])]),m.value!=""?(e.openBlock(),e.createBlock(e.unref(vt),{key:1,variant:"standard",size:"small","icon-only":"","icon-definition":e.unref(wt),onClick:b[1]||(b[1]=y=>m.value="")},null,8,["icon-definition"])):e.createCommentVNode("",!0),n.trailingIcon?(e.openBlock(),e.createBlock(e.unref(Z.Icon),{key:2,size:"small","icon-class":n.trailingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.renderSlot(g.$slots,"trailing-action")])],2),n.supportingText?(e.openBlock(),e.createElementBlock("div",Nt,e.toDisplayString(n.supportingText),1)):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createElementBlock("div",Vt,[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(kt),size:"small",inline:"",decorative:""},null,8,["icon-definition"]),e.createTextVNode(" "+e.toDisplayString(r.value),1)])):e.createCommentVNode("",!0)],2))}});var Pt={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"]},_t={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"]},zt={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"]},Je={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"]},Tt={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"]},Mt={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 Ft={class:"layer-panel"},It={key:0,class:"search-box"},Ot={key:1,class:"topics-container"},Dt={class:"layer-row"},Rt=["href","aria-label"],Zt={key:1,class:"metadata-placeholder"},At=["checked","disabled","onChange"],Ut={class:"layer-title"},Wt={key:0,class:"loading-indicator",role:"status"},qt=["aria-label"],jt={key:2,class:"zoom-indicator"},Gt={key:0,class:"opacity-control"},Ht=["for"],Kt=["id","value","aria-label","onInput"],Jt=["aria-label"],Qt={class:"legend-label"},Xt={key:0,class:"no-results"},Yt=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 o=t,n=a,r=e.computed(()=>{if(!o.searchQuery.trim())return o.layerList;const f=o.searchQuery.toLowerCase();return o.layerList.filter(u=>u.config.title.toLowerCase().includes(f))});function i(f){let u=f.split("?")[0]||f;return u=u.replace(/\/query$/,""),u=u.replace(/\/$/,""),u.toLowerCase()}function d(f){const u=i(f);return o.layerMetadata[u]||null}const v=e.computed(()=>o.layerList.some(f=>d(f.config.url)));function m(f){return o.visibleLayers.has(f)}function S(f){return o.layerOpacities[f]??1}function h(f){return o.loadingLayers.has(f)}function w(f){return o.layerErrors[f]||null}function s(f){const u=o.currentZoom,L=f.minZoom,V=f.maxZoom;return!(L!==void 0&&u<L||V!==void 0&&u>V)}const g=e.computed({get:()=>o.searchQuery,set:f=>n("updateSearch",f)});function b(f){n("toggleLayer",f)}function y(f,u){const L=u.target,V=parseFloat(L.value);n("setOpacity",f,V)}return(f,u)=>(e.openBlock(),e.createElementBlock("div",Ft,[t.showSearch?(e.openBlock(),e.createElementBlock("div",It,[e.createVNode(e.unref($t),{modelValue:g.value,"onUpdate:modelValue":u[0]||(u[0]=L=>g.value=L),placeholder:t.searchPlaceholder,"class-name":"layer-search-field"},{"trailing-action":e.withCtx(()=>[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Pt),size:"small",inline:"",decorative:""},null,8,["icon-definition"])]),_:1},8,["modelValue","placeholder"])])):e.createCommentVNode("",!0),t.mode==="topics"?(e.openBlock(),e.createElementBlock("div",Ot,[e.renderSlot(f.$slots,"topics",{},()=>[u[2]||(u[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":v.value}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,L=>(e.openBlock(),e.createElementBlock("div",{key:L.config.id,class:"layer-item"},[e.createElementVNode("div",Dt,[d(L.config.url)?(e.openBlock(),e.createElementBlock("a",{key:0,href:d(L.config.url)||"",target:"_blank",rel:"noopener noreferrer",class:"metadata-link","aria-label":"View metadata for "+L.config.title,onClick:u[1]||(u[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Mt),size:"small",inline:"",decorative:""},null,8,["icon-definition"])],8,Rt)):v.value?(e.openBlock(),e.createElementBlock("span",Zt)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!s(L.config),"layer-error":w(L.config.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:m(L.config.id),disabled:!s(L.config),onChange:V=>b(L.config.id)},null,40,At),e.createElementVNode("span",Ut,[e.createTextVNode(e.toDisplayString(L.config.title)+" ",1),h(L.config.id)?(e.openBlock(),e.createElementBlock("span",Wt," Loading... ")):e.createCommentVNode("",!0),w(L.config.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":w(L.config.id)||"Error",role:"status"}," Error ",8,qt)):e.createCommentVNode("",!0),s(L.config)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",jt," (zoom in) "))])],2)]),t.showOpacity&&m(L.config.id)?(e.openBlock(),e.createElementBlock("div",Gt,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+L.config.id}," Opacity: "+e.toDisplayString(Math.round(S(L.config.id)*100))+"% ",9,Ht),e.createElementVNode("input",{id:"opacity-"+L.config.id,type:"range",min:"0",max:"1",step:"0.05",value:S(L.config.id),"aria-label":"Opacity for "+L.config.title,class:"opacity-slider",onInput:V=>y(L.config.id,V)},null,40,Kt)])):e.createCommentVNode("",!0),t.showLegend&&m(L.config.id)&&L.config.legend?.length?(e.openBlock(),e.createElementBlock("ul",{key:1,class:"layer-legend","aria-label":"Legend for "+L.config.title},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.config.legend,(V,N)=>(e.openBlock(),e.createElementBlock("li",{key:N,class:"legend-item"},[V.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:V.color}),"aria-hidden":"true"},null,4)):V.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:V.color,height:`${V.width||2}px`}),"aria-hidden":"true"},null,4)):V.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:V.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Qt,e.toDisplayString(V.label),1)]))),128))],8,Jt)):e.createCommentVNode("",!0)]))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("div",Xt,' No layers match "'+e.toDisplayString(t.searchQuery)+'" ',1)):e.createCommentVNode("",!0)],2))]))}}),tt=he(Yt,[["__scopeId","data-v-a0dcf4f0"]]);function P(t){if(!t||!Array.isArray(t)||t.length<3)return"#888888";const a=t[0],o=t[1],n=t[2],i=(t[3]??255)/255;return i===1?`#${a.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`:`rgba(${a}, ${o}, ${n}, ${i.toFixed(2)})`}function te(t){return t!==void 0?t:1}const eo=559082264;function Qe(t){return!t||t<=0?null:Math.round(Math.log2(eo/t)*100)/100}function to(t,a){const o={};if(t&&t>0){const n=Qe(t);n!==null&&(o.minZoom=n)}if(a&&a>0){const n=Qe(a);n!==null&&(o.maxZoom=n)}return o}function Te(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 ge(t){return!(!t||t.style==="esriSLSNull"||t.color===null||t.width===0||t.color&&t.color[3]===0)}function qe(t){return String(t)}function ot(t,a,o){const n=t.symbol,r=Te(n);let i={},d=[],v=null;if(r==="fill"&&n){const m=n.color===null?0:n.color?.[3]??255,S=m===0?"rgba(0, 0, 0, 0)":P(n.color),h=m===0?0:m<255?1:te(a);if(i={"fill-color":S,"fill-opacity":h},ge(n.outline)){const w=n.outline.width||1,s=P(n.outline.color);m!==0&&(i["fill-outline-color"]=s),(w>1||m===0)&&(v={"line-color":s,"line-width":w})}d=[{type:"fill",color:P(n.color),label:t.label||"Feature"}]}else if(r==="line"&&n)i={"line-color":P(n.color),"line-width":n.width||1,"line-opacity":te(a)},d=[{type:"line",color:P(n.color),width:n.width||1,label:t.label||"Feature"}];else if(r==="circle"&&n){const m=Math.round((n.size||6)*.71*100)/100;i={"circle-color":P(n.color),"circle-radius":m,"circle-opacity":te(a)},ge(n.outline)&&(i["circle-stroke-color"]=P(n.outline.color),i["circle-stroke-width"]=n.outline.width||1),d=[{type:"circle",color:P(n.color),label:t.label||"Feature"}]}return{paint:i,legend:d,geomType:r,outlinePaint:v}}function oo(t,a,o){const n=t.field1,r=t.uniqueValueInfos||[],i=t.defaultSymbol;if(r.length===0)return ot({...t,symbol:i},a);const d=r[0]?.symbol||i,v=Te(d);let m={},S=[],h=null;if(v==="fill"){const w=["match",["to-string",["get",n]]];for(const s of r){w.push(qe(s.value)),w.push(P(s.symbol?.color));const g=String(s.value),y=o?.get(g)||s.label||g;S.push({type:"fill",color:P(s.symbol?.color),label:y})}if(w.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"fill-color":w,"fill-opacity":te(a)},ge(d?.outline)){const s=d.outline.width||1,g=P(d.outline.color);m["fill-outline-color"]=g,s>1&&(h={"line-color":g,"line-width":s})}}else if(v==="line"){const w=["match",["to-string",["get",n]]];for(const s of r){w.push(qe(s.value)),w.push(P(s.symbol?.color));const g=String(s.value),y=o?.get(g)||s.label||g;S.push({type:"line",color:P(s.symbol?.color),width:s.symbol?.width||1,label:y})}w.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"line-color":w,"line-width":d?.width||2,"line-opacity":te(a)}}else if(v==="circle"){const w=["match",["to-string",["get",n]]];for(const g of r){w.push(qe(g.value)),w.push(P(g.symbol?.color));const b=String(g.value),f=o?.get(b)||g.label||b;S.push({type:"circle",color:P(g.symbol?.color),label:f})}w.push(i?P(i.color):"rgba(0, 0, 0, 0)");const s=Math.round((d?.size||6)*.71*100)/100;m={"circle-color":w,"circle-radius":s,"circle-opacity":te(a)},ge(d?.outline)&&(m["circle-stroke-color"]=P(d.outline.color),m["circle-stroke-width"]=d.outline.width||1)}return{paint:m,legend:S,geomType:v,outlinePaint:h}}function no(t,a){const o=t.field,n=t.classBreakInfos||[],r=t.visualVariables?.find(h=>h.type==="colorInfo");if(r?.stops&&r.stops.length>0)return lo(r,o,t,a);if(n.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=n[0]?.symbol,d=Te(i);let v={},m=[],S=null;if(d==="fill"){const h=["step",["get",o]];h.push(P(n[0]?.symbol?.color));for(let w=0;w<n.length;w++){const s=n[w];w>0&&(h.push(n[w-1].classMaxValue),h.push(P(s.symbol?.color))),m.push({type:"fill",color:P(s.symbol?.color),label:s.label||`${s.classMaxValue}`})}if(v={"fill-color":h,"fill-opacity":te(a)},ge(i?.outline)){const w=i.outline.width||1,s=P(i.outline.color);v["fill-outline-color"]=s,w>1&&(S={"line-color":s,"line-width":w})}}else if(d==="line"){const h=["step",["get",o]];h.push(P(n[0]?.symbol?.color));let w=t.minValue??0;for(let g=0;g<n.length;g++){const b=n[g];g>0&&(h.push(n[g-1].classMaxValue),h.push(P(b.symbol?.color))),m.push({type:"line",color:P(b.symbol?.color),width:b.symbol?.width||i?.width||2,label:b.label||`${w} - ${b.classMaxValue}`}),w=b.classMaxValue+1}const s=i?.width||2;v={"line-color":h,"line-width":s,"line-opacity":te(a)}}return{paint:v,legend:m,geomType:d,outlinePaint:S}}function lo(t,a,o,n){const r=t.stops||[];if(r.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=o.classBreakInfos?.[0]?.symbol||o.defaultSymbol,d=Te(i);let v={},m=[],S=null;if(d==="fill"){const h=["interpolate",["linear"],["get",a]];for(const s of r)h.push(s.value),h.push(P(s.color)),m.push({type:"fill",color:P(s.color),label:s.label||`${s.value}`});if(v={"fill-color":["case",["==",["get",a],null],"rgba(0, 0, 0, 0)",h],"fill-opacity":te(n)},ge(i?.outline)){const s=i.outline.width||1,g=P(i.outline.color);v["fill-outline-color"]=g,s>1&&(S={"line-color":g,"line-width":s})}}return{paint:v,legend:m,geomType:d,outlinePaint:S}}function ao(t,a,o,n){if(!t?.renderer)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const r=t.renderer;switch(r.type){case"simple":return ot(r,a);case"uniqueValue":return oo(r,a,o);case"classBreaks":return no(r,a);default:return{paint:{},legend:[],geomType:"fill",outlinePaint:null}}}function ro(t){if(!t)return null;const a=t.title||"",n=(t.fieldInfos||[]).filter(r=>r.visible===!0).map(r=>{const i={field:r.fieldName,label:r.label||r.fieldName};return r.format&&(i.format={},r.format.dateFormat&&(i.format.dateFormat=r.format.dateFormat),r.format.digitSeparator!==void 0&&(i.format.digitSeparator=r.format.digitSeparator),r.format.places!==void 0&&(i.format.places=r.format.places),Object.keys(i.format).length===0&&delete i.format),i});return{title:a,fields:n}}function io(t){return t?.definitionExpression}function so(t){return(t.includes("_")?t.split("_").slice(1).join(" "):t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function co(t){return t.includes("_")?t.split("_").slice(1).join(" "):t}function uo(t){const a=new Map;if(!t)return a;const o=t.split(`
2
+ `),n=/^(\d{1,3})\s+(.+)$/;for(const r of o){const i=r.trim().match(n);if(i){const[,d,v]=i;d&&v&&a.set(d,v.trim())}}return a}async function fo(t){try{const a=await fetch(`${t}?f=json`);if(!a.ok)return null;const o=await a.json();return o.drawingInfo?{drawingInfo:o.drawingInfo,description:o.description}:null}catch{return null}}async function Ge(t){const a=t.operationalLayers||[],o=[],n=["Zoning and Planning_Land Use"];for(const r of a)if(r.url&&r.itemId!=="4f39b829b96d437da9231727d9c91fab")try{let i=r.layerDefinition?.drawingInfo,d;const v=!i||!i.renderer,m=n.includes(r.title);if((v||m)&&r.url){const N=await fo(r.url);N&&(i=N.drawingInfo,N.description&&(d=uo(N.description),d.size>0))}const{paint:S,legend:h,geomType:w,outlinePaint:s}=ao(i,r.opacity,d,r.title),g=ro(r.popupInfo),b=io(r.layerDefinition),y=to(r.layerDefinition?.minScale,r.layerDefinition?.maxScale),f=so(r.title),u=co(r.title);let L=r.opacity??1;const V={id:f,title:u,type:w,url:r.url,opacity:L,paint:S,legend:h,popup:g};b&&(V.where=b),y.minZoom!==void 0&&(V.minZoom=y.minZoom),y.maxZoom!==void 0&&(V.maxZoom=y.maxZoom),s&&(V.outlinePaint=s),o.push(V)}catch{}return o.sort((r,i)=>r.title.localeCompare(i.title)),o}const Xe={},He="376af635c84643cd816a8c5d017a53aa",po=He;function Me(t,a){let o=`https://www.arcgis.com/sharing/rest/content/items/${t}/data?f=json`;return a&&(o+=`&token=${a}`),o}function mo(){return Me(He)}const Pe=new Map,Ce=new Map;function nt(t){t?(Pe.delete(t),Ce.delete(t)):(Pe.clear(),Ce.clear())}let $e,Ye=0;async function yo(){const t=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:me&&me.tagName.toUpperCase()==="SCRIPT"&&me.src||new URL("index.js",document.baseURI).href}<"u"&&Xe?.VITE_AGO_USERNAME,a=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:me&&me.tagName.toUpperCase()==="SCRIPT"&&me.src||new URL("index.js",document.baseURI).href}<"u"&&Xe?.VITE_AGO_PASSWORD;if(!(!t||!a)){if($e&&Date.now()<Ye-3e5)return $e;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:($e=n.token,Ye=n.expires,$e)}catch{return}}}async function go(t,a){const o=Me(t,a),n=await fetch(o);if(!n.ok)throw new Error(`Failed to fetch WebMap: ${n.status} ${n.statusText}`);const r=await n.json();if(r.error)throw new Error(`ArcGIS error: ${r.error.message||r.error.code||"Unknown error"}`);return r}async function ho(t){try{const a=await yo(),o=await go(t,a);return await Ge(o)}catch(a){throw new Error(`Failed to load dynamic layer configs: ${a instanceof Error?a.message:"Unknown error"}`)}}async function _e(t=He){const a=Pe.get(t);if(a)return a;const o=Ce.get(t);if(o)return o;const n=(async()=>{try{const r=await ho(t);return Pe.set(t,r),r}finally{Ce.delete(t)}})();return Ce.set(t,n),n}function lt(t){const a=e.ref({}),o=new Map;for(const s of t)a.value[s.id]={data:null,loading:!1,error:null,lastFetched:null};async function n(s){const g=s.id;a.value={...a.value,[g]:{data:a.value[g]?.data??null,lastFetched:a.value[g]?.lastFetched??null,loading:!0,error:null}};try{let b;if(s.type==="http-get"){const y=await fetch(s.url,{method:"GET",...s.options});if(!y.ok)throw new Error(`HTTP ${y.status}: ${y.statusText}`);b=await y.json()}else if(s.type==="http-post"){const y=await fetch(s.url,{method:"POST",...s.options});if(!y.ok)throw new Error(`HTTP ${y.status}: ${y.statusText}`);b=await y.json()}else if(s.type==="esri"){const f=`${s.url.replace(/\/$/,"")}/query?where=1%3D1&outFields=*&returnGeometry=false&f=json`,u=await fetch(f,s.options);if(!u.ok)throw new Error(`HTTP ${u.status}: ${u.statusText}`);b=(await u.json()).features?.map(V=>V.attributes)||[]}else throw new Error(`Unknown data source type: ${s.type}`);s.transform&&(b=s.transform(b)),a.value={...a.value,[g]:{data:b,loading:!1,error:null,lastFetched:Date.now()}}}catch(b){const y=b instanceof Error?b.message:"Unknown error";a.value={...a.value,[g]:{data:a.value[g]?.data??null,lastFetched:a.value[g]?.lastFetched??null,loading:!1,error:y}}}}async function r(){await Promise.all(t.map(s=>n(s)))}async function i(s){const g=t.find(b=>b.id===s);g&&await n(g)}function d(s){return a.value[s]?.data??null}const v=e.computed(()=>Object.values(a.value).some(s=>s.loading));function m(s){return a.value[s]?.loading??!1}function S(s){return a.value[s]?.error??null}function h(){for(const s of t)if(s.pollInterval&&s.pollInterval>0){const g=window.setInterval(()=>{n(s)},s.pollInterval);o.set(s.id,g)}}function w(){for(const[,s]of o)window.clearInterval(s);o.clear()}return e.onMounted(()=>{r(),h()}),e.onUnmounted(()=>{w()}),{state:e.readonly(a),isLoading:v,fetchAll:r,refetch:i,getData:d,isSourceLoading:m,getError:S,stopPolling:w}}const vo={class:"layerboard-layout"},bo=["aria-expanded"],ko={key:0,class:"layerboard-subtitle"},Lo={class:"layerboard-mobile-menu-content"},wo={class:"layerboard-main"},Co={key:0,class:"layerboard-loading",role:"status","aria-live":"polite"},So={key:1,class:"layerboard-error",role:"alert"},Eo=["aria-expanded","aria-label"],Bo={key:0},xo={key:1},No={class:"sr-only","aria-live":"polite"},Vo=e.defineComponent({__name:"Layerboard",props:{title:{},subtitle:{},webMapId:{},themeColor:{default:"#0f4d90"},cyclomediaConfig:{},pictometryCredentials:{},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:()=>({})},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:{},initialCenter:{}},emits:["configs-loaded","load-error","zoom"],setup(t,{expose:a,emit:o}){const n=t,r=o,i=e.ref([]),d=e.ref(!0),v=e.ref(null),m=e.ref(12),S=e.ref(""),h=e.ref(new Set),w=e.ref({}),s=e.ref(new Set),g=e.ref({}),b=e.ref({}),y=e.ref(new Set),f=e.ref({});function u(){const k={};for(const C of n.tiledLayers)k[C.id]=C.opacity??1;f.value=k}function L(k){y.value.has(k)?y.value.delete(k):y.value.add(k),y.value=new Set(y.value)}function V(k,C){C?y.value.add(k):y.value.delete(k),y.value=new Set(y.value)}function N(k,C){f.value={...f.value,[k]:C}}const T=n.dataSources.length>0?lt(n.dataSources):null,I=e.computed(()=>T?.state.value??{}),X=e.computed(()=>T?.isLoading.value??!1);function ue(k){return T?.getData(k)??null}function de(k){return T?.refetch(k)??Promise.resolve()}e.provide("layerboard-layers",e.readonly(i)),e.provide("layerboard-visible",h),e.provide("layerboard-opacities",w),e.provide("layerboard-loading",e.readonly(s)),e.provide("layerboard-errors",e.readonly(g)),e.provide("layerboard-zoom",e.readonly(m)),e.provide("layerboard-toggle-layer",fe),e.provide("layerboard-set-layer-visible",oe),e.provide("layerboard-set-layers-visible",pe),e.provide("layerboard-set-opacity",ne),e.provide("layerboard-tiled-layers",e.readonly(e.computed(()=>n.tiledLayers))),e.provide("layerboard-visible-tiled",y),e.provide("layerboard-tiled-opacities",f),e.provide("layerboard-toggle-tiled",L),e.provide("layerboard-set-tiled-opacity",N),e.provide("layerboard-set-tiled-visible",V),e.provide("layerboard-data-sources-state",I),e.provide("layerboard-data-sources-loading",X),e.provide("layerboard-get-data-source",ue),e.provide("layerboard-refetch-data-source",de);const Fe=e.computed(()=>({backgroundColor:n.themeColor})),Ie=e.computed(()=>({backgroundColor:n.themeColor})),ve=e.computed(()=>({backgroundColor:n.themeColor})),Se=e.computed(()=>({width:A.value?"0":n.sidebarWidth}));async function be(){try{d.value=!0,v.value=null;const C=(await _e(n.webMapId)).map(z=>{const W=n.layerStyleOverrides[z.id];return W?{...z,paint:W.paint??z.paint,outlinePaint:W.outlinePaint??z.outlinePaint,legend:W.legend??z.legend,type:W.type??z.type}:z});i.value=C.map(z=>({config:z,component:z.type}));const D={};C.forEach(z=>{D[z.id]=z.opacity??1}),w.value=D,r("configs-loaded",C)}catch(k){const C=k instanceof Error?k.message:"Failed to load layer configurations";v.value=C,r("load-error",C)}finally{d.value=!1}}function Ee(k){let C=k.split("?")[0]||k;return C=C.replace(/\/query$/,""),C=C.replace(/\/$/,""),C.toLowerCase()}async function Oe(){if(n.fetchMetadata)try{const k="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(k);if(!C.ok)return;const D=await C.json(),z={};for(const W of D.rows||[])if(W.url_text&&W.representation){const Ue=Ee(W.url_text),l=`https://metadata.phila.gov/#home/representationdetails/${W.representation}/`;z[Ue]=l}b.value=z}catch{}}function De(k){m.value=k,r("zoom",k)}function fe(k){h.value.has(k)?h.value.delete(k):h.value.add(k),h.value=new Set(h.value)}function oe(k,C){C?h.value.add(k):h.value.delete(k),h.value=new Set(h.value)}function pe(k,C){for(const D of k)C?h.value.add(D):h.value.delete(D);h.value=new Set(h.value)}function ne(k,C){w.value={...w.value,[k]:C}}function Re(k,C){C?s.value.add(k):s.value.delete(k),s.value=new Set(s.value)}function q(k,C){if(C)g.value={...g.value,[k]:C};else{const{[k]:D,...z}=g.value;g.value=z}}function le(k){S.value=k}const j=e.ref(null),re=e.ref(null),Ze=e.ref(null),ie=e.ref(null),ke=e.ref(null),Le=e.ref(null),Be=e.ref(null),G=e.ref("map");function se(){G.value=G.value==="sidebar"?"map":"sidebar",e.nextTick(()=>{G.value==="sidebar"&&j.value?.focus()})}const K=e.ref(!1);function xe(){K.value=!K.value,K.value&&e.nextTick(()=>{ie.value?.focus()})}function ce(){K.value=!1,e.nextTick(()=>{re.value?.focus()})}const A=e.ref(!1);function Ne(){A.value=!A.value}const Y=e.ref(!1),ae=e.ref(null);function ee(){ae.value=document.activeElement,Y.value=!0,e.nextTick(()=>{Be.value?.focus()})}function J(){Y.value=!1,e.nextTick(()=>{ae.value?.focus(),ae.value=null})}function Ae(k){k.target.classList.contains("layerboard-modal-backdrop")&&J()}function Q(k){if(k.key==="Escape"){ce();return}if(k.key==="Tab"&&ke.value){const C=Array.from(ke.value.querySelectorAll('a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(C.length===0)return;const D=C[0],z=C[C.length-1];k.shiftKey?document.activeElement===D&&(k.preventDefault(),z.focus()):document.activeElement===z&&(k.preventDefault(),D.focus())}}function Ve(k){if(k.key==="Escape"){J();return}if(k.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 D=C[0],z=C[C.length-1];k.shiftKey?document.activeElement===D&&(k.preventDefault(),z.focus()):document.activeElement===z&&(k.preventDefault(),D.focus())}}e.provide("layerboard-open-modal",ee),e.provide("layerboard-close-modal",J),e.provide("layerboard-is-modal-open",e.readonly(Y)),a({layerList:i,visibleLayers:h,layerOpacities:w,loadingLayers:s,layerErrors:g,currentZoom:m,toggleLayer:fe,setLayerVisible:oe,setLayersVisible:pe,setLayerOpacity:ne,reloadConfigs:be,clearCache:()=>nt(n.webMapId),visibleTiledLayers:y,tiledLayerOpacities:f,toggleTiledLayer:L,setTiledLayerVisible:V,setTiledLayerOpacity:N,dataSourcesState:I,dataSourcesLoading:X,getDataSourceData:ue,refetchDataSource:de,isModalOpen:Y,openModal:ee,closeModal:J});function we(k){k.key==="Escape"&&K.value&&ce()}return e.onMounted(()=>{be(),Oe(),u(),document.addEventListener("keydown",we)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",we)}),(k,C)=>(e.openBlock(),e.createElementBlock("div",vo,[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(Fe.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:re,class:"layerboard-hamburger layerboard-mobile-only","aria-expanded":K.value,onClick:xe,"aria-label":"Toggle menu"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Tt),size:"medium",decorative:""},null,8,["icon-definition"])],8,bo),e.renderSlot(k.$slots,"header",{},()=>[e.createElementVNode("h1",null,e.toDisplayString(t.title),1),t.subtitle?(e.openBlock(),e.createElementBlock("span",ko,e.toDisplayString(t.subtitle),1)):e.createCommentVNode("",!0)],!0),K.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"mobileMenuRef",ref:ke,class:"layerboard-mobile-menu",style:e.normalizeStyle({backgroundColor:t.themeColor}),onKeydown:Q},[e.createElementVNode("div",Lo,[e.renderSlot(k.$slots,"footer",{openModal:ee,closeModal:J,isModalOpen:Y.value},()=>[C[0]||(C[0]=e.createTextVNode(" City of Philadelphia ",-1))],!0)]),e.createElementVNode("button",{ref_key:"mobileMenuCloseRef",ref:ie,class:"layerboard-mobile-menu-close",onClick:ce,"aria-label":"Close menu"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Je),size:"medium",decorative:""},null,8,["icon-definition"])],512)],36)):e.createCommentVNode("",!0),K.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"layerboard-mobile-menu-backdrop",onClick:ce})):e.createCommentVNode("",!0)],4),e.createElementVNode("div",wo,[d.value?(e.openBlock(),e.createElementBlock("div",Co,[e.createElementVNode("div",{class:"layerboard-spinner",style:e.normalizeStyle({borderTopColor:t.themeColor})},null,4),e.createElementVNode("p",null,"Loading "+e.toDisplayString(t.title)+"...",1)])):v.value?(e.openBlock(),e.createElementBlock("div",So,[C[3]||(C[3]=e.createElementVNode("h2",null,"Error Loading Layers",-1)),e.createElementVNode("p",null,e.toDisplayString(v.value),1),e.createElementVNode("button",{class:"layerboard-retry-button",style:e.normalizeStyle({backgroundColor:t.themeColor}),onClick:be}," Retry ",4)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("aside",{ref_key:"sidebarRef",ref:j,id:"main-content",class:e.normalizeClass(["layerboard-sidebar",{"is-active":G.value==="sidebar"}]),style:e.normalizeStyle(Se.value),"aria-label":"Map layers",tabindex:"-1"},[e.renderSlot(k.$slots,"sidebar",{layers:i.value,visibleLayers:h.value,layerOpacities:w.value,loadingLayers:s.value,layerErrors:g.value,currentZoom:m.value,toggleLayer:fe,setLayerVisible:oe,setLayersVisible:pe,setOpacity:ne,tiledLayers:t.tiledLayers,visibleTiledLayers:y.value,tiledLayerOpacities:f.value,toggleTiledLayer:L,setTiledLayerVisible:V,setTiledLayerOpacity:N,dataSourcesState:I.value,dataSourcesLoading:X.value,getDataSource:ue,refetchDataSource:de},()=>[t.showDefaultSidebar?(e.openBlock(),e.createBlock(tt,{key:0,"layer-list":i.value,"visible-layers":h.value,"layer-opacities":w.value,"loading-layers":s.value,"layer-errors":g.value,"current-zoom":m.value,"search-query":S.value,"layer-metadata":b.value,onToggleLayer:fe,onSetOpacity:ne,onUpdateSearch:le},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":G.value==="map"}])},[e.createVNode(et,{"visible-layers":h.value,"layer-opacities":w.value,"layer-list":i.value,"tiled-layers":t.tiledLayers,"visible-tiled-layers":y.value,"tiled-layer-opacities":f.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:De,onLayerLoading:Re,onLayerError:q},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":A.value}]),style:e.normalizeStyle({left:A.value?"0":n.sidebarWidth}),onClick:Ne,"aria-expanded":!A.value,"aria-label":A.value?"Expand sidebar":"Collapse sidebar"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":A.value?e.unref(_t):e.unref(zt),size:"medium",decorative:""},null,8,["icon-definition"])],14,Eo)],64))]),e.createElementVNode("button",{ref_key:"mobileToggleRef",ref:Ze,class:"layerboard-mobile-toggle",style:e.normalizeStyle(ve.value),onClick:se},[G.value==="map"?(e.openBlock(),e.createElementBlock("span",Bo,e.toDisplayString(t.sidebarLabel),1)):(e.openBlock(),e.createElementBlock("span",xo,e.toDisplayString(t.mapLabel),1))],4),e.createElementVNode("footer",{class:"layerboard-footer",style:e.normalizeStyle(Ie.value)},[e.renderSlot(k.$slots,"footer",{openModal:ee,closeModal:J,isModalOpen:Y.value},()=>[C[4]||(C[4]=e.createTextVNode(" City of Philadelphia ",-1))],!0)],4),Y.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"layerboard-modal-backdrop",onClick:Ae,onKeydown:Ve},[e.createElementVNode("div",{ref_key:"modalRef",ref:Le,class:"layerboard-modal",role:"dialog","aria-modal":"true","aria-label":"Application information"},[e.createElementVNode("button",{ref_key:"modalCloseRef",ref:Be,class:"layerboard-modal-close",onClick:J,"aria-label":"Close modal"},[e.createVNode(e.unref(Z.Icon),{"icon-definition":e.unref(Je),size:"medium",decorative:""},null,8,["icon-definition"])],512),e.renderSlot(k.$slots,"modal",{closeModal:J},void 0,!0)],512)],32)):e.createCommentVNode("",!0),e.createElementVNode("span",No,e.toDisplayString(G.value==="sidebar"?"Showing layers panel":"Showing map"),1)]))}}),$o=he(Vo,[["__scopeId","data-v-458c0bb3"]]),Po=["aria-expanded"],_o={key:0,class:"topic-icon"},zo={class:"topic-title"},To=e.defineComponent({__name:"TopicAccordion",props:{title:{},icon:{},expanded:{type:Boolean,default:!1},layerIds:{default:()=>[]},headerClass:{}},emits:["toggle","layerChange"],setup(t,{emit:a}){const o=t,n=a,r=e.ref(o.expanded),i=`topic-panel-${e.useId()}`,d=`topic-header-${e.useId()}`;e.watch(()=>o.expanded,m=>{r.value=m});function v(){r.value=!r.value,n("toggle",r.value)}return(m,S)=>{const h=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["topic-accordion",{"is-expanded":r.value}])},[e.createElementVNode("button",{id:d,class:e.normalizeClass(["topic-header",t.headerClass]),type:"button","aria-expanded":r.value,"aria-controls":i,onClick:v},[t.icon||m.$slots.icon?(e.openBlock(),e.createElementBlock("span",_o,[e.renderSlot(m.$slots,"icon",{},()=>[t.icon?(e.openBlock(),e.createBlock(h,{key:0,icon:["fas",t.icon],"aria-hidden":"true"},null,8,["icon"])):e.createCommentVNode("",!0)],!0)])):e.createCommentVNode("",!0),e.createElementVNode("span",zo,e.toDisplayString(t.title),1),e.createElementVNode("span",{class:e.normalizeClass(["topic-chevron",{"is-rotated":r.value}])},[...S[0]||(S[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,Po),e.withDirectives(e.createElementVNode("div",{id:i,role:"region","aria-labelledby":d,class:"topic-content"},[e.renderSlot(m.$slots,"default",{},()=>[S[1]||(S[1]=e.createElementVNode("p",{class:"topic-empty"},"No content provided for this topic.",-1))],!0)],512),[[e.vShow,r.value]])],2)}}}),Mo=he(To,[["__scopeId","data-v-13853397"]]),Fo={class:"layer-checkbox-set",role:"group"},Io=["checked","disabled","onChange"],Oo={class:"layer-title"},Do={key:0,class:"loading-indicator",role:"status"},Ro=["aria-label"],Zo={key:2,class:"zoom-indicator"},Ao={class:"layer-title"},Uo={key:0,class:"loading-indicator",role:"status"},Wo=["aria-label"],qo={key:2,class:"zoom-indicator"},jo={key:2,class:"opacity-control"},Go=["for"],Ho=["id","value","aria-label","onInput"],Ko=["aria-label"],Jo={class:"legend-label"},Qo={key:0,class:"empty-state"},Xo=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}},emits:["toggleLayer","setOpacity"],setup(t,{emit:a}){const o=t,n=a;function r(y){return o.visibleLayerIds.has(y)}function i(y){return o.layerOpacities[y]??1}function d(y){return o.loadingLayerIds.has(y)}function v(y){return o.layerErrors[y]||null}function m(y){const f=o.currentZoom,u=y.minZoom,L=y.maxZoom;return!(u!==void 0&&f<u||L!==void 0&&f>L)}function S(y){return y.displayOptions?.shouldShowCheckbox!==!1}function h(y){return o.showOpacity?y.displayOptions?.shouldShowSlider!==!1:!1}function w(y){return o.showLegend?y.displayOptions?.shouldShowLegendBox!==!1:!1}function s(y){return y.displayOptions?.layerNameChange||y.title}function g(y){n("toggleLayer",y)}function b(y,f){const u=f.target;n("setOpacity",y,parseFloat(u.value))}return(y,f)=>(e.openBlock(),e.createElementBlock("fieldset",Fo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,u=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:"layer-item"},[S(u)?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!m(u),"layer-error":v(u.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:r(u.id),disabled:!m(u),onChange:L=>g(u.id)},null,40,Io),e.createElementVNode("span",Oo,[e.createTextVNode(e.toDisplayString(s(u))+" ",1),d(u.id)?(e.openBlock(),e.createElementBlock("span",Do," Loading... ")):e.createCommentVNode("",!0),v(u.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(u.id)||"Error",role:"status"}," Error ",8,Ro)):e.createCommentVNode("",!0),m(u)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Zo," (zoom in) "))])],2)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["layer-label-only",{"layer-unavailable":!m(u),"layer-error":v(u.id)}])},[e.createElementVNode("span",Ao,[e.createTextVNode(e.toDisplayString(s(u))+" ",1),d(u.id)?(e.openBlock(),e.createElementBlock("span",Uo," Loading... ")):e.createCommentVNode("",!0),v(u.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(u.id)||"Error",role:"status"}," Error ",8,Wo)):e.createCommentVNode("",!0),m(u)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",qo," (zoom in) "))])],2)),h(u)&&r(u.id)?(e.openBlock(),e.createElementBlock("div",jo,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+u.id}," Opacity: "+e.toDisplayString(Math.round(i(u.id)*100))+"% ",9,Go),e.createElementVNode("input",{id:"opacity-"+u.id,type:"range",min:"0",max:"1",step:"0.05",value:i(u.id),"aria-label":"Opacity for "+s(u),class:"opacity-slider",onInput:L=>b(u.id,L)},null,40,Ho)])):e.createCommentVNode("",!0),w(u)&&r(u.id)&&u.legend?.length?(e.openBlock(),e.createElementBlock("ul",{key:3,class:"layer-legend","aria-label":"Legend for "+s(u)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.legend,(L,V)=>(e.openBlock(),e.createElementBlock("li",{key:V,class:"legend-item"},[L.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:L.color}),"aria-hidden":"true"},null,4)):L.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:L.color,height:`${L.width||2}px`}),"aria-hidden":"true"},null,4)):L.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:L.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Jo,e.toDisplayString(L.label),1)]))),128))],8,Ko)):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",Qo," No layers available ")):e.createCommentVNode("",!0)]))}}),Yo=he(Xo,[["__scopeId","data-v-431c0f6d"]]),en={class:"layer-radio-set",role:"radiogroup"},tn=["name","checked","disabled","onChange"],on={class:"layer-title"},nn={key:0,class:"loading-indicator",role:"status"},ln=["aria-label"],an={key:2,class:"zoom-indicator"},rn={key:0,class:"opacity-control"},sn=["for"],cn=["id","value","aria-label","onInput"],un=["aria-label"],dn={class:"legend-label"},fn={key:0,class:"empty-state"},pn=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"}},emits:["selectLayer","setOpacity"],setup(t,{emit:a}){const o=t,n=a;function r(b){return o.visibleLayerIds.has(b)}function i(b){return o.layerOpacities[b]??1}function d(b){return o.loadingLayerIds.has(b)}function v(b){return o.layerErrors[b]||null}function m(b){const y=o.currentZoom,f=b.minZoom,u=b.maxZoom;return!(f!==void 0&&y<f||u!==void 0&&y>u)}function S(b){return o.showOpacity?b.displayOptions?.shouldShowSlider!==!1:!1}function h(b){return o.showLegend?b.displayOptions?.shouldShowLegendBox!==!1:!1}function w(b){return b.displayOptions?.layerNameChange||b.title}function s(b){const y=o.layers.filter(f=>o.visibleLayerIds.has(f.id)&&f.id!==b).map(f=>f.id);n("selectLayer",b,y)}function g(b,y){const f=y.target;n("setOpacity",b,parseFloat(f.value))}return(b,y)=>(e.openBlock(),e.createElementBlock("div",en,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,f=>(e.openBlock(),e.createElementBlock("div",{key:f.id,class:"layer-item"},[e.createElementVNode("label",{class:e.normalizeClass(["layer-radio",{"layer-unavailable":!m(f),"layer-error":v(f.id)}])},[e.createElementVNode("input",{type:"radio",name:t.groupName,checked:r(f.id),disabled:!m(f),onChange:u=>s(f.id)},null,40,tn),e.createElementVNode("span",on,[e.createTextVNode(e.toDisplayString(w(f))+" ",1),d(f.id)?(e.openBlock(),e.createElementBlock("span",nn," Loading... ")):e.createCommentVNode("",!0),v(f.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator","aria-label":v(f.id)||"Error",role:"status"}," Error ",8,ln)):e.createCommentVNode("",!0),m(f)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",an," (zoom in) "))])],2),S(f)&&r(f.id)?(e.openBlock(),e.createElementBlock("div",rn,[e.createElementVNode("label",{class:"opacity-label",for:"opacity-"+f.id}," Opacity: "+e.toDisplayString(Math.round(i(f.id)*100))+"% ",9,sn),e.createElementVNode("input",{id:"opacity-"+f.id,type:"range",min:"0",max:"1",step:"0.05",value:i(f.id),"aria-label":"Opacity for "+w(f),class:"opacity-slider",onInput:u=>g(f.id,u)},null,40,cn)])):e.createCommentVNode("",!0),h(f)&&r(f.id)&&f.legend?.length?(e.openBlock(),e.createElementBlock("ul",{key:1,class:"layer-legend","aria-label":"Legend for "+w(f)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.legend,(u,L)=>(e.openBlock(),e.createElementBlock("li",{key:L,class:"legend-item"},[u.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:u.color}),"aria-hidden":"true"},null,4)):u.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:u.color,height:`${u.width||2}px`}),"aria-hidden":"true"},null,4)):u.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:u.color}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",dn,e.toDisplayString(u.label),1)]))),128))],8,un)):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",fn," No layers available ")):e.createCommentVNode("",!0)]))}}),mn=he(pn,[["__scopeId","data-v-0de645b0"]]);function yn(t){const a=e.ref([]),o=e.ref(new Set),n=e.ref({}),r=e.ref(new Set),i=e.ref({}),d=e.ref(""),v=e.ref(!1),m=e.ref(!1),S=e.ref(null),h=e.computed(()=>{if(!d.value.trim())return a.value;const N=d.value.toLowerCase();return a.value.filter(T=>T.title.toLowerCase().includes(N))}),w=e.computed(()=>a.value.map(N=>({config:N,component:N.type})));async function s(){if(!m.value){v.value=!0,S.value=null;try{let N;t.mode==="dynamic"||!t.mode?t.webMapId?N=await g(t.webMapId):N=await _e():N=await _e(),a.value=N;const T={};N.forEach(I=>{T[I.id]=I.opacity??1}),n.value=T,m.value=!0}catch(N){S.value=N instanceof Error?N:new Error("Failed to initialize layerboard")}finally{v.value=!1}}}async function g(N){const T=Me(N),I=await fetch(T);if(!I.ok)throw new Error(`Failed to fetch WebMap: ${I.status} ${I.statusText}`);const X=await I.json();return Ge(X)}function b(N){const T=new Set(o.value);T.has(N)?T.delete(N):T.add(N),o.value=T}function y(N,T){n.value={...n.value,[N]:Math.max(0,Math.min(1,T))}}function f(N){d.value=N}function u(N,T){const I=new Set(r.value);T?I.add(N):I.delete(N),r.value=I}function L(N,T){if(T)i.value={...i.value,[N]:T};else{const{[N]:I,...X}=i.value;i.value=X}}function V(){a.value=[],o.value=new Set,n.value={},r.value=new Set,i.value={},d.value="",v.value=!1,m.value=!1,S.value=null}return{layerConfigs:e.readonly(a),visibleLayers:e.readonly(o),layerOpacities:e.readonly(n),loadingLayers:e.readonly(r),layerErrors:e.readonly(i),searchQuery:e.readonly(d),isLoading:e.readonly(v),isInitialized:e.readonly(m),error:e.readonly(S),filteredLayerConfigs:h,layerList:w,config:t,initialize:s,toggleLayer:b,setLayerOpacity:y,filterLayers:f,setLayerLoading:u,setLayerError:L,reset:V}}function gn(){const t=e.ref([]),a=e.ref(new Set),o=e.ref(new Set);function n(i){a.value.has(i)?a.value.delete(i):a.value.add(i)}function r(i){t.value=i}return{layers:e.computed(()=>t.value),visibleLayerIds:e.computed(()=>a.value),loadingLayerIds:e.computed(()=>o.value),toggleLayer:n,setLayers:r}}function at(t){const a=e.ref(null),o=e.ref(!1),n=e.ref(null),r=e.ref(0);async function i(m={}){o.value=!0,n.value=null;const S=t.pageSize||2e3;let h=0,w=[],s=!0;try{for(;s;){const b=t.url.replace(/\/$/,""),y=encodeURIComponent(m.where||t.where||"1=1");let f=`${b}/query?where=${y}&outFields=*&returnGeometry=true&resultRecordCount=${S}&resultOffset=${h}&f=geojson`;if(m.bounds){const V=JSON.stringify({xmin:m.bounds.west,ymin:m.bounds.south,xmax:m.bounds.east,ymax:m.bounds.north,spatialReference:{wkid:4326}});f+=`&geometry=${encodeURIComponent(V)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects`}const u=await fetch(f);if(!u.ok)throw new Error(`HTTP ${u.status}: ${u.statusText}`);const L=await u.json();L.features&&L.features.length>0?(w=w.concat(L.features),h+=L.features.length,s=L.features.length===S):s=!1}const g={type:"FeatureCollection",features:w};return a.value=g,r.value=w.length,g}catch(g){const b=g instanceof Error?g:new Error("Failed to fetch features");throw n.value=b,b}finally{o.value=!1}}function d(){a.value=null,r.value=0,n.value=null}async function v(m={}){return i(m)}return{data:e.readonly(a),isLoading:e.readonly(o),error:e.readonly(n),totalFeatures:e.readonly(r),config:t,fetch:i,refetch:v,clear:d}}function hn(t,a,o){const n=at(t);return e.watch(a,async r=>{if(r){const i=o(r);await n.fetch(i)}},{immediate:!0}),n}exports.LayerCheckboxSet=Yo;exports.LayerPanel=tt;exports.LayerRadioButtonSet=mn;exports.Layerboard=$o;exports.MapPanel=et;exports.TopicAccordion=Mo;exports.WEBMAP_ID=po;exports.buildWebMapUrl=Me;exports.clearCache=nt;exports.getLayerConfigs=_e;exports.getWebMapUrl=mo;exports.transformWebMapToLayerConfigs=Ge;exports.useApiDataSources=lt;exports.useDataSource=at;exports.useLayerConfig=gn;exports.useLayerboard=yn;exports.useReactiveDataSource=hn;
package/dist/index.mjs CHANGED
@@ -480,7 +480,7 @@ const eo = { class: "map-panel" }, to = /* @__PURE__ */ Se({
480
480
  p += `<table class="popup-table" aria-label="${Ce(Ge.value)}">`;
481
481
  for (const s of n.popupConfig.fields) {
482
482
  const E = De(n.properties[s.field], s.format);
483
- p += `<tr><th>${Ce(s.label)}</th><td>${Ce(E)}</td></tr>`;
483
+ p += `<tr><th scope="row">${Ce(s.label)}</th><td>${Ce(E)}</td></tr>`;
484
484
  }
485
485
  p += "</table>";
486
486
  } else
@@ -773,7 +773,7 @@ const eo = { class: "map-panel" }, to = /* @__PURE__ */ Se({
773
773
  for (const [o, a] of i)
774
774
  t[o] = a;
775
775
  return t;
776
- }, oo = /* @__PURE__ */ Oe(to, [["__scopeId", "data-v-823ed331"]]), no = ["disabled"], io = /* @__PURE__ */ Se({
776
+ }, oo = /* @__PURE__ */ Oe(to, [["__scopeId", "data-v-669444d6"]]), no = ["disabled"], io = /* @__PURE__ */ Se({
777
777
  inheritAttrs: !1,
778
778
  __name: "PhlButton",
779
779
  props: {
@@ -1007,10 +1007,7 @@ const ko = { class: "layer-panel" }, Co = {
1007
1007
  }, Oo = {
1008
1008
  key: 0,
1009
1009
  class: "opacity-control"
1010
- }, Io = ["for"], Ro = ["id", "value", "aria-label", "onInput"], Do = {
1011
- key: 1,
1012
- class: "layer-legend"
1013
- }, Zo = { class: "legend-label" }, Bo = {
1010
+ }, Io = ["for"], Ro = ["id", "value", "aria-label", "onInput"], Do = ["aria-label"], Zo = { class: "legend-label" }, Bo = {
1014
1011
  key: 0,
1015
1012
  class: "no-results"
1016
1013
  }, Ao = /* @__PURE__ */ Se({
@@ -1167,7 +1164,11 @@ const ko = { class: "layer-panel" }, Co = {
1167
1164
  onInput: (F) => g(S.config.id, F)
1168
1165
  }, null, 40, Ro)
1169
1166
  ])) : z("", !0),
1170
- e.showLegend && y(S.config.id) && S.config.legend?.length ? (d(), m("ul", Do, [
1167
+ e.showLegend && y(S.config.id) && S.config.legend?.length ? (d(), m("ul", {
1168
+ key: 1,
1169
+ class: "layer-legend",
1170
+ "aria-label": "Legend for " + S.config.title
1171
+ }, [
1171
1172
  (d(!0), m(oe, null, re(S.config.legend, (F, T) => (d(), m("li", {
1172
1173
  key: T,
1173
1174
  class: "legend-item"
@@ -1193,13 +1194,13 @@ const ko = { class: "layer-panel" }, Co = {
1193
1194
  }, null, 4)) : z("", !0),
1194
1195
  x("span", Zo, V(F.label), 1)
1195
1196
  ]))), 128))
1196
- ])) : z("", !0)
1197
+ ], 8, Do)) : z("", !0)
1197
1198
  ]))), 128)),
1198
1199
  a.value.length === 0 ? (d(), m("div", Bo, ' No layers match "' + V(e.searchQuery) + '" ', 1)) : z("", !0)
1199
1200
  ], 2))
1200
1201
  ]));
1201
1202
  }
1202
- }), No = /* @__PURE__ */ Oe(Ao, [["__scopeId", "data-v-bd7d8852"]]);
1203
+ }), No = /* @__PURE__ */ Oe(Ao, [["__scopeId", "data-v-a0dcf4f0"]]);
1203
1204
  function D(e) {
1204
1205
  if (!e || !Array.isArray(e) || e.length < 3) return "#888888";
1205
1206
  const i = e[0], t = e[1], o = e[2], l = (e[3] ?? 255) / 255;
@@ -2256,7 +2257,7 @@ const ln = { class: "layerboard-layout" }, rn = ["aria-expanded"], sn = {
2256
2257
  x("span", hn, V(le.value === "sidebar" ? "Showing layers panel" : "Showing map"), 1)
2257
2258
  ]));
2258
2259
  }
2259
- }), ii = /* @__PURE__ */ Oe(mn, [["__scopeId", "data-v-0348ae97"]]), vn = ["aria-expanded"], bn = {
2260
+ }), ii = /* @__PURE__ */ Oe(mn, [["__scopeId", "data-v-458c0bb3"]]), vn = ["aria-expanded"], bn = {
2260
2261
  key: 0,
2261
2262
  class: "topic-icon"
2262
2263
  }, wn = { class: "topic-title" }, Ln = /* @__PURE__ */ Se({
@@ -2337,7 +2338,7 @@ const ln = { class: "layerboard-layout" }, rn = ["aria-expanded"], sn = {
2337
2338
  ], 2);
2338
2339
  };
2339
2340
  }
2340
- }), ai = /* @__PURE__ */ Oe(Ln, [["__scopeId", "data-v-7339d8d1"]]), Sn = {
2341
+ }), ai = /* @__PURE__ */ Oe(Ln, [["__scopeId", "data-v-13853397"]]), Sn = {
2341
2342
  class: "layer-checkbox-set",
2342
2343
  role: "group"
2343
2344
  }, kn = ["checked", "disabled", "onChange"], Cn = { class: "layer-title" }, $n = {
@@ -2357,10 +2358,7 @@ const ln = { class: "layerboard-layout" }, rn = ["aria-expanded"], sn = {
2357
2358
  }, zn = {
2358
2359
  key: 2,
2359
2360
  class: "opacity-control"
2360
- }, Fn = ["for"], On = ["id", "value", "aria-label", "onInput"], In = {
2361
- key: 3,
2362
- class: "layer-legend"
2363
- }, Rn = { class: "legend-label" }, Dn = {
2361
+ }, Fn = ["for"], On = ["id", "value", "aria-label", "onInput"], In = ["aria-label"], Rn = { class: "legend-label" }, Dn = {
2364
2362
  key: 0,
2365
2363
  class: "empty-state"
2366
2364
  }, Zn = /* @__PURE__ */ Se({
@@ -2478,7 +2476,11 @@ const ln = { class: "layerboard-layout" }, rn = ["aria-expanded"], sn = {
2478
2476
  onInput: (S) => w(c.id, S)
2479
2477
  }, null, 40, On)
2480
2478
  ])) : z("", !0),
2481
- k(c) && a(c.id) && c.legend?.length ? (d(), m("ul", In, [
2479
+ k(c) && a(c.id) && c.legend?.length ? (d(), m("ul", {
2480
+ key: 3,
2481
+ class: "layer-legend",
2482
+ "aria-label": "Legend for " + r(c)
2483
+ }, [
2482
2484
  (d(!0), m(oe, null, re(c.legend, (S, F) => (d(), m("li", {
2483
2485
  key: F,
2484
2486
  class: "legend-item"
@@ -2504,12 +2506,12 @@ const ln = { class: "layerboard-layout" }, rn = ["aria-expanded"], sn = {
2504
2506
  }, null, 4)) : z("", !0),
2505
2507
  x("span", Rn, V(S.label), 1)
2506
2508
  ]))), 128))
2507
- ])) : z("", !0)
2509
+ ], 8, In)) : z("", !0)
2508
2510
  ]))), 128)),
2509
2511
  e.layers.length === 0 ? (d(), m("div", Dn, " No layers available ")) : z("", !0)
2510
2512
  ]));
2511
2513
  }
2512
- }), li = /* @__PURE__ */ Oe(Zn, [["__scopeId", "data-v-d069e7e9"]]), Bn = {
2514
+ }), li = /* @__PURE__ */ Oe(Zn, [["__scopeId", "data-v-431c0f6d"]]), Bn = {
2513
2515
  class: "layer-radio-set",
2514
2516
  role: "radiogroup"
2515
2517
  }, An = ["name", "checked", "disabled", "onChange"], Nn = { class: "layer-title" }, Vn = {
@@ -2522,10 +2524,7 @@ const ln = { class: "layerboard-layout" }, rn = ["aria-expanded"], sn = {
2522
2524
  }, jn = {
2523
2525
  key: 0,
2524
2526
  class: "opacity-control"
2525
- }, qn = ["for"], Gn = ["id", "value", "aria-label", "onInput"], Hn = {
2526
- key: 1,
2527
- class: "layer-legend"
2528
- }, Kn = { class: "legend-label" }, Jn = {
2527
+ }, qn = ["for"], Gn = ["id", "value", "aria-label", "onInput"], Hn = ["aria-label"], Kn = { class: "legend-label" }, Jn = {
2529
2528
  key: 0,
2530
2529
  class: "empty-state"
2531
2530
  }, Qn = /* @__PURE__ */ Se({
@@ -2624,7 +2623,11 @@ const ln = { class: "layerboard-layout" }, rn = ["aria-expanded"], sn = {
2624
2623
  onInput: (c) => h(f.id, c)
2625
2624
  }, null, 40, Gn)
2626
2625
  ])) : z("", !0),
2627
- v(f) && a(f.id) && f.legend?.length ? (d(), m("ul", Hn, [
2626
+ v(f) && a(f.id) && f.legend?.length ? (d(), m("ul", {
2627
+ key: 1,
2628
+ class: "layer-legend",
2629
+ "aria-label": "Legend for " + k(f)
2630
+ }, [
2628
2631
  (d(!0), m(oe, null, re(f.legend, (c, S) => (d(), m("li", {
2629
2632
  key: S,
2630
2633
  class: "legend-item"
@@ -2650,12 +2653,12 @@ const ln = { class: "layerboard-layout" }, rn = ["aria-expanded"], sn = {
2650
2653
  }, null, 4)) : z("", !0),
2651
2654
  x("span", Kn, V(c.label), 1)
2652
2655
  ]))), 128))
2653
- ])) : z("", !0)
2656
+ ], 8, Hn)) : z("", !0)
2654
2657
  ]))), 128)),
2655
2658
  e.layers.length === 0 ? (d(), m("div", Jn, " No layers available ")) : z("", !0)
2656
2659
  ]));
2657
2660
  }
2658
- }), ri = /* @__PURE__ */ Oe(Qn, [["__scopeId", "data-v-1a127b6c"]]);
2661
+ }), ri = /* @__PURE__ */ Oe(Qn, [["__scopeId", "data-v-0de645b0"]]);
2659
2662
  function si(e) {
2660
2663
  const i = C([]), t = C(/* @__PURE__ */ new Set()), o = C({}), a = C(/* @__PURE__ */ new Set()), l = C({}), u = C(""), b = C(!1), y = C(!1), _ = C(null), v = I(() => {
2661
2664
  if (!u.value.trim())