import{jsxs as t,jsx as e,Fragment as x}from"react/jsx-runtime";import{g as q}from"./fonts-CqawFh47.js";import{c as A}from"./utils-CMbmcP35.js";import u,{useRef as G,useCallback as E,useEffect as R}from"react";import"clsx";import"tailwind-merge";const U=u.memo(function({appName:b,heroBackgroundUrl:o,heroBackgroundWebP:v,heroHeight:$,smokeEnabled:H,newsSparksEnabled:L,appFont:X,appNameColor:w,buttonText:y="Play Now",serverStartTime:i,heroUseLogo:z,heroLogoUrl:N,heroLogoSize:k=300}){const d=G(null),S=E(a=>{const l=d.current;if(!l)return;const n=l.getBoundingClientRect(),j=a.clientX-n.left,r=a.clientY-n.top,c=n.width/2,m=n.height/2,f=(r-m)/m*-12,g=(j-c)/c*12;l.style.transform=`perspective(800px) rotateX(${f}deg) rotateY(${g}deg) scale3d(1.05, 1.05, 1.05)`},[]),M=E(()=>{const a=d.current;a&&(a.style.transform="perspective(800px) rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1)")},[]),[h,C]=u.useState(!1),[s,D]=u.useState({days:0,hours:0,minutes:0,seconds:0}),[Y,I]=u.useState(!0);R(()=>{const a=()=>C(window.innerWidth<768);return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),R(()=>{if(!i)return;const a=()=>{const n=new Date(i).getTime(),r=new Date().getTime()-n;if(r<0){I(!1);const p=Math.abs(r),P=Math.floor(p/(1e3*60*60*24)),T=Math.floor(p%(1e3*60*60*24)/(1e3*60*60)),W=Math.floor(p%(1e3*60*60)/(1e3*60)),F=Math.floor(p%(1e3*60)/1e3);D({days:P,hours:T,minutes:W,seconds:F});return}I(!0);const c=Math.floor(r/(1e3*60*60*24)),m=Math.floor(r%(1e3*60*60*24)/(1e3*60*60)),f=Math.floor(r%(1e3*60*60)/(1e3*60)),g=Math.floor(r%(1e3*60)/1e3);D({days:c,hours:m,minutes:f,seconds:g})};a();const l=setInterval(a,1e3);return()=>clearInterval(l)},[i]);const _=L&&!h;return t("section",{id:"hero",className:"youplay-banner banner-top youplay-banner-parallax small relative overflow-visible",style:{minHeight:`${$||40}vh`},children:[!h&&t("div",{className:"hero-effect",children:[e("div",{className:"hero-rocks"}),e("div",{className:"hero-sparkles-1"}),e("div",{className:"hero-sparkles-2"})]}),o?o.endsWith(".mp4")?e("div",{className:"absolute inset-0",children:e("video",{src:o,className:"h-full w-full object-cover",autoPlay:!0,loop:!0,muted:!0,playsInline:!0})}):e("div",{className:"image absolute inset-0","data-speed":"0.4",children:t("picture",{children:[v&&e("source",{srcSet:v,type:"image/webp"}),e("img",{src:o,alt:b,className:"jarallax-img h-full w-full object-cover",fetchPriority:"high",loading:"eager",decoding:"sync",onError:a=>{a.currentTarget.style.display="none";const l=document.createElement("div");l.className="absolute inset-0 bg-gradient-to-br from-background via-background to-muted/20",a.currentTarget.parentElement?.appendChild(l)}})]})}):e("div",{className:"from-background via-background to-muted/20 absolute inset-0 bg-gradient-to-br"}),H&&t("div",{className:`pointer-events-none absolute inset-0 overflow-hidden ${h?"opacity-20":"opacity-40"}`,children:[e("div",{className:"smoke-layer-1 absolute h-full w-full"}),e("div",{className:"smoke-layer-2 absolute h-full w-full"})]}),_&&t("div",{className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e("div",{className:"sparks-spark-1"}),e("div",{className:"sparks-spark-2"}),e("div",{className:"sparks-spark-3"}),t("div",{className:"sparks sparks_2",children:[e("div",{className:"spark_1"}),e("div",{className:"spark_2"}),e("div",{className:"spark_3"}),e("div",{className:"spark_4 spark-big"}),e("div",{className:"spark_5 spark-big"})]})]}),e("div",{className:"absolute inset-0 bg-black/40"}),e("div",{className:"pointer-events-none absolute bottom-0 h-32 w-full overflow-hidden sm:h-40 md:h-48",style:{left:"50%",transform:"translateX(-50%)"},children:e("img",{src:"/img/animations/blur-bottom.svg",alt:"",className:"h-full min-w-full object-cover object-top",style:{opacity:.85,maskImage:"linear-gradient(to bottom, transparent 0%, black 20%)",WebkitMaskImage:"linear-gradient(to bottom, transparent 0%, black 20%)"}})}),e("div",{className:"info absolute inset-0 z-10 flex items-center",children:e("div",{className:"container mx-auto px-4",children:t("div",{className:"flex translate-y-14 flex-col items-center gap-0",children:[t("div",{className:"flex flex-col items-center gap-6 overflow-visible px-12 py-16",style:{filter:"drop-shadow(0 10px 15px rgba(0,0,0,0.3))"},children:[z&&N?t(x,{children:[e("style",{dangerouslySetInnerHTML:{__html:`
                                            .hero-logo {
                                                max-height: ${Math.round(k*.6)}px;
                                            }
                                            @media (min-width: 768px) {
                                                .hero-logo {
                                                    max-height: ${k}px;
                                                }
                                            }
                                            .hero-logo-wrapper {
                                                position: relative;
                                                cursor: pointer;
                                                transition: transform 0.15s ease-out;
                                                will-change: transform;
                                            }
                                            .hero-logo-wrapper::before {
                                                content: '';
                                                position: absolute;
                                                inset: -30%;
                                                background: radial-gradient(circle at 50% 50%, rgba(251,191,36,0.15) 0%, transparent 60%);
                                                opacity: 0;
                                                transition: opacity 0.3s ease;
                                                pointer-events: none;
                                                z-index: -1;
                                            }
                                            .hero-logo-wrapper:hover::before {
                                                opacity: 1;
                                            }
                                        `}}),e("div",{ref:d,className:"hero-logo-wrapper",onMouseMove:S,onMouseLeave:M,children:e("img",{src:N,alt:b,className:"hero-logo relative z-1 w-auto object-contain",style:{filter:"drop-shadow(0 4px 20px rgba(0,0,0,0.5))",transition:"filter 0.3s ease"},onMouseEnter:a=>{a.currentTarget.style.filter="drop-shadow(0 4px 30px rgba(251,191,36,0.3)) drop-shadow(0 0 60px rgba(251,191,36,0.15))"},onMouseLeave:a=>{a.currentTarget.style.filter="drop-shadow(0 4px 20px rgba(0,0,0,0.5))"}})})]}):e("div",{ref:d,className:"hero-logo-wrapper inline-block",onMouseMove:S,onMouseLeave:M,children:e("h1",{className:A("bg-clip-text text-center text-[36px] leading-relaxed font-bold text-transparent md:text-9xl",q(X)),style:{backgroundImage:w?`linear-gradient(to bottom, #ffffff 0%, ${w} 100%)`:"linear-gradient(to bottom, #ffffff 0%, #fcd34d 50%, #d97706 100%)"},children:b||"Perfect World"})}),i&&e("div",{className:"flex flex-col items-center gap-3",children:Y?t(x,{children:[e("div",{className:"text-base font-semibold tracking-widest text-amber-200 uppercase md:text-lg",style:{textShadow:"0 2px 10px rgba(0,0,0,0.5)"},children:"Server is Running:"}),t("div",{className:"flex gap-2 md:gap-3",children:[t("div",{className:"flex flex-col items-center",children:[e("div",{className:"min-w-[60px] rounded-lg bg-black/50 px-3 py-2 backdrop-blur-sm md:min-w-[80px] md:px-5 md:py-3",children:e("div",{className:"text-center font-mono text-2xl font-bold text-amber-400 tabular-nums md:text-4xl",style:{textShadow:"0 0 20px rgba(251, 191, 36, 0.5)"},children:s.days.toString().padStart(2,"0")})}),e("div",{className:"mt-1.5 text-xs tracking-wider text-amber-200/80 uppercase md:text-sm",children:"Days"})]}),t("div",{className:"flex flex-col items-center",children:[e("div",{className:"min-w-[60px] rounded-lg bg-black/50 px-3 py-2 backdrop-blur-sm md:min-w-[80px] md:px-5 md:py-3",children:e("div",{className:"text-center font-mono text-2xl font-bold text-amber-400 tabular-nums md:text-4xl",style:{textShadow:"0 0 20px rgba(251, 191, 36, 0.5)"},children:s.hours.toString().padStart(2,"0")})}),e("div",{className:"mt-1.5 text-xs tracking-wider text-amber-200/80 uppercase md:text-sm",children:"Hours"})]}),t("div",{className:"flex flex-col items-center",children:[e("div",{className:"min-w-[60px] rounded-lg bg-black/50 px-3 py-2 backdrop-blur-sm md:min-w-[80px] md:px-5 md:py-3",children:e("div",{className:"text-center font-mono text-2xl font-bold text-amber-400 tabular-nums md:text-4xl",style:{textShadow:"0 0 20px rgba(251, 191, 36, 0.5)"},children:s.minutes.toString().padStart(2,"0")})}),e("div",{className:"mt-1.5 text-xs tracking-wider text-amber-200/80 uppercase md:text-sm",children:"Minutes"})]}),t("div",{className:"flex flex-col items-center",children:[e("div",{className:"min-w-[60px] rounded-lg bg-black/50 px-3 py-2 backdrop-blur-sm md:min-w-[80px] md:px-5 md:py-3",children:e("div",{className:"text-center font-mono text-2xl font-bold text-amber-400 tabular-nums md:text-4xl",style:{textShadow:"0 0 20px rgba(251, 191, 36, 0.5)"},children:s.seconds.toString().padStart(2,"0")})}),e("div",{className:"mt-1.5 text-xs tracking-wider text-amber-200/80 uppercase md:text-sm",children:"Seconds"})]})]})]}):t(x,{children:[e("div",{className:"text-base font-semibold tracking-widest text-amber-200 uppercase md:text-lg",style:{textShadow:"0 2px 10px rgba(0,0,0,0.5)"},children:"Server Launching In:"}),t("div",{className:"flex gap-2 md:gap-3",children:[t("div",{className:"flex flex-col items-center",children:[e("div",{className:"min-w-[60px] rounded-lg bg-black/50 px-3 py-2 backdrop-blur-sm md:min-w-[80px] md:px-5 md:py-3",children:e("div",{className:"text-center font-mono text-2xl font-bold text-amber-400 tabular-nums md:text-4xl",style:{textShadow:"0 0 20px rgba(251, 191, 36, 0.5)"},children:s.days.toString().padStart(2,"0")})}),e("div",{className:"mt-1.5 text-xs tracking-wider text-amber-200/80 uppercase md:text-sm",children:"Days"})]}),t("div",{className:"flex flex-col items-center",children:[e("div",{className:"min-w-[60px] rounded-lg bg-black/50 px-3 py-2 backdrop-blur-sm md:min-w-[80px] md:px-5 md:py-3",children:e("div",{className:"text-center font-mono text-2xl font-bold text-amber-400 tabular-nums md:text-4xl",style:{textShadow:"0 0 20px rgba(251, 191, 36, 0.5)"},children:s.hours.toString().padStart(2,"0")})}),e("div",{className:"mt-1.5 text-xs tracking-wider text-amber-200/80 uppercase md:text-sm",children:"Hours"})]}),t("div",{className:"flex flex-col items-center",children:[e("div",{className:"min-w-[60px] rounded-lg bg-black/50 px-3 py-2 backdrop-blur-sm md:min-w-[80px] md:px-5 md:py-3",children:e("div",{className:"text-center font-mono text-2xl font-bold text-amber-400 tabular-nums md:text-4xl",style:{textShadow:"0 0 20px rgba(251, 191, 36, 0.5)"},children:s.minutes.toString().padStart(2,"0")})}),e("div",{className:"mt-1.5 text-xs tracking-wider text-amber-200/80 uppercase md:text-sm",children:"Minutes"})]}),t("div",{className:"flex flex-col items-center",children:[e("div",{className:"min-w-[60px] rounded-lg bg-black/50 px-3 py-2 backdrop-blur-sm md:min-w-[80px] md:px-5 md:py-3",children:e("div",{className:"text-center font-mono text-2xl font-bold text-amber-400 tabular-nums md:text-4xl",style:{textShadow:"0 0 20px rgba(251, 191, 36, 0.5)"},children:s.seconds.toString().padStart(2,"0")})}),e("div",{className:"mt-1.5 text-xs tracking-wider text-amber-200/80 uppercase md:text-sm",children:"Seconds"})]})]})]})})]}),t("div",{className:"relative inline-block",children:[_&&t(x,{children:[e("div",{className:"absolute -top-4 -left-4 h-4 w-4 animate-pulse rounded-full bg-amber-400 blur-sm"}),e("div",{className:"absolute -top-2 -right-6 h-3 w-3 animate-pulse rounded-full bg-orange-400 blur-sm",style:{animationDelay:"0.2s"}}),e("div",{className:"absolute -bottom-3 left-1/4 h-3 w-3 animate-pulse rounded-full bg-yellow-400 blur-sm",style:{animationDelay:"0.4s"}}),e("div",{className:"absolute -right-4 -bottom-2 h-4 w-4 animate-pulse rounded-full bg-red-400 blur-sm",style:{animationDelay:"0.6s"}}),e("div",{className:"absolute top-1/2 -left-8 h-2 w-2 animate-ping rounded-full bg-amber-300 blur-sm",style:{animationDelay:"0.1s"}}),e("div",{className:"absolute top-1/2 -right-8 h-2 w-2 animate-ping rounded-full bg-orange-300 blur-sm",style:{animationDelay:"0.3s"}})]}),t("a",{href:"/#download",className:"relative z-10 inline-block cursor-pointer transition-transform duration-200 hover:scale-105",children:[e("img",{src:"/img/button/4.webp",alt:y,width:547,height:220,className:"h-auto w-auto"}),e("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center text-2xl font-bold text-white drop-shadow-lg",children:y})]})]})]})})})]})});export{U as HeroSection};
