const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TweestapsSchermen-CiMl3LBj.js","assets/TweestapsKoppelen--tQMtQcn.js","assets/loader-circle-3yB38hMG.js","assets/copy--W1WYdjm.js","assets/select-DHzrMXiY.js","assets/Combination-BbivB0qK.js","assets/index-Ca-r0utX.js","assets/chevron-down-P52vGZPo.js","assets/check-BPkGDC65.js","assets/chevron-up-CDtiejVf.js","assets/shield-check-CJoToXtC.js","assets/circle-check-A-PNcqA9.js","assets/Index-pR4c7wF_.js","assets/BottomNav-C0Bcy14y.js","assets/BottomNavItem-peY2tgcZ.js","assets/UnifiedBottomNav-CtU3tZtM.js","assets/house-BAeZPxNW.js","assets/calendar-aeE5FthZ.js","assets/log-out-Db_Nx8tv.js","assets/useFacturatieStap-C5mrpdOK.js","assets/useIntakeFields-DlUSyIfq.js","assets/dialogAutoFocus-B19KLs8g.js","assets/useMutation-DXyBxYYx.js","assets/idempotency-XHrRmoKc.js","assets/supabaseUntyped-BFFrOB-Q.js","assets/mail-DHKoSJj6.js","assets/trending-up-DUQ6Dvw_.js","assets/tag-DS7ppo5S.js","assets/calendar-range-DF3VtA32.js","assets/inbox-fhx14_34.js","assets/heart-C3h-Xq26.js","assets/sunrise-Bh0eGlcC.js","assets/boxes-D6jmvpwF.js","assets/clock-CHnsi1K3.js","assets/file-text-DllmGUGW.js","assets/plus-DPdUAoR9.js","assets/avatar-CwUHKbkU.js","assets/wrench-R12jiPzo.js","assets/minus-TUOMEZEU.js","assets/triangle-alert-p-sGU1s7.js","assets/sheet-CccwJRPJ.js","assets/singleFlight-CoeuUmqZ.js","assets/addDays-Cukx13z7.js","assets/getTimezoneOffsetInMilliseconds-CtPqD4zm.js","assets/nl-BgTAe4Jf.js","assets/purify.es-DowdsyMd.js","assets/IntakeAnswerValue-B0XILsE2.js","assets/format-GrqdmVZi.js","assets/differenceInCalendarDays-DLHgGGaX.js","assets/intakeEdit-3nfNtl9I.js","assets/textarea-0gmbD4TR.js","assets/endOfWeek-wAv8nSCF.js","assets/skeleton-QeW951GS.js","assets/pencil-BnjEnIjY.js","assets/checkbox-akLz8Yxt.js","assets/printer-DwBcMmzp.js","assets/dayLink-CVajWCcB.js","assets/refresh-cw-6OtJN6Vz.js","assets/isSameMonth-D9ZVWRzF.js","assets/parseISO-Zf61mMJY.js","assets/ResponsiveContainer-BgnxMP_e.js","assets/hulpScherm-CMPNXcBT.js","assets/DataTable-UZrBrLVZ.js","assets/map-pin-CxN5rRxk.js","assets/phone-CsFsfzJp.js","assets/chevron-right-DiQ5vkcz.js","assets/navigation-8xYLSgMW.js","assets/circle-x-B8LrvhY-.js","assets/send-Cb68Lf-O.js","assets/endOfMonth-66coEGxM.js","assets/leadInteresse-BU8TvXx2.js","assets/dayBoardColumns-C3G9VzUS.js","assets/wifi-off-BMfu0vik.js","assets/layout-dashboard-CmBwx5-Z.js","assets/Booking-CGeproK0.js","assets/bookingWidgetStepList-FBe18NU1.js","assets/ServiceDescription-B4YTFasS.js","assets/search-DbuxQ4kL.js","assets/IntakeFieldList-s-c5QlyX.js","assets/differenceInCalendarMonths-Cz9hs689.js","assets/addYears-B6OYmowC.js","assets/chevron-left-C-59djui.js","assets/star-ByWadpEr.js","assets/useWorkingHours-F-PhDs69.js","assets/graduation-cap-BL9s-Eod.js","assets/index.esm-DZlXRA-e.js","assets/form-BHkiOiOt.js","assets/schemas-DniPSBGT.js","assets/bell-DUmCgrE4.js","assets/usePortalSession-DLvPwM6X.js","assets/portalSession-WVRowVei.js","assets/useOrgBrandTokens-BLB4oOqb.js","assets/orgBrandVars-Cdz-Dh_4.js","assets/Profile-BszVY6RO.js","assets/switch-VacDj3Wo.js","assets/alert-Bu8JeIxA.js","assets/save-gokPwXHF.js","assets/CustomerView-ZGoAhU_b.js","assets/arrow-right-CYuR3o4i.js","assets/Admin-C_iefJRI.js","assets/SettingsDrawer-C7k9quEt.js","assets/upload-DUKBw9Qm.js","assets/undo-2-zK2RqvmS.js","assets/IntakeChangeHistory-dTHcmshi.js","assets/paperclip-C4zTPeEF.js","assets/index-D17SJSFS.js","assets/designApprovalPage-BMxPtuYo.js","assets/portalDeepLink-B4EO5gHh.js","assets/supportNotify-B3Vvbf69.js","assets/useLeads-CG4VFamq.js","assets/ellipsis-vertical-1Ij6KqFe.js","assets/unlink-DgrrEfY2.js","assets/eachDayOfInterval-LWqxv5kH.js","assets/startOfQuarter-FyEJ6RKV.js","assets/wifi-DYjlD6X4.js","assets/circle-check-big-5QzrwZ3R.js","assets/PageHead-mW-x159g.js","assets/Admin-C-cw445N.css","assets/CustomerProfile-DNuJ7_S0.js","assets/calendar-plus-B_jymKvk.js","assets/KlantFormulierVelden-CgnzX14M.js","assets/user-round-DiQ6rK7j.js","assets/newspaper-BEMUvpAq.js","assets/link-2-g8HipUtq.js","assets/shopping-bag-ZLrNIfwY.js","assets/EditClientDialog-BWbWtnIm.js","assets/CustomerEngagement-DsovIRdZ.js","assets/customerAggregates-kNdp95Gd.js","assets/differenceInDays-BiSgeBEI.js","assets/AcceptInvitation-DtmKQ5n2.js","assets/edgeFunctionFout-gIr3SjWC.js","assets/ClaimSlot-BuZE1VxA.js","assets/Install-CiYToIr6.js","assets/DayLinkView-DH-riNlu.js","assets/DayLinkView-DBa8jv8M.css","assets/SupportPortal-N1kkw7mv.js","assets/CollapsibleSection-Bx2K7cb4.js","assets/SupportChips-D61bHts4.js","assets/formatDistanceToNow-CB5mtInW.js","assets/supportRows-BAMLrlh4.css","assets/supportSession-Bokr4X0z.js","assets/useSupportPortal-BdU3Z4U6.js","assets/SupportTicketPage-Dy5dEX2U.js","assets/Landing-1GQOfvuj.js","assets/SectionLabel-q8Y7oaG6.js","assets/user-cog-DLr7SXX-.js","assets/plug-DFn5a8r_.js","assets/menu-m0N5KQKQ.js","assets/FAQSection-BaQqRu4D.js","assets/accordion-D1mlEu_d.js","assets/CTASection-BapOEwWY.js","assets/Features-DhTG4Tfo.js","assets/FeatureDetail-DjD03hgQ.js","assets/Pricing-BLv3y_HV.js","assets/About-jgx2y4lW.js","assets/EditorialImage-TVKKYxD9.js","assets/Contact-CkR98gy2.js","assets/MarketingBlog-DSWvmrJU.js","assets/MarketingBlogPost-DHu9d-cC.js","assets/Privacy-BGa_f-pl.js","assets/NieuwsbriefWeb-Z1M1onrj.js","assets/Voorwaarden-7AfBUkIR.js","assets/Verwerkersovereenkomst-LC1M05K-.js","assets/SiteLayout-C7l9SX_t.js","assets/linkedin-gveglxLu.js","assets/SiteHome-Cm4KscQg.js","assets/SiteServices-CSmUhwro.js","assets/SiteTeam-CGfmzGLb.js","assets/SiteBlog-_6cq6Anr.js","assets/SiteBlogPost-DXzDy-BN.js","assets/SiteContact-CzpF7kTk.js","assets/PortalLogin-CpiSYi1f.js","assets/PortalHome-C96QG6aF.js","assets/DesignApprovalPage-Ddu0Fk7K.js","assets/LeadInteresse-dv8PMBxp.js","assets/InteresseSchil-DOz5MdvZ.js","assets/useFormulierContext-B-El36LW.js","assets/leadInteresseApi-CRnlKPOT.js","assets/LeadInteresseAntwoord-DfiTRZuB.js","assets/LeadAfspraak-DpnkaFXg.js","assets/leadsBookingApi-CPevm1Yl.js","assets/leadSchrijf-CvVxiypp.js","assets/calendar-check-B_vmshc_.js","assets/BerichtenAfmelden-BoaLMb6Q.js","assets/AgendaToestemming-xmiCLiRf.js","assets/Afmelden-DLa5olj5.js"])))=>i.map(i=>d[i]); var mS=Object.defineProperty;var gv=t=>{throw TypeError(t)};var gS=(t,e,r)=>e in t?mS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Xl=(t,e,r)=>gS(t,typeof e!="symbol"?e+"":e,r),Qd=(t,e,r)=>e.has(t)||gv("Cannot "+r);var L=(t,e,r)=>(Qd(t,e,"read from private field"),r?r.call(t):e.get(t)),Ee=(t,e,r)=>e.has(t)?gv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ae=(t,e,r,s)=>(Qd(t,e,"write to private field"),s?s.call(t,r):e.set(t,r),r),Ie=(t,e,r)=>(Qd(t,e,"access private method"),r);var Zl=(t,e,r,s)=>({set _(i){ae(t,e,i,r)},get _(){return L(t,e,s)}});function Ow(t,e){for(var r=0;rs[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();var S2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function vS(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function s(){return this instanceof s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(s){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}),r}var Jd={exports:{}},na={},Yd={exports:{}},Ae={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var vv;function yS(){if(vv)return Ae;vv=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;function _(N){return N===null||typeof N!="object"?null:(N=y&&N[y]||N["@@iterator"],typeof N=="function"?N:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,S={};function x(N,U,re){this.props=N,this.context=U,this.refs=S,this.updater=re||v}x.prototype.isReactComponent={},x.prototype.setState=function(N,U){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,U,"setState")},x.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function T(){}T.prototype=x.prototype;function R(N,U,re){this.props=N,this.context=U,this.refs=S,this.updater=re||v}var C=R.prototype=new T;C.constructor=R,k(C,x.prototype),C.isPureReactComponent=!0;var j=Array.isArray,D=Object.prototype.hasOwnProperty,A={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function W(N,U,re){var J,se={},ye=null,de=null;if(U!=null)for(J in U.ref!==void 0&&(de=U.ref),U.key!==void 0&&(ye=""+U.key),U)D.call(U,J)&&!z.hasOwnProperty(J)&&(se[J]=U[J]);var xe=arguments.length-2;if(xe===1)se.children=re;else if(1>>1,U=B[N];if(0>>1;Ni(se,K))yei(de,se)?(B[N]=de,B[ye]=K,N=ye):(B[N]=se,B[J]=K,N=J);else if(yei(de,K))B[N]=de,B[ye]=K,N=ye;else break e}}return V}function i(B,V){var K=B.sortIndex-V.sortIndex;return K!==0?K:B.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var u=Date,d=u.now();t.unstable_now=function(){return u.now()-d}}var f=[],p=[],g=1,y=null,_=3,v=!1,k=!1,S=!1,x=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(B){for(var V=r(p);V!==null;){if(V.callback===null)s(p);else if(V.startTime<=B)s(p),V.sortIndex=V.expirationTime,e(f,V);else break;V=r(p)}}function j(B){if(S=!1,C(B),!k)if(r(f)!==null)k=!0,oe(D);else{var V=r(p);V!==null&&ue(j,V.startTime-B)}}function D(B,V){k=!1,S&&(S=!1,T(W),W=-1),v=!0;var K=_;try{for(C(V),y=r(f);y!==null&&(!(y.expirationTime>V)||B&&!me());){var N=y.callback;if(typeof N=="function"){y.callback=null,_=y.priorityLevel;var U=N(y.expirationTime<=V);V=t.unstable_now(),typeof U=="function"?y.callback=U:y===r(f)&&s(f),C(V)}else s(f);y=r(f)}if(y!==null)var re=!0;else{var J=r(p);J!==null&&ue(j,J.startTime-V),re=!1}return re}finally{y=null,_=K,v=!1}}var A=!1,z=null,W=-1,Q=5,te=-1;function me(){return!(t.unstable_now()-teB||125N?(B.sortIndex=K,e(p,B),r(f)===null&&B===r(p)&&(S?(T(W),W=-1):S=!0,ue(j,K-N))):(B.sortIndex=U,e(f,B),k||v||(k=!0,oe(D))),B},t.unstable_shouldYield=me,t.unstable_wrapCallback=function(B){var V=_;return function(){var K=_;_=V;try{return B.apply(this,arguments)}finally{_=K}}}})(ef)),ef}var xv;function xS(){return xv||(xv=1,Zd.exports=_S()),Zd.exports}/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ev;function ES(){if(Ev)return Vt;Ev=1;var t=Lh(),e=xS();function r(n){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+n,l=1;l"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,g={},y={};function _(n){return f.call(y,n)?!0:f.call(g,n)?!1:p.test(n)?y[n]=!0:(g[n]=!0,!1)}function v(n,o,l,c){if(l!==null&&l.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return c?!1:l!==null?!l.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function k(n,o,l,c){if(o===null||typeof o>"u"||v(n,o,l,c))return!0;if(c)return!1;if(l!==null)switch(l.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function S(n,o,l,c,h,m,E){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=c,this.attributeNamespace=h,this.mustUseProperty=l,this.propertyName=n,this.type=o,this.sanitizeURL=m,this.removeEmptyString=E}var x={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){x[n]=new S(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var o=n[0];x[o]=new S(o,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){x[n]=new S(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){x[n]=new S(n,2,!1,n,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){x[n]=new S(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){x[n]=new S(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){x[n]=new S(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){x[n]=new S(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){x[n]=new S(n,5,!1,n.toLowerCase(),null,!1,!1)});var T=/[\-:]([a-z])/g;function R(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var o=n.replace(T,R);x[o]=new S(o,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var o=n.replace(T,R);x[o]=new S(o,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var o=n.replace(T,R);x[o]=new S(o,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){x[n]=new S(n,1,!1,n.toLowerCase(),null,!1,!1)}),x.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){x[n]=new S(n,1,!1,n.toLowerCase(),null,!0,!0)});function C(n,o,l,c){var h=x.hasOwnProperty(o)?x[o]:null;(h!==null?h.type!==0:c||!(2P||h[E]!==m[P]){var O=` `+h[E].replace(" at new "," at ");return n.displayName&&O.includes("")&&(O=O.replace("",n.displayName)),O}while(1<=E&&0<=P);break}}}finally{re=!1,Error.prepareStackTrace=l}return(n=n?n.displayName||n.name:"")?U(n):""}function se(n){switch(n.tag){case 5:return U(n.type);case 16:return U("Lazy");case 13:return U("Suspense");case 19:return U("SuspenseList");case 0:case 2:case 15:return n=J(n.type,!1),n;case 11:return n=J(n.type.render,!1),n;case 1:return n=J(n.type,!0),n;default:return""}}function ye(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case z:return"Fragment";case A:return"Portal";case Q:return"Profiler";case W:return"StrictMode";case pe:return"Suspense";case X:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case me:return(n.displayName||"Context")+".Consumer";case te:return(n._context.displayName||"Context")+".Provider";case ee:var o=n.render;return n=n.displayName,n||(n=o.displayName||o.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case ge:return o=n.displayName||null,o!==null?o:ye(n.type)||"Memo";case oe:o=n._payload,n=n._init;try{return ye(n(o))}catch{}}return null}function de(n){var o=n.type;switch(n.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=o.render,n=n.displayName||n.name||"",o.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ye(o);case 8:return o===W?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function xe(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Pe(n){var o=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Ve(n){var o=Pe(n)?"checked":"value",l=Object.getOwnPropertyDescriptor(n.constructor.prototype,o),c=""+n[o];if(!n.hasOwnProperty(o)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var h=l.get,m=l.set;return Object.defineProperty(n,o,{configurable:!0,get:function(){return h.call(this)},set:function(E){c=""+E,m.call(this,E)}}),Object.defineProperty(n,o,{enumerable:l.enumerable}),{getValue:function(){return c},setValue:function(E){c=""+E},stopTracking:function(){n._valueTracker=null,delete n[o]}}}}function gt(n){n._valueTracker||(n._valueTracker=Ve(n))}function qt(n){if(!n)return!1;var o=n._valueTracker;if(!o)return!0;var l=o.getValue(),c="";return n&&(c=Pe(n)?n.checked?"true":"false":n.value),n=c,n!==l?(o.setValue(n),!0):!1}function vt(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function gr(n,o){var l=o.checked;return K({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??n._wrapperState.initialChecked})}function sn(n,o){var l=o.defaultValue==null?"":o.defaultValue,c=o.checked!=null?o.checked:o.defaultChecked;l=xe(o.value!=null?o.value:l),n._wrapperState={initialChecked:c,initialValue:l,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function ps(n,o){o=o.checked,o!=null&&C(n,"checked",o,!1)}function ms(n,o){ps(n,o);var l=xe(o.value),c=o.type;if(l!=null)c==="number"?(l===0&&n.value===""||n.value!=l)&&(n.value=""+l):n.value!==""+l&&(n.value=""+l);else if(c==="submit"||c==="reset"){n.removeAttribute("value");return}o.hasOwnProperty("value")?$r(n,o.type,l):o.hasOwnProperty("defaultValue")&&$r(n,o.type,xe(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(n.defaultChecked=!!o.defaultChecked)}function Tn(n,o,l){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var c=o.type;if(!(c!=="submit"&&c!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+n._wrapperState.initialValue,l||o===n.value||(n.value=o),n.defaultValue=o}l=n.name,l!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,l!==""&&(n.name=l)}function $r(n,o,l){(o!=="number"||vt(n.ownerDocument)!==n)&&(l==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+l&&(n.defaultValue=""+l))}var Rn=Array.isArray;function sr(n,o,l,c){if(n=n.options,o){o={};for(var h=0;h"+o.valueOf().toString()+"",o=Zs.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;o.firstChild;)n.appendChild(o.firstChild)}});function Ur(n,o){if(o){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=o;return}}n.textContent=o}var gs={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ba=["Webkit","ms","Moz","O"];Object.keys(gs).forEach(function(n){Ba.forEach(function(o){o=o+n.charAt(0).toUpperCase()+n.substring(1),gs[o]=gs[n]})});function eo(n,o,l){return o==null||typeof o=="boolean"||o===""?"":l||typeof o!="number"||o===0||gs.hasOwnProperty(n)&&gs[n]?(""+o).trim():o+"px"}function on(n,o){n=n.style;for(var l in o)if(o.hasOwnProperty(l)){var c=l.indexOf("--")===0,h=eo(l,o[l],c);l==="float"&&(l="cssFloat"),c?n.setProperty(l,h):n[l]=h}}var Va=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function zr(n,o){if(o){if(Va[n]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(r(137,n));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(r(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(r(61))}if(o.style!=null&&typeof o.style!="object")throw Error(r(62))}}function _i(n,o){if(n.indexOf("-")===-1)return typeof o.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xi=null;function to(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var ro=null,Cn=null,Br=null;function vr(n){if(n=Bi(n)){if(typeof ro!="function")throw Error(r(280));var o=n.stateNode;o&&(o=hl(o),ro(n.stateNode,n.type,o))}}function Wa(n){Cn?Br?Br.push(n):Br=[n]:Cn=n}function Te(){if(Cn){var n=Cn,o=Br;if(Br=Cn=null,vr(n),o)for(n=0;n>>=0,n===0?32:31-(Ox(n)/Ax|0)|0}var Qa=64,Ja=4194304;function Si(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Ya(n,o){var l=n.pendingLanes;if(l===0)return 0;var c=0,h=n.suspendedLanes,m=n.pingedLanes,E=l&268435455;if(E!==0){var P=E&~h;P!==0?c=Si(P):(m&=E,m!==0&&(c=Si(m)))}else E=l&~h,E!==0?c=Si(E):m!==0&&(c=Si(m));if(c===0)return 0;if(o!==0&&o!==c&&(o&h)===0&&(h=c&-c,m=o&-o,h>=m||h===16&&(m&4194240)!==0))return o;if((c&4)!==0&&(c|=l&16),o=n.entangledLanes,o!==0)for(n=n.entanglements,o&=c;0l;l++)o.push(n);return o}function ki(n,o,l){n.pendingLanes|=o,o!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,o=31-wr(o),n[o]=l}function Dx(n,o){var l=n.pendingLanes&~o;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=o,n.mutableReadLanes&=o,n.entangledLanes&=o,o=n.entanglements;var c=n.eventTimes;for(n=n.expirationTimes;0=Ii),um=" ",cm=!1;function dm(n,o){switch(n){case"keyup":return cE.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fm(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var oo=!1;function fE(n,o){switch(n){case"compositionend":return fm(o);case"keypress":return o.which!==32?null:(cm=!0,um);case"textInput":return n=o.data,n===um&&cm?null:n;default:return null}}function hE(n,o){if(oo)return n==="compositionend"||!Pc&&dm(n,o)?(n=nm(),rl=Ec=In=null,oo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1=o)return{node:l,offset:o-n};n=c}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=wm(l)}}function _m(n,o){return n&&o?n===o?!0:n&&n.nodeType===3?!1:o&&o.nodeType===3?_m(n,o.parentNode):"contains"in n?n.contains(o):n.compareDocumentPosition?!!(n.compareDocumentPosition(o)&16):!1:!1}function xm(){for(var n=window,o=vt();o instanceof n.HTMLIFrameElement;){try{var l=typeof o.contentWindow.location.href=="string"}catch{l=!1}if(l)n=o.contentWindow;else break;o=vt(n.document)}return o}function Ac(n){var o=n&&n.nodeName&&n.nodeName.toLowerCase();return o&&(o==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||o==="textarea"||n.contentEditable==="true")}function xE(n){var o=xm(),l=n.focusedElem,c=n.selectionRange;if(o!==l&&l&&l.ownerDocument&&_m(l.ownerDocument.documentElement,l)){if(c!==null&&Ac(l)){if(o=c.start,n=c.end,n===void 0&&(n=o),"selectionStart"in l)l.selectionStart=o,l.selectionEnd=Math.min(n,l.value.length);else if(n=(o=l.ownerDocument||document)&&o.defaultView||window,n.getSelection){n=n.getSelection();var h=l.textContent.length,m=Math.min(c.start,h);c=c.end===void 0?m:Math.min(c.end,h),!n.extend&&m>c&&(h=c,c=m,m=h),h=bm(l,m);var E=bm(l,c);h&&E&&(n.rangeCount!==1||n.anchorNode!==h.node||n.anchorOffset!==h.offset||n.focusNode!==E.node||n.focusOffset!==E.offset)&&(o=o.createRange(),o.setStart(h.node,h.offset),n.removeAllRanges(),m>c?(n.addRange(o),n.extend(E.node,E.offset)):(o.setEnd(E.node,E.offset),n.addRange(o)))}}for(o=[],n=l;n=n.parentNode;)n.nodeType===1&&o.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l=document.documentMode,io=null,Ic=null,$i=null,Nc=!1;function Em(n,o,l){var c=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Nc||io==null||io!==vt(c)||(c=io,"selectionStart"in c&&Ac(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),$i&&Di($i,c)||($i=c,c=cl(Ic,"onSelect"),0fo||(n.current=qc[fo],qc[fo]=null,fo--)}function We(n,o){fo++,qc[fo]=n.current,n.current=o}var $n={},xt=Dn($n),Mt=Dn(!1),ws=$n;function ho(n,o){var l=n.type.contextTypes;if(!l)return $n;var c=n.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===o)return c.__reactInternalMemoizedMaskedChildContext;var h={},m;for(m in l)h[m]=o[m];return c&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=o,n.__reactInternalMemoizedMaskedChildContext=h),h}function Ft(n){return n=n.childContextTypes,n!=null}function pl(){Ke(Mt),Ke(xt)}function Mm(n,o,l){if(xt.current!==$n)throw Error(r(168));We(xt,o),We(Mt,l)}function Fm(n,o,l){var c=n.stateNode;if(o=o.childContextTypes,typeof c.getChildContext!="function")return l;c=c.getChildContext();for(var h in c)if(!(h in o))throw Error(r(108,de(n)||"Unknown",h));return K({},l,c)}function ml(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||$n,ws=xt.current,We(xt,n),We(Mt,Mt.current),!0}function Um(n,o,l){var c=n.stateNode;if(!c)throw Error(r(169));l?(n=Fm(n,o,ws),c.__reactInternalMemoizedMergedChildContext=n,Ke(Mt),Ke(xt),We(xt,n)):Ke(Mt),We(Mt,l)}var ln=null,gl=!1,Kc=!1;function zm(n){ln===null?ln=[n]:ln.push(n)}function NE(n){gl=!0,zm(n)}function Mn(){if(!Kc&&ln!==null){Kc=!0;var n=0,o=Ue;try{var l=ln;for(Ue=1;n>=E,h-=E,un=1<<32-wr(o)+h|l<ke?(mt=be,be=null):mt=be.sibling;var $e=H($,be,M[ke],Y);if($e===null){be===null&&(be=mt);break}n&&be&&$e.alternate===null&&o($,be),I=m($e,I,ke),we===null?fe=$e:we.sibling=$e,we=$e,be=mt}if(ke===M.length)return l($,be),Qe&&_s($,ke),fe;if(be===null){for(;keke?(mt=be,be=null):mt=be.sibling;var Kn=H($,be,$e.value,Y);if(Kn===null){be===null&&(be=mt);break}n&&be&&Kn.alternate===null&&o($,be),I=m(Kn,I,ke),we===null?fe=Kn:we.sibling=Kn,we=Kn,be=mt}if($e.done)return l($,be),Qe&&_s($,ke),fe;if(be===null){for(;!$e.done;ke++,$e=M.next())$e=G($,$e.value,Y),$e!==null&&(I=m($e,I,ke),we===null?fe=$e:we.sibling=$e,we=$e);return Qe&&_s($,ke),fe}for(be=c($,be);!$e.done;ke++,$e=M.next())$e=ne(be,$,ke,$e.value,Y),$e!==null&&(n&&$e.alternate!==null&&be.delete($e.key===null?ke:$e.key),I=m($e,I,ke),we===null?fe=$e:we.sibling=$e,we=$e);return n&&be.forEach(function(pS){return o($,pS)}),Qe&&_s($,ke),fe}function st($,I,M,Y){if(typeof M=="object"&&M!==null&&M.type===z&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case D:e:{for(var fe=M.key,we=I;we!==null;){if(we.key===fe){if(fe=M.type,fe===z){if(we.tag===7){l($,we.sibling),I=h(we,M.props.children),I.return=$,$=I;break e}}else if(we.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===oe&&Km(fe)===we.type){l($,we.sibling),I=h(we,M.props),I.ref=Vi($,we,M),I.return=$,$=I;break e}l($,we);break}else o($,we);we=we.sibling}M.type===z?(I=Ps(M.props.children,$.mode,Y,M.key),I.return=$,$=I):(Y=Wl(M.type,M.key,M.props,null,$.mode,Y),Y.ref=Vi($,I,M),Y.return=$,$=Y)}return E($);case A:e:{for(we=M.key;I!==null;){if(I.key===we)if(I.tag===4&&I.stateNode.containerInfo===M.containerInfo&&I.stateNode.implementation===M.implementation){l($,I.sibling),I=h(I,M.children||[]),I.return=$,$=I;break e}else{l($,I);break}else o($,I);I=I.sibling}I=Wd(M,$.mode,Y),I.return=$,$=I}return E($);case oe:return we=M._init,st($,I,we(M._payload),Y)}if(Rn(M))return le($,I,M,Y);if(V(M))return ce($,I,M,Y);bl($,M)}return typeof M=="string"&&M!==""||typeof M=="number"?(M=""+M,I!==null&&I.tag===6?(l($,I.sibling),I=h(I,M),I.return=$,$=I):(l($,I),I=Vd(M,$.mode,Y),I.return=$,$=I),E($)):l($,I)}return st}var vo=Gm(!0),Qm=Gm(!1),_l=Dn(null),xl=null,yo=null,Zc=null;function ed(){Zc=yo=xl=null}function td(n){var o=_l.current;Ke(_l),n._currentValue=o}function rd(n,o,l){for(;n!==null;){var c=n.alternate;if((n.childLanes&o)!==o?(n.childLanes|=o,c!==null&&(c.childLanes|=o)):c!==null&&(c.childLanes&o)!==o&&(c.childLanes|=o),n===l)break;n=n.return}}function wo(n,o){xl=n,Zc=yo=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&o)!==0&&(Ut=!0),n.firstContext=null)}function ar(n){var o=n._currentValue;if(Zc!==n)if(n={context:n,memoizedValue:o,next:null},yo===null){if(xl===null)throw Error(r(308));yo=n,xl.dependencies={lanes:0,firstContext:n}}else yo=yo.next=n;return o}var xs=null;function nd(n){xs===null?xs=[n]:xs.push(n)}function Jm(n,o,l,c){var h=o.interleaved;return h===null?(l.next=l,nd(o)):(l.next=h.next,h.next=l),o.interleaved=l,dn(n,c)}function dn(n,o){n.lanes|=o;var l=n.alternate;for(l!==null&&(l.lanes|=o),l=n,n=n.return;n!==null;)n.childLanes|=o,l=n.alternate,l!==null&&(l.childLanes|=o),l=n,n=n.return;return l.tag===3?l.stateNode:null}var Fn=!1;function sd(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ym(n,o){n=n.updateQueue,o.updateQueue===n&&(o.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function fn(n,o){return{eventTime:n,lane:o,tag:0,payload:null,callback:null,next:null}}function Un(n,o,l){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(De&2)!==0){var h=c.pending;return h===null?o.next=o:(o.next=h.next,h.next=o),c.pending=o,dn(n,l)}return h=c.interleaved,h===null?(o.next=o,nd(c)):(o.next=h.next,h.next=o),c.interleaved=o,dn(n,l)}function El(n,o,l){if(o=o.updateQueue,o!==null&&(o=o.shared,(l&4194240)!==0)){var c=o.lanes;c&=n.pendingLanes,l|=c,o.lanes=l,yc(n,l)}}function Xm(n,o){var l=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,l===c)){var h=null,m=null;if(l=l.firstBaseUpdate,l!==null){do{var E={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};m===null?h=m=E:m=m.next=E,l=l.next}while(l!==null);m===null?h=m=o:m=m.next=o}else h=m=o;l={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:m,shared:c.shared,effects:c.effects},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=o:n.next=o,l.lastBaseUpdate=o}function Sl(n,o,l,c){var h=n.updateQueue;Fn=!1;var m=h.firstBaseUpdate,E=h.lastBaseUpdate,P=h.shared.pending;if(P!==null){h.shared.pending=null;var O=P,F=O.next;O.next=null,E===null?m=F:E.next=F,E=O;var q=n.alternate;q!==null&&(q=q.updateQueue,P=q.lastBaseUpdate,P!==E&&(P===null?q.firstBaseUpdate=F:P.next=F,q.lastBaseUpdate=O))}if(m!==null){var G=h.baseState;E=0,q=F=O=null,P=m;do{var H=P.lane,ne=P.eventTime;if((c&H)===H){q!==null&&(q=q.next={eventTime:ne,lane:0,tag:P.tag,payload:P.payload,callback:P.callback,next:null});e:{var le=n,ce=P;switch(H=o,ne=l,ce.tag){case 1:if(le=ce.payload,typeof le=="function"){G=le.call(ne,G,H);break e}G=le;break e;case 3:le.flags=le.flags&-65537|128;case 0:if(le=ce.payload,H=typeof le=="function"?le.call(ne,G,H):le,H==null)break e;G=K({},G,H);break e;case 2:Fn=!0}}P.callback!==null&&P.lane!==0&&(n.flags|=64,H=h.effects,H===null?h.effects=[P]:H.push(P))}else ne={eventTime:ne,lane:H,tag:P.tag,payload:P.payload,callback:P.callback,next:null},q===null?(F=q=ne,O=G):q=q.next=ne,E|=H;if(P=P.next,P===null){if(P=h.shared.pending,P===null)break;H=P,P=H.next,H.next=null,h.lastBaseUpdate=H,h.shared.pending=null}}while(!0);if(q===null&&(O=G),h.baseState=O,h.firstBaseUpdate=F,h.lastBaseUpdate=q,o=h.shared.interleaved,o!==null){h=o;do E|=h.lane,h=h.next;while(h!==o)}else m===null&&(h.shared.lanes=0);ks|=E,n.lanes=E,n.memoizedState=G}}function Zm(n,o,l){if(n=o.effects,o.effects=null,n!==null)for(o=0;ol?l:4,n(!0);var c=ud.transition;ud.transition={};try{n(!1),o()}finally{Ue=l,ud.transition=c}}function yg(){return lr().memoizedState}function ME(n,o,l){var c=Wn(n);if(l={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null},wg(n))bg(o,l);else if(l=Jm(n,o,l,c),l!==null){var h=It();kr(l,n,c,h),_g(l,o,c)}}function FE(n,o,l){var c=Wn(n),h={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null};if(wg(n))bg(o,h);else{var m=n.alternate;if(n.lanes===0&&(m===null||m.lanes===0)&&(m=o.lastRenderedReducer,m!==null))try{var E=o.lastRenderedState,P=m(E,l);if(h.hasEagerState=!0,h.eagerState=P,br(P,E)){var O=o.interleaved;O===null?(h.next=h,nd(o)):(h.next=O.next,O.next=h),o.interleaved=h;return}}catch{}finally{}l=Jm(n,o,h,c),l!==null&&(h=It(),kr(l,n,c,h),_g(l,o,c))}}function wg(n){var o=n.alternate;return n===Ze||o!==null&&o===Ze}function bg(n,o){Ki=Rl=!0;var l=n.pending;l===null?o.next=o:(o.next=l.next,l.next=o),n.pending=o}function _g(n,o,l){if((l&4194240)!==0){var c=o.lanes;c&=n.pendingLanes,l|=c,o.lanes=l,yc(n,l)}}var jl={readContext:ar,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useInsertionEffect:Et,useLayoutEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useMutableSource:Et,useSyncExternalStore:Et,useId:Et,unstable_isNewReconciler:!1},UE={readContext:ar,useCallback:function(n,o){return Kr().memoizedState=[n,o===void 0?null:o],n},useContext:ar,useEffect:cg,useImperativeHandle:function(n,o,l){return l=l!=null?l.concat([n]):null,Cl(4194308,4,hg.bind(null,o,n),l)},useLayoutEffect:function(n,o){return Cl(4194308,4,n,o)},useInsertionEffect:function(n,o){return Cl(4,2,n,o)},useMemo:function(n,o){var l=Kr();return o=o===void 0?null:o,n=n(),l.memoizedState=[n,o],n},useReducer:function(n,o,l){var c=Kr();return o=l!==void 0?l(o):o,c.memoizedState=c.baseState=o,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:o},c.queue=n,n=n.dispatch=ME.bind(null,Ze,n),[c.memoizedState,n]},useRef:function(n){var o=Kr();return n={current:n},o.memoizedState=n},useState:lg,useDebugValue:gd,useDeferredValue:function(n){return Kr().memoizedState=n},useTransition:function(){var n=lg(!1),o=n[0];return n=$E.bind(null,n[1]),Kr().memoizedState=n,[o,n]},useMutableSource:function(){},useSyncExternalStore:function(n,o,l){var c=Ze,h=Kr();if(Qe){if(l===void 0)throw Error(r(407));l=l()}else{if(l=o(),pt===null)throw Error(r(349));(Ss&30)!==0||ng(c,o,l)}h.memoizedState=l;var m={value:l,getSnapshot:o};return h.queue=m,cg(og.bind(null,c,m,n),[n]),c.flags|=2048,Ji(9,sg.bind(null,c,m,l,o),void 0,null),l},useId:function(){var n=Kr(),o=pt.identifierPrefix;if(Qe){var l=cn,c=un;l=(c&~(1<<32-wr(c)-1)).toString(32)+l,o=":"+o+"R"+l,l=Gi++,0<\/script>",n=n.removeChild(n.firstChild)):typeof c.is=="string"?n=E.createElement(l,{is:c.is}):(n=E.createElement(l),l==="select"&&(E=n,c.multiple?E.multiple=!0:c.size&&(E.size=c.size))):n=E.createElementNS(n,l),n[Hr]=o,n[zi]=c,zg(n,o,!1,!1),o.stateNode=n;e:{switch(E=_i(l,c),l){case"dialog":qe("cancel",n),qe("close",n),h=c;break;case"iframe":case"object":case"embed":qe("load",n),h=c;break;case"video":case"audio":for(h=0;hSo&&(o.flags|=128,c=!0,Yi(m,!1),o.lanes=4194304)}else{if(!c)if(n=kl(E),n!==null){if(o.flags|=128,c=!0,l=n.updateQueue,l!==null&&(o.updateQueue=l,o.flags|=4),Yi(m,!0),m.tail===null&&m.tailMode==="hidden"&&!E.alternate&&!Qe)return St(o),null}else 2*nt()-m.renderingStartTime>So&&l!==1073741824&&(o.flags|=128,c=!0,Yi(m,!1),o.lanes=4194304);m.isBackwards?(E.sibling=o.child,o.child=E):(l=m.last,l!==null?l.sibling=E:o.child=E,m.last=E)}return m.tail!==null?(o=m.tail,m.rendering=o,m.tail=o.sibling,m.renderingStartTime=nt(),o.sibling=null,l=Xe.current,We(Xe,c?l&1|2:l&1),o):(St(o),null);case 22:case 23:return Ud(),c=o.memoizedState!==null,n!==null&&n.memoizedState!==null!==c&&(o.flags|=8192),c&&(o.mode&1)!==0?(Jt&1073741824)!==0&&(St(o),o.subtreeFlags&6&&(o.flags|=8192)):St(o),null;case 24:return null;case 25:return null}throw Error(r(156,o.tag))}function GE(n,o){switch(Qc(o),o.tag){case 1:return Ft(o.type)&&pl(),n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 3:return bo(),Ke(Mt),Ke(xt),ld(),n=o.flags,(n&65536)!==0&&(n&128)===0?(o.flags=n&-65537|128,o):null;case 5:return id(o),null;case 13:if(Ke(Xe),n=o.memoizedState,n!==null&&n.dehydrated!==null){if(o.alternate===null)throw Error(r(340));go()}return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 19:return Ke(Xe),null;case 4:return bo(),null;case 10:return td(o.type._context),null;case 22:case 23:return Ud(),null;case 24:return null;default:return null}}var Nl=!1,kt=!1,QE=typeof WeakSet=="function"?WeakSet:Set,ie=null;function xo(n,o){var l=n.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(c){tt(n,o,c)}else l.current=null}function Cd(n,o,l){try{l()}catch(c){tt(n,o,c)}}var Wg=!1;function JE(n,o){if(Uc=el,n=xm(),Ac(n)){if("selectionStart"in n)var l={start:n.selectionStart,end:n.selectionEnd};else e:{l=(l=n.ownerDocument)&&l.defaultView||window;var c=l.getSelection&&l.getSelection();if(c&&c.rangeCount!==0){l=c.anchorNode;var h=c.anchorOffset,m=c.focusNode;c=c.focusOffset;try{l.nodeType,m.nodeType}catch{l=null;break e}var E=0,P=-1,O=-1,F=0,q=0,G=n,H=null;t:for(;;){for(var ne;G!==l||h!==0&&G.nodeType!==3||(P=E+h),G!==m||c!==0&&G.nodeType!==3||(O=E+c),G.nodeType===3&&(E+=G.nodeValue.length),(ne=G.firstChild)!==null;)H=G,G=ne;for(;;){if(G===n)break t;if(H===l&&++F===h&&(P=E),H===m&&++q===c&&(O=E),(ne=G.nextSibling)!==null)break;G=H,H=G.parentNode}G=ne}l=P===-1||O===-1?null:{start:P,end:O}}else l=null}l=l||{start:0,end:0}}else l=null;for(zc={focusedElem:n,selectionRange:l},el=!1,ie=o;ie!==null;)if(o=ie,n=o.child,(o.subtreeFlags&1028)!==0&&n!==null)n.return=o,ie=n;else for(;ie!==null;){o=ie;try{var le=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(le!==null){var ce=le.memoizedProps,st=le.memoizedState,$=o.stateNode,I=$.getSnapshotBeforeUpdate(o.elementType===o.type?ce:xr(o.type,ce),st);$.__reactInternalSnapshotBeforeUpdate=I}break;case 3:var M=o.stateNode.containerInfo;M.nodeType===1?M.textContent="":M.nodeType===9&&M.documentElement&&M.removeChild(M.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Y){tt(o,o.return,Y)}if(n=o.sibling,n!==null){n.return=o.return,ie=n;break}ie=o.return}return le=Wg,Wg=!1,le}function Xi(n,o,l){var c=o.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var h=c=c.next;do{if((h.tag&n)===n){var m=h.destroy;h.destroy=void 0,m!==void 0&&Cd(o,l,m)}h=h.next}while(h!==c)}}function Ll(n,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var l=o=o.next;do{if((l.tag&n)===n){var c=l.create;l.destroy=c()}l=l.next}while(l!==o)}}function Pd(n){var o=n.ref;if(o!==null){var l=n.stateNode;switch(n.tag){case 5:n=l;break;default:n=l}typeof o=="function"?o(n):o.current=n}}function Hg(n){var o=n.alternate;o!==null&&(n.alternate=null,Hg(o)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(o=n.stateNode,o!==null&&(delete o[Hr],delete o[zi],delete o[Hc],delete o[AE],delete o[IE])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function qg(n){return n.tag===5||n.tag===3||n.tag===4}function Kg(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||qg(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function jd(n,o,l){var c=n.tag;if(c===5||c===6)n=n.stateNode,o?l.nodeType===8?l.parentNode.insertBefore(n,o):l.insertBefore(n,o):(l.nodeType===8?(o=l.parentNode,o.insertBefore(n,l)):(o=l,o.appendChild(n)),l=l._reactRootContainer,l!=null||o.onclick!==null||(o.onclick=fl));else if(c!==4&&(n=n.child,n!==null))for(jd(n,o,l),n=n.sibling;n!==null;)jd(n,o,l),n=n.sibling}function Od(n,o,l){var c=n.tag;if(c===5||c===6)n=n.stateNode,o?l.insertBefore(n,o):l.appendChild(n);else if(c!==4&&(n=n.child,n!==null))for(Od(n,o,l),n=n.sibling;n!==null;)Od(n,o,l),n=n.sibling}var wt=null,Er=!1;function zn(n,o,l){for(l=l.child;l!==null;)Gg(n,o,l),l=l.sibling}function Gg(n,o,l){if(Wr&&typeof Wr.onCommitFiberUnmount=="function")try{Wr.onCommitFiberUnmount(Ga,l)}catch{}switch(l.tag){case 5:kt||xo(l,o);case 6:var c=wt,h=Er;wt=null,zn(n,o,l),wt=c,Er=h,wt!==null&&(Er?(n=wt,l=l.stateNode,n.nodeType===8?n.parentNode.removeChild(l):n.removeChild(l)):wt.removeChild(l.stateNode));break;case 18:wt!==null&&(Er?(n=wt,l=l.stateNode,n.nodeType===8?Wc(n.parentNode,l):n.nodeType===1&&Wc(n,l),ji(n)):Wc(wt,l.stateNode));break;case 4:c=wt,h=Er,wt=l.stateNode.containerInfo,Er=!0,zn(n,o,l),wt=c,Er=h;break;case 0:case 11:case 14:case 15:if(!kt&&(c=l.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){h=c=c.next;do{var m=h,E=m.destroy;m=m.tag,E!==void 0&&((m&2)!==0||(m&4)!==0)&&Cd(l,o,E),h=h.next}while(h!==c)}zn(n,o,l);break;case 1:if(!kt&&(xo(l,o),c=l.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=l.memoizedProps,c.state=l.memoizedState,c.componentWillUnmount()}catch(P){tt(l,o,P)}zn(n,o,l);break;case 21:zn(n,o,l);break;case 22:l.mode&1?(kt=(c=kt)||l.memoizedState!==null,zn(n,o,l),kt=c):zn(n,o,l);break;default:zn(n,o,l)}}function Qg(n){var o=n.updateQueue;if(o!==null){n.updateQueue=null;var l=n.stateNode;l===null&&(l=n.stateNode=new QE),o.forEach(function(c){var h=oS.bind(null,n,c);l.has(c)||(l.add(c),c.then(h,h))})}}function Sr(n,o){var l=o.deletions;if(l!==null)for(var c=0;ch&&(h=E),c&=~m}if(c=h,c=nt()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*XE(c/1960))-c,10n?16:n,Vn===null)var c=!1;else{if(n=Vn,Vn=null,Ul=0,(De&6)!==0)throw Error(r(331));var h=De;for(De|=4,ie=n.current;ie!==null;){var m=ie,E=m.child;if((ie.flags&16)!==0){var P=m.deletions;if(P!==null){for(var O=0;Ont()-Nd?Rs(n,0):Id|=l),Bt(n,o)}function lv(n,o){o===0&&((n.mode&1)===0?o=1:(o=Ja,Ja<<=1,(Ja&130023424)===0&&(Ja=4194304)));var l=It();n=dn(n,o),n!==null&&(ki(n,o,l),Bt(n,l))}function sS(n){var o=n.memoizedState,l=0;o!==null&&(l=o.retryLane),lv(n,l)}function oS(n,o){var l=0;switch(n.tag){case 13:var c=n.stateNode,h=n.memoizedState;h!==null&&(l=h.retryLane);break;case 19:c=n.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(o),lv(n,l)}var uv;uv=function(n,o,l){if(n!==null)if(n.memoizedProps!==o.pendingProps||Mt.current)Ut=!0;else{if((n.lanes&l)===0&&(o.flags&128)===0)return Ut=!1,qE(n,o,l);Ut=(n.flags&131072)!==0}else Ut=!1,Qe&&(o.flags&1048576)!==0&&Bm(o,yl,o.index);switch(o.lanes=0,o.tag){case 2:var c=o.type;Il(n,o),n=o.pendingProps;var h=ho(o,xt.current);wo(o,l),h=dd(null,o,c,n,h,l);var m=fd();return o.flags|=1,typeof h=="object"&&h!==null&&typeof h.render=="function"&&h.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Ft(c)?(m=!0,ml(o)):m=!1,o.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,sd(o),h.updater=Ol,o.stateNode=h,h._reactInternals=o,yd(o,c,n,l),o=xd(null,o,c,!0,m,l)):(o.tag=0,Qe&&m&&Gc(o),At(null,o,h,l),o=o.child),o;case 16:c=o.elementType;e:{switch(Il(n,o),n=o.pendingProps,h=c._init,c=h(c._payload),o.type=c,h=o.tag=aS(c),n=xr(c,n),h){case 0:o=_d(null,o,c,n,l);break e;case 1:o=Lg(null,o,c,n,l);break e;case 11:o=jg(null,o,c,n,l);break e;case 14:o=Og(null,o,c,xr(c.type,n),l);break e}throw Error(r(306,c,""))}return o;case 0:return c=o.type,h=o.pendingProps,h=o.elementType===c?h:xr(c,h),_d(n,o,c,h,l);case 1:return c=o.type,h=o.pendingProps,h=o.elementType===c?h:xr(c,h),Lg(n,o,c,h,l);case 3:e:{if(Dg(o),n===null)throw Error(r(387));c=o.pendingProps,m=o.memoizedState,h=m.element,Ym(n,o),Sl(o,c,null,l);var E=o.memoizedState;if(c=E.element,m.isDehydrated)if(m={element:c,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},o.updateQueue.baseState=m,o.memoizedState=m,o.flags&256){h=_o(Error(r(423)),o),o=$g(n,o,c,l,h);break e}else if(c!==h){h=_o(Error(r(424)),o),o=$g(n,o,c,l,h);break e}else for(Qt=Ln(o.stateNode.containerInfo.firstChild),Gt=o,Qe=!0,_r=null,l=Qm(o,null,c,l),o.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(go(),c===h){o=hn(n,o,l);break e}At(n,o,c,l)}o=o.child}return o;case 5:return eg(o),n===null&&Yc(o),c=o.type,h=o.pendingProps,m=n!==null?n.memoizedProps:null,E=h.children,Bc(c,h)?E=null:m!==null&&Bc(c,m)&&(o.flags|=32),Ng(n,o),At(n,o,E,l),o.child;case 6:return n===null&&Yc(o),null;case 13:return Mg(n,o,l);case 4:return od(o,o.stateNode.containerInfo),c=o.pendingProps,n===null?o.child=vo(o,null,c,l):At(n,o,c,l),o.child;case 11:return c=o.type,h=o.pendingProps,h=o.elementType===c?h:xr(c,h),jg(n,o,c,h,l);case 7:return At(n,o,o.pendingProps,l),o.child;case 8:return At(n,o,o.pendingProps.children,l),o.child;case 12:return At(n,o,o.pendingProps.children,l),o.child;case 10:e:{if(c=o.type._context,h=o.pendingProps,m=o.memoizedProps,E=h.value,We(_l,c._currentValue),c._currentValue=E,m!==null)if(br(m.value,E)){if(m.children===h.children&&!Mt.current){o=hn(n,o,l);break e}}else for(m=o.child,m!==null&&(m.return=o);m!==null;){var P=m.dependencies;if(P!==null){E=m.child;for(var O=P.firstContext;O!==null;){if(O.context===c){if(m.tag===1){O=fn(-1,l&-l),O.tag=2;var F=m.updateQueue;if(F!==null){F=F.shared;var q=F.pending;q===null?O.next=O:(O.next=q.next,q.next=O),F.pending=O}}m.lanes|=l,O=m.alternate,O!==null&&(O.lanes|=l),rd(m.return,l,o),P.lanes|=l;break}O=O.next}}else if(m.tag===10)E=m.type===o.type?null:m.child;else if(m.tag===18){if(E=m.return,E===null)throw Error(r(341));E.lanes|=l,P=E.alternate,P!==null&&(P.lanes|=l),rd(E,l,o),E=m.sibling}else E=m.child;if(E!==null)E.return=m;else for(E=m;E!==null;){if(E===o){E=null;break}if(m=E.sibling,m!==null){m.return=E.return,E=m;break}E=E.return}m=E}At(n,o,h.children,l),o=o.child}return o;case 9:return h=o.type,c=o.pendingProps.children,wo(o,l),h=ar(h),c=c(h),o.flags|=1,At(n,o,c,l),o.child;case 14:return c=o.type,h=xr(c,o.pendingProps),h=xr(c.type,h),Og(n,o,c,h,l);case 15:return Ag(n,o,o.type,o.pendingProps,l);case 17:return c=o.type,h=o.pendingProps,h=o.elementType===c?h:xr(c,h),Il(n,o),o.tag=1,Ft(c)?(n=!0,ml(o)):n=!1,wo(o,l),Eg(o,c,h),yd(o,c,h,l),xd(null,o,c,!0,n,l);case 19:return Ug(n,o,l);case 22:return Ig(n,o,l)}throw Error(r(156,o.tag))};function cv(n,o){return Vp(n,o)}function iS(n,o,l,c){this.tag=n,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function cr(n,o,l,c){return new iS(n,o,l,c)}function Bd(n){return n=n.prototype,!(!n||!n.isReactComponent)}function aS(n){if(typeof n=="function")return Bd(n)?1:0;if(n!=null){if(n=n.$$typeof,n===ee)return 11;if(n===ge)return 14}return 2}function qn(n,o){var l=n.alternate;return l===null?(l=cr(n.tag,o,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=o,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&14680064,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,o=n.dependencies,l.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l}function Wl(n,o,l,c,h,m){var E=2;if(c=n,typeof n=="function")Bd(n)&&(E=1);else if(typeof n=="string")E=5;else e:switch(n){case z:return Ps(l.children,h,m,o);case W:E=8,h|=8;break;case Q:return n=cr(12,l,o,h|2),n.elementType=Q,n.lanes=m,n;case pe:return n=cr(13,l,o,h),n.elementType=pe,n.lanes=m,n;case X:return n=cr(19,l,o,h),n.elementType=X,n.lanes=m,n;case ue:return Hl(l,h,m,o);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case te:E=10;break e;case me:E=9;break e;case ee:E=11;break e;case ge:E=14;break e;case oe:E=16,c=null;break e}throw Error(r(130,n==null?n:typeof n,""))}return o=cr(E,l,o,h),o.elementType=n,o.type=c,o.lanes=m,o}function Ps(n,o,l,c){return n=cr(7,n,c,o),n.lanes=l,n}function Hl(n,o,l,c){return n=cr(22,n,c,o),n.elementType=ue,n.lanes=l,n.stateNode={isHidden:!1},n}function Vd(n,o,l){return n=cr(6,n,null,o),n.lanes=l,n}function Wd(n,o,l){return o=cr(4,n.children!==null?n.children:[],n.key,o),o.lanes=l,o.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},o}function lS(n,o,l,c,h){this.tag=o,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=vc(0),this.expirationTimes=vc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vc(0),this.identifierPrefix=c,this.onRecoverableError=h,this.mutableSourceEagerHydrationData=null}function Hd(n,o,l,c,h,m,E,P,O){return n=new lS(n,o,l,P,O),o===1?(o=1,m===!0&&(o|=8)):o=0,m=cr(3,null,null,o),n.current=m,m.stateNode=n,m.memoizedState={element:c,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},sd(m),n}function uS(n,o,l){var c=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Xd.exports=ES(),Xd.exports}var kv;function SS(){if(kv)return eu;kv=1;var t=Aw();return eu.createRoot=t.createRoot,eu.hydrateRoot=t.hydrateRoot,eu}var kS=SS(),b=Lh();const Z=Nh(b),Iw=Ow({__proto__:null,default:Z},[b]);var Wu=Aw();const Nw=Nh(Wu);var TS=t=>{switch(t){case"success":return PS;case"info":return OS;case"warning":return jS;case"error":return AS;default:return null}},RS=Array(12).fill(0),CS=({visible:t,className:e})=>Z.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},Z.createElement("div",{className:"sonner-spinner"},RS.map((r,s)=>Z.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),PS=Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Z.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),jS=Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Z.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),OS=Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Z.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),AS=Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Z.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),IS=Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Z.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Z.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),NS=()=>{let[t,e]=Z.useState(document.hidden);return Z.useEffect(()=>{let r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t},Lf=1,LS=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:r,...s}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:Lf++,a=this.toasts.find(d=>d.id===i),u=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),a?this.toasts=this.toasts.map(d=>d.id===i?(this.publish({...d,...t,id:i,title:r}),{...d,...t,id:i,dismissible:u,title:r}):d):this.addToast({title:r,...s,dismissible:u,id:i}),i},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(r=>r({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let r;e.loading!==void 0&&(r=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let s=t instanceof Promise?t:t(),i=r!==void 0,a,u=s.then(async f=>{if(a=["resolve",f],Z.isValidElement(f))i=!1,this.create({id:r,type:"default",message:f});else if($S(f)&&!f.ok){i=!1;let p=typeof e.error=="function"?await e.error(`HTTP error! status: ${f.status}`):e.error,g=typeof e.description=="function"?await e.description(`HTTP error! status: ${f.status}`):e.description;this.create({id:r,type:"error",message:p,description:g})}else if(e.success!==void 0){i=!1;let p=typeof e.success=="function"?await e.success(f):e.success,g=typeof e.description=="function"?await e.description(f):e.description;this.create({id:r,type:"success",message:p,description:g})}}).catch(async f=>{if(a=["reject",f],e.error!==void 0){i=!1;let p=typeof e.error=="function"?await e.error(f):e.error,g=typeof e.description=="function"?await e.description(f):e.description;this.create({id:r,type:"error",message:p,description:g})}}).finally(()=>{var f;i&&(this.dismiss(r),r=void 0),(f=e.finally)==null||f.call(e)}),d=()=>new Promise((f,p)=>u.then(()=>a[0]==="reject"?p(a[1]):f(a[1])).catch(p));return typeof r!="string"&&typeof r!="number"?{unwrap:d}:Object.assign(r,{unwrap:d})},this.custom=(t,e)=>{let r=(e==null?void 0:e.id)||Lf++;return this.create({jsx:t(r),id:r,...e}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Ht=new LS,DS=(t,e)=>{let r=(e==null?void 0:e.id)||Lf++;return Ht.addToast({title:t,...e,id:r}),r},$S=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",MS=DS,FS=()=>Ht.toasts,US=()=>Ht.getActiveToasts(),Je=Object.assign(MS,{success:Ht.success,info:Ht.info,warning:Ht.warning,error:Ht.error,custom:Ht.custom,message:Ht.message,promise:Ht.promise,dismiss:Ht.dismiss,loading:Ht.loading},{getHistory:FS,getToasts:US});function zS(t,{insertAt:e}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",e==="top"&&r.firstChild?r.insertBefore(s,r.firstChild):r.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}zS(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} `);function tu(t){return t.label!==void 0}var BS=3,VS="32px",WS="16px",Tv=4e3,HS=356,qS=14,KS=20,GS=200;function Tr(...t){return t.filter(Boolean).join(" ")}function QS(t){let[e,r]=t.split("-"),s=[];return e&&s.push(e),r&&s.push(r),s}var JS=t=>{var e,r,s,i,a,u,d,f,p,g,y;let{invert:_,toast:v,unstyled:k,interacting:S,setHeights:x,visibleToasts:T,heights:R,index:C,toasts:j,expanded:D,removeToast:A,defaultRichColors:z,closeButton:W,style:Q,cancelButtonStyle:te,actionButtonStyle:me,className:ee="",descriptionClassName:pe="",duration:X,position:ge,gap:oe,loadingIcon:ue,expandByDefault:B,classNames:V,icons:K,closeButtonAriaLabel:N="Close toast",pauseWhenPageIsHidden:U}=t,[re,J]=Z.useState(null),[se,ye]=Z.useState(null),[de,xe]=Z.useState(!1),[Pe,Ve]=Z.useState(!1),[gt,qt]=Z.useState(!1),[vt,gr]=Z.useState(!1),[sn,ps]=Z.useState(!1),[ms,Tn]=Z.useState(0),[$r,Rn]=Z.useState(0),sr=Z.useRef(v.duration||X||Tv),Xs=Z.useRef(null),Mr=Z.useRef(null),Fa=C===0,Ua=C+1<=T,jt=v.type,Fr=v.dismissible!==!1,Zs=v.className||"",za=v.descriptionClassName||"",Ur=Z.useMemo(()=>R.findIndex(Te=>Te.toastId===v.id)||0,[R,v.id]),gs=Z.useMemo(()=>{var Te;return(Te=v.closeButton)!=null?Te:W},[v.closeButton,W]),Ba=Z.useMemo(()=>v.duration||X||Tv,[v.duration,X]),eo=Z.useRef(0),on=Z.useRef(0),Va=Z.useRef(0),zr=Z.useRef(null),[_i,xi]=ge.split("-"),to=Z.useMemo(()=>R.reduce((Te,Me,Be)=>Be>=Ur?Te:Te+Me.height,0),[R,Ur]),ro=NS(),Cn=v.invert||_,Br=jt==="loading";on.current=Z.useMemo(()=>Ur*oe+to,[Ur,to]),Z.useEffect(()=>{sr.current=Ba},[Ba]),Z.useEffect(()=>{xe(!0)},[]),Z.useEffect(()=>{let Te=Mr.current;if(Te){let Me=Te.getBoundingClientRect().height;return Rn(Me),x(Be=>[{toastId:v.id,height:Me,position:v.position},...Be]),()=>x(Be=>Be.filter(Ot=>Ot.toastId!==v.id))}},[x,v.id]),Z.useLayoutEffect(()=>{if(!de)return;let Te=Mr.current,Me=Te.style.height;Te.style.height="auto";let Be=Te.getBoundingClientRect().height;Te.style.height=Me,Rn(Be),x(Ot=>Ot.find(Dt=>Dt.toastId===v.id)?Ot.map(Dt=>Dt.toastId===v.id?{...Dt,height:Be}:Dt):[{toastId:v.id,height:Be,position:v.position},...Ot])},[de,v.title,v.description,x,v.id]);let vr=Z.useCallback(()=>{Ve(!0),Tn(on.current),x(Te=>Te.filter(Me=>Me.toastId!==v.id)),setTimeout(()=>{A(v)},GS)},[v,A,x,on]);Z.useEffect(()=>{if(v.promise&&jt==="loading"||v.duration===1/0||v.type==="loading")return;let Te;return D||S||U&&ro?(()=>{if(Va.current{var Me;(Me=v.onAutoClose)==null||Me.call(v,v),vr()},sr.current)),()=>clearTimeout(Te)},[D,S,v,jt,U,ro,vr]),Z.useEffect(()=>{v.delete&&vr()},[vr,v.delete]);function Wa(){var Te,Me,Be;return K!=null&&K.loading?Z.createElement("div",{className:Tr(V==null?void 0:V.loader,(Te=v==null?void 0:v.classNames)==null?void 0:Te.loader,"sonner-loader"),"data-visible":jt==="loading"},K.loading):ue?Z.createElement("div",{className:Tr(V==null?void 0:V.loader,(Me=v==null?void 0:v.classNames)==null?void 0:Me.loader,"sonner-loader"),"data-visible":jt==="loading"},ue):Z.createElement(CS,{className:Tr(V==null?void 0:V.loader,(Be=v==null?void 0:v.classNames)==null?void 0:Be.loader),visible:jt==="loading"})}return Z.createElement("li",{tabIndex:0,ref:Mr,className:Tr(ee,Zs,V==null?void 0:V.toast,(e=v==null?void 0:v.classNames)==null?void 0:e.toast,V==null?void 0:V.default,V==null?void 0:V[jt],(r=v==null?void 0:v.classNames)==null?void 0:r[jt]),"data-sonner-toast":"","data-rich-colors":(s=v.richColors)!=null?s:z,"data-styled":!(v.jsx||v.unstyled||k),"data-mounted":de,"data-promise":!!v.promise,"data-swiped":sn,"data-removed":Pe,"data-visible":Ua,"data-y-position":_i,"data-x-position":xi,"data-index":C,"data-front":Fa,"data-swiping":gt,"data-dismissible":Fr,"data-type":jt,"data-invert":Cn,"data-swipe-out":vt,"data-swipe-direction":se,"data-expanded":!!(D||B&&de),style:{"--index":C,"--toasts-before":C,"--z-index":j.length-C,"--offset":`${Pe?ms:on.current}px`,"--initial-height":B?"auto":`${$r}px`,...Q,...v.style},onDragEnd:()=>{qt(!1),J(null),zr.current=null},onPointerDown:Te=>{Br||!Fr||(Xs.current=new Date,Tn(on.current),Te.target.setPointerCapture(Te.pointerId),Te.target.tagName!=="BUTTON"&&(qt(!0),zr.current={x:Te.clientX,y:Te.clientY}))},onPointerUp:()=>{var Te,Me,Be,Ot;if(vt||!Fr)return;zr.current=null;let Dt=Number(((Te=Mr.current)==null?void 0:Te.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),$t=Number(((Me=Mr.current)==null?void 0:Me.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),yr=new Date().getTime()-((Be=Xs.current)==null?void 0:Be.getTime()),yt=re==="x"?Dt:$t,Vr=Math.abs(yt)/yr;if(Math.abs(yt)>=KS||Vr>.11){Tn(on.current),(Ot=v.onDismiss)==null||Ot.call(v,v),ye(re==="x"?Dt>0?"right":"left":$t>0?"down":"up"),vr(),gr(!0),ps(!1);return}qt(!1),J(null)},onPointerMove:Te=>{var Me,Be,Ot,Dt;if(!zr.current||!Fr||((Me=window.getSelection())==null?void 0:Me.toString().length)>0)return;let $t=Te.clientY-zr.current.y,yr=Te.clientX-zr.current.x,yt=(Be=t.swipeDirections)!=null?Be:QS(ge);!re&&(Math.abs(yr)>1||Math.abs($t)>1)&&J(Math.abs(yr)>Math.abs($t)?"x":"y");let Vr={x:0,y:0};re==="y"?(yt.includes("top")||yt.includes("bottom"))&&(yt.includes("top")&&$t<0||yt.includes("bottom")&&$t>0)&&(Vr.y=$t):re==="x"&&(yt.includes("left")||yt.includes("right"))&&(yt.includes("left")&&yr<0||yt.includes("right")&&yr>0)&&(Vr.x=yr),(Math.abs(Vr.x)>0||Math.abs(Vr.y)>0)&&ps(!0),(Ot=Mr.current)==null||Ot.style.setProperty("--swipe-amount-x",`${Vr.x}px`),(Dt=Mr.current)==null||Dt.style.setProperty("--swipe-amount-y",`${Vr.y}px`)}},gs&&!v.jsx?Z.createElement("button",{"aria-label":N,"data-disabled":Br,"data-close-button":!0,onClick:Br||!Fr?()=>{}:()=>{var Te;vr(),(Te=v.onDismiss)==null||Te.call(v,v)},className:Tr(V==null?void 0:V.closeButton,(i=v==null?void 0:v.classNames)==null?void 0:i.closeButton)},(a=K==null?void 0:K.close)!=null?a:IS):null,v.jsx||b.isValidElement(v.title)?v.jsx?v.jsx:typeof v.title=="function"?v.title():v.title:Z.createElement(Z.Fragment,null,jt||v.icon||v.promise?Z.createElement("div",{"data-icon":"",className:Tr(V==null?void 0:V.icon,(u=v==null?void 0:v.classNames)==null?void 0:u.icon)},v.promise||v.type==="loading"&&!v.icon?v.icon||Wa():null,v.type!=="loading"?v.icon||(K==null?void 0:K[jt])||TS(jt):null):null,Z.createElement("div",{"data-content":"",className:Tr(V==null?void 0:V.content,(d=v==null?void 0:v.classNames)==null?void 0:d.content)},Z.createElement("div",{"data-title":"",className:Tr(V==null?void 0:V.title,(f=v==null?void 0:v.classNames)==null?void 0:f.title)},typeof v.title=="function"?v.title():v.title),v.description?Z.createElement("div",{"data-description":"",className:Tr(pe,za,V==null?void 0:V.description,(p=v==null?void 0:v.classNames)==null?void 0:p.description)},typeof v.description=="function"?v.description():v.description):null),b.isValidElement(v.cancel)?v.cancel:v.cancel&&tu(v.cancel)?Z.createElement("button",{"data-button":!0,"data-cancel":!0,style:v.cancelButtonStyle||te,onClick:Te=>{var Me,Be;tu(v.cancel)&&Fr&&((Be=(Me=v.cancel).onClick)==null||Be.call(Me,Te),vr())},className:Tr(V==null?void 0:V.cancelButton,(g=v==null?void 0:v.classNames)==null?void 0:g.cancelButton)},v.cancel.label):null,b.isValidElement(v.action)?v.action:v.action&&tu(v.action)?Z.createElement("button",{"data-button":!0,"data-action":!0,style:v.actionButtonStyle||me,onClick:Te=>{var Me,Be;tu(v.action)&&((Be=(Me=v.action).onClick)==null||Be.call(Me,Te),!Te.defaultPrevented&&vr())},className:Tr(V==null?void 0:V.actionButton,(y=v==null?void 0:v.classNames)==null?void 0:y.actionButton)},v.action.label):null))};function Rv(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function YS(t,e){let r={};return[t,e].forEach((s,i)=>{let a=i===1,u=a?"--mobile-offset":"--offset",d=a?WS:VS;function f(p){["top","right","bottom","left"].forEach(g=>{r[`${u}-${g}`]=typeof p=="number"?`${p}px`:p})}typeof s=="number"||typeof s=="string"?f(s):typeof s=="object"?["top","right","bottom","left"].forEach(p=>{s[p]===void 0?r[`${u}-${p}`]=d:r[`${u}-${p}`]=typeof s[p]=="number"?`${s[p]}px`:s[p]}):f(d)}),r}var XS=b.forwardRef(function(t,e){let{invert:r,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:u,className:d,offset:f,mobileOffset:p,theme:g="light",richColors:y,duration:_,style:v,visibleToasts:k=BS,toastOptions:S,dir:x=Rv(),gap:T=qS,loadingIcon:R,icons:C,containerAriaLabel:j="Notifications",pauseWhenPageIsHidden:D}=t,[A,z]=Z.useState([]),W=Z.useMemo(()=>Array.from(new Set([s].concat(A.filter(U=>U.position).map(U=>U.position)))),[A,s]),[Q,te]=Z.useState([]),[me,ee]=Z.useState(!1),[pe,X]=Z.useState(!1),[ge,oe]=Z.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),ue=Z.useRef(null),B=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),V=Z.useRef(null),K=Z.useRef(!1),N=Z.useCallback(U=>{z(re=>{var J;return(J=re.find(se=>se.id===U.id))!=null&&J.delete||Ht.dismiss(U.id),re.filter(({id:se})=>se!==U.id)})},[]);return Z.useEffect(()=>Ht.subscribe(U=>{if(U.dismiss){z(re=>re.map(J=>J.id===U.id?{...J,delete:!0}:J));return}setTimeout(()=>{Nw.flushSync(()=>{z(re=>{let J=re.findIndex(se=>se.id===U.id);return J!==-1?[...re.slice(0,J),{...re[J],...U},...re.slice(J+1)]:[U,...re]})})})}),[]),Z.useEffect(()=>{if(g!=="system"){oe(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?oe("dark"):oe("light")),typeof window>"u")return;let U=window.matchMedia("(prefers-color-scheme: dark)");try{U.addEventListener("change",({matches:re})=>{oe(re?"dark":"light")})}catch{U.addListener(({matches:J})=>{try{oe(J?"dark":"light")}catch(se){console.error(se)}})}},[g]),Z.useEffect(()=>{A.length<=1&&ee(!1)},[A]),Z.useEffect(()=>{let U=re=>{var J,se;i.every(ye=>re[ye]||re.code===ye)&&(ee(!0),(J=ue.current)==null||J.focus()),re.code==="Escape"&&(document.activeElement===ue.current||(se=ue.current)!=null&&se.contains(document.activeElement))&&ee(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),Z.useEffect(()=>{if(ue.current)return()=>{V.current&&(V.current.focus({preventScroll:!0}),V.current=null,K.current=!1)}},[ue.current]),Z.createElement("section",{ref:e,"aria-label":`${j} ${B}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},W.map((U,re)=>{var J;let[se,ye]=U.split("-");return A.length?Z.createElement("ol",{key:U,dir:x==="auto"?Rv():x,tabIndex:-1,ref:ue,className:d,"data-sonner-toaster":!0,"data-theme":ge,"data-y-position":se,"data-lifted":me&&A.length>1&&!a,"data-x-position":ye,style:{"--front-toast-height":`${((J=Q[0])==null?void 0:J.height)||0}px`,"--width":`${HS}px`,"--gap":`${T}px`,...v,...YS(f,p)},onBlur:de=>{K.current&&!de.currentTarget.contains(de.relatedTarget)&&(K.current=!1,V.current&&(V.current.focus({preventScroll:!0}),V.current=null))},onFocus:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||K.current||(K.current=!0,V.current=de.relatedTarget)},onMouseEnter:()=>ee(!0),onMouseMove:()=>ee(!0),onMouseLeave:()=>{pe||ee(!1)},onDragEnd:()=>ee(!1),onPointerDown:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||X(!0)},onPointerUp:()=>X(!1)},A.filter(de=>!de.position&&re===0||de.position===U).map((de,xe)=>{var Pe,Ve;return Z.createElement(JS,{key:de.id,icons:C,index:xe,toast:de,defaultRichColors:y,duration:(Pe=S==null?void 0:S.duration)!=null?Pe:_,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:r,visibleToasts:k,closeButton:(Ve=S==null?void 0:S.closeButton)!=null?Ve:u,interacting:pe,position:U,style:S==null?void 0:S.style,unstyled:S==null?void 0:S.unstyled,classNames:S==null?void 0:S.classNames,cancelButtonStyle:S==null?void 0:S.cancelButtonStyle,actionButtonStyle:S==null?void 0:S.actionButtonStyle,removeToast:N,toasts:A.filter(gt=>gt.position==de.position),heights:Q.filter(gt=>gt.position==de.position),setHeights:te,expandByDefault:a,gap:T,loadingIcon:R,expanded:me,pauseWhenPageIsHidden:D,swipeDirections:t.swipeDirections})})):null}))}),Cu={},ZS=()=>{window.va||(window.va=function(...e){window.vaq||(window.vaq=[]),window.vaq.push(e)})},ek="@vercel/analytics",tk="2.0.1";function Lw(){return typeof window<"u"}function Dw(){try{const t="production"}catch{}return"production"}function rk(t="auto"){if(t==="auto"){window.vam=Dw();return}window.vam=t}function nk(){return(Lw()?window.vam:Dw())||"production"}function Dh(){return nk()==="development"}function sk(t){return t.scriptSrc?zo(t.scriptSrc):Dh()?"https://va.vercel-scripts.com/v1/script.debug.js":t.basePath?zo(`${t.basePath}/insights/script.js`):"/_vercel/insights/script.js"}function ok(t,e){var r;let s=t;if(e)try{s={...(r=JSON.parse(e))==null?void 0:r.analytics,...t}}catch{}rk(s.mode);const i={sdkn:ek+(s.framework?`/${s.framework}`:""),sdkv:tk};return s.disableAutoTrack&&(i.disableAutoTrack="1"),s.viewEndpoint&&(i.viewEndpoint=zo(s.viewEndpoint)),s.eventEndpoint&&(i.eventEndpoint=zo(s.eventEndpoint)),s.sessionEndpoint&&(i.sessionEndpoint=zo(s.sessionEndpoint)),Dh()&&s.debug===!1&&(i.debug="false"),s.dsn&&(i.dsn=s.dsn),s.endpoint?i.endpoint=s.endpoint:s.basePath&&(i.endpoint=zo(`${s.basePath}/insights`)),{beforeSend:s.beforeSend,src:sk(s),dataset:i}}function zo(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")?t:`/${t}`}function ik(t={debug:!0},e){var r;if(!Lw())return;const{beforeSend:s,src:i,dataset:a}=ok(t,e);if(ZS(),s&&((r=window.va)==null||r.call(window,"beforeSend",s)),document.head.querySelector(`script[src*="${i}"]`))return;const u=document.createElement("script");u.src=i;for(const[d,f]of Object.entries(a))u.dataset[d]=f;u.defer=!0,u.onerror=()=>{const d=Dh()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${i}. ${d}`)},document.head.appendChild(u)}function ak({route:t,path:e}){var r;(r=window.va)==null||r.call(window,"pageview",{route:t,path:e})}function lk(){if(!(typeof process>"u"||typeof Cu>"u"))return Cu.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function uk(){if(!(typeof process>"u"||typeof Cu>"u"))return Cu.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function ck(t){return b.useEffect(()=>{var e;t.beforeSend&&((e=window.va)==null||e.call(window,"beforeSend",t.beforeSend))},[t.beforeSend]),b.useEffect(()=>{ik({framework:t.framework||"react",basePath:t.basePath??lk(),...t.route!==void 0&&{disableAutoTrack:!0},...t},t.configString??uk())},[]),b.useEffect(()=>{t.route&&t.path&&ak({route:t.route,path:t.path})},[t.route,t.path]),null}const dk="modulepreload",fk=function(t){return"/"+t},Cv={},Ce=function(e,r,s){let i=Promise.resolve();if(r&&r.length>0){let u=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=u(r.map(p=>{if(p=fk(p),p in Cv)return;Cv[p]=!0;const g=p.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${y}`))return;const _=document.createElement("link");if(_.rel=g?"stylesheet":dk,g||(_.as="script"),_.crossOrigin="",_.href=p,f&&_.setAttribute("nonce",f),document.head.appendChild(_),g)return new Promise((v,k)=>{_.addEventListener("load",v),_.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${p}`)))})}))}function a(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return i.then(u=>{for(const d of u||[])d.status==="rejected"&&a(d.reason);return e().catch(a)})},hk=1,pk=1e6;let tf=0;function mk(){return tf=(tf+1)%Number.MAX_SAFE_INTEGER,tf.toString()}const rf=new Map,Pv=t=>{if(rf.has(t))return;const e=setTimeout(()=>{rf.delete(t),fa({type:"REMOVE_TOAST",toastId:t})},pk);rf.set(t,e)},gk=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,hk)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(r=>r.id===e.toast.id?{...r,...e.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=e;return r?Pv(r):t.toasts.forEach(s=>{Pv(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===r||r===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(r=>r.id!==e.toastId)}}},_u=[];let xu={toasts:[]};function fa(t){xu=gk(xu,t),_u.forEach(e=>{e(xu)})}function vk({...t}){const e=mk(),r=i=>fa({type:"UPDATE_TOAST",toast:{...i,id:e}}),s=()=>fa({type:"DISMISS_TOAST",toastId:e});return fa({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:i=>{i||s()}}}),{id:e,dismiss:s,update:r}}function yk(){const[t,e]=b.useState(xu);return b.useEffect(()=>(_u.push(e),()=>{const r=_u.indexOf(e);r>-1&&_u.splice(r,1)}),[t]),{...t,toast:vk,dismiss:r=>fa({type:"DISMISS_TOAST",toastId:r})}}function ze(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function jv(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function $w(...t){return e=>{let r=!1;const s=t.map(i=>{const a=jv(i,e);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let i=0;i{const{children:u,...d}=a,f=b.useMemo(()=>d,Object.values(d));return w.jsx(r.Provider,{value:f,children:u})};s.displayName=t+"Provider";function i(a){const u=b.useContext(r);if(u)return u;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[s,i]}function fi(t,e=[]){let r=[];function s(a,u){const d=b.createContext(u),f=r.length;r=[...r,u];const p=y=>{var T;const{scope:_,children:v,...k}=y,S=((T=_==null?void 0:_[t])==null?void 0:T[f])||d,x=b.useMemo(()=>k,Object.values(k));return w.jsx(S.Provider,{value:x,children:v})};p.displayName=a+"Provider";function g(y,_){var S;const v=((S=_==null?void 0:_[t])==null?void 0:S[f])||d,k=b.useContext(v);if(k)return k;if(u!==void 0)return u;throw new Error(`\`${y}\` must be used within \`${a}\``)}return[p,g]}const i=()=>{const a=r.map(u=>b.createContext(u));return function(d){const f=(d==null?void 0:d[t])||a;return b.useMemo(()=>({[`__scope${t}`]:{...d,[t]:f}}),[d,f])}};return i.scopeName=t,[s,wk(i,...e)]}function wk(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const s=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const u=s.reduce((d,{useScope:f,scopeName:p})=>{const y=f(a)[`__scope${p}`];return{...d,...y}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:u}),[u])}};return r.scopeName=e.scopeName,r}function Pu(t){const e=_k(t),r=b.forwardRef((s,i)=>{const{children:a,...u}=s,d=b.Children.toArray(a),f=d.find(Ek);if(f){const p=f.props.children,g=d.map(y=>y===f?b.Children.count(p)>1?b.Children.only(null):b.isValidElement(p)?p.props.children:null:y);return w.jsx(e,{...u,ref:i,children:b.isValidElement(p)?b.cloneElement(p,void 0,g):null})}return w.jsx(e,{...u,ref:i,children:a})});return r.displayName=`${t}.Slot`,r}var bk=Pu("Slot");function _k(t){const e=b.forwardRef((r,s)=>{const{children:i,...a}=r;if(b.isValidElement(i)){const u=kk(i),d=Sk(a,i.props);return i.type!==b.Fragment&&(d.ref=s?$w(s,u):u),b.cloneElement(i,d)}return b.Children.count(i)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Mw=Symbol("radix.slottable");function xk(t){const e=({children:r})=>w.jsx(w.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=Mw,e}function Ek(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Mw}function Sk(t,e){const r={...e};for(const s in e){const i=t[s],a=e[s];/^on[A-Z]/.test(s)?i&&a?r[s]=(...d)=>{const f=a(...d);return i(...d),f}:i&&(r[s]=i):s==="style"?r[s]={...i,...a}:s==="className"&&(r[s]=[i,a].filter(Boolean).join(" "))}return{...t,...r}}function kk(t){var s,i;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function Fw(t){const e=t+"CollectionProvider",[r,s]=fi(e),[i,a]=r(e,{collectionRef:{current:null},itemMap:new Map}),u=S=>{const{scope:x,children:T}=S,R=Z.useRef(null),C=Z.useRef(new Map).current;return w.jsx(i,{scope:x,itemMap:C,collectionRef:R,children:T})};u.displayName=e;const d=t+"CollectionSlot",f=Pu(d),p=Z.forwardRef((S,x)=>{const{scope:T,children:R}=S,C=a(d,T),j=hr(x,C.collectionRef);return w.jsx(f,{ref:j,children:R})});p.displayName=d;const g=t+"CollectionItemSlot",y="data-radix-collection-item",_=Pu(g),v=Z.forwardRef((S,x)=>{const{scope:T,children:R,...C}=S,j=Z.useRef(null),D=hr(x,j),A=a(g,T);return Z.useEffect(()=>(A.itemMap.set(j,{ref:j,...C}),()=>void A.itemMap.delete(j))),w.jsx(_,{[y]:"",ref:D,children:R})});v.displayName=g;function k(S){const x=a(t+"CollectionConsumer",S);return Z.useCallback(()=>{const R=x.collectionRef.current;if(!R)return[];const C=Array.from(R.querySelectorAll(`[${y}]`));return Array.from(x.itemMap.values()).sort((A,z)=>C.indexOf(A.ref.current)-C.indexOf(z.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:u,Slot:p,ItemSlot:v},k,s]}var Tk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ot=Tk.reduce((t,e)=>{const r=Pu(`Primitive.${e}`),s=b.forwardRef((i,a)=>{const{asChild:u,...d}=i,f=u?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(f,{...d,ref:a})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function Uw(t,e){t&&Wu.flushSync(()=>t.dispatchEvent(e))}function bn(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...r)=>{var s;return(s=e.current)==null?void 0:s.call(e,...r)},[])}function Rk(t,e=globalThis==null?void 0:globalThis.document){const r=bn(t);b.useEffect(()=>{const s=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",s,{capture:!0}),()=>e.removeEventListener("keydown",s,{capture:!0})},[r,e])}var Ck="DismissableLayer",Df="dismissableLayer.update",Pk="dismissableLayer.pointerDownOutside",jk="dismissableLayer.focusOutside",Ov,zw=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$h=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:u,onDismiss:d,...f}=t,p=b.useContext(zw),[g,y]=b.useState(null),_=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=b.useState({}),k=hr(e,z=>y(z)),S=Array.from(p.layers),[x]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),T=S.indexOf(x),R=g?S.indexOf(g):-1,C=p.layersWithOutsidePointerEventsDisabled.size>0,j=R>=T,D=Ak(z=>{const W=z.target,Q=[...p.branches].some(te=>te.contains(W));!j||Q||(i==null||i(z),u==null||u(z),z.defaultPrevented||d==null||d())},_),A=Ik(z=>{const W=z.target;[...p.branches].some(te=>te.contains(W))||(a==null||a(z),u==null||u(z),z.defaultPrevented||d==null||d())},_);return Rk(z=>{R===p.layers.size-1&&(s==null||s(z),!z.defaultPrevented&&d&&(z.preventDefault(),d()))},_),b.useEffect(()=>{if(g)return r&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(Ov=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(g)),p.layers.add(g),Av(),()=>{r&&p.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=Ov)}},[g,_,r,p]),b.useEffect(()=>()=>{g&&(p.layers.delete(g),p.layersWithOutsidePointerEventsDisabled.delete(g),Av())},[g,p]),b.useEffect(()=>{const z=()=>v({});return document.addEventListener(Df,z),()=>document.removeEventListener(Df,z)},[]),w.jsx(ot.div,{...f,ref:k,style:{pointerEvents:C?j?"auto":"none":void 0,...t.style},onFocusCapture:ze(t.onFocusCapture,A.onFocusCapture),onBlurCapture:ze(t.onBlurCapture,A.onBlurCapture),onPointerDownCapture:ze(t.onPointerDownCapture,D.onPointerDownCapture)})});$h.displayName=Ck;var Ok="DismissableLayerBranch",Bw=b.forwardRef((t,e)=>{const r=b.useContext(zw),s=b.useRef(null),i=hr(e,s);return b.useEffect(()=>{const a=s.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),w.jsx(ot.div,{...t,ref:i})});Bw.displayName=Ok;function Ak(t,e=globalThis==null?void 0:globalThis.document){const r=bn(t),s=b.useRef(!1),i=b.useRef(()=>{});return b.useEffect(()=>{const a=d=>{if(d.target&&!s.current){let f=function(){Vw(Pk,r,p,{discrete:!0})};const p={originalEvent:d};d.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=f,e.addEventListener("click",i.current,{once:!0})):f()}else e.removeEventListener("click",i.current);s.current=!1},u=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(u),e.removeEventListener("pointerdown",a),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>s.current=!0}}function Ik(t,e=globalThis==null?void 0:globalThis.document){const r=bn(t),s=b.useRef(!1);return b.useEffect(()=>{const i=a=>{a.target&&!s.current&&Vw(jk,r,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Av(){const t=new CustomEvent(Df);document.dispatchEvent(t)}function Vw(t,e,r,{discrete:s}){const i=r.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),s?Uw(i,a):i.dispatchEvent(a)}var Nk=$h,Lk=Bw,_n=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},Dk="Portal",Ww=b.forwardRef((t,e)=>{var d;const{container:r,...s}=t,[i,a]=b.useState(!1);_n(()=>a(!0),[]);const u=r||i&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return u?Nw.createPortal(w.jsx(ot.div,{...s,ref:e}),u):null});Ww.displayName=Dk;function $k(t,e){return b.useReducer((r,s)=>e[r][s]??r,t)}var Hu=t=>{const{present:e,children:r}=t,s=Mk(e),i=typeof r=="function"?r({present:s.isPresent}):b.Children.only(r),a=hr(s.ref,Fk(i));return typeof r=="function"||s.isPresent?b.cloneElement(i,{ref:a}):null};Hu.displayName="Presence";function Mk(t){const[e,r]=b.useState(),s=b.useRef(null),i=b.useRef(t),a=b.useRef("none"),u=t?"mounted":"unmounted",[d,f]=$k(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const p=ru(s.current);a.current=d==="mounted"?p:"none"},[d]),_n(()=>{const p=s.current,g=i.current;if(g!==t){const _=a.current,v=ru(p);t?f("MOUNT"):v==="none"||(p==null?void 0:p.display)==="none"?f("UNMOUNT"):f(g&&_!==v?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,f]),_n(()=>{if(e){let p;const g=e.ownerDocument.defaultView??window,y=v=>{const S=ru(s.current).includes(v.animationName);if(v.target===e&&S&&(f("ANIMATION_END"),!i.current)){const x=e.style.animationFillMode;e.style.animationFillMode="forwards",p=g.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=x)})}},_=v=>{v.target===e&&(a.current=ru(s.current))};return e.addEventListener("animationstart",_),e.addEventListener("animationcancel",y),e.addEventListener("animationend",y),()=>{g.clearTimeout(p),e.removeEventListener("animationstart",_),e.removeEventListener("animationcancel",y),e.removeEventListener("animationend",y)}}else f("ANIMATION_END")},[e,f]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:b.useCallback(p=>{s.current=p?getComputedStyle(p):null,r(p)},[])}}function ru(t){return(t==null?void 0:t.animationName)||"none"}function Fk(t){var s,i;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Uk=Iw[" useInsertionEffect ".trim().toString()]||_n;function qu({prop:t,defaultProp:e,onChange:r=()=>{},caller:s}){const[i,a,u]=zk({defaultProp:e,onChange:r}),d=t!==void 0,f=d?t:i;{const g=b.useRef(t!==void 0);b.useEffect(()=>{const y=g.current;y!==d&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=d},[d,s])}const p=b.useCallback(g=>{var y;if(d){const _=Bk(g)?g(t):g;_!==t&&((y=u.current)==null||y.call(u,_))}else a(g)},[d,t,a,u]);return[f,p]}function zk({defaultProp:t,onChange:e}){const[r,s]=b.useState(t),i=b.useRef(r),a=b.useRef(e);return Uk(()=>{a.current=e},[e]),b.useEffect(()=>{var u;i.current!==r&&((u=a.current)==null||u.call(a,r),i.current=r)},[r,i]),[r,s,a]}function Bk(t){return typeof t=="function"}var Vk=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Wk="VisuallyHidden",Ku=b.forwardRef((t,e)=>w.jsx(ot.span,{...t,ref:e,style:{...Vk,...t.style}}));Ku.displayName=Wk;var Hk=Ku,Mh="ToastProvider",[Fh,qk,Kk]=Fw("Toast"),[Hw]=fi("Toast",[Kk]),[Gk,Gu]=Hw(Mh),qw=t=>{const{__scopeToast:e,label:r="Notification",duration:s=5e3,swipeDirection:i="right",swipeThreshold:a=50,children:u}=t,[d,f]=b.useState(null),[p,g]=b.useState(0),y=b.useRef(!1),_=b.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${Mh}\`. Expected non-empty \`string\`.`),w.jsx(Fh.Provider,{scope:e,children:w.jsx(Gk,{scope:e,label:r,duration:s,swipeDirection:i,swipeThreshold:a,toastCount:p,viewport:d,onViewportChange:f,onToastAdd:b.useCallback(()=>g(v=>v+1),[]),onToastRemove:b.useCallback(()=>g(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:_,children:u})})};qw.displayName=Mh;var Kw="ToastViewport",Qk=["F8"],$f="toast.viewportPause",Mf="toast.viewportResume",Gw=b.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:s=Qk,label:i="Notifications ({hotkey})",...a}=t,u=Gu(Kw,r),d=qk(r),f=b.useRef(null),p=b.useRef(null),g=b.useRef(null),y=b.useRef(null),_=hr(e,y,u.onViewportChange),v=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),k=u.toastCount>0;b.useEffect(()=>{const x=T=>{var C;s.length!==0&&s.every(j=>T[j]||T.code===j)&&((C=y.current)==null||C.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s]),b.useEffect(()=>{const x=f.current,T=y.current;if(k&&x&&T){const R=()=>{if(!u.isClosePausedRef.current){const A=new CustomEvent($f);T.dispatchEvent(A),u.isClosePausedRef.current=!0}},C=()=>{if(u.isClosePausedRef.current){const A=new CustomEvent(Mf);T.dispatchEvent(A),u.isClosePausedRef.current=!1}},j=A=>{!x.contains(A.relatedTarget)&&C()},D=()=>{x.contains(document.activeElement)||C()};return x.addEventListener("focusin",R),x.addEventListener("focusout",j),x.addEventListener("pointermove",R),x.addEventListener("pointerleave",D),window.addEventListener("blur",R),window.addEventListener("focus",C),()=>{x.removeEventListener("focusin",R),x.removeEventListener("focusout",j),x.removeEventListener("pointermove",R),x.removeEventListener("pointerleave",D),window.removeEventListener("blur",R),window.removeEventListener("focus",C)}}},[k,u.isClosePausedRef]);const S=b.useCallback(({tabbingDirection:x})=>{const R=d().map(C=>{const j=C.ref.current,D=[j,...l1(j)];return x==="forwards"?D:D.reverse()});return(x==="forwards"?R.reverse():R).flat()},[d]);return b.useEffect(()=>{const x=y.current;if(x){const T=R=>{var D,A,z;const C=R.altKey||R.ctrlKey||R.metaKey;if(R.key==="Tab"&&!C){const W=document.activeElement,Q=R.shiftKey;if(R.target===x&&Q){(D=p.current)==null||D.focus();return}const ee=S({tabbingDirection:Q?"backwards":"forwards"}),pe=ee.findIndex(X=>X===W);nf(ee.slice(pe+1))?R.preventDefault():Q?(A=p.current)==null||A.focus():(z=g.current)==null||z.focus()}};return x.addEventListener("keydown",T),()=>x.removeEventListener("keydown",T)}},[d,S]),w.jsxs(Lk,{ref:f,role:"region","aria-label":i.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:k?void 0:"none"},children:[k&&w.jsx(Ff,{ref:p,onFocusFromOutsideViewport:()=>{const x=S({tabbingDirection:"forwards"});nf(x)}}),w.jsx(Fh.Slot,{scope:r,children:w.jsx(ot.ol,{tabIndex:-1,...a,ref:_})}),k&&w.jsx(Ff,{ref:g,onFocusFromOutsideViewport:()=>{const x=S({tabbingDirection:"backwards"});nf(x)}})]})});Gw.displayName=Kw;var Qw="ToastFocusProxy",Ff=b.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:s,...i}=t,a=Gu(Qw,r);return w.jsx(Ku,{"aria-hidden":!0,tabIndex:0,...i,ref:e,style:{position:"fixed"},onFocus:u=>{var p;const d=u.relatedTarget;!((p=a.viewport)!=null&&p.contains(d))&&s()}})});Ff.displayName=Qw;var Aa="Toast",Jk="toast.swipeStart",Yk="toast.swipeMove",Xk="toast.swipeCancel",Zk="toast.swipeEnd",Jw=b.forwardRef((t,e)=>{const{forceMount:r,open:s,defaultOpen:i,onOpenChange:a,...u}=t,[d,f]=qu({prop:s,defaultProp:i??!0,onChange:a,caller:Aa});return w.jsx(Hu,{present:r||d,children:w.jsx(r1,{open:d,...u,ref:e,onClose:()=>f(!1),onPause:bn(t.onPause),onResume:bn(t.onResume),onSwipeStart:ze(t.onSwipeStart,p=>{p.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ze(t.onSwipeMove,p=>{const{x:g,y}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","move"),p.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${g}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${y}px`)}),onSwipeCancel:ze(t.onSwipeCancel,p=>{p.currentTarget.setAttribute("data-swipe","cancel"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ze(t.onSwipeEnd,p=>{const{x:g,y}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","end"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${g}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${y}px`),f(!1)})})})});Jw.displayName=Aa;var[e1,t1]=Hw(Aa,{onClose(){}}),r1=b.forwardRef((t,e)=>{const{__scopeToast:r,type:s="foreground",duration:i,open:a,onClose:u,onEscapeKeyDown:d,onPause:f,onResume:p,onSwipeStart:g,onSwipeMove:y,onSwipeCancel:_,onSwipeEnd:v,...k}=t,S=Gu(Aa,r),[x,T]=b.useState(null),R=hr(e,X=>T(X)),C=b.useRef(null),j=b.useRef(null),D=i||S.duration,A=b.useRef(0),z=b.useRef(D),W=b.useRef(0),{onToastAdd:Q,onToastRemove:te}=S,me=bn(()=>{var ge;(x==null?void 0:x.contains(document.activeElement))&&((ge=S.viewport)==null||ge.focus()),u()}),ee=b.useCallback(X=>{!X||X===1/0||(window.clearTimeout(W.current),A.current=new Date().getTime(),W.current=window.setTimeout(me,X))},[me]);b.useEffect(()=>{const X=S.viewport;if(X){const ge=()=>{ee(z.current),p==null||p()},oe=()=>{const ue=new Date().getTime()-A.current;z.current=z.current-ue,window.clearTimeout(W.current),f==null||f()};return X.addEventListener($f,oe),X.addEventListener(Mf,ge),()=>{X.removeEventListener($f,oe),X.removeEventListener(Mf,ge)}}},[S.viewport,D,f,p,ee]),b.useEffect(()=>{a&&!S.isClosePausedRef.current&&ee(D)},[a,D,S.isClosePausedRef,ee]),b.useEffect(()=>(Q(),()=>te()),[Q,te]);const pe=b.useMemo(()=>x?n0(x):null,[x]);return S.viewport?w.jsxs(w.Fragment,{children:[pe&&w.jsx(n1,{__scopeToast:r,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:pe}),w.jsx(e1,{scope:r,onClose:me,children:Wu.createPortal(w.jsx(Fh.ItemSlot,{scope:r,children:w.jsx(Nk,{asChild:!0,onEscapeKeyDown:ze(d,()=>{S.isFocusedToastEscapeKeyDownRef.current||me(),S.isFocusedToastEscapeKeyDownRef.current=!1}),children:w.jsx(ot.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":S.swipeDirection,...k,ref:R,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:ze(t.onKeyDown,X=>{X.key==="Escape"&&(d==null||d(X.nativeEvent),X.nativeEvent.defaultPrevented||(S.isFocusedToastEscapeKeyDownRef.current=!0,me()))}),onPointerDown:ze(t.onPointerDown,X=>{X.button===0&&(C.current={x:X.clientX,y:X.clientY})}),onPointerMove:ze(t.onPointerMove,X=>{if(!C.current)return;const ge=X.clientX-C.current.x,oe=X.clientY-C.current.y,ue=!!j.current,B=["left","right"].includes(S.swipeDirection),V=["left","up"].includes(S.swipeDirection)?Math.min:Math.max,K=B?V(0,ge):0,N=B?0:V(0,oe),U=X.pointerType==="touch"?10:2,re={x:K,y:N},J={originalEvent:X,delta:re};ue?(j.current=re,nu(Yk,y,J,{discrete:!1})):Iv(re,S.swipeDirection,U)?(j.current=re,nu(Jk,g,J,{discrete:!1}),X.target.setPointerCapture(X.pointerId)):(Math.abs(ge)>U||Math.abs(oe)>U)&&(C.current=null)}),onPointerUp:ze(t.onPointerUp,X=>{const ge=j.current,oe=X.target;if(oe.hasPointerCapture(X.pointerId)&&oe.releasePointerCapture(X.pointerId),j.current=null,C.current=null,ge){const ue=X.currentTarget,B={originalEvent:X,delta:ge};Iv(ge,S.swipeDirection,S.swipeThreshold)?nu(Zk,v,B,{discrete:!0}):nu(Xk,_,B,{discrete:!0}),ue.addEventListener("click",V=>V.preventDefault(),{once:!0})}})})})}),S.viewport)})]}):null}),n1=t=>{const{__scopeToast:e,children:r,...s}=t,i=Gu(Aa,e),[a,u]=b.useState(!1),[d,f]=b.useState(!1);return i1(()=>u(!0)),b.useEffect(()=>{const p=window.setTimeout(()=>f(!0),1e3);return()=>window.clearTimeout(p)},[]),d?null:w.jsx(Ww,{asChild:!0,children:w.jsx(Ku,{...s,children:a&&w.jsxs(w.Fragment,{children:[i.label," ",r]})})})},s1="ToastTitle",Yw=b.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t;return w.jsx(ot.div,{...s,ref:e})});Yw.displayName=s1;var o1="ToastDescription",Xw=b.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t;return w.jsx(ot.div,{...s,ref:e})});Xw.displayName=o1;var Zw="ToastAction",e0=b.forwardRef((t,e)=>{const{altText:r,...s}=t;return r.trim()?w.jsx(r0,{altText:r,asChild:!0,children:w.jsx(Uh,{...s,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${Zw}\`. Expected non-empty \`string\`.`),null)});e0.displayName=Zw;var t0="ToastClose",Uh=b.forwardRef((t,e)=>{const{__scopeToast:r,...s}=t,i=t1(t0,r);return w.jsx(r0,{asChild:!0,children:w.jsx(ot.button,{type:"button",...s,ref:e,onClick:ze(t.onClick,i.onClose)})})});Uh.displayName=t0;var r0=b.forwardRef((t,e)=>{const{__scopeToast:r,altText:s,...i}=t;return w.jsx(ot.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...i,ref:e})});function n0(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),a1(s)){const i=s.ariaHidden||s.hidden||s.style.display==="none",a=s.dataset.radixToastAnnounceExclude==="";if(!i)if(a){const u=s.dataset.radixToastAnnounceAlt;u&&e.push(u)}else e.push(...n0(s))}}),e}function nu(t,e,r,{discrete:s}){const i=r.originalEvent.currentTarget,a=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),s?Uw(i,a):i.dispatchEvent(a)}var Iv=(t,e,r=0)=>{const s=Math.abs(t.x),i=Math.abs(t.y),a=s>i;return e==="left"||e==="right"?a&&s>r:!a&&i>r};function i1(t=()=>{}){const e=bn(t);_n(()=>{let r=0,s=0;return r=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(s)}},[e])}function a1(t){return t.nodeType===t.ELEMENT_NODE}function l1(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function nf(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var u1=qw,s0=Gw,o0=Jw,i0=Yw,a0=Xw,l0=e0,u0=Uh;function c0(t){var e,r,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Lv=d0,Qu=(t,e)=>r=>{var s;if((e==null?void 0:e.variants)==null)return Lv(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:a}=e,u=Object.keys(i).map(p=>{const g=r==null?void 0:r[p],y=a==null?void 0:a[p];if(g===null)return null;const _=Nv(g)||Nv(y);return i[p][_]}),d=r&&Object.entries(r).reduce((p,g)=>{let[y,_]=g;return _===void 0||(p[y]=_),p},{}),f=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((p,g)=>{let{class:y,className:_,...v}=g;return Object.entries(v).every(k=>{let[S,x]=k;return Array.isArray(x)?x.includes({...a,...d}[S]):{...a,...d}[S]===x})?[...p,y,_]:p},[]);return Lv(t,u,f,r==null?void 0:r.class,r==null?void 0:r.className)};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c1=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),f0=(...t)=>t.filter((e,r,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===r).join(" ").trim();/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var d1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f1=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:i="",children:a,iconNode:u,...d},f)=>b.createElement("svg",{ref:f,...d1,width:e,height:e,stroke:t,strokeWidth:s?Number(r)*24/Number(e):r,className:f0("lucide",i),...d},[...u.map(([p,g])=>b.createElement(p,g)),...Array.isArray(a)?a:[a]]));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tr=(t,e)=>{const r=b.forwardRef(({className:s,...i},a)=>b.createElement(f1,{ref:a,iconNode:e,className:f0(`lucide-${c1(t)}`,s),...i}));return r.displayName=`${t}`,r};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h1=tr("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p1=tr("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m1=tr("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g1=tr("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v1=tr("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h0=tr("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y1=tr("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w1=tr("Share",[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dv=tr("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b1=tr("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _1=tr("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $v=tr("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zh=tr("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Bh="-",x1=t=>{const e=S1(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:u=>{const d=u.split(Bh);return d[0]===""&&d.length!==1&&d.shift(),p0(d,e)||E1(u)},getConflictingClassGroupIds:(u,d)=>{const f=r[u]||[];return d&&s[u]?[...f,...s[u]]:f}}},p0=(t,e)=>{var u;if(t.length===0)return e.classGroupId;const r=t[0],s=e.nextPart.get(r),i=s?p0(t.slice(1),s):void 0;if(i)return i;if(e.validators.length===0)return;const a=t.join(Bh);return(u=e.validators.find(({validator:d})=>d(a)))==null?void 0:u.classGroupId},Mv=/^\[(.+)\]$/,E1=t=>{if(Mv.test(t)){const e=Mv.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},S1=t=>{const{theme:e,prefix:r}=t,s={nextPart:new Map,validators:[]};return T1(Object.entries(t.classGroups),r).forEach(([a,u])=>{Uf(u,s,a,e)}),s},Uf=(t,e,r,s)=>{t.forEach(i=>{if(typeof i=="string"){const a=i===""?e:Fv(e,i);a.classGroupId=r;return}if(typeof i=="function"){if(k1(i)){Uf(i(s),e,r,s);return}e.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([a,u])=>{Uf(u,Fv(e,a),r,s)})})},Fv=(t,e)=>{let r=t;return e.split(Bh).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},k1=t=>t.isThemeGetter,T1=(t,e)=>e?t.map(([r,s])=>{const i=s.map(a=>typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([u,d])=>[e+u,d])):a);return[r,i]}):t,R1=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,s=new Map;const i=(a,u)=>{r.set(a,u),e++,e>t&&(e=0,s=r,r=new Map)};return{get(a){let u=r.get(a);if(u!==void 0)return u;if((u=s.get(a))!==void 0)return i(a,u),u},set(a,u){r.has(a)?r.set(a,u):i(a,u)}}},m0="!",C1=t=>{const{separator:e,experimentalParseClassName:r}=t,s=e.length===1,i=e[0],a=e.length,u=d=>{const f=[];let p=0,g=0,y;for(let x=0;xg?y-g:void 0;return{modifiers:f,hasImportantModifier:v,baseClassName:k,maybePostfixModifierPosition:S}};return r?d=>r({className:d,parseClassName:u}):u},P1=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(s=>{s[0]==="["?(e.push(...r.sort(),s),r=[]):r.push(s)}),e.push(...r.sort()),e},j1=t=>({cache:R1(t.cacheSize),parseClassName:C1(t),...x1(t)}),O1=/\s+/,A1=(t,e)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:i}=e,a=[],u=t.trim().split(O1);let d="";for(let f=u.length-1;f>=0;f-=1){const p=u[f],{modifiers:g,hasImportantModifier:y,baseClassName:_,maybePostfixModifierPosition:v}=r(p);let k=!!v,S=s(k?_.substring(0,v):_);if(!S){if(!k){d=p+(d.length>0?" "+d:d);continue}if(S=s(_),!S){d=p+(d.length>0?" "+d:d);continue}k=!1}const x=P1(g).join(":"),T=y?x+m0:x,R=T+S;if(a.includes(R))continue;a.push(R);const C=i(S,k);for(let j=0;j0?" "+d:d)}return d};function I1(){let t=0,e,r,s="";for(;t{if(typeof t=="string")return t;let e,r="";for(let s=0;sy(g),t());return r=j1(p),s=r.cache.get,i=r.cache.set,a=d,d(f)}function d(f){const p=s(f);if(p)return p;const g=A1(f,r);return i(f,g),g}return function(){return a(I1.apply(null,arguments))}}const Ge=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},v0=/^\[(?:([a-z-]+):)?(.+)\]$/i,L1=/^\d+\/\d+$/,D1=new Set(["px","full","screen"]),$1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,M1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,F1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,U1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,z1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mn=t=>Bo(t)||D1.has(t)||L1.test(t),Gn=t=>hi(t,"length",Q1),Bo=t=>!!t&&!Number.isNaN(Number(t)),sf=t=>hi(t,"number",Bo),sa=t=>!!t&&Number.isInteger(Number(t)),B1=t=>t.endsWith("%")&&Bo(t.slice(0,-1)),je=t=>v0.test(t),Qn=t=>$1.test(t),V1=new Set(["length","size","percentage"]),W1=t=>hi(t,V1,y0),H1=t=>hi(t,"position",y0),q1=new Set(["image","url"]),K1=t=>hi(t,q1,Y1),G1=t=>hi(t,"",J1),oa=()=>!0,hi=(t,e,r)=>{const s=v0.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):r(s[2]):!1},Q1=t=>M1.test(t)&&!F1.test(t),y0=()=>!1,J1=t=>U1.test(t),Y1=t=>z1.test(t),X1=()=>{const t=Ge("colors"),e=Ge("spacing"),r=Ge("blur"),s=Ge("brightness"),i=Ge("borderColor"),a=Ge("borderRadius"),u=Ge("borderSpacing"),d=Ge("borderWidth"),f=Ge("contrast"),p=Ge("grayscale"),g=Ge("hueRotate"),y=Ge("invert"),_=Ge("gap"),v=Ge("gradientColorStops"),k=Ge("gradientColorStopPositions"),S=Ge("inset"),x=Ge("margin"),T=Ge("opacity"),R=Ge("padding"),C=Ge("saturate"),j=Ge("scale"),D=Ge("sepia"),A=Ge("skew"),z=Ge("space"),W=Ge("translate"),Q=()=>["auto","contain","none"],te=()=>["auto","hidden","clip","visible","scroll"],me=()=>["auto",je,e],ee=()=>[je,e],pe=()=>["",mn,Gn],X=()=>["auto",Bo,je],ge=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],oe=()=>["solid","dashed","dotted","double","none"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],V=()=>["","0",je],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>[Bo,je];return{cacheSize:500,separator:":",theme:{colors:[oa],spacing:[mn,Gn],blur:["none","",Qn,je],brightness:N(),borderColor:[t],borderRadius:["none","","full",Qn,je],borderSpacing:ee(),borderWidth:pe(),contrast:N(),grayscale:V(),hueRotate:N(),invert:V(),gap:ee(),gradientColorStops:[t],gradientColorStopPositions:[B1,Gn],inset:me(),margin:me(),opacity:N(),padding:ee(),saturate:N(),scale:N(),sepia:V(),skew:N(),space:ee(),translate:ee()},classGroups:{aspect:[{aspect:["auto","square","video",je]}],container:["container"],columns:[{columns:[Qn]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...ge(),je]}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:Q()}],"overscroll-x":[{"overscroll-x":Q()}],"overscroll-y":[{"overscroll-y":Q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",sa,je]}],basis:[{basis:me()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",je]}],grow:[{grow:V()}],shrink:[{shrink:V()}],order:[{order:["first","last","none",sa,je]}],"grid-cols":[{"grid-cols":[oa]}],"col-start-end":[{col:["auto",{span:["full",sa,je]},je]}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":[oa]}],"row-start-end":[{row:["auto",{span:[sa,je]},je]}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",je]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",je]}],gap:[{gap:[_]}],"gap-x":[{"gap-x":[_]}],"gap-y":[{"gap-y":[_]}],"justify-content":[{justify:["normal",...B()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...B(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...B(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[R]}],px:[{px:[R]}],py:[{py:[R]}],ps:[{ps:[R]}],pe:[{pe:[R]}],pt:[{pt:[R]}],pr:[{pr:[R]}],pb:[{pb:[R]}],pl:[{pl:[R]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[z]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[z]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",je,e]}],"min-w":[{"min-w":[je,e,"min","max","fit"]}],"max-w":[{"max-w":[je,e,"none","full","min","max","fit","prose",{screen:[Qn]},Qn]}],h:[{h:[je,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[je,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[je,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[je,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Qn,Gn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",sf]}],"font-family":[{font:[oa]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",je]}],"line-clamp":[{"line-clamp":["none",Bo,sf]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",mn,je]}],"list-image":[{"list-image":["none",je]}],"list-style-type":[{list:["none","disc","decimal",je]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[T]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[T]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",mn,Gn]}],"underline-offset":[{"underline-offset":["auto",mn,je]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ee()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[T]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ge(),H1]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",W1]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},K1]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[k]}],"gradient-via-pos":[{via:[k]}],"gradient-to-pos":[{to:[k]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[d]}],"border-w-x":[{"border-x":[d]}],"border-w-y":[{"border-y":[d]}],"border-w-s":[{"border-s":[d]}],"border-w-e":[{"border-e":[d]}],"border-w-t":[{"border-t":[d]}],"border-w-r":[{"border-r":[d]}],"border-w-b":[{"border-b":[d]}],"border-w-l":[{"border-l":[d]}],"border-opacity":[{"border-opacity":[T]}],"border-style":[{border:[...oe(),"hidden"]}],"divide-x":[{"divide-x":[d]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[d]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[T]}],"divide-style":[{divide:oe()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...oe()]}],"outline-offset":[{"outline-offset":[mn,je]}],"outline-w":[{outline:[mn,Gn]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[T]}],"ring-offset-w":[{"ring-offset":[mn,Gn]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Qn,G1]}],"shadow-color":[{shadow:[oa]}],opacity:[{opacity:[T]}],"mix-blend":[{"mix-blend":[...ue(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ue()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[s]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",Qn,je]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[y]}],saturate:[{saturate:[C]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[T]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[u]}],"border-spacing-x":[{"border-spacing-x":[u]}],"border-spacing-y":[{"border-spacing-y":[u]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",je]}],duration:[{duration:N()}],ease:[{ease:["linear","in","out","in-out",je]}],delay:[{delay:N()}],animate:[{animate:["none","spin","ping","pulse","bounce",je]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[sa,je]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",je]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",je]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ee()}],"scroll-mx":[{"scroll-mx":ee()}],"scroll-my":[{"scroll-my":ee()}],"scroll-ms":[{"scroll-ms":ee()}],"scroll-me":[{"scroll-me":ee()}],"scroll-mt":[{"scroll-mt":ee()}],"scroll-mr":[{"scroll-mr":ee()}],"scroll-mb":[{"scroll-mb":ee()}],"scroll-ml":[{"scroll-ml":ee()}],"scroll-p":[{"scroll-p":ee()}],"scroll-px":[{"scroll-px":ee()}],"scroll-py":[{"scroll-py":ee()}],"scroll-ps":[{"scroll-ps":ee()}],"scroll-pe":[{"scroll-pe":ee()}],"scroll-pt":[{"scroll-pt":ee()}],"scroll-pr":[{"scroll-pr":ee()}],"scroll-pb":[{"scroll-pb":ee()}],"scroll-pl":[{"scroll-pl":ee()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",je]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[mn,Gn,sf]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Z1=N1(X1);function it(...t){return Z1(d0(t))}const eT=u1,w0=b.forwardRef(({className:t,...e},r)=>w.jsx(s0,{ref:r,className:it("fixed top-0 z-[140] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));w0.displayName=s0.displayName;const tT=Qu("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),b0=b.forwardRef(({className:t,variant:e,...r},s)=>w.jsx(o0,{ref:s,className:it(tT({variant:e}),t),...r}));b0.displayName=o0.displayName;const rT=b.forwardRef(({className:t,...e},r)=>w.jsx(l0,{ref:r,className:it("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-0 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",t),...e}));rT.displayName=l0.displayName;const _0=b.forwardRef(({className:t,...e},r)=>w.jsx(u0,{ref:r,className:it("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:w.jsx(zh,{className:"h-4 w-4"})}));_0.displayName=u0.displayName;const x0=b.forwardRef(({className:t,...e},r)=>w.jsx(i0,{ref:r,className:it("text-sm font-semibold",t),...e}));x0.displayName=i0.displayName;const E0=b.forwardRef(({className:t,...e},r)=>w.jsx(a0,{ref:r,className:it("text-sm opacity-90",t),...e}));E0.displayName=a0.displayName;function nT(){const{toasts:t}=yk();return w.jsxs(eT,{children:[t.map(function({id:e,title:r,description:s,action:i,...a}){return w.jsxs(b0,{...a,children:[w.jsxs("div",{className:"grid gap-1",children:[r&&w.jsx(x0,{children:r}),s&&w.jsx(E0,{children:s})]}),i,w.jsx(_0,{})]},e)}),w.jsx(w0,{})]})}var ju=["light","dark"],Vh="(prefers-color-scheme: dark)",sT=typeof window>"u",Wh=b.createContext(void 0),oT={setTheme:t=>{},themes:[]},S0=()=>{var t;return(t=b.useContext(Wh))!=null?t:oT},iT=t=>b.useContext(Wh)?t.children:b.createElement(lT,{...t}),aT=["light","dark"],lT=({forcedTheme:t,disableTransitionOnChange:e=!1,enableSystem:r=!0,enableColorScheme:s=!0,storageKey:i="theme",themes:a=aT,defaultTheme:u=r?"system":"light",attribute:d="data-theme",value:f,children:p,nonce:g})=>{let[y,_]=b.useState(()=>Uv(i,u)),[v,k]=b.useState(()=>Uv(i)),S=f?Object.values(f):a,x=b.useCallback(j=>{let D=j;if(!D)return;j==="system"&&r&&(D=zv());let A=f?f[D]:D,z=e?cT():null,W=document.documentElement;if(d==="class"?(W.classList.remove(...S),A&&W.classList.add(A)):A?W.setAttribute(d,A):W.removeAttribute(d),s){let Q=ju.includes(u)?u:null,te=ju.includes(D)?D:Q;W.style.colorScheme=te}z==null||z()},[]),T=b.useCallback(j=>{let D=typeof j=="function"?j(j):j;_(D);try{localStorage.setItem(i,D)}catch{}},[t]),R=b.useCallback(j=>{let D=zv(j);k(D),y==="system"&&r&&!t&&x("system")},[y,t]);b.useEffect(()=>{let j=window.matchMedia(Vh);return j.addListener(R),R(j),()=>j.removeListener(R)},[R]),b.useEffect(()=>{let j=D=>{if(D.key!==i)return;let A=D.newValue||u;T(A)};return window.addEventListener("storage",j),()=>window.removeEventListener("storage",j)},[T]),b.useEffect(()=>{x(t??y)},[t,y]);let C=b.useMemo(()=>({theme:y,setTheme:T,forcedTheme:t,resolvedTheme:y==="system"?v:y,themes:r?[...a,"system"]:a,systemTheme:r?v:void 0}),[y,T,t,v,r,a]);return b.createElement(Wh.Provider,{value:C},b.createElement(uT,{forcedTheme:t,disableTransitionOnChange:e,enableSystem:r,enableColorScheme:s,storageKey:i,themes:a,defaultTheme:u,attribute:d,value:f,children:p,attrs:S,nonce:g}),p)},uT=b.memo(({forcedTheme:t,storageKey:e,attribute:r,enableSystem:s,enableColorScheme:i,defaultTheme:a,value:u,attrs:d,nonce:f})=>{let p=a==="system",g=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${d.map(k=>`'${k}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,y=i?ju.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",_=(k,S=!1,x=!0)=>{let T=u?u[k]:k,R=S?k+"|| ''":`'${T}'`,C="";return i&&x&&!S&&ju.includes(k)&&(C+=`d.style.colorScheme = '${k}';`),r==="class"?S||T?C+=`c.add(${R})`:C+="null":T&&(C+=`d[s](n,${R})`),C},v=t?`!function(){${g}${_(t)}}()`:s?`!function(){try{${g}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${p})){var t='${Vh}',m=window.matchMedia(t);if(m.media!==t||m.matches){${_("dark")}}else{${_("light")}}}else if(e){${u?`var x=${JSON.stringify(u)};`:""}${_(u?"x[e]":"e",!0)}}${p?"":"else{"+_(a,!1,!1)+"}"}${y}}catch(e){}}()`:`!function(){try{${g}var e=localStorage.getItem('${e}');if(e){${u?`var x=${JSON.stringify(u)};`:""}${_(u?"x[e]":"e",!0)}}else{${_(a,!1,!1)};}${y}}catch(t){}}();`;return b.createElement("script",{nonce:f,dangerouslySetInnerHTML:{__html:v}})}),Uv=(t,e)=>{if(sT)return;let r;try{r=localStorage.getItem(t)||void 0}catch{}return r||e},cT=()=>{let t=document.createElement("style");return t.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},zv=t=>(t||(t=window.matchMedia(Vh)),t.matches?"dark":"light");const dT=({...t})=>{const{theme:e="system"}=S0();return w.jsx(XS,{theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})};var fT=Iw[" useId ".trim().toString()]||(()=>{}),hT=0;function Hh(t){const[e,r]=b.useState(fT());return _n(()=>{r(s=>s??String(hT++))},[t]),e?`radix-${e}`:""}const pT=["top","right","bottom","left"],cs=Math.min,Yt=Math.max,Ou=Math.round,su=Math.floor,tn=t=>({x:t,y:t}),mT={left:"right",right:"left",bottom:"top",top:"bottom"},gT={start:"end",end:"start"};function zf(t,e,r){return Yt(t,cs(e,r))}function xn(t,e){return typeof t=="function"?t(e):t}function En(t){return t.split("-")[0]}function pi(t){return t.split("-")[1]}function qh(t){return t==="x"?"y":"x"}function Kh(t){return t==="y"?"height":"width"}const vT=new Set(["top","bottom"]);function en(t){return vT.has(En(t))?"y":"x"}function Gh(t){return qh(en(t))}function yT(t,e,r){r===void 0&&(r=!1);const s=pi(t),i=Gh(t),a=Kh(i);let u=i==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(u=Au(u)),[u,Au(u)]}function wT(t){const e=Au(t);return[Bf(t),e,Bf(e)]}function Bf(t){return t.replace(/start|end/g,e=>gT[e])}const Bv=["left","right"],Vv=["right","left"],bT=["top","bottom"],_T=["bottom","top"];function xT(t,e,r){switch(t){case"top":case"bottom":return r?e?Vv:Bv:e?Bv:Vv;case"left":case"right":return e?bT:_T;default:return[]}}function ET(t,e,r,s){const i=pi(t);let a=xT(En(t),r==="start",s);return i&&(a=a.map(u=>u+"-"+i),e&&(a=a.concat(a.map(Bf)))),a}function Au(t){return t.replace(/left|right|bottom|top/g,e=>mT[e])}function ST(t){return{top:0,right:0,bottom:0,left:0,...t}}function k0(t){return typeof t!="number"?ST(t):{top:t,right:t,bottom:t,left:t}}function Iu(t){const{x:e,y:r,width:s,height:i}=t;return{width:s,height:i,top:r,left:e,right:e+s,bottom:r+i,x:e,y:r}}function Wv(t,e,r){let{reference:s,floating:i}=t;const a=en(e),u=Gh(e),d=Kh(u),f=En(e),p=a==="y",g=s.x+s.width/2-i.width/2,y=s.y+s.height/2-i.height/2,_=s[d]/2-i[d]/2;let v;switch(f){case"top":v={x:g,y:s.y-i.height};break;case"bottom":v={x:g,y:s.y+s.height};break;case"right":v={x:s.x+s.width,y};break;case"left":v={x:s.x-i.width,y};break;default:v={x:s.x,y:s.y}}switch(pi(e)){case"start":v[u]-=_*(r&&p?-1:1);break;case"end":v[u]+=_*(r&&p?-1:1);break}return v}const kT=async(t,e,r)=>{const{placement:s="bottom",strategy:i="absolute",middleware:a=[],platform:u}=r,d=a.filter(Boolean),f=await(u.isRTL==null?void 0:u.isRTL(e));let p=await u.getElementRects({reference:t,floating:e,strategy:i}),{x:g,y}=Wv(p,s,f),_=s,v={},k=0;for(let S=0;S({name:"arrow",options:t,async fn(e){const{x:r,y:s,placement:i,rects:a,platform:u,elements:d,middlewareData:f}=e,{element:p,padding:g=0}=xn(t,e)||{};if(p==null)return{};const y=k0(g),_={x:r,y:s},v=Gh(i),k=Kh(v),S=await u.getDimensions(p),x=v==="y",T=x?"top":"left",R=x?"bottom":"right",C=x?"clientHeight":"clientWidth",j=a.reference[k]+a.reference[v]-_[v]-a.floating[k],D=_[v]-a.reference[v],A=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p));let z=A?A[C]:0;(!z||!await(u.isElement==null?void 0:u.isElement(A)))&&(z=d.floating[C]||a.floating[k]);const W=j/2-D/2,Q=z/2-S[k]/2-1,te=cs(y[T],Q),me=cs(y[R],Q),ee=te,pe=z-S[k]-me,X=z/2-S[k]/2+W,ge=zf(ee,X,pe),oe=!f.arrow&&pi(i)!=null&&X!==ge&&a.reference[k]/2-(XX<=0)){var me,ee;const X=(((me=a.flip)==null?void 0:me.index)||0)+1,ge=z[X];if(ge&&(!(y==="alignment"?R!==en(ge):!1)||te.every(B=>B.overflows[0]>0&&en(B.placement)===R)))return{data:{index:X,overflows:te},reset:{placement:ge}};let oe=(ee=te.filter(ue=>ue.overflows[0]<=0).sort((ue,B)=>ue.overflows[1]-B.overflows[1])[0])==null?void 0:ee.placement;if(!oe)switch(v){case"bestFit":{var pe;const ue=(pe=te.filter(B=>{if(A){const V=en(B.placement);return V===R||V==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(V=>V>0).reduce((V,K)=>V+K,0)]).sort((B,V)=>B[1]-V[1])[0])==null?void 0:pe[0];ue&&(oe=ue);break}case"initialPlacement":oe=d;break}if(i!==oe)return{reset:{placement:oe}}}return{}}}};function Hv(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function qv(t){return pT.some(e=>t[e]>=0)}const CT=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:s="referenceHidden",...i}=xn(t,e);switch(s){case"referenceHidden":{const a=await va(e,{...i,elementContext:"reference"}),u=Hv(a,r.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:qv(u)}}}case"escaped":{const a=await va(e,{...i,altBoundary:!0}),u=Hv(a,r.floating);return{data:{escapedOffsets:u,escaped:qv(u)}}}default:return{}}}}},T0=new Set(["left","top"]);async function PT(t,e){const{placement:r,platform:s,elements:i}=t,a=await(s.isRTL==null?void 0:s.isRTL(i.floating)),u=En(r),d=pi(r),f=en(r)==="y",p=T0.has(u)?-1:1,g=a&&f?-1:1,y=xn(e,t);let{mainAxis:_,crossAxis:v,alignmentAxis:k}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return d&&typeof k=="number"&&(v=d==="end"?k*-1:k),f?{x:v*g,y:_*p}:{x:_*p,y:v*g}}const jT=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,s;const{x:i,y:a,placement:u,middlewareData:d}=e,f=await PT(e,t);return u===((r=d.offset)==null?void 0:r.placement)&&(s=d.arrow)!=null&&s.alignmentOffset?{}:{x:i+f.x,y:a+f.y,data:{...f,placement:u}}}}},OT=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:s,placement:i}=e,{mainAxis:a=!0,crossAxis:u=!1,limiter:d={fn:x=>{let{x:T,y:R}=x;return{x:T,y:R}}},...f}=xn(t,e),p={x:r,y:s},g=await va(e,f),y=en(En(i)),_=qh(y);let v=p[_],k=p[y];if(a){const x=_==="y"?"top":"left",T=_==="y"?"bottom":"right",R=v+g[x],C=v-g[T];v=zf(R,v,C)}if(u){const x=y==="y"?"top":"left",T=y==="y"?"bottom":"right",R=k+g[x],C=k-g[T];k=zf(R,k,C)}const S=d.fn({...e,[_]:v,[y]:k});return{...S,data:{x:S.x-r,y:S.y-s,enabled:{[_]:a,[y]:u}}}}}},AT=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:s,placement:i,rects:a,middlewareData:u}=e,{offset:d=0,mainAxis:f=!0,crossAxis:p=!0}=xn(t,e),g={x:r,y:s},y=en(i),_=qh(y);let v=g[_],k=g[y];const S=xn(d,e),x=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(f){const C=_==="y"?"height":"width",j=a.reference[_]-a.floating[C]+x.mainAxis,D=a.reference[_]+a.reference[C]-x.mainAxis;vD&&(v=D)}if(p){var T,R;const C=_==="y"?"width":"height",j=T0.has(En(i)),D=a.reference[y]-a.floating[C]+(j&&((T=u.offset)==null?void 0:T[y])||0)+(j?0:x.crossAxis),A=a.reference[y]+a.reference[C]+(j?0:((R=u.offset)==null?void 0:R[y])||0)-(j?x.crossAxis:0);kA&&(k=A)}return{[_]:v,[y]:k}}}},IT=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,s;const{placement:i,rects:a,platform:u,elements:d}=e,{apply:f=()=>{},...p}=xn(t,e),g=await va(e,p),y=En(i),_=pi(i),v=en(i)==="y",{width:k,height:S}=a.floating;let x,T;y==="top"||y==="bottom"?(x=y,T=_===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(T=y,x=_==="end"?"top":"bottom");const R=S-g.top-g.bottom,C=k-g.left-g.right,j=cs(S-g[x],R),D=cs(k-g[T],C),A=!e.middlewareData.shift;let z=j,W=D;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(W=C),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(z=R),A&&!_){const te=Yt(g.left,0),me=Yt(g.right,0),ee=Yt(g.top,0),pe=Yt(g.bottom,0);v?W=k-2*(te!==0||me!==0?te+me:Yt(g.left,g.right)):z=S-2*(ee!==0||pe!==0?ee+pe:Yt(g.top,g.bottom))}await f({...e,availableWidth:W,availableHeight:z});const Q=await u.getDimensions(d.floating);return k!==Q.width||S!==Q.height?{reset:{rects:!0}}:{}}}};function Ju(){return typeof window<"u"}function mi(t){return R0(t)?(t.nodeName||"").toLowerCase():"#document"}function er(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function nn(t){var e;return(e=(R0(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function R0(t){return Ju()?t instanceof Node||t instanceof er(t).Node:!1}function Lr(t){return Ju()?t instanceof Element||t instanceof er(t).Element:!1}function rn(t){return Ju()?t instanceof HTMLElement||t instanceof er(t).HTMLElement:!1}function Kv(t){return!Ju()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof er(t).ShadowRoot}const NT=new Set(["inline","contents"]);function Ia(t){const{overflow:e,overflowX:r,overflowY:s,display:i}=Dr(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+r)&&!NT.has(i)}const LT=new Set(["table","td","th"]);function DT(t){return LT.has(mi(t))}const $T=[":popover-open",":modal"];function Yu(t){return $T.some(e=>{try{return t.matches(e)}catch{return!1}})}const MT=["transform","translate","scale","rotate","perspective"],FT=["transform","translate","scale","rotate","perspective","filter"],UT=["paint","layout","strict","content"];function Qh(t){const e=Jh(),r=Lr(t)?Dr(t):t;return MT.some(s=>r[s]?r[s]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||FT.some(s=>(r.willChange||"").includes(s))||UT.some(s=>(r.contain||"").includes(s))}function zT(t){let e=ds(t);for(;rn(e)&&!si(e);){if(Qh(e))return e;if(Yu(e))return null;e=ds(e)}return null}function Jh(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const BT=new Set(["html","body","#document"]);function si(t){return BT.has(mi(t))}function Dr(t){return er(t).getComputedStyle(t)}function Xu(t){return Lr(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ds(t){if(mi(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Kv(t)&&t.host||nn(t);return Kv(e)?e.host:e}function C0(t){const e=ds(t);return si(e)?t.ownerDocument?t.ownerDocument.body:t.body:rn(e)&&Ia(e)?e:C0(e)}function ya(t,e,r){var s;e===void 0&&(e=[]),r===void 0&&(r=!0);const i=C0(t),a=i===((s=t.ownerDocument)==null?void 0:s.body),u=er(i);if(a){const d=Vf(u);return e.concat(u,u.visualViewport||[],Ia(i)?i:[],d&&r?ya(d):[])}return e.concat(i,ya(i,[],r))}function Vf(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function P0(t){const e=Dr(t);let r=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const i=rn(t),a=i?t.offsetWidth:r,u=i?t.offsetHeight:s,d=Ou(r)!==a||Ou(s)!==u;return d&&(r=a,s=u),{width:r,height:s,$:d}}function Yh(t){return Lr(t)?t:t.contextElement}function Vo(t){const e=Yh(t);if(!rn(e))return tn(1);const r=e.getBoundingClientRect(),{width:s,height:i,$:a}=P0(e);let u=(a?Ou(r.width):r.width)/s,d=(a?Ou(r.height):r.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const VT=tn(0);function j0(t){const e=er(t);return!Jh()||!e.visualViewport?VT:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function WT(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==er(t)?!1:e}function Gs(t,e,r,s){e===void 0&&(e=!1),r===void 0&&(r=!1);const i=t.getBoundingClientRect(),a=Yh(t);let u=tn(1);e&&(s?Lr(s)&&(u=Vo(s)):u=Vo(t));const d=WT(a,r,s)?j0(a):tn(0);let f=(i.left+d.x)/u.x,p=(i.top+d.y)/u.y,g=i.width/u.x,y=i.height/u.y;if(a){const _=er(a),v=s&&Lr(s)?er(s):s;let k=_,S=Vf(k);for(;S&&s&&v!==k;){const x=Vo(S),T=S.getBoundingClientRect(),R=Dr(S),C=T.left+(S.clientLeft+parseFloat(R.paddingLeft))*x.x,j=T.top+(S.clientTop+parseFloat(R.paddingTop))*x.y;f*=x.x,p*=x.y,g*=x.x,y*=x.y,f+=C,p+=j,k=er(S),S=Vf(k)}}return Iu({width:g,height:y,x:f,y:p})}function Xh(t,e){const r=Xu(t).scrollLeft;return e?e.left+r:Gs(nn(t)).left+r}function O0(t,e,r){r===void 0&&(r=!1);const s=t.getBoundingClientRect(),i=s.left+e.scrollLeft-(r?0:Xh(t,s)),a=s.top+e.scrollTop;return{x:i,y:a}}function HT(t){let{elements:e,rect:r,offsetParent:s,strategy:i}=t;const a=i==="fixed",u=nn(s),d=e?Yu(e.floating):!1;if(s===u||d&&a)return r;let f={scrollLeft:0,scrollTop:0},p=tn(1);const g=tn(0),y=rn(s);if((y||!y&&!a)&&((mi(s)!=="body"||Ia(u))&&(f=Xu(s)),rn(s))){const v=Gs(s);p=Vo(s),g.x=v.x+s.clientLeft,g.y=v.y+s.clientTop}const _=u&&!y&&!a?O0(u,f,!0):tn(0);return{width:r.width*p.x,height:r.height*p.y,x:r.x*p.x-f.scrollLeft*p.x+g.x+_.x,y:r.y*p.y-f.scrollTop*p.y+g.y+_.y}}function qT(t){return Array.from(t.getClientRects())}function KT(t){const e=nn(t),r=Xu(t),s=t.ownerDocument.body,i=Yt(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),a=Yt(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let u=-r.scrollLeft+Xh(t);const d=-r.scrollTop;return Dr(s).direction==="rtl"&&(u+=Yt(e.clientWidth,s.clientWidth)-i),{width:i,height:a,x:u,y:d}}function GT(t,e){const r=er(t),s=nn(t),i=r.visualViewport;let a=s.clientWidth,u=s.clientHeight,d=0,f=0;if(i){a=i.width,u=i.height;const p=Jh();(!p||p&&e==="fixed")&&(d=i.offsetLeft,f=i.offsetTop)}return{width:a,height:u,x:d,y:f}}const QT=new Set(["absolute","fixed"]);function JT(t,e){const r=Gs(t,!0,e==="fixed"),s=r.top+t.clientTop,i=r.left+t.clientLeft,a=rn(t)?Vo(t):tn(1),u=t.clientWidth*a.x,d=t.clientHeight*a.y,f=i*a.x,p=s*a.y;return{width:u,height:d,x:f,y:p}}function Gv(t,e,r){let s;if(e==="viewport")s=GT(t,r);else if(e==="document")s=KT(nn(t));else if(Lr(e))s=JT(e,r);else{const i=j0(t);s={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Iu(s)}function A0(t,e){const r=ds(t);return r===e||!Lr(r)||si(r)?!1:Dr(r).position==="fixed"||A0(r,e)}function YT(t,e){const r=e.get(t);if(r)return r;let s=ya(t,[],!1).filter(d=>Lr(d)&&mi(d)!=="body"),i=null;const a=Dr(t).position==="fixed";let u=a?ds(t):t;for(;Lr(u)&&!si(u);){const d=Dr(u),f=Qh(u);!f&&d.position==="fixed"&&(i=null),(a?!f&&!i:!f&&d.position==="static"&&!!i&&QT.has(i.position)||Ia(u)&&!f&&A0(t,u))?s=s.filter(g=>g!==u):i=d,u=ds(u)}return e.set(t,s),s}function XT(t){let{element:e,boundary:r,rootBoundary:s,strategy:i}=t;const u=[...r==="clippingAncestors"?Yu(e)?[]:YT(e,this._c):[].concat(r),s],d=u[0],f=u.reduce((p,g)=>{const y=Gv(e,g,i);return p.top=Yt(y.top,p.top),p.right=cs(y.right,p.right),p.bottom=cs(y.bottom,p.bottom),p.left=Yt(y.left,p.left),p},Gv(e,d,i));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function ZT(t){const{width:e,height:r}=P0(t);return{width:e,height:r}}function eR(t,e,r){const s=rn(e),i=nn(e),a=r==="fixed",u=Gs(t,!0,a,e);let d={scrollLeft:0,scrollTop:0};const f=tn(0);function p(){f.x=Xh(i)}if(s||!s&&!a)if((mi(e)!=="body"||Ia(i))&&(d=Xu(e)),s){const v=Gs(e,!0,a,e);f.x=v.x+e.clientLeft,f.y=v.y+e.clientTop}else i&&p();a&&!s&&i&&p();const g=i&&!s&&!a?O0(i,d):tn(0),y=u.left+d.scrollLeft-f.x-g.x,_=u.top+d.scrollTop-f.y-g.y;return{x:y,y:_,width:u.width,height:u.height}}function of(t){return Dr(t).position==="static"}function Qv(t,e){if(!rn(t)||Dr(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return nn(t)===r&&(r=r.ownerDocument.body),r}function I0(t,e){const r=er(t);if(Yu(t))return r;if(!rn(t)){let i=ds(t);for(;i&&!si(i);){if(Lr(i)&&!of(i))return i;i=ds(i)}return r}let s=Qv(t,e);for(;s&&DT(s)&&of(s);)s=Qv(s,e);return s&&si(s)&&of(s)&&!Qh(s)?r:s||zT(t)||r}const tR=async function(t){const e=this.getOffsetParent||I0,r=this.getDimensions,s=await r(t.floating);return{reference:eR(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function rR(t){return Dr(t).direction==="rtl"}const nR={convertOffsetParentRelativeRectToViewportRelativeRect:HT,getDocumentElement:nn,getClippingRect:XT,getOffsetParent:I0,getElementRects:tR,getClientRects:qT,getDimensions:ZT,getScale:Vo,isElement:Lr,isRTL:rR};function N0(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function sR(t,e){let r=null,s;const i=nn(t);function a(){var d;clearTimeout(s),(d=r)==null||d.disconnect(),r=null}function u(d,f){d===void 0&&(d=!1),f===void 0&&(f=1),a();const p=t.getBoundingClientRect(),{left:g,top:y,width:_,height:v}=p;if(d||e(),!_||!v)return;const k=su(y),S=su(i.clientWidth-(g+_)),x=su(i.clientHeight-(y+v)),T=su(g),C={rootMargin:-k+"px "+-S+"px "+-x+"px "+-T+"px",threshold:Yt(0,cs(1,f))||1};let j=!0;function D(A){const z=A[0].intersectionRatio;if(z!==f){if(!j)return u();z?u(!1,z):s=setTimeout(()=>{u(!1,1e-7)},1e3)}z===1&&!N0(p,t.getBoundingClientRect())&&u(),j=!1}try{r=new IntersectionObserver(D,{...C,root:i.ownerDocument})}catch{r=new IntersectionObserver(D,C)}r.observe(t)}return u(!0),a}function oR(t,e,r,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:f=!1}=s,p=Yh(t),g=i||a?[...p?ya(p):[],...ya(e)]:[];g.forEach(T=>{i&&T.addEventListener("scroll",r,{passive:!0}),a&&T.addEventListener("resize",r)});const y=p&&d?sR(p,r):null;let _=-1,v=null;u&&(v=new ResizeObserver(T=>{let[R]=T;R&&R.target===p&&v&&(v.unobserve(e),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var C;(C=v)==null||C.observe(e)})),r()}),p&&!f&&v.observe(p),v.observe(e));let k,S=f?Gs(t):null;f&&x();function x(){const T=Gs(t);S&&!N0(S,T)&&r(),S=T,k=requestAnimationFrame(x)}return r(),()=>{var T;g.forEach(R=>{i&&R.removeEventListener("scroll",r),a&&R.removeEventListener("resize",r)}),y==null||y(),(T=v)==null||T.disconnect(),v=null,f&&cancelAnimationFrame(k)}}const iR=jT,aR=OT,lR=RT,uR=IT,cR=CT,Jv=TT,dR=AT,fR=(t,e,r)=>{const s=new Map,i={platform:nR,...r},a={...i.platform,_c:s};return kT(t,e,{...i,platform:a})};var hR=typeof document<"u",pR=function(){},Eu=hR?b.useLayoutEffect:pR;function Nu(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,s,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(s=r;s--!==0;)if(!Nu(t[s],e[s]))return!1;return!0}if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(e,i[s]))return!1;for(s=r;s--!==0;){const a=i[s];if(!(a==="_owner"&&t.$$typeof)&&!Nu(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function L0(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Yv(t,e){const r=L0(t);return Math.round(e*r)/r}function af(t){const e=b.useRef(t);return Eu(()=>{e.current=t}),e}function mR(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:s=[],platform:i,elements:{reference:a,floating:u}={},transform:d=!0,whileElementsMounted:f,open:p}=t,[g,y]=b.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[_,v]=b.useState(s);Nu(_,s)||v(s);const[k,S]=b.useState(null),[x,T]=b.useState(null),R=b.useCallback(B=>{B!==A.current&&(A.current=B,S(B))},[]),C=b.useCallback(B=>{B!==z.current&&(z.current=B,T(B))},[]),j=a||k,D=u||x,A=b.useRef(null),z=b.useRef(null),W=b.useRef(g),Q=f!=null,te=af(f),me=af(i),ee=af(p),pe=b.useCallback(()=>{if(!A.current||!z.current)return;const B={placement:e,strategy:r,middleware:_};me.current&&(B.platform=me.current),fR(A.current,z.current,B).then(V=>{const K={...V,isPositioned:ee.current!==!1};X.current&&!Nu(W.current,K)&&(W.current=K,Wu.flushSync(()=>{y(K)}))})},[_,e,r,me,ee]);Eu(()=>{p===!1&&W.current.isPositioned&&(W.current.isPositioned=!1,y(B=>({...B,isPositioned:!1})))},[p]);const X=b.useRef(!1);Eu(()=>(X.current=!0,()=>{X.current=!1}),[]),Eu(()=>{if(j&&(A.current=j),D&&(z.current=D),j&&D){if(te.current)return te.current(j,D,pe);pe()}},[j,D,pe,te,Q]);const ge=b.useMemo(()=>({reference:A,floating:z,setReference:R,setFloating:C}),[R,C]),oe=b.useMemo(()=>({reference:j,floating:D}),[j,D]),ue=b.useMemo(()=>{const B={position:r,left:0,top:0};if(!oe.floating)return B;const V=Yv(oe.floating,g.x),K=Yv(oe.floating,g.y);return d?{...B,transform:"translate("+V+"px, "+K+"px)",...L0(oe.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:V,top:K}},[r,d,oe.floating,g.x,g.y]);return b.useMemo(()=>({...g,update:pe,refs:ge,elements:oe,floatingStyles:ue}),[g,pe,ge,oe,ue])}const gR=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:s,padding:i}=typeof t=="function"?t(r):t;return s&&e(s)?s.current!=null?Jv({element:s.current,padding:i}).fn(r):{}:s?Jv({element:s,padding:i}).fn(r):{}}}},vR=(t,e)=>({...iR(t),options:[t,e]}),yR=(t,e)=>({...aR(t),options:[t,e]}),wR=(t,e)=>({...dR(t),options:[t,e]}),bR=(t,e)=>({...lR(t),options:[t,e]}),_R=(t,e)=>({...uR(t),options:[t,e]}),xR=(t,e)=>({...cR(t),options:[t,e]}),ER=(t,e)=>({...gR(t),options:[t,e]});var SR="Arrow",D0=b.forwardRef((t,e)=>{const{children:r,width:s=10,height:i=5,...a}=t;return w.jsx(ot.svg,{...a,ref:e,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:w.jsx("polygon",{points:"0,0 30,0 15,10"})})});D0.displayName=SR;var kR=D0;function TR(t){const[e,r]=b.useState(void 0);return _n(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const a=i[0];let u,d;if("borderBoxSize"in a){const f=a.borderBoxSize,p=Array.isArray(f)?f[0]:f;u=p.inlineSize,d=p.blockSize}else u=t.offsetWidth,d=t.offsetHeight;r({width:u,height:d})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else r(void 0)},[t]),e}var Zh="Popper",[$0,M0]=fi(Zh),[RR,F0]=$0(Zh),U0=t=>{const{__scopePopper:e,children:r}=t,[s,i]=b.useState(null);return w.jsx(RR,{scope:e,anchor:s,onAnchorChange:i,children:r})};U0.displayName=Zh;var z0="PopperAnchor",B0=b.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:s,...i}=t,a=F0(z0,r),u=b.useRef(null),d=hr(e,u);return b.useEffect(()=>{a.onAnchorChange((s==null?void 0:s.current)||u.current)}),s?null:w.jsx(ot.div,{...i,ref:d})});B0.displayName=z0;var ep="PopperContent",[CR,PR]=$0(ep),V0=b.forwardRef((t,e)=>{var de,xe,Pe,Ve,gt,qt;const{__scopePopper:r,side:s="bottom",sideOffset:i=0,align:a="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:f=!0,collisionBoundary:p=[],collisionPadding:g=0,sticky:y="partial",hideWhenDetached:_=!1,updatePositionStrategy:v="optimized",onPlaced:k,...S}=t,x=F0(ep,r),[T,R]=b.useState(null),C=hr(e,vt=>R(vt)),[j,D]=b.useState(null),A=TR(j),z=(A==null?void 0:A.width)??0,W=(A==null?void 0:A.height)??0,Q=s+(a!=="center"?"-"+a:""),te=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},me=Array.isArray(p)?p:[p],ee=me.length>0,pe={padding:te,boundary:me.filter(OR),altBoundary:ee},{refs:X,floatingStyles:ge,placement:oe,isPositioned:ue,middlewareData:B}=mR({strategy:"fixed",placement:Q,whileElementsMounted:(...vt)=>oR(...vt,{animationFrame:v==="always"}),elements:{reference:x.anchor},middleware:[vR({mainAxis:i+W,alignmentAxis:u}),f&&yR({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?wR():void 0,...pe}),f&&bR({...pe}),_R({...pe,apply:({elements:vt,rects:gr,availableWidth:sn,availableHeight:ps})=>{const{width:ms,height:Tn}=gr.reference,$r=vt.floating.style;$r.setProperty("--radix-popper-available-width",`${sn}px`),$r.setProperty("--radix-popper-available-height",`${ps}px`),$r.setProperty("--radix-popper-anchor-width",`${ms}px`),$r.setProperty("--radix-popper-anchor-height",`${Tn}px`)}}),j&&ER({element:j,padding:d}),AR({arrowWidth:z,arrowHeight:W}),_&&xR({strategy:"referenceHidden",...pe})]}),[V,K]=q0(oe),N=bn(k);_n(()=>{ue&&(N==null||N())},[ue,N]);const U=(de=B.arrow)==null?void 0:de.x,re=(xe=B.arrow)==null?void 0:xe.y,J=((Pe=B.arrow)==null?void 0:Pe.centerOffset)!==0,[se,ye]=b.useState();return _n(()=>{T&&ye(window.getComputedStyle(T).zIndex)},[T]),w.jsx("div",{ref:X.setFloating,"data-radix-popper-content-wrapper":"",style:{...ge,transform:ue?ge.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(Ve=B.transformOrigin)==null?void 0:Ve.x,(gt=B.transformOrigin)==null?void 0:gt.y].join(" "),...((qt=B.hide)==null?void 0:qt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:w.jsx(CR,{scope:r,placedSide:V,onArrowChange:D,arrowX:U,arrowY:re,shouldHideArrow:J,children:w.jsx(ot.div,{"data-side":V,"data-align":K,...S,ref:C,style:{...S.style,animation:ue?void 0:"none"}})})})});V0.displayName=ep;var W0="PopperArrow",jR={top:"bottom",right:"left",bottom:"top",left:"right"},H0=b.forwardRef(function(e,r){const{__scopePopper:s,...i}=e,a=PR(W0,s),u=jR[a.placedSide];return w.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:w.jsx(kR,{...i,ref:r,style:{...i.style,display:"block"}})})});H0.displayName=W0;function OR(t){return t!==null}var AR=t=>({name:"transformOrigin",options:t,fn(e){var x,T,R;const{placement:r,rects:s,middlewareData:i}=e,u=((x=i.arrow)==null?void 0:x.centerOffset)!==0,d=u?0:t.arrowWidth,f=u?0:t.arrowHeight,[p,g]=q0(r),y={start:"0%",center:"50%",end:"100%"}[g],_=(((T=i.arrow)==null?void 0:T.x)??0)+d/2,v=(((R=i.arrow)==null?void 0:R.y)??0)+f/2;let k="",S="";return p==="bottom"?(k=u?y:`${_}px`,S=`${-f}px`):p==="top"?(k=u?y:`${_}px`,S=`${s.floating.height+f}px`):p==="right"?(k=`${-f}px`,S=u?y:`${v}px`):p==="left"&&(k=`${s.floating.width+f}px`,S=u?y:`${v}px`),{data:{x:k,y:S}}}});function q0(t){const[e,r="center"]=t.split("-");return[e,r]}var IR=U0,NR=B0,LR=V0,DR=H0,[Zu]=fi("Tooltip",[M0]),ec=M0(),K0="TooltipProvider",$R=700,Wf="tooltip.open",[MR,tp]=Zu(K0),G0=t=>{const{__scopeTooltip:e,delayDuration:r=$R,skipDelayDuration:s=300,disableHoverableContent:i=!1,children:a}=t,u=b.useRef(!0),d=b.useRef(!1),f=b.useRef(0);return b.useEffect(()=>{const p=f.current;return()=>window.clearTimeout(p)},[]),w.jsx(MR,{scope:e,isOpenDelayedRef:u,delayDuration:r,onOpen:b.useCallback(()=>{window.clearTimeout(f.current),u.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>u.current=!0,s)},[s]),isPointerInTransitRef:d,onPointerInTransitChange:b.useCallback(p=>{d.current=p},[]),disableHoverableContent:i,children:a})};G0.displayName=K0;var wa="Tooltip",[FR,tc]=Zu(wa),Q0=t=>{const{__scopeTooltip:e,children:r,open:s,defaultOpen:i,onOpenChange:a,disableHoverableContent:u,delayDuration:d}=t,f=tp(wa,t.__scopeTooltip),p=ec(e),[g,y]=b.useState(null),_=Hh(),v=b.useRef(0),k=u??f.disableHoverableContent,S=d??f.delayDuration,x=b.useRef(!1),[T,R]=qu({prop:s,defaultProp:i??!1,onChange:z=>{z?(f.onOpen(),document.dispatchEvent(new CustomEvent(Wf))):f.onClose(),a==null||a(z)},caller:wa}),C=b.useMemo(()=>T?x.current?"delayed-open":"instant-open":"closed",[T]),j=b.useCallback(()=>{window.clearTimeout(v.current),v.current=0,x.current=!1,R(!0)},[R]),D=b.useCallback(()=>{window.clearTimeout(v.current),v.current=0,R(!1)},[R]),A=b.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{x.current=!0,R(!0),v.current=0},S)},[S,R]);return b.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),w.jsx(IR,{...p,children:w.jsx(FR,{scope:e,contentId:_,open:T,stateAttribute:C,trigger:g,onTriggerChange:y,onTriggerEnter:b.useCallback(()=>{f.isOpenDelayedRef.current?A():j()},[f.isOpenDelayedRef,A,j]),onTriggerLeave:b.useCallback(()=>{k?D():(window.clearTimeout(v.current),v.current=0)},[D,k]),onOpen:j,onClose:D,disableHoverableContent:k,children:r})})};Q0.displayName=wa;var Hf="TooltipTrigger",J0=b.forwardRef((t,e)=>{const{__scopeTooltip:r,...s}=t,i=tc(Hf,r),a=tp(Hf,r),u=ec(r),d=b.useRef(null),f=hr(e,d,i.onTriggerChange),p=b.useRef(!1),g=b.useRef(!1),y=b.useCallback(()=>p.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),w.jsx(NR,{asChild:!0,...u,children:w.jsx(ot.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...s,ref:f,onPointerMove:ze(t.onPointerMove,_=>{_.pointerType!=="touch"&&!g.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),g.current=!0)}),onPointerLeave:ze(t.onPointerLeave,()=>{i.onTriggerLeave(),g.current=!1}),onPointerDown:ze(t.onPointerDown,()=>{i.open&&i.onClose(),p.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:ze(t.onFocus,()=>{p.current||i.onOpen()}),onBlur:ze(t.onBlur,i.onClose),onClick:ze(t.onClick,i.onClose)})})});J0.displayName=Hf;var UR="TooltipPortal",[T2,zR]=Zu(UR,{forceMount:void 0}),oi="TooltipContent",Y0=b.forwardRef((t,e)=>{const r=zR(oi,t.__scopeTooltip),{forceMount:s=r.forceMount,side:i="top",...a}=t,u=tc(oi,t.__scopeTooltip);return w.jsx(Hu,{present:s||u.open,children:u.disableHoverableContent?w.jsx(X0,{side:i,...a,ref:e}):w.jsx(BR,{side:i,...a,ref:e})})}),BR=b.forwardRef((t,e)=>{const r=tc(oi,t.__scopeTooltip),s=tp(oi,t.__scopeTooltip),i=b.useRef(null),a=hr(e,i),[u,d]=b.useState(null),{trigger:f,onClose:p}=r,g=i.current,{onPointerInTransitChange:y}=s,_=b.useCallback(()=>{d(null),y(!1)},[y]),v=b.useCallback((k,S)=>{const x=k.currentTarget,T={x:k.clientX,y:k.clientY},R=KR(T,x.getBoundingClientRect()),C=GR(T,R),j=QR(S.getBoundingClientRect()),D=YR([...C,...j]);d(D),y(!0)},[y]);return b.useEffect(()=>()=>_(),[_]),b.useEffect(()=>{if(f&&g){const k=x=>v(x,g),S=x=>v(x,f);return f.addEventListener("pointerleave",k),g.addEventListener("pointerleave",S),()=>{f.removeEventListener("pointerleave",k),g.removeEventListener("pointerleave",S)}}},[f,g,v,_]),b.useEffect(()=>{if(u){const k=S=>{const x=S.target,T={x:S.clientX,y:S.clientY},R=(f==null?void 0:f.contains(x))||(g==null?void 0:g.contains(x)),C=!JR(T,u);R?_():C&&(_(),p())};return document.addEventListener("pointermove",k),()=>document.removeEventListener("pointermove",k)}},[f,g,u,p,_]),w.jsx(X0,{...t,ref:a})}),[VR,WR]=Zu(wa,{isInside:!1}),HR=xk("TooltipContent"),X0=b.forwardRef((t,e)=>{const{__scopeTooltip:r,children:s,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:u,...d}=t,f=tc(oi,r),p=ec(r),{onClose:g}=f;return b.useEffect(()=>(document.addEventListener(Wf,g),()=>document.removeEventListener(Wf,g)),[g]),b.useEffect(()=>{if(f.trigger){const y=_=>{const v=_.target;v!=null&&v.contains(f.trigger)&&g()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[f.trigger,g]),w.jsx($h,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:u,onFocusOutside:y=>y.preventDefault(),onDismiss:g,children:w.jsxs(LR,{"data-state":f.stateAttribute,...p,...d,ref:e,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[w.jsx(HR,{children:s}),w.jsx(VR,{scope:r,isInside:!0,children:w.jsx(Hk,{id:f.contentId,role:"tooltip",children:i||s})})]})})});Y0.displayName=oi;var Z0="TooltipArrow",qR=b.forwardRef((t,e)=>{const{__scopeTooltip:r,...s}=t,i=ec(r);return WR(Z0,r).isInside?null:w.jsx(DR,{...i,...s,ref:e})});qR.displayName=Z0;function KR(t,e){const r=Math.abs(e.top-t.y),s=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),a=Math.abs(e.left-t.x);switch(Math.min(r,s,i,a)){case a:return"left";case i:return"right";case r:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function GR(t,e,r=5){const s=[];switch(e){case"top":s.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":s.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":s.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":s.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return s}function QR(t){const{top:e,right:r,bottom:s,left:i}=t;return[{x:i,y:e},{x:r,y:e},{x:r,y:s},{x:i,y:s}]}function JR(t,e){const{x:r,y:s}=t;let i=!1;for(let a=0,u=e.length-1;as!=_>s&&r<(y-p)*(s-g)/(_-g)+p&&(i=!i)}return i}function YR(t){const e=t.slice();return e.sort((r,s)=>r.xs.x?1:r.ys.y?1:0),XR(e)}function XR(t){if(t.length<=1)return t.slice();const e=[];for(let s=0;s=2;){const a=e[e.length-1],u=e[e.length-2];if((a.x-u.x)*(i.y-u.y)>=(a.y-u.y)*(i.x-u.x))e.pop();else break}e.push(i)}e.pop();const r=[];for(let s=t.length-1;s>=0;s--){const i=t[s];for(;r.length>=2;){const a=r[r.length-1],u=r[r.length-2];if((a.x-u.x)*(i.y-u.y)>=(a.y-u.y)*(i.x-u.x))r.pop();else break}r.push(i)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var ZR=G0,eC=Q0,tC=J0,eb=Y0;const rC=ZR,R2=eC,C2=tC,nC=b.forwardRef(({className:t,sideOffset:e=4,...r},s)=>w.jsx(eb,{ref:s,sideOffset:e,className:it("z-[130] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));nC.displayName=eb.displayName;var Na=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Qs=typeof window>"u"||"Deno"in globalThis;function Pt(){}function sC(t,e){return typeof t=="function"?t(e):t}function qf(t){return typeof t=="number"&&t>=0&&t!==1/0}function tb(t,e){return Math.max(t+(e||0)-Date.now(),0)}function us(t,e){return typeof t=="function"?t(e):t}function fr(t,e){return typeof t=="function"?t(e):t}function Xv(t,e){const{type:r="all",exact:s,fetchStatus:i,predicate:a,queryKey:u,stale:d}=t;if(u){if(s){if(e.queryHash!==rp(u,e.options))return!1}else if(!_a(e.queryKey,u))return!1}if(r!=="all"){const f=e.isActive();if(r==="active"&&!f||r==="inactive"&&f)return!1}return!(typeof d=="boolean"&&e.isStale()!==d||i&&i!==e.state.fetchStatus||a&&!a(e))}function Zv(t,e){const{exact:r,status:s,predicate:i,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(r){if(ba(e.options.mutationKey)!==ba(a))return!1}else if(!_a(e.options.mutationKey,a))return!1}return!(s&&e.state.status!==s||i&&!i(e))}function rp(t,e){return((e==null?void 0:e.queryKeyHashFn)||ba)(t)}function ba(t){return JSON.stringify(t,(e,r)=>Gf(r)?Object.keys(r).sort().reduce((s,i)=>(s[i]=r[i],s),{}):r)}function _a(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>_a(t[r],e[r])):!1}function rb(t,e){if(t===e)return t;const r=ey(t)&&ey(e);if(r||Gf(t)&&Gf(e)){const s=r?t:Object.keys(t),i=s.length,a=r?e:Object.keys(e),u=a.length,d=r?[]:{},f=new Set(s);let p=0;for(let g=0;g{setTimeout(e,t)})}function Qf(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?rb(t,e):e}function iC(t,e,r=0){const s=[...t,e];return r&&s.length>r?s.slice(1):s}function aC(t,e,r=0){const s=[e,...t];return r&&s.length>r?s.slice(0,-1):s}var np=Symbol();function nb(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===np?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function lC(t,e){return typeof t=="function"?t(...e):!!t}var Ms,ts,qo,xw,uC=(xw=class extends Na{constructor(){super();Ee(this,Ms);Ee(this,ts);Ee(this,qo);ae(this,qo,e=>{if(!Qs&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){L(this,ts)||this.setEventListener(L(this,qo))}onUnsubscribe(){var e;this.hasListeners()||((e=L(this,ts))==null||e.call(this),ae(this,ts,void 0))}setEventListener(e){var r;ae(this,qo,e),(r=L(this,ts))==null||r.call(this),ae(this,ts,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){L(this,Ms)!==e&&(ae(this,Ms,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof L(this,Ms)=="boolean"?L(this,Ms):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ms=new WeakMap,ts=new WeakMap,qo=new WeakMap,xw),sp=new uC,Ko,rs,Go,Ew,cC=(Ew=class extends Na{constructor(){super();Ee(this,Ko,!0);Ee(this,rs);Ee(this,Go);ae(this,Go,e=>{if(!Qs&&window.addEventListener){const r=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",s)}}})}onSubscribe(){L(this,rs)||this.setEventListener(L(this,Go))}onUnsubscribe(){var e;this.hasListeners()||((e=L(this,rs))==null||e.call(this),ae(this,rs,void 0))}setEventListener(e){var r;ae(this,Go,e),(r=L(this,rs))==null||r.call(this),ae(this,rs,e(this.setOnline.bind(this)))}setOnline(e){L(this,Ko)!==e&&(ae(this,Ko,e),this.listeners.forEach(s=>{s(e)}))}isOnline(){return L(this,Ko)}},Ko=new WeakMap,rs=new WeakMap,Go=new WeakMap,Ew),Lu=new cC;function Jf(){let t,e;const r=new Promise((i,a)=>{t=i,e=a});r.status="pending",r.catch(()=>{});function s(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{s({status:"fulfilled",value:i}),t(i)},r.reject=i=>{s({status:"rejected",reason:i}),e(i)},r}function dC(t){var r;let e;if((r=t.then(s=>(e=s,s),Pt))==null||r.catch(Pt),e!==void 0)return{data:e}}function fC(t){return Math.min(1e3*2**t,3e4)}function sb(t){return(t??"online")==="online"?Lu.isOnline():!0}var ob=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function lf(t){return t instanceof ob}function ib(t){let e=!1,r=0,s=!1,i;const a=Jf(),u=S=>{var x;s||(_(new ob(S)),(x=t.abort)==null||x.call(t))},d=()=>{e=!0},f=()=>{e=!1},p=()=>sp.isFocused()&&(t.networkMode==="always"||Lu.isOnline())&&t.canRun(),g=()=>sb(t.networkMode)&&t.canRun(),y=S=>{var x;s||(s=!0,(x=t.onSuccess)==null||x.call(t,S),i==null||i(),a.resolve(S))},_=S=>{var x;s||(s=!0,(x=t.onError)==null||x.call(t,S),i==null||i(),a.reject(S))},v=()=>new Promise(S=>{var x;i=T=>{(s||p())&&S(T)},(x=t.onPause)==null||x.call(t)}).then(()=>{var S;i=void 0,s||(S=t.onContinue)==null||S.call(t)}),k=()=>{if(s)return;let S;const x=r===0?t.initialPromise:void 0;try{S=x??t.fn()}catch(T){S=Promise.reject(T)}Promise.resolve(S).then(y).catch(T=>{var A;if(s)return;const R=t.retry??(Qs?0:3),C=t.retryDelay??fC,j=typeof C=="function"?C(r,T):C,D=R===!0||typeof R=="number"&&rp()?void 0:v()).then(()=>{e?_(T):k()})})};return{promise:a,cancel:u,continue:()=>(i==null||i(),a),cancelRetry:d,continueRetry:f,canStart:g,start:()=>(g()?k():v().then(k),a)}}var hC=t=>setTimeout(t,0);function pC(){let t=[],e=0,r=d=>{d()},s=d=>{d()},i=hC;const a=d=>{e?t.push(d):i(()=>{r(d)})},u=()=>{const d=t;t=[],d.length&&i(()=>{s(()=>{d.forEach(f=>{r(f)})})})};return{batch:d=>{let f;e++;try{f=d()}finally{e--,e||u()}return f},batchCalls:d=>(...f)=>{a(()=>{d(...f)})},schedule:a,setNotifyFunction:d=>{r=d},setBatchNotifyFunction:d=>{s=d},setScheduler:d=>{i=d}}}var _t=pC(),Fs,Sw,ab=(Sw=class{constructor(){Ee(this,Fs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),qf(this.gcTime)&&ae(this,Fs,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Qs?1/0:300*1e3))}clearGcTimeout(){L(this,Fs)&&(clearTimeout(L(this,Fs)),ae(this,Fs,void 0))}},Fs=new WeakMap,Sw),Qo,Us,dr,zs,Ct,Ca,Bs,Or,gn,kw,mC=(kw=class extends ab{constructor(e){super();Ee(this,Or);Ee(this,Qo);Ee(this,Us);Ee(this,dr);Ee(this,zs);Ee(this,Ct);Ee(this,Ca);Ee(this,Bs);ae(this,Bs,!1),ae(this,Ca,e.defaultOptions),this.setOptions(e.options),this.observers=[],ae(this,zs,e.client),ae(this,dr,L(this,zs).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,ae(this,Qo,gC(this.options)),this.state=e.state??L(this,Qo),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=L(this,Ct))==null?void 0:e.promise}setOptions(e){this.options={...L(this,Ca),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,dr).remove(this)}setData(e,r){const s=Qf(this.state.data,e,this.options);return Ie(this,Or,gn).call(this,{data:s,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),s}setState(e,r){Ie(this,Or,gn).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var s,i;const r=(s=L(this,Ct))==null?void 0:s.promise;return(i=L(this,Ct))==null||i.cancel(e),r?r.then(Pt).catch(Pt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(L(this,Qo))}isActive(){return this.observers.some(e=>fr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===np||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>us(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!tb(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(s=>s.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=L(this,Ct))==null||r.continue()}onOnline(){var r;const e=this.observers.find(s=>s.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=L(this,Ct))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),L(this,dr).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(L(this,Ct)&&(L(this,Bs)?L(this,Ct).cancel({revert:!0}):L(this,Ct).cancelRetry()),this.scheduleGc()),L(this,dr).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ie(this,Or,gn).call(this,{type:"invalidate"})}fetch(e,r){var p,g,y;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(L(this,Ct))return L(this,Ct).continueRetry(),L(this,Ct).promise}if(e&&this.setOptions(e),!this.options.queryFn){const _=this.observers.find(v=>v.options.queryFn);_&&this.setOptions(_.options)}const s=new AbortController,i=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(ae(this,Bs,!0),s.signal)})},a=()=>{const _=nb(this.options,r),k=(()=>{const S={client:L(this,zs),queryKey:this.queryKey,meta:this.meta};return i(S),S})();return ae(this,Bs,!1),this.options.persister?this.options.persister(_,k,this):_(k)},d=(()=>{const _={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:L(this,zs),state:this.state,fetchFn:a};return i(_),_})();(p=this.options.behavior)==null||p.onFetch(d,this),ae(this,Us,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=d.fetchOptions)==null?void 0:g.meta))&&Ie(this,Or,gn).call(this,{type:"fetch",meta:(y=d.fetchOptions)==null?void 0:y.meta});const f=_=>{var v,k,S,x;lf(_)&&_.silent||Ie(this,Or,gn).call(this,{type:"error",error:_}),lf(_)||((k=(v=L(this,dr).config).onError)==null||k.call(v,_,this),(x=(S=L(this,dr).config).onSettled)==null||x.call(S,this.state.data,_,this)),this.scheduleGc()};return ae(this,Ct,ib({initialPromise:r==null?void 0:r.initialPromise,fn:d.fetchFn,abort:s.abort.bind(s),onSuccess:_=>{var v,k,S,x;if(_===void 0){f(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(_)}catch(T){f(T);return}(k=(v=L(this,dr).config).onSuccess)==null||k.call(v,_,this),(x=(S=L(this,dr).config).onSettled)==null||x.call(S,_,this.state.error,this),this.scheduleGc()},onError:f,onFail:(_,v)=>{Ie(this,Or,gn).call(this,{type:"failed",failureCount:_,error:v})},onPause:()=>{Ie(this,Or,gn).call(this,{type:"pause"})},onContinue:()=>{Ie(this,Or,gn).call(this,{type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0})),L(this,Ct).start()}},Qo=new WeakMap,Us=new WeakMap,dr=new WeakMap,zs=new WeakMap,Ct=new WeakMap,Ca=new WeakMap,Bs=new WeakMap,Or=new WeakSet,gn=function(e){const r=s=>{switch(e.type){case"failed":return{...s,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...lb(s.data,this.options),fetchMeta:e.meta??null};case"success":return ae(this,Us,void 0),{...s,data:e.data,dataUpdateCount:s.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return lf(i)&&i.revert&&L(this,Us)?{...L(this,Us),fetchStatus:"idle"}:{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...e.state}}};this.state=r(this.state),_t.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),L(this,dr).notify({query:this,type:"updated",action:e})})},kw);function lb(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:sb(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function gC(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,s=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Yr,Tw,vC=(Tw=class extends Na{constructor(e={}){super();Ee(this,Yr);this.config=e,ae(this,Yr,new Map)}build(e,r,s){const i=r.queryKey,a=r.queryHash??rp(i,r);let u=this.get(a);return u||(u=new mC({client:e,queryKey:i,queryHash:a,options:e.defaultQueryOptions(r),state:s,defaultOptions:e.getQueryDefaults(i)}),this.add(u)),u}add(e){L(this,Yr).has(e.queryHash)||(L(this,Yr).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=L(this,Yr).get(e.queryHash);r&&(e.destroy(),r===e&&L(this,Yr).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){_t.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return L(this,Yr).get(e)}getAll(){return[...L(this,Yr).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(s=>Xv(r,s))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(s=>Xv(e,s)):r}notify(e){_t.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){_t.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){_t.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Yr=new WeakMap,Tw),Xr,Nt,Vs,Zr,Yn,Rw,yC=(Rw=class extends ab{constructor(e){super();Ee(this,Zr);Ee(this,Xr);Ee(this,Nt);Ee(this,Vs);this.mutationId=e.mutationId,ae(this,Nt,e.mutationCache),ae(this,Xr,[]),this.state=e.state||wC(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){L(this,Xr).includes(e)||(L(this,Xr).push(e),this.clearGcTimeout(),L(this,Nt).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){ae(this,Xr,L(this,Xr).filter(r=>r!==e)),this.scheduleGc(),L(this,Nt).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){L(this,Xr).length||(this.state.status==="pending"?this.scheduleGc():L(this,Nt).remove(this))}continue(){var e;return((e=L(this,Vs))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,u,d,f,p,g,y,_,v,k,S,x,T,R,C,j,D,A,z,W;const r=()=>{Ie(this,Zr,Yn).call(this,{type:"continue"})};ae(this,Vs,ib({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(Q,te)=>{Ie(this,Zr,Yn).call(this,{type:"failed",failureCount:Q,error:te})},onPause:()=>{Ie(this,Zr,Yn).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,Nt).canRun(this)}));const s=this.state.status==="pending",i=!L(this,Vs).canStart();try{if(s)r();else{Ie(this,Zr,Yn).call(this,{type:"pending",variables:e,isPaused:i}),await((u=(a=L(this,Nt).config).onMutate)==null?void 0:u.call(a,e,this));const te=await((f=(d=this.options).onMutate)==null?void 0:f.call(d,e));te!==this.state.context&&Ie(this,Zr,Yn).call(this,{type:"pending",context:te,variables:e,isPaused:i})}const Q=await L(this,Vs).start();return await((g=(p=L(this,Nt).config).onSuccess)==null?void 0:g.call(p,Q,e,this.state.context,this)),await((_=(y=this.options).onSuccess)==null?void 0:_.call(y,Q,e,this.state.context)),await((k=(v=L(this,Nt).config).onSettled)==null?void 0:k.call(v,Q,null,this.state.variables,this.state.context,this)),await((x=(S=this.options).onSettled)==null?void 0:x.call(S,Q,null,e,this.state.context)),Ie(this,Zr,Yn).call(this,{type:"success",data:Q}),Q}catch(Q){try{throw await((R=(T=L(this,Nt).config).onError)==null?void 0:R.call(T,Q,e,this.state.context,this)),await((j=(C=this.options).onError)==null?void 0:j.call(C,Q,e,this.state.context)),await((A=(D=L(this,Nt).config).onSettled)==null?void 0:A.call(D,void 0,Q,this.state.variables,this.state.context,this)),await((W=(z=this.options).onSettled)==null?void 0:W.call(z,void 0,Q,e,this.state.context)),Q}finally{Ie(this,Zr,Yn).call(this,{type:"error",error:Q})}}finally{L(this,Nt).runNext(this)}}},Xr=new WeakMap,Nt=new WeakMap,Vs=new WeakMap,Zr=new WeakSet,Yn=function(e){const r=s=>{switch(e.type){case"failed":return{...s,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...s,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:e.error,failureCount:s.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),_t.batch(()=>{L(this,Xr).forEach(s=>{s.onMutationUpdate(e)}),L(this,Nt).notify({mutation:this,type:"updated",action:e})})},Rw);function wC(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var yn,Ar,Pa,Cw,bC=(Cw=class extends Na{constructor(e={}){super();Ee(this,yn);Ee(this,Ar);Ee(this,Pa);this.config=e,ae(this,yn,new Set),ae(this,Ar,new Map),ae(this,Pa,0)}build(e,r,s){const i=new yC({mutationCache:this,mutationId:++Zl(this,Pa)._,options:e.defaultMutationOptions(r),state:s});return this.add(i),i}add(e){L(this,yn).add(e);const r=ou(e);if(typeof r=="string"){const s=L(this,Ar).get(r);s?s.push(e):L(this,Ar).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(L(this,yn).delete(e)){const r=ou(e);if(typeof r=="string"){const s=L(this,Ar).get(r);if(s)if(s.length>1){const i=s.indexOf(e);i!==-1&&s.splice(i,1)}else s[0]===e&&L(this,Ar).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=ou(e);if(typeof r=="string"){const s=L(this,Ar).get(r),i=s==null?void 0:s.find(a=>a.state.status==="pending");return!i||i===e}else return!0}runNext(e){var s;const r=ou(e);if(typeof r=="string"){const i=(s=L(this,Ar).get(r))==null?void 0:s.find(a=>a!==e&&a.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){_t.batch(()=>{L(this,yn).forEach(e=>{this.notify({type:"removed",mutation:e})}),L(this,yn).clear(),L(this,Ar).clear()})}getAll(){return Array.from(L(this,yn))}find(e){const r={exact:!0,...e};return this.getAll().find(s=>Zv(r,s))}findAll(e={}){return this.getAll().filter(r=>Zv(e,r))}notify(e){_t.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return _t.batch(()=>Promise.all(e.map(r=>r.continue().catch(Pt))))}},yn=new WeakMap,Ar=new WeakMap,Pa=new WeakMap,Cw);function ou(t){var e;return(e=t.options.scope)==null?void 0:e.id}function ry(t){return{onFetch:(e,r)=>{var g,y,_,v,k;const s=e.options,i=(_=(y=(g=e.fetchOptions)==null?void 0:g.meta)==null?void 0:y.fetchMore)==null?void 0:_.direction,a=((v=e.state.data)==null?void 0:v.pages)||[],u=((k=e.state.data)==null?void 0:k.pageParams)||[];let d={pages:[],pageParams:[]},f=0;const p=async()=>{let S=!1;const x=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(e.signal.aborted?S=!0:e.signal.addEventListener("abort",()=>{S=!0}),e.signal)})},T=nb(e.options,e.fetchOptions),R=async(C,j,D)=>{if(S)return Promise.reject();if(j==null&&C.pages.length)return Promise.resolve(C);const z=(()=>{const me={client:e.client,queryKey:e.queryKey,pageParam:j,direction:D?"backward":"forward",meta:e.options.meta};return x(me),me})(),W=await T(z),{maxPages:Q}=e.options,te=D?aC:iC;return{pages:te(C.pages,W,Q),pageParams:te(C.pageParams,j,Q)}};if(i&&a.length){const C=i==="backward",j=C?ub:Yf,D={pages:a,pageParams:u},A=j(s,D);d=await R(D,A,C)}else{const C=t??a.length;do{const j=f===0?u[0]??s.initialPageParam:Yf(s,d);if(f>0&&j==null)break;d=await R(d,j),f++}while(f{var S,x;return(x=(S=e.options).persister)==null?void 0:x.call(S,p,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=p}}}function Yf(t,{pages:e,pageParams:r}){const s=e.length-1;return e.length>0?t.getNextPageParam(e[s],e,r[s],r):void 0}function ub(t,{pages:e,pageParams:r}){var s;return e.length>0?(s=t.getPreviousPageParam)==null?void 0:s.call(t,e[0],e,r[0],r):void 0}function P2(t,e){return e?Yf(t,e)!=null:!1}function j2(t,e){return!e||!t.getPreviousPageParam?!1:ub(t,e)!=null}var rt,ns,ss,Jo,Yo,os,Xo,Zo,Pw,_C=(Pw=class{constructor(t={}){Ee(this,rt);Ee(this,ns);Ee(this,ss);Ee(this,Jo);Ee(this,Yo);Ee(this,os);Ee(this,Xo);Ee(this,Zo);ae(this,rt,t.queryCache||new vC),ae(this,ns,t.mutationCache||new bC),ae(this,ss,t.defaultOptions||{}),ae(this,Jo,new Map),ae(this,Yo,new Map),ae(this,os,0)}mount(){Zl(this,os)._++,L(this,os)===1&&(ae(this,Xo,sp.subscribe(async t=>{t&&(await this.resumePausedMutations(),L(this,rt).onFocus())})),ae(this,Zo,Lu.subscribe(async t=>{t&&(await this.resumePausedMutations(),L(this,rt).onOnline())})))}unmount(){var t,e;Zl(this,os)._--,L(this,os)===0&&((t=L(this,Xo))==null||t.call(this),ae(this,Xo,void 0),(e=L(this,Zo))==null||e.call(this),ae(this,Zo,void 0))}isFetching(t){return L(this,rt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return L(this,ns).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=L(this,rt).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=L(this,rt).build(this,e),s=r.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(us(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return L(this,rt).findAll(t).map(({queryKey:e,state:r})=>{const s=r.data;return[e,s]})}setQueryData(t,e,r){const s=this.defaultQueryOptions({queryKey:t}),i=L(this,rt).get(s.queryHash),a=i==null?void 0:i.state.data,u=sC(e,a);if(u!==void 0)return L(this,rt).build(this,s).setData(u,{...r,manual:!0})}setQueriesData(t,e,r){return _t.batch(()=>L(this,rt).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=L(this,rt).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=L(this,rt);_t.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=L(this,rt);return _t.batch(()=>(r.findAll(t).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},s=_t.batch(()=>L(this,rt).findAll(t).map(i=>i.cancel(r)));return Promise.all(s).then(Pt).catch(Pt)}invalidateQueries(t,e={}){return _t.batch(()=>(L(this,rt).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},s=_t.batch(()=>L(this,rt).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let a=i.fetch(void 0,r);return r.throwOnError||(a=a.catch(Pt)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(s).then(Pt)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=L(this,rt).build(this,e);return r.isStaleByTime(us(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Pt).catch(Pt)}fetchInfiniteQuery(t){return t.behavior=ry(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Pt).catch(Pt)}ensureInfiniteQueryData(t){return t.behavior=ry(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Lu.isOnline()?L(this,ns).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,rt)}getMutationCache(){return L(this,ns)}getDefaultOptions(){return L(this,ss)}setDefaultOptions(t){ae(this,ss,t)}setQueryDefaults(t,e){L(this,Jo).set(ba(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...L(this,Jo).values()],r={};return e.forEach(s=>{_a(t,s.queryKey)&&Object.assign(r,s.defaultOptions)}),r}setMutationDefaults(t,e){L(this,Yo).set(ba(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...L(this,Yo).values()],r={};return e.forEach(s=>{_a(t,s.mutationKey)&&Object.assign(r,s.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...L(this,ss).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=rp(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===np&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...L(this,ss).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){L(this,rt).clear(),L(this,ns).clear()}},rt=new WeakMap,ns=new WeakMap,ss=new WeakMap,Jo=new WeakMap,Yo=new WeakMap,os=new WeakMap,Xo=new WeakMap,Zo=new WeakMap,Pw),Wt,Ne,ja,Lt,Ws,ei,is,as,Oa,ti,ri,Hs,qs,ls,ni,Fe,la,Xf,Zf,eh,th,rh,nh,sh,cb,jw,xC=(jw=class extends Na{constructor(e,r){super();Ee(this,Fe);Ee(this,Wt);Ee(this,Ne);Ee(this,ja);Ee(this,Lt);Ee(this,Ws);Ee(this,ei);Ee(this,is);Ee(this,as);Ee(this,Oa);Ee(this,ti);Ee(this,ri);Ee(this,Hs);Ee(this,qs);Ee(this,ls);Ee(this,ni,new Set);this.options=r,ae(this,Wt,e),ae(this,as,null),ae(this,is,Jf()),this.options.experimental_prefetchInRender||L(this,is).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(L(this,Ne).addObserver(this),ny(L(this,Ne),this.options)?Ie(this,Fe,la).call(this):this.updateResult(),Ie(this,Fe,th).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return oh(L(this,Ne),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return oh(L(this,Ne),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ie(this,Fe,rh).call(this),Ie(this,Fe,nh).call(this),L(this,Ne).removeObserver(this)}setOptions(e){const r=this.options,s=L(this,Ne);if(this.options=L(this,Wt).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof fr(this.options.enabled,L(this,Ne))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ie(this,Fe,sh).call(this),L(this,Ne).setOptions(this.options),r._defaulted&&!Kf(this.options,r)&&L(this,Wt).getQueryCache().notify({type:"observerOptionsUpdated",query:L(this,Ne),observer:this});const i=this.hasListeners();i&&sy(L(this,Ne),s,this.options,r)&&Ie(this,Fe,la).call(this),this.updateResult(),i&&(L(this,Ne)!==s||fr(this.options.enabled,L(this,Ne))!==fr(r.enabled,L(this,Ne))||us(this.options.staleTime,L(this,Ne))!==us(r.staleTime,L(this,Ne)))&&Ie(this,Fe,Xf).call(this);const a=Ie(this,Fe,Zf).call(this);i&&(L(this,Ne)!==s||fr(this.options.enabled,L(this,Ne))!==fr(r.enabled,L(this,Ne))||a!==L(this,ls))&&Ie(this,Fe,eh).call(this,a)}getOptimisticResult(e){const r=L(this,Wt).getQueryCache().build(L(this,Wt),e),s=this.createResult(r,e);return SC(this,s)&&(ae(this,Lt,s),ae(this,ei,this.options),ae(this,Ws,L(this,Ne).state)),s}getCurrentResult(){return L(this,Lt)}trackResult(e,r){return new Proxy(e,{get:(s,i)=>(this.trackProp(i),r==null||r(i),Reflect.get(s,i))})}trackProp(e){L(this,ni).add(e)}getCurrentQuery(){return L(this,Ne)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=L(this,Wt).defaultQueryOptions(e),s=L(this,Wt).getQueryCache().build(L(this,Wt),r);return s.fetch().then(()=>this.createResult(s,r))}fetch(e){return Ie(this,Fe,la).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),L(this,Lt)))}createResult(e,r){var Q;const s=L(this,Ne),i=this.options,a=L(this,Lt),u=L(this,Ws),d=L(this,ei),p=e!==s?e.state:L(this,ja),{state:g}=e;let y={...g},_=!1,v;if(r._optimisticResults){const te=this.hasListeners(),me=!te&&ny(e,r),ee=te&&sy(e,s,r,i);(me||ee)&&(y={...y,...lb(g.data,e.options)}),r._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:k,errorUpdatedAt:S,status:x}=y;v=y.data;let T=!1;if(r.placeholderData!==void 0&&v===void 0&&x==="pending"){let te;a!=null&&a.isPlaceholderData&&r.placeholderData===(d==null?void 0:d.placeholderData)?(te=a.data,T=!0):te=typeof r.placeholderData=="function"?r.placeholderData((Q=L(this,ri))==null?void 0:Q.state.data,L(this,ri)):r.placeholderData,te!==void 0&&(x="success",v=Qf(a==null?void 0:a.data,te,r),_=!0)}if(r.select&&v!==void 0&&!T)if(a&&v===(u==null?void 0:u.data)&&r.select===L(this,Oa))v=L(this,ti);else try{ae(this,Oa,r.select),v=r.select(v),v=Qf(a==null?void 0:a.data,v,r),ae(this,ti,v),ae(this,as,null)}catch(te){ae(this,as,te)}L(this,as)&&(k=L(this,as),v=L(this,ti),S=Date.now(),x="error");const R=y.fetchStatus==="fetching",C=x==="pending",j=x==="error",D=C&&R,A=v!==void 0,W={status:x,fetchStatus:y.fetchStatus,isPending:C,isSuccess:x==="success",isError:j,isInitialLoading:D,isLoading:D,data:v,dataUpdatedAt:y.dataUpdatedAt,error:k,errorUpdatedAt:S,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>p.dataUpdateCount||y.errorUpdateCount>p.errorUpdateCount,isFetching:R,isRefetching:R&&!C,isLoadingError:j&&!A,isPaused:y.fetchStatus==="paused",isPlaceholderData:_,isRefetchError:j&&A,isStale:op(e,r),refetch:this.refetch,promise:L(this,is),isEnabled:fr(r.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const te=pe=>{W.status==="error"?pe.reject(W.error):W.data!==void 0&&pe.resolve(W.data)},me=()=>{const pe=ae(this,is,W.promise=Jf());te(pe)},ee=L(this,is);switch(ee.status){case"pending":e.queryHash===s.queryHash&&te(ee);break;case"fulfilled":(W.status==="error"||W.data!==ee.value)&&me();break;case"rejected":(W.status!=="error"||W.error!==ee.reason)&&me();break}}return W}updateResult(){const e=L(this,Lt),r=this.createResult(L(this,Ne),this.options);if(ae(this,Ws,L(this,Ne).state),ae(this,ei,this.options),L(this,Ws).data!==void 0&&ae(this,ri,L(this,Ne)),Kf(r,e))return;ae(this,Lt,r);const s=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!L(this,ni).size)return!0;const u=new Set(a??L(this,ni));return this.options.throwOnError&&u.add("error"),Object.keys(L(this,Lt)).some(d=>{const f=d;return L(this,Lt)[f]!==e[f]&&u.has(f)})};Ie(this,Fe,cb).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ie(this,Fe,th).call(this)}},Wt=new WeakMap,Ne=new WeakMap,ja=new WeakMap,Lt=new WeakMap,Ws=new WeakMap,ei=new WeakMap,is=new WeakMap,as=new WeakMap,Oa=new WeakMap,ti=new WeakMap,ri=new WeakMap,Hs=new WeakMap,qs=new WeakMap,ls=new WeakMap,ni=new WeakMap,Fe=new WeakSet,la=function(e){Ie(this,Fe,sh).call(this);let r=L(this,Ne).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(Pt)),r},Xf=function(){Ie(this,Fe,rh).call(this);const e=us(this.options.staleTime,L(this,Ne));if(Qs||L(this,Lt).isStale||!qf(e))return;const s=tb(L(this,Lt).dataUpdatedAt,e)+1;ae(this,Hs,setTimeout(()=>{L(this,Lt).isStale||this.updateResult()},s))},Zf=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(L(this,Ne)):this.options.refetchInterval)??!1},eh=function(e){Ie(this,Fe,nh).call(this),ae(this,ls,e),!(Qs||fr(this.options.enabled,L(this,Ne))===!1||!qf(L(this,ls))||L(this,ls)===0)&&ae(this,qs,setInterval(()=>{(this.options.refetchIntervalInBackground||sp.isFocused())&&Ie(this,Fe,la).call(this)},L(this,ls)))},th=function(){Ie(this,Fe,Xf).call(this),Ie(this,Fe,eh).call(this,Ie(this,Fe,Zf).call(this))},rh=function(){L(this,Hs)&&(clearTimeout(L(this,Hs)),ae(this,Hs,void 0))},nh=function(){L(this,qs)&&(clearInterval(L(this,qs)),ae(this,qs,void 0))},sh=function(){const e=L(this,Wt).getQueryCache().build(L(this,Wt),this.options);if(e===L(this,Ne))return;const r=L(this,Ne);ae(this,Ne,e),ae(this,ja,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},cb=function(e){_t.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(L(this,Lt))}),L(this,Wt).getQueryCache().notify({query:L(this,Ne),type:"observerResultsUpdated"})})},jw);function EC(t,e){return fr(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function ny(t,e){return EC(t,e)||t.state.data!==void 0&&oh(t,e,e.refetchOnMount)}function oh(t,e,r){if(fr(e.enabled,t)!==!1&&us(e.staleTime,t)!=="static"){const s=typeof r=="function"?r(t):r;return s==="always"||s!==!1&&op(t,e)}return!1}function sy(t,e,r,s){return(t!==e||fr(s.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&op(t,r)}function op(t,e){return fr(e.enabled,t)!==!1&&t.isStaleByTime(us(e.staleTime,t))}function SC(t,e){return!Kf(t.getCurrentResult(),e)}function db(t){return t}function kC(t){return{mutationKey:t.options.mutationKey,state:t.state,...t.options.scope&&{scope:t.options.scope},...t.meta&&{meta:t.meta}}}function TC(t,e,r){var s;return{dehydratedAt:Date.now(),state:{...t.state,...t.state.data!==void 0&&{data:e(t.state.data)}},queryKey:t.queryKey,queryHash:t.queryHash,...t.state.status==="pending"&&{promise:(s=t.promise)==null?void 0:s.then(e).catch(i=>r(i)?Promise.reject(new Error("redacted")):Promise.reject(i))},...t.meta&&{meta:t.meta}}}function RC(t){return t.state.isPaused}function CC(t){return t.state.status==="success"}function PC(t){return!0}function jC(t,e={}){var f,p,g,y;const r=e.shouldDehydrateMutation??((f=t.getDefaultOptions().dehydrate)==null?void 0:f.shouldDehydrateMutation)??RC,s=t.getMutationCache().getAll().flatMap(_=>r(_)?[kC(_)]:[]),i=e.shouldDehydrateQuery??((p=t.getDefaultOptions().dehydrate)==null?void 0:p.shouldDehydrateQuery)??CC,a=e.shouldRedactErrors??((g=t.getDefaultOptions().dehydrate)==null?void 0:g.shouldRedactErrors)??PC,u=e.serializeData??((y=t.getDefaultOptions().dehydrate)==null?void 0:y.serializeData)??db,d=t.getQueryCache().getAll().flatMap(_=>i(_)?[TC(_,u,a)]:[]);return{mutations:s,queries:d}}function OC(t,e,r){var f;if(typeof e!="object"||e===null)return;const s=t.getMutationCache(),i=t.getQueryCache(),a=((f=t.getDefaultOptions().hydrate)==null?void 0:f.deserializeData)??db,u=e.mutations||[],d=e.queries||[];u.forEach(({state:p,...g})=>{var y,_;s.build(t,{...(y=t.getDefaultOptions().hydrate)==null?void 0:y.mutations,...(_=r==null?void 0:r.defaultOptions)==null?void 0:_.mutations,...g},p)}),d.forEach(({queryKey:p,state:g,queryHash:y,meta:_,promise:v,dehydratedAt:k})=>{var D,A;const S=v?dC(v):void 0,x=g.data===void 0?S==null?void 0:S.data:g.data,T=x===void 0?x:a(x);let R=i.get(y);const C=(R==null?void 0:R.state.status)==="pending",j=(R==null?void 0:R.state.fetchStatus)==="fetching";if(R){const z=S&&k!==void 0&&k>R.state.dataUpdatedAt;if(g.dataUpdatedAt>R.state.dataUpdatedAt||z){const{fetchStatus:W,...Q}=g;R.setState({...Q,data:T})}}else R=i.build(t,{...(D=t.getDefaultOptions().hydrate)==null?void 0:D.queries,...(A=r==null?void 0:r.defaultOptions)==null?void 0:A.queries,queryKey:p,queryHash:y,meta:_},{...g,data:T,fetchStatus:"idle",status:T!==void 0?"success":g.status});v&&!C&&!j&&(k===void 0||k>R.state.dataUpdatedAt)&&R.fetch(void 0,{initialPromise:Promise.resolve(v).then(a)})})}var fb=b.createContext(void 0),hb=t=>{const e=b.useContext(fb);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},AC=({client:t,children:e})=>(b.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),w.jsx(fb.Provider,{value:t,children:e})),pb=b.createContext(!1),IC=()=>b.useContext(pb);pb.Provider;function NC(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var LC=b.createContext(NC()),DC=()=>b.useContext(LC),$C=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},MC=t=>{b.useEffect(()=>{t.clearReset()},[t])},FC=({result:t,errorResetBoundary:e,throwOnError:r,query:s,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(i&&t.data===void 0||lC(r,[t.error,s])),UC=t=>{if(t.suspense){const e=s=>s==="static"?s:Math.max(s??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...s)=>e(r(...s)):e(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},zC=(t,e)=>t.isLoading&&t.isFetching&&!e,BC=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,oy=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function VC(t,e,r){var y,_,v,k,S;const s=IC(),i=DC(),a=hb(r),u=a.defaultQueryOptions(t);(_=(y=a.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||_.call(y,u),u._optimisticResults=s?"isRestoring":"optimistic",UC(u),$C(u,i),MC(i);const d=!a.getQueryCache().get(u.queryHash),[f]=b.useState(()=>new e(a,u)),p=f.getOptimisticResult(u),g=!s&&t.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(x=>{const T=g?f.subscribe(_t.batchCalls(x)):Pt;return f.updateResult(),T},[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),b.useEffect(()=>{f.setOptions(u)},[u,f]),BC(u,p))throw oy(u,f,i);if(FC({result:p,errorResetBoundary:i,throwOnError:u.throwOnError,query:a.getQueryCache().get(u.queryHash),suspense:u.suspense}))throw p.error;if((k=(v=a.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||k.call(v,u,p),u.experimental_prefetchInRender&&!Qs&&zC(p,s)){const x=d?oy(u,f,i):(S=a.getQueryCache().get(u.queryHash))==null?void 0:S.promise;x==null||x.catch(Pt).finally(()=>{f.updateResult()})}return u.notifyOnChangeProps?p:f.trackResult(p)}function ih(t,e){return VC(t,xC,e)}var ah=function(t,e){return ah=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])},ah(t,e)};function mb(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ah(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Du=function(){return Du=Object.assign||function(e){for(var r,s=1,i=arguments.length;s=0;d--)(u=t[d])&&(a=(i<3?u(a):i>3?u(e,r,a):u(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function vb(t,e){return function(r,s){e(r,s,t)}}function yb(t,e,r,s,i,a){function u(T){if(T!==void 0&&typeof T!="function")throw new TypeError("Function expected");return T}for(var d=s.kind,f=d==="getter"?"get":d==="setter"?"set":"value",p=!e&&t?s.static?t:t.prototype:null,g=e||(p?Object.getOwnPropertyDescriptor(p,s.name):{}),y,_=!1,v=r.length-1;v>=0;v--){var k={};for(var S in s)k[S]=S==="access"?{}:s[S];for(var S in s.access)k.access[S]=s.access[S];k.addInitializer=function(T){if(_)throw new TypeError("Cannot add initializers after decoration has completed");a.push(u(T||null))};var x=(0,r[v])(d==="accessor"?{get:g.get,set:g.set}:g[f],k);if(d==="accessor"){if(x===void 0)continue;if(x===null||typeof x!="object")throw new TypeError("Object expected");(y=u(x.get))&&(g.get=y),(y=u(x.set))&&(g.set=y),(y=u(x.init))&&i.unshift(y)}else(y=u(x))&&(d==="field"?i.unshift(y):g[f]=y)}p&&Object.defineProperty(p,s.name,g),_=!0}function wb(t,e,r){for(var s=arguments.length>2,i=0;i0&&a[a.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!a||p[1]>a[0]&&p[1]=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ip(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),i,a=[],u;try{for(;(e===void 0||e-- >0)&&!(i=s.next()).done;)a.push(i.value)}catch(d){u={error:d}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(u)throw u.error}}return a}function kb(){for(var t=[],e=0;e1||f(v,S)})},k&&(i[v]=k(i[v])))}function f(v,k){try{p(s[v](k))}catch(S){_(a[0][3],S)}}function p(v){v.value instanceof ii?Promise.resolve(v.value.v).then(g,y):_(a[0][2],v)}function g(v){f("next",v)}function y(v){f("throw",v)}function _(v,k){v(k),a.shift(),a.length&&f(a[0][0],a[0][1])}}function Pb(t){var e,r;return e={},s("next"),s("throw",function(i){throw i}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(i,a){e[i]=t[i]?function(u){return(r=!r)?{value:ii(t[i](u)),done:!1}:a?a(u):u}:a}}function jb(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof $u=="function"?$u(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(a){r[a]=t[a]&&function(u){return new Promise(function(d,f){u=t[a](u),i(d,f,u.done,u.value)})}}function i(a,u,d,f){Promise.resolve(f).then(function(p){a({value:p,done:d})},u)}}function Ob(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var WC=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},lh=function(t){return lh=Object.getOwnPropertyNames||function(e){var r=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[r.length]=s);return r},lh(t)};function Ab(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=lh(t),s=0;st?(...e)=>t(...e):(...e)=>fetch(...e);class ap extends Error{constructor(e,r="FunctionsError",s){super(e),this.name=r,this.context=s}}class iy extends ap{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class ay extends ap{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class ly extends ap{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var uh;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(uh||(uh={}));class QC{constructor(e,{headers:r={},customFetch:s,region:i=uh.Any}={}){this.url=e,this.headers=r,this.region=i,this.fetch=GC(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return he(this,arguments,void 0,function*(r,s={}){var i;try{const{headers:a,method:u,body:d,signal:f}=s;let p={},{region:g}=s;g||(g=this.region);const y=new URL(`${this.url}/${r}`);g&&g!=="any"&&(p["x-region"]=g,y.searchParams.set("forceFunctionRegion",g));let _;d&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&d instanceof Blob||d instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",_=d):typeof d=="string"?(p["Content-Type"]="text/plain",_=d):typeof FormData<"u"&&d instanceof FormData?_=d:(p["Content-Type"]="application/json",_=JSON.stringify(d)):_=d;const v=yield this.fetch(y.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),a),body:_,signal:f}).catch(T=>{throw T.name==="AbortError"?T:new iy(T)}),k=v.headers.get("x-relay-error");if(k&&k==="true")throw new ay(v);if(!v.ok)throw new ly(v);let S=((i=v.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),x;return S==="application/json"?x=yield v.json():S==="application/octet-stream"||S==="application/pdf"?x=yield v.blob():S==="text/event-stream"?x=v:S==="multipart/form-data"?x=yield v.formData():x=yield v.text(),{data:x,error:null,response:v}}catch(a){return a instanceof Error&&a.name==="AbortError"?{data:null,error:new iy(a)}:{data:null,error:a,response:a instanceof ly||a instanceof ay?a.context:void 0}}})}}var Tt={};const vi=vS(KC);var iu={},au={},lu={},uu={},cu={},du={},uy;function Ub(){if(uy)return du;uy=1,Object.defineProperty(du,"__esModule",{value:!0});class t extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}}return du.default=t,du}var cy;function zb(){if(cy)return cu;cy=1,Object.defineProperty(cu,"__esModule",{value:!0});const e=vi.__importDefault(Ub());class r{constructor(i){var a,u;this.shouldThrowOnError=!1,this.method=i.method,this.url=i.url,this.headers=new Headers(i.headers),this.schema=i.schema,this.body=i.body,this.shouldThrowOnError=(a=i.shouldThrowOnError)!==null&&a!==void 0?a:!1,this.signal=i.signal,this.isMaybeSingle=(u=i.isMaybeSingle)!==null&&u!==void 0?u:!1,i.fetch?this.fetch=i.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(i,a){return this.headers=new Headers(this.headers),this.headers.set(i,a),this}then(i,a){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const u=this.fetch;let d=u(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async f=>{var p,g,y,_;let v=null,k=null,S=null,x=f.status,T=f.statusText;if(f.ok){if(this.method!=="HEAD"){const D=await f.text();D===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((p=this.headers.get("Accept"))===null||p===void 0)&&p.includes("application/vnd.pgrst.plan+text"))?k=D:k=JSON.parse(D))}const C=(g=this.headers.get("Prefer"))===null||g===void 0?void 0:g.match(/count=(exact|planned|estimated)/),j=(y=f.headers.get("content-range"))===null||y===void 0?void 0:y.split("/");C&&j&&j.length>1&&(S=parseInt(j[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(k)&&(k.length>1?(v={code:"PGRST116",details:`Results contain ${k.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},k=null,S=null,x=406,T="Not Acceptable"):k.length===1?k=k[0]:k=null)}else{const C=await f.text();try{v=JSON.parse(C),Array.isArray(v)&&f.status===404&&(k=[],v=null,x=200,T="OK")}catch{f.status===404&&C===""?(x=204,T="No Content"):v={message:C}}if(v&&this.isMaybeSingle&&(!((_=v==null?void 0:v.details)===null||_===void 0)&&_.includes("0 rows"))&&(v=null,x=200,T="OK"),v&&this.shouldThrowOnError)throw new e.default(v)}return{error:v,data:k,count:S,status:x,statusText:T}});return this.shouldThrowOnError||(d=d.catch(f=>{var p,g,y;return{error:{message:`${(p=f==null?void 0:f.name)!==null&&p!==void 0?p:"FetchError"}: ${f==null?void 0:f.message}`,details:`${(g=f==null?void 0:f.stack)!==null&&g!==void 0?g:""}`,hint:"",code:`${(y=f==null?void 0:f.code)!==null&&y!==void 0?y:""}`},data:null,count:null,status:0,statusText:""}})),d.then(i,a)}returns(){return this}overrideTypes(){return this}}return cu.default=r,cu}var dy;function Bb(){if(dy)return uu;dy=1,Object.defineProperty(uu,"__esModule",{value:!0});const e=vi.__importDefault(zb());class r extends e.default{select(i){let a=!1;const u=(i??"*").split("").map(d=>/\s/.test(d)&&!a?"":(d==='"'&&(a=!a),d)).join("");return this.url.searchParams.set("select",u),this.headers.append("Prefer","return=representation"),this}order(i,{ascending:a=!0,nullsFirst:u,foreignTable:d,referencedTable:f=d}={}){const p=f?`${f}.order`:"order",g=this.url.searchParams.get(p);return this.url.searchParams.set(p,`${g?`${g},`:""}${i}.${a?"asc":"desc"}${u===void 0?"":u?".nullsfirst":".nullslast"}`),this}limit(i,{foreignTable:a,referencedTable:u=a}={}){const d=typeof u>"u"?"limit":`${u}.limit`;return this.url.searchParams.set(d,`${i}`),this}range(i,a,{foreignTable:u,referencedTable:d=u}={}){const f=typeof d>"u"?"offset":`${d}.offset`,p=typeof d>"u"?"limit":`${d}.limit`;return this.url.searchParams.set(f,`${i}`),this.url.searchParams.set(p,`${a-i+1}`),this}abortSignal(i){return this.signal=i,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?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:i=!1,verbose:a=!1,settings:u=!1,buffers:d=!1,wal:f=!1,format:p="text"}={}){var g;const y=[i?"analyze":null,a?"verbose":null,u?"settings":null,d?"buffers":null,f?"wal":null].filter(Boolean).join("|"),_=(g=this.headers.get("Accept"))!==null&&g!==void 0?g:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${p}; for="${_}"; options=${y};`),p==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(i){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${i}`),this}}return uu.default=r,uu}var fy;function lp(){if(fy)return lu;fy=1,Object.defineProperty(lu,"__esModule",{value:!0});const e=vi.__importDefault(Bb()),r=new RegExp("[,()]");class s extends e.default{eq(a,u){return this.url.searchParams.append(a,`eq.${u}`),this}neq(a,u){return this.url.searchParams.append(a,`neq.${u}`),this}gt(a,u){return this.url.searchParams.append(a,`gt.${u}`),this}gte(a,u){return this.url.searchParams.append(a,`gte.${u}`),this}lt(a,u){return this.url.searchParams.append(a,`lt.${u}`),this}lte(a,u){return this.url.searchParams.append(a,`lte.${u}`),this}like(a,u){return this.url.searchParams.append(a,`like.${u}`),this}likeAllOf(a,u){return this.url.searchParams.append(a,`like(all).{${u.join(",")}}`),this}likeAnyOf(a,u){return this.url.searchParams.append(a,`like(any).{${u.join(",")}}`),this}ilike(a,u){return this.url.searchParams.append(a,`ilike.${u}`),this}ilikeAllOf(a,u){return this.url.searchParams.append(a,`ilike(all).{${u.join(",")}}`),this}ilikeAnyOf(a,u){return this.url.searchParams.append(a,`ilike(any).{${u.join(",")}}`),this}is(a,u){return this.url.searchParams.append(a,`is.${u}`),this}in(a,u){const d=Array.from(new Set(u)).map(f=>typeof f=="string"&&r.test(f)?`"${f}"`:`${f}`).join(",");return this.url.searchParams.append(a,`in.(${d})`),this}contains(a,u){return typeof u=="string"?this.url.searchParams.append(a,`cs.${u}`):Array.isArray(u)?this.url.searchParams.append(a,`cs.{${u.join(",")}}`):this.url.searchParams.append(a,`cs.${JSON.stringify(u)}`),this}containedBy(a,u){return typeof u=="string"?this.url.searchParams.append(a,`cd.${u}`):Array.isArray(u)?this.url.searchParams.append(a,`cd.{${u.join(",")}}`):this.url.searchParams.append(a,`cd.${JSON.stringify(u)}`),this}rangeGt(a,u){return this.url.searchParams.append(a,`sr.${u}`),this}rangeGte(a,u){return this.url.searchParams.append(a,`nxl.${u}`),this}rangeLt(a,u){return this.url.searchParams.append(a,`sl.${u}`),this}rangeLte(a,u){return this.url.searchParams.append(a,`nxr.${u}`),this}rangeAdjacent(a,u){return this.url.searchParams.append(a,`adj.${u}`),this}overlaps(a,u){return typeof u=="string"?this.url.searchParams.append(a,`ov.${u}`):this.url.searchParams.append(a,`ov.{${u.join(",")}}`),this}textSearch(a,u,{config:d,type:f}={}){let p="";f==="plain"?p="pl":f==="phrase"?p="ph":f==="websearch"&&(p="w");const g=d===void 0?"":`(${d})`;return this.url.searchParams.append(a,`${p}fts${g}.${u}`),this}match(a){return Object.entries(a).forEach(([u,d])=>{this.url.searchParams.append(u,`eq.${d}`)}),this}not(a,u,d){return this.url.searchParams.append(a,`not.${u}.${d}`),this}or(a,{foreignTable:u,referencedTable:d=u}={}){const f=d?`${d}.or`:"or";return this.url.searchParams.append(f,`(${a})`),this}filter(a,u,d){return this.url.searchParams.append(a,`${u}.${d}`),this}}return lu.default=s,lu}var hy;function Vb(){if(hy)return au;hy=1,Object.defineProperty(au,"__esModule",{value:!0});const e=vi.__importDefault(lp());class r{constructor(i,{headers:a={},schema:u,fetch:d}){this.url=i,this.headers=new Headers(a),this.schema=u,this.fetch=d}select(i,a){const{head:u=!1,count:d}=a??{},f=u?"HEAD":"GET";let p=!1;const g=(i??"*").split("").map(y=>/\s/.test(y)&&!p?"":(y==='"'&&(p=!p),y)).join("");return this.url.searchParams.set("select",g),d&&this.headers.append("Prefer",`count=${d}`),new e.default({method:f,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(i,{count:a,defaultToNull:u=!0}={}){var d;const f="POST";if(a&&this.headers.append("Prefer",`count=${a}`),u||this.headers.append("Prefer","missing=default"),Array.isArray(i)){const p=i.reduce((g,y)=>g.concat(Object.keys(y)),[]);if(p.length>0){const g=[...new Set(p)].map(y=>`"${y}"`);this.url.searchParams.set("columns",g.join(","))}}return new e.default({method:f,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}upsert(i,{onConflict:a,ignoreDuplicates:u=!1,count:d,defaultToNull:f=!0}={}){var p;const g="POST";if(this.headers.append("Prefer",`resolution=${u?"ignore":"merge"}-duplicates`),a!==void 0&&this.url.searchParams.set("on_conflict",a),d&&this.headers.append("Prefer",`count=${d}`),f||this.headers.append("Prefer","missing=default"),Array.isArray(i)){const y=i.reduce((_,v)=>_.concat(Object.keys(v)),[]);if(y.length>0){const _=[...new Set(y)].map(v=>`"${v}"`);this.url.searchParams.set("columns",_.join(","))}}return new e.default({method:g,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(p=this.fetch)!==null&&p!==void 0?p:fetch})}update(i,{count:a}={}){var u;const d="PATCH";return a&&this.headers.append("Prefer",`count=${a}`),new e.default({method:d,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}delete({count:i}={}){var a;const u="DELETE";return i&&this.headers.append("Prefer",`count=${i}`),new e.default({method:u,url:this.url,headers:this.headers,schema:this.schema,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}}return au.default=r,au}var py;function JC(){if(py)return iu;py=1,Object.defineProperty(iu,"__esModule",{value:!0});const t=vi,e=t.__importDefault(Vb()),r=t.__importDefault(lp());class s{constructor(a,{headers:u={},schema:d,fetch:f}={}){this.url=a,this.headers=new Headers(u),this.schemaName=d,this.fetch=f}from(a){const u=new URL(`${this.url}/${a}`);return new e.default(u,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new s(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,u={},{head:d=!1,get:f=!1,count:p}={}){var g;let y;const _=new URL(`${this.url}/rpc/${a}`);let v;d||f?(y=d?"HEAD":"GET",Object.entries(u).filter(([S,x])=>x!==void 0).map(([S,x])=>[S,Array.isArray(x)?`{${x.join(",")}}`:`${x}`]).forEach(([S,x])=>{_.searchParams.append(S,x)})):(y="POST",v=u);const k=new Headers(this.headers);return p&&k.set("Prefer",`count=${p}`),new r.default({method:y,url:_,headers:k,schema:this.schemaName,body:v,fetch:(g=this.fetch)!==null&&g!==void 0?g:fetch})}}return iu.default=s,iu}var my;function YC(){if(my)return Tt;my=1,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.PostgrestError=Tt.PostgrestBuilder=Tt.PostgrestTransformBuilder=Tt.PostgrestFilterBuilder=Tt.PostgrestQueryBuilder=Tt.PostgrestClient=void 0;const t=vi,e=t.__importDefault(JC());Tt.PostgrestClient=e.default;const r=t.__importDefault(Vb());Tt.PostgrestQueryBuilder=r.default;const s=t.__importDefault(lp());Tt.PostgrestFilterBuilder=s.default;const i=t.__importDefault(Bb());Tt.PostgrestTransformBuilder=i.default;const a=t.__importDefault(zb());Tt.PostgrestBuilder=a.default;const u=t.__importDefault(Ub());return Tt.PostgrestError=u.default,Tt.default={PostgrestClient:e.default,PostgrestQueryBuilder:r.default,PostgrestFilterBuilder:s.default,PostgrestTransformBuilder:i.default,PostgrestBuilder:a.default,PostgrestError:u.default},Tt}var Wb=YC();const Hb=Nh(Wb),XC=Ow({__proto__:null,default:Hb},[Wb]),{PostgrestClient:ZC,PostgrestQueryBuilder:O2,PostgrestFilterBuilder:A2,PostgrestTransformBuilder:I2,PostgrestBuilder:N2,PostgrestError:L2}=Hb||XC;class eP{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")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(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.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(typeof process<"u"){const r=process.versions;if(r&&r.node){const s=r.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: import ws from "ws" new 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(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=` Suggested solution: ${e.workaround}`),new Error(r)}static createWebSocket(e,r){const s=this.getWebSocketConstructor();return new s(e,r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const tP="2.80.0",rP=`realtime-js/${tP}`,nP="1.0.0",ch=1e4,sP=1e3,oP=100;var ha;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(ha||(ha={}));var dt;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(dt||(dt={}));var Ir;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(Ir||(Ir={}));var dh;(function(t){t.websocket="websocket"})(dh||(dh={}));var Ns;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Ns||(Ns={}));class iP{constructor(){this.HEADER_LENGTH=1}decode(e,r){return e.constructor===ArrayBuffer?r(this._binaryDecode(e)):r(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const r=new DataView(e),s=new TextDecoder;return this._decodeBroadcast(e,r,s)}_decodeBroadcast(e,r,s){const i=r.getUint8(1),a=r.getUint8(2);let u=this.HEADER_LENGTH+2;const d=s.decode(e.slice(u,u+i));u=u+i;const f=s.decode(e.slice(u,u+a));u=u+a;const p=JSON.parse(s.decode(e.slice(u,e.byteLength)));return{ref:null,topic:d,event:f,payload:p}}}class qb{constructor(e,r){this.callback=e,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=r}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))}}var He;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(He||(He={}));const gy=(t,e,r={})=>{var s;const i=(s=r.skipTypes)!==null&&s!==void 0?s:[];return e?Object.keys(e).reduce((a,u)=>(a[u]=aP(u,t,e,i),a),{}):{}},aP=(t,e,r,s)=>{const i=e.find(d=>d.name===t),a=i==null?void 0:i.type,u=r[t];return a&&!s.includes(a)?Kb(a,u):fh(u)},Kb=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return dP(e,r)}switch(t){case He.bool:return lP(e);case He.float4:case He.float8:case He.int2:case He.int4:case He.int8:case He.numeric:case He.oid:return uP(e);case He.json:case He.jsonb:return cP(e);case He.timestamp:return fP(e);case He.abstime:case He.date:case He.daterange:case He.int4range:case He.int8range:case He.money:case He.reltime:case He.text:case He.time:case He.timestamptz:case He.timetz:case He.tsrange:case He.tstzrange:return fh(e);default:return fh(e)}},fh=t=>t,lP=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},uP=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},cP=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},dP=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,s=t[r];if(t[0]==="{"&&s==="}"){let a;const u=t.slice(1,r);try{a=JSON.parse("["+u+"]")}catch{a=u?u.split(","):[]}return a.map(d=>Kb(e,d))}return t},fP=t=>typeof t=="string"?t.replace(" ","T"):t,Gb=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class uf{constructor(e,r,s={},i=ch){this.channel=e,this.event=r,this.payload=s,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,r){var s;return this._hasReceived(e)&&r((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:e,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:r})}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:r}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var vy;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(vy||(vy={}));class pa{constructor(e,r){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(r==null?void 0:r.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},i=>{const{onJoin:a,onLeave:u,onSync:d}=this.caller;this.joinRef=this.channel._joinRef(),this.state=pa.syncState(this.state,i,a,u),this.pendingDiffs.forEach(f=>{this.state=pa.syncDiff(this.state,f,a,u)}),this.pendingDiffs=[],d()}),this.channel._on(s.diff,{},i=>{const{onJoin:a,onLeave:u,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=pa.syncDiff(this.state,i,a,u),d())}),this.onJoin((i,a,u)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:a,newPresences:u})}),this.onLeave((i,a,u)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:a,leftPresences:u})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,r,s,i){const a=this.cloneDeep(e),u=this.transformState(r),d={},f={};return this.map(a,(p,g)=>{u[p]||(f[p]=g)}),this.map(u,(p,g)=>{const y=a[p];if(y){const _=g.map(x=>x.presence_ref),v=y.map(x=>x.presence_ref),k=g.filter(x=>v.indexOf(x.presence_ref)<0),S=y.filter(x=>_.indexOf(x.presence_ref)<0);k.length>0&&(d[p]=k),S.length>0&&(f[p]=S)}else d[p]=g}),this.syncDiff(a,{joins:d,leaves:f},s,i)}static syncDiff(e,r,s,i){const{joins:a,leaves:u}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return s||(s=()=>{}),i||(i=()=>{}),this.map(a,(d,f)=>{var p;const g=(p=e[d])!==null&&p!==void 0?p:[];if(e[d]=this.cloneDeep(f),g.length>0){const y=e[d].map(v=>v.presence_ref),_=g.filter(v=>y.indexOf(v.presence_ref)<0);e[d].unshift(..._)}s(d,g,f)}),this.map(u,(d,f)=>{let p=e[d];if(!p)return;const g=f.map(y=>y.presence_ref);p=p.filter(y=>g.indexOf(y.presence_ref)<0),e[d]=p,i(d,p,f),p.length===0&&delete e[d]}),e}static map(e,r){return Object.getOwnPropertyNames(e).map(s=>r(s,e[s]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((r,s)=>{const i=e[s];return"metas"in i?r[s]=i.metas.map(a=>(a.presence_ref=a.phx_ref,delete a.phx_ref,delete a.phx_ref_prev,a)):r[s]=i,r},{})}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()}}var yy;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(yy||(yy={}));var ma;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(ma||(ma={}));var vn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(vn||(vn={}));class up{constructor(e,r={config:{}},s){var i,a;if(this.topic=e,this.params=r,this.socket=s,this.bindings={},this.state=dt.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},r.config),this.timeout=this.socket.timeout,this.joinPush=new uf(this,Ir.join,this.params,this.timeout),this.rejoinTimer=new qb(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=dt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(u=>u.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=dt.closed,this.socket._remove(this)}),this._onError(u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=dt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=dt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=dt.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ir.reply,{},(u,d)=>{this._trigger(this._replyEventName(d),u)}),this.presence=new pa(this),this.broadcastEndpointURL=Gb(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((a=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||a===void 0)&&a.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,r=this.timeout){var s,i,a;if(this.socket.isConnected()||this.socket.connect(),this.state==dt.closed){const{config:{broadcast:u,presence:d,private:f}}=this.params,p=(i=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(v=>v.filter))!==null&&i!==void 0?i:[],g=!!this.bindings[ma.PRESENCE]&&this.bindings[ma.PRESENCE].length>0||((a=this.params.config.presence)===null||a===void 0?void 0:a.enabled)===!0,y={},_={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:g}),postgres_changes:p,private:f};this.socket.accessTokenValue&&(y.access_token=this.socket.accessTokenValue),this._onError(v=>e==null?void 0:e(vn.CHANNEL_ERROR,v)),this._onClose(()=>e==null?void 0:e(vn.CLOSED)),this.updateJoinPayload(Object.assign({config:_},y)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:v})=>{var k;if(this.socket.setAuth(),v===void 0){e==null||e(vn.SUBSCRIBED);return}else{const S=this.bindings.postgres_changes,x=(k=S==null?void 0:S.length)!==null&&k!==void 0?k:0,T=[];for(let R=0;R{this.state=dt.errored,e==null||e(vn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(v).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(vn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,s){return this.state===dt.joined&&e===ma.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,r,s)}async httpSend(e,r,s={}){var i;const a=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(r==null)return Promise.reject("Payload is required for httpSend()");const u={method:"POST",headers:{Authorization:a,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},d=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(i=s.timeout)!==null&&i!==void 0?i:this.timeout);if(d.status===202)return{success:!0};let f=d.statusText;try{const p=await d.json();f=p.error||p.message||f}catch{}return Promise.reject(new Error(f))}async send(e,r={}){var s,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:a,payload:u}=e,f={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:a,payload:u,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,f,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);return await((i=p.body)===null||i===void 0?void 0:i.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(a=>{var u,d,f;const p=this._push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((f=(d=(u=this.params)===null||u===void 0?void 0:u.config)===null||d===void 0?void 0:d.broadcast)===null||f===void 0)&&f.ack)&&a("ok"),p.receive("ok",()=>a("ok")),p.receive("error",()=>a("error")),p.receive("timeout",()=>a("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=dt.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ir.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(i=>{s=new uf(this,Ir.leave,{},e),s.receive("ok",()=>{r(),i("ok")}).receive("timeout",()=>{r(),i("timed out")}).receive("error",()=>{i("error")}),s.send(),this._canPush()||s.trigger("ok",{})}).finally(()=>{s==null||s.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=dt.closed,this.bindings={}}async _fetchWithTimeout(e,r,s){const i=new AbortController,a=setTimeout(()=>i.abort(),s),u=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(a),u}_push(e,r,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new uf(this,e,r,s);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>oP){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(e,r,s){return r}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,r,s){var i,a;const u=e.toLocaleLowerCase(),{close:d,error:f,leave:p,join:g}=Ir;if(s&&[d,f,p,g].indexOf(u)>=0&&s!==this._joinRef())return;let _=this._onMessage(u,r,s);if(r&&!_)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(u)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(v=>{var k,S,x;return((k=v.filter)===null||k===void 0?void 0:k.event)==="*"||((x=(S=v.filter)===null||S===void 0?void 0:S.event)===null||x===void 0?void 0:x.toLocaleLowerCase())===u}).map(v=>v.callback(_,s)):(a=this.bindings[u])===null||a===void 0||a.filter(v=>{var k,S,x,T,R,C;if(["broadcast","presence","postgres_changes"].includes(u))if("id"in v){const j=v.id,D=(k=v.filter)===null||k===void 0?void 0:k.event;return j&&((S=r.ids)===null||S===void 0?void 0:S.includes(j))&&(D==="*"||(D==null?void 0:D.toLocaleLowerCase())===((x=r.data)===null||x===void 0?void 0:x.type.toLocaleLowerCase()))}else{const j=(R=(T=v==null?void 0:v.filter)===null||T===void 0?void 0:T.event)===null||R===void 0?void 0:R.toLocaleLowerCase();return j==="*"||j===((C=r==null?void 0:r.event)===null||C===void 0?void 0:C.toLocaleLowerCase())}else return v.type.toLocaleLowerCase()===u}).map(v=>{if(typeof _=="object"&&"ids"in _){const k=_.data,{schema:S,table:x,commit_timestamp:T,type:R,errors:C}=k;_=Object.assign(Object.assign({},{schema:S,table:x,commit_timestamp:T,eventType:R,new:{},old:{},errors:C}),this._getPayloadRecords(k))}v.callback(_,s)})}_isClosed(){return this.state===dt.closed}_isJoined(){return this.state===dt.joined}_isJoining(){return this.state===dt.joining}_isLeaving(){return this.state===dt.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,r,s){const i=e.toLocaleLowerCase(),a={type:i,filter:r,callback:s};return this.bindings[i]?this.bindings[i].push(a):this.bindings[i]=[a],this}_off(e,r){const s=e.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(i=>{var a;return!(((a=i.type)===null||a===void 0?void 0:a.toLocaleLowerCase())===s&&up.isEqual(i.filter,r))})),this}static isEqual(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(const s in e)if(e[s]!==r[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Ir.close,{},e)}_onError(e){this._on(Ir.error,{},r=>e(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=dt.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=gy(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=gy(e.columns,e.old_record)),r}}const cf=()=>{},fu={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},hP=[1e3,2e3,5e3,1e4],pP=1e4,mP=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class gP{constructor(e,r){var s;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=ch,this.transport=null,this.heartbeatIntervalMs=fu.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=cf,this.ref=0,this.reconnectTimer=null,this.logger=cf,this.conn=null,this.sendBuffer=[],this.serializer=new iP,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=i=>i?(...a)=>i(...a):(...a)=>fetch(...a),!(!((s=r==null?void 0:r.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${e}/${dh.websocket}`,this.httpEndpoint=Gb(e),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=eP.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const r=e.message;throw r.includes("Node.js")?new Error(`${r} To use Realtime in Node.js, you need to provide a WebSocket implementation: Option 1: Use Node.js 22+ which has native WebSocket support Option 2: Install and provide the "ws" package: npm install ws import ws from "ws" const client = new RealtimeClient(url, { ...options, transport: ws })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:nP}))}disconnect(e,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const s=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(s),this._setConnectionState("disconnected")},e?this.conn.close(e,r??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const e=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,r,s){this.logger(e,r,s)}connectionState(){switch(this.conn&&this.conn.readyState){case ha.connecting:return Ns.Connecting;case ha.open:return Ns.Open;case ha.closing:return Ns.Closing;default:return Ns.Closed}}isConnected(){return this.connectionState()===Ns.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,r={config:{}}){const s=`realtime:${e}`,i=this.getChannels().find(a=>a.topic===s);if(i)return i;{const a=new up(`realtime:${e}`,r,this);return this.channels.push(a),a}}push(e){const{topic:r,event:s,payload:i,ref:a}=e,u=()=>{this.encode(e,d=>{var f;(f=this.conn)===null||f===void 0||f.send(d)})};this.log("push",`${r} ${s} (${a})`,i),this.isConnected()?u():this.sendBuffer.push(u)}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(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(sP,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},fu.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(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 r=this.channels.find(s=>s.topic===e&&(s._isJoined()||s._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${e}"`),r.unsubscribe())}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply")try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error")}catch(p){this.log("error","error in heartbeat callback",p)}r.ref&&r.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:i,payload:a,ref:u}=r,d=u?`(${u})`:"",f=a.status||"";this.log("receive",`${f} ${s} ${i} ${d}`.trim(),a),this.channels.filter(p=>p._isMember(s)).forEach(p=>p._trigger(i,a,u)),this._triggerStateCallbacks("message",r)})}_clearTimer(e){var r;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.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");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this.workerRef.terminate()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var r;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.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(Ir.error))}_appendParams(e,r){if(Object.keys(r).length===0)return e;const s=e.match(/\?/)?"&":"?",i=new URLSearchParams(r);return`${e}${s}${i}`}_workerObjectUrl(e){let r;if(e)r=e;else{const s=new Blob([mP],{type:"application/javascript"});r=URL.createObjectURL(s)}return r}_setConnectionState(e,r=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(e=null){let r;e?r=e:this.accessToken?r=await this.accessToken():r=this.accessTokenValue,this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(s=>{const i={access_token:r,version:rP};r&&s.updateJoinPayload(i),s.joinedOnce&&s._isJoined()&&s._push(Ir.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(r=>{this.log("error",`error setting auth in ${e}`,r)})}_triggerStateCallbacks(e,r){try{this.stateChangeCallbacks[e].forEach(s=>{try{s(r)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(s){this.log("error",`error triggering ${e} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new qb(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},fu.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var r,s,i,a,u,d,f,p,g;if(this.transport=(r=e==null?void 0:e.transport)!==null&&r!==void 0?r:null,this.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:ch,this.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:fu.HEARTBEAT_INTERVAL,this.worker=(a=e==null?void 0:e.worker)!==null&&a!==void 0?a:!1,this.accessToken=(u=e==null?void 0:e.accessToken)!==null&&u!==void 0?u:null,this.heartbeatCallback=(d=e==null?void 0:e.heartbeatCallback)!==null&&d!==void 0?d:cf,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(f=e==null?void 0:e.reconnectAfterMs)!==null&&f!==void 0?f:(y=>hP[y-1]||pP),this.encode=(p=e==null?void 0:e.encode)!==null&&p!==void 0?p:((y,_)=>_(JSON.stringify(y))),this.decode=(g=e==null?void 0:e.decode)!==null&&g!==void 0?g:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}class cp extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function et(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class vP extends cp{constructor(e,r,s){super(e),this.name="StorageApiError",this.status=r,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class hh extends cp{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}}const dp=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),yP=()=>Response,ph=t=>{if(Array.isArray(t))return t.map(r=>ph(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,s])=>{const i=r.replace(/([-_][a-z])/gi,a=>a.toUpperCase().replace(/[-_]/g,""));e[i]=ph(s)}),e},wP=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},df=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},bP=(t,e,r)=>he(void 0,void 0,void 0,function*(){const s=yield yP();t instanceof s&&!(r!=null&&r.noResolveJson)?t.json().then(i=>{const a=t.status||500,u=(i==null?void 0:i.statusCode)||a+"";e(new vP(df(i),a,u))}).catch(i=>{e(new hh(df(i),i))}):e(new hh(df(t),t))}),_P=(t,e,r,s)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!s?i:(wP(s)?(i.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(s)):i.body=s,e!=null&&e.duplex&&(i.duplex=e.duplex),Object.assign(Object.assign({},i),r))};function La(t,e,r,s,i,a){return he(this,void 0,void 0,function*(){return new Promise((u,d)=>{t(r,_P(e,s,i,a)).then(f=>{if(!f.ok)throw f;return s!=null&&s.noResolveJson?f:f.json()}).then(f=>u(f)).catch(f=>bP(f,d,s))})})}function xa(t,e,r,s){return he(this,void 0,void 0,function*(){return La(t,"GET",e,r,s)})}function Pr(t,e,r,s,i){return he(this,void 0,void 0,function*(){return La(t,"POST",e,s,i,r)})}function mh(t,e,r,s,i){return he(this,void 0,void 0,function*(){return La(t,"PUT",e,s,i,r)})}function xP(t,e,r,s){return he(this,void 0,void 0,function*(){return La(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),s)})}function fp(t,e,r,s,i){return he(this,void 0,void 0,function*(){return La(t,"DELETE",e,s,i,r)})}class EP{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return he(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(et(e))return{data:null,error:e};throw e}})}}var Qb;class SP{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[Qb]="BlobDownloadBuilder",this.promise=null}asStream(){return new EP(this.downloadFn,this.shouldThrowOnError)}then(e,r){return this.getPromise().then(e,r)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return he(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(et(e))return{data:null,error:e};throw e}})}}Qb=Symbol.toStringTag;const kP={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},wy={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class TP{constructor(e,r={},s,i){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=s,this.fetch=dp(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,s,i){return he(this,void 0,void 0,function*(){try{let a;const u=Object.assign(Object.assign({},wy),i);let d=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(u.upsert)});const f=u.metadata;typeof Blob<"u"&&s instanceof Blob?(a=new FormData,a.append("cacheControl",u.cacheControl),f&&a.append("metadata",this.encodeMetadata(f)),a.append("",s)):typeof FormData<"u"&&s instanceof FormData?(a=s,a.has("cacheControl")||a.append("cacheControl",u.cacheControl),f&&!a.has("metadata")&&a.append("metadata",this.encodeMetadata(f))):(a=s,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,f&&(d["x-metadata"]=this.toBase64(this.encodeMetadata(f))),(typeof ReadableStream<"u"&&a instanceof ReadableStream||a&&typeof a=="object"&&"pipe"in a&&typeof a.pipe=="function")&&!u.duplex&&(u.duplex="half")),i!=null&&i.headers&&(d=Object.assign(Object.assign({},d),i.headers));const p=this._removeEmptyFolders(r),g=this._getFinalPath(p),y=yield(e=="PUT"?mh:Pr)(this.fetch,`${this.url}/object/${g}`,a,Object.assign({headers:d},u!=null&&u.duplex?{duplex:u.duplex}:{}));return{data:{path:p,id:y.Id,fullPath:y.Key},error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(et(a))return{data:null,error:a};throw a}})}upload(e,r,s){return he(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,s)})}uploadToSignedUrl(e,r,s,i){return he(this,void 0,void 0,function*(){const a=this._removeEmptyFolders(e),u=this._getFinalPath(a),d=new URL(this.url+`/object/upload/sign/${u}`);d.searchParams.set("token",r);try{let f;const p=Object.assign({upsert:wy.upsert},i),g=Object.assign(Object.assign({},this.headers),{"x-upsert":String(p.upsert)});typeof Blob<"u"&&s instanceof Blob?(f=new FormData,f.append("cacheControl",p.cacheControl),f.append("",s)):typeof FormData<"u"&&s instanceof FormData?(f=s,f.append("cacheControl",p.cacheControl)):(f=s,g["cache-control"]=`max-age=${p.cacheControl}`,g["content-type"]=p.contentType);const y=yield mh(this.fetch,d.toString(),f,{headers:g});return{data:{path:a,fullPath:y.Key},error:null}}catch(f){if(this.shouldThrowOnError)throw f;if(et(f))return{data:null,error:f};throw f}})}createSignedUploadUrl(e,r){return he(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e);const i=Object.assign({},this.headers);r!=null&&r.upsert&&(i["x-upsert"]="true");const a=yield Pr(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:i}),u=new URL(this.url+a.url),d=u.searchParams.get("token");if(!d)throw new cp("No token returned by API");return{data:{signedUrl:u.toString(),path:e,token:d},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}})}update(e,r,s){return he(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,s)})}move(e,r,s){return he(this,void 0,void 0,function*(){try{return{data:yield Pr(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(et(i))return{data:null,error:i};throw i}})}copy(e,r,s){return he(this,void 0,void 0,function*(){try{return{data:{path:(yield Pr(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(et(i))return{data:null,error:i};throw i}})}createSignedUrl(e,r,s){return he(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),a=yield Pr(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:r},s!=null&&s.transform?{transform:s.transform}:{}),{headers:this.headers});const u=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return a={signedUrl:encodeURI(`${this.url}${a.signedURL}${u}`)},{data:a,error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(et(i))return{data:null,error:i};throw i}})}createSignedUrls(e,r,s){return he(this,void 0,void 0,function*(){try{const i=yield Pr(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),a=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return{data:i.map(u=>Object.assign(Object.assign({},u),{signedUrl:u.signedURL?encodeURI(`${this.url}${u.signedURL}${a}`):null})),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(et(i))return{data:null,error:i};throw i}})}download(e,r){const i=typeof(r==null?void 0:r.transform)<"u"?"render/image/authenticated":"object",a=this.transformOptsToQueryString((r==null?void 0:r.transform)||{}),u=a?`?${a}`:"",d=this._getFinalPath(e),f=()=>xa(this.fetch,`${this.url}/${i}/${d}${u}`,{headers:this.headers,noResolveJson:!0});return new SP(f,this.shouldThrowOnError)}info(e){return he(this,void 0,void 0,function*(){const r=this._getFinalPath(e);try{const s=yield xa(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:ph(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}})}exists(e){return he(this,void 0,void 0,function*(){const r=this._getFinalPath(e);try{return yield xP(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(et(s)&&s instanceof hh){const i=s.originalError;if([400,404].includes(i==null?void 0:i.status))return{data:!1,error:s}}throw s}})}getPublicUrl(e,r){const s=this._getFinalPath(e),i=[],a=r!=null&&r.download?`download=${r.download===!0?"":r.download}`:"";a!==""&&i.push(a);const d=typeof(r==null?void 0:r.transform)<"u"?"render/image":"object",f=this.transformOptsToQueryString((r==null?void 0:r.transform)||{});f!==""&&i.push(f);let p=i.join("&");return p!==""&&(p=`?${p}`),{data:{publicUrl:encodeURI(`${this.url}/${d}/public/${s}${p}`)}}}remove(e){return he(this,void 0,void 0,function*(){try{return{data:yield fp(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}})}list(e,r,s){return he(this,void 0,void 0,function*(){try{const i=Object.assign(Object.assign(Object.assign({},kP),r),{prefix:e||""});return{data:yield Pr(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},s),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(et(i))return{data:null,error:i};throw i}})}listV2(e,r){return he(this,void 0,void 0,function*(){try{const s=Object.assign({},e);return{data:yield Pr(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},r),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const r=[];return e.width&&r.push(`width=${e.width}`),e.height&&r.push(`height=${e.height}`),e.resize&&r.push(`resize=${e.resize}`),e.format&&r.push(`format=${e.format}`),e.quality&&r.push(`quality=${e.quality}`),r.join("&")}}const Jb="2.80.0",Yb={"X-Client-Info":`storage-js/${Jb}`};class RP{constructor(e,r={},s,i){this.shouldThrowOnError=!1;const a=new URL(e);i!=null&&i.useNewHostname&&/supabase\.(co|in|red)$/.test(a.hostname)&&!a.hostname.includes("storage.supabase.")&&(a.hostname=a.hostname.replace("supabase.","storage.supabase.")),this.url=a.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Yb),r),this.fetch=dp(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return he(this,void 0,void 0,function*(){try{const r=this.listBucketOptionsToQueryString(e);return{data:yield xa(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}})}getBucket(e){return he(this,void 0,void 0,function*(){try{return{data:yield xa(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}})}createBucket(e){return he(this,arguments,void 0,function*(r,s={public:!1}){try{return{data:yield Pr(this.fetch,`${this.url}/bucket`,{id:r,name:r,type:s.type,public:s.public,file_size_limit:s.fileSizeLimit,allowed_mime_types:s.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(et(i))return{data:null,error:i};throw i}})}updateBucket(e,r){return he(this,void 0,void 0,function*(){try{return{data:yield mh(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(et(s))return{data:null,error:s};throw s}})}emptyBucket(e){return he(this,void 0,void 0,function*(){try{return{data:yield Pr(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}})}deleteBucket(e){return he(this,void 0,void 0,function*(){try{return{data:yield fp(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}})}listBucketOptionsToQueryString(e){const r={};return e&&("limit"in e&&(r.limit=String(e.limit)),"offset"in e&&(r.offset=String(e.offset)),e.search&&(r.search=e.search),e.sortColumn&&(r.sortColumn=e.sortColumn),e.sortOrder&&(r.sortOrder=e.sortOrder)),Object.keys(r).length>0?"?"+new URLSearchParams(r).toString():""}}class CP{constructor(e,r={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Yb),r),this.fetch=dp(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return he(this,void 0,void 0,function*(){try{return{data:yield Pr(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}})}listBuckets(e){return he(this,void 0,void 0,function*(){try{const r=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&r.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&r.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&r.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&r.set("sortOrder",e.sortOrder),e!=null&&e.search&&r.set("search",e.search);const s=r.toString(),i=s?`${this.url}/bucket?${s}`:`${this.url}/bucket`;return{data:yield xa(this.fetch,i,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}})}deleteBucket(e){return he(this,void 0,void 0,function*(){try{return{data:yield fp(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(et(r))return{data:null,error:r};throw r}})}}const hp={"X-Client-Info":`storage-js/${Jb}`,"Content-Type":"application/json"};class Xb extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function Xt(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}class ff extends Xb{constructor(e,r,s){super(e),this.name="StorageVectorsApiError",this.status=r,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class PP extends Xb{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}}var by;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(by||(by={}));const pp=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),jP=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},_y=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),OP=(t,e,r)=>he(void 0,void 0,void 0,function*(){if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!(r!=null&&r.noResolveJson)){const i=t.status||500,a=t;if(typeof a.json=="function")a.json().then(u=>{const d=(u==null?void 0:u.statusCode)||(u==null?void 0:u.code)||i+"";e(new ff(_y(u),i,d))}).catch(()=>{const u=i+"",d=a.statusText||`HTTP ${i} error`;e(new ff(d,i,u))});else{const u=i+"",d=a.statusText||`HTTP ${i} error`;e(new ff(d,i,u))}}else e(new PP(_y(t),t))}),AP=(t,e,r,s)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return s?(jP(s)?(i.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(s)):i.body=s,Object.assign(Object.assign({},i),r)):i};function IP(t,e,r,s,i,a){return he(this,void 0,void 0,function*(){return new Promise((u,d)=>{t(r,AP(e,s,i,a)).then(f=>{if(!f.ok)throw f;if(s!=null&&s.noResolveJson)return f;const p=f.headers.get("content-type");return!p||!p.includes("application/json")?{}:f.json()}).then(f=>u(f)).catch(f=>OP(f,d,s))})})}function Zt(t,e,r,s,i){return he(this,void 0,void 0,function*(){return IP(t,"POST",e,s,i,r)})}class NP{constructor(e,r={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},hp),r),this.fetch=pp(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return he(this,void 0,void 0,function*(){try{return{data:(yield Zt(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}})}getIndex(e,r){return he(this,void 0,void 0,function*(){try{return{data:yield Zt(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Xt(s))return{data:null,error:s};throw s}})}listIndexes(e){return he(this,void 0,void 0,function*(){try{return{data:yield Zt(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return he(this,void 0,void 0,function*(){try{return{data:(yield Zt(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Xt(s))return{data:null,error:s};throw s}})}}class LP{constructor(e,r={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},hp),r),this.fetch=pp(s)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return he(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield Zt(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}})}getVectors(e){return he(this,void 0,void 0,function*(){try{return{data:yield Zt(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}})}listVectors(e){return he(this,void 0,void 0,function*(){try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:yield Zt(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}})}queryVectors(e){return he(this,void 0,void 0,function*(){try{return{data:yield Zt(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}})}deleteVectors(e){return he(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield Zt(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}})}}class DP{constructor(e,r={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},hp),r),this.fetch=pp(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return he(this,void 0,void 0,function*(){try{return{data:(yield Zt(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}})}getBucket(e){return he(this,void 0,void 0,function*(){try{return{data:yield Zt(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}})}listBuckets(){return he(this,arguments,void 0,function*(e={}){try{return{data:yield Zt(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}})}deleteBucket(e){return he(this,void 0,void 0,function*(){try{return{data:(yield Zt(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}})}}class $P extends DP{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new MP(this.url,this.headers,e,this.fetch)}}class MP extends NP{constructor(e,r,s,i){super(e,r,i),this.vectorBucketName=s}createIndex(e){const r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return he(this,void 0,void 0,function*(){return r.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return he(this,arguments,void 0,function*(r={}){return e.listIndexes.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){const r=Object.create(null,{getIndex:{get:()=>super.getIndex}});return he(this,void 0,void 0,function*(){return r.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){const r=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return he(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new FP(this.url,this.headers,this.vectorBucketName,e,this.fetch)}}class FP extends LP{constructor(e,r,s,i,a){super(e,r,a),this.vectorBucketName=s,this.indexName=i}putVectors(e){const r=Object.create(null,{putVectors:{get:()=>super.putVectors}});return he(this,void 0,void 0,function*(){return r.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){const r=Object.create(null,{getVectors:{get:()=>super.getVectors}});return he(this,void 0,void 0,function*(){return r.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){const e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return he(this,arguments,void 0,function*(r={}){return e.listVectors.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){const r=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return he(this,void 0,void 0,function*(){return r.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){const r=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return he(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class UP extends RP{constructor(e,r={},s,i){super(e,r,s,i)}from(e){return new TP(this.url,this.headers,e,this.fetch)}get vectors(){return new $P(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new CP(this.url+"/iceberg",this.headers,this.fetch)}}const zP="2.80.0";let ua="";typeof Deno<"u"?ua="deno":typeof document<"u"?ua="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ua="react-native":ua="node";const BP={"X-Client-Info":`supabase-js-${ua}/${zP}`},VP={headers:BP},WP={schema:"public"},HP={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},qP={},KP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),GP=()=>Headers,QP=(t,e,r)=>{const s=KP(r),i=GP();return async(a,u)=>{var d;const f=(d=await e())!==null&&d!==void 0?d:t;let p=new i(u==null?void 0:u.headers);return p.has("apikey")||p.set("apikey",t),p.has("Authorization")||p.set("Authorization",`Bearer ${f}`),s(a,Object.assign(Object.assign({},u),{headers:p}))}};function JP(t){return t.endsWith("/")?t:t+"/"}function YP(t,e){var r,s;const{db:i,auth:a,realtime:u,global:d}=t,{db:f,auth:p,realtime:g,global:y}=e,_={db:Object.assign(Object.assign({},f),i),auth:Object.assign(Object.assign({},p),a),realtime:Object.assign(Object.assign({},g),u),storage:{},global:Object.assign(Object.assign(Object.assign({},y),d),{headers:Object.assign(Object.assign({},(r=y==null?void 0:y.headers)!==null&&r!==void 0?r:{}),(s=d==null?void 0:d.headers)!==null&&s!==void 0?s:{})}),accessToken:async()=>""};return t.accessToken?_.accessToken=t.accessToken:delete _.accessToken,_}function XP(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(JP(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const Zb="2.80.0",No=30*1e3,gh=3,hf=gh*No,ZP="http://localhost:9999",ej="supabase.auth.token",tj={"X-Client-Info":`gotrue-js/${Zb}`},vh="X-Supabase-Api-Version",e_={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},rj=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,nj=600*1e3;class Ea extends Error{constructor(e,r,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=s}}function ve(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class sj extends Ea{constructor(e,r,s){super(e,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function oj(t){return ve(t)&&t.name==="AuthApiError"}class Ls extends Ea{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class hs extends Ea{constructor(e,r,s,i){super(e,s,i),this.name=r,this.status=s}}class Rr extends hs{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function ij(t){return ve(t)&&t.name==="AuthSessionMissingError"}class To extends hs{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class hu extends hs{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class pu extends hs{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function aj(t){return ve(t)&&t.name==="AuthImplicitGrantRedirectError"}class xy extends hs{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class yh extends hs{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function pf(t){return ve(t)&&t.name==="AuthRetryableFetchError"}class Ey extends hs{constructor(e,r,s){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=s}}class wh extends hs{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Mu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Sy=` \r=`.split(""),lj=(()=>{const t=new Array(128);for(let e=0;e=6;){const s=e.queue>>e.queuedBits-6&63;r(Mu[s]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;r(Mu[s]),e.queuedBits-=6}}function t_(t,e,r){const s=lj[t];if(s>-1)for(e.queue=e.queue<<6|s,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Ty(t){const e=[],r=u=>{e.push(String.fromCodePoint(u))},s={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},a=u=>{dj(u,s,r)};for(let u=0;u>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function cj(t,e){for(let r=0;r55295&&s<=56319){const i=(s-55296)*1024&65535;s=(t.charCodeAt(r+1)-56320&65535|i)+65536,r+=1}uj(s,e)}}function dj(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let s=1;s<6;s+=1)if((t>>7-s&1)===0){e.utf8seq=s;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function Wo(t){const e=[],r={queue:0,queuedBits:0},s=i=>{e.push(i)};for(let i=0;ie.push(r)),new Uint8Array(e)}function $s(t){const e=[],r={queue:0,queuedBits:0},s=i=>{e.push(i)};return t.forEach(i=>ky(i,r,s)),ky(null,r,s),e.join("")}function hj(t){return Math.round(Date.now()/1e3)+t}function pj(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const Rt=()=>typeof window<"u"&&typeof document<"u",js={tested:!1,writable:!1},r_=()=>{if(!Rt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(js.tested)return js.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),js.tested=!0,js.writable=!0}catch{js.tested=!0,js.writable=!1}return js.writable};function mj(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((i,a)=>{e[a]=i})}catch{}return r.searchParams.forEach((s,i)=>{e[i]=s}),e}const n_=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),gj=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Lo=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},Os=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return r}},Jn=async(t,e)=>{await t.removeItem(e)};class nc{constructor(){this.promise=new nc.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}nc.promiseConstructor=Promise;function mf(t){const e=t.split(".");if(e.length!==3)throw new wh("Invalid JWT structure");for(let s=0;s{setTimeout(()=>e(null),t)})}function yj(t,e){return new Promise((s,i)=>{(async()=>{for(let a=0;a<1/0;a++)try{const u=await t(a);if(!e(a,null,u)){s(u);return}}catch(u){if(!e(a,u)){i(u);return}}})()})}function wj(t){return("0"+t.toString(16)).substr(-2)}function bj(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=r.length;let i="";for(let a=0;a<56;a++)i+=r.charAt(Math.floor(Math.random()*s));return i}return crypto.getRandomValues(e),Array.from(e,wj).join("")}async function _j(t){const r=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",r),i=new Uint8Array(s);return Array.from(i).map(a=>String.fromCharCode(a)).join("")}async function xj(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await _j(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ro(t,e,r=!1){const s=bj();let i=s;r&&(i+="/PASSWORD_RECOVERY"),await Lo(t,`${e}-code-verifier`,i);const a=await xj(s);return[a,s===a?"plain":"s256"]}const Ej=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Sj(t){const e=t.headers.get(vh);if(!e||!e.match(Ej))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function kj(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Tj(t){switch(t){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 new Error("Invalid alg claim")}}const Rj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Co(t){if(!Rj.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function gf(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Cj(t,e){return new Proxy(t,{get:(r,s,i)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const a=s.toString();if(a==="Symbol(Symbol.toPrimitive)"||a==="Symbol(Symbol.toStringTag)"||a==="Symbol(util.inspect.custom)"||a==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,s,i)}return!e.value&&typeof s=="string"&&(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."),e.value=!0),Reflect.get(r,s,i)}})}function Ry(t){return JSON.parse(JSON.stringify(t))}const As=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Pj=[502,503,504];async function Cy(t){var e;if(!gj(t))throw new yh(As(t),0);if(Pj.includes(t.status))throw new yh(As(t),t.status);let r;try{r=await t.json()}catch(a){throw new Ls(As(a),a)}let s;const i=Sj(t);if(i&&i.getTime()>=e_["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?s=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(s=r.error_code),s){if(s==="weak_password")throw new Ey(As(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new Rr}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((a,u)=>a&&typeof u=="string",!0))throw new Ey(As(r),t.status,r.weak_password.reasons);throw new sj(As(r),t.status||500,s)}const jj=(t,e,r,s)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(s),Object.assign(Object.assign({},i),r))};async function Se(t,e,r,s){var i;const a=Object.assign({},s==null?void 0:s.headers);a[vh]||(a[vh]=e_["2024-01-01"].name),s!=null&&s.jwt&&(a.Authorization=`Bearer ${s.jwt}`);const u=(i=s==null?void 0:s.query)!==null&&i!==void 0?i:{};s!=null&&s.redirectTo&&(u.redirect_to=s.redirectTo);const d=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",f=await Oj(t,e,r+d,{headers:a,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(f):{data:Object.assign({},f),error:null}}async function Oj(t,e,r,s,i,a){const u=jj(e,s,i,a);let d;try{d=await t(r,Object.assign({},u))}catch(f){throw console.error(f),new yh(As(f),0)}if(d.ok||await Cy(d),s!=null&&s.noResolveJson)return d;try{return await d.json()}catch(f){await Cy(f)}}function Cr(t){var e;let r=null;Nj(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=hj(t.expires_in)));const s=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:s},error:null}}function Py(t){const e=Cr(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,s)=>r&&typeof s=="string",!0)&&(e.data.weak_password=t.weak_password),e}function es(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Aj(t){return{data:t,error:null}}function Ij(t){const{action_link:e,email_otp:r,hashed_token:s,redirect_to:i,verification_type:a}=t,u=gi(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:e,email_otp:r,hashed_token:s,redirect_to:i,verification_type:a},f=Object.assign({},u);return{data:{properties:d,user:f},error:null}}function jy(t){return t}function Nj(t){return t.access_token&&t.refresh_token&&t.expires_in}const vf=["global","local","others"];class Lj{constructor({url:e="",headers:r={},fetch:s}){this.url=e,this.headers=r,this.fetch=n_(s),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),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,r=vf[0]){if(vf.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${vf.join(", ")}`);try{return await Se(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(s){if(ve(s))return{data:null,error:s};throw s}}async inviteUserByEmail(e,r={}){try{return await Se(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:es})}catch(s){if(ve(s))return{data:{user:null},error:s};throw s}}async generateLink(e){try{const{options:r}=e,s=gi(e,["options"]),i=Object.assign(Object.assign({},s),r);return"newEmail"in s&&(i.new_email=s==null?void 0:s.newEmail,delete i.newEmail),await Se(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:Ij,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(ve(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await Se(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:es})}catch(r){if(ve(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,s,i,a,u,d,f;try{const p={nextPage:null,lastPage:0,total:0},g=await Se(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(a=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""},xform:jy});if(g.error)throw g.error;const y=await g.json(),_=(u=g.headers.get("x-total-count"))!==null&&u!==void 0?u:0,v=(f=(d=g.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&f!==void 0?f:[];return v.length>0&&(v.forEach(k=>{const S=parseInt(k.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(k.split(";")[1].split("=")[1]);p[`${x}Page`]=S}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(ve(p))return{data:{users:[]},error:p};throw p}}async getUserById(e){Co(e);try{return await Se(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:es})}catch(r){if(ve(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Co(e);try{return await Se(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:es})}catch(s){if(ve(s))return{data:{user:null},error:s};throw s}}async deleteUser(e,r=!1){Co(e);try{return await Se(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:es})}catch(s){if(ve(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){Co(e.userId);try{const{data:r,error:s}=await Se(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:r,error:s}}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Co(e.userId),Co(e.id);try{return{data:await Se(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,s,i,a,u,d,f;try{const p={nextPage:null,lastPage:0,total:0},g=await Se(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(a=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""},xform:jy});if(g.error)throw g.error;const y=await g.json(),_=(u=g.headers.get("x-total-count"))!==null&&u!==void 0?u:0,v=(f=(d=g.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&f!==void 0?f:[];return v.length>0&&(v.forEach(k=>{const S=parseInt(k.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(k.split(";")[1].split("=")[1]);p[`${x}Page`]=S}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(ve(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(e){try{return await Se(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{return await Se(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{return await Se(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ve(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(e){try{return await Se(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{return await Se(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ve(r))return{data:null,error:r};throw r}}}function Oy(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const Po={debug:!!(globalThis&&r_()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class s_ extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Dj extends s_{}async function $j(t,e,r){Po.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const s=new globalThis.AbortController;return e>0&&setTimeout(()=>{s.abort(),Po.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async i=>{if(i){Po.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{Po.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw Po.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Dj(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Po.debug)try{const a=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(a,null," "))}catch(a){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",a)}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 Mj(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function o_(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Fj(t){return parseInt(t,16)}function Uj(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,s=>s.toString(16).padStart(2,"0")).join("")}function zj(t){var e;const{chainId:r,domain:s,expirationTime:i,issuedAt:a=new Date,nonce:u,notBefore:d,requestId:f,resources:p,scheme:g,uri:y,version:_}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!s)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(u&&u.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${u}`);if(!y)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(_!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${_}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(` `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const v=o_(t.address),k=g?`${g}://${s}`:s,S=t.statement?`${t.statement} `:"",x=`${k} wants you to sign in with your Ethereum account: ${v} ${S}`;let T=`URI: ${y} Version: ${_} Chain ID: ${r}${u?` Nonce: ${u}`:""} Issued At: ${a.toISOString()}`;if(i&&(T+=` Expiration Time: ${i.toISOString()}`),d&&(T+=` Not Before: ${d.toISOString()}`),f&&(T+=` Request ID: ${f}`),p){let R=` Resources:`;for(const C of p){if(!C||typeof C!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${C}`);R+=` - ${C}`}T+=R}return`${x} ${T}`}class lt extends Error{constructor({message:e,code:r,cause:s,name:i}){var a;super(e,{cause:s}),this.__isWebAuthnError=!0,this.name=(a=i??(s instanceof Error?s.name:void 0))!==null&&a!==void 0?a:"Unknown Error",this.code=r}}class Fu extends lt{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function Bj({error:t,options:e}){var r,s,i;const{publicKey:a}=e;if(!a)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new lt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=a.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new lt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((s=a.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new lt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=a.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new lt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new lt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new lt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return a.pubKeyCredParams.filter(d=>d.type==="public-key").length===0?new lt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new lt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const u=window.location.hostname;if(i_(u)){if(a.rp.id!==u)return new lt({message:`The RP ID "${a.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new lt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(a.user.id.byteLength<1||a.user.id.byteLength>64)return new lt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new lt({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new lt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Vj({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new lt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new lt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const s=window.location.hostname;if(i_(s)){if(r.rpId!==s)return new lt({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new lt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new lt({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new lt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Wj{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const Hj=new Wj;function qj(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:s}=t,i=gi(t,["challenge","user","excludeCredentials"]),a=Wo(e).buffer,u=Object.assign(Object.assign({},r),{id:Wo(r.id).buffer}),d=Object.assign(Object.assign({},i),{challenge:a,user:u});if(s&&s.length>0){d.excludeCredentials=new Array(s.length);for(let f=0;f0){a.allowCredentials=new Array(r.length);for(let u=0;ui!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),s={};for(const i of t)if(i)for(const a in i){const u=i[a];if(u!==void 0)if(Array.isArray(u))s[a]=u;else if(r(u))s[a]=u;else if(e(u)){const d=s[a];e(d)?s[a]=Uu(d,u):s[a]=Uu(u)}else s[a]=u}return s}function eO(t,e){return Uu(Xj,t,e||{})}function tO(t,e){return Uu(Zj,t,e||{})}class rO{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:r,friendlyName:s,signal:i},a){try{const{data:u,error:d}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!u)return{data:null,error:d};const f=i??Hj.createNewAbortSignal();if(u.webauthn.type==="create"){const{user:p}=u.webauthn.credential_options.publicKey;p.name||(p.name=`${p.id}:${s}`),p.displayName||(p.displayName=p.name)}switch(u.webauthn.type){case"create":{const p=eO(u.webauthn.credential_options.publicKey,a==null?void 0:a.create),{data:g,error:y}=await Jj({publicKey:p,signal:f});return g?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:g}},error:null}:{data:null,error:y}}case"request":{const p=tO(u.webauthn.credential_options.publicKey,a==null?void 0:a.request),{data:g,error:y}=await Yj(Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:p,signal:f}));return g?{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:g}},error:null}:{data:null,error:y}}}}catch(u){return ve(u)?{data:null,error:u}:{data:null,error:new Ls("Unexpected error in challenge",u)}}}async _verify({challengeId:e,factorId:r,webauthn:s}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:s})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:i}},a){if(!r)return{data:null,error:new Ea("rpId is required for WebAuthn authentication")};try{if(!Ay())return{data:null,error:new Ls("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:s},signal:i},{request:a});if(!u)return{data:null,error:d};const{webauthn:f}=u;return this._verify({factorId:e,challengeId:u.challengeId,webauthn:{type:f.type,rpId:r,rpOrigins:s,credential_response:f.credential_response}})}catch(u){return ve(u)?{data:null,error:u}:{data:null,error:new Ls("Unexpected error in authenticate",u)}}}async _register({friendlyName:e,rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:i},a){if(!r)return{data:null,error:new Ea("rpId is required for WebAuthn registration")};try{if(!Ay())return{data:null,error:new Ls("Browser does not support WebAuthn",null)};const{data:u,error:d}=await this._enroll({friendlyName:e});if(!u)return await this.client.mfa.listFactors().then(g=>{var y;return(y=g.data)===null||y===void 0?void 0:y.all.find(_=>_.factor_type==="webauthn"&&_.friendly_name===e&&_.status!=="unverified")}).then(g=>g?this.client.mfa.unenroll({factorId:g==null?void 0:g.id}):void 0),{data:null,error:d};const{data:f,error:p}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:r,rpOrigins:s},signal:i},{create:a});return f?this._verify({factorId:u.id,challengeId:f.challengeId,webauthn:{rpId:r,rpOrigins:s,type:f.webauthn.type,credential_response:f.webauthn.credential_response}}):{data:null,error:p}}catch(u){return ve(u)?{data:null,error:u}:{data:null,error:new Ls("Unexpected error in register",u)}}}}Mj();const nO={url:ZP,storageKey:ej,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:tj,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function Iy(t,e,r){return await r()}const jo={};class Sa{get jwks(){var e,r;return(r=(e=jo[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){jo[this.storageKey]=Object.assign(Object.assign({},jo[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=jo[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){jo[this.storageKey]=Object.assign(Object.assign({},jo[this.storageKey]),{cachedAt:e})}constructor(e){var r,s,i;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;const a=Object.assign(Object.assign({},nO),e);if(this.storageKey=a.storageKey,this.instanceID=(r=Sa.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Sa.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.instanceID>0&&Rt()){const u=`${this._logPrefix()} 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.`;console.warn(u),this.logDebugMessages&&console.trace(u)}if(this.persistSession=a.persistSession,this.autoRefreshToken=a.autoRefreshToken,this.admin=new Lj({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=n_(a.fetch),this.lock=a.lock||Iy,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,this.throwOnError=a.throwOnError,a.lock?this.lock=a.lock:Rt()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=$j:this.lock=Iy,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 rO(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(a.storage?this.storage=a.storage:r_()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Oy(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=Oy(this.memoryStorage)),Rt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(u){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",u)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async u=>{this._debug("received broadcast notification from other tab or client",u),await this._notifyAllSubscribers(u.data.event,u.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Zb}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},s="none";if(Rt()&&(r=mj(window.location.href),this._isImplicitGrantCallback(r)?s="implicit":await this._isPKCECallback(r)&&(s="pkce")),Rt()&&this.detectSessionInUrl&&s!=="none"){const{data:i,error:a}=await this._getSessionFromURL(r,s);if(a){if(this._debug("#_initialize()","error detecting session from URL",a),aj(a)){const f=(e=a.details)===null||e===void 0?void 0:e.code;if(f==="identity_already_exists"||f==="identity_not_found"||f==="single_identity_not_deletable")return{error:a}}return await this._removeSession(),{error:a}}const{session:u,redirectType:d}=i;return this._debug("#_initialize()","detected session in URL",u,"redirect type",d),await this._saveSession(u),setTimeout(async()=>{d==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",u):await this._notifyAllSubscribers("SIGNED_IN",u)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return ve(r)?this._returnResult({error:r}):this._returnResult({error:new Ls("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,s,i;try{const a=await Se(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:Cr}),{data:u,error:d}=a;if(d||!u)return this._returnResult({data:{user:null,session:null},error:d});const f=u.session,p=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",f)),this._returnResult({data:{user:p,session:f},error:null})}catch(a){if(ve(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signUp(e){var r,s,i;try{let a;if("email"in e){const{email:g,password:y,options:_}=e;let v=null,k=null;this.flowType==="pkce"&&([v,k]=await Ro(this.storage,this.storageKey)),a=await Se(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:_==null?void 0:_.emailRedirectTo,body:{email:g,password:y,data:(r=_==null?void 0:_.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:_==null?void 0:_.captchaToken},code_challenge:v,code_challenge_method:k},xform:Cr})}else if("phone"in e){const{phone:g,password:y,options:_}=e;a=await Se(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:g,password:y,data:(s=_==null?void 0:_.data)!==null&&s!==void 0?s:{},channel:(i=_==null?void 0:_.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:_==null?void 0:_.captchaToken}},xform:Cr})}else throw new hu("You must provide either an email or phone number and a password");const{data:u,error:d}=a;if(d||!u)return this._returnResult({data:{user:null,session:null},error:d});const f=u.session,p=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",f)),this._returnResult({data:{user:p,session:f},error:null})}catch(a){if(ve(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithPassword(e){try{let r;if("email"in e){const{email:a,password:u,options:d}=e;r=await Se(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:a,password:u,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:Py})}else if("phone"in e){const{phone:a,password:u,options:d}=e;r=await Se(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:a,password:u,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:Py})}else throw new hu("You must provide either an email or phone number and a password");const{data:s,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!s||!s.session||!s.user){const a=new To;return this._returnResult({data:{user:null,session:null},error:a})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:i})}catch(r){if(ve(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,s,i,a;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(s=e.options)===null||s===void 0?void 0:s.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(a=e.options)===null||a===void 0?void 0:a.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,s,i,a,u,d,f,p,g,y,_;let v,k;if("message"in e)v=e.message,k=e.signature;else{const{chain:S,wallet:x,statement:T,options:R}=e;let C;if(Rt())if(typeof x=="object")C=x;else{const Q=window;if("ethereum"in Q&&typeof Q.ethereum=="object"&&"request"in Q.ethereum&&typeof Q.ethereum.request=="function")C=Q.ethereum;else throw new 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(typeof x!="object"||!(R!=null&&R.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");C=x}const j=new URL((r=R==null?void 0:R.url)!==null&&r!==void 0?r:window.location.href),D=await C.request({method:"eth_requestAccounts"}).then(Q=>Q).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!D||D.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const A=o_(D[0]);let z=(s=R==null?void 0:R.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!z){const Q=await C.request({method:"eth_chainId"});z=Fj(Q)}const W={domain:j.host,address:A,statement:T,uri:j.href,version:"1",chainId:z,nonce:(i=R==null?void 0:R.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(u=(a=R==null?void 0:R.signInWithEthereum)===null||a===void 0?void 0:a.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(d=R==null?void 0:R.signInWithEthereum)===null||d===void 0?void 0:d.expirationTime,notBefore:(f=R==null?void 0:R.signInWithEthereum)===null||f===void 0?void 0:f.notBefore,requestId:(p=R==null?void 0:R.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(g=R==null?void 0:R.signInWithEthereum)===null||g===void 0?void 0:g.resources};v=zj(W),k=await C.request({method:"personal_sign",params:[Uj(v),A]})}try{const{data:S,error:x}=await Se(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:v,signature:k},!((y=e.options)===null||y===void 0)&&y.captchaToken?{gotrue_meta_security:{captcha_token:(_=e.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:Cr});if(x)throw x;if(!S||!S.session||!S.user){const T=new To;return this._returnResult({data:{user:null,session:null},error:T})}return S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),this._returnResult({data:Object.assign({},S),error:x})}catch(S){if(ve(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async signInWithSolana(e){var r,s,i,a,u,d,f,p,g,y,_,v;let k,S;if("message"in e)k=e.message,S=e.signature;else{const{chain:x,wallet:T,statement:R,options:C}=e;let j;if(Rt())if(typeof T=="object")j=T;else{const A=window;if("solana"in A&&typeof A.solana=="object"&&("signIn"in A.solana&&typeof A.solana.signIn=="function"||"signMessage"in A.solana&&typeof A.solana.signMessage=="function"))j=A.solana;else throw new 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(typeof T!="object"||!(C!=null&&C.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=T}const D=new URL((r=C==null?void 0:C.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in j&&j.signIn){const A=await j.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},C==null?void 0:C.signInWithSolana),{version:"1",domain:D.host,uri:D.href}),R?{statement:R}:null));let z;if(Array.isArray(A)&&A[0]&&typeof A[0]=="object")z=A[0];else if(A&&typeof A=="object"&&"signedMessage"in A&&"signature"in A)z=A;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in z&&"signature"in z&&(typeof z.signedMessage=="string"||z.signedMessage instanceof Uint8Array)&&z.signature instanceof Uint8Array)k=typeof z.signedMessage=="string"?z.signedMessage:new TextDecoder().decode(z.signedMessage),S=z.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in j)||typeof j.signMessage!="function"||!("publicKey"in j)||typeof j!="object"||!j.publicKey||!("toBase58"in j.publicKey)||typeof j.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");k=[`${D.host} wants you to sign in with your Solana account:`,j.publicKey.toBase58(),...R?["",R,""]:[""],"Version: 1",`URI: ${D.href}`,`Issued At: ${(i=(s=C==null?void 0:C.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((a=C==null?void 0:C.signInWithSolana)===null||a===void 0)&&a.notBefore?[`Not Before: ${C.signInWithSolana.notBefore}`]:[],...!((u=C==null?void 0:C.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${C.signInWithSolana.expirationTime}`]:[],...!((d=C==null?void 0:C.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${C.signInWithSolana.chainId}`]:[],...!((f=C==null?void 0:C.signInWithSolana)===null||f===void 0)&&f.nonce?[`Nonce: ${C.signInWithSolana.nonce}`]:[],...!((p=C==null?void 0:C.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${C.signInWithSolana.requestId}`]:[],...!((y=(g=C==null?void 0:C.signInWithSolana)===null||g===void 0?void 0:g.resources)===null||y===void 0)&&y.length?["Resources",...C.signInWithSolana.resources.map(z=>`- ${z}`)]:[]].join(` `);const A=await j.signMessage(new TextEncoder().encode(k),"utf8");if(!A||!(A instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");S=A}}try{const{data:x,error:T}=await Se(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:k,signature:$s(S)},!((_=e.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(v=e.options)===null||v===void 0?void 0:v.captchaToken}}:null),xform:Cr});if(T)throw T;if(!x||!x.session||!x.user){const R=new To;return this._returnResult({data:{user:null,session:null},error:R})}return x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),this._returnResult({data:Object.assign({},x),error:T})}catch(x){if(ve(x))return this._returnResult({data:{user:null,session:null},error:x});throw x}}async _exchangeCodeForSession(e){const r=await Os(this.storage,`${this.storageKey}-code-verifier`),[s,i]=(r??"").split("/");try{const{data:a,error:u}=await Se(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:Cr});if(await Jn(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!a||!a.session||!a.user){const d=new To;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),this._returnResult({data:Object.assign(Object.assign({},a),{redirectType:i??null}),error:u})}catch(a){if(ve(a))return this._returnResult({data:{user:null,session:null,redirectType:null},error:a});throw a}}async signInWithIdToken(e){try{const{options:r,provider:s,token:i,access_token:a,nonce:u}=e,d=await Se(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:i,access_token:a,nonce:u,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:Cr}),{data:f,error:p}=d;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!f||!f.session||!f.user){const g=new To;return this._returnResult({data:{user:null,session:null},error:g})}return f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("SIGNED_IN",f.session)),this._returnResult({data:f,error:p})}catch(r){if(ve(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,s,i,a,u;try{if("email"in e){const{email:d,options:f}=e;let p=null,g=null;this.flowType==="pkce"&&([p,g]=await Ro(this.storage,this.storageKey));const{error:y}=await Se(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},create_user:(s=f==null?void 0:f.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:g},redirectTo:f==null?void 0:f.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:y})}if("phone"in e){const{phone:d,options:f}=e,{data:p,error:g}=await Se(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(i=f==null?void 0:f.data)!==null&&i!==void 0?i:{},create_user:(a=f==null?void 0:f.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},channel:(u=f==null?void 0:f.channel)!==null&&u!==void 0?u:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p==null?void 0:p.message_id},error:g})}throw new hu("You must provide either an email or phone number.")}catch(d){if(ve(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(e){var r,s;try{let i,a;"options"in e&&(i=(r=e.options)===null||r===void 0?void 0:r.redirectTo,a=(s=e.options)===null||s===void 0?void 0:s.captchaToken);const{data:u,error:d}=await Se(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:a}}),redirectTo:i,xform:Cr});if(d)throw d;if(!u)throw new Error("An error occurred on token verification.");const f=u.session,p=u.user;return f!=null&&f.access_token&&(await this._saveSession(f),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",f)),this._returnResult({data:{user:p,session:f},error:null})}catch(i){if(ve(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,s,i;try{let a=null,u=null;this.flowType==="pkce"&&([a,u]=await Ro(this.storage,this.storageKey));const d=await Se(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:(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&s!==void 0?s:void 0}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:u}),headers:this.headers,xform:Aj});return this._returnResult(d)}catch(a){if(ve(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:s}=e;if(s)throw s;if(!r)throw new Rr;const{error:i}=await Se(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if(ve(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:s,type:i,options:a}=e,{error:u}=await Se(this.fetch,"POST",r,{headers:this.headers,body:{email:s,type:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},redirectTo:a==null?void 0:a.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:u})}else if("phone"in e){const{phone:s,type:i,options:a}=e,{data:u,error:d}=await Se(this.fetch,"POST",r,{headers:this.headers,body:{phone:s,type:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d})}throw new hu("You must provide either an email or phone number and a type")}catch(r){if(ve(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await s,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=r();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await s}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{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await Os(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=e.expires_at?e.expires_at*1e3-Date.now()await this._getUser()))}async _getUser(e){try{return e?await Se(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:es}):await this._useSession(async r=>{var s,i,a;const{data:u,error:d}=r;if(d)throw d;return!(!((s=u.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Rr}:await Se(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(a=(i=u.session)===null||i===void 0?void 0:i.access_token)!==null&&a!==void 0?a:void 0,xform:es})})}catch(r){if(ve(r))return ij(r)&&(await this._removeSession(),await Jn(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async s=>{const{data:i,error:a}=s;if(a)throw a;if(!i.session)throw new Rr;const u=i.session;let d=null,f=null;this.flowType==="pkce"&&e.email!=null&&([d,f]=await Ro(this.storage,this.storageKey));const{data:p,error:g}=await Se(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:d,code_challenge_method:f}),jwt:u.access_token,xform:es});if(g)throw g;return u.user=p.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(s){if(ve(s))return this._returnResult({data:{user:null},error:s});throw s}}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 Rr;const r=Date.now()/1e3;let s=r,i=!0,a=null;const{payload:u}=mf(e.access_token);if(u.exp&&(s=u.exp,i=s<=r),i){const{data:d,error:f}=await this._callRefreshToken(e.refresh_token);if(f)return this._returnResult({data:{user:null,session:null},error:f});if(!d)return{data:{user:null,session:null},error:null};a=d}else{const{data:d,error:f}=await this._getUser(e.access_token);if(f)throw f;a={access_token:e.access_token,refresh_token:e.refresh_token,user:d.user,token_type:"bearer",expires_in:s-r,expires_at:s},await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)}return this._returnResult({data:{user:a.user,session:a},error:null})}catch(r){if(ve(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}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 r=>{var s;if(!e){const{data:u,error:d}=r;if(d)throw d;e=(s=u.session)!==null&&s!==void 0?s:void 0}if(!(e!=null&&e.refresh_token))throw new Rr;const{data:i,error:a}=await this._callRefreshToken(e.refresh_token);return a?this._returnResult({data:{user:null,session:null},error:a}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(ve(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){try{if(!Rt())throw new pu("No browser detected.");if(e.error||e.error_description||e.error_code)throw new pu(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new xy("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new pu("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new xy("No code detected.");const{data:R,error:C}=await this._exchangeCodeForSession(e.code);if(C)throw C;const j=new URL(window.location.href);return j.searchParams.delete("code"),window.history.replaceState(window.history.state,"",j.toString()),{data:{session:R.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:a,refresh_token:u,expires_in:d,expires_at:f,token_type:p}=e;if(!a||!d||!u||!p)throw new pu("No session defined in URL");const g=Math.round(Date.now()/1e3),y=parseInt(d);let _=g+y;f&&(_=parseInt(f));const v=_-g;v*1e3<=No&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${v}s, should have been closer to ${y}s`);const k=_-y;g-k>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",k,_,g):g-k<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",k,_,g);const{data:S,error:x}=await this._getUser(a);if(x)throw x;const T={provider_token:s,provider_refresh_token:i,access_token:a,expires_in:y,expires_at:_,refresh_token:u,token_type:p,user:S.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:T,redirectType:e.type},error:null})}catch(s){if(ve(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await Os(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}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 r=>{var s;const{data:i,error:a}=r;if(a)return this._returnResult({error:a});const u=(s=i.session)===null||s===void 0?void 0:s.access_token;if(u){const{error:d}=await this.admin.signOut(u,e);if(d&&!(oj(d)&&(d.status===404||d.status===401||d.status===403)))return this._returnResult({error:d})}return e!=="others"&&(await this._removeSession(),await Jn(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=pj(),s={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,s),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async r=>{var s,i;try{const{data:{session:a},error:u}=r;if(u)throw u;await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",a)),this._debug("INITIAL_SESSION","callback id",e,"session",a)}catch(a){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",a),console.error(a)}})}async resetPasswordForEmail(e,r={}){let s=null,i=null;this.flowType==="pkce"&&([s,i]=await Ro(this.storage,this.storageKey,!0));try{return await Se(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(a){if(ve(a))return this._returnResult({data:null,error:a});throw a}}async getUserIdentities(){var e;try{const{data:r,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(ve(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{const{data:s,error:i}=await this._useSession(async a=>{var u,d,f,p,g;const{data:y,error:_}=a;if(_)throw _;const v=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(u=e.options)===null||u===void 0?void 0:u.redirectTo,scopes:(d=e.options)===null||d===void 0?void 0:d.scopes,queryParams:(f=e.options)===null||f===void 0?void 0:f.queryParams,skipBrowserRedirect:!0});return await Se(this.fetch,"GET",v,{headers:this.headers,jwt:(g=(p=y.session)===null||p===void 0?void 0:p.access_token)!==null&&g!==void 0?g:void 0})});if(i)throw i;return Rt()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),this._returnResult({data:{provider:e.provider,url:s==null?void 0:s.url},error:null})}catch(s){if(ve(s))return this._returnResult({data:{provider:e.provider,url:null},error:s});throw s}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var s;try{const{error:i,data:{session:a}}=r;if(i)throw i;const{options:u,provider:d,token:f,access_token:p,nonce:g}=e,y=await Se(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=a==null?void 0:a.access_token)!==null&&s!==void 0?s:void 0,body:{provider:d,id_token:f,access_token:p,nonce:g,link_identity:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken}},xform:Cr}),{data:_,error:v}=y;return v?this._returnResult({data:{user:null,session:null},error:v}):!_||!_.session||!_.user?this._returnResult({data:{user:null,session:null},error:new To}):(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("USER_UPDATED",_.session)),this._returnResult({data:_,error:v}))}catch(i){if(ve(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var s,i;const{data:a,error:u}=r;if(u)throw u;return await Se(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(s=a.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if(ve(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const s=Date.now();return await yj(async i=>(i>0&&await vj(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await Se(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Cr})),(i,a)=>{const u=200*Math.pow(2,i);return a&&pf(a)&&Date.now()+u-s{try{await d.callback(e,r)}catch(f){a.push(f)}});if(await Promise.all(u),a.length>0){for(let d=0;dthis._autoRefreshTokenTick(),No);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const 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{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:s}}=r;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((s.expires_at*1e3-e)/No);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${No}ms, refresh threshold is ${gh} ticks`),i<=gh&&await this._callRefreshToken(s.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof s_)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Rt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,s){const i=[`provider=${encodeURIComponent(r)}`];if(s!=null&&s.redirectTo&&i.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&i.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[a,u]=await Ro(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(u)}`});i.push(d.toString())}if(s!=null&&s.queryParams){const a=new URLSearchParams(s.queryParams);i.push(a.toString())}return s!=null&&s.skipBrowserRedirect&&i.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var s;const{data:i,error:a}=r;return a?this._returnResult({data:null,error:a}):await Se(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token})})}catch(r){if(ve(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var s,i;const{data:a,error:u}=r;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:f,error:p}=await Se(this.fetch,"POST",`${this.url}/factors`,{body:d,headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});return p?this._returnResult({data:null,error:p}):(e.factorType==="totp"&&f.type==="totp"&&(!((i=f==null?void 0:f.totp)===null||i===void 0)&&i.qr_code)&&(f.totp.qr_code=`data:image/svg+xml;utf-8,${f.totp.qr_code}`),this._returnResult({data:f,error:null}))})}catch(r){if(ve(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var s;const{data:i,error:a}=r;if(a)return this._returnResult({data:null,error:a});const u=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Gj(e.webauthn.credential_response):Qj(e.webauthn.credential_response)})}:{code:e.code}),{data:d,error:f}=await Se(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:u,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return f?this._returnResult({data:null,error:f}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+d.expires_in},d)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",d),this._returnResult({data:d,error:f}))})}catch(r){if(ve(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var s;const{data:i,error:a}=r;if(a)return this._returnResult({data:null,error:a});const u=await Se(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});if(u.error)return u;const{data:d}=u;if(d.type!=="webauthn")return{data:d,error:null};switch(d.webauthn.type){case"create":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:qj(d.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:Kj(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(ve(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){const{data:r,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:s}=await this.getUser();if(s)return{data:null,error:s};const i={all:[],phone:[],totp:[],webauthn:[]};for(const a of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])i.all.push(a),a.status==="verified"&&i[a.factor_type].push(a);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var e,r;const{data:{session:s},error:i}=await this.getSession();if(i)return this._returnResult({data:null,error:i});if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:a}=mf(s.access_token);let u=null;a.aal&&(u=a.aal);let d=u;((r=(e=s.user.factors)===null||e===void 0?void 0:e.filter(g=>g.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(d="aal2");const p=a.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:p},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;return i?this._returnResult({data:null,error:i}):s?await Se(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new Rr})})}catch(r){if(ve(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async s=>{const{data:{session:i},error:a}=s;if(a)return this._returnResult({data:null,error:a});if(!i)return this._returnResult({data:null,error:new Rr});const u=await Se(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&Rt()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(u.data.redirect_url),u})}catch(s){if(ve(s))return this._returnResult({data:null,error:s});throw s}}async _denyAuthorization(e,r){try{return await this._useSession(async s=>{const{data:{session:i},error:a}=s;if(a)return this._returnResult({data:null,error:a});if(!i)return this._returnResult({data:null,error:new Rr});const u=await Se(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return u.data&&u.data.redirect_url&&Rt()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(u.data.redirect_url),u})}catch(s){if(ve(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(e,r={keys:[]}){let s=r.keys.find(d=>d.kid===e);if(s)return s;const i=Date.now();if(s=this.jwks.keys.find(d=>d.kid===e),s&&this.jwks_cached_at+nj>i)return s;const{data:a,error:u}=await Se(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(u)throw u;return!a.keys||a.keys.length===0||(this.jwks=a,this.jwks_cached_at=i,s=a.keys.find(d=>d.kid===e),!s)?null:s}async getClaims(e,r={}){try{let s=e;if(!s){const{data:v,error:k}=await this.getSession();if(k||!v.session)return this._returnResult({data:null,error:k});s=v.session.access_token}const{header:i,payload:a,signature:u,raw:{header:d,payload:f}}=mf(s);r!=null&&r.allowExpired||kj(a.exp);const p=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!p){const{error:v}=await this.getUser(s);if(v)throw v;return{data:{claims:a,header:i,signature:u},error:null}}const g=Tj(i.alg),y=await crypto.subtle.importKey("jwk",p,g,!0,["verify"]);if(!await crypto.subtle.verify(g,y,u,fj(`${d}.${f}`)))throw new wh("Invalid JWT signature");return{data:{claims:a,header:i,signature:u},error:null}}catch(s){if(ve(s))return this._returnResult({data:null,error:s});throw s}}}Sa.nextInstanceID={};const sO=Sa;class oO extends sO{constructor(e){super(e)}}class iO{constructor(e,r,s){var i,a,u;this.supabaseUrl=e,this.supabaseKey=r;const d=XP(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",d),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",d),this.storageUrl=new URL("storage/v1",d),this.functionsUrl=new URL("functions/v1",d);const f=`sb-${d.hostname.split(".")[0]}-auth-token`,p={db:WP,realtime:qP,auth:Object.assign(Object.assign({},HP),{storageKey:f}),global:VP},g=YP(s??{},p);this.storageKey=(i=g.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(a=g.global.headers)!==null&&a!==void 0?a:{},g.accessToken?(this.accessToken=g.accessToken,this.auth=new Proxy({},{get:(y,_)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(_)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((u=g.auth)!==null&&u!==void 0?u:{},this.headers,g.global.fetch),this.fetch=QP(r,this._getAccessToken.bind(this),g.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},g.realtime)),this.rest=new ZC(new URL("rest/v1",d).href,{headers:this.headers,schema:g.db.schema,fetch:this.fetch}),this.storage=new UP(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),g.accessToken||this._listenForAuthEvents()}get functions(){return new QC(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,r={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,r,s)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,r;if(this.accessToken)return await this.accessToken();const{data:s}=await this.auth.getSession();return(r=(e=s.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:s,storage:i,userStorage:a,storageKey:u,flowType:d,lock:f,debug:p,throwOnError:g},y,_){const v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new oO({url:this.authUrl.href,headers:Object.assign(Object.assign({},v),y),storageKey:u,autoRefreshToken:e,persistSession:r,detectSessionInUrl:s,storage:i,userStorage:a,flowType:d,lock:f,debug:p,throwOnError:g,fetch:_,hasCustomAuthorizationHeader:Object.keys(this.headers).some(k=>k.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new gP(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,s)=>{this._handleTokenChanged(r,"CLIENT",s==null?void 0:s.access_token)})}_handleTokenChanged(e,r,s){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const aO=(t,e,r)=>new iO(t,e,r);function lO(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}lO()&&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");const uO="planpilot-auth",ai="kv",cO=1,ca=new Map;function dO(){ca.clear()}function a_(){return new Promise((t,e)=>{const r=indexedDB.open(uO,cO);r.onupgradeneeded=()=>{const s=r.result;s.objectStoreNames.contains(ai)||s.createObjectStore(ai)},r.onsuccess=()=>t(r.result),r.onerror=()=>e(r.error)})}async function fO(t,e){const r=await a_();return new Promise((s,i)=>{const d=r.transaction(ai,"readwrite").objectStore(ai).put(e,t);d.onsuccess=()=>s(),d.onerror=()=>i(d.error)})}async function hO(t){const e=await a_();return new Promise((r,s)=>{const u=e.transaction(ai,"readwrite").objectStore(ai).delete(t);u.onsuccess=()=>r(),u.onerror=()=>s(u.error)})}function yf(){try{const t="__ls_test__";return localStorage.setItem(t,"1"),localStorage.removeItem(t),!0}catch{return!1}}const pO={getItem(t){const e=ca.get(t);if(e)return e;if(yf())try{const r=localStorage.getItem(t);if(r)return ca.set(t,r),r}catch{}return null},setItem(t,e){if(ca.set(t,e),yf())try{localStorage.setItem(t,e)}catch(r){console.error("[AuthStorage] localStorage write failed:",r)}fO(t,e).catch(()=>{})},removeItem(t){if(ca.delete(t),yf())try{localStorage.removeItem(t)}catch{}hO(t).catch(()=>{})}};function mO(t){if(typeof t=="string")return t;if(t instanceof URL)return t.toString();if(typeof Request<"u"&&t instanceof Request)return t.url;const e=t;return typeof(e==null?void 0:e.url)=="string"?e.url:""}function Ny(t){const e=new Headers(t);return e.delete("content-length"),e.delete("content-encoding"),e}function gO(t=globalThis.fetch.bind(globalThis)){return async function(r,s){const i=await t(r,s);if(!mO(r).includes("/auth/v1/")||!i.ok||!(i.headers.get("content-type")??"").includes("application/json"))return i;const a=await i.text();try{const u=JSON.parse(a);if(u!==null&&typeof u=="object"&&Number.isFinite(u.expires_in)&&Number.isFinite(u.expires_at))return u.expires_at=Math.floor(Date.now()/1e3)+u.expires_in,new Response(JSON.stringify(u),{status:i.status,statusText:i.statusText,headers:Ny(i.headers)})}catch{}return new Response(a,{status:i.status,statusText:i.statusText,headers:Ny(i.headers)})}}const vO=gO(),yO="https://agcoliuqqeiycdzeiera.supabase.co",wO="sb_publishable_oKVumtpr-fBxh9Vp_U8mJw_qh6KXUN7",Le=aO(yO,wO,{auth:{storage:pO,persistSession:!0,autoRefreshToken:!0},global:{fetch:vO}}),bO="handtekening",_O="progress";function D2(t){const e=t.checklistTotaal===0||t.checklistAf>=t.checklistTotaal,r=t.fotos+t.fotosInWachtrij,s=[];t.checklistTotaal>0&&s.push({key:"checklist",label:"Checklist",hint:`${t.checklistAf} van ${t.checklistTotaal} afgevinkt`,klaar:e,verplicht:!0}),s.push({key:"fotos",label:"Foto's",hint:r===0?"Minstens één foto van het werk":`${r} toegevoegd`,klaar:r>0,verplicht:!0}),s.push({key:"handtekening",label:"Handtekening",hint:t.heeftHandtekening?"Getekend":"Mag ook zonder",klaar:t.heeftHandtekening,verplicht:!1});const i=s.filter(u=>u.verplicht),a=[];if(t.gegevensOnbekend)return a.push("Gegevens zijn nog niet geladen"),{stappen:s,gedaan:i.filter(u=>u.klaar).length,totaal:i.length,kanAfronden:!1,blokkades:a};if(!e){const u=t.checklistTotaal-t.checklistAf;a.push(u===1?"Er staat nog één checklistregel open":`Er staan nog ${u} checklistregels open`)}return r===0&&a.push("Voeg minstens één foto toe"),t.ontbrekendeVerplichteVelden.length>0&&a.push(`Kantoor moet nog invullen: ${t.ontbrekendeVerplichteVelden.join(", ")}`),{stappen:s,gedaan:i.filter(u=>u.klaar).length,totaal:i.length,kanAfronden:a.length===0,blokkades:a}}const l_=["ttf","otf","woff","woff2"],u_=["font/ttf","font/otf","font/woff","font/woff2","font/sfnt","application/x-font-ttf","application/x-font-truetype","application/x-font-otf","application/x-font-opentype","application/font-sfnt","application/vnd.ms-opentype","application/font-woff","application/font-woff2","application/x-font-woff","application/octet-stream",""];function c_(t){return l_.includes(t.toLowerCase())}const Ly=(...t)=>t,mu=t=>[...t].map(e=>e.charCodeAt(0)),xO={ttf:[Ly(0,1,0,0),mu("true")],otf:[mu("OTTO"),Ly(0,1,0,0)],woff:[mu("wOFF")],woff2:[mu("wOF2")]};function EO(t,e){const r=t.toLowerCase();return c_(r)?xO[r].some(s=>s.every((i,a)=>e[a]===i)):!1}function SO(t){const e=t.split(".").pop()??"";return e===t?"":e.toLowerCase()}async function $2(t){const e=SO(t.name);if(!c_(e))return null;if(!u_.includes(t.type))return`"${t.name}" is geen geldig lettertypebestand.`;try{const r=new Uint8Array(await t.slice(0,4).arrayBuffer());return EO(e,r)?null:`"${t.name}" is geen geldig lettertypebestand.`}catch{return`"${t.name}" kon niet worden gelezen.`}}const Qr=1024*1024,kO={avatar:{maxSizeBytes:5*Qr,allowedMimeTypes:["image/jpeg","image/png","image/webp"],allowedExtensions:["jpg","jpeg","png","webp"]},customerPhoto:{maxSizeBytes:8*Qr,allowedMimeTypes:["image/jpeg","image/png","image/webp"],allowedExtensions:["jpg","jpeg","png","webp"]},staffPhoto:{maxSizeBytes:8*Qr,allowedMimeTypes:["image/jpeg","image/png","image/webp"],allowedExtensions:["jpg","jpeg","png","webp"]},projectPhoto:{maxSizeBytes:10*Qr,allowedMimeTypes:["image/jpeg","image/png","image/webp"],allowedExtensions:["jpg","jpeg","png","webp"]},projectDocument:{maxSizeBytes:15*Qr,allowedMimeTypes:["application/pdf","image/jpeg","image/png","image/webp","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],allowedExtensions:["pdf","jpg","jpeg","png","webp","doc","docx"]},richTextImage:{maxSizeBytes:5*Qr,allowedMimeTypes:["image/jpeg","image/png","image/webp"],allowedExtensions:["jpg","jpeg","png","webp"]},galleryImage:{maxSizeBytes:5*Qr,allowedMimeTypes:["image/jpeg","image/png","image/webp","image/avif"],allowedExtensions:["jpg","jpeg","png","webp","avif"]},newsletterImage:{maxSizeBytes:2*Qr,allowedMimeTypes:["image/jpeg","image/png"],allowedExtensions:["jpg","jpeg","png"]},intakeUpload:{maxSizeBytes:10*Qr,allowedMimeTypes:["image/jpeg","image/png","image/webp","image/heic","image/heif","application/pdf","image/tiff","application/postscript","application/illustrator","application/eps","application/octet-stream","",...u_.filter(t=>t!=="application/octet-stream"&&t!=="")],allowedExtensions:["jpg","jpeg","png","webp","heic","pdf","tiff","tif","eps","ai",...l_]}},TO=t=>(t.split(".").pop()||"").toLowerCase();function RO(t,e){const r=kO[e],s=TO(t.name);return r.allowedMimeTypes.includes(t.type)?r.allowedExtensions.includes(s)?t.size>r.maxSizeBytes?{valid:!1,error:`Bestand is te groot (max ${Math.round(r.maxSizeBytes/Qr)}MB).`}:{valid:!0}:{valid:!1,error:"Bestandsextensie niet toegestaan."}:{valid:!1,error:"Bestandstype niet toegestaan."}}const CO=["jpg","jpeg","png","webp"],PO=3,jO=900*1e3,Dy=[5e3,15e3,6e4,5*6e4,jO],OO={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",webp:"image/webp"},$y={"image/jpeg":"jpg","image/jpg":"jpg","image/png":"png","image/webp":"webp"};function mp(t){return[...t].sort((e,r)=>e.createdAt!==r.createdAt?e.createdAt-r.createdAt:e.idr.id?1:0)}function sc(t,e){const r=(t??"").trim().toLowerCase().replace(/^\.+/,"");if(CO.includes(r))return r;const s=(e??"").trim().toLowerCase().split(";")[0];return $y[s]?$y[s]:"jpg"}function AO(t){return OO[sc(t)]}function IO(t){const e=sc(t.ext);return`${t.organizationId}/${t.projectId}/${t.id}.${e}`}function NO(t){const e=Number.isFinite(t)?Math.floor(t):1,r=Math.min(Math.max(e,1),Dy.length)-1;return Dy[r]}function bh(t,e=Date.now()){return t.nextAttemptAt?t.nextAttemptAt<=e:!0}function LO(t,e){return mp(t.filter(r=>r.projectId===e))}function DO(t,e=Date.now()){let r=0;for(const s of t)s.attemptsr.id!==e.id&&r.projectId===e.projectId&&$O(r.kind))}function FO(t,e=Date.now()){return mp(t).filter(r=>bh(r,e)&&!MO(t,r))}const UO="nexus-afronden-queue",zO=1,fs="items",BO=3e4,VO=5e3,WO="project-photos",HO="nexus-afronden-queue-flush",My={42501:"Je staat niet meer op deze opdracht. Vraag kantoor om dit op te pakken.",23503:"Deze opdracht bestaat niet meer. Vraag kantoor om dit op te pakken."},qO="23505";class _h extends Error{constructor(e){super(e),this.reden=e,this.name="PermanenteQueueFout"}}class gp extends Error{constructor(e){super(e),this.melding=e,this.name="TijdelijkeQueueFout"}}const xh=new Set;let ft=[],wf=!1,ka=!1,Js=Ho(),zu=null,Ta=new Set,Xn={items:ft,flushing:ka,online:Js,laatsteAfgekeurd:zu,afgekeurdeIds:Ta};function KO(){return typeof indexedDB<"u"}function GO(){return typeof window<"u"}function Ho(){return typeof navigator>"u"?!0:navigator.onLine!==!1}function Ks(){if(!(Xn.items===ft&&Xn.flushing===ka&&Xn.online===Js&&Xn.laatsteAfgekeurd===zu&&Xn.afgekeurdeIds===Ta)){Xn={items:ft,flushing:ka,online:Js,laatsteAfgekeurd:zu,afgekeurdeIds:Ta};for(const t of xh)try{t(Xn)}catch{}}}function li(t){ft=mp(t),Ks()}let gu=null;function vp(){return KO()?gu||(gu=new Promise(t=>{let e=!1;const r=setTimeout(()=>{console.warn("[AfrondenQueue] IndexedDB opent niet; wachtrij draait alleen in het geheugen"),s(null)},VO),s=i=>{e||(e=!0,clearTimeout(r),t(i))};try{const i=indexedDB.open(UO,zO);i.onupgradeneeded=()=>{const a=i.result;a.objectStoreNames.contains(fs)||a.createObjectStore(fs,{keyPath:"id"})},i.onsuccess=()=>s(i.result),i.onerror=()=>s(null),i.onblocked=()=>s(null)}catch{s(null)}}),gu):Promise.resolve(null)}async function QO(){const t=await vp();return t?new Promise(e=>{const r=s=>{console.warn("[AfrondenQueue] bewaarde wachtrij niet gelezen",{melding:bp(s)}),e([])};try{const s=t.transaction(fs,"readonly"),i=s.objectStore(fs).getAll();i.onsuccess=()=>e(i.result??[]),i.onerror=()=>r(i.error),s.onabort=()=>r(s.error),s.onerror=()=>r(s.error)}catch(s){r(s)}}):[]}async function yp(t){const e=await vp();if(e)return new Promise((r,s)=>{try{const i=e.transaction(fs,"readwrite"),a=i.objectStore(fs).put(t);a.onerror=()=>s(a.error??new Error("idb-put")),i.onabort=()=>s(i.error??new Error("idb-put-abort")),i.onerror=()=>s(i.error??new Error("idb-put-error")),i.oncomplete=()=>r()}catch(i){s(i)}})}async function d_(t){const e=await vp();if(e)return new Promise((r,s)=>{try{const i=e.transaction(fs,"readwrite"),a=i.objectStore(fs).delete(t);a.onerror=()=>s(a.error??new Error("idb-delete")),i.onabort=()=>s(i.error??new Error("idb-delete-abort")),i.onerror=()=>s(i.error??new Error("idb-delete-error")),i.oncomplete=()=>r()}catch(i){s(i)}})}async function oc(t,e){try{await t()}catch(r){console.warn("[AfrondenQueue] lokale opslag bijwerken lukte niet",{waar:e,melding:bp(r)})}}let bf=null;function wp(){return bf||(bf=QO().then(t=>{const e=new Map;for(const r of t)e.set(r.id,r);for(const r of ft)e.set(r.id,r);li([...e.values()])}).catch(()=>{})),bf}function bp(t){if(t instanceof gp)return t.melding;if(!Ho())return"Geen verbinding.";const e=t==null?void 0:t.code;if(typeof e=="string"&&/^[A-Za-z0-9_]{1,20}$/.test(e))return`Versturen lukte niet (code ${e}).`;const r=t==null?void 0:t.statusCode;return typeof r=="number"&&Number.isInteger(r)&&r>=100&&r<=599?`Versturen lukte niet (status ${r}).`:typeof r=="string"&&/^[0-9]{3}$/.test(r)?`Versturen lukte niet (status ${r}).`:"Versturen lukte niet."}const JO=/failed to fetch|networkerror|network error|network request failed|fetcherror|load failed|connection|timeout|timed out/i;function YO(t){if(t instanceof gp)return"server";if(!Ho())return"verbinding";const e=t==null?void 0:t.name;if(e==="AbortError"||e==="TimeoutError"||e==="NetworkError")return"verbinding";const r=t==null?void 0:t.code;if(typeof r=="string"&&/^[A-Za-z0-9_]{1,20}$/.test(r))return"server";const s=t==null?void 0:t.statusCode;if(typeof s=="number"||typeof s=="string")return"server";if(t instanceof TypeError)return"verbinding";const i=t==null?void 0:t.message;return typeof i=="string"&&JO.test(i)?"verbinding":"server"}function XO(t){if(t instanceof _h)return t.reden;const e=t==null?void 0:t.code;return typeof e=="string"&&My[e]?My[e]:null}async function ZO(t){const e=t.blob;if(!e)throw new _h("Het bestand bij deze actie is niet meer beschikbaar.");const r=sc(t.ext,e.type),s=IO({...t,ext:r}),i=`${t.id}.${r}`,a=e.type==="image/jpg"?"image/jpeg":e.type,u=new File([e],i,{type:a||AO(r)}),d=RO(u,"projectPhoto");if(d.valid===!1)throw new _h(d.error);const{error:f}=await Le.storage.from(WO).upload(s,u,{upsert:!0});if(f)throw f;const{data:p,error:g}=await Le.from("project_photos").select("id").eq("organization_id",t.organizationId).eq("project_id",t.projectId).eq("storage_path",s).limit(1);if(g)throw g;if(p&&p.length>0)return;const{error:y}=await Le.from("project_photos").insert({project_id:t.projectId,staff_id:t.staffId,photo_url:"",storage_path:s,photo_type:t.photoType??(t.kind==="handtekening"?bO:_O),description:t.description??null,organization_id:t.organizationId,uploaded_at:new Date(t.createdAt).toISOString()});if(y){if(y.code===qO)return;throw y}}async function eA(t){const{data:e,error:r}=await Le.from("projects").update({status:"completed",updated_at:new Date().toISOString()}).eq("id",t.projectId).eq("organization_id",t.organizationId).select("id");if(r)throw r;if(!e||e.length===0)throw new gp("De opdracht kon niet op afgerond gezet worden. Vraag kantoor om dit op te pakken.")}async function Fy(t){await oc(()=>d_(t),"verwijderen"),li(ft.filter(e=>e.id!==t))}async function tA(t,e,r){const s=t.attempts+1,i={...t,attempts:s,lastError:e,lastErrorSoort:r,nextAttemptAt:Date.now()+NO(s)};await oc(()=>yp(i),"pogingen bijwerken"),li(ft.map(a=>a.id===t.id?i:a))}async function rA(t){try{return t.kind==="afronden"?await eA(t):await ZO(t),await Fy(t.id),!0}catch(e){const r=XO(e);if(r)return zu={id:t.id,kind:t.kind,projectId:t.projectId,reden:r,at:Date.now()},Ta=new Set(Ta).add(t.id),await Fy(t.id),Ks(),!0;const s=bp(e),i=YO(e);return console.warn("[AfrondenQueue] item nog niet verstuurd",{kind:t.kind,melding:s,soort:i}),await tA(t,s,i),!1}}let Uy=0;function nA(){const t=Math.max(Date.now(),Uy+1);return Uy=t,t}function sA(){const t=typeof crypto<"u"?crypto:void 0;return t&&typeof t.randomUUID=="function"?t.randomUUID():`q-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}async function oA(t){try{return new Blob([await t.arrayBuffer()],{type:t.type})}catch{throw new Error("Het bestand kon niet gelezen worden.")}}async function M2(t){await wp();const e=t.blob?await oA(t.blob):void 0;if(t.kind==="handtekening"){const s=ft.filter(i=>i.kind==="handtekening"&&i.projectId===t.projectId);for(const i of s)await oc(()=>d_(i.id),"oude handtekening opruimen");if(s.length>0){const i=new Set(s.map(a=>a.id));li(ft.filter(a=>!i.has(a.id)))}}const r={id:sA(),kind:t.kind,projectId:t.projectId,organizationId:t.organizationId,staffId:t.staffId,blob:e,ext:e?sc(t.ext,e.type):t.ext,photoType:t.photoType??null,description:t.description??null,createdAt:nA(),attempts:0,lastError:null};return await yp(r),li([...ft,r]),ui(),r.id}function iA(){if(typeof navigator>"u")return;const t=navigator.locks;if(!(!t||typeof t.request!="function"))return t}async function f_(t){if(!wf){wf=!0;try{const e=iA();if(!e){await t();return}await e.request(HO,{ifAvailable:!0},async r=>{r&&await t()})}finally{wf=!1}}}async function ui(){await f_(async()=>{try{if(await wp(),Js=Ho(),Ks(),!Js||ft.length===0)return;ka=!0,Ks();let t=ft.length+2;for(;t>0&&(t-=1,!!Ho());){const e=FO(ft,Date.now());if(e.length===0)break;let r=!1;for(const s of e){if(!ft.some(a=>a.id===s.id))continue;if(await rA(s)&&(r=!0),!Ho())break}if(!r)break}}finally{ka=!1,Ks()}})}function aA(t){return xh.add(t),()=>{xh.delete(t)}}function zy(){return Xn}let vu=0,_f=[];function By(){Js=!0,Ks(),ui()}function Vy(){Js=!1,Ks()}function Wy(){typeof document>"u"||document.visibilityState==="visible"&&ui()}function lA(){if(!GO())return()=>{};if(vu+=1,vu===1){window.addEventListener("online",By),window.addEventListener("offline",Vy),typeof document<"u"&&document.addEventListener("visibilitychange",Wy);const e=window.setInterval(()=>{ft.length>0&&ui()},BO);_f=[()=>window.removeEventListener("online",By),()=>window.removeEventListener("offline",Vy),()=>{typeof document<"u"&&document.removeEventListener("visibilitychange",Wy)},()=>window.clearInterval(e)],ui()}let t=!1;return()=>{if(!t&&(t=!0,vu-=1,vu===0)){for(const e of _f)e();_f=[]}}}async function uA(){await wp(),await f_(async()=>{const t=ft.filter(e=>!bh(e,Date.now())).map(e=>e.id);for(const e of t){const r=ft.find(i=>i.id===e);if(!r||bh(r,Date.now()))continue;const s={...r,nextAttemptAt:void 0};await oc(()=>yp(s),"wachttijd wissen"),ft.some(i=>i.id===e)&&li(ft.map(i=>i.id===e?s:i))}}),await ui()}function cA(t){const e=b.useSyncExternalStore(aA,zy,zy),r=b.useMemo(()=>t?LO(e.items,t):e.items,[e.items,t]),s=b.useMemo(()=>DO(r,Date.now()),[r]);return{items:r,total:s.total,wachtend:s.wachtend,mislukt:s.mislukt,flushing:e.flushing,online:e.online,retry:uA,laatsteAfgekeurd:e.laatsteAfgekeurd??null,afgekeurdeIds:e.afgekeurdeIds}}const h_=new Set(["planner-range-board","planner-day-board","planned-tasks"]),dA=new Set(["tenant_owner","tenant_staff"]),fA=1440*60*1e3,hA=2e3,_p="nexus-planner-cache",Eh="snapshots",Hy="laatste-stand";function qy(t){if(t.state.status!=="success")return!1;const e=Array.isArray(t.queryKey)?t.queryKey[0]:void 0;return typeof e=="string"&&h_.has(e)}function pA(t){if(!Array.isArray(t))return!1;const e=t[0];return typeof e=="string"&&h_.has(e)}function mA(t){return Array.isArray(t)&&t.some(e=>typeof e=="string"&&dA.has(e))}function gA(){return new Promise((t,e)=>{const r=indexedDB.open(_p,1);r.onupgradeneeded=()=>{r.result.createObjectStore(Eh)},r.onsuccess=()=>t(r.result),r.onerror=()=>e(r.error)})}async function xf(t,e){const r=await gA();try{return await new Promise((s,i)=>{const a=r.transaction(Eh,t),u=e(a.objectStore(Eh));a.oncomplete=()=>s(u.result),a.onerror=()=>i(a.error),a.onabort=()=>i(a.error)})}finally{r.close()}}const vA={async read(){if(typeof indexedDB>"u")return null;const t=await xf("readonly",r=>r.get(Hy));if(!t||typeof t!="object")return null;const e=t;return typeof e.userId!="string"||typeof e.storedAt!="number"||!e.state||!Array.isArray(e.state.queries)?null:e},async write(t){typeof indexedDB>"u"||await xf("readwrite",e=>e.put(t,Hy))},async clear(){typeof indexedDB>"u"||await xf("readwrite",t=>t.clear())}};function yA(t,e=vA){let r=null,s=!1,i=null,a=!1,u=Promise.resolve();const d=v=>(u=u.then(v,v),u);async function f(v){s||(s=!0,await d(async()=>{try{const k=await e.read();if(!k)return;if(k.userId!==v){await e.clear();return}const S=Math.max(0,...k.state.queries.map(T=>T.state.dataUpdatedAt??0)),x=Date.now()-S;if(x<0||x>fA){await e.clear();return}OC(t,{mutations:[],queries:k.state.queries.filter(T=>pA(T.queryKey))})}catch{}}))}async function p(){const v=r;if(!v)return;const k=t.getQueryData(["user-roles",v]);if(!mA(k))return;const S=jC(t,{shouldDehydrateQuery:x=>{if(!qy(x))return!1;const[T,R]=x.queryKey;return T==="planner-range-board"||T==="planner-day-board"?R===v:!0},shouldDehydrateMutation:()=>!1});S.queries.length!==0&&await d(async()=>{if(r===v)try{await e.write({userId:v,storedAt:Date.now(),state:S})}catch{}})}function g(){i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,p()},hA)}const y=t.getQueryCache().subscribe(v=>{a||!v.query||!qy(v.query)||g()}),{data:_}=Le.auth.onAuthStateChange((v,k)=>{var x;if(a)return;if(v==="SIGNED_OUT"){r=null,i!==null&&(clearTimeout(i),i=null),d(()=>e.clear().catch(()=>{}));return}const S=((x=k==null?void 0:k.user)==null?void 0:x.id)??null;S&&(r&&r!==S&&d(()=>e.clear().catch(()=>{})),r=S,f(S))});return()=>{a=!0,i!==null&&clearTimeout(i),y(),_.subscription.unsubscribe()}}async function p_(){if("caches"in window)try{const t=await caches.keys();await Promise.all(t.map(e=>caches.delete(e)))}catch{}try{const t=[];for(let e=0;elocalStorage.removeItem(e))}catch{}if("indexedDB"in window)for(const t of["planpilot-auth",_p])try{const e=indexedDB.deleteDatabase(t);await new Promise(r=>{e.onsuccess=()=>r(),e.onerror=()=>r(),e.onblocked=()=>r()})}catch{}if("serviceWorker"in navigator)try{const t=await navigator.serviceWorker.getRegistrations();await Promise.all(t.map(e=>e.unregister()))}catch{}window.location.href=window.location.origin+"?reset="+Date.now()}async function xp({mayWipe:t=!0}={}){var s;if(!("serviceWorker"in navigator))return;let e;try{e=await navigator.serviceWorker.getRegistrations()}catch{return}const r=(s=e.find(i=>i.waiting))==null?void 0:s.waiting;if(r){await new Promise(i=>{navigator.serviceWorker.addEventListener("controllerchange",()=>i(),{once:!0}),r.addEventListener("statechange",()=>{(r.state==="activated"||r.state==="redundant")&&i()}),setTimeout(i,5e3),r.postMessage({type:"SKIP_WAITING"})});return}if(t&&navigator.onLine!==!1){if("caches"in window)try{const i=await caches.keys();await Promise.all(i.map(a=>caches.delete(a)))}catch{}try{await Promise.all(e.map(i=>i.unregister()))}catch{}}}async function wA(){if("serviceWorker"in navigator&&navigator.onLine!==!1)try{const t=await navigator.serviceWorker.getRegistrations();if(t.length===0)return;if("caches"in window)try{const e=await caches.keys();await Promise.all(e.map(r=>caches.delete(r)))}catch{}await Promise.all(t.map(e=>e.unregister()))}catch{}}async function bA(){try{dO()}catch{}try{const t=[];for(let e=0;elocalStorage.removeItem(e))}catch{}if("indexedDB"in window)for(const t of["planpilot-auth",_p])try{await new Promise(e=>{const r=indexedDB.deleteDatabase(t);r.onsuccess=()=>e(),r.onerror=()=>e(),r.onblocked=()=>e()})}catch{}}const Ky=500,Gy=2e3,_A=/\?[^\s"'<>]*=[^\s"'<>]*/g,xA=/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,EA=/\b(bearer)(\s+)([^\s&"'<>]+)/gi,SA=/\b([\w-]*(?:apikey|api_key|api-key|key|token|secret|password|authorization))(["']?\s*[=:]\s*["']?)(?!bearer\b)([^\s&"'<>]+)/gi,kA=/\b[A-Z]{2}\d{2}(?:\s?[A-Z0-9]{4}){2,7}(?:\s?[A-Z0-9]{1,4})?\b/g,TA=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,RA=/(?:\+31|0031|\b0)[\s-]?\(?0?\)?[\s-]?6[\s-]?\d{2}[\s-]?\d{2}[\s-]?\d{2}[\s-]?\d{2}\b/g,CA=/\b0[1-9]\d(?:[\s-]?\d{7}|\d[\s-]?\d{6})\b/g,PA=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;function jA(t){let e=typeof t=="string"?t:t==null?"":String(t);return e.length>Gy&&(e=e.slice(0,Gy)),e=e.replace(_A,"?[weggelaten]"),e=e.replace(xA,"[jwt]"),e=e.replace(EA,(r,s,i)=>`${s}${i}[geheim]`),e=e.replace(SA,(r,s,i)=>`${s}${i}[geheim]`),e=e.replace(TA,"[e-mail]"),e=e.replace(kA,r=>(r.match(/\d/g)??[]).length>=8?"[iban]":r),e=e.replace(RA,"[telefoon]"),e=e.replace(CA,"[telefoon]"),e=e.replace(PA,"[id]"),e=e.replace(/\s+/g," ").trim(),e.length>Ky&&(e=e.slice(0,Ky-1)+"…"),e||"Geen melding"}function OA(t){return t?t.split("?")[0].split("/").map(e=>/^[0-9a-f]{32,}$/i.test(e)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)?"[id]":e).join("/").slice(0,200):null}let m_=!1;function AA(){m_=!0}function IA(){return m_}async function ci(t,e,r){if(!IA())try{await Le.rpc("report_app_error",{p_context:t,p_message:e,p_detail:r??null,p_route:typeof window<"u"?OA(window.location.pathname):null,p_app_host:typeof window<"u"?window.location.host:null,p_user_agent:typeof navigator<"u"?navigator.userAgent:null})}catch{}}const NA=10,LA=3600*1e3,Ef=new Map;function DA(t,e=Date.now()){const r=e-LA,s=(Ef.get(t)??[]).filter(i=>i>r);return s.length>=NA?(Ef.set(t,s),!1):(s.push(e),Ef.set(t,s),!0)}async function Qy(t,e){DA(t)&&await ci(t,jA(e),null)}function Ra(t){if(!t)return"Onbekende fout";if(typeof t=="string")return t;if(typeof t=="object"){const e=t,r=[];if(typeof e.name=="string"&&e.name&&e.name!=="Error"&&r.push(e.name),typeof e.code=="string"&&e.code&&r.push(e.code),typeof e.status=="number"&&r.push(`status ${e.status}`),typeof e.message=="string"&&e.message&&r.push(e.message),r.length>0)return r.join(" · ")}return"Onbekende fout"}async function $A(){let t=null;try{const{error:e}=await Le.auth.signOut();if(!e)return{ok:!0};t=Ra(e)}catch(e){t=Ra(e)}try{await bA()}catch{}return ci("uitloggen","Uitloggen bij de server mislukt, sessie lokaal geforceerd gewist",t),{ok:!1,reason:t??"Onbekende fout"}}function F2(){window.location.assign("/auth")}const g_=b.createContext(void 0);function MA({children:t}){const[e,r]=b.useState(null),[s,i]=b.useState(null),[a,u]=b.useState(!0),[d,f]=b.useState(!1),p=hb(),g=b.useRef(!1),y=b.useRef(!0),_=b.useRef(!0),v=b.useRef(null),k=b.useCallback((R,C)=>{y.current&&(i(R),r((R==null?void 0:R.user)??null),u(!1),_.current=!1,f(!0),v.current&&(clearTimeout(v.current),v.current=null),R&&C.includes("SIGNED_IN")&&(p.invalidateQueries({queryKey:["staff-projects"]}),p.invalidateQueries({queryKey:["current-staff-id"]})))},[p]),S=b.useCallback(async()=>{if(y.current)try{const{data:{session:R},error:C}=await Le.auth.getSession();if(C)return;k(R,"refreshSession")}catch(R){console.error("Failed to refresh session:",R)}},[k]),x=b.useCallback(async()=>await $A(),[]);b.useEffect(()=>{y.current=!0,_.current=!0;const{data:{subscription:R}}=Le.auth.onAuthStateChange((C,j)=>{setTimeout(()=>{y.current&&(k(j,`onAuthStateChange:${C}`),C==="SIGNED_OUT"&&p.clear())},0)});return g.current||(g.current=!0,Le.auth.getSession().then(({data:{session:C},error:j})=>{if(y.current){if(j){u(!1),_.current=!1,f(!0);return}_.current&&k(C,"getSession")}})),v.current=setTimeout(()=>{y.current&&_.current&&(u(!1),_.current=!1,f(!0))},5e3),()=>{y.current=!1,R.unsubscribe(),v.current&&clearTimeout(v.current)}},[]);const T={user:e,session:s,loading:a,initialized:d,signOut:x,refreshSession:S};return w.jsx(g_.Provider,{value:T,children:t})}function kn(){const t=b.useContext(g_);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function FA(){const{user:t}=kn();return b.useEffect(()=>{if(t)return lA()},[t]),BA(),null}const v_="nexus-afronden-gemelde-afkeuring";function UA(){try{return window.sessionStorage.getItem(v_)}catch{return null}}function zA(t){try{window.sessionStorage.setItem(v_,t)}catch{}}function BA(){const{laatsteAfgekeurd:t}=cA(),e=b.useRef(null);b.useEffect(()=>{if(t&&e.current!==t.id){if(UA()===t.id){e.current=t.id;return}e.current=t.id,zA(t.id),Je.error(VA(t.kind,t.reden))}},[t])}function VA(t,e){return t==="handtekening"?`De handtekening is niet opgeslagen: ${e}`:t==="photo"?`De foto is niet opgeslagen: ${e}`:`Dit is niet opgeslagen: ${e}`}const Jy=40,ga=12,Ep=1e4,WA=3e4,yu=/^[a-z][a-z0-9_]{0,39}$/,HA=/^[a-z][a-z0-9-]{0,39}$/,Yy=/^[a-z]{1,20}$/,qA=new Set(["sheet-sluiten","sheet-overlay","dialog-sluiten","dialog-overlay","kaart-printpakket","printpakket-afdrukken","kaart-volledige-details","notitie-toevoegen","backlog-kaart","kaart-tab-details","kaart-tab-aanvraag","kaart-tab-checklist","kaart-tab-materials","kaart-tab-offerteregels","kaart-tab-documents","kaart-tab-notes","kaart-tab-afronden"]),y_=64,KA=10*6e4,GA="[data-freeze-label], button, a, input, textarea, select, [role]";function QA(t){let e;try{e=new URL(t,"http://l").pathname}catch{return null}const r=e.match(/^\/rest\/v1\/rpc\/([^/]+)/);if(r)return yu.test(r[1])?`rpc:${r[1]}`:null;const s=e.match(/^\/rest\/v1\/([^/]+)/);if(s)return yu.test(s[1])?s[1]:null;const i=e.match(/^\/functions\/v1\/([^/]+)/);if(i)return yu.test(i[1].replace(/-/g,"_"))?`fn:${i[1]}`:null;const a=e.match(/^\/auth\/v1\/([^/]+)/);return a&&yu.test(a[1])?`auth:${a[1]}`:null}function JA(t,e){const r=e-Ep,s=new Map;for(const i of t){if(i.op<=r||i.op>e)continue;const a=QA(i.url);a&&s.set(a,i.op)}return[...s.entries()].sort((i,a)=>i[1]-a[1]).slice(-8).map(([i])=>i)}function Sh(){return{aantallen:new Array(ga).fill(0),mislukt:new Array(ga).fill(0),secondes:new Array(ga).fill(-1)}}function YA(t,e,r){if(!Number.isFinite(e)||e<0)return;const s=Math.floor(e/1e3),i=s%ga;t.secondes[i]!==s&&(t.secondes[i]=s,t.aantallen[i]=0,t.mislukt[i]=0),t.aantallen[i]+=1,r&&(t.mislukt[i]+=1)}function XA(t,e){const r=Math.floor((e-Ep)/1e3),s=Math.floor(e/1e3);let i=0,a=0;for(let u=0;u=r&&d<=s&&(i+=t.aantallen[u],a+=t.mislukt[u])}return{totaal:i,mislukt:a}}function ZA(t,e){if(t===null)return null;const r=e-t;return r<0||r>WA?null:r}function eI(t){let e;try{e=new URLSearchParams(t)}catch{return null}const r=e.get("section")??e.get("tab");return r&&HA.test(r)?r:null}function tI(t){var s,i;if(t.label!==null&&qA.has(t.label))return t.label;const e=((s=t.tag)==null?void 0:s.toLowerCase())??null;if(!e||!Yy.test(e))return null;const r=((i=t.rol)==null?void 0:i.toLowerCase())??null;return r&&Yy.test(r)&&r!==e?`${e}/${r}`:e}function rI(t){const e=t.closest(GA)??t;return tI({label:e.getAttribute("data-freeze-label"),tag:e.tagName,rol:e.getAttribute("role")})}function kh(){return{plaatsen:new Array(y_).fill(null),volgende:0}}function nI(t,e){t.plaatsen[t.volgende]=e,t.volgende=(t.volgende+1)%y_}function sI(t,e){let r=null;for(const s of t.plaatsen)s!==null&&s.op<=e&&(r===null||s.op>r.op)&&(r=s);return r}function oI(t,e){if(!e||!Number.isFinite(t.start)||!Number.isFinite(t.duur)||t.duur<0)return!1;const r=t.start+t.duur,s=e.einde??e.start+KA;return t.start<=s&&r>=e.start}function iI(t){const e=t/6e4;return e<1?`${Math.round(t/1e3)} s`:e<60?`${Math.round(e)} min`:`${(e/60).toFixed(1).replace(".",",")} uur`}function Xy(t){return(t/1e3).toFixed(1).replace(".",",")}function aI(t){const e=[],r=[];if(t.sectie&&r.push(`scherm ${t.sectie}`),r.push(`app ${iI(t.paginaOpenMs)} open`),r.push(t.sindsInteractieMs===null?"geen handeling vlak ervoor":t.handeling?`${Xy(t.sindsInteractieMs)} s na een handeling op ${t.handeling}`:`${Xy(t.sindsInteractieMs)} s na een handeling`),e.push(r.join(" | ")),t.verkeer.totaal>0){const i=Ep/1e3;let a=`${t.verkeer.totaal} verzoeken in de ${i} s ervoor`;t.verkeer.mislukt>0&&(a+=`, waarvan ${t.verkeer.mislukt} mislukt`),e.push(t.labels.length>0?`${a}: ${t.labels.join(", ")}`:a)}const s=[];return t.elementen!==null&&s.push(`${t.elementen} elementen`),t.geheugenMb!==null&&s.push(t.geheugenLimietMb!==null?`geheugen ${t.geheugenMb} van ${t.geheugenLimietMb} MB`:`geheugen ${t.geheugenMb} MB`),s.length>0&&e.push(s.join(" | ")),e.join(` `)}let Is=[],Su=Sh(),ku=kh(),Zn=null,Oo=null;function Sf(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():0}function lI(t){if(typeof Element>"u"||!(t instanceof Element))return null;try{return rI(t)}catch{return null}}function uI(){if(typeof document>"u")return()=>{};Oo==null||Oo(),Is=[],Su=Sh(),ku=kh(),Zn=null;const t=u=>{nI(ku,{op:Sf(),doel:lI(u.target)})},e={capture:!0,passive:!0};document.addEventListener("pointerdown",t,e),document.addEventListener("keydown",t,e);const r=()=>{Zn={start:Sf(),einde:null}},s=()=>{Zn&&Zn.einde===null&&(Zn={start:Zn.start,einde:Sf()})};window.addEventListener("beforeprint",r),window.addEventListener("afterprint",s);let i=null;if(typeof PerformanceObserver<"u")try{i=new PerformanceObserver(u=>{for(const d of u.getEntries()){const f=d.startTime+d.duration,p=d.responseStatus;YA(Su,f,typeof p=="number"&&p>=400),Is.push({op:f,url:d.name})}Is.length>Jy&&(Is=Is.slice(-Jy))}),i.observe({type:"resource",buffered:!1})}catch{i=null}const a=()=>{Oo===a&&(Oo=null,i==null||i.disconnect(),document.removeEventListener("pointerdown",t,e),document.removeEventListener("keydown",t,e),window.removeEventListener("beforeprint",r),window.removeEventListener("afterprint",s),Is=[],Su=Sh(),ku=kh(),Zn=null)};return Oo=a,a}function cI(){return Zn}function dI(){if(typeof performance>"u")return{gebruikt:null,limiet:null};const t=performance.memory;if(!t)return{gebruikt:null,limiet:null};const e=r=>typeof r=="number"&&Number.isFinite(r)?Math.round(r/1048576):null;return{gebruikt:e(t.usedJSHeapSize),limiet:e(t.jsHeapSizeLimit)}}function fI(){if(typeof document>"u")return null;try{return document.getElementsByTagName("*").length}catch{return null}}function hI(t){const e=dI(),r=sI(ku,t),s=ZA((r==null?void 0:r.op)??null,t);return{paginaOpenMs:t,sindsInteractieMs:s,handeling:s===null?null:(r==null?void 0:r.doel)??null,labels:JA(Is,t),verkeer:XA(Su,t),elementen:fI(),geheugenMb:e.gebruikt,geheugenLimietMb:e.limiet,sectie:typeof window<"u"&&typeof window.location<"u"?eI(window.location.search):null}}const w_=3e3,pI=5e3,Sp=1e4,mI=12e4,gI=1e4,vI=2e3,yI=300*1e3,wI=5,bI=3600*1e3;function b_(t){return{gestartOp:t,venster:[],meldingen:[]}}function _I(t,e,r,s){return r!==e?b_(s):t}function xI(t){return!Number.isFinite(t.start)||!Number.isFinite(t.duur)||t.duur<=0?!1:t.duur<=mI}function EI(t,e){return e.starts.start+s.duur>r)}function TI(t,e){const r=e-Sp;let s=0,i=0;for(const a of t){const u=Math.max(a.start,r),d=Math.min(a.start+a.duur,e);d>u&&(s+=d-u),a.duur>i&&(i=a.duur)}return{aantalTaken:t.length,geblokkeerdMs:s,langsteTaakMs:i}}function RI(t){return t.langsteTaakMs>=w_||t.geblokkeerdMs>=pI}function __(t,e){const r=e-bI;return t.filter(s=>s>r)}function CI(t,e){const r=__(t.meldingen,e);if(r.length>=wI)return!1;const s=r.length>0?r[r.length-1]:null;return s===null?!0:e-s>=yI}function PI(t,e,r){if(!xI(e))return{stand:t,melding:null};if(EI(t,e))return{stand:t,melding:null};if(!SI(e,r))return{stand:t,melding:null};const s=e.start+e.duur,i=[...kI(t.venster,s),e],a=TI(i,s),u={...t,venster:i};return RI(a)?CI(t,s)?{stand:{...t,venster:[],meldingen:[...__(t.meldingen,s),s]},melding:a}:{stand:u,melding:null}:{stand:u,melding:null}}function jI(t){return Math.max(t.langsteTaakMs,t.geblokkeerdMs)}function wn(t){return(t/1e3).toFixed(1).replace(".",",")}function OI(t){const e=Sp/1e3;return{message:`De pagina stond ${wn(jI(t))} seconden stil`,detail:t.aantalTaken===1?`1 lange taak van ${wn(t.langsteTaakMs)} s`:`${t.aantalTaken} lange taken binnen een venster van ${e} s, samen ${wn(t.geblokkeerdMs)} s geblokkeerd, langste ${wn(t.langsteTaakMs)} s`}}function AI(t,e,r){if(!e||!oI(t,e))return{melden:!1,vensterMs:null};const s=e.einde===null?null:e.einde-e.start;return!Number.isFinite(t.duur)||t.duur"u")return!1;const t=PerformanceObserver.supportedEntryTypes;return Array.isArray(t)&&t.includes("longtask")}function LI(t){if(typeof document>"u"||!NI())return()=>{};Ao==null||Ao(),t!==kf&&(Tf=null),wu=_I(wu,kf,t,Zy()),kf=t,Rf={zichtbaar:document.visibilityState==="visible",laatsteWisselOp:null};const e=()=>{Rf={zichtbaar:document.visibilityState==="visible",laatsteWisselOp:Zy()}};document.addEventListener("visibilitychange",e);const r=uI(),s=new PerformanceObserver(a=>{for(const u of a.getEntries()){const d={start:u.startTime,duur:u.duration},f=cI(),p=AI(d,f,Tf);if(p.melden&&f){Tf=f.start;const{message:k,detail:S}=II(p.vensterMs,d.duur),x=ew(d.start);ci("afdrukvenster-open",k,x?`${S} ${x}`:S).catch(()=>{});continue}const g=PI(wu,d,Rf);if(wu=g.stand,!g.melding)continue;const{message:y,detail:_}=OI(g.melding),v=ew(d.start);ci("scherm-bevroren",y,v?`${_} ${v}`:_).catch(()=>{})}}),i=()=>{Ao===i&&(Ao=null,s.disconnect(),r(),document.removeEventListener("visibilitychange",e))};try{s.observe({type:"longtask",buffered:!1})}catch{return r(),document.removeEventListener("visibilitychange",e),()=>{}}return Ao=i,i}function DI(){const{user:t}=kn(),e=(t==null?void 0:t.id)??null;return b.useEffect(()=>{if(e)return LI(e)},[e]),null}function $I(){const{user:t}=kn(),e=(t==null?void 0:t.id)??null;return b.useEffect(()=>{if(!e||typeof window>"u")return;const r=i=>{i.message==="Script error."&&!i.filename||typeof i.message=="string"&&i.message.startsWith("ResizeObserver loop")||Qy("onverwachte-fout",Ra(i.error??i.message))},s=i=>{Qy("afgewezen-belofte",Ra(i.reason))};return window.addEventListener("error",r),window.addEventListener("unhandledrejection",s),()=>{window.removeEventListener("error",r),window.removeEventListener("unhandledrejection",s)}},[e]),null}/** * react-router v7.18.4 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */var kp=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,x_=/^[\\/]{2}/;function MI(t,e){return e+t.replace(/\\/g,"/")}var tw="popstate";function rw(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function FI(t={}){function e(s,i){var p;let a=(p=i.state)==null?void 0:p.masked,{pathname:u,search:d,hash:f}=a||s.location;return Th("",{pathname:u,search:d,hash:f},i.state&&i.state.usr||null,i.state&&i.state.key||"default",a?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,i){return typeof i=="string"?i:Ys(i)}return zI(e,r,null,t)}function Ye(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function pr(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function UI(){return Math.random().toString(36).substring(2,10)}function nw(t,e){return{usr:t.state,key:t.key,idx:e,masked:t.mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Th(t,e,r=null,s,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?yi(e):e,state:r,key:e&&e.key||s||UI(),mask:i}}function Ys({pathname:t="/",search:e="",hash:r=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function yi(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substring(r),t=t.substring(0,r));let s=t.indexOf("?");s>=0&&(e.search=t.substring(s),t=t.substring(0,s)),t&&(e.pathname=t)}return e}function zI(t,e,r,s={}){let{window:i=document.defaultView,v5Compat:a=!1}=s,u=i.history,d="POP",f=null,p=g();p==null&&(p=0,u.replaceState({...u.state,idx:p},""));function g(){return(u.state||{idx:null}).idx}function y(){d="POP";let x=g(),T=x==null?null:x-p;p=x,f&&f({action:d,location:S.location,delta:T})}function _(x,T){d="PUSH";let R=rw(x)?x:Th(S.location,x,T);p=g()+1;let C=nw(R,p),j=S.createHref(R.mask||R);try{u.pushState(C,"",j)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(j)}a&&f&&f({action:d,location:S.location,delta:1})}function v(x,T){d="REPLACE";let R=rw(x)?x:Th(S.location,x,T);p=g();let C=nw(R,p),j=S.createHref(R.mask||R);u.replaceState(C,"",j),a&&f&&f({action:d,location:S.location,delta:0})}function k(x){return BI(i,x)}let S={get action(){return d},get location(){return t(i,u)},listen(x){if(f)throw new Error("A history only accepts one active listener");return i.addEventListener(tw,y),f=x,()=>{i.removeEventListener(tw,y),f=null}},createHref(x){return e(i,x)},createURL:k,encodeLocation(x){let T=k(x);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:_,replace:v,go(x){return u.go(x)}};return S}function BI(t,e,r=!1){let s="http://localhost";t&&(s=t.location.origin!=="null"?t.location.origin:t.location.href),Ye(s,"No window.location.(origin|href) available to create URL");let i=typeof e=="string"?e:Ys(e);return i=i.replace(/ $/,"%20"),!r&&x_.test(i)&&(i=s+i),new URL(i,s)}function E_(t,e,r="/"){return VI(t,e,r,!1)}function VI(t,e,r,s,i){let a=typeof e=="string"?yi(e):e,u=Sn(a.pathname||"/",r);if(u==null)return null;let d=WI(t),f=null,p=tN(u);for(let g=0;f==null&&g{let g={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(s)&&f)return;Ye(g.relativePath.startsWith(s),`Absolute route path "${g.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(s.length)}let y=Nr([s,g.relativePath]),_=r.concat(g);u.children&&u.children.length>0&&(Ye(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),S_(u.children,e,_,y,f)),!(u.path==null&&!u.index)&&e.push({path:y,score:XI(y,u.index),routesMeta:_.map((v,k)=>{let[S,x]=R_(v.relativePath,v.caseSensitive,k===_.length-1);return{...v,matcher:S,compiledParams:x}})})};return t.forEach((u,d)=>{var f;if(u.path===""||!((f=u.path)!=null&&f.includes("?")))a(u,d);else for(let p of k_(u.path))a(u,d,!0,p)}),e}function k_(t){let e=t.split("/");if(e.length===0)return[];let[r,...s]=e,i=r.endsWith("?"),a=r.replace(/\?$/,"");if(s.length===0)return i?[a,""]:[a];let u=k_(s.join("/")),d=[];return d.push(...u.map(f=>f===""?a:[a,f].join("/"))),i&&d.push(...u),d.map(f=>t.startsWith("/")&&f===""?"/":f)}function HI(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:ZI(e.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var qI=/^:[\w-]+$/,KI=3,GI=2,QI=1,JI=10,YI=-2,sw=t=>t==="*";function XI(t,e){let r=t.split("/"),s=r.length;return r.some(sw)&&(s+=YI),e&&(s+=GI),r.filter(i=>!sw(i)).reduce((i,a)=>i+(qI.test(a)?KI:a===""?QI:JI),s)}function ZI(t,e){return t.length===e.length&&t.slice(0,-1).every((s,i)=>s===e[i])?t[t.length-1]-e[e.length-1]:0}function eN(t,e,r=!1){let{routesMeta:s}=t,i={},a="/",u=[];for(let d=0;d{if(g==="*"){let k=d[_]||"";u=di(a.slice(0,a.length-k.length),1)}const v=d[_];return y&&!v?p[g]=void 0:p[g]=(v||"").replace(/%2F/g,"/"),p},{}),pathname:a,pathnameBase:u,pattern:t}}function R_(t,e=!1,r=!0){pr(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let s=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,f,p,g)=>{if(s.push({paramName:d,isOptional:f!=null}),f){let y=g.charAt(p+u.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(s.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),s]}function tN(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return pr(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Sn(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,s=t.charAt(r);return s&&s!=="/"?null:t.slice(r)||"/"}function rN(t,e="/"){let{pathname:r,search:s="",hash:i=""}=typeof t=="string"?yi(t):t,a;return r?(r=C_(r),r.startsWith("/")||r.startsWith("\\")?a=ow(r.substring(1),"/"):a=ow(r,e)):a=e,{pathname:a,search:oN(s),hash:iN(i)}}function ow(t,e){let r=di(e).split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Cf(t,e,r,s){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function nN(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Tp(t){let e=nN(t);return e.map((r,s)=>s===e.length-1?r.pathname:r.pathnameBase)}function ic(t,e,r,s=!1){let i;typeof t=="string"?i=yi(t):(i={...t},Ye(!i.pathname||!i.pathname.includes("?"),Cf("?","pathname","search",i)),Ye(!i.pathname||!i.pathname.includes("#"),Cf("#","pathname","hash",i)),Ye(!i.search||!i.search.includes("#"),Cf("#","search","hash",i)));let a=t===""||i.pathname==="",u=a?"/":i.pathname,d;if(u==null)d=r;else{let y=e.length-1;if(!s&&u.startsWith("..")){let _=u.split("/");for(;_[0]==="..";)_.shift(),y-=1;i.pathname=_.join("/")}d=y>=0?e[y]:"/"}let f=rN(i,d),p=u&&u!=="/"&&u.endsWith("/"),g=(a||u===".")&&r.endsWith("/");return!f.pathname.endsWith("/")&&(p||g)&&(f.pathname+="/"),f}var C_=t=>t.replace(/[\\/]{2,}/g,"/"),Nr=t=>C_(t.join("/"));function di(t,e=0){let r=t.length;for(;r>e&&t.charCodeAt(r-1)===47;)r--;return r===t.length?t:t.slice(0,r)}var sN=t=>di(t).replace(/^\/*/,"/"),oN=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,iN=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,aN=class{constructor(t,e,r,s=!1){this.status=t,this.statusText=e||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function lN(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function uN(t){let e=t.map(r=>r.route.path).filter(Boolean);return Nr(e)||"/"}var P_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function j_(t,e){let r=t;if(typeof r!="string"||!kp.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,i=!1;if(P_)try{let a=new URL(window.location.href),u=x_.test(r)?new URL(MI(r,a.protocol)):new URL(r),d=Sn(u.pathname,e);u.origin===a.origin&&d!=null?r=d+u.search+u.hash:i=!0}catch{pr(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:i,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var iw=new URL("http://localhost");function Rp(t){if(t.createURL)return t.createURL("/");try{return new URL(t.createHref("/"),iw)}catch{return iw}}function Pf(t,e){return t.origin===e.origin&&(t.origin!=="null"||t.protocol===e.protocol&&t.host===e.host)}function cN(t,e){if(t.startsWith("//"))return!0;let r=e.protocol.toLowerCase();return t.toLowerCase().startsWith(r)?e.host===""||t.slice(r.length).startsWith("//"):!1}function Cp(t,e,r,s){let i=null;try{i=t==null?null:new URL(t,r)}catch{}let a=new URL(e,r),u=i!=null&&!Pf(i,r),d=!Pf(a,r);if(s==="reject"){if(u||d)throw new Error("External navigation is not allowed")}else if(d&&(i==null||!cN(t,i)||!Pf(i,a)))throw new Error("External navigation is not allowed")}var O_=["POST","PUT","PATCH","DELETE"];new Set(O_);var dN=["GET",...O_];new Set(dN);var fN=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function hN(t){try{return fN.includes(new URL(t).protocol)}catch{return!1}}var wi=b.createContext(null);wi.displayName="DataRouter";var ac=b.createContext(null);ac.displayName="DataRouterState";var A_=b.createContext(!1);function pN(){return b.useContext(A_)}var I_=b.createContext({isTransitioning:!1});I_.displayName="ViewTransition";var mN=b.createContext(new Map);mN.displayName="Fetchers";var gN=b.createContext(null);gN.displayName="Await";var rr=b.createContext(null);rr.displayName="Navigation";var Da=b.createContext(null);Da.displayName="Location";var mr=b.createContext({outlet:null,matches:[],isDataRoute:!1});mr.displayName="Route";var Pp=b.createContext(null);Pp.displayName="RouteError";var N_="REACT_ROUTER_ERROR",vN="REDIRECT",yN="ROUTE_ERROR_RESPONSE";function wN(t){if(t.startsWith(`${N_}:${vN}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function bN(t){if(t.startsWith(`${N_}:${yN}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new aN(e.status,e.statusText,e.data)}catch{}}function _N(t,{relative:e}={}){Ye(bi(),"useHref() may be used only in the context of a component.");let{basename:r,navigator:s}=b.useContext(rr),{hash:i,pathname:a,search:u}=$a(t,{relative:e}),d=a;return r!=="/"&&(d=a==="/"?r:Nr([r,a])),s.createHref({pathname:d,search:u,hash:i})}function bi(){return b.useContext(Da)!=null}function nr(){return Ye(bi(),"useLocation() may be used only in the context of a component."),b.useContext(Da).location}var L_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function D_(t){b.useContext(rr).static||b.useLayoutEffect(t)}function lc(){let{isDataRoute:t}=b.useContext(mr);return t?LN():xN()}function xN(){Ye(bi(),"useNavigate() may be used only in the context of a component.");let t=b.useContext(wi),{basename:e,navigator:r}=b.useContext(rr),{matches:s}=b.useContext(mr),{pathname:i}=nr(),a=JSON.stringify(Tp(s)),u=b.useRef(!1);return D_(()=>{u.current=!0}),b.useCallback((f,p={})=>{if(pr(u.current,L_),!u.current)return;if(typeof f=="number"){r.go(f);return}let g=ic(f,JSON.parse(a),i,p.relative==="path");t==null&&e!=="/"&&(g.pathname=g.pathname==="/"?e:Nr([e,g.pathname])),Cp(typeof f=="string"?f:Ys(f),r.createHref(g),Rp(r),"reject"),(p.replace?r.replace:r.push)(g,p.state,p)},[e,r,a,i,t])}var $_=b.createContext(null);function U2(){return b.useContext($_)}function EN(t){let e=b.useContext(mr).outlet;return b.useMemo(()=>e&&b.createElement($_.Provider,{value:t},e),[e,t])}function uc(){let{matches:t}=b.useContext(mr),e=t[t.length-1];return(e==null?void 0:e.params)??{}}function $a(t,{relative:e}={}){let{matches:r}=b.useContext(mr),{pathname:s}=nr(),i=JSON.stringify(Tp(r));return b.useMemo(()=>ic(t,JSON.parse(i),s,e==="path"),[t,i,s,e])}function SN(t,e){return M_(t,e)}function M_(t,e,r){var x;Ye(bi(),"useRoutes() may be used only in the context of a component.");let{navigator:s}=b.useContext(rr),{matches:i}=b.useContext(mr),a=i[i.length-1],u=a?a.params:{},d=a?a.pathname:"/",f=a?a.pathnameBase:"/",p=a&&a.route;{let T=p&&p.path||"";U_(d,!p||T.endsWith("*")||T.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${d}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. Please change the parent to .`)}let g=nr(),y;if(e){let T=typeof e=="string"?yi(e):e;Ye(f==="/"||((x=T.pathname)==null?void 0:x.startsWith(f)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${T.pathname}" was given in the \`location\` prop.`),y=T}else y=g;let _=y.pathname||"/",v=_;if(f!=="/"){let T=f.replace(/^\//,"").split("/");v="/"+_.replace(/^\//,"").split("/").slice(T.length).join("/")}let k=r&&r.state.matches.length?r.state.matches.map(T=>Object.assign(T,{route:r.manifest[T.route.id]||T.route})):E_(t,{pathname:v});pr(p||k!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),pr(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let S=PN(k&&k.map(T=>Object.assign({},T,{params:Object.assign({},u,T.params),pathname:Nr([f,s.encodeLocation?s.encodeLocation(T.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?f:Nr([f,s.encodeLocation?s.encodeLocation(T.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),i,r);return e&&S?b.createElement(Da.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...y},navigationType:"POP"}},S):S}function kN(){let t=NN(),e=lN(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,s="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:s},a={padding:"2px 4px",backgroundColor:s},u=null;return console.error("Error handled by React Router default ErrorBoundary:",t),u=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:a},"ErrorBoundary")," or"," ",b.createElement("code",{style:a},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),r?b.createElement("pre",{style:i},r):null,u)}var TN=b.createElement(kN,null),F_=class extends b.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const r=bN(t.digest);r&&(t=r)}let e=t!==void 0?b.createElement(mr.Provider,{value:this.props.routeContext},b.createElement(Pp.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?b.createElement(RN,{error:t},e):e}};F_.contextType=A_;var jf=new WeakMap;function RN({children:t,error:e}){let{basename:r,navigator:s}=b.useContext(rr);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let i=wN(e.digest);if(i){let a=jf.get(e);if(a)throw a;let u=j_(i.location,r),d=u.absoluteURL||u.to;if(Cp(i.location,d,Rp(s),"allow-explicit"),hN(d))throw new Error("Invalid redirect location");if(P_&&!jf.get(e))if(u.isExternal||i.reloadDocument)window.location.href=d;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:i.replace}));throw jf.set(e,f),f}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return t}function CN({routeContext:t,match:e,children:r}){let s=b.useContext(wi);return s&&s.static&&s.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=e.route.id),b.createElement(mr.Provider,{value:t},r)}function PN(t,e=[],r){let s=r==null?void 0:r.state;if(t==null){if(!s)return null;if(s.errors)t=s.matches;else if(e.length===0&&!s.initialized&&s.matches.length>0)t=s.matches;else return null}let i=t,a=s==null?void 0:s.errors;if(a!=null){let g=i.findIndex(y=>y.route.id&&(a==null?void 0:a[y.route.id])!==void 0);Ye(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),i=i.slice(0,Math.min(i.length,g+1))}let u=!1,d=-1;if(r&&s){u=s.renderFallback;for(let g=0;g=0?i=i.slice(0,d+1):i=[i[0]];break}}}}let f=r==null?void 0:r.onError,p=s&&f?(g,y)=>{var _,v;f(g,{location:s.location,params:((v=(_=s.matches)==null?void 0:_[0])==null?void 0:v.params)??{},pattern:uN(s.matches),errorInfo:y})}:void 0;return i.reduceRight((g,y,_)=>{let v,k=!1,S=null,x=null;s&&(v=a&&y.route.id?a[y.route.id]:void 0,S=y.route.errorElement||TN,u&&(d<0&&_===0?(U_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,x=null):d===_&&(k=!0,x=y.route.hydrateFallbackElement||null)));let T=e.concat(i.slice(0,_+1)),R=()=>{let C;return v?C=S:k?C=x:y.route.Component?C=b.createElement(y.route.Component,null):y.route.element?C=y.route.element:C=g,b.createElement(CN,{match:y,routeContext:{outlet:g,matches:T,isDataRoute:s!=null},children:C})};return s&&(y.route.ErrorBoundary||y.route.errorElement||_===0)?b.createElement(F_,{location:s.location,revalidation:s.revalidation,component:S,error:v,children:R(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:p}):R()},null)}function jp(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function jN(t){let e=b.useContext(wi);return Ye(e,jp(t)),e}function ON(t){let e=b.useContext(ac);return Ye(e,jp(t)),e}function AN(t){let e=b.useContext(mr);return Ye(e,jp(t)),e}function Op(t){let e=AN(t),r=e.matches[e.matches.length-1];return Ye(r.route.id,`${t} can only be used on routes that contain a unique "id"`),r.route.id}function IN(){return Op("useRouteId")}function NN(){var s;let t=b.useContext(Pp),e=ON("useRouteError"),r=Op("useRouteError");return t!==void 0?t:(s=e.errors)==null?void 0:s[r]}function LN(){let{router:t}=jN("useNavigate"),e=Op("useNavigate"),r=b.useRef(!1);return D_(()=>{r.current=!0}),b.useCallback(async(i,a={})=>{pr(r.current,L_),r.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...a}))},[t,e])}var aw={};function U_(t,e,r){!e&&!aw[t]&&(aw[t]=!0,pr(!1,r))}b.memo(DN);function DN({routes:t,manifest:e,future:r,state:s,isStatic:i,onError:a}){return M_(t,void 0,{manifest:e,state:s,isStatic:i,onError:a})}function cc({to:t,replace:e,state:r,relative:s}){Ye(bi()," may be used only in the context of a component.");let{static:i,navigator:a}=b.useContext(rr);pr(!i," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:u}=b.useContext(mr),{pathname:d}=nr(),f=lc(),p=ic(t,Tp(u),d,s==="path");Cp(typeof t=="string"?t:Ys(t),a.createHref(p),Rp(a),"reject");let g=JSON.stringify(p);return b.useEffect(()=>{f(JSON.parse(g),{replace:e,state:r,relative:s})},[f,g,s,e,r]),null}function z2(t){return EN(t.context)}function _e(t){Ye(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function $N({basename:t="/",children:e=null,location:r,navigationType:s="POP",navigator:i,static:a=!1,useTransitions:u}){Ye(!bi(),"You cannot render a inside another . You should never have more than one in your app.");let d=t.replace(/^\/*/,"/"),f=b.useMemo(()=>({basename:d,navigator:i,static:a,useTransitions:u,future:{}}),[d,i,a,u]);typeof r=="string"&&(r=yi(r));let{pathname:p="/",search:g="",hash:y="",state:_=null,key:v="default",mask:k}=r,S=b.useMemo(()=>{let x=Sn(p,d);return x==null?null:{location:{pathname:x,search:g,hash:y,state:_,key:v,mask:k},navigationType:s}},[d,p,g,y,_,v,s,k]);return pr(S!=null,` is not able to match the URL "${p}${g}${y}" because it does not start with the basename, so the won't render anything.`),S==null?null:b.createElement(rr.Provider,{value:f},b.createElement(Da.Provider,{children:e,value:S}))}function MN({children:t,location:e}){return SN(Rh(t),e)}function Rh(t,e=[]){let r=[];return b.Children.forEach(t,(s,i)=>{if(!b.isValidElement(s))return;let a=[...e,i];if(s.type===b.Fragment){r.push.apply(r,Rh(s.props.children,a));return}Ye(s.type===_e,`[${typeof s.type=="string"?s.type:s.type.name}] is not a component. All component children of must be a or `),Ye(!s.props.index||!s.props.children,"An index route cannot have child routes.");let u={id:s.props.id||a.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(u.children=Rh(s.props.children,a)),r.push(u)}),r}var Tu="get",Ru="application/x-www-form-urlencoded";function dc(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function FN(t){return dc(t)&&t.tagName.toLowerCase()==="button"}function UN(t){return dc(t)&&t.tagName.toLowerCase()==="form"}function zN(t){return dc(t)&&t.tagName.toLowerCase()==="input"}function BN(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function VN(t,e){return t.button===0&&(!e||e==="_self")&&!BN(t)}function Ch(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,r)=>{let s=t[r];return e.concat(Array.isArray(s)?s.map(i=>[r,i]):[[r,s]])},[]))}function WN(t,e){let r=Ch(t);return e&&e.forEach((s,i)=>{r.has(i)||e.getAll(i).forEach(a=>{r.append(i,a)})}),r}var bu=null;function HN(){if(bu===null)try{new FormData(document.createElement("form"),0),bu=!1}catch{bu=!0}return bu}var qN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Of(t){return t!=null&&!qN.has(t)?(pr(!1,`"${t}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Ru}"`),null):t}function KN(t,e){let r,s,i,a,u;if(UN(t)){let d=t.getAttribute("action");s=d?Sn(d,e):null,r=t.getAttribute("method")||Tu,i=Of(t.getAttribute("enctype"))||Ru,a=new FormData(t)}else if(FN(t)||zN(t)&&(t.type==="submit"||t.type==="image")){let d=t.form;if(d==null)throw new Error('Cannot submit a