1import{l as h}from"./logger.DBjTP9ac.js";const Y="pg_install_prompt",ae=10080*60*1e3,oe=3,se="install-prompt-modal";let w=null,O=null,H=!1;function U(){try{const e=localStorage.getItem(Y);if(e)return JSON.parse(e)}catch{}return{shownCount:0,lastShownAt:0,dismissedAt:0,installed:!1}}function C(e){try{localStorage.setItem(Y,JSON.stringify({...U(),...e}))}catch{}}function J(){return!!(window.navigator.standalone===!0||window.matchMedia?.("(display-mode: standalone)").matches)}function M(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}function G(e){window.pgEvents=window.pgEvents||[],window.pgEvents.push({eventName:e})}function A(){return O||(O=document.getElementById(se)),O}function $(e,t=!1){const n=A();if(!n||window.__pgInstallPromptShowing||J())return!1;const i=U();return i.installed||!t&&(i.shownCount>=oe||i.dismissedAt&&Date.now()-i.dismissedAt<ae||document.visibilityState!=="visible"||!w&&!M())?!1:(window.__pgInstallPromptShowing=!0,n.dataset.trigger=e,n.dataset.platform=M()?"ios":"native",n.hidden=!1,C({shownCount:i.shownCount+1,lastShownAt:Date.now()}),G("install_prompt_shown_"+e),!0)}function u(e){const t=A();t&&(t.hidden=!0),window.__pgInstallPromptShowing=!1,e!=="accepted"&&C({dismissedAt:Date.now()}),G("install_prompt_"+e)}async function X(){if(!w){u("closed");return}try{await w.prompt();const e=await w.userChoice;w=null,e.outcome==="accepted"?(C({installed:!0}),u("accepted")):u("dismissed")}catch{u("dismissed")}}function re(){const e=A();e&&(e.querySelector('[data-action="install"]')?.addEventListener("click",()=>{M()?u("dismissed"):X()}),e.querySelector('[data-action="dismiss"]')?.addEventListener("click",()=>u("dismissed")),e.querySelector('[data-action="close"]')?.addEventListener("click",()=>u("closed")),e.addEventListener("click",t=>{t.target===e&&u("closed")}),document.addEventListener("keydown",t=>{t.key==="Escape"&&window.__pgInstallPromptShowing&&u("closed")}))}function le(){if(H)return;H=!0,window.addEventListener("beforeinstallprompt",n=>{n.preventDefault(),w=n}),window.addEventListener("appinstalled",()=>{C({installed:!0}),w=null,window.__pgInstallPromptShowing&&u("accepted")}),window.addEventListener("pg:engagement:rewarded-completed",()=>{A()?.dataset.allowAfterRewarded==="true"&&$("rewarded")});const t=A()?.dataset.allowAfterMinutes;if(t){const n=parseFloat(t);n>0&&de(n)}re()}function de(e){const t=e*60*1e3;let n=0,i=document.visibilityState==="visible"?Date.now():null;document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?i=Date.now():i!==null&&(n+=Date.now()-i,i=null)});const a=setInterval(()=>{i!==null&&(n+=Date.now()-i,i=Date.now()),n>=t&&(clearInterval(a),$("engagement"))},1e4)}function ce(){if(!(J()||U().installed)){if(w){X();return}M()&&$("button",!0)}}function j(e){try{const t=new URL(e);return t.searchParams.set("utm_source","share_link"),t.toString()}catch{return e}}function z(){return{title:document.title,url:j(window.location.href)}}function W(e){try{const t=new URL(e);return t.href.replace(`${t.protocol}//`,"")}catch{return e}}function ue(e){const t=encodeURIComponent(e.url||""),n=encodeURIComponent(e.title||"");return{facebook:`https://www.facebook.com/sharer/sharer.php?u=${t}`,x:`https://twitter.com/intent/tweet?url=${t}&text=${n}`,reddit:`https://www.reddit.com/submit?url=${t}&title=${n}`}}function fe(){const e=document.querySelector("[data-share]"),t=e?.querySelector('[data-action="share"]');if(!e||!t)return;const n=t.querySelector('[data-share-icon="send"]'),i=t.querySelector('[data-share-icon="check"]'),a=e.querySelector("[data-share-menu]"),r=e.querySelector("[data-share-url]"),E=e.querySelector("[data-share-copy]"),S=e.querySelector("[data-share-copy-icon]"),v=e.querySelector("[data-share-copied-icon]");let d=null,f=null;function P(){n&&(n.hidden=!0),i&&(i.hidden=!1),d&&clearTimeout(d),d=setTimeout(()=>{n&&(n.hidden=!1),i&&(i.hidden=!0)},3e3)}function y(){return!!a&&!a.hidden}function R(){if(!a)return;const o=z(),p=ue(o);a.querySelectorAll("[data-share-to]").forEach(g=>{const _=g.getAttribute("data-share-to")||"";p[_]&&(g.href=p[_])}),r&&(r.textContent=W(o.url||"")),a.hidden=!1,t.setAttribute("aria-expanded","true"),document.addEventListener("click",k,!0),document.addEventListener("keydown",q,!0)}function c(){!a||a.hidden||(a.hidden=!0,t.setAttribute("aria-expanded","fal
1se"),document.removeEventListener("click",k,!0),document.removeEventListener("keydown",q,!0))}function k(o){e.contains(o.target)||c()}function q(o){o.key==="Escape"&&(c(),t.focus())}async function F(o){if(navigator.canShare&&navigator.canShare(o))try{await navigator.share(o),P();return}catch{}try{await navigator.clipboard.writeText(o.url||""),P()}catch{}}t.addEventListener("click",async()=>{if(window.matchMedia("(pointer: coarse)").matches){await F(z());return}y()?c():R()}),E?.addEventListener("click",async o=>{o.preventDefault();const p=j(window.location.href);try{await navigator.clipboard.writeText(p),r&&(r.textContent="Copied"),S&&(S.hidden=!0),v&&(v.hidden=!1),f&&clearTimeout(f),f=setTimeout(()=>{r&&(r.textContent=W(p)),S&&(S.hidden=!1),v&&(v.hidden=!0)},3e3)}catch{}}),a?.querySelectorAll("[data-share-to]").forEach(o=>{o.addEventListener("click",()=>c())})}const pe="video-ad-popup",Q="video-ad-slot",me="video_banner",he=1200,we=10,Z=3,ve=1e3;let K=!1,L=null,m=null,T=null,D=null,B=!1,N=Z;function V(){const e=L?.dataset.state;return e==="play"||e==="fullscreen"}function ye(){const e=window;if(!e.__pgAdsReady){let t;e.__pgAdsReady=new Promise(n=>{t=n}),e.__pgAdsReady.resolve=t}return e.__pgAdsReady}function ee(e,t){const n=e*1e3;let i=0,a=document.visibilityState==="visible"?Date.now():null;const r=()=>{document.visibilityState==="visible"?a=Date.now():a!==null&&(i+=Date.now()-a,a=null)};document.addEventListener("visibilitychange",r);const E=setInterval(()=>{a!==null&&(i+=Date.now()-a,a=Date.now()),i>=n&&(clearInterval(E),document.removeEventListener("visibilitychange",r),t())},ve)}function te(e){if(V()){e();return}const t=new MutationObserver(()=>{V()&&(t.disconnect(),e())});t.observe(L,{attributes:!0,attributeFilter:["data-state"]})}function ne(){N>0&&ee(N*60,()=>te(ie))}function I(){if(D?.destroy)try{D.destroy()}catch{}D=null,m.classList.remove("video-ad--visible"),m.hidden=!0,T.innerHTML="",B&&(B=!1,ne())}function ge(e){e.addEventListener("rendered",()=>{m.classList.add("video-ad--visible"),h("video_ad_shown")}),e.addEventListener("viewable",()=>h("video_ad_viewable")),e.addEventListener("empty",t=>{const n=String(t?.detail?.reason||"unknown").replace(/[^a-z0-9]+/gi,"_");h("video_ad_empty_"+n),I()}),e.addEventListener("closed",()=>{h("video_ad_closed"),I()})}function ie(){if(B)return;if(window.innerWidth<=he||!V()){ne();return}const e=window.pgAds;if(typeof e?.requestVideoPageAd!="function"){console.warn("[video-ad] requestVideoPageAd is not available in this Ad SDK build");return}B=!0,m.hidden=!1,requestAnimationFrame(()=>{const t=T.getBoundingClientRect();if(!t.width||!t.height){console.warn("[video-ad] slot has zero size, skipping request"),I();return}h("video_ad_request"),Promise.resolve(e.requestVideoPageAd({el:Q,type:me})).then(n=>{D=n,ge(n)}).catch(n=>{console.warn("[video-ad] requestVideoPageAd failed",n),I()})})}function Ee(){if(K||(L=document.getElementById("app"),!L||L.dataset.videoAds!=="true")||(m=document.getElementById(pe),T=document.getElementById(Q),!m||!T))return;K=!0;const e=parseFloat(m.dataset.delaySec||"")||we,t=parseFloat(m.dataset.repeatMin||"");N=Number.isFinite(t)?t:Z,m.querySelector('[data-action="close"]')?.addEventListener("click",()=>{h("video_ad_dismissed"),I()}),ye().then(()=>{te(()=>ee(e,ie))})}(function(){h("loop_session_start");const e=document.getElementById("app");e?.dataset.autoplay==="true"&&(h("loop_play"),e&&(e.dataset.panel="shown"));const n=document.getElementById("sidebar"),i=document.getElementById("gamePanel"),a=document.querySelector("[data-action='show-panel']"),r=document.getElementById("fsHint"),E=document.getElementById("game-iframe");if(!e)return;const S=["howto","about","features","screenshots","faq"],v={};S.forEach(s=>{const l=document.getElementById(`popup-${s}`);l&&(v[s]=l)});let d=null,f=null;function P(){n?.classList.add("is-open"),n?.setAttribute("aria-hidden","false")}function y(){n?.classList.remove("is-open"),n?.setAttribute("aria-hidden","true")}function R(s){const l=v[s];if(!l)return;c(),y(),l.hidden=!1,d=l;const b=l.querySelector('[data-action="close-popup"]');
1b&&b.focus({preventScroll:!0})}function c(){d&&(d.hidden=!0,d=null)}function k(){h("loop_play"),c(),y(),e.dataset.state="play",e.dataset.panel="shown",i&&(i.hidden=!1,i.classList.remove("is-collapsed")),a&&(a.hidden=!0),E&&(E.hidden=!1),window.dispatchEvent(new Event("wrap:play"))}function q(){e.dataset.panel="hidden",i?.classList.add("is-collapsed"),a&&(a.hidden=!1)}function F(){e.dataset.panel="shown",i?.classList.remove("is-collapsed"),a&&(a.hidden=!0)}function o(){e.dataset.state="fullscreen",i&&(i.hidden=!0),a&&(a.hidden=!0),r&&(r.hidden=!1,f&&clearTimeout(f),window.matchMedia("(pointer: fine)").matches&&(f=setTimeout(()=>{r.hidden=!0},3e3))),document.documentElement.requestFullscreen&&document.documentElement.requestFullscreen().catch(()=>{})}function p(){e.dataset.state="play",i&&(i.hidden=!1),r&&(r.hidden=!0),f&&clearTimeout(f),document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{})}document.addEventListener("click",s=>{const l=s.target.closest("[data-action], [data-popup]");if(l){const b=l.getAttribute("data-popup");if(b){R(b);return}switch(l.getAttribute("data-action")){case"open-sidebar":P();return;case"close-sidebar":y();return;case"close-popup":c();return;case"play":k();return;case"hide-panel":q();return;case"show-panel":F();return;case"enter-fullscreen":o();return;case"exit-fullscreen":p();return}return}if(d&&!d.contains(s.target)){c();return}if(n?.classList.contains("is-open")&&!n.contains(s.target)){y();return}}),document.addEventListener("keydown",s=>{if(s.key==="Escape"){if(e.dataset.state==="fullscreen"){p();return}if(d){c();return}if(n?.classList.contains("is-open")){y();return}}}),document.addEventListener("fullscreenchange",()=>{!document.fullscreenElement&&e.dataset.state==="fullscreen"&&p()});function g(){document.documentElement.style.setProperty("--app-vh",window.innerHeight+"px")}g(),window.addEventListener("resize",g),window.addEventListener("orientationchange",()=>{g(),setTimeout(g,250)});const _=document.querySelectorAll(".faq__item");_.forEach(s=>{s.addEventListener("toggle",()=>{s.open&&_.forEach(l=>{l!==s&&(l.open=!1)})})}),fe(),Ee(),le(),[document.getElementById("topbar-install-btn"),document.getElementById("panel-install-btn")].filter(Boolean).forEach(s=>{s?.addEventListener("click",()=>ce())});const x=document.querySelector(".game-frame__video");x&&x.addEventListener("playing",()=>{x.classList.add("is-ready")},{once:!0})})();
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.