1import{_ as T,D as m,c as a,a as r,F as v,r as M,n as U,i as w,o,t as c,d,p as G,j as H,f as b,w as A,T as j,y as K,E as O,k as C,G as x,s as N,H as X,m as S,e as y,h as k,l as Y}from"./index-DEgvk0ng.js";function L(e,t,n,u){const s=(u-90)*Math.PI/180;return{x:e+n*Math.cos(s),y:t+n*Math.sin(s)}}function V(e){return e>0?360/e:360}function Z(e,t,n,u,s){const i=L(e,t,n,u),l=L(e,t,n,s),p=s-u>180?1:0;return[`M ${e} ${t}`,`L ${i.x.toFixed(3)} ${i.y.toFixed(3)}`,`A ${n} ${n} 0 ${p} 1 ${l.x.toFixed(3)} ${l.y.toFixed(3)}`,"Z"].join(" ")}function J(e,{cx:t=100,cy:n=100,radius:u=96,labelRadius:s=62}={}){const i=V(e.length);return e.map((l,p)=>{const f=p*i,h=f+i/2,g=L(t,n,s,h),z=h>90&&h<270?h+180:h;return{prize:l,index:p,centerAngle:h,path:Z(t,n,u,f,f+i),labelX:Number(g.x.toFixed(3)),labelY:Number(g.y.toFixed(3)),labelTransform:`rotate(${z.toFixed(3)} ${g.x.toFixed(3)} ${g.y.toFixed(3)})`}})}function Q(e,t,n,u=6,s=Math.random){const i=V(n),l=t*i+i/2,p=(s()-.5)*i*.62,f=(360-(l+p)%360+360)%360;let h=e-e%360+u*360+f;for(;h<=e+360;)h+=360;return h}function I(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const $={props:{segments:{type:Array,required:!0},spinning:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},inviting:{type:Boolean,default:!1}},emits:["settled"],data(){return{rotation:0,phase:"idle",pendingIndex:null}},computed:{normalizedSegments(){return this.segments.map(e=>({...e,lines:[e.label,e.label_secondary].filter(Boolean)}))},wheelSegments(){return J(this.normalizedSegments)},discStyle(){const{rampMs:e,spinMs:t,reducedMs:n}=m.animation;if(this.phase==="idle")return{transform:`rotate(${this.rotation}deg)`};if(I())return{transform:`rotate(${this.rotation}deg)`,transition:`transform ${n}ms ease-out`};const u=this.phase==="ramp"?`${e}ms cubic-bezier(0.55, 0, 0.95, 0.45)`:`${t}ms cubic-bezier(0.08, 0.82, 0.16, 1)`;return{transform:`rotate(${this.rotation}deg)`,transition:`transform ${u}`}}},created(){this.rampTimer=null,this.safetyTimer=null,this.runStartedAt=0},beforeUnmount(){clearTimeout(this.rampTimer),clearTimeout(this.safetyTimer)},methods:{spinTo(e){if(this.phase!=="idle"||e<0||e>=this.segments.length)return;this.pendingIndex=e;const t=Q(this.rotation,e,this.segments.length,m.animation.turns);if(I()){this.startRun(t,m.animation.reducedMs);return}this.phase="ramp",this.rotation+=180,clearTimeout(this.rampTimer),this.rampTimer=setTimeout(()=>this.startRun(t,m.animation.spinMs),m.animation.rampMs)},startRun(e,t){this.phase="run",this.runStartedAt=performance.now(),this.rotation=e,clearTimeout(this.safetyTimer),this.safetyTimer=setTimeout(()=>this.finishSpin(),t+400)},onTransitionEnd(e){e.propertyName!=="transform"||this.phase!=="run"||performance.now()-this.runStartedAt<250||this.finishSpin()},finishSpin(){if(this.phase!=="run")return;const e=this.pendingIndex;clearTimeout(this.safetyTimer),this.phase="idle",this.pendingIndex=null,this.$emit("settled",e)}}},ee={viewBox:"0 0 200 200",role:"img","aria-label":"Ruota dei premi"},te=["d"],ie=["x","y","transform"],ne=["x","dy"];function se(e,t,n,u,s,i){return o(),a("div",{class:w(["spin-wheel",{"is-spinning":n.spinning,"is-inviting":n.inviting&&!n.spinning}])},[t[2]||(t[2]=r("div",{class:"spin-wheel__glow","aria-hidden":"true"},null,-1)),t[3]||(t[3]=r("div",{class:"spin-wheel__pointer","aria-hidden":"true"},[r("svg",{viewBox:"0 0 32 40",role:"presentation"},[r("path",{d:"M16 38 L3 10 A 14 14 0 1 1 29 10 Z"}),r("circle",{cx:"16",cy:"13",r:"4.4"})])],-1)),r("div",{class:"spin-wheel__disc",style:U(i.discStyle),onTransitionend:t[0]||(t[0]=(...l)=>i.onTransitionEnd&&i.onTransitionEnd(...l))},[(o(),a("svg",ee,[(o(!0),a(v,null,M(i.wheelSegments,l=>(o(),a("g",{key:l.prize.id,class:w(["spin-seg",`spin-seg--${l.prize.tone}`])},[r("path",{d:l.path},null,8,te),r("text",{x:l.labelX,y:l.labelY,transform:l.labelTransform,"text-anchor":"middle"},[(o(!0),a(v,null,M(l.prize.lines,(p,f)=>(o(),a("tspan",{key:p,x:l.labelX,dy:f===0?-2:11,class:w(f===0?"spin-seg__value":"spin-seg__caption")},c(p),11,ne))),128))],8,ie)],2))),128)),t[1]||(t[1]=r("circle",{class:"spin-wheel__rim",cx:"100",cy:"100",r:"96"},null,-1))]))],36),t[4]||(t[4]=r("div",{class:"spin-wheel__hub","aria-hidden":"true"},[r("span",null,"SPIN")],-1))],2)}const re=T($,[["render",se],["__scopeId","data-v-b7c8a9b3"]]),oe=.16,E=.994,ae={props:{active:{type:Boolean,default:!1},colors:{type:Array,default:()=>[]},pieces:{type:Number,default:130},durationMs:{type:Number,default:2600}},emits:["done"],data(){return{running:!1}},watch:{active(e){if(e){this.start();return}this.stop()}},created(){this.particles=[],this.frame=null,this.startedAt=0},beforeUnmount(){this.stop()}
1,methods:{start(){if(I()){this.$emit("done");return}this.running=!0,this.$nextTick(()=>{const e=this.$refs.canvas;e&&(this.resize(),this.particles=this.createParticles(e),this.startedAt=performance.now(),this.frame=requestAnimationFrame(this.tick),window.addEventListener("resize",this.resize))})},stop(){cancelAnimationFrame(this.frame),window.removeEventListener("resize",this.resize),this.frame=null,this.particles=[],this.running=!1},resize(){const e=this.$refs.canvas;if(!e)return;const t=Math.min(window.devicePixelRatio||1,2);e.width=e.clientWidth*t,e.height=e.clientHeight*t,e.getContext("2d").setTransform(t,0,0,t,0,0)},paletteFrom(e){if(this.colors.length)return this.colors;const t=getComputedStyle(e),n=[1,2,3,4,5].map(u=>t.getPropertyValue(`--spin-confetti-${u}`).trim()).filter(Boolean);return n.length?n:["currentColor"]},createParticles(e){const t=e.clientWidth,n=this.paletteFrom(e);return Array.from({length:this.pieces},()=>({x:t*(.2+Math.random()*.6),y:-20-Math.random()*e.clientHeight*.4,vx:(Math.random()-.5)*4.2,vy:1.4+Math.random()*3.4,size:4+Math.random()*6,ratio:.4+Math.random()*.6,angle:Math.random()*Math.PI*2,spin:(Math.random()-.5)*.24,color:n[Math.floor(Math.random()*n.length)]}))},tick(e){const t=this.$refs.canvas;if(!t||!this.running)return;const n=t.getContext("2d"),u=e-this.startedAt,s=Math.max(0,1-Math.max(0,u-this.durationMs*.55)/(this.durationMs*.45));if(n.clearRect(0,0,t.clientWidth,t.clientHeight),n.globalAlpha=s,this.particles.forEach(i=>{i.vy=i.vy*E+oe,i.vx*=E,i.x+=i.vx,i.y+=i.vy,i.angle+=i.spin,n.save(),n.translate(i.x,i.y),n.rotate(i.angle),n.fillStyle=i.color,n.fillRect(-i.size/2,-(i.size*i.ratio)/2,i.size,i.size*i.ratio),n.restore()}),n.globalAlpha=1,u>=this.durationMs){n.clearRect(0,0,t.clientWidth,t.clientHeight),this.stop(),this.$emit("done");return}this.frame=requestAnimationFrame(this.tick)}}},le={key:0,ref:"canvas",class:"spin-confetti","aria-hidden":"true"};function ue(e,t,n,u,s,i){return s.running?(o(),a("canvas",le,null,512)):d("",!0)}const ce=T(ae,[["render",ue],["__scopeId","data-v-8a49a0a1"]]),de={props:{open:{type:Boolean,default:!1},prize:{type:Object,default:null},nextSpinLabel:{type:String,default:""},locked:{type:Boolean,default:!1},usableFrom:{type:String,default:""},expiresAt:{type:String,default:""}},emits:["close","use-prize","register"],data(){return{titleId:`spin-prize-title-${Math.random().toString(36).slice(2,8)}`,descriptionId:`spin-prize-description-${Math.random().toString(36).slice(2,8)}`,previousBodyOverflow:"",previousActiveElement:null}},computed:{isWin(){return!!this.prize&&this.prize.is_losing!==!0},lines(){return this.prize?[this.prize.label,this.prize.label_secondary].filter(Boolean):[]},kicker(){return this.isWin?this.locked?"Premio da sbloccare":"Hai vinto":"Nessuna vincita"},usableFromLabel(){if(!this.usableFrom)return"";const e=new Date(this.usableFrom);return Number.isNaN(e.getTime())||e.getTime()<=Date.now()?"":e.toLocaleString(void 0,{day:"2-digit",month:"long",hour:"2-digit",minute:"2-digit"})},expiresAtLabel(){if(!this.expiresAt)return"";const e=new Date(this.expiresAt);return Number.isNaN(e.getTime())?"":e.toLocaleDateString(void 0,{day:"2-digit",month:"long",year:"numeric"})}},watch:{open:{immediate:!0,handler(e){if(e){this.previousActiveElement=typeof document<"u"&&document.activeElement instanceof HTMLElement?document.activeElement:null,this.syncBodyScrollLock(!0),G(()=>{var t;return(t=this.$refs.closeButton)==null?void 0:t.focus()});return}this.cleanupModalState()}}},beforeUnmount(){this.cleanupModalState()},methods:{syncBodyScrollLock(e){if(!(typeof document>"u")){if(e){this.previousBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden";return}document.body.style.overflow=this.previousBodyOverflow||"",this.previousBodyOverflow=""}},cleanupModalState(){var e;this.syncBodyScrollLock(!1),typeof((e=this.previousActiveElement)==null?void 0:e.focus)=="function"&&this.previousActiveElement.focus(),this.previousActiveElement=null},close(){this.$emit("close")},onOverlayClick(e){e.target===e.currentTarget&&this.close()},onKeydown(e){e.key==="Escape"&&(e.preventDefault(),this.close())}}},he=["aria-labelledby","aria-describedby"],pe={class:"spin-prize-head"},me={class:"pill"},fe={class:"spin-prize-badge","aria-hidden":"true"},ge=["id"],_e=["id"],be={key:0,class:"spin-prize-locked"},ye={key:1,class:"spin-prize-coupon"},we={key:0},ve={key:1},xe={key:2,class:"spin-prize-next"},ze={key:3,class:"spin-prize-next"},Se={class:"spin-prize-actions"};function ke(e,t,n,u,s,i){return o(),H(K,{to:"body"},[b(j,{name:"spin-prize-fade"},{default:A(()=>[n.open&&n.prize?(o(),a("div",{key:0,class:"spin-prize-overlay",onClick:t[4]||(t[4]=(...l)=>i.onOverlayClick&&i.onOverlayClick(...l)),onKeydown:t[5]||(t[5]=(...l)=>i.onKeydown&&i.onKeydown(...l))},[r("section",{class:w(["spin-prize-card",i.isWin?"is-win":"is-miss"]),role:"alertdialog","aria-modal":"true","aria-labelledby":s.titleId,"aria-describedby":s.descriptionId},[r("header",pe,[r("span",me,c(i.kicker),1),r("button",{ref:"closeButton",type:"button",class:"spin-prize-close","aria-label":"Chiudi",onClick:t[0]||(t[0]=(...l)=>i.close&&i.close(...l))}
1," à ",512)]),r("div",fe,[(o(!0),a(v,null,M(i.lines,l=>(o(),a("span",{key:l},c(l),1))),128))]),r("h3",{id:s.titleId},c(n.prize.title||n.prize.label),9,ge),r("p",{id:s.descriptionId},c(n.prize.description),9,_e),i.isWin&&n.locked?(o(),a("div",be,[...t[6]||(t[6]=[r("strong",null,"Registrati per riscattarlo",-1),r("span",null,"Il premio resta tuo: appena crei l'account lo trovi tra le offerte.",-1)])])):i.isWin?(o(),a("div",ye,[r("div",null,[t[7]||(t[7]=r("strong",null,"à già tra le tue offerte",-1)),i.usableFromLabel?(o(),a("span",we,"Utilizzabile dal "+c(i.usableFromLabel),1)):(o(),a("span",ve,"Puoi usarlo da subito"))])])):d("",!0),i.isWin&&i.expiresAtLabel?(o(),a("p",xe," Valido fino al "+c(i.expiresAtLabel)+". ",1)):d("",!0),n.nextSpinLabel?(o(),a("p",ze,c(n.nextSpinLabel),1)):d("",!0),r("footer",Se,[r("button",{type:"button",class:"btn_2",onClick:t[1]||(t[1]=(...l)=>i.close&&i.close(...l))},"Chiudi"),i.isWin&&n.locked?(o(),a("button",{key:0,type:"button",class:"btn_1",onClick:t[2]||(t[2]=l=>e.$emit("register"))}," Registrati ")):i.isWin?(o(),a("button",{key:1,type:"button",class:"btn_1",onClick:t[3]||(t[3]=l=>e.$emit("use-prize",n.prize))}," Vedi le offerte ")):d("",!0)])],10,he)],32)):d("",!0)]),_:1})])}const Ae=T(de,[["render",ke],["__scopeId","data-v-c8a53ebc"]]);function P(e){return N.store.baseUrl+e}function B(e={}){return N.getApiHeaders({...e,"X-Visitor-Token":x()})}function Me(){return{can_spin:!1,spins_left:0,unavailable_reason:"",next_reset_at:"",pending_count:0,history:[]}}function D(e){return{can_spin:!!(e!=null&&e.can_spin),spins_left:Math.max(0,Number(e==null?void 0:e.spins_left)||0),unavailable_reason:(e==null?void 0:e.unavailable_reason)||"",next_reset_at:(e==null?void 0:e.next_reset_at)||"",pending_count:Math.max(0,Number(e==null?void 0:e.pending_count)||0),history:Array.isArray(e==null?void 0:e.history)?e.history:[]}}async function Te(){const{data:e}=await C.get(P(m.endpoints.config),{params:{visitor_token:x(),lang:N.lang},headers:B()});return e!=null&&e.enabled?{enabled:!0,name:e.name||"",headline:e.headline||"",subheadline:e.subheadline||"",rules_text:e.rules_text||"",require_registration:!!e.require_registration,spins_per_day:Math.max(1,Number(e.spins_per_day)||1),schedule:e.schedule||{},theme:e.theme||null,segments:Array.isArray(e.segments)?e.segments:[],status:D(e.status)}:{enabled:!1,segments:[],status:Me()}}function Ce(){const e=O();return C.post(P(m.endpoints.track),{visitor_token:x(),referrer:X(),...e},{headers:B({"Content-Type":"application/json"})}).catch(()=>{})}async function Ne(){const e=O(),{data:t}=await C.post(P(m.endpoints.play),{visitor_token:x(),...e},{headers:B({"Content-Type":"application/json"})});return{segment:(t==null?void 0:t.segment)||null,outcome:(t==null?void 0:t.outcome)||"lost",locked:!!(t!=null&&t.locked),usable_from:(t==null?void 0:t.usable_from)||"",expires_at:(t==null?void 0:t.expires_at)||"",redeem_notice_hours:Math.max(0,Number(t==null?void 0:t.redeem_notice_hours)||0),entry:(t==null?void 0:t.entry)||null,status:D(t==null?void 0:t.status)}}async function Pe(){const{data:e}=await C.post(P(m.endpoints.claim),{visitor_token:x()},{headers:B({"Content-Type":"application/json"})});return D(e)}const Be={components:{AppSpinWheel:re,AppSpinConfetti:ce,AppSpinPrizeModal:Ae},data(){return{state:N,wheel:null,segments:[],status:{can_spin:!1,spins_left:0,unavailable_reason:"",next_reset_at:"",pending_count:0,history:[]},loading:!0,spinning:!1,error:"",result:null,modalOpen:!1,confettiActive:!1,countdown:"",showAllHistory:!1}},computed:{isEnabled(){var e;return!!((e=this.wheel)!=null&&e.enabled)&&this.segments.length>0},isAuthenticated(){return this.state.customer.isAuthenticated},customerName(){var e;return((e=this.state.customer.profile)==null?void 0:e.name)||""},canSpinNow(){return this.status.can_spin&&!this.spinning&&!this.loading},headline(){var e;return((e=this.wheel)==null?void 0:e.headline)||"Gira e vinci"},subheadline(){var t,n;if((t=this.wheel)!=null&&t.subheadline)return this.wheel.subheadline;const e=((n=this.wheel)==null?void 0:n.spins_per_day)||1;return e>1?`Hai ${e} giri al giorno: ogni premio finisce tra le tue offerte.`:"Un giro al giorno: il premio che vinci finisce tra le tue offerte."},greeting(){return this.customerName?`Ciao ${this.customerName}`:""},pendingCount(){return this.status.pending_count},showRegistrationBanner(){var e;return!!((e=this.wheel)!=null&&e.require_registration)&&!this.isAuthenticated},spinButtonLabel(){return this.spinning?"Sta girandoâ¦":this.loading?"Un attimoâ¦":this.status.can_spin?"Gira la ruota":this.closedLabel||"Torna domani"},closedLabel(){return{wheel_closed_today:"Oggi non si gioca",wheel_closed_now:"Fuori orario",wheel_not_live:"Gioco chiuso",no_spins_left:"Torna domani"}[this.status.unavailable_reason]||""},nextSpinLabel(){return this.status.can_spin?this.status.spins_left>1?`Hai ${this.status.spins_left} giri disponibili`:"Hai un giro disponibile":this.status.unavailable_reason==="wheel_closed_now"?this.openingLabel||"La ruota riapre più tardi":this.status.unavailable_reason==="wheel_closed_today"?"Oggi la ruota è chiusa":this.countdown?`Prossimo giro tra ${this.countdown}`:"Prossimo giro domani"},openingLabel(){var n,u,s,i;const e=(u=(n=this.wheel)==null?void 0:n.schedule)==null?void 0:u.valid_from_time,t=(i=(s=this.wheel)==null?void 0:s.schedule)==null?void 0:i.valid_to_time;return!e&&!t?"":e&&t?`Si gioca dalle ${e} alle ${t}`:e?`Si gioca dalle ${e}`:`Si gioca fino alle ${t}`},wonPrizes(){return this.status.history},visiblePrizes(){return this.showAllHistory?this.wonPrizes:this.wonPrizes.slice(0,m.historyPreviewSize)},hasMorePrizes(){return this.wonPrizes.length>m.historyPreviewSize},wonPrizesCount(){return this.wonPrizes.length}},watch:{isAuthenticated(e){e&&this.claimPending()}},async created(){this.countdownTimer=null,await this.state.bootstrapCustomerSession(),await this.loadWheel(),this.isEnabled&&(Ce(),this.isAuthenticated&&this.pendingCount&&await this.claimPending())},mounted(){this.countdownTimer=setInterval(this.refreshCountdown,1e3),this.refreshCountdown()},beforeUnmount(){clearInterval(this.countdownTimer)},methods:{async loadWheel(){var e,t,n,u;this.loading=!0,this.error="";try{const s=await Te();this.wheel=s,this.segments=s.segments,this.status=s.status}catch(s){if(((e=s==null?void 0:s.response)==null?void 0:e.status)===401||((t=s==null?void 0:s.response)==null?void 0:t.status)===403){this.state.clearCustomerSession();return}this.error=((u=(n=s==null?void 0:s.response)==null?void 0:n.data)==null?void 0:u.message)||"Non riesco a caricare il gioco in questo momento."}finally{this.loading=!1,this.refreshCountdown()}},async claimPending(){var e,t;try{this.status=await Pe()}catch(n){this.error=((t=(e=n==null?void 0:n.response)==null?void 0:e.data)==null?void 0:t.message)||"Non riesco a sbloccare i premi in attesa."}},async spin(){var e;if(this.canSpinNow){this.spinning=!0,this.error="",this.result=null,this.buzz(12);try{const t=await Ne(),n=this.segments.findIndex(u=>{var s;return u.id===((s=t.segment)==null?void 0:s.id)});if(n<0)throw await this.loadWheel(),new Error("Il gioco è stato aggiornato: riprova.");this.result=t,this.$refs.wheel.spinTo(n)}catch(t){this.spinning=!1;const n=(e=t==null?void 0:t.response)==null?void 0:e.data;n!=null&&n.status&&(this.status=n.status),this.error=(n==null?void 0:n.message)||(t==null?void 0:t.message)||"Il giro non è andato a buon fine."}}},onWheelSettled(){this.spinning=!1,this.result&&(this.status=this.result.status,this.refreshCountdown(),this.modalOpen=!0,this.confettiActive=this.result.outcome==="won",this.buzz(this.result.outcome==="won"?[18,60,26]:10))},buzz(e){var t;try{(t=navigator.vibrate)==null||t.call(navigator,e)}catch{}},closeModal(){this.modalOpen=!1,this.confettiActive=!1},usePrize(){this.closeModal(),this.$router.push("/offerte")},goToRegistration(){this.closeModal(),this.$router.push("/account")},refreshCountdown(){const e=this.status.next_reset_at?new Date(this.status.next_reset_at):null;if(!e||Number.isNaN(e.getTime())||this.status.can_spin){this.countdown="";return}const t=e.getTime()-Date.now();if(t<=0){this.countdown="",this.loadWheel();return}const n=Math.floor(t/36e5),u=Math.floor(t%36e5/6e4),s=Math.floor(t%6e4/1e3);this.countdown=`${String(n).padStart(2,"0")}
1:${String(u).padStart(2,"0")}:${String(s).padStart(2,"0")}`},entryLabel(e){return e.title||e.label||"Premio"},entryDate(e){const t=new Date(e.played_at);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(this.state.lang||"it",{day:"2-digit",month:"short"})},entryNote(e){if(e.locked)return"Da sbloccare";if(e.redeemed)return"Già usato";if(e.usable_from){const t=new Date(e.usable_from);if(!Number.isNaN(t.getTime())&&t.getTime()>Date.now())return`Dal ${t.toLocaleDateString(this.state.lang||"it",{day:"2-digit",month:"short"})}`}return""}}},Le={class:"pad-c spin-page"},Ie={key:0,class:"spin-skeleton","aria-live":"polite"},De={key:1,class:"spin-closed"},Fe={class:"spin-intro",initial:{opacity:0,y:16},enter:{opacity:1,y:0,transition:{duration:460}}},Re={class:"pill spin-intro__kicker"},We={class:"spin-stage",initial:{opacity:0,scale:.9},enter:{opacity:1,scale:1,transition:{duration:620,delay:120}}},Ee={class:"spin-action",initial:{opacity:0,y:14},enter:{opacity:1,y:0,transition:{duration:460,delay:260}}},He=["disabled"],Oe={class:"spin-action__note"},Ve={key:0,class:"spin-dot","aria-hidden":"true"},qe={key:0,class:"spin-error",role:"alert"},Ue={key:0,class:"spin-tally"},Ge={class:"spin-tally__item"},je={key:0,class:"spin-tally__item is-pending"},Ke={class:"spin-signup__icon","aria-hidden":"true"},Xe={class:"spin-signup__text"},Ye={key:2,class:"spin-history"},Ze={class:"spin-history__head"},Je={class:"spin-history__list"},Qe=["enter"],$e={class:"spin-history__label"},et={key:0,class:"spin-history__note"},tt={key:3,class:"spin-rules"};function it(e,t,n,u,s,i){var z,F,R,W;const l=k("router-link"),p=k("AppSpinWheel"),f=k("AppSpinConfetti"),h=k("AppSpinPrizeModal"),g=Y("motion");
1return o(),a("main",Le,[s.loading?(o(),a("div",Ie,[...t[3]||(t[3]=[r("div",{class:"spin-skeleton__disc"},null,-1),r("span",null,"Preparo la ruotaâ¦",-1)])])):i.isEnabled?(o(),a(v,{key:2},[S((o(),a("header",Fe,[r("span",Re,c(s.wheel.name||"Gioco del giorno"),1),r("h1",null,c(i.headline),1),r("p",null,c(i.greeting?`${i.greeting}! ${i.subheadline}`:i.subheadline),1)])),[[g]]),S((o(),a("div",We,[b(p,{ref:"wheel",segments:s.segments,spinning:s.spinning,inviting:i.canSpinNow,onSettled:i.onWheelSettled},null,8,["segments","spinning","inviting","onSettled"])])),[[g]]),S((o(),a("div",Ee,[r("button",{type:"button",class:w(["btn_1","spin-cta",{"is-ready":i.canSpinNow,"is-busy":s.spinning}]),disabled:!i.canSpinNow,onClick:t[0]||(t[0]=(..._)=>i.spin&&i.spin(..._))},[r("span",null,c(i.spinButtonLabel),1)],10,He),r("p",Oe,[i.canSpinNow?(o(),a("span",Ve)):d("",!0),y(" "+c(i.nextSpinLabel),1)]),s.error?(o(),a("p",qe,c(s.error),1)):d("",!0)])),[[g]]),i.wonPrizesCount||i.pendingCount?(o(),a("div",Ue,[r("span",Ge,[r("strong",null,c(i.wonPrizesCount),1),t[8]||(t[8]=y(" premi vinti ",-1))]),i.pendingCount?(o(),a("span",je,[r("strong",null,c(i.pendingCount),1),t[9]||(t[9]=y(" da sbloccare ",-1))])):d("",!0)])):d("",!0),i.showRegistrationBanner?(o(),H(l,{key:1,class:"spin-signup",to:"/account"},{default:A(()=>[r("span",Ke,c(i.pendingCount?"ð":"â¨"),1),r("span",Xe,[r("strong",null,c(i.pendingCount?"Hai un premio in attesa":"Il premio si sblocca con un account"),1),r("small",null,c(i.pendingCount?"Registrati e lo trovi subito tra le tue offerte.":"Gira quanto vuoi: per riscattare bastano pochi secondi."),1)]),t[10]||(t[10]=r("span",{class:"spin-signup__go","aria-hidden":"true"},"âº",-1))]),_:1})):d("",!0),i.visiblePrizes.length?(o(),a("section",Ye,[r("header",Ze,[t[12]||(t[12]=r("h2",null,"I premi che hai vinto",-1)),b(l,{to:"/offerte"},{default:A(()=>[...t[11]||(t[11]=[y("Le mie offerte",-1)])]),_:1})]),r("ul",Je,[(o(!0),a(v,null,M(i.visiblePrizes,(_,q)=>S((o(),a("li",{key:_.id,initial:{opacity:0,x:-10},enter:{opacity:1,x:0,transition:{duration:320,delay:40*q}}},[t[13]||(t[13]=r("span",{class:"spin-history__mark","aria-hidden":"true"},"ð",-1)),r("span",$e,c(i.entryLabel(_)),1),i.entryNote(_)?(o(),a("span",et,c(i.entryNote(_)),1)):d("",!0),r("time",null,c(i.entryDate(_)),1)],8,Qe)),[[g]])),128))]),i.hasMorePrizes?(o(),a("button",{key:0,type:"button",class:"spin-history__more",onClick:t[1]||(t[1]=_=>s.showAllHistory=!s.showAllHistory)},c(s.showAllHistory?"Mostra meno":`Vedi tutti (${i.wonPrizes.length})`),1)):d("",!0)])):d("",!0),s.wheel.rules_text?(o(),a("details",tt,[t[14]||(t[14]=r("summary",null,"Regolamento",-1)),r("p",null,c(s.wheel.rules_text),1)])):d("",!0)],64)):(o(),a("section",De,[t[5]||(t[5]=r("span",{class:"spin-closed__icon","aria-hidden":"true"},"â",-1)),t[6]||(t[6]=r("h1",null,"Il gioco è chiuso",-1)),t[7]||(t[7]=r("p",null,"In questo momento non c'è nessuna ruota attiva. Dai un'occhiata alle offerte del momento.",-1)),b(l,{class:"btn_1",to:"/offerte"},{default:A(()=>[...t[4]||(t[4]=[y("Vedi le offerte",-1)])]),_:1})])),b(f,{active:s.confettiActive,onDone:t[2]||(t[2]=_=>s.confettiActive=!1)},null,8,["active"]),b(h,{open:s.modalOpen,prize:((z=s.result)==null?void 0:z.segment)||null,locked:!!((F=s.result)!=null&&F.locked),"usable-from":((R=s.result)==null?void 0:R.usable_from)||"","expires-at":((W=s.result)==null?void 0:W.expires_at)||"","next-spin-label":i.nextSpinLabel,onClose:i.closeModal,onUsePrize:i.usePrize,onRegister:i.goToRegistration},null,8,["open","prize","locked","usable-from","expires-at","next-spin-label","onClose","onUsePrize","onRegister"])])}const st=T(Be,[["render",it],["__scopeId","data-v-25384569"]]);export{st 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.