0||typeof t=="string"&&parseInt(t,10)>0}function od(e){var o;const t=e.adoptionStatus??((o=e._raw)==null?void 0:o.adopted_by_churches);return t===!0||t===1||t==="1"||t==="true"||typeof t=="number"&&t>0||typeof t=="string"&&parseInt(t,10)>0}const I_={prayer:"legend.title.prayer",engagement:"legend.title.engagement",adoption:"legend.title.adoption","language-families":"legend.title.languageFamilies","language-family":"legend.title.languageFamilies","doxa-regions":"legend.title.doxaRegions","doxa-region":"legend.title.doxaRegions","affinity-blocs":"legend.title.affinityBlocs",countries:"legend.title.countries",country:"legend.title.countries","gospel-resources":"legend.title.gospelResources",religion:"legend.title.religion"};function Sn(e){return e==="doxa-region"?"doxa-regions":e==="country"?"countries":e}function R_(e){return e?e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toLocaleString():"0"}function F_(e){return(Number(e)||0).toLocaleString()}function O_(e,t={}){const o=Ee("dataStore"),n=Ee("uiStore"),a=Ee("mapStore"),{t:r}=kt(),s=a_();s.load();const i=Q(()=>{if(Sn(e.value)==="religion")return"Religion";const y=I_[e.value];return y?r(y):""}),l=Q(()=>Sn(e.value)==="affinity-blocs"?E_:[{key:"count",label:r("legend.columns.upgs"),width:48},{key:"population",label:r("legend.columns.population"),width:48}]),c=Q(()=>{const d=Sn(e.value);return d==="prayer"?n.prayerFilter:d==="engagement"?n.engagementFilter:d==="adoption"?n.adoptionFilter:d==="language-families"?a.selectedFamily:d==="doxa-regions"?a.selectedRegion:d==="gospel-resources"?a.selectedResource:d==="religion"?n.religionFilter:null});function u(d){const y=Sn(e.value);y==="prayer"?n.setPrayerFilter(n.prayerFilter===d?null:d):y==="engagement"?n.setEngagementFilter(n.engagementFilter===d?null:d):y==="adoption"?n.setAdoptionFilter(n.adoptionFilter===d?null:d):y==="language-families"?a.selectFamily(a.selectedFamily===d?null:d):y==="doxa-regions"?a.selectRegion(a.selectedRegion===d?null:d):y==="gospel-resources"?a.selectResource(a.selectedResource===d?null:d):y==="religion"&&n.setReligionFilter(n.religionFilter===d?null:d)}const p=Q(()=>{var y,k,v,_;const d=Sn(e.value);if(d==="prayer"){const m=Zo(o,Ys("noPrayer")),$=Zo(o,Ys("hasPrayer")),L=Zo(o,Ys("fullPrayer")),R=s.loaded.value,M=R?s.noPrayerCount():m.count,I=R?s.hasPrayerCount():$.count,C=R?s.fullPrayerCount():L.count;return[{key:"noPrayer",label:r("legend.prayer.needsPrayer"),color:Jo.noPrayer,count:M,population:m.population,filterKey:"noPrayer",children:[{key:"hasPrayer",label:r("legend.prayer.hasPrayer"),color:Jo.hasPrayer,count:I,population:$.population,filterKey:"hasPrayer"},{key:"fullPrayer",label:r("legend.prayer.fullPrayerCoverage"),color:Jo.fullPrayer,count:C,population:L.population,filterKey:"fullPrayer"}]}]}if(d==="engagement"){const m=Zo(o,L=>!td(L)),$=Zo(o,L=>td(L));return[{key:"notEngaged",label:r("legend.engagement.needsEngagement"),color:Fs.notEngaged,count:m.count,population:m.population,filterKey:"notEngaged",children:[{key:"hasEngagement",label:r("legend.engagement.hasEngagement"),color:Fs.hasEngagement,count:$.count,population:$.population,filterKey:"hasEngagement"}]}]}if(d==="adoption"){const m=Zo(o,L=>!od(L)),$=Zo(o,L=>od(L));return[{key:"notAdopted",label:r("legend.adoption.needsAdoption"),color:Bs.notAdopted,count:m.count,population:m.population,filterKey:"notAdopted",children:[{key:"hasAdoption",label:r("legend.adoption.hasAdoption"),color:Bs.hasAdoption,count:$.count,population:$.population,filterKey:"hasAdoption"}]}]}if(d==="religion"){const m={},L=Object.values(o.sources||{}).flatMap(I=>(I==null?void 0:I.features)||[]);for(const I of L){const C=I.properties||I,F=C.religion||((k=(y=C._raw)==null?void 0:y.religion)==null?void 0:k.value)||((v=C._raw)==null?void 0:v.religion)||"",H=sa(F);m[H]||(m[H]={count:0,population:0}),m[H].count+=1,m[H].population+=parseInt(C.population||((_=C._raw)==null?void 0:_.Population)||0)||0}const R=new Set((t==null?void 0:t.excludeReligionFamilies)||[]);for(const I of R)delete m[I];return Object.keys(m).sort((I,C)=>I==="C"?-1:C==="C"?1:m[C].population-m[I].population).map(I=>({key:I,label:ra[I]||"Unknown",color:Bt[I]||"#94a3b8",count:m[I].count,population:m[I].population,filterKey:I,children:[]}))}if(d==="language-families")return(o.languageFamiliesData||[]).map(m=>({key:m.name,label:m.name,color:Yt(m.name),count:m.count,population:m.population,filterKey:m.name,children:[]}));if(d==="language-family"){const $={value:Object.values(o.sources||{}).flatMap(R=>(R==null?void 0:R.features)||[])},{rows:L}=Qu($);return L.value.map(R=>({key:R.key,label:R.label,color:R.color,count:R.peopleGroupCount,population:R.population,filterKey:R.key,children:[]}))}if(d==="doxa-regions"){const m=P_();return(o.doxaRegionsData||[]).map($=>({key:$.name,label:$.name,color:m[$.name]||"#999",count:$.count,population:$.population,filterKey:$.name,children:[]}))}if(d==="gospel-resources"){const m=T_(),$=(m==null?void 0:m.palette)??{},L=(m==null?void 0:m.names)??{},R=o.resourcesData||[];return Object.keys($).map(M=>{const I=R.find(C=>C.key===M);return{key:M,label:L[M]||M,color:$[M],count:(I==null?void 0:I.count)||0,population:(I==null?void 0:I.population)||0,filterKey:M,children:((I==null?void 0:I.children)||[]).map(C=>({key:C.key,label:C.name||C.key,color:C.color||$[M],count:C.count||0,population:C.population||0,filterKey:C.key}))}})}if(d==="affinity-blocs"){const m=M_();return Object.keys(m).sort().map($=>({key:$,label:$,color:m[$],filterKey:$,children:[]}))}return[]});function g(d,y){return d.reduce((k,v)=>{var m;let _=v[y]||0;return(m=v.children)!=null&&m.length&&(_+=g(v.children,y)),k+_},0)}const x=Q(()=>g(p.value,"count")),w=Q(()=>g(p.value,"population")),h=Q(()=>{if(Sn(e.value)!=="prayer")return null;const d=p.value[0];if(!d)return null;const y=(d.children||[]).find(L=>L.key==="hasPrayer"),k=(d.children||[]).find(L=>L.key==="fullPrayer"),v=Number(d.count)||0,_=Number(y==null?void 0:y.count)||0,m=Number(k==null?void 0:k.count)||0,$=(Number(y==null?void 0:y.population)||0)+(Number(k==null?void 0:k.population)||0);return{covered:_+m,total:x.value,coveredPopulation:$,totalPopulation:w.value,segments:[{key:"fullPrayer",label:(k==null?void 0:k.label)??r("legend.prayer.fullPrayerCoverage"),count:m,color:Jo.fullPrayer},{key:"hasPrayer",label:(y==null?void 0:y.label)??r("legend.prayer.hasPrayer"),count:_,color:Jo.hasPrayer},{key:"noPrayer",label:d.label,count:v,color:Jo.noPrayer}]}});return{items:p,columns:l,title:i,activeFilter:c,setFilter:u,totalCount:x,totalPopulation:w,progress:h,fmtPop:R_,fmtCount:F_}}const D_={excludeReligionFamilies:["C"]},B_="",j_={key:0,class:"lrg-title-row"},G_={class:"lrg-title-caret-slot"},U_={class:"lrg-title"},K_=["data-lrg-filter-key"],z_=["onClick"],H_={key:1,class:"lrg-caret-placeholder","aria-hidden":"true"},V_=["onClick"],W_={class:"lrg-name"},Y_={class:"lrg-badge-inner"},q_=["data-lrg-filter-key"],J_=["onClick"],Z_={class:"lrg-name"},X_={class:"lrg-badge-inner"},Q_={key:1,class:"lrg-footer"},ev={class:"lrg-footer-label"},tv=vn({__name:"LegendRows",props:{title:{type:String,default:""},items:{type:Array,required:!0},columns:{type:Array,default:()=>[]},activeFilter:{type:String,default:null},isDark:{type:Boolean,default:!1},hideColumnHeader:{type:Boolean,default:!1},showFooter:{type:Boolean,default:!1},totalCount:{type:Number,default:0},totalPopulation:{type:Number,default:0},fmtPop:{type:Function,default:e=>String(e||0)},fmtCount:{type:Function,default:e=>String(e||0)},disableCollapse:{type:Boolean,default:!1},progress:{type:Object,default:null}},emits:["filter-click"],setup(e){const{t}=kt();wt(`
.legend-row-group{--lrg-caret-col:30px;display:flex;flex-direction:column;height:100%;min-height:0;}
.lrg-items{display:grid;grid-template-columns:var(--lrg-grid-cols, var(--lrg-caret-col) minmax(80px,1fr) auto auto var(--lrg-caret-col));grid-auto-rows:auto;align-content:start;column-gap:6px;row-gap:6px;padding:0 0 12px;flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:none;-ms-overflow-style:none;}
.lrg-items::-webkit-scrollbar{display:none;width:0;height:0;}
@@ -1030,7 +1030,7 @@
`,"share-button");const{t,tm:o,rt:n}=kt(),a=e,r=ue(null),s=ue(!1),i=ue(null),l=ue(null),c=ue("link"),u=ue(!1),p=ue(!1),g=ue("medium"),x={small:{label:"Small",height:400},medium:{label:"Medium",height:600},large:{label:"Large",height:800}},w=Ee("profileConfig",null),h=Q(()=>Ry({embedPath:a.embedPath,profileConfig:be(w)||null})),d=Q(()=>{const I=x[g.value].height;return''});function y(){s.value=!s.value,s.value&&(c.value="link",u.value=!1,p.value=!1)}function k(){s.value=!1}async function v(I){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(I),!0}catch{}try{const C=document.createElement("textarea");C.value=I,C.setAttribute("readonly",""),C.style.cssText="position:fixed;top:-1000px;opacity:0",document.body.appendChild(C),C.select();const F=document.execCommand("copy");return document.body.removeChild(C),F}catch{return!1}}async function _(){await v(h.value)&&(u.value=!0,setTimeout(()=>{u.value=!1},2e3))}async function m(){await v(d.value)&&(p.value=!0,setTimeout(()=>{p.value=!1},2e3))}const $=Ee("mapToolbar",null),L=ue(null);Pt("mapToolbar",$||{el:L});const R=!$;function M(I){if(r.value=I||null,!R||!I){I||(L.value=null);return}const C=I.offsetParent||I.parentElement;C&&!C.closest(".dsm-map-area, .rm-map-area, .dm-map-area, [data-map-area]")&&C.setAttribute("data-map-area","share-fallback"),L.value=I}return(I,C)=>(W(),ee("div",{ref:M,class:"share-wrap","data-share-root":""},[je(Xo,{ref_key:"btnEl",ref:l,"is-dark":e.isDark,active:s.value,title:be(t)("buttons.share"),onClick:y},{default:jt(()=>[...C[2]||(C[2]=[P("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[P("path",{d:"M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7"}),P("polyline",{points:"16 6 12 2 8 6"}),P("line",{x1:"12",y1:"2",x2:"12",y2:"15"})],-1)])]),_:1},8,["is-dark","active","title"]),je(G1,{open:s.value,title:be(t)("buttons.share"),"is-dark":e.isDark,onClose:k},{default:jt(()=>[P("div",{ref_key:"popoverEl",ref:i,class:Ae(["share-pop",{light:!e.isDark}])},[P("ul",U1,[(W(!0),ee($e,null,St(be(o)("buttons.shareSteps"),(F,H)=>(W(),ee("li",{key:H},de(be(n)(F)),1))),128))]),P("div",K1,[P("button",{class:Ae(["share-tab",{active:c.value==="link"}]),onClick:C[0]||(C[0]=F=>c.value="link")},"Embed link",2),P("button",{class:Ae(["share-tab",{active:c.value==="embed"}]),onClick:C[1]||(C[1]=F=>c.value="embed")},"Add to Your Website",2)]),c.value==="link"?(W(),ee("div",z1,[P("div",H1,[P("div",V1,de(h.value),1)]),P("button",{class:Ae(["share-primary-btn",{copied:u.value}]),onClick:_},[u.value?(W(),ee("svg",Y1,[...C[4]||(C[4]=[P("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(W(),ee("svg",W1,[...C[3]||(C[3]=[P("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),P("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},null,-1)])])),dt(" "+de(u.value?"Copied!":"Copy Link"),1)],2)])):me("",!0),c.value==="embed"?(W(),ee("div",q1,[C[7]||(C[7]=P("div",{class:"share-embed-desc"}," Paste this code into your website builder (WordPress, Squarespace, Wix, or any site that accepts HTML widgets). ",-1)),P("div",J1,[(W(),ee($e,null,St(x,(F,H)=>P("button",{key:H,class:Ae(["share-size-pill",{active:g.value===H}]),onClick:G=>g.value=H},de(F.label),11,Z1)),64))]),P("div",X1,de(d.value),1),P("button",{class:Ae(["share-secondary-btn",{copied:p.value}]),onClick:m},[p.value?(W(),ee("svg",ek,[...C[6]||(C[6]=[P("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(W(),ee("svg",Q1,[...C[5]||(C[5]=[P("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),P("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},null,-1)])])),dt(" "+de(p.value?"Copied!":"Copy Code"),1)],2)])):me("",!0)],2)]),_:1},8,["open","title","is-dark"])],512))}},tk=["blocs","clusters","peopleGroups","families","languages","dialects","people","places","regions","wagfBlocks","religions"],ok={"people-groups":["blocs","clusters","peopleGroups","people","places","families","languages","dialects","regions","religions"],language:["families","languages","dialects","people","blocs","clusters","peopleGroups","places","regions","religions"],regions:["regions","wagfBlocks","places","blocs","clusters","peopleGroups","people","families","languages","dialects","religions"],religion:["religions","people","blocs","clusters","peopleGroups","places","families","languages","dialects","regions"]};function nk(e){return ok[e]||tk}const ak={blocs:3,clusters:3,peopleGroups:3,families:3,languages:3,dialects:3,people:5,places:2,regions:3,wagfBlocks:3,religions:2},ur=["peopleGroups","people","places","languages","religions"],rk={regions:[...ur,"regions","wagfBlocks"],"people-groups":[...ur,"blocs","clusters"],language:[...ur,"dialects","families"],religion:[...ur]},sk=100,ik=50,lk=25,ck=10,Zs=5,dd=20,uk=[[/ sign language$/i,"Sign Language"]];function dk(e){if(!e||typeof e!="string")return"";const t=e.indexOf(",");return t>0?e.slice(0,t).trim():e.trim()}function pk(e){if(!e||typeof e!="string")return null;const t=e.indexOf(",");return t>=0&&e.slice(t+1).trim()||null}function gk(e){if(!e||typeof e!="string")return null;const t=e.split(",").map(n=>n.trim()).filter(Boolean);if(t.length>=2){const n=[...t].reverse().join(" ");if(At[n])return At[n];if(t.length>=3){const a=[t[1],t[0]].join(" ");if(At[a])return At[a]}}if(At[e])return At[e];const o=e.replace(/\s*\(.*?\)\s*$/,"").trim();if(o!==e&&At[o])return At[o];for(const[n,a]of uk)if(n.test(e))return a;return null}function pd(e,t){return{id:`doxa-section-header-${Xs(e)}`,place_name:e,text:e,center:[0,0],place_type:["doxa-section-header"],geometry:{type:"Point",coordinates:[0,0]},properties:{headerLabel:e,isHeader:!0,isAllDataSection:!!t},feature:null}}function Xs(e){return String(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function xe(e){return e==null?"":typeof e=="string"?e.toLowerCase():typeof e=="object"&&"label"in e?String(e.label||"").toLowerCase():typeof e=="object"&&"value"in e?String(e.value||"").toLowerCase():String(e).toLowerCase()}function dr(e){return e==null?"":typeof e=="string"?e:typeof e=="object"?e.label||e.value||"":String(e)}function fk(e){var o,n,a,r,s;if(!Array.isArray(e))return[];const t=[];for(const i of e){if(!i)continue;const l=Number(i.latitude),c=Number(i.longitude);if(!Number.isFinite(l)||!Number.isFinite(c))continue;const u=xe(i.name)+" "+xe(i.displayName)+" "+xe(i.alternateName),p=xe(i.countryName)+" "+xe(i.country)+" "+xe(i.countryIso)+" "+xe(i.countryIsoLabel),g=xe(i.religionName)+" "+xe(i.religion)+" "+xe(i.religionLabel)+" "+xe(i.religionCode),x=xe(i.language)+" "+xe(i.languageFamily)+" "+xe(i.languageCode),w=xe(i.doxaRegion)+" "+xe(i.wagfRegion)+" "+xe(i.wagfBlock),h=xe(i.affinityBlock)+" "+xe(i.affinityBlockLabel)+" "+xe((o=i._raw)==null?void 0:o.rop1),d=xe(i.cluster)+" "+xe(i.clusterLabel)+" "+xe((n=i._raw)==null?void 0:n.imb_reg_of_people_2),y=xe(i.peopleGroup)+" "+xe(i.peopleGroupLabel)+" "+xe((a=i._raw)==null?void 0:a.imb_reg_of_people_25),k=((r=i._raw)==null?void 0:r.primary_language)??((s=i._raw)==null?void 0:s.PrimaryLanguage),v=k&&(typeof k=="object"?k.label||k.value:k)||dr(i.language)||dr(i.primaryLanguage)||"",_=dk(v),m=pk(v);t.push({feature:i,nameHay:u,countryHay:p,religionHay:g,languageHay:x,regionHay:w,haystack:u+" "+p+" "+g+" "+x+" "+w+" "+h+" "+d+" "+y,blocHay:h,clusterHay:d,pgHay:y,lat:l,lng:c,familyDerived:gk(v)||null,languageLabel:v,baseLang:_,dialectLabel:m})}return t}function hk(e){const t=(o,n,a)=>{const r=new Map;for(const s of e){const i=o(s);if(!i)continue;const l=r.get(i);if(l)l.count+=1,l.lngSum+=s.lng,l.latSum+=s.lat,l.memberIds.push(String(s.feature.uniqueId??s.feature.id??s.feature.slug??"")),l.minLng=Math.min(l.minLng,s.lng),l.maxLng=Math.max(l.maxLng,s.lng),l.minLat=Math.min(l.minLat,s.lat),l.maxLat=Math.max(l.maxLat,s.lat),a&&a(l,s,!1);else{const c={key:i,label:dr(n(s))||i,count:1,lngSum:s.lng,latSum:s.lat,minLng:s.lng,maxLng:s.lng,minLat:s.lat,maxLat:s.lat,memberIds:[String(s.feature.uniqueId??s.feature.id??s.feature.slug??"")]};a&&a(c,s,!0),r.set(i,c)}}for(const s of r.values())s.lng=s.lngSum/s.count,s.lat=s.latSum/s.count;return Array.from(r.values())};return{countries:t(o=>xe(o.feature.countryName)||xe(o.feature.country)||xe(o.feature.countryIso),o=>o.feature.countryName||o.feature.country||o.feature.countryIso||""),families:t(o=>xe(o.familyDerived),o=>o.familyDerived||""),languages:t(o=>xe(o.baseLang),o=>o.baseLang||""),dialects:t(o=>o.dialectLabel?`${xe(o.baseLang)}__${xe(o.dialectLabel)}`:"",o=>`${o.baseLang}, ${o.dialectLabel}`,(o,n,a)=>{a?(o.originalLabels=new Set([n.languageLabel]),o.familyDerived=n.familyDerived||"",o.baseLang=n.baseLang||"",o.dialectLabel=n.dialectLabel||""):(o.originalLabels.add(n.languageLabel),!o.familyDerived&&n.familyDerived&&(o.familyDerived=n.familyDerived))}),religions:t(o=>{var n,a,r;return sa(o.feature.religion||((a=(n=o.feature._raw)==null?void 0:n.religion)==null?void 0:a.value)||((r=o.feature._raw)==null?void 0:r.religion)||"")},o=>{var n,a,r;return ra[sa(o.feature.religion||((a=(n=o.feature._raw)==null?void 0:n.religion)==null?void 0:a.value)||((r=o.feature._raw)==null?void 0:r.religion)||"")]||"Unknown"}),regions:t(o=>xe(o.feature.doxaRegion)||xe(o.feature.wagfRegion),o=>{var n,a;return o.feature.wagfRegionLabel||o.feature.doxaRegionLabel||((a=(n=o.feature._raw)==null?void 0:n.wagf_region)==null?void 0:a.label)||o.feature.doxaRegion||o.feature.wagfRegion||""}),wagfBlocks:t(o=>xe(o.feature.wagfBlock),o=>{var n,a;return o.feature.wagfBlockLabel||((a=(n=o.feature._raw)==null?void 0:n.wagf_block)==null?void 0:a.label)||o.feature.wagfBlock||""}),blocs:t(o=>xe(o.feature.affinityBlockLabel)||xe(o.feature.affinityBlock),o=>o.feature.affinityBlockLabel||o.feature.affinityBlock||"",(o,n,a)=>{a&&(o.blocCode=n.feature.affinityBlock||"")}),clusters:t(o=>{const n=o.feature.affinityBlock||"",a=o.feature.cluster||"";return a?`${n}__${a}`:""},o=>o.feature.clusterLabel||o.feature.cluster||"",(o,n,a)=>{a&&(o.blocCode=n.feature.affinityBlock||"",o.blocLabel=n.feature.affinityBlockLabel||"",o.clusterCode=n.feature.cluster||"")}),peopleGroups:t(o=>xe(o.feature.peopleGroup)||xe(o.feature.peopleGroupLabel),o=>o.feature.peopleGroupLabel||o.feature.peopleGroup||o.feature.name||"",(o,n,a)=>{a&&(o.blocCode=n.feature.affinityBlock||"",o.blocLabel=n.feature.affinityBlockLabel||"",o.clusterCode=n.feature.cluster||"",o.clusterLabel=n.feature.clusterLabel||"",o.peopleGroupCode=n.feature.peopleGroup||"")})}}function mk(e){const t=e.feature,o=t.name||t.displayName||t.slug||"Unknown",n=t.countryName||t.country||t.countryIso||"",a=t.religionName||t.religion||"",r=t.slug||t.uniqueId||Xs(o+"-"+n),s=[e.lng,e.lat],i=[n,a].filter(Boolean).join(" — "),l=i?`${o}, ${i}`:o;return{id:`doxa-pg-${r}`,place_name:l,text:o,center:s,place_type:["people-group"],geometry:{type:"Point",coordinates:s},properties:{slug:r,...t},feature:t}}function io(e,t){let o,n;switch(e){case"country":o="doxa-country",n="doxa-country-";break;case"region":o="doxa-region",n="doxa-region-";break;case"language-family":o="doxa-language-family",n="doxa-language-family-";break;case"language":o="doxa-language",n="doxa-language-";break;case"dialect":o="doxa-dialect",n="doxa-dialect-";break;case"religion":o="doxa-religion",n="doxa-religion-";break;case"affinity-bloc":o="doxa-affinity-bloc",n="doxa-affinity-bloc-";break;case"cluster":o="doxa-cluster",n="doxa-cluster-";break;case"people-group":o="doxa-people-group",n="doxa-people-group-";break;default:o="doxa",n="doxa-"}const a=dr(t.label)||t.key,r=Xs(t.key),s=[t.lng,t.lat],l={"affinity-bloc":"Affinity Block",cluster:"Cluster","people-group":"PG","pg-in-country":"PGIC"}[e],c=l?`${a} (${l}) · ${t.count}`:`${a} (${t.count})`,u=t.originalLabels?Array.from(t.originalLabels):void 0,p=e==="dialect"?{familyDerived:t.familyDerived||"",baseLang:t.baseLang||"",dialectLabel:t.dialectLabel||""}:null;return{id:`${n}${r}`,place_name:c,text:a,center:s,bbox:[t.minLng,t.minLat,t.maxLng,t.maxLat],place_type:[o],geometry:{type:"Point",coordinates:s},properties:{slug:r,doxaAggregate:e,count:t.count,label:a,memberIds:t.memberIds,bounds:[t.minLng,t.minLat,t.maxLng,t.maxLat],...u?{originalLabels:u}:{},...p||{},...e==="affinity-bloc"?{blocCode:t.blocCode||""}:{},...e==="cluster"?{blocCode:t.blocCode||"",blocLabel:t.blocLabel||"",clusterCode:t.clusterCode||""}:{},...e==="people-group"?{blocCode:t.blocCode||"",blocLabel:t.blocLabel||"",clusterCode:t.clusterCode||"",clusterLabel:t.clusterLabel||"",peopleGroupCode:t.peopleGroupCode||""}:{}},feature:null}}function bk(e={}){const{dataStore:t,dataSourceId:o,getActiveFilter:n,getActiveContext:a}=e,{t:r}=kt(),s=Q(()=>{var p,g;if(!t||!t.sources)return[];if(o&&((p=t.sources[o])!=null&&p.features))return t.sources[o].features;for(const x of Object.keys(t.sources)){const w=t.sources[x];if((g=w==null?void 0:w.features)!=null&&g.length)return w.features}return[]}),i=Q(()=>fk(s.value)),l=Q(()=>hk(i.value));function c(p){const g=String(p||"").trim().toLowerCase(),x={people:[],places:[],regions:[],wagfBlocks:[],families:[],languages:[],dialects:[],religions:[],blocs:[],clusters:[],peopleGroups:[]};if(g.length<2)return x;const w=g.split(/[\s,;]+/).filter(Boolean);if(!w.length)return x;const h=i.value;if(!h.length)return x;const d=l.value,y=[];for(const B of h){let T=!0;for(const ye of w)if(!B.haystack.includes(ye)){T=!1;break}if(!T)continue;let se=0;w.some(ye=>B.nameHay.includes(ye))&&(se+=sk),w.some(ye=>B.countryHay.includes(ye))&&(se+=ik),w.some(ye=>B.religionHay.includes(ye))&&(se+=lk),w.some(ye=>B.languageHay.includes(ye))&&(se+=ck),y.push({entry:B,score:se})}y.sort((B,T)=>T.score-B.score);const k=y.slice(0,Zs).map(B=>mk(B.entry)),v=B=>B.filter(T=>w.every(se=>T.key.includes(se)||xe(T.label).includes(se))).sort((T,se)=>se.count-T.count).slice(0,Zs),_=v(d.countries).map(B=>io("country",B)),m=v(d.regions).map(B=>io("region",B)),$=v(d.wagfBlocks).map(B=>io("region",B)),L=v(d.families).map(B=>io("language-family",B)),R=v(d.languages).map(B=>io("language",B)),M=v(d.dialects).map(B=>io("dialect",B)),I=v(d.religions).map(B=>io("religion",B)),C=v(d.blocs).map(B=>io("affinity-bloc",B));let F=v(d.clusters).map(B=>io("cluster",B)),H=v(d.peopleGroups).map(B=>io("people-group",B));const G=new Set(C.map(B=>xe(B.text)));F=F.filter(B=>!G.has(xe(B.text)));const U=new Set(F.map(B=>xe(B.text)));return H=H.filter(B=>!G.has(xe(B.text))&&!U.has(xe(B.text))),{people:k,places:_,regions:m,wagfBlocks:$,families:L,languages:R,dialects:M,religions:I,blocs:C,clusters:F,peopleGroups:H}}function u(p){const g=typeof n=="function"?n():null,x=typeof a=="function"?a():null,w=c(p),h=nk(x),d=rk[x],y=d?Object.fromEntries(d.filter(L=>w[L]).map(L=>[L,w[L]])):w,k=h.flatMap(L=>y[L]||[]);if(!(g!=null&&g.key)||!k.length)return k.slice(0,dd);const v=[];for(const L of w.people){const R=i.value.find(I=>I.feature===L.feature);let M=!1;R&&(g.kind==="family"?M=(R.familyDerived||"").toLowerCase()===g.key.toLowerCase():g.kind==="language"&&(M=R.languageLabel.toLowerCase()===g.key.toLowerCase())),M&&v.push(L)}const _=[],m=g.key;v.length&&(_.push(pd(r("search.sections.within",{selection:m}),!1)),_.push(...v.slice(0,Zs)));const $=h.flatMap(L=>(y[L]||[]).slice(0,ak[L]??3)).map(L=>({...L,properties:{...L.properties,_allDataSection:!0}}));return _.push(pd(r("search.sections.allData"),!0)),_.push(...$),_.slice(0,dd+8)}return{search:u,searchGrouped:c,index:i,aggregates:l}}const gd="https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-geocoder@1/dist/maplibre-gl-geocoder.min.js",yk={__name:"GeocoderComponent",props:{mapInstance:{type:Object,required:!1,default:null},accessToken:{type:String,required:!0},provider:{type:String,default:"mapbox"},isDark:{type:Boolean,default:!1},standalone:{type:Boolean,default:!1},placeholder:{type:String,default:""},dataSourceId:{type:String,default:""},activeContext:{type:String,default:""}},emits:["result","people-group-result","aggregate-result","clear","error"],setup(e,{expose:t,emit:o}){function n(C){return C+C.replace(/mapboxgl/g,"maplibregl")}wt(n('.mapboxgl-ctrl-geocoder--input,.mapboxgl-ctrl-geocoder input[type="text"],.mapboxgl-ctrl-geocoder input[type="search"]{font-size:16px !important;line-height:1.3;}'),"geocoder-ios-zoom-fix"),wt(n(".mapboxgl-ctrl-geocoder--icon-loading{display:none !important;}"),"geocoder-hide-loading"),wt(n(".mapboxgl-ctrl-geocoder{height:35px!important;min-height:35px!important;box-sizing:border-box!important;}.mapboxgl-ctrl-geocoder--input{height:35px!important;min-height:35px!important;box-sizing:border-box!important;padding-top:0!important;padding-bottom:0!important;line-height:35px!important;}.mapboxgl-ctrl-geocoder--icon-search{top:50%!important;transform:translateY(-50%)!important;margin-top:0!important;left:7px!important;}"),"geocoder-height-35"),wt(n(".mapboxgl-ctrl-geocoder{width:100%!important;max-width:100%!important;min-width:0!important;}@media(max-width:767px){.dg-search-band{top:0!important;left:0!important;right:0!important;width:100%!important;max-width:none!important;margin:0!important;box-sizing:border-box!important;padding:9px 14px!important;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,0.10);}.dg-search-band--dark{background:#3b463d;box-shadow:0 1px 4px rgba(0,0,0,0.35);}.dg-search-band .mapboxgl-ctrl,.dg-search-band .maplibregl-ctrl{margin:0!important;float:none!important;}}.mapboxgl-ctrl-geocoder{border-radius:999px!important;background:#fff;box-shadow:0 2px 8px rgba(0,0,0,0.15)!important;transition:box-shadow .12s,border-color .12s;}.mapboxgl-ctrl-geocoder:focus-within{box-shadow:0 2px 8px rgba(0,0,0,0.15),0 0 0 3px rgba(59,70,61,0.18)!important;}.mapboxgl-ctrl-geocoder--input{border-radius:999px!important;font-size:13px!important;}.mapboxgl-ctrl-geocoder--input::placeholder{font-size:12px!important;}.mapboxgl-ctrl-geocoder--button{display:none!important;top:50%!important;bottom:auto!important;transform:translateY(-50%)!important;margin:0!important;padding:0!important;width:24px!important;height:24px!important;background:transparent!important;border:none!important;box-shadow:none!important;}.mapboxgl-ctrl-geocoder:has(.mapboxgl-ctrl-geocoder--input:not(:placeholder-shown)) .mapboxgl-ctrl-geocoder--button{display:block!important;}.mapboxgl-ctrl-geocoder--button .mapboxgl-ctrl-geocoder--icon-close{position:absolute!important;top:50%!important;left:50%!important;transform:translate(-50%,-50%)!important;margin:0!important;width:16px!important;height:16px!important;}.mapboxgl-ctrl-geocoder--suggestions,.mapboxgl-ctrl-geocoder .suggestions{z-index:1200!important;position:absolute;max-height:60vh!important;overflow-y:auto!important;}.geocoder-dark.mapboxgl-ctrl-geocoder,.dsm-dark .mapboxgl-ctrl-geocoder{background:#4e594f!important;border:1px solid rgba(255,255,255,0.14)!important;box-shadow:0 2px 8px rgba(0,0,0,0.4)!important;}.geocoder-dark.mapboxgl-ctrl-geocoder:focus-within,.dsm-dark .mapboxgl-ctrl-geocoder:focus-within{box-shadow:0 2px 8px rgba(0,0,0,0.4),0 0 0 3px rgba(115,161,127,0.22)!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--input,.dsm-dark .mapboxgl-ctrl-geocoder--input{color:#F3F3F1!important;background:transparent!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--input::placeholder,.dsm-dark .mapboxgl-ctrl-geocoder--input::placeholder{color:rgba(243,243,241,0.65)!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--icon,.dsm-dark .mapboxgl-ctrl-geocoder .mapboxgl-ctrl-geocoder--icon{fill:rgba(243,243,241,0.75)!important;}.geocoder-dark .mapboxgl-ctrl-geocoder--button,.dsm-dark .mapboxgl-ctrl-geocoder--button{background:transparent!important;}"),"geocoder-skin");const{t:a,locale:r}=kt(),s=e,i=Q(()=>s.placeholder||a("search.placeholder")),l=o,c={"&":"&","<":"<",">":">",'"':""","'":"'"};function u(C){return String(C??"").replace(/[&<>"']/g,F=>c[F])}function p(C){return C==null?"":typeof C=="string"?C:typeof C=="object"?C.label||C.value||"":String(C)}const g={"people-group":"people","doxa-people-group":"peopleGroup","doxa-affinity-bloc":"bloc","doxa-cluster":"cluster","doxa-country":"country","doxa-region":"region","doxa-language-family":"family","doxa-language":"languageKind","doxa-dialect":"dialect","doxa-religion":"religionKind"};function x(C){const F=g[C];if(!F)return"";const H=a("search.kinds."+F);return`${u(H)}`}function w(C){var G;if(!C)return"";const F=C.place_type||[];if(F.includes("doxa-section-header"))return``;if(F.includes("people-group")){const U=C.properties||{},B=p(U.name)||p(U.displayName)||p(C.text)||"",T=p(U.countryName)||p(U.country)||p(U.countryIso)||"",se=p(U.language)||p(U.primaryLanguage)||p(U.languageFamily)||"",ye=p(U.religionName)||p(U.religion)||"",ae=a("search.labels.place"),oe=a("search.labels.language"),fe=a("search.labels.religion"),Pe=[];return T&&Pe.push(`${u(ae)} ${u(T)}`),se&&Pe.push(`${u(oe)} ${u(se)}`),ye&&Pe.push(`${u(fe)} ${u(ye)}`),`${x("people-group")}${u(B)}
`+(Pe.length?`${Pe.join("")}
`:"")}const H=F.find(U=>U.startsWith("doxa-"));if(H){const U=C.properties||{},B=u(p(U.label)||C.text||""),T=Number(U.count)||0,se=T?` ${T}`:"";return`${x(H)}${B}${se}
`}return`${u(C.place_name||C.text||"")}
`}const h=Ee("dataStore",null),d=Ee("mapStore",null),y=Ee("uiStore",null);function k(){return d?d.selectedFamily?{kind:"family",key:d.selectedFamily}:d.selectedLanguage?{kind:"language",key:d.selectedLanguage}:null:null}const{search:v}=bk({dataStore:h,dataSourceId:s.dataSourceId||void 0,getActiveFilter:k,getActiveContext:()=>s.activeContext||null}),_=an(null),m=ue(null),$={mapbox:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v5.0.0/mapbox-gl-geocoder.css",maplibre:"https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-geocoder@1/dist/maplibre-gl-geocoder.css"};function L(C,F){const H=$[F]||$.mapbox;if(C.querySelector(`link[href="${H}"]`))return;const G=document.createElement("link");G.rel="stylesheet",G.href=H,C.prepend(G)}async function R(){if(typeof window<"u"&&window.MaplibreGeocoder||typeof document>"u")return;const C=document.querySelector(`script[src="${gd}"]`);if(C){if(window.MaplibreGeocoder)return;await new Promise(F=>{C.addEventListener("load",F,{once:!0}),C.addEventListener("error",F,{once:!0})});return}await new Promise((F,H)=>{const G=document.createElement("script");G.src=gd,G.async=!1,G.addEventListener("load",F,{once:!0}),G.addEventListener("error",()=>H(new Error("[GeocoderComponent] Failed to load MapLibre geocoder")),{once:!0}),document.head.appendChild(G)})}function M(C,F){return async H=>{const G={features:[]};if(!C||!(H!=null&&H.query))return G;try{const U=Array.isArray(H.language)?H.language[0]:H.language||F()||"en",B=new URLSearchParams({access_token:C,autocomplete:"true",limit:String(H.limit||5)});U&&B.set("language",U);const T=`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(H.query)}.json?${B.toString()}`,se=await fetch(T);if(!se.ok)return G;const ye=await se.json();return ye&&Array.isArray(ye.features)?ye:G}catch{return G}}}to(async()=>{var U,B,T,se,ye;const C=s.provider==="maplibre";if(C){if(await R(),typeof MaplibreGeocoder>"u"){console.error("[GeocoderComponent] MaplibreGeocoder global unavailable.");return}}else if(typeof MapboxGeocoder>"u")return;const F=s.mapInstance;if(!s.standalone&&!F)return;const H=s.standalone?(B=(U=m.value)==null?void 0:U.getRootNode)==null?void 0:B.call(U):(ye=(se=(T=F.getContainer)==null?void 0:T.call(F))==null?void 0:se.getRootNode)==null?void 0:ye.call(se);H instanceof ShadowRoot&&L(H,s.provider);const G={marker:!1,flyTo:!s.standalone,trackProximity:!s.standalone,placeholder:i.value,language:r.value||"en",localGeocoder:v,limit:20,zoom:6,render:w};if(C){const ae=typeof maplibregl<"u"?maplibregl:void 0,oe={forwardGeocode:M(s.accessToken,()=>r.value)};_.value=new MaplibreGeocoder(oe,{...G,maplibregl:ae,showResultsWhileTyping:!0,reverseGeocode:!1})}else _.value=new MapboxGeocoder({accessToken:s.accessToken,mapboxgl,...G});if(_.value.on("result",ae=>{var fe,Pe,We,Xe,Qe,ht,Ke,it,Ye,$t,A,N,E,K,Y,Z,X,q,f,b,D,V,ie,re,j,S,O,ne,ce,ge;const oe=ae==null?void 0:ae.result;oe&&((fe=oe.place_type)!=null&&fe.includes("doxa-section-header")||(d&&(d.selectedRegion=null,d.selectedResource=null,d.selectedAffinityBlock=null,d.selectedDialect=null),y&&((Pe=y.setPrayerFilter)==null||Pe.call(y,null),(We=y.setEngagementFilter)==null||We.call(y,null),(Xe=y.setAdoptionFilter)==null||Xe.call(y,null),(Qe=y.setReligionFilter)==null||Qe.call(y,null)),(ht=oe.properties)!=null&&ht._allDataSection&&d&&(d.selectedFamily=null,d.selectedLanguage=null),l("result",ae),(Ke=oe.place_type)!=null&&Ke.includes("people-group")&&oe.feature?l("people-group-result",{type:"Feature",properties:oe.properties||oe.feature,geometry:oe.geometry||{type:"Point",coordinates:oe.center}}):((it=oe.place_type)!=null&&it.includes("doxa-country")||(Ye=oe.place_type)!=null&&Ye.includes("doxa-region")||($t=oe.place_type)!=null&&$t.includes("doxa-language-family")||(A=oe.place_type)!=null&&A.includes("doxa-language")||(N=oe.place_type)!=null&&N.includes("doxa-dialect")||(E=oe.place_type)!=null&&E.includes("doxa-religion")||(K=oe.place_type)!=null&&K.includes("doxa-affinity-bloc")||(Y=oe.place_type)!=null&&Y.includes("doxa-cluster")||(Z=oe.place_type)!=null&&Z.includes("doxa-people-group"))&&l("aggregate-result",{kind:oe.place_type[0].replace(/^doxa-/,""),label:((X=oe.properties)==null?void 0:X.label)||oe.text,count:((q=oe.properties)==null?void 0:q.count)||0,memberIds:((f=oe.properties)==null?void 0:f.memberIds)||[],bounds:((b=oe.properties)==null?void 0:b.bounds)||null,center:oe.center,originalLabels:((D=oe.properties)==null?void 0:D.originalLabels)||null,familyDerived:((V=oe.properties)==null?void 0:V.familyDerived)||"",baseLang:((ie=oe.properties)==null?void 0:ie.baseLang)||"",dialectLabel:((re=oe.properties)==null?void 0:re.dialectLabel)||"",slug:((j=oe.properties)==null?void 0:j.slug)||null,id:oe.id||null,blocCode:((S=oe.properties)==null?void 0:S.blocCode)||"",blocLabel:((O=oe.properties)==null?void 0:O.blocLabel)||"",clusterCode:((ne=oe.properties)==null?void 0:ne.clusterCode)||"",clusterLabel:((ce=oe.properties)==null?void 0:ce.clusterLabel)||"",peopleGroupCode:((ge=oe.properties)==null?void 0:ge.peopleGroupCode)||"",properties:oe.properties||null})))}),_.value.on("clear",()=>l("clear")),_.value.on("error",ae=>l("error",ae)),s.standalone){if(m.value){const ae={on(){},off(){},fire(){},getContainer:()=>m.value,getZoom:()=>0,getCenter:()=>({lng:0,lat:0}),getBounds:()=>null,flyTo(){},fitBounds(){},addControl(){},removeControl(){},hasControl:()=>!1};try{const oe=_.value.onAdd(s.mapInstance||ae);oe&&m.value.appendChild(oe)}catch(oe){l("error",oe)}}}else F.addControl(_.value,"top-left"),I()});function I(){var F,H;const C=(H=(F=_.value)==null?void 0:F.container)==null?void 0:H.parentElement;C&&(C.classList.add("dg-search-band"),C.classList.toggle("dg-search-band--dark",!!s.isDark))}return nt(()=>s.isDark,()=>I()),nt(i,C=>{var G,U;const F=_.value;if(!F)return;const H=F._inputEl||((U=(G=F.container)==null?void 0:G.querySelector)==null?void 0:U.call(G,"input.mapboxgl-ctrl-geocoder--input"));H&&(H.placeholder=C,H.setAttribute("placeholder",C)),F.options&&(F.options.placeholder=C)}),nt(r,C=>{const F=_.value;F!=null&&F.options&&(F.options.language=C||"en")}),yo(()=>{var C,F;if(_.value){try{s.standalone?(F=(C=_.value).onRemove)==null||F.call(C):s.mapInstance&&s.mapInstance.removeControl(_.value)}catch{}_.value=null}}),t({geocoder:_}),(C,F)=>e.standalone?(W(),ee("div",{key:0,ref_key:"standaloneContainer",ref:m,class:"dg-standalone-geocoder"},null,512)):un(C.$slots,"default",{},void 0,void 0,1)}};function _k(e,t){return`hsl(${Math.round(e*360/(t||1))}, 72%, 56%)`}function pr(e){if(typeof e.count=="number")return e.count;if(typeof e.expected_count=="number")return e.expected_count}function fd(e){const t=parseInt(e&&e.population,10);return Number.isFinite(t)?t:0}function vk(e,t){if(!Array.isArray(t)||t.length===0)return;const o=e&&e.selector;if(o==null)return;if(o.type==="pg_slugs"){const r=new Set(Array.isArray(o.values)?o.values:[]);let s=0;for(const i of t)i&&r.has(i.slug)&&(s+=fd(i));return s}const n=wn(o,t);let a=0;for(const r of t)r&&n.has(r.slug)&&(a+=fd(r));return a}function Qs(e,t={}){const o=t.deafCount??123,n=Array.isArray(t.records)?t.records:null,a=e.lists||[],r=e.asia_lists||[],s=e.uncovered_lists||[],i={type:"affinity_bloc",rop1:"A017"},l=r.filter(G=>G.id.startsWith("asia-india")),c=r.filter(G=>G.id.startsWith("asia-china")),u=[...a.map(G=>G.id),"deaf",...l.map(G=>G.id),...c.map(G=>G.id),...s.map(G=>G.id)],p=u.length,g=G=>_k(u.indexOf(G),p),x=(G,U,B)=>{if(!n)return G;const T=B??(U&&U.selector);return G.pop=vk({selector:T},n),G},w=G=>n?G.reduce((U,B)=>U+(B.pop||0),0):void 0,h=a.map(G=>x({id:G.id,zoneKey:G.id,label:G.label,...G.provinceLabel?{provinceLabel:G.provinceLabel}:{},color:g(G.id),count:pr(G)},G)),d=x({id:"deaf",zoneKey:"deaf",label:"Deaf (affinity bloc A017)",color:g("deaf"),count:o,info:"Unified deaf row — affinity bloc rop1=A017 (collapses the two deaf_lists; zero-delta vs old deaf_predicate). Population double-counts vs geographic rows (design-approved, slice 08)."},null,i),y=G=>x({id:G.id,zoneKey:G.id,label:G.label,...G.provinceLabel?{provinceLabel:G.provinceLabel}:{},color:g(G.id),count:pr(G),...Array.isArray(G.adm0)&&G.adm0.length?{adm0:G.adm0}:{},...Array.isArray(G.provinces)&&G.provinces.length?{provinces:G.provinces}:{}},G),k=l.map(y),v=c.map(y),_=G=>G.reduce((U,B)=>U+(pr(B)||0),0),m={id:"asia-india",label:"India",count:_(l),children:k},$={id:"asia-china",label:"China",count:_(c),children:v};n&&(m.pop=w(k),$.pop=w(v)),_(r),n&&w([m,$]);const L=G=>x({id:G.id,zoneKey:G.id,label:G.label,...G.provinceLabel?{provinceLabel:G.provinceLabel}:{},color:g(G.id),count:pr(G)},G),R=s.map(L);R.length>0&&(()=>{const G={id:"frontier-asia",label:"Frontier Asia (uncovered)",count:_(s),children:R};return n&&(G.pop=w(R)),G})();const M={"west-africa":"Africa",sudan:"Africa","east-africa":"Africa","central-africa":"Africa","southern-africa-islands":"Africa","maghreb-egypt":"Middle East","middle-east-core":"Middle East","uncovered-nas-a":"Central Asia",laos:"Southeast Asia + Oceania","oceania-indonesia":"Southeast Asia + Oceania","mainland-se-asia-philippines":"Southeast Asia + Oceania",brazil:"Americas","andean-caribbean":"Americas","uncovered-scatter":"Americas",europe:"Europe",deaf:"Deaf","deaf-old-world":"Deaf"},I=G=>M[G]||(String(G).startsWith("asia-india-")?"India":String(G).startsWith("asia-china-")?"China + Mongolia":"Other"),C=[...h,d,...k,...v,...R].filter(Boolean),F=new Map;for(const G of C){const U=I(G.id||G.zoneKey);F.has(U)||F.set(U,[]),F.get(U).push(G)}const H=[...F.entries()].map(([G,U])=>{U.sort((T,se)=>(se.count||0)-(T.count||0));const B={id:"region-"+G.toLowerCase().replace(/[^a-z0-9]+/g,"-"),label:G,count:U.reduce((T,se)=>T+(se.count||0),0),children:U};return n&&(B.pop=w(U)),B}).sort((G,U)=>(U.count||0)-(G.count||0));return kk(hd(H),{withPop:!!n}),H}function kk(e,{withPop:t=!1}={}){const o=[];for(const n of e||[]){const a=[];(typeof n.id!="string"||!n.id)&&a.push("id"),(typeof n.zoneKey!="string"||!n.zoneKey)&&a.push("zoneKey"),(typeof n.label!="string"||!n.label)&&a.push("label"),(typeof n.color!="string"||!n.color)&&a.push("color"),typeof n.count!="number"&&a.push("count"),t&&typeof n.pop!="number"&&a.push("pop"),a.length&&o.push(`${n.id||"(no-id)"}: missing/!type [${a.join(", ")}]`)}if(o.length)throw new Error(`legend-tree L15: ${o.length} leaf node(s) violate the uniform consumer shape:
`+o.join(`
`));return!0}function hd(e){const t=[],o=n=>{for(const a of n)a.children&&a.children.length?o(a.children):t.push(a)};return o(e||[]),t}const md=()=>({type:"FeatureCollection",features:[]});function wk(e,t){const o=wn(e.selector,t),n=new Set;for(const a of t)a&&o.has(a.slug)&&a.country_code&&n.add(a.country_code);return n}function xk(e){return typeof e.id=="string"&&e.id.startsWith("asia-")}function ei(e,t){return{type:"Feature",properties:{...e.properties||{},zoneKey:t.zoneKey??t.id,zoneColor:t.color??t.zoneColor??"#888",zoneLabel:t.label,...t.id==="deaf"?{hatch:!0}:{}},geometry:e.geometry}}function Sk(e,t){const{records:o=[],adm0:n,adm1Ind:a,adm1Chn:r}=t||{},s=md();if(xk(e)){const l=[a,r].filter(Boolean);for(const c of l)for(const u of c.features||[])u.properties&&u.properties.listId===e.id&&s.features.push(ei(u,e));if(Array.isArray(e.adm0)&&e.adm0.length&&n){const c=new Set(e.adm0);for(const u of n.features||[])u.properties&&c.has(u.properties.iso3)&&s.features.push(ei(u,e))}return s}if(!e.selector)return s;const i=wk(e,o);if(n&&i.size)for(const l of n.features||[])l.properties&&i.has(l.properties.iso3)&&s.features.push(ei(l,e));return s}function Ak(e,t){const o=md(),n=new Map;for(const a of e){if(a.id==="deaf"){n.set(a.zoneKey??a.id,0);continue}const r=Sk(a,t);n.set(a.zoneKey??a.id,r.features.length);for(const s of r.features)o.features.push(s)}return{tapestry:o,perZone:n}}const $k={"andean-caribbean":"#f9a51f","asia-china-tibet-autonomous-region":"#00f0c8","asia-china-yunnan-province":"#22ddff","asia-frontier-nas-a":"#ff1744","asia-india-andhra-pradesh":"#22ddff","asia-india-assam":"#22ddff","asia-india-chhattisgarh":"#536dfe","asia-india-gujarat":"#536dfe","asia-india-karnataka":"#536dfe","asia-india-kerala":"#2196ff","asia-india-madhya-pradesh":"#2196ff","asia-india-maharashtra":"#2196ff","asia-india-odisha":"#2196ff","asia-india-rajasthan":"#22ddff","asia-india-tamil-nadu":"#7c4dff","asia-india-uttarakhand":"#536dfe","asia-india-west-bengal":"#22ddff",brazil:"#f4c57b","central-africa":"#c20001",deaf:"#18ffff","east-africa":"#ef3410",europe:"#34cb74",laos:"#7c4dff","maghreb-egypt":"#602f74","mainland-se-asia-philippines":"#ff1744","middle-east-core":"#bc8bd0","oceania-indonesia":"#ee892f","southern-africa-islands":"#e75556",sudan:"#e69e93","uncovered-central-asia":"#ff8a00","uncovered-himalaya":"#ff6d00","uncovered-japan":"#ffc400","uncovered-mongolia":"#76ff03","uncovered-nas-a":"#ff1744","uncovered-nepal":"#ffea00","uncovered-sa-west":"#ff1744","uncovered-scatter":"#eeff41","west-africa":"#edcac9"};function Lk(e,t){const o=$k[e];return typeof o=="string"&&o?o:t}const gr={"Andaman and Nicobar Islands":9,"Andhra Pradesh":81,"Arunāchal Pradesh":7,Assam:15,Bihār:18,Chandīgarh:1,Chhattīsgarh:24,Delhi:1,"Dādra and Nagar Haveli and Damān and Diu":1,Goa:5,Gujarāt:90,Haryāna:4,"Himāchal Pradesh":20,"Jammu and Kashmīr":33,Jhārkhand:9,Karnātaka:81,Kerala:72,Ladākh:6,Lakshadweep:1,"Madhya Pradesh":33,Mahārāshtra:54,Manipur:5,Meghālaya:2,Odisha:64,Puducherry:5,Punjab:4,Rājasthān:48,Sikkim:1,"Tamil Nādu":64,Telangāna:26,Tripura:11,"Uttar Pradesh":23,Uttarākhand:7,"West Bengal":30,"Gansu Province":3,"Guangxi Zhuang Autonomous Region":6,"Guizhou Province":34,"Hainan Province":3,"Heilongjiang Province":2,"Hunan Province":5,"Inner Mongolia Autonomous Region":3,"Qinghai Province":3,"Sichuan Province":12,"Tibet Autonomous Region":13,"Xinjiang Uyghur Autonomous Region":7,"Yunnan Province":61},bd={ABW:1,AFG:21,AGO:10,ALB:1,AND:1,ARE:2,ARM:1,ASM:1,ATG:1,AZE:3,BEN:9,BFA:8,BGD:3,BGR:1,BHR:2,BHS:1,BIH:1,BLM:1,BLR:1,BMU:1,BOL:1,BRA:103,BRB:1,BRN:5,BTN:13,CAF:1,CHN:154,CIV:2,CMR:8,COD:9,COG:2,COK:1,COL:27,COM:3,CUB:1,CUW:1,CYM:1,CYP:1,CZE:1,DJI:1,DMA:1,DZA:17,ECU:1,EGY:3,ERI:8,ESP:1,ETH:29,FIN:1,FJI:1,FRO:1,FSM:1,GAB:2,GEO:1,GGY:1,GHA:1,GIN:13,GLP:1,GMB:3,GNB:3,GNQ:1,GRC:1,GRD:1,GUF:2,GUM:1,GUY:1,IDN:36,IRN:20,IRQ:8,ISL:1,ISR:4,JAM:1,JOR:3,JPN:6,KAZ:1,KEN:5,KGZ:2,KHM:1,KIR:1,KWT:1,LAO:95,LBN:4,LBR:2,LBY:15,LCA:1,LIE:1,LKA:1,LUX:1,MAR:4,MDV:1,MHL:1,MLI:13,MLT:1,MMR:7,MNE:1,MNG:1,MNP:1,MOZ:4,MRT:3,MSR:1,MUS:1,MWI:1,MYS:12,MYT:1,NAM:6,NCL:1,NER:2,NGA:38,NIU:1,NPL:34,NZL:1,OMN:7,PAK:24,PAN:1,PER:10,PHL:1,PLW:1,PNG:1,PRK:1,PRY:1,PSE:4,PYF:1,QAT:3,RUS:21,SAU:3,SDN:105,SEN:1,SHN:1,SLB:1,SLE:2,SMR:1,SOM:9,SSD:22,STP:1,SUR:2,SWE:2,SWZ:1,SYR:5,TCA:1,TCD:53,TGO:6,THA:8,TJK:3,TON:1,TUN:2,TUR:3,TZA:16,UGA:6,USA:3,UZB:1,VCT:1,VEN:6,VGB:1,VIR:1,VNM:16,VUT:1,WLF:1,WSM:1,YEM:9,ZAF:2,ZMB:6,ZWE:3},ia={ABW:"Aruba",IND:"India",AFG:"Afghanistan",AGO:"Angola",ALB:"Albania",AND:"Andorra",ARE:"United Arab Emirates",ARM:"Armenia",ASM:"American Samoa",ATG:"Antigua and Barbuda",AZE:"Azerbaijan",BEN:"Benin",BFA:"Burkina Faso",BGD:"Bangladesh",BGR:"Bulgaria",BHR:"Bahrain",BHS:"Bahamas",BIH:"Bosnia and Herzegovina",BLM:"Saint Barthélemy",BLR:"Belarus",BMU:"Bermuda",BOL:"Bolivia",BRA:"Brazil",BRB:"Barbados",BRN:"Brunei",BTN:"Bhutan",CAF:"Central African Republic",CHN:"China",CIV:"Côte d'Ivoire",CMR:"Cameroon",COD:"DR Congo",COG:"Congo",COK:"Cook Islands",COL:"Colombia",COM:"Comoros",CUB:"Cuba",CUW:"Curaçao",CYM:"Cayman Islands",CYP:"Cyprus",CZE:"Czechia",DJI:"Djibouti",DMA:"Dominica",DZA:"Algeria",ECU:"Ecuador",EGY:"Egypt",ERI:"Eritrea",ESP:"Spain",ETH:"Ethiopia",FIN:"Finland",FJI:"Fiji",FRO:"Faroe Islands",FSM:"Micronesia",GAB:"Gabon",GEO:"Georgia",GGY:"Guernsey",GHA:"Ghana",GIN:"Guinea",GLP:"Guadeloupe",GMB:"Gambia",GNB:"Guinea-Bissau",GNQ:"Equatorial Guinea",GRC:"Greece",GRD:"Grenada",GUF:"French Guiana",GUM:"Guam",GUY:"Guyana",IDN:"Indonesia",IRN:"Iran",IRQ:"Iraq",ISL:"Iceland",ISR:"Israel",JAM:"Jamaica",JOR:"Jordan",JPN:"Japan",KAZ:"Kazakhstan",KEN:"Kenya",KGZ:"Kyrgyzstan",KHM:"Cambodia",KIR:"Kiribati",KWT:"Kuwait",LAO:"Laos",LBN:"Lebanon",LBR:"Liberia",LBY:"Libya",LCA:"Saint Lucia",LIE:"Liechtenstein",LKA:"Sri Lanka",LUX:"Luxembourg",MAR:"Morocco",MDV:"Maldives",MHL:"Marshall Islands",MLI:"Mali",MLT:"Malta",MMR:"Myanmar",MNE:"Montenegro",MNG:"Mongolia",MNP:"Northern Mariana Islands",MOZ:"Mozambique",MRT:"Mauritania",MSR:"Montserrat",MUS:"Mauritius",MWI:"Malawi",MYS:"Malaysia",MYT:"Mayotte",NAM:"Namibia",NCL:"New Caledonia",NER:"Niger",NGA:"Nigeria",NIU:"Niue",NPL:"Nepal",NZL:"New Zealand",OMN:"Oman",PAK:"Pakistan",PAN:"Panama",PER:"Peru",PHL:"Philippines",PLW:"Palau",PNG:"Papua New Guinea",PRK:"North Korea",PRY:"Paraguay",PSE:"Palestine",PYF:"French Polynesia",QAT:"Qatar",RUS:"Russia",SAU:"Saudi Arabia",SDN:"Sudan",SEN:"Senegal",SHN:"Saint Helena",SLB:"Solomon Islands",SLE:"Sierra Leone",SMR:"San Marino",SOM:"Somalia",SSD:"South Sudan",STP:"São Tomé and Príncipe",SUR:"Suriname",SWE:"Sweden",SWZ:"Eswatini",SYR:"Syria",TCA:"Turks and Caicos Islands",TCD:"Chad",TGO:"Togo",THA:"Thailand",TJK:"Tajikistan",TON:"Tonga",TUN:"Tunisia",TUR:"Turkey",TZA:"Tanzania",UGA:"Uganda",USA:"United States",UZB:"Uzbekistan",VCT:"Saint Vincent and the Grenadines",VEN:"Venezuela",VGB:"British Virgin Islands",VIR:"U.S. Virgin Islands",VNM:"Vietnam",VUT:"Vanuatu",WLF:"Wallis and Futuna",WSM:"Samoa",YEM:"Yemen",ZAF:"South Africa",ZMB:"Zambia",ZWE:"Zimbabwe"};function yd(e){const t={...ia};for(const o of e||[]){const n=o&&o.country_code,a=o&&o.country_code_label;n&&a&&(t[n]=a)}return t}function _d(e,t={}){if(!e||typeof e!="object")return null;const o=t.nameMap||ia;if(e.shapeName){const n=String(e.shapeName),a=Object.prototype.hasOwnProperty.call(gr,n)?gr[n]:null;return{key:"adm1:"+n,name:n,count:a,kind:"adm1"}}if(e.iso3){const n=String(e.iso3),a=o[n]||ia[n]||n,r=Object.prototype.hasOwnProperty.call(bd,n)?bd[n]:null;return{key:"adm0:"+n,name:a,count:r,kind:"adm0"}}return null}function vd(e,t={}){const o=Array.isArray(e)?e:[],n=o.map(l=>l.name),a=o.reduce((l,c)=>l+(Number(c.count)||0),0),r=t&&typeof t.color=="string"&&t.color?t.color:"",s=n.join(", ")+" — "+a+" UUPG"+(r?" · "+r:""),i=o.map(l=>l.name+" "+(Number(l.count)||0)).join(", ");return s+`
-`+i}function An(e){return String(e??"").normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().trim()}function Ck(e){return An(e).split(/[\s,;]+/).filter(Boolean)}function Ek(e={}){const{records:t=[],leafZones:o=[],adm1Counts:n={},iso3Names:a={},countryNameMap:r=null}=e,s=[],i=new Set;for(const c of t){if(!c)continue;const u=c.slug;if(!u||i.has(u))continue;const p=Number(c.latitude),g=Number(c.longitude);if(!Number.isFinite(p)||!Number.isFinite(g))continue;const x=c.name||u;i.add(u),s.push({label:x,kind:"pg",target:{type:"pg",slug:u,lng:g,lat:p},_hay:An(x)})}for(const c of o){if(!c)continue;const u=c.zoneKey||c.id,p=c.label||u;u&&s.push({label:p,kind:"zone",target:{type:"zone",zoneId:u},_hay:An(p)})}for(const c of Object.keys(n))s.push({label:c,kind:"territory",target:{type:"territory",shapeName:c},_hay:An(c)});const l=r||a;for(const c of Object.keys(a)){const u=l&&l[c]||a[c]||c;s.push({label:u,kind:"territory",target:{type:"territory",shapeName:c,iso3:!0},_hay:An(u)})}return s}const Tk={zone:0,territory:1,pg:2};function Pk(e={}){const{records:t=[],leafZones:o=[],adm1Counts:n={},iso3Names:a={},countryNameMap:r=null,centroidFor:s=null}=e,i=[];for(const u of t)u&&i.push(u);const l=(u,p,g)=>!p||!Number.isFinite(p[0])||!Number.isFinite(p[1])?null:{name:u,slug:g.__synthSlug,latitude:p[1],longitude:p[0],...g};for(const u of o){if(!u)continue;const p=u.zoneKey||u.id,g=u.label||p;if(!p)continue;const x=typeof s=="function"?s(h=>h&&h.properties&&h.properties.zoneKey===p):null,w=l(g,x,{__upgKind:"zone",__zoneId:p,__synthSlug:`__zone__${p}`});w&&i.push(w)}for(const u of Object.keys(n)){const p=typeof s=="function"?s(x=>x&&x.properties&&x.properties.shapeName===u):null,g=l(u,p,{__upgKind:"territory",__shapeName:u,__synthSlug:`__terr__${u}`});g&&i.push(g)}const c=r||a;for(const u of Object.keys(a)){const p=c&&c[u]||a[u]||u,g=typeof s=="function"?s(w=>w&&w.properties&&w.properties.iso3===u):null,x=l(p,g,{__upgKind:"territory",__shapeName:u,__synthSlug:`__terr__${u}`});x&&i.push(x)}return i}function kd(e,t,o={}){const n=o.limit??8,a=Ck(t);if(!a.length)return[];const r=a[0],s=[];for(const i of e){let l=!0;for(const p of a)if(!i._hay.includes(p)){l=!1;break}if(!l)continue;const c=i._hay.startsWith(r)?0:1,u=i._hay===An(t)?-1:0;s.push({e:i,starts:c,exact:u,kr:Tk[i.kind]??9,len:i._hay.length})}return s.sort((i,l)=>i.exact-l.exact||i.starts-l.starts||i.kr-l.kr||i.len-l.len),s.slice(0,n).map(i=>i.e)}const Mk="rgba(120, 128, 134, 0.28)",wd="36px",xd=()=>{};function Nk(e,t={}){const{enabled:o=!0}=t;if(!o||!e)return xd;const n=Array.from(e.querySelectorAll(".map-scroll-edge"));if(!n.length)return xd;const a=k=>k.classList.contains("map-scroll-edge--left");for(const k of n)k.style.background=`linear-gradient(${a(k)?"to right":"to left"}, ${Mk} ${wd}, transparent ${wd})`,k.style.opacity="0",k.style.transition="opacity 0.16s ease",k.style.userSelect="none",k.style.webkitUserSelect="none";const r=k=>{k.style.opacity="1"},s=k=>{k.style.opacity="0"},i=()=>n.find(k=>!a(k))||null,l=new Set;let c=!1,u=null;const p=()=>{for(const k of n)l.has(k)||s(k)},g=()=>{const k=i();k&&(r(k),u&&clearTimeout(u),u=setTimeout(p,250))},x=()=>g(),w=k=>{if(!(k.touches&&k.touches.length===1))return;const v=k.target;v&&v.classList&&v.classList.contains("map-scroll-edge")||g()},h=()=>{u&&clearTimeout(u),p()};e.addEventListener("wheel",x,{passive:!0}),e.addEventListener("touchmove",w,{passive:!0}),e.addEventListener("touchend",h,{passive:!0}),e.addEventListener("touchcancel",h,{passive:!0});const d=()=>{c||g()};typeof window<"u"&&window.addEventListener("scroll",d,{passive:!0});const y=[];for(const k of n){const v=()=>{l.add(k),r(k)},_=()=>{l.delete(k),s(k)},m=()=>{c=!0,r(k)},$=()=>{c=!1,s(k)};k.addEventListener("mouseenter",v),k.addEventListener("mouseleave",_),k.addEventListener("touchstart",m,{passive:!0}),k.addEventListener("touchend",$,{passive:!0}),y.push(()=>{k.removeEventListener("mouseenter",v),k.removeEventListener("mouseleave",_),k.removeEventListener("touchstart",m),k.removeEventListener("touchend",$)})}return function(){u&&(clearTimeout(u),u=null),e.removeEventListener("wheel",x),e.removeEventListener("touchmove",w),e.removeEventListener("touchend",h),e.removeEventListener("touchcancel",h),typeof window<"u"&&window.removeEventListener("scroll",d);for(const v of y)v();for(const v of n)s(v)}}const Ik={class:"upg-root"},Rk={key:0,class:"upg-map-err"},Fk={class:"upg-legend-desktop-slot"},Ok={class:"upg-legend-mobile-slot"},Dk={class:"upg-detail-desktop-slot"},Bk={key:4,class:"upg-hud"},jk={key:0,class:"upg-hud-head"},Gk={class:"upg-hud-total"},Uk={key:1,class:"upg-hud-names"},Kk={key:2,class:"upg-hud-swatches"},zk=["data-color","title","onClick"],Hk={key:3,class:"upg-hud-actions"},Vk={key:4,class:"upg-hud-flash"},Wk={class:"upg-status"},ti="upg-search",Sd="My UPG 100 List — Legend",Yk="people-groups",qk="Search people group, zone, or territory…",Ad=8,oi=123,Jk=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"upg-100-list",setup(e){const t=ol(()=>Cn(()=>Promise.resolve().then(()=>u1),void 0)),o={lists:Lu,asia_lists:Cu,uncovered_lists:Eu},n=Ee("mapboxToken",ue("")),a=Ee("profileConfig",ue(null)),r=Q(()=>{var z;const J=(z=a.value)==null?void 0:z.edgeScrollAffordance;return J==null?!0:!(J===!1||J==="false")}),s=Ee("dataStore",null),i=Ee("uiStore",null),l=ue(null),c=ue("loading…"),u=ue(""),p=an([]),g=ue(null),x=an(null),w=ue(!1),h=d0("my-upg-100-list");h.theme.value="light",p0(h);const d=ue([]),y=Q(()=>d.value.reduce((J,z)=>J+(Number(z.count)||0),0)),k=Q(()=>d.value.length),v=ue("");let _=null;const m=ue(!1);function $(J){const z=J===void 0?!m.value:!!J;return z===m.value||(m.value=z,T&&(T.getCanvas().style.cursor=""),Ke()),z}function L(){$()}nt([m,w],()=>{mo(()=>ne())});function R(J){if(!J)return;const z=d.value,te=z.findIndex(le=>le.key===J.key);te>=0?d.value=z.filter((le,Ce)=>Ce!==te):d.value=[...z,J],Ke(),v.value=""}const M=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7","#999999"],I=ue(""),C=ue("");function F(J){const z=/^#?([0-9a-fA-F]{6})$/.exec(String(J||"").trim());if(!z)return;const te="#"+z[1].toLowerCase();I.value=I.value===te?"":te,Ke()}function H(){/^#?[0-9a-fA-F]{6}$/.test(C.value.trim())&&F(C.value)}const G=ue(null),U=[{id:"upg100Region",label:"Region",info:"Region — the broadest grouping, one row per world area (Africa, India, Middle East, Deaf, …). Counts are the UUPGs and population summed across every zone beneath it."},{id:"upg100Zone",label:"Zone",info:"Zone — the prayer zones inside a region (e.g. Frontier Asia (uncovered) within Asia, or the Indian states within India). This is the level the map paints and colours."},{id:"upg100Group",label:"People Group",info:"People Group — the individual unreached groups inside a zone, largest prayer need first. Each map dot is one of these."}];let B=[],T=null,se=null,ye=[],ae=null,oe=null,fe=null;const Pe=typeof window<"u"&&window.MAP_APP_API_URL||"https://pray.doxa.life";wt(`.upg-root{position:absolute;inset:0;background:#0a1410;color:#e5e7eb;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-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-status{position:absolute;bottom:10px;right:10px;z-index:5;font:10px/1 ui-monospace,monospace;color:#9aa7b8;background:rgba(10,14,21,.82);padding:6px 10px;border-radius:8px}.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-hud{position:absolute;bottom:34px;right: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-left: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: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{top:58px!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 We(J){const z=[];for(const te of J)z.push(te.zoneKey,Lk(te.zoneKey,te.color));return["match",["get","zoneKey"],...z,"#9ca3af"]}function Xe(){if(T.getSource("tapestry"))return;T.addSource("tapestry",{type:"geojson",data:se});const J=w.value?.45:.3,z=w.value?.65:.45;T.addLayer({id:"tapestry-fill",type:"fill",source:"tapestry",paint:{"fill-color":ae,"fill-opacity":["case",["==",["get","zoneKey"],"deaf"],J,z]}}),T.addLayer({id:"tapestry-line",type:"line",source:"tapestry",paint:{"line-color":ae,"line-width":1.2,"line-opacity":.9}})}function Qe(){!T||!T.getSource("tapestry")||T.getLayer("upg-sel-fill")||(T.addLayer({id:"upg-sel-fill",type:"fill",source:"tapestry",filter:["boolean",!1],paint:{"fill-color":"#f59e0b","fill-opacity":.28}}),T.addLayer({id:"upg-sel-line",type:"line",source:"tapestry",filter:["boolean",!1],paint:{"line-color":"#fbbf24","line-width":2.4,"line-opacity":.95}}))}function ht(){const J=[],z=[],te=[];for(const Ce of d.value)Ce.kind==="adm1"?J.push(Ce.name):Ce.kind==="adm0"?z.push(Ce.key.slice(5)):Ce.kind==="zone"&&te.push(Ce.key.slice(5));const le=[];return J.length&&le.push(["in",["get","shapeName"],["literal",J]]),z.length&&le.push(["in",["get","iso3"],["literal",z]]),te.length&&le.push(["in",["get","zoneKey"],["literal",te]]),le.length?le.length===1?le[0]:["any",...le]:["boolean",!1]}function Ke(){if(ne(),!T||!T.getLayer("upg-sel-fill"))return;const J=m.value?ht():["boolean",!1];T.setFilter("upg-sel-fill",J),T.setFilter("upg-sel-line",J);const z=I.value;T.setPaintProperty("upg-sel-fill","fill-color",z||"#f59e0b"),T.setPaintProperty("upg-sel-fill","fill-opacity",z?.55:.28),T.setPaintProperty("upg-sel-line","line-color",z||"#fbbf24")}let it=null,Ye=!1;function $t(){if(!(!T||!T.getLayer("tapestry-fill"))){if(it)try{T.off("click","tapestry-fill",it)}catch{}it=J=>{const z=J&&J.features&&J.features[0];if(z&&m.value){const te=_d(z.properties,{nameMap:_});if(!te){console.warn("[batch-select] clicked feature has no shapeName/iso3",z.properties);return}te.count==null&&console.warn("[batch-select] no UUPG count for territory",te.name,z.properties),R(te)}},T.on("click","tapestry-fill",it),Ye||(T.on("mouseenter","tapestry-fill",()=>{T&&(T.getCanvas().style.cursor=m.value?"crosshair":"")}),T.on("mouseleave","tapestry-fill",()=>{T&&(T.getCanvas().style.cursor="")}),Ye=!0)}}function A(){d.value=[],v.value="",I.value="",C.value="",Ke()}async function N(){if(!d.value.length)return;const J=vd(d.value,{color:I.value});typeof window<"u"&&(window.__UPG_LAST_CLIPBOARD__=J);let z=!1;try{navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(J),z=!0):z=E(J)}catch{z=E(J)}v.value=z?"Copied!":"Copy failed — press Ctrl/Cmd-C",setTimeout(()=>{v.value.startsWith("Copied")&&(v.value="")},1800)}function E(J){try{const z=document.createElement("textarea");z.value=J,z.style.position="fixed",z.style.opacity="0",z.style.top="0",document.body.appendChild(z),z.focus(),z.select();const te=document.execCommand&&document.execCommand("copy");return document.body.removeChild(z),!!te}catch{return!1}}function K(J){if(s&&typeof s.cacheSourceData=="function"){const z=Pk({records:J,leafZones:ye,adm1Counts:gr,iso3Names:ia,countryNameMap:_,centroidFor:te=>{const le=V(te);return le?[(le[0][0]+le[1][0])/2,(le[0][1]+le[1][1])/2]:null}});s.cacheSourceData(ti,{normalizedData:z})}B=Ek({records:J,leafZones:ye,adm1Counts:gr,iso3Names:ia,countryNameMap:_}),typeof window<"u"&&(window.__UPG_SEARCH__={size:()=>B.length,counts:()=>{const z={pg:0,zone:0,territory:0};for(const te of B)z[te.kind]=(z[te.kind]||0)+1;return z},query:z=>kd(B,z,{limit:Ad}).map(te=>({label:te.label,kind:te.kind,target:te.target})),select:z=>{const te=kd(B,z,{limit:Ad})[0];return te?(q(te.target),{label:te.label,kind:te.kind,target:te.target}):null},feedSize:()=>{const z=s&&s.sources&&s.sources[ti];return z&&Array.isArray(z.features)&&z.features.length||0},localGeocoder:z=>{const te=G.value&&G.value.geocoder,le=te&&te.options&&te.options.localGeocoder;return le?le(z).map(Ce=>Ce&&Ce.place_name):null}})}function Y(J){const z=J&&J.properties||{},te=z.__upgKind;if(te==="zone")b(z.__zoneId);else if(te==="territory")D(z.__shapeName);else{const le=J&&J.geometry,Ce=le&&Array.isArray(le.coordinates)?le.coordinates:null;Ce&&Number.isFinite(Ce[0])&&Number.isFinite(Ce[1])&&T&&T.flyTo({center:[Ce[0],Ce[1]],zoom:6,duration:800}),f(z.slug)}}function Z(J){if(!J||!T)return;const z=new Set(J.memberIds||[]);if(!z.size)return;let te=[];try{te=T.querySourceFeatures("upg").filter(De=>{const he=De.properties||{};return z.has(he.slug)||z.has(he.id)||z.has(he.peopleGroupId)})}catch{return}if(!te.length)return;let le=180,Ce=90,Nt=-180,mt=-90,Oe=!1;for(const De of te){const he=De.geometry&&De.geometry.coordinates;!Array.isArray(he)||!Number.isFinite(he[0])||!Number.isFinite(he[1])||(he[0]Nt&&(Nt=he[0]),he[1]mt&&(mt=he[1]),Oe=!0)}Oe&&T.fitBounds([[le,Ce],[Nt,mt]],{padding:60,duration:800,maxZoom:6})}function X(){_e(null),i&&typeof i.selectPeopleGroup=="function"&&i.selectPeopleGroup(null)}function q(J){!J||!T||(J.type==="pg"?(Number.isFinite(J.lng)&&Number.isFinite(J.lat)&&T.flyTo({center:[J.lng,J.lat],zoom:6,duration:800}),f(J.slug)):J.type==="zone"?b(J.zoneId):J.type==="territory"&&D(J.shapeName))}function f(J){if(!J||!i||typeof i.selectPeopleGroup!="function")return;const z=T&&T.getSource&&T.getSource("upg"),le=(z&&z._data&&z._data.features||[]).find(Ce=>Ce.properties&&Ce.properties.slug===J);le&&i.selectPeopleGroup(le)}function b(J){if(!J||!T||!se)return;const z=V(te=>te.properties&&te.properties.zoneKey===J);z&&T.fitBounds(z,{padding:40,duration:800,maxZoom:6})}function D(J){if(!J||!T||!se)return;const z=V(te=>{const le=te.properties||{};return le.shapeName===J||le.iso3===J});z&&T.fitBounds(z,{padding:40,duration:800,maxZoom:6})}function V(J){let z=180,te=90,le=-180,Ce=-90,Nt=!1;const mt=Oe=>{if(typeof Oe[0]=="number"){const[De,he]=Oe;Dele&&(le=De),heCe&&(Ce=he),Nt=!0;return}for(const De of Oe)mt(De)};for(const Oe of se.features)J(Oe)&&mt(Oe.geometry.coordinates);return Nt?[[z,te],[le,Ce]]:null}function ie(J){const z=new Set,te=le=>{le.children&&le.children.length?le.children.forEach(te):z.add(le.zoneKey??le.id)};return te(J),z}let re=null;function j(J){if(![...ie(J)].length)return;const te=[],le=Oe=>{Oe.children&&Oe.children.length?Oe.children.forEach(le):te.push(Oe)};le(J);const Ce=d.value,Nt=new Set(Ce.filter(Oe=>Oe.kind==="zone").map(Oe=>Oe.key));if(te.every(Oe=>Nt.has("zone:"+(Oe.zoneKey??Oe.id)))){const Oe=new Set(te.map(De=>"zone:"+(De.zoneKey??De.id)));d.value=Ce.filter(De=>!Oe.has(De.key))}else{const Oe=te.filter(De=>!Nt.has("zone:"+(De.zoneKey??De.id))).map(De=>({key:"zone:"+(De.zoneKey??De.id),name:De.label||De.id,count:Number(De.count)||0,kind:"zone"}));d.value=[...Ce,...Oe]}Ke(),v.value=""}function S(){const J=new Set;for(const z of d.value)z.kind==="zone"&&J.add(z.key.slice(5));return J}function O(){const J=new Map,z=te=>{const le=ie(te);te.label&&J.set(te.label,le),te.children&&te.children.length&&te.children.forEach(z)};for(const te of p.value)z(te);return J}function ne(){if(typeof document>"u")return;const J=document.querySelector("my-upg-100-list-map"),te=(J&&J.shadowRoot||document).querySelectorAll(".stl-row");if(!te.length)return;if(!m.value){te.forEach(mt=>mt.classList.remove("upg-batch-row"));return}const le=S(),Ce=O(),Nt=w.value;te.forEach(mt=>{const Oe=mt.querySelector(".stl-name"),De=Oe?Oe.textContent.trim():"",he=De&&Ce.get(De),qe=!!(he&&he.size&&[...he].every(lt=>le.has(lt)));mt.classList.toggle("upg-batch-row",qe),mt.classList.toggle("dark",qe&&Nt)})}let ce=null;function ge(){if(typeof document>"u"||ce)return;const J=document.querySelector("my-upg-100-list-map"),te=(J&&J.shadowRoot||document).querySelector(".stl-rows");te&&(ce=new MutationObserver(()=>{requestAnimationFrame(()=>ne())}),ce.observe(te,{childList:!0,subtree:!0}))}Pt("onSemanticTreeSelect",_e);function Le(J){const z=g.value;if(!z)return;if(J==="packet"){c.value="Prayer List — coming soon",setTimeout(()=>{c.value=""},2600);return}const te=$s(a.value),le=document.createElement("a");le.href=`${te}/posters/${z}.webp`,le.download=`doxa-upg-100-${z}-poster.webp`,document.body.appendChild(le),le.click(),le.remove()}function _e(J){if(!T||!T.getLayer("tapestry-fill"))return;if(m.value){J&&j(J);return}if(!J){re=null,g.value=null,T.setFilter("tapestry-fill",null),T.setFilter("tapestry-line",null),T.setPaintProperty("upg-pins","circle-opacity",1);return}re=J;const z=[...ie(J)];g.value=z.length===1?z[0]:J.id??null;const te=["in",["get","zoneKey"],["literal",z]];T.setFilter("tapestry-fill",te),T.setFilter("tapestry-line",te),T.getLayer("upg-pins")&&T.setPaintProperty("upg-pins","circle-opacity",["case",["in",["get","zoneKey"],["literal",z]],.95,.05]);const le=V(Ce=>z.includes(Ce.properties.zoneKey));le&&T.fitBounds(le,{padding:40,duration:700,maxZoom:6})}function ct(){!T||!se||(Xe(),typeof fe=="function"&&fe(),Qe(),$t(),Ke(),g.value&&T.getLayer("tapestry-fill")&&_e(re))}function Fe(){T&&(w.value=!w.value,h.theme.value=w.value?"dark":"light",T.setStyle(w.value?"mapbox://styles/mapbox/dark-v11":"mapbox://styles/mapbox/light-v11"),T.once("style.load",ct))}function tt(){!T||!T.getLayer("upg-pins")||(T.on("click","upg-pins",J=>{const z=J&&J.features&&J.features[0];z&&i&&typeof i.selectPeopleGroup=="function"&&i.selectPeopleGroup(z)}),T.on("mouseenter","upg-pins",()=>{T&&(T.getCanvas().style.cursor="pointer")}),T.on("mouseleave","upg-pins",()=>{T&&(T.getCanvas().style.cursor="")}))}let lo=null;function fr(J){var le;const z=((le=J==null?void 0:J.detail)==null?void 0:le.listId)??null;if(!z){_e(null);return}const te=Cd(p.value,z);te&&_e(te)}function Cd(J,z){for(const te of J||[]){if((te.zoneKey||te.id)===z)return te;const le=te.children&&Cd(te.children,z);if(le)return le}return null}function sw(){const J=Qs(o,{deafCount:oi});p.value=J,ye=hd(J);const z={};for(const te of o.lists||[])z[te.id]=te.selector;for(const te of o.asia_lists||[])z[te.id]=te.selector;for(const te of o.uncovered_lists||[])z[te.id]=te.selector;z.deaf={type:"affinity_bloc",rop1:"A017"};for(const te of ye)te.selector=z[te.id];ae=We(ye)}async function Ed(){try{const z=await fetch(`${Pe}/api/people-groups/list?fields=slug,name,country_code,wagf_region,wagf_block,rop1,population,latitude,longitude&lang=en`,{cache:"no-store"});if(!z.ok)throw new Error(`list ${z.status}`);const te=Ls(Cs(await z.json()));_=yd(te),p.value=Qs(o,{deafCount:oi,records:te})}catch{}}return to(async()=>{var Ce,Nt,mt,Oe,De;sw();const J=window.mapboxgl,z=(n==null?void 0:n.value)||((Ce=a==null?void 0:a.value)==null?void 0:Ce.tk)||"";if(!J){c.value="⚠ mapbox-gl not loaded",u.value="mapbox-gl did not load. The list and legend are unaffected.",Ed();return}if(!z){c.value="⚠ no mapbox token",u.value="No Mapbox token configured. The list and legend are unaffected.",Ed();return}J.accessToken=z;try{const he=l.value&&l.value.getRootNode();if(he instanceof ShadowRoot){const qe="https://api.mapbox.com/mapbox-gl-js/v3.3.0/mapbox-gl.css";if(!he.querySelector(`link[href="${qe}"]`)){const lt=document.createElement("link");lt.rel="stylesheet",lt.href=qe,he.prepend(lt)}}}catch{}T=new J.Map({container:l.value,style:"mapbox://styles/mapbox/light-v11",center:[35,20],zoom:1.5,projection:"mercator"}),x.value=T,oe=Nk(((Nt=l.value)==null?void 0:Nt.parentElement)||null,{enabled:r.value}),typeof window<"u"&&(window.__UPG_MAP__=T),window.__UPG_SELECT__={get list(){return d.value.map(he=>({...he}))},get total(){return y.value},get count(){return k.value},get color(){return I.value},get batchMode(){return m.value},setColor:he=>F(he),setBatchMode:he=>$(he),clipboardText:()=>vd(d.value,{color:I.value}),clear:()=>A(),toggleByProps:he=>{const qe=_d(he,{nameMap:_});return qe?(R(qe),{...qe}):null},toggleLegendRow:he=>{const qe=jo=>{for(const at of jo){if(at.label===he)return at;if(at.children&&at.children.length){const co=qe(at.children);if(co)return co}}return null},lt=qe(p.value);return lt?(j(lt),{label:lt.label,zoneKeys:[...ie(lt)]}):null},markedLegendRows:()=>{if(typeof document>"u")return[];const he=document.querySelector("my-upg-100-list-map");return[...(he&&he.shadowRoot||document).querySelectorAll(".stl-row.upg-batch-row .stl-name")].map(lt=>lt.textContent.trim())},highlightFeatureCount:()=>{if(!T||!se||!T.getLayer("upg-sel-fill"))return-1;const he=new Set,qe=new Set,lt=new Set;for(const at of d.value)at.kind==="zone"?he.add(at.key.slice(5)):at.kind==="adm1"?qe.add(at.name):at.kind==="adm0"&<.add(at.key.slice(5));let jo=0;for(const at of se.features){const co=at.properties||{};(he.has(co.zoneKey)||qe.has(co.shapeName)||lt.has(co.iso3))&&jo++}return jo},zoneKeysForRow:he=>{const qe=jo=>{for(const at of jo){if(at.label===he)return at;if(at.children&&at.children.length){const co=qe(at.children);if(co)return co}}return null},lt=qe(p.value);return lt?[...ie(lt)]:null}};try{c.value="loading boundaries…";const he=Ne=>`${$s(a.value)}/boundaries/${Ne}`,qe=Ne=>fetch(he(Ne)).then(bt=>{if(!bt.ok)throw new Error(`boundary fetch ${bt.status} ${Ne}`);return bt.json()}),[lt,jo,at]=await Promise.all([qe("world-adm0.geojson"),qe("gb-IND-ADM1.geojson"),qe("gb-CHN-ADM1.geojson")]);c.value="fetching 2106 UUPGs…";const ni=await fetch(`${Pe}/api/people-groups/list?fields=slug,name,country_code,wagf_region,wagf_block,rop1,population,latitude,longitude&lang=en`,{cache:"no-store"});if(!ni.ok)throw new Error(`list ${ni.status}`);const $n=Ls(Cs(await ni.json()));_=yd($n),p.value=Qs(o,{deafCount:oi,records:$n});const{tapestry:iw,perZone:lw}=Ak(ye,{records:$n,adm0:lt,adm1Ind:jo,adm1Chn:at});se=Uo(iw),K($n);const ai=[],la={},{evaluate:cw}=await Cn(async()=>{const{evaluate:Ne}=await Promise.resolve().then(()=>jy);return{evaluate:Ne}},void 0);for(const Ne of ye)if(Ne.selector&&Ne.selector.type==="pg_slugs")for(const bt of Ne.selector.values||[])bt in la||(la[bt]=Ne.zoneKey);else try{for(const bt of cw(Ne.selector,$n))bt in la||(la[bt]=Ne.zoneKey)}catch(bt){console.warn("zone selector skipped",Ne.id,bt&&bt.message)}for(const Ne of $n){const bt=Number(Ne.latitude),si=Number(Ne.longitude);!isFinite(bt)||!isFinite(si)||ai.push({type:"Feature",geometry:{type:"Point",coordinates:[si,bt]},properties:{slug:Ne.slug,zoneKey:la[Ne.slug]||"",name:Ne.name||Ne.slug||"",population:Ne.population??0,countryName:Ne.country_code_label||"",country:Ne.country_code||""}})}const uw=Uo({type:"FeatureCollection",features:ai});fe=()=>{T.getSource("upg")||(T.addSource("upg",{type:"geojson",data:uw}),T.addLayer({id:"upg-pins",type:"circle",source:"upg",paint:{"circle-radius":["interpolate",["linear"],["zoom"],1,4,4,6,8,9],"circle-color":ae,"circle-opacity":1,"circle-stroke-width":["interpolate",["linear"],["zoom"],1,1.2,8,2],"circle-stroke-color":"rgba(15,20,25,0.9)"}}),tt())};let ri=!0;const Ln=()=>{ri&&(ri=!1,T.off("style.load",Ln),T.off("idle",Ln),ct())};if(T.isStyleLoaded())Ln();else{T.once("style.load",Ln),T.once("idle",Ln);const Ne=setInterval(()=>{if(!ri||!T){clearInterval(Ne);return}let bt=!1;try{bt=T.isStyleLoaded()}catch{clearInterval(Ne);return}bt&&(clearInterval(Ne),Ln())},120);setTimeout(()=>clearInterval(Ne),15e3)}const Td=[...lw.entries()].filter(([Ne])=>Ne!=="deaf"),dw=Td.filter(([,Ne])=>Ne>=1).length;c.value=`${se.features.length} polys · ${dw}/${Td.length} zones · ${ai.length} pins`}catch(he){c.value="⚠ "+(he&&he.message?he.message:String(he))}let te=0;const le=()=>{const he=typeof document<"u"&&document.querySelector("my-upg-100-list-map"),qe=he&&he.shadowRoot||(typeof document<"u"?document:null);if(qe&&qe.querySelector(".stl-rows")){ge(),ne();return}te++<40&&setTimeout(le,250)};le();{const he=(De=(Oe=(mt=l.value)==null?void 0:mt.getRootNode)==null?void 0:Oe.call(mt))==null?void 0:De.host;he&&(lo=fr,he.addEventListener("doxa:select-zone",lo))}}),yo(()=>{var J,z,te;if(lo){const le=(te=(z=(J=l.value)==null?void 0:J.getRootNode)==null?void 0:z.call(J))==null?void 0:te.host;le==null||le.removeEventListener("doxa:select-zone",lo),lo=null}if(ce){try{ce.disconnect()}catch{}ce=null}if(oe){try{oe()}catch{}oe=null}T&&(T.remove(),T=null),se=null}),(J,z)=>{var te;return W(),ee("div",Ik,[P("div",{ref_key:"mapEl",ref:l,class:"upg-map"},null,512),u.value?(W(),ee("div",Rk,[z[1]||(z[1]=P("strong",null,"Map unavailable",-1)),dt(de(u.value),1)])):me("",!0),r.value?(W(),ee($e,{key:1},[z[2]||(z[2]=P("div",{class:"map-scroll-edge map-scroll-edge--left"},null,-1)),z[3]||(z[3]=P("div",{class:"map-scroll-edge map-scroll-edge--right"},null,-1))],64)):me("",!0),x.value?(W(),rt(yk,{key:2,ref_key:"geocoderRef",ref:G,"map-instance":x.value,"access-token":be(n)||((te=be(a))==null?void 0:te.tk)||"","data-source-id":ti,"is-dark":w.value,placeholder:qk,"active-context":Yk,onPeopleGroupResult:Y,onAggregateResult:Z,onClear:X},null,8,["map-instance","access-token","is-dark"])):me("",!0),x.value?(W(),rt($1,{key:3},{default:jt(()=>[je(C1,{map:x.value,"is-dark":w.value},null,8,["map","is-dark"]),je(E1,{map:x.value,"is-dark":w.value},null,8,["map","is-dark"]),je(T1,{map:x.value,"is-dark":w.value},null,8,["map","is-dark"]),je(N1,{"map-container":l.value,"is-dark":w.value},null,8,["map-container","is-dark"]),je(R1,{"is-dark":w.value,onToggle:Fe},null,8,["is-dark"]),je(ud,{"is-dark":w.value,"embed-path":"my-upg-100-list/upg-100-list/index.html"},null,8,["is-dark"]),je(Xo,{"is-dark":w.value,active:m.value,class:Ae({"upg-batch-on":m.value}),"aria-pressed":m.value?"true":"false",title:"Batch Select",onClick:L},{default:jt(()=>[...z[4]||(z[4]=[P("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[P("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),P("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),P("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),P("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})],-1)])]),_:1},8,["is-dark","active","class","aria-pressed"])]),_:1})):me("",!0),P("div",Fk,[p.value.length?(W(),rt(Iu,{key:0,nodes:p.value,tabs:U,columns:["count","pop"],title:Sd,"export-enabled":!0,onSelect:_e,onExport:Le},null,8,["nodes"])):me("",!0)]),P("div",Ok,[p.value.length?(W(),rt(A1,{key:0,"legend-type":"upg-100",nodes:p.value,columns:["count","pop"],"column-label":"UPG 100",title:Sd,"is-dark":w.value,"popup-action":"pray"},null,8,["nodes","is-dark"])):me("",!0)]),P("div",Dk,[be(i)&&be(i).selectedPeopleGroup?(W(),ee("div",{key:0,class:Ae(["upg-detail-panel pg-detail-root",{dark:w.value}])},[je(be(t),{peopleGroup:be(i).selectedPeopleGroup,dark:w.value,action:"pray"},null,8,["peopleGroup","dark"])],2)):me("",!0)]),m.value?(W(),ee("div",Bk,[z[5]||(z[5]=P("div",{class:"upg-hud-hint"}," Tap territories on the map or legend rows to add · tap again to remove ",-1)),k.value?(W(),ee("div",jk,[P("span",null,de(k.value)+" territor"+de(k.value===1?"y":"ies")+" ·",1),P("span",Gk,de(y.value)+" UUPG",1),P("span",{class:Ae(["upg-hud-band",{ok:y.value>=50&&y.value<=100}])},de(y.value>=50&&y.value<=100?"✓ 50–100 band":"band 50–100"),3)])):me("",!0),k.value?(W(),ee("div",Uk,de(d.value.map(le=>le.name).join(", ")),1)):me("",!0),k.value?(W(),ee("div",Kk,[(W(),ee($e,null,St(M,le=>P("button",{key:le,class:Ae(["upg-swatch",{active:I.value===le}]),"data-color":le,style:et({background:le}),title:le,onClick:Ce=>F(le)},null,14,zk)),64)),Sp(P("input",{"onUpdate:modelValue":z[0]||(z[0]=le=>C.value=le),class:"upg-hex",placeholder:"#hex",spellcheck:"false",onChange:H,onKeyup:os(H,["enter"])},null,544),[[af,C.value]])])):me("",!0),k.value?(W(),ee("div",Hk,[P("button",{class:"upg-hud-btn copy",onClick:N},"Copy selection"),P("button",{class:"upg-hud-btn clear",onClick:A},"Clear")])):me("",!0),k.value?(W(),ee("div",Vk,de(v.value),1)):me("",!0)])):me("",!0),P("div",Wk,de(c.value),1)])}}}},Symbol.toStringTag,{value:"Module"})),Zk=`
+`+i}function An(e){return String(e??"").normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().trim()}function Ck(e){return An(e).split(/[\s,;]+/).filter(Boolean)}function Ek(e={}){const{records:t=[],leafZones:o=[],adm1Counts:n={},iso3Names:a={},countryNameMap:r=null}=e,s=[],i=new Set;for(const c of t){if(!c)continue;const u=c.slug;if(!u||i.has(u))continue;const p=Number(c.latitude),g=Number(c.longitude);if(!Number.isFinite(p)||!Number.isFinite(g))continue;const x=c.name||u;i.add(u),s.push({label:x,kind:"pg",target:{type:"pg",slug:u,lng:g,lat:p},_hay:An(x)})}for(const c of o){if(!c)continue;const u=c.zoneKey||c.id,p=c.label||u;u&&s.push({label:p,kind:"zone",target:{type:"zone",zoneId:u},_hay:An(p)})}for(const c of Object.keys(n))s.push({label:c,kind:"territory",target:{type:"territory",shapeName:c},_hay:An(c)});const l=r||a;for(const c of Object.keys(a)){const u=l&&l[c]||a[c]||c;s.push({label:u,kind:"territory",target:{type:"territory",shapeName:c,iso3:!0},_hay:An(u)})}return s}const Tk={zone:0,territory:1,pg:2};function Pk(e={}){const{records:t=[],leafZones:o=[],adm1Counts:n={},iso3Names:a={},countryNameMap:r=null,centroidFor:s=null}=e,i=[];for(const u of t)u&&i.push(u);const l=(u,p,g)=>!p||!Number.isFinite(p[0])||!Number.isFinite(p[1])?null:{name:u,slug:g.__synthSlug,latitude:p[1],longitude:p[0],...g};for(const u of o){if(!u)continue;const p=u.zoneKey||u.id,g=u.label||p;if(!p)continue;const x=typeof s=="function"?s(h=>h&&h.properties&&h.properties.zoneKey===p):null,w=l(g,x,{__upgKind:"zone",__zoneId:p,__synthSlug:`__zone__${p}`});w&&i.push(w)}for(const u of Object.keys(n)){const p=typeof s=="function"?s(x=>x&&x.properties&&x.properties.shapeName===u):null,g=l(u,p,{__upgKind:"territory",__shapeName:u,__synthSlug:`__terr__${u}`});g&&i.push(g)}const c=r||a;for(const u of Object.keys(a)){const p=c&&c[u]||a[u]||u,g=typeof s=="function"?s(w=>w&&w.properties&&w.properties.iso3===u):null,x=l(p,g,{__upgKind:"territory",__shapeName:u,__synthSlug:`__terr__${u}`});x&&i.push(x)}return i}function kd(e,t,o={}){const n=o.limit??8,a=Ck(t);if(!a.length)return[];const r=a[0],s=[];for(const i of e){let l=!0;for(const p of a)if(!i._hay.includes(p)){l=!1;break}if(!l)continue;const c=i._hay.startsWith(r)?0:1,u=i._hay===An(t)?-1:0;s.push({e:i,starts:c,exact:u,kr:Tk[i.kind]??9,len:i._hay.length})}return s.sort((i,l)=>i.exact-l.exact||i.starts-l.starts||i.kr-l.kr||i.len-l.len),s.slice(0,n).map(i=>i.e)}const Mk="rgba(120, 128, 134, 0.28)",wd="36px",xd=()=>{};function Nk(e,t={}){const{enabled:o=!0}=t;if(!o||!e)return xd;const n=Array.from(e.querySelectorAll(".map-scroll-edge"));if(!n.length)return xd;const a=k=>k.classList.contains("map-scroll-edge--left");for(const k of n)k.style.background=`linear-gradient(${a(k)?"to right":"to left"}, ${Mk} ${wd}, transparent ${wd})`,k.style.opacity="0",k.style.transition="opacity 0.16s ease",k.style.userSelect="none",k.style.webkitUserSelect="none";const r=k=>{k.style.opacity="1"},s=k=>{k.style.opacity="0"},i=()=>n.find(k=>!a(k))||null,l=new Set;let c=!1,u=null;const p=()=>{for(const k of n)l.has(k)||s(k)},g=()=>{const k=i();k&&(r(k),u&&clearTimeout(u),u=setTimeout(p,250))},x=()=>g(),w=k=>{if(!(k.touches&&k.touches.length===1))return;const v=k.target;v&&v.classList&&v.classList.contains("map-scroll-edge")||g()},h=()=>{u&&clearTimeout(u),p()};e.addEventListener("wheel",x,{passive:!0}),e.addEventListener("touchmove",w,{passive:!0}),e.addEventListener("touchend",h,{passive:!0}),e.addEventListener("touchcancel",h,{passive:!0});const d=()=>{c||g()};typeof window<"u"&&window.addEventListener("scroll",d,{passive:!0});const y=[];for(const k of n){const v=()=>{l.add(k),r(k)},_=()=>{l.delete(k),s(k)},m=()=>{c=!0,r(k)},$=()=>{c=!1,s(k)};k.addEventListener("mouseenter",v),k.addEventListener("mouseleave",_),k.addEventListener("touchstart",m,{passive:!0}),k.addEventListener("touchend",$,{passive:!0}),y.push(()=>{k.removeEventListener("mouseenter",v),k.removeEventListener("mouseleave",_),k.removeEventListener("touchstart",m),k.removeEventListener("touchend",$)})}return function(){u&&(clearTimeout(u),u=null),e.removeEventListener("wheel",x),e.removeEventListener("touchmove",w),e.removeEventListener("touchend",h),e.removeEventListener("touchcancel",h),typeof window<"u"&&window.removeEventListener("scroll",d);for(const v of y)v();for(const v of n)s(v)}}const Ik={class:"upg-root"},Rk={key:0,class:"upg-map-err"},Fk={class:"upg-legend-desktop-slot"},Ok={class:"upg-legend-mobile-slot"},Dk={class:"upg-detail-desktop-slot"},Bk={key:4,class:"upg-hud"},jk={key:0,class:"upg-hud-head"},Gk={class:"upg-hud-total"},Uk={key:1,class:"upg-hud-names"},Kk={key:2,class:"upg-hud-swatches"},zk=["data-color","title","onClick"],Hk={key:3,class:"upg-hud-actions"},Vk={key:4,class:"upg-hud-flash"},Wk={class:"upg-status"},ti="upg-search",Sd="My UPG 100 List — Legend",Yk="people-groups",qk="Search people group, zone, or territory…",Ad=8,oi=123,Jk=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"upg-100-list",setup(e){const t=ol(()=>Cn(()=>Promise.resolve().then(()=>u1),void 0)),o={lists:Lu,asia_lists:Cu,uncovered_lists:Eu},n=Ee("mapboxToken",ue("")),a=Ee("profileConfig",ue(null)),r=Q(()=>{var z;const J=(z=a.value)==null?void 0:z.edgeScrollAffordance;return J==null?!0:!(J===!1||J==="false")}),s=Ee("dataStore",null),i=Ee("uiStore",null),l=ue(null),c=ue("loading…"),u=ue(""),p=an([]),g=ue(null),x=an(null),w=ue(!1),h=d0("my-upg-100-list");h.theme.value="light",p0(h);const d=ue([]),y=Q(()=>d.value.reduce((J,z)=>J+(Number(z.count)||0),0)),k=Q(()=>d.value.length),v=ue("");let _=null;const m=ue(!1);function $(J){const z=J===void 0?!m.value:!!J;return z===m.value||(m.value=z,T&&(T.getCanvas().style.cursor=""),Ke()),z}function L(){$()}nt([m,w],()=>{mo(()=>ne())});function R(J){if(!J)return;const z=d.value,te=z.findIndex(le=>le.key===J.key);te>=0?d.value=z.filter((le,Ce)=>Ce!==te):d.value=[...z,J],Ke(),v.value=""}const M=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7","#999999"],I=ue(""),C=ue("");function F(J){const z=/^#?([0-9a-fA-F]{6})$/.exec(String(J||"").trim());if(!z)return;const te="#"+z[1].toLowerCase();I.value=I.value===te?"":te,Ke()}function H(){/^#?[0-9a-fA-F]{6}$/.test(C.value.trim())&&F(C.value)}const G=ue(null),U=[{id:"upg100Region",label:"Region",info:"Region — the broadest grouping, one row per world area (Africa, India, Middle East, Deaf, …). Counts are the UUPGs and population summed across every zone beneath it."},{id:"upg100Zone",label:"Zone",info:"Zone — the prayer zones inside a region (e.g. Frontier Asia (uncovered) within Asia, or the Indian states within India). This is the level the map paints and colours."},{id:"upg100Group",label:"People Group",info:"People Group — the individual unreached groups inside a zone, largest prayer need first. Each map dot is one of these."}];let B=[],T=null,se=null,ye=[],ae=null,oe=null,fe=null;const Pe=typeof window<"u"&&window.MAP_APP_API_URL||"https://pray.doxa.life";wt(`.upg-root{position:absolute;inset:0;background:#0a1410;color:#e5e7eb;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-status{position:absolute;bottom:10px;right:10px;z-index:5;font:10px/1 ui-monospace,monospace;color:#9aa7b8;background:rgba(10,14,21,.82);padding:6px 10px;border-radius:8px}.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-hud{position:absolute;bottom:34px;right: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-left: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: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{top:8px!important}.upg-root:has(.mapboxgl-ctrl-geocoder) .stl-panel{top:58px!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 We(J){const z=[];for(const te of J)z.push(te.zoneKey,Lk(te.zoneKey,te.color));return["match",["get","zoneKey"],...z,"#9ca3af"]}function Xe(){if(T.getSource("tapestry"))return;T.addSource("tapestry",{type:"geojson",data:se});const J=w.value?.45:.3,z=w.value?.65:.45;T.addLayer({id:"tapestry-fill",type:"fill",source:"tapestry",paint:{"fill-color":ae,"fill-opacity":["case",["==",["get","zoneKey"],"deaf"],J,z]}}),T.addLayer({id:"tapestry-line",type:"line",source:"tapestry",paint:{"line-color":ae,"line-width":1.2,"line-opacity":.9}})}function Qe(){!T||!T.getSource("tapestry")||T.getLayer("upg-sel-fill")||(T.addLayer({id:"upg-sel-fill",type:"fill",source:"tapestry",filter:["boolean",!1],paint:{"fill-color":"#f59e0b","fill-opacity":.28}}),T.addLayer({id:"upg-sel-line",type:"line",source:"tapestry",filter:["boolean",!1],paint:{"line-color":"#fbbf24","line-width":2.4,"line-opacity":.95}}))}function ht(){const J=[],z=[],te=[];for(const Ce of d.value)Ce.kind==="adm1"?J.push(Ce.name):Ce.kind==="adm0"?z.push(Ce.key.slice(5)):Ce.kind==="zone"&&te.push(Ce.key.slice(5));const le=[];return J.length&&le.push(["in",["get","shapeName"],["literal",J]]),z.length&&le.push(["in",["get","iso3"],["literal",z]]),te.length&&le.push(["in",["get","zoneKey"],["literal",te]]),le.length?le.length===1?le[0]:["any",...le]:["boolean",!1]}function Ke(){if(ne(),!T||!T.getLayer("upg-sel-fill"))return;const J=m.value?ht():["boolean",!1];T.setFilter("upg-sel-fill",J),T.setFilter("upg-sel-line",J);const z=I.value;T.setPaintProperty("upg-sel-fill","fill-color",z||"#f59e0b"),T.setPaintProperty("upg-sel-fill","fill-opacity",z?.55:.28),T.setPaintProperty("upg-sel-line","line-color",z||"#fbbf24")}let it=null,Ye=!1;function $t(){if(!(!T||!T.getLayer("tapestry-fill"))){if(it)try{T.off("click","tapestry-fill",it)}catch{}it=J=>{const z=J&&J.features&&J.features[0];if(z&&m.value){const te=_d(z.properties,{nameMap:_});if(!te){console.warn("[batch-select] clicked feature has no shapeName/iso3",z.properties);return}te.count==null&&console.warn("[batch-select] no UUPG count for territory",te.name,z.properties),R(te)}},T.on("click","tapestry-fill",it),Ye||(T.on("mouseenter","tapestry-fill",()=>{T&&(T.getCanvas().style.cursor=m.value?"crosshair":"")}),T.on("mouseleave","tapestry-fill",()=>{T&&(T.getCanvas().style.cursor="")}),Ye=!0)}}function A(){d.value=[],v.value="",I.value="",C.value="",Ke()}async function N(){if(!d.value.length)return;const J=vd(d.value,{color:I.value});typeof window<"u"&&(window.__UPG_LAST_CLIPBOARD__=J);let z=!1;try{navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(J),z=!0):z=E(J)}catch{z=E(J)}v.value=z?"Copied!":"Copy failed — press Ctrl/Cmd-C",setTimeout(()=>{v.value.startsWith("Copied")&&(v.value="")},1800)}function E(J){try{const z=document.createElement("textarea");z.value=J,z.style.position="fixed",z.style.opacity="0",z.style.top="0",document.body.appendChild(z),z.focus(),z.select();const te=document.execCommand&&document.execCommand("copy");return document.body.removeChild(z),!!te}catch{return!1}}function K(J){if(s&&typeof s.cacheSourceData=="function"){const z=Pk({records:J,leafZones:ye,adm1Counts:gr,iso3Names:ia,countryNameMap:_,centroidFor:te=>{const le=V(te);return le?[(le[0][0]+le[1][0])/2,(le[0][1]+le[1][1])/2]:null}});s.cacheSourceData(ti,{normalizedData:z})}B=Ek({records:J,leafZones:ye,adm1Counts:gr,iso3Names:ia,countryNameMap:_}),typeof window<"u"&&(window.__UPG_SEARCH__={size:()=>B.length,counts:()=>{const z={pg:0,zone:0,territory:0};for(const te of B)z[te.kind]=(z[te.kind]||0)+1;return z},query:z=>kd(B,z,{limit:Ad}).map(te=>({label:te.label,kind:te.kind,target:te.target})),select:z=>{const te=kd(B,z,{limit:Ad})[0];return te?(q(te.target),{label:te.label,kind:te.kind,target:te.target}):null},feedSize:()=>{const z=s&&s.sources&&s.sources[ti];return z&&Array.isArray(z.features)&&z.features.length||0},localGeocoder:z=>{const te=G.value&&G.value.geocoder,le=te&&te.options&&te.options.localGeocoder;return le?le(z).map(Ce=>Ce&&Ce.place_name):null}})}function Y(J){const z=J&&J.properties||{},te=z.__upgKind;if(te==="zone")b(z.__zoneId);else if(te==="territory")D(z.__shapeName);else{const le=J&&J.geometry,Ce=le&&Array.isArray(le.coordinates)?le.coordinates:null;Ce&&Number.isFinite(Ce[0])&&Number.isFinite(Ce[1])&&T&&T.flyTo({center:[Ce[0],Ce[1]],zoom:6,duration:800}),f(z.slug)}}function Z(J){if(!J||!T)return;const z=new Set(J.memberIds||[]);if(!z.size)return;let te=[];try{te=T.querySourceFeatures("upg").filter(De=>{const he=De.properties||{};return z.has(he.slug)||z.has(he.id)||z.has(he.peopleGroupId)})}catch{return}if(!te.length)return;let le=180,Ce=90,Nt=-180,mt=-90,Oe=!1;for(const De of te){const he=De.geometry&&De.geometry.coordinates;!Array.isArray(he)||!Number.isFinite(he[0])||!Number.isFinite(he[1])||(he[0]Nt&&(Nt=he[0]),he[1]mt&&(mt=he[1]),Oe=!0)}Oe&&T.fitBounds([[le,Ce],[Nt,mt]],{padding:60,duration:800,maxZoom:6})}function X(){_e(null),i&&typeof i.selectPeopleGroup=="function"&&i.selectPeopleGroup(null)}function q(J){!J||!T||(J.type==="pg"?(Number.isFinite(J.lng)&&Number.isFinite(J.lat)&&T.flyTo({center:[J.lng,J.lat],zoom:6,duration:800}),f(J.slug)):J.type==="zone"?b(J.zoneId):J.type==="territory"&&D(J.shapeName))}function f(J){if(!J||!i||typeof i.selectPeopleGroup!="function")return;const z=T&&T.getSource&&T.getSource("upg"),le=(z&&z._data&&z._data.features||[]).find(Ce=>Ce.properties&&Ce.properties.slug===J);le&&i.selectPeopleGroup(le)}function b(J){if(!J||!T||!se)return;const z=V(te=>te.properties&&te.properties.zoneKey===J);z&&T.fitBounds(z,{padding:40,duration:800,maxZoom:6})}function D(J){if(!J||!T||!se)return;const z=V(te=>{const le=te.properties||{};return le.shapeName===J||le.iso3===J});z&&T.fitBounds(z,{padding:40,duration:800,maxZoom:6})}function V(J){let z=180,te=90,le=-180,Ce=-90,Nt=!1;const mt=Oe=>{if(typeof Oe[0]=="number"){const[De,he]=Oe;Dele&&(le=De),heCe&&(Ce=he),Nt=!0;return}for(const De of Oe)mt(De)};for(const Oe of se.features)J(Oe)&&mt(Oe.geometry.coordinates);return Nt?[[z,te],[le,Ce]]:null}function ie(J){const z=new Set,te=le=>{le.children&&le.children.length?le.children.forEach(te):z.add(le.zoneKey??le.id)};return te(J),z}let re=null;function j(J){if(![...ie(J)].length)return;const te=[],le=Oe=>{Oe.children&&Oe.children.length?Oe.children.forEach(le):te.push(Oe)};le(J);const Ce=d.value,Nt=new Set(Ce.filter(Oe=>Oe.kind==="zone").map(Oe=>Oe.key));if(te.every(Oe=>Nt.has("zone:"+(Oe.zoneKey??Oe.id)))){const Oe=new Set(te.map(De=>"zone:"+(De.zoneKey??De.id)));d.value=Ce.filter(De=>!Oe.has(De.key))}else{const Oe=te.filter(De=>!Nt.has("zone:"+(De.zoneKey??De.id))).map(De=>({key:"zone:"+(De.zoneKey??De.id),name:De.label||De.id,count:Number(De.count)||0,kind:"zone"}));d.value=[...Ce,...Oe]}Ke(),v.value=""}function S(){const J=new Set;for(const z of d.value)z.kind==="zone"&&J.add(z.key.slice(5));return J}function O(){const J=new Map,z=te=>{const le=ie(te);te.label&&J.set(te.label,le),te.children&&te.children.length&&te.children.forEach(z)};for(const te of p.value)z(te);return J}function ne(){if(typeof document>"u")return;const J=document.querySelector("my-upg-100-list-map"),te=(J&&J.shadowRoot||document).querySelectorAll(".stl-row");if(!te.length)return;if(!m.value){te.forEach(mt=>mt.classList.remove("upg-batch-row"));return}const le=S(),Ce=O(),Nt=w.value;te.forEach(mt=>{const Oe=mt.querySelector(".stl-name"),De=Oe?Oe.textContent.trim():"",he=De&&Ce.get(De),qe=!!(he&&he.size&&[...he].every(lt=>le.has(lt)));mt.classList.toggle("upg-batch-row",qe),mt.classList.toggle("dark",qe&&Nt)})}let ce=null;function ge(){if(typeof document>"u"||ce)return;const J=document.querySelector("my-upg-100-list-map"),te=(J&&J.shadowRoot||document).querySelector(".stl-rows");te&&(ce=new MutationObserver(()=>{requestAnimationFrame(()=>ne())}),ce.observe(te,{childList:!0,subtree:!0}))}Pt("onSemanticTreeSelect",_e);function Le(J){const z=g.value;if(!z)return;if(J==="packet"){c.value="Prayer List — coming soon",setTimeout(()=>{c.value=""},2600);return}const te=$s(a.value),le=document.createElement("a");le.href=`${te}/posters/${z}.webp`,le.download=`doxa-upg-100-${z}-poster.webp`,document.body.appendChild(le),le.click(),le.remove()}function _e(J){if(!T||!T.getLayer("tapestry-fill"))return;if(m.value){J&&j(J);return}if(!J){re=null,g.value=null,T.setFilter("tapestry-fill",null),T.setFilter("tapestry-line",null),T.setPaintProperty("upg-pins","circle-opacity",1);return}re=J;const z=[...ie(J)];g.value=z.length===1?z[0]:J.id??null;const te=["in",["get","zoneKey"],["literal",z]];T.setFilter("tapestry-fill",te),T.setFilter("tapestry-line",te),T.getLayer("upg-pins")&&T.setPaintProperty("upg-pins","circle-opacity",["case",["in",["get","zoneKey"],["literal",z]],.95,.05]);const le=V(Ce=>z.includes(Ce.properties.zoneKey));le&&T.fitBounds(le,{padding:40,duration:700,maxZoom:6})}function ct(){!T||!se||(Xe(),typeof fe=="function"&&fe(),Qe(),$t(),Ke(),g.value&&T.getLayer("tapestry-fill")&&_e(re))}function Fe(){T&&(w.value=!w.value,h.theme.value=w.value?"dark":"light",T.setStyle(w.value?"mapbox://styles/mapbox/dark-v11":"mapbox://styles/mapbox/light-v11"),T.once("style.load",ct))}function tt(){!T||!T.getLayer("upg-pins")||(T.on("click","upg-pins",J=>{const z=J&&J.features&&J.features[0];z&&i&&typeof i.selectPeopleGroup=="function"&&i.selectPeopleGroup(z)}),T.on("mouseenter","upg-pins",()=>{T&&(T.getCanvas().style.cursor="pointer")}),T.on("mouseleave","upg-pins",()=>{T&&(T.getCanvas().style.cursor="")}))}let lo=null;function fr(J){var le;const z=((le=J==null?void 0:J.detail)==null?void 0:le.listId)??null;if(!z){_e(null);return}const te=Cd(p.value,z);te&&_e(te)}function Cd(J,z){for(const te of J||[]){if((te.zoneKey||te.id)===z)return te;const le=te.children&&Cd(te.children,z);if(le)return le}return null}function sw(){const J=Qs(o,{deafCount:oi});p.value=J,ye=hd(J);const z={};for(const te of o.lists||[])z[te.id]=te.selector;for(const te of o.asia_lists||[])z[te.id]=te.selector;for(const te of o.uncovered_lists||[])z[te.id]=te.selector;z.deaf={type:"affinity_bloc",rop1:"A017"};for(const te of ye)te.selector=z[te.id];ae=We(ye)}async function Ed(){try{const z=await fetch(`${Pe}/api/people-groups/list?fields=slug,name,country_code,wagf_region,wagf_block,rop1,population,latitude,longitude&lang=en`,{cache:"no-store"});if(!z.ok)throw new Error(`list ${z.status}`);const te=Ls(Cs(await z.json()));_=yd(te),p.value=Qs(o,{deafCount:oi,records:te})}catch{}}return to(async()=>{var Ce,Nt,mt,Oe,De;sw();const J=window.mapboxgl,z=(n==null?void 0:n.value)||((Ce=a==null?void 0:a.value)==null?void 0:Ce.tk)||"";if(!J){c.value="⚠ mapbox-gl not loaded",u.value="mapbox-gl did not load. The list and legend are unaffected.",Ed();return}if(!z){c.value="⚠ no mapbox token",u.value="No Mapbox token configured. The list and legend are unaffected.",Ed();return}J.accessToken=z;try{const he=l.value&&l.value.getRootNode();if(he instanceof ShadowRoot){const qe="https://api.mapbox.com/mapbox-gl-js/v3.3.0/mapbox-gl.css";if(!he.querySelector(`link[href="${qe}"]`)){const lt=document.createElement("link");lt.rel="stylesheet",lt.href=qe,he.prepend(lt)}}}catch{}T=new J.Map({container:l.value,style:"mapbox://styles/mapbox/light-v11",center:[35,20],zoom:1.5,projection:"mercator"}),x.value=T,oe=Nk(((Nt=l.value)==null?void 0:Nt.parentElement)||null,{enabled:r.value}),typeof window<"u"&&(window.__UPG_MAP__=T),window.__UPG_SELECT__={get list(){return d.value.map(he=>({...he}))},get total(){return y.value},get count(){return k.value},get color(){return I.value},get batchMode(){return m.value},setColor:he=>F(he),setBatchMode:he=>$(he),clipboardText:()=>vd(d.value,{color:I.value}),clear:()=>A(),toggleByProps:he=>{const qe=_d(he,{nameMap:_});return qe?(R(qe),{...qe}):null},toggleLegendRow:he=>{const qe=jo=>{for(const at of jo){if(at.label===he)return at;if(at.children&&at.children.length){const co=qe(at.children);if(co)return co}}return null},lt=qe(p.value);return lt?(j(lt),{label:lt.label,zoneKeys:[...ie(lt)]}):null},markedLegendRows:()=>{if(typeof document>"u")return[];const he=document.querySelector("my-upg-100-list-map");return[...(he&&he.shadowRoot||document).querySelectorAll(".stl-row.upg-batch-row .stl-name")].map(lt=>lt.textContent.trim())},highlightFeatureCount:()=>{if(!T||!se||!T.getLayer("upg-sel-fill"))return-1;const he=new Set,qe=new Set,lt=new Set;for(const at of d.value)at.kind==="zone"?he.add(at.key.slice(5)):at.kind==="adm1"?qe.add(at.name):at.kind==="adm0"&<.add(at.key.slice(5));let jo=0;for(const at of se.features){const co=at.properties||{};(he.has(co.zoneKey)||qe.has(co.shapeName)||lt.has(co.iso3))&&jo++}return jo},zoneKeysForRow:he=>{const qe=jo=>{for(const at of jo){if(at.label===he)return at;if(at.children&&at.children.length){const co=qe(at.children);if(co)return co}}return null},lt=qe(p.value);return lt?[...ie(lt)]:null}};try{c.value="loading boundaries…";const he=Ne=>`${$s(a.value)}/boundaries/${Ne}`,qe=Ne=>fetch(he(Ne)).then(bt=>{if(!bt.ok)throw new Error(`boundary fetch ${bt.status} ${Ne}`);return bt.json()}),[lt,jo,at]=await Promise.all([qe("world-adm0.geojson"),qe("gb-IND-ADM1.geojson"),qe("gb-CHN-ADM1.geojson")]);c.value="fetching 2106 UUPGs…";const ni=await fetch(`${Pe}/api/people-groups/list?fields=slug,name,country_code,wagf_region,wagf_block,rop1,population,latitude,longitude&lang=en`,{cache:"no-store"});if(!ni.ok)throw new Error(`list ${ni.status}`);const $n=Ls(Cs(await ni.json()));_=yd($n),p.value=Qs(o,{deafCount:oi,records:$n});const{tapestry:iw,perZone:lw}=Ak(ye,{records:$n,adm0:lt,adm1Ind:jo,adm1Chn:at});se=Uo(iw),K($n);const ai=[],la={},{evaluate:cw}=await Cn(async()=>{const{evaluate:Ne}=await Promise.resolve().then(()=>jy);return{evaluate:Ne}},void 0);for(const Ne of ye)if(Ne.selector&&Ne.selector.type==="pg_slugs")for(const bt of Ne.selector.values||[])bt in la||(la[bt]=Ne.zoneKey);else try{for(const bt of cw(Ne.selector,$n))bt in la||(la[bt]=Ne.zoneKey)}catch(bt){console.warn("zone selector skipped",Ne.id,bt&&bt.message)}for(const Ne of $n){const bt=Number(Ne.latitude),si=Number(Ne.longitude);!isFinite(bt)||!isFinite(si)||ai.push({type:"Feature",geometry:{type:"Point",coordinates:[si,bt]},properties:{slug:Ne.slug,zoneKey:la[Ne.slug]||"",name:Ne.name||Ne.slug||"",population:Ne.population??0,countryName:Ne.country_code_label||"",country:Ne.country_code||""}})}const uw=Uo({type:"FeatureCollection",features:ai});fe=()=>{T.getSource("upg")||(T.addSource("upg",{type:"geojson",data:uw}),T.addLayer({id:"upg-pins",type:"circle",source:"upg",paint:{"circle-radius":["interpolate",["linear"],["zoom"],1,4,4,6,8,9],"circle-color":ae,"circle-opacity":1,"circle-stroke-width":["interpolate",["linear"],["zoom"],1,1.2,8,2],"circle-stroke-color":"rgba(15,20,25,0.9)"}}),tt())};let ri=!0;const Ln=()=>{ri&&(ri=!1,T.off("style.load",Ln),T.off("idle",Ln),ct())};if(T.isStyleLoaded())Ln();else{T.once("style.load",Ln),T.once("idle",Ln);const Ne=setInterval(()=>{if(!ri||!T){clearInterval(Ne);return}let bt=!1;try{bt=T.isStyleLoaded()}catch{clearInterval(Ne);return}bt&&(clearInterval(Ne),Ln())},120);setTimeout(()=>clearInterval(Ne),15e3)}const Td=[...lw.entries()].filter(([Ne])=>Ne!=="deaf"),dw=Td.filter(([,Ne])=>Ne>=1).length;c.value=`${se.features.length} polys · ${dw}/${Td.length} zones · ${ai.length} pins`}catch(he){c.value="⚠ "+(he&&he.message?he.message:String(he))}let te=0;const le=()=>{const he=typeof document<"u"&&document.querySelector("my-upg-100-list-map"),qe=he&&he.shadowRoot||(typeof document<"u"?document:null);if(qe&&qe.querySelector(".stl-rows")){ge(),ne();return}te++<40&&setTimeout(le,250)};le();{const he=(De=(Oe=(mt=l.value)==null?void 0:mt.getRootNode)==null?void 0:Oe.call(mt))==null?void 0:De.host;he&&(lo=fr,he.addEventListener("doxa:select-zone",lo))}}),yo(()=>{var J,z,te;if(lo){const le=(te=(z=(J=l.value)==null?void 0:J.getRootNode)==null?void 0:z.call(J))==null?void 0:te.host;le==null||le.removeEventListener("doxa:select-zone",lo),lo=null}if(ce){try{ce.disconnect()}catch{}ce=null}if(oe){try{oe()}catch{}oe=null}T&&(T.remove(),T=null),se=null}),(J,z)=>{var te;return W(),ee("div",Ik,[P("div",{ref_key:"mapEl",ref:l,class:"upg-map"},null,512),u.value?(W(),ee("div",Rk,[z[1]||(z[1]=P("strong",null,"Map unavailable",-1)),dt(de(u.value),1)])):me("",!0),r.value?(W(),ee($e,{key:1},[z[2]||(z[2]=P("div",{class:"map-scroll-edge map-scroll-edge--left"},null,-1)),z[3]||(z[3]=P("div",{class:"map-scroll-edge map-scroll-edge--right"},null,-1))],64)):me("",!0),x.value?(W(),rt(yk,{key:2,ref_key:"geocoderRef",ref:G,"map-instance":x.value,"access-token":be(n)||((te=be(a))==null?void 0:te.tk)||"","data-source-id":ti,"is-dark":w.value,placeholder:qk,"active-context":Yk,onPeopleGroupResult:Y,onAggregateResult:Z,onClear:X},null,8,["map-instance","access-token","is-dark"])):me("",!0),x.value?(W(),rt($1,{key:3},{default:jt(()=>[je(C1,{map:x.value,"is-dark":w.value},null,8,["map","is-dark"]),je(E1,{map:x.value,"is-dark":w.value},null,8,["map","is-dark"]),je(T1,{map:x.value,"is-dark":w.value},null,8,["map","is-dark"]),je(N1,{"map-container":l.value,"is-dark":w.value},null,8,["map-container","is-dark"]),je(R1,{"is-dark":w.value,onToggle:Fe},null,8,["is-dark"]),je(ud,{"is-dark":w.value,"embed-path":"my-upg-100-list/upg-100-list/index.html"},null,8,["is-dark"]),je(Xo,{"is-dark":w.value,active:m.value,class:Ae({"upg-batch-on":m.value}),"aria-pressed":m.value?"true":"false",title:"Batch Select",onClick:L},{default:jt(()=>[...z[4]||(z[4]=[P("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[P("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),P("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),P("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),P("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})],-1)])]),_:1},8,["is-dark","active","class","aria-pressed"])]),_:1})):me("",!0),P("div",Fk,[p.value.length?(W(),rt(Iu,{key:0,nodes:p.value,tabs:U,columns:["count","pop"],title:Sd,"export-enabled":!0,onSelect:_e,onExport:Le},null,8,["nodes"])):me("",!0)]),P("div",Ok,[p.value.length?(W(),rt(A1,{key:0,"legend-type":"upg-100",nodes:p.value,columns:["count","pop"],"column-label":"UPG 100",title:Sd,"is-dark":w.value,"popup-action":"pray"},null,8,["nodes","is-dark"])):me("",!0)]),P("div",Dk,[be(i)&&be(i).selectedPeopleGroup?(W(),ee("div",{key:0,class:Ae(["upg-detail-panel pg-detail-root",{dark:w.value}])},[je(be(t),{peopleGroup:be(i).selectedPeopleGroup,dark:w.value,action:"pray"},null,8,["peopleGroup","dark"])],2)):me("",!0)]),m.value?(W(),ee("div",Bk,[z[5]||(z[5]=P("div",{class:"upg-hud-hint"}," Tap territories on the map or legend rows to add · tap again to remove ",-1)),k.value?(W(),ee("div",jk,[P("span",null,de(k.value)+" territor"+de(k.value===1?"y":"ies")+" ·",1),P("span",Gk,de(y.value)+" UUPG",1),P("span",{class:Ae(["upg-hud-band",{ok:y.value>=50&&y.value<=100}])},de(y.value>=50&&y.value<=100?"✓ 50–100 band":"band 50–100"),3)])):me("",!0),k.value?(W(),ee("div",Uk,de(d.value.map(le=>le.name).join(", ")),1)):me("",!0),k.value?(W(),ee("div",Kk,[(W(),ee($e,null,St(M,le=>P("button",{key:le,class:Ae(["upg-swatch",{active:I.value===le}]),"data-color":le,style:et({background:le}),title:le,onClick:Ce=>F(le)},null,14,zk)),64)),Sp(P("input",{"onUpdate:modelValue":z[0]||(z[0]=le=>C.value=le),class:"upg-hex",placeholder:"#hex",spellcheck:"false",onChange:H,onKeyup:os(H,["enter"])},null,544),[[af,C.value]])])):me("",!0),k.value?(W(),ee("div",Hk,[P("button",{class:"upg-hud-btn copy",onClick:N},"Copy selection"),P("button",{class:"upg-hud-btn clear",onClick:A},"Clear")])):me("",!0),k.value?(W(),ee("div",Vk,de(v.value),1)):me("",!0)])):me("",!0),P("div",Wk,de(c.value),1)])}}}},Symbol.toStringTag,{value:"Module"})),Zk=`
/* The column that scrolls. Vertical neighbours stack here and the user scrolls
between them; scroll-snap makes each pane settle cleanly instead of stopping
half-way between two views. */
diff --git a/public/doxa-maps/my-upg-100-list/poster-wall/index.html b/public/doxa-maps/my-upg-100-list/poster-wall/index.html
index 5a947b9d0..3bff1431f 100644
--- a/public/doxa-maps/my-upg-100-list/poster-wall/index.html
+++ b/public/doxa-maps/my-upg-100-list/poster-wall/index.html
@@ -29,7 +29,7 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+