1import{d as F,r,e as C,f as H,j as e,P as N,g as L,h as O,c as j,X as U,L as q}from"./index-DPyX5apy.js";import{B as m}from"./button-ZzasjO00.js";import{u as D}from"./index-BmIqlpe1.js";import{C as J}from"./cookie-CPnIrQ0N.js";var v="Switch",[W,te]=F(v),[X,G]=W(v),P=r.forwardRef((s,a)=>{const{__scopeSwitch:n,name:l,checked:o,defaultChecked:h,required:c,disabled:i,value:d="on",onCheckedChange:p,form:t,...u}=s,[f,x]=r.useState(null),k=C(a,g=>x(g)),y=r.useRef(!1),w=f?t||!!f.closest("form"):!0,[b,M]=H({prop:o,defaultProp:h??!1,onChange:p,caller:v});return e.jsxs(X,{scope:n,checked:b,disabled:i,children:[e.jsx(N.button,{type:"button",role:"switch","aria-checked":b,"aria-required":c,"data-state":_(b),"data-disabled":i?"":void 0,disabled:i,value:d,...u,ref:k,onClick:L(s.onClick,g=>{M(z=>!z),w&&(y.current=g.isPropagationStopped(),y.current||g.stopPropagation())})}),w&&e.jsx(A,{control:f,bubbles:!y.current,name:l,value:d,checked:b,required:c,disabled:i,form:t,style:{transform:"translateX(-100%)"}})]})});P.displayName=v;var E="SwitchThumb",R=r.forwardRef((s,a)=>{const{__scopeSwitch:n,...l}=s,o=G(E,n);return e.jsx(N.span,{"data-state":_(o.checked),"data-disabled":o.disabled?"":void 0,...l,ref:a})});R.displayName=E;var K="SwitchBubbleInput",A=r.forwardRef(({__scopeSwitch:s,control:a,checked:n,bubbles:l=!0,...o},h)=>{const c=r.useRef(null),i=C(c,h),d=D(n),p=O(a);return r.useEffect(()=>{const t=c.current;if(!t)return;const u=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(u,"checked").set;if(d!==n&&x){const k=new Event("click",{bubbles:l});x.call(t,n),t.dispatchEvent(k)}},[d,n,l]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:i,style:{...o.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});A.displayName=K;function _(s){return s?"checked":"unchecked"}var T=P,V=R;const B=r.forwardRef(({className:s,...a},n)=>e.jsx(T,{className:j("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",s),...a,ref:n,children:e.jsx(V,{className:j("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));B.displayName=T.displayName;const S={necessary:!0,analytics:!1,marketing:!1,functional:!1},I="canion3d_cookie_consent";function Y(){try{const s=localStorage.getItem(I);return s?JSON.parse(s):null}catch{return null}}const se=()=>{const[s,a]=r.useState(!1),[n,l]=r.useState(!1),[o,h]=r.useState(S);r.useEffect(()=>{if(!Y()){const u=setTimeout(()=>a(!0),1e3);return()=>clearTimeout(u)}},[]);const c=t=>{localStorage.setItem(I,JSON.stringify(t)),a(!1)},i=()=>{c({necessary:!0,analytics:!0,marketing:!0,functional:!0})},d=()=>{c({...S})},p=()=>{c(o)};return s?e.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-[9999] p-4 md:p-6",children:e.jsxs("div",{className:"max-w-2xl mx-auto bg-card border border-border rounded-2xl shadow-lg p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(J,{className:"text-canion-red flex-shrink-0",size:24}),e.jsx("h3",{className:"font-semibold text-lg text-foreground",children:"Cookie Settings"})]}),e.jsx("button",{onClick:d,className:"text-muted-foreground hover:text-foreground",children:e.jsx(U,{size:20})})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies."," ",e.jsx(q,{to:"/privacy-policy",className:"text-canion-red hover:underline",children:"Privacy Policy"})]}),n&&e.jsx("div",{className:"space-y-3 pt-2 border-t border-border",children:[{key:"necessary",label:"Strictly Necessary",desc:"Required for the site to function. Cannot be disabled.",disabled:!0},{key:"analytics",label:"Analytics",desc:"Help us understand how visitors interact with the site.",disabled:!1},{key:"marketing",label:"Marketing",desc:"Used to deliver relevant advertisements.",disabled:!1},{key:"functional",label:"Functional",desc:"Enable enhanced functionality and personalization.",disabled:!1}].map(t=>e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.desc})]}),e.jsx(B,{checked:o[t.key],disabled:t.disabled,onCheckedChange:u=>h(f=>({...f,[t.key]:u}))})]},t.key))}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:n?e.jsxs(e.Fragment,{children:[e.jsx(m,{onClick:p,className:"bg-canion-red hover:bg-canion-red/90 text-white flex-1",children:"Save Preferences"}),e.jsx(m,{onClick:i,variant:"outline",className:"flex-1",children:"Accept All"})]}):e.jsxs(e.Fragment,{children:[e.jsx(m,{onClick:i,className:"bg-canion-red hover:bg-canion-red/90 text-white flex-1",children:"Accept All"}),e.jsx(m,{onClick:d,variant:"outline",className:"flex-1",children:"Reject All"}),e.jsx(m,{onClick:()=>l(!0),variant:"ghost",className:"flex-1",children:"Manage Preferences"})]})})]})}):null};export{se as default,Y as getCookieConsent};
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.