1import{u as I,e as n,m as O,j as e,L as Q}from"./vendor-react-C-tLJ3C8.js";import{v as L,ab as A,K as V,ac as $,aa as F,t as E,E as m,a3 as G,k as Y,Q as _,a8 as K,j as W}from"./index-DxoJEjRy.js";import{a as H,c as J}from"./consentSync-BUri4Xpd.js";import{u as X}from"./consentUiStore-XNGvLEbA.js";import{d as Z}from"./vendor-query-4BWL3uTy.js";import{a as ee}from"./useConsentSync-DulNqSky.js";import{A as S,m as M}from"./vendor-motion-Dx4K3zup.js";import{S as se}from"./shield-4MivIpB6.js";import{B as ae}from"./bar-chart-3-DL8nypqW.js";import{C as te}from"./chevron-down-B_1PCAQj.js";import"./useFeatures-BR74PbUE.js";/** 2 * @license lucide-react v0.378.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const re=L("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]);/** 7 * @license lucide-react v0.378.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const ne=L("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]),oe=["/app/mock-exams/:id/session","/app/battles/:id","/app/competitions/:id/play","/app/study/:subject/:topicId","/app/challenge","/app/post-utme/practice/:sessionId"];function fe(){const{pathname:i,search:d}=I(),h=A(s=>s.isAuthenticated),{open:r,source:c,hide:x}=X(),u=Z(),t=V(),[P,y]=n.useState(!1),[l,g]=n.useState(!1),[p,f]=n.useState({analytics:!1,ads:!1}),w=$();n.useEffect(()=>{F()},[i,d]),n.useEffect(()=>{const s=window.setTimeout(()=>y(E(m(),t)),300);return()=>window.clearTimeout(s)},[t]),n.useEffect(()=>{const s=m();f({analytics:(s==null?void 0:s.analytics)??!1,ads:(s==null?void 0:s.ads)===!0}),w>0&&y(E(s,t))},[w,r,t]),n.useEffect(()=>{r&&g(!0)},[r]);const R=oe.some(s=>O(s,i)),T=(P||r)&&!R,b=s=>{var j;const a=r?c:"banner",o=G({...s,source:a});if(Y(o),_(),K("consent_update",{analytics:o.analytics,ads:o.ads===!0,source:a}),h){const U=((j=u.getQueryData(["features"]))==null?void 0:j.consentVersion)??"2026-09";W.put("/me/consent",H(o,{version:U,source:a,desktop:t})).then(z=>{var N;if(((N=m())==null?void 0:N.savedAt)!==o.savedAt)return;const C=z.data.data.consent;ee(J(o,C)),A.getState().updateUser({consent:C})}).catch(()=>{})}y(!1),g(!1),x()},k=s=>{var a;return t?((a=m())==null?void 0:a.ads)??null:s},q=()=>b({analytics:!0,ads:k(!0)}),B=()=>b({analytics:!1,ads:k(!1)}),D=()=>b({analytics:p.analytics,ads:k(p.ads)});return e.jsx(S,{children:T&&e.jsx(M.div,{initial:{y:120,opacity:0},animate:{y:0,opacity:1},exit:{y:120,opacity:0},transition:{type:"spring",damping:22,stiffness:220},className:`fixed inset-x-0 bottom-0 z-50 px-3 pb-3 sm:px-4 sm:pb-4 pointer-events-none ${i.startsWith("/app")?"mb-16 md:mb-0":""}`,role:"dialog","aria-live":"polite","aria-label":"Cookie consent",children:e.jsx("div",{className:"pointer-events-auto mx-auto max-w-4xl rounded-2xl border border-gray-200 dark:border-dark-border bg-white dark:bg-dark-surface shadow-xl",children:e.jsxs("div",{className:"p-5 sm:p-6",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"shrink-0 w-10 h-10 rounded-xl bg-primary-50 dark:bg-primary-900/30 flex items-center justify-center",children:e.jsx(re,{className:"w-5 h-5 text-primary-700 dark:text-primary-400","aria-hidden":"true"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-sm sm:text-base font-bold text-gray-900 dark:text-white",children:"Your privacy choices"}),e.jsxs("p",{className:"mt-1 text-xs sm:text-sm text-gray-600 dark:text-gray-300 leading-relaxed",children:["Essential cookies always run so you can log in, practise, and save your progress. You choose whether we also use analytics",t?"":" and ads (never personalised â needed to unlock Pro features by watching ads)","."," ",e.jsx(Q,{to:"/privacy",className:"font-medium text-primary-700 dark:text-primary-400 hover:underline",children:"Read our privacy policy"}),"."]})]})]}),e.jsx(S,{initial:!1,children:l&&e.jsx(M.div,{initial:{height:0,opacity:0}
11,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:e.jsxs("div",{className:"mt-4 space-y-3 rounded-xl border border-gray-100 dark:border-dark-border bg-gray-50 dark:bg-dark-bg p-4",children:[e.jsx(v,{icon:e.jsx(se,{className:"w-4 h-4"}),title:"Essential",description:"Login, session, and CSRF protection. Required â always on.",checked:!0,disabled:!0,onChange:()=>{}}),e.jsx(v,{icon:e.jsx(ae,{className:"w-4 h-4"}),title:"Analytics",description:"Google Analytics 4 â shows us which pages help you most. No analytics cookies until you allow them.",checked:p.analytics,onChange:s=>f(a=>({...a,analytics:s}))}),!t&&e.jsx(v,{icon:e.jsx(ne,{className:"w-4 h-4"}),title:"Ads (non-personalised)",description:"Ad cookies for Google's ads. Ads on ExamPadi are never personalised. Needed to unlock Pro features by watching an ad.",checked:p.ads,onChange:s=>f(a=>({...a,ads:s}))})]})})}),e.jsxs("div",{className:"mt-4 flex flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("button",{type:"button",onClick:()=>g(s=>!s),className:"inline-flex items-center gap-1 text-xs font-medium text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white self-start sm:self-auto","aria-expanded":l,children:["Customize",e.jsx(te,{className:`w-3.5 h-3.5 transition-transform ${l?"rotate-180":""}`})]}),e.jsxs("div",{className:"flex flex-col-reverse sm:flex-row gap-2 sm:items-center",children:[l?e.jsx("button",{type:"button",onClick:D,className:"rounded-xl px-4 py-2 text-sm font-semibold bg-gray-100 dark:bg-dark-border text-gray-900 dark:text-white hover:bg-gray-200 dark:hover:bg-gray-700 transition",children:"Save choices"}):e.jsx("button",{type:"button",onClick:B,className:"rounded-xl px-4 py-2 text-sm font-semibold bg-gray-100 dark:bg-dark-border text-gray-900 dark:text-white hover:bg-gray-200 dark:hover:bg-gray-700 transition",children:"Essential only"}),e.jsx("button",{type:"button",onClick:q,className:"rounded-xl px-4 py-2 text-sm font-semibold bg-primary-700 hover:bg-primary-800 text-white transition shadow-sm",children:"Accept all"})]})]})]})})})})}function v({icon:i,title:d,description:h,checked:r,disabled:c,onChange:x}){return e.jsxs("label",{className:`flex items-start gap-3 ${c?"opacity-75":"cursor-pointer"}`,children:[e.jsx("span",{className:"mt-0.5 w-7 h-7 shrink-0 rounded-lg bg-white dark:bg-dark-surface border border-gray-200 dark:border-dark-border flex items-center justify-center text-primary-700 dark:text-primary-400",children:i}),e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"block text-sm font-semibold text-gray-900 dark:text-white",children:d}),e.jsx("span",{className:"block text-xs text-gray-600 dark:text-gray-400 leading-relaxed",children:h})]}),e.jsx("input",{type:"checkbox",checked:r,disabled:c,onChange:u=>x(u.target.checked),className:"mt-1 h-4 w-4 shrink-0 rounded border-gray-300 text-primary-700 focus:ring-primary-500 disabled:opacity-60 disabled:cursor-not-allowed","aria-label":d})]})}export{fe 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.