@phila/layerboard 3.0.0-beta.7 → 3.0.0-beta.9

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"),q=require("@phila/phila-ui-map-core"),U=require("@phila/phila-ui-core");var ue=typeof document<"u"?document.currentScript:null;function Se(t,l,o={}){const n={type:"Feature"};return(o.id===0||o.id)&&(n.id=o.id),o.bbox&&(n.bbox=o.bbox),n.properties=l||{},n.geometry=t,n}function at(t,l,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 Se({type:"Polygon",coordinates:t},l,o)}function rt(t,l,o={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return Se({type:"LineString",coordinates:t},l,o)}function it(t,l,o={}){return Se({type:"MultiLineString",coordinates:t},l,o)}function st(t,l,o={}){return Se({type:"MultiPolygon",coordinates:t},l,o)}function ct(t){return t.type==="Feature"?t.geometry:t}function ut(t,l,o){var n=t.length,r=de(t[0],l),i=[],u,h,m;let S,b;for(o||(o=[]),u=1;u<n;u++){for(S=t[u-1],b=t[u],h=m=de(b,l);;)if(r|h){if(r&h)break;r?(S=Ie(S,b,r,l),r=de(S,l)):(b=Ie(S,b,h,l),h=de(b,l))}else{i.push(S),h!==m?(i.push(b),u<n-1&&(o.push(i),i=[])):u===n-1&&i.push(b);break}r=m}return i.length&&o.push(i),o}function dt(t,l){var o,n,r,i,u,h,m;for(n=1;n<=8;n*=2){for(o=[],r=t[t.length-1],i=!(de(r,l)&n),u=0;u<t.length;u++)h=t[u],m=!(de(h,l)&n),m!==i&&o.push(Ie(r,h,n,l)),m&&o.push(h),r=h,i=m;if(t=o,!t.length)break}return o}function Ie(t,l,o,n){return o&8?[t[0]+(l[0]-t[0])*(n[3]-t[1])/(l[1]-t[1]),n[3]]:o&4?[t[0]+(l[0]-t[0])*(n[1]-t[1])/(l[1]-t[1]),n[1]]:o&2?[n[2],t[1]+(l[1]-t[1])*(n[2]-t[0])/(l[0]-t[0])]:o&1?[n[0],t[1]+(l[1]-t[1])*(n[0]-t[0])/(l[0]-t[0])]:null}function de(t,l){var o=0;return t[0]<l[0]?o|=1:t[0]>l[2]&&(o|=2),t[1]<l[1]?o|=4:t[1]>l[3]&&(o|=8),o}function ft(t,l){const o=ct(t),n=o.type,r=t.type==="Feature"?t.properties:{};let i=o.coordinates;switch(n){case"LineString":case"MultiLineString":{const u=[];return n==="LineString"&&(i=[i]),i.forEach(h=>{ut(h,l,u)}),u.length===1?rt(u[0],r):it(u,r)}case"Polygon":return at(We(i,l),r);case"MultiPolygon":return st(i.map(u=>We(u,l)),r);default:throw new Error("geometry "+n+" not supported")}}function We(t,l){const o=[];for(const n of t){const r=dt(n,l);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 pt=ft;const mt={class:"map-panel"},yt=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:l}){const o=t,n=l,r=e.ref(null),i=e.ref(null),u=e.ref(0);function h(a){n("zoom",a),i.value&&(u.value=m(i.value))}function m(a){const f=a.getZoom(),B=a.getCenter().lat,C=559082264028e-3,N=B*Math.PI/180;return C*Math.cos(N)/Math.pow(2,f)}const S=e.ref({}),b=e.ref(null),k=e.ref(new Set),s=["fema-100-year-floodplain","fema-500-year-floodplain"];async function g(a,f,c,B){const C=encodeURIComponent(B||"1=1"),N=JSON.stringify({xmin:f.west,ymin:f.south,xmax:f.east,ymax:f.north,spatialReference:{wkid:4326}}),$=2e3;let F=0,M=[],A=!0;for(;A;){const O=`${a}/query?where=${C}&geometry=${encodeURIComponent(N)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&resultRecordCount=${$}&resultOffset=${F}&f=geojson`,z=await fetch(O);if(!z.ok)throw new Error(`HTTP ${z.status}: ${z.statusText}`);const D=await z.json();D.features&&D.features.length>0?(M=M.concat(D.features),F+=D.features.length,A=D.features.length===$):A=!1}if(s.includes(c)){const O=[f.west,f.south,f.east,f.north];M=M.map(z=>{if(z.geometry&&(z.geometry.type==="Polygon"||z.geometry.type==="MultiPolygon"))try{return pt(z,O)}catch{return z}return z})}return{type:"FeatureCollection",features:M}}async function v(a,f){const c=f.map(async B=>{const C=o.layerList.find(N=>N.config.id===B)?.config;if(C){n("layerLoading",B,!0);try{const N=await g(C.url,a,B,C.where);S.value={...S.value,[B]:N},n("layerError",B,null)}catch(N){const $=N instanceof Error?N.message:"Failed to load";n("layerError",B,$)}finally{n("layerLoading",B,!1)}}});await Promise.all(c)}async function y(a){const f=[...o.visibleLayers];await v(a,f)}function p(a){b.value=a.bounds,y(a.bounds)}function d(a){i.value=a;const f=a.getBounds();b.value={west:f.getWest(),south:f.getSouth(),east:f.getEast(),north:f.getNorth()};const c=a.getZoom();n("zoom",c),u.value=m(a),y(b.value)}e.watch(()=>o.visibleLayers.size,async()=>{if(j.value.length>0&&W(),b.value){const a=new Set(o.visibleLayers),f=[...a].filter(c=>!k.value.has(c));k.value=new Set(a),f.length>0&&await v(b.value,f)}});function L(a){return o.visibleLayers.has(a)}function x(a){return!!S.value[a.id]}const V=e.computed(()=>o.layerList.filter(a=>a.config.type==="circle"&&L(a.config.id)&&x(a.config)).map(a=>a.config)),_=e.computed(()=>o.layerList.filter(a=>a.config.type==="fill"&&L(a.config.id)&&x(a.config)).map(a=>a.config)),I=e.computed(()=>o.layerList.filter(a=>a.config.type==="fill"&&a.config.outlinePaint&&L(a.config.id)&&x(a.config)).map(a=>a.config)),J=e.computed(()=>o.layerList.filter(a=>a.config.type==="line"&&L(a.config.id)&&x(a.config)).map(a=>a.config));function le(a){return o.visibleTiledLayers?.has(a)??!1}function ae(a){return o.tiledLayerOpacities?.[a]??1}function Ne(a){return`${a.replace(/\/$/,"")}/tile/{z}/{y}/{x}`}function Ve(a){return{type:"raster",tiles:[Ne(a.url)],tileSize:256,attribution:a.attribution||""}}const me=e.ref({}),he=e.ref(new Set);async function ye(a){if(!he.value.has(a.id)){he.value.add(a.id);try{const f=a.url.replace(/\/$/,""),c=await fetch(`${f}?f=json`);if(!c.ok)return;const B=await c.json();let C=B.minScale||0,N=B.maxScale||0;if(B.layers&&B.layers.length>0)for(const $ of B.layers)$.maxScale&&$.maxScale>0&&(N===0||$.maxScale<N)&&(N=$.maxScale);N===0&&(N=72e3),me.value={...me.value,[a.id]:{minScale:C,maxScale:N}}}catch{}}}e.onMounted(()=>{if(o.tiledLayers)for(const a of o.tiledLayers)a.scaleBasedRendering&&ye(a)});function ve(a){if(!a.scaleBasedRendering)return"tiled";const f=me.value[a.id];if(!f)return"tiled";const c=u.value;return c===0||c>f.maxScale?"tiled":"dynamic"}const xe=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(a=>le(a.id)?a.scaleBasedRendering?ve(a)==="tiled":!0:!1):[]),$e=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(a=>le(a.id)&&a.scaleBasedRendering?ve(a)==="dynamic":!1):[]);function re(a){return{type:"raster",tiles:[`${a.url.replace(/\/$/,"")}/export?bbox={bbox-epsg-3857}&bboxSR=3857&imageSR=3857&size=256,256&format=png32&transparent=true&f=image`],tileSize:256,attribution:a.attribution||""}}function K(a){return{type:"geojson",data:S.value[a.id]}}function ie(a){return o.layerOpacities[a]??1}function X(a){const f=ie(a.id),c=a.type==="circle"?"circle-opacity":a.type==="fill"?"fill-opacity":"line-opacity";if(a.type==="fill"&&a.paint["fill-opacity"]===0)return{...a.paint,"fill-opacity":0};const B=a.type==="circle"?"circle-color":a.type==="fill"?"fill-color":"line-color",C={...a.paint},N=C[B],$=C[c]===1,F=typeof N=="string"&&N.startsWith("rgba(");if($&&F){if(f===1)return C;{const M=N.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(M&&M[4]){const[,A,O,z,D]=M,Te=parseFloat(D)*f;C[B]=`rgba(${A}, ${O}, ${z}, ${Te})`,C[c]=1}return C}}if(F){const M=N.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(M){const[,A,O,z]=M;C[B]=`rgb(${A}, ${O}, ${z})`}}return C[c]=f,C}function Pe(a){const f=ie(a.id);return{...a.outlinePaint,"line-opacity":f}}const j=e.ref([]),Y=e.ref(null),R=e.ref(0);function se(a){const f=a.replace(/-outline$/,"");return o.layerList.find(B=>B.config.id===f)?.config}function oe(a,f){return a.replace(/\{([^}]+)\}/g,(c,B)=>{const C=f[B];return C==null?"":String(C)})}function ze(a,f){if(a==null)return"-";if(f?.dateFormat&&typeof a=="number"){const c=new Date(a);switch(f.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 a=="number"){if(a>1e12&&!f)return new Date(a).toLocaleDateString();const c=f?.places,B=f?.digitSeparator??!0;if(c!==void 0){const C=a.toFixed(c);if(B){const N=C.split("."),$=N[0]||"0",F=N[1],M=$.replace(/\B(?=(\d{3})+(?!\d))/g,",");return F?`${M}.${F}`:M}return C}return B?a.toLocaleString():String(a)}return String(a)}function be(a){const f=new Set;return a.filter(c=>{const C=`${c.layer.id.replace(/-outline$/,"")}:${JSON.stringify(c.properties)}`;return f.has(C)?!1:(f.add(C),!0)})}function ee(a,f){const c=new Map;return f.forEach((B,C)=>{c.set(B.id,C)}),a.sort((B,C)=>{const N=B.layer.id.replace(/-outline$/,""),$=C.layer.id.replace(/-outline$/,""),F=c.get(N)??-1;return(c.get($)??-1)-F})}function ce(a){const f=i.value;if(!f)return;const c=[];o.layerList.forEach(O=>{const z=O.config;o.visibleLayers.has(z.id)&&(c.push(z.id),z.outlinePaint&&c.push(`${z.id}-outline`))});const B=f.project([a.lngLat.lng,a.lngLat.lat]),C=f.queryRenderedFeatures(B,{layers:c});if(C.length===0)return;const N=be(C),$=o.layerList.map(O=>O.config),F=ee(N,$),M=F.map(O=>{const z=O.layer.id.replace(/-outline$/,""),D=se(z);return D?{layerId:D.id,layerTitle:D.title,properties:O.properties||{},popupConfig:D.popup}:null}).filter(O=>O!==null);if(M.length===0)return;j.value=M,R.value=0,Y.value=[a.lngLat.lng,a.lngLat.lat];const A=F[0];if(A&&A.geometry){const O=A.layer.id.replace(/-outline$/,""),z=se(O);if(z){const D=Re(A.geometry),Te=Ze(z.id,z.type);te.value={geometry:A.geometry,geometryType:D,layerId:z.id,properties:A.properties||{},originalStyle:Te}}}}function W(){j.value=[],Y.value=null,R.value=0,te.value=null}function ne(a){if(j.value.length===0)return;const f=a.target;if(!(f.tagName==="INPUT"||f.tagName==="TEXTAREA"||f.isContentEditable))switch(a.key){case"ArrowLeft":case"ArrowUp":a.preventDefault(),ke();break;case"ArrowRight":case"ArrowDown":a.preventDefault(),G();break;case"Escape":a.preventDefault(),W();break}}e.onMounted(()=>{window.addEventListener("keydown",ne)}),e.onUnmounted(()=>{window.removeEventListener("keydown",ne)});function G(){const a=j.value.length;a<=1||(R.value=(R.value+1)%a)}function ke(){const a=j.value.length;a<=1||(R.value=(R.value-1+a)%a)}const w=e.computed(()=>j.value.length===0?null:j.value[R.value]),E=e.computed(()=>{const a=w.value;return!a||!a.popupConfig?a?.layerTitle||"":oe(a.popupConfig.title,a.properties)}),H=e.computed(()=>{const a=w.value;if(!a)return"";let f='<div class="popup-content">';if(f+=`<h3 class="popup-title">${E.value}</h3>`,a.popupConfig?.fields?.length){f+='<table class="popup-table">';for(const c of a.popupConfig.fields){const B=ze(a.properties[c.field],c.format);f+=`<tr><th>${c.label}</th><td>${B}</td></tr>`}f+="</table>"}else f+='<p class="popup-no-fields">No additional information available.</p>';return f+="</div>",f}),T=e.ref({type:"FeatureCollection",features:[]}),Z=e.ref({type:"FeatureCollection",features:[]}),_e={"circle-radius":["get","highlightRadius"],"circle-color":"#00FFFF","circle-opacity":.8,"circle-stroke-width":2,"circle-stroke-color":"#FFFFFF"},Fe={"line-width":["get","highlightWidth"],"line-color":"#00FFFF","line-opacity":.9},te=e.ref(null);function Re(a){return a.type}function Ze(a,f){const c=se(a);if(!c)return{radius:5,width:2};const B=c.paint||{};if(f==="circle"){const C=B["circle-radius"];return typeof C=="number"?{radius:C}:{radius:5}}if(f==="line"||f==="fill"){const C=B["line-width"];if(typeof C=="number")return{width:C};if(c.outlinePaint&&c.outlinePaint["line-width"]){const N=c.outlinePaint["line-width"];if(typeof N=="number")return{width:N}}return{width:2}}return{radius:5,width:2}}function Ue(a){return!a||a.length===0?[]:a[0]??[]}function tt(a){const{geometry:f,geometryType:c,originalStyle:B}=a;if(c==="Point"||c==="MultiPoint"){const N=(B.radius||5)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:f,properties:{highlightRadius:N}}]}}if(c==="LineString"||c==="MultiLineString"){const N=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:f,properties:{highlightWidth:N}}]}}if(c==="Polygon"){const C=f.coordinates,N=Ue(C),F=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:N},properties:{highlightWidth:F}}]}}if(c==="MultiPolygon"){const C=f.coordinates,$=(B.width||2)+3;return{type:"FeatureCollection",features:C.map(M=>({type:"Feature",geometry:{type:"LineString",coordinates:Ue(M)},properties:{highlightWidth:$}}))}}return{type:"FeatureCollection",features:[]}}function ot(a){if(!a){nt();return}const f=tt(a);a.geometryType==="Point"||a.geometryType==="MultiPoint"?(T.value=f,Z.value={type:"FeatureCollection",features:[]}):(Z.value=f,T.value={type:"FeatureCollection",features:[]})}function nt(){T.value={type:"FeatureCollection",features:[]},Z.value={type:"FeatureCollection",features:[]}}e.watch(te,a=>{ot(a)}),e.watch(()=>o.visibleLayers,a=>{te.value&&!a.has(te.value.layerId)&&(te.value=null,W())},{deep:!0}),e.watch(R,()=>{const a=w.value;if(!a){te.value=null;return}const f=i.value;if(!f||!Y.value)return;const c=[];o.layerList.forEach($=>{const F=$.config;o.visibleLayers.has(F.id)&&(c.push(F.id),F.outlinePaint&&c.push(`${F.id}-outline`))});const B=f.project(Y.value),N=f.queryRenderedFeatures(B,{layers:c}).find($=>$.layer.id.replace(/-outline$/,"")===a.layerId&&JSON.stringify($.properties)===JSON.stringify(a.properties));if(N&&N.geometry){const $=se(a.layerId);if($){const F=Re(N.geometry),M=Ze($.id,$.type);te.value={geometry:N.geometry,geometryType:F,layerId:$.id,properties:N.properties||{},originalStyle:M}}}});const Ae=e.ref(null);function lt(a){const[f,c]=a.geometry.coordinates;Ae.value=[f,c]}return(a,f)=>(e.openBlock(),e.createElementBlock("div",mt,[e.createVNode(e.unref(q.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:h,onClick:W,onMoveend:p,onLoad:d,onSearchResult:lt},{default:e.withCtx(()=>[o.drawControlPosition!==null?(e.openBlock(),e.createBlock(e.unref(q.DrawTool),{key:0,position:o.drawControlPosition},null,8,["position"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(xe.value,c=>(e.openBlock(),e.createBlock(e.unref(q.RasterLayer),{key:"tiled-"+c.id,id:"tiled-"+c.id,source:Ve(c),paint:{"raster-opacity":ae(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($e.value,c=>(e.openBlock(),e.createBlock(e.unref(q.RasterLayer),{key:"dynamic-"+c.id,id:"dynamic-"+c.id,source:re(c),paint:{"raster-opacity":ae(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(V.value,c=>(e.openBlock(),e.createBlock(e.unref(q.CircleLayer),{key:c.id,id:c.id,source:K(c),paint:X(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:ce},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,c=>(e.openBlock(),e.createBlock(e.unref(q.FillLayer),{key:c.id,id:c.id,source:K(c),paint:X(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:ce},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(q.LineLayer),{key:c.id+"-outline",id:c.id+"-outline",source:K(c),paint:Pe(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:ce},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(J.value,c=>(e.openBlock(),e.createBlock(e.unref(q.LineLayer),{key:c.id,id:c.id,source:K(c),paint:X(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:ce},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),e.createVNode(e.unref(q.CircleLayer),{key:"highlight-circles-layer",id:"highlight-circles",source:{type:"geojson",data:T.value},paint:_e},null,8,["source"]),e.createVNode(e.unref(q.LineLayer),{key:"highlight-lines-layer",id:"highlight-lines",source:{type:"geojson",data:Z.value},paint:Fe},null,8,["source"]),e.createVNode(e.unref(q.MapMarker),{"lng-lat":Ae.value,color:"#2176d2"},null,8,["lng-lat"]),w.value&&Y.value?(e.openBlock(),e.createBlock(e.unref(q.MapPopup),{key:1,"lng-lat":Y.value,html:H.value,"close-on-click":!1,"show-navigation":j.value.length>1,"current-feature-index":R.value,"total-features":j.value.length,"layer-name":w.value.layerTitle,onClose:W,onNext:G,onPrevious:ke},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"])]))}}),pe=(t,l)=>{const o=t.__vccOpts||t;for(const[n,r]of l)o[n]=r;return o},Je=pe(yt,[["__scopeId","data-v-3f5a9efa"]]),gt=["disabled"],ht=e.defineComponent({inheritAttrs:!1,__name:"PhlButton",props:{href:{},to:{},target:{},rel:{},disabled:{type:Boolean,default:!1},clickTarget:{},variant:{default:"primary"},size:{default:"medium"},iconOnly:{type:Boolean,default:!1},iconRight:{type:Boolean},text:{},className:{},iconDefinition:{},iconClass:{},src:{},svgRaw:{}},setup(t){const l=t,o=u=>"href"in u&&u.href!==void 0||"to"in u&&u.to!==void 0,n=e.computed(()=>U.cn("phila-button",`phila-button--${l.variant}`,l.size&&`is-${l.size}`,l.iconOnly&&"icon-button",l.iconOnly&&l.variant==="standard"&&"icon-button--standard",l.className)),r=e.computed(()=>o(l)?"to"in l&&l.to!==void 0?{to:l.to,disabled:l.disabled,className:n.value}:{href:l.href,target:l.target,rel:l.rel,disabled:l.disabled,className:n.value}:{}),i=e.computed(()=>({iconDefinition:l.iconDefinition,iconClass:l.iconClass,src:l.src,iconRight:l.iconRight,iconOnly:l.iconOnly,text:l.text,size:l.size,shadow:l.iconOnly&&l.variant==="standard"}));return(u,h)=>o(l)?(e.openBlock(),e.createBlock(e.unref(U.BaseLink),e.mergeProps({key:0},{...r.value,...u.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(U.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.text),1)])]),_:3},16)]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:1,type:"button",disabled:l.disabled,class:n.value},u.$attrs),[e.createVNode(e.unref(U.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.text),1)])]),_:3},16)],16,gt))}});var vt={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"]},bt=vt,kt={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"]},Lt=kt;const wt=["for"],Ct={class:"state-layer"},St={class:"content"},Bt={class:"input-text-container"},Et=["id","placeholder"],Nt={key:1,class:"has-text-body-small phila-supporting-text"},Vt={key:2,class:"has-text-body-small phila-error-text"},xt=e.defineComponent({inheritAttrs:!1,__name:"TextField",props:{modelValue:{default:void 0},className:{default:""},label:{default:""},id:{default:`phila-text-field-${Math.random().toString(36).substring(2,9)}`},supportingText:{default:""},placeholder:{default:""},leadingIcon:{default:""},trailingIcon:{default:""},error:{default(){return[]}}},emits:["update:modelValue"],setup(t,{emit:l}){const o=e.useAttrs(),n=t,r=e.computed(()=>typeof n.error=="string"?n.error:n.error[0]),i=e.toRef(n,"id"),u=l,h=e.ref(""),m=e.computed({get:()=>n.modelValue!==void 0?n.modelValue:h.value,set:g=>{u("update:modelValue",g),h.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"),U.cn(...g)}),b=e.computed(()=>{const g=[];return m.value!==""&&g.push("phila-text-field--filled"),n.className&&g.push(n.className),U.cn(...g)}),k=e.ref(null),s=g=>{g.target.closest("button")||k.value?.focus()};return(g,v)=>(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,wt)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["phila-text-field",b.value]),onClick:s},[e.createElementVNode("div",Ct,[n.leadingIcon?(e.openBlock(),e.createBlock(e.unref(U.Icon),{key:0,"icon-class":n.leadingIcon,inline:"",decorative:"",shadow:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.createElementVNode("div",St,[e.createElementVNode("div",Bt,[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:i.value,ref_key:"inputRef",ref:k,"onUpdate:modelValue":v[0]||(v[0]=y=>m.value=y),class:"phila-text-field-input has-text-body-default",placeholder:n.placeholder},e.unref(o)),null,16,Et),[[e.vModelDynamic,m.value]])])]),m.value!=""?(e.openBlock(),e.createBlock(e.unref(ht),{key:1,variant:"standard",size:"small","icon-only":"","icon-definition":e.unref(Lt),onClick:v[1]||(v[1]=y=>m.value="")},null,8,["icon-definition"])):e.createCommentVNode("",!0),n.trailingIcon?(e.openBlock(),e.createBlock(e.unref(U.Icon),{key:2,size:"small","icon-class":n.trailingIcon,inline:"",decorative:"",shadow:""},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(U.Icon),{"icon-definition":e.unref(bt),size:"small",inline:"",decorative:""},null,8,["icon-definition"]),e.createTextVNode(" "+e.toDisplayString(r.value),1)])):e.createCommentVNode("",!0)],2))}});var $t={prefix:"fas",iconName:"filter",icon:[512,512,[],"f0b0","M32 64C19.1 64 7.4 71.8 2.4 83.8S.2 109.5 9.4 118.6L192 301.3 192 416c0 8.5 3.4 16.6 9.4 22.6l64 64c9.2 9.2 22.9 11.9 34.9 6.9S320 492.9 320 480l0-178.7 182.6-182.6c9.2-9.2 11.9-22.9 6.9-34.9S492.9 64 480 64L32 64z"]},Pt={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"]},_t={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"]},Ft={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 Tt={class:"layer-panel"},Mt={key:0,class:"search-box"},It={key:1,class:"topics-container"},Ot={class:"layer-row"},Dt=["href"],Rt={key:1,class:"metadata-placeholder"},Zt=["checked","disabled","onChange"],Ut={class:"layer-title"},At={key:0,class:"loading-indicator"},Wt=["title"],jt={key:2,class:"zoom-indicator"},qt={key:0,class:"opacity-control"},Gt={class:"opacity-label"},Ht=["value","onInput"],Jt={key:1,class:"layer-legend"},Qt={class:"legend-label"},Kt={key:0,class:"no-results"},Xt=e.defineComponent({__name:"LayerPanel",props:{layerList:{},visibleLayers:{},layerOpacities:{},loadingLayers:{},layerErrors:{},currentZoom:{},searchQuery:{},layerMetadata:{},mode:{default:"flat"},showSearch:{type:Boolean,default:!0},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},searchPlaceholder:{default:"Filter layers..."}},emits:["toggleLayer","setOpacity","updateSearch"],setup(t,{emit:l}){const o=t,n=l,r=e.computed(()=>{if(!o.searchQuery.trim())return o.layerList;const p=o.searchQuery.toLowerCase();return o.layerList.filter(d=>d.config.title.toLowerCase().includes(p))});function i(p){let d=p.split("?")[0]||p;return d=d.replace(/\/query$/,""),d=d.replace(/\/$/,""),d.toLowerCase()}function u(p){const d=i(p);return o.layerMetadata[d]||null}const h=e.computed(()=>o.layerList.some(p=>u(p.config.url)));function m(p){return o.visibleLayers.has(p)}function S(p){return o.layerOpacities[p]??1}function b(p){return o.loadingLayers.has(p)}function k(p){return o.layerErrors[p]||null}function s(p){const d=o.currentZoom,L=p.minZoom,x=p.maxZoom;return!(L!==void 0&&d<L||x!==void 0&&d>x)}const g=e.computed({get:()=>o.searchQuery,set:p=>n("updateSearch",p)});function v(p){n("toggleLayer",p)}function y(p,d){const L=d.target,x=parseFloat(L.value);n("setOpacity",p,x)}return(p,d)=>(e.openBlock(),e.createElementBlock("aside",Tt,[t.showSearch?(e.openBlock(),e.createElementBlock("div",Mt,[e.createVNode(e.unref(xt),{modelValue:g.value,"onUpdate:modelValue":d[0]||(d[0]=L=>g.value=L),placeholder:t.searchPlaceholder,"class-name":"layer-search-field"},{"trailing-action":e.withCtx(()=>[e.createVNode(e.unref(U.Icon),{"icon-definition":e.unref($t),size:"small",inline:"",decorative:""},null,8,["icon-definition"])]),_:1},8,["modelValue","placeholder"])])):e.createCommentVNode("",!0),t.mode==="topics"?(e.openBlock(),e.createElementBlock("div",It,[e.renderSlot(p.$slots,"topics",{},()=>[d[2]||(d[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":h.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",Ot,[u(L.config.url)?(e.openBlock(),e.createElementBlock("a",{key:0,href:u(L.config.url)||"",target:"_blank",rel:"noopener noreferrer",class:"metadata-link",title:"View metadata",onClick:d[1]||(d[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(e.unref(U.Icon),{"icon-definition":e.unref(Ft),size:"small",inline:"",decorative:""},null,8,["icon-definition"])],8,Dt)):h.value?(e.openBlock(),e.createElementBlock("span",Rt)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!s(L.config),"layer-error":k(L.config.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:m(L.config.id),disabled:!s(L.config),onChange:x=>v(L.config.id)},null,40,Zt),e.createElementVNode("span",Ut,[e.createTextVNode(e.toDisplayString(L.config.title)+" ",1),b(L.config.id)?(e.openBlock(),e.createElementBlock("span",At," Loading... ")):e.createCommentVNode("",!0),k(L.config.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator",title:k(L.config.id)||""}," Error ",8,Wt)):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",qt,[e.createElementVNode("label",Gt," Opacity: "+e.toDisplayString(Math.round(S(L.config.id)*100))+"% ",1),e.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.05",value:S(L.config.id),class:"opacity-slider",onInput:x=>y(L.config.id,x)},null,40,Ht)])):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,(x,V)=>(e.openBlock(),e.createElementBlock("li",{key:V,class:"legend-item"},[x.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:x.color})},null,4)):x.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:x.color,height:`${x.width||2}px`})},null,4)):x.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:x.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Qt,e.toDisplayString(x.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("div",Kt,' No layers match "'+e.toDisplayString(t.searchQuery)+'" ',1)):e.createCommentVNode("",!0)],2))]))}}),Qe=pe(Xt,[["__scopeId","data-v-d2e878e2"]]);function P(t){if(!t||!Array.isArray(t)||t.length<3)return"#888888";const l=t[0],o=t[1],n=t[2],i=(t[3]??255)/255;return i===1?`#${l.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`:`rgba(${l}, ${o}, ${n}, ${i.toFixed(2)})`}function Q(t){return t!==void 0?t:1}const Yt=559082264;function qe(t){return!t||t<=0?null:Math.round(Math.log2(Yt/t)*100)/100}function eo(t,l){const o={};if(t&&t>0){const n=qe(t);n!==null&&(o.minZoom=n)}if(l&&l>0){const n=qe(l);n!==null&&(o.maxZoom=n)}return o}function Be(t){if(!t)return"fill";switch(t.type){case"esriSFS":return"fill";case"esriSLS":return"line";case"esriSMS":return"circle";case"esriPMS":return"circle";case"esriPFS":return"fill";default:return"fill"}}function fe(t){return!(!t||t.style==="esriSLSNull"||t.color===null||t.width===0||t.color&&t.color[3]===0)}function Me(t){return String(t)}function Ke(t,l,o){const n=t.symbol,r=Be(n);let i={},u=[],h=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),b=m===0?0:m<255?1:Q(l);if(i={"fill-color":S,"fill-opacity":b},fe(n.outline)){const k=n.outline.width||1,s=P(n.outline.color);m!==0&&(i["fill-outline-color"]=s),(k>1||m===0)&&(h={"line-color":s,"line-width":k})}u=[{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":Q(l)},u=[{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":Q(l)},fe(n.outline)&&(i["circle-stroke-color"]=P(n.outline.color),i["circle-stroke-width"]=n.outline.width||1),u=[{type:"circle",color:P(n.color),label:t.label||"Feature"}]}return{paint:i,legend:u,geomType:r,outlinePaint:h}}function to(t,l,o){const n=t.field1,r=t.uniqueValueInfos||[],i=t.defaultSymbol;if(r.length===0)return Ke({...t,symbol:i},l);const u=r[0]?.symbol||i,h=Be(u);let m={},S=[],b=null;if(h==="fill"){const k=["match",["to-string",["get",n]]];for(const s of r){k.push(Me(s.value)),k.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(k.push(i?P(i.color):"#888888"),m={"fill-color":k,"fill-opacity":Q(l)},fe(u?.outline)){const s=u.outline.width||1,g=P(u.outline.color);m["fill-outline-color"]=g,s>1&&(b={"line-color":g,"line-width":s})}}else if(h==="line"){const k=["match",["to-string",["get",n]]];for(const s of r){k.push(Me(s.value)),k.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})}k.push(i?P(i.color):"#888888"),m={"line-color":k,"line-width":u?.width||2,"line-opacity":Q(l)}}else if(h==="circle"){const k=["match",["to-string",["get",n]]];for(const g of r){k.push(Me(g.value)),k.push(P(g.symbol?.color));const v=String(g.value),p=o?.get(v)||g.label||v;S.push({type:"circle",color:P(g.symbol?.color),label:p})}k.push(i?P(i.color):"#888888");const s=Math.round((u?.size||6)*.71*100)/100;m={"circle-color":k,"circle-radius":s,"circle-opacity":Q(l)},fe(u?.outline)&&(m["circle-stroke-color"]=P(u.outline.color),m["circle-stroke-width"]=u.outline.width||1)}return{paint:m,legend:S,geomType:h,outlinePaint:b}}function oo(t,l){const o=t.field,n=t.classBreakInfos||[],r=t.visualVariables?.find(b=>b.type==="colorInfo");if(r?.stops&&r.stops.length>0)return no(r,o,t,l);if(n.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=n[0]?.symbol,u=Be(i);let h={},m=[],S=null;if(u==="fill"){const b=["step",["get",o]];b.push(P(n[0]?.symbol?.color));for(let k=0;k<n.length;k++){const s=n[k];k>0&&(b.push(n[k-1].classMaxValue),b.push(P(s.symbol?.color))),m.push({type:"fill",color:P(s.symbol?.color),label:s.label||`${s.classMaxValue}`})}if(h={"fill-color":b,"fill-opacity":Q(l)},fe(i?.outline)){const k=i.outline.width||1,s=P(i.outline.color);h["fill-outline-color"]=s,k>1&&(S={"line-color":s,"line-width":k})}}else if(u==="line"){const b=["step",["get",o]];b.push(P(n[0]?.symbol?.color));let k=t.minValue??0;for(let g=0;g<n.length;g++){const v=n[g];g>0&&(b.push(n[g-1].classMaxValue),b.push(P(v.symbol?.color))),m.push({type:"line",color:P(v.symbol?.color),width:v.symbol?.width||i?.width||2,label:v.label||`${k} - ${v.classMaxValue}`}),k=v.classMaxValue+1}const s=i?.width||2;h={"line-color":b,"line-width":s,"line-opacity":Q(l)}}return{paint:h,legend:m,geomType:u,outlinePaint:S}}function no(t,l,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,u=Be(i);let h={},m=[],S=null;if(u==="fill"){const b=["interpolate",["linear"],["get",l]];for(const s of r)b.push(s.value),b.push(P(s.color)),m.push({type:"fill",color:P(s.color),label:s.label||`${s.value}`});if(h={"fill-color":["case",["==",["get",l],null],"rgba(0, 0, 0, 0)",b],"fill-opacity":Q(n)},fe(i?.outline)){const s=i.outline.width||1,g=P(i.outline.color);h["fill-outline-color"]=g,s>1&&(S={"line-color":g,"line-width":s})}}return{paint:h,legend:m,geomType:u,outlinePaint:S}}function lo(t,l,o,n){if(!t?.renderer)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const r=t.renderer;switch(r.type){case"simple":return Ke(r,l);case"uniqueValue":return to(r,l,o);case"classBreaks":return oo(r,l);default:return{paint:{},legend:[],geomType:"fill",outlinePaint:null}}}function ao(t){if(!t)return null;const l=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:l,fields:n}}function ro(t){return t?.definitionExpression}function io(t){return(t.includes("_")?t.split("_").slice(1).join(" "):t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function so(t){return t.includes("_")?t.split("_").slice(1).join(" "):t}function co(t){const l=new Map;if(!t)return l;const o=t.split(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),q=require("@phila/phila-ui-map-core"),U=require("@phila/phila-ui-core");var ue=typeof document<"u"?document.currentScript:null;function Se(t,l,o={}){const n={type:"Feature"};return(o.id===0||o.id)&&(n.id=o.id),o.bbox&&(n.bbox=o.bbox),n.properties=l||{},n.geometry=t,n}function at(t,l,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 Se({type:"Polygon",coordinates:t},l,o)}function rt(t,l,o={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return Se({type:"LineString",coordinates:t},l,o)}function it(t,l,o={}){return Se({type:"MultiLineString",coordinates:t},l,o)}function st(t,l,o={}){return Se({type:"MultiPolygon",coordinates:t},l,o)}function ct(t){return t.type==="Feature"?t.geometry:t}function ut(t,l,o){var n=t.length,r=de(t[0],l),i=[],u,h,m;let S,b;for(o||(o=[]),u=1;u<n;u++){for(S=t[u-1],b=t[u],h=m=de(b,l);;)if(r|h){if(r&h)break;r?(S=Ie(S,b,r,l),r=de(S,l)):(b=Ie(S,b,h,l),h=de(b,l))}else{i.push(S),h!==m?(i.push(b),u<n-1&&(o.push(i),i=[])):u===n-1&&i.push(b);break}r=m}return i.length&&o.push(i),o}function dt(t,l){var o,n,r,i,u,h,m;for(n=1;n<=8;n*=2){for(o=[],r=t[t.length-1],i=!(de(r,l)&n),u=0;u<t.length;u++)h=t[u],m=!(de(h,l)&n),m!==i&&o.push(Ie(r,h,n,l)),m&&o.push(h),r=h,i=m;if(t=o,!t.length)break}return o}function Ie(t,l,o,n){return o&8?[t[0]+(l[0]-t[0])*(n[3]-t[1])/(l[1]-t[1]),n[3]]:o&4?[t[0]+(l[0]-t[0])*(n[1]-t[1])/(l[1]-t[1]),n[1]]:o&2?[n[2],t[1]+(l[1]-t[1])*(n[2]-t[0])/(l[0]-t[0])]:o&1?[n[0],t[1]+(l[1]-t[1])*(n[0]-t[0])/(l[0]-t[0])]:null}function de(t,l){var o=0;return t[0]<l[0]?o|=1:t[0]>l[2]&&(o|=2),t[1]<l[1]?o|=4:t[1]>l[3]&&(o|=8),o}function ft(t,l){const o=ct(t),n=o.type,r=t.type==="Feature"?t.properties:{};let i=o.coordinates;switch(n){case"LineString":case"MultiLineString":{const u=[];return n==="LineString"&&(i=[i]),i.forEach(h=>{ut(h,l,u)}),u.length===1?rt(u[0],r):it(u,r)}case"Polygon":return at(We(i,l),r);case"MultiPolygon":return st(i.map(u=>We(u,l)),r);default:throw new Error("geometry "+n+" not supported")}}function We(t,l){const o=[];for(const n of t){const r=dt(n,l);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 pt=ft;const mt={class:"map-panel"},yt=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:l}){const o=t,n=l,r=e.ref(null),i=e.ref(null),u=e.ref(0);function h(a){n("zoom",a),i.value&&(u.value=m(i.value))}function m(a){const f=a.getZoom(),B=a.getCenter().lat,C=559082264028e-3,N=B*Math.PI/180;return C*Math.cos(N)/Math.pow(2,f)}const S=e.ref({}),b=e.ref(null),k=e.ref(new Set),s=["fema-100-year-floodplain","fema-500-year-floodplain"];async function g(a,f,c,B){const C=encodeURIComponent(B||"1=1"),N=JSON.stringify({xmin:f.west,ymin:f.south,xmax:f.east,ymax:f.north,spatialReference:{wkid:4326}}),$=2e3;let F=0,M=[],A=!0;for(;A;){const O=`${a}/query?where=${C}&geometry=${encodeURIComponent(N)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=true&resultRecordCount=${$}&resultOffset=${F}&f=geojson`,z=await fetch(O);if(!z.ok)throw new Error(`HTTP ${z.status}: ${z.statusText}`);const D=await z.json();D.features&&D.features.length>0?(M=M.concat(D.features),F+=D.features.length,A=D.features.length===$):A=!1}if(s.includes(c)){const O=[f.west,f.south,f.east,f.north];M=M.map(z=>{if(z.geometry&&(z.geometry.type==="Polygon"||z.geometry.type==="MultiPolygon"))try{return pt(z,O)}catch{return z}return z})}return{type:"FeatureCollection",features:M}}async function v(a,f){const c=f.map(async B=>{const C=o.layerList.find(N=>N.config.id===B)?.config;if(C){n("layerLoading",B,!0);try{const N=await g(C.url,a,B,C.where);S.value={...S.value,[B]:N},n("layerError",B,null)}catch(N){const $=N instanceof Error?N.message:"Failed to load";n("layerError",B,$)}finally{n("layerLoading",B,!1)}}});await Promise.all(c)}async function y(a){const f=[...o.visibleLayers];await v(a,f)}function p(a){b.value=a.bounds,y(a.bounds)}function d(a){i.value=a;const f=a.getBounds();b.value={west:f.getWest(),south:f.getSouth(),east:f.getEast(),north:f.getNorth()};const c=a.getZoom();n("zoom",c),u.value=m(a),y(b.value)}e.watch(()=>o.visibleLayers.size,async()=>{if(j.value.length>0&&W(),b.value){const a=new Set(o.visibleLayers),f=[...a].filter(c=>!k.value.has(c));k.value=new Set(a),f.length>0&&await v(b.value,f)}});function L(a){return o.visibleLayers.has(a)}function x(a){return!!S.value[a.id]}const V=e.computed(()=>o.layerList.filter(a=>a.config.type==="circle"&&L(a.config.id)&&x(a.config)).map(a=>a.config)),_=e.computed(()=>o.layerList.filter(a=>a.config.type==="fill"&&L(a.config.id)&&x(a.config)).map(a=>a.config)),I=e.computed(()=>o.layerList.filter(a=>a.config.type==="fill"&&a.config.outlinePaint&&L(a.config.id)&&x(a.config)).map(a=>a.config)),J=e.computed(()=>o.layerList.filter(a=>a.config.type==="line"&&L(a.config.id)&&x(a.config)).map(a=>a.config));function le(a){return o.visibleTiledLayers?.has(a)??!1}function ae(a){return o.tiledLayerOpacities?.[a]??1}function Ne(a){return`${a.replace(/\/$/,"")}/tile/{z}/{y}/{x}`}function Ve(a){return{type:"raster",tiles:[Ne(a.url)],tileSize:256,attribution:a.attribution||""}}const me=e.ref({}),he=e.ref(new Set);async function ye(a){if(!he.value.has(a.id)){he.value.add(a.id);try{const f=a.url.replace(/\/$/,""),c=await fetch(`${f}?f=json`);if(!c.ok)return;const B=await c.json();let C=B.minScale||0,N=B.maxScale||0;if(B.layers&&B.layers.length>0)for(const $ of B.layers)$.maxScale&&$.maxScale>0&&(N===0||$.maxScale<N)&&(N=$.maxScale);N===0&&(N=72e3),me.value={...me.value,[a.id]:{minScale:C,maxScale:N}}}catch{}}}e.onMounted(()=>{if(o.tiledLayers)for(const a of o.tiledLayers)a.scaleBasedRendering&&ye(a)});function ve(a){if(!a.scaleBasedRendering)return"tiled";const f=me.value[a.id];if(!f)return"tiled";const c=u.value;return c===0||c>f.maxScale?"tiled":"dynamic"}const xe=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(a=>le(a.id)?a.scaleBasedRendering?ve(a)==="tiled":!0:!1):[]),$e=e.computed(()=>o.tiledLayers?o.tiledLayers.filter(a=>le(a.id)&&a.scaleBasedRendering?ve(a)==="dynamic":!1):[]);function re(a){return{type:"raster",tiles:[`${a.url.replace(/\/$/,"")}/export?bbox={bbox-epsg-3857}&bboxSR=3857&imageSR=3857&size=256,256&format=png32&transparent=true&f=image`],tileSize:256,attribution:a.attribution||""}}function K(a){return{type:"geojson",data:S.value[a.id]}}function ie(a){return o.layerOpacities[a]??1}function X(a){const f=ie(a.id),c=a.type==="circle"?"circle-opacity":a.type==="fill"?"fill-opacity":"line-opacity";if(a.type==="fill"&&a.paint["fill-opacity"]===0)return{...a.paint,"fill-opacity":0};const B=a.type==="circle"?"circle-color":a.type==="fill"?"fill-color":"line-color",C={...a.paint},N=C[B],$=C[c]===1,F=typeof N=="string"&&N.startsWith("rgba(");if($&&F){if(f===1)return C;{const M=N.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(M&&M[4]){const[,A,O,z,D]=M,Te=parseFloat(D)*f;C[B]=`rgba(${A}, ${O}, ${z}, ${Te})`,C[c]=1}return C}}if(F){const M=N.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);if(M){const[,A,O,z]=M;C[B]=`rgb(${A}, ${O}, ${z})`}}return C[c]=f,C}function Pe(a){const f=ie(a.id);return{...a.outlinePaint,"line-opacity":f}}const j=e.ref([]),Y=e.ref(null),R=e.ref(0);function se(a){const f=a.replace(/-outline$/,"");return o.layerList.find(B=>B.config.id===f)?.config}function oe(a,f){return a.replace(/\{([^}]+)\}/g,(c,B)=>{const C=f[B];return C==null?"":String(C)})}function ze(a,f){if(a==null)return"-";if(f?.dateFormat&&typeof a=="number"){const c=new Date(a);switch(f.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 a=="number"){if(a>1e12&&!f)return new Date(a).toLocaleDateString();const c=f?.places,B=f?.digitSeparator??!0;if(c!==void 0){const C=a.toFixed(c);if(B){const N=C.split("."),$=N[0]||"0",F=N[1],M=$.replace(/\B(?=(\d{3})+(?!\d))/g,",");return F?`${M}.${F}`:M}return C}return B?a.toLocaleString():String(a)}return String(a)}function be(a){const f=new Set;return a.filter(c=>{const C=`${c.layer.id.replace(/-outline$/,"")}:${JSON.stringify(c.properties)}`;return f.has(C)?!1:(f.add(C),!0)})}function ee(a,f){const c=new Map;return f.forEach((B,C)=>{c.set(B.id,C)}),a.sort((B,C)=>{const N=B.layer.id.replace(/-outline$/,""),$=C.layer.id.replace(/-outline$/,""),F=c.get(N)??-1;return(c.get($)??-1)-F})}function ce(a){const f=i.value;if(!f)return;const c=[];o.layerList.forEach(O=>{const z=O.config;o.visibleLayers.has(z.id)&&(c.push(z.id),z.outlinePaint&&c.push(`${z.id}-outline`))});const B=f.project([a.lngLat.lng,a.lngLat.lat]),C=f.queryRenderedFeatures(B,{layers:c});if(C.length===0)return;const N=be(C),$=o.layerList.map(O=>O.config),F=ee(N,$),M=F.map(O=>{const z=O.layer.id.replace(/-outline$/,""),D=se(z);return D?{layerId:D.id,layerTitle:D.title,properties:O.properties||{},popupConfig:D.popup}:null}).filter(O=>O!==null);if(M.length===0)return;j.value=M,R.value=0,Y.value=[a.lngLat.lng,a.lngLat.lat];const A=F[0];if(A&&A.geometry){const O=A.layer.id.replace(/-outline$/,""),z=se(O);if(z){const D=Re(A.geometry),Te=Ze(z.id,z.type);te.value={geometry:A.geometry,geometryType:D,layerId:z.id,properties:A.properties||{},originalStyle:Te}}}}function W(){j.value=[],Y.value=null,R.value=0,te.value=null}function ne(a){if(j.value.length===0)return;const f=a.target;if(!(f.tagName==="INPUT"||f.tagName==="TEXTAREA"||f.isContentEditable))switch(a.key){case"ArrowLeft":case"ArrowUp":a.preventDefault(),ke();break;case"ArrowRight":case"ArrowDown":a.preventDefault(),G();break;case"Escape":a.preventDefault(),W();break}}e.onMounted(()=>{window.addEventListener("keydown",ne)}),e.onUnmounted(()=>{window.removeEventListener("keydown",ne)});function G(){const a=j.value.length;a<=1||(R.value=(R.value+1)%a)}function ke(){const a=j.value.length;a<=1||(R.value=(R.value-1+a)%a)}const w=e.computed(()=>j.value.length===0?null:j.value[R.value]),E=e.computed(()=>{const a=w.value;return!a||!a.popupConfig?a?.layerTitle||"":oe(a.popupConfig.title,a.properties)}),H=e.computed(()=>{const a=w.value;if(!a)return"";let f='<div class="popup-content">';if(f+=`<h3 class="popup-title">${E.value}</h3>`,a.popupConfig?.fields?.length){f+='<table class="popup-table">';for(const c of a.popupConfig.fields){const B=ze(a.properties[c.field],c.format);f+=`<tr><th>${c.label}</th><td>${B}</td></tr>`}f+="</table>"}else f+='<p class="popup-no-fields">No additional information available.</p>';return f+="</div>",f}),T=e.ref({type:"FeatureCollection",features:[]}),Z=e.ref({type:"FeatureCollection",features:[]}),_e={"circle-radius":["get","highlightRadius"],"circle-color":"#00FFFF","circle-opacity":.8,"circle-stroke-width":2,"circle-stroke-color":"#FFFFFF"},Fe={"line-width":["get","highlightWidth"],"line-color":"#00FFFF","line-opacity":.9},te=e.ref(null);function Re(a){return a.type}function Ze(a,f){const c=se(a);if(!c)return{radius:5,width:2};const B=c.paint||{};if(f==="circle"){const C=B["circle-radius"];return typeof C=="number"?{radius:C}:{radius:5}}if(f==="line"||f==="fill"){const C=B["line-width"];if(typeof C=="number")return{width:C};if(c.outlinePaint&&c.outlinePaint["line-width"]){const N=c.outlinePaint["line-width"];if(typeof N=="number")return{width:N}}return{width:2}}return{radius:5,width:2}}function Ue(a){return!a||a.length===0?[]:a[0]??[]}function tt(a){const{geometry:f,geometryType:c,originalStyle:B}=a;if(c==="Point"||c==="MultiPoint"){const N=(B.radius||5)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:f,properties:{highlightRadius:N}}]}}if(c==="LineString"||c==="MultiLineString"){const N=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:f,properties:{highlightWidth:N}}]}}if(c==="Polygon"){const C=f.coordinates,N=Ue(C),F=(B.width||2)+3;return{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:N},properties:{highlightWidth:F}}]}}if(c==="MultiPolygon"){const C=f.coordinates,$=(B.width||2)+3;return{type:"FeatureCollection",features:C.map(M=>({type:"Feature",geometry:{type:"LineString",coordinates:Ue(M)},properties:{highlightWidth:$}}))}}return{type:"FeatureCollection",features:[]}}function ot(a){if(!a){nt();return}const f=tt(a);a.geometryType==="Point"||a.geometryType==="MultiPoint"?(T.value=f,Z.value={type:"FeatureCollection",features:[]}):(Z.value=f,T.value={type:"FeatureCollection",features:[]})}function nt(){T.value={type:"FeatureCollection",features:[]},Z.value={type:"FeatureCollection",features:[]}}e.watch(te,a=>{ot(a)}),e.watch(()=>o.visibleLayers,a=>{te.value&&!a.has(te.value.layerId)&&(te.value=null,W())},{deep:!0}),e.watch(R,()=>{const a=w.value;if(!a){te.value=null;return}const f=i.value;if(!f||!Y.value)return;const c=[];o.layerList.forEach($=>{const F=$.config;o.visibleLayers.has(F.id)&&(c.push(F.id),F.outlinePaint&&c.push(`${F.id}-outline`))});const B=f.project(Y.value),N=f.queryRenderedFeatures(B,{layers:c}).find($=>$.layer.id.replace(/-outline$/,"")===a.layerId&&JSON.stringify($.properties)===JSON.stringify(a.properties));if(N&&N.geometry){const $=se(a.layerId);if($){const F=Re(N.geometry),M=Ze($.id,$.type);te.value={geometry:N.geometry,geometryType:F,layerId:$.id,properties:N.properties||{},originalStyle:M}}}});const Ae=e.ref(null);function lt(a){const[f,c]=a.geometry.coordinates;Ae.value=[f,c]}return(a,f)=>(e.openBlock(),e.createElementBlock("div",mt,[e.createVNode(e.unref(q.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:h,onClick:W,onMoveend:p,onLoad:d,onSearchResult:lt},{default:e.withCtx(()=>[o.drawControlPosition!==null?(e.openBlock(),e.createBlock(e.unref(q.DrawTool),{key:0,position:o.drawControlPosition},null,8,["position"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(xe.value,c=>(e.openBlock(),e.createBlock(e.unref(q.RasterLayer),{key:"tiled-"+c.id,id:"tiled-"+c.id,source:Ve(c),paint:{"raster-opacity":ae(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($e.value,c=>(e.openBlock(),e.createBlock(e.unref(q.RasterLayer),{key:"dynamic-"+c.id,id:"dynamic-"+c.id,source:re(c),paint:{"raster-opacity":ae(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(V.value,c=>(e.openBlock(),e.createBlock(e.unref(q.CircleLayer),{key:c.id,id:c.id,source:K(c),paint:X(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:ce},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,c=>(e.openBlock(),e.createBlock(e.unref(q.FillLayer),{key:c.id,id:c.id,source:K(c),paint:X(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-circles",onClick:ce},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(q.LineLayer),{key:c.id+"-outline",id:c.id+"-outline",source:K(c),paint:Pe(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:ce},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(J.value,c=>(e.openBlock(),e.createBlock(e.unref(q.LineLayer),{key:c.id,id:c.id,source:K(c),paint:X(c),minzoom:c.minZoom,maxzoom:c.maxZoom,"before-id":"highlight-lines",onClick:ce},null,8,["id","source","paint","minzoom","maxzoom"]))),128)),e.createVNode(e.unref(q.CircleLayer),{key:"highlight-circles-layer",id:"highlight-circles",source:{type:"geojson",data:T.value},paint:_e},null,8,["source"]),e.createVNode(e.unref(q.LineLayer),{key:"highlight-lines-layer",id:"highlight-lines",source:{type:"geojson",data:Z.value},paint:Fe},null,8,["source"]),e.createVNode(e.unref(q.MapMarker),{"lng-lat":Ae.value,color:"#2176d2"},null,8,["lng-lat"]),w.value&&Y.value?(e.openBlock(),e.createBlock(e.unref(q.MapPopup),{key:1,"lng-lat":Y.value,html:H.value,"close-on-click":!1,"show-navigation":j.value.length>1,"current-feature-index":R.value,"total-features":j.value.length,"layer-name":w.value.layerTitle,onClose:W,onNext:G,onPrevious:ke},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"])]))}}),pe=(t,l)=>{const o=t.__vccOpts||t;for(const[n,r]of l)o[n]=r;return o},Je=pe(yt,[["__scopeId","data-v-98ba7f8b"]]),gt=["disabled"],ht=e.defineComponent({inheritAttrs:!1,__name:"PhlButton",props:{href:{},to:{},target:{},rel:{},disabled:{type:Boolean,default:!1},clickTarget:{},variant:{default:"primary"},size:{default:"medium"},iconOnly:{type:Boolean,default:!1},iconRight:{type:Boolean},text:{},className:{},iconDefinition:{},iconClass:{},src:{},svgRaw:{}},setup(t){const l=t,o=u=>"href"in u&&u.href!==void 0||"to"in u&&u.to!==void 0,n=e.computed(()=>U.cn("phila-button",`phila-button--${l.variant}`,l.size&&`is-${l.size}`,l.iconOnly&&"icon-button",l.iconOnly&&l.variant==="standard"&&"icon-button--standard",l.className)),r=e.computed(()=>o(l)?"to"in l&&l.to!==void 0?{to:l.to,disabled:l.disabled,className:n.value}:{href:l.href,target:l.target,rel:l.rel,disabled:l.disabled,className:n.value}:{}),i=e.computed(()=>({iconDefinition:l.iconDefinition,iconClass:l.iconClass,src:l.src,iconRight:l.iconRight,iconOnly:l.iconOnly,text:l.text,size:l.size}));return(u,h)=>o(l)?(e.openBlock(),e.createBlock(e.unref(U.BaseLink),e.mergeProps({key:0},{...r.value,...u.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(U.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.text),1)])]),_:3},16)]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:1,type:"button",disabled:l.disabled,class:n.value},u.$attrs),[e.createVNode(e.unref(U.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.text),1)])]),_:3},16)],16,gt))}});var vt={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"]},bt=vt,kt={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"]},Lt=kt;const wt=["for"],Ct={class:"state-layer"},St={class:"content"},Bt={class:"input-text-container"},Et=["id","placeholder"],Nt={key:1,class:"has-text-body-small phila-supporting-text"},Vt={key:2,class:"has-text-body-small phila-error-text"},xt=e.defineComponent({inheritAttrs:!1,__name:"TextField",props:{modelValue:{default:void 0},className:{default:""},label:{default:""},id:{default:`phila-text-field-${Math.random().toString(36).substring(2,9)}`},supportingText:{default:""},placeholder:{default:""},leadingIcon:{default:""},trailingIcon:{default:""},error:{default(){return[]}}},emits:["update:modelValue"],setup(t,{emit:l}){const o=e.useAttrs(),n=t,r=e.computed(()=>typeof n.error=="string"?n.error:n.error[0]),i=e.toRef(n,"id"),u=l,h=e.ref(""),m=e.computed({get:()=>n.modelValue!==void 0?n.modelValue:h.value,set:g=>{u("update:modelValue",g),h.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"),U.cn(...g)}),b=e.computed(()=>{const g=[];return m.value!==""&&g.push("phila-text-field--filled"),n.className&&g.push(n.className),U.cn(...g)}),k=e.ref(null),s=g=>{g.target.closest("button")||k.value?.focus()};return(g,v)=>(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,wt)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["phila-text-field",b.value]),onClick:s},[e.createElementVNode("div",Ct,[n.leadingIcon?(e.openBlock(),e.createBlock(e.unref(U.Icon),{key:0,"icon-class":n.leadingIcon,inline:"",decorative:""},null,8,["icon-class"])):e.createCommentVNode("",!0),e.createElementVNode("div",St,[e.createElementVNode("div",Bt,[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:i.value,ref_key:"inputRef",ref:k,"onUpdate:modelValue":v[0]||(v[0]=y=>m.value=y),class:"phila-text-field-input has-text-body-default",placeholder:n.placeholder},e.unref(o)),null,16,Et),[[e.vModelDynamic,m.value]])])]),m.value!=""?(e.openBlock(),e.createBlock(e.unref(ht),{key:1,variant:"standard",size:"small","icon-only":"","icon-definition":e.unref(Lt),onClick:v[1]||(v[1]=y=>m.value="")},null,8,["icon-definition"])):e.createCommentVNode("",!0),n.trailingIcon?(e.openBlock(),e.createBlock(e.unref(U.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(U.Icon),{"icon-definition":e.unref(bt),size:"small",inline:"",decorative:""},null,8,["icon-definition"]),e.createTextVNode(" "+e.toDisplayString(r.value),1)])):e.createCommentVNode("",!0)],2))}});var $t={prefix:"fas",iconName:"filter",icon:[512,512,[],"f0b0","M32 64C19.1 64 7.4 71.8 2.4 83.8S.2 109.5 9.4 118.6L192 301.3 192 416c0 8.5 3.4 16.6 9.4 22.6l64 64c9.2 9.2 22.9 11.9 34.9 6.9S320 492.9 320 480l0-178.7 182.6-182.6c9.2-9.2 11.9-22.9 6.9-34.9S492.9 64 480 64L32 64z"]},Pt={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"]},_t={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"]},Ft={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 Tt={class:"layer-panel"},Mt={key:0,class:"search-box"},It={key:1,class:"topics-container"},Ot={class:"layer-row"},Dt=["href"],Rt={key:1,class:"metadata-placeholder"},Zt=["checked","disabled","onChange"],Ut={class:"layer-title"},At={key:0,class:"loading-indicator"},Wt=["title"],jt={key:2,class:"zoom-indicator"},qt={key:0,class:"opacity-control"},Gt={class:"opacity-label"},Ht=["value","onInput"],Jt={key:1,class:"layer-legend"},Qt={class:"legend-label"},Kt={key:0,class:"no-results"},Xt=e.defineComponent({__name:"LayerPanel",props:{layerList:{},visibleLayers:{},layerOpacities:{},loadingLayers:{},layerErrors:{},currentZoom:{},searchQuery:{},layerMetadata:{},mode:{default:"flat"},showSearch:{type:Boolean,default:!0},showOpacity:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},searchPlaceholder:{default:"Filter layers..."}},emits:["toggleLayer","setOpacity","updateSearch"],setup(t,{emit:l}){const o=t,n=l,r=e.computed(()=>{if(!o.searchQuery.trim())return o.layerList;const p=o.searchQuery.toLowerCase();return o.layerList.filter(d=>d.config.title.toLowerCase().includes(p))});function i(p){let d=p.split("?")[0]||p;return d=d.replace(/\/query$/,""),d=d.replace(/\/$/,""),d.toLowerCase()}function u(p){const d=i(p);return o.layerMetadata[d]||null}const h=e.computed(()=>o.layerList.some(p=>u(p.config.url)));function m(p){return o.visibleLayers.has(p)}function S(p){return o.layerOpacities[p]??1}function b(p){return o.loadingLayers.has(p)}function k(p){return o.layerErrors[p]||null}function s(p){const d=o.currentZoom,L=p.minZoom,x=p.maxZoom;return!(L!==void 0&&d<L||x!==void 0&&d>x)}const g=e.computed({get:()=>o.searchQuery,set:p=>n("updateSearch",p)});function v(p){n("toggleLayer",p)}function y(p,d){const L=d.target,x=parseFloat(L.value);n("setOpacity",p,x)}return(p,d)=>(e.openBlock(),e.createElementBlock("aside",Tt,[t.showSearch?(e.openBlock(),e.createElementBlock("div",Mt,[e.createVNode(e.unref(xt),{modelValue:g.value,"onUpdate:modelValue":d[0]||(d[0]=L=>g.value=L),placeholder:t.searchPlaceholder,"class-name":"layer-search-field"},{"trailing-action":e.withCtx(()=>[e.createVNode(e.unref(U.Icon),{"icon-definition":e.unref($t),size:"small",inline:"",decorative:""},null,8,["icon-definition"])]),_:1},8,["modelValue","placeholder"])])):e.createCommentVNode("",!0),t.mode==="topics"?(e.openBlock(),e.createElementBlock("div",It,[e.renderSlot(p.$slots,"topics",{},()=>[d[2]||(d[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":h.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",Ot,[u(L.config.url)?(e.openBlock(),e.createElementBlock("a",{key:0,href:u(L.config.url)||"",target:"_blank",rel:"noopener noreferrer",class:"metadata-link",title:"View metadata",onClick:d[1]||(d[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(e.unref(U.Icon),{"icon-definition":e.unref(Ft),size:"small",inline:"",decorative:""},null,8,["icon-definition"])],8,Dt)):h.value?(e.openBlock(),e.createElementBlock("span",Rt)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!s(L.config),"layer-error":k(L.config.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:m(L.config.id),disabled:!s(L.config),onChange:x=>v(L.config.id)},null,40,Zt),e.createElementVNode("span",Ut,[e.createTextVNode(e.toDisplayString(L.config.title)+" ",1),b(L.config.id)?(e.openBlock(),e.createElementBlock("span",At," Loading... ")):e.createCommentVNode("",!0),k(L.config.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator",title:k(L.config.id)||""}," Error ",8,Wt)):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",qt,[e.createElementVNode("label",Gt," Opacity: "+e.toDisplayString(Math.round(S(L.config.id)*100))+"% ",1),e.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.05",value:S(L.config.id),class:"opacity-slider",onInput:x=>y(L.config.id,x)},null,40,Ht)])):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,(x,V)=>(e.openBlock(),e.createElementBlock("li",{key:V,class:"legend-item"},[x.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:x.color})},null,4)):x.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:x.color,height:`${x.width||2}px`})},null,4)):x.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:x.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Qt,e.toDisplayString(x.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("div",Kt,' No layers match "'+e.toDisplayString(t.searchQuery)+'" ',1)):e.createCommentVNode("",!0)],2))]))}}),Qe=pe(Xt,[["__scopeId","data-v-d2e878e2"]]);function P(t){if(!t||!Array.isArray(t)||t.length<3)return"#888888";const l=t[0],o=t[1],n=t[2],i=(t[3]??255)/255;return i===1?`#${l.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`:`rgba(${l}, ${o}, ${n}, ${i.toFixed(2)})`}function Q(t){return t!==void 0?t:1}const Yt=559082264;function qe(t){return!t||t<=0?null:Math.round(Math.log2(Yt/t)*100)/100}function eo(t,l){const o={};if(t&&t>0){const n=qe(t);n!==null&&(o.minZoom=n)}if(l&&l>0){const n=qe(l);n!==null&&(o.maxZoom=n)}return o}function Be(t){if(!t)return"fill";switch(t.type){case"esriSFS":return"fill";case"esriSLS":return"line";case"esriSMS":return"circle";case"esriPMS":return"circle";case"esriPFS":return"fill";default:return"fill"}}function fe(t){return!(!t||t.style==="esriSLSNull"||t.color===null||t.width===0||t.color&&t.color[3]===0)}function Me(t){return String(t)}function Ke(t,l,o){const n=t.symbol,r=Be(n);let i={},u=[],h=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),b=m===0?0:m<255?1:Q(l);if(i={"fill-color":S,"fill-opacity":b},fe(n.outline)){const k=n.outline.width||1,s=P(n.outline.color);m!==0&&(i["fill-outline-color"]=s),(k>1||m===0)&&(h={"line-color":s,"line-width":k})}u=[{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":Q(l)},u=[{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":Q(l)},fe(n.outline)&&(i["circle-stroke-color"]=P(n.outline.color),i["circle-stroke-width"]=n.outline.width||1),u=[{type:"circle",color:P(n.color),label:t.label||"Feature"}]}return{paint:i,legend:u,geomType:r,outlinePaint:h}}function to(t,l,o){const n=t.field1,r=t.uniqueValueInfos||[],i=t.defaultSymbol;if(r.length===0)return Ke({...t,symbol:i},l);const u=r[0]?.symbol||i,h=Be(u);let m={},S=[],b=null;if(h==="fill"){const k=["match",["to-string",["get",n]]];for(const s of r){k.push(Me(s.value)),k.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(k.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"fill-color":k,"fill-opacity":Q(l)},fe(u?.outline)){const s=u.outline.width||1,g=P(u.outline.color);m["fill-outline-color"]=g,s>1&&(b={"line-color":g,"line-width":s})}}else if(h==="line"){const k=["match",["to-string",["get",n]]];for(const s of r){k.push(Me(s.value)),k.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})}k.push(i?P(i.color):"rgba(0, 0, 0, 0)"),m={"line-color":k,"line-width":u?.width||2,"line-opacity":Q(l)}}else if(h==="circle"){const k=["match",["to-string",["get",n]]];for(const g of r){k.push(Me(g.value)),k.push(P(g.symbol?.color));const v=String(g.value),p=o?.get(v)||g.label||v;S.push({type:"circle",color:P(g.symbol?.color),label:p})}k.push(i?P(i.color):"rgba(0, 0, 0, 0)");const s=Math.round((u?.size||6)*.71*100)/100;m={"circle-color":k,"circle-radius":s,"circle-opacity":Q(l)},fe(u?.outline)&&(m["circle-stroke-color"]=P(u.outline.color),m["circle-stroke-width"]=u.outline.width||1)}return{paint:m,legend:S,geomType:h,outlinePaint:b}}function oo(t,l){const o=t.field,n=t.classBreakInfos||[],r=t.visualVariables?.find(b=>b.type==="colorInfo");if(r?.stops&&r.stops.length>0)return no(r,o,t,l);if(n.length===0)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const i=n[0]?.symbol,u=Be(i);let h={},m=[],S=null;if(u==="fill"){const b=["step",["get",o]];b.push(P(n[0]?.symbol?.color));for(let k=0;k<n.length;k++){const s=n[k];k>0&&(b.push(n[k-1].classMaxValue),b.push(P(s.symbol?.color))),m.push({type:"fill",color:P(s.symbol?.color),label:s.label||`${s.classMaxValue}`})}if(h={"fill-color":b,"fill-opacity":Q(l)},fe(i?.outline)){const k=i.outline.width||1,s=P(i.outline.color);h["fill-outline-color"]=s,k>1&&(S={"line-color":s,"line-width":k})}}else if(u==="line"){const b=["step",["get",o]];b.push(P(n[0]?.symbol?.color));let k=t.minValue??0;for(let g=0;g<n.length;g++){const v=n[g];g>0&&(b.push(n[g-1].classMaxValue),b.push(P(v.symbol?.color))),m.push({type:"line",color:P(v.symbol?.color),width:v.symbol?.width||i?.width||2,label:v.label||`${k} - ${v.classMaxValue}`}),k=v.classMaxValue+1}const s=i?.width||2;h={"line-color":b,"line-width":s,"line-opacity":Q(l)}}return{paint:h,legend:m,geomType:u,outlinePaint:S}}function no(t,l,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,u=Be(i);let h={},m=[],S=null;if(u==="fill"){const b=["interpolate",["linear"],["get",l]];for(const s of r)b.push(s.value),b.push(P(s.color)),m.push({type:"fill",color:P(s.color),label:s.label||`${s.value}`});if(h={"fill-color":["case",["==",["get",l],null],"rgba(0, 0, 0, 0)",b],"fill-opacity":Q(n)},fe(i?.outline)){const s=i.outline.width||1,g=P(i.outline.color);h["fill-outline-color"]=g,s>1&&(S={"line-color":g,"line-width":s})}}return{paint:h,legend:m,geomType:u,outlinePaint:S}}function lo(t,l,o,n){if(!t?.renderer)return{paint:{},legend:[],geomType:"fill",outlinePaint:null};const r=t.renderer;switch(r.type){case"simple":return Ke(r,l);case"uniqueValue":return to(r,l,o);case"classBreaks":return oo(r,l);default:return{paint:{},legend:[],geomType:"fill",outlinePaint:null}}}function ao(t){if(!t)return null;const l=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:l,fields:n}}function ro(t){return t?.definitionExpression}function io(t){return(t.includes("_")?t.split("_").slice(1).join(" "):t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function so(t){return t.includes("_")?t.split("_").slice(1).join(" "):t}function co(t){const l=new Map;if(!t)return l;const o=t.split(`
2
2
  `),n=/^(\d{1,3})\s+(.+)$/;for(const r of o){const i=r.trim().match(n);if(i){const[,u,h]=i;u&&h&&l.set(u,h.trim())}}return l}async function uo(t){try{const l=await fetch(`${t}?f=json`);if(!l.ok)return null;const o=await l.json();return o.drawingInfo?{drawingInfo:o.drawingInfo,description:o.description}:null}catch{return null}}async function Oe(t){const l=t.operationalLayers||[],o=[],n=["Zoning and Planning_Land Use"];for(const r of l)if(r.url&&r.itemId!=="4f39b829b96d437da9231727d9c91fab")try{let i=r.layerDefinition?.drawingInfo,u;const h=!i||!i.renderer,m=n.includes(r.title);if((h||m)&&r.url){const V=await uo(r.url);V&&(i=V.drawingInfo,V.description&&(u=co(V.description),u.size>0))}const{paint:S,legend:b,geomType:k,outlinePaint:s}=lo(i,r.opacity,u,r.title),g=ao(r.popupInfo),v=ro(r.layerDefinition),y=eo(r.layerDefinition?.minScale,r.layerDefinition?.maxScale),p=io(r.title),d=so(r.title);let L=r.opacity??1;const x={id:p,title:d,type:k,url:r.url,opacity:L,paint:S,legend:b,popup:g};v&&(x.where=v),y.minZoom!==void 0&&(x.minZoom=y.minZoom),y.maxZoom!==void 0&&(x.maxZoom=y.maxZoom),s&&(x.outlinePaint=s),o.push(x)}catch{}return o.sort((r,i)=>r.title.localeCompare(i.title)),o}const Ge={},De="376af635c84643cd816a8c5d017a53aa",fo=De;function Ee(t,l){let o=`https://www.arcgis.com/sharing/rest/content/items/${t}/data?f=json`;return l&&(o+=`&token=${l}`),o}function po(){return Ee(De)}const we=new Map,ge=new Map;function Xe(t){t?(we.delete(t),ge.delete(t)):(we.clear(),ge.clear())}let Le,He=0;async function mo(){const t=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:ue&&ue.tagName.toUpperCase()==="SCRIPT"&&ue.src||new URL("index.js",document.baseURI).href}<"u"&&Ge?.VITE_AGO_USERNAME,l=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:ue&&ue.tagName.toUpperCase()==="SCRIPT"&&ue.src||new URL("index.js",document.baseURI).href}<"u"&&Ge?.VITE_AGO_PASSWORD;if(!(!t||!l)){if(Le&&Date.now()<He-3e5)return Le;try{const n=await(await fetch("https://www.arcgis.com/sharing/rest/generateToken",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({f:"json",username:t,password:l,referer:window.location.origin||"https://localhost",expiration:"120"})})).json();return n.error?void 0:(Le=n.token,He=n.expires,Le)}catch{return}}}async function yo(t,l){const o=Ee(t,l),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 go(t){try{const l=await mo(),o=await yo(t,l);return await Oe(o)}catch(l){throw new Error(`Failed to load dynamic layer configs: ${l instanceof Error?l.message:"Unknown error"}`)}}async function Ce(t=De){const l=we.get(t);if(l)return l;const o=ge.get(t);if(o)return o;const n=(async()=>{try{const r=await go(t);return we.set(t,r),r}finally{ge.delete(t)}})();return ge.set(t,n),n}function Ye(t){const l=e.ref({}),o=new Map;for(const s of t)l.value[s.id]={data:null,loading:!1,error:null,lastFetched:null};async function n(s){const g=s.id;l.value={...l.value,[g]:{data:l.value[g]?.data??null,lastFetched:l.value[g]?.lastFetched??null,loading:!0,error:null}};try{let v;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}`);v=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}`);v=await y.json()}else if(s.type==="esri"){const p=`${s.url.replace(/\/$/,"")}/query?where=1%3D1&outFields=*&returnGeometry=false&f=json`,d=await fetch(p,s.options);if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);v=(await d.json()).features?.map(x=>x.attributes)||[]}else throw new Error(`Unknown data source type: ${s.type}`);s.transform&&(v=s.transform(v)),l.value={...l.value,[g]:{data:v,loading:!1,error:null,lastFetched:Date.now()}}}catch(v){const y=v instanceof Error?v.message:"Unknown error";l.value={...l.value,[g]:{data:l.value[g]?.data??null,lastFetched:l.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(v=>v.id===s);g&&await n(g)}function u(s){return l.value[s]?.data??null}const h=e.computed(()=>Object.values(l.value).some(s=>s.loading));function m(s){return l.value[s]?.loading??!1}function S(s){return l.value[s]?.error??null}function b(){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 k(){for(const[,s]of o)window.clearInterval(s);o.clear()}return e.onMounted(()=>{r(),b()}),e.onUnmounted(()=>{k()}),{state:e.readonly(l),isLoading:h,fetchAll:r,refetch:i,getData:u,isSourceLoading:m,getError:S,stopPolling:k}}const ho={class:"layerboard-layout"},vo={key:0,class:"layerboard-subtitle"},bo={class:"layerboard-mobile-menu-content"},ko={class:"layerboard-main"},Lo={key:0,class:"layerboard-loading"},wo={key:1,class:"layerboard-error"},Co={key:0},So={key:1},Bo={class:"layerboard-modal"},Eo=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:l,emit:o}){const n=t,r=o,i=e.ref([]),u=e.ref(!0),h=e.ref(null),m=e.ref(12),S=e.ref(""),b=e.ref(new Set),k=e.ref({}),s=e.ref(new Set),g=e.ref({}),v=e.ref({}),y=e.ref(new Set),p=e.ref({});function d(){const w={};for(const E of n.tiledLayers)w[E.id]=E.opacity??1;p.value=w}function L(w){y.value.has(w)?y.value.delete(w):y.value.add(w),y.value=new Set(y.value)}function x(w,E){E?y.value.add(w):y.value.delete(w),y.value=new Set(y.value)}function V(w,E){p.value={...p.value,[w]:E}}const _=n.dataSources.length>0?Ye(n.dataSources):null,I=e.computed(()=>_?.state.value??{}),J=e.computed(()=>_?.isLoading.value??!1);function le(w){return _?.getData(w)??null}function ae(w){return _?.refetch(w)??Promise.resolve()}e.provide("layerboard-layers",e.readonly(i)),e.provide("layerboard-visible",b),e.provide("layerboard-opacities",k),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",re),e.provide("layerboard-set-layer-visible",K),e.provide("layerboard-set-layers-visible",ie),e.provide("layerboard-set-opacity",X),e.provide("layerboard-tiled-layers",e.readonly(e.computed(()=>n.tiledLayers))),e.provide("layerboard-visible-tiled",y),e.provide("layerboard-tiled-opacities",p),e.provide("layerboard-toggle-tiled",L),e.provide("layerboard-set-tiled-opacity",V),e.provide("layerboard-set-tiled-visible",x),e.provide("layerboard-data-sources-state",I),e.provide("layerboard-data-sources-loading",J),e.provide("layerboard-get-data-source",le),e.provide("layerboard-refetch-data-source",ae);const Ne=e.computed(()=>({backgroundColor:n.themeColor})),Ve=e.computed(()=>({backgroundColor:n.themeColor})),me=e.computed(()=>({backgroundColor:n.themeColor})),he=e.computed(()=>({width:ee.value?"0":n.sidebarWidth}));async function ye(){try{u.value=!0,h.value=null;const E=(await Ce(n.webMapId)).map(T=>{const Z=n.layerStyleOverrides[T.id];return Z?{...T,paint:Z.paint??T.paint,outlinePaint:Z.outlinePaint??T.outlinePaint,legend:Z.legend??T.legend,type:Z.type??T.type}:T});i.value=E.map(T=>({config:T,component:T.type}));const H={};E.forEach(T=>{H[T.id]=T.opacity??1}),k.value=H,r("configs-loaded",E)}catch(w){const E=w instanceof Error?w.message:"Failed to load layer configurations";h.value=E,r("load-error",E)}finally{u.value=!1}}function ve(w){let E=w.split("?")[0]||w;return E=E.replace(/\/query$/,""),E=E.replace(/\/$/,""),E.toLowerCase()}async function xe(){if(n.fetchMetadata)try{const w="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"),E=await fetch(w);if(!E.ok)return;const H=await E.json(),T={};for(const Z of H.rows||[])if(Z.url_text&&Z.representation){const _e=ve(Z.url_text),Fe=`https://metadata.phila.gov/#home/representationdetails/${Z.representation}/`;T[_e]=Fe}v.value=T}catch{}}function $e(w){m.value=w,r("zoom",w)}function re(w){b.value.has(w)?b.value.delete(w):b.value.add(w),b.value=new Set(b.value)}function K(w,E){E?b.value.add(w):b.value.delete(w),b.value=new Set(b.value)}function ie(w,E){for(const H of w)E?b.value.add(H):b.value.delete(H);b.value=new Set(b.value)}function X(w,E){k.value={...k.value,[w]:E}}function Pe(w,E){E?s.value.add(w):s.value.delete(w),s.value=new Set(s.value)}function j(w,E){if(E)g.value={...g.value,[w]:E};else{const{[w]:H,...T}=g.value;g.value=T}}function Y(w){S.value=w}const R=e.ref("map");function se(){R.value=R.value==="sidebar"?"map":"sidebar"}const oe=e.ref(!1);function ze(){oe.value=!oe.value}function be(){oe.value=!1}const ee=e.ref(!1);function ce(){ee.value=!ee.value}const W=e.ref(!1);function ne(){W.value=!0}function G(){W.value=!1}function ke(w){w.target.classList.contains("layerboard-modal-backdrop")&&G()}return e.provide("layerboard-open-modal",ne),e.provide("layerboard-close-modal",G),e.provide("layerboard-is-modal-open",e.readonly(W)),l({layerList:i,visibleLayers:b,layerOpacities:k,loadingLayers:s,layerErrors:g,currentZoom:m,toggleLayer:re,setLayerVisible:K,setLayersVisible:ie,setLayerOpacity:X,reloadConfigs:ye,clearCache:()=>Xe(n.webMapId),visibleTiledLayers:y,tiledLayerOpacities:p,toggleTiledLayer:L,setTiledLayerVisible:x,setTiledLayerOpacity:V,dataSourcesState:I,dataSourcesLoading:J,getDataSourceData:le,refetchDataSource:ae,isModalOpen:W,openModal:ne,closeModal:G}),e.onMounted(()=>{ye(),xe(),d()}),(w,E)=>(e.openBlock(),e.createElementBlock("div",ho,[e.createElementVNode("header",{class:"layerboard-header",style:e.normalizeStyle(Ne.value)},[E[1]||(E[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)),E[2]||(E[2]=e.createElementVNode("span",{class:"layerboard-header-divider layerboard-desktop-only"},null,-1)),e.createElementVNode("button",{class:"layerboard-hamburger layerboard-mobile-only",onClick:ze,"aria-label":"Toggle menu"},[e.createVNode(e.unref(U.Icon),{"icon-definition":e.unref(_t),size:"medium",decorative:""},null,8,["icon-definition"])]),e.renderSlot(w.$slots,"header",{},()=>[e.createElementVNode("h1",null,e.toDisplayString(t.title),1),t.subtitle?(e.openBlock(),e.createElementBlock("span",vo,e.toDisplayString(t.subtitle),1)):e.createCommentVNode("",!0)],!0),oe.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"layerboard-mobile-menu",style:e.normalizeStyle({backgroundColor:t.themeColor})},[e.createElementVNode("div",bo,[e.renderSlot(w.$slots,"footer",{openModal:ne,closeModal:G,isModalOpen:W.value},()=>[E[0]||(E[0]=e.createTextVNode(" City of Philadelphia ",-1))],!0)]),e.createElementVNode("button",{class:"layerboard-mobile-menu-close",onClick:be,"aria-label":"Close menu"},[e.createVNode(e.unref(U.Icon),{"icon-definition":e.unref(je),size:"medium",decorative:""},null,8,["icon-definition"])])],4)):e.createCommentVNode("",!0),oe.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"layerboard-mobile-menu-backdrop",onClick:be})):e.createCommentVNode("",!0)],4),e.createElementVNode("div",ko,[u.value?(e.openBlock(),e.createElementBlock("div",Lo,[e.createElementVNode("div",{class:"layerboard-spinner",style:e.normalizeStyle({borderTopColor:t.themeColor})},null,4),e.createElementVNode("p",null,"Loading "+e.toDisplayString(t.title)+"...",1)])):h.value?(e.openBlock(),e.createElementBlock("div",wo,[E[3]||(E[3]=e.createElementVNode("h2",null,"Error Loading Layers",-1)),e.createElementVNode("p",null,e.toDisplayString(h.value),1),e.createElementVNode("button",{class:"layerboard-retry-button",style:e.normalizeStyle({backgroundColor:t.themeColor}),onClick:ye}," Retry ",4)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("aside",{class:e.normalizeClass(["layerboard-sidebar",{"is-active":R.value==="sidebar"}]),style:e.normalizeStyle(he.value)},[e.renderSlot(w.$slots,"sidebar",{layers:i.value,visibleLayers:b.value,layerOpacities:k.value,loadingLayers:s.value,layerErrors:g.value,currentZoom:m.value,toggleLayer:re,setLayerVisible:K,setLayersVisible:ie,setOpacity:X,tiledLayers:t.tiledLayers,visibleTiledLayers:y.value,tiledLayerOpacities:p.value,toggleTiledLayer:L,setTiledLayerVisible:x,setTiledLayerOpacity:V,dataSourcesState:I.value,dataSourcesLoading:J.value,getDataSource:le,refetchDataSource:ae},()=>[t.showDefaultSidebar?(e.openBlock(),e.createBlock(Qe,{key:0,"layer-list":i.value,"visible-layers":b.value,"layer-opacities":k.value,"loading-layers":s.value,"layer-errors":g.value,"current-zoom":m.value,"search-query":S.value,"layer-metadata":v.value,onToggleLayer:re,onSetOpacity:X,onUpdateSearch:Y},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",{class:e.normalizeClass(["layerboard-map",{"is-active":R.value==="map"}])},[e.createVNode(Je,{"visible-layers":b.value,"layer-opacities":k.value,"layer-list":i.value,"tiled-layers":t.tiledLayers,"visible-tiled-layers":y.value,"tiled-layer-opacities":p.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:$e,onLayerLoading:Pe,onLayerError:j},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":ee.value}]),style:e.normalizeStyle({left:ee.value?"0":n.sidebarWidth}),onClick:ce,"aria-label":"Toggle sidebar"},[e.createVNode(e.unref(U.Icon),{"icon-definition":ee.value?e.unref(Pt):e.unref(zt),size:"medium",decorative:""},null,8,["icon-definition"])],6)],64))]),e.createElementVNode("button",{class:"layerboard-mobile-toggle",style:e.normalizeStyle(me.value),onClick:se},[R.value==="map"?(e.openBlock(),e.createElementBlock("span",Co,e.toDisplayString(t.sidebarLabel),1)):(e.openBlock(),e.createElementBlock("span",So,e.toDisplayString(t.mapLabel),1))],4),e.createElementVNode("footer",{class:"layerboard-footer",style:e.normalizeStyle(Ve.value)},[e.renderSlot(w.$slots,"footer",{openModal:ne,closeModal:G,isModalOpen:W.value},()=>[E[4]||(E[4]=e.createTextVNode(" City of Philadelphia ",-1))],!0)],4),W.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"layerboard-modal-backdrop",onClick:ke},[e.createElementVNode("div",Bo,[e.createElementVNode("button",{class:"layerboard-modal-close",onClick:G,"aria-label":"Close modal"},[e.createVNode(e.unref(U.Icon),{"icon-definition":e.unref(je),size:"medium",decorative:""},null,8,["icon-definition"])]),e.renderSlot(w.$slots,"modal",{closeModal:G},void 0,!0)])])):e.createCommentVNode("",!0)]))}}),No=pe(Eo,[["__scopeId","data-v-dac16679"]]),Vo=["aria-expanded"],xo={key:0,class:"topic-icon"},$o={class:"topic-title"},Po={class:"topic-content"},zo=e.defineComponent({__name:"TopicAccordion",props:{title:{},icon:{},expanded:{type:Boolean,default:!1},layerIds:{default:()=>[]},headerClass:{}},emits:["toggle","layerChange"],setup(t,{emit:l}){const o=t,n=l,r=e.ref(o.expanded);e.watch(()=>o.expanded,u=>{r.value=u});function i(){r.value=!r.value,n("toggle",r.value)}return(u,h)=>{const m=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["topic-accordion",{"is-expanded":r.value}])},[e.createElementVNode("button",{class:e.normalizeClass(["topic-header",t.headerClass]),type:"button","aria-expanded":r.value,onClick:i},[t.icon||u.$slots.icon?(e.openBlock(),e.createElementBlock("span",xo,[e.renderSlot(u.$slots,"icon",{},()=>[t.icon?(e.openBlock(),e.createBlock(m,{key:0,icon:["fas",t.icon]},null,8,["icon"])):e.createCommentVNode("",!0)],!0)])):e.createCommentVNode("",!0),e.createElementVNode("span",$o,e.toDisplayString(t.title),1),e.createElementVNode("span",{class:e.normalizeClass(["topic-chevron",{"is-rotated":r.value}])},[...h[0]||(h[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"},[e.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])],2)],10,Vo),e.withDirectives(e.createElementVNode("div",Po,[e.renderSlot(u.$slots,"default",{},()=>[h[1]||(h[1]=e.createElementVNode("p",{class:"topic-empty"},"No content provided for this topic.",-1))],!0)],512),[[e.vShow,r.value]])],2)}}}),_o=pe(zo,[["__scopeId","data-v-fb48c75b"]]),Fo={class:"layer-checkbox-set"},To=["checked","disabled","onChange"],Mo={class:"layer-title"},Io={key:0,class:"loading-indicator"},Oo=["title"],Do={key:2,class:"zoom-indicator"},Ro={class:"layer-title"},Zo={key:0,class:"loading-indicator"},Uo=["title"],Ao={key:2,class:"zoom-indicator"},Wo={key:2,class:"opacity-control"},jo={class:"opacity-label"},qo=["value","onInput"],Go={key:3,class:"layer-legend"},Ho={class:"legend-label"},Jo={key:0,class:"empty-state"},Qo=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:l}){const o=t,n=l;function r(y){return o.visibleLayerIds.has(y)}function i(y){return o.layerOpacities[y]??1}function u(y){return o.loadingLayerIds.has(y)}function h(y){return o.layerErrors[y]||null}function m(y){const p=o.currentZoom,d=y.minZoom,L=y.maxZoom;return!(d!==void 0&&p<d||L!==void 0&&p>L)}function S(y){return y.displayOptions?.shouldShowCheckbox!==!1}function b(y){return o.showOpacity?y.displayOptions?.shouldShowSlider!==!1:!1}function k(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 v(y,p){const d=p.target;n("setOpacity",y,parseFloat(d.value))}return(y,p)=>(e.openBlock(),e.createElementBlock("div",Fo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,d=>(e.openBlock(),e.createElementBlock("div",{key:d.id,class:"layer-item"},[S(d)?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["layer-checkbox",{"layer-unavailable":!m(d),"layer-error":h(d.id)}])},[e.createElementVNode("input",{type:"checkbox",checked:r(d.id),disabled:!m(d),onChange:L=>g(d.id)},null,40,To),e.createElementVNode("span",Mo,[e.createTextVNode(e.toDisplayString(s(d))+" ",1),u(d.id)?(e.openBlock(),e.createElementBlock("span",Io," Loading... ")):e.createCommentVNode("",!0),h(d.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator",title:h(d.id)||""}," Error ",8,Oo)):e.createCommentVNode("",!0),m(d)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Do," (zoom in) "))])],2)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["layer-label-only",{"layer-unavailable":!m(d),"layer-error":h(d.id)}])},[e.createElementVNode("span",Ro,[e.createTextVNode(e.toDisplayString(s(d))+" ",1),u(d.id)?(e.openBlock(),e.createElementBlock("span",Zo," Loading... ")):e.createCommentVNode("",!0),h(d.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator",title:h(d.id)||""}," Error ",8,Uo)):e.createCommentVNode("",!0),m(d)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Ao," (zoom in) "))])],2)),b(d)&&r(d.id)?(e.openBlock(),e.createElementBlock("div",Wo,[e.createElementVNode("label",jo," Opacity: "+e.toDisplayString(Math.round(i(d.id)*100))+"% ",1),e.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.05",value:i(d.id),class:"opacity-slider",onInput:L=>v(d.id,L)},null,40,qo)])):e.createCommentVNode("",!0),k(d)&&r(d.id)&&d.legend?.length?(e.openBlock(),e.createElementBlock("ul",Go,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.legend,(L,x)=>(e.openBlock(),e.createElementBlock("li",{key:x,class:"legend-item"},[L.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:L.color})},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`})},null,4)):L.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:L.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",Ho,e.toDisplayString(L.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",Jo," No layers available ")):e.createCommentVNode("",!0)]))}}),Ko=pe(Qo,[["__scopeId","data-v-cc5e50fd"]]),Xo={class:"layer-radio-set"},Yo=["name","checked","disabled","onChange"],en={class:"layer-title"},tn={key:0,class:"loading-indicator"},on=["title"],nn={key:2,class:"zoom-indicator"},ln={key:0,class:"opacity-control"},an={class:"opacity-label"},rn=["value","onInput"],sn={key:1,class:"layer-legend"},cn={class:"legend-label"},un={key:0,class:"empty-state"},dn=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:l}){const o=t,n=l;function r(v){return o.visibleLayerIds.has(v)}function i(v){return o.layerOpacities[v]??1}function u(v){return o.loadingLayerIds.has(v)}function h(v){return o.layerErrors[v]||null}function m(v){const y=o.currentZoom,p=v.minZoom,d=v.maxZoom;return!(p!==void 0&&y<p||d!==void 0&&y>d)}function S(v){return o.showOpacity?v.displayOptions?.shouldShowSlider!==!1:!1}function b(v){return o.showLegend?v.displayOptions?.shouldShowLegendBox!==!1:!1}function k(v){return v.displayOptions?.layerNameChange||v.title}function s(v){const y=o.layers.filter(p=>o.visibleLayerIds.has(p.id)&&p.id!==v).map(p=>p.id);n("selectLayer",v,y)}function g(v,y){const p=y.target;n("setOpacity",v,parseFloat(p.value))}return(v,y)=>(e.openBlock(),e.createElementBlock("div",Xo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.layers,p=>(e.openBlock(),e.createElementBlock("div",{key:p.id,class:"layer-item"},[e.createElementVNode("label",{class:e.normalizeClass(["layer-radio",{"layer-unavailable":!m(p),"layer-error":h(p.id)}])},[e.createElementVNode("input",{type:"radio",name:t.groupName,checked:r(p.id),disabled:!m(p),onChange:d=>s(p.id)},null,40,Yo),e.createElementVNode("span",en,[e.createTextVNode(e.toDisplayString(k(p))+" ",1),u(p.id)?(e.openBlock(),e.createElementBlock("span",tn," Loading... ")):e.createCommentVNode("",!0),h(p.id)?(e.openBlock(),e.createElementBlock("span",{key:1,class:"error-indicator",title:h(p.id)||""}," Error ",8,on)):e.createCommentVNode("",!0),m(p)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",nn," (zoom in) "))])],2),S(p)&&r(p.id)?(e.openBlock(),e.createElementBlock("div",ln,[e.createElementVNode("label",an," Opacity: "+e.toDisplayString(Math.round(i(p.id)*100))+"% ",1),e.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.05",value:i(p.id),class:"opacity-slider",onInput:d=>g(p.id,d)},null,40,rn)])):e.createCommentVNode("",!0),b(p)&&r(p.id)&&p.legend?.length?(e.openBlock(),e.createElementBlock("ul",sn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.legend,(d,L)=>(e.openBlock(),e.createElementBlock("li",{key:L,class:"legend-item"},[d.type==="circle"?(e.openBlock(),e.createElementBlock("span",{key:0,class:"legend-symbol legend-circle",style:e.normalizeStyle({backgroundColor:d.color})},null,4)):d.type==="line"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"legend-symbol legend-line",style:e.normalizeStyle({backgroundColor:d.color,height:`${d.width||2}px`})},null,4)):d.type==="fill"?(e.openBlock(),e.createElementBlock("span",{key:2,class:"legend-symbol legend-fill",style:e.normalizeStyle({backgroundColor:d.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",cn,e.toDisplayString(d.label),1)]))),128))])):e.createCommentVNode("",!0)]))),128)),t.layers.length===0?(e.openBlock(),e.createElementBlock("div",un," No layers available ")):e.createCommentVNode("",!0)]))}}),fn=pe(dn,[["__scopeId","data-v-c0e5f6f1"]]);function pn(t){const l=e.ref([]),o=e.ref(new Set),n=e.ref({}),r=e.ref(new Set),i=e.ref({}),u=e.ref(""),h=e.ref(!1),m=e.ref(!1),S=e.ref(null),b=e.computed(()=>{if(!u.value.trim())return l.value;const V=u.value.toLowerCase();return l.value.filter(_=>_.title.toLowerCase().includes(V))}),k=e.computed(()=>l.value.map(V=>({config:V,component:V.type})));async function s(){if(!m.value){h.value=!0,S.value=null;try{let V;t.mode==="dynamic"||!t.mode?t.webMapId?V=await g(t.webMapId):V=await Ce():V=await Ce(),l.value=V;const _={};V.forEach(I=>{_[I.id]=I.opacity??1}),n.value=_,m.value=!0}catch(V){S.value=V instanceof Error?V:new Error("Failed to initialize layerboard")}finally{h.value=!1}}}async function g(V){const _=Ee(V),I=await fetch(_);if(!I.ok)throw new Error(`Failed to fetch WebMap: ${I.status} ${I.statusText}`);const J=await I.json();return Oe(J)}function v(V){const _=new Set(o.value);_.has(V)?_.delete(V):_.add(V),o.value=_}function y(V,_){n.value={...n.value,[V]:Math.max(0,Math.min(1,_))}}function p(V){u.value=V}function d(V,_){const I=new Set(r.value);_?I.add(V):I.delete(V),r.value=I}function L(V,_){if(_)i.value={...i.value,[V]:_};else{const{[V]:I,...J}=i.value;i.value=J}}function x(){l.value=[],o.value=new Set,n.value={},r.value=new Set,i.value={},u.value="",h.value=!1,m.value=!1,S.value=null}return{layerConfigs:e.readonly(l),visibleLayers:e.readonly(o),layerOpacities:e.readonly(n),loadingLayers:e.readonly(r),layerErrors:e.readonly(i),searchQuery:e.readonly(u),isLoading:e.readonly(h),isInitialized:e.readonly(m),error:e.readonly(S),filteredLayerConfigs:b,layerList:k,config:t,initialize:s,toggleLayer:v,setLayerOpacity:y,filterLayers:p,setLayerLoading:d,setLayerError:L,reset:x}}function mn(){const t=e.ref([]),l=e.ref(new Set),o=e.ref(new Set);function n(i){l.value.has(i)?l.value.delete(i):l.value.add(i)}function r(i){t.value=i}return{layers:e.computed(()=>t.value),visibleLayerIds:e.computed(()=>l.value),loadingLayerIds:e.computed(()=>o.value),toggleLayer:n,setLayers:r}}function et(t){const l=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 b=0,k=[],s=!0;try{for(;s;){const v=t.url.replace(/\/$/,""),y=encodeURIComponent(m.where||t.where||"1=1");let p=`${v}/query?where=${y}&outFields=*&returnGeometry=true&resultRecordCount=${S}&resultOffset=${b}&f=geojson`;if(m.bounds){const x=JSON.stringify({xmin:m.bounds.west,ymin:m.bounds.south,xmax:m.bounds.east,ymax:m.bounds.north,spatialReference:{wkid:4326}});p+=`&geometry=${encodeURIComponent(x)}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects`}const d=await fetch(p);if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);const L=await d.json();L.features&&L.features.length>0?(k=k.concat(L.features),b+=L.features.length,s=L.features.length===S):s=!1}const g={type:"FeatureCollection",features:k};return l.value=g,r.value=k.length,g}catch(g){const v=g instanceof Error?g:new Error("Failed to fetch features");throw n.value=v,v}finally{o.value=!1}}function u(){l.value=null,r.value=0,n.value=null}async function h(m={}){return i(m)}return{data:e.readonly(l),isLoading:e.readonly(o),error:e.readonly(n),totalFeatures:e.readonly(r),config:t,fetch:i,refetch:h,clear:u}}function yn(t,l,o){const n=et(t);return e.watch(l,async r=>{if(r){const i=o(r);await n.fetch(i)}},{immediate:!0}),n}exports.LayerCheckboxSet=Ko;exports.LayerPanel=Qe;exports.LayerRadioButtonSet=fn;exports.Layerboard=No;exports.MapPanel=Je;exports.TopicAccordion=_o;exports.WEBMAP_ID=fo;exports.buildWebMapUrl=Ee;exports.clearCache=Xe;exports.getLayerConfigs=Ce;exports.getWebMapUrl=po;exports.transformWebMapToLayerConfigs=Oe;exports.useApiDataSources=Ye;exports.useDataSource=et;exports.useLayerConfig=mn;exports.useLayerboard=pn;exports.useReactiveDataSource=yn;
package/dist/index.mjs CHANGED
@@ -770,7 +770,7 @@ const Qt = { class: "map-panel" }, Kt = /* @__PURE__ */ ve({
770
770
  for (const [o, a] of n)
771
771
  t[o] = a;
772
772
  return t;
773
- }, Xt = /* @__PURE__ */ ze(Kt, [["__scopeId", "data-v-3f5a9efa"]]), Yt = ["disabled"], eo = /* @__PURE__ */ ve({
773
+ }, Xt = /* @__PURE__ */ ze(Kt, [["__scopeId", "data-v-98ba7f8b"]]), Yt = ["disabled"], eo = /* @__PURE__ */ ve({
774
774
  inheritAttrs: !1,
775
775
  __name: "PhlButton",
776
776
  props: {
@@ -817,8 +817,7 @@ const Qt = { class: "map-panel" }, Kt = /* @__PURE__ */ ve({
817
817
  iconRight: n.iconRight,
818
818
  iconOnly: n.iconOnly,
819
819
  text: n.text,
820
- size: n.size,
821
- shadow: n.iconOnly && n.variant === "standard"
820
+ size: n.size
822
821
  })
823
822
  );
824
823
  return (c, v) => t(n) ? (u(), ee(O(Nt), tt({ key: 0 }, { ...a.value, ...c.$attrs }, { role: "button" }), {
@@ -914,8 +913,7 @@ const ao = ["for"], lo = { class: "state-layer" }, ro = { class: "content" }, so
914
913
  key: 0,
915
914
  "icon-class": o.leadingIcon,
916
915
  inline: "",
917
- decorative: "",
918
- shadow: ""
916
+ decorative: ""
919
917
  }, null, 8, ["icon-class"])) : T("", !0),
920
918
  k("div", ro, [
921
919
  k("div", so, [
@@ -944,8 +942,7 @@ const ao = ["for"], lo = { class: "state-layer" }, ro = { class: "content" }, so
944
942
  size: "small",
945
943
  "icon-class": o.trailingIcon,
946
944
  inline: "",
947
- decorative: "",
948
- shadow: ""
945
+ decorative: ""
949
946
  }, null, 8, ["icon-class"])) : T("", !0),
950
947
  le(h.$slots, "trailing-action")
951
948
  ])
@@ -1299,7 +1296,7 @@ function No(e, n, t) {
1299
1296
  label: g
1300
1297
  });
1301
1298
  }
1302
- if (L.push(l ? D(l.color) : "#888888"), y = {
1299
+ if (L.push(l ? D(l.color) : "rgba(0, 0, 0, 0)"), y = {
1303
1300
  "fill-color": L,
1304
1301
  "fill-opacity": de(n)
1305
1302
  }, Me(c?.outline)) {
@@ -1321,7 +1318,7 @@ function No(e, n, t) {
1321
1318
  label: g
1322
1319
  });
1323
1320
  }
1324
- L.push(l ? D(l.color) : "#888888"), y = {
1321
+ L.push(l ? D(l.color) : "rgba(0, 0, 0, 0)"), y = {
1325
1322
  "line-color": L,
1326
1323
  "line-width": c?.width || 2,
1327
1324
  "line-opacity": de(n)
@@ -1337,7 +1334,7 @@ function No(e, n, t) {
1337
1334
  label: p
1338
1335
  });
1339
1336
  }
1340
- L.push(l ? D(l.color) : "#888888");
1337
+ L.push(l ? D(l.color) : "rgba(0, 0, 0, 0)");
1341
1338
  const r = Math.round((c?.size || 6) * 0.71 * 100) / 100;
1342
1339
  y = {
1343
1340
  "circle-color": L,