1import{W as g,c as i,r as s,h,X as f}from"#entry";const m=g("tenant",()=>{const n=s(null),o=s(new Map),r=s(!1),u=s(null),a=async e=>{if(n.value?.id!==e){r.value=!0,u.value=null;try{const t=await l(e);n.value=t,o.value.set(e,t)}catch(t){u.value=t instanceof Error?t.message:"Failed to load tenant",console.error("Tenant loading error:",t)}finally{r.value=!1}}},l=async e=>{const t=o.value.get(e);if(t)return t;try{const c=await $fetch(`/api/tenant/${e}`);return o.value.set(e,c),c}catch{throw new Error(`Failed to load tenant config for ${e}`)}},d=e=>!0,v=e=>n.value?n.value.features[e]??!1:!1,T=e=>n.value?n.value.theme[e]:null;return{currentTenant:i(()=>n.value),loading:i(()=>r.value),error:i(()=>u.value),setCurrentTenant:a,loadTenantConfig:l,isValidTenant:d,getTenantFeature:v,getTenantTheme:T}}),y=defineRouteMiddleware(async(n,o)=>{const r=m(),a=h().params.region;if(!a)return f("/");if(!r.isValidTenant(a))return f("/");if(r.currentTenant?.id!==a)try{await r.setCurrentTenant(a)}catch(l){return console.error("Failed to load tenant:",l),f("/")}});export{y as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.