import{d as k,i as _,a as h,e as C,p as z,aw as B,O as v,X as N,Y as H,J as M,L as y,K as L,Q,ab as U}from"./EchoChannel-Dko4GTAA.js";import{u as A}from"./Gate-BQVvOn3b.js";import{g as w}from"./index-DjKJqAo0.js";import{_ as G}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./app-eBVI1eNF.js";import"./TelemetryClient-Difip1hg.js";var o=(r=>(r[r.None=0]="None",r[r.Authorized=1]="Authorized",r[r.Registered=2]="Registered",r[r.Join=3]="Join",r[r.Replay=4]="Replay",r[r.Requesting=5]="Requesting",r[r.Confirmation=6]="Confirmation",r[r.Login=7]="Login",r[r.Quote=8]="Quote",r[r.Contacted=9]="Contacted",r))(o||{}),i=(r=>(r[r.None=0]="None",r[r.Requesting=1]="Requesting",r[r.Confirmation=2]="Confirmation",r))(i||{});const T=["disabled"],J=["innerHTML"],j=k({__name:"RegisterButton",props:{isGuest:{type:[Boolean,null]},isHero:{type:[Boolean,null]},visible:{type:Boolean},card:{},showReplay:{type:Boolean},joinUrl:{}},emits:["registered"],setup(r,{emit:R}){const u=_("telemetryClient"),n=A(),e=r,x=R,d=h(i.None),g=h(),t=C(()=>d.value===i.Requesting?o.Requesting:d.value===i.Confirmation?o.Confirmation:e.card.isLive&&e.card.registered?o.Join:e.card.replay&&e.showReplay&&(e.card.registered||e.card.authorized)?o.Replay:e.card.isFuture&&e.card.registered?o.Registered:e.card.isFuture&&e.card.authorized?o.Authorized:e.card.isFuture&&!e.card.authorized&&!e.card.contacted?o.Quote:e.card.isFuture&&!e.card.authorized&&e.card.contacted?o.Contacted:o.None);z(()=>{const a=new URL(location.href);if(!e.isGuest&&a.pathname.startsWith("/webinar/")){const s=a.searchParams.get("action");s==="contact_us"&&t.value===o.Quote?b():s==="replay"&&t.value===o.Replay?n.startReplay():s==="register"&&t.value===o.Authorized&&p()}});const p=async()=>{if(!e.card.online){location.href="/event/register/"+e.card.id;return}n.lockHovering=!0,c(i.Requesting),await n.eventRegister(e.card)?(u.webinarRegister(e.card.name,e.isHero?"from header":"from card"),c(i.Confirmation),await B(1500),c(i.None),e.card.recommended=!1,e.card.registered=!0,await n.updateCard(e.card)):c(i.None),m(!0)},b=async()=>{n.lockHovering=!0,c(i.Requesting),await n.eventQuote(e.card)&&u.webinarContactUs(e.card.name,e.isHero?"from header":"from card"),e.card.contacted=!0,c(i.None),m()},m=(a=!1)=>{setTimeout(async()=>{n.lockHovering=!1,a&&x("registered")},500)},c=a=>{w.to(g.value,{scale:1.2,duration:.15,ease:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"}),d.value=a,w.to(g.value,{scale:1,delay:.15,duration:.15,ease:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"})},q=()=>{e.isHero?(u.webinarReplay(e.card.name),n.startReplay()):location.href=e.card.url+"?replay"},l=C(()=>[{label:` Registered <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 16" class="check-mark w-5 h-5 fill-current" > <path d="M20.443,0L6.98148,12.54L1.55698,7.81918L0.5,8.85522C1.02849,9.43189,6.64245,15.6286,6.98148,16L7.88889,15.0617L21.5,1.03604L20.443,0L20.443,0Z" > <animate attributeName="d" begin="0" dur="0.4s" repeatCount="1" values="M1.55698,7.81918L1.55698,8L1.55698,7.81918L0.5,8.85522C1.02849,9.43189,0.16097,8.48382,0.5,8.85522L0.5,8.85522L0.5,8.85522L1.55698,8L1.55698,7.81918Z;M6.98148,12.54L6.98148,12.54L1.55698,7.81918L0.5,8.85522C1.02849,9.43189,6.64245,15.6286,6.98148,16L7.88889,15.0617L7.88889,15.0617L6.98148,12.54L6.98148,12.54Z;M20.443,0L6.98148,12.54L1.55698,7.81918L0.5,8.85522C1.02849,9.43189,6.64245,15.6286,6.98148,16L7.88889,15.0617L21.5,1.03604L20.443,0L20.443,0Z" keyTimes="0;0.4;1" /> </path> </svg>`,condition:t.value===o.Confirmation||t.value===o.Registered,textColor:t.value===o.Confirmation?"text-white":"text-qorus-green",bgColor:t.value===o.Confirmation?"bg-qorus-green overflow-hidden before:delay-300 before:content-[''] before:absolute before:inset-0 before:bg-qorus-green before:brightness-75 before:translate-x-0 starting:before:-translate-x-full before:duration-700 before:ease-linear before:transition-all":"bg-transparent",action:()=>null,disabled:!0},{label:"Waiting list",condition:t.value===o.Contacted,textColor:"text-qorus-green",bgColor:"bg-transparent",action:()=>null,disabled:!0},{label:` In progress <svg class="relative animate-spin -mt-1 h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" > <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" ></circle> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" ></path> </svg>`,condition:t.value===o.Requesting,textColor:"text-black",bgColor:"bg-qorus-grey-light",action:()=>null,disabled:!0},{label:"Join now",condition:e.joinUrl&&t.value===o.Join,textColor:"text-white",bgColor:"bg-qorus-purple hover:brightness-90",action:()=>location.href=e.joinUrl,disabled:!1},{label:"Watch Replay",condition:t.value===o.Replay,textColor:"text-white",bgColor:"bg-qorus-purple hover:brightness-90",action:()=>e.isGuest?f():q(),disabled:!1},{label:e.isGuest?"Sign up":"Register",condition:t.value===o.Authorized,textColor:"text-white",bgColor:"bg-qorus-purple hover:brightness-90",action:()=>e.isGuest?f():p(),disabled:!1},{label:"Contact us",condition:t.value===o.Quote,textColor:"text-white",bgColor:"bg-qorus-purple hover:brightness-90",action:()=>e.isGuest?f():b(),disabled:!1}].find(s=>s.condition)),f=()=>{const a=new URL(location.href);t.value===o.Quote?a.searchParams.set("action","contact_us"):t.value===o.Replay?a.searchParams.set("action","replay"):t.value===o.Authorized&&a.searchParams.set("action","register");const s=new URLSearchParams;s.set("redirect",a.toString()),location.href="/login?"+s.toString()};return(a,s)=>(v(),N(U,{appear:"",name:"popping"},{default:H(()=>[l.value&&a.visible?(v(),M("button",{key:0,class:y(["relative h-10 min-w-32 px-4 py-2 font-light rounded-full",[l.value.textColor,l.value.disabled?"cursor-auto":"cursor-pointer"]]),ref_key:"button",ref:g,disabled:l.value.disabled,onClick:s[0]||(s[0]=()=>l.value.action())},[L("span",{class:y(["absolute inset-0 rounded-full",[l.value.bgColor]])},null,2),L("span",{innerHTML:l.value.label,class:"pointer-events-none relative flex gap-2 items-center justify-center"},null,8,J)],10,T)):Q("",!0)]),_:1}))}}),K=G(j,[["__scopeId","data-v-27145ce4"]]);export{K as default};