import{k as b,g as n,e as i}from"./Button-CGr3NsJh.js";const L=b("share",[["path",{d:"M12 2v13",key:"1km8f5"}],["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}]]),e=i(typeof window<"u"?window.__pwaInstallPrompt??null:null),o=i(!1),c=i(!1);let r=!1;function w(a){a.preventDefault(),e.value=a,typeof window<"u"&&(window.__pwaInstallPrompt=a)}function p(){typeof window>"u"||r||(r=!0,e.value===null&&window.__pwaInstallPrompt&&(e.value=window.__pwaInstallPrompt),window.addEventListener("beforeinstallprompt",w,{capture:!0}))}function A(a=""){p();const l=`pwa_install_dismissed_${a||"default"}`,s=n(()=>typeof window>"u"?!1:window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0||document.referrer.includes("android-app://")),u=n(()=>typeof navigator>"u"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)),d=n(()=>typeof navigator>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1),v=n(()=>u.value&&!s.value),f=n(()=>typeof window>"u"?!1:window.isSecureContext===!0),m=n(()=>!!e.value&&f.value);function I(){try{const t=localStorage.getItem(l);return t?Date.now()-parseInt(t,10)<10080*60*1e3:!1}catch{return!1}}function g(){o.value=!1;try{localStorage.setItem(l,Date.now().toString())}catch{}}async function h(){if(e.value){e.value.prompt();try{const{outcome:t}=await e.value.userChoice;t==="accepted"&&(e.value=null,c.value=!0)}catch{e.value=null}}else d.value&&(o.value=!0)}function P(t){t.preventDefault(),e.value=t}function y(){p()}function _(){r&&(r=!1,window.removeEventListener("beforeinstallprompt",w,{capture:!0}),e.value=null)}function S(){typeof window<"u"&&window.__pwaInstallPrompt&&!e.value&&(e.value=window.__pwaInstallPrompt)}function M(){o.value=!0}return{installPromptEvent:e,showIosInstructions:o,showNotificationPromptAfterInstall:c,isStandalone:s,isMobile:u,isIos:d,isSecureContextForPwa:f,canTriggerNativeInstallPrompt:m,canShowInstallButton:v,tryGetDismissed:I,dismiss:g,triggerInstall:h,registerListener:y,unregisterListener:_,handleBeforeInstallPromptInComponent:P,syncInstallPromptFromWindow:S,openIosInstructions:M}}export{L as S,A as u};
