1import{r as m,j as e,V as q,v as u,an as D,ad as C,L as T}from"./index-CEqNdWMB.js";import{r as E}from"./api-AEpoNLru.js";import{s as c}from"./salesApi-C2JFhh7n.js";import{u as I,R as A}from"./copy-IWmUO8Nb.js";import{R as K}from"./RecordingCards-CQRKltqj.js";import{b as W,d as $}from"./RecordingCollections-BATv_W8y.js";import{R as O}from"./RecordingPurchasePage-CKAeQGiH.js";import{F as z}from"./film-yiu3E6Mi.js";/* empty css */import"./arrow-left-CuHADIC7.js";import"./dialog-C4_r9fMQ.js";import"./form-layout-CimphA65.js";import"./circle-check-CLqBpQmC.js";import"./calendar-clock-DpADnzY9.js";import"./randomUUID-z-zICSG_.js";import"./label-MzaZtEZW.js";import"./checkbox-CcAbeY7r.js";import"./index-BSd2hjwl.js";import"./check-CYl4c-Z5.js";import"./sales-model-D6d1YcCN.js";function le(){const[s,a]=m.useState(()=>window.location.hash.slice(1));return m.useEffect(()=>{const l=()=>a(window.location.hash.slice(1));return window.addEventListener("hashchange",l),()=>window.removeEventListener("hashchange",l)},[]),e.jsx(B,{token:s},s)}function B({token:s}){var w,b,N,R,_,P;const{eventId:a}=q(),[l]=m.useState(()=>Math.random().toString(36)),i=s.startsWith("p2."),F=new URLSearchParams(window.location.search).get("lang")==="es"?"es":"en",L=u({queryKey:["recording-locale",a],queryFn:()=>c(a,"locale"),enabled:!!a,retry:!1,staleTime:3e5}),r=u({queryKey:["recording-portal",a,l],gcTime:0,queryFn:()=>i?c(a,"portal",{token:s}):E(a,"portal",{token:s}),enabled:!!a&&!!s,retry:!1,staleTime:3e4,refetchOnWindowFocus:!1,refetchInterval:6e5}),S=u({queryKey:["recording-portal-content",a,l],queryFn:()=>c(a,"catalog",{token:s}),enabled:!!r.data&&!i,retry:!1,gcTime:0}),d=((w=r.data)==null?void 0:w.event.locale)??((b=L.data)==null?void 0:b.locale)??F,{t,error:h}=I(d),g=async n=>{const{url:x}=await(i?c(a,"download",{id:n,token:s}):E(a,"download",{id:n,token:s})),p=document.createElement("a");p.href=x,p.rel="noreferrer",p.referrerPolicy="no-referrer",p.click()},[f,j]=m.useState(!1),[y,v]=m.useState(""),o=i?r.data:S.data;return e.jsx(A.Provider,{value:d,children:e.jsxs("main",{className:"min-h-dvh bg-background",children:[e.jsxs(D,{children:[e.jsxs("title",{children:[t("personal")," · Christian International"]}),e.jsx("meta",{name:"robots",content:"noindex,nofollow"}),e.jsx("meta",{name:"referrer",content:"no-referrer"})]}),e.jsx("header",{className:"border-b",children:e.jsx("div",{className:"max-w-6xl mx-auto px-5 py-5 text-primary font-display font-semibold",children:"Christian International"})}),e.jsxs("div",{className:"max-w-6xl mx-auto px-5 py-8 sm:py-12 space-y-8",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex gap-2 text-primary text-sm font-medium mb-3",children:[e.jsx(z,{className:"w-4 h-4"}),t("personal")]}),e.jsx("h1",{className:"font-display text-3xl sm:text-4xl font-bold",children:((N=r.data)==null?void 0:N.event.title)??t("title")}),r.data&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground mt-3",children:t("greeting",{name:r.data.attendee_name})}),r.data.access_ends_at&&e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:t("expiry",{date:new Date(r.data.access_ends_at).toLocaleDateString(d)})})]})]}),!!s&&r.isPending&&e.jsx("p",{role:"status",children:t("loading")}),(!s||r.error)&&e.jsxs("div",{className:"border rounded-xl p-6 space-y-4",children:[e.jsx("p",{role:"alert",className:"text-destructive",children:s?h(r.error):t("error.access_de
1nied")}),e.jsx(C,{variant:"outline",onClick:()=>void r.refetch(),children:t("tryAgain")})]}),i&&((R=r.data)==null?void 0:R.pending_purchase)&&e.jsxs("div",{className:"rounded-xl border bg-primary/5 p-5 space-y-3",children:[e.jsx("p",{children:t("unfinishedPurchase")}),e.jsx(C,{disabled:f,onClick:()=>{j(!0),v(""),c(a,"resume",{token:s,order_id:r.data.pending_purchase.id}).then(n=>window.location.assign(n.url)).catch(n=>v(h(n))).finally(()=>j(!1))},children:t(f?"pending":"resumeCheckout")}),y&&e.jsx("p",{role:"alert",className:"text-destructive text-sm",children:y})]}),i&&((P=(_=r.data)==null?void 0:_.purchase_items)==null?void 0:P.some(n=>!n.release_at))&&e.jsxs("section",{className:"rounded-xl border bg-primary/5 p-5 space-y-3",children:[e.jsx("h2",{className:"font-display text-lg font-semibold",children:t("preorderPaid")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("preorderWaiting")}),e.jsx("ul",{className:"space-y-2 text-sm",children:r.data.purchase_items.filter(n=>!n.release_at).map((n,x)=>e.jsxs("li",{children:[n.title,n.expected_at&&e.jsxs("span",{className:"text-muted-foreground",children:[" · ",t("expectedOn",{date:new Date(n.expected_at).toLocaleDateString(d,{timeZone:o==null?void 0:o.event.timezone})})]})]},x))})]}),o&&r.data?e.jsxs(e.Fragment,{children:[e.jsx(W,{details:o.offer.details,className:"text-muted-foreground"}),e.jsx($,{catalog:o,onDownload:g}),i&&!o.owned.full&&e.jsx(T,{className:"inline-block text-primary underline",to:`${d==="es"?"/es/eventos":"/events"}/${o.event.slug}/recordings#${s}`,children:t("upgrade")})]}):r.data&&e.jsx(K,{days:r.data.days,recordings:r.data.recordings,locale:d,onDownload:g}),a&&e.jsx(O,{event:a})]})]})})}export{le 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.