1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/web-C2sUpP4-.js","assets/index-BCakBLyb.js","assets/ui-vendor-Nh77zFHh.js","assets/radix-vendor-8V-X-v15.js","assets/chart-vendor-BHC9f-XT.js","assets/table-vendor-CmSNR_WU.js","assets/react-vendor-B-TOzi2X.js","assets/index-bhMpgpoY.css"])))=>i.map(i=>d[i]); 2import{r as l}from"./ui-vendor-Nh77zFHh.js";import{cg as y,_ as p,af as f,a6 as v}from"./index-BCakBLyb.js";function b(e){e.CapacitorUtils.Synapse=new Proxy({},{get(w,o){return new Proxy({},{get(g,s){return(n,P,i)=>{const c=e.Capacitor.Plugins[o];if(c===void 0){i(new Error(`Capacitor plugin ${o} not found`));return}if(typeof c[s]!="function"){i(new Error(`Method ${s} not found in Capacitor plugin ${o}`));return}(async()=>{try{const m=await c[s](n);P(m)}catch(m){i(m)}})()}}})}})}function C(e){e.CapacitorUtils.Synapse=new Proxy({},{get(w,o){return e.cordova.plugins[o]}})}function E(e=!1){typeof window>"u"||(window.CapacitorUtils=window.CapacitorUtils||{},window.Capacitor!==void 0&&!e?b(window):window.cordova!==void 0&&C(window))}const d=y("Geolocation",{web:()=>p(()=>import("./web-C2sUpP4-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])).then(e=>new e.GeolocationWeb)});E();const h=e=>e==="granted"||e==="granted_when_in_use",_=e=>e,G=()=>{const[e,w]=l.useState(!1),[o,g]=l.useState(null),[s,n]=l.useState("unknown"),{toast:P}=v(),i=l.useCallback(async()=>{var t;if(typeof window>"u")return n("unavailable"),"unavailable";try{if(f.isNativePlatform()){const r=await d.checkPermissions(),a=h(r.location)?"granted":r.location==="prompt"?"prompt":"denied";return n(a),a}if(!navigator.geolocation)return n("unavailable"),"unavailable";if((t=navigator.permissions)!=null&&t.query){const r=await navigator.permissions.query({name:"geolocation"}),a=r.state;return n(a),r.onchange=()=>{n(r.state)},a}return n("prompt"),"prompt"}catch(r){return console.warn("No se pudo verificar permiso de ubicación:",r),n("prompt"),"prompt"}},[]);l.useEffect(()=>{i()},[i]);const c=l.useCallback(t=>new Promise(r=>{if(!navigator.geolocation){r(null);return}navigator.geolocation.getCurrentPosition(a=>r(_(a)),a=>{console.warn("No se pudo obtener ubicación del navegador:",a),r(null)},{enableHighAccuracy:(t==null?void 0:t.enableHighAccuracy)??!0,timeout:(t==null?void 0:t.timeout)??5e3,maximumAge:6e4})}),[]);return{getCurrentPosition:async t=>{w(!0);try{const r=await i();if((t==null?void 0:t.requireGrantedPermission)!==!1&&r!=="granted")return null;if(!f.isNativePlatform()){const u=await c(t);return u&&g(u),u}const a=await d.getCurrentPosition({enableHighAccuracy:(t==null?void 0:t.enableHighAccuracy)??!0,timeout:(t==null?void 0:t.timeout)??5e3});return g(a),a}catch(r){return console.error("Error getting location:",r),null}finally{w(!1)}},watchPosition:async t=>{try{return await d.watchPosition({enableHighAccuracy:!0,timeout:1e4},t)}catch(r){return console.error("Error watching position:",r),P({title:"Error de ubicación",description:"No se pudo monitorear la ubicación",variant:"destructive"}),null}},clearWatch:async t=>{try{await d.clearWatch({id:t})}catch(r){console.error("Error clearing watch:",r)}},requestLocationPermissions:async()=>{try{const t=await i();if(t==="granted")return!0;if(t==="denied"&&!f.isNativePlatform())return!1;if(!f.isNativePlatform()){const u=await c({enableHighAccuracy:!0,timeout:8e3});return u?(g(u),n("granted"),!0):await i()==="granted"}const r=await d.requestPermissions(),a=h(r.location);return n(a?"granted":"denied"),a}catch(t){return console.error("Error requesting location permissions:",t),await i(),!1}},checkLocationPermission:i,permissionStatus:s,hasLocationPermission:s==="granted",currentPosition:o,isLoading:e}};export{G as u};
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.