var V=Object.defineProperty;var Q=(n,e,t)=>e in n?V(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var b=(n,e,t)=>(Q(n,typeof e!="symbol"?e+"":e,t),t);import{a as E,U as F}from"./UIEventSource-92ac4fe9.js";import{L as X}from"./Constants-78dfb500.js";/*! Capacitor: https://capacitorjs.com/ - MIT License */var O;(function(n){n.Unimplemented="UNIMPLEMENTED",n.Unavailable="UNAVAILABLE"})(O||(O={}));class S extends Error{constructor(e,t,r){super(e),this.message=e,this.code=t,this.data=r}}const Y=n=>{var e,t;return n!=null&&n.androidBridge?"android":!((t=(e=n==null?void 0:n.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||t===void 0)&&t.bridge?"ios":"web"},Z=n=>{const e=n.CapacitorCustomPlatform||null,t=n.Capacitor||{},r=t.Plugins=t.Plugins||{},i=()=>e!==null?e.name:Y(n),s=()=>i()!=="web",a=o=>{const c=y.get(o);return!!(c!=null&&c.platforms.has(i())||d(o))},d=o=>{var c;return(c=t.PluginHeaders)===null||c===void 0?void 0:c.find($=>$.name===o)},f=o=>n.console.error(o),y=new Map,x=(o,c={})=>{const $=y.get(o);if($)return console.warn(`Capacitor plugin "${o}" already registered. Cannot register plugins twice.`),$.proxy;const L=i(),C=d(o);let p;const K=async()=>(!p&&L in c?p=typeof c[L]=="function"?p=await c[L]():p=c[L]:e!==null&&!p&&"web"in c&&(p=typeof c.web=="function"?p=await c.web():p=c.web),p),z=(u,g)=>{var w,v;if(C){const P=C==null?void 0:C.methods.find(h=>g===h.name);if(P)return P.rtype==="promise"?h=>t.nativePromise(o,g.toString(),h):(h,U)=>t.nativeCallback(o,g.toString(),h,U);if(u)return(w=u[g])===null||w===void 0?void 0:w.bind(u)}else{if(u)return(v=u[g])===null||v===void 0?void 0:v.bind(u);throw new S(`"${o}" plugin is not implemented on ${L}`,O.Unimplemented)}},q=u=>{let g;const w=(...v)=>{const P=K().then(h=>{const U=z(h,u);if(U){const A=U(...v);return g=A==null?void 0:A.remove,A}else throw new S(`"${o}.${u}()" is not implemented on ${L}`,O.Unimplemented)});return u==="addListener"&&(P.remove=async()=>g()),P};return w.toString=()=>`${u.toString()}() { [capacitor code] }`,Object.defineProperty(w,"name",{value:u,writable:!1,configurable:!1}),w},T=q("addListener"),B=q("removeListener"),J=(u,g)=>{const w=T({eventName:u},g),v=async()=>{const h=await w;B({eventName:u,callbackId:h},g)},P=new Promise(h=>w.then(()=>h({remove:v})));return P.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await v()},P},j=new Proxy({},{get(u,g){switch(g){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return C?J:T;case"removeListener":return B;default:return q(g)}}});return r[o]=j,y.set(o,{name:o,proxy:j,platforms:new Set([...Object.keys(c),...C?[L]:[]])}),j};return t.convertFileSrc||(t.convertFileSrc=o=>o),t.getPlatform=i,t.handleError=f,t.isNativePlatform=s,t.isPluginAvailable=a,t.registerPlugin=x,t.Exception=S,t.DEBUG=!!t.DEBUG,t.isLoggingEnabled=!!t.isLoggingEnabled,t},_=n=>n.Capacitor=Z(n),R=_(typeof globalThisthis.removeListener(e,t);return Promise.resolve({remove:a})}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,t,r){const i=this.listeners[e];if(!i){if(r){let s=this.retainedEventArguments[e];s||(s=[]),s.push(t),this.retainedEventArguments[e]=s}return}i.forEach(s=>s(t))}hasListeners(e){var t;return!!(!((t=this.listeners[e])===null||t===void 0)&&t.length)}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:r=>{this.notifyListeners(t,r)}}}unimplemented(e="not implemented"){return new R.Exception(e,O.Unimplemented)}unavailable(e="not available"){return new R.Exception(e,O.Unavailable)}async removeListener(e,t){const r=this.listeners[e];if(!r)return;const i=r.indexOf(t);this.listeners[e].splice(i,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){const t=this.retainedEventArguments[e];t&&(delete this.retainedEventArguments[e],t.forEach(r=>{this.notifyListeners(e,r)}))}}const H=n=>encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),W=n=>n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class N extends M{async getCookies(){const e=document.cookie,t={};return e.split(";").forEach(r=>{if(r.length0?`domain=${e.url}`:"";document.cookie=`${t}=${r||""}${i}; path=${s}; ${a};`}catch(t){return Promise.reject(t)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}D("CapacitorCookies",{web:()=>new N});const ee=async n=>new Promise((e,t)=>{const r=new FileReader;r.onload=()=>{const i=r.result;e(i.indexOf(",")>=0?i.split(",")[1]:i)},r.onerror=i=>t(i),r.readAsDataURL(n)}),te=(n={})=>{const e=Object.keys(n);return Object.keys(n).map(i=>i.toLocaleLowerCase()).reduce((i,s,a)=>(i[s]=n[e[a]],i),{})},ne=(n,e=!0)=>n?Object.entries(n).reduce((r,i)=>{const[s,a]=i;let d,f;return Array.isArray(a)?(f="",a.forEach(y=>{d=e?encodeURIComponent(y):y,f+=`${s}=${d}&`}),f.slice(0,-1)):(d=e?encodeURIComponent(a):a,f=`${s}=${d}`),`${r}&${f}`},"").substr(1):null,re=(n,e={})=>{const t=Object.assign({method:n.method||"GET",headers:n.headers},e),i=te(n.headers)["content-type"]||"";if(typeof n.data=="string")t.body=n.data;else if(i.includes("application/x-www-form-urlencoded")){const s=new URLSearchParams;for(const[a,d]of Object.entries(n.data||{}))s.set(a,d);t.body=s.toString()}else if(i.includes("multipart/form-data")||n.data instanceof FormData){const s=new FormData;if(n.data instanceof FormData)n.data.forEach((d,f)=>{s.append(f,d)});else for(const d of Object.keys(n.data))s.append(d,n.data[d]);t.body=s;const a=new Headers(t.headers);a.delete("content-type"),t.headers=a}else(i.includes("application/json")||typeof n.data=="object")&&(t.body=JSON.stringify(n.data));return t};class se extends M{async request(e){const t=re(e,e.webFetchExtra),r=ne(e.params,e.shouldEncodeUrlParams),i=r?`${e.url}?${r}`:e.url,s=await fetch(i,t),a=s.headers.get("content-type")||"";let{responseType:d="text"}=s.ok?e:{};a.includes("application/json")&&(d="json");let f,y;switch(d){case"arraybuffer":case"blob":y=await s.blob(),f=await ee(y);break;case"json":f=await s.json();break;case"document":case"text":default:f=await s.text()}const x={};return s.headers.forEach((o,c)=>{x[c]=o}),{data:f,headers:x,status:s.status,url:s.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}D("CapacitorHttp",{web:()=>new se});const k=D("Databridge",{web:()=>({async request(n){return console.debug("Android polyfill got request for",n.key),n.key==="meta"?{value:"web"}:null}})}),l=class l{static backfillGeolocation(e){E.fromPromise(e.request({key:"location:has-permission"})).addCallbackAndRunD(r=>{const i=r.value==="true";l._geolocationPermission.set(i?"granted":"denied")})}static async requestGeoPermission(){return k.request({key:"location:request-permission"})}static async init(){const e=await l.databridgePlugin.request({key:"meta"});e.value!=="web"&&(l._inAndroid.set(!0),console.debug("Detected shell:",e.value),l.backfillGeolocation(l.databridgePlugin))}static async openLoginPage(){await k.request({key:"open:login"})}static async requestLoginCodes(){const t=(await k.request({key:"request:login"})).value.oauth_token;return console.debug("AndroidPolyfill: received oauth_token; trying to pass them to the oauth lib",t),t}static getInsetSizes(){if(l.insets)return l.insets;const e={top:new E(0),bottom:new E(0)};return l.insets=e,k.request({key:"insets"}).then(t=>{if(!t)return;let r=t.value;typeof r=="string"&&(r=JSON.parse(r)),e.bottom.set(r.bottom/window.devicePixelRatio),e.top.set(r.top/window.devicePixelRatio)}),e}static onBackButton(e,t){k.request({key:"backbutton"}).then(r=>{r!==null&&(l.onBackButton(e,t),!e()&&t.returnToIndex&&(window.location.href="/"))})}static watchLocation(e){k.request({key:"location:watch"}).then(t=>{const r=t.value;e.set({latitude:r.latitude,longitude:r.longitude,heading:r.heading,accuracy:r.accuraccy,altitude:r.altidude,altitudeAccuracy:void 0,speed:r.speed})})}static exit(){this.databridgePlugin.request({key:"exit"})}};b(l,"databridgePlugin",k),b(l,"_inAndroid",new E(!1)),b(l,"inAndroid",l._inAndroid),b(l,"_geolocationPermission",new E("prompt")),b(l,"geolocationPermission",l._geolocationPermission),b(l,"insets");let G=l;const m=class m{};b(m,"_isOnline",new E(F.runningFromConsole||navigator.onLine)),F.runningFromConsole||(window.addEventListener("online",()=>{m._isOnline.set(!0)}),window.addEventListener("offline",()=>{m._isOnline.set(!1)})),b(m,"forceOffline",E.asBoolean(X.get("forceOffline","false"))),b(m,"isOnline",m._isOnline.map(e=>e&&!m.forceOffline.data,[m.forceOffline]));let I=m;export{G as A,I}; //# sourceMappingURL=IsOnline-479694eb.js.map