2 lines
50 KiB
JavaScript
2 lines
50 KiB
JavaScript
var st=Object.defineProperty;var it=(e,t,n)=>t in e?st(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var he=(e,t,n)=>it(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&a(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();async function rt(){if(typeof caches>"u")return{ok:!1,cacheName:null,entry:null};let e;try{e=await caches.keys()}catch{return{ok:!1,cacheName:null,entry:null}}const t=e.filter(a=>a.startsWith("lumen-shell-")).sort().at(-1)??null;if(!t)return{ok:!1,cacheName:null,entry:null};let n;try{n=await caches.open(t)}catch{return{ok:!1,cacheName:t,entry:null}}for(const a of["/index.html","/"])try{if(await n.match(a))return{ok:!0,cacheName:t,entry:a}}catch{}return{ok:!1,cacheName:t,entry:null}}async function ot(){if(typeof navigator>"u"||!("serviceWorker"in navigator))return{status:"unsupported"};try{return{status:"registered",registration:await navigator.serviceWorker.register("/sw.js",{scope:"/"})}}catch(e){return{status:"failed",error:e}}}async function ct(){try{const e=navigator.storage;return e!=null&&e.estimate?await e.estimate()??null:null}catch{return null}}function lt(e){return e instanceof DOMException?e.name==="QuotaExceededError":typeof e=="object"&&e!==null&&(e.name==="QuotaExceededError"||e.code===22)?!0:String((e==null?void 0:e.message)??e).includes("QuotaExceededError")}function ge(e){return new Promise((t,n)=>{e.onsuccess=()=>{t(e.result)},e.onerror=()=>{n(e.error??new Error("IDB request failed"))}})}function ut(e){return new Promise((t,n)=>{e.oncomplete=()=>{t()},e.onerror=()=>{n(e.error??new Error("IDB transaction error"))},e.onabort=()=>{n(e.error??new Error("IDB transaction abort"))}})}function Re(e,t,n){return new Promise((a,s)=>{const i=indexedDB.open(e,t);i.onupgradeneeded=()=>{const r=i.result,o=i.transaction;o?n(r,i.result.version??dt(i),o):n(r,0,null)},i.onsuccess=()=>{a(i.result)},i.onerror=()=>{s(i.error??new Error("IDB open failed"))},i.onblocked=()=>{}})}function dt(e){return e.oldVersion??0}async function se(e,t,n,a){const s=Array.isArray(t)?t:[t],i=e.transaction(s,n);let r;try{r=await a(i)}catch(o){try{i.abort()}catch{}throw o}try{await ut(i)}catch(o){throw lt(o),o}return r}async function j(e,t,n){return se(e,t,"readonly",async a=>{const i=a.objectStore(t).get(n);return ge(i)})}async function mt(e,t){return se(e,t,"readonly",async n=>{const s=n.objectStore(t).getAll();return ge(s)})}async function Ze(e,t,n,a){await se(e,t,"readwrite",async s=>{const i=s.objectStore(t),r=a!==void 0?i.put(n,a):i.put(n);await ge(r)})}async function ft(e,t,n){await se(e,t,"readwrite",async a=>{const i=a.objectStore(t).delete(n);await ge(i)})}const de={SYSTEM:"lumen-system",SLOT_A:"lumen-slot-a",SLOT_B:"lumen-slot-b",USER:"lumen-user"};function pt(e){return e==="A"?de.SLOT_A:de.SLOT_B}const ee="meta",He="meta",te="files",Ae="assets",Se="staging",ne="favorites",me="prefs",Ie="diag",gt={activeSlot:null,activeEdition:null,activePackageVersion:null,verification:null,appVersionAtActivation:null,readbackPending:!1,clockSkew:null,bootCount:0},ht=1;function yt(e){e.objectStoreNames.contains(ee)||e.createObjectStore(ee)}function ie(){return Re(de.SYSTEM,ht,e=>{yt(e)})}async function Y(e){const t=await j(e,ee,He);if(!t)return{...gt};const n={...t};return delete n.staging,n}async function xe(e,t){await se(e,ee,"readwrite",async n=>{const s=n.objectStore(ee).put(t,He);await new Promise((i,r)=>{s.onsuccess=()=>{i()},s.onerror=()=>{r(s.error??new Error("IDB error"))}})})}async function Qe(e){const t=await Y(e);t.readbackPending&&await xe(e,{...t,readbackPending:!1})}const vt=2;function bt(e){e.objectStoreNames.contains(te)||e.createObjectStore(te),e.objectStoreNames.contains(Ae)||e.createObjectStore(Ae),e.objectStoreNames.contains(Se)||e.createObjectStore(Se)}function q(e){return Re(pt(e),vt,t=>{bt(t)})}const wt="journal";async function Z(e){return j(e,Se,wt)}async function fe(e,t){const n=await j(e,te,t);return n==null?void 0:n.json}async function ke(e,t){const n=await j(e,te,t);return n?{bytes:n.bytes,sha256:n.sha256}:void 0}const Et="manifest";async function Te(e){return await j(e,te,Et)??void 0}async function Xe(e,t){return j(e,Ae,t)}const At="lumen.package/1";function St(e,t,n){if(!t.includes(e.schemaVersion))return!1;const a=(s,i)=>{const r=s.split(".").map(c=>Number.parseInt(c,10)),o=i.split(".").map(c=>Number.parseInt(c,10));for(let c=0;c<3;c++){const l=r[c]??0,y=o[c]??0;if(l!==y)return l-y}return 0};return!(a(n,e.appCompatibility.minAppVersion)<0||e.appCompatibility.maxAppVersion!==null&&a(n,e.appCompatibility.maxAppVersion)>0)}const Ne={floor:!0,floorVersion:"1.0.0+3",emergencySchemaVersion:1,generatedAt:"2026-08-27T09:00:00Z",sourceContentVersion:3,services:{emergencyNumber:"911",security:{phone:"+1-555-0142",location:"Main Gate Kiosk"},firstAid:{location:"Behind Stage B",hours:"10:00–02:00"}},address:{lines:["123 Festival Way","Austin, TX 78701"],coordinates:{lat:30.2672,lon:-97.7431}},musterPoints:[{name:"North Field"}],exits:[{name:"East Gate"}],aedSummary:"AEDs: 1 locations",procedures:[{id:"weather",title:"Severe Weather",steps:["Seek shelter","Follow staff"]},{id:"medical",title:"Medical Emergency",steps:["Call 911","Locate first aid"]}]},kt=JSON.stringify(Ne),Me=new TextEncoder().encode(kt).length,Nt=16*1024;function I(e){return typeof e=="object"&&e!==null?e:null}function L(e){return typeof e=="string"&&e.trim().length>0}function Ct(e){const t=I(e),n=t&&I(t.services),a=n&&I(n.security),s=n&&I(n.firstAid),i=t&&I(t.address),r=i&&I(i.coordinates);return!!((t==null?void 0:t.floor)===!0&&L(t.floorVersion)&&Number.isInteger(t.emergencySchemaVersion)&&t.emergencySchemaVersion>=1&&L(t.generatedAt)&&!Number.isNaN(Date.parse(t.generatedAt))&&Number.isInteger(t.sourceContentVersion)&&t.sourceContentVersion>=1&&n&&L(n.emergencyNumber)&&a&&L(a.phone)&&s&&L(s.location)&&i&&Array.isArray(i.lines)&&i.lines.every(L)&&r&&typeof r.lat=="number"&&Number.isFinite(r.lat)&&typeof r.lon=="number"&&Number.isFinite(r.lon)&&Array.isArray(t.musterPoints)&&t.musterPoints.every(o=>{var c;return L((c=I(o))==null?void 0:c.name)})&&Array.isArray(t.exits)&&t.exits.every(o=>{var c;return L((c=I(o))==null?void 0:c.name)})&&L(t.aedSummary)&&Array.isArray(t.procedures)&&t.procedures.every(o=>{const c=I(o);return!!(c&&L(c.id)&&L(c.title)&&Array.isArray(c.steps)&&c.steps.every(L))}))}function Le(){return Me>Nt?{ok:!1,reason:"compiled emergency floor exceeds 16KB"}:Ct(Ne)?{ok:!0,floor:Ne,bytes:Me}:{ok:!1,reason:"compiled emergency floor is malformed"}}const Ot=10080*60*1e3,Ue=["emergency","schedule","map","info","assets"];async function Ce(e,t){if(!(t!=null&&t.complete)||!Ue.every(a=>t.stagedFiles.includes(a)))return!1;const n=await q(e);for(const a of Ue)if(!await ke(n,a))return n.close(),!1;for(const a of t.stagedAssets)if(!await Xe(n,a))return n.close(),!1;return n.close(),!0}async function Pt(){var r,o;const e=await ie(),t=await Y(e);if(!t.activeSlot)return e.close(),!1;const n=t.activeSlot==="A"?"B":"A",a=await q(n),s=await Z(a);if(a.close(),!await Ce(n,s)||!s)return e.close(),!1;const i={...t,activeSlot:n,activeEdition:s.edition,activePackageVersion:s.packageVersion,verification:{packageVersion:s.packageVersion,edition:s.edition,manifestSha256:s.manifestSha256,publicKeyFingerprint:s.publicKeyFingerprint??((r=t.verification)==null?void 0:r.publicKeyFingerprint)??"",verifiedAt:s.verifiedAt??((o=t.verification)==null?void 0:o.verifiedAt)??Date.now(),appVersionAtActivation:t.appVersionAtActivation??""},readbackPending:!0};return await xe(e,i),await Qe(e),e.close(),!0}async function Vt(){var o,c;const e=await ie(),t=await Y(e);if(!t.readbackPending||!t.activeSlot)return e.close(),!0;const n=await q(t.activeSlot),a=await Z(n);if(n.close(),await Ce(t.activeSlot,a))return await Qe(e),e.close(),!0;const s=t.activeSlot==="A"?"B":"A",i=await q(s),r=await Z(i);return i.close(),!await Ce(s,r)||!r?(e.close(),!1):(await xe(e,{...t,activeSlot:s,activeEdition:r.edition,activePackageVersion:r.packageVersion,verification:{packageVersion:r.packageVersion,edition:r.edition,manifestSha256:r.manifestSha256,publicKeyFingerprint:r.publicKeyFingerprint??((o=t.verification)==null?void 0:o.publicKeyFingerprint)??"",verifiedAt:r.verifiedAt??((c=t.verification)==null?void 0:c.verifiedAt)??Date.now(),appVersionAtActivation:t.appVersionAtActivation??""},readbackPending:!1}),e.close(),!0)}const Dt="0.1.0",Rt=[1,2],ae=["emergency","schedule","info","map","assets"],xt=["emergency","schedule"];function Tt(e){return ae.every(t=>e.includes(t))?"L2":xt.every(t=>e.includes(t))?"L1":"L0"}function W(e){const t=Tt(e.presentSections);return e.failure?{state:"FAILED",reason:null,missing:[...e.missing],failedOp:e.failure.op,level:t}:e.emergencyFloorOk?e.shellValid?e.datasetPresent?e.integrity==="files-missing"?{state:"RECOVERY",reason:"missing",missing:[...e.missing],failedOp:null,level:t}:e.integrity==="corrupt"?{state:"RECOVERY",reason:"corrupt",missing:[...e.missing],failedOp:null,level:t}:e.authenticity==="mismatch"?{state:"RECOVERY",reason:"corrupt",missing:[...e.missing],failedOp:null,level:t}:e.manifestOk&&(!e.schemaCompatible||e.incompatible)?{state:"RECOVERY",reason:"incompatible",missing:[...e.missing],failedOp:null,level:t}:e.authenticity==="record-missing"?{state:"PARTIAL",reason:null,missing:["verification",...e.missing],failedOp:null,level:t}:e.manifestOk?!e.requiredSectionsOk||!e.requiredAssetsOk?{state:"PARTIAL",reason:null,missing:[...e.missing],failedOp:null,level:t}:{state:"READY",reason:null,missing:[],failedOp:null,level:t}:{state:"PARTIAL",reason:null,missing:e.missing.includes("manifest")?[...e.missing]:["manifest",...e.missing],failedOp:null,level:t}:e.hadVerifiedDataset?{state:"RECOVERY",reason:"missing",missing:["dataset"],failedOp:null,level:t}:e.stagedPending?{state:"PARTIAL",reason:null,missing:[...e.stagedPending.missing],failedOp:null,level:t}:{state:"NOT_READY",reason:null,missing:[...e.missing],failedOp:null,level:t}:e.datasetPresent?{state:"PARTIAL",reason:null,missing:["shell-cache",...e.missing],failedOp:null,level:t}:{state:"NOT_READY",reason:null,missing:[...e.missing],failedOp:null,level:t}:{state:"FAILED",reason:null,missing:[...e.missing],failedOp:"emergency-floor",level:t}}function Lt(e,t){switch(e){case"READY":return{text:"OFFLINE READY ✓",tone:"ready",label:"Offline status: ready. All festival data is verified on this device."};case"PARTIAL":return{text:"PARTIAL",tone:"partial",label:`Offline status: partial. Missing: ${t??"some required data"}.`};case"NOT_READY":return{text:"Get festival data",tone:"neutral",label:"Offline status: not ready. Open with internet to get festival data."};case"RECOVERY":return{text:`RECOVERY — ${t??"data missing"}`,tone:"recovery",label:`Offline status: recovery needed (${t??"data missing"}). Emergency info still available.`};case"BASELINE_ONLY":return{text:"SAVING UNAVAILABLE",tone:"baseline",label:"Offline status: this browser cannot save offline data. Emergency info still available."};case"FAILED":return{text:`FAILED — ${t??"error"}`,tone:"failed",label:`Offline status: operation failed (${t??"error"}). Emergency info still available.`}}}const _t={openSystem:ie,openSlot:q,checkShell:rt,loadFloor:()=>{const e=Le();return e.ok?{ok:!0,version:e.floor.floorVersion,bytes:e.bytes}:{ok:!1,version:null,bytes:0}},estimate:ct,appVersion:Dt,supportedSchemaRange:Rt,now:()=>Date.now()};function pe(e,t,n){return{...W({shellValid:!1,datasetPresent:!1,authenticity:"record-missing",integrity:"files-missing",schemaCompatible:!1,requiredSectionsOk:!1,requiredAssetsOk:!1,emergencyFloorOk:t.ok,missing:[],hadVerifiedDataset:!1,manifestOk:!1,incompatible:!1,failure:{op:e},presentSections:[],stagedPending:null}),edition:null,packageVersion:null,generatedAt:null,fetchedAt:null,sections:[],assets:{total:0,present:0,missing:[]},floorVersion:t.version,storage:n,shellCache:null,canRestore:!1,activationPending:!1}}function $t(e,t){return{state:"BASELINE_ONLY",reason:null,missing:[],failedOp:null,level:"L0",edition:null,packageVersion:null,generatedAt:null,fetchedAt:null,sections:[],assets:{total:0,present:0,missing:[]},floorVersion:e.version,storage:t,shellCache:null,canRestore:!1,activationPending:!1}}function Ft(e){if(typeof e!="object"||e===null)return[];const t=e.assets;return Array.isArray(t)?t.map(n=>{const a=n;return typeof a.id=="string"&&typeof a.bytes=="number"?{id:a.id,bytes:a.bytes}:null}).filter(n=>n!==null):[]}function It(e,t){return(e==null?void 0:e.format)===At&&e.edition===t.edition&&e.packageVersion===t.packageVersion}async function Be(e,t){try{const n=await e(t);try{const a=await Z(n);return!!(a!=null&&a.complete&&ae.every(s=>a.stagedFiles.includes(s)))}finally{n.close()}}catch{return!1}}async function Mt(e,t){for(const n of["A","B"])try{const a=await e(n);try{const s=await Z(a);if(s&&t-s.lastProgressAt<=Ot)return{slot:n,staged:s.stagedFiles,complete:s.complete}}finally{a.close()}}catch{}return null}async function Ut(e=_t){const t=e.loadFloor();let n=null;try{n=await e.estimate()}catch{n=null}try{return await Bt(e,t,n)}catch{return pe("boot-check",t,n)}}async function Bt(e,t,n){const a=await e.checkShell().catch(()=>({ok:!1,cacheName:null}));let s;try{s=await e.openSystem()}catch{return $t(t,n)}try{let i=await Y(s);if(i.readbackPending)try{await Vt();const c=await e.openSystem();s.close(),s=c,i=await Y(s)}catch{return{...pe("boot-check",t,n),shellCache:a.cacheName}}if(!i.activeSlot)return await Kt(e,t,n,a,i.verification!==null);const r=i.activeSlot;let o;try{o=await e.openSlot(r)}catch{return{...pe("boot-check",t,n),shellCache:a.cacheName}}try{return await Yt(e,t,n,a,i,o,r)}finally{o.close()}}finally{s.close()}}async function Kt(e,t,n,a,s){if(s)return{...W(oe(t,a,{datasetPresent:!1,hadVerifiedDataset:!0})),edition:null,packageVersion:null,generatedAt:null,fetchedAt:null,sections:[],assets:{total:0,present:0,missing:[]},floorVersion:t.version,storage:n,shellCache:a.cacheName,canRestore:!1,activationPending:!1};const i=await Mt(e.openSlot,e.now());if(i){const o=ae.filter(l=>!i.staged.includes(l));return{...W(oe(t,a,{datasetPresent:!1,hadVerifiedDataset:!1,requiredSectionsOk:i.complete&&o.length===0,requiredAssetsOk:i.complete&&o.length===0,missing:o,presentSections:[...i.staged],stagedPending:{missing:o}})),edition:null,packageVersion:null,generatedAt:null,fetchedAt:null,sections:[],assets:{total:0,present:0,missing:[]},floorVersion:t.version,storage:n,shellCache:a.cacheName,canRestore:!1,activationPending:i.complete&&o.length===0}}return{...W(oe(t,a,{datasetPresent:!1,hadVerifiedDataset:!1})),edition:null,packageVersion:null,generatedAt:null,fetchedAt:null,sections:[],assets:{total:0,present:0,missing:[]},floorVersion:t.version,storage:n,shellCache:a.cacheName,canRestore:!1,activationPending:!1}}function oe(e,t,n){return{shellValid:t.ok,datasetPresent:!1,authenticity:"record-missing",integrity:"files-missing",schemaCompatible:!1,requiredSectionsOk:!1,requiredAssetsOk:!1,emergencyFloorOk:e.ok,missing:[],hadVerifiedDataset:!1,manifestOk:!0,incompatible:!1,failure:null,presentSections:[],stagedPending:null,...n}}async function Yt(e,t,n,a,s,i,r){const o=m=>({...pe(m,t,n),shellCache:a.cacheName});let c,l;try{c=await Z(i),l=await Te(i)}catch{return o("boot-check")}const y=s.verification,f=[],x=[],b=[];if(!c){let m=!1;for(const v of ae)try{if(await ke(i,v)){m=!0;break}}catch{return o("boot-check")}return{...W(oe(t,a,{datasetPresent:!0,authenticity:"mismatch",integrity:m?"corrupt":"files-missing",hadVerifiedDataset:!0,presentSections:[]})),edition:s.activeEdition,packageVersion:s.activePackageVersion,generatedAt:null,fetchedAt:null,sections:[],assets:{total:0,present:0,missing:[]},floorVersion:t.version,storage:n,shellCache:a.cacheName,canRestore:await Be(e.openSlot,r==="A"?"B":"A"),activationPending:!1}}let V="verified";y?(c.edition!==s.activeEdition||c.packageVersion!==s.activePackageVersion||c.manifestSha256!==y.manifestSha256)&&(V="mismatch"):V="record-missing";const E=It(l,c);let N="ok",p=!0;if(E&&l){const m=l.sections;for(const u of ae){const v=m[u],k=(v==null?void 0:v.required)!==!1;let P=!1,G=!1;try{const B=await ke(i,u);if(P=!!(B&&(!v||B.bytes===v.bytes)),B&&v&&B.bytes!==v.bytes&&(N="corrupt"),!B)k&&(N=N==="ok"?"files-missing":N);else{const H=await fe(i,u);G=typeof H=="object"&&H!==null}}catch{return o("boot-check")}P&&b.push(u),x.push({id:u,required:k,present:P,parseable:G}),k&&(!P||!G)&&(p=!1,f.includes(u)||f.push(u))}}else p=!1,f.includes("manifest")||f.push("manifest");let S=!0;const C=[];let D=0,A=0;if(E)try{const m=await fe(i,"assets"),u=Ft(m);D=u.length;for(const v of u){const k=await Xe(i,v.id);(k==null?void 0:k.bytes)===v.bytes?A+=1:(S=!1,C.push(`asset:${v.id}`),k&&k.bytes!==v.bytes?N="corrupt":N==="ok"&&(N="files-missing"))}}catch{return o("boot-check")}f.push(...C);let O=!1,U=!1;E&&l&&(O=St(l,e.supportedSchemaRange,e.appVersion),U=!O);const $={shellValid:a.ok,datasetPresent:!0,authenticity:V,integrity:N,schemaCompatible:O,requiredSectionsOk:p,requiredAssetsOk:S,emergencyFloorOk:t.ok,missing:f,hadVerifiedDataset:!0,manifestOk:E,incompatible:U,failure:null,presentSections:b,stagedPending:null};return{...W($),edition:s.activeEdition,packageVersion:s.activePackageVersion,generatedAt:E&&l?l.generatedAt:null,fetchedAt:c.verifiedAt??c.lastProgressAt,sections:x,assets:{total:D,present:A,missing:C},floorVersion:t.version,storage:n,shellCache:a.cacheName,canRestore:await Be(e.openSlot,r==="A"?"B":"A"),activationPending:!1}}const qt=[1];function ce(e){return typeof e=="object"&&e!==null?e:null}function Oe(e){return typeof e=="string"&&e.trim().length>0}function Je(e){const t=ce(e);if((t==null?void 0:t.section)!=="emergency")return null;const n=t.emergencySchemaVersion;return typeof n!="number"||!Number.isInteger(n)||n<1||t.services!==void 0&&!ce(t.services)||t.procedures!==void 0&&(!Array.isArray(t.procedures)||!t.procedures.every(a=>{const s=ce(a);return!!(s&&Oe(s.id)&&Oe(s.title)&&Array.isArray(s.steps))}))?null:e}function jt(e,t){var i,r,o;const n=e,a=ce(n.services),s=a==null?void 0:a.emergencyNumber;return{...e,services:{emergencyNumber:Oe(s)?s:t.services.emergencyNumber,security:((i=n.services)==null?void 0:i.security)??t.services.security,firstAid:((r=n.services)==null?void 0:r.firstAid)??t.services.firstAid},address:n.address??t.address,procedures:(o=n.procedures)!=null&&o.length?n.procedures:t.procedures}}function Gt(e,t=Date.now()){var n;return(n=e.notices)!=null&&n.length?{...e,notices:e.notices.filter(a=>(a.expiresAtUtc??1/0)>t)}:e}function Pe(e,t=Date.now()){const n=Le();if(!n.ok)throw new Error(n.reason);if(e===void 0)return le("no-dataset",n.floor);if(!et(e.emergencySchemaVersion))return le("unsupported-schema",n.floor);const a=Je(e.section);if((a==null?void 0:a.emergencySchemaVersion)!==e.emergencySchemaVersion)return le("malformed-section",n.floor);const s=Gt(jt(a,n.floor),t);return{source:"dataset",provenance:`FESTIVAL DATA v${String(e.packageVersion)} · generated ${e.generatedAt}`+(typeof a.updatedAt=="string"&&a.updatedAt!==e.generatedAt?` · updated ${a.updatedAt}`:""),floor:n.floor,section:s,demotion:null}}function et(e){return typeof e=="number"&&qt.includes(e)}function le(e,t){const n=t??zt();return{source:"baseline",provenance:`BASELINE v${n.floorVersion}`,floor:n,section:null,demotion:e}}function zt(){const e=Le();if(!e.ok)throw new Error(e.reason);return e.floor}async function Wt(){try{const e=await ie();let t,n;try{const s=await Y(e);t=s.activeSlot,n=s.activePackageVersion}finally{e.close()}if(!t||n===null)return{status:"absent"};const a=await q(t);try{const s=await fe(a,"emergency"),i=Je(s);if(!i)return{status:"unusable",reason:"malformed-section"};if(!et(i.emergencySchemaVersion))return{status:"unusable",reason:"unsupported-schema"};const r=await Te(a).catch(()=>{});return{status:"ready",data:{section:i,packageVersion:n,generatedAt:(r==null?void 0:r.generatedAt)??"unknown date",emergencySchemaVersion:i.emergencySchemaVersion}}}finally{a.close()}}catch{return{status:"absent"}}}const Zt=1;function Ht(e){e.objectStoreNames.contains(ne)||e.createObjectStore(ne),e.objectStoreNames.contains(me)||e.createObjectStore(me),e.objectStoreNames.contains(Ie)||e.createObjectStore(Ie)}function Ve(){return Re(de.USER,Zt,e=>{Ht(e)})}async function Qt(e,t){await Ze(e,ne,t,t.eventId)}async function Xt(e,t){await ft(e,ne,t)}async function Jt(e){return mt(e,ne)}const tt="prefs";async function en(e){return j(e,me,tt)}async function tn(e,t){await Ze(e,me,t,tt)}function nn(e){return typeof e=="object"&&e!==null?e:null}function an(e){const t=nn(e);return(t==null?void 0:t.section)!=="schedule"||!Array.isArray(t.stages)||!Array.isArray(t.artists)||!Array.isArray(t.events)?null:e}async function sn(){var e;try{const t=await ie();let n,a;try{const c=await Y(t);n=c.activeSlot,a=c.clockSkew}finally{t.close()}if(!n)return null;const s=await q(n);let i=null,r=null;try{i=an(await fe(s,"schedule"));const c=await Te(s).catch(()=>{});c&&typeof((e=c.festival)==null?void 0:e.timezone)=="string"&&(r={timezone:c.festival.timezone,startUtc:c.festival.startUtc,endUtc:c.festival.endUtc})}finally{s.close()}if(!i||!r)return null;const o=await Ve();try{return{section:i,window:r,favorites:await Jt(o),prefs:await en(o),skew:a}}finally{o.close()}}catch{return null}}const rn=45,on=24*3600*1e3;function nt(e,t){return new Intl.DateTimeFormat("en-US",{timeZone:t,weekday:"short",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function Ke(e,t){return new Intl.DateTimeFormat("en-US",{timeZone:t,weekday:"long",month:"long",day:"numeric"}).format(new Date(e))}function cn(e,t){return new Intl.DateTimeFormat("en-US",{timeZone:t,hour:"numeric",minute:"2-digit"}).format(new Date(e))}function ln(){try{return new Intl.DateTimeFormat().resolvedOptions().timeZone??"UTC"}catch{return"UTC"}}function un(e,t){return t?e+t.skewMs:e}function dn(e,t,n,a=12e4){const s=e+t;return Math.abs(n-s)>a}function mn(e,t,n,a={windowDays:rn}){const s=a.windowDays*on;return e<t.startUtc-s||e>t.endUtc+s?e>=t.startUtc-s||n!==null:!1}function fn(e,t,n){const a=n??{baseDevice:e.deviceNow,baseMono:e.monoNow},s=dn(a.baseDevice,e.monoNow-a.baseMono,e.deviceNow),i=s?{baseDevice:e.deviceNow,baseMono:e.monoNow}:a;return{now:un(e.deviceNow,t),driftWarn:s,session:i}}let Ye=null;function pn(e,t){const n=fn(e,t,Ye);return Ye=n.session,n}function gn(){return{deviceNow:Date.now(),monoNow:performance.now()}}function re(e){return[...e].sort((t,n)=>t.startUtc-n.startUtc||t.title.localeCompare(n.title))}function hn(e){const t=new Map;for(const n of e.events){const a=t.get(n.dayKey)??[];a.push(n),t.set(n.dayKey,a)}return[...t.entries()].map(([n,a])=>{var i;const s=re(a);return{dayKey:n,anchorUtc:((i=s[0])==null?void 0:i.startUtc)??0,events:s}}).sort((n,a)=>n.dayKey<a.dayKey?-1:n.dayKey>a.dayKey?1:0)}function yn(e,t){return re(e.filter(n=>n.startUtc<=t&&t<n.endUtc))}function vn(e,t,n=3){return re(e.filter(a=>a.startUtc>t)).slice(0,Math.max(0,n))}function bn(e,t,n){var o;const a=n.trim().toLowerCase();if(!a)return!0;const s=((o=t.stages.find(c=>c.id===e.stageId))==null?void 0:o.name)??"",i=(e.artistIds??[]).map(c=>{var l;return((l=t.artists.find(y=>y.id===c))==null?void 0:l.name)??""}).join(" ");return`${e.title} ${i} ${e.description??""} ${s}`.toLowerCase().includes(a)}function wn(e,t){const n=t.query??"";return re(e.events.filter(a=>{var s;return!(t.dayKey!==void 0&&a.dayKey!==t.dayKey||t.stageId!==void 0&&a.stageId!==t.stageId||t.tag!==void 0&&!(a.tags??[]).includes(t.tag)||t.statuses!==void 0&&!t.statuses.includes(a.status)||t.favoritesOnly&&!(((s=t.favoriteIds)==null?void 0:s.has(a.id))??!1)||!bn(a,e,n))}))}function En(e){const t=re(e.filter(a=>a.status!=="cancelled")),n=[];for(let a=0;a<t.length;a++){const s=t[a];if(s)for(let i=a+1;i<t.length;i++){const r=t[i];if(!r||r.startUtc>=s.endUtc)break;n.push([s,r])}}return n}function qe(e,t){var n;return((n=e.stages.find(a=>a.id===t))==null?void 0:n.name)??t}function An(e,t){return t.map(n=>{var a;return((a=e.artists.find(s=>s.id===n))==null?void 0:a.name)??n}).join(", ")}function Sn(e){const t=new Set;for(const n of e.events)for(const a of n.tags??[])t.add(a);return[...t].sort((n,a)=>n.localeCompare(a))}function kn(e){return e?e.status:"orphan"}function Nn(e,t){const n=new Map(e.events.map(a=>[a.id,a]));return[...t].map(a=>{const s=n.get(a.eventId);return{fav:a,event:s,status:kn(s)}}).sort((a,s)=>{var i,r;return(((i=a.event)==null?void 0:i.startUtc)??Number.MAX_SAFE_INTEGER)-(((r=s.event)==null?void 0:r.startUtc)??Number.MAX_SAFE_INTEGER)})}function Cn(e){return En(e.flatMap(t=>t.event?[t.event]:[]))}function _(e,t){const n=document.createElement(e);return n.textContent=t,n}function On(e,t){return`${nt(e.startUtc,t)} – ${cn(e.endUtc,t)}`}function Pn(e,t){if(e.status==="scheduled")return null;const n=document.createElement("span");return n.className=`schedule-badge schedule-badge--${e.status}`,e.status==="moved"&&e.originalStartUtc!==void 0?n.textContent=`Moved (was ${nt(e.originalStartUtc,t)})`:n.textContent=e.status==="moved"?"Moved":"Cancelled",n}function ye(e,t,n,a,s){const i=document.createElement("article");i.className="schedule-item",i.setAttribute("data-event-id",e.id);const r=document.createElement("h2");r.textContent=e.title,i.append(r),i.append(_("p",On(e,n)));const o=An(t,e.artistIds);i.append(_("p",o?`${qe(t,e.stageId)} · ${o}`:qe(t,e.stageId))),e.description&&i.append(_("p",e.description));const c=Pn(e,n);c&&i.append(c);const l=document.createElement("button");l.type="button",l.className="schedule-fav",l.setAttribute("aria-pressed",String(a)),l.setAttribute("aria-label",a?`Remove ${e.title} from My Schedule`:`Add ${e.title} to My Schedule`),l.textContent=a?"★":"☆";const y=f=>{l.setAttribute("aria-pressed",String(f)),l.textContent=f?"★":"☆",l.setAttribute("aria-label",f?`Remove ${e.title} from My Schedule`:`Add ${e.title} to My Schedule`)};return l.addEventListener("click",()=>{const f=l.getAttribute("aria-pressed")!=="true";y(f),s(e.id,f)}),i.append(l),i}function Vn(e,t){var G,B,H;const n=document.createElement("section");n.className="schedule-view",n.setAttribute("aria-labelledby","schedule-heading");const a=document.createElement("h1");if(a.id="schedule-heading",a.textContent="Schedule",n.append(a),!e){const g=document.createElement("div");return g.className="view-placeholder",g.append(_("p","The schedule isn't on this device yet.")),g.append(_("p","Open with internet to get festival data — the emergency floor always works meanwhile.")),n.append(g),n}const{section:s,clock:i}=e,r=new Set(e.favorites),o={day:null,stage:null,tag:null,query:"",mine:!1};if(i.outsideWarn||i.driftWarn){const g=_("p",i.driftWarn?"The device clock changed mid-session — times re-anchored. Event times below are absolute.":"The device clock looks off — Now/Next may be wrong, but the absolute event times below still read fine.");g.className="schedule-warning",g.setAttribute("role","status"),n.append(g)}const c=document.createElement("section");c.setAttribute("aria-labelledby","schedule-now-heading");const l=document.createElement("h2");l.id="schedule-now-heading",l.textContent="Now & Next",c.append(l);const y=document.createElement("div");y.className="schedule-live",c.append(y),n.append(c);const f=document.createElement("div");f.className="schedule-controls";const x=hn(s);o.day??(o.day=((G=x.find(g=>g.events.some(h=>h.startUtc<=i.now&&i.now<h.endUtc)))==null?void 0:G.dayKey)??((B=x.find(g=>g.events.some(h=>h.startUtc>i.now)))==null?void 0:B.dayKey)??((H=x[0])==null?void 0:H.dayKey)??null);const b=document.createElement("div");b.className="schedule-days",b.setAttribute("role","group"),b.setAttribute("aria-label","Festival days");const V=new Map;for(const g of x){const h=document.createElement("button");h.type="button",h.className="schedule-day",h.textContent=Ke(g.anchorUtc,i.zone),h.setAttribute("aria-pressed",String(o.day===g.dayKey)),h.addEventListener("click",()=>{o.day=g.dayKey;for(const[z,F]of V)F.setAttribute("aria-pressed",String(z===g.dayKey));P()}),V.set(g.dayKey,h),b.append(h)}f.append(b);const E=document.createElement("select");E.setAttribute("aria-label","Filter by stage");const N=document.createElement("option");N.value="",N.textContent="All stages",E.append(N);for(const g of s.stages){const h=document.createElement("option");h.value=g.id,h.textContent=g.name,E.append(h)}E.addEventListener("change",()=>{o.stage=E.value||null,P()}),f.append(E);const p=document.createElement("div");p.className="schedule-tags",p.setAttribute("role","group"),p.setAttribute("aria-label","Filter by tag");const S=new Map,C=()=>{for(const[g,h]of S)h.setAttribute("aria-pressed",String(g===(o.tag??"")))},D=document.createElement("button");D.type="button",D.className="schedule-tag",D.textContent="All",D.addEventListener("click",()=>{o.tag=null,C(),P()}),S.set("",D),p.append(D);for(const g of Sn(s)){const h=document.createElement("button");h.type="button",h.className="schedule-tag",h.textContent=g,h.addEventListener("click",()=>{o.tag=o.tag===g?null:g,C(),P()}),S.set(g,h),p.append(h)}C(),f.append(p);const A=document.createElement("input");A.type="search",A.setAttribute("aria-label","Search schedule"),A.placeholder="Search artists, titles, stages…",A.addEventListener("input",()=>{o.query=A.value,P()}),f.append(A);const O=document.createElement("button");O.type="button",O.className="schedule-mine";const U=()=>{O.setAttribute("aria-pressed",String(o.mine)),O.textContent=`★ Mine (${String(r.size)})`};O.addEventListener("click",()=>{o.mine=!o.mine,U(),P()}),U(),f.append(O);const $=document.createElement("button");$.type="button",$.className="schedule-zone",$.textContent=i.useDeviceZone?"Showing device time":"Showing festival time",$.addEventListener("click",()=>{t.onZoneToggle(!i.useDeviceZone)}),f.append($),n.append(f);const d=document.createElement("div");d.className="schedule-list",n.append(d);const m=(g,h)=>{h?r.add(g):r.delete(g),U(),Promise.resolve(t.onToggleFavorite(g,h)).catch(()=>{}),v()},u=document.createElement("p");u.className="schedule-conflicts",u.setAttribute("role","status");const v=()=>{const g=Nn(s,[...r].map(F=>({eventId:F,addedAt:0}))),h=Cn(g),z=h[0];if(o.mine&&z){const[F,Q]=z;u.textContent=`Overlap in My Schedule: ${F.title} × ${Q.title}${h.length>1?` (+${String(h.length-1)} more)`:""}`}else u.textContent=""};n.append(u);function k(){return{...o.day?{dayKey:o.day}:{},...o.stage?{stageId:o.stage}:{},...o.tag?{tag:o.tag}:{},...o.query?{query:o.query}:{},...o.mine?{favoritesOnly:!0,favoriteIds:r}:{}}}function P(){var Fe;const g=k(),h=wn(s,g),z=o.stage?s.events.filter(T=>T.stageId===o.stage):s.events,F=yn(s.events,i.now),Q=vn(z,i.now,3);if(y.replaceChildren(),F.length>0){y.append(_("h3","On now"));for(const T of F)y.append(ye(T,s,i.zone,r.has(T.id),m))}if(Q.length>0){y.append(_("h3",o.stage?"Next on this stage":"Up next"));for(const T of Q)y.append(ye(T,s,i.zone,r.has(T.id),m))}if(F.length===0&&Q.length===0&&y.append(_("p","Nothing scheduled around this time.")),d.replaceChildren(),h.length===0){d.append(_("p",o.mine?"No favorites yet — tap ☆ on any event.":"No events match these filters."));return}const at=o.day??((Fe=x[0])==null?void 0:Fe.dayKey),$e=x.find(T=>T.dayKey===at);$e&&!o.mine&&!o.query&&d.append(_("h2",Ke($e.anchorUtc,i.zone)));for(const T of h)d.append(ye(T,s,i.zone,r.has(T.id),m));v()}return P(),v(),n}const ue={id:"home",path:"/",label:"Home",title:"Home"},_e=[{id:"emergency",path:"/emergency",label:"Emergency",title:"Emergency"},{id:"schedule",path:"/schedule",label:"Schedule",title:"Schedule"},{id:"map",path:"/map",label:"Map",title:"Map"},{id:"festival",path:"/festival",label:"Information",title:"Information"}],Dn=new Map([ue,..._e].map(e=>[e.path,e.id]));function J(e){var n;let t=((n=e.split("?")[0])==null?void 0:n.split("#")[0])??"/";return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function De(e){const t=J(e);return Dn.get(t)??"not-found"}class Rn{constructor(t){he(this,"listeners",new Set);he(this,"currentPath");this.currentPath=J(t??(typeof location<"u"?location.pathname:"/emergency"))}getPath(){return this.currentPath}getRouteId(){return De(this.currentPath)}navigate(t,n={}){const a=J(t);a!==this.currentPath&&(this.currentPath=a,typeof history<"u"&&(n.replace?history.replaceState(null,"",a):history.pushState(null,"",a)),this.emit())}listen(t){return this.listeners.add(t),()=>this.listeners.delete(t)}attach(){const t=()=>{this.currentPath=J(typeof location<"u"?location.pathname:"/emergency"),this.emit()};return typeof window<"u"&&window.addEventListener("popstate",t),()=>{typeof window<"u"&&window.removeEventListener("popstate",t)}}emit(){const t=De(this.currentPath);for(const n of this.listeners)n(t,this.currentPath)}}function xn(){const e=document.createElement("div");e.id="lumen-shell";const t=document.createElement("a");t.href="#main-content",t.className="skip-link",t.textContent="Skip to content",e.append(t);const n=document.createElement("header");n.className="app-header",n.setAttribute("role","banner");const a=document.createElement("a");a.href=ue.path,a.className="app-header__brand",a.setAttribute("aria-label","Lumen — home"),a.setAttribute("data-route",ue.path),a.textContent="LUMEN",n.append(a);const s=document.createElement("div");s.className="app-header__status",s.setAttribute("role","status"),s.setAttribute("aria-live","polite"),s.setAttribute("aria-label","Offline status"),s.textContent="—",n.append(s),e.append(n);const i=document.createElement("main");i.id="main-content",i.className="app-main",i.setAttribute("tabindex","-1");const r=document.createElement("img");r.src="/sol_lunar_icon.svg?v=4",r.alt="",r.className="app-main__icon",i.prepend(r),e.append(i);const o=document.createElement("nav");o.className="side-nav",o.setAttribute("aria-label","Primary navigation"),o.setAttribute("role","navigation");for(const c of[ue,..._e]){const l=document.createElement("a");l.href=c.path,l.setAttribute("data-route",c.path),l.className=c.id==="emergency"?"side-nav__link side-nav__link--emergency":"side-nav__link",l.setAttribute("aria-label",c.label),l.textContent=c.label,o.append(l)}return e.append(o),{root:e,main:i,nav:o,brand:a,statusChip:s,skipLink:t}}function Tn(e,t){for(const n of e.querySelectorAll("a[data-route]")){const a=n.getAttribute("data-route");a==="/"&&t==="home"||a==="/emergency"&&t==="emergency"||a==="/schedule"&&t==="schedule"||a==="/map"&&t==="map"||a==="/festival"&&t==="festival"?n.setAttribute("aria-current","page"):n.removeAttribute("aria-current")}}const K={dates:"October 8-12, 2026",venue:"Son's Blue River Camp",location:"2769 Sherrill Rd, Kingsbury, TX 78638",mission:"A five-day gathering exploring regenerative culture, technology, consciousness, and community.",themes:[["Air","Communication, personal development, authentic relating, and networking."],["Earth","Regenerative culture, permaculture, sustainable practices, and alternative governance."],["Fire","Innovation, entrepreneurship, and technology."],["Water","Consciousness, spirituality, and integration."]],passes:["Full Access: $280 listed sale price","Steward Pass: $868+","Team Pass: $283 per person for groups of 3+","Single Day: $118 | Kids: $23 | Teen: $38","Volunteer: $174 | Parking: $59"],guidance:["All ages are welcome; guests under 18 need a parent or legal guardian.","Pack reusable containers and pack out all waste under the Leave No Trace policy.","Non-service animals are not permitted at the venue.","No alcohol is sold at the summit.","Drones are prohibited without written permission."],source:"https://solarpunksummit.com/"};function je(e,t,n){const a=document.createElement(t);a.textContent=n,e.append(a)}function ve(e,t,n){je(e,"h2",t);const a=document.createElement("ul");for(const s of n)je(a,"li",s);e.append(a)}function Ln(){const e=document.createElement("section");e.className="home-view",e.setAttribute("aria-labelledby","home-heading");const t=document.createElement("h1");t.id="home-heading",t.textContent="Lumen",e.append(t);const n=document.createElement("p");n.className="home-view__subtitle",n.textContent=`${K.dates} | ${K.venue}, ${K.location.split(", ").slice(1).join(", ")}`,e.append(n);const a=document.createElement("div");a.className="home-grid";for(const s of _e){const i=document.createElement("a");i.className=`home-tile${s.id==="emergency"?" home-tile--emergency":""}`,i.href=s.path,s.external&&(i.rel="noopener noreferrer"),i.setAttribute("data-route",s.path),i.setAttribute("aria-label",s.label),i.textContent=s.label,a.append(i)}return e.append(a),e}function R(e,t){const n=document.createElement(e);return n.textContent=t,n}function M(e,t,n=!1){const a=document.createElement("button");return a.type="button",a.className=n?"status-action status-action--primary":"status-action",a.textContent=e,a.addEventListener("click",t),a}function Ge(e){return e===void 0?"unknown":e<1024?`${String(e)} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function _n(e){const t=document.createElement("li");t.className="status-check";const n=document.createElement("span");n.className="status-check__mark",n.setAttribute("aria-hidden","true");const a=e.present&&e.parseable;n.textContent=a?"✓":"✗",t.classList.toggle("status-check--ok",a),t.classList.toggle("status-check--missing",!a);const s=document.createElement("span"),i=e.required?"required":"optional";return s.textContent=`${e.id} — ${a?"present":e.present?"unreadable":"missing"} (${i})`,t.append(n,s),t}function $n(e,t){const n=document.createElement("section");n.className="status-view",n.setAttribute("aria-labelledby","status-heading");const a=document.createElement("h1");a.id="status-heading",a.textContent="Offline status",n.append(a);const s=R("p",`State: ${e.state}`);if(s.className=`status-state status-state--${e.state.toLowerCase().replace("_","-")}`,n.append(s),e.reason&&n.append(R("p",`Reason: ${e.reason}`)),e.failedOp&&n.append(R("p",`Failed operation: ${e.failedOp}`)),e.missing.length>0&&n.append(R("p",`Missing: ${e.missing.join(", ")}`)),n.append(R("p",`Preparation level: ${e.level}`)),e.sections.length>0){n.append(R("h2","Sections"));const l=document.createElement("ul");l.className="status-checklist";for(const y of e.sections)l.append(_n(y));n.append(l)}const i=R("p",e.packageVersion===null?"Dataset: none":`Dataset: ${e.edition??"unknown edition"} v${String(e.packageVersion)} · generated ${e.generatedAt??"unknown"}`);i.className="status-dataset",n.append(i),e.fetchedAt!==null&&n.append(R("p",`Verified on this device: ${new Date(e.fetchedAt).toISOString()}`)),n.append(R("p",`Assets: ${String(e.assets.present)}/${String(e.assets.total)} present`)),e.floorVersion&&n.append(R("p",`Emergency floor: v${e.floorVersion} (always on this device)`));const r=e.storage,o=r===null||r.usage===void 0&&r.quota===void 0?"Storage: unavailable in this browser":`Storage: ${Ge(r.usage)} used of ${Ge(r.quota)}${e.shellCache?` · shell ${e.shellCache}`:""}`;n.append(R("p",o));const c=document.createElement("div");switch(c.className="status-actions",e.state){case"NOT_READY":c.append(M("Get festival data",t.onGetData,!0));break;case"PARTIAL":c.append(M(e.activationPending?"Staged data found — continue setup":"Continue setup",t.onGetData,!0));break;case"RECOVERY":c.append(M("Restore festival data",t.onGetData,!0)),t.onRestore&&c.append(M("Restore previous version",t.onRestore));break;case"FAILED":c.append(M("Retry",t.onCheckData,!0)),n.append(R("p","If this persists, restore festival data when online. Diagnostics stay on this device."));break;case"BASELINE_ONLY":n.append(R("p","This browser cannot save offline data (private mode, blocked website data, or no space). Install Lumen to the home screen, use a normal browsing window, or free storage — emergency info below still works offline."));break}return c.append(M("Check my data",t.onCheckData)),c.append(M("Close",t.onClose)),n.append(c),n}function Fn(e,t){const n=document.createElement("section");n.className="status-view",n.setAttribute("aria-labelledby","prep-heading");const a=document.createElement("h1");a.id="prep-heading",a.textContent="Get festival data",n.append(a),n.append(R("p","Festival data preparation needs an internet connection. Open Lumen online and return here — one-tap download with resume, verification, and OFFLINE READY confirmation arrives with the sync stage. Your emergency floor below always works, with or without it."));const s=document.createElement("div");return s.className="status-actions",s.append(M("Back to status",e,!0)),s.append(M("Close",t)),n.append(s),n}function w(e,t){const n=document.createElement(e);return n.textContent=t,n}function X(e,t){const n=document.createElement("h2");return n.id=e,n.textContent=t,n}function be(e){const t=document.createElement("ul");for(const n of e)t.append(w("li",n));return t}function we(e,t,n,a=!1){const s=document.createElement("div");if(s.className="emergency-service",s.append(w("h3",t),w("p",n)),a){const i=document.createElement("a");i.className="emergency-call",i.href=`tel:${n}`,i.textContent=`Call ${n}`,i.setAttribute("aria-label",`Call ${t} at ${n}`),s.append(i)}e.append(s)}function In(e){switch(e){case"no-dataset":return"Festival data isn't on this device yet — showing the built-in baseline. Open with internet to get festival data.";case"unsupported-schema":return"This festival data needs a newer app version — showing the built-in baseline. Update Lumen when online.";case"malformed-section":return"The festival data emergency section couldn't be read — showing the built-in baseline."}}function Mn(){const e=document.createElement("a");return e.className="emergency-map-link",e.href="/map",e.setAttribute("data-route","/map"),e.textContent="Show on map",e}function Ee(e,t,n){const a=document.createElement("li");a.append(w("span",t),w("span"," · "),Mn()),e.append(a)}function Un(e){const t=e;return typeof t=="object"&&t!==null&&(t.source==="baseline"||t.source==="dataset")}function Bn(e,t){var E,N;let n;try{n=Un(e)?e:Pe(e,t)}catch{const p=document.createElement("section");p.className="emergency-view";const S=document.createElement("h1");return S.textContent="Emergency",p.append(S),p.append(w("p","Emergency data failed to load on this device.")),p}const a=document.createElement("section");a.className="emergency-view",a.setAttribute("aria-labelledby","emergency-heading");const s=document.createElement("h1");s.id="emergency-heading",s.textContent="Emergency",a.append(s);const i=w("p",n.provenance);if(i.className="emergency-provenance",i.setAttribute("role","status"),a.append(i),n.demotion){const p=w("p",In(n.demotion));p.className="emergency-guidance",a.append(p)}const r=n.section,o=(r==null?void 0:r.services)??n.floor.services,c=(r==null?void 0:r.address)??n.floor.address,l=(E=r==null?void 0:r.procedures)!=null&&E.length?r.procedures:n.floor.procedures,y=document.createElement("div");y.className="emergency-alert",y.append(X("emergency-call-heading","Need immediate help?")),we(y,"Emergency services",o.emergencyNumber,!0),y.append(w("p","Tap to call. The number is also selectable for copying.")),a.append(y);const f=document.createElement("section");f.setAttribute("aria-labelledby","emergency-services-heading"),f.append(X("emergency-services-heading","Contacts"));const x=o.security.phone;we(f,"Security",x||"Contact event staff or venue personnel"),o.security.location&&f.append(w("p",`Security location: ${o.security.location}`)),we(f,"First aid",o.firstAid.location),o.firstAid.hours&&f.append(w("p",`First-aid hours: ${o.firstAid.hours}`)),a.append(f);const b=document.createElement("section");if(b.setAttribute("aria-labelledby","emergency-address-heading"),b.append(X("emergency-address-heading","Venue and exits")),b.append(w("p",c.lines.join(", "))),b.append(w("p",`Coordinates: ${String(c.coordinates.lat)}, ${String(c.coordinates.lon)}`)),r!=null&&r.locations){b.append(w("h3","Muster points"));const p=document.createElement("ul");for(const C of r.locations.musterPoints)Ee(p,C.name);b.append(p),b.append(w("h3","Exits"));const S=document.createElement("ul");for(const C of r.locations.exits)Ee(S,C.name);if(b.append(S),r.locations.aeds.length>0){b.append(w("h3","AEDs"));const C=document.createElement("ul");for(const D of r.locations.aeds)Ee(C,`AED near ${D.poi}`);b.append(C)}}else b.append(w("h3","Muster points")),b.append(be(n.floor.musterPoints.map(p=>p.name))),b.append(w("h3","Exits")),b.append(be(n.floor.exits.map(p=>p.name))),b.append(w("h3","AEDs")),b.append(w("p",n.floor.aedSummary));a.append(b);const V=document.createElement("section");V.setAttribute("aria-labelledby","emergency-procedures-heading"),V.append(X("emergency-procedures-heading","What to do"));for(const p of l)V.append(w("h3",p.title),be(p.steps));if(a.append(V),(N=r==null?void 0:r.notices)!=null&&N.length){const p=document.createElement("section");p.setAttribute("aria-labelledby","emergency-notices-heading"),p.append(X("emergency-notices-heading","Notices"));for(const S of r.notices)p.append(w("h3",`[${S.severity}] ${S.title}`)),p.append(w("p",S.body.map(String).join(" ")));a.append(p)}return a}function ze(e,t){const n=document.createElement(e);return n.textContent=t,n}function Kn(e){const t=document.createElement("section");t.className="map-view",t.setAttribute("aria-labelledby","map-heading");const n=document.createElement("h1");n.id="map-heading",n.textContent="Map",t.append(n);{const a=document.createElement("div");return a.className="view-placeholder",a.append(ze("p","The map isn't on this device yet.")),a.append(ze("p","Open with internet to get festival data — the emergency floor always works meanwhile.")),t.append(a),t}}function Yn(){const e=document.createElement("section");e.setAttribute("aria-labelledby","festival-heading");const t=document.createElement("h1");t.id="festival-heading",t.textContent="Solarpunk Summit",e.append(t);const n=document.createElement("p");n.textContent=K.mission,e.append(n),ve(e,"Daily themes",K.themes.map(([s,i])=>`${s}: ${i}`)),ve(e,"Passes",K.passes),ve(e,"Attendee guidance",K.guidance);const a=document.createElement("a");return a.href=K.source,a.target="_blank",a.rel="noreferrer",a.textContent="Verify current details at solarpunksummit.com",e.append(a),e}function qn(e){const t=document.createElement("section");t.setAttribute("aria-labelledby","not-found-heading");const n=document.createElement("h1");n.id="not-found-heading",n.textContent="Page not found",t.append(n);const a=document.createElement("p");a.textContent=`No page at “${e}”. Use the navigation below.`,t.append(a);const s=document.createElement("a");return s.href="/emergency",s.textContent="Go to Emergency",s.setAttribute("data-route","/emergency"),t.append(s),t}const jn={onToggleFavorite:()=>!1,onZoneToggle:()=>{}};function Gn(e,t){var a,s;switch(De(e)){case"home":return Ln();case"emergency":return Bn(t==null?void 0:t.emergency);case"schedule":return Vn(((a=t==null?void 0:t.schedule)==null?void 0:a.input)??null,((s=t==null?void 0:t.schedule)==null?void 0:s.actions)??jn);case"map":return Kn();case"festival":return Yn();case"not-found":return qn(e)}}function We(){const e=document.querySelector("#app");if(!e)throw new Error("#app host missing — shell invariant");const{root:t,main:n,nav:a,brand:s,statusChip:i}=xn();e.replaceChildren(t),e.removeAttribute("aria-busy");let r=null,o,c=null,l=new Set,y=!1,f=null;async function x(){const d=await Wt();return d.status==="ready"?Pe(d.data):d.status==="unusable"?le(d.reason):Pe()}function b(d){const m=d.activationPending?"staged data awaiting activation":d.reason??d.failedOp??d.missing[0]??void 0,u=Lt(d.state,m);i.textContent=u.text,i.className=`app-header__status app-header__status--${u.tone}`,i.setAttribute("aria-label",`${u.label} Activate for status details.`)}function V(d){f||(f=document.createElement("dialog"),f.className="status-dialog",f.setAttribute("aria-label","Offline status details"),f.addEventListener("close",()=>{i.focus({preventScroll:!0})}),t.append(f));const m=f,u=()=>{m.close()},v=()=>{r&&V(r)};m.replaceChildren($n(d,{onCheckData:()=>void E(!0),onGetData:()=>{m.replaceChildren(Fn(v,u))},onRestore:d.canRestore?()=>{Pt().catch(()=>!1).then(()=>E(!0))}:null,onClose:u})),m.open||m.showModal()}async function E(d){var u;const m=await Ut();r=m;try{o=await x()}catch{o=void 0}try{c=await sn(),l=new Set((c==null?void 0:c.favorites.map(v=>v.eventId))??[]),y=((u=c==null?void 0:c.prefs)==null?void 0:u.useDeviceTimezone)??!1}catch{c=null}!i.isConnected&&!t.isConnected||(b(m),!d&&(A.getRouteId()==="emergency"||A.getRouteId()==="schedule")&&O(),d&&V(m))}function N(){if(!c)return null;const{section:d,window:m,skew:u}=c,{now:v,driftWarn:k}=pn(gn(),u);return{section:d,favorites:l,clock:{now:v,zone:y?ln():m.timezone,festivalZone:m.timezone,useDeviceZone:y,outsideWarn:mn(v,{startUtc:m.startUtc,endUtc:m.endUtc,timezone:m.timezone},u),driftWarn:k}}}async function p(d,m){try{const u=await Ve();try{m?(l.add(d),await Qt(u,{eventId:d,addedAt:Date.now()})):(l.delete(d),await Xt(u,d))}finally{u.close()}return!0}catch{if(m)l.delete(d);else if(c)for(const u of c.favorites)u.eventId===d&&l.add(d);return!1}}async function S(d){y=d;try{const m=await Ve();try{const u=c==null?void 0:c.prefs;await tn(m,{festivalTimezone:(u==null?void 0:u.festivalTimezone)??(c==null?void 0:c.window.timezone)??"UTC",useDeviceTimezone:d,...(u==null?void 0:u.theme)!==void 0?{theme:u.theme}:{}})}finally{m.close()}}catch{}A.getRouteId()==="schedule"&&O()}function C(){return{onToggleFavorite:(d,m)=>p(d,m),onZoneToggle:d=>void S(d)}}i.textContent="…",i.setAttribute("tabindex","0"),i.setAttribute("title","View offline status details");const D=()=>{E(!0)};i.addEventListener("click",D),i.addEventListener("keydown",d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),D())}),ot().catch(()=>{});const A=new Rn(J(location.pathname));function O(){var P;const d=A.getPath(),m=A.getRouteId();Tn(a,m);const u=m==="home";s.classList.toggle("app-header__brand--back",!u),s.classList.toggle("app-header__brand--active",u),u?s.removeAttribute("aria-current"):s.setAttribute("aria-current","page");const v=Gn(d,{emergency:o,schedule:{input:N(),actions:C()}});n.replaceChildren(v);const k=document.createElement("img");k.src="/sol_lunar_icon.svg?v=5",k.alt="",k.className="app-main__icon",n.prepend(k),n.focus({preventScroll:!0}),document.title=m==="not-found"?"Not found — Lumen":m==="home"?"Lumen":`${((P=v.querySelector("h1"))==null?void 0:P.textContent)??m} — Lumen`}t.addEventListener("click",d=>{var v;const m=(v=d.target)==null?void 0:v.closest("a[data-route]");if(!m)return;const u=m.getAttribute("data-route");u&&(/^https?:\/\//.test(u)||(d.preventDefault(),A.navigate(u)))});const U=A.listen(()=>{O()}),$=A.attach();return O(),E(!1),{router:A,cleanup:()=>{U(),$()}}}function zn(){if(!(typeof document>"u"||!document.getElementById("app")))if(document.readyState!=="loading")try{We()}catch{}else document.addEventListener("DOMContentLoaded",()=>{if(document.getElementById("app"))try{We()}catch{}},{once:!0})}zn();
|
||
//# sourceMappingURL=index-CaoEjGwW.js.map
|