1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,98162,e=>{"use strict";let t=(0,e.i(82568).registerPlugin)("Browser",{web:()=>e.A(63442).then(e=>new e.BrowserWeb)});e.s(["Browser",0,t],3329),e.i(3329),e.s([],89414),e.i(89414),e.s(["Browser",0,t],98162)},93980,(e,t,r)=>{"use strict";async function n(e){let t=new TextEncoder().encode(e),r=Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t)));return btoa(String.fromCharCode.apply(null,r)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}Object.defineProperty(r,"__esModule",{value:!0}),r.generateCodeVerifier=function(){let e=new Uint8Array(128);crypto.getRandomValues(e);let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r="";for(let n=0;n<128;n++)r+=t.charAt(e[n]%t.length);return r},r.generateCodeChallenge=n,r.storePKCEVerifier=function(e,t){let r={verifier:t,timestamp:Date.now()};sessionStorage.setItem(`pkce_${e}`,JSON.stringify(r))},r.getPKCEVerifier=function(e){let t=sessionStorage.getItem(`pkce_${e}`);if(!t)return null;try{let r=JSON.parse(t);if(Date.now()-r.timestamp>6e5)return sessionStorage.removeItem(`pkce_${e}`),null;return r.verifier}catch{return null}},r.clearPKCEVerifier=function(e){sessionStorage.removeItem(`pkce_${e}`)},r.storeOAuthRedirectTo=function(e,t){let r={redirectTo:t,timestamp:Date.now()};sessionStorage.setItem(`oauth_redirect_${e}`,JSON.stringify(r))},r.getOAuthRedirectTo=function(e){let t=sessionStorage.getItem(`oauth_redirect_${e}`);if(!t)return null;try{let r=JSON.parse(t);if(Date.now()-r.timestamp>6e5)return sessionStorage.removeItem(`oauth_redirect_${e}`),null;return r.redirectTo}catch{return null}},r.clearOAuthRedirectTo=function(e){sessionStorage.removeItem(`oauth_redirect_${e}`)}},49015,(e,t,r)=>{"use strict";var n,i=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=e.e&&e.e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=e.e&&e.e.__importStar||(n=function(e){return(n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),a=0;a<r.length;a++)"default"!==r[a]&&i(t,e,r[a]);return o(t,e),t});Object.defineProperty(r,"__esModule",{value:!0}),r.OAuthAuthStorage=r.OAuthAuthAPI=void 0;let s=e.r(93980),c=e.r(4191);function l(){return window.hasOwnProperty("Capacitor")&&window.Capacitor.isNativePlatform()}let u="authgo_session_token";r.OAuthAuthAPI=class{constructor(e={},t){this.config={...c.defaultOAuthAuthConfig,...e},this.apiClient=t}async makeRequest(e,t,r,n){let i=`${this.config.authEndpoint}${t}`,o=l()?localStorage.getItem(u):null,a={};if(o&&(a.Authorization=`Bearer ${o}`),this.apiClient){let t={headers:{"Content-Type":"application/json",...a,...n},credentials:"include",signal:AbortSignal.timeout(1e4)};switch(e){case"GET":return this.apiClient.get(i,t);case"POST":return this.apiClient.post(i,r,t);case"PUT":return this.apiClient.put(i,r,t);case"PATCH":return this.apiClient.patch(i,r,t);case"DELETE":return this.apiClient.delete(i,r,t);default:throw Error(`Unsupported method: ${e}`)}}try{let t=new AbortController,o=setTimeout(()=>t.abort(),1e4),s={method:e,credentials:"include",headers:{"Content-Type":"POST"===e&&r instanceof URLSearchParams?"application/x-www-form-urlencoded":"application/json",...a,...n},signal:t.signal};r&&"GET"!==e&&(s.body=r instanceof URLSearchParams?r:JSON.stringify(r));let c=await fetch(i,s);if(clearTimeout(o),!c.ok){let e=await c.text();throw Error(`HTTP ${c.status}: ${e}`)}return{data:await c.json()}}catch(e){if(e instanceof Error&&"AbortError"===e.name)return{data:null,error:Error("Request timed out")};return{data:null,error:e}}}
1async exchangeAuthCode(e){try{let t=await this.makeRequest("GET",`/session/exchange?code=${encodeURIComponent(e)}`);if(t.error)return console.error("Auth code exchange failed:",t.error),null;let r=t.data?.session_token;if(r)return l()&&localStorage.setItem(u,r),console.info("Auth code exchanged successfully"),r;return console.warn("Auth code exchange returned no session token"),null}catch(e){return console.error("Auth code exchange error:",e),null}}async getSession(){try{if(!window.navigator.onLine)return console.info("Application is offline - skipping auth check"),null;let e=await this.makeRequest("POST","/session");if(e.error)return console.info("Network error fetching session:",e.error),null;let t=e.data;if(t&&"object"==typeof t&&t.id)return console.info("Session data received:",t),t;return console.warn("Invalid session data received:",t),null}catch(e){return window.navigator.onLine&&console.info("Failed to get session:",e),null}}async signOut(e){let{callbackUrl:t=window.location.origin,redirect:r=!0}=e??{};if(!window.navigator.onLine)throw console.info("Application is offline - cannot perform sign out"),Error("No internet connection. Please check your network and try again.");try{let e=new URLSearchParams({callbackUrl:t,json:"true"}),n=await this.makeRequest("POST","/session/sign-out",e);if(n.error)throw Error(`Sign out failed: ${n.error.message}`);let i=n.data;if(localStorage.removeItem(u),!1!==r){let e=i.url??t;!e||e.startsWith("/")||e.startsWith(window.location.origin)||(console.warn("Invalid redirect URL after sign out, falling back to origin"),e=window.location.origin),console.info("Redirecting after sign out to:",e),window.location.href=e,e.includes("#")&&window.location.reload();return}return i}catch(e){throw console.error("Sign out error:",e),e}}async signIn(t,r){if(!window.navigator.onLine)throw console.info("Application is offline - cannot perform sign in"),Error("No internet connection. Please check your network and try again.");if(!t||"string"!=typeof t)throw Error("Invalid authentication provider");let n=this.config.supportedProviders||["google","apple"];if(!n.includes(t.toLowerCase()))throw Error(`Unsupported provider: ${t}. Supported providers: ${n.join(", ")}`);try{let n=this.config.authEndpoint+"/auth",i=function(e){if(!e)return"/";if(/^https?:\/\//i.test(e))try{let t=new URL(e);return`${t.pathname||"/"}${t.search}${t.hash}`}catch{return"/"}return/^[a-zA-Z0-9.-]+:\/\//.test(e)||e.startsWith("/")?e:`/${e}`}(r?.redirectTo);(0,s.storeOAuthRedirectTo)(t,i);let o=new URLSearchParams;o.set("redirectTo",i),r?.scopes&&o.set("scopes",r.scopes),r?.relink&&o.set("relink","true");let c="";if("u">typeof document)try{let e=document.cookie.match(/(?:^|;\s*)referral_code=([^;]+)/);e&&(c=decodeURIComponent(e[1]))}catch(e){console.error("Failed to read referral_code cookie:",e)}c&&o.set("referral",c);let l=`${n}/${t}?${o.toString()}`;return console.info(`Initiating sign in with ${t} to:`,l),r?.redirect!==!1&&(window.hasOwnProperty("Capacitor")&&window.Capacitor.isNativePlatform()?Promise.resolve().then(()=>a(e.r(98162))).then(({Browser:e})=>e.open({url:l})):window.location.href=l),{ok:!0,status:200,url:l}}catch(e){throw console.error("Sign in error:",e),e}}
1async isAuthenticated(){return null!==await this.getSession()}async getCurrentUser(){let e=await this.getSession();return e?{id:e.id,email:e.email||null,name:e.name||null,image:e.image||null,username:e.username??void 0,first_name:e.first_name??void 0,last_name:e.last_name??void 0,role:e.role??"user",is_verified:e.is_verified??!0,created_at:e.created_at??void 0,updated_at:e.updated_at??void 0}:null}getConfig(){return this.config}},r.OAuthAuthStorage=class{constructor(e){this.config=e}setTempData(e,t){localStorage.setItem(`oauth_${e}`,t)}getTempData(e){return localStorage.getItem(`oauth_${e}`)}removeTempData(e){localStorage.removeItem(`oauth_${e}`)}clearTempData(){Object.keys(localStorage).filter(e=>e.startsWith("oauth_")).forEach(e=>localStorage.removeItem(e))}async isAuthenticated(){return!1}}},5945,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AuthProvider=l,r.OAuthProvider=function({children:e,config:t,authAPI:r}){return(0,n.jsx)(l,{config:t,authAPI:r,children:e})},r.useAuth=u,r.useOAuth=d,r.withAuth=function(e){return function(t){let{isAuthenticated:r,isLoading:i}=u();return i?(0,n.jsx)("div",{children:"Loading..."}):r?(0,n.jsx)(e,{...t}):(0,n.jsx)("div",{children:"Please log in to access this content."})}},r.ProtectedRoute=function({children:e,fallback:t=(0,n.jsx)("div",{children:"Please log in to access this content."}),loadingComponent:r=(0,n.jsx)("div",{children:"Loading..."})}){let{isAuthenticated:i,isLoading:o}=u();return o?(0,n.jsx)(n.Fragment,{children:r}):i?(0,n.jsx)(n.Fragment,{children:e}):(0,n.jsx)(n.Fragment,{children:t})},r.OAuthSignInButton=function({provider:e,options:t,children:r,className:i="",disabled:o=!1}){let{signIn:a,isLoading:s}=d(),c=async()=>{try{await a(e,t)}catch(t){console.error(`Sign in with ${e} failed:`,t)}},l=`Sign in with ${e.charAt(0).toUpperCase()+e.slice(1)}`;return(0,n.jsx)("button",{onClick:c,disabled:o||s,className:i,type:"button",children:r||l})};let n=e.r(43476),i=e.r(71645),o=e.r(49015),a=(e,t)=>{switch(t.type){case"SET_LOADING":return{...e,isLoading:t.payload};case"SET_USER":return{...e,user:t.payload,isAuthenticated:!!t.payload,isLoading:!1,error:null};case"SET_ERROR":return{...e,error:t.payload,isLoading:!1};case"CLEAR_ERROR":return{...e,error:null};case"LOGOUT":return{user:null,isAuthenticated:!1,isLoading:!1,error:null};default:return e}},s={user:null,isAuthenticated:!1,isLoading:!0,error:null},c=(0,i.createContext)(void 0);function l({children:e,config:t,authAPI:r}){let[u,d]=(0,i.useReducer)(a,s),h=r||new o.OAuthAuthAPI(t);(0,i.useEffect)(()=>{(async()=>{d({type:"SET_LOADING",payload:!0});try{if(window.hasOwnProperty("Capacitor")&&window.Capacitor.isNativePlatform()){let e=new URL(window.location.href),t=e.searchParams.get("auth_code");if(t)if(console.info("[Capacitor] Found auth_code in URL, exchanging..."),await h.exchangeAuthCode(t))e.searchParams.delete("auth_code"),window.history.replaceState({},document.title,e.toString());else{d({type:"SET_ERROR",payload:"Failed to exchange auth code. Please try signing in again."}),d({type:"SET_LOADING",payload:!1});return}}let e=await h.getCurrentUser();e?d({type:"SET_USER",payload:e}):d({type:"SET_LOADING",payload:!1})}catch(e){console.error("Auth initialization error:",e),d({type:"SET_ERROR",payload:"Failed to initialize authentication"})}})()},[h]);let f=async(e,t)=>{d({type:"SET_LOADING",payload:!0}),d({type:"CLEAR_ERROR"});try{let r=await h.signIn(e,t);return t?.redirect===!1&&d({type:"SET_LOADING",payload:!1}),r}catch(t){throw d({type:"SET_ERROR",payload:`Failed to sign in with ${e}`}),t}},g=async()=>{try{return await h.getSession()}catch(e){return console.error("Get session error:",e),null}},p=async e=>{d({type:"SET_LOADING",payload:!0}),d({type:"LOGOUT"});try{await h.signOut(e)}catch(e){console.error("Logout error:",e)}},m={...u,logout:p,clearError:()=>{d({type:"CLEAR_ERROR"})},signIn:f,getSession:g};return(0,n.jsx)(c.Provider,{value:m,children:e})}function u(){let e=(0,i.useContext)(c);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e}function d(){let e=u();
1return{...e,signIn:e.signIn,getSession:e.getSession,signOut:e.logout}}},66917,(e,t,r)=>{"use strict";var n=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=e.e&&e.e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.withOAuthAuth=r.useOAuthAuth=r.useOAuth=r.OAuthSignInButton=r.OAuthProvider=r.OAuthProtectedRoute=r.OAuthAuthProvider=r.withAuth=r.useAuth=r.ProtectedRoute=r.AuthProvider=r.storeOAuthRedirectTo=r.getOAuthRedirectTo=r.clearOAuthRedirectTo=r.clearPKCEVerifier=r.getPKCEVerifier=r.storePKCEVerifier=r.generateCodeChallenge=r.generateCodeVerifier=r.OAuthAuthStorage=r.OAuthAuthAPI=void 0,i(e.r(4191),r);var o=e.r(49015);Object.defineProperty(r,"OAuthAuthAPI",{enumerable:!0,get:function(){return o.OAuthAuthAPI}}),Object.defineProperty(r,"OAuthAuthStorage",{enumerable:!0,get:function(){return o.OAuthAuthStorage}});var a=e.r(93980);Object.defineProperty(r,"generateCodeVerifier",{enumerable:!0,get:function(){return a.generateCodeVerifier}}),Object.defineProperty(r,"generateCodeChallenge",{enumerable:!0,get:function(){return a.generateCodeChallenge}}),Object.defineProperty(r,"storePKCEVerifier",{enumerable:!0,get:function(){return a.storePKCEVerifier}}),Object.defineProperty(r,"getPKCEVerifier",{enumerable:!0,get:function(){return a.getPKCEVerifier}}),Object.defineProperty(r,"clearPKCEVerifier",{enumerable:!0,get:function(){return a.clearPKCEVerifier}}),Object.defineProperty(r,"clearOAuthRedirectTo",{enumerable:!0,get:function(){return a.clearOAuthRedirectTo}}),Object.defineProperty(r,"getOAuthRedirectTo",{enumerable:!0,get:function(){return a.getOAuthRedirectTo}}),Object.defineProperty(r,"storeOAuthRedirectTo",{enumerable:!0,get:function(){return a.storeOAuthRedirectTo}});var s=e.r(5945);Object.defineProperty(r,"AuthProvider",{enumerable:!0,get:function(){return s.AuthProvider}}),Object.defineProperty(r,"ProtectedRoute",{enumerable:!0,get:function(){return s.ProtectedRoute}}),Object.defineProperty(r,"useAuth",{enumerable:!0,get:function(){return s.useAuth}}),Object.defineProperty(r,"withAuth",{enumerable:!0,get:function(){return s.withAuth}}),Object.defineProperty(r,"OAuthAuthProvider",{enumerable:!0,get:function(){return s.AuthProvider}}),Object.defineProperty(r,"OAuthProtectedRoute",{enumerable:!0,get:function(){return s.ProtectedRoute}}),Object.defineProperty(r,"OAuthProvider",{enumerable:!0,get:function(){return s.OAuthProvider}}),Object.defineProperty(r,"OAuthSignInButton",{enumerable:!0,get:function(){return s.OAuthSignInButton}}),Object.defineProperty(r,"useOAuth",{enumerable:!0,get:function(){return s.useOAuth}}),Object.defineProperty(r,"useOAuthAuth",{enumerable:!0,get:function(){return s.useAuth}}),Object.defineProperty(r,"withOAuthAuth",{enumerable:!0,get:function(){return s.withAuth}})},82568,e=>{"use strict";var t,r,n,i,o,a,s,c;let l,u,d,h,f,g;(i=t||(t={})).Unimplemented="UNIMPLEMENTED",i.Unavailable="UNAVAILABLE";
1class p extends Error{constructor(e,t,r){super(e),this.message=e,this.code=t,this.data=r}}let m=(l=(a=o="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:e.g).CapacitorCustomPlatform||null,d=(u=a.Capacitor||{}).Plugins=u.Plugins||{},h=()=>{var e,t;return null!==l?l.name:(null==a?void 0:a.androidBridge)?"android":(null==(t=null==(e=null==a?void 0:a.webkit)?void 0:e.messageHandlers)?void 0:t.bridge)?"ios":"web"},f=e=>{var t;return null==(t=u.PluginHeaders)?void 0:t.find(t=>t.name===e)},g=new Map,u.convertFileSrc||(u.convertFileSrc=e=>e),u.getPlatform=h,u.handleError=e=>a.console.error(e),u.isNativePlatform=()=>"web"!==h(),u.isPluginAvailable=e=>{let t=g.get(e);return!!((null==t?void 0:t.platforms.has(h()))||f(e))},u.registerPlugin=(e,r={})=>{let n,i=g.get(e);if(i)return console.warn(`Capacitor plugin "${e}" already registered. Cannot register plugins twice.`),i.proxy;let o=h(),a=f(e),s=async()=>(!n&&o in r?n=n="function"==typeof r[o]?await r[o]():r[o]:null!==l&&!n&&"web"in r&&(n=n="function"==typeof r.web?await r.web():r.web),n),c=r=>{let n,i=(...i)=>{let c=s().then(s=>{let c=((r,n)=>{var i,s;if(a){let t=null==a?void 0:a.methods.find(e=>n===e.name);if(t)if("promise"===t.rtype)return t=>u.nativePromise(e,n.toString(),t);else return(t,r)=>u.nativeCallback(e,n.toString(),t,r);if(r)return null==(i=r[n])?void 0:i.bind(r)}else if(r)return null==(s=r[n])?void 0:s.bind(r);else throw new p(`"${e}" plugin is not implemented on ${o}`,t.Unimplemented)})(s,r);if(c){let e=c(...i);return n=null==e?void 0:e.remove,e}throw new p(`"${e}.${r}()" is not implemented on ${o}`,t.Unimplemented)});return"addListener"===r&&(c.remove=async()=>n()),c};return i.toString=()=>`${r.toString()}() { [capacitor code] }`,Object.defineProperty(i,"name",{value:r,writable:!1,configurable:!1}),i},m=c("addListener"),w=c("removeListener"),y=(e,t)=>{let r=m({eventName:e},t),n=async()=>{w({eventName:e,callbackId:await r},t)},i=new Promise(e=>r.then(()=>e({remove:n})));return i.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await n()},i},b=new Proxy({},{get(e,t){switch(t){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return a?y:m;case"removeListener":return w;default:return c(t)}}});return d[e]=b,g.set(e,{name:e,proxy:b,platforms:new Set([...Object.keys(r),...a?[o]:[]])}),b},u.Exception=p,u.DEBUG=!!u.DEBUG,u.isLoggingEnabled=!!u.isLoggingEnabled,o.Capacitor=u),w=m.registerPlugin;class y{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,t){let r=!1;this.listeners[e]||(this.listeners[e]=[],r=!0),this.listeners[e].push(t);let n=this.windowListeners[e];return n&&!n.registered&&this.addWindowListener(n),r&&this.sendRetainedArgumentsForEvent(e),Promise.resolve({remove:async()=>this.removeListener(e,t)})}async removeAllListeners(){for(let e in this.listeners={},this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,t,r){let n=this.listeners[e];if(!n){if(r){let r=this.retainedEventArguments[e];r||(r=[]),r.push(t),this.retainedEventArguments[e]=r}return}n.forEach(e=>e(t))}hasListeners(e){var t;return!!(null==(t=this.listeners[e])?void 0:t.length)}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:e=>{this.notifyListeners(t,e)}}}unimplemented(e="not implemented"){return new m.Exception(e,t.Unimplemented)}unavailable(e="not available"){return new m.Exception(e,t.Unavailable)}async removeListener(e,t){let r=this.listeners[e];if(!r)return;let n=r.indexOf(t);-1!==n&&this.listeners[e].splice(n,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){let t=this.retainedEventArguments[e];t&&(delete this.retainedEventArguments[e],t.forEach(t=>{this.notifyListeners(e,t)}))}}let b=e=>
1encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);class v extends y{async getCookies(){let e=document.cookie,t={};return e.split(";").forEach(e=>{if(e.length<=0)return;let[r,n]=e.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");r=r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent).trim(),n=n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent).trim(),t[r]=n}),t}async setCookie(e){try{let t=b(e.key),r=b(e.value),n=e.expires?`; expires=${e.expires.replace("expires=","")}`:"",i=(e.path||"/").replace("path=",""),o=null!=e.url&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${r||""}${n}; path=${i}; ${o};`}catch(e){return Promise.reject(e)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(e){return Promise.reject(e)}}async clearCookies(){try{for(let e of document.cookie.split(";")||[])document.cookie=e.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)}}}w("CapacitorCookies",{web:()=>new v});let A=async e=>new Promise((t,r)=>{let n=new FileReader;n.onload=()=>{let e=n.result;t(e.indexOf(",")>=0?e.split(",")[1]:e)},n.onerror=e=>r(e),n.readAsDataURL(e)});class O extends y{async request(e){let t,r,n=((e,t={})=>{let r=Object.assign({method:e.method||"GET",headers:e.headers},t),n=((e={})=>{let t=Object.keys(e);return Object.keys(e).map(e=>e.toLocaleLowerCase()).reduce((r,n,i)=>(r[n]=e[t[i]],r),{})})(e.headers)["content-type"]||"";if("string"==typeof e.data)r.body=e.data;else if(n.includes("application/x-www-form-urlencoded")){let t=new URLSearchParams;for(let[r,n]of Object.entries(e.data||{}))t.set(r,n);r.body=t.toString()}else if(n.includes("multipart/form-data")||e.data instanceof FormData){let t=new FormData;if(e.data instanceof FormData)e.data.forEach((e,r)=>{t.append(r,e)});else for(let r of Object.keys(e.data))t.append(r,e.data[r]);r.body=t;let n=new Headers(r.headers);n.delete("content-type"),r.headers=n}else(n.includes("application/json")||"object"==typeof e.data)&&(r.body=JSON.stringify(e.data));return r})(e,e.webFetchExtra),i=((e,t=!0)=>e?Object.entries(e).reduce((e,r)=>{let n,i,[o,a]=r;return Array.isArray(a)?(i="",a.forEach(e=>{n=t?encodeURIComponent(e):e,i+=`${o}=${n}&`}),i.slice(0,-1)):(n=t?encodeURIComponent(a):a,i=`${o}=${n}`),`${e}&${i}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),o=i?`${e.url}?${i}`:e.url,a=await fetch(o,n),s=a.headers.get("content-type")||"",{responseType:c="text"}=a.ok?e:{};switch(s.includes("application/json")&&(c="json"),c){case"arraybuffer":case"blob":r=await a.blob(),t=await A(r);break;case"json":t=await a.json();break;default:t=await a.text()}let l={};return a.headers.forEach((e,t)=>{l[t]=e}),{data:t,headers:l,status:a.status,url:a.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"}))}}w("CapacitorHttp",{web:()=>new O}),(s=r||(r={})).Dark="DARK",s.Light="LIGHT",s.Default="DEFAULT",(c=n||(n={})).StatusBar="StatusBar",c.NavigationBar="NavigationBar";class x extends y{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}w("SystemBars",{web:()=>new x}),e.s(["WebPlugin",0,y,"registerPlugin",0,w])},80127,e=>{"use strict";let t=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["default",0,t])},71689,e=>{"use strict";var t=e.i(80127);e.s(["ArrowLeft",()=>t.default])},82458,e=>{"use strict";let t=(0,e.i(75254).default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);e.s(["default",0,t])},94909,(e,t,r)=>{"use strict";
1e.i(47167),Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return u},getImageProps:function(){return l}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let o=e.r(55682),a=e.r(8927),s=e.r(5500),c=o._(e.r(1948));function l(e){let{props:t}=(0,a.getImgProps)(e,{defaultLoader:c.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}}let u=s.Image},57688,(e,t,r)=>{t.exports=e.r(94909)},4191,(e,t,r)=>{"use strict";var n=e.i(47167);Object.defineProperty(r,"__esModule",{value:!0}),r.defaultOAuthAuthConfig=void 0,r.defaultOAuthAuthConfig={useOAuth:!0,cookieSecure:!0,cookieSameSite:"lax",authEndpoint:n.default.env.NEXT_PUBLIC_AUTH_ENDPOINT||"http://localhost:3000/api/auth",supportedProviders:["google","apple","github","twitch","discord","kick"]}},94754,e=>{"use strict";var t=e.i(43476),r=e.i(57688),n=e.i(22016),i=e.i(71689),o=e.i(82458),o=o,a=e.i(29592),s=e.i(30178),c=e.i(11300),l=e.i(71645),u=e.i(57428),d=e.i(10204),h=e.i(25246),f=e.i(14984),g=e.i(66917);let p=["twitch","discord","kick","google"],m=null;async function w(e,t){return(function(){if(m)return m;let e="https://auth.senchabot.com".trim();if(!e)throw Error("NEXT_PUBLIC_AUTH_SERVICE_URL is not configured");return m=new g.OAuthAuthAPI({authEndpoint:e,supportedProviders:p})})().signIn(e,t)}var y=e.i(53793);let b={twitch:f.TwitchIcon,discord:f.DiscordIcon,kick:f.KickIcon,spotify:f.SpotifyIcon,google:f.GoogleIcon},v={twitch:(0,y.getOAuthCoreScopes)("twitch"),kick:(0,y.getOAuthCoreScopes)("kick"),discord:(0,y.getOAuthCoreScopes)("discord"),spotify:(0,y.getOAuthCoreScopes)("spotify"),google:(0,y.getOAuthCoreScopes)("google")};function A({provider:e,isDisabled:r=!1,redirectTo:n="/dashboard"}){let{t:i}=(0,c.useI18n)(),[o,a]=(0,l.useState)(!1),u=b[e],[d,h]=(0,l.useState)(!1),g=async()=>{a(!0);let t=n.trim().startsWith("/")&&!n.trim().startsWith("//")?n.trim():"/dashboard";try{await w(e,{redirectTo:t,scopes:v[e]})}catch(t){console.error(`Sign in with ${e} failed:`,t),a(!1)}};return(0,t.jsxs)(s.Button,{className:"flex w-full items-center gap-3 rounded-lg border border-zinc-800 bg-zinc-900 py-6 text-zinc-100 transition-all hover:border-zinc-700 hover:bg-zinc-800/80",variant:"outline",onClick:g,disabled:o||r,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[o?(0,t.jsx)(f.LoaderIcon,{className:"animate-spin"}):(0,t.jsx)(u,{className:"size-5 transition-colors",style:{color:d?({twitch:"#9147ff",discord:"#5865F2",kick:"#53fc18",spotify:"#1DB954",google:"#1e90ff"})[e]:({twitch:"#a1a1aa",discord:"#a1a1aa",kick:"#a1a1aa",spotify:"#a1a1aa",google:"#a1a1aa"})[e]}}),(0,t.jsx)("span",{className:"text-base font-medium capitalize",children:i("auth.continue_with",e)})]})}let O=[{key:"auth.privacy_policy",href:"/privacy-policy"},{key:"auth.terms_of_service",href:"/terms-of-service"},{key:"auth.billing_policy",href:"/billing-policy"},{key:"auth.refund_policy",href:"/refund-policy"},{key:"auth.cookie_policy",href:"/cookie-policy"},{key:"auth.eula",href:"/eula"}];function x({redirectTo:e}){let{t:r}=(0,c.useI18n)(),[n,i]=(0,l.useState)(!1);return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-start space-x-3 rounded-lg border border-zinc-800/50 bg-zinc-900/30 p-4",children:[(0,t.jsx)(u.Checkbox,{id:"terms",checked:n,onCheckedChange:e=>i(e),className:"mt-0.5"}),(0,t.jsxs)("div",{className:"space-y-1 leading-none",children:[(0,t.jsx)(d.Label,{htmlFor:"terms",className:"cursor-pointer text-sm font-normal text-zinc-300 hover:text-white",children:r("auth.acknowledge")}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:O.map(e=>(0,t.jsx)(h.Link,{href:e.href,className:"text-zinc-500 transition-colors hover:text-zinc-300 hover:underline",target:"_blank",rel:"noreferrer",children:r(e.key)},e.href))})]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(A,{provider:"twitch",isDisabled:!n,redirectTo:e}),(0,t.jsx)(A,{provider:"discord",isDisabled:!n,redirectTo:e}),(0,t.jsx)(A,{provider:"kick",isDisabled:!n,redirectTo:e}),(0,t.jsx)(A,{provider:"google",isDisabled:!n,redirectTo:e})]})]})}e.s(["SignInPageClient",0,function({session:e,error:l,redirectTo:u}){let{t:d}=(0,c.useI18n)(),h=function(e){switch(e){case"OAuthAccountNotLinked":return d("auth.error_account_linked");case"AccountDeactivated":return d("auth.error_deactivated");case"RateLimited":return d("auth.error_rate_limit");default:return d("auth.error_generic")}}(l);return(0,t.jsxs)("main",{className:"relative flex min-h-screen w-full flex-col items-center justify-center bg-[#09090b] text-zinc-100",children:[(0,t.jsx)(s.Button,{variant:"ghost",asChild:!0,className:"absolute left-4 top-4 text-zinc-400 hover:bg-zinc-800/50 hover:text-white",children:(0,t.jsxs)(n.default,{href:e?"/dashboard/settings":"/",children:[(0,t.jsx)(i.ArrowLeft,{className:"mr-2 size-4"}),(0,t.jsx)("span",{children:e?d("auth.back_to_dashboard"):d("common.back")})]})}),(0,t.jsxs)("div",{className:"m-auto w-full max-w-[360px] space-y-8 p-4",children:[e?(0,t.jsx)("h1",{className:"text-center text-2xl font-medium tracking-tighter text-white",children:d("auth.link_account")}
1):(0,t.jsxs)("div",{className:"space-y-8",children:[(0,t.jsx)("div",{className:"flex justify-center",children:(0,t.jsxs)(n.default,{className:"flex flex-col items-center gap-3 transition-opacity hover:opacity-80 focus-visible:outline-none",href:"/",children:[(0,t.jsx)("div",{className:"flex size-12 items-center justify-center",children:(0,t.jsx)(r.default,{src:"/senchabot-logo.svg",alt:"Senchabot",width:40,height:40,unoptimized:!0})}),(0,t.jsx)("span",{className:"font-sans text-2xl font-bold tracking-tight text-white",children:"Senchabot"})]})}),(0,t.jsx)(x,{redirectTo:u})]}),l&&(0,t.jsxs)(a.Alert,{variant:"destructive",className:"border-red-900 bg-red-900/20 text-red-200",children:[(0,t.jsx)(o.default,{className:"size-4"}),(0,t.jsx)(a.AlertTitle,{children:d("auth.error_title")}),(0,t.jsx)(a.AlertDescription,{children:h})]})]})]})}],94754)},29592,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(25913),i=e.i(75157);let o=(0,n.cva)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),a=r.forwardRef(({className:e,variant:r,...n},a)=>(0,t.jsx)("div",{ref:a,role:"alert",className:(0,i.cn)(o({variant:r}),e),...n}));a.displayName="Alert";let s=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)("h5",{ref:n,className:(0,i.cn)("mb-1 font-medium leading-none tracking-tight",e),...r}));s.displayName="AlertTitle";let c=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)("div",{ref:n,className:(0,i.cn)("text-sm [&_p]:leading-relaxed",e),...r}));c.displayName="AlertDescription",e.s(["Alert",0,a,"AlertDescription",0,c,"AlertTitle",0,s])},57428,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(20783),i=e.i(30030),o=e.i(81140),a=e.i(69340),s=e.i(35804),c=e.i(96626),l=e.i(48425),u=Object.defineProperty,d=(e,t)=>u(e,"name",{value:t,configurable:!0}),h="Checkbox",[f,g]=(0,i.createContextScope)(h),[p,m]=f(h);function w(e){let{__scopeCheckbox:n,checked:i,children:o,defaultChecked:s,disabled:c,form:l,name:u,onCheckedChange:d,required:f,value:g="on",internal_do_not_use_render:m}=e,[w,y]=(0,a.useControllableState)({prop:i,defaultProp:s??!1,onChange:d,caller:h}),[b,v]=r.useState(null),[A,P]=r.useState(null),j=r.useRef(!1),[k,C]=r.useReducer(e=>e+1,0),E=!b||!!l||!!b.closest("form"),S={checked:w,disabled:c,setChecked:y,control:b,setControl:v,name:u,form:l,value:g,hasConsumerStoppedPropagationRef:j,userInteractionCount:k,onUserInteraction:C,required:f,defaultChecked:!x(s)&&s,isFormControl:E,bubbleInput:A,setBubbleInput:P};return(0,t.jsx)(p,{scope:n,...S,children:O(m)?m(S):o})}d(w,"CheckboxProvider");var y=r.forwardRef(d(function({__scopeCheckbox:e,onKeyDown:i,onClick:a,...s},c){let{control:u,value:h,disabled:f,checked:g,required:p,setControl:w,setChecked:y,hasConsumerStoppedPropagationRef:b,onUserInteraction:v,isFormControl:A,bubbleInput:O}=m("CheckboxTrigger",e),j=(0,n.useComposedRefs)(c,w),k=r.useRef(g);return r.useEffect(()=>{let e=u?.form;if(e){let t=d(()=>y(k.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[u,y]),(0,t.jsx)(l.Primitive.button,{type:"button",role:"checkbox","aria-checked":x(g)?"mixed":g,"aria-required":p,"data-state":P(g),"data-disabled":f?"":void 0,disabled:f,value:h,...s,ref:j,onKeyDown:(0,o.composeEventHandlers)(i,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,o.composeEventHandlers)(a,e=>{v(),y(e=>!!x(e)||!e),O&&A&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})})},"CheckboxTrigger")),b=r.forwardRef(d(function(e,r){let{__scopeCheckbox:n,name:i,checked:o,defaultChecked:a,required:s,disabled:c,value:l,onCheckedChange:u,form:d,...h}=e;return(0,t.jsx)(w,{__scopeCheckbox:n,checked:o,defaultChecked:a,disabled:c,required:s,onCheckedChange:u,name:i,form:d,value:l,internal_do_not_use_render:({isFormControl:e})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y,{...h,ref:r,__scopeCheckbox:n}),e&&(0,t.jsx)(A,{__scopeCheckbox:n})]})})},"Checkbox")),v=r.forwardRef(d(function(e,r){let{__scopeCheckbox:n,forceMount:i,...o}=e,a=m("CheckboxIndicator",n);return(0,t.jsx)(c.Presence,{present:i||x(a.checked)||!0===a.checked,children:(0,t.jsx)(l.Primitive.span,{"data-state":P(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:r,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),A=r.forwardRef(d(function({__scopeCheckbox:e,onClick:i,...a},c){let{control:u,hasConsumerStoppedPropagationRef:d,userInteractionCount:h,checked:f,defaultChecked:g,required:p,disabled:w,name:y,value:b,form:v,bubbleInput:A,setBubbleInput:O}=m("CheckboxBubbleInput",e),P=(0,n.useComposedRefs)(c,O),j=(0,s.use
1Size)(u),k=r.useRef(!1),C=r.useRef(f),E=r.useRef(h);r.useEffect(()=>{if(!A)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,t=h!==E.current;E.current=h;let r=C.current!==f;C.current=f;let n=!(t&&d.current);if(r&&e){k.current=!t;let r=new Event("click",{bubbles:n});A.indeterminate=x(f),e.call(A,!x(f)&&f),A.dispatchEvent(r),k.current=!1}},[A,f,d,h]);let S=r.useRef(!x(f)&&f);return(0,t.jsx)(l.Primitive.input,{type:"checkbox","aria-hidden":!0,defaultChecked:g??S.current,required:p,disabled:w,name:y,value:b,form:v,...a,tabIndex:-1,ref:P,onClick:(0,o.composeEventHandlers)(i,e=>{k.current&&e.stopPropagation()}),style:{...a.style,...j,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function O(e){return"function"==typeof e}function x(e){return"indeterminate"===e}function P(e){return x(e)?"indeterminate":e?"checked":"unchecked"}d(O,"isFunction"),d(x,"isIndeterminate"),d(P,"getState");var j=e.i(72226),k=e.i(75157);let C=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(b,{ref:n,className:(0,k.cn)("peer size-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...r,children:(0,t.jsx)(v,{className:(0,k.cn)("flex items-center justify-center text-current"),children:(0,t.jsx)(j.CheckIcon,{className:"size-4"})})}));C.displayName=b.displayName,e.s(["Checkbox",0,C],57428)},25246,e=>{"use strict";var t=e.i(43476),r=e.i(22016),n=e.i(75157);e.s(["Link",0,function({className:e,...i}){return(0,t.jsx)(r.default,{className:(0,n.cn)("font-medium underline-offset-4 transition-colors hover:text-foreground focus-visible:rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",e),...i})}])},53793,e=>{"use strict";let t=["openid","user:read:email","channel:manage:moderators","channel:read:redemptions","channel:read:subscriptions","channel:manage:redemptions","channel:bot","user:read:moderated_channels","channel:manage:broadcast","channel:manage:schedule","clips:edit","user:read:follows","moderator:read:followers","bits:read"],r=["user:read","channel:read","channel:write","channel:rewards:write","events:subscribe"];e.s(["getOAuthCoreScopes",0,function(e){switch(e){case"twitch":return t.join(" ");case"kick":return r.join(" ");case"discord":return"identify email guilds";case"spotify":return"user-modify-playback-state user-read-playback-state user-read-currently-playing";case"google":return"https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile";case"youtube":return"https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/youtube.force-ssl";default:return""}}])}]);
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.