vendor: 19,636 bytes, lines 1-35
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ComoUsarlo-BLRpbetN.js","assets/DecoracionMargen-BwiL63O0.js","assets/Planes-BuY-CGoi.js","assets/NoEncontrado-CNC3jxu9.js","assets/NoEncontrado-DDT4Sknt.css"])))=>i.map(i=>d[i]); 2(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var Fh={exports:{}},za={},qh={exports:{}},G={};/** 3 * @license React 4 * react.production.min.js 5 * 6 * Copyright (c) Facebook, Inc. and its affiliates. 7 * 8 * This source code is licensed under the MIT license found in the 9 * LICENSE file in the root directory of this source tree. 10 */var Zs=Symbol.for("react.element"),lg=Symbol.for("react.portal"),ug=Symbol.for("react.fragment"),cg=Symbol.for("react.strict_mode"),dg=Symbol.for("react.profiler"),hg=Symbol.for("react.provider"),fg=Symbol.for("react.context"),pg=Symbol.for("react.forward_ref"),mg=Symbol.for("react.suspense"),gg=Symbol.for("react.memo"),vg=Symbol.for("react.lazy"),Oc=Symbol.iterator;function yg(e){return e===null||typeof e!="object"?null:(e=Oc&&e[Oc]||e["@@iterator"],typeof e=="function"?e:null)}var Hh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Wh=Object.assign,Vh={};function zn(e,t,r){this.props=e,this.context=t,this.refs=Vh,this.updater=r||Hh}zn.prototype.isReactComponent={};zn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};zn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Kh(){}Kh.prototype=zn.prototype;function uu(e,t,r){this.props=e,this.context=t,this.refs=Vh,this.updater=r||Hh}var cu=uu.prototype=new Kh;cu.constructor=uu;Wh(cu,zn.prototype);cu.isPureReactComponent=!0;var Lc=Array.isArray,Jh=Object.prototype.hasOwnProperty,du={current:null},Gh={key:!0,ref:!0,__self:!0,__source:!0};function Qh(e,t,r){var n,s={},i=null,a=null;if(t!=null)for(n in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)Jh.call(t,n)&&!Gh.hasOwnProperty(n)&&(s[n]=t[n]);var o=arguments.length-2;if(o===1)s.children=r;else if(1<o){for(var u=Array(o),c=0;c<o;c++)u[c]=arguments[c+2];s.children=u}if(e&&e.defaultProps)for(n in o=e.defaultProps,o)s[n]===void 0&&(s[n]=o[n]);return{$$typeof:Zs,type:e,key:i,ref:a,props:s,_owner:du.current}}function wg(e,t){return{$$typeof:Zs,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function hu(e){return typeof e=="object"&&e!==null&&e.$$typeof===Zs}function _g(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var Ic=/\/+/g;function mo(e,t){return typeof e=="object"&&e!==null&&e.key!=null?_g(""+e.key):t.toString(36)}function Vi(e,t,r,n,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Zs:case lg:a=!0}}if(a)return a=e,s=s(a),e=n===""?"."+mo(a,0):n,Lc(s)?(r="",e!=null&&(r=e.replace(Ic,"$&/")+"/"),Vi(s,t,r,"",function(c){return c})):s!=null&&(hu(s)&&(s=wg(s,r+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(Ic,"$&/")+"/")+e)),t.push(s)),1;if(a=0,n=n===""?".":n+":",Lc(e))for(var o=0;o<e.length;o++){i=e[o];var u=n+mo(i,o);a+=Vi(i,t,r,u,s)}else if(u=yg(e),typeof u=="function")for(e=u.call(e),o=0;!(i=e.next()).done;)i=i.value,u=n+mo(i,o++),a+=Vi(i,t,r,u,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function gi(e,t,r){if(e==null)return e;var n=[],s=0;return Vi(e,n,"","",function(i){return t.call(r,i,s++)}),n}function xg(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ue={current:null},Ki={transition:null},bg={ReactCurrentDispatcher:Ue,ReactCurrentBatchConfig:Ki,ReactCurrentOwner:du};function Yh(){throw Error("act(...) is not supported in production builds of React.")}G.Children={map:gi,forEach:function(e,t,r){gi(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return gi(e,function(){t++}),t},toArray:function(e){return gi(e,function(t){return t})||[]},only:function(e){if(!hu(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};G.Component=zn;G.Fragment=ug;G.Profiler=dg;G.PureComponent=uu;G.StrictMode=cg;G.Suspense=mg;G.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=bg;G.act=Yh;G.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=Wh({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=du.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(u in t)Jh.call(t,u)&&!Gh.hasOwnProperty(u)&&(n[u]=t[u]===void 0&&o!==void 0?o[u]:t[u])}var u=arguments.length-2;if(u===1)n.children=r;else if(1<u){o=Array(u);for(var c=0;c<u;c++)o[c]=arguments[c+2];n.children=o}return{$$typeof:Zs,type:e.type,key:s,ref:i,props:n,_owner:a}};G.createContext=function(e){return e={$$typeof:fg,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:hg,_context:e},e.Consumer=e};G.createElement=Qh;G.createFactory=function(e){var t=Qh.bind(null,e);return t.type=e,t};G.createRef=function(){return{current:null}};G.forwardRef=function(e){return{$$typeof:pg,render:e}};G.isValidElement=hu;G.lazy=function(e){return{$$typeof:vg,_payload:{_status:-1,_result:e},_init:xg}};G.memo=function(e,t){return{$$typeof:gg,type:e,compare:t===void 0?null:t}};G.startTransition=function(e){var t=Ki.transition;Ki.transition={};try{e()}finally{Ki.transition=t}};G.unstable_act=Yh;G.useCallback=function(e,t){return Ue.current.useCallback(e,t)};G.useContext=function(e){return Ue.current.useContext(e)};G.useDebugValue=function(){};G.useDeferredValue=function(e){return Ue.current.useDeferredValue(e)};G.useEffect=function(e,t){return Ue.current.useEffect(e,t)};G.useId=function(){return Ue.current.useId()};G.useImperativeHandle=function(e,t,r){return Ue.current.useImperativeHandle(e,t,r)};G.useInsertionEffect=function(e,t){return Ue.current.useInsertionEffect(e,t)};G.useLayoutEffect=function(e,t){return Ue.current.useLayoutEffect(e,t)};G.useMemo=function(e,t){return Ue.current.useMemo(e,t)};G.useReducer=function(e,t,r){return Ue.current.useReducer(e,t,r)};G.useRef=function(e){return Ue.current.useRef(e)};G.useState=function(e){return Ue.current.useState(e)};G.useSyncExternalStore=function(e,t,r){return Ue.current.useSyncExternalStore(e,t,r)};G.useTransition=function(){return Ue.current.useTransition()};G.version="18.3.1";qh.exports=G;var _=qh.exports;/** 11 * @license React 12 * react-jsx-runtime.production.min.js 13 * 14 * Copyright (c) Facebook, Inc. and its affiliates. 15 * 16 * This source code is licensed under the MIT license found in the 17 * LICENSE file in the root directory of this source tree. 18 */var kg=_,Sg=Symbol.for("react.element"),Eg=Symbol.for("react.fragment"),jg=Object.prototype.hasOwnProperty,Cg=kg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Rg={key:!0,ref:!0,__self:!0,__source:!0};function Xh(e,t,r){var n,s={},i=null,a=null;r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(n in t)jg.call(t,n)&&!Rg.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)s[n]===void 0&&(s[n]=t[n]);return{$$typeof:Sg,type:e,key:i,ref:a,props:s,_owner:Cg.current}}za.Fragment=Eg;za.jsx=Xh;za.jsxs=Xh;Fh.exports=za;var l=Fh.exports,Zh={exports:{}},Ze={},ef={exports:{}},tf={};/** 19 * @license React 20 * scheduler.production.min.js 21 * 22 * Copyright (c) Facebook, Inc. and its affiliates. 23 * 24 * This source code is licensed under the MIT license found in the 25 * LICENSE file in the root directory of this source tree. 26 */(function(e){function t(O,q){var H=O.length;O.push(q);e:for(;0<H;){var ee=H-1>>>1,ae=O[ee];if(0<s(ae,q))O[ee]=q,O[H]=ae,H=ee;else break e}}function r(O){return O.length===0?null:O[0]}function n(O){if(O.length===0)return null;var q=O[0],H=O.pop();if(H!==q){O[0]=H;e:for(var ee=0,ae=O.length,Ke=ae>>>1;ee<Ke;){var K=2*(ee+1)-1,Rr=O[K],It=K+1,Gr=O[It];if(0>s(Rr,H))It<ae&&0>s(Gr,Rr)?(O[ee]=Gr,O[It]=H,ee=It):(O[ee]=Rr,O[K]=H,ee=K);else if(It<ae&&0>s(Gr,H))O[ee]=Gr,O[It]=H,ee=It;else break e}}return q}function s(O,q){var H=O.sortIndex-q.sortIndex;return H!==0?H:O.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var u=[],c=[],d=1,h=null,f=3,p=!1,y=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(O){for(var q=r(c);q!==null;){if(q.callback===null)n(c);else if(q.startTime<=O)n(c),q.sortIndex=q.expirationTime,t(u,q);else break;q=r(c)}}function b(O){if(w=!1,v(O),!y)if(r(u)!==null)y=!0,W(E);else{var q=r(c);q!==null&&ne(b,q.startTime-O)}}function E(O,q){y=!1,w&&(w=!1,m(P),P=-1),p=!0;var H=f;try{for(v(q),h=r(u);h!==null&&(!(h.expirationTime>q)||O&&!B());){var ee=h.callback;if(typeof ee=="function"){h.callback=null,f=h.priorityLevel;var ae=ee(h.expirationTime<=q);q=e.unstable_now(),typeof ae=="function"?h.callback=ae:h===r(u)&&n(u),v(q)}else n(u);h=r(u)}if(h!==null)var Ke=!0;else{var K=r(c);K!==null&&ne(b,K.startTime-q),Ke=!1}return Ke}finally{h=null,f=H,p=!1}}var S=!1,j=null,P=-1,C=5,N=-1;function B(){return!(e.unstable_now()-N<C)}function I(){if(j!==null){var O=e.unstable_now();N=O;var q=!0;try{q=j(!0,O)}finally{q?T():(S=!1,j=null)}}else S=!1}var T;if(typeof g=="function")T=function(){g(I)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,D=U.port2;U.port1.onmessage=I,T=function(){D.postMessage(null)}}else T=function(){x(I,0)};function W(O){j=O,S||(S=!0,T())}function ne(O,q){P=x(function(){O(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(O){O.callback=null},e.unstable_continueExecution=function(){y||p||(y=!0,W(E))},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(u)},e.unstable_next=function(O){switch(f){case 1:case 2:case 3:var q=3;break;default:q=f}var H=f;f=q;try{return O()}finally{f=H}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(O,q){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var H=f;f=O;try{return q()}finally{f=H}},e.unstable_scheduleCallback=function(O,q,H){var ee=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?ee+H:ee):H=ee,O){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=H+ae,O={id:d++,callback:q,priorityLevel:O,startTime:H,expirationTime:ae,sortIndex:-1},H>ee?(O.sortIndex=H,t(c,O),r(u)===null&&O===r(c)&&(w?(m(P),P=-1):w=!0,ne(b,H-ee))):(O.sortIndex=ae,t(u,O),y||p||(y=!0,W(E))),O},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(O){var q=f;return function(){var H=f;f=q;try{return O.apply(this,arguments)}finally{f=H}}}})(tf);ef.exports=tf;var Tg=ef.exports;/** 27 * @license React 28 * react-dom.production.min.js 29 * 30 * Copyright (c) Facebook, Inc. and its affiliates. 31 * 32 * This source code is licensed under the MIT license found in the 33 * LICENSE file in the root directory of this source tree. 34 */var Ng=_,Xe=Tg;function A(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var rf=new Set,Rs={};function Kr(e,t){On(e,t),On(e+"Capture",t)}function On(e,t){for(Rs[e]=t,e=0;e<t.length;e++)rf.add(t[e])}var Vt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zo=Object.prototype.hasOwnProperty,Pg=/^[: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]*$/,$c={},Uc={};function Ag(e){return Zo.call(Uc,e)?!0:Zo.call($c,e)?!1:Pg.test(e)?Uc[e]=!0:($c[e]=!0,!1)}function Og(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Lg(e,t,r,n){if(t===null||typeof t>"u"||Og(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Me(e,t,r,n,s,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var Ce={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ce[e]=new Me(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ce[t]=new Me(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ce[e]=new Me(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ce[e]=new Me(e,2,!1,e,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(e){Ce[e]=new Me(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ce[e]=new Me(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ce[e]=new Me(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ce[e]=new Me(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ce[e]=new Me(e,5,!1,e.toLowerCase(),null,!1,!1)});var fu=/[\-:]([a-z])/g;function pu(e){return e[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(e){var t=e.replace(fu,pu);Ce[t]=new Me(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(fu,pu);Ce[t]=new Me(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(fu,pu);Ce[t]=new Me(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ce[e]=new Me(e,1,!1,e.toLowerCase(),null,!1,!1)});Ce.xlinkHref=new Me("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ce[e]=new Me(e,1,!1,e.toLowerCase(),null,!0,!0)});function mu(e,t,r,n){var s=Ce.hasOwnProperty(t)?Ce[t]:null;(s!==null?s.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Lg(t,r,s,n)&&(r=null),n||s===null?Ag(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):s.mustUseProperty?e[s.propertyName]=r===null?s.type===3?!1:"":r:(t=s.attributeName,n=s.attributeNamespace,r===null?e.removeAttribute(t):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var Yt=Ng.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,vi=Symbol.for("react.element"),hn=Symbol.for("react.portal"),fn=Symbol.for("react.fragment"),gu=Symbol.for("react.strict_mode"),el=Symbol.for("react.profiler"),nf=Symbol.for("react.provider"),sf=Symbol.for("react.context"),vu=Symbol.for("react.forward_ref"),tl=Symbol.for("react.suspense"),rl=Symbol.for("react.suspense_list"),yu=Symbol.for("react.memo"),sr=Symbol.for("react.lazy"),af=Symbol.for("react.offscreen"),Mc=Symbol.iterator;function Gn(e){return e===null||typeof e!="object"?null:(e=Mc&&e[Mc]||e["@@iterator"],typeof e=="function"?e:null)}var he=Object.assign,go;function ls(e){if(go===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);go=t&&t[1]||""}return` 35`+go+e}var vo=!1;function yo(e,t){if(!e||vo)return"";vo=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var n=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){n=c}e.call(t.prototype)}else{try{throw Error()}catch(c){n=c}e()}}
vendor: 14,090 bytes, lines 35-38
35catch(c){if(c&&n&&typeof c.stack=="string"){for(var s=c.stack.split(` 36`),i=n.stack.split(` 37`),a=s.length-1,o=i.length-1;1<=a&&0<=o&&s[a]!==i[o];)o--;for(;1<=a&&0<=o;a--,o--)if(s[a]!==i[o]){if(a!==1||o!==1)do if(a--,o--,0>o||s[a]!==i[o]){var u=` 38`+s[a].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=a&&0<=o);break}}}finally{vo=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?ls(e):""}function Ig(e){switch(e.tag){case 5:return ls(e.type);case 16:return ls("Lazy");case 13:return ls("Suspense");case 19:return ls("SuspenseList");case 0:case 2:case 15:return e=yo(e.type,!1),e;case 11:return e=yo(e.type.render,!1),e;case 1:return e=yo(e.type,!0),e;default:return""}}function nl(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case fn:return"Fragment";case hn:return"Portal";case el:return"Profiler";case gu:return"StrictMode";case tl:return"Suspense";case rl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case sf:return(e.displayName||"Context")+".Consumer";case nf:return(e._context.displayName||"Context")+".Provider";case vu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case yu:return t=e.displayName||null,t!==null?t:nl(e.type)||"Memo";case sr:t=e._payload,e=e._init;try{return nl(e(t))}catch{}}return null}function $g(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return nl(t);case 8:return t===gu?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function xr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function of(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ug(e){var t=of(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function yi(e){e._valueTracker||(e._valueTracker=Ug(e))}function lf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=of(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function ua(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function sl(e,t){var r=t.checked;return he({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Dc(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=xr(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function uf(e,t){t=t.checked,t!=null&&mu(e,"checked",t,!1)}function il(e,t){uf(e,t);var r=xr(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?al(e,t.type,r):t.hasOwnProperty("defaultValue")&&al(e,t.type,xr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Bc(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function al(e,t,r){(t!=="number"||ua(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var us=Array.isArray;function jn(e,t,r,n){if(e=e.options,t){t={};for(var s=0;s<r.length;s++)t["$"+r[s]]=!0;for(r=0;r<e.length;r++)s=t.hasOwnProperty("$"+e[r].value),e[r].selected!==s&&(e[r].selected=s),s&&n&&(e[r].defaultSelected=!0)}else{for(r=""+xr(r),t=null,s=0;s<e.length;s++){if(e[s].value===r){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function ol(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(A(91));return he({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function zc(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(A(92));if(us(r)){if(1<r.length)throw Error(A(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:xr(r)}}function cf(e,t){var r=xr(t.value),n=xr(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function Fc(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function df(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ll(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?df(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var wi,hf=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,s){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(wi=wi||document.createElement("div"),wi.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=wi.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ts(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var ps={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},Mg=["Webkit","ms","Moz","O"];Object.keys(ps).forEach(function(e){Mg.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ps[t]=ps[e]})});function ff(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||ps.hasOwnProperty(e)&&ps[e]?(""+t).trim():t+"px"}function pf(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=ff(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var Dg=he({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 ul(e,t){if(t){if(Dg[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(A(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(A(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(A(61))}if(t.style!=null&&typeof t.style!="object")throw Error(A(62))}}function cl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 dl=null;function wu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hl=null,Cn=null,Rn=null;function qc(e){if(e=ri(e)){if(typeof hl!="function")throw Error(A(280));var t=e.stateNode;t&&(t=Va(t),hl(e.stateNode,e.type,t))}}function mf(e){Cn?Rn?Rn.push(e):Rn=[e]:Cn=e}function gf(){if(Cn){var e=Cn,t=Rn;if(Rn=Cn=null,qc(e),t)for(e=0;e<t.length;e++)qc(t[e])}}function vf(e,t){return e(t)}function yf(){}var wo=!1;function wf(e,t,r){if(wo)return e(t,r);wo=!0;try{return vf(e,t,r)}finally{wo=!1,(Cn!==null||Rn!==null)&&(yf(),gf())}}function Ns(e,t){var r=e.stateNode;if(r===null)return null;var n=Va(r);if(n===null)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(A(231,t,typeof r));return r}var fl=!1;if(Vt)try{var Qn={};Object.defineProperty(Qn,"passive",{get:function(){fl=!0}}),window.addEventListener("test",Qn,Qn),window.removeEventListener("test",Qn,Qn)}catch{fl=!1}function Bg(e,t,r,n,s,i,a,o,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(d){this.onError(d)}}var ms=!1,ca=null,da=!1,pl=null,zg={onError:function(e){ms=!0,ca=e}};function Fg(e,t,r,n,s,i,a,o,u){ms=!1,ca=null,Bg.apply(zg,arguments)}function qg(e,t,r,n,s,i,a,o,u){if(Fg.apply(this,arguments),ms){if(ms){var c=ca;ms=!1,ca=null}else throw Error(A(198));da||(da=!0,pl=c)}}function Jr(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function _f(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Hc(e){if(Jr(e)!==e)throw Error(A(188))}function Hg(e){var t=e.alternate;if(!t){if(t=Jr(e),t===null)throw Error(A(188));return t!==e?null:e}for(var r=e,n=t;;){var s=r.return;if(s===null)break;var i=s.alternate;if(i===null){if(n=s.return,n!==null){r=n;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===r)return Hc(s),e;if(i===n)return Hc(s),t;i=i.sibling}throw Error(A(188))}if(r.return!==n.return)r=s,n=i;else{for(var a=!1,o=s.child;o;){if(o===r){a=!0,r=s,n=i;break}if(o===n){a=!0,n=s,r=i;break}o=o.sibling}if(!a){for(o=i.child;o;){if(o===r){a=!0,r=i,n=s;break}if(o===n){a=!0,n=i,r=s;break}o=o.sibling}if(!a)throw Error(A(189))}}if(r.alternate!==n)throw Error(A(190))}if(r.tag!==3)throw Error(A(188));return r.stateNode.current===r?e:t}function xf(e){return e=Hg(e),e!==null?bf(e):null}function bf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=bf(e);if(t!==null)return t;e=e.sibling}return null}var kf=Xe.unstable_scheduleCallback,Wc=Xe.unstable_cancelCallback,Wg=Xe.unstable_shouldYield,Vg=Xe.unstable_requestPaint,me=Xe.unstable_now,Kg=Xe.unstable_getCurrentPriorityLevel,_u=Xe.unstable_ImmediatePriority,Sf=Xe.unstable_UserBlockingPriority,ha=Xe.unstable_NormalPriority,Jg=Xe.unstable_LowPriority,Ef=Xe.unstable_IdlePriority,Fa=null,At=null;function Gg(e){if(At&&typeof At.onCommitFiberRoot=="function")try{At.onCommitFiberRoot(Fa,e,void 0,(e.current.flags&128)===128)}catch{}}var _t=Math.clz32?Math.clz32:Xg,Qg=Math.log,Yg=Math.LN2;function Xg(e){return e>>>=0,e===0?32:31-(Qg(e)/Yg|0)|0}var _i=64,xi=4194304;function cs(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function fa(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,s=e.suspendedLanes,i=e.pingedLanes,a=r&268435455;if(a!==0){var o=a&~s;o!==0?n=cs(o):(i&=a,i!==0&&(n=cs(i)))}else a=r&~s,a!==0?n=cs(a):i!==0&&(n=cs(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&s)&&(s=n&-n,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-_t(t),s=1<<r,n|=e[r],t&=~s;return n}function Zg(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ev(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-_t(i),o=1<<a,u=s[a];u===-1?(!(o&r)||o&n)&&(s[a]=Zg(o,t)):u<=t&&(e.expiredLanes|=o),i&=~o}}function ml(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function jf(){var e=_i;return _i<<=1,!(_i&4194240)&&(_i=64),e}function _o(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}
vendor: 4,080 bytes, line 38
38function ei(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-_t(t),e[t]=r}function tv(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var s=31-_t(r),i=1<<s;t[s]=0,n[s]=-1,e[s]=-1,r&=~i}}function xu(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-_t(r),s=1<<n;s&t|e[n]&t&&(e[n]|=t),r&=~s}}var X=0;function Cf(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Rf,bu,Tf,Nf,Pf,gl=!1,bi=[],fr=null,pr=null,mr=null,Ps=new Map,As=new Map,ar=[],rv="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Vc(e,t){switch(e){case"focusin":case"focusout":fr=null;break;case"dragenter":case"dragleave":pr=null;break;case"mouseover":case"mouseout":mr=null;break;case"pointerover":case"pointerout":Ps.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":As.delete(t.pointerId)}}function Yn(e,t,r,n,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[s]},t!==null&&(t=ri(t),t!==null&&bu(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function nv(e,t,r,n,s){switch(t){case"focusin":return fr=Yn(fr,e,t,r,n,s),!0;case"dragenter":return pr=Yn(pr,e,t,r,n,s),!0;case"mouseover":return mr=Yn(mr,e,t,r,n,s),!0;case"pointerover":var i=s.pointerId;return Ps.set(i,Yn(Ps.get(i)||null,e,t,r,n,s)),!0;case"gotpointercapture":return i=s.pointerId,As.set(i,Yn(As.get(i)||null,e,t,r,n,s)),!0}return!1}function Af(e){var t=Lr(e.target);if(t!==null){var r=Jr(t);if(r!==null){if(t=r.tag,t===13){if(t=_f(r),t!==null){e.blockedOn=t,Pf(e.priority,function(){Tf(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ji(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=vl(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);dl=n,r.target.dispatchEvent(n),dl=null}else return t=ri(r),t!==null&&bu(t),e.blockedOn=r,!1;t.shift()}return!0}function Kc(e,t,r){Ji(e)&&r.delete(t)}function sv(){gl=!1,fr!==null&&Ji(fr)&&(fr=null),pr!==null&&Ji(pr)&&(pr=null),mr!==null&&Ji(mr)&&(mr=null),Ps.forEach(Kc),As.forEach(Kc)}function Xn(e,t){e.blockedOn===t&&(e.blockedOn=null,gl||(gl=!0,Xe.unstable_scheduleCallback(Xe.unstable_NormalPriority,sv)))}function Os(e){function t(s){return Xn(s,e)}if(0<bi.length){Xn(bi[0],e);for(var r=1;r<bi.length;r++){var n=bi[r];n.blockedOn===e&&(n.blockedOn=null)}}for(fr!==null&&Xn(fr,e),pr!==null&&Xn(pr,e),mr!==null&&Xn(mr,e),Ps.forEach(t),As.forEach(t),r=0;r<ar.length;r++)n=ar[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<ar.length&&(r=ar[0],r.blockedOn===null);)Af(r),r.blockedOn===null&&ar.shift()}var Tn=Yt.ReactCurrentBatchConfig,pa=!0;function iv(e,t,r,n){var s=X,i=Tn.transition;Tn.transition=null;try{X=1,ku(e,t,r,n)}finally{X=s,Tn.transition=i}}function av(e,t,r,n){var s=X,i=Tn.transition;Tn.transition=null;try{X=4,ku(e,t,r,n)}finally{X=s,Tn.transition=i}}function ku(e,t,r,n){if(pa){var s=vl(e,t,r,n);if(s===null)No(e,t,n,ma,r),Vc(e,n);else if(nv(s,e,t,r,n))n.stopPropagation();else if(Vc(e,n),t&4&&-1<rv.indexOf(e)){for(;s!==null;){var i=ri(s);if(i!==null&&Rf(i),i=vl(e,t,r,n),i===null&&No(e,t,n,ma,r),i===s)break;s=i}s!==null&&n.stopPropagation()}else No(e,t,n,null,r)}}var ma=null;function vl(e,t,r,n){if(ma=null,e=wu(n),e=Lr(e),e!==null)if(t=Jr(e),t===null)e=null;else if(r=t.tag,r===13){if(e=_f(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return ma=e,null}
vendor: 10,401 bytes, line 38
38function Of(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Kg()){case _u:return 1;case Sf:return 4;case ha:case Jg:return 16;case Ef:return 536870912;default:return 16}default:return 16}}var cr=null,Su=null,Gi=null;function Lf(){if(Gi)return Gi;var e,t=Su,r=t.length,n,s="value"in cr?cr.value:cr.textContent,i=s.length;for(e=0;e<r&&t[e]===s[e];e++);var a=r-e;for(n=1;n<=a&&t[r-n]===s[i-n];n++);return Gi=s.slice(e,1<n?1-n:void 0)}function Qi(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ki(){return!0}function Jc(){return!1}function et(e){function t(r,n,s,i,a){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(r=e[o],this[o]=r?r(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ki:Jc,this.isPropagationStopped=Jc,this}return he(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=ki)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=ki)},persist:function(){},isPersistent:ki}),t}var Fn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Eu=et(Fn),ti=he({},Fn,{view:0,detail:0}),ov=et(ti),xo,bo,Zn,qa=he({},ti,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ju,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Zn&&(Zn&&e.type==="mousemove"?(xo=e.screenX-Zn.screenX,bo=e.screenY-Zn.screenY):bo=xo=0,Zn=e),xo)},movementY:function(e){return"movementY"in e?e.movementY:bo}}),Gc=et(qa),lv=he({},qa,{dataTransfer:0}),uv=et(lv),cv=he({},ti,{relatedTarget:0}),ko=et(cv),dv=he({},Fn,{animationName:0,elapsedTime:0,pseudoElement:0}),hv=et(dv),fv=he({},Fn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),pv=et(fv),mv=he({},Fn,{data:0}),Qc=et(mv),gv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vv={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},yv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=yv[e])?!!t[e]:!1}function ju(){return wv}var _v=he({},ti,{key:function(e){if(e.key){var t=gv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Qi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?vv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ju,charCode:function(e){return e.type==="keypress"?Qi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Qi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),xv=et(_v),bv=he({},qa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yc=et(bv),kv=he({},ti,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ju}),Sv=et(kv),Ev=he({},Fn,{propertyName:0,elapsedTime:0,pseudoElement:0}),jv=et(Ev),Cv=he({},qa,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Rv=et(Cv),Tv=[9,13,27,32],Cu=Vt&&"CompositionEvent"in window,gs=null;Vt&&"documentMode"in document&&(gs=document.documentMode);var Nv=Vt&&"TextEvent"in window&&!gs,If=Vt&&(!Cu||gs&&8<gs&&11>=gs),Xc=" ",Zc=!1;function $f(e,t){switch(e){case"keyup":return Tv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var pn=!1;function Pv(e,t){switch(e){case"compositionend":return Uf(t);case"keypress":return t.which!==32?null:(Zc=!0,Xc);case"textInput":return e=t.data,e===Xc&&Zc?null:e;default:return null}}function Av(e,t){if(pn)return e==="compositionend"||!Cu&&$f(e,t)?(e=Lf(),Gi=Su=cr=null,pn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return If&&t.locale!=="ko"?null:t.data;default:return null}}var Ov={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ed(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ov[e.type]:t==="textarea"}function Mf(e,t,r,n){mf(n),t=ga(t,"onChange"),0<t.length&&(r=new Eu("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var vs=null,Ls=null;function Lv(e){Gf(e,0)}function Ha(e){var t=vn(e);if(lf(t))return e}function Iv(e,t){if(e==="change")return t}var Df=!1;if(Vt){var So;if(Vt){var Eo="oninput"in document;if(!Eo){var td=document.createElement("div");td.setAttribute("oninput","return;"),Eo=typeof td.oninput=="function"}So=Eo}else So=!1;Df=So&&(!document.documentMode||9<document.documentMode)}function rd(){vs&&(vs.detachEvent("onpropertychange",Bf),Ls=vs=null)}function Bf(e){if(e.propertyName==="value"&&Ha(Ls)){var t=[];Mf(t,Ls,e,wu(e)),wf(Lv,t)}}function $v(e,t,r){e==="focusin"?(rd(),vs=t,Ls=r,vs.attachEvent("onpropertychange",Bf)):e==="focusout"&&rd()}function Uv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ha(Ls)}function Mv(e,t){if(e==="click")return Ha(t)}function Dv(e,t){if(e==="input"||e==="change")return Ha(t)}function Bv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var kt=typeof Object.is=="function"?Object.is:Bv;function Is(e,t){if(kt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var s=r[n];if(!Zo.call(t,s)||!kt(e[s],t[s]))return!1}return!0}function nd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function sd(e,t){var r=nd(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=nd(r)}}function zf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?zf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ff(){for(var e=window,t=ua();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ua(e.document)}return t}function Ru(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function zv(e){var t=Ff(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&zf(r.ownerDocument.documentElement,r)){if(n!==null&&Ru(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,i=Math.min(n.start,s);n=n.end===void 0?i:Math.min(n.end,s),!e.extend&&i>n&&(s=n,n=i,i=s),s=sd(r,i);var a=sd(r,n);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>n?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Fv=Vt&&"documentMode"in document&&11>=document.documentMode,mn=null,yl=null,ys=null,wl=!1;function id(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;wl||mn==null||mn!==ua(n)||(n=mn,"selectionStart"in n&&Ru(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focu
vendor: 4,383 bytes, line 38
38sNode:n.focusNode,focusOffset:n.focusOffset}),ys&&Is(ys,n)||(ys=n,n=ga(yl,"onSelect"),0<n.length&&(t=new Eu("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=mn)))}function Si(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var gn={animationend:Si("Animation","AnimationEnd"),animationiteration:Si("Animation","AnimationIteration"),animationstart:Si("Animation","AnimationStart"),transitionend:Si("Transition","TransitionEnd")},jo={},qf={};Vt&&(qf=document.createElement("div").style,"AnimationEvent"in window||(delete gn.animationend.animation,delete gn.animationiteration.animation,delete gn.animationstart.animation),"TransitionEvent"in window||delete gn.transitionend.transition);function Wa(e){if(jo[e])return jo[e];if(!gn[e])return e;var t=gn[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in qf)return jo[e]=t[r];return e}var Hf=Wa("animationend"),Wf=Wa("animationiteration"),Vf=Wa("animationstart"),Kf=Wa("transitionend"),Jf=new Map,ad="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function kr(e,t){Jf.set(e,t),Kr(t,[e])}for(var Co=0;Co<ad.length;Co++){var Ro=ad[Co],qv=Ro.toLowerCase(),Hv=Ro[0].toUpperCase()+Ro.slice(1);kr(qv,"on"+Hv)}kr(Hf,"onAnimationEnd");kr(Wf,"onAnimationIteration");kr(Vf,"onAnimationStart");kr("dblclick","onDoubleClick");kr("focusin","onFocus");kr("focusout","onBlur");kr(Kf,"onTransitionEnd");On("onMouseEnter",["mouseout","mouseover"]);On("onMouseLeave",["mouseout","mouseover"]);On("onPointerEnter",["pointerout","pointerover"]);On("onPointerLeave",["pointerout","pointerover"]);Kr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Kr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Kr("onBeforeInput",["compositionend","keypress","textInput","paste"]);Kr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Kr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Kr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ds="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Wv=new Set("cancel close invalid load scroll toggle".split(" ").concat(ds));function od(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,qg(n,t,void 0,e),e.currentTarget=null}function Gf(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],s=n.event;n=n.listeners;e:{var i=void 0;if(t)for(var a=n.length-1;0<=a;a--){var o=n[a],u=o.instance,c=o.currentTarget;if(o=o.listener,u!==i&&s.isPropagationStopped())break e;od(s,o,c),i=u}else for(a=0;a<n.length;a++){if(o=n[a],u=o.instance,c=o.currentTarget,o=o.listener,u!==i&&s.isPropagationStopped())break e;od(s,o,c),i=u}}}if(da)throw e=pl,da=!1,pl=null,e}function se(e,t){var r=t[Sl];r===void 0&&(r=t[Sl]=new Set);var n=e+"__bubble";r.has(n)||(Qf(t,e,2,!1),r.add(n))}function To(e,t,r){var n=0;t&&(n|=4),Qf(r,e,n,t)}var Ei="_reactListening"+Math.random().toString(36).slice(2);function $s(e){if(!e[Ei]){e[Ei]=!0,rf.forEach(function(r){r!=="selectionchange"&&(Wv.has(r)||To(r,!1,e),To(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ei]||(t[Ei]=!0,To("selectionchange",!1,t))}}function Qf(e,t,r,n){switch(Of(t)){case 1:var s=iv;break;case 4:s=av;break;default:s=ku}r=s.bind(null,t,r,e),s=void 0,!fl||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,r,{capture:!0,passive:s}):e.addEventListener(t,r,!0):s!==void 0?e.addEventListener(t,r,{passive:s}):e.addEventListener(t,r,!1)}function No(e,t,r,n,s){var i=n;
vendor: 22,731 bytes, lines 38-39
38if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var a=n.tag;if(a===3||a===4){var o=n.stateNode.containerInfo;if(o===s||o.nodeType===8&&o.parentNode===s)break;if(a===4)for(a=n.return;a!==null;){var u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===s||u.nodeType===8&&u.parentNode===s))return;a=a.return}for(;o!==null;){if(a=Lr(o),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}o=o.parentNode}}n=n.return}wf(function(){var c=i,d=wu(r),h=[];e:{var f=Jf.get(e);if(f!==void 0){var p=Eu,y=e;switch(e){case"keypress":if(Qi(r)===0)break e;case"keydown":case"keyup":p=xv;break;case"focusin":y="focus",p=ko;break;case"focusout":y="blur",p=ko;break;case"beforeblur":case"afterblur":p=ko;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Gc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=uv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Sv;break;case Hf:case Wf:case Vf:p=hv;break;case Kf:p=jv;break;case"scroll":p=ov;break;case"wheel":p=Rv;break;case"copy":case"cut":case"paste":p=pv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Yc}var w=(t&4)!==0,x=!w&&e==="scroll",m=w?f!==null?f+"Capture":null:f;w=[];for(var g=c,v;g!==null;){v=g;var b=v.stateNode;if(v.tag===5&&b!==null&&(v=b,m!==null&&(b=Ns(g,m),b!=null&&w.push(Us(g,b,v)))),x)break;g=g.return}0<w.length&&(f=new p(f,y,null,r,d),h.push({event:f,listeners:w}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==dl&&(y=r.relatedTarget||r.fromElement)&&(Lr(y)||y[Kt]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(y=r.relatedTarget||r.toElement,p=c,y=y?Lr(y):null,y!==null&&(x=Jr(y),y!==x||y.tag!==5&&y.tag!==6)&&(y=null)):(p=null,y=c),p!==y)){if(w=Gc,b="onMouseLeave",m="onMouseEnter",g="mouse",(e==="pointerout"||e==="pointerover")&&(w=Yc,b="onPointerLeave",m="onPointerEnter",g="pointer"),x=p==null?f:vn(p),v=y==null?f:vn(y),f=new w(b,g+"leave",p,r,d),f.target=x,f.relatedTarget=v,b=null,Lr(d)===c&&(w=new w(m,g+"enter",y,r,d),w.target=v,w.relatedTarget=x,b=w),x=b,p&&y)t:{for(w=p,m=y,g=0,v=w;v;v=Zr(v))g++;for(v=0,b=m;b;b=Zr(b))v++;for(;0<g-v;)w=Zr(w),g--;for(;0<v-g;)m=Zr(m),v--;for(;g--;){if(w===m||m!==null&&w===m.alternate)break t;w=Zr(w),m=Zr(m)}w=null}else w=null;p!==null&&ld(h,f,p,w,!1),y!==null&&x!==null&&ld(h,x,y,w,!0)}}e:{if(f=c?vn(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var E=Iv;else if(ed(f))if(Df)E=Dv;else{E=Uv;var S=$v}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(E=Mv);if(E&&(E=E(e,c))){Mf(h,E,r,d);break e}S&&S(e,f,c),e==="focusout"&&(S=f._wrapperState)&&S.controlled&&f.type==="number"&&al(f,"number",f.value)}switch(S=c?vn(c):window,e){case"focusin":(ed(S)||S.contentEditable==="true")&&(mn=S,yl=c,ys=null);break;case"focusout":ys=yl=mn=null;break;case"mousedown":wl=!0;break;case"contextmenu":case"mouseup":case"dragend":wl=!1,id(h,r,d);break;case"selectionchange":if(Fv)break;case"keydown":case"keyup":id(h,r,d)}var j;if(Cu)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else pn?$f(e,r)&&(P="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(P="onCompositionStart");P&&(If&&r.locale!=="ko"&&(pn||P!=="onCompositionStart"?P==="onCompositionEnd"&&pn&&(j=Lf()):(cr=d,Su="value"in cr?cr.value:cr.textContent,pn=!0)),S=ga(c,P),0<S.length&&(P=new Qc(P,e,null,r,d),h.push({event:P,listeners:S}),j?P.data=j:(j=Uf(r),j!==null&&(P.data=j)))),(j=Nv?Pv(e,r):Av(e,r))&&(c=ga(c,"onBeforeInput"),0<c.length&&(d=new Qc("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:c}),d.data=j))}Gf(h,t)})}function Us(e,t,r){return{instance:e,listener:t,currentTarget:r}}function ga(e,t){for(var r=t+"Capture",n=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Ns(e,r),i!=null&&n.unshift(Us(e,i,s)),i=Ns(e,t),i!=null&&n.push(Us(e,i,s))),e=e.return}return n}function Zr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function ld(e,t,r,n,s){for(var i=t._reactName,a=[];r!==null&&r!==n;){var o=r,u=o.alternate,c=o.stateNode;if(u!==null&&u===n)break;o.tag===5&&c!==null&&(o=c,s?(u=Ns(r,i),u!=null&&a.unshift(Us(r,u,o))):s||(u=Ns(r,i),u!=null&&a.push(Us(r,u,o)))),r=r.return}a.length!==0&&e.push({event:t,listeners:a})}var Vv=/\r\n?/g,Kv=/\u0000|\uFFFD/g;function ud(e){return(typeof e=="string"?e:""+e).replace(Vv,` 39`).replace(Kv,"")}function ji(e,t,r){if(t=ud(t),ud(e)!==t&&r)throw Error(A(425))}function va(){}var _l=null,xl=null;function bl(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var kl=typeof setTimeout=="function"?setTimeout:void 0,Jv=typeof clearTimeout=="function"?clearTimeout:void 0,cd=typeof Promise=="function"?Promise:void 0,Gv=typeof queueMicrotask=="function"?queueMicrotask:typeof cd<"u"?function(e){return cd.resolve(null).then(e).catch(Qv)}:kl;function Qv(e){setTimeout(function(){throw e})}function Po(e,t){var r=t,n=0;do{var s=r.nextSibling;if(e.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(n===0){e.removeChild(s),Os(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);Os(t)}function gr(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function dd(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var qn=Math.random().toString(36).slice(2),Pt="__reactFiber$"+qn,Ms="__reactProps$"+qn,Kt="__reactContainer$"+qn,Sl="__reactEvents$"+qn,Yv="__reactListeners$"+qn,Xv="__reactHandles$"+qn;function Lr(e){var t=e[Pt];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Kt]||r[Pt]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=dd(e);e!==null;){if(r=e[Pt])return r;e=dd(e)}return t}e=r,r=e.parentNode}return null}function ri(e){return e=e[Pt]||e[Kt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function vn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(A(33))}function Va(e){return e[Ms]||null}var El=[],yn=-1;function Sr(e){return{current:e}}function ie(e){0>yn||(e.current=El[yn],El[yn]=null,yn--)}function re(e,t){yn++,El[yn]=e.current,e.current=t}var br={},Ae=Sr(br),He=Sr(!1),Fr=br;function Ln(e,t){var r=e.type.contextTypes;if(!r)return br;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in r)s[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function We(e){return e=e.childContextTypes,e!=null}function ya(){ie(He),ie(Ae)}function hd(e,t,r){if(Ae.current!==br)throw Error(A(168));re(Ae,t),re(He,r)}function Yf(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in t))throw Error(A(108,$g(e)||"Unknown",s));return he({},r,n)}function wa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||br,Fr=Ae.current,re(Ae,e),re(He,He.current),!0}function fd(e,t,r){var n=e.stateNode;if(!n)throw Error(A(169));r?(e=Yf(e,t,Fr),n.__reactInternalMemoizedMergedChildContext=e,ie(He),ie(Ae),re(Ae,e)):ie(He),re(He,r)}var zt=null,Ka=!1,Ao=!1;function Xf(e){zt===null?zt=[e]:zt.push(e)}function Zv(e){Ka=!0,Xf(e)}function Er(){if(!Ao&&zt!==null){Ao=!0;var e=0,t=X;try{var r=zt;for(X=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}zt=null,Ka=!1}catch(s){throw zt!==null&&(zt=zt.slice(e+1)),kf(_u,Er),s}finally{X=t,Ao=!1}}return null}var wn=[],_n=0,_a=null,xa=0,rt=[],nt=0,qr=null,qt=1,Ht="";function Pr(e,t){wn[_n++]=xa,wn[_n++]=_a,_a=e,xa=t}function Zf(e,t,r){rt[nt++]=qt,rt[nt++]=Ht,rt[nt++]=qr,qr=e;var n=qt;e=Ht;var s=32-_t(n)-1;n&=~(1<<s),r+=1;var i=32-_t(t)+s;if(30<i){var a=s-s%5;i=(n&(1<<a)-1).toString(32),n>>=a,s-=a,qt=1<<32-_t(t)+s|r<<s|n,Ht=i+e}else qt=1<<i|r<<s|n,Ht=e}function Tu(e){e.return!==null&&(Pr(e,1),Zf(e,1,0))}function Nu(e){for(;e===_a;)_a=wn[--_n],wn[_n]=null,xa=wn[--_n],wn[_n]=null;for(;e===qr;)qr=rt[--nt],rt[nt]=null,Ht=rt[--nt],rt[nt]=null,qt=rt[--nt],rt[nt]=null}var Ye=null,Qe=null,le=!1,yt=null;function ep(e,t){var r=it(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function pd(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Ye=e,Qe=gr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Ye=e,Qe=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=qr!==null?{id:qt,overflow:Ht}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=it(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,Ye=e,Qe=null,!0):!1;default:return!1}}function jl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Cl(e){if(le){var t=Qe;if(t){var r=t;if(!pd(e,t)){if(jl(e))throw Error(A(418));t=gr(r.nextSibling);var n=Ye;t&&pd(e,t)?ep(n,r):(e.flags=e.flags&-4097|2,le=!1,Ye=e)}}else{if(jl(e))throw Error(A(418));e.flags=e.flags&-4097|2,le=!1,Ye=e}}}function md(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ye=e}function Ci(e){if(e!==Ye)return!1;if(!le)return md(e),le=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!bl(e.type,e.memoizedProps)),t&&(t=Qe)){if(jl(e))throw tp(),Error(A(418));for(;t;)ep(e,t),t=gr(t.nextSibling)}if(md(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(A(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Qe=gr(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Qe=null}}else Qe=Ye?gr(e.stateNode.nextSibling):null;return!0}function tp(){for(var e=Qe;e;)e=gr(e.nextSibling)}function In(){Qe=Ye=null,le=!1}function Pu(e){yt===null?yt=[e]:yt.push(e)}var ey=Yt.ReactCurrentBatchConfig;function es(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(A(309));var n=r.stateNode}if(!n)throw Error(A(147,e));var s=n,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var o=s.refs;a===null?delete o[i]:o[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(A(284));if(!r._owner)throw Error(A(290,e))}return e}function Ri(e,t){throw e=Object.prototype.toString.call(t),Error(A(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function gd(e){var t=e._init;return t(e._payload)}function rp(e){function t(m,g){if(e){var v=m.deletions;v===null?(m.deletions=[g],m.flags|=16):v.push(g)}}function r(m,g){if(!e)return null;for(;g!==null;)t(m,g),g=g.sibling;return null}function n(m,g){for(m=new Map;g!==null;)g.key!==null?m.set(g.key,g):m.set(g.index,g),g=g.sibling;return m}function s(m,g){return m=_r(m,g),m.index=0,m.sibling=null,m}function i(m,g,v){return m.index=v,e?(v=m.alternate,v!==null?(v=v.index,v<g?(m.flags|=2,g):v):(m.flags|=2,g)):(m.flags|=1048576,g)}function a(m){return e&&m.alternate===null&&(m.flags|=2),m}function o(m,g,v,b){return g===null||g.tag!==6?(g=Do(v,m.mode,b),g.return=m,g):(g=s(g,v),g.return=m,g)}function u(m,g,v,b){var E=v.type;return E===fn?d(m,g,v.props.children,b,v.key):g!==null&&(g.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===sr&&gd(E)===g.type)?(b=s(g,v.props),b.ref=es(m,g,v),b.return=m,b):(b=na(v.type,v.key,v.props,null,m.mode,b),b.ref=es(m,g,v),b.return=m,b)}function c(m,g,v,b){return g===null||g.tag!==4||g.stateNode.containerInfo!==v.containerInfo||g.stateNode.implementation!==v.implementation?(g=Bo(v,m.mode,b),g.return=m,g):(g=s(g,v.children||[]),g.return=m,g)}function d(m,g,v,b,E){return g===null||g.tag!==7?(g=Br(v,m.mode,b,E),g.return=m,g):(g=s(g,v),g.return=m,g)}function h(m,g,v){if(typeof g=="string"&&g!==""||typeof g=="number")return g=Do(""+g,m.mode,v),g.return=m,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case vi:return v=na(g.type,g.key,g.props,null,m.mode,v),v.ref=es(m,null,g),v.return=m,v;case hn:return g=Bo(g,m.mode,v),g.return=m,g;case sr:var b=g._init;return h(m,b(g._payload),v)}if(us(g)||Gn(g))return g=Br(g,m.mode,v,null),g.return=m,g;Ri(m,g)}return null}function f(m,g,v,b){var E=g!==null?g.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return E!==null?null:o(m,g,""+v,b);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case vi:return v.key===E?u(m,g,v,b):null;case hn:return v.key===E?c(m,g,v,b):null;case sr:return E=v._init,f(m,g,E(v._payload),b)}if(us(v)||Gn(v))return E!==null?null:d(m,g,v,b,null);Ri(m,v)}return null}function p(m,g,v,b,E){if(typeof b=="string"&&b!==""||typeof b=="number")return m=m.get(v)||null,o(g,m,""+b,E);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case vi:return m=m.get(b.key===null?v:b.key)||null,u(g,m,b,E);case hn:return m=m.get(b.key===null?v:b.key)||null,c(g,m,b,E);case sr:var S=b._init;return p(m,g,v,S(b._payload),E)}if(us(b)||Gn(b))return m=m.get(v)||null,d(g,m,b,E,null);Ri(g,b)}return null}function y(m,g,v,b){for(var E=null,S=null,j=g,P=g=0,C=null;j!==null&&P<v.length;P++){j.index>P?(C=j,j=null):C=j.sibling;var N=f(m,j,v[P],b);if(N===null){j===null&&(j=C);break}e&&j&&N.alternate===null&&t(m,j),g=i(N,g,P),S===null?E=N:S.sibling=N,S=N,j=C}if(P===v.length)return r(m,j),le&&Pr(m,P),E;if(j===null){for(;P<v.length;P++)j=h(m,v[P],b),j!==null&&(g=i(j,g,P),S===null?E=j:S.sibling=j,S=j);return le&&Pr(m,P),E}for(j=n(m,j);P<v.length;P++)C=p(j,m,P,v[P],b),C!==null&&(e&&C.alternate!==null&&j.delete(C.key===null?P:C.key),g=i(C,g,P),S===null?E=C:S.sibling=C,S=C);return e&&j.forEach(function(B){return t(m,B)}),le&&Pr(m,P),E}function w(m,g,v,b){var E=Gn(v);if(typeof E!="function")throw Error(A(150));if(v=E.call(v),v==null)throw Error(A(151));for(var S=E=null,j=g,P=g=0,C=null,N=v.next();j!==null&&!N.done;P++,N=v.next()){j.index>P?(C=j,j=null):C=j.sibling;var B=f(m,j,N.value,b);if(B===null){j===null&&(j=C);break}e&&j&&B.alternate===null&&t(m,j),g=i(B,g,P),S===null?E=B:S.sibling=B,S=B,j=C}if(N.done)return r(m,j),le&&Pr(m,P),E;if(j===null){for(;!N.done;P++,N=v.next())N=h(m,N.value,b),N!==null&&(g=i(N,g,P),S===null?E=N:S.sibling=N,S=N);return le&&Pr(m,P),E}for(j=n(m,j);!N.done;P++,N=v.next())N=p(j,m,P,N.value,b),N!==null&&(e&&N.alternate!==null&&j.delete(N.key===null?P:N.key),g=i(N,g,P),S===null?E=N:S.sibling=N,S=N);return e&&j.forEach(function(I){return t(m,I)}),le&&Pr(m,P),E}function x(m,g,v,b){if(typeof v=="object"&&v!==null&&v.type===fn&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case vi:e:{for(var E=v.key,S=g;S!==null;){if(S.key===E){if(E=v.type,E===fn){if(S.tag===7){r(m,S.sibling),g=s(S,v.props.children),g.return=m,m=g;break e}}else if(S.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===sr&&gd(E)===S.type){r(m,S.sibling),g=s(S,v.props),g.ref=es(m,S,v),g.return=m,m=g;break e}r(m,S);break}else t(m,S);S=S.sibling}v.type===fn?(g=Br(v.props.children,m.mode,b,v.key),g.return=m,m=g):(b=na(v.type,v.key,v.props,null,m.mode,b),b.ref=es(m,g,v),b.return=m,m=b)}return a(m);case hn:e:{for(S=v.key;g!==null;){if(g.key===S)if(g.tag===4&&g.stateNode.containerInfo===v.containerInfo&&g.stateNode.implementation===v.implementation){r(m,g.sibling),g=s(g,v.children||[]),g.return=m,m=g;break e}else{r(m,g);break}else t(m,g);g=g.sibling}g=Bo(v,m.mode,b),g.return=m,m=g}return a(m);case sr:return S=v._init,x(m,g,S(v._payload),b)}if(us(v))return y(m,g,v,b);if(Gn(v))return w(m,g,v,b);Ri(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,g!==null&&g.tag===6?(r(m,g.sibling),g=s(g,v),g.return=m,m=g):(r(m,g),g=Do(v,m.mode,b),g.return=m,m=g),a(m)):r(m,g)}return x}var $n=rp(!0),np=rp(!1),ba=Sr(null),ka=null,xn=null,Au=null;function Ou(){Au=xn=ka=null}function Lu(e){var t=ba.current;ie(ba),e._currentValue=t}function Rl(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Nn(e,t){ka=e,Au=xn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(qe=!0),e.firstContext=null)}function ot(e){var t=e._currentValue;if(Au!==e)if(e={context:e,memoizedValue:t,next:null},xn===null){if(ka===null)throw Error(A(308));xn=e,ka.dependencies={lanes:0,firstContext:e}}else xn=xn.next=e;return t}var Ir=null;function Iu(e){Ir===null?Ir=[e]:Ir.push(e)}function sp(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,Iu(t)):(r.next=s.next,s.next=r),t.interleaved=r,Jt(e,n)}function Jt(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var ir=!1;function $u(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ip(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Wt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function vr(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Q&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,Jt(e,r)}return s=n.interleaved,s===null?(t.next=t,Iu(n)):(t.next=s.next,s.next=t),n.interleaved=t,Jt(e,r)}function Yi(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,xu(e,r)}}function vd(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var a={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?s=i=a:i=i.next=a,r=r.next}while(r!==null);i===null?s=i=t:i=i.next=t}else s=i=t;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Sa(e,t,r,n){var s=e.updateQueue;ir=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var u=o,c=u.next;u.next=null,a===null?i=c:a.next=c,a=u;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=c:o.next=c,d.lastBaseUpdate=u))}if(i!==null){var h=s.baseState;a=0,d=c=u=null,o=i;do{var f=o.lane,p=o.eventTime;if((n&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var y=e,w=o;switch(f=t,p=r,w.tag){case 1:if(y=w.payload,typeof y=="function"){h=y.call(p,h,f);break e}h=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=w.payload,f=typeof y=="function"?y.call(p,h,f):y,f==null)break e;h=he({},h,f);break e;case 2:ir=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[o]:f.push(o))}else p={eventTime:p,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(c=d=p,u=h):d=d.next=p,a|=f;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;f=o,o=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(u=h),s.baseState=u,s.firstBaseUpdate=c,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Wr|=a,e.lanes=a,e.memoizedState=h}}function yd(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],s=n.callback;if(s!==null){if(n.callback=null,n=r,typeof s!="function")throw Error(A(191,s));s.call(n)}}}var ni={},Ot=Sr(ni),Ds=Sr(ni),Bs=Sr(ni);function $r(e){if(e===ni)throw Error(A(174));return e}function Uu(e,t){switch(re(Bs,t),re(Ds,e),re(Ot,ni),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ll(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ll(t,e)}ie(Ot),re(Ot,t)}function Un(){ie(Ot),ie(Ds),ie(Bs)}function ap(e){$r(Bs.current);var t=$r(Ot.current),r=ll(t,e.type);t!==r&&(re(Ds,e),re(Ot,r))}function Mu(e){Ds.current===e&&(ie(Ot),ie(Ds))}var ue=Sr(0);function Ea(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Oo=[];function Du(){for(var e=0;e<Oo.length;e++)Oo[e]._workInProgressVersionPrimary=null;Oo.length=0}var Xi=Yt.ReactCurrentDispatcher,Lo=Yt.ReactCurrentBatchConfig,Hr=0,ce=null,ye=null,xe=null,ja=!1,ws=!1,zs=0,ty=0;function Te(){throw Error(A(321))}function Bu(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!kt(e[r],t[r]))return!1;return!0}function zu(e,t,r,n,s,i){if(Hr=i,ce=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Xi.current=e===null||e.memoizedState===null?iy:ay,e=r(n,s),ws){i=0;do{if(ws=!1,zs=0,25<=i)throw Error(A(301));i+=1,xe=ye=null,t.updateQueue=null,Xi.current=oy,e=r(n,s)}while(ws)}if(Xi.current=Ca,t=ye!==null&&ye.next!==null,Hr=0,xe=ye=ce=null,ja=!1,t)throw Error(A(300));return e}function Fu(){var e=zs!==0;return zs=0,e}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xe===null?ce.memoizedState=xe=e:xe=xe.next=e,xe}function lt(){if(ye===null){var e=ce.alternate;e=e!==null?e.memoizedState:null}else e=ye.next;var t=xe===null?ce.memoizedState:xe.next;if(t!==null)xe=t,ye=e;else{if(e===null)throw Error(A(310));ye=e,e={memoizedState:ye.memoizedState,baseState:ye.baseState,baseQueue:ye.baseQueue,queue:ye.queue,next:null},xe===null?ce.memoizedState=xe=e:xe=xe.next=e}return xe}function Fs(e,t){return typeof t=="function"?t(e):t}function Io(e){var t=lt(),r=t.queue;if(r===null)throw Error(A(311));r.lastRenderedReducer=e;
vendor: 5,685 bytes, line 39
39var n=ye,s=n.baseQueue,i=r.pending;if(i!==null){if(s!==null){var a=s.next;s.next=i.next,i.next=a}n.baseQueue=s=i,r.pending=null}if(s!==null){i=s.next,n=n.baseState;var o=a=null,u=null,c=i;do{var d=c.lane;if((Hr&d)===d)u!==null&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),n=c.hasEagerState?c.eagerState:e(n,c.action);else{var h={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};u===null?(o=u=h,a=n):u=u.next=h,ce.lanes|=d,Wr|=d}c=c.next}while(c!==null&&c!==i);u===null?a=n:u.next=o,kt(n,t.memoizedState)||(qe=!0),t.memoizedState=n,t.baseState=a,t.baseQueue=u,r.lastRenderedState=n}if(e=r.interleaved,e!==null){s=e;do i=s.lane,ce.lanes|=i,Wr|=i,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function $o(e){var t=lt(),r=t.queue;if(r===null)throw Error(A(311));r.lastRenderedReducer=e;var n=r.dispatch,s=r.pending,i=t.memoizedState;if(s!==null){r.pending=null;var a=s=s.next;do i=e(i,a.action),a=a.next;while(a!==s);kt(i,t.memoizedState)||(qe=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),r.lastRenderedState=i}return[i,n]}function op(){}function lp(e,t){var r=ce,n=lt(),s=t(),i=!kt(n.memoizedState,s);if(i&&(n.memoizedState=s,qe=!0),n=n.queue,qu(dp.bind(null,r,n,e),[e]),n.getSnapshot!==t||i||xe!==null&&xe.memoizedState.tag&1){if(r.flags|=2048,qs(9,cp.bind(null,r,n,s,t),void 0,null),be===null)throw Error(A(349));Hr&30||up(r,t,s)}return s}function up(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ce.updateQueue,t===null?(t={lastEffect:null,stores:null},ce.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function cp(e,t,r,n){t.value=r,t.getSnapshot=n,hp(t)&&fp(e)}function dp(e,t,r){return r(function(){hp(t)&&fp(e)})}function hp(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!kt(e,r)}catch{return!0}}function fp(e){var t=Jt(e,1);t!==null&&xt(t,e,1,-1)}function wd(e){var t=Rt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:e},t.queue=e,e=e.dispatch=sy.bind(null,ce,e),[t.memoizedState,e]}function qs(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=ce.updateQueue,t===null?(t={lastEffect:null,stores:null},ce.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function pp(){return lt().memoizedState}function Zi(e,t,r,n){var s=Rt();ce.flags|=e,s.memoizedState=qs(1|t,r,void 0,n===void 0?null:n)}function Ja(e,t,r,n){var s=lt();n=n===void 0?null:n;var i=void 0;if(ye!==null){var a=ye.memoizedState;if(i=a.destroy,n!==null&&Bu(n,a.deps)){s.memoizedState=qs(t,r,i,n);return}}ce.flags|=e,s.memoizedState=qs(1|t,r,i,n)}function _d(e,t){return Zi(8390656,8,e,t)}function qu(e,t){return Ja(2048,8,e,t)}function mp(e,t){return Ja(4,2,e,t)}function gp(e,t){return Ja(4,4,e,t)}function vp(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function yp(e,t,r){return r=r!=null?r.concat([e]):null,Ja(4,4,vp.bind(null,t,e),r)}function Hu(){}function wp(e,t){var r=lt();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Bu(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function _p(e,t){var r=lt();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Bu(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function xp(e,t,r){return Hr&21?(kt(r,t)||(r=jf(),ce.lanes|=r,Wr|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,qe=!0),e.memoizedState=r)}function ry(e,t){var r=X;X=r!==0&&4>r?r:4,e(!0);var n=Lo.transition;Lo.transition={};try{e(!1),t()}finally{X=r,Lo.transition=n}}function bp(){return lt().memoizedState}function ny(e,t,r){var n=wr(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},kp(e))Sp(t,r);else if(r=sp(e,t,r,n),r!==null){var s=$e();xt(r,e,n,s),Ep(r,t,n)}}function sy(e,t,r){var n=wr(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(kp(e))Sp(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,o=i(a,r);if(s.hasEagerState=!0,s.eagerState=o,kt(o,a)){var u=t.interleaved;u===null?(s.next=s,Iu(t)):(s.next=u.next,u.next=s),t.interleaved=s;return}}catch{}finally{}r=sp(e,t,s,n),r!==null&&(s=$e(),xt(r,e,n,s),Ep(r,t,n))}}function kp(e){var t=e.alternate;return e===ce||t!==null&&t===ce}function Sp(e,t){ws=ja=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Ep(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,xu(e,r)}}var Ca={readContext:ot,useCallback:Te,useContext:Te,useEffect:Te,useImperativeHandle:Te,useInsertionEffect:Te,useLayoutEffect:Te,useMemo:Te,useReducer:Te,useRef:Te,useState:Te,useDebugValue:Te,useDeferredValue:Te,useTransition:Te,useMutableSource:Te,useSyncExternalStore:Te,useId:Te,unstable_isNewReconciler:!1},iy={readContext:ot,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:ot,useEffect:_d,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Zi(4194308,4,vp.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Zi(4194308,4,e,t)},useInsertionEffect:function(e,t){return Zi(4,2,e,t)},useMemo:function(e,t){var r=Rt();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Rt();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=ny.bind(null,ce,e),[n.memoizedState,e]}
vendor: 5,876 bytes, lines 39-41
39,useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:wd,useDebugValue:Hu,useDeferredValue:function(e){return Rt().memoizedState=e},useTransition:function(){var e=wd(!1),t=e[0];return e=ry.bind(null,e[1]),Rt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ce,s=Rt();if(le){if(r===void 0)throw Error(A(407));r=r()}else{if(r=t(),be===null)throw Error(A(349));Hr&30||up(n,t,r)}s.memoizedState=r;var i={value:r,getSnapshot:t};return s.queue=i,_d(dp.bind(null,n,i,e),[e]),n.flags|=2048,qs(9,cp.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=Rt(),t=be.identifierPrefix;if(le){var r=Ht,n=qt;r=(n&~(1<<32-_t(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=zs++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=ty++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ay={readContext:ot,useCallback:wp,useContext:ot,useEffect:qu,useImperativeHandle:yp,useInsertionEffect:mp,useLayoutEffect:gp,useMemo:_p,useReducer:Io,useRef:pp,useState:function(){return Io(Fs)},useDebugValue:Hu,useDeferredValue:function(e){var t=lt();return xp(t,ye.memoizedState,e)},useTransition:function(){var e=Io(Fs)[0],t=lt().memoizedState;return[e,t]},useMutableSource:op,useSyncExternalStore:lp,useId:bp,unstable_isNewReconciler:!1},oy={readContext:ot,useCallback:wp,useContext:ot,useEffect:qu,useImperativeHandle:yp,useInsertionEffect:mp,useLayoutEffect:gp,useMemo:_p,useReducer:$o,useRef:pp,useState:function(){return $o(Fs)},useDebugValue:Hu,useDeferredValue:function(e){var t=lt();return ye===null?t.memoizedState=e:xp(t,ye.memoizedState,e)},useTransition:function(){var e=$o(Fs)[0],t=lt().memoizedState;return[e,t]},useMutableSource:op,useSyncExternalStore:lp,useId:bp,unstable_isNewReconciler:!1};function mt(e,t){if(e&&e.defaultProps){t=he({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Tl(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:he({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Ga={isMounted:function(e){return(e=e._reactInternals)?Jr(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=$e(),s=wr(e),i=Wt(n,s);i.payload=t,r!=null&&(i.callback=r),t=vr(e,i,s),t!==null&&(xt(t,e,s,n),Yi(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=$e(),s=wr(e),i=Wt(n,s);i.tag=1,i.payload=t,r!=null&&(i.callback=r),t=vr(e,i,s),t!==null&&(xt(t,e,s,n),Yi(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=$e(),n=wr(e),s=Wt(r,n);s.tag=2,t!=null&&(s.callback=t),t=vr(e,s,n),t!==null&&(xt(t,e,n,r),Yi(t,e,n))}};function xd(e,t,r,n,s,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,a):t.prototype&&t.prototype.isPureReactComponent?!Is(r,n)||!Is(s,i):!0}function jp(e,t,r){var n=!1,s=br,i=t.contextType;return typeof i=="object"&&i!==null?i=ot(i):(s=We(t)?Fr:Ae.current,n=t.contextTypes,i=(n=n!=null)?Ln(e,s):br),t=new t(r,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ga,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function bd(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&Ga.enqueueReplaceState(t,t.state,null)}function Nl(e,t,r,n){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},$u(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=ot(i):(i=We(t)?Fr:Ae.current,s.context=Ln(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Tl(e,t,i,r),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Ga.enqueueReplaceState(s,s.state,null),Sa(e,r,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Mn(e,t){try{var r="",n=t;do r+=Ig(n),n=n.return;while(n);var s=r}catch(i){s=` 40Error generating stack: `+i.message+` 41`+i.stack}return{value:e,source:t,stack:s,digest:null}}function Uo(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Pl(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var ly=typeof WeakMap=="function"?WeakMap:Map;function Cp(e,t,r){r=Wt(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Ta||(Ta=!0,zl=n),Pl(e,t)},r}function Rp(e,t,r){r=Wt(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var s=t.value;r.payload=function(){return n(s)},r.callback=function(){Pl(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){Pl(e,t),typeof n!="function"&&(yr===null?yr=new Set([this]):yr.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),r}function kd(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new ly;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(r)||(s.add(r),e=by.bind(null,e,t,r),t.then(e,e))}function Sd(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Ed(e,t,r,n,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Wt(-1,1),t.tag=2,vr(r,t,1))),r.lanes|=1),e)}var uy=Yt.ReactCurrentOwner,qe=!1;function Ie(e,t,r,n){t.child=e===null?np(t,null,r,n):$n(t,e.child,r,n)}
vendor: 6,266 bytes, line 41
41function jd(e,t,r,n,s){r=r.render;var i=t.ref;return Nn(t,s),n=zu(e,t,r,n,i,s),r=Fu(),e!==null&&!qe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Gt(e,t,s)):(le&&r&&Tu(t),t.flags|=1,Ie(e,t,n,s),t.child)}function Cd(e,t,r,n,s){if(e===null){var i=r.type;return typeof i=="function"&&!Xu(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,Tp(e,t,i,n,s)):(e=na(r.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var a=i.memoizedProps;if(r=r.compare,r=r!==null?r:Is,r(a,n)&&e.ref===t.ref)return Gt(e,t,s)}return t.flags|=1,e=_r(i,n),e.ref=t.ref,e.return=t,t.child=e}function Tp(e,t,r,n,s){if(e!==null){var i=e.memoizedProps;if(Is(i,n)&&e.ref===t.ref)if(qe=!1,t.pendingProps=n=i,(e.lanes&s)!==0)e.flags&131072&&(qe=!0);else return t.lanes=e.lanes,Gt(e,t,s)}return Al(e,t,r,n,s)}function Np(e,t,r){var n=t.pendingProps,s=n.children,i=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},re(kn,Je),Je|=r;else{if(!(r&1073741824))return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,re(kn,Je),Je|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,re(kn,Je),Je|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,re(kn,Je),Je|=n;return Ie(e,t,s,r),t.child}function Pp(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Al(e,t,r,n,s){var i=We(r)?Fr:Ae.current;return i=Ln(t,i),Nn(t,s),r=zu(e,t,r,n,i,s),n=Fu(),e!==null&&!qe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Gt(e,t,s)):(le&&n&&Tu(t),t.flags|=1,Ie(e,t,r,s),t.child)}function Rd(e,t,r,n,s){if(We(r)){var i=!0;wa(t)}else i=!1;if(Nn(t,s),t.stateNode===null)ea(e,t),jp(t,r,n),Nl(t,r,n,s),n=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var u=a.context,c=r.contextType;typeof c=="object"&&c!==null?c=ot(c):(c=We(r)?Fr:Ae.current,c=Ln(t,c));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";h||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==n||u!==c)&&bd(t,a,n,c),ir=!1;var f=t.memoizedState;a.state=f,Sa(t,n,a,s),u=t.memoizedState,o!==n||f!==u||He.current||ir?(typeof d=="function"&&(Tl(t,r,d,n),u=t.memoizedState),(o=ir||xd(t,r,o,n,f,u,c))?(h||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=u),a.props=n,a.state=u,a.context=c,n=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{a=t.stateNode,ip(e,t),o=t.memoizedProps,c=t.type===t.elementType?o:mt(t.type,o),a.props=c,h=t.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=ot(u):(u=We(r)?Fr:Ae.current,u=Ln(t,u));var p=r.getDerivedStateFromProps;(d=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==h||f!==u)&&bd(t,a,n,u),ir=!1,f=t.memoizedState,a.state=f,Sa(t,n,a,s);var y=t.memoizedState;o!==h||f!==y||He.current||ir?(typeof p=="function"&&(Tl(t,r,p,n),y=t.memoizedState),(c=ir||xd(t,r,c,n,f,y,u)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,y,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,y,u)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=y),a.props=n,a.state=y,a.context=u,n=c):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),n=!1)}return Ol(e,t,r,n,i,s)}function Ol(e,t,r,n,s,i){Pp(e,t);var a=(t.flags&128)!==0;if(!n&&!a)return s&&fd(t,r,!1),Gt(e,t,i);n=t.stateNode,uy.current=t;var o=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&a?(t.child=$n(t,e.child,null,i),t.child=$n(t,null,o,i)):Ie(e,t,o,i),t.memoizedState=n.state,s&&fd(t,r,!0),t.child}function Ap(e){var t=e.stateNode;t.pendingContext?hd(e,t.pendingContext,t.pendingContext!==t.context):t.context&&hd(e,t.context,!1),Uu(e,t.containerInfo)}function Td(e,t,r,n,s){return In(),Pu(s),t.flags|=256,Ie(e,t,r,n),t.child}var Ll={dehydrated:null,treeContext:null,retryLane:0};function Il(e){return{baseLanes:e,cachePool:null,transitions:null}}function Op(e,t,r){var n=t.pendingProps,s=ue.current,i=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(s&2)!==0),o?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),re(ue,s&1),e===null)return Cl(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=n.children,e=n.fallback,i?(n=t.mode,i=t.child,a={mode:"hidden",children:a},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=Xa(a,n,0,null),e=Br(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Il(r),t.memoizedState=Ll,e):Wu(t,a));if(s=e.memoizedState,s!==null&&(o=s.dehydrated,o!==null))return cy(e,t,a,n,o,s,r);if(i){i=n.fallback,a=t.mode,s=e.child,o=s.sibling;var u={mode:"hidden",children:n.children};return!(a&1)&&t.child!==s?(n=t.child,n.childLanes=0,n.pendingProps=u,t.deletions=null):(n=_r(s,u),n.subtreeFlags=s.subtreeFlags&14680064),o!==null?i=_r(o,i):(i=Br(i,a,r,null),i.flags|=2),i.return=t,n.return=t,n.sibling=i,t.child=n,n=i,i=t.child,a=e.child.memoizedState,a=a===null?Il(r):{base
vendor: 7,641 bytes, line 41
41Lanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~r,t.memoizedState=Ll,n}return i=e.child,e=i.sibling,n=_r(i,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function Wu(e,t){return t=Xa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ti(e,t,r,n){return n!==null&&Pu(n),$n(t,e.child,null,r),e=Wu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function cy(e,t,r,n,s,i,a){if(r)return t.flags&256?(t.flags&=-257,n=Uo(Error(A(422))),Ti(e,t,a,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,s=t.mode,n=Xa({mode:"visible",children:n.children},s,0,null),i=Br(i,s,a,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,t.mode&1&&$n(t,e.child,null,a),t.child.memoizedState=Il(a),t.memoizedState=Ll,i);if(!(t.mode&1))return Ti(e,t,a,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var o=n.dgst;return n=o,i=Error(A(419)),n=Uo(i,n,void 0),Ti(e,t,a,n)}if(o=(a&e.childLanes)!==0,qe||o){if(n=be,n!==null){switch(a&-a){case 4:s=2;break;case 16:s=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(n.suspendedLanes|a)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Jt(e,s),xt(n,e,s,-1))}return Yu(),n=Uo(Error(A(421))),Ti(e,t,a,n)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=ky.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Qe=gr(s.nextSibling),Ye=t,le=!0,yt=null,e!==null&&(rt[nt++]=qt,rt[nt++]=Ht,rt[nt++]=qr,qt=e.id,Ht=e.overflow,qr=t),t=Wu(t,n.children),t.flags|=4096,t)}function Nd(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Rl(e.return,t,r)}function Mo(e,t,r,n,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=s)}function Lp(e,t,r){var n=t.pendingProps,s=n.revealOrder,i=n.tail;if(Ie(e,t,n.children,r),n=ue.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Nd(e,r,t);else if(e.tag===19)Nd(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(re(ue,n),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(r=t.child,s=null;r!==null;)e=r.alternate,e!==null&&Ea(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),Mo(t,!1,s,r,i);break;case"backwards":for(r=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Ea(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}Mo(t,!0,r,null,i);break;case"together":Mo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ea(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Gt(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Wr|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(A(153));if(t.child!==null){for(e=t.child,r=_r(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=_r(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function dy(e,t,r){switch(t.tag){case 3:Ap(t),In();break;case 5:ap(t);break;case 1:We(t.type)&&wa(t);break;case 4:Uu(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;re(ba,n._currentValue),n._currentValue=s;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(re(ue,ue.current&1),t.flags|=128,null):r&t.child.childLanes?Op(e,t,r):(re(ue,ue.current&1),e=Gt(e,t,r),e!==null?e.sibling:null);re(ue,ue.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return Lp(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),re(ue,ue.current),n)break;return null;case 22:case 23:return t.lanes=0,Np(e,t,r)}return Gt(e,t,r)}var Ip,$l,$p,Up;Ip=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};$l=function(){};$p=function(e,t,r,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,$r(Ot.current);var i=null;switch(r){case"input":s=sl(e,s),n=sl(e,n),i=[];break;case"select":s=he({},s,{value:void 0}),n=he({},n,{value:void 0}),i=[];break;case"textarea":s=ol(e,s),n=ol(e,n),i=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=va)}ul(r,n);var a;r=null;for(c in s)if(!n.hasOwnProperty(c)&&s.hasOwnProperty(c)&&s[c]!=null)if(c==="style"){var o=s[c];for(a in o)o.hasOwnProperty(a)&&(r||(r={}),r[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Rs.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in n){var u=n[c];if(o=s!=null?s[c]:void 0,n.hasOwnProperty(c)&&u!==o&&(u!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(r||(r={}),r[a]="");for(a in u)u.hasOwnProperty(a)&&o[a]!==u[a]&&(r||(r={}),r[a]=u[a])}else r||(i||(i=[]),i.push(c,r)),r=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,o=o?o.__html:void 0,u!=null&&o!==u&&(i=i||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Rs.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&se("scroll",e),i||o===u||(i=[])):(i=i||[]).push(c,u))}r&&(i=i||[]).push("style",r);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};Up=function(e,t,r,n){r!==n&&(t.flags|=4)};function ts(e,t){if(!le)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Ne(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function hy(e,t,r){var n=t.pendingProps;switch(Nu(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ne(t),null;case 1:return We(t.type)&&ya(),Ne(t),null;case 3:return n=t.stateNode,Un(),ie(He),ie(Ae),Du(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ci(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,yt!==null&&(Hl(yt),yt=null))),$l(e,t),Ne(t),null;case 5:Mu(t);var s=$r(Bs.current);if(r=t.type,e!==null&&t.stateNode!=null)$p(e,t,r,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(A(166));return Ne(t),null}if(e=$r(Ot.current),Ci(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;
vendor: 33,157 bytes, line 41
41switch(n[Pt]=t,n[Ms]=i,e=(t.mode&1)!==0,r){case"dialog":se("cancel",n),se("close",n);break;case"iframe":case"object":case"embed":se("load",n);break;case"video":case"audio":for(s=0;s<ds.length;s++)se(ds[s],n);break;case"source":se("error",n);break;case"img":case"image":case"link":se("error",n),se("load",n);break;case"details":se("toggle",n);break;case"input":Dc(n,i),se("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},se("invalid",n);break;case"textarea":zc(n,i),se("invalid",n)}ul(r,i),s=null;for(var a in i)if(i.hasOwnProperty(a)){var o=i[a];a==="children"?typeof o=="string"?n.textContent!==o&&(i.suppressHydrationWarning!==!0&&ji(n.textContent,o,e),s=["children",o]):typeof o=="number"&&n.textContent!==""+o&&(i.suppressHydrationWarning!==!0&&ji(n.textContent,o,e),s=["children",""+o]):Rs.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&se("scroll",n)}switch(r){case"input":yi(n),Bc(n,i,!0);break;case"textarea":yi(n),Fc(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=va)}n=s,t.updateQueue=n,n!==null&&(t.flags|=4)}else{a=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=df(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=a.createElement(r,{is:n.is}):(e=a.createElement(r),r==="select"&&(a=e,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):e=a.createElementNS(e,r),e[Pt]=t,e[Ms]=n,Ip(e,t,!1,!1),t.stateNode=e;e:{switch(a=cl(r,n),r){case"dialog":se("cancel",e),se("close",e),s=n;break;case"iframe":case"object":case"embed":se("load",e),s=n;break;case"video":case"audio":for(s=0;s<ds.length;s++)se(ds[s],e);s=n;break;case"source":se("error",e),s=n;break;case"img":case"image":case"link":se("error",e),se("load",e),s=n;break;case"details":se("toggle",e),s=n;break;case"input":Dc(e,n),s=sl(e,n),se("invalid",e);break;case"option":s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=he({},n,{value:void 0}),se("invalid",e);break;case"textarea":zc(e,n),s=ol(e,n),se("invalid",e);break;default:s=n}ul(r,s),o=s;for(i in o)if(o.hasOwnProperty(i)){var u=o[i];i==="style"?pf(e,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&hf(e,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&Ts(e,u):typeof u=="number"&&Ts(e,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Rs.hasOwnProperty(i)?u!=null&&i==="onScroll"&&se("scroll",e):u!=null&&mu(e,i,u,a))}switch(r){case"input":yi(e),Bc(e,n,!1);break;case"textarea":yi(e),Fc(e);break;case"option":n.value!=null&&e.setAttribute("value",""+xr(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?jn(e,!!n.multiple,i,!1):n.defaultValue!=null&&jn(e,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=va)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ne(t),null;case 6:if(e&&t.stateNode!=null)Up(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(A(166));if(r=$r(Bs.current),$r(Ot.current),Ci(t)){if(n=t.stateNode,r=t.memoizedProps,n[Pt]=t,(i=n.nodeValue!==r)&&(e=Ye,e!==null))switch(e.tag){case 3:ji(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ji(n.nodeValue,r,(e.mode&1)!==0)}i&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Pt]=t,t.stateNode=n}return Ne(t),null;case 13:if(ie(ue),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(le&&Qe!==null&&t.mode&1&&!(t.flags&128))tp(),In(),t.flags|=98560,i=!1;else if(i=Ci(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error(A(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(A(317));i[Pt]=t}else In(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ne(t),i=!1}else yt!==null&&(Hl(yt),yt=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||ue.current&1?we===0&&(we=3):Yu())),t.updateQueue!==null&&(t.flags|=4),Ne(t),null);case 4:return Un(),$l(e,t),e===null&&$s(t.stateNode.containerInfo),Ne(t),null;case 10:return Lu(t.type._context),Ne(t),null;case 17:return We(t.type)&&ya(),Ne(t),null;case 19:if(ie(ue),i=t.memoizedState,i===null)return Ne(t),null;if(n=(t.flags&128)!==0,a=i.rendering,a===null)if(n)ts(i,!1);else{if(we!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Ea(e),a!==null){for(t.flags|=128,ts(i,!1),n=a.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)i=r,e=n,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return re(ue,ue.current&1|2),t.child}e=e.sibling}i.tail!==null&&me()>Dn&&(t.flags|=128,n=!0,ts(i,!1),t.lanes=4194304)}else{if(!n)if(e=Ea(a),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),ts(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!le)return Ne(t),null}else 2*me()-i.renderingStartTime>Dn&&r!==1073741824&&(t.flags|=128,n=!0,ts(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(r=i.last,r!==null?r.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=me(),t.sibling=null,r=ue.current,re(ue,n?r&1|2:r&1),t):(Ne(t),null);case 22:case 23:return Qu(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Je&1073741824&&(Ne(t),t.subtreeFlags&6&&(t.flags|=8192)):Ne(t),null;case 24:return null;case 25:return null}throw Error(A(156,t.tag))}function fy(e,t){switch(Nu(t),t.tag){case 1:return We(t.type)&&ya(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Un(),ie(He),ie(Ae),Du(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Mu(t),null;case 13:if(ie(ue),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(A(340));In()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ie(ue),null;case 4:return Un(),null;case 10:return Lu(t.type._context),null;case 22:case 23:return Qu(),null;case 24:return null;default:return null}}var Ni=!1,Pe=!1,py=typeof WeakSet=="function"?WeakSet:Set,$=null;function bn(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){pe(e,t,n)}else r.current=null}function Ul(e,t,r){try{r()}catch(n){pe(e,t,n)}}var Pd=!1;function my(e,t){if(_l=pa,e=Ff(),Ru(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var a=0,o=-1,u=-1,c=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==r||s!==0&&h.nodeType!==3||(o=a+s),h!==i||n!==0&&h.nodeType!==3||(u=a+n),h.nodeType===3&&(a+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===e)break t;if(f===r&&++c===s&&(o=a),f===i&&++d===n&&(u=a),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}r=o===-1||u===-1?null:{start:o,end:u}}else r=null}r=r||{start:0,end:0}}else r=null;for(xl={focusedElem:e,selectionRange:r},pa=!1,$=t;$!==null;)if(t=$,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var w=y.memoizedProps,x=y.memoizedState,m=t.stateNode,g=m.getSnapshotBeforeUpdate(t.elementType===t.type?w:mt(t.type,w),x);m.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(A(163))}}catch(b){pe(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return y=Pd,Pd=!1,y}function _s(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Ul(t,r,i)}s=s.next}while(s!==n)}}function Qa(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function Ml(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Mp(e){var t=e.alternate;t!==null&&(e.alternate=null,Mp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Pt],delete t[Ms],delete t[Sl],delete t[Yv],delete t[Xv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Dp(e){return e.tag===5||e.tag===3||e.tag===4}function Ad(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Dp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Dl(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=va));else if(n!==4&&(e=e.child,e!==null))for(Dl(e,t,r),e=e.sibling;e!==null;)Dl(e,t,r),e=e.sibling}function Bl(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Bl(e,t,r),e=e.sibling;e!==null;)Bl(e,t,r),e=e.sibling}var Ee=null,vt=!1;function nr(e,t,r){for(r=r.child;r!==null;)Bp(e,t,r),r=r.sibling}function Bp(e,t,r){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(Fa,r)}catch{}switch(r.tag){case 5:Pe||bn(r,t);case 6:var n=Ee,s=vt;Ee=null,nr(e,t,r),Ee=n,vt=s,Ee!==null&&(vt?(e=Ee,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ee.removeChild(r.stateNode));break;case 18:Ee!==null&&(vt?(e=Ee,r=r.stateNode,e.nodeType===8?Po(e.parentNode,r):e.nodeType===1&&Po(e,r),Os(e)):Po(Ee,r.stateNode));break;case 4:n=Ee,s=vt,Ee=r.stateNode.containerInfo,vt=!0,nr(e,t,r),Ee=n,vt=s;break;case 0:case 11:case 14:case 15:if(!Pe&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Ul(r,t,a),s=s.next}while(s!==n)}nr(e,t,r);break;case 1:if(!Pe&&(bn(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(o){pe(r,t,o)}nr(e,t,r);break;case 21:nr(e,t,r);break;case 22:r.mode&1?(Pe=(n=Pe)||r.memoizedState!==null,nr(e,t,r),Pe=n):nr(e,t,r);break;default:nr(e,t,r)}}function Od(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new py),t.forEach(function(n){var s=Sy.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function ft(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var i=e,a=t,o=a;e:for(;o!==null;){switch(o.tag){case 5:Ee=o.stateNode,vt=!1;break e;case 3:Ee=o.stateNode.containerInfo,vt=!0;break e;case 4:Ee=o.stateNode.containerInfo,vt=!0;break e}o=o.return}if(Ee===null)throw Error(A(160));Bp(i,a,s),Ee=null,vt=!1;var u=s.alternate;u!==null&&(u.return=null),s.return=null}catch(c){pe(s,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)zp(t,e),t=t.sibling}function zp(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ft(t,e),Et(e),n&4){try{_s(3,e,e.return),Qa(3,e)}catch(w){pe(e,e.return,w)}try{_s(5,e,e.return)}catch(w){pe(e,e.return,w)}}break;case 1:ft(t,e),Et(e),n&512&&r!==null&&bn(r,r.return);break;case 5:if(ft(t,e),Et(e),n&512&&r!==null&&bn(r,r.return),e.flags&32){var s=e.stateNode;try{Ts(s,"")}catch(w){pe(e,e.return,w)}}if(n&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=r!==null?r.memoizedProps:i,o=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{o==="input"&&i.type==="radio"&&i.name!=null&&uf(s,i),cl(o,a);var c=cl(o,i);for(a=0;a<u.length;a+=2){var d=u[a],h=u[a+1];d==="style"?pf(s,h):d==="dangerouslySetInnerHTML"?hf(s,h):d==="children"?Ts(s,h):mu(s,d,h,c)}switch(o){case"input":il(s,i);break;case"textarea":cf(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?jn(s,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?jn(s,!!i.multiple,i.defaultValue,!0):jn(s,!!i.multiple,i.multiple?[]:"",!1))}s[Ms]=i}catch(w){pe(e,e.return,w)}}break;case 6:if(ft(t,e),Et(e),n&4){if(e.stateNode===null)throw Error(A(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(w){pe(e,e.return,w)}}break;case 3:if(ft(t,e),Et(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Os(t.containerInfo)}catch(w){pe(e,e.return,w)}break;case 4:ft(t,e),Et(e);break;case 13:ft(t,e),Et(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(Ju=me())),n&4&&Od(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(Pe=(c=Pe)||d,ft(t,e),Pe=c):ft(t,e),Et(e),n&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!d&&e.mode&1)for($=e,d=e.child;d!==null;){for(h=$=d;$!==null;){switch(f=$,p=f.child,f.tag){case 0:case 11:case 14:case 15:_s(4,f,f.return);break;case 1:bn(f,f.return);var y=f.stateNode;if(typeof y.componentWillUnmount=="function"){n=f,r=f.return;try{t=n,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(w){pe(n,r,w)}}break;case 5:bn(f,f.return);break;case 22:if(f.memoizedState!==null){Id(h);continue}}p!==null?(p.return=f,$=p):Id(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,c?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(o=h.stateNode,u=h.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,o.style.display=ff("display",a))}catch(w){pe(e,e.return,w)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(w){pe(e,e.return,w)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:ft(t,e),Et(e),n&4&&Od(e);break;case 21:break;default:ft(t,e),Et(e)}}function Et(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(Dp(r)){var n=r;break e}r=r.return}throw Error(A(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(Ts(s,""),n.flags&=-33);var i=Ad(e);Bl(e,i,s);break;case 3:case 4:var a=n.stateNode.containerInfo,o=Ad(e);Dl(e,o,a);break;default:throw Error(A(161))}}catch(u){pe(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gy(e,t,r){$=e,Fp(e)}function Fp(e,t,r){for(var n=(e.mode&1)!==0;$!==null;){var s=$,i=s.child;if(s.tag===22&&n){var a=s.memoizedState!==null||Ni;if(!a){var o=s.alternate,u=o!==null&&o.memoizedState!==null||Pe;o=Ni;var c=Pe;if(Ni=a,(Pe=u)&&!c)for($=s;$!==null;)a=$,u=a.child,a.tag===22&&a.memoizedState!==null?$d(s):u!==null?(u.return=a,$=u):$d(s);for(;i!==null;)$=i,Fp(i),i=i.sibling;$=s,Ni=o,Pe=c}Ld(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,$=i):Ld(e)}}function Ld(e){for(;$!==null;){var t=$;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Pe||Qa(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Pe)if(r===null)n.componentDidMount();else{var s=t.elementType===t.type?r.memoizedProps:mt(t.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&yd(t,i,n);break;case 3:var a=t.updateQueue;if(a!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}yd(t,a,r)}break;case 5:var o=t.stateNode;if(r===null&&t.flags&4){r=o;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&r.focus();break;case"img":u.src&&(r.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var d=c.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&Os(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(A(163))}Pe||t.flags&512&&Ml(t)}catch(f){pe(t,t.return,f)}}if(t===e){$=null;break}if(r=t.sibling,r!==null){r.return=t.return,$=r;break}$=t.return}}function Id(e){for(;$!==null;){var t=$;if(t===e){$=null;break}var r=t.sibling;if(r!==null){r.return=t.return,$=r;break}$=t.return}}function $d(e){for(;$!==null;){var t=$;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{Qa(4,t)}catch(u){pe(t,r,u)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var s=t.return;try{n.componentDidMount()}catch(u){pe(t,s,u)}}var i=t.return;try{Ml(t)}catch(u){pe(t,i,u)}break;case 5:var a=t.return;try{Ml(t)}catch(u){pe(t,a,u)}}}catch(u){pe(t,t.return,u)}if(t===e){$=null;break}var o=t.sibling;if(o!==null){o.return=t.return,$=o;break}$=t.return}}var vy=Math.ceil,Ra=Yt.ReactCurrentDispatcher,Vu=Yt.ReactCurrentOwner,at=Yt.ReactCurrentBatchConfig,Q=0,be=null,ve=null,je=0,Je=0,kn=Sr(0),we=0,Hs=null,Wr=0,Ya=0,Ku=0,xs=null,Fe=null,Ju=0,Dn=1/0,Mt=null,Ta=!1,zl=null,yr=null,Pi=!1,dr=null,Na=0,bs=0,Fl=null,ta=-1,ra=0;function $e(){return Q&6?me():ta!==-1?ta:ta=me()}function wr(e){return e.mode&1?Q&2&&je!==0?je&-je:ey.transition!==null?(ra===0&&(ra=jf()),ra):(e=X,e!==0||(e=window.event,e=e===void 0?16:Of(e.type)),e):1}function xt(e,t,r,n){if(50<bs)throw bs=0,Fl=null,Error(A(185));ei(e,r,n),(!(Q&2)||e!==be)&&(e===be&&(!(Q&2)&&(Ya|=r),we===4&&or(e,je)),Ve(e,n),r===1&&Q===0&&!(t.mode&1)&&(Dn=me()+500,Ka&&Er()))}function Ve(e,t){var r=e.callbackNode;ev(e,t);var n=fa(e,e===be?je:0);if(n===0)r!==null&&Wc(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&Wc(r),t===1)e.tag===0?Zv(Ud.bind(null,e)):Xf(Ud.bind(null,e)),Gv(function(){!(Q&6)&&Er()}),r=null;else{switch(Cf(n)){case 1:r=_u;break;case 4:r=Sf;break;case 16:r=ha;break;case 536870912:r=Ef;break;default:r=ha}r=Qp(r,qp.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function qp(e,t){if(ta=-1,ra=0,Q&6)throw Error(A(327));var r=e.callbackNode;if(Pn()&&e.callbackNode!==r)return null;var n=fa(e,e===be?je:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Pa(e,n);else{t=n;var s=Q;Q|=2;var i=Wp();(be!==e||je!==t)&&(Mt=null,Dn=me()+500,Dr(e,t));do try{_y();break}catch(o){Hp(e,o)}while(!0);Ou(),Ra.current=i,Q=s,ve!==null?t=0:(be=null,je=0,t=we)}if(t!==0){if(t===2&&(s=ml(e),s!==0&&(n=s,t=ql(e,s))),t===1)throw r=Hs,Dr(e,0),or(e,n),Ve(e,me()),r;if(t===6)or(e,n);else{if(s=e.current.alternate,!(n&30)&&!yy(s)&&(t=Pa(e,n),t===2&&(i=ml(e),i!==0&&(n=i,t=ql(e,i))),t===1))throw r=Hs,Dr(e,0),or(e,n),Ve(e,me()),r;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error(A(345));case 2:Ar(e,Fe,Mt);break;case 3:if(or(e,n),(n&130023424)===n&&(t=Ju+500-me(),10<t)){if(fa(e,0)!==0)break;if(s=e.suspendedLanes,(s&n)!==n){$e(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=kl(Ar.bind(null,e,Fe,Mt),t);break}Ar(e,Fe,Mt);break;case 4:if(or(e,n),(n&4194240)===n)break;for(t=e.eventTimes,s=-1;0<n;){var a=31-_t(n);i=1<<a,a=t[a],a>s&&(s=a),n&=~i}if(n=s,n=me()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*vy(n/1960))-n,10<n){e.timeoutHandle=kl(Ar.bind(null,e,Fe,Mt),n);break}Ar(e,Fe,Mt);break;case 5:Ar(e,Fe,Mt);break;default:throw Error(A(329))}}}return Ve(e,me()),e.callbackNode===r?qp.bind(null,e):null}function ql(e,t){var r=xs;return e.current.memoizedState.isDehydrated&&(Dr(e,t).flags|=256),e=Pa(e,t),e!==2&&(t=Fe,Fe=r,t!==null&&Hl(t)),e}function Hl(e){Fe===null?Fe=e:Fe.push.apply(Fe,e)}function yy(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var s=r[n],i=s.getSnapshot;s=s.value;try{if(!kt(i(),s))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function or(e,t){for(t&=~Ku,t&=~Ya,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-_t(t),n=1<<r;e[r]=-1,t&=~n}}function Ud(e){if(Q&6)throw Error(A(327));Pn();var t=fa(e,0);if(!(t&1))return Ve(e,me()),null;var r=Pa(e,t);if(e.tag!==0&&r===2){var n=ml(e);n!==0&&(t=n,r=ql(e,n))}if(r===1)throw r=Hs,Dr(e,0),or(e,t),Ve(e,me()),r;if(r===6)throw Error(A(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ar(e,Fe,Mt),Ve(e,me()),null}function Gu(e,t){var r=Q;Q|=1;try{return e(t)}finally{Q=r,Q===0&&(Dn=me()+500,Ka&&Er())}}function Vr(e){dr!==null&&dr.tag===0&&!(Q&6)&&Pn();var t=Q;Q|=1;var r=at.transition,n=X;try{if(at.transition=null,X=1,e)return e()}finally{X=n,at.transition=r,Q=t,!(Q&6)&&Er()}}function Qu(){Je=kn.current,ie(kn)}function Dr(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,Jv(r)),ve!==null)for(r=ve.return;r!==null;){var n=r;switch(Nu(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&ya();break;case 3:Un(),ie(He),ie(Ae),Du();break;case 5:Mu(n);break;case 4:Un();break;case 13:ie(ue);break;case 19:ie(ue);break;case 10:Lu(n.type._context);break;case 22:case 23:Qu()}r=r.return}if(be=e,ve=e=_r(e.current,null),je=Je=t,we=0,Hs=null,Ku=Ya=Wr=0,Fe=xs=null,Ir!==null){for(t=0;t<Ir.length;t++)if(r=Ir[t],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,i=r.pending;if(i!==null){var a=i.next;i.next=s,n.next=a}r.pending=n}Ir=null}return e}function Hp(e,t){do{var r=ve;try{if(Ou(),Xi.current=Ca,ja){for(var n=ce.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}ja=!1}if(Hr=0,xe=ye=ce=null,ws=!1,zs=0,Vu.current=null,r===null||r.return===null){we=1,Hs=t,ve=null;break}e:{var i=e,a=r.return,o=r,u=t;if(t=je,o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var c=u,d=o,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=Sd(a);if(p!==null){p.flags&=-257,Ed(p,a,o,i,t),p.mode&1&&kd(i,c,t),t=p,u=c;var y=t.updateQueue;if(y===null){var w=new Set;w.add(u),t.updateQueue=w}else y.add(u);break e}else{if(!(t&1)){kd(i,c,t),Yu();break e}u=Error(A(426))}}else if(le&&o.mode&1){var x=Sd(a);if(x!==null){!(x.flags&65536)&&(x.flags|=256),Ed(x,a,o,i,t),Pu(Mn(u,o));break e}}i=u=Mn(u,o),we!==4&&(we=2),xs===null?xs=[i]:xs.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var m=Cp(i,u,t);vd(i,m);break e;case 1:o=u;var g=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof g.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(yr===null||!yr.has(v)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=Rp(i,o,t);vd(i,b);break e}}i=i.return}while(i!==null)}Kp(r)}catch(E){t=E,ve===r&&r!==null&&(ve=r=r.return);continue}break}while(!0)}function Wp(){var e=Ra.current;return Ra.current=Ca,e===null?Ca:e}function Yu(){(we===0||we===3||we===2)&&(we=4),be===null||!(Wr&268435455)&&!(Ya&268435455)||or(be,je)}function Pa(e,t){var r=Q;Q|=2;var n=Wp();(be!==e||je!==t)&&(Mt=null,Dr(e,t));do try{wy();break}catch(s){Hp(e,s)}while(!0);if(Ou(),Q=r,Ra.current=n,ve!==null)throw Error(A(261));return be=null,je=0,we}function wy(){for(;ve!==null;)Vp(ve)}function _y(){for(;ve!==null&&!Wg();)Vp(ve)}function Vp(e){var t=Gp(e.alternate,e,Je);e.memoizedProps=e.pendingProps,t===null?Kp(e):ve=t,Vu.current=null}function Kp(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=fy(r,t),r!==null){r.flags&=32767,ve=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{we=6,ve=null;return}}else if(r=hy(r,t,Je),r!==null){ve=r;return}if(t=t.sibling,t!==null){ve=t;return}ve=t=e}while(t!==null);we===0&&(we=5)}function Ar(e,t,r){var n=X,s=at.transition;try{at.transition=null,X=1,xy(e,t,r,n)}finally{at.transition=s,X=n}return null}function xy(e,t,r,n){do Pn();while(dr!==null);if(Q&6)throw Error(A(327));r=e.finishedWork;var s=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(A(177));e.callbackNode=null,e.callbackPriority=0;var i=r.lanes|r.childLanes;if(tv(e,i),e===be&&(ve=be=null,je=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Pi||(Pi=!0,Qp(ha,function(){return Pn(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=at.transition,at.transition=null;var a=X;X=1;var o=Q;Q|=4,Vu.current=null,my(e,r),zp(r,e),zv(xl),pa=!!_l,xl=_l=null,e.current=r,gy(r),Vg(),Q=o,X=a,at.transition=i}else e.current=r;if(Pi&&(Pi=!1,dr=e,Na=s),i=e.pendingLanes,i===0&&(yr=null),Gg(r.stateNode),Ve(e,me()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)s=t[r],n(s.value,{componentStack:s.stack,digest:s.digest});if(Ta)throw Ta=!1,e=zl,zl=null,e;return Na&1&&e.tag!==0&&Pn(),i=e.pendingLanes,i&1?e===Fl?bs++:(bs=0,Fl=e):bs=0,Er(),null}function Pn(){if(dr!==null){var e=Cf(Na),t=at.transition,r=X;try{if(at.transition=null,X=16>e?16:e,dr===null)var n=!1;else{if(e=dr,dr=null,Na=0,Q&6)throw Error(A(331));var s=Q;for(Q|=4,$=e.current;$!==null;){var i=$,a=i.child;if($.flags&16){var o=i.deletions;if(o!==null){for(var u=0;u<o.length;u++){var c=o[u];for($=c;$!==null;){var d=$;switch(d.tag){case 0:case 11:case 15:_s(8,d,i)}var h=d.child;if(h!==null)h.return=d,$=h;else for(;$!==null;){d=$;var f=d.sibling,p=d.return;if(Mp(d),d===c){$=null;break}if(f!==null){f.return=p,$=f;break}$=p}}}var y=i.alternate;if(y!==null){var w=y.child;if(w!==null){y.child=null;do{var x=w.sibling;w.sibling=null,w=x}while(w!==null)}}$=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,$=a;else e:for(;$!==null;){if(i=$,i.flags&2048)switch(i.tag){case 0:case 11:case 15:_s(9,i,i.return)}var m=i.sibling;if(m!==null){m.return=i.return,$=m;break e}$=i.return}}var g=e.current;for($=g;$!==null;){a=$;var v=a.child;if(a.subtreeFlags&2064&&v!==null)v.return=a,$=v;else e:for(a=g;$!==null;){if(o=$,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:Qa(9,o)}}catch(E){pe(o,o.return,E)}if(o===a){$=null;break e}var b=o.sibling;if(b!==null){b.return=o.return,$=b;break e}$=o.return}}if(Q=s,Er(),At&&typeof At.onPostCommitFiberRoot=="function")try{At.onPostCommitFiberRoot(Fa,e)}catch{}n=!0}return n}finally{X=r,at.transition=t}}return!1}function Md(e,t,r){t=Mn(r,t),t=Cp(e,t,1),e=vr(e,t,1),t=$e(),e!==null&&(ei(e,1,t),Ve(e,t))}function pe(e,t,r){if(e.tag===3)Md(e,e,r);else for(;t!==null;){if(t.tag===3){Md(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(yr===null||!yr.has(n))){e=Mn(r,e),e=Rp(t,e,1),t=vr(t,e,1),e=$e(),t!==null&&(ei(t,1,e),Ve(t,e));break}}t=t.return}}function by(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=$e(),e.pingedLanes|=e.suspendedLanes&r,be===e&&(je&r)===r&&(we===4||we===3&&(je&130023424)===je&&500>me()-Ju?Dr(e,0):Ku|=r),Ve(e,t)}function Jp(e,t){t===0&&(e.mode&1?(t=xi,xi<<=1,!(xi&130023424)&&(xi=4194304)):t=1);var r=$e();e=Jt(e,t),e!==null&&(ei(e,t,r),Ve(e,r))}function ky(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Jp(e,r)}function Sy(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(A(314))}n!==null&&n.delete(t),Jp(e,r)}var Gp;Gp=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||He.current)qe=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return qe=!1,dy(e,t,r);qe=!!(e.flags&131072)}else qe=!1,le&&t.flags&1048576&&Zf(t,xa,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;ea(e,t),e=t.pendingProps;var s=Ln(t,Ae.current);Nn(t,r),s=zu(null,t,n,e,s,r);var i=Fu();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,We(n)?(i=!0,wa(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,$u(t),s.updater=Ga,t.stateNode=s,s._reactInternals=t,Nl(t,n,e,r),t=Ol(null,t,n,!0,i,r)):(t.tag=0,le&&i&&Tu(t),Ie(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(ea(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=jy(n),e=mt(n,e),s){case 0:t=Al(null,t,n,e,r);break e;case 1:t=Rd(null,t,n,e,r);break e;case 11:t=jd(null,t,n,e,r);break e;case 14:t=Cd(null,t,n,mt(n.type,e),r);break e}throw Error(A(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:mt(n,s),Al(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:mt(n,s),Rd(e,t,n,s,r);case 3:e:{if(Ap(t),e===null)throw Error(A(387));n=t.pendingProps,i=t.memoizedState,s=i.element,ip(e,t),Sa(t,n,null,r);var a=t.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Mn(Error(A(423)),t),t=Td(e,t,n,r,s);break e}else if(n!==s){s=Mn(Error(A(424)),t),t=Td(e,t,n,r,s);break e}else for(Qe=gr(t.stateNode.containerInfo.firstChild),Ye=t,le=!0,yt=null,r=np(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(In(),n===s){t=Gt(e,t,r);break e}Ie(e,t,n,r)}t=t.child}return t;case 5:return ap(t),e===null&&Cl(t),n=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,bl(n,s)?a=null:i!==null&&bl(n,i)&&(t.flags|=32),Pp(e,t),Ie(e,t,a,r),t.child;case 6:return e===null&&Cl(t),null;case 13:return Op(e,t,r);case 4:return Uu(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=$n(t,null,n,r):Ie(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:mt(n,s),jd(e,t,n,s,r);case 7:return Ie(e,t,t.pendingProps,r),t.child;case 8:return Ie(e,t,t.pendingProps.children,r),t.child;case 12:return Ie(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,re(ba,n._currentValue),n._currentValue=a,i!==null)if(kt(i.value,a)){if(i.children===s.children&&!He.current){t=Gt(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){a=i.child;for(var u=o.firstContext;u!==null;){if(u.context===n){if(i.tag===1){u=Wt(-1,r&-r),u.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?u.next=u:(u.next=d.next,d.next=u),c.pending=u}}i.lanes|=r,u=i.alternate,u!==null&&(u.lanes|=r),Rl(i.return,r,t),o.lanes|=r;break}u=u.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(A(341));a.lanes|=r,o=a.alternate,o!==null&&(o.lanes|=r),Rl(a,r,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Ie(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Nn(t,r),s=ot(s),n=n(s),t.flags|=1,Ie(e,t,n,r),t.child;case 14:return n=t.type,s=mt(n,t.pendingProps),s=mt(n.type,s),Cd(e,t,n,s,r);case 15:return Tp(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:mt(n,s),ea(e,t),t.tag=1,We(n)?(e=!0,wa(t)):e=!1,Nn(t,r),jp(t,n,s),Nl(t,n,s,r),Ol(null,t,n,!0,e,r);case 19:return Lp(e,t,r);case 22:return Np(e,t,r)}throw Error(A(156,t.tag))};function Qp(e,t){return kf(e,t)}function Ey(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function it(e,t,r,n){return new Ey(e,t,r,n)}function Xu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function jy(e){if(typeof e=="function")return Xu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===vu)return 11;if(e===yu)return 14}return 2}function _r(e,t){var r=e.alternate;return r===null?(r=it(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.depen
vendor: 9,521 bytes, line 41
41dencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function na(e,t,r,n,s,i){var a=2;if(n=e,typeof e=="function")Xu(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case fn:return Br(r.children,s,i,t);case gu:a=8,s|=8;break;case el:return e=it(12,r,t,s|2),e.elementType=el,e.lanes=i,e;case tl:return e=it(13,r,t,s),e.elementType=tl,e.lanes=i,e;case rl:return e=it(19,r,t,s),e.elementType=rl,e.lanes=i,e;case af:return Xa(r,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case nf:a=10;break e;case sf:a=9;break e;case vu:a=11;break e;case yu:a=14;break e;case sr:a=16,n=null;break e}throw Error(A(130,e==null?e:typeof e,""))}return t=it(a,r,t,s),t.elementType=e,t.type=n,t.lanes=i,t}function Br(e,t,r,n){return e=it(7,e,n,t),e.lanes=r,e}function Xa(e,t,r,n){return e=it(22,e,n,t),e.elementType=af,e.lanes=r,e.stateNode={isHidden:!1},e}function Do(e,t,r){return e=it(6,e,null,t),e.lanes=r,e}function Bo(e,t,r){return t=it(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Cy(e,t,r,n,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_o(0),this.expirationTimes=_o(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_o(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Zu(e,t,r,n,s,i,a,o,u){return e=new Cy(e,t,r,o,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=it(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},$u(i),e}function Ry(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:hn,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function Yp(e){if(!e)return br;e=e._reactInternals;e:{if(Jr(e)!==e||e.tag!==1)throw Error(A(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(We(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(A(171))}if(e.tag===1){var r=e.type;if(We(r))return Yf(e,r,t)}return t}function Xp(e,t,r,n,s,i,a,o,u){return e=Zu(r,n,!0,e,s,i,a,o,u),e.context=Yp(null),r=e.current,n=$e(),s=wr(r),i=Wt(n,s),i.callback=t??null,vr(r,i,s),e.current.lanes=s,ei(e,s,n),Ve(e,n),e}function Za(e,t,r,n){var s=t.current,i=$e(),a=wr(s);return r=Yp(r),t.context===null?t.context=r:t.pendingContext=r,t=Wt(i,a),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=vr(s,t,a),e!==null&&(xt(e,s,a,i),Yi(e,s,a)),a}function Aa(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Dd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function ec(e,t){Dd(e,t),(e=e.alternate)&&Dd(e,t)}function Ty(){return null}var Zp=typeof reportError=="function"?reportError:function(e){console.error(e)};function tc(e){this._internalRoot=e}eo.prototype.render=tc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(A(409));Za(e,t,null,null)};eo.prototype.unmount=tc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Vr(function(){Za(null,e,null,null)}),t[Kt]=null}};function eo(e){this._internalRoot=e}eo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Nf();e={blockedOn:null,target:e,priority:t};for(var r=0;r<ar.length&&t!==0&&t<ar[r].priority;r++);ar.splice(r,0,e),r===0&&Af(e)}};function rc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function to(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Bd(){}function Ny(e,t,r,n,s){if(s){if(typeof n=="function"){var i=n;n=function(){var c=Aa(a);i.call(c)}}var a=Xp(t,n,e,0,null,!1,!1,"",Bd);return e._reactRootContainer=a,e[Kt]=a.current,$s(e.nodeType===8?e.parentNode:e),Vr(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof n=="function"){var o=n;n=function(){var c=Aa(u);o.call(c)}}var u=Zu(e,0,!1,null,null,!1,!1,"",Bd);return e._reactRootContainer=u,e[Kt]=u.current,$s(e.nodeType===8?e.parentNode:e),Vr(function(){Za(t,u,r,n)}),u}function ro(e,t,r,n,s){var i=r._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var o=s;s=function(){var u=Aa(a);o.call(u)}}Za(t,a,e,s)}else a=Ny(r,t,e,s,n);return Aa(a)}Rf=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=cs(t.pendingLanes);r!==0&&(xu(t,r|1),Ve(t,me()),!(Q&6)&&(Dn=me()+500,Er()))}break;case 13:Vr(function(){var n=Jt(e,1);if(n!==null){var s=$e();xt(n,e,1,s)}}),ec(e,1)}};bu=function(e){if(e.tag===13){var t=Jt(e,134217728);if(t!==null){var r=$e();xt(t,e,134217728,r)}ec(e,134217728)}};Tf=function(e){if(e.tag===13){var t=wr(e),r=Jt(e,t);if(r!==null){var n=$e();xt(r,e,t,n)}ec(e,t)}};Nf=function(){return X};Pf=function(e,t){var r=X;try{return X=e,t()}finally{X=r}};hl=function(e,t,r){switch(t){case"input":if(il(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var s=Va(n);if(!s)throw Error(A(90));lf(n),il(n,s)}}}break;case"textarea":cf(e,r);break;case"select":t=r.value,t!=null&&jn(e,!!r.multiple,t,!1)}};vf=Gu;yf=Vr;var Py={usingClientEntryPoint:!1,Events:[ri,vn,Va,mf,gf,Gu]},rs={findFiberByHostInstance:Lr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ay={bundleType:rs.bundleType,version:rs.version,rendererPackageName:rs.rendererPackageName,rendererConfig:rs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Yt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=xf(e),e===null?null:e.stateNode},findFiberByHostInstance:rs.findFiberByHostInstance||Ty,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ai=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ai.isDisabled&&Ai.supportsFiber)try{Fa=Ai.inject(Ay),At=Ai}catch{}}Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Py;Ze.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!rc(t))throw Error(A(200));return Ry(e,t,null,r)};Ze.createRoot=function(e,t){if(!rc(e))throw Error(A(299));var r=!1,n="",s=Zp;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Zu(e,1,!1,null,null,r,!1,n,s),e[Kt]=t.current,$s(e.nodeType===8?e.parentNode:e),new tc(t)};Ze.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(A(188)):(e=Object.keys(e).join(","),Error(A(268,e)));return e=xf(t),e=e===null?null:e.stateNode,e};Ze.flushSync=function(e){return Vr(e)};Ze.hydrate=function(e,t,r){if(!to(t))throw Error(A(200));return ro(null,e,t,!0,r)};Ze.hydrateRoot=function(e,t,r){if(!rc(e))throw Error(A(405));var n=r!=null&&r.hydratedSources||null,s=!1,i="",a=Zp;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),t=Xp(t,null,e,1,r??null,s,!1,i,a),e[Kt]=t.current,$s(e),n)for(e=0;e<n.length;e++)r=n[e],s=r._getVersion,s=s(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,s]:t.mutableSourceEagerHydrationData.push(r,s);return new eo(t)};Ze.render=function(e,t,r){if(!to(t))throw Error(A(200));return ro(null,e,t,!1,r)};Ze.unmountComponentAtNode=function(e){if(!to(e))throw Error(A(40));return e._reactRootContainer?(Vr(function(){ro(null,null,e,!1,function(){e._reactRootContainer=null,e[Kt]=null})}),!0):!1};Ze.unstable_batchedUpdates=Gu;Ze.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!to(r))throw Error(A(200));if(e==null||e._reactInternals===void 0)throw Error(A(38));return ro(e,t,r,!1,n)};Ze.version="18.3.1-next-f1338f8080-20240426";function em(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(em)}catch(e){console.error(e)}}em(),Zh.exports=Ze;var Oy=Zh.exports,tm,zd=Oy;tm=zd.createRoot,zd.hydrateRoot;const Ly="modulepreload",Iy=function(e){return"/"+e},Fd={},jr=function(t,r,n){let s=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(r.map(u=>{if(u=Iy(u),u in Fd)return;Fd[u]=!0;const c=u.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const h=document.createElement("link");
41if(h.rel=c?"stylesheet":Ly,c||(h.as="script"),h.crossOrigin="",h.href=u,o&&h.setAttribute("nonce",o),document.head.appendChild(h),c)return new Promise((f,p)=>{h.addEventListener("load",f),h.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};/** 42 * react-router v7.14.2 43 * 44 * Copyright (c) Remix Software Inc. 45 * 46 * This source code is licensed under the MIT license found in the 47 * LICENSE.md file in the root directory of this source tree. 48 * 49 * @license MIT 50 */var qd="popstate";function Hd(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function $y(e={}){function t(n,s){var c;let i=(c=s.state)==null?void 0:c.masked,{pathname:a,search:o,hash:u}=i||n.location;return Wl("",{pathname:a,search:o,hash:u},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function r(n,s){return typeof s=="string"?s:Ws(s)}return My(t,r,null,e)}function de(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function St(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Uy(){return Math.random().toString(36).substring(2,10)}function Wd(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Wl(e,t,r=null,n,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Hn(t):t,state:r,key:t&&t.key||n||Uy(),unstable_mask:s}}function Ws({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Hn(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function My(e,t,r,n={}){let{window:s=document.defaultView,v5Compat:i=!1}=n,a=s.history,o="POP",u=null,c=d();c==null&&(c=0,a.replaceState({...a.state,idx:c},""));function d(){return(a.state||{idx:null}).idx}function h(){o="POP";let x=d(),m=x==null?null:x-c;c=x,u&&u({action:o,location:w.location,delta:m})}function f(x,m){o="PUSH";let g=Hd(x)?x:Wl(w.location,x,m);c=d()+1;let v=Wd(g,c),b=w.createHref(g.unstable_mask||g);try{a.pushState(v,"",b)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;s.location.assign(b)}i&&u&&u({action:o,location:w.location,delta:1})}function p(x,m){o="REPLACE";let g=Hd(x)?x:Wl(w.location,x,m);c=d();let v=Wd(g,c),b=w.createHref(g.unstable_mask||g);a.replaceState(v,"",b),i&&u&&u({action:o,location:w.location,delta:0})}function y(x){return Dy(x)}let w={get action(){return o},get location(){return e(s,a)}
50,listen(x){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(qd,h),u=x,()=>{s.removeEventListener(qd,h),u=null}},createHref(x){return t(s,x)},createURL:y,encodeLocation(x){let m=y(x);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:f,replace:p,go(x){return a.go(x)}};return w}function Dy(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),de(r,"No window.location.(origin|href) available to create URL");let n=typeof e=="string"?e:Ws(e);return n=n.replace(/ $/,"%20"),!t&&n.startsWith("//")&&(n=r+n),new URL(n,r)}function rm(e,t,r="/"){return By(e,t,r,!1)}function By(e,t,r,n){let s=typeof t=="string"?Hn(t):t,i=Qt(s.pathname||"/",r);if(i==null)return null;let a=nm(e);zy(a);let o=null;for(let u=0;o==null&&u<a.length;++u){let c=Xy(i);o=Qy(a[u],c,n)}return o}function nm(e,t=[],r=[],n="",s=!1){let i=(a,o,u=s,c)=>{let d={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(n)&&u)return;de(d.relativePath.startsWith(n),`Absolute route path "${d.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(n.length)}let h=bt([n,d.relativePath]),f=r.concat(d);a.children&&a.children.length>0&&(de(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),nm(a.children,t,f,h,u)),!(a.path==null&&!a.index)&&t.push({path:h,score:Jy(h,a.index),routesMeta:f})};return e.forEach((a,o)=>{var u;if(a.path===""||!((u=a.path)!=null&&u.includes("?")))i(a,o);else for(let c of sm(a.path))i(a,o,!0,c)}),t}function sm(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,s=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return s?[i,""]:[i];let a=sm(n.join("/")),o=[];return o.push(...a.map(u=>u===""?i:[i,u].join("/"))),s&&o.push(...a),o.map(u=>e.startsWith("/")&&u===""?"/":u)}function zy(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Gy(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var Fy=/^:[\w-]+$/,qy=3,Hy=2,Wy=1,Vy=10,Ky=-2,Vd=e=>e==="*";function Jy(e,t){let r=e.split("/"),n=r.length;return r.some(Vd)&&(n+=Ky),t&&(n+=Hy),r.filter(s=>!Vd(s)).reduce((s,i)=>s+(Fy.test(i)?qy:i===""?Wy:Vy),n)}function Gy(e,t){return e.length===t.length&&e.slice(0,-1).every((n,s)=>n===t[s])?e[e.length-1]-t[t.length-1]:0}function Qy(e,t,r=!1){let{routesMeta:n}=e,s={},i="/",a=[];for(let o=0;o<n.length;++o){let u=n[o],c=o===n.length-1,d=i==="/"?t:t.slice(i.length)||"/",h=Oa({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},d),f=u.route;if(!h&&c&&r&&!n[n.length-1].route.index&&(h=Oa({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},d)),!h)return null;
50Object.assign(s,h.params),a.push({params:s,pathname:bt([i,h.pathname]),pathnameBase:r0(bt([i,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(i=bt([i,h.pathnameBase]))}return a}function Oa(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Yy(e.path,e.caseSensitive,e.end),s=t.match(r);if(!s)return null;let i=s[0],a=i.replace(/(.)\/+$/,"$1"),o=s.slice(1);return{params:n.reduce((c,{paramName:d,isOptional:h},f)=>{if(d==="*"){let y=o[f]||"";a=i.slice(0,i.length-y.length).replace(/(.)\/+$/,"$1")}const p=o[f];return h&&!p?c[d]=void 0:c[d]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:a,pattern:e}}function Yy(e,t=!1,r=!0){St(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,u,c,d)=>{if(n.push({paramName:o,isOptional:u!=null}),u){let h=d.charAt(c+a.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),n]}function Xy(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return St(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Qt(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}var Zy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function e0(e,t="/"){let{pathname:r,search:n="",hash:s=""}=typeof e=="string"?Hn(e):e,i;return r?(r=am(r),r.startsWith("/")?i=Kd(r.substring(1),"/"):i=Kd(r,t)):i=t,{pathname:i,search:n0(n),hash:s0(s)}}function Kd(e,t){let r=La(t).split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function zo(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function t0(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function im(e){let t=t0(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function nc(e,t,r,n=!1){let s;typeof e=="string"?s=Hn(e):(s={...e},de(!s.pathname||!s.pathname.includes("?"),zo("?","pathname","search",s)),de(!s.pathname||!s.pathname.includes("#"),zo("#","pathname","hash",s)),de(!s.search||!s.search.includes("#"),zo("#","search","hash",s)));let i=e===""||s.pathname==="",a=i?"/":s.pathname,o;if(a==null)o=r;else{let h=t.length-1;if(!n&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}o=h>=0?t[h]:"/"}let u=e0(s,o),c=a&&a!=="/"&&a.endsWith("/"),d=(i||a===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(c||d)&&(u.pathname+="/"),u}var am=e=>e.replace(/\/\/+/g,"/"),bt=e=>am(e.join("/")),La=e=>e.replace(/\/+$/,""),r0=e=>La(e).replace(/^\/*/,"/"),n0=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,s0=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,i0=class{constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function a0(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function o0(e){let t=e.map(r=>r.route.path).filter(Boolean);return bt(t)||"/"}var om=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lm(e,t){let r=e;if(typeof r!="string"||!Zy.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,s=!1;if(om)try{let i=new URL(window.location.href),a=r.startsWith("//")?new URL(i.protocol+r):new URL(r),o=Qt(a.pathname,t);a.origin===i.origin&&o!=null?r=o+a.search+a.hash:s=!0}catch{St(!1,`<Link to="${r}">
50 contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var um=["POST","PUT","PATCH","DELETE"];new Set(um);var l0=["GET",...um];new Set(l0);var Wn=_.createContext(null);Wn.displayName="DataRouter";var no=_.createContext(null);no.displayName="DataRouterState";var cm=_.createContext(!1);function u0(){return _.useContext(cm)}var dm=_.createContext({isTransitioning:!1});dm.displayName="ViewTransition";var c0=_.createContext(new Map);c0.displayName="Fetchers";var d0=_.createContext(null);d0.displayName="Await";var ut=_.createContext(null);ut.displayName="Navigation";var si=_.createContext(null);si.displayName="Location";var Xt=_.createContext({outlet:null,matches:[],isDataRoute:!1});Xt.displayName="Route";var sc=_.createContext(null);sc.displayName="RouteError";var hm="REACT_ROUTER_ERROR",h0="REDIRECT",f0="ROUTE_ERROR_RESPONSE";function p0(e){if(e.startsWith(`${hm}:${h0}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function m0(e){if(e.startsWith(`${hm}:${f0}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new i0(t.status,t.statusText,t.data)}catch{}}function g0(e,{relative:t}={}){de(ii(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=_.useContext(ut),{hash:s,pathname:i,search:a}=oi(e,{relative:t}),o=i;return r!=="/"&&(o=i==="/"?r:bt([r,i])),n.createHref({pathname:o,search:a,hash:s})}function ii(){return _.useContext(si)!=null}function ct(){return de(ii(),"useLocation() may be used only in the context of a <Router> component."),_.useContext(si).location}var fm="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function pm(e){_.useContext(ut).static||_.useLayoutEffect(e)}function ai(){let{isDataRoute:e}=_.useContext(Xt);return e?T0():v0()}function v0(){de(ii(),"useNavigate() may be used only in the context of a <Router> component.");let e=_.useContext(Wn),{basename:t,navigator:r}=_.useContext(ut),{matches:n}=_.useContext(Xt),{pathname:s}=ct(),i=JSON.stringify(im(n)),a=_.useRef(!1);return pm(()=>{a.current=!0}),_.useCallback((u,c={})=>{if(St(a.current,fm),!a.current)return;if(typeof u=="number"){r.go(u);return}let d=nc(u,JSON.parse(i),s,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:bt([t,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[t,r,i,s,e])}_.createContext(null);function oi(e,{relative:t}={}){let{matches:r}=_.useContext(Xt),{pathname:n}=ct(),s=JSON.stringify(im(r));return _.useMemo(()=>nc(e,JSON.parse(s),n,t==="path"),[e,s,n,t])}function y0(e,t){return mm(e,t)}function mm(e,t,r){var x;de(ii(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=_.useContext(ut),{matches:s}=_.useContext(Xt),i=s[s.length-1],a=i?i.params:{},o=i?i.pathname:"/",u=i?i.pathnameBase:"/",c=i&&i.route;{let m=c&&c.path||"";vm(o,!c||m.endsWith("*")||m.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (under <Route path="${m}">) 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. 51 52Please change the parent <Route path="${m}"> to <Route path="${m==="/"?"*":`${m}/*`}">.`)}let d=ct(),h;if(t){let m=typeof t=="string"?Hn(t):t;de(u==="/"||((x=m.pathname)==null?void 0:x.startsWith(u)),`When overriding the location using \`<Routes location>\` 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 "${u}" but pathname "${m.pathname}" was given in the \`location\` prop.`),h=m}else h=d;let f=h.pathname||"/",p=f;if(u!=="/"){let m=u.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(m.length).join("/")}let y=rm(e,{pathname:p});St(c||y!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),St(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=k0(y&&y.map(m=>Object.assign({},m,{params:Object.assign({},a,m.params),pathname:bt([u,n.encodeLocation?n.encodeLocation(m.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?u:bt([u,n.encodeLocation?n.encodeLocation(m.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathnameBase])})),s,r);return t&&w?_.createElement(si.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},w):w}function w0(){let e=R0(),t=a0(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:n},i={padding:"2px 4px",backgroundColor:n},a=null;return console.error("Error handled by React Router default ErrorBoundary:",e),a=_.createElement(_.Fragment,null,_.createElement("p",null,"ð¿ Hey developer ð"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:i},"ErrorBoundary")," or"," ",_.createElement("code",{style:i},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application
52Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),r?_.createElement("pre",{style:s},r):null,a)}var _0=_.createElement(w0,null),gm=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=m0(e.digest);r&&(e=r)}let t=e!==void 0?_.createElement(Xt.Provider,{value:this.props.routeContext},_.createElement(sc.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?_.createElement(x0,{error:e},t):t}};gm.contextType=cm;var Fo=new WeakMap;function x0({children:e,error:t}){let{basename:r}=_.useContext(ut);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=p0(t.digest);if(n){let s=Fo.get(t);if(s)throw s;let i=lm(n.location,r);if(om&&!Fo.get(t))if(i.isExternal||n.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:n.replace}));throw Fo.set(t,a),a}return _.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function b0({routeContext:e,match:t,children:r}){let n=_.useContext(Wn);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(Xt.Provider,{value:e},r)}function k0(e,t=[],r){let n=r==null?void 0:r.state;if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let s=e,i=n==null?void 0:n.errors;if(i!=null){let d=s.findIndex(h=>h.route.id&&(i==null?void 0:i[h.route.id])!==void 0);de(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,d+1))}let a=!1,o=-1;if(r&&n){a=n.renderFallback;for(let d=0;d<s.length;d++){let h=s[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(o=d),h.route.id){let{loaderData:f,errors:p}=n,y=h.route.loader&&!f.hasOwnProperty(h.route.id)&&(!p||p[h.route.id]===void 0);if(h.route.lazy||y){r.isStatic&&(a=!0),o>=0?s=s.slice(0,o+1):s=[s[0]];break}}}}let u=r==null?void 0:r.onError,c=n&&u?(d,h)=>{var f,p;u(d,{location:n.location,params:((p=(f=n.matches)==null?void 0:f[0])==null?void 0:p.params)??{},unstable_pattern:o0(n.matches),errorInfo:h})}:void 0;return s.reduceRight((d,h,f)=>{let p,y=!1,w=null,x=null;n&&(p=i&&h.route.id?i[h.route.id]:void 0,w=h.route.errorElement||_0,a&&(o<0&&f===0?(vm("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,x=null):o===f&&(y=!0,x=h.route.hydrateFallbackElement||null)));let m=t.concat(s.slice(0,f+1)),g=()=>{let v;return p?v=w:y?v=x:h.route.Component?v=_.createElement(h.route.Component,null):h.route.element?v=h.route.element:v=d,_.createElement(b0,{match:h,routeContext:{outlet:d,matches:m,isDataRoute:n!=null},children:v})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?_.createElement(gm,{location:n.location,revalidation:n.revalidation,component:w,error:p,children:g(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:c}):g()},null)}function ic(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function S0(e){let t=_.useContext(Wn);return de(t,ic(e)),t}function E0(e){let t=_.useContext(no);return de(t,ic(e)),t}function j0(e){let t=_.useContext(Xt);return de(t,ic(e)),t}function ac(e){let t=j0(e),r=t.matches[t.matches.length-1];return de(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function C0(){return ac("useRouteId")}function R0(){var n;let e=_.useContext(sc),t=E0("useRouteError"),r=ac("useRouteError");return e!==void 0?e:(n=t.errors)==null?void 0:n[r]}function T0(){let{router:e}=S0("useNavigate"),t=ac("useNavigate"),r=_.useRef(!1);return pm(()=>{r.current=!0}),_.useCallback(async(s,i={})=>{St(r.current,fm),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...i}))},[e,t])}var Jd={};function vm(e,t,r){!t&&!Jd[e]&&(Jd[e]=!0,St(!1,r))}_.memo(N0);function N0({routes:e,future:t,state:r,isStatic:n,onError:s}){return mm(e,void 0,{state:r,isStatic:n,onError:s})}function Ct(e){de(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function P0({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:s,static:i=!1,unstable_useTransitions:a}){de(!ii(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=e.replace(/^\/*/,"/"),u=_.useMemo(()=>({basename:o,navigator:s,static:i,unstable_useTransitions:a,future:{}}),[o,s,i,a]);typeof r=="string"&&(r=Hn(r));let{pathname:c="/",search:d="",hash:h="",state:f=null,key:p="default",unstable_mask:y}=r,w=_.useMemo(()=>{let x=Qt(c,o);return x==null?null:{location:{pathname:x,search:d,hash:h,state:f,key:p,unstable_mask:y},navigationType:n}},[o,c,d,h,f,p,n,y]);
52return St(w!=null,`<Router basename="${o}"> is not able to match the URL "${c}${d}${h}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:_.createElement(ut.Provider,{value:u},_.createElement(si.Provider,{children:t,value:w}))}function A0({children:e,location:t}){return y0(Vl(e),t)}function Vl(e,t=[]){let r=[];return _.Children.forEach(e,(n,s)=>{if(!_.isValidElement(n))return;let i=[...t,s];if(n.type===_.Fragment){r.push.apply(r,Vl(n.props.children,i));return}de(n.type===Ct,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),de(!n.props.index||!n.props.children,"An index route cannot have child routes.");let a={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(a.children=Vl(n.props.children,i)),r.push(a)}),r}var sa="get",ia="application/x-www-form-urlencoded";function so(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function O0(e){return so(e)&&e.tagName.toLowerCase()==="button"}function L0(e){return so(e)&&e.tagName.toLowerCase()==="form"}function I0(e){return so(e)&&e.tagName.toLowerCase()==="input"}function $0(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function U0(e,t){return e.button===0&&(!t||t==="_self")&&!$0(e)}function Kl(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(s=>[r,s]):[[r,n]])},[]))}function M0(e,t){let r=Kl(e);return t&&t.forEach((n,s)=>{r.has(s)||t.getAll(s).forEach(i=>{r.append(s,i)})}),r}var Oi=null;function D0(){if(Oi===null)try{new FormData(document.createElement("form"),0),Oi=!1}catch{Oi=!0}return Oi}var B0=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function qo(e){return e!=null&&!B0.has(e)?(St(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ia}"`),null):e}function z0(e,t){let r,n,s,i,a;if(L0(e)){let o=e.getAttribute("action");n=o?Qt(o,t):null,r=e.getAttribute("method")||sa,s=qo(e.getAttribute("enctype"))||ia,i=new FormData(e)}else if(O0(e)||I0(e)&&(e.type==="submit"||e.type==="image")){let o=e.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||o.getAttribute("action");if(n=u?Qt(u,t):null,r=e.getAttribute("formmethod")||o.getAttribute("method")||sa,s=qo(e.getAttribute("formenctype"))||qo(o.getAttribute("enctype"))||ia,i=new FormData(o,e),!D0()){let{name:c,type:d,value:h}=e;if(d==="image"){let f=c?`${c}.`:"";i.append(`${f}x`,"0"),i.append(`${f}y`,"0")}else c&&i.append(c,h)}}else{if(so(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=sa,n=null,s=ia,a=e}return i&&s==="text/plain"&&(a=i,i=void 0),{action:n,method:r.toLowerCase(),encType:s,formData:i,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function oc(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ym(e,t,r,n){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${n}`:s.pathname=`${s.pathname}.${n}`:s.pathname==="/"?s.pathname=`_root.${n}`:t&&Qt(s.pathname,t)==="/"?s.pathname=`${La(t)}/_root.${n}`:s.pathname=`${La(s.pathname)}.${n}`,s}async function F0(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.
52isSpaMode,window.location.reload(),new Promise(()=>{})}}function q0(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function H0(e,t,r){let n=await Promise.all(e.map(async s=>{let i=t.routes[s.route.id];if(i){let a=await F0(i,r);return a.links?a.links():[]}return[]}));return J0(n.flat(1).filter(q0).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Gd(e,t,r,n,s,i){let a=(u,c)=>r[c]?u.route.id!==r[c].route.id:!0,o=(u,c)=>{var d;return r[c].pathname!==u.pathname||((d=r[c].route.path)==null?void 0:d.endsWith("*"))&&r[c].params["*"]!==u.params["*"]};return i==="assets"?t.filter((u,c)=>a(u,c)||o(u,c)):i==="data"?t.filter((u,c)=>{var h;let d=n.routes[u.route.id];if(!d||!d.hasLoader)return!1;if(a(u,c)||o(u,c))return!0;if(u.route.shouldRevalidate){let f=u.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((h=r[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function W0(e,t,{includeHydrateFallback:r}={}){return V0(e.map(n=>{let s=t.routes[n.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function V0(e){return[...new Set(e)]}function K0(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function J0(e,t){let r=new Set;return new Set(t),e.reduce((n,s)=>{let i=JSON.stringify(K0(s));return r.has(i)||(r.add(i),n.push({key:i,link:s})),n},[])}function lc(){let e=_.useContext(Wn);return oc(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function G0(){let e=_.useContext(no);return oc(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var uc=_.createContext(void 0);uc.displayName="FrameworkContext";function cc(){let e=_.useContext(uc);return oc(e,"You must render this element inside a <HydratedRouter> element"),e}function Q0(e,t){let r=_.useContext(uc),[n,s]=_.useState(!1),[i,a]=_.useState(!1),{onFocus:o,onBlur:u,onMouseEnter:c,onMouseLeave:d,onTouchStart:h}=t,f=_.useRef(null);_.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let w=m=>{m.forEach(g=>{a(g.isIntersecting)})},x=new IntersectionObserver(w,{threshold:.5});return f.current&&x.observe(f.current),()=>{x.disconnect()}}},[e]),_.useEffect(()=>{if(n){let w=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(w)}}},[n]);let p=()=>{s(!0)},y=()=>{s(!1),a(!1)};return r?e!=="intent"?[i,f,{}]:[i,f,{onFocus:ns(o,p),onBlur:ns(u,y),onMouseEnter:ns(c,p),onMouseLeave:ns(d,y),onTouchStart:ns(h,p)}]:[!1,f,{}]}function ns(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Y0({page:e,...t}){let r=u0(),{router:n}=lc(),s=_.useMemo(()=>rm(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?r?_.createElement(Z0,{page:e,matches:s,...t}):_.createElement(ew,{page:e,matches:s,...t}):null}function X0(e){let{manifest:t,routeModules:r}=cc(),[n,s]=_.useState([]);return _.useEffect(()=>{let i=!1;return H0(e,t,r).then(a=>{i||s(a)}),()=>{i=!0}},[e,t,r]),n}function Z0({page:e,matches:t,...r}){let n=ct(),{future:s}=cc(),{basename:i}=lc(),a=_.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let o=ym(e,i,s.unstable_trailingSlashAwareDataRequests,"rsc"),u=!1,c=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?u=!0:c.push(d.route.id);return u&&c.length>0&&o.searchParams.set("_routes",c.join(",")),[o.pathname+o.search]},[i,s.unstable_trailingSlashAwareDataRequests,e,n,t]);return _.createElement(_.Fragment,null,a.map(o=>_.createElement("link",{key:o,rel:"prefetch",as:"fetch",href:o,...r})))}function ew({page:e,matches:t,...r}){let n=ct(),{future:s,manifest:i,routeModules:a}=cc(),{basename:o}=lc(),{loaderData:u,matches:c}=G0(),d=_.useMemo(()=>Gd(e,t,c,i,n,"data"),[e,t,c,i,n]),h=_.useMemo(()=>Gd(e,t,c,i,n,"assets"),[e,t,c,i,n]),f=_.useMemo(()=>
52{if(e===n.pathname+n.search+n.hash)return[];let w=new Set,x=!1;if(t.forEach(g=>{var b;let v=i.routes[g.route.id];!v||!v.hasLoader||(!d.some(E=>E.route.id===g.route.id)&&g.route.id in u&&((b=a[g.route.id])!=null&&b.shouldRevalidate)||v.hasClientLoader?x=!0:w.add(g.route.id))}),w.size===0)return[];let m=ym(e,o,s.unstable_trailingSlashAwareDataRequests,"data");return x&&w.size>0&&m.searchParams.set("_routes",t.filter(g=>w.has(g.route.id)).map(g=>g.route.id).join(",")),[m.pathname+m.search]},[o,s.unstable_trailingSlashAwareDataRequests,u,n,i,d,t,e,a]),p=_.useMemo(()=>W0(h,i),[h,i]),y=X0(h);return _.createElement(_.Fragment,null,f.map(w=>_.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...r})),p.map(w=>_.createElement("link",{key:w,rel:"modulepreload",href:w,...r})),y.map(({key:w,link:x})=>_.createElement("link",{key:w,nonce:r.nonce,...x,crossOrigin:x.crossOrigin??r.crossOrigin})))}function tw(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var rw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{rw&&(window.__reactRouterVersion="7.14.2")}catch{}function nw({basename:e,children:t,unstable_useTransitions:r,window:n}){let s=_.useRef();s.current==null&&(s.current=$y({window:n,v5Compat:!0}));let i=s.current,[a,o]=_.useState({action:i.action,location:i.location}),u=_.useCallback(c=>{r===!1?o(c):_.startTransition(()=>o(c))},[r]);return _.useLayoutEffect(()=>i.listen(u),[i,u]),_.createElement(P0,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:i,unstable_useTransitions:r})}var wm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,st=_.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:s,reloadDocument:i,replace:a,unstable_mask:o,state:u,target:c,to:d,preventScrollReset:h,viewTransition:f,unstable_defaultShouldRevalidate:p,...y},w){let{basename:x,navigator:m,unstable_useTransitions:g}=_.useContext(ut),v=typeof d=="string"&&wm.test(d),b=lm(d,x);d=b.to;let E=g0(d,{relative:s}),S=ct(),j=null;if(o){let D=nc(o,[],S.unstable_mask?S.unstable_mask.pathname:"/",!0);x!=="/"&&(D.pathname=D.pathname==="/"?x:bt([x,D.pathname])),j=m.createHref(D)}let[P,C,N]=Q0(n,y),B=aw(d,{replace:a,unstable_mask:o,state:u,target:c,preventScrollReset:h,relative:s,viewTransition:f,unstable_defaultShouldRevalidate:p,unstable_useTransitions:g});function I(D){t&&t(D),D.defaultPrevented||B(D)}let T=!(b.isExternal||i),U=_.createElement("a",{...y,...N,href:(T?j:void 0)||b.absoluteURL||E,onClick:T?I:t,ref:tw(w,C),target:c,"data-discover":!v&&r==="render"?"true":void 0});return P&&!v?_.createElement(_.Fragment,null,U,_.createElement(Y0,{page:E})):U});st.displayName="Link";var aa=_.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:s=!1,style:i,to:a,viewTransition:o,children:u,...c},d){let h=oi(a,{relative:c.relative}),f=ct(),p=_.useContext(no),{navigator:y,basename:w}=_.useContext(ut),x=p!=null&&hw(h)&&o===!0,m=y.encodeLocation?y.encodeLocation(h).pathname:h.pathname,g=f.pathname,v=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;r||(g=g.toLowerCase(),v=v?v.toLowerCase():null,m=m.toLowerCase()),v&&w&&(v=Qt(v,w)||v);const b=m!=="/"&&m.endsWith("/")?m.length-1:m.length;let E=g===m||!s&&g.startsWith(m)&&g.charAt(b)==="/",S=v!=null&&(v===m||!s&&v.startsWith(m)&&v.charAt(m.length)==="/"),j={isActive:E,isPending:S,isTransitioning:x},P=E?t:void 0,C;typeof n=="function"?C=n(j):C=[n,E?"active":null,S?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let N=typeof i=="function"?i(j):i;return _.createElement(st,{...c,"aria-current":P,className:C,ref:d,style:N,to:a,viewTransition:o},typeof u=="function"?u(j):u)});aa.displayName="NavLink";var sw=_.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:s,state:i,method:a=sa,action:o,onSubmit:u,relative:c,preventScrollReset:d,viewTransition:h,unstable_defaultShouldRevalidate:f,...p},y)=>{let{unstable_useTransitions:w}=_.useContext(ut),x=cw(),m=dw(o,{relative:c}
52),g=a.toLowerCase()==="get"?"get":"post",v=typeof o=="string"&&wm.test(o),b=E=>{if(u&&u(E),E.defaultPrevented)return;E.preventDefault();let S=E.nativeEvent.submitter,j=(S==null?void 0:S.getAttribute("formmethod"))||a,P=()=>x(S||E.currentTarget,{fetcherKey:t,method:j,navigate:r,replace:s,state:i,relative:c,preventScrollReset:d,viewTransition:h,unstable_defaultShouldRevalidate:f});w&&r!==!1?_.startTransition(()=>P()):P()};return _.createElement("form",{ref:y,method:g,action:m,onSubmit:n?u:b,...p,"data-discover":!v&&e==="render"?"true":void 0})});sw.displayName="Form";function iw(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function _m(e){let t=_.useContext(Wn);return de(t,iw(e)),t}function aw(e,{target:t,replace:r,unstable_mask:n,state:s,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:u,unstable_useTransitions:c}={}){let d=ai(),h=ct(),f=oi(e,{relative:a});return _.useCallback(p=>{if(U0(p,t)){p.preventDefault();let y=r!==void 0?r:Ws(h)===Ws(f),w=()=>d(e,{replace:y,unstable_mask:n,state:s,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:u});c?_.startTransition(()=>w()):w()}},[h,d,f,r,n,s,t,e,i,a,o,u,c])}function ow(e){St(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=_.useRef(Kl(e)),r=_.useRef(!1),n=ct(),s=_.useMemo(()=>M0(n.search,r.current?null:t.current),[n.search]),i=ai(),a=_.useCallback((o,u)=>{const c=Kl(typeof o=="function"?o(new URLSearchParams(s)):o);r.current=!0,i("?"+c,u)},[i,s]);return[s,a]}var lw=0,uw=()=>`__${String(++lw)}__`;function cw(){let{router:e}=_m("useSubmit"),{basename:t}=_.useContext(ut),r=C0(),n=e.fetch,s=e.navigate;return _.useCallback(async(i,a={})=>{let{action:o,method:u,encType:c,formData:d,body:h}=z0(i,t);if(a.navigate===!1){let f=a.fetcherKey||uw();await n(f,r,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||u,formEncType:a.encType||c,flushSync:a.flushSync})}else await s(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||u,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[n,s,t,r])}function dw(e,{relative:t}={}){let{basename:r}=_.useContext(ut),n=_.useContext(Xt);de(n,"useFormAction must be used inside a RouteContext");let[s]=n.matches.slice(-1),i={...oi(e||".",{relative:t})},a=ct();if(e==null){i.search=a.search;let o=new URLSearchParams(i.search),u=o.getAll("index");if(u.some(d=>d==="")){o.delete("index"),u.filter(h=>h).forEach(h=>o.append("index",h));let d=o.toString();i.search=d?`?${d}`:""}}return(!e||e===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(i.pathname=i.pathname==="/"?r:bt([r,i.pathname])),Ws(i)}function hw(e,{relative:t}={}){let r=_.useContext(dm);de(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=_m("useViewTransitionState"),s=oi(e,{relative:t});if(!r.isTransitioning)return!1;let i=Qt(r.currentLocation.pathname,n)||r.currentLocation.pathname,a=Qt(r.nextLocation.pathname,n)||r.nextLocation.pathname;return Oa(s.pathname,a)!=null||Oa(s.pathname,i)!=null}function io(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function fw(e,t,r,n){function s(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function o(d){try{c(n.next(d))}catch(h){a(h)}}function u(d){try{c(n.throw(d))}catch(h){a(h)}}function c(d){d.done?i(d.value):s(d.value).then(o,u)}c((n=n.apply(e,t||[])).next())})}const pw=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);
52class dc extends Error{constructor(t,r="FunctionsError",n){super(t),this.name=r,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class mw extends dc{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Qd extends dc{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Yd extends dc{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Jl;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(Jl||(Jl={}));class gw{constructor(t,{headers:r={},customFetch:n,region:s=Jl.Any}={}){this.url=t,this.headers=r,this.region=s,this.fetch=pw(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return fw(this,arguments,void 0,function*(r,n={}){var s;let i,a;try{const{headers:o,method:u,body:c,signal:d,timeout:h}=n;let f={},{region:p}=n;p||(p=this.region);const y=new URL(`${this.url}/${r}`);p&&p!=="any"&&(f["x-region"]=p,y.searchParams.set("forceFunctionRegion",p));let w;c&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",w=c):typeof c=="string"?(f["Content-Type"]="text/plain",w=c):typeof FormData<"u"&&c instanceof FormData?w=c:(f["Content-Type"]="application/json",w=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?w=JSON.stringify(c):w=c;let x=d;h&&(a=new AbortController,i=setTimeout(()=>a.abort(),h),d?(x=a.signal,d.addEventListener("abort",()=>a.abort())):x=a.signal);const m=yield this.fetch(y.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),o),body:w,signal:x}).catch(E=>{throw new mw(E)}),g=m.headers.get("x-relay-error");if(g&&g==="true")throw new Qd(m);if(!m.ok)throw new Yd(m);let v=((s=m.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),b;return v==="application/json"?b=yield m.json():v==="application/octet-stream"||v==="application/pdf"?b=yield m.blob():v==="text/event-stream"?b=m:v==="multipart/form-data"?b=yield m.formData():b=yield m.text(),{data:b,error:null,response:m}}catch(o){return{data:null,error:o,response:o instanceof Yd||o instanceof Qd?o.context:void 0}}finally{i&&clearTimeout(i)}})}}const xm=3,Xd=e=>Math.min(1e3*2**e,3e4),vw=[520,503],bm=["GET","HEAD","OPTIONS"];var yw=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
52de=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function Zd(e,t){return new Promise(r=>{if(t!=null&&t.aborted){r();return}const n=setTimeout(()=>{t==null||t.removeEventListener("abort",s),r()},e);function s(){clearTimeout(n),r()}t==null||t.addEventListener("abort",s)})}function ww(e,t,r,n){return!(!n||r>=xm||!bm.includes(e)||!vw.includes(t))}var _w=class{constructor(e){var t,r,n,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=e.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(s=e.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=e.retry)!==null&&i!==void 0?i:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var r=this;if(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"),this.shouldStripNulls){const a=this.headers.get("Accept");a==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!a||a==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let i=(async()=>{let a=0;for(;;){const c=new Headers(r.headers);a>0&&c.set("X-Retry-Count",String(a));let d;try{d=await n(r.url.toString(),{method:r.method,headers:c,body:JSON.stringify(r.body,(h,f)=>typeof f=="bigint"?f.toString():f),signal:r.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!bm.includes(r.method))throw h;if(r.retryEnabled&&a<xm){const f=Xd(a);a++,await Zd(f,r.signal);continue}throw h}if(ww(r.method,d.status,a,r.retryEnabled)){var o,u;const h=(o=(u=d.headers)===null||u===void 0?void 0:u.get("Retry-After"))!==null&&o!==void 0?o:null,f=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:Xd(a);await d.text(),a++,await Zd(f,r.signal);continue}return await r.processResponse(d)}})();return this.shouldThrowOnError||(i=i.catch(a=>{var o;let u="",c="",d="";const h=a==null?void 0:a.cause;if(h){var f,p,y,w;const g=(f=h==null?void 0:h.message)!==null&&f!==void 0?f:"",v=(p=h==null?void 0:h.code)!==null&&p!==void 0?p:"";u=`${(y=a==null?void 0:a.name)!==null&&y!==void 0?y:"FetchError"}: ${a==null?void 0:a.message}`,u+=` 53 54Caused by: ${(w=h==null?void 0:h.name)!==null&&w!==void 0?w:"Error"}: ${g}`,v&&(u+=` (${v})`),h!=null&&h.stack&&(u+=` 55${h.stack}`)}else{var x;u=(x=a==null?void 0:a.stack)!==null&&x!==void 0?x:""}const m=this.url.toString().length;return(a==null?void 0:a.name)==="AbortError"||(a==null?void 0:a.code)==="ABORT_ERR"?(d="",c="Request was aborted (timeout or manual cancellation)",m>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${m} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(d="",c="HTTP headers exceeded server limits (typically 16KB)",m>this.urlLengthLimit&&(c+=`. Your request URL is ${m} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(o=a==null?void 0:a.name)!==null&&o!==void 0?o:"FetchError"}: ${a==null?void 0:a.message}`,details:u,hint:c,code:d},data:null,count:null,status:0,statusText:""}}
55)),i.then(e,t)}async processResponse(e){var t=this;let r=null,n=null,s=null,i=e.status,a=e.statusText;if(e.ok){var o,u;if(t.method!=="HEAD"){var c;const f=await e.text();f===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((c=t.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?n=f:n=JSON.parse(f))}const d=(o=t.headers.get("Prefer"))===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),h=(u=e.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");d&&h&&h.length>1&&(s=parseInt(h[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,s=null,i=406,a="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const d=await e.text();try{r=JSON.parse(d),Array.isArray(r)&&e.status===404&&(n=[],r=null,i=200,a="OK")}catch{e.status===404&&d===""?(i=204,a="No Content"):r={message:d}}if(r&&t.shouldThrowOnError)throw new yw(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:a}}returns(){return this}overrideTypes(){return this}},xw=class extends _w{select(e){let t=!1;const r=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const i=s?`${s}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var a;const o=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),u=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${u}"; options=${o};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const eh=new RegExp("[,()]");var on=class extends xw{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(n=>typeof n=="string"&&eh.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(n=>typeof n=="string"&&eh.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${s}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,r])=>
55r!==void 0).forEach(([t,r])=>{this.url.searchParams.append(t,`eq.${r}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},bw=class{constructor(e,{headers:t={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:n}=t??{},s=r?"HEAD":"GET";let i=!1;const a=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:o,headers:u}=this.cloneRequestState();return o.searchParams.set("select",a),n&&u.append("Prefer",`count=${n}`),new on({method:s,url:o,headers:u,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;const s="POST",{url:i,headers:a}=this.cloneRequestState();if(t&&a.append("Prefer",`count=${t}`),r||a.append("Prefer","missing=default"),Array.isArray(e)){const o=e.reduce((u,c)=>u.concat(Object.keys(c)),[]);if(o.length>0){const u=[...new Set(o)].map(c=>`"${c}"`);i.searchParams.set("columns",u.join(","))}}return new on({method:s,url:i,headers:a,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;const a="POST",{url:o,headers:u}=this.cloneRequestState();if(u.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&o.searchParams.set("on_conflict",t),n&&u.append("Prefer",`count=${n}`),s||u.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((d,h)=>d.concat(Object.keys(h)),[]);if(c.length>0){const d=[...new Set(c)].map(h=>`"${h}"`);o.searchParams.set("columns",d.join(","))}}return new on({method:a,url:o,headers:u,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const n="PATCH",{url:s,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new on({method:n,url:s,headers:i,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const r="DELETE",{url:n,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new on({method:r,url:n,headers:s,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Vs(e){"@babel/helpers - typeof";return Vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vs(e)}function kw(e,t){if(Vs(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Vs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sw(e){var t=kw(e,"string");return Vs(t)=="symbol"?t:t+""}function Ew(e,t,r){return(t=Sw(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function th(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Li(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?th(Object(r),!0).forEach(function(n){Ew(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):th(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var jw=class km{constructor(t,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:a=8e3,retry:o}={}){this.url=t,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=a;const u=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,d)=>{const h=new AbortController,f=setTimeout(()=>h.abort(),i),p=d==null?void 0:d.signal;if(p){if(p.aborted)return clearTimeout(f),u(c,d);const y=()=>{clearTimeout(f),h.abort()};return p.addEventListener("abort",y,{once:!0}),u(c,Li(Li({},d),{},{signal:h.signal})).finally(()=>{clearTimeout(f),p.removeEventListener("abort",y)})}return u(c,Li(Li({},d),{},{signal:h.signal})).finally(()=>clearTimeout(f))}:this.fetch=u,this.retry=o}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new bw(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new km(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,r={},{head:n=!1,get:s=!1,count:i}={}){var a;let o;const u=new URL(`${this.url}/rpc/${t}`);let c;const d=p=>p!==null&&typeof p=="object"&&(!Array.isArray(p)||p.some(d)),h=n&&Object.values(r).some(d);h?(o="POST",c=r):n||s?(o=n?"HEAD":"GET",Object.entries(r).filter(([p,y])=>y!==void 0).map(([p,y])=>[p,Array.isArray(y)?`{${y.join(",")}}`:`${y}
55`]).forEach(([p,y])=>{u.searchParams.append(p,y)})):(o="POST",c=r);const f=new Headers(this.headers);return h?f.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&f.set("Prefer",`count=${i}`),new on({method:o,url:u,headers:f,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class Cw{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};if(typeof globalThis<"u"&&typeof r.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"&&r.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const s=globalThis.process;if(s){const i=s.versions;if(i&&i.node){const a=i.node,o=parseInt(a.replace(/^v/,"").split(".")[0]);return o>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${o} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${o} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: 56import ws from "ws" 57new 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 t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let r=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(r+=` 58 59Suggested solution: ${t.workaround}`),new Error(r)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const Rw="2.106.1",Tw=`realtime-js/${Rw}`,Nw="1.0.0",Sm="2.0.0",Pw=Sm,Aw=1e4,Ow=100,lr={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Em={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Gl={connecting:"connecting",closing:"closing",closed:"closed"};class Lw{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,r){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(t));let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(t){var r;return this._isArrayBuffer((r=t.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var r,n;const s=(n=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(t){var r,n;const s=(n=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},a=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(t,r,n){var s,i;const a=t.topic,o=(s=t.ref)!==null&&s!==void 0?s:"",u=(i=t.join_ref)!==null&&i!==void 0?i:"",c=t.payload.event,d=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},h=Object.keys(d).length===0?"":JSON.stringify(d);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const f=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+o.length+a.length+c.length+h.length,p=new ArrayBuffer(this.HEADER_LENGTH+f);let y=new DataView(p),w=0;y.setUint8(w++,this.KINDS.userBroadcastPush),y.setUint8(w++,u.length),y.setUint8(w++,o.length),y.setUint8(w++,a.length),y.setUint8(w++,c.length),y.setUint8(w++,h.length),y.setUint8(w++,r),Array.from(u,m=>y.setUint8(w++,m.charCodeAt(0))),Array.from(o,m=>y.setUint8(w++,m.charCodeAt(0))),Array.from(a,m=>y.setUint8(w++,m.charCodeAt(0))),Array.from(c,m=>y.setUint8(w++,m.charCodeAt(0))),Array.from(h,m=>y.setUint8(w++,m.charCodeAt(0)));var x=new Uint8Array(p.byteLength+n.byteLength);return x.set(new Uint8Array(p),0),x.set(new Uint8Array(n),p.byteLength),x.buffer}decode(t,r){if(this._isArrayBuffer(t)){let n=this._binaryDecode(t);return r(n)}if(typeof t=="string"){const n=JSON.parse(t),[s,i,a,o,u]=n;return r({join_ref:s,ref:i,topic:a,event:o,payload:u})}return r({})}_binaryDecode(t){const r=new DataView(t),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,r,s)}}_decodeUserBroadcast(t,r,n){const s=r.getUint8(1),i=r.getUint8(2),a=r.getUint8(3),o=r.getUint8(4);let u=this.HEADER_LENGTH+4;const c=n.decode(t.slice(u,u+s));u=u+s;const d=n.decode(t.slice(u,u+i));u=u+i;const h=n.decode(t.slice(u,u+a));u=u+a;const f=t.slice(u,t.byteLength),p=o===this.JSON_ENCODING?JSON.parse(n.decode(f)):f,y={type:this.BROADCAST_EVENT,event:d,payload:p};return a>0&&(y.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:y}}_isArrayBuffer(t){var r;return t instanceof ArrayBuffer||((r=t==null?void 0:t.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(t,r){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([n])=>r.includes(n)))}}var te;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(te||(te={}));const rh=(e,t,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return t?Object.keys(t).reduce((i,a)=>(i[a]=Iw(a,e,t,s),i),{}):{}},Iw=(e,t,r,n)=>{const s=t.find(o=>o.name===e),i=s==null?void 0:s.type,a=r[e];return i&&!n.includes(i)?jm(i,a):Ql(a)},jm=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return Dw(t,r)}switch(e){case te.bool:return $w(t);case te.float4:case te.float8:case te.int2:case te.int4:case te.int8:case te.numeric:case te.oid:return Uw(t);case te.json:case te.jsonb:return Mw(t);case te.timestamp:return Bw(t);case te.abstime:case te.date:case te.daterange:case te.int4range:case te.int8range:case te.money:case te.reltime:case te.text:case te.time:case te.timestamptz:case te.timetz:case te.tsrange:case te.tstzrange:return Ql(t);default:return Ql(t)}},Ql=e=>e,$w=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Uw=e=>{if(typeof e=="string"){const t=parseFloat(e);
vendor: 4,773 bytes, line 59
59if(!Number.isNaN(t))return t}return e},Mw=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Dw=(e,t)=>{if(typeof e!="string")return e;const r=e.length-1,n=e[r];if(e[0]==="{"&&n==="}"){let i;const a=e.slice(1,r);try{i=JSON.parse("["+a+"]")}catch{i=a?a.split(","):[]}return i.map(o=>jm(t,o))}return e},Bw=e=>typeof e=="string"?e.replace(" ","T"):e,Cm=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var ks=e=>typeof e=="function"?e:function(){return e},zw=typeof self<"u"?self:null,ln=typeof window<"u"?window:null,Tt=zw||ln||globalThis,Fw="2.0.0",qw=1e4,Hw=1e3,Nt={connecting:0,open:1,closing:2,closed:3},ze={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Dt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Yl={longpoll:"longpoll",websocket:"websocket"},Ww={complete:4},Xl="base64url.bearer.phx.",Ii=class{constructor(e,t,r,n){this.channel=e,this.event=t,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),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()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Rm=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Vw=class{constructor(e,t,r){this.state=ze.closed,this.topic=e,this.params=ks(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Ii(this,Dt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Rm(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=ze.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=ze.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=ze.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=ze.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new Ii(this,Dt.leave,ks({}),this.timeout).send(),this.state=ze.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Dt.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}
vendor: 5,263 bytes, line 59
59teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ze.closed,this.bindings=[]}onClose(e){this.on(Dt.close,e)}onError(e){return this.on(Dt.error,t=>e(t))}on(e,t){let r=this.bindingRef++;return this.bindings.push({event:e,ref:r,callback:t}),r}off(e,t){this.bindings=this.bindings.filter(r=>!(r.event===e&&(typeof t>"u"||t===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new Ii(this,e,function(){return t},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=ze.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Dt.close,"leave")},r=new Ii(this,Dt.leave,ks({}),e);return r.receive("ok",()=>t()).receive("timeout",()=>t()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}filterBindings(e,t,r){return!0}isMember(e,t,r,n){return this.topic!==e?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=ze.joining,this.joinPush.resend(e))}trigger(e,t,r,n){let s=this.onMessage(e,t,r,n);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(a=>a.event===e&&this.filterBindings(a,t,r));for(let a=0;a<i.length;a++)i[a].callback(s,r,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===ze.closed}isErrored(){return this.state===ze.errored}isJoined(){return this.state===ze.joined}isJoining(){return this.state===ze.joining}isLeaving(){return this.state===ze.leaving}},Ia=class{static request(e,t,r,n,s,i,a){if(Tt.XDomainRequest){let o=new Tt.XDomainRequest;return this.xdomainRequest(o,e,t,n,s,i,a)}else if(Tt.XMLHttpRequest){let o=new Tt.XMLHttpRequest;return this.xhrRequest(o,e,t,r,n,s,i,a)}else{if(Tt.fetch&&Tt.AbortController)return this.fetchRequest(e,t,r,n,s,i,a);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,r,n,s,i,a){let o={method:e,headers:r,body:n},u=null;return s&&(u=new AbortController,setTimeout(()=>u.abort(),s),o.signal=u.signal),Tt.fetch(t,o).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>a&&a(c)).catch(c=>{c.name==="AbortError"&&i?i():a&&a(null)}),u}static xdomainRequest(e,t,r,n,s,i,a){return e.timeout=s,e.open(t,r),e.onload=()=>{let o=this.parseJSON(e.responseText);a&&a(o)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(n),e}static xhrRequest(e,t,r,n,s,i,a,o){e.open(t,r,!0),e.timeout=i;for(let[u,c]of Object.entries(n))e.setRequestHeader(u,c);return e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===Ww.complete&&o){let u=this.parseJSON(e.responseText);o(u)}},a&&(e.ontimeout=a),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let r=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let s=t?`${t}[${n}]`:n,i=e[n];typeof i=="object"?r.push(this.serialize(i,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},Kw=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let s=0;s<n;s++)t+=String.fromCharCode(r[s]);return btoa(t)},en=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(Xl)&&(this.authToken=atob(t[1].slice(Xl.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=Nt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Yl.websocket),"$1/"+Yl.longpoll)}endpointURL(){return Ia.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=Nt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Nt.open||this.readyState===Nt.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:r,token:n,messages:s}=t;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Nt.open,this.onopen({}),this.poll();break;
59case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(e){typeof e!="string"&&(e=Kw(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(` 60`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,r){for(let s of this.reqs)s.abort();this.readyState=Nt.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(e,t,r,n,s){let i,a=()=>{this.reqs.delete(i),n()};i=Ia.request(e,this.endpointURL(),t,r,this.timeout,a,o=>{this.reqs.delete(i),this.isActive()&&s(o)}),this.reqs.add(i)}},Jw=class hs{constructor(t,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,s=>{let{onJoin:i,onLeave:a,onSync:o}=this.caller;this.joinRef=this.channel.joinRef(),this.state=hs.syncState(this.state,s,i,a),this.pendingDiffs.forEach(u=>{this.state=hs.syncDiff(this.state,u,i,a)}),this.pendingDiffs=[],o()}),this.channel.on(n.diff,s=>{let{onJoin:i,onLeave:a,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=hs.syncDiff(this.state,s,i,a),o())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return hs.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,r,n,s){let i=this.clone(t),a={},o={};return this.map(i,(u,c)=>{r[u]||(o[u]=c)}),this.map(r,(u,c)=>{let d=i[u];if(d){let h=c.metas.map(w=>w.phx_ref),f=d.metas.map(w=>w.phx_ref),p=c.metas.filter(w=>f.indexOf(w.phx_ref)<0),y=d.metas.filter(w=>h.indexOf(w.phx_ref)<0);p.length>0&&(a[u]=c,a[u].metas=p),y.length>0&&(o[u]=this.clone(d),o[u].metas=y)}else a[u]=c}),this.syncDiff(i,{joins:a,leaves:o},n,s)}static syncDiff(t,r,n,s){let{joins:i,leaves:a}=this.clone(r);return n||(n=function(){}),s||(s=function(){}),this.map(i,(o,u)=>{let c=t[o];if(t[o]=this.clone(u),c){let d=t[o].metas.map(f=>f.phx_ref),h=c.metas.filter(f=>d.indexOf(f.phx_ref)<0);t[o].metas.unshift(...h)}n(o,c,u)}),this.map(a,(o,u)=>{let c=t[o];if(!c)return;let d=u.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>d.indexOf(h.phx_ref)<0),s(o,c,u),c.metas.length===0&&delete t[o]}),t}static list(t,r){return r||(r=function(n,s){return s}),this.map(t,(n,s)=>r(n,s))}static map(t,r){return Object.getOwnPropertyNames(t).map(n=>r(n,t[n]))}static clone(t){return JSON.parse(JSON.stringify(t))}},$i={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[r,n,s,i,a]=JSON.parse(e);return t({join_ref:r,ref:n,topic:s,event:i,payload:a})}},binaryEncode(e){let{join_ref:t,ref:r,event:n,topic:s,payload:i}=e,a=this.META_LENGTH+t.length+r.length+s.length+n.length,o=new ArrayBuffer(this.HEADER_LENGTH+a),u=new DataView(o),c=0;u.setUint8(c++,this.KINDS.push),u.setUint8(c++,t.length),u.setUint8(c++,r.length),u.setUint8(c++,s.length),u.setUint8(c++,n.length),Array.from(t,h=>u.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>u.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>u.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>u.setUint8(c++,h.charCodeAt(0)));var d=new Uint8Array(o.byteLength+i.byteLength);return d.set(new Uint8Array(o),0),d.set(new Uint8Array(i),o.byteLength),d.buffer},binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),n=new TextDecoder;
vendor: 8,661 bytes, line 60
60switch(r){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,o=r.decode(e.slice(a,a+n));a=a+n;let u=r.decode(e.slice(a,a+s));a=a+s;let c=r.decode(e.slice(a,a+i));a=a+i;let d=e.slice(a,e.byteLength);return{join_ref:o,ref:null,topic:u,event:c,payload:d}},decodeReply(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),a=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,u=r.decode(e.slice(o,o+n));o=o+n;let c=r.decode(e.slice(o,o+s));o=o+s;let d=r.decode(e.slice(o,o+i));o=o+i;let h=r.decode(e.slice(o,o+a));o=o+a;let f=e.slice(o,e.byteLength),p={status:h,response:f};return{join_ref:u,ref:c,topic:d,event:Dt.reply,payload:p}},decodeBroadcast(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=this.HEADER_LENGTH+2,a=r.decode(e.slice(i,i+n));i=i+n;let o=r.decode(e.slice(i,i+s));i=i+s;let u=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:a,event:o,payload:u}}},Gw=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||qw,this.transport=t.transport||Tt.WebSocket||en,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=Tt&&Tt.sessionStorage}catch{}this.sessionStore=t.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=$i.encode.bind($i),this.defaultDecoder=$i.decode.bind($i),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==en?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;ln&&ln.addEventListener&&(ln.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),ln.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),ln.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(s,i,a)=>{console.log(`${s}: ${i}`,a)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=ks(t.params||{}),this.endPoint=`${e}/${Yl.websocket}`,this.vsn=t.vsn||Fw,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Rm(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return en}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Ia.appendParams(Ia.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,r)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=ks(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==en?this.connectWithFallback(en,this.longPollFallbackMs):this.transportConnect())}log(e,t,r){this.logger&&this.logger(e,t,r)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let n=this.onMessage(s=>{s.ref===t&&(this.off([n]),e(Date.now()-r))});return!0}transportName(e){switch(e){case en:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${Xl}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,s,i,a=this.transportName(e),o=u=>{this.log("transport",`falling back to ${a}...`,u),this.off([s,i]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),i=this.onError(u=>{this.log("transport","error",u),n&&!r&&(clearTimeout(this.fallbackTimer),o(u))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let u=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${u}`,"true"),this.log("transport",`established ${u} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping(u=>{this.log("transport","connected to primary after",u),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Hw,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,r){if(!this.conn)return e&&e();const n=this.conn;this.waitForBufferDone(n,()=>{t?n.close(t,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,r=1){if(r===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,r+1)},150*r)}waitForSocketClosed(e,t,r=1){if(r===5||e.readyState===Nt.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,r+1)},150*r)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",e,t,r),(t===this.transport||r>0)&&this.triggerChanError(e)}
vendor: 4,126 bytes, line 60
60triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Dt.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case Nt.connecting:return"connecting";case Nt.open:return"open";case Nt.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([r])=>e.indexOf(r)===-1)}channel(e,t={}){let r=new Vw(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:n,ref:s,join_ref:i}=e;this.log("push",`${t} ${r} (${i}, ${s})`,n)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:r,event:n,payload:s,ref:i,join_ref:a}=t;if(i&&i===this.pendingHeartbeatRef){const o=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",o)}catch(u){this.log("error","error in heartbeat callback",u)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${r} ${n} ${i&&"("+i+")"||""}`.trim(),s);for(let o=0;o<this.channels.length;o++){const u=this.channels[o];u.isMember(r,n,s,a)&&u.trigger(n,s,i,a)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,n])=>{try{n(...t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}leaveOpenTopic(e){let t=this.channels.find(r=>r.topic===e&&(r.isJoined()||r.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Ss{constructor(t,r){const n=Yw(r);this.presence=new Jw(t.getChannel(),n),this.presence.onJoin((s,i,a)=>{const o=Ss.onJoinPayload(s,i,a);t.getChannel().trigger("presence",o)}),this.presence.onLeave((s,i,a)=>{const o=Ss.onLeavePayload(s,i,a);t.getChannel().trigger("presence",o)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Ss.transformState(this.presence.state)}static transformState(t){return t=Qw(t),Object.getOwnPropertyNames(t).reduce((r,n)=>{const s=t[n];return r[n]=oa(s),r},{})}static onJoinPayload(t,r,n){const s=nh(r),i=oa(n);return{event:"join",key:t,currentPresences:s,newPresences:i}}static onLeavePayload(t,r,n){const s=nh(r),i=oa(n);return{event:"leave",key:t,currentPresences:s,leftPresences:i}}}function oa(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function Qw(e){return JSON.parse(JSON.stringify(e))}function Yw(e){return(e==null?void 0:e.events)&&{events:e.events}}function nh(e){return e!=null&&e.metas?oa(e):[]}var sh;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(sh||(sh={}));class Xw{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new Ss(this.channel.channelAdapter,r)}}function Zw(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);
60if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const r=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${r}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class e_{constructor(t,r,n){const s=t_(n);this.channel=t.getSocket().channel(r,s),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,r){return this.channel.on(t,r)}off(t,r){this.channel.off(t,r)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,r,n){let s;try{s=this.channel.push(t,r,n)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>Ow){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return s}updateJoinPayload(t){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),t)}canPush(){return this.socket.isConnected()&&this.state===lr.joined}isJoined(){return this.state===lr.joined}isJoining(){return this.state===lr.joining}isClosed(){return this.state===lr.closed}isLeaving(){return this.state===lr.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function t_(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var ih;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(ih||(ih={}));var Sn;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Sn||(Sn={}));var Bt;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Bt||(Bt={}));class Es{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,r={config:{}},n){var s,i;if(this.topic=t,this.params=r,this.socket=n,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new e_(this.socket.socketAdapter,t,this.params),this.presence=new Xw(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Cm(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,r=this.timeout){var n,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:a,presence:o,private:u}}=this.params,c=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(p=>p.filter))!==null&&s!==void 0?s:[],d=!!this.bindings[Sn.PRESENCE]&&this.bindings[Sn.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},f={broadcast:a,presence:Object.assign(Object.assign({},o),{enabled:d}),postgres_changes:c,private:u};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(p=>{t==null||t(Bt.CHANNEL_ERROR,Zw(p))}),this._onClose(()=>t==null?void 0:t(Bt.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:p})=>{if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){t==null||t(Bt.SUBSCRIBED);return}this._updatePostgresBindings(p,t)}
60).receive("error",p=>{this.state=lr.errored;const y=Object.values(p).join(", ")||"error";t==null||t(Bt.CHANNEL_ERROR,new Error(y,{cause:p}))}).receive("timeout",()=>{t==null||t(Bt.TIMED_OUT)})}return this}_updatePostgresBindings(t,r){var n;const s=this.bindings.postgres_changes,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0,a=[];for(let o=0;o<i;o++){const u=s[o],{filter:{event:c,schema:d,table:h,filter:f}}=u,p=t&&t[o];if(p&&p.event===c&&Es.isFilterValueEqual(p.schema,d)&&Es.isFilterValueEqual(p.table,h)&&Es.isFilterValueEqual(p.filter,f))a.push(Object.assign(Object.assign({},u),{id:p.id}));else{this.unsubscribe(),this.state=lr.errored,r==null||r(Bt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,this.state!=lr.errored&&r&&r(Bt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,r={}){return await this.send({type:"presence",event:"track",payload:t},r.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,r,n){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=t===Sn.PRESENCE||t===Sn.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,r,n)}async httpSend(t,r,n={}){var s;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:r,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(o.status===202)return{success:!0};let u=o.statusText;try{const c=await o.json();u=c.error||c.message||u}catch{}return Promise.reject(new Error(u))}async send(t,r={}){var n,s;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated
60in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:a}=t,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=c.body)===null||s===void 0?void 0:s.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,o,u;const c=this.channelAdapter.push(t.type,t,r.timeout||this.timeout);t.type==="broadcast"&&!(!((u=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.broadcast)===null||u===void 0)&&u.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),a=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),a}_on(t,r,n){const s=t.toLocaleLowerCase(),i=this.channelAdapter.on(t,n),a={type:s,filter:r,callback:n,ref:i};return this.bindings[s]?this.bindings[s].push(a):this.bindings[s]=[a],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,r,n)=>{var s,i,a,o,u,c,d;const h=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,n))return!1;const f=(s=this.bindings[h])===null||s===void 0?void 0:s.find(p=>p.ref===t.ref);if(!f)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in f){const p=f.id,y=(i=f.filter)===null||i===void 0?void 0:i.event;return p&&((a=r.ids)===null||a===void 0?void 0:a.includes(p))&&(y==="*"||(y==null?void 0:y.toLocaleLowerCase())===((o=r.data)===null||o===void 0?void 0:o.type.toLocaleLowerCase()))}else{const p=(c=(u=f==null?void 0:f.filter)===null||u===void 0?void 0:u.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return p==="*"||p===((d=r==null?void 0:r.event)===null||d===void 0?void 0:d.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===h})}_notThisChannelEvent(t,r){const{close:n,error:s,leave:i,join:a}=Em;return r&&[n,s,i,a].includes(t)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,r,n)=>{if(typeof r=="object"&&"ids"in r){const s=r.data,{schema:i,table:a,commit_timestamp:o,type:u,errors:c}=s;return Object.assign(Object.assign({},{schema:i,table:a,commit_timestamp:o,eventType:u,new:{},old:{},errors:c}),this._getPayloadRecords(s))}return r})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in t.bindings)for(const n of t.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(t,r){return(t??void 0)===(r??void 0)}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=rh(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=rh(t.columns,t.old_record)),r}}class r_{constructor(t,r){this.socket=new Gw(t,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,r,n,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{t(),i("ok")},r,n)})}push(t){this.socket.push(t)}log(t,r,n){this.socket.log(t,r,n)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Gl.connecting}isDisconnecting(){return this.socket.connectionState()==Gl.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const ah={HEARTBEAT_INTERVAL:25e3},n_=[1e3,2e3,5e3,1e4],s_=1e4;function i_(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var r;return(r=Array.from(e.keys())[t])!==null&&r!==void 0?r:null},removeItem(t){e.delete(t)},setItem(t,r){e.set(t,String(r))}}}function a_(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return i_()}const o_=` 61 addEventListener("message", (e) => { 62 if (e.data.event === "start") { 63 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 64 } 65 });`;class l_{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,r){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={}
65,this.ref=0,this.serializer=new Lw,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...a)=>i(...a):(...a)=>fetch(...a),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const s=this._initializeOptions(r);this.socketAdapter=new r_(t,s),this.httpEndpoint=Cm(t),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const r=t.message;throw r.includes("Node.js")?new Error(`${r} 66 67To use Realtime in Node.js, you need to provide a WebSocket implementation: 68 69Option 1: Use Node.js 22+ which has native WebSocket support 70Option 2: Install and provide the "ws" package: 71 72 npm install ws 73 74 import ws from "ws" 75 const client = new RealtimeClient(url, { 76 ...options, 77 transport: ws 78 })`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,r)}getChannels(){return this.channels}async removeChannel(t){const r=await t.unsubscribe();return r==="ok"&&t.teardown(),r}async removeAllChannels(){const t=this.channels.map(async n=>{const s=await n.unsubscribe();return n.teardown(),s}),r=await Promise.all(t);return await this.disconnect(),r}log(t,r,n){this.socketAdapter.log(t,r,n)}connectionState(){return this.socketAdapter.connectionState()||Gl.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,r={config:{}}){const n=`realtime:${t}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new Es(`realtime:${t}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(r=>r.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}
78this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let r,n=!1;if(t)r=t,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(s=>{const i={access_token:r,version:Tw};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(Em.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${t}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(r,n)=>{r=="sent"&&this._setAuthSafely(),t&&t(r,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(t){let r;if(t)r=t;else{const n=new Blob([o_],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(t){var r,n,s,i,a,o,u,c,d,h,f,p;this.worker=(r=t==null?void 0:t.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=t==null?void 0:t.accessToken)!==null&&n!==void 0?n:null;const y={};y.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:Aw,y.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:ah.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(a=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&a!==void 0?a:2*((o=t==null?void 0:t.heartbeatIntervalMs)!==null&&o!==void 0?o:ah.HEARTBEAT_INTERVAL),y.transport=(u=t==null?void 0:t.transport)!==null&&u!==void 0?u:Cw.getWebSocketConstructor(),y.params=t==null?void 0:t.params,y.logger=t==null?void 0:t.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),y.sessionStorage=(c=t==null?void 0:t.sessionStorage)!==null&&c!==void 0?c:a_(),y.reconnectAfterMs=(d=t==null?void 0:t.reconnectAfterMs)!==null&&d!==void 0?d:g=>n_[g-1]||s_;let w,x;const m=(h=t==null?void 0:t.vsn)!==null&&h!==void 0?h:Pw;switch(m){case Nw:w=(g,v)=>v(JSON.stringify(g)),x=(g,v)=>v(JSON.parse(g));break;case Sm:w=this.serializer.encode.bind(this.serializer),x=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=m,y.encode=(f=t==null?void 0:t.encode)!==null&&f!==void 0?f:w,y.decode=(p=t==null?void 0:t.decode)!==null&&p!==void 0?p:x,y.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl,y.autoSendHeartbeat=!this.worker}return y}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}
78var Ks=class extends Error{constructor(e,t){var r;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((r=t.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function u_(e,t,r){const n=new URL(t,e);if(r)for(const[s,i]of Object.entries(r))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function c_(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function d_(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:a}){const o=u_(e.baseUrl,n,s),u=await c_(e.auth),c=await t(o,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...u,...a},body:i?JSON.stringify(i):void 0}),d=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),f=h&&d?JSON.parse(d):d;if(!c.ok){const p=h?f:void 0,y=p==null?void 0:p.error;throw new Ks((y==null?void 0:y.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:y==null?void 0:y.type,icebergCode:y==null?void 0:y.code,details:p})}return{status:c.status,headers:c.headers,data:f}}}}function Ui(e){return e.join("�")}var h_=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Ui(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(e,t){const r={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Ui(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ui(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Ui(e.namespace)}`}),!0}catch(t){if(t instanceof Ks&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof Ks&&r.status===409)return;throw r}}};function tn(e){return e.join("�")}var f_=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${tn(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${tn(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${tn(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${tn(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${tn(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${tn(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof Ks&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof Ks&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},p_=class{constructor(e){var n;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=d_({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(n=e.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new h_(this.client,t),this.tableOps=new f_(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}
78async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function Js(e){"@babel/helpers - typeof";return Js=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Js(e)}function m_(e,t){if(Js(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Js(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function g_(e){var t=m_(e,"string");return Js(t)=="symbol"?t:t+""}function v_(e,t,r){return(t=g_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function F(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oh(Object(r),!0).forEach(function(n){v_(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oh(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ao=class extends Error{constructor(e,t="storage",r,n){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function oo(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Zl=class extends ao{constructor(e,t,r,n="storage"){super(e,n,t,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=r}toJSON(){return F({},super.toJSON())}},Tm=class extends ao{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function $a(e,t,r){const n=F({},e),s=t.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function y_(e){const t={};for(const[r,n]of Object.entries(e))t[r.toLowerCase()]=n;return t}const w_=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),__=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},eu=e=>{if(Array.isArray(e))return e.map(r=>eu(r));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[s]=eu(n)}),t},x_=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),lh=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const r=t.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(e)},b_=async(e,t,r,n)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const s=e;let i=parseInt(String(s.status),10);Number.isFinite(i)||(i=500),s.json().then(a=>{const o=(a==null?void 0:a.statusCode)||(a==null?void 0:a.code)||i+"";t(new Zl(lh(a),i,o,n))}).catch(()=>{const a=i+"";t(new Zl(s.statusText||`HTTP ${i} error`,i,a,n))})}else t(new Tm(lh(e),e,n))},k_=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!n)return F(F({},s),r);if(__(n)){var i;const a=(t==null?void 0:t.headers)||{};let o;for(const[u,c]of Object.entries(a))u.toLowerCase()==="content-type"&&(o=c);s.headers=$a(a,"Content-Type",(i=o)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(n)}else s.body=n;return t!=null&&t.duplex&&(s.duplex=t.duplex),F(F({},s),r)};async function ss(e,t,r,n,s,i,a){return new Promise((o,u)=>{e(r,k_(t,n,s,i)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.noResolveJson)return c;if(a==="vectors"){const d=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!d||!d.includes("application/json"))return{}}return c.json()}).then(c=>o(c)).catch(c=>b_(c,u,n,a))})}function Nm(e="storage"){return{get:async(t,r,n,s)=>ss(t,"GET",r,n,s,void 0,e),post:async(t,r,n,s,i)=>ss(t,"POST",r,s,i,n,e),put:async(t,r,n,s,i)=>ss(t,"PUT",r,s,i,n,e),head:async(t,r,n,s)=>ss(t,"HEAD",r,F(F({},n),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,r,n,s,i)=>ss(t,"DELETE",r,s,i,n,e)}}const S_=Nm("storage"),{get:Gs,post:gt,put:tu,head:E_,remove:hc}=S_,Ge=Nm("vectors");var Vn=class{constructor(e,t={},r,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=y_(t),this.fetch=w_(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=$a(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(oo(r))return{data:null,error:r};throw r}}};let Pm;Pm=Symbol.toStringTag;var j_=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Pm]="StreamDownloadBuilder",this.promise=null}
78then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(oo(t))return{data:null,error:t};throw t}}};let Am;Am=Symbol.toStringTag;var C_=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Am]="BlobDownloadBuilder",this.promise=null}asStream(){return new j_(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(oo(t))return{data:null,error:t};throw t}}};const R_={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},uh={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var T_=class extends Vn{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var s=this;return s.handleOperation(async()=>{let i;const a=F(F({},uh),n);let o=F(F({},s.headers),e==="POST"&&{"x-upsert":String(a.upsert)});const u=a.metadata;if(typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),u&&i.append("metadata",s.encodeMetadata(u)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),u&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(u))):(i=r,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,u&&(o["x-metadata"]=s.toBase64(s.encodeMetadata(u))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),n!=null&&n.headers)for(const[f,p]of Object.entries(n.headers))o=$a(o,f,p);const c=s._removeEmptyFolders(t),d=s._getFinalPath(c),h=await(e=="PUT"?tu:gt)(s.fetch,`${s.url}/object/${d}`,i,F({headers:o},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var s=this;const i=s._removeEmptyFolders(e),a=s._getFinalPath(i),o=new URL(s.url+`/object/upload/sign/${a}`);return o.searchParams.set("token",t),s.handleOperation(async()=>{let u;const c=F(F({},uh),n);let d=F(F({},s.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&r instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),h&&u.append("metadata",s.encodeMetadata(h)),u.append("",r)):typeof FormData<"u"&&r instanceof FormData?(u=r,u.has("cacheControl")||u.append("cacheControl",c.cacheControl),h&&!u.has("metadata")&&u.append("metadata",s.encodeMetadata(h))):(u=r,d["cache-control"]=`max-age=${c.cacheControl}`,d["content-type"]=c.contentType,h&&(d["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&u instanceof ReadableStream||u&&typeof u=="object"&&"pipe"in u&&typeof u.pipe=="function")&&!c.duplex&&(c.duplex="half")),n!=null&&n.headers)for(const[f,p]of Object.entries(n.headers))d=$a(d,f,p);return{path:i,fullPath:(await tu(s.fetch,o.toString(),u,F({headers:d},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const s=F({},r.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const i=await gt(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),a=new URL(r.url+i.url),o=a.searchParams.get("token");if(!o)throw new ao("No token returned by API");return{signedUrl:a.toString(),path:e,token:o}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await gt(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,de
78stinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await gt(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(e);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let a=await gt(n.fetch,`${n.url}/object/sign/${s}`,F({expiresIn:t},i?{transform:r.transform}:{}),{headers:n.headers});const o=new URLSearchParams;r!=null&&r.download&&o.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&o.set("cacheNonce",String(r.cacheNonce));const u=o.toString();return{signedUrl:encodeURI(`${n.url}${a.signedURL}${u?`&${u}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const s=await gt(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),i=new URLSearchParams;r!=null&&r.download&&i.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&i.set("cacheNonce",String(r.cacheNonce));const a=i.toString();return s.map(o=>F(F({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.signedURL}${a?`&${a}`:""}`):null}))})}download(e,t,r){const n=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(s,t.transform),(t==null?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));const i=s.toString(),a=this._getFinalPath(e),o=()=>Gs(this.fetch,`${this.url}/${n}/${a}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new C_(o,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>eu(await Gs(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await E_(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(oo(s)){var n;const i=s instanceof Zl?s.status:s instanceof Tm?(n=s.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;t!=null&&t.download&&n.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(n,t.transform),(t==null?void 0:t.cacheNonce)!=null&&n.set("cacheNonce",String(t.cacheNonce));const s=n.toString(),i=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}`)+(s?`?${s}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await hc(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const s=F(F(F({},R_),t),{},{prefix:e||""});return await gt(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=F({},e);return await gt(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}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,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const N_="2.106.1",li={"X-Client-Info":`storage-js/${N_}`};var P_=class extends Vn{constructor(e,t={},r,n){const s=new URL(e);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),a=F(F({},li),t);super(i,a,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await Gs(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Gs(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await gt(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await tu(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await gt(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await hc(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},A_=class extends Vn{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=F(F({},li),t);super(n,s,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await gt(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>
78{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 n=r.toString(),s=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await Gs(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await hc(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!x_(e))throw new ao("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new p_({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,i){const a=s[i];return typeof a!="function"?a:async(...o)=>{try{return{data:await a.apply(s,o),error:null}}catch(u){if(n)throw u;return{data:null,error:u}}}}})}},O_=class extends Vn{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=F(F({},li),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await Ge.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await Ge.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},L_=class extends Vn{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=F(F({},li),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;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 t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},I_=class extends Vn{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=F(F({},li),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Ge.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},$_=class extends I_{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new U_(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,r=this;return t().call(r,e)}async getBucket(e){var t=()=>super.getBucket,r=this;return t().call(r,e)}async listBuckets(e={}){var t=()=>super.listBuckets,r=this;return t().call(r,e)}async deleteBucket(e){var t=()=>super.deleteBucket,r=this;return t().call(r,e)}},U_=class extends O_{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){var t=()=>super.createIndex,r=this;return t().call(r,F(F({},e),{},{vectorBucketName:r.vectorBucketName}))}
78async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,F(F({},e),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,r=this;return t().call(r,r.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,r=this;return t().call(r,r.vectorBucketName,e)}index(e){return new M_(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},M_=class extends L_{constructor(e,t,r,n,s){super(e,t,s),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=()=>super.putVectors,r=this;return t().call(r,F(F({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,F(F({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,F(F({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,F(F({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,F(F({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},D_=class extends P_{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new T_(this.url,this.headers,e,this.fetch)}get vectors(){return new $_(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new A_(this.url+"/iceberg",this.headers,this.fetch)}};const Om="2.106.1",un=30*1e3,ru=3,Ho=ru*un,B_="http://localhost:9999",z_="supabase.auth.token",F_={"X-Client-Info":`gotrue-js/${Om}`},nu="X-Supabase-Api-Version",Lm={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},q_=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,H_=10*60*1e3;class Bn extends Error{constructor(t,r,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function L(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class W_ extends Bn{constructor(t,r,n){super(t,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function V_(e){return L(e)&&e.name==="AuthApiError"}class wt extends Bn{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class Zt extends Bn{constructor(t,r,n,s){super(t,n,s),this.name=r,this.status=n}}class _e extends Zt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Mi(e){return L(e)&&e.name==="AuthSessionMissingError"}class rn extends Zt{constructor(){super("Auth session or user missing","AuthInvalidToken
78ResponseError",500,void 0)}}class Di extends Zt{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Bi extends Zt{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function K_(e){return L(e)&&e.name==="AuthImplicitGrantRedirectError"}class ch extends Zt{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class J_ extends Zt{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class su extends Zt{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function Wo(e){return L(e)&&e.name==="AuthRetryableFetchError"}class dh extends Zt{constructor(t,r,n){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class iu extends Zt{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ua="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),hh=` 79\r=`.split(""),G_=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<hh.length;t+=1)e[hh[t].charCodeAt(0)]=-2;for(let t=0;t<Ua.length;t+=1)e[Ua[t].charCodeAt(0)]=t;return e})();function fh(e,t,r){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;r(Ua[n]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;r(Ua[n]),t.queuedBits-=6}}function Im(e,t,r){const n=G_[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function ph(e){const t=[],r=a=>{t.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=a=>{X_(a,n,r)};for(let a=0;a<e.length;a+=1)Im(e.charCodeAt(a),s,i);return t.join("")}function Q_(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function Y_(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}Q_(n,t)}}function X_(e,t,r){if(t.utf8seq===0){if(e<=127){r(e);return}for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&r(t.codepoint)}}function An(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)Im(e.charCodeAt(s),r,n);return new Uint8Array(t)}function Z_(e){const t=[];return Y_(e,r=>t.push(r)),new Uint8Array(t)}function Ur(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};return e.forEach(s=>fh(s,r,n)),fh(null,r,n),t.join("")}function ex(e){return Math.round(Date.now()/1e3)+e}function tx(){return Symbol("auth-callback")}const Se=()=>typeof window<"u"&&typeof document<"u",Tr={tested:!1,writable:!1},$m=()=>{if(!Se())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Tr.tested)return Tr.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Tr.tested=!0,Tr.writable=!0}catch{Tr.tested=!0,Tr.writable=!1}return Tr.writable};function rx(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEac
79h((s,i)=>{t[i]=s})}catch{}return r.searchParams.forEach((n,s)=>{t[s]=n}),t}const Um=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),nx=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",cn=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},Nr=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return null}},ke=async(e,t)=>{await e.removeItem(t)};class lo{constructor(){this.promise=new lo.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}lo.promiseConstructor=Promise;function zi(e){const t=e.split(".");if(t.length!==3)throw new iu("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!q_.test(t[n]))throw new iu("JWT not in base64url format");return{header:JSON.parse(ph(t[0])),payload:JSON.parse(ph(t[1])),signature:An(t[2]),raw:{header:t[0],payload:t[1]}}}async function sx(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function ix(e,t){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const a=await e(i);if(!t(i,null,a)){n(a);return}}catch(a){if(!t(i,a)){s(a);return}}})()})}function ax(e){return("0"+e.toString(16)).substr(-2)}function ox(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let i=0;i<56;i++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(t),Array.from(t,ax).join("")}async function lx(e){const r=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function ux(e){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."),e;const r=await lx(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function nn(e,t,r=!1){const n=ox();let s=n;r&&(s+="/recovery"),await cn(e,`${t}-code-verifier`,s);const i=await ux(n);return[i,n===i?"plain":"s256"]}const cx=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function dx(e){const t=e.headers.get(nu);if(!t||!t.match(cx))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function hx(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function fx(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const px=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function $t(e){if(!px.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function pt(e){if(!e.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Vo(){const e={};return new Proxy(e,{get:(t,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="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:(t,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:(t,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 mx(e,t){return new Proxy(e,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;
79if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,s)}return!t.value&&typeof n=="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."),t.value=!0),Reflect.get(r,n,s)}})}function mh(e){return JSON.parse(JSON.stringify(e))}const Or=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error}return JSON.stringify(e)},gx=[502,503,504,520,521,522,523,524,530];async function gh(e){var t;if(!nx(e))throw new su(Or(e),0);if(gx.includes(e.status))throw new su(Or(e),e.status);let r;try{r=await e.json()}catch(i){throw new wt(Or(i),i)}let n;const s=dx(e);if(s&&s.getTime()>=Lm["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new dh(Or(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new _e}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((i,a)=>i&&typeof a=="string",!0))throw new dh(Or(r),e.status,r.weak_password.reasons);throw new W_(Or(r),e.status||500,n)}const vx=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function M(e,t,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[nu]||(i[nu]=Lm["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const a=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(a.redirect_to=n.redirectTo);const o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",u=await yx(e,t,r+o,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(u):{data:Object.assign({},u),error:null}}async function yx(e,t,r,n,s,i){const a=vx(t,n,s,i);let o;try{o=await e(r,Object.assign({},a))}catch(u){throw console.error(u),new su(Or(u),0)}if(o.ok||await gh(o),n!=null&&n.noResolveJson)return o;try{return await o.json()}catch(u){await gh(u)}}function tt(e){var t;let r=null;xx(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=ex(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:null;return{data:{session:r,user:n},error:null}}function vh(e){const t=tt(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(t.data.weak_password=e.weak_password),t}function ur(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function wx(e){return{data:e,error:null}}function _x(e){const{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=e,a=io(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},u=Object.assign({},a);return{data:{properties:o,user:u},error:null}}function yh(e){return e}function xx(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Ko=["global","local","others"];class bx{_encodePathSegment(t){if(t==="."||t==="..")throw new Bn("Invalid path segment");return encodeURIComponent(t)}constructor({url:t="",headers:r={},fetch:n,experimental:s}){this.url=t,this.headers=r,this.fetch=Um(n),this.experimental=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)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}
79async signOut(t,r=Ko[0]){if(Ko.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ko.join(", ")}`);try{return await M(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(L(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,r={}){try{return await M(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:ur})}catch(n){if(L(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:r}=t,n=io(t,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await M(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:_x,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(L(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await M(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:ur})}catch(r){if(L(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,n,s,i,a,o,u;try{const c={nextPage:null,lastPage:0,total:0},d=await M(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:yh});if(d.error)throw d.error;const h=await d.json(),f=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(u=(o=d.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&u!==void 0?u:[];return p.length>0&&(p.forEach(y=>{const w=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(y.split(";")[1].split("=")[1]);c[`${x}Page`]=w}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(L(c))return{data:{users:[]},error:c};throw c}}async getUserById(t){$t(t);try{return await M(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:ur})}catch(r){if(L(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){$t(t);try{return await M(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:ur})}catch(n){if(L(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,r=!1){$t(t);try{return await M(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:ur})}catch(n){if(L(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){$t(t.userId);try{const{data:r,error:n}=await M(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(L(r))return{data:null,error:r};throw r}}
79async _deleteFactor(t){$t(t.userId),$t(t.id);try{return{data:await M(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(L(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,n,s,i,a,o,u;try{const c={nextPage:null,lastPage:0,total:0},d=await M(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:yh});if(d.error)throw d.error;const h=await d.json(),f=(a=d.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(u=(o=d.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&u!==void 0?u:[];return p.length>0&&(p.forEach(y=>{const w=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(y.split(";")[1].split("=")[1]);c[`${x}Page`]=w}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(L(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(t){try{return await M(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(L(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{const r=this._encodePathSegment(t);return await M(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(L(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{const n=this._encodePathSegment(t);return await M(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(L(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{const r=this._encodePathSegment(t);return await M(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(L(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{const r=this._encodePathSegment(t);return await M(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(L(r))return{data:null,error:r};throw r}}async _listCustomProviders(t){try{const r={};return t!=null&&t.type&&(r.type=t.type),await M(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var s;return{data:{providers:(s=n==null?void 0:n.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(r){if(L(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(t){try{return await M(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(L(r))return{data:null,error:r};throw r}}async _getCustomProvider(t){try{const r=this._encodePathSegment(t);return await M(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(L(r))return{data:null,error:r};throw r}}async _updateCustomProvider(t,r){try{const n=this._encodePathSegment(t);return await M(this.fetch,"PUT",`${this.url}/admin/custom-providers/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(L(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(t){try{const r=this._encodePathSegment(t);return await M(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(L(r))return{data:null,error:r};throw r}}async _adminListPasskeys(t){pt(this.experimental),$t(t.userId);try{return await M(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(L(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(t){pt(this.experimental),$t(t.userId),$t(t.passkeyId);try{return await M(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(L(r))return{data:null,error:r};throw r}}}function wh(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const jt={debug:!!(globalThis&&$m()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};
79class Mm extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class _h extends Mm{}async function kx(e,t,r){jt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const n=new globalThis.AbortController;let s;t>0&&(s=setTimeout(()=>{n.abort(),jt.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){clearTimeout(s),jt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await r()}finally{jt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw jt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new _h(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(jt.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"),clearTimeout(s),await r()}})}catch(i){if(t>0&&clearTimeout(s),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&t>0){if(n.signal.aborted)return jt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async a=>{if(a){jt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,a.name);try{return await r()}finally{jt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,a.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw jt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new _h(`Lock "${e}" was released because another request stole it`)}throw i}}function Sx(){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 Dm(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Ex(e){return parseInt(e,16)}function jx(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function Cx(e){var t;const{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:a,notBefore:o,requestId:u,resources:c,scheme:d,uri:h,version:f}=e;{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(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(` 80`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const p=Dm(e.address),y=d?`${d}://${n}`:n,w=e.statement?`${e.statement} 81`:"",x=`${y} wants you to sign in with your Ethereum account: 82${p} 83 84${w}`;let m=`URI: ${h} 85Version: ${f} 86Chain ID: ${r}${a?` 87Nonce: ${a}`:""} 88Issued At: ${i.toISOString()}`;if(s&&(m+=` 89Expiration Time: ${s.toISOString()}`),o&&(m+=` 90Not Before: ${o.toISOString()}`),u&&(m+=` 91Request ID: ${u}`),c){let g=` 92Resources:`;for(const v of c){if(!v||typeof v!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${v}`);g+=` 93- ${v}`}m+=g}return`${x} 94${m}`}
94class ge extends Error{constructor({message:t,code:r,cause:n,name:s}){var i;super(t,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=s??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Ma extends ge{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function Rx({error:e,options:t}){var r,n,s;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ge({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ge({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new ge({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new ge({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new ge({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new ge({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new ge({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new ge({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const a=window.location.hostname;if(Bm(a)){if(i.rp.id!==a)return new ge({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ge({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new ge({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new ge({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new ge({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Tx({error:e,options:t}){const{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ge({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new ge({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(Bm(n)){if(r.rpId!==n)return new ge({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ge({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new ge({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new ge({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Nx{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const au=new Nx;function xh(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:r,excludeCredentials:n}=e,s=io(e,["challenge","user","excludeCredentials"]),i=An(t).buffer,a=Object.assign(Object.assign({},r),{id:An(r.id).buffer}),o=Object.assign(Object.assign({}
94,s),{challenge:i,user:a});if(n&&n.length>0){o.excludeCredentials=new Array(n.length);for(let u=0;u<n.length;u++){const c=n[u];o.excludeCredentials[u]=Object.assign(Object.assign({},c),{id:An(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function bh(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:r}=e,n=io(e,["challenge","allowCredentials"]),s=An(t).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let a=0;a<r.length;a++){const o=r[a];i.allowCredentials[a]=Object.assign(Object.assign({},o),{id:An(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return i}function kh(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e;return{id:e.id,rawId:e.id,response:{attestationObject:Ur(new Uint8Array(e.response.attestationObject)),clientDataJSON:Ur(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Sh(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e,n=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Ur(new Uint8Array(s.authenticatorData)),clientDataJSON:Ur(new Uint8Array(s.clientDataJSON)),signature:Ur(new Uint8Array(s.signature)),userHandle:s.userHandle?Ur(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Bm(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Da(){var e,t;return!!(Se()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function zm(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Ma("Browser returned unexpected credential type",t)}:{data:null,error:new Ma("Empty credential response",t)}}catch(t){return{data:null,error:Rx({error:t,options:e})}}}async function Fm(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Ma("Browser returned unexpected credential type",t)}:{data:null,error:new Ma("Empty credential response",t)}}catch(t){return{data:null,error:Tx({error:t,options:e})}}}const Px={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Ax={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Ba(...e){const t=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of e)if(s)for(const i in s){const a=s[i];if(a!==void 0)if(Array.isArray(a))n[i]=a;else if(r(a))n[i]=a;else if(t(a)){const o=n[i];t(o)?n[i]=Ba(o,a):n[i]=Ba(a)}else n[i]=a}return n}function Ox(e,t){return Ba(Px,e,t||{})}function Lx(e,t){return Ba(Ax,e,t||{})}class Ix{constructor(t){this.client=t,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(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:r,friendlyName:n,signal:s},i){var a;try{const{data:o,error:u}=await this.client.mfa.challenge({factorId:t,webauthn:r});if(!o)return{data:null,error:u};const c=s??au.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:d}=o.webauthn.credential_options.publicKey;if(!d.name){const h=n;if(h)d.name=`${d.id}:${h}`;else{const p=(await this.client.getUser()).data.user,y=((a=p==null?void 0:p.user_metadata)===null||a===void 0?void 0:a.name)||(p==null?void 0:p.email)||(p==null?void 0:p.id)||"User";d.name=`${d.id}:${y}`}}d.displayName||(d.displayName=d.name)}switch(o.webauthn.type){case"create":{const d=Ox(o.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:f}=await zm({publicKey:d,signal:c});return h?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}case"request":{const d=Lx(o.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:f}=await Fm(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:d,signal:c}));return h?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}}}catch(o){return L(o)?{data:null,error:o}:{data:null,error:new wt("Unexpected error in challenge",o)}}}async _verify({challengeId:t,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:t,webauthn:n})}async _authenticate({factorId:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new Bn("rpId is required for WebAuthn authentication")};try{if(!Da())return{data:null,error:new wt("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:i});if(!a)return{data:null,error:o};const{webauthn:u}=a;return this._verify({factorId:t,challengeId:a.challengeId,webauthn:{type:u.type,rpId:r,rpOrigins:n,credential_response:u.credential_response}})}catch(a){return L(a)?{data:null,error:a}:{data:null,error:new wt("Unexpected error in authenticate",a)}}}async _register({friendlyName:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new Bn("rpId is required for WebAuthn registration")};try{if(!Da())return{data:null,error:new wt("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this._enroll({friendlyName:t});if(!a)return await this.client.mfa.listFactors().then(d=>{var h;
94return(h=d.data)===null||h===void 0?void 0:h.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===t&&f.status!=="unverified")}).then(d=>d?this.client.mfa.unenroll({factorId:d==null?void 0:d.id}):void 0),{data:null,error:o};const{data:u,error:c}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:i});return u?this._verify({factorId:a.id,challengeId:u.challengeId,webauthn:{rpId:r,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:c}}catch(a){return L(a)?{data:null,error:a}:{data:null,error:new wt("Unexpected error in register",a)}}}}Sx();const $x={url:B_,storageKey:z_,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:F_,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function Eh(e,t,r){return await r()}const sn={};class Qs{get jwks(){var t,r;return(r=(t=sn[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){sn[this.storageKey]=Object.assign(Object.assign({},sn[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=sn[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){sn[this.storageKey]=Object.assign(Object.assign({},sn[this.storageKey]),{cachedAt:t})}constructor(t){var r,n,s,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=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({},$x),t);if(this.storageKey=a.storageKey,this.instanceID=(r=Qs.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Qs.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.instanceID>0&&Se()){const o=`${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(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=a.persistSession,this.autoRefreshToken=a.autoRefreshToken,this.experimental=(n=a.experimental)!==null&&n!==void 0?n:{},this.admin=new bx({url:a.url,headers:a.headers,fetch:a.fetch,experimental:this.experimental}),this.url=a.url,this.headers=a.headers,this.fetch=Um(a.fetch),this.lock=a.lock||Eh,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,this.throwOnError=a.throwOnError,this.lockAcquireTimeout=a.lockAcquireTimeout,a.lock?this.lock=a.lock:this.persistSession&&Se()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=kx:this.lock=Eh,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 Ix(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(a.storage?this.storage=a.storage:$m()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=wh(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=wh(this.memoryStorage)),Se()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(u){this._debug("#broadcastChannel","error",u)}})}a.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Om}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let r={},n="none";if(Se()&&(r=rx(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Se()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:i}=await this._getSessionFromURL(r,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),K_(i)){const u=(t=i.details)===null||t===void 0?void 0:t.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:a,redirectType:o}=s;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return L(r)?this._returnResult({error:r}):this._returnResult({error:new wt("Unexpected error during initialization",r)}
94)}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,n,s;try{const i=await M(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}},xform:tt}),{data:a,error:o}=i;if(o||!a)return this._returnResult({data:{user:null,session:null},error:o});const u=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(i){if(L(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var r,n,s;try{let i;if("email"in t){const{email:d,password:h,options:f}=t;let p=null,y=null;this.flowType==="pkce"&&([p,y]=await nn(this.storage,this.storageKey)),i=await M(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:d,password:h,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:y},xform:tt})}else if("phone"in t){const{phone:d,password:h,options:f}=t;i=await M(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:h,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},channel:(s=f==null?void 0:f.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:tt})}else throw new Di("You must provide either an email or phone number and a password");const{data:a,error:o}=i;if(o||!a)return await ke(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const u=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(i){if(await ke(this.storage,`${this.storageKey}-code-verifier`),L(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let r;if("email"in t){const{email:i,password:a,options:o}=t;r=await M(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:vh})}else if("phone"in t){const{phone:i,password:a,options:o}=t;r=await M(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:vh})}else throw new Di("You must provide either an email or phone number and a password");const{data:n,error:s}=r;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){const i=new rn;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if(L(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(t){var r,n,s,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=t.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:r}=t;switch(r){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(t){var r,n,s,i,a,o,u,c,d,h,f;let p,y;if("message"in t)p=t.message,y=t.signature;else{const{chain:w,wallet:x,statement:m,options:g}=t;let v;if(Se())if(typeof x=="object")v=x;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")v=C.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"||!(g!=null&&g.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");v=x}const b=new URL((r=g==null?void 0:g.url)!==null&&r!==void 0?r:window.location.href),E=await v.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!E||E.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const S=Dm(E[0]);let j=(n=g==null?void 0:g.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!j){const C=await v.request({method:"eth_chainId"});j=Ex(C)}const P={domain:b.host,address:S,statement:m,uri:b.href,version:"1",chainId:j,nonce:(s=g==null?void 0:g.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(a=(i=g==null?void 0:g.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=g==null?void 0:g.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(u=g==null?void 0:g.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(c=g==null?void 0:g.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(d=g==null?void 0:g.signInWithEthereum)===null||d===void 0?void 0:d.resources};p=Cx(P),y=await v.request({method:"personal_sign",params:[jx(p),S]})}try{const{data:w,error:x}=await M(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:y}
94,!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:tt});if(x)throw x;if(!w||!w.session||!w.user){const m=new rn;return this._returnResult({data:{user:null,session:null},error:m})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:x})}catch(w){if(L(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async signInWithSolana(t){var r,n,s,i,a,o,u,c,d,h,f,p;let y,w;if("message"in t)y=t.message,w=t.signature;else{const{chain:x,wallet:m,statement:g,options:v}=t;let b;if(Se())if(typeof m=="object")b=m;else{const S=window;if("solana"in S&&typeof S.solana=="object"&&("signIn"in S.solana&&typeof S.solana.signIn=="function"||"signMessage"in S.solana&&typeof S.solana.signMessage=="function"))b=S.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 m!="object"||!(v!=null&&v.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=m}const E=new URL((r=v==null?void 0:v.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in b&&b.signIn){const S=await b.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},v==null?void 0:v.signInWithSolana),{version:"1",domain:E.host,uri:E.href}),g?{statement:g}:null));let j;if(Array.isArray(S)&&S[0]&&typeof S[0]=="object")j=S[0];else if(S&&typeof S=="object"&&"signedMessage"in S&&"signature"in S)j=S;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in j&&"signature"in j&&(typeof j.signedMessage=="string"||j.signedMessage instanceof Uint8Array)&&j.signature instanceof Uint8Array)y=typeof j.signedMessage=="string"?j.signedMessage:new TextDecoder().decode(j.signedMessage),w=j.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in b)||typeof b.signMessage!="function"||!("publicKey"in b)||typeof b!="object"||!b.publicKey||!("toBase58"in b.publicKey)||typeof b.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");y=[`${E.host} wants you to sign in with your Solana account:`,b.publicKey.toBase58(),...g?["",g,""]:[""],"Version: 1",`URI: ${E.href}`,`Issued At: ${(s=(n=v==null?void 0:v.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=v==null?void 0:v.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${v.signInWithSolana.notBefore}`]:[],...!((a=v==null?void 0:v.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${v.signInWithSolana.expirationTime}`]:[],...!((o=v==null?void 0:v.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${v.signInWithSolana.chainId}`]:[],...!((u=v==null?void 0:v.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${v.signInWithSolana.nonce}`]:[],...!((c=v==null?void 0:v.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${v.signInWithSolana.requestId}`]:[],...!((h=(d=v==null?void 0:v.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",...v.signInWithSolana.resources.map(j=>`- ${j}`)]:[]].join(` 95`);const S=await b.signMessage(new TextEncoder().encode(y),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");w=S}}try{const{data:x,error:m}=await M(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:y,signature:Ur(w)},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=t.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:tt});if(m)throw m;if(!x||!x.session||!x.user){const g=new rn;return this._returnResult({data:{user:null,session:null},error:g})}return x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),this._returnResult({data:Object.assign({},x),error:m})}
95catch(x){if(L(x))return this._returnResult({data:{user:null,session:null},error:x});throw x}}async _exchangeCodeForSession(t){const r=await Nr(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new J_;const{data:i,error:a}=await M(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:tt});if(await ke(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!i||!i.session||!i.user){const o=new rn;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(s==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:a})}catch(i){if(await ke(this.storage,`${this.storageKey}-code-verifier`),L(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:r,provider:n,token:s,access_token:i,nonce:a}=t,o=await M(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:tt}),{data:u,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!u||!u.session||!u.user){const d=new rn;return this._returnResult({data:{user:null,session:null},error:d})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:c})}catch(r){if(L(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(t){var r,n,s,i,a;try{if("email"in t){const{email:o,options:u}=t;let c=null,d=null;this.flowType==="pkce"&&([c,d]=await nn(this.storage,this.storageKey));const{error:h}=await M(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(r=u==null?void 0:u.data)!==null&&r!==void 0?r:{},create_user:(n=u==null?void 0:u.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},code_challenge:c,code_challenge_method:d},redirectTo:u==null?void 0:u.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in t){const{phone:o,options:u}=t,{data:c,error:d}=await M(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(s=u==null?void 0:u.data)!==null&&s!==void 0?s:{},create_user:(i=u==null?void 0:u.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},channel:(a=u==null?void 0:u.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:d})}throw new Di("You must provide either an email or phone number.")}catch(o){if(await ke(this.storage,`${this.storageKey}-code-verifier`),L(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(t){var r,n;try{let s,i;"options"in t&&(s=(r=t.options)===null||r===void 0?void 0:r.redirectTo,i=(n=t.options)===null||n===void 0?void 0:n.captchaToken);const{data:a,error:o}=await M(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:tt});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");const u=a.session,c=a.user;return u!=null&&u.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if(L(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var r,n,s,i,a;try{let o=null,u=null;this.flowType==="pkce"&&([o,u]=await nn(this.storage,this.storageKey));const c=await M(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(n=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=t==null?void 0:t.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}
95:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:u}),headers:this.headers,xform:wx});return!((i=c.data)===null||i===void 0)&&i.url&&Se()&&!(!((a=t.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await ke(this.storage,`${this.storageKey}-code-verifier`),L(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)throw n;if(!r)throw new _e;const{error:s}=await M(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(t){if(L(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const r=`${this.url}/resend`;if("email"in t){const{email:n,type:s,options:i}=t,{error:a}=await M(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in t){const{phone:n,type:s,options:i}=t,{data:a,error:o}=await M(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:o})}throw new Di("You must provide either an email or phone number and a type")}catch(r){if(L(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await t(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 t=null;const r=await Nr(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at*1e3-Date.now()<Ho:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const a=await Nr(this.userStorage,this.storageKey+"-user");a!=null&&a.user?t.user=a.user:t.user=Vo()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};t.user=mx(t.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(t){try{return t?await M(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:ur}):await this._useSession(async r=>{var n,s,i;const{data:a,error:o}=r;if(o)throw o;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new _e}:await M(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=a.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:ur})})}catch(r){if(L(r))return Mi(r)&&(await this._removeSession(),await ke(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async n=>{const{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new _e;const a=s.session;let o=null,u=null;this.flowType==="pkce"&&t.email!=null&&([o,u]=await nn(this.storage,this.storageKey));const{data:c,error:d}=await M(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({}
95,t),{code_challenge:o,code_challenge_method:u}),jwt:a.access_token,xform:ur});if(d)throw d;return a.user=c.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(n){if(await ke(this.storage,`${this.storageKey}-code-verifier`),L(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new _e;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:a}=zi(t.access_token);if(a.exp&&(n=a.exp,s=n<=r),s){const{data:o,error:u}=await this._callRefreshToken(t.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!o)return{data:{user:null,session:null},error:null};i=o}else{const{data:o,error:u}=await this._getUser(t.access_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});i={access_token:t.access_token,refresh_token:t.refresh_token,user:o.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(r){if(L(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async r=>{var n;if(!t){const{data:a,error:o}=r;if(o)throw o;t=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(t!=null&&t.refresh_token))throw new _e;const{data:s,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(L(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){var n;try{if(!Se())throw new Bi("No browser detected.");if(t.error||t.error_description||t.error_code)throw new Bi(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new ch("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Bi("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new ch("No code detected.");const{data:v,error:b}=await this._exchangeCodeForSession(t.code);if(b)throw b;const E=new URL(window.location.href);return E.searchParams.delete("code"),window.history.replaceState(window.history.state,"",E.toString()),{data:{session:v.session,redirectType:(n=v.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:a,refresh_token:o,expires_in:u,expires_at:c,token_type:d}=t;if(!a||!u||!o||!d)throw new Bi("No session defined in URL");const h=Math.round(Date.now()/1e3),f=parseInt(u);let p=h+f;c&&(p=parseInt(c));const y=p-h;y*1e3<=un&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${f}s`);const w=p-f;h-w>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",w,p,h):h-w<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",w,p,h);const{data:x,error:m}=await this._getUser(a);if(m)throw m;const g={provider_token:s,provider_refresh_token:i,access_token:a,expires_in:f,expires_at:p,refresh_token:o,token_type:d,user:x.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:g,redirectType:t.type},error:null})}catch(s){if(L(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const r=await Nr(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i&&!Mi(i))return this._returnResult({error:i});const a=(n=s.session)===null||n===void 0?void 0:n.access_token;if(a){const{error:o}=await this.admin.signOut(a,t);if(o&&!(V_(o)&&(o.status===404||o.status===401||o.status===403)||Mi(o)))return this._returnResult({error:o})}return t!=="others"&&(await this._removeSession(),await ke(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=tx(),n={id:r,callback:t,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,n),(
95async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(t){return await this._useSession(async r=>{var n,s;try{const{data:{session:i},error:a}=r;if(a)throw a;await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),Mi(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await nn(this.storage,this.storageKey,!0));try{return await M(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(await ke(this.storage,`${this.storageKey}-code-verifier`),L(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var r;try{const{data:n,error:s}=await this._useSession(async i=>{var a,o,u,c,d;const{data:h,error:f}=i;if(f)throw f;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(u=t.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await M(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return Se()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:t.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(L(n))return this._returnResult({data:{provider:t.provider,url:null},error:n});throw n}}async linkIdentityIdToken(t){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:i}}=r;if(s)throw s;const{options:a,provider:o,token:u,access_token:c,nonce:d}=t,h=await M(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:o,id_token:u,access_token:c,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:tt}),{data:f,error:p}=h;return p?this._returnResult({data:{user:null,session:null},error:p}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new rn}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:p}))}catch(s){if(await ke(this.storage,`${this.storageKey}-code-verifier`),L(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(t){try{return await this._useSession(async r=>{var n,s;const{data:i,error:a}=r;if(a)throw a;return await M(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(t){const r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await ix(async s=>(s>
950&&await sx(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await M(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:tt})),(s,i)=>{const a=200*Math.pow(2,s);return i&&Wo(i)&&Date.now()+a-n<un})}catch(n){if(this._debug(r,"error",n),L(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",n),Se()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:t,url:n},error:null}}async _recoverAndRefresh(){var t,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await Nr(this.storage,this.storageKey);if(s&&this.userStorage){let a=await Nr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:s.user},await cn(this.userStorage,this.storageKey+"-user",a)),s.user=(t=a==null?void 0:a.user)!==null&&t!==void 0?t:Vo()}else if(s&&!s.user&&!s.user){const a=await Nr(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(s.user=a.user,await ke(this.storage,this.storageKey+"-user"),await cn(this.storage,this.storageKey,s)):s.user=Vo()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const i=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Ho;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Ho}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:a}=await this._callRefreshToken(s.refresh_token);a&&(console.error(a),Wo(a)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:o}=await this._getUser(s.access_token);!o&&(a!=null&&a.user)?(s.user=a.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(n,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(t){var r,n;if(!t)throw new _e;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new lo;const{data:i,error:a}=await this._refreshAccessToken(t);if(a)throw a;if(!i.session)throw new _e;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const o={data:i.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(i){if(this._debug(s,"error",i),L(i)){const a={data:null,error:i};return Wo(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(a),a}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(t,r,n=!0){const s=`#_notifyAllSubscribers(${t})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:t,session:r});const i=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(t,r)}catch(u){i.push(u)}});if(await Promise.all(a),i.length>0){for(let o=0;o<i.length;o+=1)console.error(i[o]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await ke(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},t),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await cn(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=mh(s);await cn(this.storage,this.storageKey,i)}else{const s=mh(r);await cn(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await ke(this.storage,this.storageKey),await ke(this.storage,this.storageKey+"-code-verifier"),await ke(this.storage,this.storageKey+"-user"),this.userStorage&&await ke(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Se()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}
95catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),un);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}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 t=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-t)/un);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${un}ms, refresh threshold is ${ru} ticks`),s<=ru&&await this._callRefreshToken(n.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(t){if(t instanceof Mm)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Se()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const r=`#_onVisibilityChanged(${t})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,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(t,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,a]=await nn(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});s.push(o.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);s.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?this._returnResult({data:null,error:i}):await M(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(t){try{return await this._useSession(async r=>{var n,s;const{data:i,error:a}=r;if(a)return this._returnResult({data:null,error:a});const o=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:u,error:c}=await M(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(t.factorType==="totp"&&u.type==="totp"&&(!((s=u==null?void 0:u.totp)===null||s===void 0)&&s.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const a=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?kh(t.webauthn.credential_response):Sh(t.webauthn.credential_response)})}:{code:t.code}),{data:o,error:u}=await M(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:a,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:u}))})}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const a=await M(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});if(a.error)return a;const{data:o}=a;if(o.type!=="webauthn")return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:xh(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:bh(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(t){const{data:r,error:n}=await this._challenge({factorId:t.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){var t;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(t){var r,n,s,i;if(t)try{const{payload:p}=zi(t);let y=null;p.aal&&(y=p.aal);let w=y;const{data:{user:x},error:m}=await this.getUser(t);if(m)return this._returnResult({data:null,error:m});((n=(r=x==null?void 0:x.factors)===null||r===void 0?void 0:r.filter(b=>b.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(w="aal2");const v=p.amr||[];return{data:{currentLevel:y,nextLevel:w,currentAuthenticationMethods:v},error:null}}catch(p){if(L(p))return this._returnResult({data:null,error:p});throw p}const{data:{session:a},error:o}
95=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:u}=zi(a.access_token);let c=null;u.aal&&(c=u.aal);let d=c;((i=(s=a.user.factors)===null||s===void 0?void 0:s.filter(p=>p.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(d="aal2");const f=u.amr||[];return{data:{currentLevel:c,nextLevel:d,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await M(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new _e})})}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(t,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new _e});const a=await M(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&Se()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(L(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(t,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new _e});const a=await M(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&Se()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(L(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?await M(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new _e})})}catch(t){if(L(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await M(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new _e})})}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(t,r={keys:[]}){let n=r.keys.find(o=>o.kid===t);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(o=>o.kid===t),n&&this.jwks_cached_at+H_>s)return n;const{data:i,error:a}=await M(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,n=i.keys.find(o=>o.kid===t),!n)?null:n}async getClaims(t,r={}){try{let n=t;if(!n){const{data:p,error:y}
95=await this.getSession();if(y||!p.session)return this._returnResult({data:null,error:y});n=p.session.access_token}const{header:s,payload:i,signature:a,raw:{header:o,payload:u}}=zi(n);r!=null&&r.allowExpired||hx(i.exp);const c=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!c){const{error:p}=await this.getUser(n);if(p)throw p;return{data:{claims:i,header:s,signature:a},error:null}}const d=fx(s.alg),h=await crypto.subtle.importKey("jwk",c,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,a,Z_(`${o}.${u}`)))throw new iu("Invalid JWT signature");return{data:{claims:i,header:s,signature:a},error:null}}catch(n){if(L(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(t){var r,n,s;pt(this.experimental);try{if(!Da())return this._returnResult({data:null,error:new wt("Browser does not support WebAuthn",null)});const{data:i,error:a}=await this._startPasskeyAuthentication({options:{captchaToken:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}});if(a||!i)return this._returnResult({data:null,error:a});const o=bh(i.options),u=(s=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:au.createNewAbortSignal(),{data:c,error:d}=await Fm({publicKey:o,signal:u});if(d||!c)return this._returnResult({data:null,error:d??new wt("WebAuthn ceremony failed",null)});const h=Sh(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(L(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var r,n;pt(this.experimental);try{if(!Da())return this._returnResult({data:null,error:new wt("Browser does not support WebAuthn",null)});const{data:s,error:i}=await this._startPasskeyRegistration();if(i||!s)return this._returnResult({data:null,error:i});const a=xh(s.options),o=(n=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:au.createNewAbortSignal(),{data:u,error:c}=await zm({publicKey:a,signal:o});if(c||!u)return this._returnResult({data:null,error:c??new wt("WebAuthn ceremony failed",null)});const d=kh(u);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:d})}catch(s){if(L(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){pt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new _e});const{data:s,error:i}=await M(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(L(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){pt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new _e});const{data:i,error:a}=await M(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(t){var r;pt(this.experimental);try{const{data:n,error:s}=await M(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})}catch(n){if(L(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(t){pt(this.experimental);try{const{data:r,error:n}=await M(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:tt});return n?this._returnResult({data:null,error:n}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){pt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new _e});const{data:s,error:i}=await M(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:a=>({data:a,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(L(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){pt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new _e});const{data:i,error:a}=await M(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:t.friendlyName}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(t){pt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new _e});const{error:i}
95=await M(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(r){if(L(r))return this._returnResult({data:null,error:r});throw r}}}Qs.nextInstanceID={};const Ux=Qs,Mx="2.106.1";let fs="";typeof Deno<"u"?fs="deno":typeof document<"u"?fs="web":typeof navigator<"u"&&navigator.product==="ReactNative"?fs="react-native":fs="node";const Dx={"X-Client-Info":`supabase-js-${fs}/${Mx}`},Bx={headers:Dx},zx={schema:"public"},Fx={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},qx={},Hx={enabled:!1,respectSamplingDecision:!0};function Wx(e,t,r,n){function s(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function o(d){try{c(n.next(d))}catch(h){a(h)}}function u(d){try{c(n.throw(d))}catch(h){a(h)}}function c(d){d.done?i(d.value):s(d.value).then(o,u)}c((n=n.apply(e,[])).next())})}let Jo=null;const Vx="@opentelemetry/api";function Kx(){return Jo===null&&(Jo=import(Vx).catch(()=>null)),Jo}function Jx(){return Wx(this,void 0,void 0,function*(){try{const e=yield Kx();if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const r=t.traceparent;return r?{traceparent:r,tracestate:t.tracestate,baggage:t.baggage}:null}catch{return null}})}function Gx(e){if(!e||typeof e!="string")return null;const t=e.split("-");if(t.length!==4)return null;const[r,n,s,i]=t;if(r.length!==2||n.length!==32||s.length!==16||i.length!==2)return null;const a=/^[0-9a-f]+$/i;return!a.test(r)||!a.test(n)||!a.test(s)||!a.test(i)||n==="00000000000000000000000000000000"||s==="0000000000000000"?null:{version:r,traceId:n,parentId:s,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function Qx(e,t){if(!e||!t||t.length===0)return!1;let r;if(e instanceof URL)r=e;else try{r=new URL(e)}catch{return!1}for(const n of t)try{if(typeof n=="string"){if(Yx(r.hostname,n))return!0}else if(n instanceof RegExp){if(n.test(r.hostname))return!0}else if(typeof n=="function"&&n(r))return!0}catch{continue}return!1}function Yx(e,t){if(t===e)return!0;if(t.startsWith("*.")){const r=t.slice(2);if(e.endsWith(r)&&(e===r||e.endsWith("."+r)))return!0}return!1}function Xx(e){const t=[];try{const r=new URL(e);t.push(r.hostname)}catch{}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function Ys(e){"@babel/helpers - typeof";return Ys=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ys(e)}function Zx(e,t){if(Ys(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ys(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eb(e){var t=Zx(e,"string");return Ys(t)=="symbol"?t:t+""}function tb(e,t,r){return(t=eb(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function fe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jh(Object(r),!0).forEach(function(n){tb(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jh(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const rb=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),nb=()=>Headers,sb=(e,t,r,n,s)=>{const i=rb(n),a=nb(),o=(s==null?void 0:s.enabled)===!0,u=(s==null?void 0:s.respectSamplingDecision)!==!1,c=o?Xx(t):null;return async(d,h)=>{var f;const p=(f=await r())!==null&&f!==void 0?f:e;let y=new a(h==null?void 0:h.headers);if(y.has("apikey")||y.set("apikey",e),y.has("Authorization")||y.set("Authorization",`Bearer ${p}`),c){const w=await ib(d,c,u);w&&(w.traceparent&&!y.has("traceparent")&&y.set("traceparent",w.traceparent),w.tracestate&&!y.has("tracestate")&&y.set("tracestate",w.tracestate),w.baggage&&!y.has("baggage")&&y.set("baggage",w.baggage))}return i(d,fe(fe({},h),{},{headers:y}))}};async function ib(e,t,r){if(!Qx(typeof e=="string"||e instanceof URL?e:e.url,t))return null;const n=await Jx();if(!n||!n.traceparent)return null;if(r){const s=Gx(n.traceparent);if(s&&!s.isSampled)return null}return n}function Ch(e){return typeof e=="boolean"?{enabled:e}:e}function ab(e){return e.endsWith("/")?e:e+"/"}function ob(e,t){var r,n,s,i,a,o;const{db:u,auth:c,realtime:d,global:h}=e,{db:f,auth:p,realtime:y,global:w}=t,x=Ch(e.tracePropagation),m=Ch(t.tracePropagation),g={db:fe(fe({},f),u),auth:fe(fe({},p),c),realtime:fe(fe({},y),d),storage:{},global:fe(fe(fe({},w),h),{},{headers:fe(fe({},(r=w==null?void 0:w.headers)!==null&&r!==void 0?r:{}),(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(s=(i=x==null?void 0:x.enabled)!==null&&i!==void 0?i:m==null?void 0:m.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(a=(o=x==null?void 0:x.respectSamplingDecision)!==null&&o!==void 0?o:m==null?void 0:m.respectSamplingDecision)!==null&&a!==void 0?a:!0},accessToken:async()=>""};return e.accessToken?g.accessToken=e.accessToken:delete g.accessToken,g}function lb(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");
95if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(ab(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var ub=class extends Ux{constructor(e){super(e)}},cb=class{constructor(e,t,r){var n,s;this.supabaseUrl=e,this.supabaseKey=t;const i=lb(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const a=`sb-${i.hostname.split(".")[0]}-auth-token`,o={db:zx,realtime:qx,auth:fe(fe({},Fx),{},{storageKey:a}),global:Bx,tracePropagation:Hx},u=ob(r??{},o);if(this.settings=u,this.storageKey=(n=u.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=u.global.headers)!==null&&s!==void 0?s:{},u.accessToken)this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=u.auth)!==null&&c!==void 0?c:{},this.headers,u.global.fetch)}this.fetch=sb(t,e,this._getAccessToken.bind(this),u.global.fetch,u.tracePropagation),this.realtime=this._initRealtimeClient(fe({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},u.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new jw(new URL("rest/v1",i).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch,timeout:u.db.timeout,urlLengthLimit:u.db.urlLengthLimit}),this.storage=new D_(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new gw(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,r;if(e.accessToken)return await e.accessToken();const{data:n}=await e.auth.getSession();return(t=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:a,lock:o,debug:u,throwOnError:c,experimental:d,lockAcquireTimeout:h,skipAutoInitialize:f},p,y){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new ub({url:this.authUrl.href,headers:fe(fe({},w),p),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,flowType:a,lock:o,debug:u,throwOnError:c,experimental:d,fetch:y,lockAcquireTimeout:h,skipAutoInitialize:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(x=>x.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new l_(this.realtimeUrl.href,fe(fe({},e),{},{params:fe(fe({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const db=(e,t,r)=>new cb(e,t,r);function hb(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const r=t.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}hb()&&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 N
95ode.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const fb="https://holcvkttvimxpketejwh.supabase.co",pb="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImhvbGN2a3R0dmlteHBrZXRlandoIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzk2NjYxNDIsImV4cCI6MjA5NTI0MjE0Mn0.ia3Vwf9yYx4RaWNoylRXDuG8RM2dKL9aDyNDeRS9U8o",dn=db(fb,pb,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),er="https://comparacarrito-production.up.railway.app";async function Cr(e){if(!e.ok){const t=await e.json().catch(()=>({})),r=new Error(t.detail||`Error ${e.status}`);throw r.status=e.status,r.upgradeUrl=t.upgrade_url||null,r}return e.json()}async function mb(){var t;const{data:e}=await dn.auth.getSession();return((t=e.session)==null?void 0:t.access_token)||null}async function tr(e={}){const t=await mb();return t?{...e,Authorization:`Bearer ${t}`}:e}async function gb(e,t){return Cr(await fetch(`${er}/api/parse-cart`,{method:"POST",headers:await tr({"Content-Type":"application/json"}),body:JSON.stringify({text:e,supermarket:t})}))}async function vb({products:e,sourceSupermarket:t,targetSupermarkets:r},{signal:n}={}){var i;const s=await fetch(`${er}/api/compare`,{method:"POST",headers:await tr({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({products:e,source_supermarket:t,target_supermarkets:r}),signal:n});if(!s.ok){const a=await s.json().catch(()=>({})),o=new Error(a.detail||`No se pudo iniciar la comparación (error ${s.status})`);throw o.status=s.status,o.upgradeUrl=a.upgrade_url||null,o}if(!((i=s.body)!=null&&i.getReader))throw new Error("El navegador no pudo abrir la respuesta en tiempo real.");return s}async function yb(e,t,r){return Cr(await fetch(`${er}/api/optimize`,{method:"POST",headers:await tr({"Content-Type":"application/json"}),body:JSON.stringify({products:e,shipping_config:t,include_shipping:r})}))}async function wb(){return Cr(await fetch(`${er}/api/user/profile`,{headers:await tr()}))}async function _b(e){return Cr(await fetch(`${er}/api/user/profile`,{method:"PATCH",headers:await tr({"Content-Type":"application/json"}),body:JSON.stringify(e)}))}async function xb(){return Cr(await fetch(`${er}/api/user/usage-status`,{headers:await tr()}))}async function Yk(){return Cr(await fetch(`${er}/api/subscriptions/create`,{method:"POST",headers:await tr({"Content-Type":"application/json"})}))}async function Xk(){return Cr(await fetch(`${er}/api/subscriptions/status`,{headers:await tr()}))}async function Zk(e){const t=e?`?payment_id=${encodeURIComponent(e)}`:"";return Cr(await fetch(`${er}/api/subscriptions/sync${t}`,{method:"POST",headers:await tr({"Content-Type":"application/json"})}))}function qm(e,{onRequireAuth:t,onUpgrade:r}={}){return(e==null?void 0:e.status)===401?(t==null||t(),!0):(e==null?void 0:e.status)===429?(r==null||r({title:"LÃmite diario alcanzado",message:e.message}),!0):!1}const Hm=_.createContext(null);function bb({children:e}){const[t,r]=_.useState(null),[n,s]=_.useState(null),[i,a]=_.useState(null),[o,u]=_.useState(!0);_.useEffect(()=>{dn.auth.getSession().then(({data:g})=>{var v;r(g.session),s(((v=g.session)==null?void 0:v.user)??null),u(!1)});const{data:m}=dn.auth.onAuthStateChange((g,v)=>{r(v),s((v==null?void 0:v.user)??null)});return()=>m.subscription.unsubscribe()},[]);const c=_.useCallback(async()=>{try{const m=await wb();return a(m),m}catch{return a(null),null}},[]);_.useEffect(()=>{n!=null&&n.id?c():a(null)},[n==null?void 0:n.id,c]);async function d(m,g){const{error:v}=await dn.auth.signInWithPassword({email:m,password:g});return{error:v}}async function h(m,g,v,b={}){var C;const E={display_name:v||m.split("@")[0]};b.comuna&&(E.comuna=b.comuna),b.region&&(E.region=b.region),(C=b.preferred_stores)!=null&&C.length&&(E.preferred_stores=b.preferred_stores);const{data:S,error:j}=await dn.auth.signUp({email:m,password:g,options:{data:E}}),P=!j&&!S.session;return{error:j,needsConfirmation:P}}async function f(){await dn.auth.signOut(),a(null)}async function p(m){const g=await _b(m);return a(g),g}const y=(i==null?void 0:i.plan)||"free",x={session:t,user:n,profile:i,loading:o,plan:y,isPro:y==="pro",signIn:d,signUp:h,signOut:f,refreshProfile:c,saveProfile:p};return l.jsx(Hm.Provider,{value:x,children:e})}function ui(){const e=_.useContext(Hm);
95if(!e)throw new Error("useAuth debe usarse dentro de <AuthProvider>");return e}const fc="https://chromewebstore.google.com/detail/comparacarritocl/albnjaaiikibhhmngbmmpdneamjhbmnj",kb=1500,Sb=12e4,Eb=new Set(["ok","empty","timeout","blocked","schema_error"]);class Go extends Error{constructor(t,r="blocked",n=null){super(t),this.name="ExtensionComparisonError",this.status=Eb.has(r)?r:"blocked",this.storeStatus=n}}function Wm(){return`cc-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function pc(e=kb){return new Promise(t=>{const r=Wm();let n=!1;function s(o){n||(n=!0,window.removeEventListener("message",i),clearTimeout(a),t(o))}function i(o){o.source!==window||!o.data||o.data.type==="CC_PONG"&&o.data.requestId===r&&s(!0)}window.addEventListener("message",i);const a=setTimeout(()=>s(!1),e);window.postMessage({type:"CC_PING",requestId:r},window.location.origin)})}function jb({sourceStore:e,items:t,stores:r},{onProgress:n,signal:s}={},i=Sb){return new Promise((a,o)=>{const u=Wm();let c=!1,d;function h(){clearTimeout(d),d=setTimeout(()=>{c||(f(),o(new Go("La extensión dejó de responder. Revisa que siga activa y vuelve a intentar.","timeout")))},i)}function f(){c||(c=!0,window.removeEventListener("message",y),s==null||s.removeEventListener("abort",p),clearTimeout(d))}function p(){if(c)return;window.postMessage({type:"CC_COMPARE_STREAM_ABORT",requestId:u},window.location.origin),f();const w=new DOMException("Comparación detenida","AbortError");o(w)}function y(w){if(!(w.source!==window||!w.data||w.data.requestId!==u))switch(w.data.type){case"CC_COMPARE_STREAM_PROGRESS":h(),n&&n({done:w.data.done,total:w.data.total,item:w.data.item});break;case"CC_COMPARE_STREAM_DONE":f(),!w.data.data||typeof w.data.data!="object"||!w.data.data.comparisonResults||typeof w.data.data.comparisonResults!="object"||Array.isArray(w.data.data.comparisonResults)||Object.values(w.data.data.comparisonResults).some(x=>!x||typeof x!="object"||!Array.isArray(x.items))?o(new Go("La extensión respondió con un formato inesperado. ActualÃzala antes de reintentar.","schema_error")):a(w.data.data);break;case"CC_COMPARE_STREAM_ERROR":f(),o(new Go(w.data.error||"No se pudo comparar con la extensión.",w.data.status,w.data.storeStatus||null));break}}if(s!=null&&s.aborted){p();return}window.addEventListener("message",y),s==null||s.addEventListener("abort",p,{once:!0}),h(),window.postMessage({type:"CC_COMPARE_STREAM_REQUEST",requestId:u,payload:{sourceStore:e,items:t,stores:r}},window.location.origin)})}function Lt({size:e=24,children:t,...r}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r,children:t})}function Xs({size:e=20,...t}){return l.jsx(Lt,{size:e,...t,children:l.jsx("path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z"})})}function mc({size:e=18,...t}){return l.jsx(Lt,{size:e,strokeWidth:"3",...t,children:l.jsx("polyline",{points:"20 6 9 17 4 12"})})}function gc({size:e=14,...t}){return l.jsx(Lt,{size:e,strokeWidth:"2.5",...t,children:l.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})}function Vm({size:e=22,...t}){return l.jsxs(Lt,{size:e,...t,children:[l.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"2.5"}),l.jsx("circle",{cx:"12",cy:"12",r:"2.6"}),l.jsx("path",{d:"M5.6 9.6v4.8M18.4 9.6v4.8"})]})}
95function Cb({size:e=22,...t}){return l.jsxs(Lt,{size:e,...t,children:[l.jsx("path",{d:"M3.2 8.6 5.5 4.2A2 2 0 0 1 7.3 3.1h9.4a2 2 0 0 1 1.8 1.1l2.3 4.4"}),l.jsx("path",{d:"M3.2 8.6h17.6"}),l.jsx("path",{d:"M5 8.6V20a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8.6"}),l.jsx("path",{d:"M9.6 21v-5.6h4.8V21"})]})}function Rb({size:e=22,...t}){return l.jsx(Lt,{size:e,...t,children:l.jsx("path",{d:"M2.5 12h4l2-6.6 3.6 13.2 2.4-6.6h6.5"})})}function Tb({size:e=22,...t}){return l.jsxs(Lt,{size:e,...t,children:[l.jsx("path",{d:"M3 17.4V6.6a1 1 0 0 1 1-1h9.2a1 1 0 0 1 1 1v10.8"}),l.jsx("path",{d:"M14.2 9.6h3.3a2 2 0 0 1 1.63.84l1.5 2.1a2 2 0 0 1 .37 1.16v3.7h-1.6"}),l.jsx("path",{d:"M3 17.4h2.2M9.6 17.4h5.6"}),l.jsx("circle",{cx:"7.4",cy:"17.6",r:"1.9"}),l.jsx("circle",{cx:"17.4",cy:"17.6",r:"1.9"})]})}function Nb({size:e=15,...t}){return l.jsxs(Lt,{size:e,...t,children:[l.jsx("rect",{x:"3.2",y:"3.2",width:"7.6",height:"7.6",rx:"1.8"}),l.jsx("rect",{x:"13.2",y:"3.2",width:"7.6",height:"7.6",rx:"1.8"}),l.jsx("rect",{x:"3.2",y:"13.2",width:"7.6",height:"7.6",rx:"1.8"}),l.jsx("rect",{x:"13.2",y:"13.2",width:"7.6",height:"7.6",rx:"1.8"})]})}function Pb({size:e=15,...t}){return l.jsxs(Lt,{size:e,...t,children:[l.jsx("path",{d:"M20.7 12.6 12.6 20.7a2 2 0 0 1-2.83 0l-6.4-6.4A2 2 0 0 1 2.8 12.9V4.8a2 2 0 0 1 2-2h8.1a2 2 0 0 1 1.41.59l6.4 6.4a2 2 0 0 1 0 2.82z"}),l.jsx("circle",{cx:"7.6",cy:"7.6",r:"1.3"})]})}function Km({size:e=18,...t}){return l.jsxs(Lt,{size:e,...t,children:[l.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),l.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}const Mr=fc!=="#";function uo({children:e="Agregar a Chrome",className:t="btn-chrome",iconSize:r=20}){return l.jsxs("a",{href:Mr?fc:void 0,target:Mr?"_blank":void 0,rel:"noopener noreferrer",className:t,"aria-disabled":!Mr,onClick:Mr?void 0:n=>n.preventDefault(),children:[l.jsx(Xs,{size:r}),e]})}let En=null,is=null;function Rh(e=!1){return!e&&En!==null?Promise.resolve(En):is||(is=pc().then(t=>(En=t,t)).catch(()=>(En=!1,!1)).finally(()=>{is=null}),is)}function Ab(){const[e,t]=_.useState(En);return _.useEffect(()=>{let r=!0;Rh().then(s=>{r&&t(s)});function n(){En!==!0&&Rh(!0).then(s=>{r&&t(s)})}return window.addEventListener("focus",n),()=>{r=!1,window.removeEventListener("focus",n)}},[]),e}function Ob({className:e="btn-chrome-nav",onNavigate:t}){return Ab()?l.jsxs(st,{to:"/?app=1",className:`${e} esta-instalada`,onClick:t,title:"Ya tienes la extensión instalada",children:[l.jsx(mc,{size:16}),"Comparar ahora"]}):l.jsx(uo,{className:e,iconSize:17})}function Lb({className:e=""}){const[t,r]=_.useState(()=>typeof document>"u"?"light":document.documentElement.getAttribute("data-theme")||"light");_.useEffect(()=>{document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem("cc-theme",t)}catch{}},[t]);const n=t==="dark",s=n?"Cambiar a modo claro":"Cambiar a modo oscuro";return l.jsx("button",{type:"button",className:e?`theme-toggle ${e}`:"theme-toggle",onClick:()=>r(i=>i==="dark"?"light":"dark"),"aria-label":s,title:s,children:n?l.jsx("svg",{width:"17",height:"17",viewBox:"0 0 256 256",fill:"currentColor","aria-hidden":"true",children:l.jsx("path",{d:"M233.5 142.2a8 8 0 0 0-8.2-2.6 88 88 0 0 1-109-109 8 8 0 0 0-10-10 104.3 104.3 0 0 0-52 40.2 104 104 0 0 0 140.9 140.9 104.3 104.3 0 0 0 40.2-52 8 8 0 0 0-1.9-7.5Z"})}):l.jsx("svg",{width:"17",height:"17",viewBox:"0 0 256 256",fill:"currentColor","aria-hidden":"true",children:l.jsx("path",{d:"M128 60a68 68 0 1 0 68 68 68.07 68.07 0 0 0-68-68Zm0 120a52 52 0 1 1 52-52 52.06 52.06 0 0 1-52 52ZM120 36V16a8 8 0 0 1 16 0v20a8 8 0 0 1-16 0Zm0 204v-20a8 8 0 0 1 16 0v20a8 8 0 0 1-16 0ZM36 120H16a8 8 0 0 1 0 16h20a8 8 0 0 1 0-16Zm204 0h-20a8 8 0 0 1 0 16h20a8 8 0 0 1 0-16ZM58.3 47a8 8 0 0 1 11.4 11.4L55.6 72.4A8 8 0 0 1 44.2 61Zm139 139a8 8 0 0 1 11.4 11.3l-14.1 14.2a8 8 0 0 1-11.4-11.4Zm14.1-139L186.3 61a8 8 0 0 1-11.4-11.4L189 35.6A8 8 0 0 1 200.4 47ZM58.3 200.4 44.2 186.3A8 8 0 0 1 55.6 175l14.1 14.1a8 8 0 0 1-11.4 11.3Z"})})})}function Ib(){return l.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"9",cy:"21",r:"1"}),l.jsx("circle",{cx:"20",cy:"21",r:"1"}),l.jsx("path",{d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"})]})}function $b({user:e,signOut:t,onNavigate:r}){var h;const[n,s]=_.useState(!1),i=ai(),a=_.useRef(null),o=((h=e.user_metadata)==null?void 0:h.display_name)||e.email,u=(o||"U").charAt(0).toUpperCase();_.useEffect(()=>{if(!n)return;const f=y=>{a.current&&!a.current.contains(y.target)&&s(!1)},p=y=>{y.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",f),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",p)}},[n]);function c(f){s(!1),r==null||r(),i(f)}async function d(){s(!1),r==null||r(),await t(),i("/")}return l.jsxs("div",{className:"user-menu",ref:a,children:[l.jsxs("button",{className:"user-menu-trigger",onClick:()=>s(f=>!f),"aria-haspopup":"true","aria-expanded":n,children:[l.jsx("span",{className:"user-menu-avatar",children:u}),l.jsx("span",{className:"user-menu-name",children:o}),l.jsx("svg",{className:`user-menu-caret ${n?"open":""}`,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),n&&l.jsxs("div",{className:"user-menu-dropdown",role:"menu",children:[l.jsxs("button",{className:"user-menu-item",role:"menuitem",onClick:()=>c("/perfil"),children:[l.jsx(Km,{size:16}),"Mi Perfil"]}
95),l.jsxs("button",{className:"user-menu-item",role:"menuitem",onClick:()=>c("/planes"),children:[l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),"Mi Plan"]}),l.jsx("div",{className:"user-menu-sep"}),l.jsxs("button",{className:"user-menu-item danger",role:"menuitem",onClick:d,children:[l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),l.jsx("polyline",{points:"16 17 21 12 16 7"}),l.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]}),"Cerrar sesión"]})]})]})}function Ub({onLoginClick:e}){const[t,r]=_.useState(!1),[n,s]=_.useState(!1),i=ai(),{user:a,loading:o,signOut:u}=ui(),c=_.useRef(null);_.useEffect(()=>{const f=c.current;if(!f)return;const p=new IntersectionObserver(([y])=>r(!y.isIntersecting),{threshold:0});return p.observe(f),()=>p.disconnect()},[]),_.useEffect(()=>{if(!n)return;const f=p=>{p.key==="Escape"&&s(!1)};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n]);const d=()=>s(!1);function h(f){f.preventDefault(),d(),i("/",{state:{goHome:Date.now()}}),window.scrollTo({top:0})}return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:`header ${t?"scrolled":""}`,children:[l.jsxs("div",{className:"header-inner",children:[l.jsxs("a",{href:"/",onClick:h,className:"logo",children:[l.jsx("div",{className:"logo-mark",children:l.jsx(Ib,{})}),l.jsxs("span",{className:"logo-text",children:["Compara",l.jsx("span",{className:"logo-accent",children:"Carrito"}),".cl"]})]}),l.jsx("button",{type:"button",className:"nav-toggle","aria-label":n?"Cerrar menú":"Abrir menú","aria-expanded":n,onClick:()=>s(f=>!f),children:n?l.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):l.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:[l.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),l.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),l.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),l.jsxs("nav",{className:`nav ${n?"open":""}`,children:[l.jsx(aa,{to:"/",end:!0,onClick:d,className:({isActive:f})=>`nav-link ${f?"active":""}`,children:"Inicio"}),l.jsx(aa,{to:"/como-usarlo",onClick:d,className:({isActive:f})=>`nav-link ${f?"active":""}`,children:"Cómo usarlo"}),l.jsx(aa,{to:"/planes",onClick:d,className:({isActive:f})=>`nav-link ${f?"active":""}`,children:"Planes"}),l.jsx(Ob,{className:"btn-chrome-nav",onNavigate:d}),!o&&(a?l.jsx($b,{user:a,signOut:u,onNavigate:d}):l.jsxs("button",{type:"button",className:"btn-login",onClick:()=>{d(),e()},children:[l.jsx(Km,{size:16}),"Iniciar sesión"]})),l.jsx(Lb,{className:"theme-toggle-nav"})]})]}),n&&l.jsx("div",{className:"nav-backdrop",onClick:d,"aria-hidden":"true"})]}),l.jsx("div",{ref:c,"aria-hidden":"true",style:{height:1,marginTop:-1}})]})}function Mb(){return l.jsx("footer",{className:"site-footer",children:l.jsxs("div",{className:"footer-inner",children:[l.jsxs("div",{className:"footer-top",children:[l.jsxs("div",{className:"footer-brand",children:[l.jsx("h3",{children:"ComparaCarrito.cl"}),l.jsx("p",{children:"El comparador de precios de supermercados más fácil de Chile. Porque ahorrar no deberÃa ser complicado."})]}),l.jsxs("div",{className:"footer-col",children:[l.jsx("h4",{children:"Producto"}),l.jsx(st,{to:"/",children:"Comparador"}),l.jsx(st,{to:"/como-usarlo",children:"Cómo usarlo"}),l.jsx(st,{to:"/planes",children:"Planes"})]}),l.jsxs("div",{className:"footer-col",children:[l.jsx("h4",{children:"Empresa"}),l.jsx(st,{to:"/quienes-somos",children:"Quiénes somos"}),l.jsx(st,{to:"/legal",children:"Legal"}),l.jsx(st,{to:"/contacto",children:"Contacto"})]}),l.jsxs("div",{className:"footer-col",children:[l.jsx("h4",{children:"Supermercados"}),l.jsx("a",{href:"https://www.lider.cl",target:"_blank",rel:"noopener noreferrer",children:"Lider"}),l.jsx("a",{href:"https://www.jumbo.cl",target:"_blank",rel:"noopener noreferrer",children:"Jumbo"}),l.jsx("a",{href:"https://www.unimarc.cl",target:"_blank",rel:"noopener noreferrer",children:"Unimarc"}),l.jsx("a",{href:"https://www.santaisabel.cl",target:"_blank",rel:"noopener noreferrer",children:"Santa Isabel"})]})]}),l.jsx("div",{className:"footer-bottom",children:l.jsxs("span",{children:["© ",new Date().getFullYear()," ComparaCarrito.cl"]}
95)})]})})}function Db({name:e,color:t,className:r=""}){return l.jsxs("div",{className:r?`store-mark ${r}`:"store-mark",children:[l.jsx("span",{className:"store-mark-dot",style:{background:t},"aria-hidden":"true"}),l.jsx("span",{className:"store-mark-name",style:{color:t},children:e})]})}const Bb=44780,zb=6490,Qo=zb/Bb,Fi=6e4,Yo=6e5,Fb=1e4,as=new Intl.NumberFormat("es-CL",{style:"currency",currency:"CLP",maximumFractionDigits:0}),Th=e=>Math.round(e/100)*100;function qb(){var f;const[e,t]=_.useState(18e4),[r,n]=_.useState(!1),[s,i]=_.useState(0),a=_.useRef(null),o=typeof window<"u"&&((f=window.matchMedia)==null?void 0:f.call(window,"(prefers-reduced-motion: reduce)").matches),u=Th(e*Qo*s),c=Th(e*Qo*12*s),d=(e-Fi)/(Yo-Fi)*100;_.useEffect(()=>{const p=a.current;if(!p)return;if(o){i(1);return}let y=0;const w=new IntersectionObserver(([x],m)=>{if(!x.isIntersecting)return;m.disconnect();const g=performance.now(),v=700,b=E=>{const S=Math.min((E-g)/v,1);i(1-Math.pow(1-S,3)),S<1&&(y=requestAnimationFrame(b))};y=requestAnimationFrame(b)},{threshold:.35});return w.observe(p),()=>{w.disconnect(),y&&cancelAnimationFrame(y)}},[o]);function h(){o||(n(!1),requestAnimationFrame(()=>n(!0)))}return l.jsxs("div",{className:"calc",ref:a,children:[l.jsxs("div",{className:"calc-top",children:[l.jsx("label",{className:"calc-q",htmlFor:"calc-gasto",children:"Tu compra del mes"}),l.jsx("output",{className:"calc-spend num",htmlFor:"calc-gasto",children:as.format(e)}),l.jsx("div",{className:"calc-slider",style:{"--pct":`${d}%`},children:l.jsx("input",{id:"calc-gasto",type:"range",min:Fi,max:Yo,step:Fb,value:e,onChange:p=>t(Number(p.target.value)),onPointerUp:h,onKeyUp:h})}),l.jsxs("div",{className:"calc-scale",children:[l.jsx("span",{className:"num",children:as.format(Fi)}),l.jsx("span",{className:"num",children:as.format(Yo)})]})]}),l.jsxs("div",{className:"calc-res",children:[l.jsx("div",{className:"calc-res-cab",children:"Al año te quedan"}),l.jsx("div",{className:r?"calc-ano num pulso":"calc-ano num",children:as.format(c)}),l.jsx("div",{className:"calc-prop","aria-hidden":"true",children:l.jsx("div",{className:"calc-prop-fill",style:{width:`${Qo*100*s}%`}})}),l.jsxs("div",{className:"calc-prop-pie",children:[l.jsxs("span",{children:[l.jsx("strong",{className:"num",children:as.format(u)})," al mes"]}),l.jsx("span",{className:"calc-prop-pct",children:"proyectado del ejemplo"})]})]}),l.jsx("p",{className:"calc-note",children:"Proyección basada en la comparación de ejemplo de esta página, no una promesa de ahorro. Lo que ahorres depende de qué compres, dónde y cuándo."})]})}const Hb=[{q:"¿Es una suscripción mensual?",a:"No. Es un pago único a precio de lanzamiento y el acceso queda para siempre, sin renovación ni cobro recurrente."},{q:"¿Por qué necesito la extensión si la web ya compara?",a:"La versión web compara Jumbo y Santa Isabel. Lider y Unimarc bloquean las consultas automáticas desde servidores, asà que la única forma de leer sus precios es desde tu propio navegador. Eso es exactamente lo que hace la extensión."},{q:"¿Los precios son los de verdad?",a:"Se leen del sitio de cada supermercado en el momento en que comparas, no de una base de datos antigua. Aun asà son referenciales: verifica en el sitio del supermercado antes de comprar."},{q:"¿Guardan mi carrito o mis datos de compra?",a:"La comparación se procesa para devolverte el resultado. Guardamos datos de uso agregados para medir el servicio y aplicar los lÃmites de cada plan, nunca el detalle de lo que compras asociado a tu nombre."},{q:"¿Cuánto me puedo ahorrar en realidad?",a:"Depende de lo que compres, dónde y cuándo, asà que no damos una cifra general: serÃa inventarla. En el carrito de ejemplo de esta página la diferencia entre el más barato y el más caro fue de $6.490. En la compra del mes, esa diferencia se multiplica."}];function Wb({preguntas:e=Hb,abiertaInicial:t=0}){const[r,n]=_.useState(t),s=_.useId();return l.jsx("ul",{className:"faq-landing",children:e.map((i,a)=>{const o=r===a,u=`${s}-b${a}`,c=`${s}-p${a}`;return l.jsxs("li",{className:o?"faq-l-item open":"faq-l-item",children:[l.jsx("h3",{className:"faq-l-h",children:l.jsxs("button",{type:"button",id:u,className:"faq-l-btn","aria-expanded":o,"aria-controls":c,onClick:()=>n(o?-1:a),children:[l.jsx("span",{children:i.q}),l.jsx("span",{className:"faq-l-mas","aria-hidden":"true",children:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[l.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19",className:"faq-l-mas-v"}),l.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})})]})}),l.jsx("div",{id:c,role:"region","aria-labelledby":u,className:"faq-l-body",children:l.jsx("div",{className:"faq-l-body-inner",children:l.jsx("p",{children:i.a})})})]},i.q)})})}function vc({nombre:e,alt:t,ratio:r="3 / 2",className:n="",priority:s=!1}){return l.jsx("div",{className:n?`ilus ${n}`:"ilus",style:{aspectRatio:r},children:l.jsx("img",{src:`/assets/brand/${e}.webp`,alt:t,loading:s?"eager":"lazy",decoding:"async",fetchPriority:s?"high":"auto"})})}const Jm=[{name:"Lider",sub:"Walmart Chile",color:"var(--m-lider)"},{name:"Jumbo",sub:"Cencosud",color:"var(--m-jumbo)"},{name:"Unimarc",sub:"SMU",color:"var(--m-unimarc)"},{name:"Santa Isabel",sub:"Cencosud",color:"var(--m-santaisabel)"},{name:"Tottus",sub:"Falabella",color:"var(--m-tottus)",pronto:!0}],la=[{store:"Unimarc",color:"var(--m-unimarc)",total:38290,ancho:86,estado:"barato"},{store:"Lider",color:"var(--m-lider)",total:41230,ancho:92,estado:null},{store:"Santa Isabel",color:"var(--m-santaisabel)",total:42500,ancho:95,estado:null},{store:"Jumbo",color:"var(--m-jumbo)",total:44780,ancho:100,estado:"caro"}],zr=new Intl.NumberFormat("es-CL",{style:"currency",currency:"CLP",maximumFractionDigits:0});function Gm(){return l.jsx("p",{className:"aviso-precios",children:"* Valores referenciales. El precio puede cambiar al momento de ejecutar la compra."})}function Vb({setPage:e}){return l.jsxs("section",{className:"hero",children:[l.jsxs("div",{className:"hero-inner",children:[l.jsxs("div",{className:"hero-copy",children:[Mr&&l.jsxs("div",{className:"hero-pill sube",children:[l.jsx(Xs,{size:14}),"Publicada en la Chrome Web Store"]}),l.jsxs("h1",{className:"sube",children:["El mismo carrito, ",l.jsx("em",{children:"comparado con claridad"})," en cuatro tiendas."]}),l.jsx("p",{className:"hero-sub sube",children:"Comparamos tu carrito en Lider, Jumbo, Unimarc y Santa Isabel antes de que pagues, y mostramos el ahorro sólo cuando todas las tiendas cubren la lista completa."}),l.jsxs("div",{className:"hero-actions sube",children:[l.jsx(uo,{className:"btn-chrome-hero",children:"Agregar a Chrome"}),l.jsx("button",{type:"button",className:"btn-hero-ghost",onClick:()=>e("comp"),children:"Probar gratis"})]})]}),l.jsx(qb,{})]}),l.jsx(Gm,{})]})}function Kb(){const e=[Mr&&{Icon:Xs,txt:l.jsxs(l.Fragment,{children:["Publicada en la ",l.jsx("strong",{children:"Chrome Web Store"})]})},{Icon:Nb,txt:l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"4 supermercados"})," en una sola comparación"]})},{Icon:Pb,txt:l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"Pago único"})," a precio de lanzamiento"]})}
95].filter(Boolean);return l.jsxs("div",{className:"confianza",children:[l.jsx("div",{className:"confianza-inner",children:e.map((t,r)=>l.jsxs("div",{className:"confianza-item",children:[l.jsx("span",{className:"confianza-ic",children:l.jsx(t.Icon,{size:16})}),t.txt]},r))}),l.jsx("div",{className:"franja-inner",children:Jm.map(t=>l.jsxs("span",{className:"franja-tienda",children:[l.jsx("i",{style:{background:t.color},"aria-hidden":"true"}),t.name]},t.name))})]})}function Jb(){const e=la.find(r=>r.estado==="barato"),t=la.find(r=>r.estado==="caro");return l.jsx("section",{className:"ls ls-bg-paper",children:l.jsxs("div",{className:"ls-inner",children:[l.jsx("div",{className:"ls-label fade-in",children:"El producto, en una pantalla"}),l.jsx("h2",{className:"ls-title fade-in",children:"La diferencia no es de pesos. Es de decenas de miles."}),l.jsx("p",{className:"ls-sub fade-in",children:"Un carrito de 12 productos comparado en los cuatro supermercados el mismo dÃa."}),l.jsxs("div",{className:"cmp-wrap",children:[l.jsxs("div",{className:"cmp fade-in",children:[l.jsxs("div",{className:"cmp-hd",children:[l.jsx("span",{children:"Carrito de 12 productos"}),l.jsx("span",{children:"Precios de hoy"})]}),la.map(r=>l.jsxs("div",{className:r.estado?`cmp-row ${r.estado}`:"cmp-row",children:[l.jsx("span",{className:"cmp-marca",style:{background:r.color},"aria-hidden":"true"}),l.jsxs("div",{className:"cmp-medio",children:[l.jsxs("div",{className:"cmp-nombre",children:[r.store,r.estado==="barato"&&l.jsx("span",{className:"cmp-tag tag-barato",children:"Más barato"}),r.estado==="caro"&&l.jsx("span",{className:"cmp-tag tag-caro",children:"Más caro"})]}),l.jsx("div",{className:"cmp-barra",children:l.jsx("i",{style:{"--w":`${r.ancho}%`}})})]}),l.jsx("div",{className:"cmp-precio num",children:zr.format(r.total)}),l.jsx("div",{className:r.total===e.total?"cmp-delta base":"cmp-delta",children:r.total===e.total?"base":`+${zr.format(r.total-e.total)}`})]},r.store)),l.jsxs("div",{className:"cmp-ft",children:[l.jsx("span",{children:"Ahorro comprando en el más barato"}),l.jsx("strong",{className:"num",children:zr.format(t.total-e.total)})]})]}),l.jsxs("div",{className:"cmp-lado",children:[l.jsx(vc,{nombre:"comparacion-cuatro-tiendas",alt:"Cuatro compras comparadas que convergen en la alternativa más conveniente",ratio:"3 / 2",className:"fade-in"}),l.jsx("p",{className:"cmp-aside fade-in",children:"Nadie tiene tiempo de revisar cuatro sitios antes de cada compra. Esa es justamente la parte que hacemos nosotros, en el momento en que estás por pagar."})]})]})]})})}function Gb(){const e=[{n:"1",img:"paso-1-pegar-carrito",alt:"Lista de compras pasando a una bandeja de comparación",title:"Pega tu carrito",desc:"Copia el contenido del carrito desde el sitio de tu super y pégalo. Detectamos el formato automáticamente."},{n:"2",img:"paso-2-comparar-precios",alt:"Canasto comparado mediante cuatro tarjetas de supermercado",title:"Compara según tu plan",desc:"Gratis busca en Jumbo y Santa Isabel; Pro agrega Lider y Unimarc mediante la extensión."},{n:"3",img:"paso-3-elegir-compra",alt:"Alternativas de compra convergiendo en el canasto más conveniente",title:"Revisa la cobertura",desc:"Con cobertura completa mostramos ganador y ahorro; si falta algo, los totales quedan rotulados como parciales."}];return l.jsx("section",{className:"ls ls-bg-surface",children:l.jsxs("div",{className:"ls-inner",children:[l.jsxs("div",{className:"como-top",children:[l.jsx("div",{className:"ls-label fade-in",children:"Versión de prueba, gratis"}),l.jsx("h2",{className:"ls-title fade-in",children:"Pruébalo pegando tu carrito"}),l.jsx("p",{className:"ls-sub fade-in",children:"Sin instalar nada, en tres pasos. Para todo el poder, o sea los 4 supermercados sin lÃmites y de forma automática, está la extensión Pro."}),l.jsx("div",{className:"how-tutorial-wrap fade-in",children:l.jsxs(st,{to:"/como-usarlo",className:"btn-plan-detalle",children:["Ver tutorial completo",l.jsx(gc,{})]})})]}),l.jsx("div",{className:"steps",children:e.map((t,r)=>l.jsxs("div",{className:"step-block fade-in",style:{transitionDelay:`${r*100}ms`},children:[l.jsx(vc,{nombre:t.img,alt:t.alt,ratio:"3 / 2",className:"step-ilus"}),l.jsxs("div",{className:"step-icon-wrap",children:[l.jsx("div",{className:"step-num",children:t.n}),l.jsx("h3",{children:t.title})]}),l.jsx("p",{children:t.desc})]},r))})]})})}function Qb(){const e=["Comparación automática mientras navegas","Funciona en Lider, Jumbo, Unimarc y Santa Isabel","Un solo clic, sin copiar ni pegar","Pago único a precio de lanzamiento, sin mensualidad"];return l.jsxs("section",{className:"ls ext-section",children:[l.jsxs("div",{className:"ls-inner ext-inner",children:[l.jsxs("div",{className:"ext-text fade-in",children:[l.jsxs("div",{className:"ext-label",children:[l.jsx(Xs,{size:14})," Extensión de Chrome"]}),l.jsx("h2",{className:"ls-title",children:"La extensión lo hace sola"}),l.jsx("p",{className:"ext-desc",children:"Se activa cuando estás armando el carrito en el sitio del supermercado. Cuando logra cobertura completa, te muestra dónde conviene comprar; si no, explica qué tienda falló."}),l.jsx("ul",{className:"ext-benefits",children:e.map(t=>l.jsxs("li",{className:"ext-benefit",children:[l.jsx(mc,{}),t]},t))}),l.jsxs("div",{className:"ext-cta",children:[l.jsx(uo,{className:"btn-chrome",children:"Agregar a Chrome"}),Mr&&l.jsx("span",{className:"ext-note",children:"Ya disponible en la Chrome Web Store"})]})]}),l.jsx("div",{className:"ext-visual-wrap fade-in",children:l.jsxs("div",{className:"ext-widget",children:[l.jsxs("div",{className:"ext-widget-head",children:[l.jsx(Xs,{size:15}),l.jsx("span",{children:"ComparaCarrito"}),l.jsx("span",{className:"ext-widget-live",children:"en vivo"})]}),la.slice(0,3).map(t=>l.jsxs("div",{className:t.estado==="barato"?"ext-widget-row best":"ext-widget-row",children:[l.jsxs("span",{children:[l.jsx("span",{className:"ext-wd",style:{background:t.color}}),t.store]}),l.jsx("strong",{className:"num",children:zr.format(t.total)})]},t.store)),l.jsxs("div",{className:"ext-widget-save",children:["Ahorras ",zr.format(6490)," comprando en Unimarc"]})]})})]}),l.jsx(Gm,{})]})}function Yb(){const e=[{Icon:Vm,tint:"tint-green",title:"Ahorro con cobertura completa",desc:"Calculamos el ahorro sólo cuando todas las tiendas encuentran el carrito completo."},{Icon:Cb,tint:"",title:"4 supermercados",desc:"Lider, Jumbo, Unimarc y Santa Isabel. Donde compra la mayorÃa de los chilenos."},{Icon:Rb,tint:"tint-orange",title:"Resultados en tiempo real",desc:"Ves los precios aparecer a medida que los buscamos, sin esperar al final."},{Icon:Tb,tint:"tint-red",title:"Optimiza con despacho",desc:"Calcula la mejor combinación tomando en cuenta los costos de envÃo de cada tienda."}];return l.jsx("section",{className:"ls ls-bg-paper",children:l.jsxs("div",{className:"ls-inner",children:[l.jsxs("div",{className:"feat-top",children:[l.jsxs("div",{children:[l.jsx("div",{className:"ls-label fade-in",children:"Por qué ComparaCarrito"}),l.jsx("h2",{className:"ls-title fade-in",children:"Diseñado para ahorrar, no para confundir"}),l.jsx("p",{className:"ls-sub fade-in",children:"Hecho para que cualquier persona lo use, sin necesitar ayuda."})]}),l.jsx(vc,{nombre:"hero-canasto-ahorro",alt:"Canasto de supermercado con una moneda de ahorro y un indicador de bajada de precio",ratio:"4 / 3",className:"fade-in feat-ilus"})]}),l.jsx("div",{className:"feat-grid",children:e.map((t,r)=>l.jsxs("div",{className:"feat-card fade-in",style:{transitionDelay:`${r*80}ms`},children:[l.jsx("div",{className:t.tint?`feat-icon ${t.tint}`:"feat-icon",children:l.jsx(t.Icon,{size:22})}),l.jsx("h3",{children:t.title}),l.jsx("p",{children:t.desc})]},r))})]})})}function Xb(){const e=[{et:"Supermercados incluidos",free:"Jumbo y Santa Isabel",pro:"Lider, Jumbo, Unimarc y Santa Isabel"},{et:"Comparaciones",free:"Limitadas por mes",pro:"Sin lÃmite"},{et:"Productos por carrito",free:"Limitados",pro:"Sin lÃmite"},{et:"Comparación automática mientras navegas",free:!1,pro:!0},{et:"Optimización con costo de despacho",free:!1,pro:!0},{et:"Forma de pago",free:"Gratis",pro:"Un solo pago"},{et:"Vigencia del acceso",free:"Permanente",pro:"Permanente, sin renovación"}],t=({v:r,pro:n})=>r===!0?l.jsx(mc,{"aria-label":"Incluido"}):r===!1?l.jsx("span",{className:"tabla-no","aria-label":"No incluido",children:"No incluido"}):l.jsx("span",{className:n?"tabla-txt tabla-txt-pro":"tabla-txt",children:r});return l.jsx("section",{className:"ls ls-bg-surface",children:l.jsxs("div",{className:"ls-inner",children:[l.jsx("div",{className:"ls-label fade-in",children:"Comparativa de planes"}),l.jsx("h2",{className:"ls-title fade-in",children:"Qué incluye cada plan"}),l.jsx("p",{className:"ls-sub fade-in",children:"La versión gratuita compara Jumbo y Santa Isabel desde nuestros servidores. Lider y Unimarc bloquean ese tipo de consulta, asà que solo pueden leerse des
95de tu propio navegador, que es lo que hace la extensión."}),l.jsxs("div",{className:"tabla-planes fade-in",children:[l.jsxs("div",{className:"tabla-cab",children:[l.jsx("div",{className:"tabla-cab-et",children:"Capacidad"}),l.jsx("div",{className:"tabla-col",children:l.jsx("span",{className:"tabla-col-nombre",children:"Plan Gratis"})}),l.jsx("div",{className:"tabla-col tabla-col-pro",children:l.jsx("span",{className:"tabla-col-nombre",children:"Plan Pro"})})]}),e.map(r=>l.jsxs("div",{className:"tabla-fila",children:[l.jsx("div",{className:"tabla-et",children:r.et}),l.jsx("div",{className:"tabla-val",children:l.jsx(t,{v:r.free})}),l.jsx("div",{className:"tabla-val tabla-val-pro",children:l.jsx(t,{v:r.pro,pro:!0})})]},r.et))]}),l.jsx("div",{className:"tabla-pie fade-in",children:l.jsxs(st,{to:"/planes",className:"btn-plan-detalle",children:["Ver el detalle completo de los planes",l.jsx(gc,{})]})})]})})}function Zb(){return l.jsx("section",{className:"ls ls-bg-paper",children:l.jsxs("div",{className:"ls-inner",children:[l.jsx("h2",{className:"ls-title fade-in",children:"Los supermercados que cubrimos"}),l.jsx("p",{className:"ls-sub fade-in",children:"Donde compra la mayorÃa de las familias chilenas. Tottus se suma próximamente."}),l.jsx("div",{className:"supers-grid",children:Jm.map((e,t)=>l.jsxs("div",{className:e.pronto?"super-card super-pronto fade-in":"super-card fade-in",style:{transitionDelay:`${t*70}ms`},children:[l.jsx(Db,{name:e.name,color:e.color}),l.jsx("div",{className:"super-sub",children:e.sub}),e.pronto&&l.jsx("span",{className:"super-badge",children:"Próximamente"})]},t))})]})})}function ek(){return l.jsx("section",{className:"ls ls-bg-surface",children:l.jsxs("div",{className:"ls-inner ls-inner-estrecho",children:[l.jsx("div",{className:"ls-label fade-in",children:"Antes de decidir"}),l.jsx("h2",{className:"ls-title fade-in",children:"Preguntas frecuentes"}),l.jsx("div",{className:"fade-in",children:l.jsx(Wb,{})})]})})}const tk=14990,rk=5990;function nk(){return l.jsxs("section",{className:"ls precio-section",children:[l.jsx("img",{className:"precio-fondo",src:"/assets/brand/fondo-cta-navy.webp",alt:"","aria-hidden":"true",loading:"lazy",decoding:"async"}),l.jsx("div",{className:"ls-inner",children:l.jsxs("div",{className:"precio-card fade-in",children:[l.jsxs("div",{className:"precio-texto",children:[l.jsx("h2",{children:"Se paga una vez y queda tuyo."}),l.jsx("p",{children:"Acceso de por vida, sin cobro mensual ni renovación. Con el ahorro de la primera compra del mes ya está pagado."}),l.jsxs(st,{to:"/planes",className:"btn-plan-detalle btn-plan-detalle-oscuro",children:["Ver qué incluye cada plan",l.jsx(gc,{})]})]}),l.jsxs("div",{className:"precio-monto",children:[l.jsxs("div",{className:"precio-antes",children:[l.jsx("span",{className:"precio-antes-et",children:"Antes"}),l.jsx("span",{className:"precio-antes-cifra num",children:zr.format(tk)})]}),l.jsx("div",{className:"precio-cifra num",children:zr.format(rk)}),l.jsx("div",{className:"precio-nota",children:"pago único, precio de lanzamiento"}),l.jsx(uo,{className:"btn-chrome"})]})]})})]})}function sk({setPage:e}){const t=_.useRef(null);return _.useEffect(()=>{var a,o;const r=t.current;if(!r||(o=(a=window.CSS)==null?void 0:a.supports)!=null&&o.call(a,"animation-timeline","scroll()"))return;let n=0;const s=()=>{n=0;const u=document.documentElement.scrollHeight-window.innerHeight,c=u>0?Math.min(1,window.scrollY/u):0;r.style.transform=`scaleX(${c})`},i=()=>{n||(n=requestAnimationFrame(s))};return s(),window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",i,{passive:!0}),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i),n&&cancelAnimationFrame(n)}},[]),_.useEffect(()=>{const r=document.querySelectorAll(".fade-in"),n=new IntersectionObserver(s=>{s.forEach(i=>{i.isIntersecting&&(i.target.classList.add("visible"),n.unobserve(i.target))})},{threshold:.12,rootMargin:"0px 0px -6% 0px"});return r.forEach(s=>n.observe(s)),()=>n.disconnect()},[]),l.jsxs("div",{className:"landing",children:[l.jsx("div",{className:"scroll-prog",children:l.jsx("div",{className:"scroll-prog-bar",ref:t})}),l.jsxs("main",{id:"contenido",children:[l.jsx(Vb,{setPage:e}),l.jsx(Kb,{}),l.jsx(Jb,{}),l.jsx(Gb,{}),l.jsx(Qb,{}),l.jsx(Yb,{}),l.jsx(Xb,{}),l.jsx(Zb,{}),l.jsx(ek,{}),l.jsx(nk,{})]}),l.jsx(Mb,{})]})}const Z=e=>
95e!=null?`$${Number(e).toLocaleString("es-CL")}`:"â",ik=20,ak=200,qi=[{id:"auto",name:"Auto",short:"A",color:"#6b6860",bg:"#f3f2ee",textBg:"#faf9f6"},{id:"lider",name:"Lider",short:"L",color:"#0066cc",bg:"#dbeafe",textBg:"#eff6ff"},{id:"jumbo",name:"Jumbo",short:"J",color:"#00a651",bg:"#dcfce7",textBg:"#f0fdf4"},{id:"unimarc",name:"Unimarc",short:"U",color:"#ea580c",bg:"#ffedd5",textBg:"#fff7ed"},{id:"santa isabel",name:"Santa Isabel",short:"SI",color:"#dc2626",bg:"#fee2e2",textBg:"#fef2f2"}];function ok({cartData:e,onCartParsed:t,onGoToCompare:r,showToast:n,onRequireAuth:s,onUpgrade:i}){var I;const{isPro:a}=ui(),o=a?ak:ik,[u,c]=_.useState("auto"),[d,h]=_.useState(""),[f,p]=_.useState(!1),[y,w]=_.useState(null),[x,m]=_.useState([]),g=_.useRef([]);_.useEffect(()=>{e&&x.length===0&&m(e.products)},[e]);async function v(){if(!d.trim()){w("Pega el contenido de tu carrito antes de analizar.");return}p(!0),w(null);try{const T=await gb(d,u),U=T.products.map((W,ne)=>({...W,_id:ne})),D={...T,products:U};m(U),t(D)}catch(T){if(qm(T,{onRequireAuth:s,onUpgrade:i}))return;w(T.message||"Error al parsear el carrito")}finally{p(!1)}}function b(T,U){const D=x.map(W=>W._id===T?{...W,quantity:Math.max(1,W.quantity+U)}:W);m(D),e&&t({...e,products:D})}function E(T){const U=x.filter(D=>D._id!==T);m(U),e&&t({...e,products:U})}function S(T,U){var ne;const D=qi.length-1;let W=null;if(T.key==="ArrowRight"||T.key==="ArrowDown")W=U===D?0:U+1;else if(T.key==="ArrowLeft"||T.key==="ArrowUp")W=U===0?D:U-1;else if(T.key==="Home")W=0;else if(T.key==="End")W=D;else if(T.key===" "||T.key==="Enter"){T.preventDefault(),c(qi[U].id);return}else return;T.preventDefault(),c(qi[W].id),(ne=g.current[W])==null||ne.focus()}function j(){h(""),m([]),w(null),c("auto")}const P=x.reduce((T,U)=>T+U.price*U.quantity,0),C=x.reduce((T,U)=>T+U.quantity,0),N=e==null?void 0:e.supermarket,B=x.length>o;return l.jsxs("div",{children:[l.jsxs("div",{className:"step1-title",children:[l.jsx("h2",{children:"¿Qué vas a comprar hoy?"}),l.jsx("p",{children:"Copia el contenido del carrito desde el sitio del super y pégalo aquÃ. Detectamos el formato automáticamente."})]}),l.jsxs("div",{className:"textarea-card",children:[l.jsxs("div",{className:"textarea-top",children:[l.jsx("span",{className:"textarea-top-label",id:"cart-textarea-label",children:"Contenido del carrito"}),N&&l.jsxs("span",{className:"detected-badge",style:{marginTop:0},children:[l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.5",strokeLinecap:"round","aria-hidden":"true",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Detectado: ",N]})]}),l.jsx("textarea",{id:"cart-textarea","aria-labelledby":"cart-textarea-label",className:"prod-textarea",placeholder:"Pega aquà el contenido del carrito copiado desde el sitio del super (Lider, Jumbo, Unimarc o Santa Isabel)â¦",value:d,onChange:T=>h(T.target.value)})]}),l.jsxs("div",{className:"origin-section",children:[l.jsx("span",{className:"origin-label",id:"origin-label",children:"¿De qué supermercado es tu carrito?"}),l.jsx("div",{className:"origin-badges",role:"radiogroup","aria-labelledby":"origin-label",children:qi.map((T,U)=>{const D=u===T.id;return l.jsxs("div",{ref:W=>{g.current[U]=W},role:"radio","aria-checked":D,tabIndex:D?0:-1,className:`origin-badge ${D?"sel":""}`,style:D?{borderColor:T.color,background:T.textBg}:{},onClick:()=>c(T.id),onKeyDown:W=>S(W,U),children:[l.jsx("div",{className:"origin-badge-logo",style:{background:T.bg,color:T.color},"aria-hidden":"true",children:T.short}),l.jsx("div",{className:"origin-badge-name",style:D?{color:T.color}:{},children:T.name}),l.jsx("div",{className:"origin-check","aria-hidden":"true",children:l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3.5",strokeLinecap:"round","aria-hidden":"true",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})})})]},T.id)})})]}),l.jsxs("div",{className:"cart-actions",children:[l.jsx("button",{type:"button",className:"btn-primary",onClick:v,disabled:f||!d.trim(),"aria-busy":f,children:f?"Analizandoâ¦":x.length>0?"Re-analizar":"Analizar carrito"}),(d||x.length>0)&&l.jsx("button",{type:"button",className:"btn-ghost",onClick:j,children:"Limpiar"})]}),y&&l.jsx("div",{className:"error-box",role:"alert",children:y}),x.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"product-counter-row",children:l.jsx("span",{className:`product-counter ${B?"over":""}`,children:a?`${x.length} productos`:`${x.length}/${o} productos`})}),B&&l.jsxs("div",{className:"limit-msg",children:["El plan gratuito permite hasta ",o," productos."," ",l.jsx("button",{type:"button",className:"limit-msg-link",onClick:()=>i==null?void 0:i(),children:"Actualiza a Pro"})," ","para carritos ilimitados."]}),l.jsxs("div",{className:"chips-section",children:[l.jsxs("div",{className:"chips-label",children:[x.length," productos detectados · ",C," unidades · ",Z(P),((I=e==null?void 0:e.summary)==null?void 0:I.total_savings)>0&&l.jsxs("span",{style:{color:"var(--green)",marginLeft:8},children:["· Ahorros: â",Z(e.summary.total_savings)]})]}),l.jsx("div",{className:"chips-wrap",children:x.map(T=>l.jsxs("div",{className:"chip",title:Z(T.price),children:[l.jsx("span",{children:T.name}),T.quantity>1&&l.jsxs("span",{className:"chip-qty",children:["Ã",T.quantity]}),l.jsx("button",{type:"button",className:"chip-x",onClick:()=>E(T._id),"aria-label":`Eliminar ${T.name} del carrito`,children:l.jsx("span",{"aria-hidden":"true",children:"â"})})]},T._id))})]}),l.jsxs("div",{className:"mini-list",children:[l.jsxs("div",{className:"mini-list-head",children:[l.jsx("span",{children:"Producto"}),l.jsx("span",{children:"Cantidad"})]}),x.map(T=>l.jsxs("div",{className:"mini-list-row",children:[l.jsxs("div",{children:[l.jsx("div",{className:"name",children:T.name}),T.promotion&&l.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text3)",marginTop:2},children:T.promotion})]}),l.jsx("div",{className:"price",children:Z(T.price)}),l.jsxs("div",{className:"qty-pill",children:[l.jsx("button",{type:"button",className:"qty-btn-sm",onClick:()=>b(T._id,-1),"aria-label":`Quitar una unidad de ${T.name}`,children:l.jsx("span",{"aria-hidden":"true",children:"â"})}),l.jsxs("span",{className:"qty-num",children:[l.jsxs("span",{className:"cc-sr-only",children:["Cantidad de ",T.name,": "]}),T.quantity]}),l.jsx("button",{type:"button",className:"qty-btn-sm",onClick:()=>b(T._id,1),"aria-label":`Agregar una unidad de ${T.name}`,children:l.jsx("span",{"aria-hidden":"true",children:"+"})})]}),l.jsx("button",{type:"button",className:"del-btn",onClick:()=>E(T._id),title:"Eliminar","aria-label":`Eliminar ${T.name} del carrito`,children:l.jsx("span",{"aria-hidden":"true",children:"â"})})]},T._id))]})]}),l.jsxs("button",{type:"button",className:"btn-go",onClick:r,disabled:x.length===0||B,style:{marginTop:8},children:[l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"11",cy:"11",r:"8"}),l.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),"Buscar mejores precios",l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",children:l.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})]})]})}const Nh={current:0,total:0,product:"",supermarket:""},Qm=new Set(["completion","failure","aborted"]);function lk(e){let t="message";const r=[];for(const n of e.split(` 96`))n.startsWith("event:")?t=n.slice(6).trim():n.startsWith("data:")&&r.push(n.slice(5).trimStart());return r.length?{event:t,data:JSON.parse(r.join(` 97`))}:null}function uk(e){return Qm.has(e==null?void 0:e.outcome)?e.outcome:(Array.isArray(e==null?void 0:e.stores)?e.stores:[]).some(r=>["timeout","blocked","schema_error"].includes(r==null?void 0:r.status))||Object.values((e==null?void 0:e.store_stats)||{}).some(r=>Number(r==null?void 0:r.errors)>0)?"failure":"completion"}function ck(){const[e,t]=_.useState([]),[r,n]=_.useState(Nh),[s,i]=_.useState("idle"),[a,o]=_.useState(null),[u,c]=_.useState(null),d=_.useRef(null),h=_.useRef(0),f=_.useRef(null),p=_.useCallback(()=>{t([]),n(Nh),o(null),c(null)},[]),y=_.useCallback(()=>{d.current&&d.current.abort(),p(),i("preflight")},[p]),w=_.useCallback((v=null)=>{c(v),i("idle")},[]),x=_.useCallback(async v=>{var S;d.current&&d.current.abort();const b=new AbortController,E=++h.current;d.current=b,f.current=v,p();try{const j=await vb(v,{signal:b.signal});if(E!==h.current)return;i("running");const P=j.body.getReader(),C=new TextDecoder;let N="",B=!1;const I=T=>{var D,W;const U=lk(T);!U||E!==h.current||(U.event==="progress"?n(U.data):U.event==="result"?t(ne=>[...ne,U.data]):U.event==="done"?(B=!0,o(U.data),i(uk(U.data))):U.event==="error"&&(B=!0,o(U.data),c(((D=U.data)==null?void 0:D.message)||"L
97a comparación terminó con un error."),i(((W=U.data)==null?void 0:W.outcome)==="aborted"?"aborted":"failure")))};for(;;){const{done:T,value:U}=await P.read();N+=C.decode(U||new Uint8Array,{stream:!T}).replace(/\r\n/g,` 98`);const D=N.split(` 99 100`);if(N=D.pop()||"",D.forEach(I),B){await((S=P.cancel)==null?void 0:S.call(P));break}if(T)break}if(N.trim()&&I(N),!B&&E===h.current)throw new Error("La conexión terminó antes de recibir el resultado final.")}catch(j){if(E!==h.current)return;(j==null?void 0:j.name)==="AbortError"?(i("aborted"),c(null)):(c((j==null?void 0:j.message)||"No pudimos completar la comparación."),i("failure"))}finally{E===h.current&&(d.current=null)}},[p]),m=_.useCallback(()=>{d.current&&(d.current.abort(),d.current=null,i("aborted"),c(null))},[]),g=_.useCallback(()=>{if(f.current)return i("preflight"),x(f.current)},[x]);return _.useEffect(()=>()=>{var v;h.current+=1,(v=d.current)==null||v.abort()},[]),{results:e,progress:r,phase:s,isLoading:s==="running",isDone:Qm.has(s),stats:a,error:u,beginPreflight:y,cancelPreflight:w,startComparison:x,retry:g,
100stop:m}}const dk=["Lider","Jumbo","Unimarc","Santa Isabel"],Ph=["Jumbo","Santa Isabel"],Ah={Lider:"lider",Jumbo:"jumbo",Unimarc:"unimarc","Santa Isabel":"santa-isabel"},Ft={lider:"Lider",jumbo:"Jumbo",unimarc:"Unimarc","santa-isabel":"Santa Isabel",santa_isabel:"Santa Isabel"},ou=new Set(["timeout","blocked","schema_error"]),Oh={Jumbo:"https://www.jumbo.cl/","Santa Isabel":"https://www.santaisabel.cl/",Lider:"https://super.lider.cl/",Unimarc:"https://www.unimarc.cl/"},hk=new Set(["completion","failure","aborted"]),hr=e=>["ok","empty","timeout","blocked","schema_error"].includes(e)?e:e==="error"?"blocked":"schema_error",os={empty:["Sin resultados","La tienda respondió, pero no encontró coincidencias."],timeout:["Tiempo agotado","La tienda no respondió dentro del plazo."],blocked:["Acceso bloqueado","La tienda pidió verificar que no eres un robot. Ãbrela, completa la verificación y reintenta."],schema_error:["Respuesta incompatible","La tienda cambió su respuesta y no pudimos interpretarla."]};function fk(e,t){const r={},n={},s={},i={},a={},o={},u=(e.cartItems||[]).length;for(const[h,f]of Object.entries(e.comparisonResults||{})){const p=Ft[h]||h,y=hr(f.status),w=(f.items||[]).filter(x=>{var m;return((m=x==null?void 0:x.found)==null?void 0:m.price)!=null}).length;a[p]=y,o[p]={requested:Number.isInteger(f.requested)?f.requested:u,matched:Number.isInteger(f.matched)?f.matched:w,status:y},(f.items||[]).forEach((x,m)=>{x.found&&x.found.price!=null&&((r[m]=r[m]||{})[p]=x.found.price,x.found.url&&((n[m]=n[m]||{})[p]=x.found.url),x.found.approx&&((s[m]=s[m]||{})[p]=!0),x.found.pricePerKg!=null&&((i[m]=i[m]||{})[p]=x.found.pricePerKg))})}const c=Ft[e.sourceStore]||e.sourceStore;(e.cartItems||[]).forEach((h,f)=>{h.url&&((n[f]=n[f]||{})[c]=h.url)});for(const h of t)o[h]||(a[h]="schema_error",o[h]={requested:u,matched:0,status:"schema_error"});const d=["completion","failure","aborted"].includes(e.outcome)?e.outcome:Object.values(a).some(h=>ou.has(h))?"failure":"completion";return{priceMap:r,urlMap:n,approxMap:s,perKgMap:i,targetStores:t,storeStatus:a,storeCoverage:o,outcome:d,fromExtension:!0}}function Lh(e,t,r){const n={};if(Array.isArray(e==null?void 0:e.stores)){for(const s of e.stores){const i=Ft[s.store]||s.store;n[i]={requested:s.requested,matched:s.matched,status:hr(s.status)}}return n}for(const[s,i]of Object.entries((e==null?void 0:e.store_stats)||{})){const a=Number(i.requested??(i.found||0)+(i.not_found||0)+(i.errors||0))||r,o=i.status?hr(i.status):i.errors>0?"blocked":i.found>0?"ok":"empty";n[Ft[s]||s]={requested:a,matched:Number(i.matched??i.found??0),status:o}}for(const s of t)!n[s]&&e&&(n[s]={requested:r,matched:0,status:"schema_error"});return n}function Ih(e,t=0){var r;return(e==null?void 0:e.outcome)!=="completion"||!((r=e.targetStores)!=null&&r.length)?!1:e.targetStores.every(n=>{var o,u;const s=(o=e.storeCoverage)==null?void 0:o[n];if(s)return s.status==="ok"&&s.requested>0&&s.matched===s.requested;const i=hr((u=e.storeStatus)==null?void 0:u[n]),a=Object.values(e.priceMap||{}).filter(c=>(c==null?void 0:c[n])!=null).length;return i==="ok"&&t>0&&a===t})}const an={Lider:{color:"#0066cc",bg:"#dbeafe",textBg:"#eff6ff",short:"L"},Jumbo:{color:"#00a651",bg:"#dcfce7",textBg:"#f0fdf4",short:"J"},Unimarc:{color:"#ea580c",bg:"#ffedd5",textBg:"#fff7ed",short:"U"},"Santa Isabel":{color:"#dc2626",bg:"#fee2e2",textBg:"#fef2f2",short:"SI"}},pk=e=>/\bgranel\b/i.test(e||""),js=e=>(e==null?void 0:e.weightLabel)||(e==null?void 0:e.weight_label)||null,lu=e=>pk(e==null?void 0:e.name)||!!js(e),mk=(e,t)=>e>0?`$${Number(e).toLocaleString("es-CL")}/${t}`:null,Ym=e=>{if(!e)return null;const t=/^(\d+(?:[.,]\d+)?)\s*(kg|grs?|g|ml|lts?|lt|l|cc)$/i.exec(String(e).trim());if(!t)return null;const r=parseFloat(t[1].replace(",","."));if(!(r>0))return null;const n=t[2].toLowerCase();return n==="kg"?{value:r,base:"kg"}:n.startsWith("g")?{value:r/1e3,base:"kg"}:n==="l"||n.startsWith("lt")?{value:r,base:"L"}:n==="ml"||n==="cc"?{value:r/1e3,base:"L"}:null};function gk({products:e,priceMap:t,urlMap:r,approxMap:n,perKgMap:s,sourceStore:i,targetStores:a,comparisonSuccess:o}){const u=[i,...a];return e.map((c,d)=>{const h=t[d]||{},f=r[d]||{},p=n[d]||{},y=lu(c),w=js(c),x=y?Ym(w):null,m=s[d]||{},g={[i]:c.price,...Object.fromEntries(a.map(N=>[N,h[N]??null]))},v=N=>{const B=g[N];return B==null?null:B*c.quantity},b=N=>x?mk(m[N],x.base):null,E=u.map(v),S=E.filter(N=>N!=null),j=S.length?Math.min(...S):null,P=S.length?Math.max(...S):null,C=u.map((N,B)=>{const I=E[B],T=o&&I!=null&&I===j&&S.length>1,U=o&&I!=null&&I===P&&P!==j&&S.length>1;
100return{store:N,isSource:N===i,value:I,perUnit:b(N),loaded:N===i||Object.prototype.hasOwnProperty.call(h,N),url:f[N]||null,approx:!!p[N],isBest:T,isWorst:U,cellClass:T?"price-best":U?"price-worst":"price-mid"}});return{idx:d,product:c,granel:y,weightLabel:w,w:x,cells:C}})}function vk({cartData:e,comparisonData:t,liveCompare:r,onComparisonDone:n,onGoToOptimize:s,onBack:i,showToast:a,onRequireAuth:o,onUpgrade:u}){var Pc,Ac;const{results:c,progress:d,phase:h,stats:f,error:p,beginPreflight:y,cancelPreflight:w,startComparison:x,stop:m}=ck(),{isPro:g}=ui(),[v,b]=_.useState([]),[E,S]=_.useState("idle"),[j,P]=_.useState(null),[C,N]=_.useState({done:0,total:0}),[B,I]=_.useState({}),[T,U]=_.useState({}),[D,W]=_.useState({}),[ne,O]=_.useState({}),[q,H]=_.useState(null),[ee,ae]=_.useState(!1),Ke=_.useRef(null),K=t!=null&&t.fromExtension?t:null,Rr=(K==null?void 0:K.storeStatus)||{};_.useEffect(()=>{b([])},[e==null?void 0:e.supermarket]),_.useEffect(()=>()=>{var k;return(k=Ke.current)==null?void 0:k.abort()},[]);const It=_.useMemo(()=>{const k={};for(const R of c)k[R.product_index]=R.prices;return k},[c]),Gr=_.useMemo(()=>{const k={};for(const R of c)k[R.product_index]=R.urls||{};return k},[c]),eg=_.useMemo(()=>{const k={};for(const R of c)R.prices_per_kg&&(k[R.product_index]=R.prices_per_kg);return k},[c]),rr=E!=="idle"||!!j,ho=K?K.priceMap:rr?B:It,yc=K?K.urlMap:rr?T:Gr,tg=K?K.approxMap||{}:rr?D:{},wc=K?K.perKgMap||{}:rr?ne:eg,Oe=K?K.targetStores:v,fo=K?K.outcome||(Object.values(Rr).some(k=>ou.has(hr(k)))?"failure":"completion"):null,Re=fo||(rr?E:h),_c=Re==="running",De=hk.has(Re);_.useEffect(()=>{var k;if(!K&&!rr&&De&&c.length>0){const R=Lh(f,Oe,((k=e==null?void 0:e.products)==null?void 0:k.length)||0);Re==="completion"&&Oe.every(z=>{const V=R[z];return(V==null?void 0:V.status)==="ok"&&V.requested>0&&V.matched===V.requested})&&(n({priceMap:ho,urlMap:yc,targetStores:Oe,outcome:Re,storeCoverage:R}),a==null||a("Comparación completa"))}},[De,Re]),_.useEffect(()=>{var k;!K||!Ih({...K,outcome:fo},((k=e==null?void 0:e.products)==null?void 0:k.length)||0)||(localStorage.setItem("cc_activation_first_comparison","complete"),window.dispatchEvent(new Event("cc:activation")))},[K,fo,(Pc=e==null?void 0:e.products)==null?void 0:Pc.length]);async function xc(){if(e){if(g)return S("preflight"),P(null),H(null),kc();y();try{const k=await xb();if(k&&k.can_compare===!1){u==null||u({title:"LÃmite diario alcanzado",message:"Alcanzaste tu lÃmite de comparaciones de hoy. Actualiza a Pro para comparaciones ilimitadas."}),w();return}}catch(k){if((k==null?void 0:k.status)===401){w(),o==null||o();return}}x({products:e.products,sourceSupermarket:e.supermarket,targetSupermarkets:Oe})}}function rg(k){if(!k||k.index==null||!k.prices)return;const R=Object.entries(k.prices);I(J=>{const z={...J},V={...z[k.index]||{}};for(const[Y,oe]of R)oe&&oe.price!=null&&(V[Ft[Y]||Y]=oe.price);return z[k.index]=V,z}),U(J=>{const z={...J},V={...z[k.index]||{}};for(const[Y,oe]of R)oe&&oe.url&&(V[Ft[Y]||Y]=oe.url);return k.sourceUrl&&(e!=null&&e.supermarket)&&(V[e.supermarket]=k.sourceUrl),z[k.index]=V,z}),W(J=>{const z={...J},V={...z[k.index]||{}};for(const[Y,oe]of R)oe&&oe.approx&&(V[Ft[Y]||Y]=!0);return z[k.index]=V,z}),O(J=>{const z={...J},V={...z[k.index]||{}};for(const[Y,oe]of R)oe&&oe.pricePerKg!=null&&(V[Ft[Y]||Y]=oe.pricePerKg);return z[k.index]=V,z})}async function bc({sourceStore:k,items:R,stores:J,targetNames:z}){H(null),S("running"),P(null),I({}),O({}),U({}),W({}),N({done:0,total:R.length});const V=new AbortController;Ke.current=V;try{const Y=await jb({sourceStore:k,items:R,stores:J},{onProgress:({done:Jn,total:Xr,item:ht})=>{N({done:Jn??0,total:Xr??R.length}),ht&&rg(ht)},signal:V.signal}),oe=fk(Y,z);P(oe),S(oe.outcome),Ih(oe,R.length)?(n(oe),localStorage.setItem("cc_activation_first_comparison","complete"),window.dispatchEvent(new Event("cc:activation")),a==null||a("Comparación completa")):oe.outcome==="completion"&&(a==null||a("Comparación parcial: revisa la cobertura"))}catch(Y){if((Y==null?void 0:Y.name)==="AbortError")S("aborted"),H(null);else{const oe=hr((Y==null?void 0:Y.status)||"blocked"),Jn=Object.fromEntries(Object.entries((Y==null?void 0:Y.storeStatus)||{}).map(([ht,og])=>[Ft[ht]||ht,og])),Xr=Object.fromEntries(z.map(ht=>[ht,hr(Jn[ht]||oe)]));P({targetStores:z,storeStatus:Xr,outcome:"failure"}),S("failure"),H(Y.message||"No se pudo comparar con la extensión. Intenta de nuevo.")}}finally{Ke.current===V&&(Ke.current=null)}}async function kc(){if(H(null),ae(!1),!await pc()){ae(!0),S("idle");return}const R=e.products.map(V=>({name:V.name,price:V.price,qty:V.quantity,weightLabel:js(V)})),J=Ah[e.supermarket]||e.supermarket,z=Oe.map(V=>
100Ah[V]).filter(Boolean);await bc({sourceStore:J,items:R,stores:z,targetNames:Oe})}_.useEffect(()=>{if(!r||!e||t!=null&&t.fromExtension)return;const k=r.targetStoreNames||[];b(k);const R=e.products.map(J=>({name:J.name,price:J.price,qty:J.quantity,weightLabel:js(J)}));bc({sourceStore:r.sourceStore,items:R,stores:r.stores||[],targetNames:k})},[r]);function Sc(k){if(!g&&!Ph.includes(k)){u==null||u();return}b(R=>R.includes(k)?R.filter(J=>J!==k):[...R,k])}function Ec(){Ke.current?Ke.current.abort():m()}if(!e)return l.jsxs("div",{className:"empty-state",children:[l.jsx("h3",{children:"Primero analiza tu carrito"}),l.jsx("p",{children:"Vuelve al paso 1 y pega el contenido de tu carrito."}),l.jsxs("button",{className:"btn-primary",onClick:i,children:[l.jsx("span",{"aria-hidden":"true",children:"â "}),"Ir a Mi Carrito"]})]});const Be=e.supermarket,Qr=[Be,...Oe],ci=K?!0:Re==="running"||De||c.length>0,dt={},di={},hi={};for(const k of Qr)dt[k]=0,di[k]=0,hi[k]=0;for(let k=0;k<e.products.length;k++){const R=e.products[k],J=ho[k]||{};lu(R)&&Ym(js(R)),wc[k],di[Be]+=1,dt[Be]+=R.price*R.quantity,hi[Be]+=1;for(const z of Oe){const V=J[z];V!=null&&(di[z]+=1,dt[z]+=V*R.quantity,hi[z]+=1)}}const jc=k=>k===Be||hi[k]>0,fi=e.products.length,pi=(K==null?void 0:K.storeCoverage)||(j==null?void 0:j.storeCoverage)||Lh(f,Oe,fi),ng=(K==null?void 0:K.storeStatus)||(j==null?void 0:j.storeStatus)||{},Yr=k=>{if(k===Be)return{requested:fi,matched:fi,status:"ok"};if(pi!=null&&pi[k])return pi[k];const R=ng[k];return{requested:fi,matched:di[k]||0,status:R?hr(R):De?"schema_error":"ok"}},Le=Re==="completion"&&Qr.every(k=>{const R=Yr(k);return R.status==="ok"&&R.requested>0&&R.matched===R.requested}),mi=Le?[...Qr].sort((k,R)=>dt[k]-dt[R]):Qr,Kn=Le?mi[0]:null,po=Le?mi[mi.length-1]:null,Cc=Le?dt[po]-dt[Kn]:0,sg=De&&Qr.some(k=>{const R=Yr(k);return R.matched<R.requested}),ig=Re==="failure"||Re==="aborted"||Oe.some(k=>{const R=Yr(k);return R.status==="ok"&&R.matched<R.requested}),ag=e.products.some(k=>lu(k)),Rc=Oe.map(k=>({store:k,...Yr(k)})).filter(k=>ou.has(k.status)),Tc=gk({products:e.products,priceMap:ho,urlMap:yc,approxMap:tg,perKgMap:wc,sourceStore:Be,targetStores:Oe,comparisonSuccess:Le}),Nc=Qr.map(k=>{var z;const R=!jc(k),J=Yr(k);return{store:k,unavailable:R,isBest:Le&&!R&&k===Kn,isWorst:Le&&!R&&k===po&&Kn!==po,label:R?((z=os[J.status])==null?void 0:z[0])||"Sin resultados":`${Z(dt[k])}${!Le&&k!==Be?" parcial":""}`}});return l.jsxs("div",{children:[!ci&&!De&&Re!=="preflight"&&!ee&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"step1-title",style:{marginBottom:24},children:[l.jsx("h2",{children:"Comparemos tu carrito ð"}),l.jsx("p",{children:"Buscaremos los mismos productos en otras tiendas para que sepas dónde te conviene comprar."})]}),l.jsxs("div",{className:"compare-config",children:[l.jsx("h3",{children:"Comparar con"}),l.jsx("div",{className:"store-toggles",children:dk.filter(k=>k!==Be).map(k=>{const R=an[k];if(!g&&!Ph.includes(k))return l.jsxs("div",{role:"button",tabIndex:0,className:"store-toggle locked",title:"Disponible en el Plan Pro",onClick:()=>u==null?void 0:u(),onKeyDown:V=>{(V.key===" "||V.key==="Enter")&&(V.preventDefault(),u==null||u())},children:[l.jsx("div",{className:"store-toggle-lock","aria-hidden":"true",children:l.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),l.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}),l.jsx("span",{className:"store-toggle-name",children:k}),l.jsx("span",{className:"store-toggle-pro",children:"Pro"})]},k);const z=Oe.includes(k);return l.jsxs("div",{role:"checkbox","aria-checked":z,tabIndex:0,className:`store-toggle ${z?"checked":""}`,onClick:()=>Sc(k),onKeyDown:V=>{(V.key===" "||V.key==="Enter")&&(V.preventDefault(),Sc(k))},style:z?{borderColor:R.color,background:R.textBg}:{},children:[l.jsx("div",{className:"store-toggle-box",style:z?{background:R.color,borderColor:R.color}:{},children:z&&l.jsx("div",{className:"store-toggle-dot"})}),l.jsx("span",{className:"store-toggle-name",style:{color:z?R.color:void 0},children:k})]},k)})}),l.jsx("div",{className:"compare-actions",children:l.jsx("button",{className:"btn-primary",onClick:xc,disabled:Oe.length===0,children:"Buscar mejores precios"})}),g&&l.jsx("p",{className:"compare-ext-hint",children:"Con tu plan Pro la búsqueda se hace a través de la extensión de Chrome, directo en tu navegador."})]})]}),Re==="preflight"&&l.jsx("div",{className:"progress-wrap",role:"status","aria-live":"polite",children:"Verificando sesión, plan y disponibilidad antes de compararâ¦"}),ee&&l.jsxs("div",{className:"ext-gate",children:[l.jsx("div",{className:"ext-gate-icon",children:"ð§©"}),l.jsx("h3",{children:"Activa la extensión para comparar"}),l.jsx("p",{children:"Tu plan Pro busca precios en Lider, Unimarc, Jumbo y Santa Isabel a través de la extensión de Chrome (directo en tu navegador, sin intermediarios). Instálala o actÃvala y vuelve a intentar."}),l.jsxs("ol",{className:"profile-benefits","aria-label":"Pasos para activar Pro",children:[l.jsxs("li",{children:[l.jsx("span",{"aria-hidden":"true",children:"â"})," Instala o activa la extensión."]}),l.jsxs("li",{children:[l.jsx("span",{"aria-hidden":"true",children:"â"})," Inicia sesión en tu cuenta."]}),l.jsxs("li",{children:[l.jsx("span",{"aria-hidden":"true",children:"â"})," Confirma tu acceso Pro de pago único."]}),l.jsxs("li",{children:[l.jsx("span",{"aria-hidden":"true",children:"â"})," Completa tu primera comparación con cobertura total."]})]}),l.jsxs("div",{className:"ext-gate-actions",children:[l.jsx("a",{className:"btn-chrome",href:fc,target:"_blank",rel:"noopener noreferrer",onClick:void 0,children:"Agregar a Chrome, gratis"}),l.jsx("button",{className:"btn-ghost",onClick:()=>{ae(!1),kc()},children:"Ya la tengo, reintentar"})]})]}),_c&&rr&&l.jsxs("div",{className:"progress-wrap",children:[l.jsxs("span",{children:["Comparando en tu navegador con la extensiónâ¦",C.total>0&&` (${C.done}/${C.total})`]}),l.jsx("div",{className:"progress-bar-bg",children:l.jsx("div",{className:"progress-bar-fill",style:{width:C.total>0?`${C.done/C.total*100}%`:"5%"}})}),l.jsx("p",{style:{marginTop:10,fontSize:"0.82rem",color:"var(--text3)"},children:"Tu navegador está buscando en cada supermercado; la tabla se llena a medida que avanza."}),l.jsx("div",{style:{marginTop:10},children:l.jsx("button",{className:"btn-ghost",onClick:Ec,style:{borderColor:"var(--red)",color:"var(--red)"},children:"Detener búsqueda"})})]}),_c&&!rr&&l.jsxs("div",{className:"progress-wrap",children:[l.jsxs("span",{children:["Buscando ",d.product?`"${d.product}"`:"..."," en ",d.supermarket??"...",d.total>0&&` (${d.current}/${d.total})`]}),l.jsx("div",{className:"progress-bar-bg",children:l.jsx("div",{className:"progress-bar-fill",style:{width:d.total>0?`${d.current/d.total*100}%`:"5%"}})}),l.jsx("div",{style:{marginTop:10},children:l.jsx("button",{className:"btn-ghost",onClick:Ec,style:{borderColor:"var(--red)",color:"var(--red)"},children:"Detener búsqueda"})})]}),De&&(Re==="failure"||Re==="aborted"||sg)&&l.jsxs("div",{className:"warn-banner",role:Re==="failure"?"alert":"status",children:[l.jsx("div",{className:"warn-banner-icon",children:"â ï¸"}),l.jsxs("div",{className:"warn-banner-text",children:[l.jsx("strong",{children:Re==="aborted"?"Comparación detenida":"Comparación parcial"}),l.jsx("p",{children:Re==="aborted"?"Conservamos lo alcanzado hasta detenerla, pero no es un resultado completo.":p||q||"No alcanzan para declarar una tienda ganadora, pero puedes revisarlos y continuar al carrito optimizado."}),Rc.length>0&&l.jsx("ul",{children:Rc.map(k=>{var R,J;
100return l.jsxs("li",{children:[k.store,": ",((R=os[k.status])==null?void 0:R[0])||"No disponible"," â ",((J=os[k.status])==null?void 0:J[1])||"No pudimos concluir la consulta.",k.status==="blocked"&&Oh[k.store]&&l.jsxs(l.Fragment,{children:[" ",l.jsxs("a",{href:Oh[k.store],target:"_blank",rel:"noopener noreferrer",className:"warn-banner-link",children:["Verificar en ",k.store," â"]})]})]},k.store)})}),ig&&l.jsx("button",{className:"btn-ghost",onClick:xc,children:"Reintentar comparación"})]})]}),Le&&Cc>0&&l.jsxs("div",{className:"save-banner",children:[l.jsxs("div",{className:"save-banner-left",children:[l.jsx("div",{className:"save-banner-emoji",children:l.jsx(Vm,{size:26})}),l.jsxs("div",{className:"save-banner-text",children:[l.jsxs("h2",{children:["PodrÃas ahorrar comprando en ",Kn]}),l.jsx("p",{children:"vs. el supermercado más caro de tu lista completa"})]})]}),l.jsx("div",{className:"save-amount",children:Z(Cc)})]}),(De||c.length>0)&&l.jsx("div",{className:"store-cards",children:mi.map((k,R)=>{var Xr,ht;const J=an[k]||{color:"#888",bg:"#eee"},z=Yr(k),V=!jc(k),Y=Le&&R===0,oe=k===Be,Jn=Le?dt[k]-dt[Kn]:null;return l.jsxs("div",{className:`store-card ${Y?"winner":""}`,style:Y?{borderColor:J.color}:{},children:[l.jsx("div",{className:"store-card-bar",style:{background:J.color}}),l.jsx("div",{className:"store-card-logo",style:{background:J.bg,color:J.color},children:J.short}),l.jsx("div",{className:"store-card-name",children:k}),V?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"store-card-total",style:{color:"var(--text3)",fontSize:"1.05rem"},children:((Xr=os[z.status])==null?void 0:Xr[0])||"Sin resultados"}),l.jsx("div",{className:"store-card-diff",style:{color:"var(--text3)"},children:((ht=os[z.status])==null?void 0:ht[1])||"No se encontraron productos"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"store-card-total",style:Y?{color:J.color}:{},children:[Z(dt[k]),!Le&&k!==Be?" parcial":""]}),Y?l.jsxs("div",{className:"store-winner-tag",children:[l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round","aria-hidden":"true",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Más barato"]}):Le?l.jsxs("div",{className:"store-card-diff",style:{color:"var(--red)"},children:["+",Z(Jn)," más"]}):null,l.jsxs("div",{className:"store-card-coverage",style:{color:"var(--text3)",fontSize:"0.72rem",marginTop:6},children:[z.matched,"/",z.requested," productos (",z.requested?Math.round(z.matched/z.requested*100):0,"%)"]})]}),oe&&l.jsx("div",{className:"store-card-tag-origin",children:"Origen"})]},k)})}),De&&!Le&&l.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text3)",margin:"10px 2px 0"},children:"Los totales son parciales: alguna tienda no tiene todos tus productos, asà que no se declara ganador (comparar totales de listas distintas darÃa un ahorro falso). Puedes seguir al carrito optimizado igual: ahà cada producto se asigna entre las tiendas que sà lo tienen."}),De&&ag&&l.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text3)",margin:"6px 2px 0"},children:"*Cada tienda muestra el precio que ella cobra. En los productos vendidos por peso (â) la base puede cambiar entre supermercados âuno cotiza por kilo y otro por porciónâ, asà que bajo cada precio se indica su precio por kilo para que puedas compararlos."}),ci&&l.jsxs("div",{className:"cmp-card",children:[l.jsxs("div",{className:"cmp-card-header",children:[l.jsx("h3",{children:"Precio por producto"}),Le&&l.jsx("span",{className:"cmp-card-header-hint",children:"Verde = más barato · Rojo = más caro"})]}),l.jsx("div",{className:"cmp-table-wrap",children:l.jsxs("table",{className:"cmp-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{scope:"col",children:"Producto"}),l.jsxs("th",{scope:"col",style:{color:(Ac=an[Be])==null?void 0:Ac.color},children:[Be,l.jsx("div",{style:{fontSize:"0.65rem",fontWeight:600,color:"var(--text3)"},children:"(origen)"})]}),Oe.map(k=>{var R;return l.jsx("th",{scope:"col",style:{color:(R=an[k])==null?void 0:R.color},children:k},k)})]})}),l.jsxs("tbody",{children:[Tc.map(k=>l.jsxs("tr",{children:[l.jsxs("td",{children:[k.product.name,k.product.quantity>1&&l.jsxs("span",{style:{color:"var(--text3)",fontWeight:400,marginLeft:4},children:["Ã",k.product.quantity]}),k.granel&&l.jsx("span",{style:{color:"var(--text3)",fontWeight:400,fontSize:"0.7rem",marginLeft:6},children:"· granel"}),k.w&&l.jsxs("div",{style:{fontSize:"0.65rem",color:"var(--text3)",fontWeight:400,marginTop:2,lineHeight:1.15},children:["Tu carrito: ",k.weightLabel," · cada tienda muestra su propio precio"]})]}),k.cells.map(R=>{if(R.value==null)return l.jsx("td",{style:{color:"var(--text3)"},children:R.loaded?"-":"···"},R.store);const J=Z(R.value),z=R.url?l.jsx("a",{href:R.url,target:"_blank",rel:"noopener noreferrer",className:"price-link",title:R.approx?`Producto similar en ${R.store} (otra marca)`:`Ver en ${R.store}`,children:J}):J;return l.jsxs("td",{className:R.cellClass,title:R.approx?"Producto similar (otra marca), precio de lista parecido":void 0,children:[R.approx?l.jsxs("span",{style:{opacity:.9},children:["â ",z]}):z,R.perUnit&&l.jsx("div",{style:{fontSize:"0.62rem",color:"var(--text3)",fontWeight:400,marginTop:2,lineHeight:1.15},title:"Base de precio de esta tienda",children:R.perUnit})]},R.store)})]},k.idx)),De&&l.jsxs("tr",{className:"total-row",children:[l.jsx("td",{children:"Total carrito"}),Nc.map(k=>l.jsx("td",{style:{color:k.isBest?"var(--green)":k.isWorst?"var(--red)":k.unavailable?"var(--text3)":"var(--text)"},children:k.label},k.store))]})]})]})}),l.jsxs("ul",{className:"cmp-cards",children:[Tc.map(k=>l.jsxs("li",{className:"cmp-pcard",children:[l.jsxs("span",{className:"cmp-pcard-name",children:[k.product.name,k.product.quantity>1&&l.jsxs("span",{className:"cmp-pcard-qty",children:["Ã",k.product.quantity]}),k.granel&&l.jsx("span",{className:"cmp-pcard-granel",children:"· granel"})]}),k.w&&l.jsxs("span",{className:"cmp-pcard-note",children:["Tu carrito: ",k.weightLabel," · cada tienda muestra su propio precio"]}),l.jsx("ul",{className:"cmp-pcard-stores",children:k.cells.map(R=>{const J=an[R.store]||{color:"#a8a69f"},z=R.url?l.jsx("a",{href:R.url,target:"_blank",rel:"noopener noreferrer",className:"price-link",title:R.approx?`Producto similar en ${R.store} (otra marca)`:`Ver en ${R.store}`,children:Z(R.value)}):Z(R.value);return l.jsxs("li",{className:`cmp-pcard-store ${R.value!=null?R.cellClass:""}`,children:[l.jsxs("span",{className:"cmp-pcard-store-name",children:[l.jsx("span",{className:"cmp-pcard-dot",style:{background:J.color},"aria-hidden":"true"}),R.store,R.isSource&&l.jsx("span",{className:"cmp-pcard-origin",children:"origen"})]}),R.value==null?l.jsx("span",{className:"cmp-pcard-empty",children:R.loaded?"No encontrado":"Buscandoâ¦"}):l.jsxs("span",{className:"cmp-pcard-price",title:R.perUnit||void 0,children:[R.approx&&l.jsxs("span",{title:"Producto similar (otra marca), precio de lista parecido",children:[l.jsx("span",{"aria-hidden":"true",children:"â "}),l.jsx("span",{className:"cc-sr-only",children:"producto similar, "})]}),z,R.isBest&&l.jsx("span",{className:"cc-sr-only",children:". El más barato"}),R.isWorst&&l.jsx("span",{className:"cc-sr-only",children:". El más caro"})]})]},R.store)})})]},k.idx)),De&&l.jsxs("li",{className:"cmp-cards-total",children:[l.jsx("div",{className:"cmp-cards-total-label",children:"Total carrito"}),l.jsx("ul",{className:"cmp-cards-total-list",children:Nc.map(k=>{const R=an[k.store]||{color:"#a8a69f"};return l.jsxs("li",{className:`cmp-cards-total-row${k.isBest?" is-best":""}${k.isWorst?" is-worst":""}${k.unavailable?" is-unavailable":""}`,children:[l.jsxs("span",{className:"cmp-pcard-store-name",children:[l.jsx("span",{className:"cmp-pcard-dot",style:{background:R.color},"aria-hidden":"true"}),k.store,k.store===Be&&l.jsx("span",{className:"cmp-pcard-origin",children:"origen"})]}),l.jsxs("span",{className:"cmp-pcard-price",children:[k.label,k.isBest&&l.jsx("span",{className:"cc-sr-only",children:". El más barato"}),k.isWorst&&l.jsx("span",{className:"cc-sr-only",children:". El más caro"})]})]},k.store)})})]})]})]}),(De||ci)&&l.jsxs("div",{className:"nav-btns",children:[l.jsxs("button",{className:"btn-back",onClick:i,children:[l.jsx("span",{"aria-hidden":"true",children:"â "}),"Editar carrito"]}),l.jsxs("button",{className:"btn-fwd",onClick:s,children:["Ver carrito optimizado",l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",children:l.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})]})]}),!ci&&!De&&l.jsx("div",{className:"nav-btns",style:{marginTop:24},children:l.jsxs("button",{className:"btn-back",onClick:i,children:[l.jsx("span",{"aria-hidden":"true",children:"â "}),"Editar carrito"]})})]})}const $h={Lider:{color:"#0066cc",bg:"#dbeafe",textBg:"#eff6ff",short:"L"},Jumbo:{color:"#00a651",bg:"#dcfce7",textBg:"#f0fdf4",short:"J"}
100,Unimarc:{color:"#ea580c",bg:"#ffedd5",textBg:"#fff7ed",short:"U"},"Santa Isabel":{color:"#dc2626",bg:"#fee2e2",textBg:"#fef2f2",short:"SI"}},yk={Lider:{enabled:!0,shipping_cost:3e3,free_threshold:3e4},Jumbo:{enabled:!0,shipping_cost:4990,free_threshold:0},Unimarc:{enabled:!0,shipping_cost:5e3,free_threshold:6e4},"Santa Isabel":{enabled:!0,shipping_cost:3990,free_threshold:25e3}},Uh=["Lider","Jumbo","Unimarc","Santa Isabel"];function Mh({size:e=14}){return l.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),l.jsx("polyline",{points:"15 3 21 3 21 9"}),l.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function wk(e,t){return e?e.products.map((r,n)=>{var u,c;const s={[e.supermarket]:r.price},i={},a=((u=t==null?void 0:t.priceMap)==null?void 0:u[n])||{},o=((c=t==null?void 0:t.urlMap)==null?void 0:c[n])||{};for(const[d,h]of Object.entries(a))h!=null&&(s[d]=h);for(const[d,h]of Object.entries(o))h&&(i[d]=h);return{name:r.name,quantity:r.quantity,prices:s,urls:i}}):[]}function _k(e,t){if(!t)return 0;const r=Number(t.free_threshold)>0?Number(t.free_threshold):null;return r!==null&&e>=r?0:Number(t.shipping_cost)||0}function Dh(e,t,r,n){const s=[];for(const f of Object.values(e.distribution||{}))for(const p of f)s.push(p);const i=s.map(f=>{var y;const p=(y=f.prices)==null?void 0:y[t];return{...f,assigned_price:p!=null?p*(f.quantity||1):null}}),a=i.reduce((f,p)=>f+(p.assigned_price||0),0),o=n?_k(a,r[t]):0,u={[t]:i},c={[t]:{subtotal:a,shipping:o,total:a+o}},d=a+o,h=i.filter(f=>f.assigned_price==null).length;return{distribution:u,costs:c,enabled_stores:[t],total_cost:d,baseline_store:e.baseline_store,baseline_cost:e.baseline_cost,savings:e.baseline_cost-d,worthwhile:!1,missing_count:h}}function xk({cartData:e,comparisonData:t,onBack:r,showToast:n,onRequireAuth:s,onUpgrade:i}){const[a,o]=_.useState(yk),[u,c]=_.useState(!0),[d,h]=_.useState(!1),[f,p]=_.useState(!1),[y,w]=_.useState(null),[x,m]=_.useState(null),[g,v]=_.useState("optimal");if(!e)return l.jsxs("div",{className:"empty-state",children:[l.jsx("h3",{children:"Primero analiza tu carrito"}),l.jsx("p",{children:"Vuelve al paso 1 y pega el contenido de tu carrito."})]});if(!t)return l.jsxs("div",{className:"empty-state",children:[l.jsx("h3",{children:"Falta comparar precios"}),l.jsx("p",{children:"El optimizador necesita los precios de las otras tiendas. Vuelve al paso 2 y ejecuta la comparación."}),l.jsxs("button",{className:"btn-primary",onClick:r,children:[l.jsx("span",{"aria-hidden":"true",children:"â "}),"Ir a Resultados"]})]});function b(C,N,B){o(I=>({...I,[C]:{...I[C],[N]:B}}))}async function E(){p(!0),w(null),m(null),v("optimal");try{const C=wk(e,t),N={};for(const[I,T]of Object.entries(a))N[I]={enabled:T.enabled,shipping_cost:Number(T.shipping_cost)||0,free_threshold:Number(T.free_threshold)>0?Number(T.free_threshold):null};const B=await yb(C,N,u);m(B),n==null||n("Carrito optimizado")}catch(C){if(qm(C,{onRequireAuth:s,onUpgrade:i}))return;w(C.message||"Error al optimizar")}finally{p(!1)}}const S=_.useMemo(()=>x?g==="optimal"?x:Dh(x,g,a,u):null,[x,g,a,u]),j=_.useMemo(()=>{if(!x)return{};const C={};for(const N of Uh){const B=Dh(x,N,a,u);C[N]={total:B.total_cost,missing:B.missing_count}}return C},[x,a,u]);function P(){var N,B,I;if(!S)return;const C=[];for(const T of S.enabled_stores||[]){const U=((N=S.distribution)==null?void 0:N[T])||[],D=((B=S.costs)==null?void 0:B[T])||{};if(U.length){C.push(`--- ${T} ---`);for(const W of U){const ne=W.quantity>1?` Ã${W.quantity}`:"";W.assigned_price==null?C.push(` ${W.name}${ne} (no disponible en ${T})`):C.push(` ${W.name}${ne} ${Z(W.assigned_price)}`)}u&&D.shipping!=null&&C.push(` Despacho: ${D.shipping===0?"GRATIS":Z(D.shipping)}`),C.push(` Subtotal: ${Z(D.subtotal||0)}`),C.push("")}}C.push(`Total: ${Z(S.total_cost)}`),(I=navigator.clipboard)==null||I.writeText(C.join(` 101`)).then(()=>n==null?void 0:n("Lista copiada al portapapeles")).catch(()=>n==null?void 0:n("No se pudo copiar"))}return l.jsxs("div",{children:[l.jsxs("div",{className:"step1-title",style:{marginBottom:24},children:[l.jsx("h2",{children:"Tu carrito optimizado"}),l.jsx("p",{children:"Te decimos exactamente qué comprar en cada super para que pagues lo mÃnimo."})]}),l.jsxs("div",{className:"ship-toggle-card",children:[l.jsxs("div",{className:"ship-toggle-left",children:[l.jsx("h3",{id:"ship-toggle-label",children:"¿Incluir costo de despacho?"}),l.jsx("p",{id:"ship-toggle-desc",children:"ActÃvalo si vas a pedir el super a domicilio"})]}),l.jsx("button",{type:"button",className:`toggle ${u?"on":""}`,role:"switch","aria-checked":u,"aria-labelledby":"ship-toggle-label","aria-describedby":"ship-toggle-desc",onClick:()=>c(C=>!C)})]}),l.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:14},children:l.jsx("button",{type:"button",className:"btn-ghost",onClick:()=>h(C=>!C),style:{fontSize:"0.82rem"},"aria-expanded":d,children:d?"â Ocultar configuración avanzada":"â Ajustar costos por tienda"})}),d&&l.jsxs("div",{className:"ship-config",children:[l.jsx("div",{className:"ship-config-header",children:l.jsx("h3",{children:"Configuración de despacho por tienda"})}),l.jsxs("table",{className:"ship-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{scope:"col",children:"Tienda"}),l.jsx("th",{scope:"col",children:"Costo envÃo"}),l.jsx("th",{scope:"col",children:"Gratis sobre"}),l.jsx("th",{scope:"col",children:"Activa"})]})}),l.jsx("tbody",{children:Object.entries(a).map(([C,N])=>{const B=$h[C];return l.jsxs("tr",{style:{opacity:N.enabled?1:.45},children:[l.jsx("td",{children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[l.jsx("div",{style:{width:10,height:10,borderRadius:"50%",background:B.color,flexShrink:0},"aria-hidden":"true"}),C]})}),l.jsxs("td",{children:[l.jsx("span",{style:{color:"var(--text3)",fontSize:"0.85rem",marginRight:4},"aria-hidden":"true",children:"$"}),l.jsx("input",{className:"ship-input",type:"number",min:"0",value:N.shipping_cost,onChange:I=>b(C,"shipping_cost",I.target.value),disabled:!u||!N.enabled,"aria-label":`Costo de envÃo en ${C}, en pesos`})]}),l.jsxs("td",{children:[l.jsx("span",{style:{color:"var(--text3)",fontSize:"0.85rem",marginRight:4},"aria-hidden":"true",children:"$"}),l.jsx("input",{className:"ship-input",type:"number",min:"0",value:N.free_threshold,onChange:I=>b(C,"free_threshold",I.target.value),disabled:!u||!N.enabled,placeholder:"0","aria-label":`EnvÃo gratis en ${C} sobre este monto, en pesos`})]}),l.jsx("td",{children:l.jsx("div",{className:`checkmark ${N.enabled?"on":""}`,role:"checkbox","aria-checked":N.enabled,"aria-label":`Incluir ${C} en la optimización`,tabIndex:0,onClick:()=>b(C,"enabled",!N.enabled),onKeyDown:I=>{(I.key===" "||I.key==="Enter")&&(I.preventDefault(),b(C,"enabled",!N.enabled))},children:N.enabled&&l.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3.5",strokeLinecap:"round","aria-hidden":"true",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})})})})]},C)})})]})]}),l.jsx("div",{className:"cart-actions",children:l.jsx("button",{type:"button",className:"btn-primary",onClick:E,disabled:f,"aria-busy":f,children:f?"Optimizandoâ¦":x?"Recalcular":"Optimizar carrito"})}),y&&l.jsx("div",{className:"error-box",role:"alert",children:y}),x&&S&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"view-selector",children:[l.jsx("label",{className:"view-selector-label",htmlFor:"view-mode-select",children:"Comprar todo en:"}),l.jsxs("select",{id:"view-mode-select",className:"view-selector-select",value:g,onChange:C=>v(C.target.value),children:[l.jsxs("option",{value:"optimal",children:["División óptima: ",Z(x.total_cost)]}),Uh.map(C=>{const N=j[C];if(!N)return null;const B=N.total-x.total_cost,I=B<=0?`${C}: ${Z(N.total)}`:`${C}: ${Z(N.total)} (+${Z(B)})`,T=N.missing>0?` · ${N.missing} sin precio`:"";return l.jsxs("option",{value:C,children:[I,T]},C)})]})]}),g==="optimal"&&x.worthwhile&&x.savings>0&&l.jsxs("div",{className:"opt-tip",children:[l.jsx("div",{className:"opt-tip-icon",children:"ð¡"}),l.jsxs("div",{className:"opt-tip-text",children:[l.jsxs("strong",{children:["Comprando en varias tiendas ahorras ",Z(x.savings)," adicionales"]}),l.jsxs("span",{children:["vs. comprar todo en ",x.baseline_store," (",Z(x.baseline_cost),")"]})]})]}),g==="optimal"&&!x.worthwhile&&l.jsxs("div",{className:"opt-tip",style:{background:"var(--blue-bg)",borderColor:"rgba(0,102,204,0.2)"},children:[l.jsx("div",{className:"opt-tip-icon",children:"â"}),l.jsxs("div",{className:"opt-tip-text",children:[l.jsx("strong",{children:"No conviene dividir el carrito"}),l.jsxs("span",{children:["Mejor comprar todo en ",x.baseline_store,": ",Z(x.baseline_cost)]})]})]}),g!=="optimal"&&S.missing_count>0&&l.jsxs("div",{className:"opt-tip",style:{background:"#fef3c7",borderColor:"#fbbf24"},children:[l.jsx("div",{className:"opt-tip-icon",children:"â ï¸"}),l.jsxs("div",{className:"opt-tip-text",children:[l.jsxs("strong",{children:[S.missing_count," producto",S.missing_count!==1?"s":""," sin precio en ",g]}
101),l.jsx("span",{children:"Aparecen en la lista pero no suman al total. Considera la división óptima."})]})]}),l.jsxs("div",{className:"receipt",children:[l.jsx("div",{className:"receipt-header",children:l.jsx("h3",{children:g==="optimal"?"Dónde comprar cada producto":`Tu carrito en ${g}`})}),l.jsx("div",{className:"receipt-body",children:(S.enabled_stores||[]).map(C=>{var T,U;const N=((T=S.distribution)==null?void 0:T[C])||[],B=((U=S.costs)==null?void 0:U[C])||{};if(!N.length&&!B.subtotal)return null;const I=$h[C]||{color:"#888",bg:"#eee",textBg:"#f5f5f5"};return l.jsxs("div",{className:"receipt-store-section",children:[l.jsxs("div",{className:"receipt-store-head",style:{background:I.textBg},children:[l.jsxs("div",{className:"receipt-store-name",children:[l.jsx("div",{className:"receipt-store-dot",style:{background:I.color}}),l.jsx("span",{children:C}),l.jsxs("span",{className:"receipt-store-pill",style:{background:I.bg,color:I.color},children:[N.length," producto",N.length!==1?"s":""]})]}),l.jsx("div",{className:"receipt-store-subtotal",style:{color:I.color},children:Z(B.subtotal||0)})]}),N.map((D,W)=>{var q;const ne=(q=D.urls)==null?void 0:q[C],O=D.assigned_price==null;return l.jsxs("div",{className:"receipt-item",children:[l.jsxs("span",{className:"receipt-item-name",children:[D.name,D.quantity>1&&l.jsxs("span",{className:"qty-mark",children:["Ã",D.quantity]})]}),l.jsxs("span",{className:"receipt-item-right",children:[l.jsx("span",{className:"receipt-item-price",style:O?{color:"var(--text3)",fontWeight:400}:void 0,children:O?"-":Z(D.assigned_price)}),ne?l.jsx("a",{href:ne,target:"_blank",rel:"noopener noreferrer",className:"item-ext-link",title:`Ver en ${C}`,"aria-label":`Ver ${D.name} en ${C}`,children:l.jsx(Mh,{size:14})}):l.jsx("span",{className:"item-ext-link item-ext-link--disabled","aria-hidden":"true",children:l.jsx(Mh,{size:14})})]})]},W)}),u&&B.shipping!=null&&l.jsxs("div",{className:"receipt-ship",children:[l.jsx("span",{children:"Despacho"}),l.jsx("strong",{children:B.shipping===0?"GRATIS":Z(B.shipping)})]})]},C)})})]}),l.jsxs("div",{className:"grand-total-card",children:[l.jsxs("div",{className:"gt-left",children:[l.jsx("h2",{children:"Total a pagar"}),g==="optimal"&&x.savings>0&&x.worthwhile&&l.jsxs("div",{className:"gt-saving",children:["Ahorras ",Z(x.savings)," (",(x.savings/x.baseline_cost*100).toFixed(1),"%) vs. comprar todo en ",x.baseline_store]}),g!=="optimal"&&l.jsxs("div",{className:"gt-saving",style:{color:"rgba(255,255,255,0.7)"},children:["Vista: comprar todo en ",g]}),!u&&l.jsx("div",{style:{fontSize:"0.78rem",color:"rgba(255,255,255,0.55)",marginTop:4},children:"(despacho no incluido)"})]}),l.jsx("div",{className:"gt-amount",children:Z(S.total_cost)})]}),l.jsxs("div",{className:"action-btns",children:[l.jsxs("button",{className:"btn-back",onClick:r,style:{flex:"0 0 auto"},children:[l.jsx("span",{"aria-hidden":"true",children:"â "}),"Volver"]}),l.jsxs("button",{className:"btn-copy",onClick:P,children:[l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copiar lista"]})]})]}),!x&&l.jsx("div",{className:"nav-btns",style:{marginTop:24},children:l.jsxs("button",{className:"btn-back",onClick:r,children:[l.jsx("span",{"aria-hidden":"true",children:"â "}),"Volver a resultados"]})})]})}const bk=["a[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function kk(e){return e?Array.from(e.querySelectorAll(bk)).filter(t=>t.offsetParent!==null||t.getClientRects().length>0):[]}function Xm(e,t){const r=_.useRef(null),n=_.useRef(null),s=_.useRef(t);return s.current=t,_.useEffect(()=>{var o;if(!e)return;const i=r.current;if(n.current=document.activeElement,i){const c=i.querySelector("[data-modal-autofocus]")||i;(o=c.focus)==null||o.call(c)}const a=u=>{var y,w;if(u.key==="Escape"){u.stopPropagation(),(y=s.current)==null||y.call(s);return}if(u.key!=="Tab")return;const c=r.current;if(!c)return;const d=kk(c);if(d.length===0){u.preventDefault(),(w=c.focus)==null||w.call(c);return}const h=d[0],f=d[d.length-1],p=document.activeElement;if(!c.contains(p)){u.preventDefault(),(u.shiftKey?f:h).focus();return}
101u.shiftKey&&p===h?(u.preventDefault(),f.focus()):!u.shiftKey&&p===f&&(u.preventDefault(),h.focus())};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a);const u=n.current;n.current=null,u&&typeof u.focus=="function"&&document.contains(u)&&u.focus()}},[e]),r}const co=[{name:"Santiago",region:"Metropolitana",lat:-33.4489,lng:-70.6693},{name:"Providencia",region:"Metropolitana",lat:-33.4314,lng:-70.6093},{name:"Las Condes",region:"Metropolitana",lat:-33.4089,lng:-70.5694},{name:"Vitacura",region:"Metropolitana",lat:-33.3899,lng:-70.576},{name:"Lo Barnechea",region:"Metropolitana",lat:-33.35,lng:-70.52},{name:"Ãuñoa",region:"Metropolitana",lat:-33.4569,lng:-70.598},{name:"La Reina",region:"Metropolitana",lat:-33.447,lng:-70.538},{name:"Macul",region:"Metropolitana",lat:-33.49,lng:-70.598},{name:"Peñalolén",region:"Metropolitana",lat:-33.487,lng:-70.543},{name:"La Florida",region:"Metropolitana",lat:-33.532,lng:-70.599},{name:"Puente Alto",region:"Metropolitana",lat:-33.611,lng:-70.576},{name:"San JoaquÃn",region:"Metropolitana",lat:-33.497,lng:-70.628},{name:"San Miguel",region:"Metropolitana",lat:-33.497,lng:-70.651},{name:"La Cisterna",region:"Metropolitana",lat:-33.529,lng:-70.662},{name:"El Bosque",region:"Metropolitana",lat:-33.562,lng:-70.675},{name:"La Granja",region:"Metropolitana",lat:-33.54,lng:-70.625},{name:"La Pintana",region:"Metropolitana",lat:-33.583,lng:-70.634},{name:"San Ramón",region:"Metropolitana",lat:-33.538,lng:-70.645},{name:"San Bernardo",region:"Metropolitana",lat:-33.592,lng:-70.699},{name:"Maipú",region:"Metropolitana",lat:-33.511,lng:-70.758},{name:"Estación Central",region:"Metropolitana",lat:-33.461,lng:-70.696},{name:"Cerrillos",region:"Metropolitana",lat:-33.496,lng:-70.709},{name:"Pedro Aguirre Cerda",region:"Metropolitana",lat:-33.487,lng:-70.674},{name:"Lo Espejo",region:"Metropolitana",lat:-33.523,lng:-70.689},{name:"Quinta Normal",region:"Metropolitana",lat:-33.428,lng:-70.7},{name:"Lo Prado",region:"Metropolitana",lat:-33.444,lng:-70.724},{name:"Pudahuel",region:"Metropolitana",lat:-33.442,lng:-70.756},{name:"Cerro Navia",region:"Metropolitana",lat:-33.422,lng:-70.739},{name:"Renca",region:"Metropolitana",lat:-33.404,lng:-70.726},{name:"Quilicura",region:"Metropolitana",lat:-33.367,lng:-70.729},{name:"ConchalÃ",region:"Metropolitana",lat:-33.384,lng:-70.675},{name:"Huechuraba",region:"Metropolitana",lat:-33.37,lng:-70.64},{name:"Recoleta",region:"Metropolitana",lat:-33.41,lng:-70.642},{name:"Independencia",region:"Metropolitana",lat:-33.417,lng:-70.664},{name:"Colina",region:"Metropolitana",lat:-33.202,lng:-70.676}
101,{name:"Padre Hurtado",region:"Metropolitana",lat:-33.568,lng:-70.806},{name:"Melipilla",region:"Metropolitana",lat:-33.688,lng:-71.215},{name:"Talagante",region:"Metropolitana",lat:-33.664,lng:-70.928},{name:"Buin",region:"Metropolitana",lat:-33.733,lng:-70.743},{name:"Arica",region:"Arica y Parinacota",lat:-18.4783,lng:-70.3126},{name:"Iquique",region:"Tarapacá",lat:-20.2133,lng:-70.1503},{name:"Alto Hospicio",region:"Tarapacá",lat:-20.25,lng:-70.11},{name:"Antofagasta",region:"Antofagasta",lat:-23.6509,lng:-70.3975},{name:"Calama",region:"Antofagasta",lat:-22.4567,lng:-68.9295},{name:"Copiapó",region:"Atacama",lat:-27.3668,lng:-70.3322},{name:"La Serena",region:"Coquimbo",lat:-29.9027,lng:-71.252},{name:"Coquimbo",region:"Coquimbo",lat:-29.9533,lng:-71.3436},{name:"Ovalle",region:"Coquimbo",lat:-30.601,lng:-71.199},{name:"ValparaÃso",region:"ValparaÃso",lat:-33.0472,lng:-71.6127},{name:"Viña del Mar",region:"ValparaÃso",lat:-33.0246,lng:-71.5518},{name:"Quilpué",region:"ValparaÃso",lat:-33.047,lng:-71.442},{name:"Villa Alemana",region:"ValparaÃso",lat:-33.042,lng:-71.373},{name:"Quillota",region:"ValparaÃso",lat:-32.88,lng:-71.248},{name:"San Antonio",region:"ValparaÃso",lat:-33.593,lng:-71.621},{name:"Los Andes",region:"ValparaÃso",lat:-32.834,lng:-70.598},{name:"Rancagua",region:"O'Higgins",lat:-34.1708,lng:-70.7444},{name:"San Fernando",region:"O'Higgins",lat:-34.586,lng:-70.989},{name:"Talca",region:"Maule",lat:-35.4264,lng:-71.6554},{name:"Curicó",region:"Maule",lat:-34.983,lng:-71.239},{name:"Linares",region:"Maule",lat:-35.846,lng:-71.593},{name:"Chillán",region:"Ãuble",lat:-36.6066,lng:-72.1034},{name:"Concepción",region:"BiobÃo",lat:-36.8201,lng:-73.0444},{name:"Talcahuano",region:"BiobÃo",lat:-36.717,lng:-73.117},{name:"Los Ãngeles",region:"BiobÃo",lat:-37.469,lng:-72.354},{name:"Coronel",region:"BiobÃo",lat:-37.029,lng:-73.134},{name:"Temuco",region:"La AraucanÃa",lat:-38.7359,lng:-72.5904},{name:"Padre Las Casas",region:"La AraucanÃa",lat:-38.766,lng:-72.6},{name:"Valdivia",region:"Los RÃos",lat:-39.8142,lng:-73.2459},{name:"Osorno",region:"Los Lagos",lat:-40.574,lng:-73.133},{name:"Puerto Montt",region:"Los Lagos",lat:-41.4717,lng:-72.9369},{name:"Castro",region:"Los Lagos",lat:-42.482,lng:-73.764},{name:"Coyhaique",region:"Aysén",lat:-45.5712,lng:-72.0685},{name:"Punta Arenas",region:"Magallanes",lat:-53.1638,lng:-70.9171}],Sk=[...new Set(co.map(e=>e.region))],Ek=[...co].sort((e,t)=>e.name.localeCompare(t.name,"es"));function jk(e){if(!e)return null;const t=e.trim().toLowerCase();return co.find(r=>r.name.toLowerCase()===t)||null}function Ck({timeout:e=1e4}={}){return new Promise((t,r)=>{if(!("geolocation"in navigator)){r(new Error("Tu navegador no permite obtener la ubicación."));return}navigator.geolocation.getCurrentPosition(n=>t({lat:n.coords.latitude,lng:n.coords.longitude}),n=>{const s=n.code===n.PERMISSION_DENIED?"Permiso de ubicación denegado. Puedes elegir tu comuna manualmente.":n.code===n.TIMEOUT?"No pudimos obtener tu ubicación a tiempo. Inténtalo de nuevo.":"No pudimos obtener tu ubicación. Elige tu comuna manualmente.";r(new Error(s))},{enableHighAccuracy:!1,timeout:e,maximumAge:5*60*1e3})})}function Rk(e,t){const n=c=>c*Math.PI/180,s=n(t.lat-e.lat),i=n(t.lng-e.lng),a=n(e.lat),o=n(t.lat),u=Math.sin(s/2)**2+Math.cos(a)*Math.cos(o)*Math.sin(i/2)**2;return 2*6371*Math.asin(Math.sqrt(u))}function Tk({lat:e,lng:t}){if(typeof e!="number"||typeof t!="number")return null;let r=null,n=1/0;for(const s of co){const i=Rk({lat:e,lng:t},s);i<n&&(n=i,r=s)}return r?{...r,distanceKm:n}:null}const Nk=[{key:"jumbo",label:"Jumbo"},{key:"lider",label:"LÃder"},{key:"santa-isabel",label:"Santa Isabel"},{key:"unimarc",label:"Unimarc"}];function Pk({value:e,onChange:t,idPrefix:r="loc"}){const n=(e==null?void 0:e.comuna)||"",s=(e==null?void 0:e.preferred_stores)||[],[i,a]=_.useState(!1),[o,u]=_.useState("");function c(f){const p=jk(f);t({...e,comuna:f||null,region:(p==null?void 0:p.region)||(e==null?void 0:e.region)||null})}function d(f){const p=s.includes(f)?s.filter(y=>y!==f):[...s,f];t({...e,preferred_stores:p})}async function h(){u(""),a(!0);try{const f=await Ck(),p=Tk(f);if(!p){u("No encontramos una comuna cercana. ElÃgela manualmente.");return}t({...e,comuna:p.name,region:p.region}),u(`Detectamos: ${p.name}. ¿No es correcto? Ajústalo abajo.`)}catch(f){u(f.message||"No pudimos obtener tu ubicación.")}finally{a(!1)}}return l.jsxs("div",{className:"locpick",children:[l.jsxs("div",{className:"locpick-field",children:[l.jsxs("div",{className:"locpick-label-row",children:[l.jsx("label",{htmlFor:`${r}-comuna`,children:"Tu comuna"}),l.jsx("button",{type:"button",className:"locpick-geo-btn",onClick:h,disabled:i,"aria-busy":i,"aria-describedby":`${r}-geo-msg`,children:i?"Ubicandoâ¦":l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":"true",children:"ð "}),"Usar mi ubicación"]})})]}),l.jsxs("select",{id:`${r}-comuna`,className:"locpick-select",value:n,onChange:f=>c(f.target.value),"aria-describedby":`${r}-comuna-hint`,children:[l.jsx("option",{value:"",children:"Selecciona tu comunaâ¦"}),Sk.map(f=>l.jsx("optgroup",{label:f,children:Ek.filter(p=>p.region===f).map(p=>l.jsx("option",{value:p.name,children:p.name},`${p.name}-${p.region}`))},f))]}),l.jsx("p",{className:"locpick-geo-msg",id:`${r}-geo-msg`,role:"status",hidden:!o,children:o}),l.jsx("p",{className:"locpick-hint",id:`${r}
101-comuna-hint`,children:"Los precios de Jumbo y Santa Isabel cambian según la zona; tu comuna ayuda a mostrarte el precio de tu tienda."})]}),l.jsxs("div",{className:"locpick-field",role:"group","aria-labelledby":`${r}-stores-label`,children:[l.jsx("span",{className:"locpick-group-label",id:`${r}-stores-label`,children:"¿Dónde compras habitualmente?"}),l.jsx("div",{className:"locpick-stores",children:Nk.map(f=>l.jsxs("label",{className:`locpick-chip ${s.includes(f.key)?"is-on":""}`,children:[l.jsx("input",{type:"checkbox",checked:s.includes(f.key),onChange:()=>d(f.key)}),f.label]},f.key))})]})]})}function Ak({open:e,onClose:t}){const{signIn:r,signUp:n}=ui(),[s,i]=_.useState("login"),[a,o]=_.useState(""),[u,c]=_.useState(""),[d,h]=_.useState(""),[f,p]=_.useState({comuna:null,region:null,preferred_stores:[]}),[y,w]=_.useState(""),[x,m]=_.useState(""),[g,v]=_.useState(!1);_.useEffect(()=>{e&&(w(""),m(""))},[e]);const b=Xm(e,t);if(!e)return null;function E(P){i(P),w(""),m("")}async function S(P){if(P.preventDefault(),w(""),m(""),!a.trim()||!u){w("Ingresa tu email y contraseña.");return}if(s==="register"&&u.length<6){w("La contraseña debe tener al menos 6 caracteres.");return}v(!0);try{if(s==="login"){const{error:C}=await r(a.trim(),u);if(C){w(Bh(C.message));return}t()}else{const{error:C,needsConfirmation:N}=await n(a.trim(),u,d.trim(),f);if(C){w(Bh(C.message));return}if(N){m("Te enviamos un correo de confirmación. RevÃsalo para activar tu cuenta.");return}t()}}finally{v(!1)}}const j=s==="login";return l.jsx("div",{className:"auth-overlay",onClick:t,children:l.jsxs("div",{className:"auth-modal",onClick:P=>P.stopPropagation(),ref:b,role:"dialog","aria-modal":"true","aria-labelledby":"auth-modal-title","aria-describedby":"auth-modal-sub",tabIndex:-1,children:[l.jsx("button",{className:"auth-close",type:"button",onClick:t,"aria-label":"Cerrar",children:l.jsx("span",{"aria-hidden":"true",children:"Ã"})}),l.jsx("h2",{className:"auth-title",id:"auth-modal-title",children:j?"Iniciar sesión":"Crear cuenta"}),l.jsx("p",{className:"auth-sub",id:"auth-modal-sub",children:j?"Accede para comparar tu carrito y guardar tu uso.":"RegÃstrate gratis para empezar a ahorrar."}),l.jsxs("form",{className:"auth-form",onSubmit:S,children:[!j&&l.jsxs("div",{className:"auth-field",children:[l.jsx("label",{htmlFor:"auth-name",children:"Nombre (opcional)"}),l.jsx("input",{id:"auth-name",className:"auth-input",type:"text",value:d,onChange:P=>h(P.target.value),placeholder:"Cómo te llamamos",autoComplete:"name"})]}),l.jsxs("div",{className:"auth-field",children:[l.jsx("label",{htmlFor:"auth-email",children:"Email"}),l.jsx("input",{id:"auth-email",className:"auth-input","data-modal-autofocus":!0,type:"email",value:a,onChange:P=>o(P.target.value),placeholder:"[email protected]",autoComplete:"email",required:!0})]}),l.jsxs("div",{className:"auth-field",children:[l.jsx("label",{htmlFor:"auth-password",children:"Contraseña"}),l.jsx("input",{id:"auth-password",className:"auth-input",type:"password",value:u,onChange:P=>c(P.target.value),placeholder:j?"Tu contraseña":"MÃnimo 6 caracteres",autoComplete:j?"current-password":"new-password",required:!0})]}),!j&&l.jsxs("div",{className:"auth-field",children:[l.jsxs("span",{className:"auth-loc-title",id:"auth-loc-title",children:["Ubicación y supermercados ",l.jsx("span",{className:"auth-loc-opt",children:"(opcional)"})]}),l.jsx("div",{role:"group","aria-labelledby":"auth-loc-title",children:l.jsx(Pk,{value:f,onChange:p,idPrefix:"auth"})})]}),y&&l.jsx("div",{className:"auth-error",role:"alert",children:y}),x&&l.jsx("div",{className:"auth-info",role:"status",children:x}),l.jsx("button",{className:"auth-submit",type:"submit",disabled:g,"aria-busy":g,children:g?"Procesandoâ¦":j?"Entrar":"Crear cuenta"})]}),l.jsx("div",{className:"auth-switch",children:j?l.jsxs(l.Fragment,{children:["¿No tienes cuenta?"," ",l.jsx("button",{type:"button",className:"auth-link",onClick:()=>E("register"),children:"RegÃstrate"})]}):l.jsxs(l.Fragment,{children:["¿Ya tienes cuenta?"," ",l.jsx("button",{type:"button",className:"auth-link",onClick:()=>E("login"),children:"Inicia sesión"})]})})]})})}function Bh(e=""){const t=e.toLowerCase();return t.includes("invalid login credentials")?"Email o contraseña incorrectos.":t.includes("email not confirmed")?"Debes confirmar tu correo antes de iniciar sesión.":t.includes("user already registered")?"Ya existe una cuenta con este email.":t.includes("password should be at least")?"La contraseña debe tener al menos 6 caracteres.":t.includes("unable to validate email")||t.includes("invalid email")?"El email no es válido.":t.includes("rate limit")||t.includes("too many")?"Demasiados intentos. Espera un momento.":e||"Ocurrió un error. Inténtalo de nuevo."}const Ok="Desbloquea todos los supermercados",Lk="Accede a Lider y Unimarc con el Plan Pro y la extensión de Chrome.";function Ik({open:e,onClose:t,title:r,message:n}){const s=ai(),i=Xm(e,t);if(!e)return null;function a(){t(),s("/planes")}return l.jsx("div",{className:"auth-overlay",onClick:t,children:l.jsxs("div",{className:"upgrade-modal",onClick:o=>o.stopPropagation(),ref:i,role:"dialog","aria-modal":"true","aria-labelledby":"upgrade-modal-title","aria-describedby":"upgrade-modal-message",tabIndex:-1,
101children:[l.jsx("button",{className:"auth-close",type:"button",onClick:t,"aria-label":"Cerrar",children:l.jsx("span",{"aria-hidden":"true",children:"Ã"})}),l.jsx("div",{className:"upgrade-icon","aria-hidden":"true",children:"ð"}),l.jsx("h2",{className:"upgrade-title",id:"upgrade-modal-title",children:r||Ok}),l.jsx("p",{className:"upgrade-message",id:"upgrade-modal-message",children:n||Lk}),l.jsxs("div",{className:"upgrade-actions",children:[l.jsx("button",{className:"upgrade-cta",type:"button",onClick:a,children:"Ver planes"}),l.jsx("button",{className:"upgrade-dismiss",type:"button",onClick:t,children:"Cerrar"})]})]})})}class $k extends _.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,r){console.error("[ErrorBoundary]",t,r==null?void 0:r.componentStack)}render(){return this.state.error?l.jsx("div",{className:"comp-page",children:l.jsxs("div",{className:"inst-main",style:{textAlign:"center",maxWidth:560},children:[l.jsx("div",{style:{width:64,height:64,borderRadius:"50%",background:"var(--red-light)",color:"var(--red)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 24px"},children:l.jsxs("svg",{width:"30",height:"30",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),l.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),l.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}),l.jsx("h1",{style:{fontSize:"1.8rem",fontWeight:800,letterSpacing:"-0.03em",marginBottom:12},children:"Algo se rompió de nuestro lado"}),l.jsx("p",{style:{color:"var(--text2)",lineHeight:1.7,marginBottom:28},children:"No pudimos mostrar esta pantalla. Tus datos no se perdieron: puedes reintentar o volver al inicio y armar el carrito otra vez."}),l.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"center",flexWrap:"wrap"},children:[l.jsx("button",{type:"button",className:"btn-nav-cta",onClick:()=>window.location.reload(),children:"Reintentar"}),l.jsx("button",{type:"button",className:"inst-cta-btn-ghost",style:{background:"var(--cream2)",color:"var(--text)",borderColor:"var(--border2)"},onClick:()=>{window.location.href="/"},children:"Volver al inicio"})]}),!1]})}):this.props.children}}const zh="https://comparacarrito.cl",Uk="ComparaCarrito.cl";function Zm(e,t,r,n){let s=document.head.querySelector(e);return s||(s=document.createElement("meta"),s.setAttribute(t,r),document.head.appendChild(s)),s.setAttribute("content",n),s}function Hi(e,t){return Zm(`meta[name="${e}"]`,"name",e,t)}function Wi(e,t){return Zm(`meta[property="${e}"]`,"property",e,t)}function Ut({title:e,description:t,path:r,noindex:n=!1}){return _.useEffect(()=>{const s=r!=null?zh+r:zh+window.location.pathname;document.title=e,Hi("description",t),Wi("og:title",e),Wi("og:description",t),Wi("og:url",s),Wi("og:site_name",Uk),Hi("twitter:title",e),Hi("twitter:description",t);let i=document.head.querySelector('link[rel="canonical"]');r==null?i&&i.remove():(i||(i=document.createElement("link"),i.setAttribute("rel","canonical"),document.head.appendChild(i)),i.setAttribute("href",s));const a=document.head.querySelector('meta[name="robots"]');n?Hi("robots","noindex, nofollow"):a&&a.remove()},[e,t,r,n]),null}const Mk=_.lazy(()=>jr(()=>import("./QuienesSomos-OfXL1GjP.js"),[])),Dk=_.lazy(()=>jr(()=>import("./Legal-CNSU1IbM.js"),[])),Bk=_.lazy(()=>jr(()=>import("./ComoUsarlo-BLRpbetN.js"),__vite__mapDeps([0,1]))),zk=_.lazy(()=>jr(()=>import("./Planes-BuY-CGoi.js"),__vite__mapDeps([2,1]))),Fk=_.lazy(()=>jr(()=>import("./Perfil-BFH6pe9k.js"),[])),qk=_.lazy(()=>jr(()=>import("./Contacto-B5UlawyY.js"),[])),Hk=_.lazy(()=>jr(()=>import("./PagoRetorno-D1g6b2sp.js"),[])),Wk=_.lazy(()=>jr(()=>import("./NoEncontrado-CNC3jxu9.js"),__vite__mapDeps([3,4]))),Xo=[{id:"cart",label:"Mi Carrito",icon:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"9",cy:"21",r:"1"}),l.jsx("circle",{cx:"20",cy:"21",r:"1"}),l.jsx("path",{d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"})]})},{id:"compare",label:"Resultados",icon:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"11",cy:"11",r:"7"}),l.jsx("line",{x1:"21",y1:"21",x2:"16",y2:"16"})]})},{id:"optimize",label:"Carrito Ãptimo",icon:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"9"}),l.jsx("polyline",{points:"8.5 12.2 11 14.7 15.5 9.7"})]})}],Cs={lider:"Lider",jumbo:"Jumbo",unimarc:"Unimarc","santa-isabel":"Santa Isabel"};function Vk(e){const t=Cs[e.sourceStore]||e.sourceStore,r=(e.cartItems||[]).map((c,d)=>({name:c.name,price:c.price,quantity:c.quantity||1,weightLabel:c.weightLabel||null,_id:d})),n=Object.keys(e.comparisonResults||{}).map(c=>Cs[c]||c),s={},i={},a={},o={},u={};for(const[c,d]of Object.entries(e.comparisonResults||{})){const h=Cs[c]||c;
101u[h]=d.status||"ok",(d.items||[]).forEach((f,p)=>{f.found&&f.found.price!=null&&((s[p]=s[p]||{})[h]=f.found.price,f.found.url&&((i[p]=i[p]||{})[h]=f.found.url),f.found.approx&&((a[p]=a[p]||{})[h]=!0),f.found.pricePerKg!=null&&((o[p]=o[p]||{})[h]=f.found.pricePerKg))})}return(e.cartItems||[]).forEach((c,d)=>{c.url&&((i[d]=i[d]||{})[t]=c.url)}),{cartData:{products:r,supermarket:t},comparisonData:{priceMap:s,urlMap:i,approxMap:a,perKgMap:o,targetStores:n,storeStatus:u,fromExtension:!0}}}function Kk({showToast:e,onRequireAuth:t,onUpgrade:r}){var B;const[n,s]=ow(),i=ct(),{user:a,loading:o}=ui(),[u,c]=_.useState(n.get("app")==="1"?"comp":"landing"),[d,h]=_.useState(0),[f,p]=_.useState(null),[y,w]=_.useState(null),[x,m]=_.useState(null),g=n.get("ref")==="extension",[v,b]=_.useState(g);_.useEffect(()=>{n.get("app")==="1"&&(c("comp"),s({},{replace:!0}),window.scrollTo({top:0}))},[n,s]),_.useEffect(()=>{var I;(I=i.state)!=null&&I.goHome&&(c("landing"),h(0),window.scrollTo({top:0}))},[(B=i.state)==null?void 0:B.goHome]),_.useEffect(()=>{if(!g)return;c("comp");let I=!1;function T(ne){if(ne.source!==window||!ne.data||ne.data.type!=="CC_HANDOFF"||I)return;I=!0;const O=ne.data.data;if(O&&O.mode==="live"){const ee=Cs[O.sourceStore]||O.sourceStore,ae=(O.cartItems||[]).map((K,Rr)=>({name:K.name,price:K.price,quantity:K.quantity||1,weightLabel:K.weightLabel||null,_id:Rr})),Ke=(O.stores||[]).map(K=>Cs[K]||K);p({products:ae,supermarket:ee}),w(null),m({sourceStore:O.sourceStore,stores:O.stores||[],targetStoreNames:Ke}),h(1),b(!1),s({},{replace:!0}),window.scrollTo({top:0});return}const{cartData:q,comparisonData:H}=Vk(O);p(q),w(H),h(1),b(!1),s({},{replace:!0}),window.scrollTo({top:0})}window.addEventListener("message",T);const U=()=>window.postMessage({type:"CC_HANDOFF_REQUEST"},window.location.origin);U();let D=0;const W=setInterval(()=>{if(I||D++>20){clearInterval(W),I||b(!1);return}U()},350);return()=>{window.removeEventListener("message",T),clearInterval(W)}},[g]);function E(I){c(I),window.scrollTo({top:0})}function S(I){h(I),window.scrollTo({top:0})}function j(I){p(I),w(null),e(`${I.products.length} productos detectados`)}const P=f!==null,C=y!==null,N=[P,C,!1];return _.useEffect(()=>{u==="comp"&&!o&&!a&&t()},[u,o,a,t]),u==="landing"?l.jsx(sk,{setPage:E}):o?l.jsx("div",{className:"comp-page",children:l.jsx("div",{className:"empty-state",style:{textAlign:"center",padding:"80px 20px"},children:l.jsx("h3",{children:"Cargandoâ¦"})})}):a?v?l.jsx("div",{className:"comp-page",children:l.jsxs("div",{className:"empty-state",style:{textAlign:"center",padding:"80px 20px"},children:[l.jsx("h3",{children:"Cargando tu comparaciónâ¦"}),l.jsx("p",{children:"Trayendo los datos desde la extensión ComparaCarrito."})]})}):l.jsxs("div",{className:"comp-page",children:[l.jsx("div",{className:"stepper-wrap",children:l.jsx("div",{className:"stepper",role:"group","aria-label":"Progreso de la comparación",children:Xo.map((I,T)=>{const U=d===T,D=d>T||N[T]&&!U,W=T===0||T===1&&P||T===2&&C,ne=U?"paso actual":D?"completado":W?"disponible":"bloqueado, completa el paso anterior";return l.jsxs(_.Fragment,{children:[l.jsxs("div",{className:"step-node",children:[l.jsx("button",{type:"button",className:`step-circle ${U?"active":D?"done":""}`,onClick:()=>S(T),disabled:!W,"aria-current":U?"step":void 0,"aria-label":`Paso ${T+1} de ${Xo.length}: ${I.label} (${ne})`,style:{fontFamily:"inherit",color:U||D?"#ffffff":"var(--text3)",...W?null:{cursor:"not-allowed",opacity:.55}},title:W?void 0:"Completa el paso anterior primero",children:D&&!U?l.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})}):I.icon}),l.jsx("div",{className:`step-label ${U?"active":D?"done":""}`,children:I.label})]}),T<Xo.length-1&&l.jsx("div",{className:"step-line",children:l.jsx("div",{className:`step-line-fill ${d>T?"filled":""}`})})]},I.id)})})}),l.jsxs("div",{className:"comp-body",children:[d===0&&l.jsx(ok,{cartData:f,onCartParsed:j,onGoToCompare:()=>S(1),showToast:e,onRequireAuth:t,onUpgrade:r}),d===1&&l.jsx(vk,{cartData:f,comparisonData:y,liveCompare:x,onComparisonDone:w,onGoToOptimize:()=>S(2),onBack:()=>S(0),showToast:e,onRequireAuth:t,onUpgrade:r}),d===2&&l.jsx(xk,{cartData:f,comparisonData:y,onBack:()=>S(1),showToast:e,onRequireAuth:t,onUpgrade:r})]})]}):l.jsx("div",{className:"comp-page",children:l.jsxs("div",{className:"auth-gate",children:[l.jsx("div",{className:"auth-gate-icon",children:"ð"}),l.jsx("h3",{children:"Inicia sesión para comparar tu carrito"}),l.jsx("p",{children:"Crea una cuenta gratis o entra para usar el comparador y guardar tu historial de uso."}),l.jsx("button",{className:"btn-nav-cta",onClick:t,children:"Iniciar sesión / Registrarme"})]})})}function Jk(){return l.jsx("div",{style:{paddingTop:62,minHeight:"70vh",display:"flex",alignItems:"center",justifyContent:"center"},role:"status","aria-live":"polite",children:l.jsx("p",{style:{color:"var(--text2)"},children:"Cargandoâ¦"})})}function Gk(){const{pathname:e,hash:t}=ct();return _.useEffect(()=>{t||window.scrollTo({top:0})},[e,t]),null}function Qk(){const[e,t]=_.useState(null),[r,n]=_.useState(!1),[s,i]=_.useState(null),a=_.useRef(null),o=_.useCallback(d=>{t(d),clearTimeout(a.current),a.current=setTimeout(()=>t(null),2600)},[]),u=_.useCallback(()=>n(!0),[]),c=_.useCallback((d={})=>i(d),[]);return _.useEffect(()=>{if(sessionStorage.getItem("cc_ext_detected"))return;let d=!1,h=0;const f=()=>{d||pc().then(p=>{d||(p?(sessionStorage.setItem("cc_ext_detected","1"),o("Extensión ComparaCarrito detectada â")):h++<3&&setTimeout(f,1e3))})};return f(),()=>{d=!0}},[o]),l.jsx(bb,{children:l.jsxs(nw,{children:[l.jsx(Gk,{}),l.jsx("a",{className:"skip-link",href:"#contenido",children:"Saltar al contenido"}),l.jsx(Ub,{onLoginClick:u}),l.jsx($k,{children:l.jsx(_.Suspense,{fallback:l.jsx(Jk,{}),children:l.jsxs(A0,{children:[l.jsx(Ct,{path:"/",element:l.jsxs(l.Fragment,{children:[l.jsx(Kk,{showToast:o,onRequireAuth:u,onUpgrade:c}),l.jsx(Ut,{title:"ComparaCarrito.cl | Compara precios de supermercados chilenos",description:"Compara los precios de tu carrito entre Lider, Jumbo, Unimarc y Santa Isabel. Descubre en qué supermercado te conviene comprar y cuánto ahorras. Gratis.",path:"/"})]})}),l.jsx(Ct,{path:"/quienes-somos",element:l.jsxs(l.Fragment,{children:[l.jsx(Mk,{}),l.jsx(Ut,{title:"Quiénes somos | ComparaCarrito.cl",description:"Somos un comparador independiente de precios de supermercados chilenos. Sin acuerdos comerciales ni sesgos: mostramos los precios tal cual los publican.",path:"/quienes-somos"})]})}),l.jsx(Ct,{path:"/legal",element:l.jsxs(l.Fragment,{children:[l.jsx(Dk,{}),l.jsx(Ut,{title:"Términos y privacidad | ComparaCarrito.cl",description:"Términos de uso, polÃtica de privacidad y tratamiento de datos de ComparaCarrito.cl. Qué guardamos, qué no, y cómo puedes eliminar tu cuenta.",path:"/legal"})]})}),l.jsx(Ct,{path:"/como-usarlo",element:l.jsxs(l.Fragment,{children:[l.jsx(Bk,{}),l.jsx(Ut,{title:"Cómo usar ComparaCarrito | GuÃa paso a paso",description:"Arma tu carrito pegando una lista, subiendo tu boleta o con la extensión de Chrome, y compara los precios en Lider, Jumbo, Unimarc y Santa Isabel.",path:"/como-usarlo"})]})}),l.jsx(Ct,{path:"/planes",element:l.jsxs(l.Fragment,{children:[l.jsx(zk,{onRequireAuth:u}),l.jsx(Ut,{title:"Planes y precios | ComparaCarrito.cl",description:"Compara gratis todas las veces que quieras con el plan Free, o pásate a Pro para carritos ilimitados y el carrito óptimo entre supermercados.",path:"/planes"})]})}),l.jsx(Ct,{path:"/perfil",element:l.jsxs(l.Fragment,{children:[l.jsx(Fk,{onRequireAuth:u}),l.jsx(Ut,{title:"Mi perfil | ComparaCarrito.cl",description:"Tu cuenta, tu plan y tu uso del mes en ComparaCarrito.cl.",path:"/perfil",noindex:!0})]})}),l.jsx(Ct,{path:"/contacto",element:l.jsxs(l.Fragment,{children:[l.jsx(qk,{}),l.jsx(Ut,{title:"Contacto | ComparaCarrito.cl",description:"¿Dudas, sugerencias o un precio que no cuadra? EscrÃbenos: leemos y respondemos todos los mensajes.",path:"/contacto"})]})}),l.jsx(Ct,{path:"/pago/retorno",element:l.jsxs(l.Fragment,{children:[l.jsx(Hk,{}),l.jsx(Ut,{title:"Procesando tu pago | ComparaCarrito.cl",description:"Estamos confirmando tu pago con Mercado Pago para activar tu plan Pro.",path:"/pago/retorno",noindex:!0})]})}),l.jsx(Ct,{path:"*",element:l.jsxs(l.Fragment,{children:[l.jsx(W
101k,{}),l.jsx(Ut,{title:"Página no encontrada | ComparaCarrito.cl",description:"La página que buscas no existe o cambió de dirección.",noindex:!0})]})})]})})}),l.jsx(Ak,{open:r,onClose:()=>n(!1)}),l.jsx(Ik,{open:s!==null,onClose:()=>i(null),title:s==null?void 0:s.title,message:s==null?void 0:s.message}),l.jsxs("div",{className:`toast ${e?"show":""}`,role:"status","aria-live":"polite",children:[l.jsx("div",{className:"toast-dot","aria-hidden":"true"}),e]})]})})}tm(document.getElementById("root")).render(l.jsx(_.StrictMode,{children:l.jsx(Qk,{})}));export{Vm as B,fc as C,Mb as F,vc as I,st as L,Nk as S,Wb as a,ui as b,Yk as c,ai as d,Xk as e,Pk as f,xb as g,ow as h,l as j,pc as p,_ as r,Zk as s,ct as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.