https://www.aventix.net/_next/static/chunks/88eeffa1a5ead79b.js?dpl=dpl_Eipwt7yPkwWY24B5euqbw3zE8oMQ
1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="0453201f-ae0f-ae25-73b5-797b1a86e11d")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,96588,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("4070809d86f53a9323517f56968d34d9790cdabb72",t.callServer,void 0,t.findSourceMapURL,"getOrganizationPhoto");e.s(["getOrganizationPhoto",()=>r])},3541,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("405a2a19c5715219eedcf77eadde0d91bef38ff032",t.callServer,void 0,t.findSourceMapURL,"getProfilePhoto");e.s(["getProfilePhoto",()=>r])},766487,982748,317203,526402,819324,479400,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("0091256c2574b97253d6c2e58ee658fd396247e7a0",t.callServer,void 0,t.findSourceMapURL,"getAllAuctions");e.s(["getAllAuctions",()=>r],766487);let i=(0,t.createServerReference)("40b557d13fc1ce9829e2a99c73dbfe489fa3c12439",t.callServer,void 0,t.findSourceMapURL,"getAuction");e.s(["getAuction",()=>i],982748);let n=(0,t.createServerReference)("405c570561de81e8f00b5eab10c5bf728394ae7593",t.callServer,void 0,t.findSourceMapURL,"getAuctionsByOrganization");e.s(["getAuctionsByOrganization",()=>n],317203);let a=(0,t.createServerReference)("4073cbdfb9a1cad38f047078dfe016198f69aaa738",t.callServer,void 0,t.findSourceMapURL,"getAuctionsByUser");e.s(["getAuctionsByUser",()=>a],526402);let s=(0,t.createServerReference)("40d1b3743bf75929c94005bc478ea70530a5adf765",t.callServer,void 0,t.findSourceMapURL,"getCompletedAuctionsByUser");e.s(["getCompletedAuctionsByUser",()=>s],819324);let o=(0,t.createServerReference)("40c6fe31c5746a1167ce7ee9bccd402182321595b1",t.callServer,void 0,t.findSourceMapURL,"getBidsByAuction");e.s(["getBidsByAuction",()=>o],479400)},982690,e=>{"use strict";e.s([])},533327,e=>{"use strict";var t=e.i(766487),r=e.i(982748),i=e.i(317203),n=e.i(526402),a=e.i(819324),s=e.i(479400);e.i(982690);var o=e.i(95187);let l=(0,o.createServerReference)("70d0f65894c26d75e9a6d037afee66c5a431dec33e",o.callServer,void 0,o.findSourceMapURL,"createAuctions"),c=(0,o.createServerReference)("40a7a8bd19a04a0c013189e42e6afd32d0cc1ca6b5",o.callServer,void 0,o.findSourceMapURL,"deleteAuctions"),u=(0,o.createServerReference)("789c8e2e34c10dd183c16b4c0978f53cc001c027e1",o.callServer,void 0,o.findSourceMapURL,"updateAuctions"),h=(0,o.createServerReference)("70fbc919074fc24d2ef50f1ddcc4f24214a8752ab3",o.callServer,void 0,o.findSourceMapURL,"createAuctionTemplates"),d=(0,o.createServerReference)("7f2399c38c192862364dd01f50ebd81325344e4bad",o.callServer,void 0,o.findSourceMapURL,"getAuctionTemplatesBy"),f=(0,o.createServerReference)("78eacec155d4b81071d46606a997dee42ddeb59231",o.callServer,void 0,o.findSourceMapURL,"updateAuctionTemplates"),p=(0,o.createServerReference)("4069aa8b40c2fb0cccb934f6ad81157519e3b086a3",o.callServer,void 0,o.findSourceMapURL,"deleteAuctionTemplates"),g=(0,o.createServerReference)("7033dad9ba1813e4f89ed85b7a1a8d6117465d5c54",o.callServer,void 0,o.findSourceMapURL,"createAuctionPrizes"),v=(0,o.createServerReference)("7f22a317d3060ffbe614657fb851482a7d48715f08",o.callServer,void 0,o.findSourceMapURL,"getAuctionPrizesBy"),y=(0,o.createServerReference)("78b789111f60f7f07835d85c0f898f3055d7a3d2d6",o.callServer,void 0,o.findSourceMapURL,"updateAuctionPrizes");e.s(["default",0,{all:async()=>(0,t.getAllAuctions)(),get:async e=>(0,r.getAuction)(e),create:l,update:u,delete:c,bids:async e=>(0,s.getBidsByAuction)(e),byOrganization:async e=>(0,i.getAuctionsByOrganization)(e),byUser:async e=>(0,n.getAuctionsByUser)(e),completedByUser:async e=>(0,a.getCompletedAuctionsByUser)(e),prizes:{create:g,byAuction:async e=>v("auction",e),update:y},templates:{byOrganization:async e=>d("organization",e),create:h,update:f,delete:p}}],533327)},946512,384919,775112,e=>{"use strict";e.s([],384919),e.s([],946512);var t=e.i(95187);let r=(0,t.createServerReference)("404b7fe87eb6053a07d2dded94dc85246a95a0e2de",t.callServer,void 0,t.findSourceMapURL,"passUpdate");e.s(["passUpdate",()=>r],775112)},574141,170925,447563,727569,378174,592116,18030,432757,241646,780902,233948,436637,160496,218916,653615,197105,902063,585007,406421,907770,616675,614987,59e3,743442,848
2068,687008,909121,40595,381912,299066,557784,681385,950797,e=>{"use strict";e.i(946512);var t=e.i(775112),r=e.i(95187);let i=(0,r.createServerReference)("7e2ef99df039e6b415ea3bee8e9b92ff2de9ba202c",r.callServer,void 0,r.findSourceMapURL,"register"),n=(0,r.createServerReference)("40e0a64c1a3883119bcbc99bb124aa6cae47b79179",r.callServer,void 0,r.findSourceMapURL,"signInWithOTP"),a=(0,r.createServerReference)("403245b1dee6442cbc39d8940ea811f2f004a54177",r.callServer,void 0,r.findSourceMapURL,"signInWithPhoneOtp"),s=(0,r.createServerReference)("601cd8800aa36bda883f30de9feccdec8a090f0183",r.callServer,void 0,r.findSourceMapURL,"signInWithPhonePassword"),o=(0,r.createServerReference)("60a6052a42657c26abc108237d55395963f0aecfde",r.callServer,void 0,r.findSourceMapURL,"verifyPhoneOtp");e.i(982690);let l=(0,r.createServerReference)("40eb52692272ae0a8cc1a1e4288377cf9acfe46de0",r.callServer,void 0,r.findSourceMapURL,"deletepasskeys"),c=(0,r.createServerReference)("7f1ae86ac16a4d8f6ea37629f5778c2e7131df60c9",r.callServer,void 0,r.findSourceMapURL,"getpasskeysBy");e.s(["default",0,{register:async(e,t,r,n,a,s)=>await i(e,t,r,n,a,s),verifyPhoneOtp:async(e,t)=>await o(e,t),signInWithPhoneOtp:async e=>await a(e),signInWithPhonePassword:async(e,t)=>await s(e,t),signInWithOTP:async e=>await n(e),sendPasswordReset:async e=>null,updatePassword:async e=>await (0,t.passUpdate)(e),listPasskeys:async e=>c("user_id",e,["id","credential_id","created_at"]),deletePasskey:l}],574141),e.s([],170925);let u=(0,r.createServerReference)("40924f9ba1aaf512300d8b08ad60a59bfa7f3da119",r.callServer,void 0,r.findSourceMapURL,"archiveEvent");e.s(["archiveEvent",()=>u],447563);let h=(0,r.createServerReference)("70311ccf1693c8f6e83b119b03bf19d22083b265d5",r.callServer,void 0,r.findSourceMapURL,"getAllTicketsForEvent"),d=(0,r.createServerReference)("40dcec94d74be98b4db878adfee7ff312d14b3da46",r.callServer,void 0,r.findSourceMapURL,"getEvent"),f=(0,r.createServerReference)("40c719929d53f0941a072b5f770b801c78072bf274",r.callServer,void 0,r.findSourceMapURL,"getEventPhotoWithId");e.s(["getEventPhotoWithId",()=>f],727569);let p=(0,r.createServerReference)("40fd814b18f3e67915ee6f7a56a16934b605f02711",r.callServer,void 0,r.findSourceMapURL,"getEventRecommendations"),g=(0,r.createServerReference)("403fcfdf68ba43c74157f68f38c82964bed454e73f",r.callServer,void 0,r.findSourceMapURL,"getEventsByVenue"),v=(0,r.createServerReference)("40bed3c14449e16953c00e323d56e8be650daf072c",r.callServer,void 0,r.findSourceMapURL,"getEventsByVerifiedAccount"),y=(0,r.createServerReference)("701835d77db8b569a30fa63c9efd9822db4725de33",r.callServer,void 0,r.findSourceMapURL,"SearchEvents"),b=(0,r.createServerReference)("78d8c8f2f0892c59c8dc27baab8d438f015877a91b",r.callServer,void 0,r.findSourceMapURL,"getEventsByCategoryAndLocation"),w=(0,r.createServerReference)("602501baa7ca1f3095105523fc9856b63d395aca79",r.callServer,void 0,r.findSourceMapURL,"getFriendsAttendingEvent");e.s(["getFriendsAttendingEvent",()=>w],378174);let m=(0,r.createServerReference)("60aa5bf8630fbdc243b748d196a0bc5b697eaba686",r.callServer,void 0,r.findSourceMapURL,"getSalesVelocity"),S=(0,r.createServerReference)("40bd2e316608edc68b711759e5225510e68fdc0112",r.callServer,void 0,r.findSourceMapURL,"getInventoryAlerts"),_=(0,r.createServerReference)("403e85db3dcaf5c8eb28a9b60d0fdd8665d6ac881d",r.callServer,void 0,r.findSourceMapURL,"getCheckinMetrics"),k=(0,r.createServerReference)("40137d08379bc0a0f64960b314f0bb97f17623aed6",r.callServer,void 0,r.findSourceMapURL,"getEventTicketStats"),R=(0,r.createServerReference)("403392519997067cd61dd4303c36bad2b6d3dc69ea",r.callServer,void 0,r.findSourceMapURL,"getAvailableTicketsForEvent"),E=(0,r.createServerReference)("60b370c91078f1269304f3a521f3b73d68aa617cf9",r.callServer,void 0,r.findSourceMapURL,"updateEventUTM"),O=(0,r.createServerReference)("7f1490aa715c4e6929c5a750cddc4c16cdcf27f0be",r.callServer,void 0,r.findSourceMapURL,"getEventUTMBy"),T=(0,r.createServerReference)("70150ccb0d4ff76f5c8443158fde1b7af9bd7a937f",r.callServer,void 0,r.findSourceMapURL,"createEventAccess"),A=(0,r.createServerReference)("709ae4c902e373fefb09f12eb28192c88890ec1f5c",r.callServer,void 0,r.findSourceMapURL,"createEventMetadata"),U=(0,r.createServerReference)("70122ac9472a4e83acf77defdb548edbbe7defb5fe",r.callServer,void 0,r.findSourceMapURL,"createEventWhitelistedEmails"),I=(0,r.createServerReference)("40bb9e4ff874480112508e6ab783b5aba3506929c4",r.callServer,void 0,r.findSourceMapURL,"deleteEventAccess"),j=(0,r.createServerReference)("40cec1a08f3b95ac0c25cecf00d8f91e6702e0ad61",r.callServer,void 0,r.findSourceMapURL,"deleteEventMetadata"),P=(0,r.createServerReference)("4069d7dd6b5334d4956209cb5c54e51596e7acbbef",r.callServer,void 0,r.findSourceMapURL,"deleteEventWhitelistedEmails"),C=(0,r.createServerReference)("7f345d8175b906521ad5aa0278c942ae2ca55a4a8b",r.callServer,void 0,r.findSourceMapURL,"getEventAccessBy"),L=(0,r.createServerReference)("7f41d153e9c4dab7c4482e534f5088b4380de8e332",r.callServer,void 0,r.findSourceMapURL,"getEventMetadataBy"),$=(0,r.createServerReference)("70bd6da5dff42aeb7bc4fbf327e0e8f5e4cac17f2a",r.callServer,void 0,r.findSourceMapURL,"getEventsById"),x=(0,r.createServerReference)("7f66a1706565dd1c3bd953e0e69e5f43fbf3690aa3",r.callServer,void 0,r.findSourceMapURL,"getTicketsBy");
2e.s(["getTicketsBy",()=>x],592116);let B=(0,r.createServerReference)("7f2a0dd1f93f3304b5e98890d5e8406aa62a5b2d2f",r.callServer,void 0,r.findSourceMapURL,"getTransactionsBy");e.s(["getTransactionsBy",()=>B],18030);let M=(0,r.createServerReference)("78b6a998eeda8fac031219a67a859fb6e155c0ec08",r.callServer,void 0,r.findSourceMapURL,"updateEventAccountEntity"),z=(0,r.createServerReference)("78add1c14f7283aed068dc562c70eafaa8fcbc5983",r.callServer,void 0,r.findSourceMapURL,"updateEvents");e.s(["updateEvents",()=>z],432757);let N=(0,r.createServerReference)("70a1766ba9799624109fe4153273ddf459078368c7",r.callServer,void 0,r.findSourceMapURL,"createEventAccountEntity"),q=(0,r.createServerReference)("7076fb7d9b5dcb79a8dbd1d2b5cc8dba97bc919dd6",r.callServer,void 0,r.findSourceMapURL,"createEventOrganizationEntity"),D=(0,r.createServerReference)("40a9cf5be018af0832fffd822c11df89cb58446e2e",r.callServer,void 0,r.findSourceMapURL,"deleteEventAccountEntity"),F=(0,r.createServerReference)("4041f2738fe9ff42fd46215dd656e1f2b0fb6a37ed",r.callServer,void 0,r.findSourceMapURL,"deleteEventOrganizationEntity");class W extends Error{action;supabaseError;constructor(e,t){super(t?.message??`Supabase error during ${e}`),this.name="SupabaseActionError",this.action=e,this.supabaseError=t,Error.captureStackTrace&&Error.captureStackTrace(this,W)}}function V(e){if(null==e)return null;if(e instanceof Date)return e.toISOString();if(Array.isArray(e))return e.map(e=>V(e));if("object"==typeof e&&null!==e){let t={};for(let r in e)Object.hasOwn(e,r)&&(t[r]=V(e[r]));return t}return e}function K(e,t="Supabase Query"){if(e.error)throw console.error(`[Supabase Error - ${t}]`,e.error.message),new W(t,e.error);if(null===e.data){let e=Error("No data returned from Supabase");throw console.warn(`[Supabase Warning - ${t}] No data returned`),new W(t,e)}return V(e.data)}e.s(["deepSerialize",()=>V,"handleSupabaseResponse",()=>K,"serializeSelectJoins",0,e=>{if(!e)return"*";let t=e=>Object.entries(e).map(([e,r])=>!0===r?e:"object"==typeof r?`${e}(${t(r)}
2)`:"").filter(Boolean).join(",");return t(e)}],241646);var J=e.i(121280);e.s(["default",0,{get:async e=>await d(e),getRecommendations:async e=>{let t=await p(e);return t.error?(console.error("[Supabase Error - Get Recommended Events]",t.error.message),[]):t.data??[]},listByVerifiedAccount:async e=>await v(e),listByVenue:async e=>await g(e),getPasskey:async e=>$(e,["passkey","event_id","title"]),getPhoto:async e=>f(e),search:async(e,t,r)=>await y(e,r,t),archive:async e=>await u(e).then(e=>K(e,"Archive Events")),update:async(e,t,...r)=>{let i=await z(e,t,...r);return["start_date","end_date","location","venue","title","coordinates"].some(e=>e in t)&&(0,J.notifyEventUpdate)(e).catch(t=>{console.error(`[PassKit] Failed to notify event update for ${e}:`,t)}),i},listFriendsAttending:async(e,t)=>await w(t,e),listClaimedTickets:async e=>x("event",e,null,null,[{column:"scanned",operation:"eq",value:!0}]),listAllTickets:async(e,t=!1,r)=>await h(t,e,r),getMetadata:L,createMetadata:async(e,t,r)=>A([{event:e,label:t,value:r}]),deleteMetadata:async e=>j(e),listTransactions:async e=>await B("event",e,null,"event:Events(title, event_id), profile:profiles!Transactions_profile_fkey(gender, age, full_name, email, color, id), tickets:TransactionTickets(ticket(seat, purchased_on, scanned, scanned_at))"),whitelisted:{insert:U,delete:P},access:{insert:T,delete:I,getByEvent:async e=>C("event",e,null,"id, created_at, profile:profiles!event_access_profile_fkey(id, full_name, email, color), granted_by:profiles!event_access_granted_by_fkey(full_name)")},updateVerifiedAccountVisibility:async(e,t)=>M(e,{visible:t}),entities:{createAccount:N,deleteAccount:D,createOrganization:q,deleteOrganization:F},getSalesVelocity:async(e,t=24)=>m(e,t),getInventoryAlerts:async e=>S(e),getCheckinMetrics:async e=>_(e),getTicketStats:async e=>k(e),getUTM:async e=>O("event",e),updateUTM:async(e,t)=>E(e,t),getAvailableTickets:async e=>R(e),listByCategoryAndLocation:async(e,t,r,i)=>b(e,t,r,i)}],780902);let H=(0,r.createServerReference)("4067ed869eda9cd0775aefe827e537e89a10503459",r.callServer,void 0,r.findSourceMapURL,"getGiveaway"),G=(0,r.createServerReference)("70ee5a85e34b7d14fbd421b445536dfdc996d97343",r.callServer,void 0,r.findSourceMapURL,"createGiveaways"),Y=(0,r.createServerReference)("406a7f7d032285850b6ae877319378b367f2ad3b1f",r.callServer,void 0,r.findSourceMapURL,"deleteGiveaways"),Q=(0,r.createServerReference)("7f17b3823208f3c883dc913b9d00f9f7f84af7e3e4",r.callServer,void 0,r.findSourceMapURL,"getGiveawayEntriesBy"),X=(0,r.createServerReference)("7fc4e2849f57da7d39361e8bdfa48ec3cec5082784",r.callServer,void 0,r.findSourceMapURL,"getGiveawayPrizesBy"),Z=(0,r.createServerReference)("7e2421cfd2635a2d40c2befd36e74b19e65fecac21",r.callServer,void 0,r.findSourceMapURL,"getGiveaways"),ee=(0,r.createServerReference)("7f639e7b821e5758549e8f2f8495e7496739843d88",r.callServer,void 0,r.findSourceMapURL,"getGiveawaysBy"),et=(0,r.createServerReference)("78bfd0ba2604d570a27851d2734e9175d27a4e4480",r.callServer,void 0,r.findSourceMapURL,"updateGiveaways");e.s(["default",0,{all:async()=>Z(null,"ticket(type(type), event(*, organization:Organizations(*)))"),get:async e=>await H(e),create:G,update:et,delete:Y,entries:async e=>Q("giveaway",e,null,"user(full_name, email, color, private, id)"),prizes:async e=>X("giveaway",e,null,"ticket(id, type(type), event(event_id, title)), winner(id, full_name, email, color)"),listByOrganization:async e=>ee("organization",e,null,"ticket(id, type(type), event(*, venue(name, city, state), organization:Organizations(organization_id, color, name, tier)))",null,{column:"end_time",ascending:!1}),byUser:async e=>Q("user",e,"","giveaway(ticket(event(event_id, title, venue(*), organization:Organizations(*)), type(type)))",[{column:"giveaway.end_time",operation:"gt",value:new Date().toISOString()}],{column:"created_at",ascending:!1})}],233948),e.s([],436637);let er=(0,r.createServerReference)("70563967cc09ba84ae4bef318e575b64082d47652c",r.callServer,void 0,r.findSourceMapURL,"addUserToOrganization");e.s(["addUserToOrganization",()=>er],160496);let ei=(0,r.createServerReference)("6081c279cb3a5a8be6d714fb43c701ea48c2eb1a3c",r.callServer,void 0,r.findSourceMapURL,"cancelOrganizationInvitation");e.s(["cancelOrganizationInvitation",()=>ei],218916);let en=(0,r.createServerReference)("70e6f15e4fbd89e07482869b2052a8b706b84c8540",r.callServer,void 0,r.findSourceMapURL,"changeUserRole");e.s(["changeUserRole",()=>en],653615);let ea=(0,r.createServerReference)("405746df9665d1d2dbea5a291bf6e7289ef9c21607",r.callServer,void 0,r.findSourceMapURL,"createAndLinkUserToOrg");e.s(["createAndLinkUserToOrg",()=>ea],197105);let es=(0,r.createServerReference)("700d94083bacdd8d2f062793ecfdf27d5787272a7e",r.callServer,void 0,r.findSourceMapURL,"getOrganizationEvents");e.s(["getOrganizationEvents",()=>es],902063);let eo=(0,r.createServerReference)("60aa1cea914ff2763188eeac463112d8ab083b692e",r.callServer,void 0,r.findSourceMapURL,"getTransactionsForOrganization");e.s(["getTransactionsForOrganization",()=>eo],585007);let el=(0,r.createServerReference)("40d09e6a4b14b26d7e57a5b6c7b29a0a566f9b7c21",r.callServer,void 0,r.findSourceMapURL,"getUsersWithRolesForOrganization");e.s(["getUsersWithRolesForOrganization",()=>el],406421);let ec=(0,r.createServerReference)("70d3a77e210c049b54d328bf36db70ad7867bc5cf8",r.callServer,void 0,r.findSourceMapURL,"inviteUserToOrganization");e.s(["inviteUserToOrganization",()=>ec],907770);let eu=(0,r.createServerReference)("6054da2d82513862750570d9f4c115e102f246d6e5",r.callServer,void 0,r.findSourceMapURL,"removeUserFromOrganization");e.s(["removeUserFromOrganization",()=>eu],616675);let eh=(0,r.createServerReference)("60f9caab0feb9506675f6e1ecb486a84b55cabee3b",r.callServer,void 0,r.findSourceMapURL,"getOrganizationKPIs");e.s(["getOrganizationKPIs",()=>eh],614987);let ed=(0,r.createServerReference)("60eb3e85e2424df97876bbf291b795754902a6d9a0",r.callServer,void 0,r.findSourceMapURL,"getOrganizationDemographics");e.s(["getOrganizationDemographics",()=>ed],59e3);let ef=(0,r.createServerReference)("4095edf799fe9ee07d238f05ba783221bddbcb4589",r.callServer,void 0,r.findSourceMapURL,"getOrganizationTotalEventCount");e.s(["getOrganizationTotalEventCount",()=>ef],743442);let ep=(0,r.createServerReference)("4088aa657cdbf7368df41fc55db5f2c0fe34b6d093",r.callServer,void 0,r.findSourceMapURL,"canOrganizationCreateEvent");e.s(["canOrganizationCreateEvent",()=>ep],848068);let eg=(0,r.createServerReference)("4097c4f4285221abe1aa80048f0d3eb7701f0cb63f",r.callServer,void 0,r.findSourceMapURL,"checkVerifiedAndGetOrganizationName");e.s(["checkVerifiedAndGetOrganizationName",()=>eg],687008);let ev=(0,r.createServerReference)("6053f95f87753fc563fb3cd3e7b00d222598dd75cc",r.callServer,void 0,r.findSourceMapURL,"getFinancialTransfersByOrganization");e.s(["getFinancialTransfersByOrganization",()=>ev],909121);let ey=(0,r.createServerReference)("7f7c3d2524d39207730f57752b170961862bb05804",r.callServer,void 0,r.findSourceMapURL,"getOrganizationInvitationsBy");e.s(["getOrganizationInvitationsBy",()=>ey],40595);let eb=(0,r.createServerReference)("60932933b387c31556932de505103d0550f9635fde",r.callServer,void 0,r.findSourceMapURL,"updateOrganizationUTM");e.s(["updateOrganizationUTM",()=>eb],381912);let ew=(0,r.createServerReference)("4020ec806233d02931fb2dc30d889abd8289b50b4d",r.callServer,void 0,r.findSourceMapURL,"checkAccountEligibility");e.s(["checkAccountEligibility",()=>ew],299066),e.i(247167);let em="https://www.aventix.net";function eS(e){let{id:t,name:r,description:i,email:n,website:a,logoUrl:s,socialLinks:o}=e,l=[];return o?.twitter&&l.push(`https://twitter.com/${o.twitter}`),o?.facebook&&l.push(o.facebook),o?.instagram&&l.push(`https://instagram.com/${o.instagram}`),a&&l.push(a),{"@context":"https://schema.org","@type":"Organization","@id":`${em}/organization/${t}`,name:r,url:`${em}/organization/${t}`,...s&&{logo:s},...i&&{description:i},...n&&{email:n},...l.length>0&&{sameAs:l}}}e.s(["generateEventOrganizerSchema",()=>eS],557784),e.s([],681385);let e_=(0,r.createServerReference)("70636f370db49cf9f2ffbbd9df65590e82ac489de0",r.callServer,void 0,r.findSourceMapURL,"createBanList");e.s(["createBanList",()=>e_],950797)},619009,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("70fa255d15364ea41288877838c03d1763e69d9a7d",t.callServer,void 0,t.findSourceMapURL,"createOrganizationRequests");e.s(["createOrganizationRequests",()=>r])},319280,520835,97325,41883,673092,975391,52205,747723,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("70bab644f94f22d93427ed626bda6fb51d83a40e77",t.callServer,void 0,t.findSourceMapURL,"createOrganizations");e.s(["createOrganizations",()=>r],319280);let i=(0,t.createServerReference)("404776ecf8cf4e19e8f05be9a1ef2f5637cafeabef",t.callServer,void 0,t.findSourceMapURL,"deleteBanList");e.s(["deleteBanList",()=>i],520835);let n=(0,t.createServerReference)("407a0b88b50565860b3b3ceaab1eaab7021431c63e",t.callServer,void 0,t.findSourceMapURL,"deleteOrganizations");e.s(["deleteOrganizations",()=>n],97325);let a=(0,t.createServerReference)("7f0cb68d2ec7e1bb21dfce8d9ea53411f7d55ab9fb",t.callServer,void 0,t.findSourceMapURL,"getBanListBy");e.s(["getBanListBy",()=>a],41883);let s=(0,t.createServerReference)("70527619b99c727fdac6df51bc9f52b0e8457e0e7b",t.callServer,void 0,t.findSourceMapURL,"getOrganizationsById");e.s(["getOrganizationsById",()=>s],673092);let o=(0,t.createServerReference)("7f974348e8cdfa3674ed4b530e6d828e300de28e52",t.callServer,void 0,t.findSourceMapURL,"searchOrganizations");e.s(["searchOrganizations",()=>o],975391);let l=(0,t.createServerReference)("78d7179cdb46ca86e7441c74200981e8b8056b0b61",t.callServer,void 0,t.findSourceMapURL,"updateBanList");e.s(["updateBanList",()=>l],52205);let c=(0,t.createServerReference)("783f5981d71ecc28878288c82d523eb334f915830b",t.callServer,void 0,t.findSourceMapURL,"updateOrganizations");e.s(["updateOrganizations",()=>c],747723)},271260,421651,493760,478612,294106,235684,425408,607894,487755,955186,916964,991788,122178,972834,158079,235056,515609,600361,336199,393610,321730,423986,513482,303541,571473,659817,651021,551304,133237,70018,315522,242281,428303,120896,578478,e=>{"use strict";e.i(436637);
2var t=e.i(160496),r=e.i(218916),i=e.i(653615),n=e.i(197105),a=e.i(902063),s=e.i(585007),o=e.i(406421),l=e.i(907770),c=e.i(616675),u=e.i(614987),h=e.i(59e3),d=e.i(743442),f=e.i(848068),p=e.i(687008),g=e.i(909121),v=e.i(40595),y=e.i(381912),b=e.i(299066);e.i(681385);var w=e.i(557784);e.i(982690);var m=e.i(950797),S=e.i(619009),_=e.i(319280),k=e.i(520835),R=e.i(97325),E=e.i(41883),O=e.i(673092),T=e.i(975391),A=e.i(52205),U=e.i(747723),I=e.i(96588);let j={get:O.getOrganizationsById,create:_.createOrganizations,createRequest:S.createOrganizationRequests,getPhoto:async e=>await (0,I.getOrganizationPhoto)(e)??"",search:async e=>(0,T.searchOrganizations)("name",e,null,null,null,{column:"tier",ascending:!0}),listEvents:async(e,t,r)=>await (0,a.getOrganizationEvents)(e,t,r),delete:R.deleteOrganizations,inviteUser:async(e,t,r)=>await (0,l.inviteUserToOrganization)(e,t,r),update:U.updateOrganizations,getStatus:async e=>(0,O.getOrganizationsById)(e,["activated"]),addUser:async(e,r,i)=>{await (0,t.addUserToOrganization)(e,r,i)},removeUser:async(e,t)=>await (0,c.removeUserFromOrganization)(e,t),setPhoto:async e=>null,getStripeAccountId:async e=>(0,O.getOrganizationsById)(e,["stripe_account_id"]),createStripeAccount:async e=>await (0,n.createAndLinkUserToOrg)(e),getEventLimitOverride:async e=>(0,O.getOrganizationsById)(e,["unverified_event_limit_override"]),listTransactions:async(e,t="month")=>await (0,s.getTransactionsForOrganization)(t,e),listUsersWithRoles:async e=>await (0,o.getUsersWithRolesForOrganization)(e),updateUserRole:async(e,t,r)=>await (0,i.changeUserRole)(e,r,t),updateWalletAddress:async(e,t,r)=>(0,U.updateOrganizations)(e,{token_container_wallet_address:t,queue_id:r},["token_container_wallet_address","queue_id"]),updateStripeAccountId:async(e,t)=>(0,U.updateOrganizations)(e,{stripe_account_id:t},["stripe_account_id"]),getKPIs:async(e,t)=>(0,u.getOrganizationKPIs)(e,t),getDemographics:async(e,t)=>(0,h.getOrganizationDemographics)(e,t),getTotalEventCount:async e=>(0,d.getOrganizationTotalEventCount)(e),listInvitations:async(e,t=[{column:"used_at",operation:"is",value:null}])=>(0,v.getOrganizationInvitationsBy)("organization_id",e,null,null,t),cancelInvitation:async(e,t)=>(0,r.cancelOrganizationInvitation)(e,t),verifyStatus:async e=>(0,p.checkVerifiedAndGetOrganizationName)(e),updateUTM:async(e,t)=>(0,y.updateOrganizationUTM)(e,t),getSchema:e=>(0,w.generateEventOrganizerSchema)(e),checkStripeCapabilities:async e=>(0,b.checkAccountEligibility)(e),listFinancialTransfers:async(e,t="month")=>(0,g.getFinancialTransfersByOrganization)(e,t),canCreateEvent:async e=>(0,f.canOrganizationCreateEvent)(e),listBans:async e=>(0,E.getBanListBy)("organization",e,["id","email","ip_address","user_agent","created_at"]),createBan:m.createBanList,updateBan:async(e,t,r)=>(0,A.updateBanList)(e,{ip_address:t,user_agent:r},["ip_address","user_agent"]),deleteBan:k.deleteBanList};e.s(["default",0,j],271260);var P=e.i(95187);let C=(0,P.createServerReference)("607da63a6f278211f71907633c5ef1f10290fcfbc9",P.callServer,void 0,P.findSourceMapURL,"insertTicketTypes"),L=(0,P.createServerReference)("40bae4e2f4aea9d37fab402c2b06f84da421d90ea9",P.callServer,void 0,P.findSourceMapURL,"getOrganizationSettings"),$=(0,P.createServerReference)("70e88888384ef7987b729e07430cc15d9121b8f83a",P.callServer,void 0,P.findSourceMapURL,"createTransferRequests"),x=(0,P.createServerReference)("40a7d8ad96681c777aa6506195e91bc81912ae203c",P.callServer,void 0,P.findSourceMapURL,"deleteTicketTypes"),B=(0,P.createServerReference)("4036764bbc263346d58e0a940a246c97b32637d540",P.callServer,void 0,P.findSourceMapURL,"deleteTransferRequests");var M=e.i(592116);let z=(0,P.createServerReference)("7000279f4a11478c3ec24e5300a84fd69abedc841e",P.callServer,void 0,P.findSourceMapURL,"getTicketsById"),N=(0,P.createServerReference)("7f3e48b41850fb991fb2a2327837cb5175ad5760c2",P.callServer,void 0,P.findSourceMapURL,"getTicketTypesBy"),q=(0,P.createServerReference)("7e03cc0a679a5f7cdcca308d50280ec5115f2d2c46",P.callServer,void 0,P.findSourceMapURL,"getTransferRequests"),D=(0,P.createServerReference)("782bdec3eaeccd5d88f581ff5ae05a487cc19908b8",P.callServer,void 0,P.findSourceMapURL,"updateTickets"),F=(0,P.createServerReference)("781ec6169f6682a3d795cb088cafd1a1f8a547e1f1",P.callServer,void 0,P.findSourceMapURL,"updateTicketTypes");var W=e.i(971031),V=e.i(654306);e.s(["default",0,{get:async(e,t,r)=>z(e,null,`${t?"event(*)":""}${r?", type(*)":""}`),organizationTickets:async e=>(0,M.getTicketsBy)("event.organization",e,["id"],"event:Events!inner(organization)"),ticketTypes:async e=>N("event",e),insertType:C,editType:async(e,t)=>{let r=await F(e,t);return["type","pk_bg_color","pk_image_type"].some(e=>
2e in t)&&(0,W.notifyTicketTypeUpdate)(e).catch(t=>{console.error(`[PassKit] Failed to notify ticket type update for ${e}:`,t)}),r},hide:async e=>D(e,{hidden:!0}),unhide:async e=>D(e,{hidden:!1}),savePasskitInfo:async(e,t,r)=>{let i=await F(e,{pk_bg_color:t,pk_image_type:r});return(0,W.notifyTicketTypeUpdate)(e),i},isClaimed:async e=>z(e,["scanned"]).then(e=>e.scanned),claimTicket:async e=>{let t=await D(e,{scanned:!0,scanned_at:new Date().toISOString()});return(0,V.notifyTicketUpdate)(e),t},update:async(e,t)=>{let r=await D(e,t);return(t.seat||t.owner_name||t.metadata)&&(0,V.notifyTicketUpdate)(e),r},deleteType:x,transfers:{get:async e=>q(null,"to_user (*), from_user (*), event(*, metadata:EventMetadata(*), organization(organization_id, color, name, tier), venue(name))",[{column:"to_user",operation:"eq",value:e,orGroup:"1"},{column:"from_user",operation:"eq",value:e,orGroup:"1"}]),create:async(e,t,r)=>{let i=r.event?.organization;if(i){let e=await L(i);if(e?.allow_ticket_transfers===!1)throw Error("Ticket transfers are disabled for this event")}return $([{from_user:e,to_user:t,ticket_id:r.nft.token.id,nft_token_id:r.nft.nftTokenId,nft_token_address:r.nft.token.tokenAddress,nft_token_symbol
2:r.nft.token.symbol,nft_token_standard:r.nft.token.standard,nft_blockchain:r.nft.token.blockchain,nft_metadata_url:r.nft.metadata,nft_amount:Number.parseInt(r.nft.amount),event:r.event?.event_id}])},delete:B}}],421651);var K=e.i(18030);e.s(["transactions",0,{get:async e=>(0,K.getTransactionsBy)("transaction_number",e,null,"profile(id, color, full_name, email, phone_number, created_at), event(*, venue(name, city, state, name), organization(name, tier, organization_id, color)), tickets:TransactionTickets(ticket(*, type(type)))").then(e=>e[0]),byUser:async(e,t)=>(0,K.getTransactionsBy)("profile",e,null,"*, profile(full_name, id, color, email, created_at, age, gender), event(title, event_type), tickets:TransactionTickets(ticket, ticket_details:Tickets(scanned, refunded, giveaway))",[{column:"organization_id",operation:"eq",value:t}]),recentsByUser:async(e,t)=>(0,K.getTransactionsBy)("profile",e,null,"tickets:TransactionTickets(ticket(*, type(type))), event(*, organization(name, tier))",t?[{column:"id",operation:"neq",value:t}]:void 0,void 0,5),byOrganization:async e=>(0,K.getTransactionsBy)("organization_id",e,null,"profile(gender, age)")}],493760);let J=(0,P.createServerReference)("70019cfbc243e2b7132f518d65fd99da27bfef6695",P.callServer,void 0,P.findSourceMapURL,"acceptOrRejectFriendRequest");e.s(["acceptOrRejectFriendRequest",()=>J],478612);let H=(0,P.createServerReference)("60755693648698299084036c6119cfb8f31fc524f3",P.callServer,void 0,P.findSourceMapURL,"areUsersFriends");e.s(["areUsersFriends",()=>H],294106);let G=(0,P.createServerReference)("60ef7720af3b2f8832a03e562d7e5aeaa49a96e894",P.callServer,void 0,P.findSourceMapURL,"blockUser");e.s(["blockUser",()=>G],235684);let Y=(0,P.createServerReference)("60dd5a7d1c7a6dacd30a56bd2c696f41c543b9ae19",P.callServer,void 0,P.findSourceMapURL,"cancelFriendRequest");e.s(["cancelFriendRequest",()=>Y],425408);let Q=(0,P.createServerReference)("606166965854e7cf275ac5904fab17294e6b05bcd4",P.callServer,void 0,P.findSourceMapURL,"checkBlockStatus");e.s(["checkBlockStatus",()=>Q],607894);let X=(0,P.createServerReference)("4083e98677a556e60c5a0360787f167766bf2b4e5d",P.callServer,void 0,P.findSourceMapURL,"deleteSupabaseAccount");e.s(["deleteSupabaseAccount",()=>X],487755);let Z=(0,P.createServerReference)("40bea3a28ef97762cb1e0df9a096a7f1270ec948ca",P.callServer,void 0,P.findSourceMapURL,"getBlockedUsers");e.s(["getBlockedUsers",()=>Z],955186);let ee=(0,P.createServerReference)("407c05230ffebc53268d524d2f9129ab744a4ab6b0",P.callServer,void 0,P.findSourceMapURL,"getFriendsForUser");e.s(["getFriendsForUser",()=>ee],916964);let et=(0,P.createServerReference)("40778a63dbc8c44df4f4cf37f839a43e6951cbd76e",P.callServer,void 0,P.findSourceMapURL,"getPendingFriendRequests");e.s(["getPendingFriendRequests",()=>et],991788);let er=(0,P.createServerReference)("40da87994b19003c140612dc5ebfcb2e5471816b75",P.callServer,void 0,P.findSourceMapURL,"getSentFriendRequests");e.s(["getSentFriendRequests",()=>er],122178);let ei=(0,P.createServerReference)("60294c4b433a00d3ac7d762e6f583433313699264c",P.callServer,void 0,P.findSourceMapURL,"removeFriend");e.s(["removeFriend",()=>ei],972834);let en=(0,P.createServerReference)("60dfdb791fb7588ade66cf0dbc4ea8ce3edd65996b",P.callServer,void 0,P.findSourceMapURL,"sendFriendRequest");e.s(["sendFriendRequest",()=>en],158079);let ea=(0,P.createServerReference)("6014c1dc1b78bfde77aca0972ee830196fea2c86f0",P.callServer,void 0,P.findSourceMapURL,"unblockUser");e.s(["unblockUser",()=>ea],235056);let es=(0,P.createServerReference)("70a0be88fbe55bb21698c2a927ea7ce31120ead4ca",P.callServer,void 0,P.findSourceMapURL,"createSavedEvents");e.s(["createSavedEvents",()=>es],515609);let eo=(0,P.createServerReference)("70162950523a05e22d619f484623ea13422645f026",P.callServer,void 0,P.findSourceMapURL,"createSavedOrganizations");e.s(["createSavedOrganizations",()=>eo],600361);let el=(0,P.createServerReference)("703263660f9bd0363e1d87369b5509c1e019296e84",P.callServer,void 0,P.findSourceMapURL,"createSavedVenues");e.s(["createSavedVenues",()=>el],336199);let ec=(0,P.createServerReference)("70007499a5c63b37e53f2acd6e568222303f85bd11",P.callServer,void 0,P.findSourceMapURL,"createSavedVerifiedAccounts");e.s(["createSavedVerifiedAccounts",()=>ec],393610);let eu=(0,P.createServerReference)("40b74696dd1a950219c926ebd11fc8e2ec1d2b65bf",P.callServer,void 0,P.findSourceMapURL,"deleteprofiles");e.s(["deleteprofiles",()=>eu],321730);let eh=(0,P.createServerReference)("40388bcdf25f0a74f3f5d24a5d3f0b3a8670f5bfff",P.callServer,void 0,P.findSourceMapURL,"deleteSavedEventsBy");
2e.s(["deleteSavedEventsBy",()=>eh],423986);let ed=(0,P.createServerReference)("40c9efa865d288f673bf7b0dad03f6fb44f0ee5b7c",P.callServer,void 0,P.findSourceMapURL,"deleteSavedOrganizationsBy");e.s(["deleteSavedOrganizationsBy",()=>ed],513482);let ef=(0,P.createServerReference)("40e6c4b6116985ddaf5ad558e6c33b35ee244868cf",P.callServer,void 0,P.findSourceMapURL,"deleteSavedVenuesBy");e.s(["deleteSavedVenuesBy",()=>ef],303541);let ep=(0,P.createServerReference)("40f8190cfa0e0c199acc54aa0abd9af7f80a7c52da",P.callServer,void 0,P.findSourceMapURL,"deleteSavedVerifiedAccountsBy");e.s(["deleteSavedVerifiedAccountsBy",()=>ep],571473);let eg=(0,P.createServerReference)("7e63ff02be26f0250668c118e2ec2ba6470f18d316",P.callServer,void 0,P.findSourceMapURL,"getprofiles");e.s(["getprofiles",()=>eg],659817);let ev=(0,P.createServerReference)("70612d378481cc021304481c370ccf66f51da63569",P.callServer,void 0,P.findSourceMapURL,"getprofilesById");e.s(["getprofilesById",()=>ev],651021);let ey=(0,P.createServerReference)("7fd613432921705386ff6b76cf843981b2d82c56d3",P.callServer,void 0,P.findSourceMapURL,"getSavedEventsBy");e.s(["getSavedEventsBy",()=>ey],551304);let eb=(0,P.createServerReference)("7f9cf4d88736d730421f2de426ab2d6c76ed840eeb",P.callServer,void 0,P.findSourceMapURL,"getSavedOrganizationsBy");e.s(["getSavedOrganizationsBy",()=>eb],133237);let ew=(0,P.createServerReference)("7fb7dcd82af365cab1231404c2e258b4ab33c17926",P.callServer,void 0,P.findSourceMapURL,"getSavedVenuesBy");e.s(["getSavedVenuesBy",()=>ew],70018);let em=(0,P.createServerReference)("7f629f8dc4dac8a4fbb53528f1de8364ed3dceb4a9",P.callServer,void 0,P.findSourceMapURL,"getSavedVerifiedAccountsBy");e.s(["getSavedVerifiedAccountsBy",()=>em],315522);let eS=(0,P.createServerReference)("70cc5c27e918028db0376a1237466dc60440060dbb",P.callServer,void 0,P.findSourceMapURL,"getVerifiedAccountInfoById");e.s(["getVerifiedAccountInfoById",()=>eS],242281);let e_=(0,P.createServerReference)("7f272c0fd09303fece308a2d4fbe0bc2e4fea01210",P.callServer,void 0,P.findSourceMapURL,"searchprofiles");e.s(["searchprofiles",()=>e_],428303);let ek=(0,P.createServerReference)("789e0564bd0d5a843c5f32ea18a54e6e390d0f3e35",P.callServer,void 0,P.findSourceMapURL,"updateprofiles");e.s(["updateprofiles",()=>ek],120896);let eR=(0,P.createServerReference)("7068aee44611f4474fb64d36d98fa30056e96116ec",P.callServer,void 0,P.findSourceMapURL,"createVerifiedAccountsRequests");e.s(["createVerifiedAccountsRequests",()=>eR],578478)},146944,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("404eefb590e5a0a9b3961138719982668e5ac8ff82",t.callServer,void 0,t.findSourceMapURL,"getTicketsForUser");e.s(["getTicketsForUser",()=>r])},884469,e=>{"use strict";let t={events:{view:"events:view",create:"events:create",update:"events:update",archive:"events:archive"},users:{view:"users:view",create:"users:create",update:"users:update",delete:"users:delete"},settings:{view:"settings:view",update:"settings:update"},discounts:{view:"discounts:view",create:"discounts:create",update:"discounts:update",delete:"discounts:delete"},auctions:{view:"auctions:view",create:"auctions:create",update:"auctions:update",delete:"auctions:delete"},giveaways:{view:"giveaways:view",create:"giveaways:create",delete:"giveaways:delete",update:"giveaways:update"},financial:{view:"financial:view",create:"financial:create",update:"financial:update"}},r=()=>{let e=[];for(let r of Object.values(t))for(let t of Object.values(r))e.push(t);return e};function i(e){switch(e){case"Administrator":return r();case"Event Manager":return[...new Set([...Object.values(t.events),...Object.values(t.auctions),...Object.values(t.giveaways),...Object.values(t.discounts),t.users.view])];case"Financial Manager":return[...new Set([...Object.values(t.financial),...Object.values(t.discounts),t.users.view,t.events.view,t.auctions.view])];case"Viewer":return[t.users.view,t.events.view,t.auctions.view,t.giveaways.view];default:return[t.events.view,t.users.view]}}e.s(["PermissionSets",0,t,"getAllPermissions",0,r,"getPermissionsForRole",()=>i])},702656,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("402d7213c233384e0045148e5a2f732287de335ae7",t.callServer,void 0,t.findSourceMapURL,"createClient");e.s(["createClient",()=>r])},154385,(e,t,r)=>{"use strict";
2Object.defineProperty(r,"__esModule",{value:!0}),r.default=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}},343173,(e,t,r)=>{"use strict";var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let n=i(e.r(906085)),a=i(e.r(154385));r.default=class{constructor(e){var t,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!=(t=e.shouldThrowOnError)&&t,this.signal=e.signal,this.isMaybeSingle=null!=(r=e.isMaybeSingle)&&r,e.fetch?this.fetch=e.fetch:"u"<typeof fetch?this.fetch=n.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json");let r=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async e=>{var t,r,i,n;let s=null,o=null,l=null,c=e.status,u=e.statusText;if(e.ok){if("HEAD"!==this.method){let r=await e.text();""===r||(o="text/csv"===this.headers.get("Accept")||this.headers.get("Accept")&&(null==(t=this.headers.get("Accept"))?void 0:t.includes("application/vnd.pgrst.plan+text"))?r:JSON.parse(r))}let n=null==(r=this.headers.get("Prefer"))?void 0:r.match(/count=(exact|planned|estimated)/),a=null==(i=e.headers.get("content-range"))?void 0:i.split("/");n&&a&&a.length>1&&(l=parseInt(a[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(o)&&(o.length>1?(s={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,l=null,c=406,u="Not Acceptable"):o=1===o.length?o[0]:null)}else{let t=await e.text();try{s=JSON.parse(t),Array.isArray(s)&&404===e.status&&(o=[],s=null,c=200,u="OK")}catch(r){404===e.status&&""===t?(c=204,u="No Content"):s={message:t}}if(s&&this.isMaybeSingle&&(null==(n=null==s?void 0:s.details)?void 0:n.includes("0 rows"))&&(s=null,c=200,u="OK"),s&&this.shouldThrowOnError)throw new a.default(s)}return{error:s,data:o,count:l,status:c,statusText:u}});return this.shouldThrowOnError||(r=r.catch(e=>{var t,r,i;return{error:{message:`${null!=(t=null==e?void 0:e.name)?t:"FetchError"}: ${null==e?void 0:e.message}`,details:`${null!=(r=null==e?void 0:e.stack)?r:""}`,hint:"",code:`${null!=(i=null==e?void 0:e.code)?i:""}`},data:null,count:null,status:0,statusText:""}})),r.then(e,t)}returns(){return this}overrideTypes(){return this}}},782191,(e,t,r)=>{"use strict";var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});
2let n=i(e.r(343173));class a extends n.default{select(e){let t=!1,r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:i,referencedTable:n=i}={}){let a=n?`${n}.order`:"order",s=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${s?`${s},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let i=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:i=r}={}){let n=void 0===i?"offset":`${i}.offset`,a=void 0===i?"limit":`${i}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(a,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return"GET"===this.method?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:i=!1,wal:n=!1,format:a="text"}={}){var s;let o=[e?"analyze":null,t?"verbose":null,r?"settings":null,i?"buffers":null,n?"wal":null].filter(Boolean).join("|"),l=null!=(s=this.headers.get("Accept"))?s:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${a}; for="${l}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}}r.default=a},714633,(e,t,r)=>{"use strict";var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let n=i(e.r(782191));class a extends n.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){let r=Array.from(new Set(t)).map(e=>"string"==typeof e&&RegExp("[,()]").test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:i}={}){let n="";"plain"===i?n="pl":"phrase"===i?n="ph":"websearch"===i&&(n="w");let a=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${n}fts${a}.${t}`),this}match(e){return Object.entries(e).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let i=r?`${r}.or`:"or";return this.url.searchParams.append(i,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}}r.default=a},838290,(e,t,r)=>{"use strict";
2var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let n=i(e.r(714633));r.default=class{constructor(e,{headers:t={},schema:r,fetch:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=i}select(e,t){let{head:r=!1,count:i}=null!=t?t:{},a=!1,s=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!a?"":('"'===e&&(a=!a),e)).join("");return this.url.searchParams.set("select",s),i&&this.headers.append("Prefer",`count=${i}`),new n.default({method:r?"HEAD":"GET",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:r=!0}={}){var i;if(t&&this.headers.append("Prefer",`count=${t}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new n.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(i=this.fetch)?i:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:i,defaultToNull:a=!0}={}){var s;if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&this.url.searchParams.set("on_conflict",t),i&&this.headers.append("Prefer",`count=${i}`),a||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new n.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(s=this.fetch)?s:fetch})}update(e,{count:t}={}){var r;return t&&this.headers.append("Prefer",`count=${t}`),new n.default({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(r=this.fetch)?r:fetch})}delete({count:e}={}){var t;return e&&this.headers.append("Prefer",`count=${e}`),new n.default({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:null!=(t=this.fetch)?t:fetch})}}},902259,(e,t,r)=>{"use strict";var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let n=i(e.r(838290)),a=i(e.r(714633));class s{constructor(e,{headers:t={},schema:r,fetch:i}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.fetch=i}from(e){let t=new URL(`${this.url}/${e}`);return new n.default(t,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new s(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:i=!1,count:n}={}){var s;let o,l,c=new URL(`${this.url}/rpc/${e}`);r||i?(o=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{c.searchParams.append(e,t)})):(o="POST",l=t);let u=new Headers(this.headers);return n&&u.set("Prefer",`count=${n}`),new a.default({method:o,url:c,headers:u,schema:this.schemaName,body:l,fetch:null!=(s=this.fetch)?s:fetch})}}r.default=s},82215,(e,t,r)=>{"use strict";var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.PostgrestError=r.PostgrestBuilder=r.PostgrestTransformBuilder=r.PostgrestFilterBuilder=r.PostgrestQueryBuilder=r.PostgrestClient=void 0;let n=i(e.r(902259));r.PostgrestClient=n.default;let a=i(e.r(838290));r.PostgrestQueryBuilder=a.default;let s=i(e.r(714633));r.PostgrestFilterBuilder=s.default;let o=i(e.r(782191));r.PostgrestTransformBuilder=o.default;let l=i(e.r(343173));r.PostgrestBuilder=l.default;let c=i(e.r(154385));r.PostgrestError=c.default,r.default={PostgrestClient:n.default,PostgrestQueryBuilder:a.default,PostgrestFilterBuilder:s.default,PostgrestTransformBuilder:o.default,PostgrestBuilder:l.default,PostgrestError:c.default}},467034,(e,t,r)=>{var i={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],i=t[1];return(r+i)*3/4-i},t.toByteArray=function(e){var t,r,a=l(e),s=a[0],o=a[1],c=new n((s+o)*3/4-o),u=0,h=o>0?s-4:s;for(r=0;r<h;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===o&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,c[u++]=255&t),1===o&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,a=[],s=0,o=i-n;s<o;s+=16383)a.push(function(e,t,i){for(var n,a=[],s=t;s<i;s+=3)n=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[n>>18&63]+r[n>>12&63]+r[n>>6&63]+r[63&n]);return a.join("")}(e,s,s+16383>o?o:s+16383));return 1===n?a.push(r[(t=e[i-1])>>2]+r[t<<4&63]+"=="):2===n&&a.push(r[(t=(e[i-2]<<8)+e[i-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),a.join("")};for(var r=[],i=[],n="u">typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
vendor: 19,994 bytes, line 2
2+/",s=0,o=a.length;s<o;++s)r[s]=a[s],i[a.charCodeAt(s)]=s;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var i=r===t?0:4-r%4;return[r,i]}i[45]=62,i[95]=63},72:function(e,t,r){"use strict";var i=r(675),n=r(783),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return u(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var i=e,n=t;if(("string"!=typeof n||""===n)&&(n="utf8"),!o.isEncoding(n))throw TypeError("Unknown encoding: "+n);var a=0|f(i,n),l=s(a),c=l.write(i,n);return c!==a&&(l=l.slice(0,c)),l}if(ArrayBuffer.isView(e))return h(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(U(e,ArrayBuffer)||e&&U(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(U(e,SharedArrayBuffer)||e&&U(e.buffer,SharedArrayBuffer)))return function(e,t,r){var i;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),o.prototype),i}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var u=e.valueOf&&e.valueOf();if(null!=u&&u!==e)return o.from(u,t,r);var p=function(e){if(o.isBuffer(e)){var t=0|d(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(p)return p;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return c(e),s(e<0?0:0|d(e))}function h(e){for(var t=e.length<0?0:0|d(e.length),r=s(t),i=0;i<t;i+=1)r[i]=255&e[i];return r}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!o.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(c(e),e<=0)?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(e)};function d(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||U(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return T(e).length;default:if(n)return i?-1:E(e).length;t=(""+t).toLowerCase(),n=!0}}function p(e,t,r){var n,a,s,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var n="",a=t;a<r;++a)n+=I[e[a]];return n}(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return function(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}(this,t,r);case"latin1":case"binary":return function(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}(this,t,r);case"base64":return n=this,a=t,s=r,0===a&&s===n.length?i.fromByteArray(n):i.fromByteArray(n.slice(a,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var i=e.slice(t,r),n="",a=0;a<i.length;a+=2)n+=String.fromCharCode(i[a]+256*i[a+1]);return n}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function g(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function v(e,t,r,i,n){var a;if(0===e.length)return -1;if("string"==typeof r?(i=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(a=r*=1)!=a&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(n)return -1;else r=e.length-1;else if(r<0)if(!n)return -1;else r=0;if("string"==typeof t&&(t=o.from(t,i)),o.isBuffer(t))return 0===t.length?-1:y(e,t,r,i,n);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(n)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,i,n)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,i,n){var a,s=1,o=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return -1;s=2,o/=2,l/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var u=-1;for(a=r;a<o;a++)if(c(e,a)===c(t,-1===u?0:a-u)){if(-1===u&&(u=a),a-u+1===l)return u*s}else -1!==u&&(a-=a-u),u=-1}else for(r+l>o&&(r=o-l),a=r;a>=0;a--){for(var h=!0,d=0;d<l;d++)if(c(e,a+d)!==c(t,d)){h=!1;break}if(h)return a}return -1}o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(U(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),U(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,i=t.length,n=0,a=Math.min(r,i);n<a;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:+(i<r)},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,i=o.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var a=e[r];if(U(a,Uint8Array)&&(a=o.from(a)),!o.isBuffer(a))throw TypeError('"list" argument must be an Array of Buffers');a.copy(i,n),n+=a.length}return i},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?b(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a&&(o.prototype[a]=o.prototype.inspect),o.prototype.compare=function(e,t,r,i,n){if(U(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,n>>>=0,this===e)return 0;for(var a=n-i,s=r-t,l=Math.min(a,s),c=this.slice(i,n),u=e.slice(t,r),h=0;h<l;++h)if(c[h]!==u[h]){a=c[h],s=u[h];break}return a<s?-1:+(s<a)},o.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return v(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return v(this,e,t,r,!1)};function b(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n<r;){var a,s,o,l,c=e[n],u=null,h=c>239?4:c>223?3:c>191?2:1;if(n+h<=r)switch(h){case 1:c<128&&(u=c);break;case 2:(192&(a=e[n+1]))==128&&(l=(31&c)<<6|63&a)>127&&(u=l);break;case 3:a=e[n+1],s=e[n+2],(192&a)==128&&(192&s)==128&&(l=(15&c)<<12|(63&a)<<6|63&s)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:a=e[n+1],s=e[n+2],o=e[n+3],(192&a)==128&&(192&s)==128&&(192&o)==128&&(l=(15&c)<<18|(63&a)<<12|(63&s)<<6|63&o)>65535&&l<1114112&&(u=l)}null===u?(u=65533,h=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),n+=h}var d=i,f=d.length;if(f<=4096)return String.fromCharCode.apply(String,d);for(var p="",g=0;g<f;)p+=String.fromCharCode.apply(String,d.slice(g,g+=4096));return p}function w(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function m(e,t,r,i,n,a){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<a)throw RangeError('"value" argument is out of bounds');if(r+i>e.length)throw RangeError("Index out of range")}function S(e,t,r,i,n,a){if(r+i>e.length||r<0)throw RangeError("Index out of range")}function _(e,t,r,i,a){return t*=1,r>>>=0,a||S(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}function k(e,t,r,i,a){return t*=1,r>>>=0,a||S(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}o.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var n,a,s,o,l,c,u,h,d=this.length-t;if((void 0===r||r>d)&&(r=d),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var f=!1;;)switch(i){case"hex":return function(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;var a=t.length;i>a/2&&(i=a/2);for(var s=0;s<i;++s){var o,l=parseInt(t.substr(2*s,2),16);if((o=l)!=o)break;e[r+s]=l}return s}(this,e,t,r);case"utf8":case"utf-8":return n=t,a=r,A(E(e,this.length-n),this,n,a);case"ascii":return s=t,o=r,A(O(e),this,s,o);case"latin1":case"binary":return function(e,t,r,i){return A(O(t),e,r,i)}(this,e,t,r);case"base64":return l=t,c=r,A(T(e),this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u=t,h=r,A(function(e,t){for(var r,i,n=[],a=0;a<e.length&&!((t-=2)<0);++a)i=(r=e.charCodeAt(a))>>8,n.push(r%256),n.push(i);return n}(e,this.length-u),this,u,h);default:if(f)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),f=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var i=this.subarray(e,t);return Object.setPrototypeOf(i,o.prototype),i},o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var i=this[e],n=1,a=0;++a<t&&(n*=256);)i+=this[e+a]*n;return i},o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},o.prototype.readUInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var i=this[e],n=1,a=0;++a<t&&(n*=256);)i+=this[e+a]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var i=t,n=1,a=this[e+--i];i>0&&(n*=256);)a+=this[e+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(e,t){return(e>>>=0,t||w(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||w(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||w(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||w(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||w(e,8,this.length),n.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,i){if(e*=1,t>>>=0,r>>>=0,!i){var n=Math.pow(2,8*r)-1;m(this,e,t,r,n,0)}var a=1,s=0;for(this[t]=255&e;++s<r&&(a*=256);)this[t+s]=e/a&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,i){if(e*=1,t>>>=0,r>>>=0,!i){var n=Math.pow(2,8*r)-1;m(this,e,t,r,n,0)}var a=r-1,s=1;for(this[t+a]=255&e;--a>=0&&(s*=256);)this[t+a]=e/s&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||m(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||m(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||m(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||m(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||m(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,r,i){if(e*=1,t>>>=0,!i){var n=Math.pow(2,8*r-1);m(this,e,t,r,n-1,-n)}var a=0,s=1,o=0;for(this[t]=255&e;++a<r&&(s*=256);)e<0&&0===o&&0!==this[t+a-1]&&(o=1),this[t+a]=(e/s|0)-o&255;return t+r},o.prototype.writeIntBE=function(e,t,r,i){if(e*=1,t>>>=0,!i){var n=Math.pow(2,8*r-1);m(this,e,t,r,n-1,-n)}var a=r-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s|0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||m(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||m(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||m(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||m(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||m(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,r){return _(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return _(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return k(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return k(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,i){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var n=i-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,i);else if(this===e&&r<t&&t<i)for(var a=n-1;a>=0;--a)e[a+t]=this[a+r];else Uint8Array.prototype.set.call(e,this.subarray(r,i),t);return n},o.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!o.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(1===e.length){var n,a=e.charCodeAt(0);("utf8"===i&&a<128||"latin1"===i)&&(e=a)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{var s=o.isBuffer(e)?e:o.from(e,i),l=s.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=s[n%l]}return this};var R=/[^+/0-9A-Za-z-_]/g;function E(e,t){t=t||1/0;for(var r,i=e.length,n=null,a=[],s=0;s<i;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!n){if(r>56319||s+1===i){(t-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return a}function O(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function T(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}
2function A(e,t,r,i){for(var n=0;n<i&&!(n+r>=t.length)&&!(n>=e.length);++n)t[n+r]=e[n];return n}function U(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var I=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var i=16*r,n=0;n<16;++n)t[i+n]=e[r]+e[n];return t}()},783:function(e,t){t.read=function(e,t,r,i,n){var a,s,o=8*n-i-1,l=(1<<o)-1,c=l>>1,u=-7,h=r?n-1:0,d=r?-1:1,f=e[t+h];for(h+=d,a=f&(1<<-u)-1,f>>=-u,u+=o;u>0;a=256*a+e[t+h],h+=d,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=i;u>0;s=256*s+e[t+h],h+=d,u-=8);if(0===a)a=1-c;else{if(a===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,i),a-=c}return(f?-1:1)*s*Math.pow(2,a-i)},t.write=function(e,t,r,i,n,a){var s,o,l,c=8*a-n-1,u=(1<<c)-1,h=u>>1,d=5960464477539062e-23*(23===n),f=i?0:a-1,p=i?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+h>=1?t+=d/l:t+=d*Math.pow(2,1-h),t*l>=2&&(s++,l/=2),s+h>=u?(o=0,s=u):s+h>=1?(o=(t*l-1)*Math.pow(2,n),s+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,n),s=0));n>=8;e[r+f]=255&o,f+=p,o/=256,n-=8);for(s=s<<n|o,c+=n;c>0;e[r+f]=255&s,f+=p,s/=256,c-=8);e[r+f-p]|=128*g}}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}},s=!0;try{i[e](r,r.exports,a),s=!1}finally{s&&delete n[e]}return r.exports}a.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=a(72)},70203,(e,t,r)=>{"use strict";r.parse=function(e,t){if("string"!=typeof e)throw TypeError("argument str must be a string");var r={},i=e.length;if(i<2)return r;var a=t&&t.decode||h,s=0,o=0,l=0;do{if(-1===(o=e.indexOf("=",s)))break;if(-1===(l=e.indexOf(";",s)))l=i;else if(o>l){s=e.lastIndexOf(";",o-1)+1;continue}var d=c(e,s,o),f=u(e,o,d),p=e.slice(d,f);if(!n.call(r,p)){var g=c(e,o+1,l),v=u(e,l,g);34===e.charCodeAt(g)&&34===e.charCodeAt(v-1)&&(g++,v--);var y=e.slice(g,v);r[p]=function(e,t){try{return t(e)}catch(t){return e}}(y,a)}s=l+1}while(s<i)return r},r.serialize=function(e,t,r){var n=r&&r.encode||encodeURIComponent;if("function"!=typeof n)throw TypeError("option encode is invalid");if(!a.test(e))throw TypeError("argument name is invalid");var c=n(t);if(!s.test(c))throw TypeError("argument val is invalid");var u=e+"="+c;if(!r)return u;if(null!=r.maxAge){var h=Math.floor(r.maxAge);if(!isFinite(h))throw TypeError("option maxAge is invalid");u+="; Max-Age="+h}if(r.domain){if(!o.test(r.domain))throw TypeError("option domain is invalid");u+="; Domain="+r.domain}if(r.path){if(!l.test(r.path))throw TypeError("option path is invalid");u+="; Path="+r.path}if(r.expires){var d,f=r.expires;if(d=f,"[object Date]"!==i.call(d)||isNaN(f.valueOf()))throw TypeError("option expires is invali
2d");u+="; Expires="+f.toUTCString()}if(r.httpOnly&&(u+="; HttpOnly"),r.secure&&(u+="; Secure"),r.partitioned&&(u+="; Partitioned"),r.priority)switch("string"==typeof r.priority?r.priority.toLowerCase():r.priority){case"low":u+="; Priority=Low";break;case"medium":u+="; Priority=Medium";break;case"high":u+="; Priority=High";break;default:throw TypeError("option priority is invalid")}if(r.sameSite)switch("string"==typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:case"strict":u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"none":u+="; SameSite=None";break;default:throw TypeError("option sameSite is invalid")}return u};var i=Object.prototype.toString,n=Object.prototype.hasOwnProperty,a=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,s=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,o=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,l=/^[\u0020-\u003A\u003D-\u007E]*$/;function c(e,t,r){do{var i=e.charCodeAt(t);if(32!==i&&9!==i)return t}while(++t<r)return r}function u(e,t,r){for(;t>r;){var i=e.charCodeAt(--t);if(32!==i&&9!==i)return t+1}return r}
2function h(e){return -1!==e.indexOf("%")?decodeURIComponent(e):e}},752683,(e,t,r)=>{},143151,242397,e=>{"use strict";let t;var r,i,n,a,s,o,l,c,u,h,d,f,p,g,v,y,b,w,m,S,_,k=e.i(533327),R=e.i(574141),E=e.i(780902),O=e.i(233948),T=e.i(271260),A=e.i(421651),U=e.i(493760);e.i(946512);var I=e.i(478612),j=e.i(294106),P=e.i(235684),C=e.i(425408),L=e.i(607894),$=e.i(487755),x=e.i(955186),B=e.i(378174),M=e.i(916964),z=e.i(991788),N=e.i(122178),q=e.i(972834),D=e.i(158079),F=e.i(235056);e.i(982690);var W=e.i(515609),V=e.i(600361),K=e.i(336199),J=e.i(393610),H=e.i(321730),G=e.i(423986),Y=e.i(513482),Q=e.i(303541),X=e.i(571473),Z=e.i(659817),ee=e.i(651021),et=e.i(551304),er=e.i(133237),ei=e.i(70018),en=e.i(315522),ea=e.i(242281),es=e.i(428303),eo=e.i(120896),el=e.i(578478),ec=e.i(146944),eu=e.i(884469),eh=e.i(702656),ed=e.i(3541);let ef={get:ee.getprofilesById,getPhoto:async e=>(0,ed.getProfilePhoto)(e),updatePhoto:async e=>null,search:async(e,t=!1)=>(0,Z.getprofiles)(null,t?"verified_account_info:VerifiedAccountInfo(*)":"",[{column:"full_name",operation:"ilike",value:`%${e}%`,orGroup:"1"},{column:"email",operation:"ilike",value:`%${e}%`,orGroup:"1"}]),searchByEmail:async(e,t=!1)=>(0,es.searchprofiles)("email",e,null,t?"verified_account_info:VerifiedAccountInfo(*)":""),delete:async e=>{let t=await (0,$.deleteSupabaseAccount)(e);if(t.error)return{success:!1,error:t.error.message||"Failed to delete authentication account"};try{return await (0,H.deleteprofiles)(e),{success:!0}}catch(e){return console.error("[Account Delete] Profile cleanup failed after auth deletion:",e),{success:!0}}},update:async(e,t)=>(0,eo.updateprofiles)(e,t),updatePreferences:async(e,t,r,i)=>(0,eo.updateprofiles)(e,{preferences:t,age:i,gender:r}),createWallet:async(e,t,r)=>(0,eo.updateprofiles)(e,{wallet_id:t,wallet_address:r}),listPermissions:async(e,t)=>{let r=await (0,eh.createClient)(!0),{data:i}=await r.from("Organizations").select("tier, owner_id").eq("organization_id",t).single();if(i?.owner_id===e)return(0,eu.getAllPermissions)();let{data:n}=await r.from("OrganizationUsers").select("id").eq("organization",t).eq("user",e).maybeSingle();if(!n)return[];if(i&&"basic"===i.tier)return(0,eu.getAllPermissions)();let{data:a}=await r.from("UserRoles").select("user_role_id").eq("user",e).eq("organization",t);if(!a?.[0]?.user_role_id)return[];let{data:s}=await r.from("UserRoleAssignments").select("role_name").eq("user_role_id",a[0].user_role_id);return s?.map(e=>e.role_name)??[]},listFriends:async e=>await (0,M.getFriendsForUser)(e),checkFriendship:async(e,t)=>await (0,j.areUsersFriends)(e,t),deleteFriendship:async(e,t)=>await (0,q.removeFriend)(e,t),listFriendsAttendingEvent:async(e,t)=>(0,B.getFriendsAttendingEvent)(e,t),updateFriendRequestStatus:async(e,t,r)=>(0,I.acceptOrRejectFriendRequest)(t,e,r),createFriendRequest:async(e,t)=>(0,D.sendFriendRequest)(e,t),deleteFriendRequest:async(e,t)=>(0,C.cancelFriendRequest)(e,t),listIncomingFriendRequests:async e=>(0,z.getPendingFriendRequests)(e),listSentFriendRequests:async e=>(0,N.getSentFriendRequests)(e),createBlock:async(e,t)=>(0,P.blockUser)(e,t),deleteBlock:async(e,t)=>(0,F.unblockUser)(e,t),listBlockedUsers:async e=>(0,x.getBlockedUsers)(e),checkBlockStatus:async(e,t)=>(0,L.checkBlockStatus)(e,t),updateNewsletterSubscription:async(e,t)=>(0,eo.updateprofiles)(e,{newsletter_subscribed:t}),checkNewsletterSubscription:async e=>{let t=await (0,ee.getprofilesById)(e);return t?.newsletter_subscribed??!0},listTickets:async e=>e?await (0,ec.getTicketsForUser)(e):[],getVerifiedAccount:async e=>(0,ea.getVerifiedAccountInfoById)(e,null,"user(*)"),createVerifiedAccountRequest:el.createVerifiedAccountsRequests,checkIsEventSaved:async(e,t)=>(0,et.getSavedEventsBy)("user",e,["id"],null,[{column:"event",operation:"eq",value:t}]).then(e=>e.length>0),checkIsVenueSaved:async(e,t)=>(0,ei.getSavedVenuesBy)("user",e,["id"],null,[{column:"venue",operation:"eq",value:t}]).then(e=>e.length>0),checkIsVerifiedAccountSaved:async(e,t)=>(0,en.getSavedVerifiedAccountsBy)("user",e,["id"],null,[{column:"account",operation:"eq",value:t}]).then(e=>e.length>0),checkIsOrganizationSaved:async(e,t)=>(0,er.getSavedOrganizationsBy)("user",e,["id"],null,[{column:"organization",operation:"eq",value:t}]).then(e=>e.length>0),listSavedEvents:async e=>(0,et.getSavedEventsBy)("user",e,["id","user"],"event(*, organization:Organizations(*), venue(*))"),listSavedVerifiedAccounts:async e=>(0,en.getSavedVerifiedAccountsBy)("user",e,["id","user"],"performer:account(*)"),listSavedOrganizations:async e=>(0,er.getSavedOrganizationsBy)("user",e,["id","user"],"organization:Organizations(*)"),listSavedVenues:async e=>(0,ei.getSavedVenuesBy)("user",e,["id","user"],"venue(*)"),createSavedEvent:async(e,t)=>(0,W.createSavedEvents)([{user:e,event:t}]),deleteSavedEvent:async(e,t)=>(0,G.deleteSavedEventsBy)([{column:"user",operation:"eq",value:e},{column:"event",operation:"eq",value:t}]),createSavedVerifiedAccount:async(e,t)=>(0,J.createSavedVerifiedAccounts)([{user:e,account:t}]),deleteSavedVerifiedAccount:async(e,t)=>(0,X.deleteSavedVerifiedAccountsBy)([{column:"user",operation:"eq",value:e},{column:"account",operation:"eq",value:t}]),createSavedOrganization:async(e,t)=>(0,V.createSavedOrganizations)([{user:e,organization:t}]),deleteSavedOrganization:async(e,t)=>(0,Y.deleteSavedOrganizationsBy)([{column:"user",operation:"eq",value:e},{column:"organization",operation:"eq",value:t}]),createSavedVenue:async(e,t)=>(0,K.createSavedVenues)([{user:e,venue:t}]),deleteSavedVenue:async(e,t)=>(0,Q.deleteSavedVenuesBy)([{column:"user",operation:"eq",value:e},{column:"venue",operation:"eq",value:t}])};var ep=e.i(95187);let eg=(0,ep.createServerReference)("60524410bfe3bdcce276629bfd60dd7a5aae5b4fc1",ep.callServer,void 0,ep.findSourceMapURL,"searchForVenues"),ev=(0,ep.createServerReference)("408eb30bb65beb21f247b2ce9ff6b933059ca634b1",ep.callServer,void 0,ep.findSourceMapURL,"getVenuesInArea"),ey=(0,ep.createServerReference)("7004be10a9595bf4c4e25522d16d58ced95da5ac01",ep.callServer,void 0,ep.findSourceMapURL,"createVenues"),eb=(0,ep.createServerReference)("40401d40918ad689c50a2b3aeca80bc4de8101f109",ep.callServer,void 0,ep.findSourceMapURL,"deleteVenues"),ew=(0,ep.createServerReference)("7e25e173bf7cd913220a
2aff58dc5e2f2f6432eae75",ep.callServer,void 0,ep.findSourceMapURL,"getVenues"),em=(0,ep.createServerReference)("70ec56590e785f06a0660fdf66c45fb8c8ae5e41f5",ep.callServer,void 0,ep.findSourceMapURL,"getVenuesById"),eS=(0,ep.createServerReference)("78baa33a7648a173f9d096d41fb1cd935adeb5f605",ep.callServer,void 0,ep.findSourceMapURL,"updateVenues"),e_=(0,ep.createServerReference)("605fd94fd4f28c778bbbde4cb0c6831091578d3754",ep.callServer,void 0,ep.findSourceMapURL,"updateVenueUTM"),ek={get:async e=>em(e),list:async()=>ew(),create:async e=>ey([e]).then(e=>e[0]),update:async(t,r)=>{let i=await eS(t,r);if(["name","location","name_v2"].some(e=>e in r)){let{notifyVenueUpdate:r}=await e.A(819885);r(t).catch(e=>{console.error(`[PassKit] Failed to notify venue update for ${t}:`,e)})}return i},delete:async e=>eb(e),search:async(e,t)=>await eg(e,t),listInArea:async e=>ev(e),updateUTM:async(e,t)=>e_(e,t)},eR=(0,ep.createServerReference)("40c688e15c8444de334562af6f497db13d7d4d049e",ep.callServer,void 0,ep.findSourceMapURL,"createFinancialAccount"),eE=(0,ep.createServerReference)("7fb78074933b5edfc1d6ffffbf89ffd4294070549f",ep.callServer,void 0,ep.findSourceMapURL,"getEventAccountEntityBy"),eO=(0,ep.createServerReference)("7e663390cd98ffd23bb30e8e2fa4224459adcad9b4",ep.callServer,void 0,ep.findSourceMapURL,"getVerifiedAccountInfo"),eT=(0,ep.createServerReference)("7f7ad4ed108bb11a5bb159fa2e1260cdee79f6897d",ep.callServer,void 0,ep.findSourceMapURL,"getVerifiedAccountInfoBy"),eA=(0,ep.createServerReference)("78813babbbdc2d1ba15672656318a6ba4c96f51e4a",ep.callServer,void 0,ep.findSourceMapURL,"updateVerifiedAccountInfo"),eU={get:async e=>(await eT("user",e))[0],search:async e=>eO(null,"user(full_name, color)",[{column:"name",operation:"ilike",value:`%${e}%`}]),createAndLinkFinancialAccount:async e=>{let{url:t,account:r}=await eR("verified_account");return await eA(e,{stripe_account_id:r}),t},upcomingEvents:async e=>eE("verified_account",e,["share"],"event (*, organization:Organizations!Events_organization_fkey(name), venue(name), ticket_types:TicketTypes!event_id(price))",[],void 0,5)},eI={},ej=(0,ep.createServerReference)("70445d78246b4984e2a0c149f32bba2abc5f51ef8e",ep.callServer,void 0,ep.findSourceMapURL,"createDiscounts"),eP=(0,ep.createServerReference)("403518bb151acfa381729c2657154a401801446793",ep.callServer,void 0,ep.findSourceMapURL,"deleteDiscounts"),eC=(0,ep.createServerReference)("7ff8b9d1005c0262bc08ec6d9b7b93585fb800fca1",ep.callServer,void 0,ep.findSourceMapURL,"getDiscountsBy"),eL={listByOrganization:async e=>eC("organization",e,null,"event(*)"),listByEvent:async e=>eC("event",e),create:ej,update:(0,ep.createServerReference)("7826cf440b9a0f5dba5cc6066cb120c03cbbabebdb",ep.callServer,void 0,ep.findSourceMapURL,"updateDiscounts"),delete:eP};var e$=e.i(247167);class ex extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class eB extends ex{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class eM extends ex{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class ez extends ex{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}(r=d||(d={})).Any="any",r.ApNortheast1="ap-northeast-1",r.ApNortheast2="ap-northeast-2",r.ApSouth1="ap-south-1",r.ApSoutheast1="ap-southeast-1",r.ApSoutheast2="ap-southeast-2",r.CaCentral1="ca-central-1",r.EuCentral1="eu-central-1",r.EuWest1="eu-west-1",r.EuWest2="eu-west-2",r.EuWest3="eu-west-3",r.SaEast1="sa-east-1",r.UsEast1="us-east-1",r.UsWest1="us-west-1",r.UsWest2="us-west-2";class eN{constructor(t,{headers:r={},customFetch:i,region:n=d.Any}={}){this.url=t,this.headers=r,this.region=n,this.fetch=(t=>{let r;return r=t||("u"<typeof fetch?(...t)=>e.A(611737).then(({default:e})=>e(...t)):fetch),(...e)=>r(...e)})(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){var t,r,i,n;return t=this,r=arguments,i=void 0,n=function*(e,t={}){var r;try{let i,{headers:n,method:a,body:s,signal:o}=t,l={},{region:c}=t;c||(c=this.region);let u=new URL(`${this.url}/${e}`);c&&"any"!==c&&(l["x-region"]=c,u.searchParams.set("forceFunctionRegion",c)),s&&(n&&!Object.prototype.hasOwnProperty.call(n,"Content-Type")||!n)&&("u">typeof Blob&&s instanceof Blob||s instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",i=s):"string"==typeof s?(l["Content-Type"]="text/plain",i=s):"u">typeof FormData&&s instanceof FormData?i=s:(l["Content-Type"]="application/json",i=JSON.stringify(s)));let h=yield this.fetch(u.toString(),{method:a||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),n),body:i,signal:o}).catch(e=>{if("AbortError"===e.name)throw e;throw new eB(e)}),d=h.headers.get("x-relay-error");
2if(d&&"true"===d)throw new eM(h);if(!h.ok)throw new ez(h);let f=(null!=(r=h.headers.get("Content-Type"))?r:"text/plain").split(";")[0].trim();return{data:"application/json"===f?yield h.json():"application/octet-stream"===f?yield h.blob():"text/event-stream"===f?h:"multipart/form-data"===f?yield h.formData():yield h.text(),error:null,response:h}}catch(e){if(e instanceof Error&&"AbortError"===e.name)return{data:null,error:new eB(e)};return{data:null,error:e,response:e instanceof ez||e instanceof eM?e.context:void 0}}},new(i||(i=Promise))(function(e,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof i?r:new i(function(e){e(r)})).then(s,o)}l((n=n.apply(t,r||[])).next())})}}let{PostgrestClient:eq,PostgrestQueryBuilder:eD,PostgrestFilterBuilder:eF,PostgrestTransformBuilder:eW,PostgrestBuilder:eV,PostgrestError:eK}=e.i(82215).default,eJ=class{static detectEnvironment(){var t;if("u">typeof WebSocket)return{type:"native",constructor:WebSocket};if("u">typeof globalThis&&void 0!==globalThis.WebSocket)return{type:"native",constructor:globalThis.WebSocket};if(void 0!==e.g.WebSocket)return{type:"native",constructor:e.g.WebSocket};if("u">typeof globalThis&&void 0!==globalThis.WebSocketPair&&void 0===globalThis.WebSocket)return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if("u">typeof globalThis&&globalThis.EdgeRuntime||"u">typeof navigator&&(null==(t=navigator.userAgent)?void 0:t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(void 0!==e$.default){let e=e$.default.versions;if(e&&e.node){let t=parseInt(e.node.replace(/^v/,"").split(".")[0]);return t>=22?void 0!==globalThis.WebSocket?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${t} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${t} detected without native WebSocket support.`,workaround:'For Node.js < 22, install "ws" package and provide it via the transport option:\nimport ws from "ws"\nnew RealtimeClient(url, { transport: ws })'}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=` 3 4Suggested solution: ${e.workaround}`),Error(t)}static createWebSocket(e,t){return new(this.getWebSocketConstructor())(e,t)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return"native"===e.type||"ws"===e.type}catch(e){return!1}}};(i=f||(f={}))[i.connecting=0]="connecting",i[i.open=1]="open",i[i.closing=2]="closing",i[i.closed=3]="closed",(n=p||(p={})).closed="closed",n.errored="errored",n.joined="joined",n.joining="joining",n.leaving="leaving",(a=g||(g={})).close="phx_close",a.error="phx_error",a.join="phx_join",a.reply="phx_reply",a.leave="phx_leave",a.access_token="access_token",(v||(v={})).websocket="websocket",(s=y||(y={})).Connecting="connecting",s.Open="open",s.Closing="closing",s.Closed="closed";class eH{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):"string"==typeof e?t(JSON.parse(e)):t({})}_binaryDecode(e){let t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){let i=t.getUint8(1),n=t.getUint8(2),a=this.HEADER_LENGTH+2,s=r.decode(e.slice(a,a+i));a+=i;let o=r.decode(e.slice(a,a+n));return a+=n,{ref:null,topic:s,event:o,payload:JSON.parse(r.decode(e.slice(a,e.byteLength)))}}}class eG{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}(o=b||(b={})).abstime="abstime",o.bool="bool",o.date="date",o.daterange="daterange",o.float4="float4",o.float8="float8",o.int2="int2",o.int4="int4",o.int4range="int4range",o.int8="int8",o.int8range="int8range",o.json="json",o.jsonb="jsonb",o.money="money",o.numeric="numeric",o.oid="oid",o.reltime="reltime",o.text="text",o.time="time",o.timestamp="timestamp",o.timestamptz="timestamptz",o.timetz="timetz",o.tsrange="tsrange",o.tstzrange="tstzrange";let eY=(e,t,r={})=>{var i;let n=null!=(i=r.skipTypes)?i:[];return t?Object.keys(t).reduce((r,i)=>(r[i]=eQ(i,e,t,n),r),{}):{}},eQ=(e,t,r,i)=>{let n=t.find(t=>t.name===e),a=null==n?void 0:n.type,s=r[e];return a&&!i.includes(a)?eX(a,s):eZ(s)},eX=(e,t)=>{if("_"===e.charAt(0))return e6(t,e.slice(1,e.length));switch(e){case b.bool:return e0(t);case b.float4:case b.float8:case b.int2:case b.int4:case b.int8:case b.numeric:case b.oid:return e1(t);case b.json:case b.jsonb:return e2(t);case b.timestamp:return e8(t);case b.abstime:case b.date:case b.daterange:case b.int4range:case b.int8range:case b.money:case b.reltime:case b.text:case b.time:case b.timestamptz:case b.timetz:case b.tsrange:case b.tstzrange:default:return eZ(t)}},eZ=e=>e,e0=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},e1=e=>{if("string"==typeof e){let t=parseFloat(e);
4if(!Number.isNaN(t))return t}return e},e2=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){console.log(`JSON parse error: ${e}`)}return e},e6=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,i=e[r];if("{"===e[0]&&"}"===i){let i,n=e.slice(1,r);try{i=JSON.parse("["+n+"]")}catch(e){i=n?n.split(","):[]}return i.map(e=>eX(t,e))}return e},e8=e=>"string"==typeof e?e.replace(" ","T"):e,e5=e=>{let t=e;return(t=(t=t.replace(/^ws/i,"http")).replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,"")).replace(/\/+$/,"")+"/api/broadcast"};class e3{constructor(e,t,r={},i=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var r;return this._hasReceived(e)&&t(null==(r=this.receivedResp)?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let e=e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}(l=w||(w={})).SYNC="sync",l.JOIN="join",l.LEAVE="leave";class e4{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(null==t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},e=>{let{onJoin:t,onLeave:r,onSync:i}=this.caller;this.joinRef=this.channel._joinRef(),this.state=e4.syncState(this.state,e,t,r),this.pendingDiffs.forEach(e=>{this.state=e4.syncDiff(this.state,e,t,r)}),this.pendingDiffs=[],i()}),this.channel._on(r.diff,{},e=>{let{onJoin:t,onLeave:r,onSync:i}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=e4.syncDiff(this.state,e,t,r),i())}),this.onJoin((e,t,r)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:r})}),this.onLeave((e,t,r)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:r})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,r,i){let n=this.cloneDeep(e),a=this.transformState(t),s={},o={};return this.map(n,(e,t)=>{a[e]||(o[e]=t)}),this.map(a,(e,t)=>{let r=n[e];if(r){let i=t.map(e=>e.presence_ref),n=r.map(e=>e.presence_ref),a=t.filter(e=>0>n.indexOf(e.presence_ref)),l=r.filter(e=>0>i.indexOf(e.presence_ref));a.length>0&&(s[e]=a),l.length>0&&(o[e]=l)}else s[e]=t}),this.syncDiff(n,{joins:s,leaves:o},r,i)}static syncDiff(e,t,r,i){let{joins:n,leaves:a}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),i||(i=()=>{}),this.map(n,(t,i)=>{var n;let a=null!=(n=e[t])?n:[];if(e[t]=this.cloneDeep(i),a.length>0){let r=e[t].map(e=>e.presence_ref),i=a.filter(e=>0>r.indexOf(e.presence_ref));e[t].unshift(...i)}r(t,a,i)}),this.map(a,(t,r)=>{let n=e[t];if(!n)return;let a=r.map(e=>e.presence_ref);n=n.filter(e=>0>a.indexOf(e.presence_ref)),e[t]=n,i(t,n,r),0===n.length&&delete e[t]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return Object.getOwnPropertyNames(e=this.cloneDeep(e)).reduce((t,r)=>{let i=e[r];return"metas"in i?t[r]=i.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):t[r]=i,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}(c=m||(m={})).ALL="*",c.INSERT="INSERT",c.UPDATE="UPDATE",c.DELETE="DELETE",(u=S||(S={})).BROADCAST="broadcast",u.PRESENCE="presence",u.POSTGRES_CHANGES="postgres_changes",u.SYSTEM="system",(h=_||(_={})).SUBSCRIBED="SUBSCRIBED",h.TIMED_OUT="TIMED_OUT",h.CLOSED="CLOSED",h.CHANNEL_ERROR="CHANNEL_ERROR";class e7{constructor(e,t={config:{}},r){var i,n;if(this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=p.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new e3(this,g.join,this.params,this.timeout),this.rejoinTimer=new eG(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=p.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e
4=>e.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=p.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=p.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=p.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=p.errored,this.rejoinTimer.scheduleTimeout())}),this._on(g.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new e4(this),this.broadcastEndpointURL=e5(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(null==(n=null==(i=this.params.config)?void 0:i.broadcast)?void 0:n.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,t=this.timeout){var r,i,n;if(this.socket.isConnected()||this.socket.connect(),this.state==p.closed){let{config:{broadcast:a,presence:s,private:o}}=this.params,l=null!=(i=null==(r=this.bindings.postgres_changes)?void 0:r.map(e=>e.filter))?i:[],c=!!this.bindings[S.PRESENCE]&&this.bindings[S.PRESENCE].length>0||(null==(n=this.params.config.presence)?void 0:n.enabled)===!0,u={},h={broadcast:a,presence:Object.assign(Object.assign({},s),{enabled:c}),postgres_changes:l,private:o};this.socket.accessTokenValue&&(u.access_token=this.socket.accessTokenValue),this._onError(t=>null==e?void 0:e(_.CHANNEL_ERROR,t)),this._onClose(()=>null==e?void 0:e(_.CLOSED)),this.updateJoinPayload(Object.assign({config:h},u)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:t})=>{var r;if(this.socket.setAuth(),void 0===t){null==e||e(_.SUBSCRIBED);return}{let i=this.bindings.postgres_changes,n=null!=(r=null==i?void 0:i.length)?r:0,a=[];for(let r=0;r<n;r++){let n=i[r],{filter:{event:s,schema:o,table:l,filter:c}}=n,u=t&&t[r];if(u&&u.event===s&&u.schema===o&&u.table===l&&u.filter===c)a.push(Object.assign(Object.assign({},n),{id:u.id}));else{this.unsubscribe(),this.state=p.errored,null==e||e(_.CHANNEL_ERROR,Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,e&&e(_.SUBSCRIBED);return}}).receive("error",t=>{this.state=p.errored,null==e||e(_.CHANNEL_ERROR,Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",()=>{null==e||e(_.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){return this.state===p.joined&&e===S.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,t,r)}async send(e,t={}){var r,i;if(this._canPush()||"broadcast"!==e.type)return new Promise(r=>{var i,n,a;let s=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null==(a=null==(n=null==(i=this.params)?void 0:i.config)?void 0:n.broadcast)?void 0:a.ack)||r("ok"),s.receive("ok",()=>r("ok")),s.receive("error",()=>r("error")),s.receive("timeout",()=>r("timed out"))});{let{event:n,payload:a}=e,s={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:n,payload:a,private:this.private}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,s,null!=(r=t.timeout)?r:this.timeout);return await (null==(i=e.body)?void 0:i.cancel()),e.ok?"ok":"error"}catch(e){if("AbortError"===e.name)return"timed out";return"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=p.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(g.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(i=>{(r=new e3(this,g.leave,{},e)).receive("ok",()=>{t(),i("ok")}).receive("timeout",()=>{t(),i("timed out")}).receive("error",()=>{i("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{null==r||r.destroy()})}
4teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=p.closed,this.bindings={}}async _fetchWithTimeout(e,t,r){let i=new AbortController,n=setTimeout(()=>i.abort(),r),a=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(n),a}_push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new e3(this,e,t,r);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>100){let e=this.pushBuffer.shift();e&&(e.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${e.event}`,e.payload))}}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var i,n;let a=e.toLocaleLowerCase(),{close:s,error:o,leave:l,join:c}=g;if(r&&[s,o,l,c].indexOf(a)>=0&&r!==this._joinRef())return;let u=this._onMessage(a,t,r);if(t&&!u)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?null==(i=this.bindings.postgres_changes)||i.filter(e=>{var t,r,i;return(null==(t=e.filter)?void 0:t.event)==="*"||(null==(i=null==(r=e.filter)?void 0:r.event)?void 0:i.toLocaleLowerCase())===a}).map(e=>e.callback(u,r)):null==(n=this.bindings[a])||n.filter(e=>{var r,i,n,s,o,l;if(!["broadcast","presence","postgres_changes"].includes(a))return e.type.toLocaleLowerCase()===a;if("id"in e){let a=e.id,s=null==(r=e.filter)?void 0:r.event;return a&&(null==(i=t.ids)?void 0:i.includes(a))&&("*"===s||(null==s?void 0:s.toLocaleLowerCase())===(null==(n=t.data)?void 0:n.type.toLocaleLowerCase()))}{let r=null==(o=null==(s=null==e?void 0:e.filter)?void 0:s.event)?void 0:o.toLocaleLowerCase();return"*"===r||r===(null==(l=null==t?void 0:t.event)?void 0:l.toLocaleLowerCase())}}).map(e=>{if("object"==typeof u&&"ids"in u){let e=u.data,{schema:t,table:r,commit_timestamp:i,type:n,errors:a}=e;u=Object.assign(Object.assign({},{schema:t,table:r,commit_timestamp:i,eventType:n,new:{},old:{},errors:a}),this._getPayloadRecords(e))}e.callback(u,r)})}_isClosed(){return this.state===p.closed}_isJoined(){return this.state===p.joined}_isJoining(){return this.state===p.joining}_isLeaving(){return this.state===p.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){let i=e.toLocaleLowerCase(),n={type:i,filter:t,callback:r};return this.bindings[i]?this.bindings[i].push(n):this.bindings[i]=[n],this}_off(e,t){let r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(e=>{var i;return!((null==(i=e.type)?void 0:i.toLocaleLowerCase())===r&&e7.isEqual(e.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(g.close,{},e)}_onError(e){this._on(g.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=p.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=eY(e.columns,e.record)),("UPDATE"===e.type||"DELETE"===e.type)&&(t.old=eY(e.columns,e.old_record)),t}}let e9=()=>{},te=[1e3,2e3,5e3,1e4],tt=` 5 addEventListener("message", (e) => { 6 if (e.data.event === "start") { 7 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 8 } 9 });`;class tr{constructor(t,r){var i;if(this.accessTokenValue=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=1e4,this.transport=null,this.heartbeatIntervalMs=25e3,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=e9,this.ref=0,this.reconnectTimer=null,this.logger=e9,this.conn=null,this.sendBuffer=[],this.serializer
9=new eH,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=t=>{let r;return r=t||("u"<typeof fetch?(...t)=>e.A(611737).then(({default:e})=>e(...t)).catch(e=>{throw Error(`Failed to load @supabase/node-fetch: ${e.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):fetch),(...e)=>r(...e)},!(null==(i=null==r?void 0:r.params)?void 0:i.apikey))throw Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${t}/${v.websocket}`,this.httpEndpoint=e5(t),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(null==r?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||null!==this.conn&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=eJ.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");let e=t.message;if(e.includes("Node.js"))throw Error(`${e} 10 11To use Realtime in Node.js, you need to provide a WebSocket implementation: 12 13Option 1: Use Node.js 22+ which has native WebSocket support 14Option 2: Install and provide the "ws" package: 15 16 npm install ws 17 18 import ws from "ws" 19 const client = new RealtimeClient(url, { 20 ...options, 21 transport: ws 22 })`);throw Error(`WebSocket not available: ${e}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){let r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},e?this.conn.close(e,null!=t?t:""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){let t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){let e=await Promise.all(this.channels.map(e=>e.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case f.connecting:return y.Connecting;case f.open:return y.Open;case f.closing:return y.Closing;default:return y.Closed}}isConnected(){return this.connectionState()===y.Open}isConnecting(){return"connecting"===this._connectionState}isDisconnecting(){return"disconnecting"===this._connectionState}channel(e,t={config:{}}){let r=`realtime:${e}`,i=this.getChannels().find(e=>e.topic===r);if(i)return i;{let r=new e7(`realtime:${e}`,t,this);return this.channels.push(r),r}}push(e){let{topic:t,event:r,payload:i,ref:n}=e,a=()=>{this.encode(e,e=>{var t;null==(t=this.conn)||t.send(e)})};this.log("push",`${t} ${r} (${n})`,i),this.isConnected()?a():this.sendBuffer.push(a)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this._wasManualDisconnect=!1,null==(e=this.conn)||e.close(1e3,"heartbeat timeout"),setTimeout(()=>{var e;this.isConnected()||null==(e=this.reconnectTimer)||e.scheduleTimeout()},100);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>
220&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t._isJoined()||t._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,e=>{if("phoenix"===e.topic&&"phx_reply"===e.event)try{this.heartbeatCallback("ok"===e.payload.status?"ok":"error")}catch(e){this.log("error","error in heartbeat callback",e)}e.ref&&e.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);let{topic:t,event:r,payload:i,ref:n}=e,a=n?`(${n})`:"",s=i.status||"";this.log("receive",`${s} ${t} ${r} ${a}`.trim(),i),this.channels.filter(e=>e._isMember(t)).forEach(e=>e._trigger(r,i,n)),this._triggerStateCallbacks("message",e)})}_clearTimer(e){var t;"heartbeat"===e&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):"reconnect"===e&&(null==(t=this.reconnectTimer)||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");let e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log("worker","worker error",e.message),this.workerRef.terminate()},this.workerRef.onmessage=e=>{"keepAlive"===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||null==(t=this.reconnectTimer)||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(g.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?",i=new URLSearchParams(t);return`${e}${r}${i}`}_workerObjectUrl(e){let t;if(e)t=e;else{let e=new Blob([tt],{type:"application/javascript"});t=URL.createObjectURL(e)}return t}_setConnectionState(e,t=!1){this._connectionState=e,"connecting"===e?this._wasManualDisconnect=!1:"disconnecting"===e&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t;t=e||(this.accessToken?await this.accessToken():this.accessTokenValue),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{t&&e.updateJoinPayload({access_token:t,version:"realtime-js/2.74.0"}),e.joinedOnce&&e._isJoined()&&e._push(g.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(t=>{this.log("error",`error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}_setupReconnectionTimer(){this.reconnectTimer=new eG(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},10)},this.reconnectAfterMs)}_initializeOptions(e){var t,r,i,n,a,s,o,l,c;if(this.transport=null!=(t=null==e?void 0:e.transport)?t:null,this.timeout=null!=(r=null==e?void 0:e.timeout)?r:1e4,this.heartbeatIntervalMs=null!=(i=null==e?void 0:e.heartbeatIntervalMs)?i:25e3,this.worker=null!=(n=null==e?void 0:e.worker)&&n,this.accessToken=null!=(a=null==e?void 0:e.accessToken)?a:null,this.heartbeatCallback=null!=(s=null==e?void 0:e.heartbeatCallback)?s:e9,(null==e?void 0:e.params)&&(this.params=e.params),(null==e?void 0:e.logger)&&(this.logger=e.logger),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=null!=(o=null==e?void 0:e.reconnectAfterMs)?o:e=>te[e-1]||1e4,this.encode=null!=(l=null==e?void 0:e.encode)?l:(e,t)=>
22t(JSON.stringify(e)),this.decode=null!=(c=null==e?void 0:e.decode)?c:this.serializer.decode.bind(this.serializer),this.worker){if("u">typeof window&&!window.Worker)throw Error("Web Worker is not supported");this.workerUrl=null==e?void 0:e.workerUrl}}}var ti=e.i(467034);class tn extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function ta(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}class ts extends tn{constructor(e,t,r){super(e),this.name="StorageApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class to extends tn{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}let tl=t=>{let r;return r=t||("u"<typeof fetch?(...t)=>e.A(611737).then(({default:e})=>e(...t)):fetch),(...e)=>r(...e)},tc=e=>{if(Array.isArray(e))return e.map(e=>tc(e));if("function"==typeof e||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([e,r])=>{t[e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""))]=tc(r)}),t};var tu=function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}l((i=i.apply(e,t||[])).next())})};let th=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e);function td(t,r,i,n,a,s){return tu(this,void 0,void 0,function*(){return new Promise((o,l)=>{let c;t(i,(c={method:r,headers:(null==n?void 0:n.headers)||{}},"GET"===r||!s?c:((e=>{if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)})(s)?(c.headers=Object.assign({"Content-Type":"application/json"},null==n?void 0:n.headers),c.body=JSON.stringify(s)):c.body=s,(null==n?void 0:n.duplex)&&(c.duplex=n.duplex),Object.assign(Object.assign({},c),a)))).then(e=>{if(!e.ok)throw e;return(null==n?void 0:n.noResolveJson)?e:e.json()}).then(e=>o(e)).catch(t=>tu(void 0,void 0,void 0,function*(){var r,i,a,s;let o=yield(r=void 0,i=void 0,a=void 0,s=function*(){return"u"<typeof Response?(yield e.A(611737)).Response:Response},new(a||(a=Promise))(function(e,t){function n(e){try{l(s.next(e))}catch(e){t(e)}}function o(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof a?r:new a(function(e){e(r)})).then(n,o)}l((s=s.apply(r,i||[])).next())}));t instanceof o&&!(null==n?void 0:n.noResolveJson)?t.json().then(e=>{let r=t.status||500,i=(null==e?void 0:e.statusCode)||r+"";l(new ts(th(e),r,i))}).catch(e=>{l(new to(th(e),e))}):l(new to(th(t),t))}))})})}function tf(e,t,r,i){return tu(this,void 0,void 0,function*(){return td(e,"GET",t,r,i)})}function tp(e,t,r,i,n){return tu(this,void 0,void 0,function*(){return td(e,"POST",t,i,n,r)})}function tg(e,t,r,i,n){return tu(this,void 0,void 0,function*(){return td(e,"PUT",t,i,n,r)})}function tv(e,t,r,i,n){return tu(this,void 0,void 0,function*(){return td(e,"DELETE",t,i,n,r)})}class ty{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}execute(){var e,t,r,i;return e=this,t=void 0,r=void 0,i=function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}},new(r||(r=Promise))(function(n,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}l((i=i.apply(e,t||[])).next())})}}class tb{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}asStream(){return new ty(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.execute().then(e,t)}execute(){var e,t,r,i;return e=this,t=void 0,r=void 0,i=function*(){try{let e=yield this.downloadFn();return{data:yield e.blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}},new(r||(r=Promise))(function(n,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}l((i=i.apply(e,t||[])).next())})}}var tw=function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}l((i=i.apply(e,t||[])).next())})};let tm={limit:100,offset:0,sortBy:{column:"name",order:"asc"}}
22,tS={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class t_{constructor(e,t={},r,i){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=r,this.fetch=tl(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,t,r,i){return tw(this,void 0,void 0,function*(){try{let n,a=Object.assign(Object.assign({},tS),i),s=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(a.upsert)}),o=a.metadata;"u">typeof Blob&&r instanceof Blob?((n=new FormData).append("cacheControl",a.cacheControl),o&&n.append("metadata",this.encodeMetadata(o)),n.append("",r)):"u">typeof FormData&&r instanceof FormData?((n=r).append("cacheControl",a.cacheControl),o&&n.append("metadata",this.encodeMetadata(o))):(n=r,s["cache-control"]=`max-age=${a.cacheControl}`,s["content-type"]=a.contentType,o&&(s["x-metadata"]=this.toBase64(this.encodeMetadata(o)))),(null==i?void 0:i.headers)&&(s=Object.assign(Object.assign({},s),i.headers));let l=this._removeEmptyFolders(t),c=this._getFinalPath(l),u=yield("PUT"==e?tg:tp)(this.fetch,`${this.url}/object/${c}`,n,Object.assign({headers:s},(null==a?void 0:a.duplex)?{duplex:a.duplex}:{}));return{data:{path:l,id:u.Id,fullPath:u.Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}upload(e,t,r){return tw(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}uploadToSignedUrl(e,t,r,i){return tw(this,void 0,void 0,function*(){let n=this._removeEmptyFolders(e),a=this._getFinalPath(n),s=new URL(this.url+`/object/upload/sign/${a}`);s.searchParams.set("token",t);try{let e,t=Object.assign({upsert:tS.upsert},i),a=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});"u">typeof Blob&&r instanceof Blob?((e=new FormData).append("cacheControl",t.cacheControl),e.append("",r)):"u">typeof FormData&&r instanceof FormData?(e=r).append("cacheControl",t.cacheControl):(e=r,a["cache-control"]=`max-age=${t.cacheControl}`,a["content-type"]=t.contentType);let o=yield tg(this.fetch,s.toString(),e,{headers:a});return{data:{path:n,fullPath:o.Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}createSignedUploadUrl(e,t){return tw(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e),i=Object.assign({},this.headers);(null==t?void 0:t.upsert)&&(i["x-upsert"]="true");let n=yield tp(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:i}),a=new URL(this.url+n.url),s=a.searchParams.get("token");if(!s)throw new tn("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:s},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}update(e,t,r){return tw(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t,r){return tw(this,void 0,void 0,function*(){try{return{data:yield tp(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,de
22stinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}copy(e,t,r){return tw(this,void 0,void 0,function*(){try{return{data:{path:(yield tp(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}createSignedUrl(e,t,r){return tw(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),n=yield tp(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers}),a=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:n={signedUrl:encodeURI(`${this.url}${n.signedURL}${a}`)},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}createSignedUrls(e,t,r){return tw(this,void 0,void 0,function*(){try{let i=yield tp(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),n=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:i.map(e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${n}`):null})),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}download(e,t){let r=void 0!==(null==t?void 0:t.transform)?"render/image/authenticated":"object",i=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),n=i?`?${i}`:"",a=this._getFinalPath(e);return new tb(()=>tf(this.fetch,`${this.url}/${r}/${a}${n}`,{headers:this.headers,noResolveJson:!0}),this.shouldThrowOnError)}info(e){return tw(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{let e=yield tf(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:tc(e),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}exists(e){return tw(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{return yield function(e,t,r,i){return tu(this,void 0,void 0,function*(){return td(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),void 0)})}(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e)&&e instanceof to){let t=e.originalError;if([400,404].includes(null==t?void 0:t.status))return{data:!1,error:e}}throw e}})}getPublicUrl(e,t){let r=this._getFinalPath(e),i=[],n=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==n&&i.push(n);let a=void 0!==(null==t?void 0:t.transform),s=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==s&&i.push(s);let o=i.join("&");return""!==o&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${a?"render/image":"object"}/public/${r}${o}`)}}}remove(e){return tw(this,void 0,void 0,function*(){try{return{data:yield tv(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}list(e,t,r){return tw(this,void 0,void 0,function*(){try{let i=Object.assign(Object.assign(Object.assign({},tm),t),{prefix:e||""});return{data:yield tp(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},r),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}listV2(e,t){return tw(this,void 0,void 0,function*(){try{let r=Object.assign({},e);return{data:yield tp(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},t),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return void 0!==ti.Buffer?ti.Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}let tk={"X-Client-Info":"storage-js/2.74.0"};var tR=function(e,t,r,i){return new(r||(r=Promise))(function(n,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}l((i=i.apply(e,t||[])).next())})};class tE{constructor(e,t={},r,i){this.shouldThrowOnError=!1;const n=new URL(e);(null==i?void 0:i.useNewHostname)&&/supabase\.(co|in|red)$/.test(n.hostname)&&!n.hostname.includes("storage.supabase.")&&(n.hostname=n.hostname.replace("supabase.","storage.supabase.")),this.url=n.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},tk),t),this.fetch=tl(r)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(){return tR(this,void 0,void 0,function*(){try{return{data:yield tf(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}getBucket(e){return tR(this,void 0,void 0,function*(){try{return{data:yield tf(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}createBucket(e){return tR(this,arguments,void 0,function*(e,t={public:!1}){try{return{data:yield tp(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}updateBucket(e,t){return tR(this,void 0,void 0,function*(){try{return{data:yield tg(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}emptyBucket(e){return tR(this,void 0,void 0,function*(){try{return{data:yield tp(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}deleteBucket(e){return tR(this,void 0,void 0,function*(){try{return{data:yield tv(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ta(e))return{data:null,error:e};throw e}})}}class tO extends tE{constructor(e,t={}
22,r,i){super(e,t,r,i)}from(e){return new t_(this.url,this.headers,e,this.fetch)}}let tT="";tT="u">typeof Deno?"deno":"u">typeof document?"web":"u">typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";let tA={headers:{"X-Client-Info":`supabase-js-${tT}/2.74.0`}},tU={schema:"public"},tI={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},tj={};var tP=e.i(906085);let tC="2.74.0",tL={"X-Client-Info":`gotrue-js/${tC}`},t$="X-Supabase-Api-Version",tx={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},tB=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;class tM extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function tz(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class tN extends tM{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}class tq extends tM{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}
22class tD extends tM{constructor(e,t,r,i){super(e,r,i),this.name=t,this.status=r}}class tF extends tD{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class tW extends tD{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class tV extends tD{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class tK extends tD{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class tJ extends tD{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class tH extends tD{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function tG(e){return tz(e)&&"AuthRetryableFetchError"===e.name}class tY extends tD{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}class tQ extends tD{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}let tX="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),tZ=" \n\r=".split(""),t0=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<tZ.length;t+=1)e[tZ[t].charCodeAt(0)]=-2;for(let t=0;t<tX.length;t+=1)e[tX[t].charCodeAt(0)]=t;return e})();function t1(e,t,r){if(null!==e)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;)r(tX[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6;else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;)r(tX[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6}function t2(e,t,r){let i=t0[e];if(i>-1)for(t.queue=t.queue<<6|i,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else if(-2===i)return;else throw Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}function t6(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},i={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},a=e=>{!function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}}(e,i,r)};for(let t=0;t<e.length;t+=1)t2(e.charCodeAt(t),n,a);return t.join("")}function t8(e){let t=[],r={queue:0,queuedBits:0},i=e=>{t.push(e)};for(let t=0;t<e.length;t+=1)t2(e.charCodeAt(t),r,i);return new Uint8Array(t)}function t5(e){let t=[],r={queue:0,queuedBits:0},i=e=>{t.push(e)};return e.forEach(e=>t1(e,r,i)),t1(null,r,i),t.join("")}let t3=()=>"u">typeof window&&"u">typeof document,t4={tested:!1,writable:!1},t7=()=>{if(!t3())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(t4.tested)return t4.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),t4.tested=!0,t4.writable=!0}catch(e){t4.tested=!0,t4.writable=!1}return t4.writable},t9=t=>{let r;return r=t||("u"<typeof fetch?(...t)=>e.A(611737).then(({default:e})=>e(...t)):fetch),(...e)=>r(...e)},re=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},rt=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return r}},rr=async(e,t)=>{await e.removeItem(t)};class ri{constructor(){this.promise=new ri.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function rn(e){let t=e.split(".");if(3!==t.length)throw new tQ("Invalid JWT structure");for(let e=0;e<t.length;e++)if(!tB.test(t[e]))throw new tQ("JWT not in base64url format");return{header:JSON.parse(t6(t[0])),payload:JSON.parse(t6(t[1])),signature:t8(t[2]),raw:{header:t[0],payload:t[1]}}}async function ra(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function rs(e){return("0"+e.toString(16)).substr(-2)}async function ro(e){let t=new TextEncoder().encode(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>String.fromCharCode(e)).join("")}async function rl(e){return"u">typeof crypto&&void 0!==crypto.subtle&&"u">typeof TextEncoder?btoa(await ro(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):(console.warn("WebCrypto API is not supported. Code
22challenge method will default to use plain instead of sha256."),e)}async function rc(e,t,r=!1){let i=function(){let e=new Uint32Array(56);if("u"<typeof crypto){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length,r="";for(let i=0;i<56;i++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,rs).join("")}(),n=i;r&&(n+="/PASSWORD_RECOVERY"),await re(e,`${t}-code-verifier`,n);let a=await rl(i),s=i===a?"plain":"s256";return[a,s]}ri.promiseConstructor=Promise;let ru=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i,rh=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function rd(e){if(!rh.test(e))throw Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function rf(){return new Proxy({},{get:(e,t)=>{if("__isUserNotAvailableProxy"===t)return!0;if("symbol"==typeof t){let e=t.toString();if("Symbol(Symbol.toPrimitive)"===e||"Symbol(Symbol.toStringTag)"===e||"Symbol(util.inspect.custom)"===e)return}throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function rp(e){return JSON.parse(JSON.stringify(e))}var rg=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};let rv=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),ry=[502,503,504];async function rb(e){var t;let r,i;if(!("object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json))throw new tH(rv(e),0);if(ry.includes(e.status))throw new tH(rv(e),e.status);try{r=await e.json()}catch(e){throw new tq(rv(e),e)}let n=function(e){let t=e.headers.get(t$);if(!t||!t.match(ru))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch(e){return null}}(e);if(n&&n.getTime()>=tx["2024-01-01"].timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?i=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(i=r.error_code),i){if("weak_password"===i)throw new tY(rv(r),e.status,(null==(t=r.weak_password)?void 0:t.reasons)||[]);else if("session_not_found"===i)throw new tF}else if("object"==typeof r&&r&&"object"==typeof r.weak_password&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((e,t)=>e&&"string"==typeof t,!0))throw new tY(rv(r),e.status,r.weak_password.reasons);throw new tN(rv(r),e.status||500,i)}async function rw(e,t,r,i){var n;let a=Object.assign({},null==i?void 0:i.headers);a[t$]||(a[t$]=tx["2024-01-01"].name),(null==i?void 0:i.jwt)&&(a.Authorization=`Bearer ${i.jwt}`);let s=null!=(n=null==i?void 0:i.query)?n:{};(null==i?void 0:i.redirectTo)&&(s.redirect_to=i.redirectTo);let o=Object.keys(s).length?"?"+new URLSearchParams(s).toString():"",l=await rm(e,t,r+o,{headers:a,noResolveJson:null==i?void 0:i.noResolveJson},{},null==i?void 0:i.body);return(null==i?void 0:i.xform)?null==i?void 0:i.xform(l):{data:Object.assign({},l),error:null}}async function rm(e,t,r,i,n,a){let s,o,l=(o={method:t,headers:(null==i?void 0:i.headers)||{}},"GET"===t?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==i?void 0:i.headers),o.body=JSON.stringify(a),Object.assign(Object.assign({},o),n)));try{s=await e(r,Object.assign({},l))}catch(e){throw console.error(e),new tH(rv(e),0)}if(s.ok||await rb(s),null==i?void 0:i.noResolveJson)return s;try{return await s.json()}catch(e){await rb(e)}}function rS(e){var t,r,i;let n=null;(i=e).access_token&&i.refresh_token&&i.expires_in&&(n=Object.assign({},e),e.expires_at||(n.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:n,user:null!=(t=e.user)?t:e},error:null}}function r_(e){let t=rS(e);return!t.error&&e.weak_password&&"object"==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,t)=>
22e&&"string"==typeof t,!0)&&(t.data.weak_password=e.weak_password),t}function rk(e){var t;return{data:{user:null!=(t=e.user)?t:e},error:null}}function rR(e){return{data:e,error:null}}function rE(e){let{action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:a}=e;return{data:{properties:{action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:a},user:Object.assign({},rg(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function rO(e){return e}let rT=["global","local","others"];var rA=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};class rU{constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=t9(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,t=rT[0]){if(0>rT.indexOf(t))throw Error(`@supabase/auth-js: Parameter scope must be one of ${rT.join(", ")}`);try{return await rw(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(tz(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await rw(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:rk})}catch(e){if(tz(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=rA(e,["options"]),i=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(i.new_email=null==r?void 0:r.newEmail,delete i.newEmail),await rw(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:rE,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(tz(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await rw(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:rk})}catch(e){if(tz(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,i,n,a,s,o;try{let l={nextPage:null,lastPage:0,total:0},c=await rw(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(n=null==(i=null==e?void 0:e.perPage)?void 0:i.toString())?n:""},xform:rO});if(c.error)throw c.error;let u=await c.json(),h=null!=(a=c.headers.get("x-total-count"))?a:0,d=null!=(o=null==(s=c.headers.get("link"))?void 0:s.split(","))?o:[];return d.length>0&&(d.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(h)),{data:Object.assign(Object.assign({},u),l),error:null}}catch(e){if(tz(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){rd(e);try{return await rw(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:rk})}catch(e){if(tz(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){rd(e);try{return await rw(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:rk})}catch(e){if(tz(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){rd(e);try{return await rw(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:rk})}catch(e){if(tz(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){rd(e.userId);try{let{data:t,error:r}=await rw(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:r}}catch(e){if(tz(e))return{data:null,error:e};throw e}}async _deleteFactor(e){rd(e.userId),rd(e.id);
22try{return{data:await rw(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(tz(e))return{data:null,error:e};throw e}}async _listOAuthClients(e){var t,r,i,n,a,s,o;try{let l={nextPage:null,lastPage:0,total:0},c=await rw(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(n=null==(i=null==e?void 0:e.perPage)?void 0:i.toString())?n:""},xform:rO});if(c.error)throw c.error;let u=await c.json(),h=null!=(a=c.headers.get("x-total-count"))?a:0,d=null!=(o=null==(s=c.headers.get("link"))?void 0:s.split(","))?o:[];return d.length>0&&(d.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(h)),{data:Object.assign(Object.assign({},u),l),error:null}}catch(e){if(tz(e))return{data:{clients:[]},error:e};throw e}}async _createOAuthClient(e){try{return await rw(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tz(e))return{data:null,error:e};throw e}}async _getOAuthClient(e){try{return await rw(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tz(e))return{data:null,error:e};throw e}}async _deleteOAuthClient(e){try{return await rw(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tz(e))return{data:null,error:e};throw e}}async _regenerateOAuthClientSecret(e){try{return await rw(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(tz(e))return{data:null,error:e};throw e}}}function rI(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}let rj={debug:!!(globalThis&&t7()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"))};class rP extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class rC extends rP{}async function rL(e,t,r){rj.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let i=new globalThis.AbortController;return t>0&&setTimeout(()=>{i.abort(),rj.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async i=>{if(i){rj.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await r()}finally{rj.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}if(0===t)throw rj.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new rC(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(rj.debug)try{let e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null," "))}catch(e){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",e)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}))}function r$(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}class rx extends Error{constructor({message:e,code:t,cause:r,name:i}){var n;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=null!=(n=null!=i?i:r instanceof Error?r.name:void 0)?n:"Unknown Error",this.code=t}}class rB extends rx{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}var rM=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};let rz=new class{createNewAbortSignal(){if(this.controller){let e=Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};function rN(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function rq(){var e,t;return!!(t3()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&"function"==typeof(null==(e=null==navigator?void 0:navigator.credentials)?void 0:e.create)&&"function"==typeof(null==(t=null==navigator?void 0:navigator.credentials)?void 0:t.get))}async function rD(e){try{let t=await navigator.credentials.create(e);if(!t)return{data:null,error:new rB("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new rB("Browser returned unexpected credential type",t)};return{data:t,error:null}}catch(t){return{data:null,error:function({error:e,options:t}){var r,i,n;let{publicKey:a}=t;if(!a)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new rx({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if((null==(r=a.authenticatorSelection)?void 0:r.requireResidentKey)===!0)return new rx({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});else if("conditional"===t.mediation&&(null==(i=a.authenticatorSelection)?void 0:i.userVerification)==="required")return new rx({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});else if((null==(n=a.authenticatorSelection)?void 0:n.userVerification)==="required")return new rx({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else if("InvalidStateError"===e.name)return new rx({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});else if("NotAllowedError"===e.name)return new rx({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("NotSupportedError"===e.name)return new rx(0===a.pubKeyCredParams.filter(e=>"public-key"===e.type).length?{message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}:{message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});else if("SecurityError"===e.name){let t=window.location.hostname;if(!rN(t))return new rx({message:`${window.location.hostname}
22 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(a.rp.id!==t)return new rx({message:`The RP ID "${a.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(a.user.id.byteLength<1||a.user.id.byteLength>64)return new rx({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new rx({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return new rx({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}({error:t,options:e})}}}async function rF(e){try{let t=await navigator.credentials.get(e);if(!t)return{data:null,error:new rB("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new rB("Browser returned unexpected credential type",t)};return{data:t,error:null}}catch(t){return{data:null,error:function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new rx({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("NotAllowedError"===e.name)return new rx({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("SecurityError"===e.name){let t=window.location.hostname;if(!rN(t))return new rx({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new rx({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new rx({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return new rx({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}({error:t,options:e})}}}let rW={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"},rV={userVerification:"preferred",hints:["security-key"]};function rK(...e){let t=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),i={};for(let n of e)if(n)for(let e in n){let a=n[e];if(void 0!==a)if(Array.isArray(a))i[e]=a;else if(r(a))i[e]=a;else if(t(a)){let r=i[e];t(r)?i[e]=rK(r,a):i[e]=rK(a)}else i[e]=a}return i}class rJ{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:r,signal:i},n){try{var a,s,o,l;let{data:c,error:u}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!c)return{data:null,error:u};let h=null!=i?i:rz.createNewAbortSignal();if("create"===c.webauthn.type){let{user:e}=c.webauthn.credential_options.publicKey;e.name||(e.name=`${e.id}:${r}`),e.displayName||(e.displayName=e.name)}switch(c.webauthn.type){case"create":{let t=(a=c.webauthn.credential_options.publicKey,s=null==n?void 0:n.create,rK(rW,a,s||{})),{data:r,error:i}=await rD({publicKey:t,signal:h});if(r)return{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:r}},error:null};return{data:null,error:i}}case"request":{let t=(o=c.webauthn.credential_options.publicKey,l=null==n?void 0:n.request,rK(rV,o,l||{})),{data:r,error:i}=await rF(Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:t,signal:h}));if(r)return{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:r}},error:null};return{data:null,error:i}}}}catch(e){if(tz(e))return{data:null,error:e};return{data:null,error:new tq("Unexpected error in challenge",e)}}}async _verify({challengeId:e,factorId:t,webauthn:r}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:t="u">typeof window?window.location.hostname:void 0,rpOrigins:r="u">typeof window?[window.location.origin]:void 0,signal:i}},n){if(!t)return{data:null,error:new tM("rpId is required for WebAuthn authentication")};try{if(!rq())return{data:null,error:new tq("Browser does not support WebAuthn",null)};let{data:a,error:s}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:r},signal:i},{request:n});if(!a)return{data:null,error:s};let{webauthn:o}=a;return this._verify({factorId:e,challengeId:a.challengeId,webauthn:{type:o.type,rpId:t,rpOrigins:r,credential_response:o.credential_response}})}catch(e){if(tz(e))return{data:null,error:e};return{data:null,error:new tq("Unexpected error in authenticate",e)}}}async _register({friendlyName:e,rpId:t="u">typeof window?window.location.hostname:void 0,rpOrigins:r="u">typeof window?[window.location.origin]:void 0,signal:i},n){if(!t)return{data:null,error:new tM("rpId is required for WebAuthn registration")};try{if(!rq())return{data:null,error:new tq("Browser does not support WebAuthn",null)};let{data:a,error:s}=await this._enroll({friendlyName:e});if(!a)return await this.client.mfa.listFactors().then(t=>{var r;return null==(r=t.data)?void 0:r.all.find(t=>"webauthn"===t.factor_type&&t.friendly_name===e&&"unverified"!==t.status)}).then(e=>e?this.client.mfa.unenroll({factorId:null==e?void 0:e.id}):void 0),{data:null,error:s};let{data:o,error:l}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:t,rpOrigins:r},signal:i},{create:n});if(!o)return{data:null,error:l};return this._verify({factorId:a.id,challengeId:o.challengeId,webauthn:{rpId:t,rpOrigins:r,type:o.webauthn.type,credential_response:o.webauthn.credential_response}})}catch(e){if(tz(e))return{data:null,error:e};return{data:null,error:new tq("Unexpected error in register",e)}}}}if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"u">typeof self&&(self.globalThis=self)}let rH={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:tL,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function rG(e,t,r){return await r()}let rY={};class rQ{get jwks(){var e,t;return null!=(t=null==(e=rY[this.storageKey])?void 0:e.jwks)?t:{keys:[]}}set jwks(e){rY[this.storageKey]=Object.assign(Object.assign({},rY[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!=(t=null==(e=rY[this.storageKey])?void 0:e.cachedAt)?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){rY[this.storageKey]=Object.assign(Object.assign({},rY[this.storageKey]),{cachedAt:e})}constructor(e){var t,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=rQ.nextInstanceID,rQ.nextInstanceID+=1,this.instanceID>0&&t3()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const i=Object.assign(Object.assign({},rH),e);if(this.logDebugMessages=!!i.debug,"function"==typeof i.debug&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new rU({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=t9(i.fetch),this.lock=i.lock||rG,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,i.lock?this.lock=i.lock:t3()&&(null==(t=null==globalThis?void 0:globalThis.navigator)?void 0:t.locks)?this.lock=rL:this.lock=rG,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new rJ(this)},this.persistSession?(i.storage?this.storage=i.storage:t7()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=rI(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=rI(this.memoryStorage)),t3()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null==(r=this.broadcastChannel)||r.addEventListener("message",async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${tC}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))()),await this.initializePromise}async _initialize(){var e;try{let t=function(e){let t={},r=new URL(e);if(r.hash&&"#"===r.hash[0])try{new URLSearchParams(r.hash.substring(1)).forEac
22h((e,r)=>{t[r]=e})}catch(e){}return r.searchParams.forEach((e,r)=>{t[r]=e}),t}(window.location.href),r="none";if(this._isImplicitGrantCallback(t)?r="implicit":await this._isPKCECallback(t)&&(r="pkce"),t3()&&this.detectSessionInUrl&&"none"!==r){let{data:i,error:n}=await this._getSessionFromURL(t,r);if(n){if(this._debug("#_initialize()","error detecting session from URL",n),tz(n)&&"AuthImplicitGrantRedirectError"===n.name){let t=null==(e=n.details)?void 0:e.code;if("identity_already_exists"===t||"identity_not_found"===t||"single_identity_not_deletable"===t)return{error:n}}return await this._removeSession(),{error:n}}let{session:a,redirectType:s}=i;return this._debug("#_initialize()","detected session in URL",a,"redirect type",s),await this._saveSession(a),setTimeout(async()=>{"recovery"===s?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(tz(e))return{error:e};return{error:new tq("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,i;try{let{data:n,error:a}=await rw(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:null!=(r=null==(t=null==e?void 0:e.options)?void 0:t.data)?r:{},gotrue_meta_security:{captcha_token:null==(i=null==e?void 0:e.options)?void 0:i.captchaToken}},xform:rS});if(a||!n)return{data:{user:null,session:null},error:a};let s=n.session,o=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",s)),{data:{user:o,session:s},error:null}}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}}async signUp(e){var t,r,i;try{let n;if("email"in e){let{email:r,password:i,options:a}=e,s=null,o=null;"pkce"===this.flowType&&([s,o]=await rc(this.storage,this.storageKey)),n=await rw(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==a?void 0:a.emailRedirectTo,body:{email:r,password:i,data:null!=(t=null==a?void 0:a.data)?t:{},gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken},code_challenge:s,code_challenge_method:o},xform:rS})}else if("phone"in e){let{phone:t,password:a,options:s}=e;n=await rw(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:a,data:null!=(r=null==s?void 0:s.data)?r:{},channel:null!=(i=null==s?void 0:s.channel)?i:"sms",gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:rS})}else throw new tV("You must provide either an email or phone number and a password");let{data:a,error:s}=n;if(s||!a)return{data:{user:null,session:null},error:s};let o=a.session,l=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if("email"in e){let{email:r,password:i,options:n}=e;t=await rw(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:i,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:r_})}else if("phone"in e){let{phone:r,password:i,options:n}=e;t=await rw(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:i,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:r_})}else throw new tV("You must provide either an email or phone number and a password");let{data:r,error:i}=t;if(i)return{data:{user:null,session:null},error:i};if(!r||!r.session||!r.user)return{data:{user:null,session:null},error:new tW};return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:i}}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,r,i,n;return await this._handleProviderSignIn(e.provider,{redirectTo:null==(t=e.options)?void 0:t.redirectTo,scopes:null==(r=e.options)?void 0:r.scopes,queryParams:null==(i=e.options)?void 0:i.queryParams,skipBrowserRedirect:null==(n=e.options)?void 0:n.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,r,i,n,a,s,o,l,c,u,h,d;let f,p;if("message"in e)f=e.message,p=e.signature;else{let u,{chain:h,wallet:g,statement:v,options:y}=e;if(t3())if("object"==typeof g)u=g;else{let e=window;if("ethereum"in e&&"object"==typeof e.ethereum&&"request"in e.ethereum&&"function"==typeof e.ethereum.request)u=e.ethereum;else throw Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if("object"!=typeof g||!(null==y?void 0:y.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");u=g}let b=new URL(null!=(t=null==y?void 0:y.url)?t:window.location.href),w=await u.request({method:"eth_requestAccounts"}).then(e=>e).catch(()=>{throw Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!w||0===w.length)throw Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let m=r$(w[0]),S=null==(r=null==y?void 0:y.signInWithEthereum)?void 0:r.chainId;S||(S=parseInt(await u.request({method:"eth_chainId"}),16)),f=function(e){var t;let{chainId:r,domain:i,expirationTime:n,issuedAt:a=new Date,nonce:s,notBefore:o,requestId:l,resources:c,scheme:u,uri:h,version:d}=e;if(!Number.isInteger(r))throw Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!i)throw Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(s&&s.length<8)throw Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${s}`);if(!h)throw Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if("1"!==d)throw Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(null==(t=e.statement)?void 0:t.includes("\n"))throw Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`);let f=r$(e.address),p=u?`${u}://${i}`:i,g=e.statement?`${e.statement} 23`:"",v=`${p} wants you to sign in with your Ethereum account: 24${f} 25 26${g}`,y=`URI: ${h} 27Version: ${d}
28Chain ID: ${r}${s?` 29Nonce: ${s}`:""} 30Issued At: ${a.toISOString()}`;if(n&&(y+=` 31Expiration Time: ${n.toISOString()}`),o&&(y+=` 32Not Before: ${o.toISOString()}`),l&&(y+=` 33Request ID: ${l}`),c){let e="\nResources:";for(let t of c){if(!t||"string"!=typeof t)throw Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${t}`);e+=` 34- ${t}`}y+=e}return`${v} 35${y}`}({domain:b.host,address:m,statement:v,uri:b.href,version:"1",chainId:S,nonce:null==(i=null==y?void 0:y.signInWithEthereum)?void 0:i.nonce,issuedAt:null!=(a=null==(n=null==y?void 0:y.signInWithEthereum)?void 0:n.issuedAt)?a:new Date,expirationTime:null==(s=null==y?void 0:y.signInWithEthereum)?void 0:s.expirationTime,notBefore:null==(o=null==y?void 0:y.signInWithEthereum)?void 0:o.notBefore,requestId:null==(l=null==y?void 0:y.signInWithEthereum)?void 0:l.requestId,resources:null==(c=null==y?void 0:y.signInWithEthereum)?void 0:c.resources}),p=await u.request({method:"personal_sign",params:[(d=f,"0x"+Array.from(new TextEncoder().encode(d),e=>e.toString(16).padStart(2,"0")).join("")),m]})}try{let{data:t,error:r}=await rw(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},(null==(u=e.options)?void 0:u.captchaToken)?{gotrue_meta_security:{captcha_token:null==(h=e.options)?void 0:h.captchaToken}}:null),xform:rS});if(r)throw r;if(!t||!t.session||!t.user)return{data:{user:null,session:null},error:new tW};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign({},t),error:r}}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSolana(e){var t,r,i,n,a,s,o,l,c,u,h,d;let f,p;if("message"in e)f=e.message,p=e.signature;else{let h,{chain:d,wallet:g,statement:v,options:y}=e;if(t3())if("object"==typeof g)h=g;else{let e=window;if("solana"in e&&"object"==typeof e.solana&&("signIn"in e.solana&&"function"==typeof e.solana.signIn||"signMessage"in e.solana&&"function"==typeof e.solana.signMessage))h=e.solana;else throw Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if("object"!=typeof g||!(null==y?void 0:y.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");h=g}let b=new URL(null!=(t=null==y?void 0:y.url)?t:window.location.href);if("signIn"in h&&h.signIn){let e,t=await h.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==y?void 0:y.signInWithSolana),{version:"1",domain:b.host,uri:b.href}),v?{statement:v}:null));if(Array.isArray(t)&&t[0]&&"object"==typeof t[0])e=t[0];else if(t&&"object"==typeof t&&"signedMessage"in t&&"signature"in t)e=t;else throw Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in e&&"signature"in e&&("string"==typeof e.signedMessage||e.signedMessage instanceof Uint8Array)&&e.signature instanceof Uint8Array)f="string"==typeof e.signedMessage?e.signedMessage:new TextDecoder().decode(e.signedMessage),p=e.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in h)||"function"!=typeof h.signMessage||!("publicKey"in h)||"object"!=typeof h||!h.publicKey||!("toBase58"in h.publicKey)||"function"!=typeof h.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");f=[`${b.host} wants you to sign in with your Solana account:`,h.publicKey.toBase58(),...v?["",v,""]:[""],"Version: 1",`URI: ${b.href}`,`Issued At: ${null!=(i=null==(r=null==y?void 0:y.signInWithSolana)?void 0:r.issuedAt)?i:new Date().toISOString()}`,...(null==(n=null==y?void 0:y.signInWithSolana)?void 0:n.notBefore)?[`Not Before: ${y.signInWithSolana.notBefore}`]:[],...(null==(a=null==y?void 0:y.signInWithSolana)?void 0:a.expirationTime)?[`Expiration Time: ${y.signInWithSolana.expirationTime}`]:[],...(null==(s=null==y?void 0:y.signInWithSolana)?void 0:s.chainId)?[`Chain ID: ${y.signInWithSolana.chainId}`]:[],...(null==(o=null==y?void 0:y.signInWithSolana)?void 0:o.nonce)?[`Nonce: ${y.signInWithSolana.nonce}`]:[],...(null==(l=null==y?void 0:y.signInWithSolana)?void 0:l.requestId)?[`Request ID: ${y.signInWithSolana.requestId}`]:[],...(null==(u=null==(c=null==y?void 0:y.signInWithSolana)?void 0:c.resources)?void 0:u.length)?["Resources",...y.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");let e=await h.signMessage(new TextEncoder().encode(f),"utf8");if(!e||!(e instanceof Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=e}}try{let{data:t,error:r}=await rw(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:f,signature:t5(p)},(null==(h=e.options)?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null==(d=e.options)?void 0:d.captchaToken}}:null),xform:rS});if(r)throw r;if(!t||!t.session||!t.user)return{data:{user:null,session:null},error:new tW};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign({},t),error:r}}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}}async _exchangeCodeForSession(e){let t=await rt(this.storage,`${this.storageKey}-code-verifier`),[r,i]=(null!=t?t:"").split("/");try{let{data:t,error:n}=await rw(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:rS});if(await rr(this.storage,`${this.storageKey}-code-verifier`),n)throw n;if(!t||!t.session||!t.user)return{data:{user:null,session:null,redirectType:null},error:new tW};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign(Object.assign({},t),{redirectType:null!=i?i:null}),error:n}}catch(e){if(tz(e))return{data:{user:null,session:null,redirectType:null},error:e};throw e}}async signInWithIdToken(e){try{let{options:t,provider:r,token:i,access_token:n,nonce:a}=e,{data:s,error:o}=await rw(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:i,access_token:n,nonce:a,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:rS});if(o)return{data:{user:null,session:null},error:o};if(!s||!s.session||!s.user)return{data:{user:null,session:null},error:new tW};return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:s,error:o}}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,r,i,n,a;try{if("email"in e){let{email:i,options:n}=e,a=null,s=null;"pkce"===this.flowType&&([a,s]=await rc(this.storage,this.storageKey));let{error:o}=await rw(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:i,data:null!=(t=null==n?void 0:n.data)?t:{},create_user:null==(r=null==n?void 0:n.shouldCreateUser)||r,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:s},redirectTo:null==n?void 0:n.emailRedirectTo});return{data:{user:null,session:null},error:o}}if("phone"in e){let{phone:t,options:r}=e,{data:s,error:o}=await rw(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!=(i=null==r?void 0:r.data)?i:{},create_user:null==(n=null==r?void 0:r.shouldCreateUser)||n,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!=(a=null==r?void 0:r.channel)?a:"sms"}});return{data:{user:null,session:null,messageId:null==s?void 0:s.message_id},error:o}}throw new tV("You must provide either an email or phone number.")}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,r;try{let i,n;"options"in e&&(i=null==(t=e.options)?void 0:t.redirectTo,n=null==(r=e.options)?void 0:r.captchaToken);let{data:a,error:s}=await rw(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:n}}),redirectTo:i,xform:rS});if(s)throw s;if(!a)throw Error("An error occurred on token verification.");let o=a.session,l=a.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,r,i;try{let n=null,a=null;return"pkce"===this.flowType&&([n,a]=await rc(this.storage,this.storageKey)),await rw(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:null!=(r=null==(t=e.options)?void 0:t.redirectTo)?r:void 0}),(null==(i=null==e?void 0:e.options)?void 0:i.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:n,code_challenge_method:a}),headers:this.headers,xform:rR})}catch(e){if(tz(e))return{data:null,error:e};throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)throw r;if(!t)throw new tF;let{error:i}=await rw(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:i}})}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{let t=`${this.url}/resend`;if("email"in e){let{email:r,type:i,options:n}=e,{error:a}=await rw(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},redirectTo:null==n?void 0:n.emailRedirectTo});return{data:{user:null,session:null},error:a}}if("phone"in e){let{phone:r,type:i,options:n}=e,{data:a,error:s}=await rw(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}}});return{data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:s}}throw new tV("You must provide either an email or phone number and a type")}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){let e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",Error().stack);try{let e=null,t=await rt(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not val
35id"),await this._removeSession())),!e)return{data:{session:null},error:null};let r=!!e.expires_at&&1e3*e.expires_at-Date.now()<9e4;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){let t=await rt(this.userStorage,this.storageKey+"-user");(null==t?void 0:t.user)?e.user=t.user:e.user=rf()}if(this.storage.isServer&&e.user){let t=this.suppressGetSessionWarning;e=new Proxy(e,{get:(e,r,i)=>(t||"user"!==r||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t=!0,this.suppressGetSessionWarning=!0),Reflect.get(e,r,i))})}return{data:{session:e},error:null}}let{data:i,error:n}=await this._callRefreshToken(e.refresh_token);if(n)return{data:{session:null},error:n};return{data:{session:i},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{if(e)return await rw(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:rk});return await this._useSession(async e=>{var t,r,i;let{data:n,error:a}=e;if(a)throw a;return(null==(t=n.session)?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await rw(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!=(i=null==(r=n.session)?void 0:r.access_token)?i:void 0,xform:rk}):{data:{user:null},error:new tF}})}catch(e){if(tz(e))return tz(e)&&"AuthSessionMissingError"===e.name&&(await this._removeSession(),await rr(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:e};throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{let{data:i,error:n}=r;if(n)throw n;if(!i.session)throw new tF;let a=i.session,s=null,o=null;"pkce"===this.flowType&&null!=e.email&&([s,o]=await rc(this.storage,this.storageKey));let{data:l,error:c}=await rw(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:s,code_challenge_method:o}),jwt:a.access_token,xform:rk});if(c)throw c;return a.user=l.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),{data:{user:a.user},error:null}})}catch(e){if(tz(e))return{data:{user:null},error:e};throw e}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new tF;let t=Date.now()/1e3,r=t,i=!0,n=null,{payload:a}=rn(e.access_token);if(a.exp&&(i=(r=a.exp)<=t),i){let{data:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return{data:{user:null,session:null},error:r};if(!t)return{data:{user:null,session:null},error:null};n=t}else{let{data:i,error:a}=await this._getUser(e.access_token);if(a)throw a;n={access_token:e.access_token,refresh_token:e.refresh_token,user:i.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)}return{data:{user:n.user,session:n},error:null}}catch(e){if(tz(e))return{data:{session:null,user:null},error:e};throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){let{data:i,error:n}=t;if(n)throw n;e=null!=(r=i.session)?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new tF;let{data:i,error:n}=await this._callRefreshToken(e.refresh_token);return n?{data:{user:null,session:null},error:n}:i?{data:{user:i.user,session:i},error:null}:{data:{user:null,session:null},error:null}})}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e,t){try{if(!t3())throw new tK("No browser detected.");
35if(e.error||e.error_description||e.error_code)throw new tK(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if("pkce"===this.flowType)throw new tJ("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new tK("Not a valid implicit grant flow url.")}if("pkce"===t){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new tJ("No code detected.");let{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;let i=new URL(window.location.href);return i.searchParams.delete("code"),window.history.replaceState(window.history.state,"",i.toString()),{data:{session:t.session,redirectType:null},error:null}}let{provider_token:r,provider_refresh_token:i,access_token:n,refresh_token:a,expires_in:s,expires_at:o,token_type:l}=e;if(!n||!s||!a||!l)throw new tK("No session defined in URL");let c=Math.round(Date.now()/1e3),u=parseInt(s),h=c+u;o&&(h=parseInt(o));let d=h-c;1e3*d<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${d}s, should have been closer to ${u}s`);let f=h-u;c-f>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",f,h,c):c-f<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",f,h,c);let{data:p,error:g}=await this._getUser(n);if(g)throw g;let v={provider_token:r,provider_refresh_token:i,access_token:n,expires_in:u,expires_at:h,refresh_token:a,token_type:l,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:v,redirectType:e.type},error:null}}catch(e){if(tz(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await rt(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;let{data:i,error:n}=t;if(n)return{error:n};let a=null==(r=i.session)?void 0:r.access_token;if(a){let{error:t}=await this.admin.signOut(a,e);if(t&&!(tz(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status||403===t.status)))return{error:t}}return"others"!==e&&(await this._removeSession(),await rr(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){let t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),r={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,r),(async()=>{await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,i;try{let{data:{session:i},error:n}=t;if(n)throw n;await (null==(r=this.stateChangeEmitters.get(e))?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(t){await (null==(i=this.stateChangeEmitters.get(e))?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,i=null;"pkce"===this.flowType&&([r,i]=await rc(this.storage,this.storageKey,!0));try{return await rw(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:i,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(tz(e))return{data:null,error:e};throw e}}async getUserIdentities(){var e;try{let{data:t,error:r}=await this.getUser();if(r)throw r;return{data:{identities:null!=(e=t.user.identities)?e:[]},error:null}}catch(e){if(tz(e))return{data:null,error:e};throw e}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{let{data:r,error:i}=await this._useSession(async t=>{var r,i,n,a,s;let{data:o,error:l}=t;if(l)throw l;let c=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null==(r=e.options)?void 0:r.redirectTo,scopes:null==(i=e.options)?void 0:i.scopes,queryParams:null==(n=e.options)?void 0:n.queryParams,skipBrowserRedirect:!0});return await rw(this.fetch,"GET",c,{headers:this.headers,jwt:null!=(s=null==(a=o.session)?void 0:a.access_token)?s:void 0})});if(i)throw i;return!t3()||(null==(t=e.options)?void 0:t.skipBrowserRedirect)||window.location.assign(null==r?void 0:r.url),{data:{provider:e.provider,url:null==r?void 0:r.url},error:null}}catch(t){if(tz(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var r;try{let{error:i,data:{session:n}}=t;if(i)throw i;let{options:a,provider:s,token:o,access_token:l,nonce:c}=e,{data:u,error:h}=await rw(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!=(r=null==n?void 0:n.access_token)?r:void 0,body:{provider:s,id_token:o,access_token:l,nonce:c,link_identity:!0,gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:rS});if(h)return{data:{user:null,session:null},error:h};if(!u||!u.session||!u.user)return{data:{user:null,session:null},error:new tW};return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("USER_UPDATED",u.session)),{data:u,error:h}}catch(e){if(tz(e))return{data:{user:null,session:null},error:e};throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,i;let{data:n,error:a}=t;if(a)throw a;
35return await rw(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!=(i=null==(r=n.session)?void 0:r.access_token)?i:void 0})})}catch(e){if(tz(e))return{data:null,error:e};throw e}}async _refreshAccessToken(e){let t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{var r,i;let n=Date.now();return await (r=async r=>(r>0&&await ra(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await rw(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:rS})),i=(e,t)=>{let r=200*Math.pow(2,e);return t&&tG(t)&&Date.now()+r-n<3e4},new Promise((e,t)=>{(async()=>{for(let n=0;n<1/0;n++)try{let t=await r(n);if(!i(n,null,t))return void e(t)}catch(e){if(!i(n,e))return void t(e)}})()}))}catch(e){if(this._debug(t,"error",e),tz(e))return{data:{session:null,user:null},error:e};throw e}finally{this._debug(t,"end")}}_isValidSession(e){return"object"==typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){let r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),t3()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let i=await rt(this.storage,this.storageKey);if(i&&this.userStorage){let t=await rt(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!t&&(t={user:i.user},await re(this.userStorage,this.storageKey+"-user",t)),i.user=null!=(e=null==t?void 0:t.user)?e:rf()}else if(i&&!i.user&&!i.user){let e=await rt(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(i.user=e.user,await rr(this.storage,this.storageKey+"-user"),await re(this.storage,this.storageKey,i)):i.user=rf()}if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),null!==i&&await this._removeSession();return}let n=(null!=(t=i.expires_at)?t:1/0)*1e3-Date.now()<9e4;if(this._debug(r,`session has${n?"":" not"} expired with margin of 90000s`),n){if(this.autoRefreshToken&&i.refresh_token){let{error:e}=await this._callRefreshToken(i.refresh_token);e&&(console.error(e),tG(e)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else if(i.user&&!0===i.user.__isUserNotAvailableProxy)try{let{data:e,error:t}=await this._getUser(i.access_token);!t&&(null==e?void 0:e.user)?(i.user=e.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(e){console.error("Error getting user data:",e),this._debug(r,"error getting user data, skipping SIGNED_IN notification",e)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(e){this._debug(r,"error",e),console.error(e);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new tF;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new ri;let{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new tF;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);let i={data:t.session,error:null};return this.refreshingDeferred.resolve(i),i}catch(e){if(this._debug(i,"error",e),tz(e)){let r={data:null,error:e};return tG(e)||await this._removeSession(),null==(t=this.refreshingDeferred)||t.resolve(r),r}throw null==(r=this.refreshingDeferred)||r.reject(e),e}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,t,r=!0){let i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let i=[],n=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){i.push(e)}});if(await Promise.all(n),i.length>0){for(let e=0;e<i.length;e+=1)console.error(i[e]);throw i[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let t=Object.assign({},e),r=t.user&&!0===t.user.__isUserNotAvailableProxy;if(this.userStorage){!r&&t.user&&await re(this.userStorage,this.storageKey+"-user",{user:t.user});let e=Object.assign({},t);delete e.user;let i=rp(e);await re(this.storage,this.storageKey,i)}else{let e=rp(t);await re(this.storage,this.storageKey,e)}}async _removeSession(){this._debug("#_removeSession()"),await rr(this.storage,this.storageKey),await rr(this.storage,this.storageKey+"-code-verifier"),await rr(this.storage,this.storageKey+"-user"),this.userStorage&&await rr(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&t3()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
35catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),3e4);this.autoRefreshTicker=e,e&&"object"==typeof e&&"function"==typeof e.unref?e.unref():"u">typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async t=>{let{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");let i=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),i<=3&&await this._callRefreshToken(r.refresh_token)})}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof rP)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!t3()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{"visible"!==document.visibilityState?this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting"):await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){let i=[`provider=${encodeURIComponent(t)}`];if((null==r?void 0:r.redirectTo)&&i.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),(null==r?void 0:r.scopes)&&i.push(`scopes=${encodeURIComponent(r.scopes)}`),"pkce"===this.flowType){let[e,t]=await rc(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});i.push(r.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);i.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&i.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:i,error:n}=t;return n?{data:null,error:n}:await rw(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null==(r=null==i?void 0:i.session)?void 0:r.access_token})})}catch(e){if(tz(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,i;let{data:n,error:a}=t;if(a)return{data:null,error:a};let s=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:"totp"===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await rw(this.fetch,"POST",`${this.url}/factors`,{body:s,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});return l?{data:null,error:l}:("totp"===e.factorType&&"totp"===o.type&&(null==(i=null==o?void 0:o.totp)?void 0:i.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(e){if(tz(e))return{data:null,error:e};throw e}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r,i,n;let{data:a,error:s}=t;if(s)return{data:null,error:s};let o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?(i=e.webauthn.credential_response,"toJSON"in
35i&&"function"==typeof i.toJSON?i.toJSON():{id:i.id,rawId:i.id,response:{attestationObject:t5(new Uint8Array(i.response.attestationObject)),clientDataJSON:t5(new Uint8Array(i.response.clientDataJSON))},type:"public-key",clientExtensionResults:i.getClientExtensionResults(),authenticatorAttachment:null!=(n=i.authenticatorAttachment)?n:void 0}):function(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();let r=e.getClientExtensionResults(),i=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:t5(new Uint8Array(i.authenticatorData)),clientDataJSON:t5(new Uint8Array(i.clientDataJSON)),signature:t5(new Uint8Array(i.signature)),userHandle:i.userHandle?t5(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:null!=(t=e.authenticatorAttachment)?t:void 0}}(e.webauthn.credential_response)})}:{code:e.code}),{data:l,error:c}=await rw(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:null==(r=null==a?void 0:a.session)?void 0:r.access_token});return c?{data:null,error:c}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),{data:l,error:c})})}catch(e){if(tz(e))return{data:null,error:e};throw e}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;let{data:i,error:n}=t;if(n)return{data:null,error:n};let a=await rw(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null==(r=null==i?void 0:i.session)?void 0:r.access_token});if(a.error)return a;let{data:s}=a;if("webauthn"!==s.type)return{data:s,error:null};switch(s.webauthn.type){case"create":return{data:Object.assign(Object.assign({},s),{webauthn:Object.assign(Object.assign({},s.webauthn),{credential_options:Object.assign(Object.assign({},s.webauthn.credential_options),{publicKey:function(e){if(!e)throw Error("Credential creation options are required");if("u">typeof PublicKeyCredential&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(e);let{challenge:t,user:r,excludeCredentials:i}=e,n=rM(e,["challenge","user","excludeCredentials"]),a=t8(t).buffer,s=Object.assign(Object.assign({},r),{id:t8(r.id).buffer}),o=Object.assign(Object.assign({},n),{challenge:a,user:s});if(i&&i.length>0){o.excludeCredentials=Array(i.length);for(let e=0;e<i.length;e++){let t=i[e];o.excludeCredentials[e]=Object.assign(Object.assign({},t),{id:t8(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return o}(s.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},s),{webauthn:Object.assign(Object.assign({},s.webauthn),{credential_options:Object.assign(Object.assign({},s.webauthn.credential_options),{publicKey:function(e){if(!e)throw Error("Credential request options are required");if("u">typeof PublicKeyCredential&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseRequestOptionsFromJSON)return PublicKeyCredential.parseRequestOptionsFromJSON(e);let{challenge:t,allowCredentials:r}=e,i=rM(e,["challenge","allowCredentials"]),n=t8(t).buffer,a=Object.assign(Object.assign({},i),{challenge:n});if(r&&r.length>0){a.allowCredentials=Array(r.length);for(let e=0;e<r.length;e++){let t=r[e];a.allowCredentials[e]=Object.assign(Object.assign({},t),{id:t8(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return a}(s.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if(tz(e))return{data:null,error:e};throw e}})}async _challengeAndVerify(e){let{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;let{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};let i={all:[],phone:[],totp:[],webauthn:[]};for(let r of null!=(e=null==t?void 0:t.factors)?e:[])i.all.push(r),"verified"===r.status&&i[r.factor_type].push(r);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,r;let{data:{session:i},error:n}=e;if(n)return{data:null,error:n};if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:a}=rn(i.access_token),s=null;a.aal&&(s=a.aal);let o=s;return(null!=(r=null==(t=i.user.factors)?void 0:t.filter(e=>"verified"===e.status))?r:[]).length>0&&(o="aal2"),{data:{currentLevel:s,nextLevel:o,currentAuthenticationMethods:a.amr||[]},error:null}}))}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(t=>t.kid===e);if(r)return r;let i=Date.now();if((r=this.jwks.keys.find(t=>t.kid===e))&&this.jwks_cached_at+6e5>i)return r;let{data:n,error:a}=await rw(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return n.keys&&0!==n.keys.length&&(this.jwks=n,this.jwks_cached_at=i,r=n.keys.find(t=>t.kid===e))?r:null}async getClaims(e,t={}){try{var r;let i,n=e;if(!n){let{data:e,error:t}
35=await this.getSession();if(t||!e.session)return{data:null,error:t};n=e.session.access_token}let{header:a,payload:s,signature:o,raw:{header:l,payload:c}}=rn(n);(null==t?void 0:t.allowExpired)||function(e){if(!e)throw Error("Missing exp claim");if(e<=Math.floor(Date.now()/1e3))throw Error("JWT has expired")}(s.exp);let u=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks);if(!u){let{error:e}=await this.getUser(n);if(e)throw e;return{data:{claims:s,header:a,signature:o},error:null}}let h=function(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw Error("Invalid alg claim")}}(a.alg),d=await crypto.subtle.importKey("jwk",u,h,!0,["verify"]);if(!await crypto.subtle.verify(h,d,o,(r=`${l}.${c}`,i=[],!function(e,t){for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i>55295&&i<=56319){let t=(i-55296)*1024&65535;i=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(i,t)}}(r,e=>i.push(e)),new Uint8Array(i))))throw new tQ("Invalid JWT signature");return{data:{claims:s,header:a,signature:o},error:null}}catch(e){if(tz(e))return{data:null,error:e};throw e}}}rQ.nextInstanceID=0;let rX=rQ;class rZ extends rX{constructor(e){super(e)}}class r0{constructor(e,t,r){var i,n,a;this.supabaseUrl=e,this.supabaseKey=t;const s=function(e){let t=null==e?void 0:e.trim();if(!t)throw Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(t.endsWith("/")?t:t+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}(e);if(!t)throw Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);const o=`sb-${s.hostname.split(".")[0]}-auth-token`,l=function(e,t){var r,i;let{db:n,auth:a,realtime:s,global:o}=e,{db:l,auth:c,realtime:u,global:h}=t,d={db:Object.assign(Object.assign({},l),n),auth:Object.assign(Object.assign({},c),a),realtime:Object.assign(Object.assign({},u),s),storage:{},global:Object.assign(Object.assign(Object.assign({},h),o),{headers:Object.assign(Object.assign({},null!=(r=null==h?void 0:h.headers)?r:{}),null!=(i=null==o?void 0:o.headers)?i:{})}),accessToken:()=>{var e,t,r,i;return e=this,t=void 0,i=function*(){return""},new(r=void 0,r=Promise)(function(n,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}l((i=i.apply(e,t||[])).next())})}};return e.accessToken?d.accessToken=e.accessToken:delete d.accessToken,d}(null!=r?r:{},{db:tU,realtime:tj,auth:Object.assign(Object.assign({},tI),{storageKey:o}),global:tA});this.storageKey=null!=(i=l.auth.storageKey)?i:"",this.headers=null!=(n=l.global.headers)?n:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!=(a=l.auth)?a:{},this.headers,l.global.fetch),this.fetch=((e,t,r)=>{let i,n=(i=r||("u"<typeof fetch?tP.default:fetch),(...e)=>i(...e)),a="u"<typeof Headers?tP.Headers:Headers;return(r,i)=>{var s,o,l,c;return s=void 0,o=void 0,l=void 0,c=function*(){var s;let o=null!=(s=yield t())?s:e,l=new a(null==i?void 0:i.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${o}`),n(r,Object.assign(Object.assign({},i),{headers:l}))},new(l||(l=Promise))(function(e,t){function r(e){try{n(c.next(e))}catch(e){t(e)}}function i(e){try{n(c.throw(e))}catch(e){t(e)}}function n(t){var n;t.done?e(t.value):((n=t.value)instanceof l?n:new l(function(e){e(n)})).then(r,i)}n((c=c.apply(s,o||[])).next())})}})(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)}
35,l.realtime)),this.rest=new eq(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new tO(this.storageUrl.href,this.headers,this.fetch,null==r?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new eN(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={}){return this.rest.rpc(e,t,r)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t,r,i;return e=this,t=void 0,r=void 0,i=function*(){var e,t;if(this.accessToken)return yield this.accessToken();let{data:r}=yield this.auth.getSession();return null!=(t=null==(e=r.session)?void 0:e.access_token)?t:this.supabaseKey},new(r||(r=Promise))(function(n,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,o)}l((i=i.apply(e,t||[])).next())})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:i,userStorage:n,storageKey:a,flowType:s,lock:o,debug:l},c,u){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new rZ({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),c),storageKey:a,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:i,userStorage:n,flowType:s,lock:o,debug:l,fetch:u,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new tr(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,r){("TOKEN_REFRESHED"===e||"SIGNED_IN"===e)&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}}(function(){if("u">typeof window||void 0===e$.default)return!1;let e=e$.default.version;if(null==e)return!1;let t=e.match(/^v(\d+)\./);return!!t&&18>=parseInt(t[1],10)})()&&console.warn(`â ï¸ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217`);var r1=e.i(70203);function r2(){return"u">typeof window&&void 0!==window.document}r1.parse,r1.serialize;let r6={path:"/",sameSite:"lax",httpOnly:!1,maxAge:3456e4},r8=/^(.*)[.](0|[1-9][0-9]*)$/;function r5(e,t){if(e===t)return!0;let r=e.match(r8);return!!r&&r[1]===t}function r3(e,t,r){let i=r??3180,n=encodeURIComponent(t);if(n.length<=i)return[{name:e,value:t}];let a=[];for(;n.length>0;){let e=n.slice(0,i),t=e.lastIndexOf("%");t>i-3&&(e=e.slice(0,t));let r="";for(;e.length>0;)try{r=decodeURIComponent(e);break}catch(t){if(t instanceof URIError&&"%"===e.at(-3)&&e.length>3)e=e.slice(0,e.length-3);else throw t}a.push(r),n=n.slice(e.length)}return a.map((t,r)=>({name:`${e}.${r}`,value:t}))}async function r4(e,t){let r=await t(e);if(r)return r;let i=[];for(let r=0;;r++){let n=`${e}.${r}`,a=await t(n);if(!a)break;i.push(a)}return i.length>0?i.join(""):null}let r7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),r9=" \n\r=".split(""),ie=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<r9.length;t+=1)e[r9[t].charCodeAt(0)]=-2;for(let t=0;t<r7.length;t+=1)e[r7[t].charCodeAt(0)]=t;return e})();function it(e){let t=[],r=0,i=0;if(function(e,t){for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i>55295&&i<=56319){let t=(i-55296)*1024&65535;i=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>
356&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(i,t)}}(e,e=>{for(r=r<<8|e,i+=8;i>=6;){let e=r>>i-6&63;t.push(r7[e]),i-=6}}),i>0)for(r<<=6-i,i=6;i>=6;){let e=r>>i-6&63;t.push(r7[e]),i-=6}return t.join("")}function ir(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},i={utf8seq:0,codepoint:0},n=0,a=0;for(let t=0;t<e.length;t+=1){let s=ie[e.charCodeAt(t)];if(s>-1)for(n=n<<6|s,a+=6;a>=8;)(function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}})(n>>a-8&255,i,r),a-=8;else if(-2===s)continue;else throw Error(`Invalid Base64-URL character "${e.at(t)}" at position ${t}`)}return t.join("")}let ii="base64-";async function ia({getAll:e,setAll:t,setItems:r,removedItems:i},n){let a=n.cookieEncoding,s=n.cookieOptions??null,o=await e([...r?Object.keys(r):[],...i?Object.keys(i):[]]),l=o?.map(({name:e})=>e)||[],c=Object.keys(i).flatMap(e=>l.filter(t=>r5(t,e))),u=Object.keys(r).flatMap(e=>{let t=new Set(l.filter(t=>r5(t,e))),i=r[e];"base64url"===a&&(i=ii+it(i));let n=r3(e,i);return n.forEach(e=>{t.delete(e.name)}),c.push(...t),n}),h={...r6,...s,maxAge:0},d={...r6,...s,maxAge:r6.maxAge};delete h.name,delete d.name,await t([...c.map(e=>({name:e,value:"",options:h})),...u.map(({name:e,value:t})=>({name:e,value:t,options:d}))])}e.i(752683);let is=(e=!1)=>["https://vgyilmiiweufhtspnrrj.supabase.co",e?e$.default.env.SUPABASE_SERVICE_ROLE_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZneWlsbWlpd2V1Zmh0c3BucnJqIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTc5MTUzODQsImV4cCI6MjAxMzQ5MTM4NH0.FSBQM2ULUFgMZEHts_ZDARl3miiyJoRLMjCj7v0MXqw"];e.s(["getKeyType",0,is],242397),e.i(241646);let io=function(e,r,i){let n=r2();if(n&&t)return t;if(!e||!r)throw Error(`@supabase/ssr: Your project's URL and API key are required to create a Supabase client! 36 37Check your Supabase project's API settings to find these values 38 39https://supabase.com/dashboard/project/_/settings/api`);let{storage:a}=function(e,t){let r,i,n=e.cookies??null,a=e.cookieEncoding,s={},o={};if(n)if("get"in n){let e=async e=>{let t=e.flatMap(e=>[e,...Array.from({length:5}).map((t,r)=>`${e}.${r}`)]),r=[];for(let e=0;e<t.length;e+=1){let i=await n.get(t[e]);(i||"string"==typeof i)&&r.push({name:t[e],value:i})}return r};if(r=async t=>await e(t),"set"in n&&"remove"in n)i=async e=>{for(let t=0;t<e.length;t+=1){let{name:r,value:i,options:a}=e[t];i?await n.set(r,i,a):await n.remove(r,a)}};else if(t)i=async()=>{console.warn("@supabase/ssr: createServerClient was configured without set and remove cookie methods, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness. Consider switching to the getAll and setAll cookie methods instead of get, set and remove which are deprecated and can be difficult to use correctly.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring a getAll and setAll cookie method (deprecated: alternatively both get, set and remove can be used)")}else if("getAll"in n)if(r=async()=>await n.getAll(),"setAll"in n)i=n.setAll;else if(t)i=async()=>{console.warn("@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)");else throw Error(`@supabase/ssr: ${t?"createServerClient":"createBrowserClient"} requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).${r2()?" As this is called
39in a browser runtime, consider removing the cookies option object to use the document.cookie API automatically.":""}`);else if(!t&&r2())r=()=>{let e;return Object.keys(e=(0,r1.parse)(document.cookie)).map(t=>({name:t,value:e[t]}))},i=e=>{e.forEach(({name:e,value:t,options:r})=>{document.cookie=(0,r1.serialize)(e,t,r)})};else if(t)throw Error("@supabase/ssr: createServerClient must be initialized with cookie options that specify getAll and setAll functions (deprecated, not recommended: alternatively use get, set and remove)");else r=()=>[],i=()=>{throw Error("@supabase/ssr: createBrowserClient in non-browser runtimes (including Next.js pre-rendering mode) was not initialized cookie options that specify getAll and setAll functions (deprecated: alternatively use get, set and remove), but they were needed")};return t?{getAll:r,setAll:i,setItems:s,removedItems:o,storage:{isServer:!0,getItem:async e=>{if("string"==typeof s[e])return s[e];if(o[e])return null;let t=await r([e]),i=await r4(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});if(!i)return null;let n=i;return"string"==typeof i&&i.startsWith(ii)&&(n=ir(i.substring(ii.length))),n},setItem:async(t,n)=>{t.endsWith("-code-verifier")&&await ia({getAll:r,setAll:i,setItems:{[t]:n},removedItems:{}},{cookieOptions:e?.cookieOptions??null,cookieEncoding:a}),s[t]=n,delete o[t]},removeItem:async e=>{delete s[e],o[e]=!0}}}:{getAll:r,setAll:i,setItems:s,removedItems:o,storage:{isServer:!1,getItem:async e=>{let t=await r([e]),i=await r4(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});if(!i)return null;let n=i;return i.startsWith(ii)&&(n=ir(i.substring(ii.length))),n},setItem:async(t,n)=>{let s=await r([t]),o=new Set((s?.map(({name:e})=>e)||[]).filter(e=>r5(e,t))),l=n;"base64url"===a&&(l=ii+it(n));let c=r3(t,l);c.forEach(({name:e})=>{o.delete(e)});let u={...r6,...e?.cookieOptions,maxAge:0},h={...r6,...e?.cookieOptions,maxAge:r6.maxAge};delete u.name,delete h.name;let d=[...[...o].map(e=>({name:e,value:"",options:u})),...c.map(({name:e,value:t})=>({name:e,value:t,options:h}))];d.length>0&&await i(d)},removeItem:async t=>{let n=await r([t]),a=(n?.map(({name:e})=>e)||[]).filter(e=>r5(e,t)),s={...r6,...e?.cookieOptions,maxAge:0};delete s.name,a.length>0&&await i(a.map(e=>({name:e,value:"",options:s})))}}}}({...void 0,cookieEncoding:(void 0)??"base64url"},!1),s=new r0(e,r,{...void 0,global:{...void 0,headers:{...void 0,"X-Client-Info":"supabase-ssr/0.5.2"}},auth:{...void 0,...null,flowType:"pkce",autoRefreshToken:r2(),detectSessionInUrl:r2(),persistSession:!0,storage:a}});return n&&(t=s),s}(is()[0],is()[1]);e.s(["supabase",0,io,"supabaseClient",0,()=>({auctions:k.default,auth:R.default,events:E.default,giveaways:O.default,organizations:T.default,users:ef,tickets:A.default,venues:ek,transactions:U.transactions,verified_accounts:eU,newsletters:eI,discounts:eL})],143151)}]); 40 41//# debugId=0453201f-ae0f-ae25-73b5-797b1a86e11d 42//# sourceMappingURL=d608a99b29a716ab.js.map
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.