const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-CZ4JTT9J.js","assets/index-CkLBOkYv.js","assets/main-Jpa1YoBA.css","assets/index-CnvLnlyT.js"])))=>i.map(i=>d[i]);
import{C as u,_ as o}from"./index-CkLBOkYv.js";const a=3,w=15,f=30*24*60*60*1e3,p=2500,i="review:winCount",c="review:lastPromptTs";async function r(){const{Preferences:t}=await o(async()=>{const{Preferences:e}=await import("./main-CZ4JTT9J.js").then(n=>n.aR);return{Preferences:e}},__vite__mapDeps([0,1,2]));return t}async function P(){try{const t=await r(),{value:e}=await t.get({key:i});return e&&parseInt(e,10)||0}catch{return 0}}async function y(t){try{await(await r()).set({key:i,value:String(t)})}catch{}}async function _(){try{const t=await r(),{value:e}=await t.get({key:c});return e&&parseInt(e,10)||0}catch{return 0}}async function l(t){try{await(await r()).set({key:c,value:String(t)})}catch{}}let s=!1;async function R(){if(!s){s=!0;try{const{InAppReview:t}=await o(async()=>{const{InAppReview:e}=await import("./index-CnvLnlyT.js");return{InAppReview:e}},__vite__mapDeps([3,1]));await t.requestReview(),console.log("[InAppReview] Review prompt shown")}catch(t){console.warn("[InAppReview] requestReview failed:",t)}finally{s=!1}}}function v(t,e){if(t<a)return!1;const n=Date.now();return e>0&&n-e<f?!1:t===a||(t-a)%w===0}async function I(){try{if(!u.isNativePlatform())return;const t=await P()+1;await y(t);const e=await _();if(!v(t,e))return;setTimeout(async()=>{try{await l(Date.now()),await R()}catch(n){console.warn("[InAppReview] Delayed prompt error:",n)}},p)}catch(t){console.warn("[InAppReview] maybePromptReview error:",t)}}export{I as maybePromptReview};
