import{an as I,S as x,K as h,bl as V,C as B,ae as z,d as L,ai as N,a2 as d,h as p,a as r,x as A,y as P,a7 as a,ab as g,bm as D,b as j,c as S,w as _,i as b,t as f,F,r as T,bn as $,o as u,ac as K,e as C,af as R}from"./index-Cj-040Sc.js";import{u as H}from"./useBreadcrumbTail-xr5xn5PC.js";function M(o){return o&&(o.startsWith("http")?o:`/storage${o}`)}function E(o){if(!o||typeof o!="object"||Array.isArray(o))return;const t=o;return{code:typeof t.code=="string"?t.code:void 0,event:typeof t.event=="number"?t.event:void 0}}function G(o){if(!o||typeof o!="object"||Array.isArray(o))return;const s=o.games;return{games:Array.isArray(s)?s.filter(e=>!!e&&typeof e=="object"&&!Array.isArray(e)).map(e=>({id:typeof e.id=="number"||typeof e.id=="string"?e.id:"",name:typeof e.name=="string"?e.name:"",image:typeof e.image=="string"?e.image:"",custom_image:typeof e.custom_image=="string"?e.custom_image:void 0,provider:e.provider&&typeof e.provider=="object"&&!Array.isArray(e.provider)?{name:typeof e.provider.name=="string"?String(e.provider.name):""}:void 0})):[]}}function U(o){if(!o||typeof o!="object"||Array.isArray(o))return null;const t=o,s=typeof t.id=="string"||typeof t.id=="number"?t.id:"";if(s==="")return null;const e=typeof t.image=="string"?t.image:"";return{id:s,name:typeof t.name=="string"?t.name:void 0,title:typeof t.title=="string"?t.title:void 0,slug:typeof t.slug=="string"?t.slug:void 0,description:typeof t.description=="string"?t.description:void 0,text:typeof t.text=="string"?t.text:void 0,image:M(e),image_cf:typeof t.image_cf=="string"?t.image_cf:void 0,link:typeof t.link=="string"?t.link:void 0,type:typeof t.type=="string"?t.type:void 0,coupon_id:typeof t.coupon_id=="number"?t.coupon_id:null,coupon:E(t.coupon),rollover:G(t.rollover),starts_at:typeof t.starts_at=="string"?t.starts_at:void 0,ends_at:typeof t.ends_at=="string"?t.ends_at:void 0,created_at:typeof t.created_at=="string"?t.created_at:void 0,updated_at:typeof t.updated_at=="string"?t.updated_at:void 0}}function W(o){if(Array.isArray(o))return o[0]??null;if(o&&typeof o=="object"&&"data"in o){const t=o.data;return Array.isArray(t)?t[0]??null:t??null}return o}function q(o){const t=I(),s=x(null),e=x(!1),l=x(!1),c=h(()=>(V(o)??"").trim());async function y(i){const n=i.trim();if(!n){s.value=null,l.value=!0;return}e.value=!0,l.value=!1;try{const{data:m}=await z.get(`/api/promotion/${n}`),v=U(W(m));if(v){s.value=v;return}const w=t.list.find(k=>k.slug===n||String(k.id)===n)??null;s.value=w,l.value=w===null}catch{const m=t.list.find(v=>v.slug===n||String(v.id)===n)??null;s.value=m,l.value=m===null}finally{e.value=!1}}return B(()=>c.value,i=>{y(i)},{immediate:!0}),{slug:c,promotion:s,isLoading:e,notFound:l,reload:()=>y(c.value)}}const J={class:"easy-in-out scrollbar-hide flex h-full flex-col items-center overflow-y-auto overflow-x-hidden text-white transition-all duration-1000"},O={class:"w-full max-w-6xl flex-1 transition-all duration-1000"},Q={key:0,class:"mx-auto w-full max-w-[1024px] select-none space-y-6 p-6"},X={key:1,class:"mx-auto w-full max-w-[1024px] select-none space-y-6 px-6 py-10"},Y={class:"flex w-[80%] flex-col items-start gap-2 md:w-[50%]"},Z={class:"inline-flex items-center gap-3"},tt={class:"text-xl font-medium leading-tight md:text-4xl"},et={class:"w-10/12 text-sm text-gray-300"},ot={class:"mx-auto min-h-[256px] max-w-[1105px] select-none space-y-6 p-5 md:py-16"},at={key:0,class:"mt-4 flex flex-col gap-6"},it={key:1,class:"rounded-md border border-white/10 bg-white/5 p-6 text-sm text-gray-300"},nt={key:2,class:"promotion-content flex flex-col items-center"},rt={class:"w-full max-w-[800px]"},st=["innerHTML"],ct={auth:!1,crumb:[{textKey:"breadcrumb.home",link:"/"},{textKey:"breadcrumb.promotions",link:"/promotions"},{text:"",link:""}]},lt=L({__name:"[Slug]",setup(o){const t=$(),{getCloudflareImage:s}=N(),{promotion:e,isLoading:l,notFound:c}=q(()=>String(t.params.slug||""));H(h(()=>{if(l.value&&!c.value)return"";const i=e.value;if(i){const n=(i.name||i.title||"").trim();if(n)return n}return c.value?d("promotions.not-found"):d("breadcrumb.promotion-detail")}));const y=h(()=>{const i=e.value;return i?i.image_cf?s(i.image_cf,i.image,"banDesktop"):i.image:""});return(i,n)=>(u(),p("div",J,[r("section",O,[r("header",{class:P(["relative mx-auto flex w-full max-w-[1105px] bg-cover bg-center md:h-96",{"animate-pulse bg-white/10":a(l)}]),style:A(!a(l)&&a(e)?{backgroundImage:`url('${y.value}')`}:void 0)},[r("div",{class:"flex h-full w-full items-end md:items-center",style:A(a(l)?void 0:{backgroundImage:"linear-gradient(225deg,transparent,rgba(0,0,0,.8) 60%)"})},[a(l)?(u(),p("div",Q,[...n[0]||(n[0]=[D('