From 2e6f6a59e6e91189690902bdb9b6bac3d4233fa0 Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Wed, 30 Sep 2026 23:17:20 +0000 Subject: [PATCH] UPG-100 batch mode: a tap on a people-group pin selects the territory under it and opens no detail sheet (the sheet covered the whole batch HUD on a phone, and in a dense state nearly every tap lands on a pin); outside batch mode pins behave as before. Gated; my-upg-100-list rebuilt with the tree and SRI --- internal/check-batch-selection-export.mjs | 3 +++ plugin-designs/my-upg-100-list/upg-100-list.vue | 7 ++++++- public/dx-maps/doxa-maps-spa/manifest.json | 12 ++++++------ public/dx-maps/manifest.json | 12 ++++++------ public/dx-maps/my-upg-100-list/my-upg-100-list.js | 2 +- .../dx-maps/my-upg-100-list/poster-wall/index.html | 2 +- .../dx-maps/my-upg-100-list/upg-100-list/index.html | 2 +- .../dx-maps/my-upg-100-list/upg-100-mfe/index.html | 2 +- 8 files changed, 25 insertions(+), 17 deletions(-) diff --git a/internal/check-batch-selection-export.mjs b/internal/check-batch-selection-export.mjs index 0766f00a3..e03860a89 100644 --- a/internal/check-batch-selection-export.mjs +++ b/internal/check-batch-selection-export.mjs @@ -150,6 +150,9 @@ const wired = { 'the prefetch on batch mode': /if \(next\) selectionRecordsLoad\(\)/.test(vue), 'one detection for every action': (vue.match(/await selectionPeople\(\)/g) || []).length >= 2 && /selectionPeople\(\)\.then/.test(vue), // India's states resolve through the served table (library/data/indiaStates.js), fetched only once a state is selected + // In batch mode a tap on a pin opens NO detail sheet (it covered the whole HUD on a phone); the tapestry + // listener under it toggles the territory. The real-tap proof is rega's; this pins the guard in the source. + 'a pin tap in batch mode opens no sheet': /map\.on\('click', 'upg-pins-hit', \(e\) => \{[\s\S]{0,700}?if \(batchMode\.value\) return\s*\n\s*const f = e && e\.features/.test(vue), 'the regroup warning on Copy': /const warn = regroupable\(sel\) \? '' : t\('upgMap\.copyNotRegroupable'\)/.test(vue), 'India states detected from the served table': /import \{ loadIndiaStates \} from '@map\/data\/indiaStates\.js'/.test(vue) && /india\.byShapeName\.get\(t\.name\)/.test(vue) && /t\.kind === 'adm1'\) indiaStates\(\)\.catch/.test(vue), diff --git a/plugin-designs/my-upg-100-list/upg-100-list.vue b/plugin-designs/my-upg-100-list/upg-100-list.vue index e88cf502e..035da7ba5 100644 --- a/plugin-designs/my-upg-100-list/upg-100-list.vue +++ b/plugin-designs/my-upg-100-list/upg-100-list.vue @@ -2201,13 +2201,18 @@ function attachPinHandlers() { // Mapbox keeps its own per-layer listener list; after setStyle the layer is a // fresh object so re-binding is correct. Guard only the cursor leak below. map.on('click', 'upg-pins-hit', (e) => { + // ★ IN BATCH MODE A PIN TAP IS A TERRITORY TAP. The same tap also reaches the 'tapestry-fill' listener + // (attachTapestrySelect), which toggles the territory under the finger. Opening the pin's detail sheet + // as well covered the whole batch HUD on a phone (Copy, CSV and Clear hidden), and in a dense state + // almost every tap lands on a pin. So batch mode opens no sheet; outside it, pins behave as before. + if (batchMode.value) return const f = e && e.features && e.features[0] if (!f) return if (uiStore && typeof uiStore.selectPeopleGroup === 'function') { uiStore.selectPeopleGroup(f) // opens panel (selectedPeopleGroup + legendMode='detail') } }) - map.on('mouseenter', 'upg-pins-hit', () => { if (map) map.getCanvas().style.cursor = 'pointer' }) + map.on('mouseenter', 'upg-pins-hit', () => { if (map) map.getCanvas().style.cursor = batchMode.value ? 'crosshair' : 'pointer' }) map.on('mouseleave', 'upg-pins-hit', () => { if (map) map.getCanvas().style.cursor = '' }) _pinHandlersAttached = true } diff --git a/public/dx-maps/doxa-maps-spa/manifest.json b/public/dx-maps/doxa-maps-spa/manifest.json index cc4a4a64f..2b967b6cd 100644 --- a/public/dx-maps/doxa-maps-spa/manifest.json +++ b/public/dx-maps/doxa-maps-spa/manifest.json @@ -881,7 +881,7 @@ "bundle": "my-upg-100-list", "scriptUrl": "./my-upg-100-list/my-upg-100-list.js", "output": "dx-maps/my-upg-100-list/my-upg-100-list.js", - "integrity": "sha384-Wn5zY+t9FyjcmCXTBNZ3SFzrSQrs4g/2cn2wfUZL+EE1Tc6rYhHixSfhu8Z7j6BF", + "integrity": "sha384-nVK2jZgWTnkjr0YwtOQuX9ZY70H/PJHEe0R1oDO5uqc0NYkuFLhqBLZ2f4t1+JpC", "elements": [ "my-upg-100-list-map" ], @@ -904,7 +904,7 @@ "scriptUrl": "./my-upg-100-list/my-upg-100-list.js", "embed": { "iframe": "", - "script": "\n\n\n" + "script": "\n\n\n" } }, { @@ -920,8 +920,8 @@ "scriptUrl": "./my-upg-100-list/my-upg-100-list.js", "embed": { "iframe": "", - "script": "\n\n\n\n\n\n", - "scriptMapbox": "\n\n\n\n\n\n" + "script": "\n\n\n\n\n\n", + "scriptMapbox": "\n\n\n\n\n\n" } }, { @@ -937,8 +937,8 @@ "scriptUrl": "./my-upg-100-list/my-upg-100-list.js", "embed": { "iframe": "", - "script": "\n\n\n\n\n\n", - "scriptMapbox": "\n\n\n\n\n\n" + "script": "\n\n\n\n\n\n", + "scriptMapbox": "\n\n\n\n\n\n" } } ] diff --git a/public/dx-maps/manifest.json b/public/dx-maps/manifest.json index cc4a4a64f..2b967b6cd 100644 --- a/public/dx-maps/manifest.json +++ b/public/dx-maps/manifest.json @@ -881,7 +881,7 @@ "bundle": "my-upg-100-list", "scriptUrl": "./my-upg-100-list/my-upg-100-list.js", "output": "dx-maps/my-upg-100-list/my-upg-100-list.js", - "integrity": "sha384-Wn5zY+t9FyjcmCXTBNZ3SFzrSQrs4g/2cn2wfUZL+EE1Tc6rYhHixSfhu8Z7j6BF", + "integrity": "sha384-nVK2jZgWTnkjr0YwtOQuX9ZY70H/PJHEe0R1oDO5uqc0NYkuFLhqBLZ2f4t1+JpC", "elements": [ "my-upg-100-list-map" ], @@ -904,7 +904,7 @@ "scriptUrl": "./my-upg-100-list/my-upg-100-list.js", "embed": { "iframe": "", - "script": "\n\n\n" + "script": "\n\n\n" } }, { @@ -920,8 +920,8 @@ "scriptUrl": "./my-upg-100-list/my-upg-100-list.js", "embed": { "iframe": "", - "script": "\n\n\n\n\n\n", - "scriptMapbox": "\n\n\n\n\n\n" + "script": "\n\n\n\n\n\n", + "scriptMapbox": "\n\n\n\n\n\n" } }, { @@ -937,8 +937,8 @@ "scriptUrl": "./my-upg-100-list/my-upg-100-list.js", "embed": { "iframe": "", - "script": "\n\n\n\n\n\n", - "scriptMapbox": "\n\n\n\n\n\n" + "script": "\n\n\n\n\n\n", + "scriptMapbox": "\n\n\n\n\n\n" } } ] diff --git a/public/dx-maps/my-upg-100-list/my-upg-100-list.js b/public/dx-maps/my-upg-100-list/my-upg-100-list.js index 184b37cec..56000456f 100644 --- a/public/dx-maps/my-upg-100-list/my-upg-100-list.js +++ b/public/dx-maps/my-upg-100-list/my-upg-100-list.js @@ -882,7 +882,7 @@ `)[1],s=r+` `+i;return o?s+` -`+o:s}function bP(e){return`upg-100-${String(e||"selection").normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^A-Za-z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase().slice(0,60)||"selection"}.csv`}function Hn(e){return String(e??"").normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().trim()}function $P(e){return Hn(e).split(/[\s,;]+/).filter(Boolean)}function _P(e={}){const{records:t=[],leafZones:o=[],adm1Counts:a={},iso3Names:n={},countryNameMap:r=null}=e,i=[],s=new Set;for(const c of t){if(!c)continue;const u=c.slug;if(!u||s.has(u))continue;const d=Number(c.latitude),p=Number(c.longitude);if(!Number.isFinite(d)||!Number.isFinite(p))continue;const _=c.name||u;s.add(u),i.push({label:_,kind:"pg",target:{type:"pg",slug:u,lng:p,lat:d},_hay:Hn(_)})}for(const c of o){if(!c)continue;const u=c.zoneKey||c.id,d=c.label||u;u&&i.push({label:d,kind:"zone",target:{type:"zone",zoneId:u},_hay:Hn(d)})}for(const c of Object.keys(a))i.push({label:c,kind:"territory",target:{type:"territory",shapeName:c},_hay:Hn(c)});const l=r||n;for(const c of Object.keys(n)){const u=l&&l[c]||n[c]||c;i.push({label:u,kind:"territory",target:{type:"territory",shapeName:c,iso3:!0},_hay:Hn(u)})}return i}const yP={zone:0,territory:1,pg:2};function vP(e={}){const{records:t=[],leafZones:o=[],adm1Counts:a={},iso3Names:n={},countryNameMap:r=null,centroidFor:i=null}=e,s=[];for(const u of t)u&&s.push(u);const l=(u,d,p)=>!d||!Number.isFinite(d[0])||!Number.isFinite(d[1])?null:{name:u,slug:p.__synthSlug,latitude:d[1],longitude:d[0],...p};for(const u of o){if(!u)continue;const d=u.zoneKey||u.id,p=u.label||d;if(!d)continue;const _=typeof i=="function"?i(h=>h&&h.properties&&h.properties.zoneKey===d):null,f=l(p,_,{__upgKind:"zone",__zoneId:d,__synthSlug:`__zone__${d}`});f&&s.push(f)}for(const u of Object.keys(a)){const d=typeof i=="function"?i(_=>_&&_.properties&&_.properties.shapeName===u):null,p=l(u,d,{__upgKind:"territory",__shapeName:u,__synthSlug:`__terr__${u}`});p&&s.push(p)}const c=r||n;for(const u of Object.keys(n)){const d=c&&c[u]||n[u]||u,p=typeof i=="function"?i(f=>f&&f.properties&&f.properties.iso3===u):null,_=l(d,p,{__upgKind:"territory",__shapeName:u,__synthSlug:`__terr__${u}`});_&&s.push(_)}return s}function zf(e,t,o={}){const a=o.limit??8,n=$P(t);if(!n.length)return[];const r=n[0],i=[];for(const s of e){let l=!0;for(const d of n)if(!s._hay.includes(d)){l=!1;break}if(!l)continue;const c=s._hay.startsWith(r)?0:1,u=s._hay===Hn(t)?-1:0;i.push({e:s,starts:c,exact:u,kr:yP[s.kind]??9,len:s._hay.length})}return i.sort((s,l)=>s.exact-l.exact||s.starts-l.starts||s.kr-l.kr||s.len-l.len),i.slice(0,a).map(s=>s.e)}const kP="sha384-PC2ve+U+IHimP8b4GBPS7LpbXqQKFzxtS8fs6I4pXBP7OqXOAqBx7kiWG0FWjxL6",wP=((gm=globalThis.document)==null?void 0:gm.baseURI)||void 0,Gr=new Map;function xP(e){return new URL(`${e}/people-groups/india-states.json`,wP).href}function SP(e){if(!e)return Promise.reject(new Error("no assets base to fetch india-states.json from"));let t;try{t=xP(e)}catch(o){return Promise.reject(o)}if(!Gr.has(t)){const o=(async()=>{const a=await fetch(t,{cache:"force-cache"});if(!a.ok)throw new Error(`india-states.json not served (${a.status})`);const n=await a.text();if(await es(n)!==kP)throw new Error("india-states.json failed its integrity check");const r=JSON.parse(n),i=Array.isArray(r.states)?r.states:[];return{meta:r.meta||{},states:i,byShapeName:new Map(i.map(s=>[s.shapeName,s])),byIso:new Map(i.map(s=>[s.iso,s]))}})();o.catch(()=>{Gr.get(t)===o&&Gr.delete(t)}),Gr.set(t,o)}return Gr.get(t)}const _s=new Set;function PP(e,t){var n,r;const o=e.getSource(t);if(!o)return[];let a=o._data??((r=(n=o.serialize)==null?void 0:n.call(o))==null?void 0:r.data);if(a&&typeof a=="object"&&!Array.isArray(a)){if(a.geojson!==void 0)a=a.geojson;else if(a.url!==void 0)return _s.has(t)||(_s.add(t),console.warn(`[pin-selection] source "${t}" is remote (url); its features cannot be read locally, so nothing can be selected from it.`)),[]}return a?Array.isArray(a==null?void 0:a.features)?a.features:(a==null?void 0:a.type)==="Feature"?[a]:(a&&typeof a=="object"&&!_s.has(t)&&(_s.add(t),console.warn(`[pin-selection] source "${t}": unrecognised data shape {${Object.keys(a).join(",")}} — nothing can be selected from it; this is NOT a confirmed empty source.`)),[]):[]}const AP={class:"upg-root"},LP={key:0,class:"upg-map-err"},CP={class:"upg-legend-desktop-slot"},TP={class:"upg-legend-mobile-slot"},EP={class:"upg-detail-desktop-slot"},MP=["aria-label","title"],NP={class:"upg-shown-name"},RP={key:5,class:"upg-hud"},FP={class:"upg-hud-hint"},IP={key:0,class:"upg-hud-head"},OP={class:"upg-hud-total"},DP={key:1,class:"upg-hud-names"},zP=["aria-label"],GP=["aria-pressed","data-color","title","aria-label","onClick"],jP=["aria-label"],BP={key:3,class:"upg-hud-actions"},HP=["disabled"],UP=["disabled"],WP=["disabled"],KP={key:4,class:"upg-hud-actions"},VP=["disabled"],qP={key:5,class:"upg-hud-flash"},YP={class:"upg-status"},eu="upg-search",Gf=1,ZP="people-groups",jf=8,Bf=123,JP=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"upg-100-list",setup(e){const t=Og(()=>wt(()=>Promise.resolve().then(()=>nS),void 0)),o=lt("mapboxToken",me("")),a=lt("profileConfig",me(null));let n=null,r=null,i=null;function s(){var C,F;return((C=a.value)==null?void 0:C.instanceId)||((F=a.value)==null?void 0:F.profile)||"upg-100-list"}const l=JS(a),c=l==="maplibre",u=te(()=>{var C;return((C=a==null?void 0:a.value)==null?void 0:C.search)===!1?!1:l==="mapbox"}),d=te(()=>{var F;const C=(F=a.value)==null?void 0:F.edgeScrollAffordance;return C==null?!0:!(C===!1||C==="false")}),p=lt("dataStore",null),_=lt("uiStore",null),f=me(null),h=me(""),y=me(""),b=Za([]),m=me(null),w=Za(null),$=me(!1),g=Nv("my-upg-100-list");g.theme.value="light",Rv(g);const v=me([]),P=te(()=>v.value.reduce((C,F)=>C+(Number(F.count)||0),0)),L=te(()=>v.value.length),T=me("");let V=null;const J=me(!1);function R(C){const F=C===void 0?!J.value:!!C;return F===J.value||(J.value=F,H&&(H.getCanvas().style.cursor=""),F&&Nt().catch(()=>{}),A()),F}function E(){R()}ht([J,$],()=>{io(()=>Ne())});function re(C){if(!C)return;const F=v.value,W=F.findIndex(ee=>ee.key===C.key);W>=0?v.value=F.filter((ee,Te)=>Te!==W):v.value=[...F,C],W<0&&C.kind==="adm1"&&Rt().catch(()=>{}),A(),T.value=""}const Q=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7","#999999"],B=me(""),he=me("");function k(C){const F=/^#?([0-9a-fA-F]{6})$/.exec(String(C||"").trim());if(!F)return;const W="#"+F[1].toLowerCase();B.value=B.value===W?"":W,A()}function z(){/^#?[0-9a-fA-F]{6}$/.test(he.value.trim())&&k(he.value)}const O=me(null),X=te(()=>[{id:"upg100Region",label:$e("tabs.upg100Region"),info:$e("legend.tabInfo.upg100Region")},{id:"upg100Zone",label:$e("tabs.upg100Zone"),info:$e("legend.tabInfo.upg100Zone")}]);let le=[],H=null,be=null,ke=[],Ee=null,Be=null,Pe=null;const Ve=typeof window<"u"&&window.MAP_APP_API_URL||void 0||"",{locale:tt,t:$e}=Vt();let M="";ht(()=>Yt(),()=>{(h.value===""||h.value===M)&&(h.value=M=$e("legend.loadingData"))},{immediate:!0});function j(C){const F={zone_affinity_A017:$e("poster.zone_deaf")},W=C?hh(C):void 0;return{deafCount:Bf,...C?{records:C}:{},title:ee=>nc(ee,F,{byCode:W,countryName:as,locale:Yt()}),regionTitle:ee=>tc[ee]?$e(`poster.${tc[ee]}`):ee}}let I=null;function ne(C){return C!==void 0&&(I=C),oc(ie(),j(I))}ht(()=>Yt(),()=>{if(!b.value.length)return;b.value=ne();const C=new Map(Nr(b.value).map(F=>[F.id,F.label]));for(const F of ke)C.has(F.id)&&(F.label=C.get(F.id));fe&&Le(fe)});const ge=te(()=>$e("upgMap.displayName")),ue=te(()=>$e("legend.title.batchSelect")),ve=te(()=>$e("search.upg100Placeholder"));oo(`.upg-root{position:absolute;inset:0;background:#0a1410;color:#e5e7eb;isolation:isolate;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}.upg-map{position:absolute;inset:0}.upg-map-err{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);z-index:1;pointer-events:none;text-align:center;padding:0 24px;font:13px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:#9aa7b8}.upg-map-err strong{display:block;font-size:14px;color:#cbd5e1;margin-bottom:4px}.map-scroll-edge{position:absolute;top:0;bottom:0;width:40px;z-index:2;touch-action:pan-y;pointer-events:auto;background:transparent}.map-scroll-edge--left{left:0}.map-scroll-edge--right{right:0}.upg-legend-desktop-slot{--stl-top:8px}.upg-legend-mobile-slot{display:none}@media(max-width:767px){.upg-legend-mobile-slot{display:block}.upg-legend-desktop-slot{display:none}.upg-detail-desktop-slot{display:none}}.upg-root{--upg-credit-floor:calc(max(min(var(--legend-sheet-h,0px),48px),var(--map-fab-clearance,0px)) + 30px)}@media(max-width:767.98px){.upg-root{--upg-credit-floor:max(min(var(--legend-sheet-h,0px),48px),var(--map-fab-clearance,0px))}}.upg-status{position:absolute;bottom:calc(var(--upg-credit-floor) + 6px);inset-inline-end:10px;z-index:1;pointer-events:none;font:10px/1 ui-monospace,monospace;color:#9aa7b8;background:rgba(10,14,21,.82);padding:6px 10px;border-radius:8px}@media(max-width:767px){.upg-status{display:none}}.upg-detail-panel{position:absolute;top:60px;right:8px;bottom:10px;width:340px;max-width:calc(100vw - 16px);z-index:6;background:#fff;border-radius:12px;box-shadow:0 8px 28px rgba(0,0,0,.45);overflow:hidden;display:flex;flex-direction:column;animation:upgPanelIn .18s ease}.upg-detail-panel.dark{background:#1a1a2e}@keyframes upgPanelIn{from{transform:translateX(16px);opacity:0}to{transform:translateX(0);opacity:1}}@media(max-width:480px){.upg-detail-panel{top:auto;left:8px;right:8px;width:auto;height:55vh}}.upg-shown{position:absolute;bottom:calc(var(--upg-credit-floor) + 12px);left:50%;transform:translateX(-50%);z-index:6;display:inline-flex;align-items:center;gap:10px;max-width:calc(100% - 120px);min-height:40px;box-sizing:border-box;padding:0 6px 0 16px;border:1px solid rgba(110,231,183,.45);border-radius:999px;background:rgba(10,20,16,.92);color:#e5e7eb;font:600 13px/1.2 system-ui,sans-serif;cursor:pointer;box-shadow:0 2px 8px rgba(0,0,0,.25)}.upg-shown-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.upg-shown-x{display:inline-flex;align-items:center;justify-content:center;flex:0 0 28px;height:28px;border-radius:50%;background:rgba(255,255,255,.16);font-size:18px;line-height:1}.upg-shown:focus-visible{outline:2px solid #6ee7b7;outline-offset:2px}.upg-hud{position:absolute;bottom:calc(var(--upg-credit-floor) + 30px);inset-inline-end:10px;z-index:6;min-width:150px;font:11px/1.35 ui-monospace,monospace;color:#e5e7eb;background:rgba(10,20,16,.92);border:1px solid rgba(110,231,183,.35);border-radius:10px;padding:8px 10px;box-shadow:0 4px 16px rgba(0,0,0,.4)}.upg-hud-head{display:flex;align-items:baseline;gap:6px;white-space:nowrap}.upg-hud-total{font-size:15px;font-weight:700;color:#6ee7b7}.upg-hud-band{margin-inline-start:auto;font-size:9px;color:#9aa7b8}.upg-hud-band.ok{color:#6ee7b7}.upg-hud-names{margin-top:5px;max-height:84px;overflow:auto;font-size:10px;color:#cbd5e1;line-height:1.45;word-break:break-word}.upg-hud-actions{display:flex;gap:6px;margin-top:7px}.upg-hud-btn{flex:1;cursor:pointer;border:1px solid rgba(110,231,183,.4);background:rgba(16,185,129,.18);color:#d1fae5;font:12px/1 ui-monospace,monospace;padding:0 10px;min-height:40px;border-radius:8px}.upg-hud-btn:hover{background:rgba(16,185,129,.32)}.upg-hud-btn.clear{background:rgba(148,163,184,.12);border-color:rgba(148,163,184,.4);color:#cbd5e1}.upg-hud-flash{margin-top:5px;font-size:9px;color:#6ee7b7;min-height:11px}.upg-hud-hint{margin-top:4px;font-size:9px;color:#64748b}.upg-hud-swatches{display:flex;gap:6px;margin-top:7px;align-items:center;flex-wrap:wrap}.upg-swatch{width:40px;height:40px;border-radius:9px;cursor:pointer;padding:0;border:1px solid rgba(255,255,255,.3)}.upg-swatch.active{outline:2px solid #fff;outline-offset:1px}.upg-hex{width:84px;min-height:40px;background:rgba(148,163,184,.12);border:1px solid rgba(148,163,184,.4);color:#cbd5e1;font:12px/1 ui-monospace,monospace;padding:0 8px;border-radius:8px}@media(max-width:480px){.upg-hud{left:8px;right:8px;min-width:0;bottom:calc(var(--upg-credit-floor) + 30px);max-height:48vh;overflow:auto}}.map-toolbar .mcb.upg-batch-on{background:#10b981!important;color:#04241a!important;box-shadow:0 0 0 2px rgba(52,211,153,.45),0 1px 4px rgba(0,0,0,0.2)!important}.map-toolbar .mcb.upg-batch-on.dark{border-color:#34d399!important}.upg-batch-row{position:relative;background:rgba(16,185,129,.16)!important;opacity:1!important;box-shadow:inset 3px 0 0 0 #10b981}.upg-batch-row .stl-name{color:#065f46!important;font-weight:700}.stl-panel[data-theme="dark"] .upg-batch-row .stl-name,.upg-batch-row.dark .stl-name{color:#6ee7b7!important}.upg-batch-row .stl-dot{box-shadow:0 0 0 2px #10b981}.mapboxgl-ctrl-top-left{top:12px!important;left:8px!important;width:380px!important;max-width:380px!important;z-index:1200!important}.mapboxgl-ctrl-top-left .mapboxgl-ctrl{margin:0!important;float:none!important}.stl-panel{--stl-top:8px!important}.upg-root:has(.mapboxgl-ctrl-geocoder) .stl-panel{--stl-top:58px!important}[dir="rtl"] .upg-legend-desktop-slot .stl-panel,.upg-root:has(.mapboxgl-ctrl-logo) .upg-legend-desktop-slot .stl-panel{max-height:calc(100% - var(--stl-top,60px) - 12px - 30px)!important}[dir="rtl"] .upg-detail-panel{right:auto!important;left:8px!important}.dg-main{font:13px/1.3 ui-monospace,monospace}.dg-meta{margin-top:2px;font-size:11px;color:#475569;display:flex;flex-wrap:wrap;gap:8px}.dg-field strong{font-weight:700}.dg-section-header-item{padding:4px 8px;font:10px/1.2 ui-monospace,monospace;letter-spacing:.06em;text-transform:uppercase;color:#94a3b8;pointer-events:none}`);function _e(C){const F=[];for(const W of C)F.push(W.zoneKey,uP(W.zoneKey,W.color));return["match",["get","zoneKey"],...F,"#9ca3af"]}function x(){if(H.getSource("tapestry")&&H.getLayer("tapestry-fill")&&H.getLayer("tapestry-line"))return;H.getSource("tapestry")||H.addSource("tapestry",{type:"geojson",data:be});const C=$.value?.45:.3,F=$.value?.65:.45;if(H.getLayer("tapestry-fill")||H.addLayer({id:"tapestry-fill",type:"fill",source:"tapestry",paint:{"fill-color":Ee,"fill-opacity":["case",["==",["get","zoneKey"],"deaf"],C,F]}}),H.getLayer("tapestry-line")||H.addLayer({id:"tapestry-line",type:"line",source:"tapestry",paint:{"line-color":Ee,"line-width":1.2,"line-opacity":.9}}),Io){const W=Io;io(()=>{Io===W&&Ka(W)})}}function S(){!H||!H.getSource("tapestry")||H.getLayer("upg-sel-fill")||(H.addLayer({id:"upg-sel-fill",type:"fill",source:"tapestry",filter:["boolean",!1],paint:{"fill-color":"#f59e0b","fill-opacity":.28}}),H.addLayer({id:"upg-sel-line",type:"line",source:"tapestry",filter:["boolean",!1],paint:{"line-color":"#fbbf24","line-width":2.4,"line-opacity":.95}}))}function Z(){const C=[],F=[],W=[];for(const Te of v.value)Te.kind==="adm1"?C.push(Te.name):Te.kind==="adm0"?F.push(Te.key.slice(5)):Te.kind==="zone"&&W.push(Te.key.slice(5));const ee=[];return C.length&&ee.push(["in",["get","shapeName"],["literal",C]]),F.length&&ee.push(["in",["get","iso3"],["literal",F]]),W.length&&ee.push(["in",["get","zoneKey"],["literal",W]]),ee.length?ee.length===1?ee[0]:["any",...ee]:["boolean",!1]}function A(){if(Ne(),!H||!H.getLayer("upg-sel-fill"))return;const C=J.value?Z():["boolean",!1];H.setFilter("upg-sel-fill",C),H.setFilter("upg-sel-line",C);const F=B.value;H.setPaintProperty("upg-sel-fill","fill-color",F||"#f59e0b"),H.setPaintProperty("upg-sel-fill","fill-opacity",F?.55:.28),H.setPaintProperty("upg-sel-line","line-color",F||"#fbbf24")}let K=null,q=!1;function D(){if(!(!H||!H.getLayer("tapestry-fill"))){if(K)try{H.off("click","tapestry-fill",K)}catch{}K=C=>{const F=C&&C.features&&C.features[0];if(F&&J.value){const W=If(F.properties,{nameMap:V});if(!W){console.warn("[batch-select] clicked feature has no shapeName/iso3",F.properties);return}W.count==null&&console.warn("[batch-select] no UUPG count for territory",W.name,F.properties),re(W)}},H.on("click","tapestry-fill",K),q||(H.on("mouseenter","tapestry-fill",()=>{H&&(H.getCanvas().style.cursor=J.value?"crosshair":"")}),H.on("mouseleave","tapestry-fill",()=>{H&&(H.getCanvas().style.cursor="")}),q=!0)}}function G(){v.value=[],T.value="",B.value="",he.value="",A()}let fe=null;function Le(C){if(fe=C,p&&typeof p.cacheSourceData=="function"){const F=vP({records:C,leafZones:ke,adm1Counts:$s,iso3Names:gn,countryNameMap:V,centroidFor:W=>{const ee=$t(W);return ee?[(ee[0][0]+ee[1][0])/2,(ee[0][1]+ee[1][1])/2]:null}});p.cacheSourceData(eu,{normalizedData:F})}le=_P({records:C,leafZones:ke,adm1Counts:$s,iso3Names:gn,countryNameMap:V}),typeof window<"u"&&(window.__UPG_SEARCH__={size:()=>le.length,counts:()=>{const F={pg:0,zone:0,territory:0};for(const W of le)F[W.kind]=(F[W.kind]||0)+1;return F},query:F=>zf(le,F,{limit:jf}).map(W=>({label:W.label,kind:W.kind,target:W.target})),select:F=>{const W=zf(le,F,{limit:jf})[0];return W?(Me(W.target),{label:W.label,kind:W.kind,target:W.target}):null},feedSize:()=>{const F=p&&p.sources&&p.sources[eu];return F&&Array.isArray(F.features)&&F.features.length||0},localGeocoder:F=>{const W=O.value&&O.value.geocoder,ee=W&&W.options&&W.options.localGeocoder;return ee?ee(F).map(Te=>Te&&Te.place_name):null}},n=window.__UPG_SEARCH__,(window.__UPG_SEARCHES__||(window.__UPG_SEARCHES__={}))[s()]=window.__UPG_SEARCH__)}function ot(C){const F=C&&C.properties||{},W=F.__upgKind;if(W==="zone")Fe(F.__zoneId);else if(W==="territory")rt(F.__shapeName);else{const ee=C&&C.geometry,Te=ee&&Array.isArray(ee.coordinates)?ee.coordinates:null;Te&&Number.isFinite(Te[0])&&Number.isFinite(Te[1])&&H&&H.flyTo({center:[Te[0],Te[1]],zoom:6,duration:800}),Re(F.slug)}}function gt(C){if(!C||!H)return;const F=new Set(C.memberIds||[]);if(!F.size)return;let W=[];try{W=H.querySourceFeatures("upg").filter(st=>{const Ae=st.properties||{};return F.has(Ae.slug)||F.has(Ae.id)||F.has(Ae.peopleGroupId)})}catch{return}if(!W.length)return;let ee=180,Te=90,Ze=-180,Je=-90,Qe=!1;for(const st of W){const Ae=st.geometry&&st.geometry.coordinates;!Array.isArray(Ae)||!Number.isFinite(Ae[0])||!Number.isFinite(Ae[1])||(Ae[0]Ze&&(Ze=Ae[0]),Ae[1]Je&&(Je=Ae[1]),Qe=!0)}Qe&&H.fitBounds([[ee,Te],[Ze,Je]],{padding:60,duration:800,maxZoom:6})}function vt(){Uo(null),_&&typeof _.selectPeopleGroup=="function"&&_.selectPeopleGroup(null)}function Me(C){!C||!H||(C.type==="pg"?(Number.isFinite(C.lng)&&Number.isFinite(C.lat)&&H.flyTo({center:[C.lng,C.lat],zoom:6,duration:800}),Re(C.slug)):C.type==="zone"?Fe(C.zoneId):C.type==="territory"&&rt(C.shapeName))}function Re(C){if(!C||!_||typeof _.selectPeopleGroup!="function")return;const W=PP(H,"upg").find(ee=>ee.properties&&ee.properties.slug===C);W&&_.selectPeopleGroup(W)}function Fe(C){if(!C||!H||!be)return;const F=$t(W=>W.properties&&W.properties.zoneKey===C);F&&H.fitBounds(F,{padding:40,duration:800,maxZoom:6})}function rt(C){if(!C||!H||!be)return;const F=$t(W=>{const ee=W.properties||{};return ee.shapeName===C||ee.iso3===C});F&&H.fitBounds(F,{padding:40,duration:800,maxZoom:6})}function $t(C){let F=180,W=90,ee=-180,Te=-90,Ze=!1;const Je=Qe=>{if(typeof Qe[0]=="number"){const[st,Ae]=Qe;stee&&(ee=st),AeTe&&(Te=Ae),Ze=!0;return}for(const st of Qe)Je(st)};for(const Qe of be.features)C(Qe)&&Je(Qe.geometry.coordinates);return Ze?[[F,W],[ee,Te]]:null}function uo(C){const F=new Set,W=ee=>{ee.children&&ee.children.length?ee.children.forEach(W):F.add(ee.zoneKey??ee.id)};return W(C),F}let Ha=null;function Un(C){if(![...uo(C)].length)return;const W=[],ee=Qe=>{Qe.children&&Qe.children.length?Qe.children.forEach(ee):W.push(Qe)};ee(C);const Te=v.value,Ze=new Set(Te.filter(Qe=>Qe.kind==="zone").map(Qe=>Qe.key));if(W.every(Qe=>Ze.has("zone:"+(Qe.zoneKey??Qe.id)))){const Qe=new Set(W.map(st=>"zone:"+(st.zoneKey??st.id)));v.value=Te.filter(st=>!Qe.has(st.key))}else{const Qe=W.filter(st=>!Ze.has("zone:"+(st.zoneKey??st.id))).map(st=>({key:"zone:"+(st.zoneKey??st.id),name:st.label||st.id,count:Number(st.count)||0,kind:"zone"}));v.value=[...Te,...Qe]}A(),T.value=""}function U(){const C=new Set;for(const F of v.value)F.kind==="zone"&&C.add(F.key.slice(5));return C}function oe(){const C=new Map,F=W=>{const ee=uo(W);W.label&&C.set(W.label,ee),W.children&&W.children.length&&W.children.forEach(F)};for(const W of b.value)F(W);return C}function Ne(){if(typeof document>"u")return;const C=document.querySelector("my-upg-100-list-map"),W=(C&&C.shadowRoot||document).querySelectorAll(".stl-row");if(!W.length)return;if(!J.value){W.forEach(Je=>Je.classList.remove("upg-batch-row"));return}const ee=U(),Te=oe(),Ze=$.value;W.forEach(Je=>{const Qe=Je.querySelector(".stl-name"),st=Qe?Qe.textContent.trim():"",Ae=st&&Te.get(st),dt=!!(Ae&&Ae.size&&[...Ae].every(Ke=>ee.has(Ke)));Je.classList.toggle("upg-batch-row",dt),Je.classList.toggle("dark",dt&&Ze)})}let De=null;function Ye(){if(typeof document>"u"||De)return;const C=document.querySelector("my-upg-100-list-map"),W=(C&&C.shadowRoot||document).querySelector(".stl-rows");W&&(De=new MutationObserver(()=>{requestAnimationFrame(()=>Ne())}),De.observe(W,{childList:!0,subtree:!0}))}ho("onSemanticTreeSelect",Uo),ho("onLegendExport",At),ho("legendExportCards",!0);async function At(C){const F=m.value;if(!F)return;const[W,ee]=String(C).split(":");if(!ye.value){ye.value=!0,Ie.value=W==="packet"?"packet":W==="cards"?"cards":"poster";try{if(W==="packet"){await Hr(F,ee||"full");return}const Te=pe().find(Ze=>Ze.id===F)||{id:F};if(W==="cards"){const Ze=pe().find(Je=>Je.id===F);Ze&&await ze.printCardDeck(await Ur(Ze));return}await ze.printPoster(Te)}finally{ye.value=!1,Ie.value=""}}}const ze=Yg({t:(C,F,W)=>typeof W=="number"?$e(C,F,W):$e(C,F),records:C=>Po(C),lang:()=>Yt(),label:C=>(C==null?void 0:C.label)||(C==null?void 0:C.id)||"",assetsBase:()=>ra(a.value),iso3Names:()=>gn,sheet:(C,F)=>Wn(C,F),sets:()=>fetch(`${ra(a.value)}/tables/near-neighbors.json`).then(C=>C.ok?C.json():null).catch(()=>null),downloadPrefix:"doxa-upg-100"});let Ot="";ht(ze.exportState,C=>{if(!C){Ot&&h.value===Ot&&(h.value=""),Ot="";return}if(C.phase==="error"){Ot="",Ua($e("messages.packetFailed",{reason:C.message}),4e3);return}Ot=C.phase==="done"?"":`${C.message}…`,h.value=Ot});const qt=rh({apiBase:()=>Ve,lang:()=>Yt(),profileConfig:a,evaluate:(C,F)=>Oa(C,F)});async function Po(C){if(!Ve)throw mo("wall.hud.noApi","no people-groups service is configured");return qt(C.selector)}const Wn=dh({allRecords:()=>qt.all(),assetsBase:()=>ra(a.value),profileConfig:a});function Kn(C,F,W){C.value=F,setTimeout(()=>{C.value===F&&(C.value="")},W)}const Ua=(C,F)=>Kn(h,C,F);async function Hr(C,F="full"){const W=pe().find(Te=>Te.id===C);if(!W)return;const ee=await Ur(W);await ze.printPacket(ee,{variant:F,funnel:await Se()})}async function Ur(C){try{const[{zoneTitle:F},{countryName:W},ee]=await Promise.all([wt(()=>Promise.resolve().then(()=>Sv),void 0),wt(()=>Promise.resolve().then(()=>sc),void 0),os(ra(a.value))]),Te={...ee.en||{},...ee[Yt()]||{}},Ze=F(C,Te,{countryName:W,locale:Yt()});return Ze?{...C,label:Ze}:C}catch{return C}}function ie(){return Ql(Fn(a))}function ce(){const C=ie();return[...C.lists||[],...C.asia_lists||[],...C.uncovered_lists||[]]}function pe(){const C=ce(),F=new Set(C.map(W=>W.id));return[...C,...bv(ie(),{deafCount:Bf}).filter(W=>!F.has(W.id))]}async function Se(){var C;try{const F=(await wt(async()=>{const{default:Ze}=await Promise.resolve().then(()=>sm);return{default:Ze}},void 0)).default;if(!F||!Array.isArray(F.steps)||!F.steps.length)return null;const W=Fn(a),ee=Number(F.steps[F.steps.length-1].groups)||0;if(W===Tr)return{...F,listCount:pe().length,listTotal:ee};let Te=0;try{const Ze=ra(a.value),Je=await fetch(`${Ze}/people-groups/lists/${W}.json`);if(Je.ok){const Qe=await Je.json();Te=Number((C=Qe==null?void 0:Qe.counts)==null?void 0:C.doxa)||(Array.isArray(Qe==null?void 0:Qe.slugs)?Qe.slugs.length:0)}}catch{}return{...F,listTotal:Te,listId:W,listLabel:(Gg(W)||{}).label||W}}catch{return null}}const ye=me(!1),Ie=me("");function we(){const C=v.value.filter(W=>W.kind==="zone").map(W=>String(W.key).replace(/^zone:/,"")),F=new Map(pe().map(W=>[W.id,W]));return C.map(W=>F.get(W)).filter(Boolean)}async function Ge(){const C=await os(ra(a.value));return{...C.en||{},...C[Yt()]||{}}}function at(C,F){return C?String(C).replace(/\{(\w+)\}/g,(W,ee)=>F[ee]!=null?String(F[ee]):W):null}function Oe(){return v.value.filter(C=>C.kind==="adm0").map(C=>String(C.key).replace(/^adm0:/,"")).filter(Boolean)}function We(){return v.value.filter(C=>C.kind==="adm1").map(C=>C.name||String(C.key).replace(/^adm1:/,""))}let ct=null;function Nt(){const C=Yt();if(ct&&ct.lang===C)return ct.promise;if(!Ve)return Promise.reject(mo("wall.hud.noApi","no people-groups service is configured"));const F=nh,W=(async()=>{const ee=await fetch(`${Ve}/api/people-groups/list?fields=${F}&lang=${C}`,{cache:"no-store"});if(!ee.ok)throw mo("wall.hud.fetchFailed","could not load the people groups ({status})",{status:ee.status});return Jc(await Xi(Xc(await ee.json()),a))})();return ct={lang:C,promise:W},W.catch(()=>{ct&&ct.promise===W&&(ct=null)}),W}function Rt(){return SP(ra(a.value))}async function Ut(){const C=we(),F=Oe();let W=We(),ee=null;if(W.length){try{ee=await Rt()}catch{ee=null}ee&&(W=W.filter(Ke=>!ee.byShapeName.has(Ke)))}const Te=ee?v.value.filter(Ke=>Ke.kind==="adm1"&&ee.byShapeName.has(Ke.name)).length:0;if(!C.length&&!F.length&&!Te)throw W.length?mo("upgMap.selectionAdm1NoData","no people-group data for {names} — select the country instead",{names:Yi(W,{locale:Yt()})}):mo("upgMap.nothingSelected","nothing is selected");const Ze=await Nt(),{evaluate:Je}=await wt(async()=>{const{evaluate:Ke}=await Promise.resolve().then(()=>sh);return{evaluate:Ke}},void 0),Qe=new Map(Ze.map(Ke=>[Ke.slug,Ke])),st=new Map(pe().map(Ke=>[Ke.id,Ke])),Ae=new Map,dt=(Ke,Lt)=>{const ft=Ae.get(Ke);ft?ft.includes(Lt)||ft.push(Lt):Ae.set(Ke,[Lt])};for(const Ke of v.value)if(Ke.kind==="zone"){const Lt=st.get(String(Ke.key).replace(/^zone:/,""));if(!Lt)continue;const ft=Lt.selector&&Lt.selector.type==="pg_slugs"?Lt.selector.values||[]:Je(Lt.selector,Ze);for(const jt of ft)dt(jt,Ke.name)}else if(Ke.kind==="adm0")for(const Lt of Je({type:"country_codes",values:[String(Ke.key).replace(/^adm0:/,"")]},Ze))dt(Lt,Ke.name);else if(Ke.kind==="adm1"&&ee){const Lt=ee.byShapeName.get(Ke.name);if(Lt)for(const ft of Lt.slugs)dt(ft,Ke.name)}return{records:[...Ae.keys()].map(Ke=>Qe.get(Ke)).filter(Boolean),from:Ae,missing:W}}async function wo(){const C=we(),{from:F}=await Ut(),W=(await Promise.all(C.map(Ur))).map(st=>st.label||st.id),ee=v.value.filter(st=>st.kind==="adm0").map(st=>st.name),Te=[...W,...ee],Ze=await Ge(),Je=(st,Ae)=>at(Ze.zone_join,{a:st,b:Ae})??`${st} + ${Ae}`;return{id:"selection",label:Te.length<=3?Te.reduce(Je):at(Ze.zone_join_more,{a:Te.slice(0,2).reduce(Je),n:Te.length-2})??`${Te.slice(0,2).join(" + ")} +${Te.length-2} more`,count:F.size,selector:{type:"pg_slugs",values:[...F.keys()]}}}function Mo(C){return C&&C.length?$e("upgMap.selectionAdm1NoData",{names:Yi(C,{locale:Yt()})}):""}function po(){const C=v.value;if(!C.length)return;const F=B.value;let W=null,ee="";const Te=Ut().then(Je=>(W=Je.records.length,ee=Mo(Je.missing),Df(C,{color:F},Of(Je.records,Je.from,{color:F}))),Je=>(ee=un(Je,$e),Df(C,{color:F})));Te.then(Je=>{try{window.__UPG_LAST_CLIPBOARD__=Je}catch{}});const Ze=mP(C)?"":$e("upgMap.copyNotRegroupable");No(Te).then(Je=>{const Qe=(W==null?$e("upgMap.copiedTerritoriesOnly",{reason:ee.slice(0,90)}):$e("upgMap.copiedSelection",{count:W})+(ee?" · "+ee.slice(0,90):""))+(Ze?" · "+Ze:"");Kn(T,Je?Qe:$e("messages.copyFailed"),Je&&(ee||Ze)?6e3:3e3)})}async function No(C){const F=typeof navigator<"u"?navigator:null;if(F&&F.clipboard&&F.clipboard.write&&typeof ClipboardItem<"u")try{return await F.clipboard.write([new ClipboardItem({"text/plain":C.then(ee=>new Blob([ee],{type:"text/plain"}))})]),!0}catch{}const W=await C;try{if(F&&F.clipboard&&F.clipboard.writeText)return await F.clipboard.writeText(W),!0}catch{}return ao(W)}function ao(C){try{const F=document.createElement("textarea");F.value=C,F.style.position="fixed",F.style.opacity="0",F.style.top="0",document.body.appendChild(F),F.focus(),F.select();const W=document.execCommand&&document.execCommand("copy");return document.body.removeChild(F),!!W}catch{return!1}}async function Qt(){if(!ye.value){ye.value=!0,Ie.value="csv";try{const C=await Ut(),F=B.value,W=Of(C.records,C.from,{color:F});try{window.__UPG_LAST_CSV__=W}catch{}const ee=URL.createObjectURL(new Blob(["\uFEFF"+W],{type:"text/csv;charset=utf-8"})),Te=document.createElement("a");Te.href=ee,Te.download=bP(v.value.map(Je=>Je.name).join(" ")),Te.style.display="none",document.body.appendChild(Te),Te.click(),setTimeout(()=>{try{URL.revokeObjectURL(ee),Te.remove()}catch{}},400);const Ze=Mo(C.missing);Kn(T,$e("upgMap.csvSaved",{count:C.records.length})+(Ze?" · "+Ze.slice(0,90):""),Ze?6e3:3e3)}catch(C){Kn(T,$e("upgMap.csvFailed",{reason:un(C,$e).slice(0,90)}),5e3)}finally{ye.value=!1,Ie.value=""}}}async function Gt(){if(!ye.value){ye.value=!0,Ie.value="packet";try{const C=await wo(),F=we(),W=F.length===1?F[0].id:null,ee=await Se();await ze.printPacket({...C,mapId:W},{funnel:ee&&F.length===1?ee:ee?{...ee,listCount:0}:null})}catch(C){Ua($e("messages.selectionPacketFailed",{reason:un(C,$e).slice(0,90)}),4e3)}finally{ye.value=!1,Ie.value=""}}}async function Dt(){if(!ye.value){ye.value=!0,Ie.value="cards";try{await ze.printCardDeck(await wo())}catch(C){Ua($e("upgMap.selectionCardsFailed",{reason:un(C,$e).slice(0,90)}),4e3)}finally{ye.value=!1,Ie.value=""}}}async function Ro(){if(!ye.value){ye.value=!0,Ie.value="poster";try{const C=we();if(!C.length)throw Oe().length||We().length?mo("upgMap.selectionPosterNeedsZone","posters exist per territory on the legend — use Prayer list for a map selection"):mo("upgMap.nothingSelected","nothing is selected");if(C.length>1){Ua($e("messages.posterOneTerritory",{count:C.length}),5e3);return}await ze.printPoster(C[0])}catch(C){Ua($e("messages.selectionPosterFailed",{reason:un(C,$e).slice(0,90)}),4e3)}finally{ye.value=!1,Ie.value=""}}}function Yt(){const C=tt&&(tt.value??tt);return typeof C=="string"&&C||"en"}function Uo(C){if(!H||!H.getLayer("tapestry-fill"))return!1;if(J.value)return C&&Un(C),!0;if(!C)return Ha=null,m.value=null,H.setFilter("tapestry-fill",null),H.setFilter("tapestry-line",null),H.setPaintProperty("upg-pins","circle-opacity",1),!0;Ha=C;const F=[...uo(C)];m.value=F.length===1?F[0]:C.id??null;const W=["in",["get","zoneKey"],["literal",F]];H.setFilter("tapestry-fill",W),H.setFilter("tapestry-line",W),H.getLayer("upg-pins")&&H.setPaintProperty("upg-pins","circle-opacity",["case",["in",["get","zoneKey"],["literal",F]],.95,.05]);const ee=$t(Te=>F.includes(Te.properties.zoneKey));return ee&&H.fitBounds(ee,{padding:40,duration:700,maxZoom:6}),!0}function Wa(){H&&(typeof Pe=="function"&&Pe(),be&&(x(),S(),D(),A(),m.value&&H.getLayer("tapestry-fill")&&Uo(Ha)))}function Wo(){H&&($.value=!$.value,g.theme.value=$.value?"dark":"light",H.setStyle($.value?Yc("ink",l).style||"mapbox://styles/mapbox/dark-v11":Yc("paper",l).style||"mapbox://styles/mapbox/light-v11"),H.once("style.load",Wa))}function Ko(){!H||!H.getLayer("upg-pins-hit")||(H.on("click","upg-pins-hit",C=>{const F=C&&C.features&&C.features[0];F&&_&&typeof _.selectPeopleGroup=="function"&&_.selectPeopleGroup(F)}),H.on("mouseenter","upg-pins-hit",()=>{H&&(H.getCanvas().style.cursor="pointer")}),H.on("mouseleave","upg-pins-hit",()=>{H&&(H.getCanvas().style.cursor="")}))}let sa=null,Io,Vo=null;function Vn(C,F){var W,ee,Te;try{const Ze=(Te=(ee=(W=f.value)==null?void 0:W.getRootNode)==null?void 0:ee.call(W))==null?void 0:Te.host;if(!Ze)return;Ze.setAttribute("data-doxa-select-zone-state",C),F&&Ze.setAttribute("data-doxa-select-zone-applied",String(F))}catch{}}function Ka(C){if(!C)return Uo(null),Io=void 0,Vn("cleared",""),!0;const F=Yn(b.value,C);return F?Uo(F)?(Io=void 0,Vn("applied",C),!0):(Io=C,Vn("applied-but-no-selection",C),!1):(Io=C,Vn("unresolved",C),!1)}function qn(C){var W;const F=((W=C==null?void 0:C.detail)==null?void 0:W.listId)??null;Ka(F)}function Yn(C,F){for(const W of C||[]){if((W.zoneKey||W.id)===F)return W;const ee=W.children&&Yn(W.children,F);if(ee)return ee}return null}const Wr=te(()=>{if(!m.value||J.value)return null;const C=Yn(b.value,m.value);return C&&C.label||String(m.value)});function Kr(){Ka(null)}function Ps(){const C=ie(),F=ne(null);b.value=F,ke=Nr(F);const W={};for(const ee of C.lists||[])W[ee.id]=ee.selector;for(const ee of C.asia_lists||[])W[ee.id]=ee.selector;for(const ee of C.uncovered_lists||[])W[ee.id]=ee.selector;W.deaf=Mr;for(const ee of ke)ee.selector=W[ee.id];Ee=_e(ke)}async function He(){if(Ve)try{const F=await fetch(`${Ve}/api/people-groups/list?fields=slug,name,country_code,wagf_region,wagf_block,rop1,population,latitude,longitude&lang=${Yt()}`,{cache:"no-store"});if(!F.ok)throw new Error(`list ${F.status}`);const W=Jc(await Xi(Xc(await F.json()),a));V=Ff(W),b.value=ne(W)}catch{}}fo(async()=>{var Te,Ze,Je,Qe,st;Ps();try{await nP(l)}catch{}if(!f.value)return;const C=Zc(l);C&&aP(C);const F=(o==null?void 0:o.value)||((Te=a==null?void 0:a.value)==null?void 0:Te.tk)||"";if(!C){console.warn(`[upg-100-list] ${l} engine global is missing — refusing to substitute another engine. A page that asked for the keyless engine must not silently receive the token-gated one.`),h.value=`⚠ ${$e("messages.engineNotLoaded")}`,y.value=$e("messages.engineNotLoadedDetail",{engine:c?"MapLibre":"Mapbox"}),He();return}if(!c){if(!F){h.value=`⚠ ${$e("messages.noMapboxToken")}`,y.value=$e("messages.noMapboxTokenDetail"),He();return}C.accessToken=F}try{const Ae=Tf(l);Ae&&await rP(f.value,Ae)}catch{}if(!f.value)return;try{const Ae=!c&&f.value&&f.value.getRootNode();if(Ae instanceof ShadowRoot){const dt=Tf("mapbox");if(dt&&!Ae.querySelector(`link[href="${dt}"]`)){const Ke=document.createElement("link");Ke.rel="stylesheet",Ke.href=dt,Ae.prepend(Ke)}}}catch{}H=new C.Map({container:f.value,style:Yc("paper",l).style||"mapbox://styles/mapbox/light-v11",center:[35,20],zoom:1.5,projection:"mercator"}),w.value=H,Be=eP(((Ze=f.value)==null?void 0:Ze.parentElement)||null,{enabled:d.value}),typeof window<"u"&&(window.__UPG_MAP__=H,r=H,(window.__UPG_MAPS__||(window.__UPG_MAPS__={}))[s()]=H),window.__UPG_SELECT__={get list(){return v.value.map(Ae=>({...Ae}))},get total(){return P.value},get count(){return L.value},get color(){return B.value},get batchMode(){return J.value},setColor:Ae=>k(Ae),setBatchMode:Ae=>R(Ae),clipboardText:()=>Qc(v.value,{color:B.value}),clear:()=>G(),toggleByProps:Ae=>{const dt=If(Ae,{nameMap:V});return dt?(re(dt),{...dt}):null},toggleLegendRow:Ae=>{const dt=Lt=>{for(const ft of Lt){if(ft.label===Ae||ft.id===Ae)return ft;if(ft.children&&ft.children.length){const jt=dt(ft.children);if(jt)return jt}}return null},Ke=dt(b.value);return Ke?(Un(Ke),{label:Ke.label,zoneKeys:[...uo(Ke)]}):null},markedLegendRows:()=>{if(typeof document>"u")return[];const Ae=document.querySelector("my-upg-100-list-map");return[...(Ae&&Ae.shadowRoot||document).querySelectorAll(".stl-row.upg-batch-row .stl-name")].map(Ke=>Ke.textContent.trim())},highlightFeatureCount:()=>{if(!H||!be||!H.getLayer("upg-sel-fill"))return-1;const Ae=new Set,dt=new Set,Ke=new Set;for(const ft of v.value)ft.kind==="zone"?Ae.add(ft.key.slice(5)):ft.kind==="adm1"?dt.add(ft.name):ft.kind==="adm0"&&Ke.add(ft.key.slice(5));let Lt=0;for(const ft of be.features){const jt=ft.properties||{};(Ae.has(jt.zoneKey)||dt.has(jt.shapeName)||Ke.has(jt.iso3))&&Lt++}return Lt},zoneKeysForRow:Ae=>{const dt=Lt=>{for(const ft of Lt){if(ft.label===Ae||ft.id===Ae)return ft;if(ft.children&&ft.children.length){const jt=dt(ft.children);if(jt)return jt}}return null},Ke=dt(b.value);return Ke?[...uo(Ke)]:null}},i=window.__UPG_SELECT__,(window.__UPG_SELECTS__||(window.__UPG_SELECTS__={}))[s()]=window.__UPG_SELECT__;try{h.value=$e("messages.loadingBoundaries");const Ae=ut=>`${ra(a.value)}/boundaries/${ut}`,dt=ut=>fetch(Ae(ut)).then(ro=>{if(!ro.ok)throw new Error(`boundary fetch ${ro.status} ${ut}`);return ro.json()});if(!Ve)throw new Error("No API base configured — set window.MAP_APP_API_URL or VITE_API_BASE_URL. Failing closed (no default host).");const Lt=fetch(`${Ve}/api/people-groups/list?fields=slug,name,country_code,wagf_region,wagf_block,rop1,population,latitude,longitude&lang=${Yt()}`).then(ut=>{if(!ut.ok)throw new Error(`list ${ut.status}`);return ut.json()}),ft={adm0:dt("world-adm0-web.geojson"),adm1Chn:dt("gb-CHN-ADM1.geojson"),adm1Ind:dt("gb-IND-ADM1-web.geojson")};h.value=$e("messages.fetchingUupgs",{n:2106});const jt=Jc(await Xi(Xc(await Lt),a));V=Ff(jt),b.value=ne(jt);const Vr=[],mn={},{evaluate:As}=await wt(async()=>{const{evaluate:ut}=await Promise.resolve().then(()=>sh);return{evaluate:ut}},void 0);for(const ut of ke)if(ut.selector&&ut.selector.type==="pg_slugs")for(const ro of ut.selector.values||[])ro in mn||(mn[ro]=ut.zoneKey);else try{for(const ro of As(ut.selector,jt))ro in mn||(mn[ro]=ut.zoneKey)}catch(ro){console.warn("zone selector skipped",ut.id,ro&&ro.message)}for(const ut of jt){const ro=Number(ut.latitude),du=Number(ut.longitude);!isFinite(ro)||!isFinite(du)||Vr.push({type:"Feature",geometry:{type:"Point",coordinates:[du,ro]},properties:{slug:ut.slug,zoneKey:mn[ut.slug]||"",name:ut.name||ut.slug||"",population:ut.population??0,countryName:ut.country_code_label||"",country:ut.country_code||""}})}const cu=Ya({type:"FeatureCollection",features:Vr});Pe=()=>{H.getSource("upg")&&H.getLayer("upg-pins")&&H.getLayer("upg-pins-hit")||(H.getSource("upg")||H.addSource("upg",{type:"geojson",data:cu}),H.getLayer("upg-pins")||H.addLayer({id:"upg-pins",type:"circle",source:"upg",paint:{"circle-radius":["interpolate",["linear"],["zoom"],0,2.6,2,3.2,4,4.5,6,6.5,8,9],"circle-color":Ee,"circle-opacity":1,"circle-stroke-width":["interpolate",["linear"],["zoom"],0,.9,4,1.4,8,2],"circle-stroke-color":"rgba(15,20,25,0.9)"}}),H.getLayer("upg-pins-hit")||H.addLayer({id:"upg-pins-hit",type:"circle",source:"upg",paint:{"circle-radius":["interpolate",["linear"],["zoom"],1,5,4,6.5,8,9],"circle-stroke-width":["interpolate",["linear"],["zoom"],1,1.8,8,2],"circle-opacity":0,"circle-stroke-opacity":0}}),Ko())};const Ls=()=>{try{Wa()}catch(ut){console.warn("early pin paint skipped",ut&&ut.message)}};H.isStyleLoaded()?Ls():H.once("style.load",Ls),h.value=$e("messages.loadingBoundaries");const[$A,_A]=await Promise.all([ft.adm0,ft.adm1Chn]),yA=await ft.adm1Ind,{tapestry:vA,perZone:kA}=wv(ke,{records:jt,adm0:$A,adm1Ind:yA,adm1Chn:_A});be=Ya(vA),Le(jt);let uu=!0;const Zn=()=>{uu&&(uu=!1,H.off("style.load",Zn),H.off("idle",Zn),Wa())};if(H.isStyleLoaded())Zn();else{H.once("style.load",Zn),H.once("idle",Zn);const ut=setInterval(()=>{if(!uu||!H){clearInterval(ut);return}let ro=!1;try{ro=H.isStyleLoaded()}catch{clearInterval(ut);return}ro&&(clearInterval(ut),Zn())},120);setTimeout(()=>clearInterval(ut),15e3)}const fm=[...kA.entries()].filter(([ut])=>ut!=="deaf"),wA=fm.filter(([,ut])=>ut>=1).length;h.value=$e("messages.mapStatusCounts",{polys:be.features.length,zones:wA,total:fm.length,pins:Vr.length})}catch(Ae){console.warn("[upg-100-list] map data failed:",Ae),h.value="⚠ "+$e("upgMap.mapDataFailed")}let W=0;const ee=()=>{const Ae=typeof document<"u"&&document.querySelector("my-upg-100-list-map"),dt=Ae&&Ae.shadowRoot||(typeof document<"u"?document:null);if(dt&&dt.querySelector(".stl-rows")){Ye(),Ne();return}W++<40&&setTimeout(ee,250)};ee();{const Ae=(st=(Qe=(Je=f.value)==null?void 0:Je.getRootNode)==null?void 0:Qe.call(Je))==null?void 0:st.host;if(Ae){sa=qn,Ae.addEventListener("doxa:select-zone",sa);const dt=Ae.getAttribute("select-zone");dt&&Ka(dt),Vo=new MutationObserver(()=>{Ka(Ae.getAttribute("select-zone")||null)}),Vo.observe(Ae,{attributes:!0,attributeFilter:["select-zone"]})}}});const no=()=>{var C,F,W;try{return((W=(F=(C=f.value)==null?void 0:C.getRootNode)==null?void 0:F.call(C))==null?void 0:W.host)||null}catch{return null}};return ht([b,w],()=>{io(()=>{var F;const C=((F=no())==null?void 0:F.getAttribute("select-zone"))||Io||null;C&&Ka(C)})}),Jt(()=>{var C,F,W;if(Vo==null||Vo.disconnect(),Vo=null,sa){const ee=(W=(F=(C=f.value)==null?void 0:C.getRootNode)==null?void 0:F.call(C))==null?void 0:W.host;ee==null||ee.removeEventListener("doxa:select-zone",sa),sa=null}if(De){try{De.disconnect()}catch{}De=null}if(Be){try{Be()}catch{}Be=null}if(H&&(H.remove(),H=null),be=null,typeof window<"u"){const ee=s();try{window.__UPG_SEARCHES__&&delete window.__UPG_SEARCHES__[ee],window.__UPG_MAPS__&&delete window.__UPG_MAPS__[ee],window.__UPG_SELECTS__&&delete window.__UPG_SELECTS__[ee],window.__UPG_SEARCH__===n&&delete window.__UPG_SEARCH__,window.__UPG_MAP__===r&&delete window.__UPG_MAP__,window.__UPG_SELECT__===i&&delete window.__UPG_SELECT__,delete window.__UPG_LAST_CLIPBOARD__,delete window.__UPG_LAST_CSV__}catch{}}}),(C,F)=>{var W;return Y(),ae("div",AP,[N("div",{ref_key:"mapEl",ref:f,class:"upg-map"},null,512),y.value?(Y(),ae("div",LP,[N("strong",null,de(se($e)("messages.mapUnavailable")),1),Kt(de(y.value),1)])):xe("",!0),d.value?(Y(),ae(Xe,{key:1},[F[1]||(F[1]=N("div",{class:"map-scroll-edge map-scroll-edge--left"},null,-1)),F[2]||(F[2]=N("div",{class:"map-scroll-edge map-scroll-edge--right"},null,-1))],64)):xe("",!0),w.value&&u.value?(Y(),St(qS,{key:2,ref_key:"geocoderRef",ref:O,"map-instance":w.value,"access-token":se(o)||((W=se(a))==null?void 0:W.tk)||"","data-source-id":eu,"is-dark":$.value,placeholder:ve.value,"active-context":ZP,onPeopleGroupResult:ot,onAggregateResult:gt,onClear:vt},null,8,["map-instance","access-token","is-dark","placeholder"])):xe("",!0),w.value?(Y(),St(vS,{key:3,"has-geocoder":u.value},{default:xo(()=>[yt(wS,{map:w.value,"is-dark":$.value},null,8,["map","is-dark"]),yt(xS,{map:w.value,"is-dark":$.value},null,8,["map","is-dark"]),yt(SS,{map:w.value,"is-dark":$.value},null,8,["map","is-dark"]),yt(LS,{"map-container":f.value,"is-dark":$.value},null,8,["map-container","is-dark"]),yt(TS,{"is-dark":$.value,onToggle:Wo},null,8,["is-dark"]),yt(Ba,{"is-dark":$.value,active:J.value,class:Ue({"upg-batch-on":J.value}),"aria-pressed":J.value?"true":"false",title:ue.value,onClick:E},{default:xo(()=>[...F[3]||(F[3]=[N("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),N("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),N("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),N("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})],-1)])]),_:1},8,["is-dark","active","class","aria-pressed","title"])]),_:1},8,["has-geocoder"])):xe("",!0),N("div",CP,[b.value.length?(Y(),St(wh,{key:0,nodes:b.value,tabs:X.value,"default-tab":Gf,columns:["count","pop"],title:ge.value,"export-enabled":!0,"export-cards":!0,onSelect:Uo,onExport:At},null,8,["nodes","tabs","title"])):xe("",!0)]),N("div",TP,[b.value.length?(Y(),St(yS,{key:0,"legend-type":"upg-100",nodes:b.value,tabs:X.value,"default-tab":Gf,columns:["count","pop"],"column-label":"UPG 100",title:ge.value,"is-dark":$.value,"popup-action":"pray"},null,8,["nodes","tabs","title","is-dark"])):xe("",!0)]),N("div",EP,[se(_)&&se(_).selectedPeopleGroup?(Y(),ae("div",{key:0,class:Ue(["upg-detail-panel pg-detail-root",{dark:$.value}])},[yt(se(t),{peopleGroup:se(_).selectedPeopleGroup,dark:$.value,action:"pray"},null,8,["peopleGroup","dark"])],2)):xe("",!0)]),Wr.value?(Y(),ae("button",{key:4,type:"button",class:"upg-shown","aria-label":se($e)("buttons.clearSelection")+": "+Wr.value,title:se($e)("buttons.clearSelection"),onClick:Kr},[N("span",NP,de(Wr.value),1),F[4]||(F[4]=N("span",{class:"upg-shown-x","aria-hidden":"true"},"×",-1))],8,MP)):xe("",!0),J.value?(Y(),ae("div",RP,[N("div",FP,de(se($e)("messages.tapTerritoriesHint")),1),L.value?(Y(),ae("div",IP,[N("span",null,de(se($e)("messages.territoriesSelected",{count:L.value}))+" ·",1),N("span",OP,de(P.value)+" UUPG",1),N("span",{class:Ue(["upg-hud-band",{ok:P.value>=50&&P.value<=100}])},de(P.value>=50&&P.value<=100?se($e)("messages.bandInRange"):se($e)("messages.bandOutOfRange")),3)])):xe("",!0),L.value?(Y(),ae("div",DP,de(se(Yi)(v.value.map(ee=>ee.name),{locale:Yt()})),1)):xe("",!0),L.value?(Y(),ae("div",{key:2,class:"upg-hud-swatches",role:"group","aria-label":se($e)("upgMap.selectionColourGroup")},[(Y(),ae(Xe,null,Wt(Q,ee=>N("button",{key:ee,type:"button",class:Ue(["upg-swatch",{active:B.value===ee}]),"aria-pressed":B.value===ee?"true":"false","data-color":ee,style:xt({background:ee}),title:se($e)("upgMap.selectionColour",{hex:ee}),"aria-label":se($e)("upgMap.selectionColour",{hex:ee}),onClick:Te=>k(ee)},null,14,GP)),64)),fi(N("input",{"onUpdate:modelValue":F[0]||(F[0]=ee=>he.value=ee),class:"upg-hex",placeholder:"#hex",spellcheck:"false","aria-label":se($e)("upgMap.customColour"),onChange:z,onKeyup:fl(z,["enter"])},null,40,jP),[[Bb,he.value]])],8,zP)):xe("",!0),L.value?(Y(),ae("div",BP,[N("button",{class:Ue(["upg-hud-btn make",{"is-busy":Ie.value==="packet"}]),disabled:ye.value,onClick:Gt},de(Ie.value==="packet"?se($e)("buttons.working"):se($e)("buttons.prayerList")),11,HP),N("button",{class:Ue(["upg-hud-btn make",{"is-busy":Ie.value==="poster"}]),disabled:ye.value,onClick:Ro},de(Ie.value==="poster"?se($e)("buttons.working"):se($e)("buttons.posterMap")),11,UP),N("button",{class:Ue(["upg-hud-btn make",{"is-busy":Ie.value==="cards"}]),disabled:ye.value,onClick:Dt},de(Ie.value==="cards"?se($e)("buttons.working"):se($e)("buttons.cardDeck")),11,WP)])):xe("",!0),L.value?(Y(),ae("div",KP,[N("button",{class:"upg-hud-btn copy",onClick:po},de(se($e)("upgMap.copySelection")),1),N("button",{class:Ue(["upg-hud-btn csv",{"is-busy":Ie.value==="csv"}]),disabled:ye.value,onClick:Qt},de(Ie.value==="csv"?se($e)("buttons.working"):se($e)("upgMap.exportCsv")),11,VP),N("button",{class:"upg-hud-btn clear",onClick:G},de(se($e)("buttons.clearSelection")),1)])):xe("",!0),L.value?(Y(),ae("div",qP,de(T.value),1)):xe("",!0)])):xe("",!0),N("div",YP,de(h.value),1)])}}}},Symbol.toStringTag,{value:"Module"})),XP=` +`+o:s}function bP(e){return`upg-100-${String(e||"selection").normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^A-Za-z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase().slice(0,60)||"selection"}.csv`}function Hn(e){return String(e??"").normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().trim()}function $P(e){return Hn(e).split(/[\s,;]+/).filter(Boolean)}function _P(e={}){const{records:t=[],leafZones:o=[],adm1Counts:a={},iso3Names:n={},countryNameMap:r=null}=e,i=[],s=new Set;for(const c of t){if(!c)continue;const u=c.slug;if(!u||s.has(u))continue;const d=Number(c.latitude),p=Number(c.longitude);if(!Number.isFinite(d)||!Number.isFinite(p))continue;const _=c.name||u;s.add(u),i.push({label:_,kind:"pg",target:{type:"pg",slug:u,lng:p,lat:d},_hay:Hn(_)})}for(const c of o){if(!c)continue;const u=c.zoneKey||c.id,d=c.label||u;u&&i.push({label:d,kind:"zone",target:{type:"zone",zoneId:u},_hay:Hn(d)})}for(const c of Object.keys(a))i.push({label:c,kind:"territory",target:{type:"territory",shapeName:c},_hay:Hn(c)});const l=r||n;for(const c of Object.keys(n)){const u=l&&l[c]||n[c]||c;i.push({label:u,kind:"territory",target:{type:"territory",shapeName:c,iso3:!0},_hay:Hn(u)})}return i}const yP={zone:0,territory:1,pg:2};function vP(e={}){const{records:t=[],leafZones:o=[],adm1Counts:a={},iso3Names:n={},countryNameMap:r=null,centroidFor:i=null}=e,s=[];for(const u of t)u&&s.push(u);const l=(u,d,p)=>!d||!Number.isFinite(d[0])||!Number.isFinite(d[1])?null:{name:u,slug:p.__synthSlug,latitude:d[1],longitude:d[0],...p};for(const u of o){if(!u)continue;const d=u.zoneKey||u.id,p=u.label||d;if(!d)continue;const _=typeof i=="function"?i(h=>h&&h.properties&&h.properties.zoneKey===d):null,f=l(p,_,{__upgKind:"zone",__zoneId:d,__synthSlug:`__zone__${d}`});f&&s.push(f)}for(const u of Object.keys(a)){const d=typeof i=="function"?i(_=>_&&_.properties&&_.properties.shapeName===u):null,p=l(u,d,{__upgKind:"territory",__shapeName:u,__synthSlug:`__terr__${u}`});p&&s.push(p)}const c=r||n;for(const u of Object.keys(n)){const d=c&&c[u]||n[u]||u,p=typeof i=="function"?i(f=>f&&f.properties&&f.properties.iso3===u):null,_=l(d,p,{__upgKind:"territory",__shapeName:u,__synthSlug:`__terr__${u}`});_&&s.push(_)}return s}function zf(e,t,o={}){const a=o.limit??8,n=$P(t);if(!n.length)return[];const r=n[0],i=[];for(const s of e){let l=!0;for(const d of n)if(!s._hay.includes(d)){l=!1;break}if(!l)continue;const c=s._hay.startsWith(r)?0:1,u=s._hay===Hn(t)?-1:0;i.push({e:s,starts:c,exact:u,kr:yP[s.kind]??9,len:s._hay.length})}return i.sort((s,l)=>s.exact-l.exact||s.starts-l.starts||s.kr-l.kr||s.len-l.len),i.slice(0,a).map(s=>s.e)}const kP="sha384-PC2ve+U+IHimP8b4GBPS7LpbXqQKFzxtS8fs6I4pXBP7OqXOAqBx7kiWG0FWjxL6",wP=((gm=globalThis.document)==null?void 0:gm.baseURI)||void 0,Gr=new Map;function xP(e){return new URL(`${e}/people-groups/india-states.json`,wP).href}function SP(e){if(!e)return Promise.reject(new Error("no assets base to fetch india-states.json from"));let t;try{t=xP(e)}catch(o){return Promise.reject(o)}if(!Gr.has(t)){const o=(async()=>{const a=await fetch(t,{cache:"force-cache"});if(!a.ok)throw new Error(`india-states.json not served (${a.status})`);const n=await a.text();if(await es(n)!==kP)throw new Error("india-states.json failed its integrity check");const r=JSON.parse(n),i=Array.isArray(r.states)?r.states:[];return{meta:r.meta||{},states:i,byShapeName:new Map(i.map(s=>[s.shapeName,s])),byIso:new Map(i.map(s=>[s.iso,s]))}})();o.catch(()=>{Gr.get(t)===o&&Gr.delete(t)}),Gr.set(t,o)}return Gr.get(t)}const _s=new Set;function PP(e,t){var n,r;const o=e.getSource(t);if(!o)return[];let a=o._data??((r=(n=o.serialize)==null?void 0:n.call(o))==null?void 0:r.data);if(a&&typeof a=="object"&&!Array.isArray(a)){if(a.geojson!==void 0)a=a.geojson;else if(a.url!==void 0)return _s.has(t)||(_s.add(t),console.warn(`[pin-selection] source "${t}" is remote (url); its features cannot be read locally, so nothing can be selected from it.`)),[]}return a?Array.isArray(a==null?void 0:a.features)?a.features:(a==null?void 0:a.type)==="Feature"?[a]:(a&&typeof a=="object"&&!_s.has(t)&&(_s.add(t),console.warn(`[pin-selection] source "${t}": unrecognised data shape {${Object.keys(a).join(",")}} — nothing can be selected from it; this is NOT a confirmed empty source.`)),[]):[]}const AP={class:"upg-root"},LP={key:0,class:"upg-map-err"},CP={class:"upg-legend-desktop-slot"},TP={class:"upg-legend-mobile-slot"},EP={class:"upg-detail-desktop-slot"},MP=["aria-label","title"],NP={class:"upg-shown-name"},RP={key:5,class:"upg-hud"},FP={class:"upg-hud-hint"},IP={key:0,class:"upg-hud-head"},OP={class:"upg-hud-total"},DP={key:1,class:"upg-hud-names"},zP=["aria-label"],GP=["aria-pressed","data-color","title","aria-label","onClick"],jP=["aria-label"],BP={key:3,class:"upg-hud-actions"},HP=["disabled"],UP=["disabled"],WP=["disabled"],KP={key:4,class:"upg-hud-actions"},VP=["disabled"],qP={key:5,class:"upg-hud-flash"},YP={class:"upg-status"},eu="upg-search",Gf=1,ZP="people-groups",jf=8,Bf=123,JP=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"upg-100-list",setup(e){const t=Og(()=>wt(()=>Promise.resolve().then(()=>nS),void 0)),o=lt("mapboxToken",me("")),a=lt("profileConfig",me(null));let n=null,r=null,i=null;function s(){var C,F;return((C=a.value)==null?void 0:C.instanceId)||((F=a.value)==null?void 0:F.profile)||"upg-100-list"}const l=JS(a),c=l==="maplibre",u=te(()=>{var C;return((C=a==null?void 0:a.value)==null?void 0:C.search)===!1?!1:l==="mapbox"}),d=te(()=>{var F;const C=(F=a.value)==null?void 0:F.edgeScrollAffordance;return C==null?!0:!(C===!1||C==="false")}),p=lt("dataStore",null),_=lt("uiStore",null),f=me(null),h=me(""),y=me(""),b=Za([]),m=me(null),w=Za(null),$=me(!1),g=Nv("my-upg-100-list");g.theme.value="light",Rv(g);const v=me([]),P=te(()=>v.value.reduce((C,F)=>C+(Number(F.count)||0),0)),L=te(()=>v.value.length),T=me("");let V=null;const J=me(!1);function R(C){const F=C===void 0?!J.value:!!C;return F===J.value||(J.value=F,H&&(H.getCanvas().style.cursor=""),F&&Nt().catch(()=>{}),A()),F}function E(){R()}ht([J,$],()=>{io(()=>Ne())});function re(C){if(!C)return;const F=v.value,W=F.findIndex(ee=>ee.key===C.key);W>=0?v.value=F.filter((ee,Te)=>Te!==W):v.value=[...F,C],W<0&&C.kind==="adm1"&&Rt().catch(()=>{}),A(),T.value=""}const Q=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7","#999999"],B=me(""),he=me("");function k(C){const F=/^#?([0-9a-fA-F]{6})$/.exec(String(C||"").trim());if(!F)return;const W="#"+F[1].toLowerCase();B.value=B.value===W?"":W,A()}function z(){/^#?[0-9a-fA-F]{6}$/.test(he.value.trim())&&k(he.value)}const O=me(null),X=te(()=>[{id:"upg100Region",label:$e("tabs.upg100Region"),info:$e("legend.tabInfo.upg100Region")},{id:"upg100Zone",label:$e("tabs.upg100Zone"),info:$e("legend.tabInfo.upg100Zone")}]);let le=[],H=null,be=null,ke=[],Ee=null,Be=null,Pe=null;const Ve=typeof window<"u"&&window.MAP_APP_API_URL||void 0||"",{locale:tt,t:$e}=Vt();let M="";ht(()=>Yt(),()=>{(h.value===""||h.value===M)&&(h.value=M=$e("legend.loadingData"))},{immediate:!0});function j(C){const F={zone_affinity_A017:$e("poster.zone_deaf")},W=C?hh(C):void 0;return{deafCount:Bf,...C?{records:C}:{},title:ee=>nc(ee,F,{byCode:W,countryName:as,locale:Yt()}),regionTitle:ee=>tc[ee]?$e(`poster.${tc[ee]}`):ee}}let I=null;function ne(C){return C!==void 0&&(I=C),oc(ie(),j(I))}ht(()=>Yt(),()=>{if(!b.value.length)return;b.value=ne();const C=new Map(Nr(b.value).map(F=>[F.id,F.label]));for(const F of ke)C.has(F.id)&&(F.label=C.get(F.id));fe&&Le(fe)});const ge=te(()=>$e("upgMap.displayName")),ue=te(()=>$e("legend.title.batchSelect")),ve=te(()=>$e("search.upg100Placeholder"));oo(`.upg-root{position:absolute;inset:0;background:#0a1410;color:#e5e7eb;isolation:isolate;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}.upg-map{position:absolute;inset:0}.upg-map-err{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);z-index:1;pointer-events:none;text-align:center;padding:0 24px;font:13px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:#9aa7b8}.upg-map-err strong{display:block;font-size:14px;color:#cbd5e1;margin-bottom:4px}.map-scroll-edge{position:absolute;top:0;bottom:0;width:40px;z-index:2;touch-action:pan-y;pointer-events:auto;background:transparent}.map-scroll-edge--left{left:0}.map-scroll-edge--right{right:0}.upg-legend-desktop-slot{--stl-top:8px}.upg-legend-mobile-slot{display:none}@media(max-width:767px){.upg-legend-mobile-slot{display:block}.upg-legend-desktop-slot{display:none}.upg-detail-desktop-slot{display:none}}.upg-root{--upg-credit-floor:calc(max(min(var(--legend-sheet-h,0px),48px),var(--map-fab-clearance,0px)) + 30px)}@media(max-width:767.98px){.upg-root{--upg-credit-floor:max(min(var(--legend-sheet-h,0px),48px),var(--map-fab-clearance,0px))}}.upg-status{position:absolute;bottom:calc(var(--upg-credit-floor) + 6px);inset-inline-end:10px;z-index:1;pointer-events:none;font:10px/1 ui-monospace,monospace;color:#9aa7b8;background:rgba(10,14,21,.82);padding:6px 10px;border-radius:8px}@media(max-width:767px){.upg-status{display:none}}.upg-detail-panel{position:absolute;top:60px;right:8px;bottom:10px;width:340px;max-width:calc(100vw - 16px);z-index:6;background:#fff;border-radius:12px;box-shadow:0 8px 28px rgba(0,0,0,.45);overflow:hidden;display:flex;flex-direction:column;animation:upgPanelIn .18s ease}.upg-detail-panel.dark{background:#1a1a2e}@keyframes upgPanelIn{from{transform:translateX(16px);opacity:0}to{transform:translateX(0);opacity:1}}@media(max-width:480px){.upg-detail-panel{top:auto;left:8px;right:8px;width:auto;height:55vh}}.upg-shown{position:absolute;bottom:calc(var(--upg-credit-floor) + 12px);left:50%;transform:translateX(-50%);z-index:6;display:inline-flex;align-items:center;gap:10px;max-width:calc(100% - 120px);min-height:40px;box-sizing:border-box;padding:0 6px 0 16px;border:1px solid rgba(110,231,183,.45);border-radius:999px;background:rgba(10,20,16,.92);color:#e5e7eb;font:600 13px/1.2 system-ui,sans-serif;cursor:pointer;box-shadow:0 2px 8px rgba(0,0,0,.25)}.upg-shown-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.upg-shown-x{display:inline-flex;align-items:center;justify-content:center;flex:0 0 28px;height:28px;border-radius:50%;background:rgba(255,255,255,.16);font-size:18px;line-height:1}.upg-shown:focus-visible{outline:2px solid #6ee7b7;outline-offset:2px}.upg-hud{position:absolute;bottom:calc(var(--upg-credit-floor) + 30px);inset-inline-end:10px;z-index:6;min-width:150px;font:11px/1.35 ui-monospace,monospace;color:#e5e7eb;background:rgba(10,20,16,.92);border:1px solid rgba(110,231,183,.35);border-radius:10px;padding:8px 10px;box-shadow:0 4px 16px rgba(0,0,0,.4)}.upg-hud-head{display:flex;align-items:baseline;gap:6px;white-space:nowrap}.upg-hud-total{font-size:15px;font-weight:700;color:#6ee7b7}.upg-hud-band{margin-inline-start:auto;font-size:9px;color:#9aa7b8}.upg-hud-band.ok{color:#6ee7b7}.upg-hud-names{margin-top:5px;max-height:84px;overflow:auto;font-size:10px;color:#cbd5e1;line-height:1.45;word-break:break-word}.upg-hud-actions{display:flex;gap:6px;margin-top:7px}.upg-hud-btn{flex:1;cursor:pointer;border:1px solid rgba(110,231,183,.4);background:rgba(16,185,129,.18);color:#d1fae5;font:12px/1 ui-monospace,monospace;padding:0 10px;min-height:40px;border-radius:8px}.upg-hud-btn:hover{background:rgba(16,185,129,.32)}.upg-hud-btn.clear{background:rgba(148,163,184,.12);border-color:rgba(148,163,184,.4);color:#cbd5e1}.upg-hud-flash{margin-top:5px;font-size:9px;color:#6ee7b7;min-height:11px}.upg-hud-hint{margin-top:4px;font-size:9px;color:#64748b}.upg-hud-swatches{display:flex;gap:6px;margin-top:7px;align-items:center;flex-wrap:wrap}.upg-swatch{width:40px;height:40px;border-radius:9px;cursor:pointer;padding:0;border:1px solid rgba(255,255,255,.3)}.upg-swatch.active{outline:2px solid #fff;outline-offset:1px}.upg-hex{width:84px;min-height:40px;background:rgba(148,163,184,.12);border:1px solid rgba(148,163,184,.4);color:#cbd5e1;font:12px/1 ui-monospace,monospace;padding:0 8px;border-radius:8px}@media(max-width:480px){.upg-hud{left:8px;right:8px;min-width:0;bottom:calc(var(--upg-credit-floor) + 30px);max-height:48vh;overflow:auto}}.map-toolbar .mcb.upg-batch-on{background:#10b981!important;color:#04241a!important;box-shadow:0 0 0 2px rgba(52,211,153,.45),0 1px 4px rgba(0,0,0,0.2)!important}.map-toolbar .mcb.upg-batch-on.dark{border-color:#34d399!important}.upg-batch-row{position:relative;background:rgba(16,185,129,.16)!important;opacity:1!important;box-shadow:inset 3px 0 0 0 #10b981}.upg-batch-row .stl-name{color:#065f46!important;font-weight:700}.stl-panel[data-theme="dark"] .upg-batch-row .stl-name,.upg-batch-row.dark .stl-name{color:#6ee7b7!important}.upg-batch-row .stl-dot{box-shadow:0 0 0 2px #10b981}.mapboxgl-ctrl-top-left{top:12px!important;left:8px!important;width:380px!important;max-width:380px!important;z-index:1200!important}.mapboxgl-ctrl-top-left .mapboxgl-ctrl{margin:0!important;float:none!important}.stl-panel{--stl-top:8px!important}.upg-root:has(.mapboxgl-ctrl-geocoder) .stl-panel{--stl-top:58px!important}[dir="rtl"] .upg-legend-desktop-slot .stl-panel,.upg-root:has(.mapboxgl-ctrl-logo) .upg-legend-desktop-slot .stl-panel{max-height:calc(100% - var(--stl-top,60px) - 12px - 30px)!important}[dir="rtl"] .upg-detail-panel{right:auto!important;left:8px!important}.dg-main{font:13px/1.3 ui-monospace,monospace}.dg-meta{margin-top:2px;font-size:11px;color:#475569;display:flex;flex-wrap:wrap;gap:8px}.dg-field strong{font-weight:700}.dg-section-header-item{padding:4px 8px;font:10px/1.2 ui-monospace,monospace;letter-spacing:.06em;text-transform:uppercase;color:#94a3b8;pointer-events:none}`);function _e(C){const F=[];for(const W of C)F.push(W.zoneKey,uP(W.zoneKey,W.color));return["match",["get","zoneKey"],...F,"#9ca3af"]}function x(){if(H.getSource("tapestry")&&H.getLayer("tapestry-fill")&&H.getLayer("tapestry-line"))return;H.getSource("tapestry")||H.addSource("tapestry",{type:"geojson",data:be});const C=$.value?.45:.3,F=$.value?.65:.45;if(H.getLayer("tapestry-fill")||H.addLayer({id:"tapestry-fill",type:"fill",source:"tapestry",paint:{"fill-color":Ee,"fill-opacity":["case",["==",["get","zoneKey"],"deaf"],C,F]}}),H.getLayer("tapestry-line")||H.addLayer({id:"tapestry-line",type:"line",source:"tapestry",paint:{"line-color":Ee,"line-width":1.2,"line-opacity":.9}}),Io){const W=Io;io(()=>{Io===W&&Ka(W)})}}function S(){!H||!H.getSource("tapestry")||H.getLayer("upg-sel-fill")||(H.addLayer({id:"upg-sel-fill",type:"fill",source:"tapestry",filter:["boolean",!1],paint:{"fill-color":"#f59e0b","fill-opacity":.28}}),H.addLayer({id:"upg-sel-line",type:"line",source:"tapestry",filter:["boolean",!1],paint:{"line-color":"#fbbf24","line-width":2.4,"line-opacity":.95}}))}function Z(){const C=[],F=[],W=[];for(const Te of v.value)Te.kind==="adm1"?C.push(Te.name):Te.kind==="adm0"?F.push(Te.key.slice(5)):Te.kind==="zone"&&W.push(Te.key.slice(5));const ee=[];return C.length&&ee.push(["in",["get","shapeName"],["literal",C]]),F.length&&ee.push(["in",["get","iso3"],["literal",F]]),W.length&&ee.push(["in",["get","zoneKey"],["literal",W]]),ee.length?ee.length===1?ee[0]:["any",...ee]:["boolean",!1]}function A(){if(Ne(),!H||!H.getLayer("upg-sel-fill"))return;const C=J.value?Z():["boolean",!1];H.setFilter("upg-sel-fill",C),H.setFilter("upg-sel-line",C);const F=B.value;H.setPaintProperty("upg-sel-fill","fill-color",F||"#f59e0b"),H.setPaintProperty("upg-sel-fill","fill-opacity",F?.55:.28),H.setPaintProperty("upg-sel-line","line-color",F||"#fbbf24")}let K=null,q=!1;function D(){if(!(!H||!H.getLayer("tapestry-fill"))){if(K)try{H.off("click","tapestry-fill",K)}catch{}K=C=>{const F=C&&C.features&&C.features[0];if(F&&J.value){const W=If(F.properties,{nameMap:V});if(!W){console.warn("[batch-select] clicked feature has no shapeName/iso3",F.properties);return}W.count==null&&console.warn("[batch-select] no UUPG count for territory",W.name,F.properties),re(W)}},H.on("click","tapestry-fill",K),q||(H.on("mouseenter","tapestry-fill",()=>{H&&(H.getCanvas().style.cursor=J.value?"crosshair":"")}),H.on("mouseleave","tapestry-fill",()=>{H&&(H.getCanvas().style.cursor="")}),q=!0)}}function G(){v.value=[],T.value="",B.value="",he.value="",A()}let fe=null;function Le(C){if(fe=C,p&&typeof p.cacheSourceData=="function"){const F=vP({records:C,leafZones:ke,adm1Counts:$s,iso3Names:gn,countryNameMap:V,centroidFor:W=>{const ee=$t(W);return ee?[(ee[0][0]+ee[1][0])/2,(ee[0][1]+ee[1][1])/2]:null}});p.cacheSourceData(eu,{normalizedData:F})}le=_P({records:C,leafZones:ke,adm1Counts:$s,iso3Names:gn,countryNameMap:V}),typeof window<"u"&&(window.__UPG_SEARCH__={size:()=>le.length,counts:()=>{const F={pg:0,zone:0,territory:0};for(const W of le)F[W.kind]=(F[W.kind]||0)+1;return F},query:F=>zf(le,F,{limit:jf}).map(W=>({label:W.label,kind:W.kind,target:W.target})),select:F=>{const W=zf(le,F,{limit:jf})[0];return W?(Me(W.target),{label:W.label,kind:W.kind,target:W.target}):null},feedSize:()=>{const F=p&&p.sources&&p.sources[eu];return F&&Array.isArray(F.features)&&F.features.length||0},localGeocoder:F=>{const W=O.value&&O.value.geocoder,ee=W&&W.options&&W.options.localGeocoder;return ee?ee(F).map(Te=>Te&&Te.place_name):null}},n=window.__UPG_SEARCH__,(window.__UPG_SEARCHES__||(window.__UPG_SEARCHES__={}))[s()]=window.__UPG_SEARCH__)}function ot(C){const F=C&&C.properties||{},W=F.__upgKind;if(W==="zone")Fe(F.__zoneId);else if(W==="territory")rt(F.__shapeName);else{const ee=C&&C.geometry,Te=ee&&Array.isArray(ee.coordinates)?ee.coordinates:null;Te&&Number.isFinite(Te[0])&&Number.isFinite(Te[1])&&H&&H.flyTo({center:[Te[0],Te[1]],zoom:6,duration:800}),Re(F.slug)}}function gt(C){if(!C||!H)return;const F=new Set(C.memberIds||[]);if(!F.size)return;let W=[];try{W=H.querySourceFeatures("upg").filter(st=>{const Ae=st.properties||{};return F.has(Ae.slug)||F.has(Ae.id)||F.has(Ae.peopleGroupId)})}catch{return}if(!W.length)return;let ee=180,Te=90,Ze=-180,Je=-90,Qe=!1;for(const st of W){const Ae=st.geometry&&st.geometry.coordinates;!Array.isArray(Ae)||!Number.isFinite(Ae[0])||!Number.isFinite(Ae[1])||(Ae[0]Ze&&(Ze=Ae[0]),Ae[1]Je&&(Je=Ae[1]),Qe=!0)}Qe&&H.fitBounds([[ee,Te],[Ze,Je]],{padding:60,duration:800,maxZoom:6})}function vt(){Uo(null),_&&typeof _.selectPeopleGroup=="function"&&_.selectPeopleGroup(null)}function Me(C){!C||!H||(C.type==="pg"?(Number.isFinite(C.lng)&&Number.isFinite(C.lat)&&H.flyTo({center:[C.lng,C.lat],zoom:6,duration:800}),Re(C.slug)):C.type==="zone"?Fe(C.zoneId):C.type==="territory"&&rt(C.shapeName))}function Re(C){if(!C||!_||typeof _.selectPeopleGroup!="function")return;const W=PP(H,"upg").find(ee=>ee.properties&&ee.properties.slug===C);W&&_.selectPeopleGroup(W)}function Fe(C){if(!C||!H||!be)return;const F=$t(W=>W.properties&&W.properties.zoneKey===C);F&&H.fitBounds(F,{padding:40,duration:800,maxZoom:6})}function rt(C){if(!C||!H||!be)return;const F=$t(W=>{const ee=W.properties||{};return ee.shapeName===C||ee.iso3===C});F&&H.fitBounds(F,{padding:40,duration:800,maxZoom:6})}function $t(C){let F=180,W=90,ee=-180,Te=-90,Ze=!1;const Je=Qe=>{if(typeof Qe[0]=="number"){const[st,Ae]=Qe;stee&&(ee=st),AeTe&&(Te=Ae),Ze=!0;return}for(const st of Qe)Je(st)};for(const Qe of be.features)C(Qe)&&Je(Qe.geometry.coordinates);return Ze?[[F,W],[ee,Te]]:null}function uo(C){const F=new Set,W=ee=>{ee.children&&ee.children.length?ee.children.forEach(W):F.add(ee.zoneKey??ee.id)};return W(C),F}let Ha=null;function Un(C){if(![...uo(C)].length)return;const W=[],ee=Qe=>{Qe.children&&Qe.children.length?Qe.children.forEach(ee):W.push(Qe)};ee(C);const Te=v.value,Ze=new Set(Te.filter(Qe=>Qe.kind==="zone").map(Qe=>Qe.key));if(W.every(Qe=>Ze.has("zone:"+(Qe.zoneKey??Qe.id)))){const Qe=new Set(W.map(st=>"zone:"+(st.zoneKey??st.id)));v.value=Te.filter(st=>!Qe.has(st.key))}else{const Qe=W.filter(st=>!Ze.has("zone:"+(st.zoneKey??st.id))).map(st=>({key:"zone:"+(st.zoneKey??st.id),name:st.label||st.id,count:Number(st.count)||0,kind:"zone"}));v.value=[...Te,...Qe]}A(),T.value=""}function U(){const C=new Set;for(const F of v.value)F.kind==="zone"&&C.add(F.key.slice(5));return C}function oe(){const C=new Map,F=W=>{const ee=uo(W);W.label&&C.set(W.label,ee),W.children&&W.children.length&&W.children.forEach(F)};for(const W of b.value)F(W);return C}function Ne(){if(typeof document>"u")return;const C=document.querySelector("my-upg-100-list-map"),W=(C&&C.shadowRoot||document).querySelectorAll(".stl-row");if(!W.length)return;if(!J.value){W.forEach(Je=>Je.classList.remove("upg-batch-row"));return}const ee=U(),Te=oe(),Ze=$.value;W.forEach(Je=>{const Qe=Je.querySelector(".stl-name"),st=Qe?Qe.textContent.trim():"",Ae=st&&Te.get(st),dt=!!(Ae&&Ae.size&&[...Ae].every(Ke=>ee.has(Ke)));Je.classList.toggle("upg-batch-row",dt),Je.classList.toggle("dark",dt&&Ze)})}let De=null;function Ye(){if(typeof document>"u"||De)return;const C=document.querySelector("my-upg-100-list-map"),W=(C&&C.shadowRoot||document).querySelector(".stl-rows");W&&(De=new MutationObserver(()=>{requestAnimationFrame(()=>Ne())}),De.observe(W,{childList:!0,subtree:!0}))}ho("onSemanticTreeSelect",Uo),ho("onLegendExport",At),ho("legendExportCards",!0);async function At(C){const F=m.value;if(!F)return;const[W,ee]=String(C).split(":");if(!ye.value){ye.value=!0,Ie.value=W==="packet"?"packet":W==="cards"?"cards":"poster";try{if(W==="packet"){await Hr(F,ee||"full");return}const Te=pe().find(Ze=>Ze.id===F)||{id:F};if(W==="cards"){const Ze=pe().find(Je=>Je.id===F);Ze&&await ze.printCardDeck(await Ur(Ze));return}await ze.printPoster(Te)}finally{ye.value=!1,Ie.value=""}}}const ze=Yg({t:(C,F,W)=>typeof W=="number"?$e(C,F,W):$e(C,F),records:C=>Po(C),lang:()=>Yt(),label:C=>(C==null?void 0:C.label)||(C==null?void 0:C.id)||"",assetsBase:()=>ra(a.value),iso3Names:()=>gn,sheet:(C,F)=>Wn(C,F),sets:()=>fetch(`${ra(a.value)}/tables/near-neighbors.json`).then(C=>C.ok?C.json():null).catch(()=>null),downloadPrefix:"doxa-upg-100"});let Ot="";ht(ze.exportState,C=>{if(!C){Ot&&h.value===Ot&&(h.value=""),Ot="";return}if(C.phase==="error"){Ot="",Ua($e("messages.packetFailed",{reason:C.message}),4e3);return}Ot=C.phase==="done"?"":`${C.message}…`,h.value=Ot});const qt=rh({apiBase:()=>Ve,lang:()=>Yt(),profileConfig:a,evaluate:(C,F)=>Oa(C,F)});async function Po(C){if(!Ve)throw mo("wall.hud.noApi","no people-groups service is configured");return qt(C.selector)}const Wn=dh({allRecords:()=>qt.all(),assetsBase:()=>ra(a.value),profileConfig:a});function Kn(C,F,W){C.value=F,setTimeout(()=>{C.value===F&&(C.value="")},W)}const Ua=(C,F)=>Kn(h,C,F);async function Hr(C,F="full"){const W=pe().find(Te=>Te.id===C);if(!W)return;const ee=await Ur(W);await ze.printPacket(ee,{variant:F,funnel:await Se()})}async function Ur(C){try{const[{zoneTitle:F},{countryName:W},ee]=await Promise.all([wt(()=>Promise.resolve().then(()=>Sv),void 0),wt(()=>Promise.resolve().then(()=>sc),void 0),os(ra(a.value))]),Te={...ee.en||{},...ee[Yt()]||{}},Ze=F(C,Te,{countryName:W,locale:Yt()});return Ze?{...C,label:Ze}:C}catch{return C}}function ie(){return Ql(Fn(a))}function ce(){const C=ie();return[...C.lists||[],...C.asia_lists||[],...C.uncovered_lists||[]]}function pe(){const C=ce(),F=new Set(C.map(W=>W.id));return[...C,...bv(ie(),{deafCount:Bf}).filter(W=>!F.has(W.id))]}async function Se(){var C;try{const F=(await wt(async()=>{const{default:Ze}=await Promise.resolve().then(()=>sm);return{default:Ze}},void 0)).default;if(!F||!Array.isArray(F.steps)||!F.steps.length)return null;const W=Fn(a),ee=Number(F.steps[F.steps.length-1].groups)||0;if(W===Tr)return{...F,listCount:pe().length,listTotal:ee};let Te=0;try{const Ze=ra(a.value),Je=await fetch(`${Ze}/people-groups/lists/${W}.json`);if(Je.ok){const Qe=await Je.json();Te=Number((C=Qe==null?void 0:Qe.counts)==null?void 0:C.doxa)||(Array.isArray(Qe==null?void 0:Qe.slugs)?Qe.slugs.length:0)}}catch{}return{...F,listTotal:Te,listId:W,listLabel:(Gg(W)||{}).label||W}}catch{return null}}const ye=me(!1),Ie=me("");function we(){const C=v.value.filter(W=>W.kind==="zone").map(W=>String(W.key).replace(/^zone:/,"")),F=new Map(pe().map(W=>[W.id,W]));return C.map(W=>F.get(W)).filter(Boolean)}async function Ge(){const C=await os(ra(a.value));return{...C.en||{},...C[Yt()]||{}}}function at(C,F){return C?String(C).replace(/\{(\w+)\}/g,(W,ee)=>F[ee]!=null?String(F[ee]):W):null}function Oe(){return v.value.filter(C=>C.kind==="adm0").map(C=>String(C.key).replace(/^adm0:/,"")).filter(Boolean)}function We(){return v.value.filter(C=>C.kind==="adm1").map(C=>C.name||String(C.key).replace(/^adm1:/,""))}let ct=null;function Nt(){const C=Yt();if(ct&&ct.lang===C)return ct.promise;if(!Ve)return Promise.reject(mo("wall.hud.noApi","no people-groups service is configured"));const F=nh,W=(async()=>{const ee=await fetch(`${Ve}/api/people-groups/list?fields=${F}&lang=${C}`,{cache:"no-store"});if(!ee.ok)throw mo("wall.hud.fetchFailed","could not load the people groups ({status})",{status:ee.status});return Jc(await Xi(Xc(await ee.json()),a))})();return ct={lang:C,promise:W},W.catch(()=>{ct&&ct.promise===W&&(ct=null)}),W}function Rt(){return SP(ra(a.value))}async function Ut(){const C=we(),F=Oe();let W=We(),ee=null;if(W.length){try{ee=await Rt()}catch{ee=null}ee&&(W=W.filter(Ke=>!ee.byShapeName.has(Ke)))}const Te=ee?v.value.filter(Ke=>Ke.kind==="adm1"&&ee.byShapeName.has(Ke.name)).length:0;if(!C.length&&!F.length&&!Te)throw W.length?mo("upgMap.selectionAdm1NoData","no people-group data for {names} — select the country instead",{names:Yi(W,{locale:Yt()})}):mo("upgMap.nothingSelected","nothing is selected");const Ze=await Nt(),{evaluate:Je}=await wt(async()=>{const{evaluate:Ke}=await Promise.resolve().then(()=>sh);return{evaluate:Ke}},void 0),Qe=new Map(Ze.map(Ke=>[Ke.slug,Ke])),st=new Map(pe().map(Ke=>[Ke.id,Ke])),Ae=new Map,dt=(Ke,Lt)=>{const ft=Ae.get(Ke);ft?ft.includes(Lt)||ft.push(Lt):Ae.set(Ke,[Lt])};for(const Ke of v.value)if(Ke.kind==="zone"){const Lt=st.get(String(Ke.key).replace(/^zone:/,""));if(!Lt)continue;const ft=Lt.selector&&Lt.selector.type==="pg_slugs"?Lt.selector.values||[]:Je(Lt.selector,Ze);for(const jt of ft)dt(jt,Ke.name)}else if(Ke.kind==="adm0")for(const Lt of Je({type:"country_codes",values:[String(Ke.key).replace(/^adm0:/,"")]},Ze))dt(Lt,Ke.name);else if(Ke.kind==="adm1"&&ee){const Lt=ee.byShapeName.get(Ke.name);if(Lt)for(const ft of Lt.slugs)dt(ft,Ke.name)}return{records:[...Ae.keys()].map(Ke=>Qe.get(Ke)).filter(Boolean),from:Ae,missing:W}}async function wo(){const C=we(),{from:F}=await Ut(),W=(await Promise.all(C.map(Ur))).map(st=>st.label||st.id),ee=v.value.filter(st=>st.kind==="adm0").map(st=>st.name),Te=[...W,...ee],Ze=await Ge(),Je=(st,Ae)=>at(Ze.zone_join,{a:st,b:Ae})??`${st} + ${Ae}`;return{id:"selection",label:Te.length<=3?Te.reduce(Je):at(Ze.zone_join_more,{a:Te.slice(0,2).reduce(Je),n:Te.length-2})??`${Te.slice(0,2).join(" + ")} +${Te.length-2} more`,count:F.size,selector:{type:"pg_slugs",values:[...F.keys()]}}}function Mo(C){return C&&C.length?$e("upgMap.selectionAdm1NoData",{names:Yi(C,{locale:Yt()})}):""}function po(){const C=v.value;if(!C.length)return;const F=B.value;let W=null,ee="";const Te=Ut().then(Je=>(W=Je.records.length,ee=Mo(Je.missing),Df(C,{color:F},Of(Je.records,Je.from,{color:F}))),Je=>(ee=un(Je,$e),Df(C,{color:F})));Te.then(Je=>{try{window.__UPG_LAST_CLIPBOARD__=Je}catch{}});const Ze=mP(C)?"":$e("upgMap.copyNotRegroupable");No(Te).then(Je=>{const Qe=(W==null?$e("upgMap.copiedTerritoriesOnly",{reason:ee.slice(0,90)}):$e("upgMap.copiedSelection",{count:W})+(ee?" · "+ee.slice(0,90):""))+(Ze?" · "+Ze:"");Kn(T,Je?Qe:$e("messages.copyFailed"),Je&&(ee||Ze)?6e3:3e3)})}async function No(C){const F=typeof navigator<"u"?navigator:null;if(F&&F.clipboard&&F.clipboard.write&&typeof ClipboardItem<"u")try{return await F.clipboard.write([new ClipboardItem({"text/plain":C.then(ee=>new Blob([ee],{type:"text/plain"}))})]),!0}catch{}const W=await C;try{if(F&&F.clipboard&&F.clipboard.writeText)return await F.clipboard.writeText(W),!0}catch{}return ao(W)}function ao(C){try{const F=document.createElement("textarea");F.value=C,F.style.position="fixed",F.style.opacity="0",F.style.top="0",document.body.appendChild(F),F.focus(),F.select();const W=document.execCommand&&document.execCommand("copy");return document.body.removeChild(F),!!W}catch{return!1}}async function Qt(){if(!ye.value){ye.value=!0,Ie.value="csv";try{const C=await Ut(),F=B.value,W=Of(C.records,C.from,{color:F});try{window.__UPG_LAST_CSV__=W}catch{}const ee=URL.createObjectURL(new Blob(["\uFEFF"+W],{type:"text/csv;charset=utf-8"})),Te=document.createElement("a");Te.href=ee,Te.download=bP(v.value.map(Je=>Je.name).join(" ")),Te.style.display="none",document.body.appendChild(Te),Te.click(),setTimeout(()=>{try{URL.revokeObjectURL(ee),Te.remove()}catch{}},400);const Ze=Mo(C.missing);Kn(T,$e("upgMap.csvSaved",{count:C.records.length})+(Ze?" · "+Ze.slice(0,90):""),Ze?6e3:3e3)}catch(C){Kn(T,$e("upgMap.csvFailed",{reason:un(C,$e).slice(0,90)}),5e3)}finally{ye.value=!1,Ie.value=""}}}async function Gt(){if(!ye.value){ye.value=!0,Ie.value="packet";try{const C=await wo(),F=we(),W=F.length===1?F[0].id:null,ee=await Se();await ze.printPacket({...C,mapId:W},{funnel:ee&&F.length===1?ee:ee?{...ee,listCount:0}:null})}catch(C){Ua($e("messages.selectionPacketFailed",{reason:un(C,$e).slice(0,90)}),4e3)}finally{ye.value=!1,Ie.value=""}}}async function Dt(){if(!ye.value){ye.value=!0,Ie.value="cards";try{await ze.printCardDeck(await wo())}catch(C){Ua($e("upgMap.selectionCardsFailed",{reason:un(C,$e).slice(0,90)}),4e3)}finally{ye.value=!1,Ie.value=""}}}async function Ro(){if(!ye.value){ye.value=!0,Ie.value="poster";try{const C=we();if(!C.length)throw Oe().length||We().length?mo("upgMap.selectionPosterNeedsZone","posters exist per territory on the legend — use Prayer list for a map selection"):mo("upgMap.nothingSelected","nothing is selected");if(C.length>1){Ua($e("messages.posterOneTerritory",{count:C.length}),5e3);return}await ze.printPoster(C[0])}catch(C){Ua($e("messages.selectionPosterFailed",{reason:un(C,$e).slice(0,90)}),4e3)}finally{ye.value=!1,Ie.value=""}}}function Yt(){const C=tt&&(tt.value??tt);return typeof C=="string"&&C||"en"}function Uo(C){if(!H||!H.getLayer("tapestry-fill"))return!1;if(J.value)return C&&Un(C),!0;if(!C)return Ha=null,m.value=null,H.setFilter("tapestry-fill",null),H.setFilter("tapestry-line",null),H.setPaintProperty("upg-pins","circle-opacity",1),!0;Ha=C;const F=[...uo(C)];m.value=F.length===1?F[0]:C.id??null;const W=["in",["get","zoneKey"],["literal",F]];H.setFilter("tapestry-fill",W),H.setFilter("tapestry-line",W),H.getLayer("upg-pins")&&H.setPaintProperty("upg-pins","circle-opacity",["case",["in",["get","zoneKey"],["literal",F]],.95,.05]);const ee=$t(Te=>F.includes(Te.properties.zoneKey));return ee&&H.fitBounds(ee,{padding:40,duration:700,maxZoom:6}),!0}function Wa(){H&&(typeof Pe=="function"&&Pe(),be&&(x(),S(),D(),A(),m.value&&H.getLayer("tapestry-fill")&&Uo(Ha)))}function Wo(){H&&($.value=!$.value,g.theme.value=$.value?"dark":"light",H.setStyle($.value?Yc("ink",l).style||"mapbox://styles/mapbox/dark-v11":Yc("paper",l).style||"mapbox://styles/mapbox/light-v11"),H.once("style.load",Wa))}function Ko(){!H||!H.getLayer("upg-pins-hit")||(H.on("click","upg-pins-hit",C=>{if(J.value)return;const F=C&&C.features&&C.features[0];F&&_&&typeof _.selectPeopleGroup=="function"&&_.selectPeopleGroup(F)}),H.on("mouseenter","upg-pins-hit",()=>{H&&(H.getCanvas().style.cursor=J.value?"crosshair":"pointer")}),H.on("mouseleave","upg-pins-hit",()=>{H&&(H.getCanvas().style.cursor="")}))}let sa=null,Io,Vo=null;function Vn(C,F){var W,ee,Te;try{const Ze=(Te=(ee=(W=f.value)==null?void 0:W.getRootNode)==null?void 0:ee.call(W))==null?void 0:Te.host;if(!Ze)return;Ze.setAttribute("data-doxa-select-zone-state",C),F&&Ze.setAttribute("data-doxa-select-zone-applied",String(F))}catch{}}function Ka(C){if(!C)return Uo(null),Io=void 0,Vn("cleared",""),!0;const F=Yn(b.value,C);return F?Uo(F)?(Io=void 0,Vn("applied",C),!0):(Io=C,Vn("applied-but-no-selection",C),!1):(Io=C,Vn("unresolved",C),!1)}function qn(C){var W;const F=((W=C==null?void 0:C.detail)==null?void 0:W.listId)??null;Ka(F)}function Yn(C,F){for(const W of C||[]){if((W.zoneKey||W.id)===F)return W;const ee=W.children&&Yn(W.children,F);if(ee)return ee}return null}const Wr=te(()=>{if(!m.value||J.value)return null;const C=Yn(b.value,m.value);return C&&C.label||String(m.value)});function Kr(){Ka(null)}function Ps(){const C=ie(),F=ne(null);b.value=F,ke=Nr(F);const W={};for(const ee of C.lists||[])W[ee.id]=ee.selector;for(const ee of C.asia_lists||[])W[ee.id]=ee.selector;for(const ee of C.uncovered_lists||[])W[ee.id]=ee.selector;W.deaf=Mr;for(const ee of ke)ee.selector=W[ee.id];Ee=_e(ke)}async function He(){if(Ve)try{const F=await fetch(`${Ve}/api/people-groups/list?fields=slug,name,country_code,wagf_region,wagf_block,rop1,population,latitude,longitude&lang=${Yt()}`,{cache:"no-store"});if(!F.ok)throw new Error(`list ${F.status}`);const W=Jc(await Xi(Xc(await F.json()),a));V=Ff(W),b.value=ne(W)}catch{}}fo(async()=>{var Te,Ze,Je,Qe,st;Ps();try{await nP(l)}catch{}if(!f.value)return;const C=Zc(l);C&&aP(C);const F=(o==null?void 0:o.value)||((Te=a==null?void 0:a.value)==null?void 0:Te.tk)||"";if(!C){console.warn(`[upg-100-list] ${l} engine global is missing — refusing to substitute another engine. A page that asked for the keyless engine must not silently receive the token-gated one.`),h.value=`⚠ ${$e("messages.engineNotLoaded")}`,y.value=$e("messages.engineNotLoadedDetail",{engine:c?"MapLibre":"Mapbox"}),He();return}if(!c){if(!F){h.value=`⚠ ${$e("messages.noMapboxToken")}`,y.value=$e("messages.noMapboxTokenDetail"),He();return}C.accessToken=F}try{const Ae=Tf(l);Ae&&await rP(f.value,Ae)}catch{}if(!f.value)return;try{const Ae=!c&&f.value&&f.value.getRootNode();if(Ae instanceof ShadowRoot){const dt=Tf("mapbox");if(dt&&!Ae.querySelector(`link[href="${dt}"]`)){const Ke=document.createElement("link");Ke.rel="stylesheet",Ke.href=dt,Ae.prepend(Ke)}}}catch{}H=new C.Map({container:f.value,style:Yc("paper",l).style||"mapbox://styles/mapbox/light-v11",center:[35,20],zoom:1.5,projection:"mercator"}),w.value=H,Be=eP(((Ze=f.value)==null?void 0:Ze.parentElement)||null,{enabled:d.value}),typeof window<"u"&&(window.__UPG_MAP__=H,r=H,(window.__UPG_MAPS__||(window.__UPG_MAPS__={}))[s()]=H),window.__UPG_SELECT__={get list(){return v.value.map(Ae=>({...Ae}))},get total(){return P.value},get count(){return L.value},get color(){return B.value},get batchMode(){return J.value},setColor:Ae=>k(Ae),setBatchMode:Ae=>R(Ae),clipboardText:()=>Qc(v.value,{color:B.value}),clear:()=>G(),toggleByProps:Ae=>{const dt=If(Ae,{nameMap:V});return dt?(re(dt),{...dt}):null},toggleLegendRow:Ae=>{const dt=Lt=>{for(const ft of Lt){if(ft.label===Ae||ft.id===Ae)return ft;if(ft.children&&ft.children.length){const jt=dt(ft.children);if(jt)return jt}}return null},Ke=dt(b.value);return Ke?(Un(Ke),{label:Ke.label,zoneKeys:[...uo(Ke)]}):null},markedLegendRows:()=>{if(typeof document>"u")return[];const Ae=document.querySelector("my-upg-100-list-map");return[...(Ae&&Ae.shadowRoot||document).querySelectorAll(".stl-row.upg-batch-row .stl-name")].map(Ke=>Ke.textContent.trim())},highlightFeatureCount:()=>{if(!H||!be||!H.getLayer("upg-sel-fill"))return-1;const Ae=new Set,dt=new Set,Ke=new Set;for(const ft of v.value)ft.kind==="zone"?Ae.add(ft.key.slice(5)):ft.kind==="adm1"?dt.add(ft.name):ft.kind==="adm0"&&Ke.add(ft.key.slice(5));let Lt=0;for(const ft of be.features){const jt=ft.properties||{};(Ae.has(jt.zoneKey)||dt.has(jt.shapeName)||Ke.has(jt.iso3))&&Lt++}return Lt},zoneKeysForRow:Ae=>{const dt=Lt=>{for(const ft of Lt){if(ft.label===Ae||ft.id===Ae)return ft;if(ft.children&&ft.children.length){const jt=dt(ft.children);if(jt)return jt}}return null},Ke=dt(b.value);return Ke?[...uo(Ke)]:null}},i=window.__UPG_SELECT__,(window.__UPG_SELECTS__||(window.__UPG_SELECTS__={}))[s()]=window.__UPG_SELECT__;try{h.value=$e("messages.loadingBoundaries");const Ae=ut=>`${ra(a.value)}/boundaries/${ut}`,dt=ut=>fetch(Ae(ut)).then(ro=>{if(!ro.ok)throw new Error(`boundary fetch ${ro.status} ${ut}`);return ro.json()});if(!Ve)throw new Error("No API base configured — set window.MAP_APP_API_URL or VITE_API_BASE_URL. Failing closed (no default host).");const Lt=fetch(`${Ve}/api/people-groups/list?fields=slug,name,country_code,wagf_region,wagf_block,rop1,population,latitude,longitude&lang=${Yt()}`).then(ut=>{if(!ut.ok)throw new Error(`list ${ut.status}`);return ut.json()}),ft={adm0:dt("world-adm0-web.geojson"),adm1Chn:dt("gb-CHN-ADM1.geojson"),adm1Ind:dt("gb-IND-ADM1-web.geojson")};h.value=$e("messages.fetchingUupgs",{n:2106});const jt=Jc(await Xi(Xc(await Lt),a));V=Ff(jt),b.value=ne(jt);const Vr=[],mn={},{evaluate:As}=await wt(async()=>{const{evaluate:ut}=await Promise.resolve().then(()=>sh);return{evaluate:ut}},void 0);for(const ut of ke)if(ut.selector&&ut.selector.type==="pg_slugs")for(const ro of ut.selector.values||[])ro in mn||(mn[ro]=ut.zoneKey);else try{for(const ro of As(ut.selector,jt))ro in mn||(mn[ro]=ut.zoneKey)}catch(ro){console.warn("zone selector skipped",ut.id,ro&&ro.message)}for(const ut of jt){const ro=Number(ut.latitude),du=Number(ut.longitude);!isFinite(ro)||!isFinite(du)||Vr.push({type:"Feature",geometry:{type:"Point",coordinates:[du,ro]},properties:{slug:ut.slug,zoneKey:mn[ut.slug]||"",name:ut.name||ut.slug||"",population:ut.population??0,countryName:ut.country_code_label||"",country:ut.country_code||""}})}const cu=Ya({type:"FeatureCollection",features:Vr});Pe=()=>{H.getSource("upg")&&H.getLayer("upg-pins")&&H.getLayer("upg-pins-hit")||(H.getSource("upg")||H.addSource("upg",{type:"geojson",data:cu}),H.getLayer("upg-pins")||H.addLayer({id:"upg-pins",type:"circle",source:"upg",paint:{"circle-radius":["interpolate",["linear"],["zoom"],0,2.6,2,3.2,4,4.5,6,6.5,8,9],"circle-color":Ee,"circle-opacity":1,"circle-stroke-width":["interpolate",["linear"],["zoom"],0,.9,4,1.4,8,2],"circle-stroke-color":"rgba(15,20,25,0.9)"}}),H.getLayer("upg-pins-hit")||H.addLayer({id:"upg-pins-hit",type:"circle",source:"upg",paint:{"circle-radius":["interpolate",["linear"],["zoom"],1,5,4,6.5,8,9],"circle-stroke-width":["interpolate",["linear"],["zoom"],1,1.8,8,2],"circle-opacity":0,"circle-stroke-opacity":0}}),Ko())};const Ls=()=>{try{Wa()}catch(ut){console.warn("early pin paint skipped",ut&&ut.message)}};H.isStyleLoaded()?Ls():H.once("style.load",Ls),h.value=$e("messages.loadingBoundaries");const[$A,_A]=await Promise.all([ft.adm0,ft.adm1Chn]),yA=await ft.adm1Ind,{tapestry:vA,perZone:kA}=wv(ke,{records:jt,adm0:$A,adm1Ind:yA,adm1Chn:_A});be=Ya(vA),Le(jt);let uu=!0;const Zn=()=>{uu&&(uu=!1,H.off("style.load",Zn),H.off("idle",Zn),Wa())};if(H.isStyleLoaded())Zn();else{H.once("style.load",Zn),H.once("idle",Zn);const ut=setInterval(()=>{if(!uu||!H){clearInterval(ut);return}let ro=!1;try{ro=H.isStyleLoaded()}catch{clearInterval(ut);return}ro&&(clearInterval(ut),Zn())},120);setTimeout(()=>clearInterval(ut),15e3)}const fm=[...kA.entries()].filter(([ut])=>ut!=="deaf"),wA=fm.filter(([,ut])=>ut>=1).length;h.value=$e("messages.mapStatusCounts",{polys:be.features.length,zones:wA,total:fm.length,pins:Vr.length})}catch(Ae){console.warn("[upg-100-list] map data failed:",Ae),h.value="⚠ "+$e("upgMap.mapDataFailed")}let W=0;const ee=()=>{const Ae=typeof document<"u"&&document.querySelector("my-upg-100-list-map"),dt=Ae&&Ae.shadowRoot||(typeof document<"u"?document:null);if(dt&&dt.querySelector(".stl-rows")){Ye(),Ne();return}W++<40&&setTimeout(ee,250)};ee();{const Ae=(st=(Qe=(Je=f.value)==null?void 0:Je.getRootNode)==null?void 0:Qe.call(Je))==null?void 0:st.host;if(Ae){sa=qn,Ae.addEventListener("doxa:select-zone",sa);const dt=Ae.getAttribute("select-zone");dt&&Ka(dt),Vo=new MutationObserver(()=>{Ka(Ae.getAttribute("select-zone")||null)}),Vo.observe(Ae,{attributes:!0,attributeFilter:["select-zone"]})}}});const no=()=>{var C,F,W;try{return((W=(F=(C=f.value)==null?void 0:C.getRootNode)==null?void 0:F.call(C))==null?void 0:W.host)||null}catch{return null}};return ht([b,w],()=>{io(()=>{var F;const C=((F=no())==null?void 0:F.getAttribute("select-zone"))||Io||null;C&&Ka(C)})}),Jt(()=>{var C,F,W;if(Vo==null||Vo.disconnect(),Vo=null,sa){const ee=(W=(F=(C=f.value)==null?void 0:C.getRootNode)==null?void 0:F.call(C))==null?void 0:W.host;ee==null||ee.removeEventListener("doxa:select-zone",sa),sa=null}if(De){try{De.disconnect()}catch{}De=null}if(Be){try{Be()}catch{}Be=null}if(H&&(H.remove(),H=null),be=null,typeof window<"u"){const ee=s();try{window.__UPG_SEARCHES__&&delete window.__UPG_SEARCHES__[ee],window.__UPG_MAPS__&&delete window.__UPG_MAPS__[ee],window.__UPG_SELECTS__&&delete window.__UPG_SELECTS__[ee],window.__UPG_SEARCH__===n&&delete window.__UPG_SEARCH__,window.__UPG_MAP__===r&&delete window.__UPG_MAP__,window.__UPG_SELECT__===i&&delete window.__UPG_SELECT__,delete window.__UPG_LAST_CLIPBOARD__,delete window.__UPG_LAST_CSV__}catch{}}}),(C,F)=>{var W;return Y(),ae("div",AP,[N("div",{ref_key:"mapEl",ref:f,class:"upg-map"},null,512),y.value?(Y(),ae("div",LP,[N("strong",null,de(se($e)("messages.mapUnavailable")),1),Kt(de(y.value),1)])):xe("",!0),d.value?(Y(),ae(Xe,{key:1},[F[1]||(F[1]=N("div",{class:"map-scroll-edge map-scroll-edge--left"},null,-1)),F[2]||(F[2]=N("div",{class:"map-scroll-edge map-scroll-edge--right"},null,-1))],64)):xe("",!0),w.value&&u.value?(Y(),St(qS,{key:2,ref_key:"geocoderRef",ref:O,"map-instance":w.value,"access-token":se(o)||((W=se(a))==null?void 0:W.tk)||"","data-source-id":eu,"is-dark":$.value,placeholder:ve.value,"active-context":ZP,onPeopleGroupResult:ot,onAggregateResult:gt,onClear:vt},null,8,["map-instance","access-token","is-dark","placeholder"])):xe("",!0),w.value?(Y(),St(vS,{key:3,"has-geocoder":u.value},{default:xo(()=>[yt(wS,{map:w.value,"is-dark":$.value},null,8,["map","is-dark"]),yt(xS,{map:w.value,"is-dark":$.value},null,8,["map","is-dark"]),yt(SS,{map:w.value,"is-dark":$.value},null,8,["map","is-dark"]),yt(LS,{"map-container":f.value,"is-dark":$.value},null,8,["map-container","is-dark"]),yt(TS,{"is-dark":$.value,onToggle:Wo},null,8,["is-dark"]),yt(Ba,{"is-dark":$.value,active:J.value,class:Ue({"upg-batch-on":J.value}),"aria-pressed":J.value?"true":"false",title:ue.value,onClick:E},{default:xo(()=>[...F[3]||(F[3]=[N("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),N("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),N("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),N("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})],-1)])]),_:1},8,["is-dark","active","class","aria-pressed","title"])]),_:1},8,["has-geocoder"])):xe("",!0),N("div",CP,[b.value.length?(Y(),St(wh,{key:0,nodes:b.value,tabs:X.value,"default-tab":Gf,columns:["count","pop"],title:ge.value,"export-enabled":!0,"export-cards":!0,onSelect:Uo,onExport:At},null,8,["nodes","tabs","title"])):xe("",!0)]),N("div",TP,[b.value.length?(Y(),St(yS,{key:0,"legend-type":"upg-100",nodes:b.value,tabs:X.value,"default-tab":Gf,columns:["count","pop"],"column-label":"UPG 100",title:ge.value,"is-dark":$.value,"popup-action":"pray"},null,8,["nodes","tabs","title","is-dark"])):xe("",!0)]),N("div",EP,[se(_)&&se(_).selectedPeopleGroup?(Y(),ae("div",{key:0,class:Ue(["upg-detail-panel pg-detail-root",{dark:$.value}])},[yt(se(t),{peopleGroup:se(_).selectedPeopleGroup,dark:$.value,action:"pray"},null,8,["peopleGroup","dark"])],2)):xe("",!0)]),Wr.value?(Y(),ae("button",{key:4,type:"button",class:"upg-shown","aria-label":se($e)("buttons.clearSelection")+": "+Wr.value,title:se($e)("buttons.clearSelection"),onClick:Kr},[N("span",NP,de(Wr.value),1),F[4]||(F[4]=N("span",{class:"upg-shown-x","aria-hidden":"true"},"×",-1))],8,MP)):xe("",!0),J.value?(Y(),ae("div",RP,[N("div",FP,de(se($e)("messages.tapTerritoriesHint")),1),L.value?(Y(),ae("div",IP,[N("span",null,de(se($e)("messages.territoriesSelected",{count:L.value}))+" ·",1),N("span",OP,de(P.value)+" UUPG",1),N("span",{class:Ue(["upg-hud-band",{ok:P.value>=50&&P.value<=100}])},de(P.value>=50&&P.value<=100?se($e)("messages.bandInRange"):se($e)("messages.bandOutOfRange")),3)])):xe("",!0),L.value?(Y(),ae("div",DP,de(se(Yi)(v.value.map(ee=>ee.name),{locale:Yt()})),1)):xe("",!0),L.value?(Y(),ae("div",{key:2,class:"upg-hud-swatches",role:"group","aria-label":se($e)("upgMap.selectionColourGroup")},[(Y(),ae(Xe,null,Wt(Q,ee=>N("button",{key:ee,type:"button",class:Ue(["upg-swatch",{active:B.value===ee}]),"aria-pressed":B.value===ee?"true":"false","data-color":ee,style:xt({background:ee}),title:se($e)("upgMap.selectionColour",{hex:ee}),"aria-label":se($e)("upgMap.selectionColour",{hex:ee}),onClick:Te=>k(ee)},null,14,GP)),64)),fi(N("input",{"onUpdate:modelValue":F[0]||(F[0]=ee=>he.value=ee),class:"upg-hex",placeholder:"#hex",spellcheck:"false","aria-label":se($e)("upgMap.customColour"),onChange:z,onKeyup:fl(z,["enter"])},null,40,jP),[[Bb,he.value]])],8,zP)):xe("",!0),L.value?(Y(),ae("div",BP,[N("button",{class:Ue(["upg-hud-btn make",{"is-busy":Ie.value==="packet"}]),disabled:ye.value,onClick:Gt},de(Ie.value==="packet"?se($e)("buttons.working"):se($e)("buttons.prayerList")),11,HP),N("button",{class:Ue(["upg-hud-btn make",{"is-busy":Ie.value==="poster"}]),disabled:ye.value,onClick:Ro},de(Ie.value==="poster"?se($e)("buttons.working"):se($e)("buttons.posterMap")),11,UP),N("button",{class:Ue(["upg-hud-btn make",{"is-busy":Ie.value==="cards"}]),disabled:ye.value,onClick:Dt},de(Ie.value==="cards"?se($e)("buttons.working"):se($e)("buttons.cardDeck")),11,WP)])):xe("",!0),L.value?(Y(),ae("div",KP,[N("button",{class:"upg-hud-btn copy",onClick:po},de(se($e)("upgMap.copySelection")),1),N("button",{class:Ue(["upg-hud-btn csv",{"is-busy":Ie.value==="csv"}]),disabled:ye.value,onClick:Qt},de(Ie.value==="csv"?se($e)("buttons.working"):se($e)("upgMap.exportCsv")),11,VP),N("button",{class:"upg-hud-btn clear",onClick:G},de(se($e)("buttons.clearSelection")),1)])):xe("",!0),L.value?(Y(),ae("div",qP,de(T.value),1)):xe("",!0)])):xe("",!0),N("div",YP,de(h.value),1)])}}}},Symbol.toStringTag,{value:"Module"})),XP=` .pane-col{ position:absolute; inset:0; overflow-y:auto; overflow-x:hidden; scroll-snap-type:y mandatory; scroll-behavior:smooth; diff --git a/public/dx-maps/my-upg-100-list/poster-wall/index.html b/public/dx-maps/my-upg-100-list/poster-wall/index.html index 85a2c0624..14c8883a7 100644 --- a/public/dx-maps/my-upg-100-list/poster-wall/index.html +++ b/public/dx-maps/my-upg-100-list/poster-wall/index.html @@ -67,7 +67,7 @@ - + - + - +