PageSourceSearch

https://preppingacademy.com/assets/admin-B2-C5YZS.js

js preppingacademy.com collected 2026-10-04 05:32:42 UTC 4,588 bytes, 1 lines download raw bytes

1import{c as o,g as M,h as w,r as t,a as d,j as e,O as x,b as S,B as l,L as h,M as C}from"./index-ChaxCLQ_.js";import{M as L}from"./mic-CeHZwdG-.js";import{U as _}from"./users-B3Kgtlnz.js";import{H as z}from"./handshake-eQmMJLOZ.js";import{M as A}from"./megaphone-BH7buE7J.js";import{M as E}from"./message-square-US6Fghgt.js";import{N as q}from"./network-DX0023tB.js";const H=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],O=o("chart-column",H);const V=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],p=o("log-out",V);const $=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],B=o("share-2",$);const I=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],U=o("shield-alert",I),R=t.createContext({userEmail:null}),G=[{to:"/admin",label:"Analytics",icon:O},{to:"/admin/subscribers",label:"Subscribers",icon:C},{to:"/admin/guests",label:"Guests",icon:L},{to:"/admin/sponsor-list",label:"Sponsor List",icon:_},{to:"/admin/sponsors",label:"Sponsor Inquiries",icon:z},{to:"/admin/speakers",label:"Speakers",icon:A},{to:"/admin/messages",label:"Messages",icon:E},{to:"/admin/social",label:"Social",icon:B},{to:"/admin/network",label:"Network",icon:q}];function Q(){const r=M(),n=w(),[f,b]=t.useState(!1),[g,m]=t.useState(!1),[y,j]=t.useState(!1),[i,k]=t.useState(null),c=n.pathname==="/admin/login";if(t.useEffect(()=>{b(!0)},[]),t.useEffect(()=>{if(c){m(!0);return}if(typeof window>"u")return;let s=!0;return(async()=>{const{data:a}=await d.auth.getSession();if(!a.session){r({to:"/admin/login"});return}if(!s)return;k(a.session.user.email??null);const{data:N}=await d.from("user_roles").select("role").eq("user_id",a.session.user.id);j((N??[]).some(v=>v.role==="admin")),m(!0)})(),()=>{s=!1}},[c,r]),c)return e.jsx(x,{});if(!f||!g)return e.jsx("div",{className:"flex min-h-[60vh] items-center justify-center",children:e.jsx(S,{className:"size-6 animate-spin text-muted-foreground"})});async function u(){await d.auth.signOut(),r({to:"/admin/login"})}return y?e.jsxs(R.Provider,{value:{userEmail:i},children:[e.jsx("div",{className:"border-b border-border bg-secondary/40",children:e.jsxs("div",{className:"mx-auto max-w-7xl px-4 md:px-8 pt-8 pb-0",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-accent",children:"Admin"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Signed in as ",i]})]}),e.jsxs(l,{variant:"outline",onClick:u,className:"rounded-sm",children:[e.jsx(p,{className:"size-4"})," Sign out"]})]}),e.jsx("nav",{className:"mt-6 flex flex-wrap gap-1 border-b border-transparent",children:G.map(s=>{const a=s.to==="/admin"?n.pathname==="/admin"||n.pathname==="/admin/":n.pathname.startsWith(s.to);return e.jsxs(h,{to:s.to,className:`-mb-px inline-flex items-center gap-2 border-b-2 px-4 py-3 text-sm font-semibold transition-colors ${a?"border-accent text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[e.jsx(s.icon,{className:"size-4"}),s.label]},s.to)})})]})}),e.jsx(x,{})]}):e.jsx("section",{className:"mx-auto max-w-md px-4 py-20 text-center",children:e.jsxs("div",{className:"rounded-sm border border-border bg-card p-8",children:[e.jsx(U,{className:"mx-auto size-8 text-destructive"}),e.jsx("h1",{className:"mt-4 font-serif text-2xl font-semibold text-foreground",children:"Not authorized"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Your account (",i,") doesn't have admin access. Ask the site owner to grant you the ",e.jsx("code",{children:"admin"})," role."]}),e.jsxs("div",{className:"mt-6 flex justify-center gap-2",children:[e.jsxs(l,{variant:"outline",onClick:u,className:"rounded-sm",children:[e.jsx(p,{className:"size-4"})," Sign out"]}),e.jsx(l,{asChild:!0,className:"rounded-sm",children:e.jsx(h,{to:"/",children:"Back to site"})})]})]})})}export{Q as component};

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.