amazon-clone88.netlify.app
Open in
urlscan Pro
2600:1f18:16e:df02::65
Public Scan
Submitted URL: http://amazon-clone88.netlify.app/assets/index-dyerppxw.js
Effective URL: https://amazon-clone88.netlify.app/assets/index-dyerppxw.js
Submission: On November 02 via api from US — Scanned from US
Effective URL: https://amazon-clone88.netlify.app/assets/index-dyerppxw.js
Submission: On November 02 via api from US — Scanned from US
Form analysis
0 forms found in the DOMText Content
function pN(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var H_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function K_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var K1={exports:{}},ip={},G1={exports:{}},de={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Fc=Symbol.for("react.element"),mN=Symbol.for("react.portal"),gN=Symbol.for("react.fragment"),yN=Symbol.for("react.strict_mode"),_N=Symbol.for("react.profiler"),vN=Symbol.for("react.provider"),wN=Symbol.for("react.context"),EN=Symbol.for("react.forward_ref"),IN=Symbol.for("react.suspense"),TN=Symbol.for("react.memo"),SN=Symbol.for("react.lazy"),jE=Symbol.iterator;function AN(t){return t===null||typeof t!="object"?null:(t=jE&&t[jE]||t["@@iterator"],typeof t=="function"?t:null)}var Q1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Y1=Object.assign,J1={};function al(t,e,n){this.props=t,this.context=e,this.refs=J1,this.updater=n||Q1}al.prototype.isReactComponent={};al.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};al.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function X1(){}X1.prototype=al.prototype;function G_(t,e,n){this.props=t,this.context=e,this.refs=J1,this.updater=n||Q1}var Q_=G_.prototype=new X1;Q_.constructor=G_;Y1(Q_,al.prototype);Q_.isPureReactComponent=!0;var BE=Array.isArray,Z1=Object.prototype.hasOwnProperty,Y_={current:null},eA={key:!0,ref:!0,__self:!0,__source:!0};function tA(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Z1.call(e,r)&&!eA.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];i.children=l}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:Fc,type:t,key:s,ref:o,props:i,_owner:Y_.current}}function bN(t,e){return{$$typeof:Fc,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function J_(t){return typeof t=="object"&&t!==null&&t.$$typeof===Fc}function RN(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var $E=/\/+/g;function Hm(t,e){return typeof t=="object"&&t!==null&&t.key!=null?RN(""+t.key):e.toString(36)}function vh(t,e,n,r,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Fc:case mN:o=!0}}if(o)return o=t,i=i(o),t=r===""?"."+Hm(o,0):r,BE(i)?(n="",t!=null&&(n=t.replace($E,"$&/")+"/"),vh(i,e,n,"",function(u){return u})):i!=null&&(J_(i)&&(i=bN(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace($E,"$&/")+"/")+t)),e.push(i)),1;if(o=0,r=r===""?".":r+":",BE(t))for(var a=0;a<t.length;a++){s=t[a];var l=r+Hm(s,a);o+=vh(s,e,n,l,i)}else if(l=AN(t),typeof l=="function")for(t=l.call(t),a=0;!(s=t.next()).done;)s=s.value,l=r+Hm(s,a++),o+=vh(s,e,n,l,i);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Fd(t,e,n){if(t==null)return t;var r=[],i=0;return vh(t,r,"","",function(s){return e.call(n,s,i++)}),r}function PN(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var cn={current:null},wh={transition:null},CN={ReactCurrentDispatcher:cn,ReactCurrentBatchConfig:wh,ReactCurrentOwner:Y_};function nA(){throw Error("act(...) is not supported in production builds of React.")}de.Children={map:Fd,forEach:function(t,e,n){Fd(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Fd(t,function(){e++}),e},toArray:function(t){return Fd(t,function(e){return e})||[]},only:function(t){if(!J_(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};de.Component=al;de.Fragment=gN;de.Profiler=_N;de.PureComponent=G_;de.StrictMode=yN;de.Suspense=IN;de.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=CN;de.act=nA;de.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=Y1({},t.props),i=t.key,s=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=Y_.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)Z1.call(e,l)&&!eA.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:Fc,type:t.type,key:i,ref:s,props:r,_owner:o}};de.createContext=function(t){return t={$$typeof:wN,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:vN,_context:t},t.Consumer=t};de.createElement=tA;de.createFactory=function(t){var e=tA.bind(null,t);return e.type=t,e};de.createRef=function(){return{current:null}};de.forwardRef=function(t){return{$$typeof:EN,render:t}};de.isValidElement=J_;de.lazy=function(t){return{$$typeof:SN,_payload:{_status:-1,_result:t},_init:PN}};de.memo=function(t,e){return{$$typeof:TN,type:t,compare:e===void 0?null:e}};de.startTransition=function(t){var e=wh.transition;wh.transition={};try{t()}finally{wh.transition=e}};de.unstable_act=nA;de.useCallback=function(t,e){return cn.current.useCallback(t,e)};de.useContext=function(t){return cn.current.useContext(t)};de.useDebugValue=function(){};de.useDeferredValue=function(t){return cn.current.useDeferredValue(t)};de.useEffect=function(t,e){return cn.current.useEffect(t,e)};de.useId=function(){return cn.current.useId()};de.useImperativeHandle=function(t,e,n){return cn.current.useImperativeHandle(t,e,n)};de.useInsertionEffect=function(t,e){return cn.current.useInsertionEffect(t,e)};de.useLayoutEffect=function(t,e){return cn.current.useLayoutEffect(t,e)};de.useMemo=function(t,e){return cn.current.useMemo(t,e)};de.useReducer=function(t,e,n){return cn.current.useReducer(t,e,n)};de.useRef=function(t){return cn.current.useRef(t)};de.useState=function(t){return cn.current.useState(t)};de.useSyncExternalStore=function(t,e,n){return cn.current.useSyncExternalStore(t,e,n)};de.useTransition=function(){return cn.current.useTransition()};de.version="18.3.1";G1.exports=de;var F=G1.exports;const me=K_(F),Jh=pN({__proto__:null,default:me},[F]);/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var kN=F,xN=Symbol.for("react.element"),ON=Symbol.for("react.fragment"),NN=Object.prototype.hasOwnProperty,DN=kN.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,VN={key:!0,ref:!0,__self:!0,__source:!0};function rA(t,e,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)NN.call(e,r)&&!VN.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:xN,type:t,key:s,ref:o,props:i,_owner:DN.current}}ip.Fragment=ON;ip.jsx=rA;ip.jsxs=rA;K1.exports=ip;var C=K1.exports,iA={exports:{}},jn={},sA={exports:{}},oA={};/** * @license React * scheduler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */(function(t){function e(G,te){var ne=G.length;G.push(te);e:for(;0<ne;){var ue=ne-1>>>1,Ie=G[ue];if(0<i(Ie,te))G[ue]=te,G[ne]=Ie,ne=ue;else break e}}function n(G){return G.length===0?null:G[0]}function r(G){if(G.length===0)return null;var te=G[0],ne=G.pop();if(ne!==te){G[0]=ne;e:for(var ue=0,Ie=G.length,Me=Ie>>>1;ue<Me;){var tr=2*(ue+1)-1,nr=G[tr],rr=tr+1,ir=G[rr];if(0>i(nr,ne))rr<Ie&&0>i(ir,nr)?(G[ue]=ir,G[rr]=ne,ue=rr):(G[ue]=nr,G[tr]=ne,ue=tr);else if(rr<Ie&&0>i(ir,ne))G[ue]=ir,G[rr]=ne,ue=rr;else break e}}return te}function i(G,te){var ne=G.sortIndex-te.sortIndex;return ne!==0?ne:G.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],d=1,h=null,f=3,g=!1,_=!1,v=!1,T=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(G){for(var te=n(u);te!==null;){if(te.callback===null)r(u);else if(te.startTime<=G)r(u),te.sortIndex=te.expirationTime,e(l,te);else break;te=n(u)}}function x(G){if(v=!1,E(G),!_)if(n(l)!==null)_=!0,vt(O);else{var te=n(u);te!==null&&We(x,te.startTime-G)}}function O(G,te){_=!1,v&&(v=!1,S(I),I=-1),g=!0;var ne=f;try{for(E(te),h=n(l);h!==null&&(!(h.expirationTime>te)||G&&!k());){var ue=h.callback;if(typeof ue=="function"){h.callback=null,f=h.priorityLevel;var Ie=ue(h.expirationTime<=te);te=t.unstable_now(),typeof Ie=="function"?h.callback=Ie:h===n(l)&&r(l),E(te)}else r(l);h=n(l)}if(h!==null)var Me=!0;else{var tr=n(u);tr!==null&&We(x,tr.startTime-te),Me=!1}return Me}finally{h=null,f=ne,g=!1}}var D=!1,A=null,I=-1,m=5,R=-1;function k(){return!(t.unstable_now()-R<m)}function N(){if(A!==null){var G=t.unstable_now();R=G;var te=!0;try{te=A(!0,G)}finally{te?P():(D=!1,A=null)}}else D=!1}var P;if(typeof w=="function")P=function(){w(N)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,oe=he.port2;he.port1.onmessage=N,P=function(){oe.postMessage(null)}}else P=function(){T(N,0)};function vt(G){A=G,D||(D=!0,P())}function We(G,te){I=T(function(){G(t.unstable_now())},te)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(G){G.callback=null},t.unstable_continueExecution=function(){_||g||(_=!0,vt(O))},t.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):m=0<G?Math.floor(1e3/G):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(G){switch(f){case 1:case 2:case 3:var te=3;break;default:te=f}var ne=f;f=te;try{return G()}finally{f=ne}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(G,te){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var ne=f;f=G;try{return te()}finally{f=ne}},t.unstable_scheduleCallback=function(G,te,ne){var ue=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?ue+ne:ue):ne=ue,G){case 1:var Ie=-1;break;case 2:Ie=250;break;case 5:Ie=1073741823;break;case 4:Ie=1e4;break;default:Ie=5e3}return Ie=ne+Ie,G={id:d++,callback:te,priorityLevel:G,startTime:ne,expirationTime:Ie,sortIndex:-1},ne>ue?(G.sortIndex=ne,e(u,G),n(l)===null&&G===n(u)&&(v?(S(I),I=-1):v=!0,We(x,ne-ue))):(G.sortIndex=Ie,e(l,G),_||g||(_=!0,vt(O))),G},t.unstable_shouldYield=k,t.unstable_wrapCallback=function(G){var te=f;return function(){var ne=f;f=te;try{return G.apply(this,arguments)}finally{f=ne}}}})(oA);sA.exports=oA;var LN=sA.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var MN=F,Fn=LN;function W(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var aA=new Set,Qu={};function Po(t,e){Na(t,e),Na(t+"Capture",e)}function Na(t,e){for(Qu[t]=e,t=0;t<e.length;t++)aA.add(e[t])}var ci=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qg=Object.prototype.hasOwnProperty,FN=/^[: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]*$/,zE={},WE={};function UN(t){return qg.call(WE,t)?!0:qg.call(zE,t)?!1:FN.test(t)?WE[t]=!0:(zE[t]=!0,!1)}function jN(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function BN(t,e,n,r){if(e===null||typeof e>"u"||jN(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function dn(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var jt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){jt[t]=new dn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];jt[e]=new dn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){jt[t]=new dn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){jt[t]=new dn(t,2,!1,t,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(t){jt[t]=new dn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){jt[t]=new dn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){jt[t]=new dn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){jt[t]=new dn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){jt[t]=new dn(t,5,!1,t.toLowerCase(),null,!1,!1)});var X_=/[\-:]([a-z])/g;function Z_(t){return t[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(t){var e=t.replace(X_,Z_);jt[e]=new dn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(X_,Z_);jt[e]=new dn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(X_,Z_);jt[e]=new dn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){jt[t]=new dn(t,1,!1,t.toLowerCase(),null,!1,!1)});jt.xlinkHref=new dn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){jt[t]=new dn(t,1,!1,t.toLowerCase(),null,!0,!0)});function ev(t,e,n,r){var i=jt.hasOwnProperty(e)?jt[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(BN(e,n,i,r)&&(n=null),r||i===null?UN(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var vi=MN.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ud=Symbol.for("react.element"),sa=Symbol.for("react.portal"),oa=Symbol.for("react.fragment"),tv=Symbol.for("react.strict_mode"),Hg=Symbol.for("react.profiler"),lA=Symbol.for("react.provider"),uA=Symbol.for("react.context"),nv=Symbol.for("react.forward_ref"),Kg=Symbol.for("react.suspense"),Gg=Symbol.for("react.suspense_list"),rv=Symbol.for("react.memo"),Fi=Symbol.for("react.lazy"),cA=Symbol.for("react.offscreen"),qE=Symbol.iterator;function ql(t){return t===null||typeof t!="object"?null:(t=qE&&t[qE]||t["@@iterator"],typeof t=="function"?t:null)}var Qe=Object.assign,Km;function fu(t){if(Km===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Km=e&&e[1]||""}return` `+Km+t}var Gm=!1;function Qm(t,e){if(!t||Gm)return"";Gm=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var r=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){r=u}t.call(e.prototype)}else{try{throw Error()}catch(u){r=u}t()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(` `),s=r.stack.split(` `),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=` `+i[o].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{Gm=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?fu(t):""}function $N(t){switch(t.tag){case 5:return fu(t.type);case 16:return fu("Lazy");case 13:return fu("Suspense");case 19:return fu("SuspenseList");case 0:case 2:case 15:return t=Qm(t.type,!1),t;case 11:return t=Qm(t.type.render,!1),t;case 1:return t=Qm(t.type,!0),t;default:return""}}function Qg(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case oa:return"Fragment";case sa:return"Portal";case Hg:return"Profiler";case tv:return"StrictMode";case Kg:return"Suspense";case Gg:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case uA:return(t.displayName||"Context")+".Consumer";case lA:return(t._context.displayName||"Context")+".Provider";case nv:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case rv:return e=t.displayName||null,e!==null?e:Qg(t.type)||"Memo";case Fi:e=t._payload,t=t._init;try{return Qg(t(e))}catch{}}return null}function zN(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qg(e);case 8:return e===tv?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function os(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function dA(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function WN(t){var e=dA(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function jd(t){t._valueTracker||(t._valueTracker=WN(t))}function hA(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=dA(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Xh(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Yg(t,e){var n=e.checked;return Qe({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function HE(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=os(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function fA(t,e){e=e.checked,e!=null&&ev(t,"checked",e,!1)}function Jg(t,e){fA(t,e);var n=os(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Xg(t,e.type,n):e.hasOwnProperty("defaultValue")&&Xg(t,e.type,os(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function KE(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Xg(t,e,n){(e!=="number"||Xh(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var pu=Array.isArray;function va(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+os(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function Zg(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(W(91));return Qe({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function GE(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(W(92));if(pu(n)){if(1<n.length)throw Error(W(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:os(n)}}function pA(t,e){var n=os(e.value),r=os(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function QE(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function mA(t){switch(t){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 ey(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?mA(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Bd,gA=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Bd=Bd||document.createElement("div"),Bd.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Bd.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Yu(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Ru={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},qN=["Webkit","ms","Moz","O"];Object.keys(Ru).forEach(function(t){qN.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ru[e]=Ru[t]})});function yA(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Ru.hasOwnProperty(t)&&Ru[t]?(""+e).trim():e+"px"}function _A(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=yA(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var HN=Qe({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 ty(t,e){if(e){if(HN[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(W(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(W(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(W(61))}if(e.style!=null&&typeof e.style!="object")throw Error(W(62))}}function ny(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 ry=null;function iv(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var iy=null,wa=null,Ea=null;function YE(t){if(t=Bc(t)){if(typeof iy!="function")throw Error(W(280));var e=t.stateNode;e&&(e=up(e),iy(t.stateNode,t.type,e))}}function vA(t){wa?Ea?Ea.push(t):Ea=[t]:wa=t}function wA(){if(wa){var t=wa,e=Ea;if(Ea=wa=null,YE(t),e)for(t=0;t<e.length;t++)YE(e[t])}}function EA(t,e){return t(e)}function IA(){}var Ym=!1;function TA(t,e,n){if(Ym)return t(e,n);Ym=!0;try{return EA(t,e,n)}finally{Ym=!1,(wa!==null||Ea!==null)&&(IA(),wA())}}function Ju(t,e){var n=t.stateNode;if(n===null)return null;var r=up(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(W(231,e,typeof n));return n}var sy=!1;if(ci)try{var Hl={};Object.defineProperty(Hl,"passive",{get:function(){sy=!0}}),window.addEventListener("test",Hl,Hl),window.removeEventListener("test",Hl,Hl)}catch{sy=!1}function KN(t,e,n,r,i,s,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(d){this.onError(d)}}var Pu=!1,Zh=null,ef=!1,oy=null,GN={onError:function(t){Pu=!0,Zh=t}};function QN(t,e,n,r,i,s,o,a,l){Pu=!1,Zh=null,KN.apply(GN,arguments)}function YN(t,e,n,r,i,s,o,a,l){if(QN.apply(this,arguments),Pu){if(Pu){var u=Zh;Pu=!1,Zh=null}else throw Error(W(198));ef||(ef=!0,oy=u)}}function Co(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function SA(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function JE(t){if(Co(t)!==t)throw Error(W(188))}function JN(t){var e=t.alternate;if(!e){if(e=Co(t),e===null)throw Error(W(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return JE(i),t;if(s===r)return JE(i),e;s=s.sibling}throw Error(W(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(W(189))}}if(n.alternate!==r)throw Error(W(190))}if(n.tag!==3)throw Error(W(188));return n.stateNode.current===n?t:e}function AA(t){return t=JN(t),t!==null?bA(t):null}function bA(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=bA(t);if(e!==null)return e;t=t.sibling}return null}var RA=Fn.unstable_scheduleCallback,XE=Fn.unstable_cancelCallback,XN=Fn.unstable_shouldYield,ZN=Fn.unstable_requestPaint,lt=Fn.unstable_now,eD=Fn.unstable_getCurrentPriorityLevel,sv=Fn.unstable_ImmediatePriority,PA=Fn.unstable_UserBlockingPriority,tf=Fn.unstable_NormalPriority,tD=Fn.unstable_LowPriority,CA=Fn.unstable_IdlePriority,sp=null,Lr=null;function nD(t){if(Lr&&typeof Lr.onCommitFiberRoot=="function")try{Lr.onCommitFiberRoot(sp,t,void 0,(t.current.flags&128)===128)}catch{}}var fr=Math.clz32?Math.clz32:sD,rD=Math.log,iD=Math.LN2;function sD(t){return t>>>=0,t===0?32:31-(rD(t)/iD|0)|0}var $d=64,zd=4194304;function mu(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function nf(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=mu(a):(s&=o,s!==0&&(r=mu(s)))}else o=n&~i,o!==0?r=mu(o):s!==0&&(r=mu(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-fr(e),i=1<<n,r|=t[n],e&=~i;return r}function oD(t,e){switch(t){case 1:case 2:case 4:return e+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 e+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 aD(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var o=31-fr(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=oD(a,e)):l<=e&&(t.expiredLanes|=a),s&=~a}}function ay(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function kA(){var t=$d;return $d<<=1,!($d&4194240)&&($d=64),t}function Jm(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Uc(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-fr(e),t[e]=n}function lD(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-fr(n),s=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~s}}function ov(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-fr(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var Ae=0;function xA(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var OA,av,NA,DA,VA,ly=!1,Wd=[],Qi=null,Yi=null,Ji=null,Xu=new Map,Zu=new Map,ji=[],uD="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 ZE(t,e){switch(t){case"focusin":case"focusout":Qi=null;break;case"dragenter":case"dragleave":Yi=null;break;case"mouseover":case"mouseout":Ji=null;break;case"pointerover":case"pointerout":Xu.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zu.delete(e.pointerId)}}function Kl(t,e,n,r,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=Bc(e),e!==null&&av(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function cD(t,e,n,r,i){switch(e){case"focusin":return Qi=Kl(Qi,t,e,n,r,i),!0;case"dragenter":return Yi=Kl(Yi,t,e,n,r,i),!0;case"mouseover":return Ji=Kl(Ji,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return Xu.set(s,Kl(Xu.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,Zu.set(s,Kl(Zu.get(s)||null,t,e,n,r,i)),!0}return!1}function LA(t){var e=Ys(t.target);if(e!==null){var n=Co(e);if(n!==null){if(e=n.tag,e===13){if(e=SA(n),e!==null){t.blockedOn=e,VA(t.priority,function(){NA(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Eh(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=uy(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);ry=r,n.target.dispatchEvent(r),ry=null}else return e=Bc(n),e!==null&&av(e),t.blockedOn=n,!1;e.shift()}return!0}function eI(t,e,n){Eh(t)&&n.delete(e)}function dD(){ly=!1,Qi!==null&&Eh(Qi)&&(Qi=null),Yi!==null&&Eh(Yi)&&(Yi=null),Ji!==null&&Eh(Ji)&&(Ji=null),Xu.forEach(eI),Zu.forEach(eI)}function Gl(t,e){t.blockedOn===e&&(t.blockedOn=null,ly||(ly=!0,Fn.unstable_scheduleCallback(Fn.unstable_NormalPriority,dD)))}function ec(t){function e(i){return Gl(i,t)}if(0<Wd.length){Gl(Wd[0],t);for(var n=1;n<Wd.length;n++){var r=Wd[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Qi!==null&&Gl(Qi,t),Yi!==null&&Gl(Yi,t),Ji!==null&&Gl(Ji,t),Xu.forEach(e),Zu.forEach(e),n=0;n<ji.length;n++)r=ji[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<ji.length&&(n=ji[0],n.blockedOn===null);)LA(n),n.blockedOn===null&&ji.shift()}var Ia=vi.ReactCurrentBatchConfig,rf=!0;function hD(t,e,n,r){var i=Ae,s=Ia.transition;Ia.transition=null;try{Ae=1,lv(t,e,n,r)}finally{Ae=i,Ia.transition=s}}function fD(t,e,n,r){var i=Ae,s=Ia.transition;Ia.transition=null;try{Ae=4,lv(t,e,n,r)}finally{Ae=i,Ia.transition=s}}function lv(t,e,n,r){if(rf){var i=uy(t,e,n,r);if(i===null)ag(t,e,r,sf,n),ZE(t,r);else if(cD(i,t,e,n,r))r.stopPropagation();else if(ZE(t,r),e&4&&-1<uD.indexOf(t)){for(;i!==null;){var s=Bc(i);if(s!==null&&OA(s),s=uy(t,e,n,r),s===null&&ag(t,e,r,sf,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else ag(t,e,r,null,n)}}var sf=null;function uy(t,e,n,r){if(sf=null,t=iv(r),t=Ys(t),t!==null)if(e=Co(t),e===null)t=null;else if(n=e.tag,n===13){if(t=SA(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return sf=t,null}function MA(t){switch(t){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(eD()){case sv:return 1;case PA:return 4;case tf:case tD:return 16;case CA:return 536870912;default:return 16}default:return 16}}var Wi=null,uv=null,Ih=null;function FA(){if(Ih)return Ih;var t,e=uv,n=e.length,r,i="value"in Wi?Wi.value:Wi.textContent,s=i.length;for(t=0;t<n&&e[t]===i[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===i[s-r];r++);return Ih=i.slice(t,1<r?1-r:void 0)}function Th(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function qd(){return!0}function tI(){return!1}function Bn(t){function e(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?qd:tI,this.isPropagationStopped=tI,this}return Qe(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=qd)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=qd)},persist:function(){},isPersistent:qd}),e}var ll={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cv=Bn(ll),jc=Qe({},ll,{view:0,detail:0}),pD=Bn(jc),Xm,Zm,Ql,op=Qe({},jc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dv,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ql&&(Ql&&t.type==="mousemove"?(Xm=t.screenX-Ql.screenX,Zm=t.screenY-Ql.screenY):Zm=Xm=0,Ql=t),Xm)},movementY:function(t){return"movementY"in t?t.movementY:Zm}}),nI=Bn(op),mD=Qe({},op,{dataTransfer:0}),gD=Bn(mD),yD=Qe({},jc,{relatedTarget:0}),eg=Bn(yD),_D=Qe({},ll,{animationName:0,elapsedTime:0,pseudoElement:0}),vD=Bn(_D),wD=Qe({},ll,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),ED=Bn(wD),ID=Qe({},ll,{data:0}),rI=Bn(ID),TD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},SD={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"},AD={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bD(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=AD[t])?!!e[t]:!1}function dv(){return bD}var RD=Qe({},jc,{key:function(t){if(t.key){var e=TD[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Th(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?SD[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dv,charCode:function(t){return t.type==="keypress"?Th(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Th(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),PD=Bn(RD),CD=Qe({},op,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),iI=Bn(CD),kD=Qe({},jc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dv}),xD=Bn(kD),OD=Qe({},ll,{propertyName:0,elapsedTime:0,pseudoElement:0}),ND=Bn(OD),DD=Qe({},op,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),VD=Bn(DD),LD=[9,13,27,32],hv=ci&&"CompositionEvent"in window,Cu=null;ci&&"documentMode"in document&&(Cu=document.documentMode);var MD=ci&&"TextEvent"in window&&!Cu,UA=ci&&(!hv||Cu&&8<Cu&&11>=Cu),sI=" ",oI=!1;function jA(t,e){switch(t){case"keyup":return LD.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function BA(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var aa=!1;function FD(t,e){switch(t){case"compositionend":return BA(e);case"keypress":return e.which!==32?null:(oI=!0,sI);case"textInput":return t=e.data,t===sI&&oI?null:t;default:return null}}function UD(t,e){if(aa)return t==="compositionend"||!hv&&jA(t,e)?(t=FA(),Ih=uv=Wi=null,aa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return UA&&e.locale!=="ko"?null:e.data;default:return null}}var jD={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 aI(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!jD[t.type]:e==="textarea"}function $A(t,e,n,r){vA(r),e=of(e,"onChange"),0<e.length&&(n=new cv("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var ku=null,tc=null;function BD(t){ZA(t,0)}function ap(t){var e=ca(t);if(hA(e))return t}function $D(t,e){if(t==="change")return e}var zA=!1;if(ci){var tg;if(ci){var ng="oninput"in document;if(!ng){var lI=document.createElement("div");lI.setAttribute("oninput","return;"),ng=typeof lI.oninput=="function"}tg=ng}else tg=!1;zA=tg&&(!document.documentMode||9<document.documentMode)}function uI(){ku&&(ku.detachEvent("onpropertychange",WA),tc=ku=null)}function WA(t){if(t.propertyName==="value"&&ap(tc)){var e=[];$A(e,tc,t,iv(t)),TA(BD,e)}}function zD(t,e,n){t==="focusin"?(uI(),ku=e,tc=n,ku.attachEvent("onpropertychange",WA)):t==="focusout"&&uI()}function WD(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ap(tc)}function qD(t,e){if(t==="click")return ap(e)}function HD(t,e){if(t==="input"||t==="change")return ap(e)}function KD(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var gr=typeof Object.is=="function"?Object.is:KD;function nc(t,e){if(gr(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!qg.call(e,i)||!gr(t[i],e[i]))return!1}return!0}function cI(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function dI(t,e){var n=cI(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=cI(n)}}function qA(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?qA(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function HA(){for(var t=window,e=Xh();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Xh(t.document)}return e}function fv(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function GD(t){var e=HA(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&qA(n.ownerDocument.documentElement,n)){if(r!==null&&fv(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=dI(n,s);var o=dI(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var QD=ci&&"documentMode"in document&&11>=document.documentMode,la=null,cy=null,xu=null,dy=!1;function hI(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;dy||la==null||la!==Xh(r)||(r=la,"selectionStart"in r&&fv(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),xu&&nc(xu,r)||(xu=r,r=of(cy,"onSelect"),0<r.length&&(e=new cv("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=la)))}function Hd(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var ua={animationend:Hd("Animation","AnimationEnd"),animationiteration:Hd("Animation","AnimationIteration"),animationstart:Hd("Animation","AnimationStart"),transitionend:Hd("Transition","TransitionEnd")},rg={},KA={};ci&&(KA=document.createElement("div").style,"AnimationEvent"in window||(delete ua.animationend.animation,delete ua.animationiteration.animation,delete ua.animationstart.animation),"TransitionEvent"in window||delete ua.transitionend.transition);function lp(t){if(rg[t])return rg[t];if(!ua[t])return t;var e=ua[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in KA)return rg[t]=e[n];return t}var GA=lp("animationend"),QA=lp("animationiteration"),YA=lp("animationstart"),JA=lp("transitionend"),XA=new Map,fI="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 Is(t,e){XA.set(t,e),Po(e,[t])}for(var ig=0;ig<fI.length;ig++){var sg=fI[ig],YD=sg.toLowerCase(),JD=sg[0].toUpperCase()+sg.slice(1);Is(YD,"on"+JD)}Is(GA,"onAnimationEnd");Is(QA,"onAnimationIteration");Is(YA,"onAnimationStart");Is("dblclick","onDoubleClick");Is("focusin","onFocus");Is("focusout","onBlur");Is(JA,"onTransitionEnd");Na("onMouseEnter",["mouseout","mouseover"]);Na("onMouseLeave",["mouseout","mouseover"]);Na("onPointerEnter",["pointerout","pointerover"]);Na("onPointerLeave",["pointerout","pointerover"]);Po("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Po("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Po("onBeforeInput",["compositionend","keypress","textInput","paste"]);Po("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Po("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Po("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gu="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(" "),XD=new Set("cancel close invalid load scroll toggle".split(" ").concat(gu));function pI(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,YN(r,e,void 0,t),t.currentTarget=null}function ZA(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,u=a.currentTarget;if(a=a.listener,l!==s&&i.isPropagationStopped())break e;pI(i,a,u),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,u=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;pI(i,a,u),s=l}}}if(ef)throw t=oy,ef=!1,oy=null,t}function De(t,e){var n=e[gy];n===void 0&&(n=e[gy]=new Set);var r=t+"__bubble";n.has(r)||(eb(e,t,2,!1),n.add(r))}function og(t,e,n){var r=0;e&&(r|=4),eb(n,t,r,e)}var Kd="_reactListening"+Math.random().toString(36).slice(2);function rc(t){if(!t[Kd]){t[Kd]=!0,aA.forEach(function(n){n!=="selectionchange"&&(XD.has(n)||og(n,!1,t),og(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Kd]||(e[Kd]=!0,og("selectionchange",!1,e))}}function eb(t,e,n,r){switch(MA(e)){case 1:var i=hD;break;case 4:i=fD;break;default:i=lv}n=i.bind(null,e,n,t),i=void 0,!sy||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function ag(t,e,n,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=Ys(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}TA(function(){var u=s,d=iv(n),h=[];e:{var f=XA.get(t);if(f!==void 0){var g=cv,_=t;switch(t){case"keypress":if(Th(n)===0)break e;case"keydown":case"keyup":g=PD;break;case"focusin":_="focus",g=eg;break;case"focusout":_="blur",g=eg;break;case"beforeblur":case"afterblur":g=eg;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=nI;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=gD;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=xD;break;case GA:case QA:case YA:g=vD;break;case JA:g=ND;break;case"scroll":g=pD;break;case"wheel":g=VD;break;case"copy":case"cut":case"paste":g=ED;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=iI}var v=(e&4)!==0,T=!v&&t==="scroll",S=v?f!==null?f+"Capture":null:f;v=[];for(var w=u,E;w!==null;){E=w;var x=E.stateNode;if(E.tag===5&&x!==null&&(E=x,S!==null&&(x=Ju(w,S),x!=null&&v.push(ic(w,x,E)))),T)break;w=w.return}0<v.length&&(f=new g(f,_,null,n,d),h.push({event:f,listeners:v}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",g=t==="mouseout"||t==="pointerout",f&&n!==ry&&(_=n.relatedTarget||n.fromElement)&&(Ys(_)||_[di]))break e;if((g||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,g?(_=n.relatedTarget||n.toElement,g=u,_=_?Ys(_):null,_!==null&&(T=Co(_),_!==T||_.tag!==5&&_.tag!==6)&&(_=null)):(g=null,_=u),g!==_)){if(v=nI,x="onMouseLeave",S="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(v=iI,x="onPointerLeave",S="onPointerEnter",w="pointer"),T=g==null?f:ca(g),E=_==null?f:ca(_),f=new v(x,w+"leave",g,n,d),f.target=T,f.relatedTarget=E,x=null,Ys(d)===u&&(v=new v(S,w+"enter",_,n,d),v.target=E,v.relatedTarget=T,x=v),T=x,g&&_)t:{for(v=g,S=_,w=0,E=v;E;E=zo(E))w++;for(E=0,x=S;x;x=zo(x))E++;for(;0<w-E;)v=zo(v),w--;for(;0<E-w;)S=zo(S),E--;for(;w--;){if(v===S||S!==null&&v===S.alternate)break t;v=zo(v),S=zo(S)}v=null}else v=null;g!==null&&mI(h,f,g,v,!1),_!==null&&T!==null&&mI(h,T,_,v,!0)}}e:{if(f=u?ca(u):window,g=f.nodeName&&f.nodeName.toLowerCase(),g==="select"||g==="input"&&f.type==="file")var O=$D;else if(aI(f))if(zA)O=HD;else{O=WD;var D=zD}else(g=f.nodeName)&&g.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(O=qD);if(O&&(O=O(t,u))){$A(h,O,n,d);break e}D&&D(t,f,u),t==="focusout"&&(D=f._wrapperState)&&D.controlled&&f.type==="number"&&Xg(f,"number",f.value)}switch(D=u?ca(u):window,t){case"focusin":(aI(D)||D.contentEditable==="true")&&(la=D,cy=u,xu=null);break;case"focusout":xu=cy=la=null;break;case"mousedown":dy=!0;break;case"contextmenu":case"mouseup":case"dragend":dy=!1,hI(h,n,d);break;case"selectionchange":if(QD)break;case"keydown":case"keyup":hI(h,n,d)}var A;if(hv)e:{switch(t){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else aa?jA(t,n)&&(I="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(UA&&n.locale!=="ko"&&(aa||I!=="onCompositionStart"?I==="onCompositionEnd"&&aa&&(A=FA()):(Wi=d,uv="value"in Wi?Wi.value:Wi.textContent,aa=!0)),D=of(u,I),0<D.length&&(I=new rI(I,t,null,n,d),h.push({event:I,listeners:D}),A?I.data=A:(A=BA(n),A!==null&&(I.data=A)))),(A=MD?FD(t,n):UD(t,n))&&(u=of(u,"onBeforeInput"),0<u.length&&(d=new rI("onBeforeInput","beforeinput",null,n,d),h.push({event:d,listeners:u}),d.data=A))}ZA(h,e)})}function ic(t,e,n){return{instance:t,listener:e,currentTarget:n}}function of(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Ju(t,n),s!=null&&r.unshift(ic(t,s,i)),s=Ju(t,e),s!=null&&r.push(ic(t,s,i))),t=t.return}return r}function zo(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function mI(t,e,n,r,i){for(var s=e._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&u!==null&&(a=u,i?(l=Ju(n,s),l!=null&&o.unshift(ic(n,l,a))):i||(l=Ju(n,s),l!=null&&o.push(ic(n,l,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var ZD=/\r\n?/g,e2=/\u0000|\uFFFD/g;function gI(t){return(typeof t=="string"?t:""+t).replace(ZD,` `).replace(e2,"")}function Gd(t,e,n){if(e=gI(e),gI(t)!==e&&n)throw Error(W(425))}function af(){}var hy=null,fy=null;function py(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var my=typeof setTimeout=="function"?setTimeout:void 0,t2=typeof clearTimeout=="function"?clearTimeout:void 0,yI=typeof Promise=="function"?Promise:void 0,n2=typeof queueMicrotask=="function"?queueMicrotask:typeof yI<"u"?function(t){return yI.resolve(null).then(t).catch(r2)}:my;function r2(t){setTimeout(function(){throw t})}function lg(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),ec(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);ec(e)}function Xi(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function _I(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var ul=Math.random().toString(36).slice(2),br="__reactFiber$"+ul,sc="__reactProps$"+ul,di="__reactContainer$"+ul,gy="__reactEvents$"+ul,i2="__reactListeners$"+ul,s2="__reactHandles$"+ul;function Ys(t){var e=t[br];if(e)return e;for(var n=t.parentNode;n;){if(e=n[di]||n[br]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=_I(t);t!==null;){if(n=t[br])return n;t=_I(t)}return e}t=n,n=t.parentNode}return null}function Bc(t){return t=t[br]||t[di],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function ca(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(W(33))}function up(t){return t[sc]||null}var yy=[],da=-1;function Ts(t){return{current:t}}function Le(t){0>da||(t.current=yy[da],yy[da]=null,da--)}function xe(t,e){da++,yy[da]=t.current,t.current=e}var as={},Yt=Ts(as),vn=Ts(!1),uo=as;function Da(t,e){var n=t.type.contextTypes;if(!n)return as;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function wn(t){return t=t.childContextTypes,t!=null}function lf(){Le(vn),Le(Yt)}function vI(t,e,n){if(Yt.current!==as)throw Error(W(168));xe(Yt,e),xe(vn,n)}function tb(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(W(108,zN(t)||"Unknown",i));return Qe({},n,r)}function uf(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||as,uo=Yt.current,xe(Yt,t),xe(vn,vn.current),!0}function wI(t,e,n){var r=t.stateNode;if(!r)throw Error(W(169));n?(t=tb(t,e,uo),r.__reactInternalMemoizedMergedChildContext=t,Le(vn),Le(Yt),xe(Yt,t)):Le(vn),xe(vn,n)}var Xr=null,cp=!1,ug=!1;function nb(t){Xr===null?Xr=[t]:Xr.push(t)}function o2(t){cp=!0,nb(t)}function Ss(){if(!ug&&Xr!==null){ug=!0;var t=0,e=Ae;try{var n=Xr;for(Ae=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Xr=null,cp=!1}catch(i){throw Xr!==null&&(Xr=Xr.slice(t+1)),RA(sv,Ss),i}finally{Ae=e,ug=!1}}return null}var ha=[],fa=0,cf=null,df=0,zn=[],Wn=0,co=null,ni=1,ri="";function js(t,e){ha[fa++]=df,ha[fa++]=cf,cf=t,df=e}function rb(t,e,n){zn[Wn++]=ni,zn[Wn++]=ri,zn[Wn++]=co,co=t;var r=ni;t=ri;var i=32-fr(r)-1;r&=~(1<<i),n+=1;var s=32-fr(e)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ni=1<<32-fr(e)+i|n<<i|r,ri=s+t}else ni=1<<s|n<<i|r,ri=t}function pv(t){t.return!==null&&(js(t,1),rb(t,1,0))}function mv(t){for(;t===cf;)cf=ha[--fa],ha[fa]=null,df=ha[--fa],ha[fa]=null;for(;t===co;)co=zn[--Wn],zn[Wn]=null,ri=zn[--Wn],zn[Wn]=null,ni=zn[--Wn],zn[Wn]=null}var Dn=null,On=null,je=!1,hr=null;function ib(t,e){var n=Hn(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function EI(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Dn=t,On=Xi(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Dn=t,On=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=co!==null?{id:ni,overflow:ri}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Hn(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Dn=t,On=null,!0):!1;default:return!1}}function _y(t){return(t.mode&1)!==0&&(t.flags&128)===0}function vy(t){if(je){var e=On;if(e){var n=e;if(!EI(t,e)){if(_y(t))throw Error(W(418));e=Xi(n.nextSibling);var r=Dn;e&&EI(t,e)?ib(r,n):(t.flags=t.flags&-4097|2,je=!1,Dn=t)}}else{if(_y(t))throw Error(W(418));t.flags=t.flags&-4097|2,je=!1,Dn=t}}}function II(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Dn=t}function Qd(t){if(t!==Dn)return!1;if(!je)return II(t),je=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!py(t.type,t.memoizedProps)),e&&(e=On)){if(_y(t))throw sb(),Error(W(418));for(;e;)ib(t,e),e=Xi(e.nextSibling)}if(II(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(W(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){On=Xi(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}On=null}}else On=Dn?Xi(t.stateNode.nextSibling):null;return!0}function sb(){for(var t=On;t;)t=Xi(t.nextSibling)}function Va(){On=Dn=null,je=!1}function gv(t){hr===null?hr=[t]:hr.push(t)}var a2=vi.ReactCurrentBatchConfig;function Yl(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(W(309));var r=n.stateNode}if(!r)throw Error(W(147,t));var i=r,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=i.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof t!="string")throw Error(W(284));if(!n._owner)throw Error(W(290,t))}return t}function Yd(t,e){throw t=Object.prototype.toString.call(e),Error(W(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function TI(t){var e=t._init;return e(t._payload)}function ob(t){function e(S,w){if(t){var E=S.deletions;E===null?(S.deletions=[w],S.flags|=16):E.push(w)}}function n(S,w){if(!t)return null;for(;w!==null;)e(S,w),w=w.sibling;return null}function r(S,w){for(S=new Map;w!==null;)w.key!==null?S.set(w.key,w):S.set(w.index,w),w=w.sibling;return S}function i(S,w){return S=ns(S,w),S.index=0,S.sibling=null,S}function s(S,w,E){return S.index=E,t?(E=S.alternate,E!==null?(E=E.index,E<w?(S.flags|=2,w):E):(S.flags|=2,w)):(S.flags|=1048576,w)}function o(S){return t&&S.alternate===null&&(S.flags|=2),S}function a(S,w,E,x){return w===null||w.tag!==6?(w=gg(E,S.mode,x),w.return=S,w):(w=i(w,E),w.return=S,w)}function l(S,w,E,x){var O=E.type;return O===oa?d(S,w,E.props.children,x,E.key):w!==null&&(w.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===Fi&&TI(O)===w.type)?(x=i(w,E.props),x.ref=Yl(S,w,E),x.return=S,x):(x=kh(E.type,E.key,E.props,null,S.mode,x),x.ref=Yl(S,w,E),x.return=S,x)}function u(S,w,E,x){return w===null||w.tag!==4||w.stateNode.containerInfo!==E.containerInfo||w.stateNode.implementation!==E.implementation?(w=yg(E,S.mode,x),w.return=S,w):(w=i(w,E.children||[]),w.return=S,w)}function d(S,w,E,x,O){return w===null||w.tag!==7?(w=io(E,S.mode,x,O),w.return=S,w):(w=i(w,E),w.return=S,w)}function h(S,w,E){if(typeof w=="string"&&w!==""||typeof w=="number")return w=gg(""+w,S.mode,E),w.return=S,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Ud:return E=kh(w.type,w.key,w.props,null,S.mode,E),E.ref=Yl(S,null,w),E.return=S,E;case sa:return w=yg(w,S.mode,E),w.return=S,w;case Fi:var x=w._init;return h(S,x(w._payload),E)}if(pu(w)||ql(w))return w=io(w,S.mode,E,null),w.return=S,w;Yd(S,w)}return null}function f(S,w,E,x){var O=w!==null?w.key:null;if(typeof E=="string"&&E!==""||typeof E=="number")return O!==null?null:a(S,w,""+E,x);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case Ud:return E.key===O?l(S,w,E,x):null;case sa:return E.key===O?u(S,w,E,x):null;case Fi:return O=E._init,f(S,w,O(E._payload),x)}if(pu(E)||ql(E))return O!==null?null:d(S,w,E,x,null);Yd(S,E)}return null}function g(S,w,E,x,O){if(typeof x=="string"&&x!==""||typeof x=="number")return S=S.get(E)||null,a(w,S,""+x,O);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Ud:return S=S.get(x.key===null?E:x.key)||null,l(w,S,x,O);case sa:return S=S.get(x.key===null?E:x.key)||null,u(w,S,x,O);case Fi:var D=x._init;return g(S,w,E,D(x._payload),O)}if(pu(x)||ql(x))return S=S.get(E)||null,d(w,S,x,O,null);Yd(w,x)}return null}function _(S,w,E,x){for(var O=null,D=null,A=w,I=w=0,m=null;A!==null&&I<E.length;I++){A.index>I?(m=A,A=null):m=A.sibling;var R=f(S,A,E[I],x);if(R===null){A===null&&(A=m);break}t&&A&&R.alternate===null&&e(S,A),w=s(R,w,I),D===null?O=R:D.sibling=R,D=R,A=m}if(I===E.length)return n(S,A),je&&js(S,I),O;if(A===null){for(;I<E.length;I++)A=h(S,E[I],x),A!==null&&(w=s(A,w,I),D===null?O=A:D.sibling=A,D=A);return je&&js(S,I),O}for(A=r(S,A);I<E.length;I++)m=g(A,S,I,E[I],x),m!==null&&(t&&m.alternate!==null&&A.delete(m.key===null?I:m.key),w=s(m,w,I),D===null?O=m:D.sibling=m,D=m);return t&&A.forEach(function(k){return e(S,k)}),je&&js(S,I),O}function v(S,w,E,x){var O=ql(E);if(typeof O!="function")throw Error(W(150));if(E=O.call(E),E==null)throw Error(W(151));for(var D=O=null,A=w,I=w=0,m=null,R=E.next();A!==null&&!R.done;I++,R=E.next()){A.index>I?(m=A,A=null):m=A.sibling;var k=f(S,A,R.value,x);if(k===null){A===null&&(A=m);break}t&&A&&k.alternate===null&&e(S,A),w=s(k,w,I),D===null?O=k:D.sibling=k,D=k,A=m}if(R.done)return n(S,A),je&&js(S,I),O;if(A===null){for(;!R.done;I++,R=E.next())R=h(S,R.value,x),R!==null&&(w=s(R,w,I),D===null?O=R:D.sibling=R,D=R);return je&&js(S,I),O}for(A=r(S,A);!R.done;I++,R=E.next())R=g(A,S,I,R.value,x),R!==null&&(t&&R.alternate!==null&&A.delete(R.key===null?I:R.key),w=s(R,w,I),D===null?O=R:D.sibling=R,D=R);return t&&A.forEach(function(N){return e(S,N)}),je&&js(S,I),O}function T(S,w,E,x){if(typeof E=="object"&&E!==null&&E.type===oa&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case Ud:e:{for(var O=E.key,D=w;D!==null;){if(D.key===O){if(O=E.type,O===oa){if(D.tag===7){n(S,D.sibling),w=i(D,E.props.children),w.return=S,S=w;break e}}else if(D.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===Fi&&TI(O)===D.type){n(S,D.sibling),w=i(D,E.props),w.ref=Yl(S,D,E),w.return=S,S=w;break e}n(S,D);break}else e(S,D);D=D.sibling}E.type===oa?(w=io(E.props.children,S.mode,x,E.key),w.return=S,S=w):(x=kh(E.type,E.key,E.props,null,S.mode,x),x.ref=Yl(S,w,E),x.return=S,S=x)}return o(S);case sa:e:{for(D=E.key;w!==null;){if(w.key===D)if(w.tag===4&&w.stateNode.containerInfo===E.containerInfo&&w.stateNode.implementation===E.implementation){n(S,w.sibling),w=i(w,E.children||[]),w.return=S,S=w;break e}else{n(S,w);break}else e(S,w);w=w.sibling}w=yg(E,S.mode,x),w.return=S,S=w}return o(S);case Fi:return D=E._init,T(S,w,D(E._payload),x)}if(pu(E))return _(S,w,E,x);if(ql(E))return v(S,w,E,x);Yd(S,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,w!==null&&w.tag===6?(n(S,w.sibling),w=i(w,E),w.return=S,S=w):(n(S,w),w=gg(E,S.mode,x),w.return=S,S=w),o(S)):n(S,w)}return T}var La=ob(!0),ab=ob(!1),hf=Ts(null),ff=null,pa=null,yv=null;function _v(){yv=pa=ff=null}function vv(t){var e=hf.current;Le(hf),t._currentValue=e}function wy(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Ta(t,e){ff=t,yv=pa=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(mn=!0),t.firstContext=null)}function Jn(t){var e=t._currentValue;if(yv!==t)if(t={context:t,memoizedValue:e,next:null},pa===null){if(ff===null)throw Error(W(308));pa=t,ff.dependencies={lanes:0,firstContext:t}}else pa=pa.next=t;return e}var Js=null;function wv(t){Js===null?Js=[t]:Js.push(t)}function lb(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,wv(e)):(n.next=i.next,i.next=n),e.interleaved=n,hi(t,r)}function hi(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Ui=!1;function Ev(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ub(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function li(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Zi(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,ye&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,hi(t,n)}return i=r.interleaved,i===null?(e.next=e,wv(r)):(e.next=i.next,i.next=e),r.interleaved=e,hi(t,n)}function Sh(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,ov(t,n)}}function SI(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function pf(t,e,n,r){var i=t.updateQueue;Ui=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(s!==null){var h=i.baseState;o=0,d=u=l=null,a=s;do{var f=a.lane,g=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var _=t,v=a;switch(f=e,g=n,v.tag){case 1:if(_=v.payload,typeof _=="function"){h=_.call(g,h,f);break e}h=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=v.payload,f=typeof _=="function"?_.call(g,h,f):_,f==null)break e;h=Qe({},h,f);break e;case 2:Ui=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else g={eventTime:g,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=g,l=h):d=d.next=g,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(d===null&&(l=h),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=d,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);fo|=o,t.lanes=o,t.memoizedState=h}}function AI(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(W(191,i));i.call(r)}}}var $c={},Mr=Ts($c),oc=Ts($c),ac=Ts($c);function Xs(t){if(t===$c)throw Error(W(174));return t}function Iv(t,e){switch(xe(ac,e),xe(oc,t),xe(Mr,$c),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:ey(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=ey(e,t)}Le(Mr),xe(Mr,e)}function Ma(){Le(Mr),Le(oc),Le(ac)}function cb(t){Xs(ac.current);var e=Xs(Mr.current),n=ey(e,t.type);e!==n&&(xe(oc,t),xe(Mr,n))}function Tv(t){oc.current===t&&(Le(Mr),Le(oc))}var He=Ts(0);function mf(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var cg=[];function Sv(){for(var t=0;t<cg.length;t++)cg[t]._workInProgressVersionPrimary=null;cg.length=0}var Ah=vi.ReactCurrentDispatcher,dg=vi.ReactCurrentBatchConfig,ho=0,Ke=null,wt=null,Rt=null,gf=!1,Ou=!1,lc=0,l2=0;function Wt(){throw Error(W(321))}function Av(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!gr(t[n],e[n]))return!1;return!0}function bv(t,e,n,r,i,s){if(ho=s,Ke=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Ah.current=t===null||t.memoizedState===null?h2:f2,t=n(r,i),Ou){s=0;do{if(Ou=!1,lc=0,25<=s)throw Error(W(301));s+=1,Rt=wt=null,e.updateQueue=null,Ah.current=p2,t=n(r,i)}while(Ou)}if(Ah.current=yf,e=wt!==null&&wt.next!==null,ho=0,Rt=wt=Ke=null,gf=!1,e)throw Error(W(300));return t}function Rv(){var t=lc!==0;return lc=0,t}function Tr(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?Ke.memoizedState=Rt=t:Rt=Rt.next=t,Rt}function Xn(){if(wt===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=wt.next;var e=Rt===null?Ke.memoizedState:Rt.next;if(e!==null)Rt=e,wt=t;else{if(t===null)throw Error(W(310));wt=t,t={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},Rt===null?Ke.memoizedState=Rt=t:Rt=Rt.next=t}return Rt}function uc(t,e){return typeof e=="function"?e(t):e}function hg(t){var e=Xn(),n=e.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=t;var r=wt,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,l=null,u=s;do{var d=u.lane;if((ho&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:t(r,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=h,o=r):l=l.next=h,Ke.lanes|=d,fo|=d}u=u.next}while(u!==null&&u!==s);l===null?o=r:l.next=a,gr(r,e.memoizedState)||(mn=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do s=i.lane,Ke.lanes|=s,fo|=s,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function fg(t){var e=Xn(),n=e.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=t(s,o.action),o=o.next;while(o!==i);gr(s,e.memoizedState)||(mn=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function db(){}function hb(t,e){var n=Ke,r=Xn(),i=e(),s=!gr(r.memoizedState,i);if(s&&(r.memoizedState=i,mn=!0),r=r.queue,Pv(mb.bind(null,n,r,t),[t]),r.getSnapshot!==e||s||Rt!==null&&Rt.memoizedState.tag&1){if(n.flags|=2048,cc(9,pb.bind(null,n,r,i,e),void 0,null),Ct===null)throw Error(W(349));ho&30||fb(n,e,i)}return i}function fb(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Ke.updateQueue,e===null?(e={lastEffect:null,stores:null},Ke.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function pb(t,e,n,r){e.value=n,e.getSnapshot=r,gb(e)&&yb(t)}function mb(t,e,n){return n(function(){gb(e)&&yb(t)})}function gb(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!gr(t,n)}catch{return!0}}function yb(t){var e=hi(t,1);e!==null&&pr(e,t,1,-1)}function bI(t){var e=Tr();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:uc,lastRenderedState:t},e.queue=t,t=t.dispatch=d2.bind(null,Ke,t),[e.memoizedState,t]}function cc(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Ke.updateQueue,e===null?(e={lastEffect:null,stores:null},Ke.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function _b(){return Xn().memoizedState}function bh(t,e,n,r){var i=Tr();Ke.flags|=t,i.memoizedState=cc(1|e,n,void 0,r===void 0?null:r)}function dp(t,e,n,r){var i=Xn();r=r===void 0?null:r;var s=void 0;if(wt!==null){var o=wt.memoizedState;if(s=o.destroy,r!==null&&Av(r,o.deps)){i.memoizedState=cc(e,n,s,r);return}}Ke.flags|=t,i.memoizedState=cc(1|e,n,s,r)}function RI(t,e){return bh(8390656,8,t,e)}function Pv(t,e){return dp(2048,8,t,e)}function vb(t,e){return dp(4,2,t,e)}function wb(t,e){return dp(4,4,t,e)}function Eb(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Ib(t,e,n){return n=n!=null?n.concat([t]):null,dp(4,4,Eb.bind(null,e,t),n)}function Cv(){}function Tb(t,e){var n=Xn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Av(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function Sb(t,e){var n=Xn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Av(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function Ab(t,e,n){return ho&21?(gr(n,e)||(n=kA(),Ke.lanes|=n,fo|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,mn=!0),t.memoizedState=n)}function u2(t,e){var n=Ae;Ae=n!==0&&4>n?n:4,t(!0);var r=dg.transition;dg.transition={};try{t(!1),e()}finally{Ae=n,dg.transition=r}}function bb(){return Xn().memoizedState}function c2(t,e,n){var r=ts(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Rb(t))Pb(e,n);else if(n=lb(t,e,n,r),n!==null){var i=sn();pr(n,t,r,i),Cb(n,e,r)}}function d2(t,e,n){var r=ts(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rb(t))Pb(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,gr(a,o)){var l=e.interleaved;l===null?(i.next=i,wv(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=lb(t,e,i,r),n!==null&&(i=sn(),pr(n,t,r,i),Cb(n,e,r))}}function Rb(t){var e=t.alternate;return t===Ke||e!==null&&e===Ke}function Pb(t,e){Ou=gf=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Cb(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,ov(t,n)}}var yf={readContext:Jn,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useInsertionEffect:Wt,useLayoutEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useMutableSource:Wt,useSyncExternalStore:Wt,useId:Wt,unstable_isNewReconciler:!1},h2={readContext:Jn,useCallback:function(t,e){return Tr().memoizedState=[t,e===void 0?null:e],t},useContext:Jn,useEffect:RI,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,bh(4194308,4,Eb.bind(null,e,t),n)},useLayoutEffect:function(t,e){return bh(4194308,4,t,e)},useInsertionEffect:function(t,e){return bh(4,2,t,e)},useMemo:function(t,e){var n=Tr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Tr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=c2.bind(null,Ke,t),[r.memoizedState,t]},useRef:function(t){var e=Tr();return t={current:t},e.memoizedState=t},useState:bI,useDebugValue:Cv,useDeferredValue:function(t){return Tr().memoizedState=t},useTransition:function(){var t=bI(!1),e=t[0];return t=u2.bind(null,t[1]),Tr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Ke,i=Tr();if(je){if(n===void 0)throw Error(W(407));n=n()}else{if(n=e(),Ct===null)throw Error(W(349));ho&30||fb(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,RI(mb.bind(null,r,s,t),[t]),r.flags|=2048,cc(9,pb.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=Tr(),e=Ct.identifierPrefix;if(je){var n=ri,r=ni;n=(r&~(1<<32-fr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=lc++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=l2++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},f2={readContext:Jn,useCallback:Tb,useContext:Jn,useEffect:Pv,useImperativeHandle:Ib,useInsertionEffect:vb,useLayoutEffect:wb,useMemo:Sb,useReducer:hg,useRef:_b,useState:function(){return hg(uc)},useDebugValue:Cv,useDeferredValue:function(t){var e=Xn();return Ab(e,wt.memoizedState,t)},useTransition:function(){var t=hg(uc)[0],e=Xn().memoizedState;return[t,e]},useMutableSource:db,useSyncExternalStore:hb,useId:bb,unstable_isNewReconciler:!1},p2={readContext:Jn,useCallback:Tb,useContext:Jn,useEffect:Pv,useImperativeHandle:Ib,useInsertionEffect:vb,useLayoutEffect:wb,useMemo:Sb,useReducer:fg,useRef:_b,useState:function(){return fg(uc)},useDebugValue:Cv,useDeferredValue:function(t){var e=Xn();return wt===null?e.memoizedState=t:Ab(e,wt.memoizedState,t)},useTransition:function(){var t=fg(uc)[0],e=Xn().memoizedState;return[t,e]},useMutableSource:db,useSyncExternalStore:hb,useId:bb,unstable_isNewReconciler:!1};function cr(t,e){if(t&&t.defaultProps){e=Qe({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Ey(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Qe({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var hp={isMounted:function(t){return(t=t._reactInternals)?Co(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=sn(),i=ts(t),s=li(r,i);s.payload=e,n!=null&&(s.callback=n),e=Zi(t,s,i),e!==null&&(pr(e,t,i,r),Sh(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=sn(),i=ts(t),s=li(r,i);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=Zi(t,s,i),e!==null&&(pr(e,t,i,r),Sh(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=sn(),r=ts(t),i=li(n,r);i.tag=2,e!=null&&(i.callback=e),e=Zi(t,i,r),e!==null&&(pr(e,t,r,n),Sh(e,t,r))}};function PI(t,e,n,r,i,s,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,s,o):e.prototype&&e.prototype.isPureReactComponent?!nc(n,r)||!nc(i,s):!0}function kb(t,e,n){var r=!1,i=as,s=e.contextType;return typeof s=="object"&&s!==null?s=Jn(s):(i=wn(e)?uo:Yt.current,r=e.contextTypes,s=(r=r!=null)?Da(t,i):as),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=hp,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=s),e}function CI(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&hp.enqueueReplaceState(e,e.state,null)}function Iy(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},Ev(t);var s=e.contextType;typeof s=="object"&&s!==null?i.context=Jn(s):(s=wn(e)?uo:Yt.current,i.context=Da(t,s)),i.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(Ey(t,e,s,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&hp.enqueueReplaceState(i,i.state,null),pf(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function Fa(t,e){try{var n="",r=e;do n+=$N(r),r=r.return;while(r);var i=n}catch(s){i=` Error generating stack: `+s.message+` `+s.stack}return{value:t,source:e,stack:i,digest:null}}function pg(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Ty(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var m2=typeof WeakMap=="function"?WeakMap:Map;function xb(t,e,n){n=li(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){vf||(vf=!0,Ny=r),Ty(t,e)},n}function Ob(t,e,n){n=li(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){Ty(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Ty(t,e),typeof r!="function"&&(es===null?es=new Set([this]):es.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function kI(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new m2;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=C2.bind(null,t,e,n),e.then(t,t))}function xI(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function OI(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=li(-1,1),e.tag=2,Zi(n,e,1))),n.lanes|=1),t)}var g2=vi.ReactCurrentOwner,mn=!1;function tn(t,e,n,r){e.child=t===null?ab(e,null,n,r):La(e,t.child,n,r)}function NI(t,e,n,r,i){n=n.render;var s=e.ref;return Ta(e,i),r=bv(t,e,n,r,s,i),n=Rv(),t!==null&&!mn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,fi(t,e,i)):(je&&n&&pv(e),e.flags|=1,tn(t,e,r,i),e.child)}function DI(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!Mv(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,Nb(t,e,s,r,i)):(t=kh(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:nc,n(o,r)&&t.ref===e.ref)return fi(t,e,i)}return e.flags|=1,t=ns(s,r),t.ref=e.ref,t.return=e,e.child=t}function Nb(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(nc(s,r)&&t.ref===e.ref)if(mn=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(mn=!0);else return e.lanes=t.lanes,fi(t,e,i)}return Sy(t,e,n,r,i)}function Db(t,e,n){var r=e.pendingProps,i=r.children,s=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},xe(ga,Pn),Pn|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,xe(ga,Pn),Pn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,xe(ga,Pn),Pn|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,xe(ga,Pn),Pn|=r;return tn(t,e,i,n),e.child}function Vb(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Sy(t,e,n,r,i){var s=wn(n)?uo:Yt.current;return s=Da(e,s),Ta(e,i),n=bv(t,e,n,r,s,i),r=Rv(),t!==null&&!mn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,fi(t,e,i)):(je&&r&&pv(e),e.flags|=1,tn(t,e,n,i),e.child)}function VI(t,e,n,r,i){if(wn(n)){var s=!0;uf(e)}else s=!1;if(Ta(e,i),e.stateNode===null)Rh(t,e),kb(e,n,r),Iy(e,n,r,i),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Jn(u):(u=wn(n)?uo:Yt.current,u=Da(e,u));var d=n.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==u)&&CI(e,o,r,u),Ui=!1;var f=e.memoizedState;o.state=f,pf(e,r,o,i),l=e.memoizedState,a!==r||f!==l||vn.current||Ui?(typeof d=="function"&&(Ey(e,n,d,r),l=e.memoizedState),(a=Ui||PI(e,n,a,r,f,l,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,ub(t,e),a=e.memoizedProps,u=e.type===e.elementType?a:cr(e.type,a),o.props=u,h=e.pendingProps,f=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Jn(l):(l=wn(n)?uo:Yt.current,l=Da(e,l));var g=n.getDerivedStateFromProps;(d=typeof g=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||f!==l)&&CI(e,o,r,l),Ui=!1,f=e.memoizedState,o.state=f,pf(e,r,o,i);var _=e.memoizedState;a!==h||f!==_||vn.current||Ui?(typeof g=="function"&&(Ey(e,n,g,r),_=e.memoizedState),(u=Ui||PI(e,n,u,r,f,_,l)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,_,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,_,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=_),o.props=r,o.state=_,o.context=l,r=u):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return Ay(t,e,n,r,s,i)}function Ay(t,e,n,r,i,s){Vb(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&wI(e,n,!1),fi(t,e,s);r=e.stateNode,g2.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=La(e,t.child,null,s),e.child=La(e,null,a,s)):tn(t,e,a,s),e.memoizedState=r.state,i&&wI(e,n,!0),e.child}function Lb(t){var e=t.stateNode;e.pendingContext?vI(t,e.pendingContext,e.pendingContext!==e.context):e.context&&vI(t,e.context,!1),Iv(t,e.containerInfo)}function LI(t,e,n,r,i){return Va(),gv(i),e.flags|=256,tn(t,e,n,r),e.child}var by={dehydrated:null,treeContext:null,retryLane:0};function Ry(t){return{baseLanes:t,cachePool:null,transitions:null}}function Mb(t,e,n){var r=e.pendingProps,i=He.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),xe(He,i&1),t===null)return vy(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=mp(o,r,0,null),t=io(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=Ry(n),e.memoizedState=by,t):kv(e,o));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return y2(t,e,o,r,a,i,n);if(s){s=r.fallback,o=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=ns(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=ns(a,s):(s=io(s,o,n,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=t.child.memoizedState,o=o===null?Ry(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~n,e.memoizedState=by,r}return s=t.child,t=s.sibling,r=ns(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function kv(t,e){return e=mp({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Jd(t,e,n,r){return r!==null&&gv(r),La(e,t.child,null,n),t=kv(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function y2(t,e,n,r,i,s,o){if(n)return e.flags&256?(e.flags&=-257,r=pg(Error(W(422))),Jd(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=mp({mode:"visible",children:r.children},i,0,null),s=io(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&La(e,t.child,null,o),e.child.memoizedState=Ry(o),e.memoizedState=by,s);if(!(e.mode&1))return Jd(t,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(W(419)),r=pg(s,r,void 0),Jd(t,e,o,r)}if(a=(o&t.childLanes)!==0,mn||a){if(r=Ct,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,hi(t,i),pr(r,t,i,-1))}return Lv(),r=pg(Error(W(421))),Jd(t,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=k2.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,On=Xi(i.nextSibling),Dn=e,je=!0,hr=null,t!==null&&(zn[Wn++]=ni,zn[Wn++]=ri,zn[Wn++]=co,ni=t.id,ri=t.overflow,co=e),e=kv(e,r.children),e.flags|=4096,e)}function MI(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),wy(t.return,e,n)}function mg(t,e,n,r,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function Fb(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(tn(t,e,r.children,n),r=He.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&MI(t,n,e);else if(t.tag===19)MI(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(xe(He,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&mf(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),mg(e,!1,i,n,s);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&mf(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}mg(e,!0,n,null,s);break;case"together":mg(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Rh(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function fi(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),fo|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(W(153));if(e.child!==null){for(t=e.child,n=ns(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=ns(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function _2(t,e,n){switch(e.tag){case 3:Lb(e),Va();break;case 5:cb(e);break;case 1:wn(e.type)&&uf(e);break;case 4:Iv(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;xe(hf,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(xe(He,He.current&1),e.flags|=128,null):n&e.child.childLanes?Mb(t,e,n):(xe(He,He.current&1),t=fi(t,e,n),t!==null?t.sibling:null);xe(He,He.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return Fb(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),xe(He,He.current),r)break;return null;case 22:case 23:return e.lanes=0,Db(t,e,n)}return fi(t,e,n)}var Ub,Py,jb,Bb;Ub=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Py=function(){};jb=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,Xs(Mr.current);var s=null;switch(n){case"input":i=Yg(t,i),r=Yg(t,r),s=[];break;case"select":i=Qe({},i,{value:void 0}),r=Qe({},r,{value:void 0}),s=[];break;case"textarea":i=Zg(t,i),r=Zg(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=af)}ty(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var a=i[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Qu.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(a=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(s||(s=[]),s.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Qu.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&De("scroll",t),s||a===l||(s=[])):(s=s||[]).push(u,l))}n&&(s=s||[]).push("style",n);var u=s;(e.updateQueue=u)&&(e.flags|=4)}};Bb=function(t,e,n,r){n!==r&&(e.flags|=4)};function Jl(t,e){if(!je)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function qt(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function v2(t,e,n){var r=e.pendingProps;switch(mv(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(e),null;case 1:return wn(e.type)&&lf(),qt(e),null;case 3:return r=e.stateNode,Ma(),Le(vn),Le(Yt),Sv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Qd(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,hr!==null&&(Ly(hr),hr=null))),Py(t,e),qt(e),null;case 5:Tv(e);var i=Xs(ac.current);if(n=e.type,t!==null&&e.stateNode!=null)jb(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(W(166));return qt(e),null}if(t=Xs(Mr.current),Qd(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[br]=e,r[sc]=s,t=(e.mode&1)!==0,n){case"dialog":De("cancel",r),De("close",r);break;case"iframe":case"object":case"embed":De("load",r);break;case"video":case"audio":for(i=0;i<gu.length;i++)De(gu[i],r);break;case"source":De("error",r);break;case"img":case"image":case"link":De("error",r),De("load",r);break;case"details":De("toggle",r);break;case"input":HE(r,s),De("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},De("invalid",r);break;case"textarea":GE(r,s),De("invalid",r)}ty(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Gd(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Gd(r.textContent,a,t),i=["children",""+a]):Qu.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&De("scroll",r)}switch(n){case"input":jd(r),KE(r,s,!0);break;case"textarea":jd(r),QE(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=af)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=mA(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[br]=e,t[sc]=r,Ub(t,e,!1,!1),e.stateNode=t;e:{switch(o=ny(n,r),n){case"dialog":De("cancel",t),De("close",t),i=r;break;case"iframe":case"object":case"embed":De("load",t),i=r;break;case"video":case"audio":for(i=0;i<gu.length;i++)De(gu[i],t);i=r;break;case"source":De("error",t),i=r;break;case"img":case"image":case"link":De("error",t),De("load",t),i=r;break;case"details":De("toggle",t),i=r;break;case"input":HE(t,r),i=Yg(t,r),De("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=Qe({},r,{value:void 0}),De("invalid",t);break;case"textarea":GE(t,r),i=Zg(t,r),De("invalid",t);break;default:i=r}ty(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?_A(t,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&gA(t,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Yu(t,l):typeof l=="number"&&Yu(t,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Qu.hasOwnProperty(s)?l!=null&&s==="onScroll"&&De("scroll",t):l!=null&&ev(t,s,l,o))}switch(n){case"input":jd(t),KE(t,r,!1);break;case"textarea":jd(t),QE(t);break;case"option":r.value!=null&&t.setAttribute("value",""+os(r.value));break;case"select":t.multiple=!!r.multiple,s=r.value,s!=null?va(t,!!r.multiple,s,!1):r.defaultValue!=null&&va(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=af)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return qt(e),null;case 6:if(t&&e.stateNode!=null)Bb(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(W(166));if(n=Xs(ac.current),Xs(Mr.current),Qd(e)){if(r=e.stateNode,n=e.memoizedProps,r[br]=e,(s=r.nodeValue!==n)&&(t=Dn,t!==null))switch(t.tag){case 3:Gd(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Gd(r.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[br]=e,e.stateNode=r}return qt(e),null;case 13:if(Le(He),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(je&&On!==null&&e.mode&1&&!(e.flags&128))sb(),Va(),e.flags|=98560,s=!1;else if(s=Qd(e),r!==null&&r.dehydrated!==null){if(t===null){if(!s)throw Error(W(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(W(317));s[br]=e}else Va(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;qt(e),s=!1}else hr!==null&&(Ly(hr),hr=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||He.current&1?Et===0&&(Et=3):Lv())),e.updateQueue!==null&&(e.flags|=4),qt(e),null);case 4:return Ma(),Py(t,e),t===null&&rc(e.stateNode.containerInfo),qt(e),null;case 10:return vv(e.type._context),qt(e),null;case 17:return wn(e.type)&&lf(),qt(e),null;case 19:if(Le(He),s=e.memoizedState,s===null)return qt(e),null;if(r=(e.flags&128)!==0,o=s.rendering,o===null)if(r)Jl(s,!1);else{if(Et!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=mf(t),o!==null){for(e.flags|=128,Jl(s,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)s=n,t=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,t=o.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return xe(He,He.current&1|2),e.child}t=t.sibling}s.tail!==null&<()>Ua&&(e.flags|=128,r=!0,Jl(s,!1),e.lanes=4194304)}else{if(!r)if(t=mf(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Jl(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!je)return qt(e),null}else 2*lt()-s.renderingStartTime>Ua&&n!==1073741824&&(e.flags|=128,r=!0,Jl(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=lt(),e.sibling=null,n=He.current,xe(He,r?n&1|2:n&1),e):(qt(e),null);case 22:case 23:return Vv(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Pn&1073741824&&(qt(e),e.subtreeFlags&6&&(e.flags|=8192)):qt(e),null;case 24:return null;case 25:return null}throw Error(W(156,e.tag))}function w2(t,e){switch(mv(e),e.tag){case 1:return wn(e.type)&&lf(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ma(),Le(vn),Le(Yt),Sv(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Tv(e),null;case 13:if(Le(He),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(W(340));Va()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Le(He),null;case 4:return Ma(),null;case 10:return vv(e.type._context),null;case 22:case 23:return Vv(),null;case 24:return null;default:return null}}var Xd=!1,Qt=!1,E2=typeof WeakSet=="function"?WeakSet:Set,J=null;function ma(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){tt(t,e,r)}else n.current=null}function Cy(t,e,n){try{n()}catch(r){tt(t,e,r)}}var FI=!1;function I2(t,e){if(hy=rf,t=HA(),fv(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,d=0,h=t,f=null;t:for(;;){for(var g;h!==n||i!==0&&h.nodeType!==3||(a=o+i),h!==s||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(g=h.firstChild)!==null;)f=h,h=g;for(;;){if(h===t)break t;if(f===n&&++u===i&&(a=o),f===s&&++d===r&&(l=o),(g=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=g}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(fy={focusedElem:t,selectionRange:n},rf=!1,J=e;J!==null;)if(e=J,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,J=t;else for(;J!==null;){e=J;try{var _=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(_!==null){var v=_.memoizedProps,T=_.memoizedState,S=e.stateNode,w=S.getSnapshotBeforeUpdate(e.elementType===e.type?v:cr(e.type,v),T);S.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var E=e.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(x){tt(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,J=t;break}J=e.return}return _=FI,FI=!1,_}function Nu(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&Cy(e,n,s)}i=i.next}while(i!==r)}}function fp(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function ky(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function $b(t){var e=t.alternate;e!==null&&(t.alternate=null,$b(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[br],delete e[sc],delete e[gy],delete e[i2],delete e[s2])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function zb(t){return t.tag===5||t.tag===3||t.tag===4}function UI(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||zb(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function xy(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=af));else if(r!==4&&(t=t.child,t!==null))for(xy(t,e,n),t=t.sibling;t!==null;)xy(t,e,n),t=t.sibling}function Oy(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Oy(t,e,n),t=t.sibling;t!==null;)Oy(t,e,n),t=t.sibling}var Vt=null,dr=!1;function ki(t,e,n){for(n=n.child;n!==null;)Wb(t,e,n),n=n.sibling}function Wb(t,e,n){if(Lr&&typeof Lr.onCommitFiberUnmount=="function")try{Lr.onCommitFiberUnmount(sp,n)}catch{}switch(n.tag){case 5:Qt||ma(n,e);case 6:var r=Vt,i=dr;Vt=null,ki(t,e,n),Vt=r,dr=i,Vt!==null&&(dr?(t=Vt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Vt.removeChild(n.stateNode));break;case 18:Vt!==null&&(dr?(t=Vt,n=n.stateNode,t.nodeType===8?lg(t.parentNode,n):t.nodeType===1&&lg(t,n),ec(t)):lg(Vt,n.stateNode));break;case 4:r=Vt,i=dr,Vt=n.stateNode.containerInfo,dr=!0,ki(t,e,n),Vt=r,dr=i;break;case 0:case 11:case 14:case 15:if(!Qt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Cy(n,e,o),i=i.next}while(i!==r)}ki(t,e,n);break;case 1:if(!Qt&&(ma(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){tt(n,e,a)}ki(t,e,n);break;case 21:ki(t,e,n);break;case 22:n.mode&1?(Qt=(r=Qt)||n.memoizedState!==null,ki(t,e,n),Qt=r):ki(t,e,n);break;default:ki(t,e,n)}}function jI(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new E2),e.forEach(function(r){var i=x2.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function ar(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:Vt=a.stateNode,dr=!1;break e;case 3:Vt=a.stateNode.containerInfo,dr=!0;break e;case 4:Vt=a.stateNode.containerInfo,dr=!0;break e}a=a.return}if(Vt===null)throw Error(W(160));Wb(s,o,i),Vt=null,dr=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(u){tt(i,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)qb(e,t),e=e.sibling}function qb(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(ar(e,t),Er(t),r&4){try{Nu(3,t,t.return),fp(3,t)}catch(v){tt(t,t.return,v)}try{Nu(5,t,t.return)}catch(v){tt(t,t.return,v)}}break;case 1:ar(e,t),Er(t),r&512&&n!==null&&ma(n,n.return);break;case 5:if(ar(e,t),Er(t),r&512&&n!==null&&ma(n,n.return),t.flags&32){var i=t.stateNode;try{Yu(i,"")}catch(v){tt(t,t.return,v)}}if(r&4&&(i=t.stateNode,i!=null)){var s=t.memoizedProps,o=n!==null?n.memoizedProps:s,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&fA(i,s),ny(a,o);var u=ny(a,s);for(o=0;o<l.length;o+=2){var d=l[o],h=l[o+1];d==="style"?_A(i,h):d==="dangerouslySetInnerHTML"?gA(i,h):d==="children"?Yu(i,h):ev(i,d,h,u)}switch(a){case"input":Jg(i,s);break;case"textarea":pA(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var g=s.value;g!=null?va(i,!!s.multiple,g,!1):f!==!!s.multiple&&(s.defaultValue!=null?va(i,!!s.multiple,s.defaultValue,!0):va(i,!!s.multiple,s.multiple?[]:"",!1))}i[sc]=s}catch(v){tt(t,t.return,v)}}break;case 6:if(ar(e,t),Er(t),r&4){if(t.stateNode===null)throw Error(W(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(v){tt(t,t.return,v)}}break;case 3:if(ar(e,t),Er(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ec(e.containerInfo)}catch(v){tt(t,t.return,v)}break;case 4:ar(e,t),Er(t);break;case 13:ar(e,t),Er(t),i=t.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Nv=lt())),r&4&&jI(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(Qt=(u=Qt)||d,ar(e,t),Qt=u):ar(e,t),Er(t),r&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!d&&t.mode&1)for(J=t,d=t.child;d!==null;){for(h=J=d;J!==null;){switch(f=J,g=f.child,f.tag){case 0:case 11:case 14:case 15:Nu(4,f,f.return);break;case 1:ma(f,f.return);var _=f.stateNode;if(typeof _.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,_.props=e.memoizedProps,_.state=e.memoizedState,_.componentWillUnmount()}catch(v){tt(r,n,v)}}break;case 5:ma(f,f.return);break;case 22:if(f.memoizedState!==null){$I(h);continue}}g!==null?(g.return=f,J=g):$I(h)}d=d.sibling}e:for(d=null,h=t;;){if(h.tag===5){if(d===null){d=h;try{i=h.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=h.stateNode,l=h.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=yA("display",o))}catch(v){tt(t,t.return,v)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(v){tt(t,t.return,v)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:ar(e,t),Er(t),r&4&&jI(t);break;case 21:break;default:ar(e,t),Er(t)}}function Er(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(zb(n)){var r=n;break e}n=n.return}throw Error(W(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Yu(i,""),r.flags&=-33);var s=UI(t);Oy(t,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=UI(t);xy(t,a,o);break;default:throw Error(W(161))}}catch(l){tt(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function T2(t,e,n){J=t,Hb(t)}function Hb(t,e,n){for(var r=(t.mode&1)!==0;J!==null;){var i=J,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Xd;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||Qt;a=Xd;var u=Qt;if(Xd=o,(Qt=l)&&!u)for(J=i;J!==null;)o=J,l=o.child,o.tag===22&&o.memoizedState!==null?zI(i):l!==null?(l.return=o,J=l):zI(i);for(;s!==null;)J=s,Hb(s),s=s.sibling;J=i,Xd=a,Qt=u}BI(t)}else i.subtreeFlags&8772&&s!==null?(s.return=i,J=s):BI(t)}}function BI(t){for(;J!==null;){var e=J;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Qt||fp(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Qt)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:cr(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&AI(e,s,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}AI(e,o,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&ec(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}Qt||e.flags&512&&ky(e)}catch(f){tt(e,e.return,f)}}if(e===t){J=null;break}if(n=e.sibling,n!==null){n.return=e.return,J=n;break}J=e.return}}function $I(t){for(;J!==null;){var e=J;if(e===t){J=null;break}var n=e.sibling;if(n!==null){n.return=e.return,J=n;break}J=e.return}}function zI(t){for(;J!==null;){var e=J;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{fp(4,e)}catch(l){tt(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){tt(e,i,l)}}var s=e.return;try{ky(e)}catch(l){tt(e,s,l)}break;case 5:var o=e.return;try{ky(e)}catch(l){tt(e,o,l)}}}catch(l){tt(e,e.return,l)}if(e===t){J=null;break}var a=e.sibling;if(a!==null){a.return=e.return,J=a;break}J=e.return}}var S2=Math.ceil,_f=vi.ReactCurrentDispatcher,xv=vi.ReactCurrentOwner,Qn=vi.ReactCurrentBatchConfig,ye=0,Ct=null,yt=null,Ut=0,Pn=0,ga=Ts(0),Et=0,dc=null,fo=0,pp=0,Ov=0,Du=null,pn=null,Nv=0,Ua=1/0,Jr=null,vf=!1,Ny=null,es=null,Zd=!1,qi=null,wf=0,Vu=0,Dy=null,Ph=-1,Ch=0;function sn(){return ye&6?lt():Ph!==-1?Ph:Ph=lt()}function ts(t){return t.mode&1?ye&2&&Ut!==0?Ut&-Ut:a2.transition!==null?(Ch===0&&(Ch=kA()),Ch):(t=Ae,t!==0||(t=window.event,t=t===void 0?16:MA(t.type)),t):1}function pr(t,e,n,r){if(50<Vu)throw Vu=0,Dy=null,Error(W(185));Uc(t,n,r),(!(ye&2)||t!==Ct)&&(t===Ct&&(!(ye&2)&&(pp|=n),Et===4&&Bi(t,Ut)),En(t,r),n===1&&ye===0&&!(e.mode&1)&&(Ua=lt()+500,cp&&Ss()))}function En(t,e){var n=t.callbackNode;aD(t,e);var r=nf(t,t===Ct?Ut:0);if(r===0)n!==null&&XE(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&XE(n),e===1)t.tag===0?o2(WI.bind(null,t)):nb(WI.bind(null,t)),n2(function(){!(ye&6)&&Ss()}),n=null;else{switch(xA(r)){case 1:n=sv;break;case 4:n=PA;break;case 16:n=tf;break;case 536870912:n=CA;break;default:n=tf}n=eR(n,Kb.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function Kb(t,e){if(Ph=-1,Ch=0,ye&6)throw Error(W(327));var n=t.callbackNode;if(Sa()&&t.callbackNode!==n)return null;var r=nf(t,t===Ct?Ut:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Ef(t,r);else{e=r;var i=ye;ye|=2;var s=Qb();(Ct!==t||Ut!==e)&&(Jr=null,Ua=lt()+500,ro(t,e));do try{R2();break}catch(a){Gb(t,a)}while(!0);_v(),_f.current=s,ye=i,yt!==null?e=0:(Ct=null,Ut=0,e=Et)}if(e!==0){if(e===2&&(i=ay(t),i!==0&&(r=i,e=Vy(t,i))),e===1)throw n=dc,ro(t,0),Bi(t,r),En(t,lt()),n;if(e===6)Bi(t,r);else{if(i=t.current.alternate,!(r&30)&&!A2(i)&&(e=Ef(t,r),e===2&&(s=ay(t),s!==0&&(r=s,e=Vy(t,s))),e===1))throw n=dc,ro(t,0),Bi(t,r),En(t,lt()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(W(345));case 2:Bs(t,pn,Jr);break;case 3:if(Bi(t,r),(r&130023424)===r&&(e=Nv+500-lt(),10<e)){if(nf(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){sn(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=my(Bs.bind(null,t,pn,Jr),e);break}Bs(t,pn,Jr);break;case 4:if(Bi(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var o=31-fr(r);s=1<<o,o=e[o],o>i&&(i=o),r&=~s}if(r=i,r=lt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*S2(r/1960))-r,10<r){t.timeoutHandle=my(Bs.bind(null,t,pn,Jr),r);break}Bs(t,pn,Jr);break;case 5:Bs(t,pn,Jr);break;default:throw Error(W(329))}}}return En(t,lt()),t.callbackNode===n?Kb.bind(null,t):null}function Vy(t,e){var n=Du;return t.current.memoizedState.isDehydrated&&(ro(t,e).flags|=256),t=Ef(t,e),t!==2&&(e=pn,pn=n,e!==null&&Ly(e)),t}function Ly(t){pn===null?pn=t:pn.push.apply(pn,t)}function A2(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!gr(s(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Bi(t,e){for(e&=~Ov,e&=~pp,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-fr(e),r=1<<n;t[n]=-1,e&=~r}}function WI(t){if(ye&6)throw Error(W(327));Sa();var e=nf(t,0);if(!(e&1))return En(t,lt()),null;var n=Ef(t,e);if(t.tag!==0&&n===2){var r=ay(t);r!==0&&(e=r,n=Vy(t,r))}if(n===1)throw n=dc,ro(t,0),Bi(t,e),En(t,lt()),n;if(n===6)throw Error(W(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Bs(t,pn,Jr),En(t,lt()),null}function Dv(t,e){var n=ye;ye|=1;try{return t(e)}finally{ye=n,ye===0&&(Ua=lt()+500,cp&&Ss())}}function po(t){qi!==null&&qi.tag===0&&!(ye&6)&&Sa();var e=ye;ye|=1;var n=Qn.transition,r=Ae;try{if(Qn.transition=null,Ae=1,t)return t()}finally{Ae=r,Qn.transition=n,ye=e,!(ye&6)&&Ss()}}function Vv(){Pn=ga.current,Le(ga)}function ro(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,t2(n)),yt!==null)for(n=yt.return;n!==null;){var r=n;switch(mv(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&lf();break;case 3:Ma(),Le(vn),Le(Yt),Sv();break;case 5:Tv(r);break;case 4:Ma();break;case 13:Le(He);break;case 19:Le(He);break;case 10:vv(r.type._context);break;case 22:case 23:Vv()}n=n.return}if(Ct=t,yt=t=ns(t.current,null),Ut=Pn=e,Et=0,dc=null,Ov=pp=fo=0,pn=Du=null,Js!==null){for(e=0;e<Js.length;e++)if(n=Js[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}Js=null}return t}function Gb(t,e){do{var n=yt;try{if(_v(),Ah.current=yf,gf){for(var r=Ke.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}gf=!1}if(ho=0,Rt=wt=Ke=null,Ou=!1,lc=0,xv.current=null,n===null||n.return===null){Et=1,dc=e,yt=null;break}e:{var s=t,o=n.return,a=n,l=e;if(e=Ut,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,d=a,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 g=xI(o);if(g!==null){g.flags&=-257,OI(g,o,a,s,e),g.mode&1&&kI(s,u,e),e=g,l=u;var _=e.updateQueue;if(_===null){var v=new Set;v.add(l),e.updateQueue=v}else _.add(l);break e}else{if(!(e&1)){kI(s,u,e),Lv();break e}l=Error(W(426))}}else if(je&&a.mode&1){var T=xI(o);if(T!==null){!(T.flags&65536)&&(T.flags|=256),OI(T,o,a,s,e),gv(Fa(l,a));break e}}s=l=Fa(l,a),Et!==4&&(Et=2),Du===null?Du=[s]:Du.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var S=xb(s,l,e);SI(s,S);break e;case 1:a=l;var w=s.type,E=s.stateNode;if(!(s.flags&128)&&(typeof w.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(es===null||!es.has(E)))){s.flags|=65536,e&=-e,s.lanes|=e;var x=Ob(s,a,e);SI(s,x);break e}}s=s.return}while(s!==null)}Jb(n)}catch(O){e=O,yt===n&&n!==null&&(yt=n=n.return);continue}break}while(!0)}function Qb(){var t=_f.current;return _f.current=yf,t===null?yf:t}function Lv(){(Et===0||Et===3||Et===2)&&(Et=4),Ct===null||!(fo&268435455)&&!(pp&268435455)||Bi(Ct,Ut)}function Ef(t,e){var n=ye;ye|=2;var r=Qb();(Ct!==t||Ut!==e)&&(Jr=null,ro(t,e));do try{b2();break}catch(i){Gb(t,i)}while(!0);if(_v(),ye=n,_f.current=r,yt!==null)throw Error(W(261));return Ct=null,Ut=0,Et}function b2(){for(;yt!==null;)Yb(yt)}function R2(){for(;yt!==null&&!XN();)Yb(yt)}function Yb(t){var e=Zb(t.alternate,t,Pn);t.memoizedProps=t.pendingProps,e===null?Jb(t):yt=e,xv.current=null}function Jb(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=w2(n,e),n!==null){n.flags&=32767,yt=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Et=6,yt=null;return}}else if(n=v2(n,e,Pn),n!==null){yt=n;return}if(e=e.sibling,e!==null){yt=e;return}yt=e=t}while(e!==null);Et===0&&(Et=5)}function Bs(t,e,n){var r=Ae,i=Qn.transition;try{Qn.transition=null,Ae=1,P2(t,e,n,r)}finally{Qn.transition=i,Ae=r}return null}function P2(t,e,n,r){do Sa();while(qi!==null);if(ye&6)throw Error(W(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(W(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(lD(t,s),t===Ct&&(yt=Ct=null,Ut=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Zd||(Zd=!0,eR(tf,function(){return Sa(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=Qn.transition,Qn.transition=null;var o=Ae;Ae=1;var a=ye;ye|=4,xv.current=null,I2(t,n),qb(n,t),GD(fy),rf=!!hy,fy=hy=null,t.current=n,T2(n),ZN(),ye=a,Ae=o,Qn.transition=s}else t.current=n;if(Zd&&(Zd=!1,qi=t,wf=i),s=t.pendingLanes,s===0&&(es=null),nD(n.stateNode),En(t,lt()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(vf)throw vf=!1,t=Ny,Ny=null,t;return wf&1&&t.tag!==0&&Sa(),s=t.pendingLanes,s&1?t===Dy?Vu++:(Vu=0,Dy=t):Vu=0,Ss(),null}function Sa(){if(qi!==null){var t=xA(wf),e=Qn.transition,n=Ae;try{if(Qn.transition=null,Ae=16>t?16:t,qi===null)var r=!1;else{if(t=qi,qi=null,wf=0,ye&6)throw Error(W(331));var i=ye;for(ye|=4,J=t.current;J!==null;){var s=J,o=s.child;if(J.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(J=u;J!==null;){var d=J;switch(d.tag){case 0:case 11:case 15:Nu(8,d,s)}var h=d.child;if(h!==null)h.return=d,J=h;else for(;J!==null;){d=J;var f=d.sibling,g=d.return;if($b(d),d===u){J=null;break}if(f!==null){f.return=g,J=f;break}J=g}}}var _=s.alternate;if(_!==null){var v=_.child;if(v!==null){_.child=null;do{var T=v.sibling;v.sibling=null,v=T}while(v!==null)}}J=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,J=o;else e:for(;J!==null;){if(s=J,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Nu(9,s,s.return)}var S=s.sibling;if(S!==null){S.return=s.return,J=S;break e}J=s.return}}var w=t.current;for(J=w;J!==null;){o=J;var E=o.child;if(o.subtreeFlags&2064&&E!==null)E.return=o,J=E;else e:for(o=w;J!==null;){if(a=J,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:fp(9,a)}}catch(O){tt(a,a.return,O)}if(a===o){J=null;break e}var x=a.sibling;if(x!==null){x.return=a.return,J=x;break e}J=a.return}}if(ye=i,Ss(),Lr&&typeof Lr.onPostCommitFiberRoot=="function")try{Lr.onPostCommitFiberRoot(sp,t)}catch{}r=!0}return r}finally{Ae=n,Qn.transition=e}}return!1}function qI(t,e,n){e=Fa(n,e),e=xb(t,e,1),t=Zi(t,e,1),e=sn(),t!==null&&(Uc(t,1,e),En(t,e))}function tt(t,e,n){if(t.tag===3)qI(t,t,n);else for(;e!==null;){if(e.tag===3){qI(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(es===null||!es.has(r))){t=Fa(n,t),t=Ob(e,t,1),e=Zi(e,t,1),t=sn(),e!==null&&(Uc(e,1,t),En(e,t));break}}e=e.return}}function C2(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=sn(),t.pingedLanes|=t.suspendedLanes&n,Ct===t&&(Ut&n)===n&&(Et===4||Et===3&&(Ut&130023424)===Ut&&500>lt()-Nv?ro(t,0):Ov|=n),En(t,e)}function Xb(t,e){e===0&&(t.mode&1?(e=zd,zd<<=1,!(zd&130023424)&&(zd=4194304)):e=1);var n=sn();t=hi(t,e),t!==null&&(Uc(t,e,n),En(t,n))}function k2(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Xb(t,n)}function x2(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(e),Xb(t,n)}var Zb;Zb=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||vn.current)mn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return mn=!1,_2(t,e,n);mn=!!(t.flags&131072)}else mn=!1,je&&e.flags&1048576&&rb(e,df,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Rh(t,e),t=e.pendingProps;var i=Da(e,Yt.current);Ta(e,n),i=bv(null,e,r,t,i,n);var s=Rv();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,wn(r)?(s=!0,uf(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ev(e),i.updater=hp,e.stateNode=i,i._reactInternals=e,Iy(e,r,t,n),e=Ay(null,e,r,!0,s,n)):(e.tag=0,je&&s&&pv(e),tn(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Rh(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=N2(r),t=cr(r,t),i){case 0:e=Sy(null,e,r,t,n);break e;case 1:e=VI(null,e,r,t,n);break e;case 11:e=NI(null,e,r,t,n);break e;case 14:e=DI(null,e,r,cr(r.type,t),n);break e}throw Error(W(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:cr(r,i),Sy(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:cr(r,i),VI(t,e,r,i,n);case 3:e:{if(Lb(e),t===null)throw Error(W(387));r=e.pendingProps,s=e.memoizedState,i=s.element,ub(t,e),pf(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Fa(Error(W(423)),e),e=LI(t,e,r,n,i);break e}else if(r!==i){i=Fa(Error(W(424)),e),e=LI(t,e,r,n,i);break e}else for(On=Xi(e.stateNode.containerInfo.firstChild),Dn=e,je=!0,hr=null,n=ab(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Va(),r===i){e=fi(t,e,n);break e}tn(t,e,r,n)}e=e.child}return e;case 5:return cb(e),t===null&&vy(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,py(r,i)?o=null:s!==null&&py(r,s)&&(e.flags|=32),Vb(t,e),tn(t,e,o,n),e.child;case 6:return t===null&&vy(e),null;case 13:return Mb(t,e,n);case 4:return Iv(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=La(e,null,r,n):tn(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:cr(r,i),NI(t,e,r,i,n);case 7:return tn(t,e,e.pendingProps,n),e.child;case 8:return tn(t,e,e.pendingProps.children,n),e.child;case 12:return tn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,xe(hf,r._currentValue),r._currentValue=o,s!==null)if(gr(s.value,o)){if(s.children===i.children&&!vn.current){e=fi(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=li(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),wy(s.return,n,e),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(W(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),wy(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}tn(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Ta(e,n),i=Jn(i),r=r(i),e.flags|=1,tn(t,e,r,n),e.child;case 14:return r=e.type,i=cr(r,e.pendingProps),i=cr(r.type,i),DI(t,e,r,i,n);case 15:return Nb(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:cr(r,i),Rh(t,e),e.tag=1,wn(r)?(t=!0,uf(e)):t=!1,Ta(e,n),kb(e,r,i),Iy(e,r,i,n),Ay(null,e,r,!0,t,n);case 19:return Fb(t,e,n);case 22:return Db(t,e,n)}throw Error(W(156,e.tag))};function eR(t,e){return RA(t,e)}function O2(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hn(t,e,n,r){return new O2(t,e,n,r)}function Mv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function N2(t){if(typeof t=="function")return Mv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===nv)return 11;if(t===rv)return 14}return 2}function ns(t,e){var n=t.alternate;return n===null?(n=Hn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function kh(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")Mv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case oa:return io(n.children,i,s,e);case tv:o=8,i|=8;break;case Hg:return t=Hn(12,n,e,i|2),t.elementType=Hg,t.lanes=s,t;case Kg:return t=Hn(13,n,e,i),t.elementType=Kg,t.lanes=s,t;case Gg:return t=Hn(19,n,e,i),t.elementType=Gg,t.lanes=s,t;case cA:return mp(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case lA:o=10;break e;case uA:o=9;break e;case nv:o=11;break e;case rv:o=14;break e;case Fi:o=16,r=null;break e}throw Error(W(130,t==null?t:typeof t,""))}return e=Hn(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function io(t,e,n,r){return t=Hn(7,t,r,e),t.lanes=n,t}function mp(t,e,n,r){return t=Hn(22,t,r,e),t.elementType=cA,t.lanes=n,t.stateNode={isHidden:!1},t}function gg(t,e,n){return t=Hn(6,t,null,e),t.lanes=n,t}function yg(t,e,n){return e=Hn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function D2(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jm(0),this.expirationTimes=Jm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jm(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Fv(t,e,n,r,i,s,o,a,l){return t=new D2(t,e,n,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Hn(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ev(s),t}function V2(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:sa,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function tR(t){if(!t)return as;t=t._reactInternals;e:{if(Co(t)!==t||t.tag!==1)throw Error(W(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(wn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(W(171))}if(t.tag===1){var n=t.type;if(wn(n))return tb(t,n,e)}return e}function nR(t,e,n,r,i,s,o,a,l){return t=Fv(n,r,!0,t,i,s,o,a,l),t.context=tR(null),n=t.current,r=sn(),i=ts(n),s=li(r,i),s.callback=e??null,Zi(n,s,i),t.current.lanes=i,Uc(t,i,r),En(t,r),t}function gp(t,e,n,r){var i=e.current,s=sn(),o=ts(i);return n=tR(n),e.context===null?e.context=n:e.pendingContext=n,e=li(s,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=Zi(i,e,o),t!==null&&(pr(t,i,o,s),Sh(t,i,o)),o}function If(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function HI(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Uv(t,e){HI(t,e),(t=t.alternate)&&HI(t,e)}function L2(){return null}var rR=typeof reportError=="function"?reportError:function(t){console.error(t)};function jv(t){this._internalRoot=t}yp.prototype.render=jv.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(W(409));gp(t,e,null,null)};yp.prototype.unmount=jv.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;po(function(){gp(null,t,null,null)}),e[di]=null}};function yp(t){this._internalRoot=t}yp.prototype.unstable_scheduleHydration=function(t){if(t){var e=DA();t={blockedOn:null,target:t,priority:e};for(var n=0;n<ji.length&&e!==0&&e<ji[n].priority;n++);ji.splice(n,0,t),n===0&&LA(t)}};function Bv(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function _p(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function KI(){}function M2(t,e,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=If(o);s.call(u)}}var o=nR(e,r,t,0,null,!1,!1,"",KI);return t._reactRootContainer=o,t[di]=o.current,rc(t.nodeType===8?t.parentNode:t),po(),o}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var u=If(l);a.call(u)}}var l=Fv(t,0,!1,null,null,!1,!1,"",KI);return t._reactRootContainer=l,t[di]=l.current,rc(t.nodeType===8?t.parentNode:t),po(function(){gp(e,l,n,r)}),l}function vp(t,e,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=If(o);a.call(l)}}gp(e,o,t,i)}else o=M2(n,e,t,i,r);return If(o)}OA=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=mu(e.pendingLanes);n!==0&&(ov(e,n|1),En(e,lt()),!(ye&6)&&(Ua=lt()+500,Ss()))}break;case 13:po(function(){var r=hi(t,1);if(r!==null){var i=sn();pr(r,t,1,i)}}),Uv(t,1)}};av=function(t){if(t.tag===13){var e=hi(t,134217728);if(e!==null){var n=sn();pr(e,t,134217728,n)}Uv(t,134217728)}};NA=function(t){if(t.tag===13){var e=ts(t),n=hi(t,e);if(n!==null){var r=sn();pr(n,t,e,r)}Uv(t,e)}};DA=function(){return Ae};VA=function(t,e){var n=Ae;try{return Ae=t,e()}finally{Ae=n}};iy=function(t,e,n){switch(e){case"input":if(Jg(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=up(r);if(!i)throw Error(W(90));hA(r),Jg(r,i)}}}break;case"textarea":pA(t,n);break;case"select":e=n.value,e!=null&&va(t,!!n.multiple,e,!1)}};EA=Dv;IA=po;var F2={usingClientEntryPoint:!1,Events:[Bc,ca,up,vA,wA,Dv]},Xl={findFiberByHostInstance:Ys,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},U2={bundleType:Xl.bundleType,version:Xl.version,rendererPackageName:Xl.rendererPackageName,rendererConfig:Xl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:vi.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=AA(t),t===null?null:t.stateNode},findFiberByHostInstance:Xl.findFiberByHostInstance||L2,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 eh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!eh.isDisabled&&eh.supportsFiber)try{sp=eh.inject(U2),Lr=eh}catch{}}jn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F2;jn.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bv(e))throw Error(W(200));return V2(t,e,null,n)};jn.createRoot=function(t,e){if(!Bv(t))throw Error(W(299));var n=!1,r="",i=rR;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=Fv(t,1,!1,null,null,n,!1,r,i),t[di]=e.current,rc(t.nodeType===8?t.parentNode:t),new jv(e)};jn.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(W(188)):(t=Object.keys(t).join(","),Error(W(268,t)));return t=AA(e),t=t===null?null:t.stateNode,t};jn.flushSync=function(t){return po(t)};jn.hydrate=function(t,e,n){if(!_p(e))throw Error(W(200));return vp(null,t,e,!0,n)};jn.hydrateRoot=function(t,e,n){if(!Bv(t))throw Error(W(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=rR;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=nR(e,null,t,1,n??null,i,!1,s,o),t[di]=e.current,rc(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new yp(e)};jn.render=function(t,e,n){if(!_p(e))throw Error(W(200));return vp(null,t,e,!1,n)};jn.unmountComponentAtNode=function(t){if(!_p(t))throw Error(W(40));return t._reactRootContainer?(po(function(){vp(null,null,t,!1,function(){t._reactRootContainer=null,t[di]=null})}),!0):!1};jn.unstable_batchedUpdates=Dv;jn.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!_p(n))throw Error(W(200));if(t==null||t._reactInternals===void 0)throw Error(W(38));return vp(t,e,n,!1,r)};jn.version="18.3.1-next-f1338f8080-20240426";function iR(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(iR)}catch(t){console.error(t)}}iR(),iA.exports=jn;var j2=iA.exports,sR,GI=j2;sR=GI.createRoot,GI.hydrateRoot;/** * @remix-run/router v1.19.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function hc(){return hc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},hc.apply(this,arguments)}var Hi;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Hi||(Hi={}));const QI="popstate";function B2(t){t===void 0&&(t={});function e(r,i){let{pathname:s,search:o,hash:a}=r.location;return My("",{pathname:s,search:o,hash:a},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:Tf(i)}return z2(e,n,null,t)}function _t(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function oR(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function $2(){return Math.random().toString(36).substr(2,8)}function YI(t,e){return{usr:t.state,key:t.key,idx:e}}function My(t,e,n,r){return n===void 0&&(n=null),hc({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?cl(e):e,{state:n,key:e&&e.key||r||$2()})}function Tf(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function cl(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function z2(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a=Hi.Pop,l=null,u=d();u==null&&(u=0,o.replaceState(hc({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function h(){a=Hi.Pop;let T=d(),S=T==null?null:T-u;u=T,l&&l({action:a,location:v.location,delta:S})}function f(T,S){a=Hi.Push;let w=My(v.location,T,S);u=d()+1;let E=YI(w,u),x=v.createHref(w);try{o.pushState(E,"",x)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;i.location.assign(x)}s&&l&&l({action:a,location:v.location,delta:1})}function g(T,S){a=Hi.Replace;let w=My(v.location,T,S);u=d();let E=YI(w,u),x=v.createHref(w);o.replaceState(E,"",x),s&&l&&l({action:a,location:v.location,delta:0})}function _(T){let S=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof T=="string"?T:Tf(T);return w=w.replace(/ $/,"%20"),_t(S,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,S)}let v={get action(){return a},get location(){return t(i,o)},listen(T){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(QI,h),l=T,()=>{i.removeEventListener(QI,h),l=null}},createHref(T){return e(i,T)},createURL:_,encodeLocation(T){let S=_(T);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:f,replace:g,go(T){return o.go(T)}};return v}var JI;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(JI||(JI={}));function W2(t,e,n){return n===void 0&&(n="/"),q2(t,e,n,!1)}function q2(t,e,n,r){let i=typeof e=="string"?cl(e):e,s=$v(i.pathname||"/",n);if(s==null)return null;let o=aR(t);H2(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let u=rV(s);a=tV(o[l],u,r)}return a}function aR(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(s,o,a)=>{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(_t(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=rs([r,l.relativePath]),d=n.concat(l);s.children&&s.children.length>0&&(_t(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),aR(s.children,e,d,u)),!(s.path==null&&!s.index)&&e.push({path:u,score:Z2(u,s.index),routesMeta:d})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of lR(s.path))i(s,o,l)}),e}function lR(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=lR(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function H2(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:eV(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const K2=/^:[\w-]+$/,G2=3,Q2=2,Y2=1,J2=10,X2=-2,XI=t=>t==="*";function Z2(t,e){let n=t.split("/"),r=n.length;return n.some(XI)&&(r+=X2),e&&(r+=Q2),n.filter(i=>!XI(i)).reduce((i,s)=>i+(K2.test(s)?G2:s===""?Y2:J2),r)}function eV(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function tV(t,e,n){let{routesMeta:r}=t,i={},s="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],u=a===r.length-1,d=s==="/"?e:e.slice(s.length)||"/",h=ZI({path:l.relativePath,caseSensitive:l.caseSensitive,end:u},d),f=l.route;if(!h&&u&&n&&!r[r.length-1].route.index&&(h=ZI({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!h)return null;Object.assign(i,h.params),o.push({params:i,pathname:rs([s,h.pathname]),pathnameBase:aV(rs([s,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(s=rs([s,h.pathnameBase]))}return o}function ZI(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=nV(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((u,d,h)=>{let{paramName:f,isOptional:g}=d;if(f==="*"){let v=a[h]||"";o=s.slice(0,s.length-v.length).replace(/(.)\/+$/,"$1")}const _=a[h];return g&&!_?u[f]=void 0:u[f]=(_||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:t}}function nV(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),oR(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function rV(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return oR(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function $v(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function iV(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?cl(t):t;return{pathname:n?n.startsWith("/")?n:sV(n,e):e,search:lV(r),hash:uV(i)}}function sV(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function _g(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function oV(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function uR(t,e){let n=oV(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function cR(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=cl(t):(i=hc({},t),_t(!i.pathname||!i.pathname.includes("?"),_g("?","pathname","search",i)),_t(!i.pathname||!i.pathname.includes("#"),_g("#","pathname","hash",i)),_t(!i.search||!i.search.includes("#"),_g("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let h=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;i.pathname=f.join("/")}a=h>=0?e[h]:"/"}let l=iV(i,a),u=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const rs=t=>t.join("/").replace(/\/\/+/g,"/"),aV=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),lV=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,uV=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function cV(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const dR=["post","put","patch","delete"];new Set(dR);const dV=["get",...dR];new Set(dV);/** * React Router v6.26.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function fc(){return fc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},fc.apply(this,arguments)}const zv=F.createContext(null),hV=F.createContext(null),ko=F.createContext(null),wp=F.createContext(null),As=F.createContext({outlet:null,matches:[],isDataRoute:!1}),hR=F.createContext(null);function fV(t,e){let{relative:n}=e===void 0?{}:e;zc()||_t(!1);let{basename:r,navigator:i}=F.useContext(ko),{hash:s,pathname:o,search:a}=mR(t,{relative:n}),l=o;return r!=="/"&&(l=o==="/"?r:rs([r,o])),i.createHref({pathname:l,search:a,hash:s})}function zc(){return F.useContext(wp)!=null}function Wc(){return zc()||_t(!1),F.useContext(wp).location}function fR(t){F.useContext(ko).static||F.useLayoutEffect(t)}function Ep(){let{isDataRoute:t}=F.useContext(As);return t?bV():pV()}function pV(){zc()||_t(!1);let t=F.useContext(zv),{basename:e,future:n,navigator:r}=F.useContext(ko),{matches:i}=F.useContext(As),{pathname:s}=Wc(),o=JSON.stringify(uR(i,n.v7_relativeSplatPath)),a=F.useRef(!1);return fR(()=>{a.current=!0}),F.useCallback(function(u,d){if(d===void 0&&(d={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let h=cR(u,JSON.parse(o),s,d.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:rs([e,h.pathname])),(d.replace?r.replace:r.push)(h,d.state,d)},[e,r,o,s,t])}function pR(){let{matches:t}=F.useContext(As),e=t[t.length-1];return e?e.params:{}}function mR(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=F.useContext(ko),{matches:i}=F.useContext(As),{pathname:s}=Wc(),o=JSON.stringify(uR(i,r.v7_relativeSplatPath));return F.useMemo(()=>cR(t,JSON.parse(o),s,n==="path"),[t,o,s,n])}function mV(t,e){return gV(t,e)}function gV(t,e,n,r){zc()||_t(!1);let{navigator:i}=F.useContext(ko),{matches:s}=F.useContext(As),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=Wc(),d;if(e){var h;let T=typeof e=="string"?cl(e):e;l==="/"||(h=T.pathname)!=null&&h.startsWith(l)||_t(!1),d=T}else d=u;let f=d.pathname||"/",g=f;if(l!=="/"){let T=l.replace(/^\//,"").split("/");g="/"+f.replace(/^\//,"").split("/").slice(T.length).join("/")}let _=W2(t,{pathname:g}),v=EV(_&&_.map(T=>Object.assign({},T,{params:Object.assign({},a,T.params),pathname:rs([l,i.encodeLocation?i.encodeLocation(T.pathname).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?l:rs([l,i.encodeLocation?i.encodeLocation(T.pathnameBase).pathname:T.pathnameBase])})),s,n,r);return e&&v?F.createElement(wp.Provider,{value:{location:fc({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Hi.Pop}},v):v}function yV(){let t=AV(),e=cV(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return F.createElement(F.Fragment,null,F.createElement("h2",null,"Unexpected Application Error!"),F.createElement("h3",{style:{fontStyle:"italic"}},e),n?F.createElement("pre",{style:i},n):null,null)}const _V=F.createElement(yV,null);class vV extends F.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,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?F.createElement(As.Provider,{value:this.props.routeContext},F.createElement(hR.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function wV(t){let{routeContext:e,match:n,children:r}=t,i=F.useContext(zv);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),F.createElement(As.Provider,{value:e},r)}function EV(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var s;if(!n)return null;if(n.errors)t=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,a=(i=n)==null?void 0:i.errors;if(a!=null){let d=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id])!==void 0);d>=0||_t(!1),o=o.slice(0,Math.min(o.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<o.length;d++){let h=o[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=d),h.route.id){let{loaderData:f,errors:g}=n,_=h.route.loader&&f[h.route.id]===void 0&&(!g||g[h.route.id]===void 0);if(h.route.lazy||_){l=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,h,f)=>{let g,_=!1,v=null,T=null;n&&(g=a&&h.route.id?a[h.route.id]:void 0,v=h.route.errorElement||_V,l&&(u<0&&f===0?(_=!0,T=null):u===f&&(_=!0,T=h.route.hydrateFallbackElement||null)));let S=e.concat(o.slice(0,f+1)),w=()=>{let E;return g?E=v:_?E=T:h.route.Component?E=F.createElement(h.route.Component,null):h.route.element?E=h.route.element:E=d,F.createElement(wV,{match:h,routeContext:{outlet:d,matches:S,isDataRoute:n!=null},children:E})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?F.createElement(vV,{location:n.location,revalidation:n.revalidation,component:v,error:g,children:w(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):w()},null)}var gR=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(gR||{}),Sf=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Sf||{});function IV(t){let e=F.useContext(zv);return e||_t(!1),e}function TV(t){let e=F.useContext(hV);return e||_t(!1),e}function SV(t){let e=F.useContext(As);return e||_t(!1),e}function yR(t){let e=SV(),n=e.matches[e.matches.length-1];return n.route.id||_t(!1),n.route.id}function AV(){var t;let e=F.useContext(hR),n=TV(Sf.UseRouteError),r=yR(Sf.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function bV(){let{router:t}=IV(gR.UseNavigateStable),e=yR(Sf.UseNavigateStable),n=F.useRef(!1);return fR(()=>{n.current=!0}),F.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,fc({fromRouteId:e},s)))},[t,e])}function Mi(t){_t(!1)}function RV(t){let{basename:e="/",children:n=null,location:r,navigationType:i=Hi.Pop,navigator:s,static:o=!1,future:a}=t;zc()&&_t(!1);let l=e.replace(/^\/*/,"/"),u=F.useMemo(()=>({basename:l,navigator:s,static:o,future:fc({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof r=="string"&&(r=cl(r));let{pathname:d="/",search:h="",hash:f="",state:g=null,key:_="default"}=r,v=F.useMemo(()=>{let T=$v(d,l);return T==null?null:{location:{pathname:T,search:h,hash:f,state:g,key:_},navigationType:i}},[l,d,h,f,g,_,i]);return v==null?null:F.createElement(ko.Provider,{value:u},F.createElement(wp.Provider,{children:n,value:v}))}function PV(t){let{children:e,location:n}=t;return mV(Fy(e),n)}new Promise(()=>{});function Fy(t,e){e===void 0&&(e=[]);let n=[];return F.Children.forEach(t,(r,i)=>{if(!F.isValidElement(r))return;let s=[...e,i];if(r.type===F.Fragment){n.push.apply(n,Fy(r.props.children,s));return}r.type!==Mi&&_t(!1),!r.props.index||!r.props.children||_t(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Fy(r.props.children,s)),n.push(o)}),n}/** * React Router DOM v6.26.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Uy(){return Uy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Uy.apply(this,arguments)}function CV(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function kV(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function xV(t,e){return t.button===0&&(!e||e==="_self")&&!kV(t)}const OV=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],NV="6";try{window.__reactRouterVersion=NV}catch{}const DV="startTransition",eT=Jh[DV];function VV(t){let{basename:e,children:n,future:r,window:i}=t,s=F.useRef();s.current==null&&(s.current=B2({window:i,v5Compat:!0}));let o=s.current,[a,l]=F.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=F.useCallback(h=>{u&&eT?eT(()=>l(h)):l(h)},[l,u]);return F.useLayoutEffect(()=>o.listen(d),[o,d]),F.createElement(RV,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const LV=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",MV=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ei=F.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:a,target:l,to:u,preventScrollReset:d,unstable_viewTransition:h}=e,f=CV(e,OV),{basename:g}=F.useContext(ko),_,v=!1;if(typeof u=="string"&&MV.test(u)&&(_=u,LV))try{let E=new URL(window.location.href),x=u.startsWith("//")?new URL(E.protocol+u):new URL(u),O=$v(x.pathname,g);x.origin===E.origin&&O!=null?u=O+x.search+x.hash:v=!0}catch{}let T=fV(u,{relative:i}),S=FV(u,{replace:o,state:a,target:l,preventScrollReset:d,relative:i,unstable_viewTransition:h});function w(E){r&&r(E),E.defaultPrevented||S(E)}return F.createElement("a",Uy({},f,{href:_||T,onClick:v||s?r:w,ref:n,target:l}))});var tT;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(tT||(tT={}));var nT;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(nT||(nT={}));function FV(t,e){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a}=e===void 0?{}:e,l=Ep(),u=Wc(),d=mR(t,{relative:o});return F.useCallback(h=>{if(xV(h,n)){h.preventDefault();let f=r!==void 0?r:Tf(u)===Tf(d);l(t,{replace:f,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a})}},[u,l,d,r,i,n,t,s,o,a])}const UV="_container_d0tvy_1",jV="_cart_product_d0tvy_11",BV="_btn_container_d0tvy_15",$V="_btn_d0tvy_15",zV="_subtotal_d0tvy_32",WV="_cart_container_d0tvy_35",Ms={container:UV,cart_product:jV,btn_container:BV,btn:$V,subtotal:zV,cart_container:WV},qV="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG4AAAAjCAYAAAB1nT9JAAAFdklEQVR4Ae3YY3CkCRdH8RsM17bt3bE9O7Zt27Zt27aNtW3bu7GT5z0fBrdupfvppHo72Td9qn6jO+jpfyzB/k9zHKcSNuM7XOwPHERDhECMApirPIUw9MQr+Bbn0BJyQTh64jS+wDl0RijEg7sxDe8iEQ4l4A0Mx/UQWMMw1wfTEA4xHsAsvISv8A6WoaCXxzkLcy8oD0FNHMfXeAsTcCXEjbdjbmyHWweRG6KMhW4s1iG9hiEMh5Beez2M1wbx8NaveApiRMDX7oUonZAIT02HfWFuC91adEB6vY8rkenhVsHXxroM9xI8lYip8FZziFIZqfClTxHqp+Gawpcmugy31+UxjMzscI/DthNN0Q9/Q/cdzHB+bS1EeQu6z9ANzfAKbKUgyjl8a/wO23cIg+Ba2N/zOgZhG3QpeNIOZ+7eeiWzww2Abr+5d4Qtj8twa/AoGiMRtqMoglr4C7qzkAvuhC4ON6n7tYiHrj3ExUHYaqh7P+h+MG/S9kO3zgxn+xhFUQAfQ/dPZod7EIMwDztQ1NwLwHatl+EizbDr7ZOPa9R9BnSvqVsudMIUbMBAiPEFdH0hXrSDbQVEeRW6GebeHLoY5PEyXAXIBS1g82E4312Dp9Ajg8O9ClHGQPeGuffx/BrnUW48gHL4JgPD3Y0o6L7BVeaFJRG6lhDladgKexgu2rzfLezv4fKgLfbjV9h8HW4vROnrMkw3H4crhaX4BKmwuQ0XglPQpaGsfQsEW22IcitsrTwM9zVEudefwz2NL2EKwHDu9/zYBltGh+sB2xyIUQi2chDlWth6eRju3X9ruNvxB3R/YBJqo10WD7cdujRsQktUwGc+DPcQYqH7FHkhxnOwVc+Owy2A7hfcbl8Cs2i4ErC1gChfuQwXhhehS0EhCKy7YWsIUW6ArWWgh/sJuqnm/jxsNwdouGnQfQ8xfoNugLkPgm0D7kUeiBGKaJcXhqdhKxDo4WyDzH0CbIUDNNxWlyfhUdjmqvsjSICn0vARpuFuyAXHodsGUTpDF4HwQA+XBN0x8wXWCNiWBmi4NdAl4A4IwnAAtl9wFQRD4WtJKObhyY/H/RDkxYfQLYAEeri3YDuOJfjLy0tq4QAM1w+2r7EQb8NTszL55bi2EOTGF9D9jFX4DLpo3JkVw3WGt1JxArrvcF8AhrsNMfDWGSSbx9sW9rGl4jMcwl4cx7fpDgeUQxLcag3JiuFCsBLp9RtqIDdeUQ/kdvuVkQwMd9rce7sMWwOxsKViLsLQH+TEobb5OuzH6IKbILDuwgB8izrmVgW/I72i0ApitA7QcABKYwrWYh7a4GrzJbBBuAb2gfRVipr77eij7qXM/Rb0VvdyEOM2DMJKLMVQPAJRWqEQxM+uRU9sx2lsQS/cAIF1vfn/VDb3cHRW95a+DJczLZNimIZz+BoR+BpnMQCSnfGN31TACRSHZGP34zQcF3fllOFyYyMc7MBDkGyoPIagKZ5HYZRBXbwK54I7csZwQAjGwkEadqAQ5D+iMRzEISxHDGfUwd9wLjiPNsgPySaexWJEYjQEw+DgDCTnDQfcheNwlCisQi3kgwTYPRiKt+Bc8AtKQrAXDnrl3OGAELTFr3CMGOxGXzyLMIifXYfqmIkP4RibcAME+RBzwXU5djjjKkxBPBwPonAei9EDz+NxXOvDC8dNKIAGGIYt+ARpcGC9hYoQpQEcjIMgOJxyKybhbzgZEIcIfIuv8DW+xR92HBevojFCIMZ+vIc8weE8uxLd8AKcf9nfWIliLq+1Z3AnJDicb+5GfxxFNBw/+AQLURO5IH4WHM4IQyF0xSzsw0f4CRFwlAh8gxewEcNRHbdBrOBwQcHhgoLDBYcL+m/4H7hC5P0T56mkAAAAAElFTkSuQmCC",HV="_header_container_1nd4d_6",KV="_fixed_1nd4d_14",GV="_logo_container_1nd4d_20",QV="_delivery_1nd4d_32",YV="_search_1nd4d_44",JV="_order_container_1nd4d_83",XV="_language_1nd4d_98",ZV="_cart_1nd4d_111",eL="_TheFont_1nd4d_126",tL="_lower_container_1nd4d_139",$n={header_container:HV,fixed:KV,logo_container:GV,delivery:QV,search:YV,order_container:JV,language:XV,cart:ZV,TheFont:eL,lower_container:tL};var _R={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},rT=me.createContext&&me.createContext(_R),nL=["attr","size","title"];function rL(t,e){if(t==null)return{};var n=iL(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function iL(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Af(){return Af=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Af.apply(this,arguments)}function iT(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function bf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?iT(Object(n),!0).forEach(function(r){sL(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):iT(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function sL(t,e,n){return e=oL(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oL(t){var e=aL(t,"string");return typeof e=="symbol"?e:e+""}function aL(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function vR(t){return t&&t.map((e,n)=>me.createElement(e.tag,bf({key:n},e.attr),vR(e.child)))}function dl(t){return e=>me.createElement(lL,Af({attr:bf({},t.attr)},e),vR(t.child))}function lL(t){var e=n=>{var{attr:r,size:i,title:s}=t,o=rL(t,nL),a=i||n.size||"1em",l;return n.className&&(l=n.className),t.className&&(l=(l?l+" ":"")+t.className),me.createElement("svg",Af({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:l,style:bf(bf({color:t.color||n.color},n.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&me.createElement("title",null,s),t.children)};return rT!==void 0?me.createElement(rT.Consumer,null,n=>e(n)):e(_R)}function uL(t){return dl({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M515.664-.368C305.76-.368 128 178.4 128 390.176c0 221.76 206.032 448.544 344.624 607.936.528.64 22.929 25.52 50.528 25.52h2.449c27.6 0 49.84-24.88 50.399-25.52 130.064-149.52 320-396.048 320-607.936C896 178.4 757.344-.368 515.664-.368zm12.832 955.552c-1.12 1.12-2.753 2.369-4.193 3.409-1.472-1.008-3.072-2.288-4.255-3.408l-16.737-19.248C371.92 785.2 192 578.785 192 390.176c0-177.008 148.224-326.56 323.664-326.56 218.528 0 316.336 164 316.336 326.56 0 143.184-102.128 333.296-303.504 565.008zm-15.377-761.776c-106.032 0-192 85.968-192 192s85.968 192 192 192 192-85.968 192-192-85.968-192-192-192zm0 320c-70.576 0-129.473-58.816-129.473-129.408 0-70.576 57.424-128 128-128 70.624 0 128 57.424 128 128 .032 70.592-55.903 129.408-126.527 129.408z"},child:[]}]})(t)}function cL(t){return dl({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"},child:[]}]})(t)}function dL(t){return dl({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M21.822 7.431A1 1 0 0 0 21 7H7.333L6.179 4.23A1.994 1.994 0 0 0 4.333 3H2v2h2.333l4.744 11.385A1 1 0 0 0 10 17h8c.417 0 .79-.259.937-.648l3-8a1 1 0 0 0-.115-.921zM17.307 15h-6.64l-2.5-6h11.39l-2.25 6z"},child:[]},{tag:"circle",attr:{cx:"10.5",cy:"19.5",r:"1.5"},child:[]},{tag:"circle",attr:{cx:"17.5",cy:"19.5",r:"1.5"},child:[]}]})(t)}function hL(t){return dl({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M904 160H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0 624H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0-312H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8z"},child:[]}]})(t)}function fL(){return C.jsx("div",{className:$n.lower_container,children:C.jsxs("ul",{children:[C.jsxs("li",{children:[C.jsx(hL,{}),C.jsx("p",{children:"All"})]}),C.jsx("li",{children:"Today's Deals"}),C.jsx("li",{children:"Customer Service"}),C.jsx("li",{children:"Registry"}),C.jsx("li",{children:"Gift Card"}),C.jsx("li",{children:"Sell"})]})})}const wi=F.createContext();function pL({children:t,reducer:e,initialState:n}){return C.jsx(wi.Provider,{value:F.useReducer(e,n),children:t})}var sT={};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const wR=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},mL=function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=t[n++],o=t[n++],a=t[n++],l=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},ER={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<t.length;i+=3){const s=t[i],o=i+1<t.length,a=o?t[i+1]:0,l=i+2<t.length,u=l?t[i+2]:0,d=s>>2,h=(s&3)<<4|a>>4;let f=(a&15)<<2|u>>6,g=u&63;l||(g=64,o||(f=64)),r.push(n[d],n[h],n[f],n[g])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(wR(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):mL(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<t.length;){const s=n[t.charAt(i++)],a=i<t.length?n[t.charAt(i)]:0;++i;const u=i<t.length?n[t.charAt(i)]:64;++i;const h=i<t.length?n[t.charAt(i)]:64;if(++i,s==null||a==null||u==null||h==null)throw new gL;const f=s<<2|a>>4;if(r.push(f),u!==64){const g=a<<4&240|u>>2;if(r.push(g),h!==64){const _=u<<6&192|h;r.push(_)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class gL extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const yL=function(t){const e=wR(t);return ER.encodeByteArray(e,!0)},Rf=function(t){return yL(t).replace(/\./g,"")},IR=function(t){try{return ER.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Pf(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:const n=e;return new Date(n.getTime());case Object:t===void 0&&(t={});break;case Array:t=[];break;default:return e}for(const n in e)!e.hasOwnProperty(n)||!_L(n)||(t[n]=Pf(t[n],e[n]));return t}function _L(t){return t!=="__proto__"}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function TR(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const vL=()=>TR().__FIREBASE_DEFAULTS__,wL=()=>{if(typeof process>"u"||typeof sT>"u")return;const t=sT.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},EL=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&IR(t[1]);return e&&JSON.parse(e)},Ip=()=>{try{return vL()||wL()||EL()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},IL=t=>{var e,n;return(n=(e=Ip())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[t]},SR=()=>{var t;return(t=Ip())===null||t===void 0?void 0:t.config},AR=t=>{var e;return(e=Ip())===null||e===void 0?void 0:e[`_${t}`]};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class TL{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function SL(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=e||"demo-project",i=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},t);return[Rf(JSON.stringify(n)),Rf(JSON.stringify(o)),""].join(".")}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Ye(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function AL(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Ye())}function Wv(){var t;const e=(t=Ip())===null||t===void 0?void 0:t.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function bL(){return typeof window<"u"||bR()}function bR(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function RL(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function RR(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function qv(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function PR(){const t=Ye();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function CR(){return!Wv()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function pc(){try{return typeof indexedDB=="object"}catch{return!1}}function PL(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(n){e(n)}})}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const CL="FirebaseError";class on extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=CL,Object.setPrototypeOf(this,on.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,xo.prototype.create)}}class xo{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?kL(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new on(i,a,r)}}function kL(t,e){return t.replace(xL,(n,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const xL=/\{\$([^}]+)}/g;/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function oT(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function OL(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function ja(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const s=t[i],o=e[i];if(aT(s)&&aT(o)){if(!ja(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function aT(t){return t!==null&&typeof t=="object"}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function hl(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function ya(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function yu(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function kR(t,e){const n=new NL(t,e);return n.subscribe.bind(n)}class NL{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");DL(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=vg),i.error===void 0&&(i.error=vg),i.complete===void 0&&(i.complete=vg);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function DL(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function vg(){}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function ee(t){return t&&t._delegate?t._delegate:t}class Br{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const $s="[DEFAULT]";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class VL{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new TL;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),i=(n=e==null?void 0:e.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(ML(e))try{this.getOrInitializeService({instanceIdentifier:$s})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=$s){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=$s){return this.instances.has(e)}getOptions(e=$s){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,n){var r;const i=this.normalizeInstanceIdentifier(n),s=(r=this.onInitCallbacks.get(i))!==null&&r!==void 0?r:new Set;s.add(e),this.onInitCallbacks.set(i,s);const o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:LL(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=$s){return this.component?this.component.multipleInstances?e:$s:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function LL(t){return t===$s?void 0:t}function ML(t){return t.instantiationMode==="EAGER"}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class xR{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new VL(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Hv=[];var ce;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(ce||(ce={}));const OR={debug:ce.DEBUG,verbose:ce.VERBOSE,info:ce.INFO,warn:ce.WARN,error:ce.ERROR,silent:ce.SILENT},FL=ce.INFO,UL={[ce.DEBUG]:"log",[ce.VERBOSE]:"log",[ce.INFO]:"info",[ce.WARN]:"warn",[ce.ERROR]:"error"},jL=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),i=UL[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class Tp{constructor(e){this.name=e,this._logLevel=FL,this._logHandler=jL,this._userLogHandler=null,Hv.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in ce))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?OR[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,ce.DEBUG,...e),this._logHandler(this,ce.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,ce.VERBOSE,...e),this._logHandler(this,ce.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,ce.INFO,...e),this._logHandler(this,ce.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,ce.WARN,...e),this._logHandler(this,ce.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,ce.ERROR,...e),this._logHandler(this,ce.ERROR,...e)}}function BL(t){Hv.forEach(e=>{e.setLogLevel(t)})}function $L(t,e){for(const n of Hv){let r=null;e&&e.level&&(r=OR[e.level]),t===null?n.userLogHandler=null:n.userLogHandler=(i,s,...o)=>{const a=o.map(l=>{if(l==null)return null;if(typeof l=="string")return l;if(typeof l=="number"||typeof l=="boolean")return l.toString();if(l instanceof Error)return l.message;try{return JSON.stringify(l)}catch{return null}}).filter(l=>l).join(" ");s>=(r??i.logLevel)&&t({level:ce[s].toLowerCase(),message:a,args:o,type:i.name})}}}const zL=(t,e)=>e.some(n=>t instanceof n);let lT,uT;function WL(){return lT||(lT=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function qL(){return uT||(uT=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const NR=new WeakMap,jy=new WeakMap,DR=new WeakMap,wg=new WeakMap,Kv=new WeakMap;function HL(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(is(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&NR.set(n,t)}).catch(()=>{}),Kv.set(e,t),e}function KL(t){if(jy.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});jy.set(t,e)}let By={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return jy.get(t);if(e==="objectStoreNames")return t.objectStoreNames||DR.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return is(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function GL(t){By=t(By)}function QL(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Eg(this),e,...n);return DR.set(r,e.sort?e.sort():[e]),is(r)}:qL().includes(t)?function(...e){return t.apply(Eg(this),e),is(NR.get(this))}:function(...e){return is(t.apply(Eg(this),e))}}function YL(t){return typeof t=="function"?QL(t):(t instanceof IDBTransaction&&KL(t),zL(t,WL())?new Proxy(t,By):t)}function is(t){if(t instanceof IDBRequest)return HL(t);if(wg.has(t))return wg.get(t);const e=YL(t);return e!==t&&(wg.set(t,e),Kv.set(e,t)),e}const Eg=t=>Kv.get(t);function JL(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=is(o);return r&&o.addEventListener("upgradeneeded",l=>{r(is(o.result),l.oldVersion,l.newVersion,is(o.transaction),l)}),n&&o.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const XL=["get","getKey","getAll","getAllKeys","count"],ZL=["put","add","delete","clear"],Ig=new Map;function cT(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Ig.get(e))return Ig.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=ZL.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||XL.includes(n)))return;const s=async function(o,...a){const l=this.transaction(o,i?"readwrite":"readonly");let u=l.store;return r&&(u=u.index(a.shift())),(await Promise.all([u[n](...a),i&&l.done]))[0]};return Ig.set(e,s),s}GL(t=>({...t,get:(e,n,r)=>cT(e,n)||t.get(e,n,r),has:(e,n)=>!!cT(e,n)||t.has(e,n)}));/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class eM{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(tM(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function tM(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Cf="@firebase/app",$y="0.10.11";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const pi=new Tp("@firebase/app"),nM="@firebase/app-compat",rM="@firebase/analytics-compat",iM="@firebase/analytics",sM="@firebase/app-check-compat",oM="@firebase/app-check",aM="@firebase/auth",lM="@firebase/auth-compat",uM="@firebase/database",cM="@firebase/database-compat",dM="@firebase/functions",hM="@firebase/functions-compat",fM="@firebase/installations",pM="@firebase/installations-compat",mM="@firebase/messaging",gM="@firebase/messaging-compat",yM="@firebase/performance",_M="@firebase/performance-compat",vM="@firebase/remote-config",wM="@firebase/remote-config-compat",EM="@firebase/storage",IM="@firebase/storage-compat",TM="@firebase/firestore",SM="@firebase/vertexai-preview",AM="@firebase/firestore-compat",bM="firebase",RM="10.13.2";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ls="[DEFAULT]",PM={[Cf]:"fire-core",[nM]:"fire-core-compat",[iM]:"fire-analytics",[rM]:"fire-analytics-compat",[oM]:"fire-app-check",[sM]:"fire-app-check-compat",[aM]:"fire-auth",[lM]:"fire-auth-compat",[uM]:"fire-rtdb",[cM]:"fire-rtdb-compat",[dM]:"fire-fn",[hM]:"fire-fn-compat",[fM]:"fire-iid",[pM]:"fire-iid-compat",[mM]:"fire-fcm",[gM]:"fire-fcm-compat",[yM]:"fire-perf",[_M]:"fire-perf-compat",[vM]:"fire-rc",[wM]:"fire-rc-compat",[EM]:"fire-gcs",[IM]:"fire-gcs-compat",[TM]:"fire-fst",[AM]:"fire-fst-compat",[SM]:"fire-vertex","fire-js":"fire-js",[bM]:"fire-js-all"};/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const us=new Map,Ba=new Map,$a=new Map;function mc(t,e){try{t.container.addComponent(e)}catch(n){pi.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function VR(t,e){t.container.addOrOverwriteComponent(e)}function cs(t){const e=t.name;if($a.has(e))return pi.debug(`There were multiple attempts to register component ${e}.`),!1;$a.set(e,t);for(const n of us.values())mc(n,t);for(const n of Ba.values())mc(n,t);return!0}function Sp(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function CM(t,e,n=ls){Sp(t,e).clearInstance(n)}function LR(t){return t.options!==void 0}function nt(t){return t.settings!==void 0}function kM(){$a.clear()}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const xM={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Yn=new xo("app","Firebase",xM);/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let MR=class{constructor(e,n,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Br("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Yn.create("app-deleted",{appName:this._name})}};/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class OM extends MR{constructor(e,n,r,i){const s=n.automaticDataCollectionEnabled!==void 0?n.automaticDataCollectionEnabled:!1,o={name:r,automaticDataCollectionEnabled:s};if(e.apiKey!==void 0)super(e,o,i);else{const a=e;super(a.options,o,i)}this._serverConfig=Object.assign({automaticDataCollectionEnabled:s},n),this._finalizationRegistry=null,typeof FinalizationRegistry<"u"&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=void 0,n.releaseOnDeref=void 0,mr(Cf,$y,"serverapp")}toJSON(){}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==void 0&&this._finalizationRegistry!==null&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){Qv(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw Yn.create("server-app-deleted")}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const bs=RM;function Gv(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r=Object.assign({name:ls,automaticDataCollectionEnabled:!1},e),i=r.name;if(typeof i!="string"||!i)throw Yn.create("bad-app-name",{appName:String(i)});if(n||(n=SR()),!n)throw Yn.create("no-options");const s=us.get(i);if(s){if(ja(n,s.options)&&ja(r,s.config))return s;throw Yn.create("duplicate-app",{appName:i})}const o=new xR(i);for(const l of $a.values())o.addComponent(l);const a=new MR(n,r,o);return us.set(i,a),a}function NM(t,e){if(bL()&&!bR())throw Yn.create("invalid-server-app-environment");e.automaticDataCollectionEnabled===void 0&&(e.automaticDataCollectionEnabled=!1);let n;LR(t)?n=t.options:n=t;const r=Object.assign(Object.assign({},e),n);r.releaseOnDeref!==void 0&&delete r.releaseOnDeref;const i=u=>[...u].reduce((d,h)=>Math.imul(31,d)+h.charCodeAt(0)|0,0);if(e.releaseOnDeref!==void 0&&typeof FinalizationRegistry>"u")throw Yn.create("finalization-registry-not-supported",{});const s=""+i(JSON.stringify(r)),o=Ba.get(s);if(o)return o.incRefCount(e.releaseOnDeref),o;const a=new xR(s);for(const u of $a.values())a.addComponent(u);const l=new OM(n,e,s,a);return Ba.set(s,l),l}function FR(t=ls){const e=us.get(t);if(!e&&t===ls&&SR())return Gv();if(!e)throw Yn.create("no-app",{appName:t});return e}function DM(){return Array.from(us.values())}async function Qv(t){let e=!1;const n=t.name;us.has(n)?(e=!0,us.delete(n)):Ba.has(n)&&t.decRefCount()<=0&&(Ba.delete(n),e=!0),e&&(await Promise.all(t.container.getProviders().map(r=>r.delete())),t.isDeleted=!0)}function mr(t,e,n){var r;let i=(r=PM[t])!==null&&r!==void 0?r:t;n&&(i+=`-${n}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const a=[`Unable to register library "${i}" with version "${e}":`];s&&a.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),pi.warn(a.join(" "));return}cs(new Br(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}function UR(t,e){if(t!==null&&typeof t!="function")throw Yn.create("invalid-log-argument");$L(t,e)}function jR(t){BL(t)}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const VM="firebase-heartbeat-database",LM=1,gc="firebase-heartbeat-store";let Tg=null;function BR(){return Tg||(Tg=JL(VM,LM,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(gc)}catch(n){console.warn(n)}}}}).catch(t=>{throw Yn.create("idb-open",{originalErrorMessage:t.message})})),Tg}async function MM(t){try{const n=(await BR()).transaction(gc),r=await n.objectStore(gc).get($R(t));return await n.done,r}catch(e){if(e instanceof on)pi.warn(e.message);else{const n=Yn.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});pi.warn(n.message)}}}async function dT(t,e){try{const r=(await BR()).transaction(gc,"readwrite");await r.objectStore(gc).put(e,$R(t)),await r.done}catch(n){if(n instanceof on)pi.warn(n.message);else{const r=Yn.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});pi.warn(r.message)}}}function $R(t){return`${t.name}!${t.options.appId}`}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const FM=1024,UM=30*24*60*60*1e3;class jM{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new $M(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;try{const i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=hT();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{const a=new Date(o.date).valueOf();return Date.now()-a<=UM}),this._storage.overwrite(this._heartbeatsCache))}catch(r){pi.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=hT(),{heartbeatsToSend:r,unsentEntries:i}=BM(this._heartbeatsCache.heartbeats),s=Rf(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return pi.warn(n),""}}}function hT(){return new Date().toISOString().substring(0,10)}function BM(t,e=FM){const n=[];let r=t.slice();for(const i of t){const s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),fT(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),fT(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class $M{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return pc()?PL().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await MM(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){const i=await this.read();return dT(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){const i=await this.read();return dT(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}}function fT(t){return Rf(JSON.stringify({version:2,heartbeats:t})).length}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function zM(t){cs(new Br("platform-logger",e=>new eM(e),"PRIVATE")),cs(new Br("heartbeat",e=>new jM(e),"PRIVATE")),mr(Cf,$y,t),mr(Cf,$y,"esm2017"),mr("fire-js","")}zM("");const WM=Object.freeze(Object.defineProperty({__proto__:null,FirebaseError:on,SDK_VERSION:bs,_DEFAULT_ENTRY_NAME:ls,_addComponent:mc,_addOrOverwriteComponent:VR,_apps:us,_clearComponents:kM,_components:$a,_getProvider:Sp,_isFirebaseApp:LR,_isFirebaseServerApp:nt,_registerComponent:cs,_removeServiceInstance:CM,_serverApps:Ba,deleteApp:Qv,getApp:FR,getApps:DM,initializeApp:Gv,initializeServerApp:NM,onLog:UR,registerVersion:mr,setLogLevel:jR},Symbol.toStringTag,{value:"Module"}));/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class qM{constructor(e,n){this._delegate=e,this.firebase=n,mc(e,new Br("app-compat",()=>this,"PUBLIC")),this.container=e.container}get automaticDataCollectionEnabled(){return this._delegate.automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this._delegate.automaticDataCollectionEnabled=e}get name(){return this._delegate.name}get options(){return this._delegate.options}delete(){return new Promise(e=>{this._delegate.checkDestroyed(),e()}).then(()=>(this.firebase.INTERNAL.removeApp(this.name),Qv(this._delegate)))}_getService(e,n=ls){var r;this._delegate.checkDestroyed();const i=this._delegate.container.getProvider(e);return!i.isInitialized()&&((r=i.getComponent())===null||r===void 0?void 0:r.instantiationMode)==="EXPLICIT"&&i.initialize(),i.getImmediate({identifier:n})}_removeServiceInstance(e,n=ls){this._delegate.container.getProvider(e).clearInstance(n)}_addComponent(e){mc(this._delegate,e)}_addOrOverwriteComponent(e){VR(this._delegate,e)}toJSON(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const HM={"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance."},pT=new xo("app-compat","Firebase",HM);/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function KM(t){const e={},n={__esModule:!0,initializeApp:s,app:i,registerVersion:mr,setLogLevel:jR,onLog:UR,apps:null,SDK_VERSION:bs,INTERNAL:{registerComponent:a,removeApp:r,useAsService:l,modularAPIs:WM}};n.default=n,Object.defineProperty(n,"apps",{get:o});function r(u){delete e[u]}function i(u){if(u=u||ls,!oT(e,u))throw pT.create("no-app",{appName:u});return e[u]}i.App=t;function s(u,d={}){const h=Gv(u,d);if(oT(e,h.name))return e[h.name];const f=new t(h,n);return e[h.name]=f,f}function o(){return Object.keys(e).map(u=>e[u])}function a(u){const d=u.name,h=d.replace("-compat","");if(cs(u)&&u.type==="PUBLIC"){const f=(g=i())=>{if(typeof g[h]!="function")throw pT.create("invalid-app-argument",{appName:d});return g[h]()};u.serviceProps!==void 0&&Pf(f,u.serviceProps),n[h]=f,t.prototype[h]=function(...g){return this._getService.bind(this,d).apply(this,u.multipleInstances?g:[])}}return u.type==="PUBLIC"?n[h]:null}function l(u,d){return d==="serverAuth"?null:d}return n}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function zR(){const t=KM(qM);t.INTERNAL=Object.assign(Object.assign({},t.INTERNAL),{createFirebaseNamespace:zR,extendNamespace:e,createSubscribe:kR,ErrorFactory:xo,deepExtend:Pf});function e(n){Pf(t,n)}return t}const GM=zR();/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const mT=new Tp("@firebase/app-compat"),QM="@firebase/app-compat",YM="0.2.41";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function JM(t){mr(QM,YM,t)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */try{const t=TR();if(t.firebase!==void 0){mT.warn(` Warning: Firebase is already defined in the global scope. Please make sure Firebase library is only loaded once. `);const e=t.firebase.SDK_VERSION;e&&e.indexOf("LITE")>=0&&mT.warn(` Warning: You are trying to load Firebase while using Firebase Performance standalone script. You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code. `)}}catch{}const fl=GM;JM();var XM="firebase",ZM="10.13.2";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */fl.registerVersion(XM,ZM,"app-compat");function Yv(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}const Zl={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},Wo={EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"};/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function eF(){return{"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","emulator-config-failed":'Auth instance has already been used to make a network call. Auth can no longer be configured to use the emulator. Try calling "connectAuthEmulator()" sooner.',"expired-action-code":"The action code has expired.","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal AuthError has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registered for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal AuthError has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-emulator-scheme":"Emulator URL must start with a valid scheme (http:// or https://).","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is incorrect, malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","login-blocked":"Login blocked by user-provided method: {$originalMessage}","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal AuthError has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-or-invalid-nonce":"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.","missing-password":"A non-empty password must be provided","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal AuthError has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled.","already-initialized":"initializeAuth() has already been called with different options. To avoid this error, call initializeAuth() with the same options as when it was originally called, or call getAuth() to return the already initialized instance.","missing-recaptcha-token":"The reCAPTCHA token is missing when sending request to the backend.","invalid-recaptcha-token":"The reCAPTCHA token is invalid when sending request to the backend.","invalid-recaptcha-action":"The reCAPTCHA action is invalid when sending request to the backend.","recaptcha-not-enabled":"reCAPTCHA Enterprise integration is not enabled for this project.","missing-client-type":"The reCAPTCHA client type is missing when sending request to the backend.","missing-recaptcha-version":"The reCAPTCHA version is missing when sending request to the backend.","invalid-req-type":"Invalid request parameters.","invalid-recaptcha-version":"The reCAPTCHA version is invalid when sending request to the backend.","unsupported-password-policy-schema-version":"The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.","password-does-not-meet-requirements":"The password does not meet the requirements."}}function WR(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const tF=eF,nF=WR,qR=new xo("auth","Firebase",WR());/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const kf=new Tp("@firebase/auth");function rF(t,...e){kf.logLevel<=ce.WARN&&kf.warn(`Auth (${bs}): ${t}`,...e)}function xh(t,...e){kf.logLevel<=ce.ERROR&&kf.error(`Auth (${bs}): ${t}`,...e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Ot(t,...e){throw Xv(t,...e)}function It(t,...e){return Xv(t,...e)}function Jv(t,e,n){const r=Object.assign(Object.assign({},nF()),{[e]:n});return new xo("auth","Firebase",r).create(e,{appName:t.name})}function kt(t){return Jv(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function pl(t,e,n){const r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&Ot(t,"argument-error"),Jv(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Xv(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return qR.create(t,...e)}function q(t,e,...n){if(!t)throw Xv(e,...n)}function xr(t){const e="INTERNAL ASSERTION FAILED: "+t;throw xh(e),new Error(e)}function yr(t,e){t||xr(e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function yc(){var t;return typeof self<"u"&&((t=self.location)===null||t===void 0?void 0:t.href)||""}function Zv(){return gT()==="http:"||gT()==="https:"}function gT(){var t;return typeof self<"u"&&((t=self.location)===null||t===void 0?void 0:t.protocol)||null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function iF(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Zv()||RR()||"connection"in navigator)?navigator.onLine:!0}function sF(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class qc{constructor(e,n){this.shortDelay=e,this.longDelay=n,yr(n>e,"Short delay should be less than long delay!"),this.isMobile=AL()||qv()}get(){return iF()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function e0(t,e){yr(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class HR{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;xr("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;xr("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;xr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const oF={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const aF=new qc(3e4,6e4);function ot(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function at(t,e,n,r,i={}){return KR(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const a=hl(Object.assign({key:t.config.apiKey},o)).slice(1),l=await t._getAdditionalHeaders();l["Content-Type"]="application/json",t.languageCode&&(l["X-Firebase-Locale"]=t.languageCode);const u=Object.assign({method:e,headers:l},s);return RL()||(u.referrerPolicy="no-referrer"),HR.fetch()(GR(t,t.config.apiHost,n,a),u)})}async function KR(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},oF),e);try{const i=new uF(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw _u(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[l,u]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw _u(t,"credential-already-in-use",o);if(l==="EMAIL_EXISTS")throw _u(t,"email-already-in-use",o);if(l==="USER_DISABLED")throw _u(t,"user-disabled",o);const d=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw Jv(t,d,u);Ot(t,d)}}catch(i){if(i instanceof on)throw i;Ot(t,"network-request-failed",{message:String(i)})}}async function Ei(t,e,n,r,i={}){const s=await at(t,e,n,r,i);return"mfaPendingCredential"in s&&Ot(t,"multi-factor-auth-required",{_serverResponse:s}),s}function GR(t,e,n,r){const i=`${e}${n}?${r}`;return t.config.emulator?e0(t.config,i):`${t.config.apiScheme}://${i}`}function lF(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class uF{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(It(this.auth,"network-request-failed")),aF.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function _u(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=It(t,e,r);return i.customData._tokenResponse=n,i}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function yT(t){return t!==void 0&&t.getResponse!==void 0}function _T(t){return t!==void 0&&t.enterprise!==void 0}class cF{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return lF(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function dF(t){return(await at(t,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function hF(t,e){return at(t,"GET","/v2/recaptchaConfig",ot(t,e))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function fF(t,e){return at(t,"POST","/v1/accounts:delete",e)}async function pF(t,e){return at(t,"POST","/v1/accounts:update",e)}async function QR(t,e){return at(t,"POST","/v1/accounts:lookup",e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Lu(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function mF(t,e=!1){const n=ee(t),r=await n.getIdToken(e),i=Ap(r);q(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s==null?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:Lu(Sg(i.auth_time)),issuedAtTime:Lu(Sg(i.iat)),expirationTime:Lu(Sg(i.exp)),signInProvider:o||null,signInSecondFactor:(s==null?void 0:s.sign_in_second_factor)||null}}function Sg(t){return Number(t)*1e3}function Ap(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return xh("JWT malformed, contained fewer than 3 sections"),null;try{const i=IR(n);return i?JSON.parse(i):(xh("Failed to decode base64 JWT payload"),null)}catch(i){return xh("Caught error parsing JWT payload as JSON",i==null?void 0:i.toString()),null}}function vT(t){const e=Ap(t);return q(e,"internal-error"),q(typeof e.exp<"u","internal-error"),q(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function mi(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof on&&gF(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function gF({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class yF{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const i=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class zy{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Lu(this.lastLoginAt),this.creationTime=Lu(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function _c(t){var e;const n=t.auth,r=await t.getIdToken(),i=await mi(t,QR(n,{idToken:r}));q(i==null?void 0:i.users.length,n,"internal-error");const s=i.users[0];t._notifyReloadListener(s);const o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?YR(s.providerUserInfo):[],a=vF(t.providerData,o),l=t.isAnonymous,u=!(t.email&&s.passwordHash)&&!(a!=null&&a.length),d=l?u:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new zy(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(t,h)}async function _F(t){const e=ee(t);await _c(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function vF(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function YR(t){return t.map(e=>{var{providerId:n}=e,r=Yv(e,["providerId"]);return{providerId:n,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function wF(t,e){const n=await KR(t,{},async()=>{const r=hl({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=GR(t,i,"/v1/token",`key=${s}`),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",HR.fetch()(o,{method:"POST",headers:a,body:r})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function EF(t,e){return at(t,"POST","/v2/accounts:revokeToken",ot(t,e))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Aa{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){q(e.idToken,"internal-error"),q(typeof e.idToken<"u","internal-error"),q(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):vT(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){q(e.length!==0,"internal-error");const n=vT(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(q(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:i,expiresIn:s}=await wF(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:i,expirationTime:s}=n,o=new Aa;return r&&(q(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(q(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(q(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Aa,this.toJSON())}_performRefresh(){return xr("not implemented")}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function xi(t,e){q(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class ii{constructor(e){var{uid:n,auth:r,stsTokenManager:i}=e,s=Yv(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new yF(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new zy(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const n=await mi(this,this.stsTokenManager.getToken(this.auth,e));return q(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return mF(this,e)}reload(){return _F(this)}_assign(e){this!==e&&(q(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new ii(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){q(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await _c(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(nt(this.auth.app))return Promise.reject(kt(this.auth));const e=await this.getIdToken();return await mi(this,fF(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){var r,i,s,o,a,l,u,d;const h=(r=n.displayName)!==null&&r!==void 0?r:void 0,f=(i=n.email)!==null&&i!==void 0?i:void 0,g=(s=n.phoneNumber)!==null&&s!==void 0?s:void 0,_=(o=n.photoURL)!==null&&o!==void 0?o:void 0,v=(a=n.tenantId)!==null&&a!==void 0?a:void 0,T=(l=n._redirectEventId)!==null&&l!==void 0?l:void 0,S=(u=n.createdAt)!==null&&u!==void 0?u:void 0,w=(d=n.lastLoginAt)!==null&&d!==void 0?d:void 0,{uid:E,emailVerified:x,isAnonymous:O,providerData:D,stsTokenManager:A}=n;q(E&&A,e,"internal-error");const I=Aa.fromJSON(this.name,A);q(typeof E=="string",e,"internal-error"),xi(h,e.name),xi(f,e.name),q(typeof x=="boolean",e,"internal-error"),q(typeof O=="boolean",e,"internal-error"),xi(g,e.name),xi(_,e.name),xi(v,e.name),xi(T,e.name),xi(S,e.name),xi(w,e.name);const m=new ii({uid:E,auth:e,email:f,emailVerified:x,displayName:h,isAnonymous:O,photoURL:_,phoneNumber:g,tenantId:v,stsTokenManager:I,createdAt:S,lastLoginAt:w});return D&&Array.isArray(D)&&(m.providerData=D.map(R=>Object.assign({},R))),T&&(m._redirectEventId=T),m}static async _fromIdTokenResponse(e,n,r=!1){const i=new Aa;i.updateFromServerResponse(n);const s=new ii({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await _c(s),s}static async _fromGetAccountInfoResponse(e,n,r){const i=n.users[0];q(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?YR(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!(s!=null&&s.length),a=new Aa;a.updateFromIdToken(r);const l=new ii({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),u={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new zy(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(s!=null&&s.length)};return Object.assign(l,u),l}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const wT=new Map;function Nn(t){yr(t instanceof Function,"Expected a class definition");let e=wT.get(t);return e?(yr(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,wT.set(t,e),e)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class JR{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}JR.type="NONE";const za=JR;/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function so(t,e,n){return`firebase:${t}:${e}:${n}`}class ba{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=so(this.userKey,i.apiKey,s),this.fullPersistenceKey=so("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?ii._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new ba(Nn(za),e,r);const i=(await Promise.all(n.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let s=i[0]||Nn(za);const o=so(r,e.config.apiKey,e.name);let a=null;for(const u of n)try{const d=await u._get(o);if(d){const h=ii._fromJSON(e,d);u!==s&&(a=h),s=u;break}}catch{}const l=i.filter(u=>u._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new ba(s,e,r):(s=l[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async u=>{if(u!==s)try{await u._remove(o)}catch{}})),new ba(s,e,r))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function ET(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(tP(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(XR(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(nP(e))return"Blackberry";if(rP(e))return"Webos";if(ZR(e))return"Safari";if((e.includes("chrome/")||eP(e))&&!e.includes("edge/"))return"Chrome";if(Hc(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function XR(t=Ye()){return/firefox\//i.test(t)}function ZR(t=Ye()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function eP(t=Ye()){return/crios\//i.test(t)}function tP(t=Ye()){return/iemobile/i.test(t)}function Hc(t=Ye()){return/android/i.test(t)}function nP(t=Ye()){return/blackberry/i.test(t)}function rP(t=Ye()){return/webos/i.test(t)}function Kc(t=Ye()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function IF(t=Ye()){return/(iPad|iPhone|iPod).*OS 7_\d/i.test(t)||/(iPad|iPhone|iPod).*OS 8_\d/i.test(t)}function TF(t=Ye()){var e;return Kc(t)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function SF(){return PR()&&document.documentMode===10}function iP(t=Ye()){return Kc(t)||Hc(t)||rP(t)||nP(t)||/windows phone/i.test(t)||tP(t)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function sP(t,e=[]){let n;switch(t){case"Browser":n=ET(Ye());break;case"Worker":n=`${ET(Ye())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${bs}/${r}`}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class AF{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=s=>new Promise((o,a)=>{try{const l=e(s);o(l)}catch(l){a(l)}});r.onAbort=n,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function bF(t,e={}){return at(t,"GET","/v2/passwordPolicy",ot(t,e))}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const RF=6;class PF{constructor(e){var n,r,i,s;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:RF,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,r,i,s,o,a;const l={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,l),this.validatePasswordCharacterOptions(e,l),l.isValid&&(l.isValid=(n=l.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),l.isValid&&(l.isValid=(r=l.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),l.isValid&&(l.isValid=(i=l.containsLowercaseLetter)!==null&&i!==void 0?i:!0),l.isValid&&(l.isValid=(s=l.containsUppercaseLetter)!==null&&s!==void 0?s:!0),l.isValid&&(l.isValid=(o=l.containsNumericCharacter)!==null&&o!==void 0?o:!0),l.isValid&&(l.isValid=(a=l.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),l}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class CF{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new IT(this),this.idTokenSubscription=new IT(this),this.beforeStateQueue=new AF(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=qR,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=Nn(n)),this._initializationPromise=this.queue(async()=>{var r,i;if(!this._deleted&&(this.persistenceManager=await ba.create(this,e),!this._deleted)){if(!((r=this._popupRedirectResolver)===null||r===void 0)&&r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await QR(this,{idToken:e}),r=await ii._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var n;if(nt(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const r=await this.assertedPersistence.getCurrentUser();let i=r,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=i==null?void 0:i._redirectEventId,l=await this.tryRedirectSignIn(e);(!o||o===a)&&(l!=null&&l.user)&&(i=l.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return q(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await _c(e)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=sF()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(nt(this.app))return Promise.reject(kt(this));const n=e?ee(e):null;return n&&q(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&q(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return nt(this.app)?Promise.reject(kt(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return nt(this.app)?Promise.reject(kt(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Nn(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await bF(this),n=new PF(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new xo("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await EF(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&Nn(e)||this._popupRedirectResolver;q(n,this,"argument-error"),this.redirectPersistenceManager=await ba.create(this,[Nn(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};const s=typeof n=="function"?n:n.next.bind(n);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(q(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){const l=e.addObserver(n,r,i);return()=>{o=!0,l()}}else{const l=e.addObserver(n);return()=>{o=!0,l()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return q(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=sP(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);const r=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());r&&(n["X-Firebase-Client"]=r);const i=await this._getAppCheckToken();return i&&(n["X-Firebase-AppCheck"]=i),n}async _getAppCheckToken(){var e;const n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n!=null&&n.error&&rF(`Error while retrieving App Check token: ${n.error}`),n==null?void 0:n.token}}function rt(t){return ee(t)}class IT{constructor(e){this.auth=e,this.observer=null,this.addObserver=kR(n=>this.observer=n)}get next(){return q(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let Gc={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function kF(t){Gc=t}function t0(t){return Gc.loadJS(t)}function xF(){return Gc.recaptchaV2Script}function OF(){return Gc.recaptchaEnterpriseScript}function NF(){return Gc.gapiScript}function oP(t){return`__${t}${Math.floor(Math.random()*1e6)}`}const DF="recaptcha-enterprise",VF="NO_RECAPTCHA";class LF{constructor(e){this.type=DF,this.auth=rt(e)}async verify(e="verify",n=!1){async function r(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{hF(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const u=new cF(l);return s.tenantId==null?s._agentRecaptchaConfig=u:s._tenantRecaptchaConfigs[s.tenantId]=u,o(u.siteKey)}}).catch(l=>{a(l)})})}function i(s,o,a){const l=window.grecaptcha;_T(l)?l.enterprise.ready(()=>{l.enterprise.execute(s,{action:e}).then(u=>{o(u)}).catch(()=>{o(VF)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{r(this.auth).then(a=>{if(!n&&_T(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let l=OF();l.length!==0&&(l+=a),t0(l).then(()=>{i(a,s,o)}).catch(u=>{o(u)})}}).catch(a=>{o(a)})})}}async function TT(t,e,n,r=!1){const i=new LF(t);let s;try{s=await i.verify(n)}catch{s=await i.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function vc(t,e,n,r){var i;if(!((i=t._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await TT(t,e,n,n==="getOobCode");return r(t,s)}else return r(t,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const o=await TT(t,e,n,n==="getOobCode");return r(t,o)}else return Promise.reject(s)})}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function MF(t,e){const n=Sp(t,"auth");if(n.isInitialized()){const i=n.getImmediate(),s=n.getOptions();if(ja(s,e??{}))return i;Ot(i,"already-initialized")}return n.initialize({options:e})}function FF(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Nn);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function aP(t,e,n){const r=rt(t);q(r._canInitEmulator,r,"emulator-config-failed"),q(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!!(n!=null&&n.disableWarnings),s=lP(e),{host:o,port:a}=UF(e),l=a===null?"":`:${a}`;r.config.emulator={url:`${s}//${o}${l}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||jF()}function lP(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function UF(t){const e=lP(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:ST(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:ST(o)}}}function ST(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function jF(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ml{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return xr("not implemented")}_getIdTokenResponse(e){return xr("not implemented")}_linkToIdToken(e,n){return xr("not implemented")}_getReauthenticationResolver(e){return xr("not implemented")}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function uP(t,e){return at(t,"POST","/v1/accounts:resetPassword",ot(t,e))}async function BF(t,e){return at(t,"POST","/v1/accounts:update",e)}async function $F(t,e){return at(t,"POST","/v1/accounts:signUp",e)}async function zF(t,e){return at(t,"POST","/v1/accounts:update",ot(t,e))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function WF(t,e){return Ei(t,"POST","/v1/accounts:signInWithPassword",ot(t,e))}async function bp(t,e){return at(t,"POST","/v1/accounts:sendOobCode",ot(t,e))}async function qF(t,e){return bp(t,e)}async function HF(t,e){return bp(t,e)}async function KF(t,e){return bp(t,e)}async function GF(t,e){return bp(t,e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function QF(t,e){return Ei(t,"POST","/v1/accounts:signInWithEmailLink",ot(t,e))}async function YF(t,e){return Ei(t,"POST","/v1/accounts:signInWithEmailLink",ot(t,e))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class wc extends ml{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new wc(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new wc(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e;if(n!=null&&n.email&&(n!=null&&n.password)){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return vc(e,n,"signInWithPassword",WF);case"emailLink":return QF(e,{email:this._email,oobCode:this._password});default:Ot(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":const r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return vc(e,r,"signUpPassword",$F);case"emailLink":return YF(e,{idToken:n,email:this._email,oobCode:this._password});default:Ot(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function ui(t,e){return Ei(t,"POST","/v1/accounts:signInWithIdp",ot(t,e))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const JF="http://localhost";class $r extends ml{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new $r(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):Ot("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i}=n,s=Yv(n,["providerId","signInMethod"]);if(!r||!i)return null;const o=new $r(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return ui(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,ui(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,ui(e,n)}buildRequest(){const e={requestUri:JF,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=hl(n)}return e}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function XF(t,e){return at(t,"POST","/v1/accounts:sendVerificationCode",ot(t,e))}async function ZF(t,e){return Ei(t,"POST","/v1/accounts:signInWithPhoneNumber",ot(t,e))}async function e4(t,e){const n=await Ei(t,"POST","/v1/accounts:signInWithPhoneNumber",ot(t,e));if(n.temporaryProof)throw _u(t,"account-exists-with-different-credential",n);return n}const t4={USER_NOT_FOUND:"user-not-found"};async function n4(t,e){const n=Object.assign(Object.assign({},e),{operation:"REAUTH"});return Ei(t,"POST","/v1/accounts:signInWithPhoneNumber",ot(t,n),t4)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class oo extends ml{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new oo({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new oo({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return ZF(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return e4(e,Object.assign({idToken:n},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return n4(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:n,verificationId:r,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:r,code:i}}toJSON(){const e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));const{verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:s}=e;return!r&&!n&&!i&&!s?null:new oo({verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:s})}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function r4(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function i4(t){const e=ya(yu(t)).link,n=e?ya(yu(e)).deep_link_id:null,r=ya(yu(t)).deep_link_id;return(r?ya(yu(r)).link:null)||r||n||e||t}class Rp{constructor(e){var n,r,i,s,o,a;const l=ya(yu(e)),u=(n=l.apiKey)!==null&&n!==void 0?n:null,d=(r=l.oobCode)!==null&&r!==void 0?r:null,h=r4((i=l.mode)!==null&&i!==void 0?i:null);q(u&&d&&h,"argument-error"),this.apiKey=u,this.operation=h,this.code=d,this.continueUrl=(s=l.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=l.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=l.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){const n=i4(e);try{return new Rp(n)}catch{return null}}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Rs{constructor(){this.providerId=Rs.PROVIDER_ID}static credential(e,n){return wc._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=Rp.parseLink(n);return q(r,"argument-error"),wc._fromEmailAndCode(e,r.code,r.tenantId)}}Rs.PROVIDER_ID="password";Rs.EMAIL_PASSWORD_SIGN_IN_METHOD="password";Rs.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ii{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class gl extends Ii{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Ra extends gl{static credentialFromJSON(e){const n=typeof e=="string"?JSON.parse(e):e;return q("providerId"in n&&"signInMethod"in n,"argument-error"),$r._fromParams(n)}credential(e){return this._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}_credential(e){return q(e.idToken||e.accessToken,"argument-error"),$r._fromParams(Object.assign(Object.assign({},e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return Ra.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return Ra.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r,oauthTokenSecret:i,pendingToken:s,nonce:o,providerId:a}=e;if(!r&&!i&&!n&&!s||!a)return null;try{return new Ra(a)._credential({idToken:n,accessToken:r,nonce:o,pendingToken:s})}catch{return null}}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Rr extends gl{constructor(){super("facebook.com")}static credential(e){return $r._fromParams({providerId:Rr.PROVIDER_ID,signInMethod:Rr.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Rr.credentialFromTaggedObject(e)}static credentialFromError(e){return Rr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Rr.credential(e.oauthAccessToken)}catch{return null}}}Rr.FACEBOOK_SIGN_IN_METHOD="facebook.com";Rr.PROVIDER_ID="facebook.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Pr extends gl{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return $r._fromParams({providerId:Pr.PROVIDER_ID,signInMethod:Pr.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return Pr.credentialFromTaggedObject(e)}static credentialFromError(e){return Pr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return Pr.credential(n,r)}catch{return null}}}Pr.GOOGLE_SIGN_IN_METHOD="google.com";Pr.PROVIDER_ID="google.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Cr extends gl{constructor(){super("github.com")}static credential(e){return $r._fromParams({providerId:Cr.PROVIDER_ID,signInMethod:Cr.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Cr.credentialFromTaggedObject(e)}static credentialFromError(e){return Cr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Cr.credential(e.oauthAccessToken)}catch{return null}}}Cr.GITHUB_SIGN_IN_METHOD="github.com";Cr.PROVIDER_ID="github.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const s4="http://localhost";class Wa extends ml{constructor(e,n){super(e,e),this.pendingToken=n}_getIdTokenResponse(e){const n=this.buildRequest();return ui(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,ui(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,ui(e,n)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,pendingToken:s}=n;return!r||!i||!s||r!==i?null:new Wa(r,s)}static _create(e,n){return new Wa(e,n)}buildRequest(){return{requestUri:s4,returnSecureToken:!0,pendingToken:this.pendingToken}}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const o4="saml.";class xf extends Ii{constructor(e){q(e.startsWith(o4),"argument-error"),super(e)}static credentialFromResult(e){return xf.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return xf.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){const n=Wa.fromJSON(e);return q(n,"argument-error"),n}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{pendingToken:n,providerId:r}=e;if(!n||!r)return null;try{return Wa._create(r,n)}catch{return null}}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class kr extends gl{constructor(){super("twitter.com")}static credential(e,n){return $r._fromParams({providerId:kr.PROVIDER_ID,signInMethod:kr.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return kr.credentialFromTaggedObject(e)}static credentialFromError(e){return kr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return kr.credential(n,r)}catch{return null}}}kr.TWITTER_SIGN_IN_METHOD="twitter.com";kr.PROVIDER_ID="twitter.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function cP(t,e){return Ei(t,"POST","/v1/accounts:signUp",ot(t,e))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Zn{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){const s=await ii._fromIdTokenResponse(e,r,i),o=AT(r);return new Zn({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const i=AT(r);return new Zn({user:e,providerId:i,_tokenResponse:r,operationType:n})}}function AT(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function a4(t){var e;if(nt(t.app))return Promise.reject(kt(t));const n=rt(t);if(await n._initializationPromise,!((e=n.currentUser)===null||e===void 0)&&e.isAnonymous)return new Zn({user:n.currentUser,providerId:null,operationType:"signIn"});const r=await cP(n,{returnSecureToken:!0}),i=await Zn._fromIdTokenResponse(n,"signIn",r,!0);return await n._updateCurrentUser(i.user),i}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Of extends on{constructor(e,n,r,i){var s;super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,Of.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new Of(e,n,r,i)}}function dP(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Of._fromErrorAndOperation(t,s,e,r):s})}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function hP(t){return new Set(t.map(({providerId:e})=>e).filter(e=>!!e))}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function l4(t,e){const n=ee(t);await Pp(!0,n,e);const{providerUserInfo:r}=await pF(n.auth,{idToken:await n.getIdToken(),deleteProvider:[e]}),i=hP(r||[]);return n.providerData=n.providerData.filter(s=>i.has(s.providerId)),i.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function n0(t,e,n=!1){const r=await mi(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Zn._forOperation(t,"link",r)}async function Pp(t,e,n){await _c(e);const r=hP(e.providerData),i=t===!1?"provider-already-linked":"no-such-provider";q(r.has(n)===t,e.auth,i)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function fP(t,e,n=!1){const{auth:r}=t;if(nt(r.app))return Promise.reject(kt(r));const i="reauthenticate";try{const s=await mi(t,dP(r,i,e,t),n);q(s.idToken,r,"internal-error");const o=Ap(s.idToken);q(o,r,"internal-error");const{sub:a}=o;return q(t.uid===a,r,"user-mismatch"),Zn._forOperation(t,i,s)}catch(s){throw(s==null?void 0:s.code)==="auth/user-not-found"&&Ot(r,"user-mismatch"),s}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function pP(t,e,n=!1){if(nt(t.app))return Promise.reject(kt(t));const r="signIn",i=await dP(t,r,e),s=await Zn._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function Cp(t,e){return pP(rt(t),e)}async function mP(t,e){const n=ee(t);return await Pp(!1,n,e.providerId),n0(n,e)}async function gP(t,e){return fP(ee(t),e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function u4(t,e){return Ei(t,"POST","/v1/accounts:signInWithCustomToken",ot(t,e))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function c4(t,e){if(nt(t.app))return Promise.reject(kt(t));const n=rt(t),r=await u4(n,{token:e,returnSecureToken:!0}),i=await Zn._fromIdTokenResponse(n,"signIn",r);return await n._updateCurrentUser(i.user),i}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Qc{constructor(e,n){this.factorId=e,this.uid=n.mfaEnrollmentId,this.enrollmentTime=new Date(n.enrolledAt).toUTCString(),this.displayName=n.displayName}static _fromServerResponse(e,n){return"phoneInfo"in n?r0._fromServerResponse(e,n):"totpInfo"in n?i0._fromServerResponse(e,n):Ot(e,"internal-error")}}class r0 extends Qc{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,n){return new r0(n)}}class i0 extends Qc{constructor(e){super("totp",e)}static _fromServerResponse(e,n){return new i0(n)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function kp(t,e,n){var r;q(((r=n.url)===null||r===void 0?void 0:r.length)>0,t,"invalid-continue-uri"),q(typeof n.dynamicLinkDomain>"u"||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(q(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(q(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function s0(t){const e=rt(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function d4(t,e,n){const r=rt(t),i={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&kp(r,i,n),await vc(r,i,"getOobCode",HF)}async function h4(t,e,n){await uP(ee(t),{oobCode:e,newPassword:n}).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&s0(t),r})}async function f4(t,e){await zF(ee(t),{oobCode:e})}async function yP(t,e){const n=ee(t),r=await uP(n,{oobCode:e}),i=r.requestType;switch(q(i,n,"internal-error"),i){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":q(r.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":q(r.mfaInfo,n,"internal-error");default:q(r.email,n,"internal-error")}let s=null;return r.mfaInfo&&(s=Qc._fromServerResponse(rt(n),r.mfaInfo)),{data:{email:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.newEmail:r.email)||null,previousEmail:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.email:r.newEmail)||null,multiFactorInfo:s},operation:i}}async function p4(t,e){const{data:n}=await yP(ee(t),e);return n.email}async function _P(t,e,n){if(nt(t.app))return Promise.reject(kt(t));const r=rt(t),o=await vc(r,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",cP).catch(l=>{throw l.code==="auth/password-does-not-meet-requirements"&&s0(t),l}),a=await Zn._fromIdTokenResponse(r,"signIn",o);return await r._updateCurrentUser(a.user),a}function vP(t,e,n){return nt(t.app)?Promise.reject(kt(t)):Cp(ee(t),Rs.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&s0(t),r})}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function m4(t,e,n){const r=rt(t),i={requestType:"EMAIL_SIGNIN",email:e,clientType:"CLIENT_TYPE_WEB"};function s(o,a){q(a.handleCodeInApp,r,"argument-error"),a&&kp(r,o,a)}s(i,n),await vc(r,i,"getOobCode",KF)}function g4(t,e){const n=Rp.parseLink(e);return(n==null?void 0:n.operation)==="EMAIL_SIGNIN"}async function y4(t,e,n){if(nt(t.app))return Promise.reject(kt(t));const r=ee(t),i=Rs.credentialWithLink(e,n||yc());return q(i._tenantId===(r.tenantId||null),r,"tenant-id-mismatch"),Cp(r,i)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function _4(t,e){return at(t,"POST","/v1/accounts:createAuthUri",ot(t,e))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function v4(t,e){const n=Zv()?yc():"http://localhost",r={identifier:e,continueUri:n},{signinMethods:i}=await _4(ee(t),r);return i||[]}async function w4(t,e){const n=ee(t),i={requestType:"VERIFY_EMAIL",idToken:await t.getIdToken()};e&&kp(n.auth,i,e);const{email:s}=await qF(n.auth,i);s!==t.email&&await t.reload()}async function E4(t,e,n){const r=ee(t),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await t.getIdToken(),newEmail:e};n&&kp(r.auth,s,n);const{email:o}=await GF(r.auth,s);o!==t.email&&await t.reload()}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function I4(t,e){return at(t,"POST","/v1/accounts:update",e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function T4(t,{displayName:e,photoURL:n}){if(e===void 0&&n===void 0)return;const r=ee(t),s={idToken:await r.getIdToken(),displayName:e,photoUrl:n,returnSecureToken:!0},o=await mi(r,I4(r.auth,s));r.displayName=o.displayName||null,r.photoURL=o.photoUrl||null;const a=r.providerData.find(({providerId:l})=>l==="password");a&&(a.displayName=r.displayName,a.photoURL=r.photoURL),await r._updateTokensIfNecessary(o)}function S4(t,e){const n=ee(t);return nt(n.auth.app)?Promise.reject(kt(n.auth)):wP(n,e,null)}function A4(t,e){return wP(ee(t),null,e)}async function wP(t,e,n){const{auth:r}=t,s={idToken:await t.getIdToken(),returnSecureToken:!0};e&&(s.email=e),n&&(s.password=n);const o=await mi(t,BF(r,s));await t._updateTokensIfNecessary(o,!0)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function b4(t){var e,n;if(!t)return null;const{providerId:r}=t,i=t.rawUserInfo?JSON.parse(t.rawUserInfo):{},s=t.isNewUser||t.kind==="identitytoolkit#SignupNewUserResponse";if(!r&&(t!=null&&t.idToken)){const o=(n=(e=Ap(t.idToken))===null||e===void 0?void 0:e.firebase)===null||n===void 0?void 0:n.sign_in_provider;if(o){const a=o!=="anonymous"&&o!=="custom"?o:null;return new Pa(s,a)}}if(!r)return null;switch(r){case"facebook.com":return new R4(s,i);case"github.com":return new P4(s,i);case"google.com":return new C4(s,i);case"twitter.com":return new k4(s,i,t.screenName||null);case"custom":case"anonymous":return new Pa(s,null);default:return new Pa(s,r,i)}}class Pa{constructor(e,n,r={}){this.isNewUser=e,this.providerId=n,this.profile=r}}class EP extends Pa{constructor(e,n,r,i){super(e,n,r),this.username=i}}class R4 extends Pa{constructor(e,n){super(e,"facebook.com",n)}}class P4 extends EP{constructor(e,n){super(e,"github.com",n,typeof(n==null?void 0:n.login)=="string"?n==null?void 0:n.login:null)}}class C4 extends Pa{constructor(e,n){super(e,"google.com",n)}}class k4 extends EP{constructor(e,n,r){super(e,"twitter.com",n,r)}}function x4(t){const{user:e,_tokenResponse:n}=t;return e.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:b4(n)}function O4(t,e,n,r){return ee(t).onIdTokenChanged(e,n,r)}function N4(t,e,n){return ee(t).beforeAuthStateChanged(e,n)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Zs{constructor(e,n,r){this.type=e,this.credential=n,this.user=r}static _fromIdtoken(e,n){return new Zs("enroll",e,n)}static _fromMfaPendingCredential(e){return new Zs("signin",e)}toJSON(){return{multiFactorSession:{[this.type==="enroll"?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){var n,r;if(e!=null&&e.multiFactorSession){if(!((n=e.multiFactorSession)===null||n===void 0)&&n.pendingCredential)return Zs._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(!((r=e.multiFactorSession)===null||r===void 0)&&r.idToken)return Zs._fromIdtoken(e.multiFactorSession.idToken)}return null}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class o0{constructor(e,n,r){this.session=e,this.hints=n,this.signInResolver=r}static _fromError(e,n){const r=rt(e),i=n.customData._serverResponse,s=(i.mfaInfo||[]).map(a=>Qc._fromServerResponse(r,a));q(i.mfaPendingCredential,r,"internal-error");const o=Zs._fromMfaPendingCredential(i.mfaPendingCredential);return new o0(o,s,async a=>{const l=await a._process(r,o);delete i.mfaInfo,delete i.mfaPendingCredential;const u=Object.assign(Object.assign({},i),{idToken:l.idToken,refreshToken:l.refreshToken});switch(n.operationType){case"signIn":const d=await Zn._fromIdTokenResponse(r,n.operationType,u);return await r._updateCurrentUser(d.user),d;case"reauthenticate":return q(n.user,r,"internal-error"),Zn._forOperation(n.user,n.operationType,u);default:Ot(r,"internal-error")}})}async resolveSignIn(e){const n=e;return this.signInResolver(n)}}function D4(t,e){var n;const r=ee(t),i=e;return q(e.customData.operationType,r,"argument-error"),q((n=i.customData._serverResponse)===null||n===void 0?void 0:n.mfaPendingCredential,r,"argument-error"),o0._fromError(r,i)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function V4(t,e){return at(t,"POST","/v2/accounts/mfaEnrollment:start",ot(t,e))}function L4(t,e){return at(t,"POST","/v2/accounts/mfaEnrollment:finalize",ot(t,e))}function M4(t,e){return at(t,"POST","/v2/accounts/mfaEnrollment:withdraw",ot(t,e))}class a0{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(n=>{n.mfaInfo&&(this.enrolledFactors=n.mfaInfo.map(r=>Qc._fromServerResponse(e.auth,r)))})}static _fromUser(e){return new a0(e)}async getSession(){return Zs._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,n){const r=e,i=await this.getSession(),s=await mi(this.user,r._process(this.user.auth,i,n));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){const n=typeof e=="string"?e:e.uid,r=await this.user.getIdToken();try{const i=await mi(this.user,M4(this.user.auth,{idToken:r,mfaEnrollmentId:n}));this.enrolledFactors=this.enrolledFactors.filter(({uid:s})=>s!==n),await this.user._updateTokensIfNecessary(i),await this.user.reload()}catch(i){throw i}}}const Ag=new WeakMap;function F4(t){const e=ee(t);return Ag.has(e)||Ag.set(e,a0._fromUser(e)),Ag.get(e)}const Nf="__sak";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class IP{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Nf,"1"),this.storage.removeItem(Nf),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const U4=1e3,j4=10;class TP extends IP{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=iP(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,l)=>{this.notifyListeners(o,l)});return}const r=e.key;n?this.detachListener():this.stopPolling();const i=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);SF()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,j4):i()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},U4)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}TP.type="LOCAL";const xp=TP;/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class SP extends IP{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}SP.type="SESSION";const ds=SP;/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function B4(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Op{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;const r=new Op(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const a=Array.from(o).map(async u=>u(n.origin,s)),l=await B4(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:l})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Op.receivers=[];/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Yc(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class $4{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,n,r=50){const i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,o;return new Promise((a,l)=>{const u=Yc("",20);i.port1.start();const d=setTimeout(()=>{l(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(h){const f=h;if(f.data.eventId===u)switch(f.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(f.data.response);break;default:clearTimeout(d),clearTimeout(s),l(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:u,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function mt(){return window}function z4(t){mt().location.href=t}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function l0(){return typeof mt().WorkerGlobalScope<"u"&&typeof mt().importScripts=="function"}async function W4(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function q4(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)===null||t===void 0?void 0:t.controller)||null}function H4(){return l0()?self:null}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const AP="firebaseLocalStorageDb",K4=1,Df="firebaseLocalStorage",bP="fbase_key";class Jc{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Np(t,e){return t.transaction([Df],e?"readwrite":"readonly").objectStore(Df)}function G4(){const t=indexedDB.deleteDatabase(AP);return new Jc(t).toPromise()}function Wy(){const t=indexedDB.open(AP,K4);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(Df,{keyPath:bP})}catch(i){n(i)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(Df)?e(r):(r.close(),await G4(),e(await Wy()))})})}async function bT(t,e,n){const r=Np(t,!0).put({[bP]:e,value:n});return new Jc(r).toPromise()}async function Q4(t,e){const n=Np(t,!1).get(e),r=await new Jc(n).toPromise();return r===void 0?null:r.value}function RT(t,e){const n=Np(t,!0).delete(e);return new Jc(n).toPromise()}const Y4=800,J4=3;class RP{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Wy(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>J4)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return l0()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Op._getInstance(H4()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await W4(),!this.activeServiceWorker)return;this.sender=new $4(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&!((e=r[0])===null||e===void 0)&&e.fulfilled&&!((n=r[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||q4()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Wy();return await bT(e,Nf,"1"),await RT(e,Nf),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>bT(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>Q4(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>RT(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=Np(i,!1).getAll();return new Jc(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Y4)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}RP.type="LOCAL";const qa=RP;/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function X4(t,e){return at(t,"POST","/v2/accounts/mfaSignIn:start",ot(t,e))}function Z4(t,e){return at(t,"POST","/v2/accounts/mfaSignIn:finalize",ot(t,e))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const eU=500,tU=6e4,th=1e12;class nU{constructor(e){this.auth=e,this.counter=th,this._widgets=new Map}render(e,n){const r=this.counter;return this._widgets.set(r,new rU(e,this.auth.name,n||{})),this.counter++,r}reset(e){var n;const r=e||th;(n=this._widgets.get(r))===null||n===void 0||n.delete(),this._widgets.delete(r)}getResponse(e){var n;const r=e||th;return((n=this._widgets.get(r))===null||n===void 0?void 0:n.getResponse())||""}async execute(e){var n;const r=e||th;return(n=this._widgets.get(r))===null||n===void 0||n.execute(),""}}class rU{constructor(e,n,r){this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};const i=typeof e=="string"?document.getElementById(e):e;q(i,"argument-error",{appName:n}),this.container=i,this.isVisible=this.params.size!=="invisible",this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),!this.timerId&&(this.timerId=window.setTimeout(()=>{this.responseToken=iU(50);const{callback:e,"expired-callback":n}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,n)try{n()}catch{}this.isVisible&&this.execute()},tU)},eU))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}function iU(t){const e=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let r=0;r<t;r++)e.push(n.charAt(Math.floor(Math.random()*n.length)));return e.join("")}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const bg=oP("rcb"),sU=new qc(3e4,6e4);class oU{constructor(){var e;this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!(!((e=mt().grecaptcha)===null||e===void 0)&&e.render)}load(e,n=""){return q(aU(n),e,"argument-error"),this.shouldResolveImmediately(n)&&yT(mt().grecaptcha)?Promise.resolve(mt().grecaptcha):new Promise((r,i)=>{const s=mt().setTimeout(()=>{i(It(e,"network-request-failed"))},sU.get());mt()[bg]=()=>{mt().clearTimeout(s),delete mt()[bg];const a=mt().grecaptcha;if(!a||!yT(a)){i(It(e,"internal-error"));return}const l=a.render;a.render=(u,d)=>{const h=l(u,d);return this.counter++,h},this.hostLanguage=n,r(a)};const o=`${xF()}?${hl({onload:bg,render:"explicit",hl:n})}`;t0(o).catch(()=>{clearTimeout(s),i(It(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){var n;return!!(!((n=mt().grecaptcha)===null||n===void 0)&&n.render)&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}}function aU(t){return t.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(t)}class lU{async load(e){return new nU(e)}clearedOneInstance(){}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const PP="recaptcha",uU={theme:"light",type:"image"};let cU=class{constructor(e,n,r=Object.assign({},uU)){this.parameters=r,this.type=PP,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=rt(e),this.isInvisible=this.parameters.size==="invisible",q(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");const i=typeof n=="string"?document.getElementById(n):n;q(i,this.auth,"argument-error"),this.container=i,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new lU:new oU,this.validateStartingState()}async verify(){this.assertNotDestroyed();const e=await this.render(),n=this.getAssertedRecaptcha(),r=n.getResponse(e);return r||new Promise(i=>{const s=o=>{o&&(this.tokenChangeListeners.delete(s),i(o))};this.tokenChangeListeners.add(s),this.isInvisible&&n.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise?this.renderPromise:(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),this.widgetId!==null&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){q(!this.parameters.sitekey,this.auth,"argument-error"),q(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),q(typeof document<"u",this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return n=>{if(this.tokenChangeListeners.forEach(r=>r(n)),typeof e=="function")e(n);else if(typeof e=="string"){const r=mt()[e];typeof r=="function"&&r(n)}}}assertNotDestroyed(){q(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){const n=document.createElement("div");e.appendChild(n),e=n}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){q(Zv()&&!l0(),this.auth,"internal-error"),await dU(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);const e=await dF(this.auth);q(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return q(this.recaptcha,this.auth,"internal-error"),this.recaptcha}};function dU(){let t=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}t=()=>e(),window.addEventListener("load",t)}).catch(e=>{throw t&&window.removeEventListener("load",t),e})}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class u0{constructor(e,n){this.verificationId=e,this.onConfirmation=n}confirm(e){const n=oo._fromVerification(this.verificationId,e);return this.onConfirmation(n)}}async function hU(t,e,n){if(nt(t.app))return Promise.reject(kt(t));const r=rt(t),i=await Dp(r,e,ee(n));return new u0(i,s=>Cp(r,s))}async function fU(t,e,n){const r=ee(t);await Pp(!1,r,"phone");const i=await Dp(r.auth,e,ee(n));return new u0(i,s=>mP(r,s))}async function pU(t,e,n){const r=ee(t);if(nt(r.auth.app))return Promise.reject(kt(r.auth));const i=await Dp(r.auth,e,ee(n));return new u0(i,s=>gP(r,s))}async function Dp(t,e,n){var r;const i=await n.verify();try{q(typeof i=="string",t,"argument-error"),q(n.type===PP,t,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){const o=s.session;if("phoneNumber"in s)return q(o.type==="enroll",t,"internal-error"),(await V4(t,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}})).phoneSessionInfo.sessionInfo;{q(o.type==="signin",t,"internal-error");const a=((r=s.multiFactorHint)===null||r===void 0?void 0:r.uid)||s.multiFactorUid;return q(a,t,"missing-multi-factor-info"),(await X4(t,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:i}})).phoneResponseInfo.sessionInfo}}else{const{sessionInfo:o}=await XF(t,{phoneNumber:s.phoneNumber,recaptchaToken:i});return o}}finally{n._reset()}}async function mU(t,e){const n=ee(t);if(nt(n.auth.app))return Promise.reject(kt(n.auth));await n0(n,e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let mo=class Oh{constructor(e){this.providerId=Oh.PROVIDER_ID,this.auth=rt(e)}verifyPhoneNumber(e,n){return Dp(this.auth,e,ee(n))}static credential(e,n){return oo._fromVerification(e,n)}static credentialFromResult(e){const n=e;return Oh.credentialFromTaggedObject(n)}static credentialFromError(e){return Oh.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{phoneNumber:n,temporaryProof:r}=e;return n&&r?oo._fromTokenResponse(n,r):null}};mo.PROVIDER_ID="phone";mo.PHONE_SIGN_IN_METHOD="phone";/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Oo(t,e){return e?Nn(e):(q(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class c0 extends ml{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ui(e,this._buildIdpRequest())}_linkToIdToken(e,n){return ui(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return ui(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function gU(t){return pP(t.auth,new c0(t),t.bypassAuthState)}function yU(t){const{auth:e,user:n}=t;return q(n,e,"internal-error"),fP(n,new c0(t),t.bypassAuthState)}async function _U(t){const{auth:e,user:n}=t;return q(n,e,"internal-error"),n0(n,new c0(t),t.bypassAuthState)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class CP{constructor(e,n,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const l={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(u){this.reject(u)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return gU;case"linkViaPopup":case"linkViaRedirect":return _U;case"reauthViaPopup":case"reauthViaRedirect":return yU;default:Ot(this.auth,"internal-error")}}resolve(e){yr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){yr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const vU=new qc(2e3,1e4);async function wU(t,e,n){if(nt(t.app))return Promise.reject(It(t,"operation-not-supported-in-this-environment"));const r=rt(t);pl(t,e,Ii);const i=Oo(r,n);return new si(r,"signInViaPopup",e,i).executeNotNull()}async function EU(t,e,n){const r=ee(t);if(nt(r.auth.app))return Promise.reject(It(r.auth,"operation-not-supported-in-this-environment"));pl(r.auth,e,Ii);const i=Oo(r.auth,n);return new si(r.auth,"reauthViaPopup",e,i,r).executeNotNull()}async function IU(t,e,n){const r=ee(t);pl(r.auth,e,Ii);const i=Oo(r.auth,n);return new si(r.auth,"linkViaPopup",e,i,r).executeNotNull()}class si extends CP{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,si.currentPopupAction&&si.currentPopupAction.cancel(),si.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return q(e,this.auth,"internal-error"),e}async onExecution(){yr(this.filter.length===1,"Popup operations only handle one event");const e=Yc();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(It(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(It(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,si.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if(!((r=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(It(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,vU.get())};e()}}si.currentPopupAction=null;/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const TU="pendingRedirect",Mu=new Map;class SU extends CP{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Mu.get(this.auth._key());if(!e){try{const r=await AU(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Mu.set(this.auth._key(),e)}return this.bypassAuthState||Mu.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function AU(t,e){const n=xP(e),r=kP(t);if(!await r._isAvailable())return!1;const i=await r._get(n)==="true";return await r._remove(n),i}async function d0(t,e){return kP(t)._set(xP(e),"true")}function bU(){Mu.clear()}function h0(t,e){Mu.set(t._key(),e)}function kP(t){return Nn(t._redirectPersistence)}function xP(t){return so(TU,t.config.apiKey,t.name)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function RU(t,e,n){return PU(t,e,n)}async function PU(t,e,n){if(nt(t.app))return Promise.reject(kt(t));const r=rt(t);pl(t,e,Ii),await r._initializationPromise;const i=Oo(r,n);return await d0(i,r),i._openRedirect(r,e,"signInViaRedirect")}function CU(t,e,n){return kU(t,e,n)}async function kU(t,e,n){const r=ee(t);if(pl(r.auth,e,Ii),nt(r.auth.app))return Promise.reject(kt(r.auth));await r.auth._initializationPromise;const i=Oo(r.auth,n);await d0(i,r.auth);const s=await OP(r);return i._openRedirect(r.auth,e,"reauthViaRedirect",s)}function xU(t,e,n){return OU(t,e,n)}async function OU(t,e,n){const r=ee(t);pl(r.auth,e,Ii),await r.auth._initializationPromise;const i=Oo(r.auth,n);await Pp(!1,r,e.providerId),await d0(i,r.auth);const s=await OP(r);return i._openRedirect(r.auth,e,"linkViaRedirect",s)}async function NU(t,e){return await rt(t)._initializationPromise,Vp(t,e,!1)}async function Vp(t,e,n=!1){if(nt(t.app))return Promise.reject(kt(t));const r=rt(t),i=Oo(r,e),o=await new SU(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}async function OP(t){const e=Yc(`${t.uid}:::`);return t._redirectEventId=e,await t.auth._setRedirectUser(t),await t.auth._persistUserIfCurrent(t),e}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const DU=10*60*1e3;class NP{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!VU(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!DP(e)){const i=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";n.onError(It(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=DU&&this.cachedEventUids.clear(),this.cachedEventUids.has(PT(e))}saveEventToCache(e){this.cachedEventUids.add(PT(e)),this.lastProcessedEventTime=Date.now()}}function PT(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function DP({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function VU(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return DP(t);default:return!1}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function VP(t,e={}){return at(t,"GET","/v1/projects",e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const LU=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,MU=/^https?/;async function FU(t){if(t.config.emulator)return;const{authorizedDomains:e}=await VP(t);for(const n of e)try{if(UU(n))return}catch{}Ot(t,"unauthorized-domain")}function UU(t){const e=yc(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!MU.test(n))return!1;if(LU.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const jU=new qc(3e4,6e4);function CT(){const t=mt().___jsl;if(t!=null&&t.H){for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n<t.CP.length;n++)t.CP[n]=null}}function BU(t){return new Promise((e,n)=>{var r,i,s;function o(){CT(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{CT(),n(It(t,"network-request-failed"))},timeout:jU.get()})}if(!((i=(r=mt().gapi)===null||r===void 0?void 0:r.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=mt().gapi)===null||s===void 0)&&s.load)o();else{const a=oP("iframefcb");return mt()[a]=()=>{gapi.load?o():n(It(t,"network-request-failed"))},t0(`${NF()}?onload=${a}`).catch(l=>n(l))}}).catch(e=>{throw Nh=null,e})}let Nh=null;function $U(t){return Nh=Nh||BU(t),Nh}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const zU=new qc(5e3,15e3),WU="__/auth/iframe",qU="emulator/auth/iframe",HU={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},KU=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function GU(t){const e=t.config;q(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?e0(e,qU):`https://${t.config.authDomain}/${WU}`,r={apiKey:e.apiKey,appName:t.name,v:bs},i=KU.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${hl(r).slice(1)}`}async function QU(t){const e=await $U(t),n=mt().gapi;return q(n,t,"internal-error"),e.open({where:document.body,url:GU(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:HU,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=It(t,"network-request-failed"),a=mt().setTimeout(()=>{s(o)},zU.get());function l(){mt().clearTimeout(a),i(r)}r.ping(l).then(l,()=>{s(o)})}))}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const YU={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},JU=500,XU=600,ZU="_blank",ej="http://localhost";class kT{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function tj(t,e,n,r=JU,i=XU){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const l=Object.assign(Object.assign({},YU),{width:r.toString(),height:i.toString(),top:s,left:o}),u=Ye().toLowerCase();n&&(a=eP(u)?ZU:n),XR(u)&&(e=e||ej,l.scrollbars="yes");const d=Object.entries(l).reduce((f,[g,_])=>`${f}${g}=${_},`,"");if(TF(u)&&a!=="_self")return nj(e||"",a),new kT(null);const h=window.open(e||"",a,d);q(h,t,"popup-blocked");try{h.focus()}catch{}return new kT(h)}function nj(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const rj="__/auth/handler",ij="emulator/auth/handler",sj=encodeURIComponent("fac");async function qy(t,e,n,r,i,s){q(t.config.authDomain,t,"auth-domain-config-required"),q(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:bs,eventId:i};if(e instanceof Ii){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",OL(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof gl){const d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const d of Object.keys(a))a[d]===void 0&&delete a[d];const l=await t._getAppCheckToken(),u=l?`#${sj}=${encodeURIComponent(l)}`:"";return`${oj(t)}?${hl(a).slice(1)}${u}`}function oj({config:t}){return t.emulator?e0(t,ij):`https://${t.authDomain}/${rj}`}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Rg="webStorageSupport";class aj{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=ds,this._completeRedirectFn=Vp,this._overrideRedirectResult=h0}async _openPopup(e,n,r,i){var s;yr((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");const o=await qy(e,n,r,yc(),i);return tj(e,o,Yc())}async _openRedirect(e,n,r,i){await this._originValidation(e);const s=await qy(e,n,r,yc(),i);return z4(s),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(yr(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await QU(e),r=new NP(e);return n.register("authEvent",i=>(q(i==null?void 0:i.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Rg,{type:Rg},i=>{var s;const o=(s=i==null?void 0:i[0])===null||s===void 0?void 0:s[Rg];o!==void 0&&n(!!o),Ot(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=FU(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return iP()||ZR()||Kc()}}const LP=aj;class lj{constructor(e){this.factorId=e}_process(e,n,r){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,r);case"signin":return this._finalizeSignIn(e,n.credential);default:return xr("unexpected MultiFactorSessionType")}}}class f0 extends lj{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new f0(e)}_finalizeEnroll(e,n,r){return L4(e,{idToken:n,displayName:r,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return Z4(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}}class MP{constructor(){}static assertion(e){return f0._fromCredential(e)}}MP.FACTOR_ID="phone";var xT="@firebase/auth",OT="1.7.9";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class uj{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){q(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function cj(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function dj(t){cs(new Br("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;q(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:sP(t)},u=new CF(r,i,s,l);return FF(u,n),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),cs(new Br("auth-internal",e=>{const n=rt(e.getProvider("auth").getImmediate());return(r=>new uj(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),mr(xT,OT,cj(t)),mr(xT,OT,"esm2017")}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const hj=5*60,fj=AR("authIdTokenMaxAge")||hj;let NT=null;const pj=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>fj)return;const i=n==null?void 0:n.token;NT!==i&&(NT=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function mj(t=FR()){const e=Sp(t,"auth");if(e.isInitialized())return e.getImmediate();const n=MF(t,{popupRedirectResolver:LP,persistence:[qa,xp,ds]}),r=AR("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const o=pj(s.toString());N4(n,o,()=>o(n.currentUser)),O4(n,a=>o(a))}}const i=IL("auth");return i&&aP(n,`http://${i}`),n}function gj(){var t,e;return(e=(t=document.getElementsByTagName("head"))===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:document}kF({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{const s=It("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",gj().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});dj("Browser");var DT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */var ao,FP;(function(){var t;/** @license Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */function e(A,I){function m(){}m.prototype=I.prototype,A.D=I.prototype,A.prototype=new m,A.prototype.constructor=A,A.C=function(R,k,N){for(var P=Array(arguments.length-2),he=2;he<arguments.length;he++)P[he-2]=arguments[he];return I.prototype[k].apply(R,P)}}function n(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(r,n),r.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function i(A,I,m){m||(m=0);var R=Array(16);if(typeof I=="string")for(var k=0;16>k;++k)R[k]=I.charCodeAt(m++)|I.charCodeAt(m++)<<8|I.charCodeAt(m++)<<16|I.charCodeAt(m++)<<24;else for(k=0;16>k;++k)R[k]=I[m++]|I[m++]<<8|I[m++]<<16|I[m++]<<24;I=A.g[0],m=A.g[1],k=A.g[2];var N=A.g[3],P=I+(N^m&(k^N))+R[0]+3614090360&4294967295;I=m+(P<<7&4294967295|P>>>25),P=N+(k^I&(m^k))+R[1]+3905402710&4294967295,N=I+(P<<12&4294967295|P>>>20),P=k+(m^N&(I^m))+R[2]+606105819&4294967295,k=N+(P<<17&4294967295|P>>>15),P=m+(I^k&(N^I))+R[3]+3250441966&4294967295,m=k+(P<<22&4294967295|P>>>10),P=I+(N^m&(k^N))+R[4]+4118548399&4294967295,I=m+(P<<7&4294967295|P>>>25),P=N+(k^I&(m^k))+R[5]+1200080426&4294967295,N=I+(P<<12&4294967295|P>>>20),P=k+(m^N&(I^m))+R[6]+2821735955&4294967295,k=N+(P<<17&4294967295|P>>>15),P=m+(I^k&(N^I))+R[7]+4249261313&4294967295,m=k+(P<<22&4294967295|P>>>10),P=I+(N^m&(k^N))+R[8]+1770035416&4294967295,I=m+(P<<7&4294967295|P>>>25),P=N+(k^I&(m^k))+R[9]+2336552879&4294967295,N=I+(P<<12&4294967295|P>>>20),P=k+(m^N&(I^m))+R[10]+4294925233&4294967295,k=N+(P<<17&4294967295|P>>>15),P=m+(I^k&(N^I))+R[11]+2304563134&4294967295,m=k+(P<<22&4294967295|P>>>10),P=I+(N^m&(k^N))+R[12]+1804603682&4294967295,I=m+(P<<7&4294967295|P>>>25),P=N+(k^I&(m^k))+R[13]+4254626195&4294967295,N=I+(P<<12&4294967295|P>>>20),P=k+(m^N&(I^m))+R[14]+2792965006&4294967295,k=N+(P<<17&4294967295|P>>>15),P=m+(I^k&(N^I))+R[15]+1236535329&4294967295,m=k+(P<<22&4294967295|P>>>10),P=I+(k^N&(m^k))+R[1]+4129170786&4294967295,I=m+(P<<5&4294967295|P>>>27),P=N+(m^k&(I^m))+R[6]+3225465664&4294967295,N=I+(P<<9&4294967295|P>>>23),P=k+(I^m&(N^I))+R[11]+643717713&4294967295,k=N+(P<<14&4294967295|P>>>18),P=m+(N^I&(k^N))+R[0]+3921069994&4294967295,m=k+(P<<20&4294967295|P>>>12),P=I+(k^N&(m^k))+R[5]+3593408605&4294967295,I=m+(P<<5&4294967295|P>>>27),P=N+(m^k&(I^m))+R[10]+38016083&4294967295,N=I+(P<<9&4294967295|P>>>23),P=k+(I^m&(N^I))+R[15]+3634488961&4294967295,k=N+(P<<14&4294967295|P>>>18),P=m+(N^I&(k^N))+R[4]+3889429448&4294967295,m=k+(P<<20&4294967295|P>>>12),P=I+(k^N&(m^k))+R[9]+568446438&4294967295,I=m+(P<<5&4294967295|P>>>27),P=N+(m^k&(I^m))+R[14]+3275163606&4294967295,N=I+(P<<9&4294967295|P>>>23),P=k+(I^m&(N^I))+R[3]+4107603335&4294967295,k=N+(P<<14&4294967295|P>>>18),P=m+(N^I&(k^N))+R[8]+1163531501&4294967295,m=k+(P<<20&4294967295|P>>>12),P=I+(k^N&(m^k))+R[13]+2850285829&4294967295,I=m+(P<<5&4294967295|P>>>27),P=N+(m^k&(I^m))+R[2]+4243563512&4294967295,N=I+(P<<9&4294967295|P>>>23),P=k+(I^m&(N^I))+R[7]+1735328473&4294967295,k=N+(P<<14&4294967295|P>>>18),P=m+(N^I&(k^N))+R[12]+2368359562&4294967295,m=k+(P<<20&4294967295|P>>>12),P=I+(m^k^N)+R[5]+4294588738&4294967295,I=m+(P<<4&4294967295|P>>>28),P=N+(I^m^k)+R[8]+2272392833&4294967295,N=I+(P<<11&4294967295|P>>>21),P=k+(N^I^m)+R[11]+1839030562&4294967295,k=N+(P<<16&4294967295|P>>>16),P=m+(k^N^I)+R[14]+4259657740&4294967295,m=k+(P<<23&4294967295|P>>>9),P=I+(m^k^N)+R[1]+2763975236&4294967295,I=m+(P<<4&4294967295|P>>>28),P=N+(I^m^k)+R[4]+1272893353&4294967295,N=I+(P<<11&4294967295|P>>>21),P=k+(N^I^m)+R[7]+4139469664&4294967295,k=N+(P<<16&4294967295|P>>>16),P=m+(k^N^I)+R[10]+3200236656&4294967295,m=k+(P<<23&4294967295|P>>>9),P=I+(m^k^N)+R[13]+681279174&4294967295,I=m+(P<<4&4294967295|P>>>28),P=N+(I^m^k)+R[0]+3936430074&4294967295,N=I+(P<<11&4294967295|P>>>21),P=k+(N^I^m)+R[3]+3572445317&4294967295,k=N+(P<<16&4294967295|P>>>16),P=m+(k^N^I)+R[6]+76029189&4294967295,m=k+(P<<23&4294967295|P>>>9),P=I+(m^k^N)+R[9]+3654602809&4294967295,I=m+(P<<4&4294967295|P>>>28),P=N+(I^m^k)+R[12]+3873151461&4294967295,N=I+(P<<11&4294967295|P>>>21),P=k+(N^I^m)+R[15]+530742520&4294967295,k=N+(P<<16&4294967295|P>>>16),P=m+(k^N^I)+R[2]+3299628645&4294967295,m=k+(P<<23&4294967295|P>>>9),P=I+(k^(m|~N))+R[0]+4096336452&4294967295,I=m+(P<<6&4294967295|P>>>26),P=N+(m^(I|~k))+R[7]+1126891415&4294967295,N=I+(P<<10&4294967295|P>>>22),P=k+(I^(N|~m))+R[14]+2878612391&4294967295,k=N+(P<<15&4294967295|P>>>17),P=m+(N^(k|~I))+R[5]+4237533241&4294967295,m=k+(P<<21&4294967295|P>>>11),P=I+(k^(m|~N))+R[12]+1700485571&4294967295,I=m+(P<<6&4294967295|P>>>26),P=N+(m^(I|~k))+R[3]+2399980690&4294967295,N=I+(P<<10&4294967295|P>>>22),P=k+(I^(N|~m))+R[10]+4293915773&4294967295,k=N+(P<<15&4294967295|P>>>17),P=m+(N^(k|~I))+R[1]+2240044497&4294967295,m=k+(P<<21&4294967295|P>>>11),P=I+(k^(m|~N))+R[8]+1873313359&4294967295,I=m+(P<<6&4294967295|P>>>26),P=N+(m^(I|~k))+R[15]+4264355552&4294967295,N=I+(P<<10&4294967295|P>>>22),P=k+(I^(N|~m))+R[6]+2734768916&4294967295,k=N+(P<<15&4294967295|P>>>17),P=m+(N^(k|~I))+R[13]+1309151649&4294967295,m=k+(P<<21&4294967295|P>>>11),P=I+(k^(m|~N))+R[4]+4149444226&4294967295,I=m+(P<<6&4294967295|P>>>26),P=N+(m^(I|~k))+R[11]+3174756917&4294967295,N=I+(P<<10&4294967295|P>>>22),P=k+(I^(N|~m))+R[2]+718787259&4294967295,k=N+(P<<15&4294967295|P>>>17),P=m+(N^(k|~I))+R[9]+3951481745&4294967295,A.g[0]=A.g[0]+I&4294967295,A.g[1]=A.g[1]+(k+(P<<21&4294967295|P>>>11))&4294967295,A.g[2]=A.g[2]+k&4294967295,A.g[3]=A.g[3]+N&4294967295}r.prototype.u=function(A,I){I===void 0&&(I=A.length);for(var m=I-this.blockSize,R=this.B,k=this.h,N=0;N<I;){if(k==0)for(;N<=m;)i(this,A,N),N+=this.blockSize;if(typeof A=="string"){for(;N<I;)if(R[k++]=A.charCodeAt(N++),k==this.blockSize){i(this,R),k=0;break}}else for(;N<I;)if(R[k++]=A[N++],k==this.blockSize){i(this,R),k=0;break}}this.h=k,this.o+=I},r.prototype.v=function(){var A=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);A[0]=128;for(var I=1;I<A.length-8;++I)A[I]=0;var m=8*this.o;for(I=A.length-8;I<A.length;++I)A[I]=m&255,m/=256;for(this.u(A),A=Array(16),I=m=0;4>I;++I)for(var R=0;32>R;R+=8)A[m++]=this.g[I]>>>R&255;return A};function s(A,I){var m=a;return Object.prototype.hasOwnProperty.call(m,A)?m[A]:m[A]=I(A)}function o(A,I){this.h=I;for(var m=[],R=!0,k=A.length-1;0<=k;k--){var N=A[k]|0;R&&N==I||(m[k]=N,R=!1)}this.g=m}var a={};function l(A){return-128<=A&&128>A?s(A,function(I){return new o([I|0],0>I?-1:0)}):new o([A|0],0>A?-1:0)}function u(A){if(isNaN(A)||!isFinite(A))return h;if(0>A)return T(u(-A));for(var I=[],m=1,R=0;A>=m;R++)I[R]=A/m|0,m*=4294967296;return new o(I,0)}function d(A,I){if(A.length==0)throw Error("number format error: empty string");if(I=I||10,2>I||36<I)throw Error("radix out of range: "+I);if(A.charAt(0)=="-")return T(d(A.substring(1),I));if(0<=A.indexOf("-"))throw Error('number format error: interior "-" character');for(var m=u(Math.pow(I,8)),R=h,k=0;k<A.length;k+=8){var N=Math.min(8,A.length-k),P=parseInt(A.substring(k,k+N),I);8>N?(N=u(Math.pow(I,N)),R=R.j(N).add(u(P))):(R=R.j(m),R=R.add(u(P)))}return R}var h=l(0),f=l(1),g=l(16777216);t=o.prototype,t.m=function(){if(v(this))return-T(this).m();for(var A=0,I=1,m=0;m<this.g.length;m++){var R=this.i(m);A+=(0<=R?R:4294967296+R)*I,I*=4294967296}return A},t.toString=function(A){if(A=A||10,2>A||36<A)throw Error("radix out of range: "+A);if(_(this))return"0";if(v(this))return"-"+T(this).toString(A);for(var I=u(Math.pow(A,6)),m=this,R="";;){var k=x(m,I).g;m=S(m,k.j(I));var N=((0<m.g.length?m.g[0]:m.h)>>>0).toString(A);if(m=k,_(m))return N+R;for(;6>N.length;)N="0"+N;R=N+R}},t.i=function(A){return 0>A?0:A<this.g.length?this.g[A]:this.h};function _(A){if(A.h!=0)return!1;for(var I=0;I<A.g.length;I++)if(A.g[I]!=0)return!1;return!0}function v(A){return A.h==-1}t.l=function(A){return A=S(this,A),v(A)?-1:_(A)?0:1};function T(A){for(var I=A.g.length,m=[],R=0;R<I;R++)m[R]=~A.g[R];return new o(m,~A.h).add(f)}t.abs=function(){return v(this)?T(this):this},t.add=function(A){for(var I=Math.max(this.g.length,A.g.length),m=[],R=0,k=0;k<=I;k++){var N=R+(this.i(k)&65535)+(A.i(k)&65535),P=(N>>>16)+(this.i(k)>>>16)+(A.i(k)>>>16);R=P>>>16,N&=65535,P&=65535,m[k]=P<<16|N}return new o(m,m[m.length-1]&-2147483648?-1:0)};function S(A,I){return A.add(T(I))}t.j=function(A){if(_(this)||_(A))return h;if(v(this))return v(A)?T(this).j(T(A)):T(T(this).j(A));if(v(A))return T(this.j(T(A)));if(0>this.l(g)&&0>A.l(g))return u(this.m()*A.m());for(var I=this.g.length+A.g.length,m=[],R=0;R<2*I;R++)m[R]=0;for(R=0;R<this.g.length;R++)for(var k=0;k<A.g.length;k++){var N=this.i(R)>>>16,P=this.i(R)&65535,he=A.i(k)>>>16,oe=A.i(k)&65535;m[2*R+2*k]+=P*oe,w(m,2*R+2*k),m[2*R+2*k+1]+=N*oe,w(m,2*R+2*k+1),m[2*R+2*k+1]+=P*he,w(m,2*R+2*k+1),m[2*R+2*k+2]+=N*he,w(m,2*R+2*k+2)}for(R=0;R<I;R++)m[R]=m[2*R+1]<<16|m[2*R];for(R=I;R<2*I;R++)m[R]=0;return new o(m,0)};function w(A,I){for(;(A[I]&65535)!=A[I];)A[I+1]+=A[I]>>>16,A[I]&=65535,I++}function E(A,I){this.g=A,this.h=I}function x(A,I){if(_(I))throw Error("division by zero");if(_(A))return new E(h,h);if(v(A))return I=x(T(A),I),new E(T(I.g),T(I.h));if(v(I))return I=x(A,T(I)),new E(T(I.g),I.h);if(30<A.g.length){if(v(A)||v(I))throw Error("slowDivide_ only works with positive integers.");for(var m=f,R=I;0>=R.l(A);)m=O(m),R=O(R);var k=D(m,1),N=D(R,1);for(R=D(R,2),m=D(m,2);!_(R);){var P=N.add(R);0>=P.l(A)&&(k=k.add(m),N=P),R=D(R,1),m=D(m,1)}return I=S(A,k.j(I)),new E(k,I)}for(k=h;0<=A.l(I);){for(m=Math.max(1,Math.floor(A.m()/I.m())),R=Math.ceil(Math.log(m)/Math.LN2),R=48>=R?1:Math.pow(2,R-48),N=u(m),P=N.j(I);v(P)||0<P.l(A);)m-=R,N=u(m),P=N.j(I);_(N)&&(N=f),k=k.add(N),A=S(A,P)}return new E(k,A)}t.A=function(A){return x(this,A).h},t.and=function(A){for(var I=Math.max(this.g.length,A.g.length),m=[],R=0;R<I;R++)m[R]=this.i(R)&A.i(R);return new o(m,this.h&A.h)},t.or=function(A){for(var I=Math.max(this.g.length,A.g.length),m=[],R=0;R<I;R++)m[R]=this.i(R)|A.i(R);return new o(m,this.h|A.h)},t.xor=function(A){for(var I=Math.max(this.g.length,A.g.length),m=[],R=0;R<I;R++)m[R]=this.i(R)^A.i(R);return new o(m,this.h^A.h)};function O(A){for(var I=A.g.length+1,m=[],R=0;R<I;R++)m[R]=A.i(R)<<1|A.i(R-1)>>>31;return new o(m,A.h)}function D(A,I){var m=I>>5;I%=32;for(var R=A.g.length-m,k=[],N=0;N<R;N++)k[N]=0<I?A.i(N+m)>>>I|A.i(N+m+1)<<32-I:A.i(N+m);return new o(k,A.h)}r.prototype.digest=r.prototype.v,r.prototype.reset=r.prototype.s,r.prototype.update=r.prototype.u,FP=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.A,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=u,o.fromString=d,ao=o}).apply(typeof DT<"u"?DT:typeof self<"u"?self:typeof window<"u"?window:{});var nh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */var UP,jP,vu,BP,Dh,Hy,$P,zP,WP;(function(){var t,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(c,p,y){return c==Array.prototype||c==Object.prototype||(c[p]=y.value),c};function n(c){c=[typeof globalThis=="object"&&globalThis,c,typeof window=="object"&&window,typeof self=="object"&&self,typeof nh=="object"&&nh];for(var p=0;p<c.length;++p){var y=c[p];if(y&&y.Math==Math)return y}throw Error("Cannot find global object")}var r=n(this);function i(c,p){if(p)e:{var y=r;c=c.split(".");for(var b=0;b<c.length-1;b++){var V=c[b];if(!(V in y))break e;y=y[V]}c=c[c.length-1],b=y[c],p=p(b),p!=b&&p!=null&&e(y,c,{configurable:!0,writable:!0,value:p})}}function s(c,p){c instanceof String&&(c+="");var y=0,b=!1,V={next:function(){if(!b&&y<c.length){var U=y++;return{value:p(U,c[U]),done:!1}}return b=!0,{done:!0,value:void 0}}};return V[Symbol.iterator]=function(){return V},V}i("Array.prototype.values",function(c){return c||function(){return s(this,function(p,y){return y})}});/** @license Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */var o=o||{},a=this||self;function l(c){var p=typeof c;return p=p!="object"?p:c?Array.isArray(c)?"array":p:"null",p=="array"||p=="object"&&typeof c.length=="number"}function u(c){var p=typeof c;return p=="object"&&c!=null||p=="function"}function d(c,p,y){return c.call.apply(c.bind,arguments)}function h(c,p,y){if(!c)throw Error();if(2<arguments.length){var b=Array.prototype.slice.call(arguments,2);return function(){var V=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(V,b),c.apply(p,V)}}return function(){return c.apply(p,arguments)}}function f(c,p,y){return f=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?d:h,f.apply(null,arguments)}function g(c,p){var y=Array.prototype.slice.call(arguments,1);return function(){var b=y.slice();return b.push.apply(b,arguments),c.apply(this,b)}}function _(c,p){function y(){}y.prototype=p.prototype,c.aa=p.prototype,c.prototype=new y,c.prototype.constructor=c,c.Qb=function(b,V,U){for(var H=Array(arguments.length-2),Pe=2;Pe<arguments.length;Pe++)H[Pe-2]=arguments[Pe];return p.prototype[V].apply(b,H)}}function v(c){const p=c.length;if(0<p){const y=Array(p);for(let b=0;b<p;b++)y[b]=c[b];return y}return[]}function T(c,p){for(let y=1;y<arguments.length;y++){const b=arguments[y];if(l(b)){const V=c.length||0,U=b.length||0;c.length=V+U;for(let H=0;H<U;H++)c[V+H]=b[H]}else c.push(b)}}class S{constructor(p,y){this.i=p,this.j=y,this.h=0,this.g=null}get(){let p;return 0<this.h?(this.h--,p=this.g,this.g=p.next,p.next=null):p=this.i(),p}}function w(c){return/^[\s\xa0]*$/.test(c)}function E(){var c=a.navigator;return c&&(c=c.userAgent)?c:""}function x(c){return x[" "](c),c}x[" "]=function(){};var O=E().indexOf("Gecko")!=-1&&!(E().toLowerCase().indexOf("webkit")!=-1&&E().indexOf("Edge")==-1)&&!(E().indexOf("Trident")!=-1||E().indexOf("MSIE")!=-1)&&E().indexOf("Edge")==-1;function D(c,p,y){for(const b in c)p.call(y,c[b],b,c)}function A(c,p){for(const y in c)p.call(void 0,c[y],y,c)}function I(c){const p={};for(const y in c)p[y]=c[y];return p}const m="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function R(c,p){let y,b;for(let V=1;V<arguments.length;V++){b=arguments[V];for(y in b)c[y]=b[y];for(let U=0;U<m.length;U++)y=m[U],Object.prototype.hasOwnProperty.call(b,y)&&(c[y]=b[y])}}function k(c){var p=1;c=c.split(":");const y=[];for(;0<p&&c.length;)y.push(c.shift()),p--;return c.length&&y.push(c.join(":")),y}function N(c){a.setTimeout(()=>{throw c},0)}function P(){var c=te;let p=null;return c.g&&(p=c.g,c.g=c.g.next,c.g||(c.h=null),p.next=null),p}class he{constructor(){this.h=this.g=null}add(p,y){const b=oe.get();b.set(p,y),this.h?this.h.next=b:this.g=b,this.h=b}}var oe=new S(()=>new vt,c=>c.reset());class vt{constructor(){this.next=this.g=this.h=null}set(p,y){this.h=p,this.g=y,this.next=null}reset(){this.next=this.g=this.h=null}}let We,G=!1,te=new he,ne=()=>{const c=a.Promise.resolve(void 0);We=()=>{c.then(ue)}};var ue=()=>{for(var c;c=P();){try{c.h.call(c.g)}catch(y){N(y)}var p=oe;p.j(c),100>p.h&&(p.h++,c.next=p.g,p.g=c)}G=!1};function Ie(){this.s=this.s,this.C=this.C}Ie.prototype.s=!1,Ie.prototype.ma=function(){this.s||(this.s=!0,this.N())},Ie.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function Me(c,p){this.type=c,this.g=this.target=p,this.defaultPrevented=!1}Me.prototype.h=function(){this.defaultPrevented=!0};var tr=function(){if(!a.addEventListener||!Object.defineProperty)return!1;var c=!1,p=Object.defineProperty({},"passive",{get:function(){c=!0}});try{const y=()=>{};a.addEventListener("test",y,p),a.removeEventListener("test",y,p)}catch{}return c}();function nr(c,p){if(Me.call(this,c?c.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,c){var y=this.type=c.type,b=c.changedTouches&&c.changedTouches.length?c.changedTouches[0]:null;if(this.target=c.target||c.srcElement,this.g=p,p=c.relatedTarget){if(O){e:{try{x(p.nodeName);var V=!0;break e}catch{}V=!1}V||(p=null)}}else y=="mouseover"?p=c.fromElement:y=="mouseout"&&(p=c.toElement);this.relatedTarget=p,b?(this.clientX=b.clientX!==void 0?b.clientX:b.pageX,this.clientY=b.clientY!==void 0?b.clientY:b.pageY,this.screenX=b.screenX||0,this.screenY=b.screenY||0):(this.clientX=c.clientX!==void 0?c.clientX:c.pageX,this.clientY=c.clientY!==void 0?c.clientY:c.pageY,this.screenX=c.screenX||0,this.screenY=c.screenY||0),this.button=c.button,this.key=c.key||"",this.ctrlKey=c.ctrlKey,this.altKey=c.altKey,this.shiftKey=c.shiftKey,this.metaKey=c.metaKey,this.pointerId=c.pointerId||0,this.pointerType=typeof c.pointerType=="string"?c.pointerType:rr[c.pointerType]||"",this.state=c.state,this.i=c,c.defaultPrevented&&nr.aa.h.call(this)}}_(nr,Me);var rr={2:"touch",3:"pen",4:"mouse"};nr.prototype.h=function(){nr.aa.h.call(this);var c=this.i;c.preventDefault?c.preventDefault():c.returnValue=!1};var ir="closure_listenable_"+(1e6*Math.random()|0),Id=0;function Os(c,p,y,b,V){this.listener=c,this.proxy=null,this.src=p,this.type=y,this.capture=!!b,this.ha=V,this.key=++Id,this.da=this.fa=!1}function An(c){c.da=!0,c.listener=null,c.proxy=null,c.src=null,c.ha=null}function Re(c){this.src=c,this.g={},this.h=0}Re.prototype.add=function(c,p,y,b,V){var U=c.toString();c=this.g[U],c||(c=this.g[U]=[],this.h++);var H=Jt(c,p,b,V);return-1<H?(p=c[H],y||(p.fa=!1)):(p=new Os(p,this.src,U,!!b,V),p.fa=y,c.push(p)),p};function ht(c,p){var y=p.type;if(y in c.g){var b=c.g[y],V=Array.prototype.indexOf.call(b,p,void 0),U;(U=0<=V)&&Array.prototype.splice.call(b,V,1),U&&(An(p),c.g[y].length==0&&(delete c.g[y],c.h--))}}function Jt(c,p,y,b){for(var V=0;V<c.length;++V){var U=c[V];if(!U.da&&U.listener==p&&U.capture==!!y&&U.ha==b)return V}return-1}var bi="closure_lm_"+(1e6*Math.random()|0),wr={};function qr(c,p,y,b,V){if(Array.isArray(p)){for(var U=0;U<p.length;U++)qr(c,p[U],y,b,V);return null}return y=Ww(y),c&&c[ir]?c.K(p,y,u(b)?!!b.capture:!!b,V):sr(c,p,y,!1,b,V)}function sr(c,p,y,b,V,U){if(!p)throw Error("Invalid event type");var H=u(V)?!!V.capture:!!V,Pe=Pm(c);if(Pe||(c[bi]=Pe=new Re(c)),y=Pe.add(p,y,b,H,U),y.proxy)return y;if(b=Hr(),y.proxy=b,b.src=c,b.listener=y,c.addEventListener)tr||(V=H),V===void 0&&(V=!1),c.addEventListener(p.toString(),b,V);else if(c.attachEvent)c.attachEvent(zw(p.toString()),b);else if(c.addListener&&c.removeListener)c.addListener(b);else throw Error("addEventListener and attachEvent are unavailable.");return y}function Hr(){function c(y){return p.call(c.src,c.listener,y)}const p=BO;return c}function Fo(c,p,y,b,V){if(Array.isArray(p))for(var U=0;U<p.length;U++)Fo(c,p[U],y,b,V);else b=u(b)?!!b.capture:!!b,y=Ww(y),c&&c[ir]?(c=c.i,p=String(p).toString(),p in c.g&&(U=c.g[p],y=Jt(U,y,b,V),-1<y&&(An(U[y]),Array.prototype.splice.call(U,y,1),U.length==0&&(delete c.g[p],c.h--)))):c&&(c=Pm(c))&&(p=c.g[p.toString()],c=-1,p&&(c=Jt(p,y,b,V)),(y=-1<c?p[c]:null)&&Rm(y))}function Rm(c){if(typeof c!="number"&&c&&!c.da){var p=c.src;if(p&&p[ir])ht(p.i,c);else{var y=c.type,b=c.proxy;p.removeEventListener?p.removeEventListener(y,b,c.capture):p.detachEvent?p.detachEvent(zw(y),b):p.addListener&&p.removeListener&&p.removeListener(b),(y=Pm(p))?(ht(y,c),y.h==0&&(y.src=null,p[bi]=null)):An(c)}}}function zw(c){return c in wr?wr[c]:wr[c]="on"+c}function BO(c,p){if(c.da)c=!0;else{p=new nr(p,this);var y=c.listener,b=c.ha||c.src;c.fa&&Rm(c),c=y.call(b,p)}return c}function Pm(c){return c=c[bi],c instanceof Re?c:null}var Cm="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ww(c){return typeof c=="function"?c:(c[Cm]||(c[Cm]=function(p){return c.handleEvent(p)}),c[Cm])}function Bt(){Ie.call(this),this.i=new Re(this),this.M=this,this.F=null}_(Bt,Ie),Bt.prototype[ir]=!0,Bt.prototype.removeEventListener=function(c,p,y,b){Fo(this,c,p,y,b)};function Xt(c,p){var y,b=c.F;if(b)for(y=[];b;b=b.F)y.push(b);if(c=c.M,b=p.type||p,typeof p=="string")p=new Me(p,c);else if(p instanceof Me)p.target=p.target||c;else{var V=p;p=new Me(b,c),R(p,V)}if(V=!0,y)for(var U=y.length-1;0<=U;U--){var H=p.g=y[U];V=Td(H,b,!0,p)&&V}if(H=p.g=c,V=Td(H,b,!0,p)&&V,V=Td(H,b,!1,p)&&V,y)for(U=0;U<y.length;U++)H=p.g=y[U],V=Td(H,b,!1,p)&&V}Bt.prototype.N=function(){if(Bt.aa.N.call(this),this.i){var c=this.i,p;for(p in c.g){for(var y=c.g[p],b=0;b<y.length;b++)An(y[b]);delete c.g[p],c.h--}}this.F=null},Bt.prototype.K=function(c,p,y,b){return this.i.add(String(c),p,!1,y,b)},Bt.prototype.L=function(c,p,y,b){return this.i.add(String(c),p,!0,y,b)};function Td(c,p,y,b){if(p=c.i.g[String(p)],!p)return!0;p=p.concat();for(var V=!0,U=0;U<p.length;++U){var H=p[U];if(H&&!H.da&&H.capture==y){var Pe=H.listener,Dt=H.ha||H.src;H.fa&&ht(c.i,H),V=Pe.call(Dt,b)!==!1&&V}}return V&&!b.defaultPrevented}function qw(c,p,y){if(typeof c=="function")y&&(c=f(c,y));else if(c&&typeof c.handleEvent=="function")c=f(c.handleEvent,c);else throw Error("Invalid listener argument");return 2147483647<Number(p)?-1:a.setTimeout(c,p||0)}function Hw(c){c.g=qw(()=>{c.g=null,c.i&&(c.i=!1,Hw(c))},c.l);const p=c.h;c.h=null,c.m.apply(null,p)}class $O extends Ie{constructor(p,y){super(),this.m=p,this.l=y,this.h=null,this.i=!1,this.g=null}j(p){this.h=arguments,this.g?this.i=!0:Hw(this)}N(){super.N(),this.g&&(a.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function xl(c){Ie.call(this),this.h=c,this.g={}}_(xl,Ie);var Kw=[];function Gw(c){D(c.g,function(p,y){this.g.hasOwnProperty(y)&&Rm(p)},c),c.g={}}xl.prototype.N=function(){xl.aa.N.call(this),Gw(this)},xl.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var km=a.JSON.stringify,zO=a.JSON.parse,WO=class{stringify(c){return a.JSON.stringify(c,void 0)}parse(c){return a.JSON.parse(c,void 0)}};function xm(){}xm.prototype.h=null;function Qw(c){return c.h||(c.h=c.i())}function Yw(){}var Ol={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function Om(){Me.call(this,"d")}_(Om,Me);function Nm(){Me.call(this,"c")}_(Nm,Me);var Ns={},Jw=null;function Sd(){return Jw=Jw||new Bt}Ns.La="serverreachability";function Xw(c){Me.call(this,Ns.La,c)}_(Xw,Me);function Nl(c){const p=Sd();Xt(p,new Xw(p))}Ns.STAT_EVENT="statevent";function Zw(c,p){Me.call(this,Ns.STAT_EVENT,c),this.stat=p}_(Zw,Me);function Zt(c){const p=Sd();Xt(p,new Zw(p,c))}Ns.Ma="timingevent";function eE(c,p){Me.call(this,Ns.Ma,c),this.size=p}_(eE,Me);function Dl(c,p){if(typeof c!="function")throw Error("Fn must not be null and must be a function");return a.setTimeout(function(){c()},p)}function Vl(){this.g=!0}Vl.prototype.xa=function(){this.g=!1};function qO(c,p,y,b,V,U){c.info(function(){if(c.g)if(U)for(var H="",Pe=U.split("&"),Dt=0;Dt<Pe.length;Dt++){var ve=Pe[Dt].split("=");if(1<ve.length){var $t=ve[0];ve=ve[1];var zt=$t.split("_");H=2<=zt.length&&zt[1]=="type"?H+($t+"="+ve+"&"):H+($t+"=redacted&")}}else H=null;else H=U;return"XMLHTTP REQ ("+b+") [attempt "+V+"]: "+p+` `+y+` `+H})}function HO(c,p,y,b,V,U,H){c.info(function(){return"XMLHTTP RESP ("+b+") [ attempt "+V+"]: "+p+` `+y+` `+U+" "+H})}function Uo(c,p,y,b){c.info(function(){return"XMLHTTP TEXT ("+p+"): "+GO(c,y)+(b?" "+b:"")})}function KO(c,p){c.info(function(){return"TIMEOUT: "+p})}Vl.prototype.info=function(){};function GO(c,p){if(!c.g)return p;if(!p)return null;try{var y=JSON.parse(p);if(y){for(c=0;c<y.length;c++)if(Array.isArray(y[c])){var b=y[c];if(!(2>b.length)){var V=b[1];if(Array.isArray(V)&&!(1>V.length)){var U=V[0];if(U!="noop"&&U!="stop"&&U!="close")for(var H=1;H<V.length;H++)V[H]=""}}}}return km(y)}catch{return p}}var Ad={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},tE={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},Dm;function bd(){}_(bd,xm),bd.prototype.g=function(){return new XMLHttpRequest},bd.prototype.i=function(){return{}},Dm=new bd;function Ri(c,p,y,b){this.j=c,this.i=p,this.l=y,this.R=b||1,this.U=new xl(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new nE}function nE(){this.i=null,this.g="",this.h=!1}var rE={},Vm={};function Lm(c,p,y){c.L=1,c.v=kd(Kr(p)),c.m=y,c.P=!0,iE(c,null)}function iE(c,p){c.F=Date.now(),Rd(c),c.A=Kr(c.v);var y=c.A,b=c.R;Array.isArray(b)||(b=[String(b)]),_E(y.i,"t",b),c.C=0,y=c.j.J,c.h=new nE,c.g=LE(c.j,y?p:null,!c.m),0<c.O&&(c.M=new $O(f(c.Y,c,c.g),c.O)),p=c.U,y=c.g,b=c.ca;var V="readystatechange";Array.isArray(V)||(V&&(Kw[0]=V.toString()),V=Kw);for(var U=0;U<V.length;U++){var H=qr(y,V[U],b||p.handleEvent,!1,p.h||p);if(!H)break;p.g[H.key]=H}p=c.H?I(c.H):{},c.m?(c.u||(c.u="POST"),p["Content-Type"]="application/x-www-form-urlencoded",c.g.ea(c.A,c.u,c.m,p)):(c.u="GET",c.g.ea(c.A,c.u,null,p)),Nl(),qO(c.i,c.u,c.A,c.l,c.R,c.m)}Ri.prototype.ca=function(c){c=c.target;const p=this.M;p&&Gr(c)==3?p.j():this.Y(c)},Ri.prototype.Y=function(c){try{if(c==this.g)e:{const zt=Gr(this.g);var p=this.g.Ba();const $o=this.g.Z();if(!(3>zt)&&(zt!=3||this.g&&(this.h.h||this.g.oa()||AE(this.g)))){this.J||zt!=4||p==7||(p==8||0>=$o?Nl(3):Nl(2)),Mm(this);var y=this.g.Z();this.X=y;t:if(sE(this)){var b=AE(this.g);c="";var V=b.length,U=Gr(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){Ds(this),Ll(this);var H="";break t}this.h.i=new a.TextDecoder}for(p=0;p<V;p++)this.h.h=!0,c+=this.h.i.decode(b[p],{stream:!(U&&p==V-1)});b.length=0,this.h.g+=c,this.C=0,H=this.h.g}else H=this.g.oa();if(this.o=y==200,HO(this.i,this.u,this.A,this.l,this.R,zt,y),this.o){if(this.T&&!this.K){t:{if(this.g){var Pe,Dt=this.g;if((Pe=Dt.g?Dt.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!w(Pe)){var ve=Pe;break t}}ve=null}if(y=ve)Uo(this.i,this.l,y,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Fm(this,y);else{this.o=!1,this.s=3,Zt(12),Ds(this),Ll(this);break e}}if(this.P){y=!0;let or;for(;!this.J&&this.C<H.length;)if(or=QO(this,H),or==Vm){zt==4&&(this.s=4,Zt(14),y=!1),Uo(this.i,this.l,null,"[Incomplete Response]");break}else if(or==rE){this.s=4,Zt(15),Uo(this.i,this.l,H,"[Invalid Chunk]"),y=!1;break}else Uo(this.i,this.l,or,null),Fm(this,or);if(sE(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),zt!=4||H.length!=0||this.h.h||(this.s=1,Zt(16),y=!1),this.o=this.o&&y,!y)Uo(this.i,this.l,H,"[Invalid Chunked Response]"),Ds(this),Ll(this);else if(0<H.length&&!this.W){this.W=!0;var $t=this.j;$t.g==this&&$t.ba&&!$t.M&&($t.j.info("Great, no buffering proxy detected. Bytes received: "+H.length),Wm($t),$t.M=!0,Zt(11))}}else Uo(this.i,this.l,H,null),Fm(this,H);zt==4&&Ds(this),this.o&&!this.J&&(zt==4?OE(this.j,this):(this.o=!1,Rd(this)))}else hN(this.g),y==400&&0<H.indexOf("Unknown SID")?(this.s=3,Zt(12)):(this.s=0,Zt(13)),Ds(this),Ll(this)}}}catch{}finally{}};function sE(c){return c.g?c.u=="GET"&&c.L!=2&&c.j.Ca:!1}function QO(c,p){var y=c.C,b=p.indexOf(` `,y);return b==-1?Vm:(y=Number(p.substring(y,b)),isNaN(y)?rE:(b+=1,b+y>p.length?Vm:(p=p.slice(b,b+y),c.C=b+y,p)))}Ri.prototype.cancel=function(){this.J=!0,Ds(this)};function Rd(c){c.S=Date.now()+c.I,oE(c,c.I)}function oE(c,p){if(c.B!=null)throw Error("WatchDog timer not null");c.B=Dl(f(c.ba,c),p)}function Mm(c){c.B&&(a.clearTimeout(c.B),c.B=null)}Ri.prototype.ba=function(){this.B=null;const c=Date.now();0<=c-this.S?(KO(this.i,this.A),this.L!=2&&(Nl(),Zt(17)),Ds(this),this.s=2,Ll(this)):oE(this,this.S-c)};function Ll(c){c.j.G==0||c.J||OE(c.j,c)}function Ds(c){Mm(c);var p=c.M;p&&typeof p.ma=="function"&&p.ma(),c.M=null,Gw(c.U),c.g&&(p=c.g,c.g=null,p.abort(),p.ma())}function Fm(c,p){try{var y=c.j;if(y.G!=0&&(y.g==c||Um(y.h,c))){if(!c.K&&Um(y.h,c)&&y.G==3){try{var b=y.Da.g.parse(p)}catch{b=null}if(Array.isArray(b)&&b.length==3){var V=b;if(V[0]==0){e:if(!y.u){if(y.g)if(y.g.F+3e3<c.F)Vd(y),Nd(y);else break e;zm(y),Zt(18)}}else y.za=V[1],0<y.za-y.T&&37500>V[2]&&y.F&&y.v==0&&!y.C&&(y.C=Dl(f(y.Za,y),6e3));if(1>=uE(y.h)&&y.ca){try{y.ca()}catch{}y.ca=void 0}}else Ls(y,11)}else if((c.K||y.g==c)&&Vd(y),!w(p))for(V=y.Da.g.parse(p),p=0;p<V.length;p++){let ve=V[p];if(y.T=ve[0],ve=ve[1],y.G==2)if(ve[0]=="c"){y.K=ve[1],y.ia=ve[2];const $t=ve[3];$t!=null&&(y.la=$t,y.j.info("VER="+y.la));const zt=ve[4];zt!=null&&(y.Aa=zt,y.j.info("SVER="+y.Aa));const $o=ve[5];$o!=null&&typeof $o=="number"&&0<$o&&(b=1.5*$o,y.L=b,y.j.info("backChannelRequestTimeoutMs_="+b)),b=y;const or=c.g;if(or){const Md=or.g?or.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Md){var U=b.h;U.g||Md.indexOf("spdy")==-1&&Md.indexOf("quic")==-1&&Md.indexOf("h2")==-1||(U.j=U.l,U.g=new Set,U.h&&(jm(U,U.h),U.h=null))}if(b.D){const qm=or.g?or.g.getResponseHeader("X-HTTP-Session-Id"):null;qm&&(b.ya=qm,Ne(b.I,b.D,qm))}}y.G=3,y.l&&y.l.ua(),y.ba&&(y.R=Date.now()-c.F,y.j.info("Handshake RTT: "+y.R+"ms")),b=y;var H=c;if(b.qa=VE(b,b.J?b.ia:null,b.W),H.K){cE(b.h,H);var Pe=H,Dt=b.L;Dt&&(Pe.I=Dt),Pe.B&&(Mm(Pe),Rd(Pe)),b.g=H}else kE(b);0<y.i.length&&Dd(y)}else ve[0]!="stop"&&ve[0]!="close"||Ls(y,7);else y.G==3&&(ve[0]=="stop"||ve[0]=="close"?ve[0]=="stop"?Ls(y,7):$m(y):ve[0]!="noop"&&y.l&&y.l.ta(ve),y.v=0)}}Nl(4)}catch{}}var YO=class{constructor(c,p){this.g=c,this.map=p}};function aE(c){this.l=c||10,a.PerformanceNavigationTiming?(c=a.performance.getEntriesByType("navigation"),c=0<c.length&&(c[0].nextHopProtocol=="hq"||c[0].nextHopProtocol=="h2")):c=!!(a.chrome&&a.chrome.loadTimes&&a.chrome.loadTimes()&&a.chrome.loadTimes().wasFetchedViaSpdy),this.j=c?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function lE(c){return c.h?!0:c.g?c.g.size>=c.j:!1}function uE(c){return c.h?1:c.g?c.g.size:0}function Um(c,p){return c.h?c.h==p:c.g?c.g.has(p):!1}function jm(c,p){c.g?c.g.add(p):c.h=p}function cE(c,p){c.h&&c.h==p?c.h=null:c.g&&c.g.has(p)&&c.g.delete(p)}aE.prototype.cancel=function(){if(this.i=dE(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const c of this.g.values())c.cancel();this.g.clear()}};function dE(c){if(c.h!=null)return c.i.concat(c.h.D);if(c.g!=null&&c.g.size!==0){let p=c.i;for(const y of c.g.values())p=p.concat(y.D);return p}return v(c.i)}function JO(c){if(c.V&&typeof c.V=="function")return c.V();if(typeof Map<"u"&&c instanceof Map||typeof Set<"u"&&c instanceof Set)return Array.from(c.values());if(typeof c=="string")return c.split("");if(l(c)){for(var p=[],y=c.length,b=0;b<y;b++)p.push(c[b]);return p}p=[],y=0;for(b in c)p[y++]=c[b];return p}function XO(c){if(c.na&&typeof c.na=="function")return c.na();if(!c.V||typeof c.V!="function"){if(typeof Map<"u"&&c instanceof Map)return Array.from(c.keys());if(!(typeof Set<"u"&&c instanceof Set)){if(l(c)||typeof c=="string"){var p=[];c=c.length;for(var y=0;y<c;y++)p.push(y);return p}p=[],y=0;for(const b in c)p[y++]=b;return p}}}function hE(c,p){if(c.forEach&&typeof c.forEach=="function")c.forEach(p,void 0);else if(l(c)||typeof c=="string")Array.prototype.forEach.call(c,p,void 0);else for(var y=XO(c),b=JO(c),V=b.length,U=0;U<V;U++)p.call(void 0,b[U],y&&y[U],c)}var fE=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function ZO(c,p){if(c){c=c.split("&");for(var y=0;y<c.length;y++){var b=c[y].indexOf("="),V=null;if(0<=b){var U=c[y].substring(0,b);V=c[y].substring(b+1)}else U=c[y];p(U,V?decodeURIComponent(V.replace(/\+/g," ")):"")}}}function Vs(c){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,c instanceof Vs){this.h=c.h,Pd(this,c.j),this.o=c.o,this.g=c.g,Cd(this,c.s),this.l=c.l;var p=c.i,y=new Ul;y.i=p.i,p.g&&(y.g=new Map(p.g),y.h=p.h),pE(this,y),this.m=c.m}else c&&(p=String(c).match(fE))?(this.h=!1,Pd(this,p[1]||"",!0),this.o=Ml(p[2]||""),this.g=Ml(p[3]||"",!0),Cd(this,p[4]),this.l=Ml(p[5]||"",!0),pE(this,p[6]||"",!0),this.m=Ml(p[7]||"")):(this.h=!1,this.i=new Ul(null,this.h))}Vs.prototype.toString=function(){var c=[],p=this.j;p&&c.push(Fl(p,mE,!0),":");var y=this.g;return(y||p=="file")&&(c.push("//"),(p=this.o)&&c.push(Fl(p,mE,!0),"@"),c.push(encodeURIComponent(String(y)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),y=this.s,y!=null&&c.push(":",String(y))),(y=this.l)&&(this.g&&y.charAt(0)!="/"&&c.push("/"),c.push(Fl(y,y.charAt(0)=="/"?nN:tN,!0))),(y=this.i.toString())&&c.push("?",y),(y=this.m)&&c.push("#",Fl(y,iN)),c.join("")};function Kr(c){return new Vs(c)}function Pd(c,p,y){c.j=y?Ml(p,!0):p,c.j&&(c.j=c.j.replace(/:$/,""))}function Cd(c,p){if(p){if(p=Number(p),isNaN(p)||0>p)throw Error("Bad port number "+p);c.s=p}else c.s=null}function pE(c,p,y){p instanceof Ul?(c.i=p,sN(c.i,c.h)):(y||(p=Fl(p,rN)),c.i=new Ul(p,c.h))}function Ne(c,p,y){c.i.set(p,y)}function kd(c){return Ne(c,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),c}function Ml(c,p){return c?p?decodeURI(c.replace(/%25/g,"%2525")):decodeURIComponent(c):""}function Fl(c,p,y){return typeof c=="string"?(c=encodeURI(c).replace(p,eN),y&&(c=c.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c):null}function eN(c){return c=c.charCodeAt(0),"%"+(c>>4&15).toString(16)+(c&15).toString(16)}var mE=/[#\/\?@]/g,tN=/[#\?:]/g,nN=/[#\?]/g,rN=/[#\?@]/g,iN=/#/g;function Ul(c,p){this.h=this.g=null,this.i=c||null,this.j=!!p}function Pi(c){c.g||(c.g=new Map,c.h=0,c.i&&ZO(c.i,function(p,y){c.add(decodeURIComponent(p.replace(/\+/g," ")),y)}))}t=Ul.prototype,t.add=function(c,p){Pi(this),this.i=null,c=jo(this,c);var y=this.g.get(c);return y||this.g.set(c,y=[]),y.push(p),this.h+=1,this};function gE(c,p){Pi(c),p=jo(c,p),c.g.has(p)&&(c.i=null,c.h-=c.g.get(p).length,c.g.delete(p))}function yE(c,p){return Pi(c),p=jo(c,p),c.g.has(p)}t.forEach=function(c,p){Pi(this),this.g.forEach(function(y,b){y.forEach(function(V){c.call(p,V,b,this)},this)},this)},t.na=function(){Pi(this);const c=Array.from(this.g.values()),p=Array.from(this.g.keys()),y=[];for(let b=0;b<p.length;b++){const V=c[b];for(let U=0;U<V.length;U++)y.push(p[b])}return y},t.V=function(c){Pi(this);let p=[];if(typeof c=="string")yE(this,c)&&(p=p.concat(this.g.get(jo(this,c))));else{c=Array.from(this.g.values());for(let y=0;y<c.length;y++)p=p.concat(c[y])}return p},t.set=function(c,p){return Pi(this),this.i=null,c=jo(this,c),yE(this,c)&&(this.h-=this.g.get(c).length),this.g.set(c,[p]),this.h+=1,this},t.get=function(c,p){return c?(c=this.V(c),0<c.length?String(c[0]):p):p};function _E(c,p,y){gE(c,p),0<y.length&&(c.i=null,c.g.set(jo(c,p),v(y)),c.h+=y.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const c=[],p=Array.from(this.g.keys());for(var y=0;y<p.length;y++){var b=p[y];const U=encodeURIComponent(String(b)),H=this.V(b);for(b=0;b<H.length;b++){var V=U;H[b]!==""&&(V+="="+encodeURIComponent(String(H[b]))),c.push(V)}}return this.i=c.join("&")};function jo(c,p){return p=String(p),c.j&&(p=p.toLowerCase()),p}function sN(c,p){p&&!c.j&&(Pi(c),c.i=null,c.g.forEach(function(y,b){var V=b.toLowerCase();b!=V&&(gE(this,b),_E(this,V,y))},c)),c.j=p}function oN(c,p){const y=new Vl;if(a.Image){const b=new Image;b.onload=g(Ci,y,"TestLoadImage: loaded",!0,p,b),b.onerror=g(Ci,y,"TestLoadImage: error",!1,p,b),b.onabort=g(Ci,y,"TestLoadImage: abort",!1,p,b),b.ontimeout=g(Ci,y,"TestLoadImage: timeout",!1,p,b),a.setTimeout(function(){b.ontimeout&&b.ontimeout()},1e4),b.src=c}else p(!1)}function aN(c,p){const y=new Vl,b=new AbortController,V=setTimeout(()=>{b.abort(),Ci(y,"TestPingServer: timeout",!1,p)},1e4);fetch(c,{signal:b.signal}).then(U=>{clearTimeout(V),U.ok?Ci(y,"TestPingServer: ok",!0,p):Ci(y,"TestPingServer: server error",!1,p)}).catch(()=>{clearTimeout(V),Ci(y,"TestPingServer: error",!1,p)})}function Ci(c,p,y,b,V){try{V&&(V.onload=null,V.onerror=null,V.onabort=null,V.ontimeout=null),b(y)}catch{}}function lN(){this.g=new WO}function uN(c,p,y){const b=y||"";try{hE(c,function(V,U){let H=V;u(V)&&(H=km(V)),p.push(b+U+"="+encodeURIComponent(H))})}catch(V){throw p.push(b+"type="+encodeURIComponent("_badmap")),V}}function jl(c){this.l=c.Ub||null,this.j=c.eb||!1}_(jl,xm),jl.prototype.g=function(){return new xd(this.l,this.j)},jl.prototype.i=function(c){return function(){return c}}({});function xd(c,p){Bt.call(this),this.D=c,this.o=p,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}_(xd,Bt),t=xd.prototype,t.open=function(c,p){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=c,this.A=p,this.readyState=1,$l(this)},t.send=function(c){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const p={headers:this.u,method:this.B,credentials:this.m,cache:void 0};c&&(p.body=c),(this.D||a).fetch(new Request(this.A,p)).then(this.Sa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,Bl(this)),this.readyState=0},t.Sa=function(c){if(this.g&&(this.l=c,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=c.headers,this.readyState=2,$l(this)),this.g&&(this.readyState=3,$l(this),this.g)))if(this.responseType==="arraybuffer")c.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof a.ReadableStream<"u"&&"body"in c){if(this.j=c.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;vE(this)}else c.text().then(this.Ra.bind(this),this.ga.bind(this))};function vE(c){c.j.read().then(c.Pa.bind(c)).catch(c.ga.bind(c))}t.Pa=function(c){if(this.g){if(this.o&&c.value)this.response.push(c.value);else if(!this.o){var p=c.value?c.value:new Uint8Array(0);(p=this.v.decode(p,{stream:!c.done}))&&(this.response=this.responseText+=p)}c.done?Bl(this):$l(this),this.readyState==3&&vE(this)}},t.Ra=function(c){this.g&&(this.response=this.responseText=c,Bl(this))},t.Qa=function(c){this.g&&(this.response=c,Bl(this))},t.ga=function(){this.g&&Bl(this)};function Bl(c){c.readyState=4,c.l=null,c.j=null,c.v=null,$l(c)}t.setRequestHeader=function(c,p){this.u.append(c,p)},t.getResponseHeader=function(c){return this.h&&this.h.get(c.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const c=[],p=this.h.entries();for(var y=p.next();!y.done;)y=y.value,c.push(y[0]+": "+y[1]),y=p.next();return c.join(`\r `)};function $l(c){c.onreadystatechange&&c.onreadystatechange.call(c)}Object.defineProperty(xd.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(c){this.m=c?"include":"same-origin"}});function wE(c){let p="";return D(c,function(y,b){p+=b,p+=":",p+=y,p+=`\r `}),p}function Bm(c,p,y){e:{for(b in y){var b=!1;break e}b=!0}b||(y=wE(y),typeof c=="string"?y!=null&&encodeURIComponent(String(y)):Ne(c,p,y))}function Xe(c){Bt.call(this),this.headers=new Map,this.o=c||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}_(Xe,Bt);var cN=/^https?$/i,dN=["POST","PUT"];t=Xe.prototype,t.Ha=function(c){this.J=c},t.ea=function(c,p,y,b){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+c);p=p?p.toUpperCase():"GET",this.D=c,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Dm.g(),this.v=this.o?Qw(this.o):Qw(Dm),this.g.onreadystatechange=f(this.Ea,this);try{this.B=!0,this.g.open(p,String(c),!0),this.B=!1}catch(U){EE(this,U);return}if(c=y||"",y=new Map(this.headers),b)if(Object.getPrototypeOf(b)===Object.prototype)for(var V in b)y.set(V,b[V]);else if(typeof b.keys=="function"&&typeof b.get=="function")for(const U of b.keys())y.set(U,b.get(U));else throw Error("Unknown input type for opt_headers: "+String(b));b=Array.from(y.keys()).find(U=>U.toLowerCase()=="content-type"),V=a.FormData&&c instanceof a.FormData,!(0<=Array.prototype.indexOf.call(dN,p,void 0))||b||V||y.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[U,H]of y)this.g.setRequestHeader(U,H);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{SE(this),this.u=!0,this.g.send(c),this.u=!1}catch(U){EE(this,U)}};function EE(c,p){c.h=!1,c.g&&(c.j=!0,c.g.abort(),c.j=!1),c.l=p,c.m=5,IE(c),Od(c)}function IE(c){c.A||(c.A=!0,Xt(c,"complete"),Xt(c,"error"))}t.abort=function(c){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=c||7,Xt(this,"complete"),Xt(this,"abort"),Od(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Od(this,!0)),Xe.aa.N.call(this)},t.Ea=function(){this.s||(this.B||this.u||this.j?TE(this):this.bb())},t.bb=function(){TE(this)};function TE(c){if(c.h&&typeof o<"u"&&(!c.v[1]||Gr(c)!=4||c.Z()!=2)){if(c.u&&Gr(c)==4)qw(c.Ea,0,c);else if(Xt(c,"readystatechange"),Gr(c)==4){c.h=!1;try{const H=c.Z();e:switch(H){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var p=!0;break e;default:p=!1}var y;if(!(y=p)){var b;if(b=H===0){var V=String(c.D).match(fE)[1]||null;!V&&a.self&&a.self.location&&(V=a.self.location.protocol.slice(0,-1)),b=!cN.test(V?V.toLowerCase():"")}y=b}if(y)Xt(c,"complete"),Xt(c,"success");else{c.m=6;try{var U=2<Gr(c)?c.g.statusText:""}catch{U=""}c.l=U+" ["+c.Z()+"]",IE(c)}}finally{Od(c)}}}}function Od(c,p){if(c.g){SE(c);const y=c.g,b=c.v[0]?()=>{}:null;c.g=null,c.v=null,p||Xt(c,"ready");try{y.onreadystatechange=b}catch{}}}function SE(c){c.I&&(a.clearTimeout(c.I),c.I=null)}t.isActive=function(){return!!this.g};function Gr(c){return c.g?c.g.readyState:0}t.Z=function(){try{return 2<Gr(this)?this.g.status:-1}catch{return-1}},t.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.Oa=function(c){if(this.g){var p=this.g.responseText;return c&&p.indexOf(c)==0&&(p=p.substring(c.length)),zO(p)}};function AE(c){try{if(!c.g)return null;if("response"in c.g)return c.g.response;switch(c.H){case"":case"text":return c.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in c.g)return c.g.mozResponseArrayBuffer}return null}catch{return null}}function hN(c){const p={};c=(c.g&&2<=Gr(c)&&c.g.getAllResponseHeaders()||"").split(`\r `);for(let b=0;b<c.length;b++){if(w(c[b]))continue;var y=k(c[b]);const V=y[0];if(y=y[1],typeof y!="string")continue;y=y.trim();const U=p[V]||[];p[V]=U,U.push(y)}A(p,function(b){return b.join(", ")})}t.Ba=function(){return this.m},t.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function zl(c,p,y){return y&&y.internalChannelParams&&y.internalChannelParams[c]||p}function bE(c){this.Aa=0,this.i=[],this.j=new Vl,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=zl("failFast",!1,c),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=zl("baseRetryDelayMs",5e3,c),this.cb=zl("retryDelaySeedMs",1e4,c),this.Wa=zl("forwardChannelMaxRetries",2,c),this.wa=zl("forwardChannelRequestTimeoutMs",2e4,c),this.pa=c&&c.xmlHttpFactory||void 0,this.Xa=c&&c.Tb||void 0,this.Ca=c&&c.useFetchStreams||!1,this.L=void 0,this.J=c&&c.supportsCrossDomainXhr||!1,this.K="",this.h=new aE(c&&c.concurrentRequestLimit),this.Da=new lN,this.P=c&&c.fastHandshake||!1,this.O=c&&c.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=c&&c.Rb||!1,c&&c.xa&&this.j.xa(),c&&c.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&c&&c.detectBufferingProxy||!1,this.ja=void 0,c&&c.longPollingTimeout&&0<c.longPollingTimeout&&(this.ja=c.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}t=bE.prototype,t.la=8,t.G=1,t.connect=function(c,p,y,b){Zt(0),this.W=c,this.H=p||{},y&&b!==void 0&&(this.H.OSID=y,this.H.OAID=b),this.F=this.X,this.I=VE(this,null,this.W),Dd(this)};function $m(c){if(RE(c),c.G==3){var p=c.U++,y=Kr(c.I);if(Ne(y,"SID",c.K),Ne(y,"RID",p),Ne(y,"TYPE","terminate"),Wl(c,y),p=new Ri(c,c.j,p),p.L=2,p.v=kd(Kr(y)),y=!1,a.navigator&&a.navigator.sendBeacon)try{y=a.navigator.sendBeacon(p.v.toString(),"")}catch{}!y&&a.Image&&(new Image().src=p.v,y=!0),y||(p.g=LE(p.j,null),p.g.ea(p.v)),p.F=Date.now(),Rd(p)}DE(c)}function Nd(c){c.g&&(Wm(c),c.g.cancel(),c.g=null)}function RE(c){Nd(c),c.u&&(a.clearTimeout(c.u),c.u=null),Vd(c),c.h.cancel(),c.s&&(typeof c.s=="number"&&a.clearTimeout(c.s),c.s=null)}function Dd(c){if(!lE(c.h)&&!c.s){c.s=!0;var p=c.Ga;We||ne(),G||(We(),G=!0),te.add(p,c),c.B=0}}function fN(c,p){return uE(c.h)>=c.h.j-(c.s?1:0)?!1:c.s?(c.i=p.D.concat(c.i),!0):c.G==1||c.G==2||c.B>=(c.Va?0:c.Wa)?!1:(c.s=Dl(f(c.Ga,c,p),NE(c,c.B)),c.B++,!0)}t.Ga=function(c){if(this.s)if(this.s=null,this.G==1){if(!c){this.U=Math.floor(1e5*Math.random()),c=this.U++;const V=new Ri(this,this.j,c);let U=this.o;if(this.S&&(U?(U=I(U),R(U,this.S)):U=this.S),this.m!==null||this.O||(V.H=U,U=null),this.P)e:{for(var p=0,y=0;y<this.i.length;y++){t:{var b=this.i[y];if("__data__"in b.map&&(b=b.map.__data__,typeof b=="string")){b=b.length;break t}b=void 0}if(b===void 0)break;if(p+=b,4096<p){p=y;break e}if(p===4096||y===this.i.length-1){p=y+1;break e}}p=1e3}else p=1e3;p=CE(this,V,p),y=Kr(this.I),Ne(y,"RID",c),Ne(y,"CVER",22),this.D&&Ne(y,"X-HTTP-Session-Id",this.D),Wl(this,y),U&&(this.O?p="headers="+encodeURIComponent(String(wE(U)))+"&"+p:this.m&&Bm(y,this.m,U)),jm(this.h,V),this.Ua&&Ne(y,"TYPE","init"),this.P?(Ne(y,"$req",p),Ne(y,"SID","null"),V.T=!0,Lm(V,y,null)):Lm(V,y,p),this.G=2}}else this.G==3&&(c?PE(this,c):this.i.length==0||lE(this.h)||PE(this))};function PE(c,p){var y;p?y=p.l:y=c.U++;const b=Kr(c.I);Ne(b,"SID",c.K),Ne(b,"RID",y),Ne(b,"AID",c.T),Wl(c,b),c.m&&c.o&&Bm(b,c.m,c.o),y=new Ri(c,c.j,y,c.B+1),c.m===null&&(y.H=c.o),p&&(c.i=p.D.concat(c.i)),p=CE(c,y,1e3),y.I=Math.round(.5*c.wa)+Math.round(.5*c.wa*Math.random()),jm(c.h,y),Lm(y,b,p)}function Wl(c,p){c.H&&D(c.H,function(y,b){Ne(p,b,y)}),c.l&&hE({},function(y,b){Ne(p,b,y)})}function CE(c,p,y){y=Math.min(c.i.length,y);var b=c.l?f(c.l.Na,c.l,c):null;e:{var V=c.i;let U=-1;for(;;){const H=["count="+y];U==-1?0<y?(U=V[0].g,H.push("ofs="+U)):U=0:H.push("ofs="+U);let Pe=!0;for(let Dt=0;Dt<y;Dt++){let ve=V[Dt].g;const $t=V[Dt].map;if(ve-=U,0>ve)U=Math.max(0,V[Dt].g-100),Pe=!1;else try{uN($t,H,"req"+ve+"_")}catch{b&&b($t)}}if(Pe){b=H.join("&");break e}}}return c=c.i.splice(0,y),p.D=c,b}function kE(c){if(!c.g&&!c.u){c.Y=1;var p=c.Fa;We||ne(),G||(We(),G=!0),te.add(p,c),c.v=0}}function zm(c){return c.g||c.u||3<=c.v?!1:(c.Y++,c.u=Dl(f(c.Fa,c),NE(c,c.v)),c.v++,!0)}t.Fa=function(){if(this.u=null,xE(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var c=2*this.R;this.j.info("BP detection timer enabled: "+c),this.A=Dl(f(this.ab,this),c)}},t.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Zt(10),Nd(this),xE(this))};function Wm(c){c.A!=null&&(a.clearTimeout(c.A),c.A=null)}function xE(c){c.g=new Ri(c,c.j,"rpc",c.Y),c.m===null&&(c.g.H=c.o),c.g.O=0;var p=Kr(c.qa);Ne(p,"RID","rpc"),Ne(p,"SID",c.K),Ne(p,"AID",c.T),Ne(p,"CI",c.F?"0":"1"),!c.F&&c.ja&&Ne(p,"TO",c.ja),Ne(p,"TYPE","xmlhttp"),Wl(c,p),c.m&&c.o&&Bm(p,c.m,c.o),c.L&&(c.g.I=c.L);var y=c.g;c=c.ia,y.L=1,y.v=kd(Kr(p)),y.m=null,y.P=!0,iE(y,c)}t.Za=function(){this.C!=null&&(this.C=null,Nd(this),zm(this),Zt(19))};function Vd(c){c.C!=null&&(a.clearTimeout(c.C),c.C=null)}function OE(c,p){var y=null;if(c.g==p){Vd(c),Wm(c),c.g=null;var b=2}else if(Um(c.h,p))y=p.D,cE(c.h,p),b=1;else return;if(c.G!=0){if(p.o)if(b==1){y=p.m?p.m.length:0,p=Date.now()-p.F;var V=c.B;b=Sd(),Xt(b,new eE(b,y)),Dd(c)}else kE(c);else if(V=p.s,V==3||V==0&&0<p.X||!(b==1&&fN(c,p)||b==2&&zm(c)))switch(y&&0<y.length&&(p=c.h,p.i=p.i.concat(y)),V){case 1:Ls(c,5);break;case 4:Ls(c,10);break;case 3:Ls(c,6);break;default:Ls(c,2)}}}function NE(c,p){let y=c.Ta+Math.floor(Math.random()*c.cb);return c.isActive()||(y*=2),y*p}function Ls(c,p){if(c.j.info("Error code "+p),p==2){var y=f(c.fb,c),b=c.Xa;const V=!b;b=new Vs(b||"//www.google.com/images/cleardot.gif"),a.location&&a.location.protocol=="http"||Pd(b,"https"),kd(b),V?oN(b.toString(),y):aN(b.toString(),y)}else Zt(2);c.G=0,c.l&&c.l.sa(p),DE(c),RE(c)}t.fb=function(c){c?(this.j.info("Successfully pinged google.com"),Zt(2)):(this.j.info("Failed to ping google.com"),Zt(1))};function DE(c){if(c.G=0,c.ka=[],c.l){const p=dE(c.h);(p.length!=0||c.i.length!=0)&&(T(c.ka,p),T(c.ka,c.i),c.h.i.length=0,v(c.i),c.i.length=0),c.l.ra()}}function VE(c,p,y){var b=y instanceof Vs?Kr(y):new Vs(y);if(b.g!="")p&&(b.g=p+"."+b.g),Cd(b,b.s);else{var V=a.location;b=V.protocol,p=p?p+"."+V.hostname:V.hostname,V=+V.port;var U=new Vs(null);b&&Pd(U,b),p&&(U.g=p),V&&Cd(U,V),y&&(U.l=y),b=U}return y=c.D,p=c.ya,y&&p&&Ne(b,y,p),Ne(b,"VER",c.la),Wl(c,b),b}function LE(c,p,y){if(p&&!c.J)throw Error("Can't create secondary domain capable XhrIo object.");return p=c.Ca&&!c.pa?new Xe(new jl({eb:y})):new Xe(c.pa),p.Ha(c.J),p}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function ME(){}t=ME.prototype,t.ua=function(){},t.ta=function(){},t.sa=function(){},t.ra=function(){},t.isActive=function(){return!0},t.Na=function(){};function Ld(){}Ld.prototype.g=function(c,p){return new bn(c,p)};function bn(c,p){Bt.call(this),this.g=new bE(p),this.l=c,this.h=p&&p.messageUrlParams||null,c=p&&p.messageHeaders||null,p&&p.clientProtocolHeaderRequired&&(c?c["X-Client-Protocol"]="webchannel":c={"X-Client-Protocol":"webchannel"}),this.g.o=c,c=p&&p.initMessageHeaders||null,p&&p.messageContentType&&(c?c["X-WebChannel-Content-Type"]=p.messageContentType:c={"X-WebChannel-Content-Type":p.messageContentType}),p&&p.va&&(c?c["X-WebChannel-Client-Profile"]=p.va:c={"X-WebChannel-Client-Profile":p.va}),this.g.S=c,(c=p&&p.Sb)&&!w(c)&&(this.g.m=c),this.v=p&&p.supportsCrossDomainXhr||!1,this.u=p&&p.sendRawJson||!1,(p=p&&p.httpSessionIdParam)&&!w(p)&&(this.g.D=p,c=this.h,c!==null&&p in c&&(c=this.h,p in c&&delete c[p])),this.j=new Bo(this)}_(bn,Bt),bn.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},bn.prototype.close=function(){$m(this.g)},bn.prototype.o=function(c){var p=this.g;if(typeof c=="string"){var y={};y.__data__=c,c=y}else this.u&&(y={},y.__data__=km(c),c=y);p.i.push(new YO(p.Ya++,c)),p.G==3&&Dd(p)},bn.prototype.N=function(){this.g.l=null,delete this.j,$m(this.g),delete this.g,bn.aa.N.call(this)};function FE(c){Om.call(this),c.__headers__&&(this.headers=c.__headers__,this.statusCode=c.__status__,delete c.__headers__,delete c.__status__);var p=c.__sm__;if(p){e:{for(const y in p){c=y;break e}c=void 0}(this.i=c)&&(c=this.i,p=p!==null&&c in p?p[c]:void 0),this.data=p}else this.data=c}_(FE,Om);function UE(){Nm.call(this),this.status=1}_(UE,Nm);function Bo(c){this.g=c}_(Bo,ME),Bo.prototype.ua=function(){Xt(this.g,"a")},Bo.prototype.ta=function(c){Xt(this.g,new FE(c))},Bo.prototype.sa=function(c){Xt(this.g,new UE)},Bo.prototype.ra=function(){Xt(this.g,"b")},Ld.prototype.createWebChannel=Ld.prototype.g,bn.prototype.send=bn.prototype.o,bn.prototype.open=bn.prototype.m,bn.prototype.close=bn.prototype.close,WP=function(){return new Ld},zP=function(){return Sd()},$P=Ns,Hy={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Ad.NO_ERROR=0,Ad.TIMEOUT=8,Ad.HTTP_ERROR=6,Dh=Ad,tE.COMPLETE="complete",BP=tE,Yw.EventType=Ol,Ol.OPEN="a",Ol.CLOSE="b",Ol.ERROR="c",Ol.MESSAGE="d",Bt.prototype.listen=Bt.prototype.K,vu=Yw,jP=jl,Xe.prototype.listenOnce=Xe.prototype.L,Xe.prototype.getLastError=Xe.prototype.Ka,Xe.prototype.getLastErrorCode=Xe.prototype.Ba,Xe.prototype.getStatus=Xe.prototype.Z,Xe.prototype.getResponseJson=Xe.prototype.Oa,Xe.prototype.getResponseText=Xe.prototype.oa,Xe.prototype.send=Xe.prototype.ea,Xe.prototype.setWithCredentials=Xe.prototype.Ha,UP=Xe}).apply(typeof nh<"u"?nh:typeof self<"u"?self:typeof window<"u"?window:{});const VT="@firebase/firestore";/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let Pt=class{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}};Pt.UNAUTHENTICATED=new Pt(null),Pt.GOOGLE_CREDENTIALS=new Pt("google-credentials-uid"),Pt.FIRST_PARTY=new Pt("first-party-uid"),Pt.MOCK_USER=new Pt("mock-user");/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let yl="10.13.2";/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const hs=new Tp("@firebase/firestore");function ea(){return hs.logLevel}function yj(t){hs.setLogLevel(t)}function z(t,...e){if(hs.logLevel<=ce.DEBUG){const n=e.map(p0);hs.debug(`Firestore (${yl}): ${t}`,...n)}}function ut(t,...e){if(hs.logLevel<=ce.ERROR){const n=e.map(p0);hs.error(`Firestore (${yl}): ${t}`,...n)}}function _r(t,...e){if(hs.logLevel<=ce.WARN){const n=e.map(p0);hs.warn(`Firestore (${yl}): ${t}`,...n)}}function p0(t){if(typeof t=="string")return t;try{/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */return function(n){return JSON.stringify(n)}(t)}catch{return t}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Y(t="Unexpected state"){const e=`FIRESTORE (${yl}) INTERNAL ASSERTION FAILED: `+t;throw ut(e),new Error(e)}function X(t,e){t||Y()}function _j(t,e){t||Y()}function Q(t,e){return t}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const M={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class $ extends on{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class xt{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class qP{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class vj{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(Pt.UNAUTHENTICATED))}shutdown(){}}class wj{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class Ej{constructor(e){this.t=e,this.currentUser=Pt.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){let r=this.i;const i=l=>this.i!==r?(r=this.i,n(l)):Promise.resolve();let s=new xt;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new xt,e.enqueueRetryable(()=>i(this.currentUser))};const o=()=>{const l=s;e.enqueueRetryable(async()=>{await l.promise,await i(this.currentUser)})},a=l=>{z("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.auth.addAuthTokenListener(this.o),o()};this.t.onInit(l=>a(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?a(l):(z("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new xt)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(z("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(X(typeof r.accessToken=="string"),new qP(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const e=this.auth&&this.auth.getUid();return X(e===null||typeof e=="string"),new Pt(e)}}class Ij{constructor(e,n,r){this.l=e,this.h=n,this.P=r,this.type="FirstParty",this.user=Pt.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class Tj{constructor(e,n,r){this.l=e,this.h=n,this.P=r}getToken(){return Promise.resolve(new Ij(this.l,this.h,this.P))}start(e,n){e.enqueueRetryable(()=>n(Pt.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Sj{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Aj{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,n){const r=s=>{s.error!=null&&z("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const o=s.token!==this.R;return this.R=s.token,z("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>r(s))};const i=s=>{z("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.appCheck.addTokenListener(this.o)};this.A.onInit(s=>i(s)),setTimeout(()=>{if(!this.appCheck){const s=this.A.getImmediate({optional:!0});s?i(s):z("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(X(typeof n.token=="string"),this.R=n.token,new Sj(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function bj(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class HP{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=Math.floor(256/e.length)*e.length;let r="";for(;r.length<20;){const i=bj(40);for(let s=0;s<i.length;++s)r.length<20&&i[s]<n&&(r+=e.charAt(i[s]%e.length))}return r}}function re(t,e){return t<e?-1:t>e?1:0}function Ha(t,e,n){return t.length===e.length&&t.every((r,i)=>n(r,e[i]))}function KP(t){return t+"\0"}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ze{constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new $(M.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new $(M.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e<-62135596800)throw new $(M.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new $(M.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return ze.fromMillis(Date.now())}static fromDate(e){return ze.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*n));return new ze(n,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?re(this.nanoseconds,e.nanoseconds):re(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Z{constructor(e){this.timestamp=e}static fromTimestamp(e){return new Z(e)}static min(){return new Z(new ze(0,0))}static max(){return new Z(new ze(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ec{constructor(e,n,r){n===void 0?n=0:n>e.length&&Y(),r===void 0?r=e.length-n:r>e.length-n&&Y(),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return Ec.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof Ec?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}forEach(e){for(let n=this.offset,r=this.limit();n<r;n++)e(this.segments[n])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,n){const r=Math.min(e.length,n.length);for(let i=0;i<r;i++){const s=e.get(i),o=n.get(i);if(s<o)return-1;if(s>o)return 1}return e.length<n.length?-1:e.length>n.length?1:0}}class fe extends Ec{construct(e,n,r){return new fe(e,n,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const n=[];for(const r of e){if(r.indexOf("//")>=0)throw new $(M.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(i=>i.length>0))}return new fe(n)}static emptyPath(){return new fe([])}}const Rj=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Be extends Ec{construct(e,n,r){return new Be(e,n,r)}static isValidIdentifier(e){return Rj.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Be.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new Be(["__name__"])}static fromServerFormat(e){const n=[];let r="",i=0;const s=()=>{if(r.length===0)throw new $(M.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;i<e.length;){const a=e[i];if(a==="\\"){if(i+1===e.length)throw new $(M.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[i+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new $(M.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=l,i+=2}else a==="`"?(o=!o,i++):a!=="."||o?(r+=a,i++):(s(),i++)}if(s(),o)throw new $(M.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new Be(n)}static emptyPath(){return new Be([])}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class K{constructor(e){this.path=e}static fromPath(e){return new K(fe.fromString(e))}static fromName(e){return new K(fe.fromString(e).popFirst(5))}static empty(){return new K(fe.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&fe.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return fe.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new K(new fe(e.slice()))}}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Vf{constructor(e,n,r,i){this.indexId=e,this.collectionGroup=n,this.fields=r,this.indexState=i}}function Ky(t){return t.fields.find(e=>e.kind===2)}function zs(t){return t.fields.filter(e=>e.kind!==2)}Vf.UNKNOWN_ID=-1;class Vh{constructor(e,n){this.fieldPath=e,this.kind=n}}class Ic{constructor(e,n){this.sequenceNumber=e,this.offset=n}static empty(){return new Ic(0,Un.min())}}function GP(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=Z.fromTimestamp(r===1e9?new ze(n+1,0):new ze(n,r));return new Un(i,K.empty(),e)}function QP(t){return new Un(t.readTime,t.key,-1)}class Un{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new Un(Z.min(),K.empty(),-1)}static max(){return new Un(Z.max(),K.empty(),-1)}}function m0(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=K.comparator(t.documentKey,e.documentKey),n!==0?n:re(t.largestBatchId,e.largestBatchId))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const YP="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class JP{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Ps(t){if(t.code!==M.FAILED_PRECONDITION||t.message!==YP)throw t;z("LocalStore","Unexpectedly lost primary lease")}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class L{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&Y(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new L((r,i)=>{this.nextCallback=s=>{this.wrapSuccess(e,s).next(r,i)},this.catchCallback=s=>{this.wrapFailure(n,s).next(r,i)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof L?n:L.resolve(n)}catch(n){return L.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):L.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):L.reject(n)}static resolve(e){return new L((n,r)=>{n(e)})}static reject(e){return new L((n,r)=>{r(e)})}static waitFor(e){return new L((n,r)=>{let i=0,s=0,o=!1;e.forEach(a=>{++i,a.next(()=>{++s,o&&s===i&&n()},l=>r(l))}),o=!0,s===i&&n()})}static or(e){let n=L.resolve(!1);for(const r of e)n=n.next(i=>i?L.resolve(i):r());return n}static forEach(e,n){const r=[];return e.forEach((i,s)=>{r.push(n.call(this,i,s))}),this.waitFor(r)}static mapArray(e,n){return new L((r,i)=>{const s=e.length,o=new Array(s);let a=0;for(let l=0;l<s;l++){const u=l;n(e[u]).next(d=>{o[u]=d,++a,a===s&&r(o)},d=>i(d))}})}static doWhile(e,n){return new L((r,i)=>{const s=()=>{e()===!0?n().next(()=>{s()},i):r()};s()})}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Lp{constructor(e,n){this.action=e,this.transaction=n,this.aborted=!1,this.V=new xt,this.transaction.oncomplete=()=>{this.V.resolve()},this.transaction.onabort=()=>{n.error?this.V.reject(new Fu(e,n.error)):this.V.resolve()},this.transaction.onerror=r=>{const i=g0(r.target.error);this.V.reject(new Fu(e,i))}}static open(e,n,r,i){try{return new Lp(n,e.transaction(i,r))}catch(s){throw new Fu(n,s)}}get m(){return this.V.promise}abort(e){e&&this.V.reject(e),this.aborted||(z("SimpleDb","Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}g(){const e=this.transaction;this.aborted||typeof e.commit!="function"||e.commit()}store(e){const n=this.transaction.objectStore(e);return new Cj(n)}}class Fr{constructor(e,n,r){this.name=e,this.version=n,this.p=r,Fr.S(Ye())===12.2&&ut("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}static delete(e){return z("SimpleDb","Removing database:",e),Ws(window.indexedDB.deleteDatabase(e)).toPromise()}static D(){if(!pc())return!1;if(Fr.v())return!0;const e=Ye(),n=Fr.S(e),r=0<n&&n<10,i=XP(e),s=0<i&&i<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||r||s)}static v(){var e;return typeof process<"u"&&((e=process.__PRIVATE_env)===null||e===void 0?void 0:e.C)==="YES"}static F(e,n){return e.store(n)}static S(e){const n=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),r=n?n[1].split("_").slice(0,2).join("."):"-1";return Number(r)}async M(e){return this.db||(z("SimpleDb","Opening database:",this.name),this.db=await new Promise((n,r)=>{const i=indexedDB.open(this.name,this.version);i.onsuccess=s=>{const o=s.target.result;n(o)},i.onblocked=()=>{r(new Fu(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=s=>{const o=s.target.error;o.name==="VersionError"?r(new $(M.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):o.name==="InvalidStateError"?r(new $(M.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+o)):r(new Fu(e,o))},i.onupgradeneeded=s=>{z("SimpleDb",'Database "'+this.name+'" requires upgrade from version:',s.oldVersion);const o=s.target.result;this.p.O(o,i.transaction,s.oldVersion,this.version).next(()=>{z("SimpleDb","Database upgrade to version "+this.version+" complete")})}})),this.N&&(this.db.onversionchange=n=>this.N(n)),this.db}L(e){this.N=e,this.db&&(this.db.onversionchange=n=>e(n))}async runTransaction(e,n,r,i){const s=n==="readonly";let o=0;for(;;){++o;try{this.db=await this.M(e);const a=Lp.open(this.db,e,s?"readonly":"readwrite",r),l=i(a).next(u=>(a.g(),u)).catch(u=>(a.abort(u),L.reject(u))).toPromise();return l.catch(()=>{}),await a.m,l}catch(a){const l=a,u=l.name!=="FirebaseError"&&o<3;if(z("SimpleDb","Transaction failed with error:",l.message,"Retrying:",u),this.close(),!u)return Promise.reject(l)}}}close(){this.db&&this.db.close(),this.db=void 0}}function XP(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}class Pj{constructor(e){this.B=e,this.k=!1,this.q=null}get isDone(){return this.k}get K(){return this.q}set cursor(e){this.B=e}done(){this.k=!0}$(e){this.q=e}delete(){return Ws(this.B.delete())}}class Fu extends ${constructor(e,n){super(M.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${n}`),this.name="IndexedDbTransactionError"}}function Cs(t){return t.name==="IndexedDbTransactionError"}class Cj{constructor(e){this.store=e}put(e,n){let r;return n!==void 0?(z("SimpleDb","PUT",this.store.name,e,n),r=this.store.put(n,e)):(z("SimpleDb","PUT",this.store.name,"<auto-key>",e),r=this.store.put(e)),Ws(r)}add(e){return z("SimpleDb","ADD",this.store.name,e,e),Ws(this.store.add(e))}get(e){return Ws(this.store.get(e)).next(n=>(n===void 0&&(n=null),z("SimpleDb","GET",this.store.name,e,n),n))}delete(e){return z("SimpleDb","DELETE",this.store.name,e),Ws(this.store.delete(e))}count(){return z("SimpleDb","COUNT",this.store.name),Ws(this.store.count())}U(e,n){const r=this.options(e,n),i=r.index?this.store.index(r.index):this.store;if(typeof i.getAll=="function"){const s=i.getAll(r.range);return new L((o,a)=>{s.onerror=l=>{a(l.target.error)},s.onsuccess=l=>{o(l.target.result)}})}{const s=this.cursor(r),o=[];return this.W(s,(a,l)=>{o.push(l)}).next(()=>o)}}G(e,n){const r=this.store.getAll(e,n===null?void 0:n);return new L((i,s)=>{r.onerror=o=>{s(o.target.error)},r.onsuccess=o=>{i(o.target.result)}})}j(e,n){z("SimpleDb","DELETE ALL",this.store.name);const r=this.options(e,n);r.H=!1;const i=this.cursor(r);return this.W(i,(s,o,a)=>a.delete())}J(e,n){let r;n?r=e:(r={},n=e);const i=this.cursor(r);return this.W(i,n)}Y(e){const n=this.cursor({});return new L((r,i)=>{n.onerror=s=>{const o=g0(s.target.error);i(o)},n.onsuccess=s=>{const o=s.target.result;o?e(o.primaryKey,o.value).next(a=>{a?o.continue():r()}):r()}})}W(e,n){const r=[];return new L((i,s)=>{e.onerror=o=>{s(o.target.error)},e.onsuccess=o=>{const a=o.target.result;if(!a)return void i();const l=new Pj(a),u=n(a.primaryKey,a.value,l);if(u instanceof L){const d=u.catch(h=>(l.done(),L.reject(h)));r.push(d)}l.isDone?i():l.K===null?a.continue():a.continue(l.K)}}).next(()=>L.waitFor(r))}options(e,n){let r;return e!==void 0&&(typeof e=="string"?r=e:n=e),{index:r,range:n}}cursor(e){let n="next";if(e.reverse&&(n="prev"),e.index){const r=this.store.index(e.index);return e.H?r.openKeyCursor(e.range,n):r.openCursor(e.range,n)}return this.store.openCursor(e.range,n)}}function Ws(t){return new L((e,n)=>{t.onsuccess=r=>{const i=r.target.result;e(i)},t.onerror=r=>{const i=g0(r.target.error);n(i)}})}let LT=!1;function g0(t){const e=Fr.S(Ye());if(e>=12.2&&e<13){const n="An internal error was encountered in the Indexed Database server";if(t.message.indexOf(n)>=0){const r=new $("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${n}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return LT||(LT=!0,setTimeout(()=>{throw r},0)),r}}return t}class kj{constructor(e,n){this.asyncQueue=e,this.Z=n,this.task=null}start(){this.X(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return this.task!==null}X(e){z("IndexBackfiller",`Scheduled in ${e}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,async()=>{this.task=null;try{z("IndexBackfiller",`Documents written: ${await this.Z.ee()}`)}catch(n){Cs(n)?z("IndexBackfiller","Ignoring IndexedDB error during index backfill: ",n):await Ps(n)}await this.X(6e4)})}}class xj{constructor(e,n){this.localStore=e,this.persistence=n}async ee(e=50){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",n=>this.te(n,e))}te(e,n){const r=new Set;let i=n,s=!0;return L.doWhile(()=>s===!0&&i>0,()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(e).next(o=>{if(o!==null&&!r.has(o))return z("IndexBackfiller",`Processing collection: ${o}`),this.ne(e,o,i).next(a=>{i-=a,r.add(o)});s=!1})).next(()=>n-i)}ne(e,n,r){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(e,n).next(i=>this.localStore.localDocuments.getNextDocuments(e,n,i,r).next(s=>{const o=s.changes;return this.localStore.indexManager.updateIndexEntries(e,o).next(()=>this.re(i,s)).next(a=>(z("IndexBackfiller",`Updating offset: ${a}`),this.localStore.indexManager.updateCollectionGroup(e,n,a))).next(()=>o.size)}))}re(e,n){let r=e;return n.changes.forEach((i,s)=>{const o=QP(s);m0(o,r)>0&&(r=o)}),new Un(r.readTime,r.documentKey,Math.max(n.batchId,e.largestBatchId))}}/** * @license * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class gn{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ie(r),this.se=r=>n.writeSequenceNumber(r))}ie(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.se&&this.se(e),e}}gn.oe=-1;function Xc(t){return t==null}function Tc(t){return t===0&&1/t==-1/0}function ZP(t){return typeof t=="number"&&Number.isInteger(t)&&!Tc(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function an(t){let e="";for(let n=0;n<t.length;n++)e.length>0&&(e=MT(e)),e=Oj(t.get(n),e);return MT(e)}function Oj(t,e){let n=e;const r=t.length;for(let i=0;i<r;i++){const s=t.charAt(i);switch(s){case"\0":n+="";break;case"":n+="";break;default:n+=s}}return n}function MT(t){return t+""}function Or(t){const e=t.length;if(X(e>=2),e===2)return X(t.charAt(0)===""&&t.charAt(1)===""),fe.emptyPath();const n=e-2,r=[];let i="";for(let s=0;s<e;){const o=t.indexOf("",s);switch((o<0||o>n)&&Y(),t.charAt(o+1)){case"":const a=t.substring(s,o);let l;i.length===0?l=a:(i+=a,l=i,i=""),r.push(l);break;case"":i+=t.substring(s,o),i+="\0";break;case"":i+=t.substring(s,o+1);break;default:Y()}s=o+2}return new fe(r)}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const FT=["userId","batchId"];/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Lh(t,e){return[t,an(e)]}function eC(t,e,n){return[t,an(e),n]}const Nj={},Dj=["prefixPath","collectionGroup","readTime","documentId"],Vj=["prefixPath","collectionGroup","documentId"],Lj=["collectionGroup","readTime","prefixPath","documentId"],Mj=["canonicalId","targetId"],Fj=["targetId","path"],Uj=["path","targetId"],jj=["collectionId","parent"],Bj=["indexId","uid"],$j=["uid","sequenceNumber"],zj=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],Wj=["indexId","uid","orderedDocumentKey"],qj=["userId","collectionPath","documentId"],Hj=["userId","collectionPath","largestBatchId"],Kj=["userId","collectionGroup","largestBatchId"],tC=["mutationQueues","mutations","documentMutations","remoteDocuments","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries"],Gj=[...tC,"documentOverlays"],nC=["mutationQueues","mutations","documentMutations","remoteDocumentsV14","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries","documentOverlays"],rC=nC,y0=[...rC,"indexConfiguration","indexState","indexEntries"],Qj=y0,Yj=[...y0,"globals"];/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Gy extends JP{constructor(e,n){super(),this._e=e,this.currentSequenceNumber=n}}function Tt(t,e){const n=Q(t);return Fr.F(n._e,e)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function UT(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function No(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function iC(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Oe{constructor(e,n){this.comparator=e,this.root=n||Lt.EMPTY}insert(e,n){return new Oe(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,Lt.BLACK,null,null))}remove(e){return new Oe(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Lt.BLACK,null,null))}get(e){let n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const i=this.comparator(e,r.key);if(i===0)return n+r.left.size;i<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new rh(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new rh(this.root,e,this.comparator,!1)}getReverseIterator(){return new rh(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new rh(this.root,e,this.comparator,!0)}}class rh{constructor(e,n,r,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=n?r(e.key,n):1,n&&i&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class Lt{constructor(e,n,r,i,s){this.key=e,this.value=n,this.color=r??Lt.RED,this.left=i??Lt.EMPTY,this.right=s??Lt.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,i,s){return new Lt(e??this.key,n??this.value,r??this.color,i??this.left,s??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,n,r){let i=this;const s=r(e,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(e,n,r),null):s===0?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.insert(e,n,r)),i.fixUp()}removeMin(){if(this.left.isEmpty())return Lt.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,i=this;if(n(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(e,i.key)===0){if(i.right.isEmpty())return Lt.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,Lt.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Lt.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw Y();const e=this.left.check();if(e!==this.right.check())throw Y();return e+(this.isRed()?0:1)}}Lt.EMPTY=null,Lt.RED=!0,Lt.BLACK=!1;Lt.EMPTY=new class{constructor(){this.size=0}get key(){throw Y()}get value(){throw Y()}get color(){throw Y()}get left(){throw Y()}get right(){throw Y()}copy(e,n,r,i,s){return this}insert(e,n,r){return new Lt(e,n)}remove(e,n){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class be{constructor(e){this.comparator=e,this.data=new Oe(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const i=r.getNext();if(this.comparator(i.key,e[1])>=0)return;n(i.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new jT(this.data.getIterator())}getIteratorFrom(e){return new jT(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let n=this;return n.size<e.size&&(n=e,e=this),e.forEach(r=>{n=n.add(r)}),n}isEqual(e){if(!(e instanceof be)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(this.comparator(i,s)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new be(this.comparator);return n.data=e,n}}class jT{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}function qo(t){return t.hasNext()?t.getNext():void 0}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class yn{constructor(e){this.fields=e,e.sort(Be.comparator)}static empty(){return new yn([])}unionWith(e){let n=new be(Be.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new yn(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return Ha(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class sC extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Jj(){return typeof atob<"u"}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class it{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(i){try{return atob(i)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new sC("Invalid base64 string: "+s):s}}(e);return new it(n)}static fromUint8Array(e){const n=function(i){let s="";for(let o=0;o<i.length;++o)s+=String.fromCharCode(i[o]);return s}(e);return new it(n)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(n){return btoa(n)}(this.binaryString)}toUint8Array(){return function(n){const r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return re(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}it.EMPTY_BYTE_STRING=new it("");const Xj=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function gi(t){if(X(!!t),typeof t=="string"){let e=0;const n=Xj.exec(t);if(X(!!n),n[1]){let i=n[1];i=(i+"000000000").substr(0,9),e=Number(i)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:Ue(t.seconds),nanos:Ue(t.nanos)}}function Ue(t){return typeof t=="number"?t:typeof t=="string"?Number(t):0}function fs(t){return typeof t=="string"?it.fromBase64String(t):it.fromUint8Array(t)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Mp(t){var e,n;return((n=(((e=t==null?void 0:t.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||n===void 0?void 0:n.stringValue)==="server_timestamp"}function _0(t){const e=t.mapValue.fields.__previous_value__;return Mp(e)?_0(e):e}function Sc(t){const e=gi(t.mapValue.fields.__local_write_time__.timestampValue);return new ze(e.seconds,e.nanos)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Zj{constructor(e,n,r,i,s,o,a,l,u){this.databaseId=e,this.appId=n,this.persistenceKey=r,this.host=i,this.ssl=s,this.forceLongPolling=o,this.autoDetectLongPolling=a,this.longPollingOptions=l,this.useFetchStreams=u}}class ps{constructor(e,n){this.projectId=e,this.database=n||"(default)"}static empty(){return new ps("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof ps&&e.projectId===this.projectId&&e.database===this.database}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Ki={mapValue:{fields:{__type__:{stringValue:"__max__"}}}},Mh={nullValue:"NULL_VALUE"};function go(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?Mp(t)?4:oC(t)?9007199254740991:Fp(t)?10:11:Y()}function zr(t,e){if(t===e)return!0;const n=go(t);if(n!==go(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Sc(t).isEqual(Sc(e));case 3:return function(i,s){if(typeof i.timestampValue=="string"&&typeof s.timestampValue=="string"&&i.timestampValue.length===s.timestampValue.length)return i.timestampValue===s.timestampValue;const o=gi(i.timestampValue),a=gi(s.timestampValue);return o.seconds===a.seconds&&o.nanos===a.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(i,s){return fs(i.bytesValue).isEqual(fs(s.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(i,s){return Ue(i.geoPointValue.latitude)===Ue(s.geoPointValue.latitude)&&Ue(i.geoPointValue.longitude)===Ue(s.geoPointValue.longitude)}(t,e);case 2:return function(i,s){if("integerValue"in i&&"integerValue"in s)return Ue(i.integerValue)===Ue(s.integerValue);if("doubleValue"in i&&"doubleValue"in s){const o=Ue(i.doubleValue),a=Ue(s.doubleValue);return o===a?Tc(o)===Tc(a):isNaN(o)&&isNaN(a)}return!1}(t,e);case 9:return Ha(t.arrayValue.values||[],e.arrayValue.values||[],zr);case 10:case 11:return function(i,s){const o=i.mapValue.fields||{},a=s.mapValue.fields||{};if(UT(o)!==UT(a))return!1;for(const l in o)if(o.hasOwnProperty(l)&&(a[l]===void 0||!zr(o[l],a[l])))return!1;return!0}(t,e);default:return Y()}}function Ac(t,e){return(t.values||[]).find(n=>zr(n,e))!==void 0}function ms(t,e){if(t===e)return 0;const n=go(t),r=go(e);if(n!==r)return re(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return re(t.booleanValue,e.booleanValue);case 2:return function(s,o){const a=Ue(s.integerValue||s.doubleValue),l=Ue(o.integerValue||o.doubleValue);return a<l?-1:a>l?1:a===l?0:isNaN(a)?isNaN(l)?0:-1:1}(t,e);case 3:return BT(t.timestampValue,e.timestampValue);case 4:return BT(Sc(t),Sc(e));case 5:return re(t.stringValue,e.stringValue);case 6:return function(s,o){const a=fs(s),l=fs(o);return a.compareTo(l)}(t.bytesValue,e.bytesValue);case 7:return function(s,o){const a=s.split("/"),l=o.split("/");for(let u=0;u<a.length&&u<l.length;u++){const d=re(a[u],l[u]);if(d!==0)return d}return re(a.length,l.length)}(t.referenceValue,e.referenceValue);case 8:return function(s,o){const a=re(Ue(s.latitude),Ue(o.latitude));return a!==0?a:re(Ue(s.longitude),Ue(o.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return $T(t.arrayValue,e.arrayValue);case 10:return function(s,o){var a,l,u,d;const h=s.fields||{},f=o.fields||{},g=(a=h.value)===null||a===void 0?void 0:a.arrayValue,_=(l=f.value)===null||l===void 0?void 0:l.arrayValue,v=re(((u=g==null?void 0:g.values)===null||u===void 0?void 0:u.length)||0,((d=_==null?void 0:_.values)===null||d===void 0?void 0:d.length)||0);return v!==0?v:$T(g,_)}(t.mapValue,e.mapValue);case 11:return function(s,o){if(s===Ki.mapValue&&o===Ki.mapValue)return 0;if(s===Ki.mapValue)return 1;if(o===Ki.mapValue)return-1;const a=s.fields||{},l=Object.keys(a),u=o.fields||{},d=Object.keys(u);l.sort(),d.sort();for(let h=0;h<l.length&&h<d.length;++h){const f=re(l[h],d[h]);if(f!==0)return f;const g=ms(a[l[h]],u[d[h]]);if(g!==0)return g}return re(l.length,d.length)}(t.mapValue,e.mapValue);default:throw Y()}}function BT(t,e){if(typeof t=="string"&&typeof e=="string"&&t.length===e.length)return re(t,e);const n=gi(t),r=gi(e),i=re(n.seconds,r.seconds);return i!==0?i:re(n.nanos,r.nanos)}function $T(t,e){const n=t.values||[],r=e.values||[];for(let i=0;i<n.length&&i<r.length;++i){const s=ms(n[i],r[i]);if(s)return s}return re(n.length,r.length)}function Ka(t){return Qy(t)}function Qy(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(n){const r=gi(n);return`time(${r.seconds},${r.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?function(n){return fs(n).toBase64()}(t.bytesValue):"referenceValue"in t?function(n){return K.fromName(n).toString()}(t.referenceValue):"geoPointValue"in t?function(n){return`geo(${n.latitude},${n.longitude})`}(t.geoPointValue):"arrayValue"in t?function(n){let r="[",i=!0;for(const s of n.values||[])i?i=!1:r+=",",r+=Qy(s);return r+"]"}(t.arrayValue):"mapValue"in t?function(n){const r=Object.keys(n.fields||{}).sort();let i="{",s=!0;for(const o of r)s?s=!1:i+=",",i+=`${o}:${Qy(n.fields[o])}`;return i+"}"}(t.mapValue):Y()}function yo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Yy(t){return!!t&&"integerValue"in t}function bc(t){return!!t&&"arrayValue"in t}function zT(t){return!!t&&"nullValue"in t}function WT(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Fh(t){return!!t&&"mapValue"in t}function Fp(t){var e,n;return((n=(((e=t==null?void 0:t.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||n===void 0?void 0:n.stringValue)==="__vector__"}function Uu(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return No(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=Uu(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Uu(t.arrayValue.values[n]);return e}return Object.assign({},t)}function oC(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}const aC={mapValue:{fields:{__type__:{stringValue:"__vector__"},value:{arrayValue:{}}}}};function eB(t){return"nullValue"in t?Mh:"booleanValue"in t?{booleanValue:!1}:"integerValue"in t||"doubleValue"in t?{doubleValue:NaN}:"timestampValue"in t?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in t?{stringValue:""}:"bytesValue"in t?{bytesValue:""}:"referenceValue"in t?yo(ps.empty(),K.empty()):"geoPointValue"in t?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in t?{arrayValue:{}}:"mapValue"in t?Fp(t)?aC:{mapValue:{}}:Y()}function tB(t){return"nullValue"in t?{booleanValue:!1}:"booleanValue"in t?{doubleValue:NaN}:"integerValue"in t||"doubleValue"in t?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in t?{stringValue:""}:"stringValue"in t?{bytesValue:""}:"bytesValue"in t?yo(ps.empty(),K.empty()):"referenceValue"in t?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in t?{arrayValue:{}}:"arrayValue"in t?aC:"mapValue"in t?Fp(t)?{mapValue:{}}:Ki:Y()}function qT(t,e){const n=ms(t.value,e.value);return n!==0?n:t.inclusive&&!e.inclusive?-1:!t.inclusive&&e.inclusive?1:0}function HT(t,e){const n=ms(t.value,e.value);return n!==0?n:t.inclusive&&!e.inclusive?1:!t.inclusive&&e.inclusive?-1:0}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ft{constructor(e){this.value=e}static empty(){return new Ft({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r<e.length-1;++r)if(n=(n.mapValue.fields||{})[e.get(r)],!Fh(n))return null;return n=(n.mapValue.fields||{})[e.lastSegment()],n||null}}set(e,n){this.getFieldsMap(e.popLast())[e.lastSegment()]=Uu(n)}setAll(e){let n=Be.emptyPath(),r={},i=[];e.forEach((o,a)=>{if(!n.isImmediateParentOf(a)){const l=this.getFieldsMap(n);this.applyChanges(l,r,i),r={},i=[],n=a.popLast()}o?r[a.lastSegment()]=Uu(o):i.push(a.lastSegment())});const s=this.getFieldsMap(n);this.applyChanges(s,r,i)}delete(e){const n=this.field(e.popLast());Fh(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return zr(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;r<e.length;++r){let i=n.mapValue.fields[e.get(r)];Fh(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},n.mapValue.fields[e.get(r)]=i),n=i}return n.mapValue.fields}applyChanges(e,n,r){No(n,(i,s)=>e[i]=s);for(const i of r)delete e[i]}clone(){return new Ft(Uu(this.value))}}function lC(t){const e=[];return No(t.fields,(n,r)=>{const i=new Be([n]);if(Fh(r)){const s=lC(r.mapValue).fields;if(s.length===0)e.push(i);else for(const o of s)e.push(i.child(o))}else e.push(i)}),new yn(e)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ve{constructor(e,n,r,i,s,o,a){this.key=e,this.documentType=n,this.version=r,this.readTime=i,this.createTime=s,this.data=o,this.documentState=a}static newInvalidDocument(e){return new Ve(e,0,Z.min(),Z.min(),Z.min(),Ft.empty(),0)}static newFoundDocument(e,n,r,i){return new Ve(e,1,n,Z.min(),r,i,0)}static newNoDocument(e,n){return new Ve(e,2,n,Z.min(),Z.min(),Ft.empty(),0)}static newUnknownDocument(e,n){return new Ve(e,3,n,Z.min(),Z.min(),Ft.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(Z.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Ft.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Ft.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Z.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof Ve&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Ve(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class gs{constructor(e,n){this.position=e,this.inclusive=n}}function KT(t,e,n){let r=0;for(let i=0;i<t.position.length;i++){const s=e[i],o=t.position[i];if(s.field.isKeyField()?r=K.comparator(K.fromName(o.referenceValue),n.key):r=ms(o,n.data.field(s.field)),s.dir==="desc"&&(r*=-1),r!==0)break}return r}function GT(t,e){if(t===null)return e===null;if(e===null||t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!zr(t.position[n],e.position[n]))return!1;return!0}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Rc{constructor(e,n="asc"){this.field=e,this.dir=n}}function nB(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class uC{}class pe extends uC{constructor(e,n,r){super(),this.field=e,this.op=n,this.value=r}static create(e,n,r){return e.isKeyField()?n==="in"||n==="not-in"?this.createKeyFieldInFilter(e,n,r):new rB(e,n,r):n==="array-contains"?new oB(e,r):n==="in"?new mC(e,r):n==="not-in"?new aB(e,r):n==="array-contains-any"?new lB(e,r):new pe(e,n,r)}static createKeyFieldInFilter(e,n,r){return n==="in"?new iB(e,r):new sB(e,r)}matches(e){const n=e.data.field(this.field);return this.op==="!="?n!==null&&this.matchesComparison(ms(n,this.value)):n!==null&&go(this.value)===go(n)&&this.matchesComparison(ms(n,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return Y()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Se extends uC{constructor(e,n){super(),this.filters=e,this.op=n,this.ae=null}static create(e,n){return new Se(e,n)}matches(e){return Ga(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.ae!==null||(this.ae=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.ae}getFilters(){return Object.assign([],this.filters)}}function Ga(t){return t.op==="and"}function Jy(t){return t.op==="or"}function v0(t){return cC(t)&&Ga(t)}function cC(t){for(const e of t.filters)if(e instanceof Se)return!1;return!0}function Xy(t){if(t instanceof pe)return t.field.canonicalString()+t.op.toString()+Ka(t.value);if(v0(t))return t.filters.map(e=>Xy(e)).join(",");{const e=t.filters.map(n=>Xy(n)).join(",");return`${t.op}(${e})`}}function dC(t,e){return t instanceof pe?function(r,i){return i instanceof pe&&r.op===i.op&&r.field.isEqual(i.field)&&zr(r.value,i.value)}(t,e):t instanceof Se?function(r,i){return i instanceof Se&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((s,o,a)=>s&&dC(o,i.filters[a]),!0):!1}(t,e):void Y()}function hC(t,e){const n=t.filters.concat(e);return Se.create(n,t.op)}function fC(t){return t instanceof pe?function(n){return`${n.field.canonicalString()} ${n.op} ${Ka(n.value)}`}(t):t instanceof Se?function(n){return n.op.toString()+" {"+n.getFilters().map(fC).join(" ,")+"}"}(t):"Filter"}class rB extends pe{constructor(e,n,r){super(e,n,r),this.key=K.fromName(r.referenceValue)}matches(e){const n=K.comparator(e.key,this.key);return this.matchesComparison(n)}}class iB extends pe{constructor(e,n){super(e,"in",n),this.keys=pC("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class sB extends pe{constructor(e,n){super(e,"not-in",n),this.keys=pC("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function pC(t,e){var n;return(((n=e.arrayValue)===null||n===void 0?void 0:n.values)||[]).map(r=>K.fromName(r.referenceValue))}class oB extends pe{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return bc(n)&&Ac(n.arrayValue,this.value)}}class mC extends pe{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&Ac(this.value.arrayValue,n)}}class aB extends pe{constructor(e,n){super(e,"not-in",n)}matches(e){if(Ac(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&!Ac(this.value.arrayValue,n)}}class lB extends pe{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!bc(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>Ac(this.value.arrayValue,r))}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class uB{constructor(e,n=null,r=[],i=[],s=null,o=null,a=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=s,this.startAt=o,this.endAt=a,this.ue=null}}function Zy(t,e=null,n=[],r=[],i=null,s=null,o=null){return new uB(t,e,n,r,i,s,o)}function _o(t){const e=Q(t);if(e.ue===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>Xy(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(s){return s.field.canonicalString()+s.dir}(r)).join(","),Xc(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>Ka(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>Ka(r)).join(",")),e.ue=n}return e.ue}function Zc(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!nB(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!dC(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!GT(t.startAt,e.startAt)&>(t.endAt,e.endAt)}function Lf(t){return K.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}function Mf(t,e){return t.filters.filter(n=>n instanceof pe&&n.field.isEqual(e))}function QT(t,e,n){let r=Mh,i=!0;for(const s of Mf(t,e)){let o=Mh,a=!0;switch(s.op){case"<":case"<=":o=eB(s.value);break;case"==":case"in":case">=":o=s.value;break;case">":o=s.value,a=!1;break;case"!=":case"not-in":o=Mh}qT({value:r,inclusive:i},{value:o,inclusive:a})<0&&(r=o,i=a)}if(n!==null){for(let s=0;s<t.orderBy.length;++s)if(t.orderBy[s].field.isEqual(e)){const o=n.position[s];qT({value:r,inclusive:i},{value:o,inclusive:n.inclusive})<0&&(r=o,i=n.inclusive);break}}return{value:r,inclusive:i}}function YT(t,e,n){let r=Ki,i=!0;for(const s of Mf(t,e)){let o=Ki,a=!0;switch(s.op){case">=":case">":o=tB(s.value),a=!1;break;case"==":case"in":case"<=":o=s.value;break;case"<":o=s.value,a=!1;break;case"!=":case"not-in":o=Ki}HT({value:r,inclusive:i},{value:o,inclusive:a})>0&&(r=o,i=a)}if(n!==null){for(let s=0;s<t.orderBy.length;++s)if(t.orderBy[s].field.isEqual(e)){const o=n.position[s];HT({value:r,inclusive:i},{value:o,inclusive:n.inclusive})>0&&(r=o,i=n.inclusive);break}}return{value:r,inclusive:i}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ti{constructor(e,n=null,r=[],i=[],s=null,o="F",a=null,l=null){this.path=e,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=i,this.limit=s,this.limitType=o,this.startAt=a,this.endAt=l,this.ce=null,this.le=null,this.he=null,this.startAt,this.endAt}}function gC(t,e,n,r,i,s,o,a){return new Ti(t,e,n,r,i,s,o,a)}function _l(t){return new Ti(t)}function JT(t){return t.filters.length===0&&t.limit===null&&t.startAt==null&&t.endAt==null&&(t.explicitOrderBy.length===0||t.explicitOrderBy.length===1&&t.explicitOrderBy[0].field.isKeyField())}function w0(t){return t.collectionGroup!==null}function Ca(t){const e=Q(t);if(e.ce===null){e.ce=[];const n=new Set;for(const s of e.explicitOrderBy)e.ce.push(s),n.add(s.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new be(Be.comparator);return o.filters.forEach(l=>{l.getFlattenedFilters().forEach(u=>{u.isInequality()&&(a=a.add(u.field))})}),a})(e).forEach(s=>{n.has(s.canonicalString())||s.isKeyField()||e.ce.push(new Rc(s,r))}),n.has(Be.keyField().canonicalString())||e.ce.push(new Rc(Be.keyField(),r))}return e.ce}function ln(t){const e=Q(t);return e.le||(e.le=cB(e,Ca(t))),e.le}function cB(t,e){if(t.limitType==="F")return Zy(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(i=>{const s=i.dir==="desc"?"asc":"desc";return new Rc(i.field,s)});const n=t.endAt?new gs(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new gs(t.startAt.position,t.startAt.inclusive):null;return Zy(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function e_(t,e){const n=t.filters.concat([e]);return new Ti(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Ff(t,e,n){return new Ti(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function ed(t,e){return Zc(ln(t),ln(e))&&t.limitType===e.limitType}function yC(t){return`${_o(ln(t))}|lt:${t.limitType}`}function ta(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(i=>fC(i)).join(", ")}]`),Xc(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(i=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(i)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(i=>Ka(i)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(i=>Ka(i)).join(",")),`Target(${r})`}(ln(t))}; limitType=${t.limitType})`}function td(t,e){return e.isFoundDocument()&&function(r,i){const s=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(s):K.isDocumentKey(r.path)?r.path.isEqual(s):r.path.isImmediateParentOf(s)}(t,e)&&function(r,i){for(const s of Ca(r))if(!s.field.isKeyField()&&i.data.field(s.field)===null)return!1;return!0}(t,e)&&function(r,i){for(const s of r.filters)if(!s.matches(i))return!1;return!0}(t,e)&&function(r,i){return!(r.startAt&&!function(o,a,l){const u=KT(o,a,l);return o.inclusive?u<=0:u<0}(r.startAt,Ca(r),i)||r.endAt&&!function(o,a,l){const u=KT(o,a,l);return o.inclusive?u>=0:u>0}(r.endAt,Ca(r),i))}(t,e)}function _C(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function vC(t){return(e,n)=>{let r=!1;for(const i of Ca(t)){const s=dB(i,e,n);if(s!==0)return s;r=r||i.field.isKeyField()}return 0}}function dB(t,e,n){const r=t.field.isKeyField()?K.comparator(e.key,n.key):function(s,o,a){const l=o.data.field(s),u=a.data.field(s);return l!==null&&u!==null?ms(l,u):Y()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Y()}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ks{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[i,s]of r)if(this.equalsFn(i,e))return s}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),i=this.inner[r];if(i===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let s=0;s<i.length;s++)if(this.equalsFn(i[s][0],e))return void(i[s]=[e,n]);i.push([e,n]),this.innerSize++}delete(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r===void 0)return!1;for(let i=0;i<r.length;i++)if(this.equalsFn(r[i][0],e))return r.length===1?delete this.inner[n]:r.splice(i,1),this.innerSize--,!0;return!1}forEach(e){No(this.inner,(n,r)=>{for(const[i,s]of r)e(i,s)})}isEmpty(){return iC(this.inner)}size(){return this.innerSize}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const hB=new Oe(K.comparator);function _n(){return hB}const wC=new Oe(K.comparator);function wu(...t){let e=wC;for(const n of t)e=e.insert(n.key,n);return e}function EC(t){let e=wC;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function Nr(){return ju()}function IC(){return ju()}function ju(){return new ks(t=>t.toString(),(t,e)=>t.isEqual(e))}const fB=new Oe(K.comparator),pB=new be(K.comparator);function se(...t){let e=pB;for(const n of t)e=e.add(n);return e}const mB=new be(re);function E0(){return mB}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function I0(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Tc(e)?"-0":e}}function TC(t){return{integerValue:""+t}}function SC(t,e){return ZP(e)?TC(e):I0(t,e)}/** * @license * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Up{constructor(){this._=void 0}}function gB(t,e,n){return t instanceof Qa?function(i,s){const o={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return s&&Mp(s)&&(s=_0(s)),s&&(o.fields.__previous_value__=s),{mapValue:o}}(n,e):t instanceof vo?bC(t,e):t instanceof wo?RC(t,e):function(i,s){const o=AC(i,s),a=XT(o)+XT(i.Pe);return Yy(o)&&Yy(i.Pe)?TC(a):I0(i.serializer,a)}(t,e)}function yB(t,e,n){return t instanceof vo?bC(t,e):t instanceof wo?RC(t,e):n}function AC(t,e){return t instanceof Ya?function(r){return Yy(r)||function(s){return!!s&&"doubleValue"in s}(r)}(e)?e:{integerValue:0}:null}class Qa extends Up{}class vo extends Up{constructor(e){super(),this.elements=e}}function bC(t,e){const n=PC(e);for(const r of t.elements)n.some(i=>zr(i,r))||n.push(r);return{arrayValue:{values:n}}}class wo extends Up{constructor(e){super(),this.elements=e}}function RC(t,e){let n=PC(e);for(const r of t.elements)n=n.filter(i=>!zr(i,r));return{arrayValue:{values:n}}}class Ya extends Up{constructor(e,n){super(),this.serializer=e,this.Pe=n}}function XT(t){return Ue(t.integerValue||t.doubleValue)}function PC(t){return bc(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class nd{constructor(e,n){this.field=e,this.transform=n}}function _B(t,e){return t.field.isEqual(e.field)&&function(r,i){return r instanceof vo&&i instanceof vo||r instanceof wo&&i instanceof wo?Ha(r.elements,i.elements,zr):r instanceof Ya&&i instanceof Ya?zr(r.Pe,i.Pe):r instanceof Qa&&i instanceof Qa}(t.transform,e.transform)}class vB{constructor(e,n){this.version=e,this.transformResults=n}}class $e{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new $e}static exists(e){return new $e(void 0,e)}static updateTime(e){return new $e(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Uh(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class jp{}function CC(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new wl(t.key,$e.none()):new vl(t.key,t.data,$e.none());{const n=t.data,r=Ft.empty();let i=new be(Be.comparator);for(let s of e.fields)if(!i.has(s)){let o=n.field(s);o===null&&s.length>1&&(s=s.popLast(),o=n.field(s)),o===null?r.delete(s):r.set(s,o),i=i.add(s)}return new Si(t.key,r,new yn(i.toArray()),$e.none())}}function wB(t,e,n){t instanceof vl?function(i,s,o){const a=i.value.clone(),l=eS(i.fieldTransforms,s,o.transformResults);a.setAll(l),s.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(t,e,n):t instanceof Si?function(i,s,o){if(!Uh(i.precondition,s))return void s.convertToUnknownDocument(o.version);const a=eS(i.fieldTransforms,s,o.transformResults),l=s.data;l.setAll(kC(i)),l.setAll(a),s.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(t,e,n):function(i,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function Bu(t,e,n,r){return t instanceof vl?function(s,o,a,l){if(!Uh(s.precondition,o))return a;const u=s.value.clone(),d=tS(s.fieldTransforms,l,o);return u.setAll(d),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),null}(t,e,n,r):t instanceof Si?function(s,o,a,l){if(!Uh(s.precondition,o))return a;const u=tS(s.fieldTransforms,l,o),d=o.data;return d.setAll(kC(s)),d.setAll(u),o.convertToFoundDocument(o.version,d).setHasLocalMutations(),a===null?null:a.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(h=>h.field))}(t,e,n,r):function(s,o,a){return Uh(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(t,e,n)}function EB(t,e){let n=null;for(const r of t.fieldTransforms){const i=e.data.field(r.field),s=AC(r.transform,i||null);s!=null&&(n===null&&(n=Ft.empty()),n.set(r.field,s))}return n||null}function ZT(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,i){return r===void 0&&i===void 0||!(!r||!i)&&Ha(r,i,(s,o)=>_B(s,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class vl extends jp{constructor(e,n,r,i=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Si extends jp{constructor(e,n,r,i,s=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function kC(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}}),e}function eS(t,e,n){const r=new Map;X(t.length===n.length);for(let i=0;i<n.length;i++){const s=t[i],o=s.transform,a=e.data.field(s.field);r.set(s.field,yB(o,a,n[i]))}return r}function tS(t,e,n){const r=new Map;for(const i of t){const s=i.transform,o=n.data.field(i.field);r.set(i.field,gB(s,o,e))}return r}class wl extends jp{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class T0 extends jp{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class S0{constructor(e,n,r,i){this.batchId=e,this.localWriteTime=n,this.baseMutations=r,this.mutations=i}applyToRemoteDocument(e,n){const r=n.mutationResults;for(let i=0;i<this.mutations.length;i++){const s=this.mutations[i];s.key.isEqual(e.key)&&wB(s,e,r[i])}}applyToLocalView(e,n){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(n=Bu(r,e,n,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(n=Bu(r,e,n,this.localWriteTime));return n}applyToLocalDocumentSet(e,n){const r=IC();return this.mutations.forEach(i=>{const s=e.get(i.key),o=s.overlayedDocument;let a=this.applyToLocalView(o,s.mutatedFields);a=n.has(i.key)?null:a;const l=CC(o,a);l!==null&&r.set(i.key,l),o.isValidDocument()||o.convertToNoDocument(Z.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),se())}isEqual(e){return this.batchId===e.batchId&&Ha(this.mutations,e.mutations,(n,r)=>ZT(n,r))&&Ha(this.baseMutations,e.baseMutations,(n,r)=>ZT(n,r))}}class A0{constructor(e,n,r,i){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}static from(e,n,r){X(e.mutations.length===r.length);let i=function(){return fB}();const s=e.mutations;for(let o=0;o<s.length;o++)i=i.insert(s[o].key,r[o].version);return new A0(e,n,r,i)}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class b0{constructor(e,n){this.largestBatchId=e,this.mutation=n}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{ largestBatchId: ${this.largestBatchId}, mutation: ${this.mutation.toString()} }`}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class IB{constructor(e,n){this.count=e,this.unchangedNames=n}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var pt,ge;function xC(t){switch(t){default:return Y();case M.CANCELLED:case M.UNKNOWN:case M.DEADLINE_EXCEEDED:case M.RESOURCE_EXHAUSTED:case M.INTERNAL:case M.UNAVAILABLE:case M.UNAUTHENTICATED:return!1;case M.INVALID_ARGUMENT:case M.NOT_FOUND:case M.ALREADY_EXISTS:case M.PERMISSION_DENIED:case M.FAILED_PRECONDITION:case M.ABORTED:case M.OUT_OF_RANGE:case M.UNIMPLEMENTED:case M.DATA_LOSS:return!0}}function OC(t){if(t===void 0)return ut("GRPC error has no .code"),M.UNKNOWN;switch(t){case pt.OK:return M.OK;case pt.CANCELLED:return M.CANCELLED;case pt.UNKNOWN:return M.UNKNOWN;case pt.DEADLINE_EXCEEDED:return M.DEADLINE_EXCEEDED;case pt.RESOURCE_EXHAUSTED:return M.RESOURCE_EXHAUSTED;case pt.INTERNAL:return M.INTERNAL;case pt.UNAVAILABLE:return M.UNAVAILABLE;case pt.UNAUTHENTICATED:return M.UNAUTHENTICATED;case pt.INVALID_ARGUMENT:return M.INVALID_ARGUMENT;case pt.NOT_FOUND:return M.NOT_FOUND;case pt.ALREADY_EXISTS:return M.ALREADY_EXISTS;case pt.PERMISSION_DENIED:return M.PERMISSION_DENIED;case pt.FAILED_PRECONDITION:return M.FAILED_PRECONDITION;case pt.ABORTED:return M.ABORTED;case pt.OUT_OF_RANGE:return M.OUT_OF_RANGE;case pt.UNIMPLEMENTED:return M.UNIMPLEMENTED;case pt.DATA_LOSS:return M.DATA_LOSS;default:return Y()}}(ge=pt||(pt={}))[ge.OK=0]="OK",ge[ge.CANCELLED=1]="CANCELLED",ge[ge.UNKNOWN=2]="UNKNOWN",ge[ge.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",ge[ge.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",ge[ge.NOT_FOUND=5]="NOT_FOUND",ge[ge.ALREADY_EXISTS=6]="ALREADY_EXISTS",ge[ge.PERMISSION_DENIED=7]="PERMISSION_DENIED",ge[ge.UNAUTHENTICATED=16]="UNAUTHENTICATED",ge[ge.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",ge[ge.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",ge[ge.ABORTED=10]="ABORTED",ge[ge.OUT_OF_RANGE=11]="OUT_OF_RANGE",ge[ge.UNIMPLEMENTED=12]="UNIMPLEMENTED",ge[ge.INTERNAL=13]="INTERNAL",ge[ge.UNAVAILABLE=14]="UNAVAILABLE",ge[ge.DATA_LOSS=15]="DATA_LOSS";/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function NC(){return new TextEncoder}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const TB=new ao([4294967295,4294967295],0);function nS(t){const e=NC().encode(t),n=new FP;return n.update(e),new Uint8Array(n.digest())}function rS(t){const e=new DataView(t.buffer),n=e.getUint32(0,!0),r=e.getUint32(4,!0),i=e.getUint32(8,!0),s=e.getUint32(12,!0);return[new ao([n,r],0),new ao([i,s],0)]}class R0{constructor(e,n,r){if(this.bitmap=e,this.padding=n,this.hashCount=r,n<0||n>=8)throw new Eu(`Invalid padding: ${n}`);if(r<0)throw new Eu(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new Eu(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new Eu(`Invalid padding when bitmap length is 0: ${n}`);this.Ie=8*e.length-n,this.Te=ao.fromNumber(this.Ie)}Ee(e,n,r){let i=e.add(n.multiply(ao.fromNumber(r)));return i.compare(TB)===1&&(i=new ao([i.getBits(0),i.getBits(1)],0)),i.modulo(this.Te).toNumber()}de(e){return(this.bitmap[Math.floor(e/8)]&1<<e%8)!=0}mightContain(e){if(this.Ie===0)return!1;const n=nS(e),[r,i]=rS(n);for(let s=0;s<this.hashCount;s++){const o=this.Ee(r,i,s);if(!this.de(o))return!1}return!0}static create(e,n,r){const i=e%8==0?0:8-e%8,s=new Uint8Array(Math.ceil(e/8)),o=new R0(s,i,n);return r.forEach(a=>o.insert(a)),o}insert(e){if(this.Ie===0)return;const n=nS(e),[r,i]=rS(n);for(let s=0;s<this.hashCount;s++){const o=this.Ee(r,i,s);this.Ae(o)}}Ae(e){const n=Math.floor(e/8),r=e%8;this.bitmap[n]|=1<<r}}class Eu extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class rd{constructor(e,n,r,i,s){this.snapshotVersion=e,this.targetChanges=n,this.targetMismatches=r,this.documentUpdates=i,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,n,r){const i=new Map;return i.set(e,id.createSynthesizedTargetChangeForCurrentChange(e,n,r)),new rd(Z.min(),i,new Oe(re),_n(),se())}}class id{constructor(e,n,r,i,s){this.resumeToken=e,this.current=n,this.addedDocuments=r,this.modifiedDocuments=i,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,n,r){return new id(r,n,se(),se(),se())}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class jh{constructor(e,n,r,i){this.Re=e,this.removedTargetIds=n,this.key=r,this.Ve=i}}class DC{constructor(e,n){this.targetId=e,this.me=n}}class VC{constructor(e,n,r=it.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=n,this.resumeToken=r,this.cause=i}}class iS{constructor(){this.fe=0,this.ge=oS(),this.pe=it.EMPTY_BYTE_STRING,this.ye=!1,this.we=!0}get current(){return this.ye}get resumeToken(){return this.pe}get Se(){return this.fe!==0}get be(){return this.we}De(e){e.approximateByteSize()>0&&(this.we=!0,this.pe=e)}ve(){let e=se(),n=se(),r=se();return this.ge.forEach((i,s)=>{switch(s){case 0:e=e.add(i);break;case 2:n=n.add(i);break;case 1:r=r.add(i);break;default:Y()}}),new id(this.pe,this.ye,e,n,r)}Ce(){this.we=!1,this.ge=oS()}Fe(e,n){this.we=!0,this.ge=this.ge.insert(e,n)}Me(e){this.we=!0,this.ge=this.ge.remove(e)}xe(){this.fe+=1}Oe(){this.fe-=1,X(this.fe>=0)}Ne(){this.we=!0,this.ye=!0}}class SB{constructor(e){this.Le=e,this.Be=new Map,this.ke=_n(),this.qe=sS(),this.Qe=new Oe(re)}Ke(e){for(const n of e.Re)e.Ve&&e.Ve.isFoundDocument()?this.$e(n,e.Ve):this.Ue(n,e.key,e.Ve);for(const n of e.removedTargetIds)this.Ue(n,e.key,e.Ve)}We(e){this.forEachTarget(e,n=>{const r=this.Ge(n);switch(e.state){case 0:this.ze(n)&&r.De(e.resumeToken);break;case 1:r.Oe(),r.Se||r.Ce(),r.De(e.resumeToken);break;case 2:r.Oe(),r.Se||this.removeTarget(n);break;case 3:this.ze(n)&&(r.Ne(),r.De(e.resumeToken));break;case 4:this.ze(n)&&(this.je(n),r.De(e.resumeToken));break;default:Y()}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.Be.forEach((r,i)=>{this.ze(i)&&n(i)})}He(e){const n=e.targetId,r=e.me.count,i=this.Je(n);if(i){const s=i.target;if(Lf(s))if(r===0){const o=new K(s.path);this.Ue(n,o,Ve.newNoDocument(o,Z.min()))}else X(r===1);else{const o=this.Ye(n);if(o!==r){const a=this.Ze(e),l=a?this.Xe(a,e,o):1;if(l!==0){this.je(n);const u=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Qe=this.Qe.insert(n,u)}}}}}Ze(e){const n=e.me.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:i=0},hashCount:s=0}=n;let o,a;try{o=fs(r).toUint8Array()}catch(l){if(l instanceof sC)return _r("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{a=new R0(o,i,s)}catch(l){return _r(l instanceof Eu?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return a.Ie===0?null:a}Xe(e,n,r){return n.me.count===r-this.nt(e,n.targetId)?0:2}nt(e,n){const r=this.Le.getRemoteKeysForTarget(n);let i=0;return r.forEach(s=>{const o=this.Le.tt(),a=`projects/${o.projectId}/databases/${o.database}/documents/${s.path.canonicalString()}`;e.mightContain(a)||(this.Ue(n,s,null),i++)}),i}rt(e){const n=new Map;this.Be.forEach((s,o)=>{const a=this.Je(o);if(a){if(s.current&&Lf(a.target)){const l=new K(a.target.path);this.ke.get(l)!==null||this.it(o,l)||this.Ue(o,l,Ve.newNoDocument(l,e))}s.be&&(n.set(o,s.ve()),s.Ce())}});let r=se();this.qe.forEach((s,o)=>{let a=!0;o.forEachWhile(l=>{const u=this.Je(l);return!u||u.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(r=r.add(s))}),this.ke.forEach((s,o)=>o.setReadTime(e));const i=new rd(e,n,this.Qe,this.ke,r);return this.ke=_n(),this.qe=sS(),this.Qe=new Oe(re),i}$e(e,n){if(!this.ze(e))return;const r=this.it(e,n.key)?2:0;this.Ge(e).Fe(n.key,r),this.ke=this.ke.insert(n.key,n),this.qe=this.qe.insert(n.key,this.st(n.key).add(e))}Ue(e,n,r){if(!this.ze(e))return;const i=this.Ge(e);this.it(e,n)?i.Fe(n,1):i.Me(n),this.qe=this.qe.insert(n,this.st(n).delete(e)),r&&(this.ke=this.ke.insert(n,r))}removeTarget(e){this.Be.delete(e)}Ye(e){const n=this.Ge(e).ve();return this.Le.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}xe(e){this.Ge(e).xe()}Ge(e){let n=this.Be.get(e);return n||(n=new iS,this.Be.set(e,n)),n}st(e){let n=this.qe.get(e);return n||(n=new be(re),this.qe=this.qe.insert(e,n)),n}ze(e){const n=this.Je(e)!==null;return n||z("WatchChangeAggregator","Detected inactive target",e),n}Je(e){const n=this.Be.get(e);return n&&n.Se?null:this.Le.ot(e)}je(e){this.Be.set(e,new iS),this.Le.getRemoteKeysForTarget(e).forEach(n=>{this.Ue(e,n,null)})}it(e,n){return this.Le.getRemoteKeysForTarget(e).has(n)}}function sS(){return new Oe(K.comparator)}function oS(){return new Oe(K.comparator)}const AB={asc:"ASCENDING",desc:"DESCENDING"},bB={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},RB={and:"AND",or:"OR"};class PB{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function t_(t,e){return t.useProto3Json||Xc(e)?e:{value:e}}function Ja(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function LC(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function CB(t,e){return Ja(t,e.toTimestamp())}function ct(t){return X(!!t),Z.fromTimestamp(function(n){const r=gi(n);return new ze(r.seconds,r.nanos)}(t))}function P0(t,e){return n_(t,e).canonicalString()}function n_(t,e){const n=function(i){return new fe(["projects",i.projectId,"databases",i.database])}(t).child("documents");return e===void 0?n:n.child(e)}function MC(t){const e=fe.fromString(t);return X(KC(e)),e}function Pc(t,e){return P0(t.databaseId,e.path)}function Ur(t,e){const n=MC(e);if(n.get(1)!==t.databaseId.projectId)throw new $(M.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new $(M.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new K(jC(n))}function FC(t,e){return P0(t.databaseId,e)}function UC(t){const e=MC(t);return e.length===4?fe.emptyPath():jC(e)}function r_(t){return new fe(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function jC(t){return X(t.length>4&&t.get(4)==="documents"),t.popFirst(5)}function aS(t,e,n){return{name:Pc(t,e),fields:n.value.mapValue.fields}}function BC(t,e,n){const r=Ur(t,e.name),i=ct(e.updateTime),s=e.createTime?ct(e.createTime):Z.min(),o=new Ft({mapValue:{fields:e.fields}}),a=Ve.newFoundDocument(r,i,s,o);return n&&a.setHasCommittedMutations(),n?a.setHasCommittedMutations():a}function kB(t,e){return"found"in e?function(r,i){X(!!i.found),i.found.name,i.found.updateTime;const s=Ur(r,i.found.name),o=ct(i.found.updateTime),a=i.found.createTime?ct(i.found.createTime):Z.min(),l=new Ft({mapValue:{fields:i.found.fields}});return Ve.newFoundDocument(s,o,a,l)}(t,e):"missing"in e?function(r,i){X(!!i.missing),X(!!i.readTime);const s=Ur(r,i.missing),o=ct(i.readTime);return Ve.newNoDocument(s,o)}(t,e):Y()}function xB(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(u){return u==="NO_CHANGE"?0:u==="ADD"?1:u==="REMOVE"?2:u==="CURRENT"?3:u==="RESET"?4:Y()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(u,d){return u.useProto3Json?(X(d===void 0||typeof d=="string"),it.fromBase64String(d||"")):(X(d===void 0||d instanceof Buffer||d instanceof Uint8Array),it.fromUint8Array(d||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(u){const d=u.code===void 0?M.UNKNOWN:OC(u.code);return new $(d,u.message||"")}(o);n=new VC(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=Ur(t,r.document.name),s=ct(r.document.updateTime),o=r.document.createTime?ct(r.document.createTime):Z.min(),a=new Ft({mapValue:{fields:r.document.fields}}),l=Ve.newFoundDocument(i,s,o,a),u=r.targetIds||[],d=r.removedTargetIds||[];n=new jh(u,d,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=Ur(t,r.document),s=r.readTime?ct(r.readTime):Z.min(),o=Ve.newNoDocument(i,s),a=r.removedTargetIds||[];n=new jh([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=Ur(t,r.document),s=r.removedTargetIds||[];n=new jh([],s,i,null)}else{if(!("filter"in e))return Y();{e.filter;const r=e.filter;r.targetId;const{count:i=0,unchangedNames:s}=r,o=new IB(i,s),a=r.targetId;n=new DC(a,o)}}return n}function Cc(t,e){let n;if(e instanceof vl)n={update:aS(t,e.key,e.value)};else if(e instanceof wl)n={delete:Pc(t,e.key)};else if(e instanceof Si)n={update:aS(t,e.key,e.data),updateMask:MB(e.fieldMask)};else{if(!(e instanceof T0))return Y();n={verify:Pc(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(s,o){const a=o.transform;if(a instanceof Qa)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof vo)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof wo)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof Ya)return{fieldPath:o.field.canonicalString(),increment:a.Pe};throw Y()}(0,r))),e.precondition.isNone||(n.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:CB(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:Y()}(t,e.precondition)),n}function i_(t,e){const n=e.currentDocument?function(s){return s.updateTime!==void 0?$e.updateTime(ct(s.updateTime)):s.exists!==void 0?$e.exists(s.exists):$e.none()}(e.currentDocument):$e.none(),r=e.updateTransforms?e.updateTransforms.map(i=>function(o,a){let l=null;if("setToServerValue"in a)X(a.setToServerValue==="REQUEST_TIME"),l=new Qa;else if("appendMissingElements"in a){const d=a.appendMissingElements.values||[];l=new vo(d)}else if("removeAllFromArray"in a){const d=a.removeAllFromArray.values||[];l=new wo(d)}else"increment"in a?l=new Ya(o,a.increment):Y();const u=Be.fromServerFormat(a.fieldPath);return new nd(u,l)}(t,i)):[];if(e.update){e.update.name;const i=Ur(t,e.update.name),s=new Ft({mapValue:{fields:e.update.fields}});if(e.updateMask){const o=function(l){const u=l.fieldPaths||[];return new yn(u.map(d=>Be.fromServerFormat(d)))}(e.updateMask);return new Si(i,s,o,n,r)}return new vl(i,s,n,r)}if(e.delete){const i=Ur(t,e.delete);return new wl(i,n)}if(e.verify){const i=Ur(t,e.verify);return new T0(i,n)}return Y()}function OB(t,e){return t&&t.length>0?(X(e!==void 0),t.map(n=>function(i,s){let o=i.updateTime?ct(i.updateTime):ct(s);return o.isEqual(Z.min())&&(o=ct(s)),new vB(o,i.transformResults||[])}(n,e))):[]}function $C(t,e){return{documents:[FC(t,e.path)]}}function zC(t,e){const n={structuredQuery:{}},r=e.path;let i;e.collectionGroup!==null?(i=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=FC(t,i);const s=function(u){if(u.length!==0)return HC(Se.create(u,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const o=function(u){if(u.length!==0)return u.map(d=>function(f){return{field:na(f.field),direction:DB(f.dir)}}(d))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const a=t_(t,e.limit);return a!==null&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=function(u){return{before:u.inclusive,values:u.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(u){return{before:!u.inclusive,values:u.position}}(e.endAt)),{_t:n,parent:i}}function WC(t){let e=UC(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){X(r===1);const d=n.from[0];d.allDescendants?i=d.collectionId:e=e.child(d.collectionId)}let s=[];n.where&&(s=function(h){const f=qC(h);return f instanceof Se&&v0(f)?f.getFilters():[f]}(n.where));let o=[];n.orderBy&&(o=function(h){return h.map(f=>function(_){return new Rc(ra(_.field),function(T){switch(T){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(_.direction))}(f))}(n.orderBy));let a=null;n.limit&&(a=function(h){let f;return f=typeof h=="object"?h.value:h,Xc(f)?null:f}(n.limit));let l=null;n.startAt&&(l=function(h){const f=!!h.before,g=h.values||[];return new gs(g,f)}(n.startAt));let u=null;return n.endAt&&(u=function(h){const f=!h.before,g=h.values||[];return new gs(g,f)}(n.endAt)),gC(e,i,o,s,a,"F",l,u)}function NB(t,e){const n=function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Y()}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function qC(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=ra(n.unaryFilter.field);return pe.create(r,"==",{doubleValue:NaN});case"IS_NULL":const i=ra(n.unaryFilter.field);return pe.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=ra(n.unaryFilter.field);return pe.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=ra(n.unaryFilter.field);return pe.create(o,"!=",{nullValue:"NULL_VALUE"});default:return Y()}}(t):t.fieldFilter!==void 0?function(n){return pe.create(ra(n.fieldFilter.field),function(i){switch(i){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Y()}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return Se.create(n.compositeFilter.filters.map(r=>qC(r)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return Y()}}(n.compositeFilter.op))}(t):Y()}function DB(t){return AB[t]}function VB(t){return bB[t]}function LB(t){return RB[t]}function na(t){return{fieldPath:t.canonicalString()}}function ra(t){return Be.fromServerFormat(t.fieldPath)}function HC(t){return t instanceof pe?function(n){if(n.op==="=="){if(WT(n.value))return{unaryFilter:{field:na(n.field),op:"IS_NAN"}};if(zT(n.value))return{unaryFilter:{field:na(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(WT(n.value))return{unaryFilter:{field:na(n.field),op:"IS_NOT_NAN"}};if(zT(n.value))return{unaryFilter:{field:na(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:na(n.field),op:VB(n.op),value:n.value}}}(t):t instanceof Se?function(n){const r=n.getFilters().map(i=>HC(i));return r.length===1?r[0]:{compositeFilter:{op:LB(n.op),filters:r}}}(t):Y()}function MB(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function KC(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class oi{constructor(e,n,r,i,s=Z.min(),o=Z.min(),a=it.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=l}withSequenceNumber(e){return new oi(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new oi(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new oi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new oi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class GC{constructor(e){this.ct=e}}function FB(t,e){let n;if(e.document)n=BC(t.ct,e.document,!!e.hasCommittedMutations);else if(e.noDocument){const r=K.fromSegments(e.noDocument.path),i=Io(e.noDocument.readTime);n=Ve.newNoDocument(r,i),e.hasCommittedMutations&&n.setHasCommittedMutations()}else{if(!e.unknownDocument)return Y();{const r=K.fromSegments(e.unknownDocument.path),i=Io(e.unknownDocument.version);n=Ve.newUnknownDocument(r,i)}}return e.readTime&&n.setReadTime(function(i){const s=new ze(i[0],i[1]);return Z.fromTimestamp(s)}(e.readTime)),n}function lS(t,e){const n=e.key,r={prefixPath:n.getCollectionPath().popLast().toArray(),collectionGroup:n.collectionGroup,documentId:n.path.lastSegment(),readTime:Uf(e.readTime),hasCommittedMutations:e.hasCommittedMutations};if(e.isFoundDocument())r.document=function(s,o){return{name:Pc(s,o.key),fields:o.data.value.mapValue.fields,updateTime:Ja(s,o.version.toTimestamp()),createTime:Ja(s,o.createTime.toTimestamp())}}(t.ct,e);else if(e.isNoDocument())r.noDocument={path:n.path.toArray(),readTime:Eo(e.version)};else{if(!e.isUnknownDocument())return Y();r.unknownDocument={path:n.path.toArray(),version:Eo(e.version)}}return r}function Uf(t){const e=t.toTimestamp();return[e.seconds,e.nanoseconds]}function Eo(t){const e=t.toTimestamp();return{seconds:e.seconds,nanoseconds:e.nanoseconds}}function Io(t){const e=new ze(t.seconds,t.nanoseconds);return Z.fromTimestamp(e)}function qs(t,e){const n=(e.baseMutations||[]).map(s=>i_(t.ct,s));for(let s=0;s<e.mutations.length-1;++s){const o=e.mutations[s];if(s+1<e.mutations.length&&e.mutations[s+1].transform!==void 0){const a=e.mutations[s+1];o.updateTransforms=a.transform.fieldTransforms,e.mutations.splice(s+1,1),++s}}const r=e.mutations.map(s=>i_(t.ct,s)),i=ze.fromMillis(e.localWriteTimeMs);return new S0(e.batchId,i,n,r)}function Iu(t){const e=Io(t.readTime),n=t.lastLimboFreeSnapshotVersion!==void 0?Io(t.lastLimboFreeSnapshotVersion):Z.min();let r;return r=function(s){return s.documents!==void 0}(t.query)?function(s){return X(s.documents.length===1),ln(_l(UC(s.documents[0])))}(t.query):function(s){return ln(WC(s))}(t.query),new oi(r,t.targetId,"TargetPurposeListen",t.lastListenSequenceNumber,e,n,it.fromBase64String(t.resumeToken))}function QC(t,e){const n=Eo(e.snapshotVersion),r=Eo(e.lastLimboFreeSnapshotVersion);let i;i=Lf(e.target)?$C(t.ct,e.target):zC(t.ct,e.target)._t;const s=e.resumeToken.toBase64();return{targetId:e.targetId,canonicalId:_o(e.target),readTime:n,resumeToken:s,lastListenSequenceNumber:e.sequenceNumber,lastLimboFreeSnapshotVersion:r,query:i}}function C0(t){const e=WC({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?Ff(e,e.limit,"L"):e}function Pg(t,e){return new b0(e.largestBatchId,i_(t.ct,e.overlayMutation))}function uS(t,e){const n=e.path.lastSegment();return[t,an(e.path.popLast()),n]}function cS(t,e,n,r){return{indexId:t,uid:e,sequenceNumber:n,readTime:Eo(r.readTime),documentKey:an(r.documentKey.path),largestBatchId:r.largestBatchId}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class UB{getBundleMetadata(e,n){return dS(e).get(n).next(r=>{if(r)return function(s){return{id:s.bundleId,createTime:Io(s.createTime),version:s.version}}(r)})}saveBundleMetadata(e,n){return dS(e).put(function(i){return{bundleId:i.id,createTime:Eo(ct(i.createTime)),version:i.version}}(n))}getNamedQuery(e,n){return hS(e).get(n).next(r=>{if(r)return function(s){return{name:s.name,query:C0(s.bundledQuery),readTime:Io(s.readTime)}}(r)})}saveNamedQuery(e,n){return hS(e).put(function(i){return{name:i.name,readTime:Eo(ct(i.readTime)),bundledQuery:i.bundledQuery}}(n))}}function dS(t){return Tt(t,"bundles")}function hS(t){return Tt(t,"namedQueries")}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Bp{constructor(e,n){this.serializer=e,this.userId=n}static lt(e,n){const r=n.uid||"";return new Bp(e,r)}getOverlay(e,n){return eu(e).get(uS(this.userId,n)).next(r=>r?Pg(this.serializer,r):null)}getOverlays(e,n){const r=Nr();return L.forEach(n,i=>this.getOverlay(e,i).next(s=>{s!==null&&r.set(i,s)})).next(()=>r)}saveOverlays(e,n,r){const i=[];return r.forEach((s,o)=>{const a=new b0(n,o);i.push(this.ht(e,a))}),L.waitFor(i)}removeOverlaysForBatchId(e,n,r){const i=new Set;n.forEach(o=>i.add(an(o.getCollectionPath())));const s=[];return i.forEach(o=>{const a=IDBKeyRange.bound([this.userId,o,r],[this.userId,o,r+1],!1,!0);s.push(eu(e).j("collectionPathOverlayIndex",a))}),L.waitFor(s)}getOverlaysForCollection(e,n,r){const i=Nr(),s=an(n),o=IDBKeyRange.bound([this.userId,s,r],[this.userId,s,Number.POSITIVE_INFINITY],!0);return eu(e).U("collectionPathOverlayIndex",o).next(a=>{for(const l of a){const u=Pg(this.serializer,l);i.set(u.getKey(),u)}return i})}getOverlaysForCollectionGroup(e,n,r,i){const s=Nr();let o;const a=IDBKeyRange.bound([this.userId,n,r],[this.userId,n,Number.POSITIVE_INFINITY],!0);return eu(e).J({index:"collectionGroupOverlayIndex",range:a},(l,u,d)=>{const h=Pg(this.serializer,u);s.size()<i||h.largestBatchId===o?(s.set(h.getKey(),h),o=h.largestBatchId):d.done()}).next(()=>s)}ht(e,n){return eu(e).put(function(i,s,o){const[a,l,u]=uS(s,o.mutation.key);return{userId:s,collectionPath:l,documentId:u,collectionGroup:o.mutation.key.getCollectionGroup(),largestBatchId:o.largestBatchId,overlayMutation:Cc(i.ct,o.mutation)}}(this.serializer,this.userId,n))}}function eu(t){return Tt(t,"documentOverlays")}/** * @license * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class jB{Pt(e){return Tt(e,"globals")}getSessionToken(e){return this.Pt(e).get("sessionToken").next(n=>{const r=n==null?void 0:n.value;return r?it.fromUint8Array(r):it.EMPTY_BYTE_STRING})}setSessionToken(e,n){return this.Pt(e).put({name:"sessionToken",value:n.toUint8Array()})}}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Hs{constructor(){}It(e,n){this.Tt(e,n),n.Et()}Tt(e,n){if("nullValue"in e)this.dt(n,5);else if("booleanValue"in e)this.dt(n,10),n.At(e.booleanValue?1:0);else if("integerValue"in e)this.dt(n,15),n.At(Ue(e.integerValue));else if("doubleValue"in e){const r=Ue(e.doubleValue);isNaN(r)?this.dt(n,13):(this.dt(n,15),Tc(r)?n.At(0):n.At(r))}else if("timestampValue"in e){let r=e.timestampValue;this.dt(n,20),typeof r=="string"&&(r=gi(r)),n.Rt(`${r.seconds||""}`),n.At(r.nanos||0)}else if("stringValue"in e)this.Vt(e.stringValue,n),this.ft(n);else if("bytesValue"in e)this.dt(n,30),n.gt(fs(e.bytesValue)),this.ft(n);else if("referenceValue"in e)this.yt(e.referenceValue,n);else if("geoPointValue"in e){const r=e.geoPointValue;this.dt(n,45),n.At(r.latitude||0),n.At(r.longitude||0)}else"mapValue"in e?oC(e)?this.dt(n,Number.MAX_SAFE_INTEGER):Fp(e)?this.wt(e.mapValue,n):(this.St(e.mapValue,n),this.ft(n)):"arrayValue"in e?(this.bt(e.arrayValue,n),this.ft(n)):Y()}Vt(e,n){this.dt(n,25),this.Dt(e,n)}Dt(e,n){n.Rt(e)}St(e,n){const r=e.fields||{};this.dt(n,55);for(const i of Object.keys(r))this.Vt(i,n),this.Tt(r[i],n)}wt(e,n){var r,i;const s=e.fields||{};this.dt(n,53);const o="value",a=((i=(r=s[o].arrayValue)===null||r===void 0?void 0:r.values)===null||i===void 0?void 0:i.length)||0;this.dt(n,15),n.At(Ue(a)),this.Vt(o,n),this.Tt(s[o],n)}bt(e,n){const r=e.values||[];this.dt(n,50);for(const i of r)this.Tt(i,n)}yt(e,n){this.dt(n,37),K.fromName(e).path.forEach(r=>{this.dt(n,60),this.Dt(r,n)})}dt(e,n){e.At(n)}ft(e){e.At(2)}}Hs.vt=new Hs;function BB(t){if(t===0)return 8;let e=0;return!(t>>4)&&(e+=4,t<<=4),!(t>>6)&&(e+=2,t<<=2),!(t>>7)&&(e+=1),e}function fS(t){const e=64-function(r){let i=0;for(let s=0;s<8;++s){const o=BB(255&r[s]);if(i+=o,o!==8)break}return i}(t);return Math.ceil(e/8)}class $B{constructor(){this.buffer=new Uint8Array(1024),this.position=0}Ct(e){const n=e[Symbol.iterator]();let r=n.next();for(;!r.done;)this.Ft(r.value),r=n.next();this.Mt()}xt(e){const n=e[Symbol.iterator]();let r=n.next();for(;!r.done;)this.Ot(r.value),r=n.next();this.Nt()}Lt(e){for(const n of e){const r=n.charCodeAt(0);if(r<128)this.Ft(r);else if(r<2048)this.Ft(960|r>>>6),this.Ft(128|63&r);else if(n<"\uD800"||"\uDBFF"<n)this.Ft(480|r>>>12),this.Ft(128|63&r>>>6),this.Ft(128|63&r);else{const i=n.codePointAt(0);this.Ft(240|i>>>18),this.Ft(128|63&i>>>12),this.Ft(128|63&i>>>6),this.Ft(128|63&i)}}this.Mt()}Bt(e){for(const n of e){const r=n.charCodeAt(0);if(r<128)this.Ot(r);else if(r<2048)this.Ot(960|r>>>6),this.Ot(128|63&r);else if(n<"\uD800"||"\uDBFF"<n)this.Ot(480|r>>>12),this.Ot(128|63&r>>>6),this.Ot(128|63&r);else{const i=n.codePointAt(0);this.Ot(240|i>>>18),this.Ot(128|63&i>>>12),this.Ot(128|63&i>>>6),this.Ot(128|63&i)}}this.Nt()}kt(e){const n=this.qt(e),r=fS(n);this.Qt(1+r),this.buffer[this.position++]=255&r;for(let i=n.length-r;i<n.length;++i)this.buffer[this.position++]=255&n[i]}Kt(e){const n=this.qt(e),r=fS(n);this.Qt(1+r),this.buffer[this.position++]=~(255&r);for(let i=n.length-r;i<n.length;++i)this.buffer[this.position++]=~(255&n[i])}$t(){this.Ut(255),this.Ut(255)}Wt(){this.Gt(255),this.Gt(255)}reset(){this.position=0}seed(e){this.Qt(e.length),this.buffer.set(e,this.position),this.position+=e.length}zt(){return this.buffer.slice(0,this.position)}qt(e){const n=function(s){const o=new DataView(new ArrayBuffer(8));return o.setFloat64(0,s,!1),new Uint8Array(o.buffer)}(e),r=(128&n[0])!=0;n[0]^=r?255:128;for(let i=1;i<n.length;++i)n[i]^=r?255:0;return n}Ft(e){const n=255&e;n===0?(this.Ut(0),this.Ut(255)):n===255?(this.Ut(255),this.Ut(0)):this.Ut(n)}Ot(e){const n=255&e;n===0?(this.Gt(0),this.Gt(255)):n===255?(this.Gt(255),this.Gt(0)):this.Gt(e)}Mt(){this.Ut(0),this.Ut(1)}Nt(){this.Gt(0),this.Gt(1)}Ut(e){this.Qt(1),this.buffer[this.position++]=e}Gt(e){this.Qt(1),this.buffer[this.position++]=~e}Qt(e){const n=e+this.position;if(n<=this.buffer.length)return;let r=2*this.buffer.length;r<n&&(r=n);const i=new Uint8Array(r);i.set(this.buffer),this.buffer=i}}class zB{constructor(e){this.jt=e}gt(e){this.jt.Ct(e)}Rt(e){this.jt.Lt(e)}At(e){this.jt.kt(e)}Et(){this.jt.$t()}}class WB{constructor(e){this.jt=e}gt(e){this.jt.xt(e)}Rt(e){this.jt.Bt(e)}At(e){this.jt.Kt(e)}Et(){this.jt.Wt()}}class tu{constructor(){this.jt=new $B,this.Ht=new zB(this.jt),this.Jt=new WB(this.jt)}seed(e){this.jt.seed(e)}Yt(e){return e===0?this.Ht:this.Jt}zt(){return this.jt.zt()}reset(){this.jt.reset()}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ks{constructor(e,n,r,i){this.indexId=e,this.documentKey=n,this.arrayValue=r,this.directionalValue=i}Zt(){const e=this.directionalValue.length,n=e===0||this.directionalValue[e-1]===255?e+1:e,r=new Uint8Array(n);return r.set(this.directionalValue,0),n!==e?r.set([0],this.directionalValue.length):++r[r.length-1],new Ks(this.indexId,this.documentKey,this.arrayValue,r)}}function Oi(t,e){let n=t.indexId-e.indexId;return n!==0?n:(n=pS(t.arrayValue,e.arrayValue),n!==0?n:(n=pS(t.directionalValue,e.directionalValue),n!==0?n:K.comparator(t.documentKey,e.documentKey)))}function pS(t,e){for(let n=0;n<t.length&&n<e.length;++n){const r=t[n]-e[n];if(r!==0)return r}return t.length-e.length}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class mS{constructor(e){this.Xt=new be((n,r)=>Be.comparator(n.field,r.field)),this.collectionId=e.collectionGroup!=null?e.collectionGroup:e.path.lastSegment(),this.en=e.orderBy,this.tn=[];for(const n of e.filters){const r=n;r.isInequality()?this.Xt=this.Xt.add(r):this.tn.push(r)}}get nn(){return this.Xt.size>1}rn(e){if(X(e.collectionGroup===this.collectionId),this.nn)return!1;const n=Ky(e);if(n!==void 0&&!this.sn(n))return!1;const r=zs(e);let i=new Set,s=0,o=0;for(;s<r.length&&this.sn(r[s]);++s)i=i.add(r[s].fieldPath.canonicalString());if(s===r.length)return!0;if(this.Xt.size>0){const a=this.Xt.getIterator().getNext();if(!i.has(a.field.canonicalString())){const l=r[s];if(!this.on(a,l)||!this._n(this.en[o++],l))return!1}++s}for(;s<r.length;++s){const a=r[s];if(o>=this.en.length||!this._n(this.en[o++],a))return!1}return!0}an(){if(this.nn)return null;let e=new be(Be.comparator);const n=[];for(const r of this.tn)if(!r.field.isKeyField())if(r.op==="array-contains"||r.op==="array-contains-any")n.push(new Vh(r.field,2));else{if(e.has(r.field))continue;e=e.add(r.field),n.push(new Vh(r.field,0))}for(const r of this.en)r.field.isKeyField()||e.has(r.field)||(e=e.add(r.field),n.push(new Vh(r.field,r.dir==="asc"?0:1)));return new Vf(Vf.UNKNOWN_ID,this.collectionId,n,Ic.empty())}sn(e){for(const n of this.tn)if(this.on(n,e))return!0;return!1}on(e,n){if(e===void 0||!e.field.isEqual(n.fieldPath))return!1;const r=e.op==="array-contains"||e.op==="array-contains-any";return n.kind===2===r}_n(e,n){return!!e.field.isEqual(n.fieldPath)&&(n.kind===0&&e.dir==="asc"||n.kind===1&&e.dir==="desc")}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function YC(t){var e,n;if(X(t instanceof pe||t instanceof Se),t instanceof pe){if(t instanceof mC){const i=((n=(e=t.value.arrayValue)===null||e===void 0?void 0:e.values)===null||n===void 0?void 0:n.map(s=>pe.create(t.field,"==",s)))||[];return Se.create(i,"or")}return t}const r=t.filters.map(i=>YC(i));return Se.create(r,t.op)}function qB(t){if(t.getFilters().length===0)return[];const e=a_(YC(t));return X(JC(e)),s_(e)||o_(e)?[e]:e.getFilters()}function s_(t){return t instanceof pe}function o_(t){return t instanceof Se&&v0(t)}function JC(t){return s_(t)||o_(t)||function(n){if(n instanceof Se&&Jy(n)){for(const r of n.getFilters())if(!s_(r)&&!o_(r))return!1;return!0}return!1}(t)}function a_(t){if(X(t instanceof pe||t instanceof Se),t instanceof pe)return t;if(t.filters.length===1)return a_(t.filters[0]);const e=t.filters.map(r=>a_(r));let n=Se.create(e,t.op);return n=jf(n),JC(n)?n:(X(n instanceof Se),X(Ga(n)),X(n.filters.length>1),n.filters.reduce((r,i)=>k0(r,i)))}function k0(t,e){let n;return X(t instanceof pe||t instanceof Se),X(e instanceof pe||e instanceof Se),n=t instanceof pe?e instanceof pe?function(i,s){return Se.create([i,s],"and")}(t,e):gS(t,e):e instanceof pe?gS(e,t):function(i,s){if(X(i.filters.length>0&&s.filters.length>0),Ga(i)&&Ga(s))return hC(i,s.getFilters());const o=Jy(i)?i:s,a=Jy(i)?s:i,l=o.filters.map(u=>k0(u,a));return Se.create(l,"or")}(t,e),jf(n)}function gS(t,e){if(Ga(e))return hC(e,t.getFilters());{const n=e.filters.map(r=>k0(t,r));return Se.create(n,"or")}}function jf(t){if(X(t instanceof pe||t instanceof Se),t instanceof pe)return t;const e=t.getFilters();if(e.length===1)return jf(e[0]);if(cC(t))return t;const n=e.map(i=>jf(i)),r=[];return n.forEach(i=>{i instanceof pe?r.push(i):i instanceof Se&&(i.op===t.op?r.push(...i.filters):r.push(i))}),r.length===1?r[0]:Se.create(r,t.op)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class HB{constructor(){this.un=new x0}addToCollectionParentIndex(e,n){return this.un.add(n),L.resolve()}getCollectionParents(e,n){return L.resolve(this.un.getEntries(n))}addFieldIndex(e,n){return L.resolve()}deleteFieldIndex(e,n){return L.resolve()}deleteAllFieldIndexes(e){return L.resolve()}createTargetIndexes(e,n){return L.resolve()}getDocumentsMatchingTarget(e,n){return L.resolve(null)}getIndexType(e,n){return L.resolve(0)}getFieldIndexes(e,n){return L.resolve([])}getNextCollectionGroupToUpdate(e){return L.resolve(null)}getMinOffset(e,n){return L.resolve(Un.min())}getMinOffsetFromCollectionGroup(e,n){return L.resolve(Un.min())}updateCollectionGroup(e,n,r){return L.resolve()}updateIndexEntries(e,n){return L.resolve()}}class x0{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n]||new be(fe.comparator),s=!i.has(r);return this.index[n]=i.add(r),s}has(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n];return i&&i.has(r)}getEntries(e){return(this.index[e]||new be(fe.comparator)).toArray()}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ih=new Uint8Array(0);class KB{constructor(e,n){this.databaseId=n,this.cn=new x0,this.ln=new ks(r=>_o(r),(r,i)=>Zc(r,i)),this.uid=e.uid||""}addToCollectionParentIndex(e,n){if(!this.cn.has(n)){const r=n.lastSegment(),i=n.popLast();e.addOnCommittedListener(()=>{this.cn.add(n)});const s={collectionId:r,parent:an(i)};return yS(e).put(s)}return L.resolve()}getCollectionParents(e,n){const r=[],i=IDBKeyRange.bound([n,""],[KP(n),""],!1,!0);return yS(e).U(i).next(s=>{for(const o of s){if(o.collectionId!==n)break;r.push(Or(o.parent))}return r})}addFieldIndex(e,n){const r=nu(e),i=function(a){return{indexId:a.indexId,collectionGroup:a.collectionGroup,fields:a.fields.map(l=>[l.fieldPath.canonicalString(),l.kind])}}(n);delete i.indexId;const s=r.add(i);if(n.indexState){const o=Ko(e);return s.next(a=>{o.put(cS(a,this.uid,n.indexState.sequenceNumber,n.indexState.offset))})}return s.next()}deleteFieldIndex(e,n){const r=nu(e),i=Ko(e),s=Ho(e);return r.delete(n.indexId).next(()=>i.delete(IDBKeyRange.bound([n.indexId],[n.indexId+1],!1,!0))).next(()=>s.delete(IDBKeyRange.bound([n.indexId],[n.indexId+1],!1,!0)))}deleteAllFieldIndexes(e){const n=nu(e),r=Ho(e),i=Ko(e);return n.j().next(()=>r.j()).next(()=>i.j())}createTargetIndexes(e,n){return L.forEach(this.hn(n),r=>this.getIndexType(e,r).next(i=>{if(i===0||i===1){const s=new mS(r).an();if(s!=null)return this.addFieldIndex(e,s)}}))}getDocumentsMatchingTarget(e,n){const r=Ho(e);let i=!0;const s=new Map;return L.forEach(this.hn(n),o=>this.Pn(e,o).next(a=>{i&&(i=!!a),s.set(o,a)})).next(()=>{if(i){let o=se();const a=[];return L.forEach(s,(l,u)=>{z("IndexedDbIndexManager",`Using index ${function(E){return`id=${E.indexId}|cg=${E.collectionGroup}|f=${E.fields.map(x=>`${x.fieldPath}:${x.kind}`).join(",")}`}(l)} to execute ${_o(n)}`);const d=function(E,x){const O=Ky(x);if(O===void 0)return null;for(const D of Mf(E,O.fieldPath))switch(D.op){case"array-contains-any":return D.value.arrayValue.values||[];case"array-contains":return[D.value]}return null}(u,l),h=function(E,x){const O=new Map;for(const D of zs(x))for(const A of Mf(E,D.fieldPath))switch(A.op){case"==":case"in":O.set(D.fieldPath.canonicalString(),A.value);break;case"not-in":case"!=":return O.set(D.fieldPath.canonicalString(),A.value),Array.from(O.values())}return null}(u,l),f=function(E,x){const O=[];let D=!0;for(const A of zs(x)){const I=A.kind===0?QT(E,A.fieldPath,E.startAt):YT(E,A.fieldPath,E.startAt);O.push(I.value),D&&(D=I.inclusive)}return new gs(O,D)}(u,l),g=function(E,x){const O=[];let D=!0;for(const A of zs(x)){const I=A.kind===0?YT(E,A.fieldPath,E.endAt):QT(E,A.fieldPath,E.endAt);O.push(I.value),D&&(D=I.inclusive)}return new gs(O,D)}(u,l),_=this.In(l,u,f),v=this.In(l,u,g),T=this.Tn(l,u,h),S=this.En(l.indexId,d,_,f.inclusive,v,g.inclusive,T);return L.forEach(S,w=>r.G(w,n.limit).next(E=>{E.forEach(x=>{const O=K.fromSegments(x.documentKey);o.has(O)||(o=o.add(O),a.push(O))})}))}).next(()=>a)}return L.resolve(null)})}hn(e){let n=this.ln.get(e);return n||(e.filters.length===0?n=[e]:n=qB(Se.create(e.filters,"and")).map(r=>Zy(e.path,e.collectionGroup,e.orderBy,r.getFilters(),e.limit,e.startAt,e.endAt)),this.ln.set(e,n),n)}En(e,n,r,i,s,o,a){const l=(n!=null?n.length:1)*Math.max(r.length,s.length),u=l/(n!=null?n.length:1),d=[];for(let h=0;h<l;++h){const f=n?this.dn(n[h/u]):ih,g=this.An(e,f,r[h%u],i),_=this.Rn(e,f,s[h%u],o),v=a.map(T=>this.An(e,f,T,!0));d.push(...this.createRange(g,_,v))}return d}An(e,n,r,i){const s=new Ks(e,K.empty(),n,r);return i?s:s.Zt()}Rn(e,n,r,i){const s=new Ks(e,K.empty(),n,r);return i?s.Zt():s}Pn(e,n){const r=new mS(n),i=n.collectionGroup!=null?n.collectionGroup:n.path.lastSegment();return this.getFieldIndexes(e,i).next(s=>{let o=null;for(const a of s)r.rn(a)&&(!o||a.fields.length>o.fields.length)&&(o=a);return o})}getIndexType(e,n){let r=2;const i=this.hn(n);return L.forEach(i,s=>this.Pn(e,s).next(o=>{o?r!==0&&o.fields.length<function(l){let u=new be(Be.comparator),d=!1;for(const h of l.filters)for(const f of h.getFlattenedFilters())f.field.isKeyField()||(f.op==="array-contains"||f.op==="array-contains-any"?d=!0:u=u.add(f.field));for(const h of l.orderBy)h.field.isKeyField()||(u=u.add(h.field));return u.size+(d?1:0)}(s)&&(r=1):r=0})).next(()=>function(o){return o.limit!==null}(n)&&i.length>1&&r===2?1:r)}Vn(e,n){const r=new tu;for(const i of zs(e)){const s=n.data.field(i.fieldPath);if(s==null)return null;const o=r.Yt(i.kind);Hs.vt.It(s,o)}return r.zt()}dn(e){const n=new tu;return Hs.vt.It(e,n.Yt(0)),n.zt()}mn(e,n){const r=new tu;return Hs.vt.It(yo(this.databaseId,n),r.Yt(function(s){const o=zs(s);return o.length===0?0:o[o.length-1].kind}(e))),r.zt()}Tn(e,n,r){if(r===null)return[];let i=[];i.push(new tu);let s=0;for(const o of zs(e)){const a=r[s++];for(const l of i)if(this.fn(n,o.fieldPath)&&bc(a))i=this.gn(i,o,a);else{const u=l.Yt(o.kind);Hs.vt.It(a,u)}}return this.pn(i)}In(e,n,r){return this.Tn(e,n,r.position)}pn(e){const n=[];for(let r=0;r<e.length;++r)n[r]=e[r].zt();return n}gn(e,n,r){const i=[...e],s=[];for(const o of r.arrayValue.values||[])for(const a of i){const l=new tu;l.seed(a.zt()),Hs.vt.It(o,l.Yt(n.kind)),s.push(l)}return s}fn(e,n){return!!e.filters.find(r=>r instanceof pe&&r.field.isEqual(n)&&(r.op==="in"||r.op==="not-in"))}getFieldIndexes(e,n){const r=nu(e),i=Ko(e);return(n?r.U("collectionGroupIndex",IDBKeyRange.bound(n,n)):r.U()).next(s=>{const o=[];return L.forEach(s,a=>i.get([a.indexId,this.uid]).next(l=>{o.push(function(d,h){const f=h?new Ic(h.sequenceNumber,new Un(Io(h.readTime),new K(Or(h.documentKey)),h.largestBatchId)):Ic.empty(),g=d.fields.map(([_,v])=>new Vh(Be.fromServerFormat(_),v));return new Vf(d.indexId,d.collectionGroup,g,f)}(a,l))})).next(()=>o)})}getNextCollectionGroupToUpdate(e){return this.getFieldIndexes(e).next(n=>n.length===0?null:(n.sort((r,i)=>{const s=r.indexState.sequenceNumber-i.indexState.sequenceNumber;return s!==0?s:re(r.collectionGroup,i.collectionGroup)}),n[0].collectionGroup))}updateCollectionGroup(e,n,r){const i=nu(e),s=Ko(e);return this.yn(e).next(o=>i.U("collectionGroupIndex",IDBKeyRange.bound(n,n)).next(a=>L.forEach(a,l=>s.put(cS(l.indexId,this.uid,o,r)))))}updateIndexEntries(e,n){const r=new Map;return L.forEach(n,(i,s)=>{const o=r.get(i.collectionGroup);return(o?L.resolve(o):this.getFieldIndexes(e,i.collectionGroup)).next(a=>(r.set(i.collectionGroup,a),L.forEach(a,l=>this.wn(e,i,l).next(u=>{const d=this.Sn(s,l);return u.isEqual(d)?L.resolve():this.bn(e,s,l,u,d)}))))})}Dn(e,n,r,i){return Ho(e).put({indexId:i.indexId,uid:this.uid,arrayValue:i.arrayValue,directionalValue:i.directionalValue,orderedDocumentKey:this.mn(r,n.key),documentKey:n.key.path.toArray()})}vn(e,n,r,i){return Ho(e).delete([i.indexId,this.uid,i.arrayValue,i.directionalValue,this.mn(r,n.key),n.key.path.toArray()])}wn(e,n,r){const i=Ho(e);let s=new be(Oi);return i.J({index:"documentKeyIndex",range:IDBKeyRange.only([r.indexId,this.uid,this.mn(r,n)])},(o,a)=>{s=s.add(new Ks(r.indexId,n,a.arrayValue,a.directionalValue))}).next(()=>s)}Sn(e,n){let r=new be(Oi);const i=this.Vn(n,e);if(i==null)return r;const s=Ky(n);if(s!=null){const o=e.data.field(s.fieldPath);if(bc(o))for(const a of o.arrayValue.values||[])r=r.add(new Ks(n.indexId,e.key,this.dn(a),i))}else r=r.add(new Ks(n.indexId,e.key,ih,i));return r}bn(e,n,r,i,s){z("IndexedDbIndexManager","Updating index entries for document '%s'",n.key);const o=[];return function(l,u,d,h,f){const g=l.getIterator(),_=u.getIterator();let v=qo(g),T=qo(_);for(;v||T;){let S=!1,w=!1;if(v&&T){const E=d(v,T);E<0?w=!0:E>0&&(S=!0)}else v!=null?w=!0:S=!0;S?(h(T),T=qo(_)):w?(f(v),v=qo(g)):(v=qo(g),T=qo(_))}}(i,s,Oi,a=>{o.push(this.Dn(e,n,r,a))},a=>{o.push(this.vn(e,n,r,a))}),L.waitFor(o)}yn(e){let n=1;return Ko(e).J({index:"sequenceNumberIndex",reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},(r,i,s)=>{s.done(),n=i.sequenceNumber+1}).next(()=>n)}createRange(e,n,r){r=r.sort((o,a)=>Oi(o,a)).filter((o,a,l)=>!a||Oi(o,l[a-1])!==0);const i=[];i.push(e);for(const o of r){const a=Oi(o,e),l=Oi(o,n);if(a===0)i[0]=e.Zt();else if(a>0&&l<0)i.push(o),i.push(o.Zt());else if(l>0)break}i.push(n);const s=[];for(let o=0;o<i.length;o+=2){if(this.Cn(i[o],i[o+1]))return[];const a=[i[o].indexId,this.uid,i[o].arrayValue,i[o].directionalValue,ih,[]],l=[i[o+1].indexId,this.uid,i[o+1].arrayValue,i[o+1].directionalValue,ih,[]];s.push(IDBKeyRange.bound(a,l))}return s}Cn(e,n){return Oi(e,n)>0}getMinOffsetFromCollectionGroup(e,n){return this.getFieldIndexes(e,n).next(_S)}getMinOffset(e,n){return L.mapArray(this.hn(n),r=>this.Pn(e,r).next(i=>i||Y())).next(_S)}}function yS(t){return Tt(t,"collectionParents")}function Ho(t){return Tt(t,"indexEntries")}function nu(t){return Tt(t,"indexConfiguration")}function Ko(t){return Tt(t,"indexState")}function _S(t){X(t.length!==0);let e=t[0].indexState.offset,n=e.largestBatchId;for(let r=1;r<t.length;r++){const i=t[r].indexState.offset;m0(i,e)<0&&(e=i),n<i.largestBatchId&&(n=i.largestBatchId)}return new Un(e.readTime,e.documentKey,n)}/** * @license * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const vS={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0};class hn{constructor(e,n,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}static withCacheSize(e){return new hn(e,hn.DEFAULT_COLLECTION_PERCENTILE,hn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function XC(t,e,n){const r=t.store("mutations"),i=t.store("documentMutations"),s=[],o=IDBKeyRange.only(n.batchId);let a=0;const l=r.J({range:o},(d,h,f)=>(a++,f.delete()));s.push(l.next(()=>{X(a===1)}));const u=[];for(const d of n.mutations){const h=eC(e,d.key.path,n.batchId);s.push(i.delete(h)),u.push(d.key)}return L.waitFor(s).next(()=>u)}function Bf(t){if(!t)return 0;let e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw Y();e=t.noDocument}return JSON.stringify(e).length}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */hn.DEFAULT_COLLECTION_PERCENTILE=10,hn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,hn.DEFAULT=new hn(41943040,hn.DEFAULT_COLLECTION_PERCENTILE,hn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),hn.DISABLED=new hn(-1,0,0);class $p{constructor(e,n,r,i){this.userId=e,this.serializer=n,this.indexManager=r,this.referenceDelegate=i,this.Fn={}}static lt(e,n,r,i){X(e.uid!=="");const s=e.isAuthenticated()?e.uid:"";return new $p(s,n,r,i)}checkEmpty(e){let n=!0;const r=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return Ni(e).J({index:"userMutationsIndex",range:r},(i,s,o)=>{n=!1,o.done()}).next(()=>n)}addMutationBatch(e,n,r,i){const s=ia(e),o=Ni(e);return o.add({}).next(a=>{X(typeof a=="number");const l=new S0(a,n,r,i),u=function(g,_,v){const T=v.baseMutations.map(w=>Cc(g.ct,w)),S=v.mutations.map(w=>Cc(g.ct,w));return{userId:_,batchId:v.batchId,localWriteTimeMs:v.localWriteTime.toMillis(),baseMutations:T,mutations:S}}(this.serializer,this.userId,l),d=[];let h=new be((f,g)=>re(f.canonicalString(),g.canonicalString()));for(const f of i){const g=eC(this.userId,f.key.path,a);h=h.add(f.key.path.popLast()),d.push(o.put(u)),d.push(s.put(g,Nj))}return h.forEach(f=>{d.push(this.indexManager.addToCollectionParentIndex(e,f))}),e.addOnCommittedListener(()=>{this.Fn[a]=l.keys()}),L.waitFor(d).next(()=>l)})}lookupMutationBatch(e,n){return Ni(e).get(n).next(r=>r?(X(r.userId===this.userId),qs(this.serializer,r)):null)}Mn(e,n){return this.Fn[n]?L.resolve(this.Fn[n]):this.lookupMutationBatch(e,n).next(r=>{if(r){const i=r.keys();return this.Fn[n]=i,i}return null})}getNextMutationBatchAfterBatchId(e,n){const r=n+1,i=IDBKeyRange.lowerBound([this.userId,r]);let s=null;return Ni(e).J({index:"userMutationsIndex",range:i},(o,a,l)=>{a.userId===this.userId&&(X(a.batchId>=r),s=qs(this.serializer,a)),l.done()}).next(()=>s)}getHighestUnacknowledgedBatchId(e){const n=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]);let r=-1;return Ni(e).J({index:"userMutationsIndex",range:n,reverse:!0},(i,s,o)=>{r=s.batchId,o.done()}).next(()=>r)}getAllMutationBatches(e){const n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return Ni(e).U("userMutationsIndex",n).next(r=>r.map(i=>qs(this.serializer,i)))}getAllMutationBatchesAffectingDocumentKey(e,n){const r=Lh(this.userId,n.path),i=IDBKeyRange.lowerBound(r),s=[];return ia(e).J({range:i},(o,a,l)=>{const[u,d,h]=o,f=Or(d);if(u===this.userId&&n.path.isEqual(f))return Ni(e).get(h).next(g=>{if(!g)throw Y();X(g.userId===this.userId),s.push(qs(this.serializer,g))});l.done()}).next(()=>s)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new be(re);const i=[];return n.forEach(s=>{const o=Lh(this.userId,s.path),a=IDBKeyRange.lowerBound(o),l=ia(e).J({range:a},(u,d,h)=>{const[f,g,_]=u,v=Or(g);f===this.userId&&s.path.isEqual(v)?r=r.add(_):h.done()});i.push(l)}),L.waitFor(i).next(()=>this.xn(e,r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,i=r.length+1,s=Lh(this.userId,r),o=IDBKeyRange.lowerBound(s);let a=new be(re);return ia(e).J({range:o},(l,u,d)=>{const[h,f,g]=l,_=Or(f);h===this.userId&&r.isPrefixOf(_)?_.length===i&&(a=a.add(g)):d.done()}).next(()=>this.xn(e,a))}xn(e,n){const r=[],i=[];return n.forEach(s=>{i.push(Ni(e).get(s).next(o=>{if(o===null)throw Y();X(o.userId===this.userId),r.push(qs(this.serializer,o))}))}),L.waitFor(i).next(()=>r)}removeMutationBatch(e,n){return XC(e._e,this.userId,n).next(r=>(e.addOnCommittedListener(()=>{this.On(n.batchId)}),L.forEach(r,i=>this.referenceDelegate.markPotentiallyOrphaned(e,i))))}On(e){delete this.Fn[e]}performConsistencyCheck(e){return this.checkEmpty(e).next(n=>{if(!n)return L.resolve();const r=IDBKeyRange.lowerBound(function(o){return[o]}(this.userId)),i=[];return ia(e).J({range:r},(s,o,a)=>{if(s[0]===this.userId){const l=Or(s[1]);i.push(l)}else a.done()}).next(()=>{X(i.length===0)})})}containsKey(e,n){return ZC(e,this.userId,n)}Nn(e){return ek(e).get(this.userId).next(n=>n||{userId:this.userId,lastAcknowledgedBatchId:-1,lastStreamToken:""})}}function ZC(t,e,n){const r=Lh(e,n.path),i=r[1],s=IDBKeyRange.lowerBound(r);let o=!1;return ia(t).J({range:s,H:!0},(a,l,u)=>{const[d,h,f]=a;d===e&&h===i&&(o=!0),u.done()}).next(()=>o)}function Ni(t){return Tt(t,"mutations")}function ia(t){return Tt(t,"documentMutations")}function ek(t){return Tt(t,"mutationQueues")}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class To{constructor(e){this.Ln=e}next(){return this.Ln+=2,this.Ln}static Bn(){return new To(0)}static kn(){return new To(-1)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class GB{constructor(e,n){this.referenceDelegate=e,this.serializer=n}allocateTargetId(e){return this.qn(e).next(n=>{const r=new To(n.highestTargetId);return n.highestTargetId=r.next(),this.Qn(e,n).next(()=>n.highestTargetId)})}getLastRemoteSnapshotVersion(e){return this.qn(e).next(n=>Z.fromTimestamp(new ze(n.lastRemoteSnapshotVersion.seconds,n.lastRemoteSnapshotVersion.nanoseconds)))}getHighestSequenceNumber(e){return this.qn(e).next(n=>n.highestListenSequenceNumber)}setTargetsMetadata(e,n,r){return this.qn(e).next(i=>(i.highestListenSequenceNumber=n,r&&(i.lastRemoteSnapshotVersion=r.toTimestamp()),n>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=n),this.Qn(e,i)))}addTargetData(e,n){return this.Kn(e,n).next(()=>this.qn(e).next(r=>(r.targetCount+=1,this.$n(n,r),this.Qn(e,r))))}updateTargetData(e,n){return this.Kn(e,n)}removeTargetData(e,n){return this.removeMatchingKeysForTargetId(e,n.targetId).next(()=>Go(e).delete(n.targetId)).next(()=>this.qn(e)).next(r=>(X(r.targetCount>0),r.targetCount-=1,this.Qn(e,r)))}removeTargets(e,n,r){let i=0;const s=[];return Go(e).J((o,a)=>{const l=Iu(a);l.sequenceNumber<=n&&r.get(l.targetId)===null&&(i++,s.push(this.removeTargetData(e,l)))}).next(()=>L.waitFor(s)).next(()=>i)}forEachTarget(e,n){return Go(e).J((r,i)=>{const s=Iu(i);n(s)})}qn(e){return wS(e).get("targetGlobalKey").next(n=>(X(n!==null),n))}Qn(e,n){return wS(e).put("targetGlobalKey",n)}Kn(e,n){return Go(e).put(QC(this.serializer,n))}$n(e,n){let r=!1;return e.targetId>n.highestTargetId&&(n.highestTargetId=e.targetId,r=!0),e.sequenceNumber>n.highestListenSequenceNumber&&(n.highestListenSequenceNumber=e.sequenceNumber,r=!0),r}getTargetCount(e){return this.qn(e).next(n=>n.targetCount)}getTargetData(e,n){const r=_o(n),i=IDBKeyRange.bound([r,Number.NEGATIVE_INFINITY],[r,Number.POSITIVE_INFINITY]);let s=null;return Go(e).J({range:i,index:"queryTargetsIndex"},(o,a,l)=>{const u=Iu(a);Zc(n,u.target)&&(s=u,l.done())}).next(()=>s)}addMatchingKeys(e,n,r){const i=[],s=$i(e);return n.forEach(o=>{const a=an(o.path);i.push(s.put({targetId:r,path:a})),i.push(this.referenceDelegate.addReference(e,r,o))}),L.waitFor(i)}removeMatchingKeys(e,n,r){const i=$i(e);return L.forEach(n,s=>{const o=an(s.path);return L.waitFor([i.delete([r,o]),this.referenceDelegate.removeReference(e,r,s)])})}removeMatchingKeysForTargetId(e,n){const r=$i(e),i=IDBKeyRange.bound([n],[n+1],!1,!0);return r.delete(i)}getMatchingKeysForTargetId(e,n){const r=IDBKeyRange.bound([n],[n+1],!1,!0),i=$i(e);let s=se();return i.J({range:r,H:!0},(o,a,l)=>{const u=Or(o[1]),d=new K(u);s=s.add(d)}).next(()=>s)}containsKey(e,n){const r=an(n.path),i=IDBKeyRange.bound([r],[KP(r)],!1,!0);let s=0;return $i(e).J({index:"documentTargetsIndex",H:!0,range:i},([o,a],l,u)=>{o!==0&&(s++,u.done())}).next(()=>s>0)}ot(e,n){return Go(e).get(n).next(r=>r?Iu(r):null)}}function Go(t){return Tt(t,"targets")}function wS(t){return Tt(t,"targetGlobal")}function $i(t){return Tt(t,"targetDocuments")}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function ES([t,e],[n,r]){const i=re(t,n);return i===0?re(e,r):i}class QB{constructor(e){this.Un=e,this.buffer=new be(ES),this.Wn=0}Gn(){return++this.Wn}zn(e){const n=[e,this.Gn()];if(this.buffer.size<this.Un)this.buffer=this.buffer.add(n);else{const r=this.buffer.last();ES(n,r)<0&&(this.buffer=this.buffer.delete(r).add(n))}}get maxValue(){return this.buffer.last()[0]}}class YB{constructor(e,n,r){this.garbageCollector=e,this.asyncQueue=n,this.localStore=r,this.jn=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Hn(6e4)}stop(){this.jn&&(this.jn.cancel(),this.jn=null)}get started(){return this.jn!==null}Hn(e){z("LruGarbageCollector",`Garbage collection scheduled in ${e}ms`),this.jn=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.jn=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(n){Cs(n)?z("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",n):await Ps(n)}await this.Hn(3e5)})}}class JB{constructor(e,n){this.Jn=e,this.params=n}calculateTargetCount(e,n){return this.Jn.Yn(e).next(r=>Math.floor(n/100*r))}nthSequenceNumber(e,n){if(n===0)return L.resolve(gn.oe);const r=new QB(n);return this.Jn.forEachTarget(e,i=>r.zn(i.sequenceNumber)).next(()=>this.Jn.Zn(e,i=>r.zn(i))).next(()=>r.maxValue)}removeTargets(e,n,r){return this.Jn.removeTargets(e,n,r)}removeOrphanedDocuments(e,n){return this.Jn.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(z("LruGarbageCollector","Garbage collection skipped; disabled"),L.resolve(vS)):this.getCacheSize(e).next(r=>r<this.params.cacheSizeCollectionThreshold?(z("LruGarbageCollector",`Garbage collection skipped; Cache size ${r} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),vS):this.Xn(e,n))}getCacheSize(e){return this.Jn.getCacheSize(e)}Xn(e,n){let r,i,s,o,a,l,u;const d=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(h=>(h>this.params.maximumSequenceNumbersToCollect?(z("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${h}`),i=this.params.maximumSequenceNumbersToCollect):i=h,o=Date.now(),this.nthSequenceNumber(e,i))).next(h=>(r=h,a=Date.now(),this.removeTargets(e,r,n))).next(h=>(s=h,l=Date.now(),this.removeOrphanedDocuments(e,r))).next(h=>(u=Date.now(),ea()<=ce.DEBUG&&z("LruGarbageCollector",`LRU Garbage Collection Counted targets in ${o-d}ms Determined least recently used ${i} in `+(a-o)+`ms Removed ${s} targets in `+(l-a)+`ms Removed ${h} documents in `+(u-l)+`ms Total Duration: ${u-d}ms`),L.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:s,documentsRemoved:h})))}}function XB(t,e){return new JB(t,e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ZB{constructor(e,n){this.db=e,this.garbageCollector=XB(this,n)}Yn(e){const n=this.er(e);return this.db.getTargetCache().getTargetCount(e).next(r=>n.next(i=>r+i))}er(e){let n=0;return this.Zn(e,r=>{n++}).next(()=>n)}forEachTarget(e,n){return this.db.getTargetCache().forEachTarget(e,n)}Zn(e,n){return this.tr(e,(r,i)=>n(i))}addReference(e,n,r){return sh(e,r)}removeReference(e,n,r){return sh(e,r)}removeTargets(e,n,r){return this.db.getTargetCache().removeTargets(e,n,r)}markPotentiallyOrphaned(e,n){return sh(e,n)}nr(e,n){return function(i,s){let o=!1;return ek(i).Y(a=>ZC(i,a,s).next(l=>(l&&(o=!0),L.resolve(!l)))).next(()=>o)}(e,n)}removeOrphanedDocuments(e,n){const r=this.db.getRemoteDocumentCache().newChangeBuffer(),i=[];let s=0;return this.tr(e,(o,a)=>{if(a<=n){const l=this.nr(e,o).next(u=>{if(!u)return s++,r.getEntry(e,o).next(()=>(r.removeEntry(o,Z.min()),$i(e).delete(function(h){return[0,an(h.path)]}(o))))});i.push(l)}}).next(()=>L.waitFor(i)).next(()=>r.apply(e)).next(()=>s)}removeTarget(e,n){const r=n.withSequenceNumber(e.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(e,r)}updateLimboDocument(e,n){return sh(e,n)}tr(e,n){const r=$i(e);let i,s=gn.oe;return r.J({index:"documentTargetsIndex"},([o,a],{path:l,sequenceNumber:u})=>{o===0?(s!==gn.oe&&n(new K(Or(i)),s),s=u,i=l):s=gn.oe}).next(()=>{s!==gn.oe&&n(new K(Or(i)),s)})}getCacheSize(e){return this.db.getRemoteDocumentCache().getSize(e)}}function sh(t,e){return $i(t).put(function(r,i){return{targetId:0,path:an(r.path),sequenceNumber:i}}(e,t.currentSequenceNumber))}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class tk{constructor(){this.changes=new ks(e=>e.toString(),(e,n)=>e.isEqual(n)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,Ve.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?L.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class e5{constructor(e){this.serializer=e}setIndexManager(e){this.indexManager=e}addEntry(e,n,r){return Fs(e).put(r)}removeEntry(e,n,r){return Fs(e).delete(function(s,o){const a=s.path.toArray();return[a.slice(0,a.length-2),a[a.length-2],Uf(o),a[a.length-1]]}(n,r))}updateMetadata(e,n){return this.getMetadata(e).next(r=>(r.byteSize+=n,this.rr(e,r)))}getEntry(e,n){let r=Ve.newInvalidDocument(n);return Fs(e).J({index:"documentKeyIndex",range:IDBKeyRange.only(ru(n))},(i,s)=>{r=this.ir(n,s)}).next(()=>r)}sr(e,n){let r={size:0,document:Ve.newInvalidDocument(n)};return Fs(e).J({index:"documentKeyIndex",range:IDBKeyRange.only(ru(n))},(i,s)=>{r={document:this.ir(n,s),size:Bf(s)}}).next(()=>r)}getEntries(e,n){let r=_n();return this._r(e,n,(i,s)=>{const o=this.ir(i,s);r=r.insert(i,o)}).next(()=>r)}ar(e,n){let r=_n(),i=new Oe(K.comparator);return this._r(e,n,(s,o)=>{const a=this.ir(s,o);r=r.insert(s,a),i=i.insert(s,Bf(o))}).next(()=>({documents:r,ur:i}))}_r(e,n,r){if(n.isEmpty())return L.resolve();let i=new be(SS);n.forEach(l=>i=i.add(l));const s=IDBKeyRange.bound(ru(i.first()),ru(i.last())),o=i.getIterator();let a=o.getNext();return Fs(e).J({index:"documentKeyIndex",range:s},(l,u,d)=>{const h=K.fromSegments([...u.prefixPath,u.collectionGroup,u.documentId]);for(;a&&SS(a,h)<0;)r(a,null),a=o.getNext();a&&a.isEqual(h)&&(r(a,u),a=o.hasNext()?o.getNext():null),a?d.$(ru(a)):d.done()}).next(()=>{for(;a;)r(a,null),a=o.hasNext()?o.getNext():null})}getDocumentsMatchingQuery(e,n,r,i,s){const o=n.path,a=[o.popLast().toArray(),o.lastSegment(),Uf(r.readTime),r.documentKey.path.isEmpty()?"":r.documentKey.path.lastSegment()],l=[o.popLast().toArray(),o.lastSegment(),[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],""];return Fs(e).U(IDBKeyRange.bound(a,l,!0)).next(u=>{s==null||s.incrementDocumentReadCount(u.length);let d=_n();for(const h of u){const f=this.ir(K.fromSegments(h.prefixPath.concat(h.collectionGroup,h.documentId)),h);f.isFoundDocument()&&(td(n,f)||i.has(f.key))&&(d=d.insert(f.key,f))}return d})}getAllFromCollectionGroup(e,n,r,i){let s=_n();const o=TS(n,r),a=TS(n,Un.max());return Fs(e).J({index:"collectionGroupIndex",range:IDBKeyRange.bound(o,a,!0)},(l,u,d)=>{const h=this.ir(K.fromSegments(u.prefixPath.concat(u.collectionGroup,u.documentId)),u);s=s.insert(h.key,h),s.size===i&&d.done()}).next(()=>s)}newChangeBuffer(e){return new t5(this,!!e&&e.trackRemovals)}getSize(e){return this.getMetadata(e).next(n=>n.byteSize)}getMetadata(e){return IS(e).get("remoteDocumentGlobalKey").next(n=>(X(!!n),n))}rr(e,n){return IS(e).put("remoteDocumentGlobalKey",n)}ir(e,n){if(n){const r=FB(this.serializer,n);if(!(r.isNoDocument()&&r.version.isEqual(Z.min())))return r}return Ve.newInvalidDocument(e)}}function nk(t){return new e5(t)}class t5 extends tk{constructor(e,n){super(),this.cr=e,this.trackRemovals=n,this.lr=new ks(r=>r.toString(),(r,i)=>r.isEqual(i))}applyChanges(e){const n=[];let r=0,i=new be((s,o)=>re(s.canonicalString(),o.canonicalString()));return this.changes.forEach((s,o)=>{const a=this.lr.get(s);if(n.push(this.cr.removeEntry(e,s,a.readTime)),o.isValidDocument()){const l=lS(this.cr.serializer,o);i=i.add(s.path.popLast());const u=Bf(l);r+=u-a.size,n.push(this.cr.addEntry(e,s,l))}else if(r-=a.size,this.trackRemovals){const l=lS(this.cr.serializer,o.convertToNoDocument(Z.min()));n.push(this.cr.addEntry(e,s,l))}}),i.forEach(s=>{n.push(this.cr.indexManager.addToCollectionParentIndex(e,s))}),n.push(this.cr.updateMetadata(e,r)),L.waitFor(n)}getFromCache(e,n){return this.cr.sr(e,n).next(r=>(this.lr.set(n,{size:r.size,readTime:r.document.readTime}),r.document))}getAllFromCache(e,n){return this.cr.ar(e,n).next(({documents:r,ur:i})=>(i.forEach((s,o)=>{this.lr.set(s,{size:o,readTime:r.get(s).readTime})}),r))}}function IS(t){return Tt(t,"remoteDocumentGlobal")}function Fs(t){return Tt(t,"remoteDocumentsV14")}function ru(t){const e=t.path.toArray();return[e.slice(0,e.length-2),e[e.length-2],e[e.length-1]]}function TS(t,e){const n=e.documentKey.path.toArray();return[t,Uf(e.readTime),n.slice(0,n.length-2),n.length>0?n[n.length-1]:""]}function SS(t,e){const n=t.path.toArray(),r=e.path.toArray();let i=0;for(let s=0;s<n.length-2&&s<r.length-2;++s)if(i=re(n[s],r[s]),i)return i;return i=re(n.length,r.length),i||(i=re(n[n.length-2],r[r.length-2]),i||re(n[n.length-1],r[r.length-1]))}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class n5{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class rk{constructor(e,n,r,i){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(i=>(r=i,this.remoteDocumentCache.getEntry(e,n))).next(i=>(r!==null&&Bu(r.mutation,i,yn.empty(),ze.now()),i))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,se()).next(()=>r))}getLocalViewOfDocuments(e,n,r=se()){const i=Nr();return this.populateOverlays(e,i,n).next(()=>this.computeViews(e,n,i,r).next(s=>{let o=wu();return s.forEach((a,l)=>{o=o.insert(a,l.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=Nr();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,se()))}populateOverlays(e,n,r){const i=[];return r.forEach(s=>{n.has(s)||i.push(s)}),this.documentOverlayCache.getOverlays(e,i).next(s=>{s.forEach((o,a)=>{n.set(o,a)})})}computeViews(e,n,r,i){let s=_n();const o=ju(),a=function(){return ju()}();return n.forEach((l,u)=>{const d=r.get(u.key);i.has(u.key)&&(d===void 0||d.mutation instanceof Si)?s=s.insert(u.key,u):d!==void 0?(o.set(u.key,d.mutation.getFieldMask()),Bu(d.mutation,u,d.mutation.getFieldMask(),ze.now())):o.set(u.key,yn.empty())}),this.recalculateAndSaveOverlays(e,s).next(l=>(l.forEach((u,d)=>o.set(u,d)),n.forEach((u,d)=>{var h;return a.set(u,new n5(d,(h=o.get(u))!==null&&h!==void 0?h:null))}),a))}recalculateAndSaveOverlays(e,n){const r=ju();let i=new Oe((o,a)=>o-a),s=se();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const a of o)a.keys().forEach(l=>{const u=n.get(l);if(u===null)return;let d=r.get(l)||yn.empty();d=a.applyToLocalView(u,d),r.set(l,d);const h=(i.get(a.batchId)||se()).add(l);i=i.insert(a.batchId,h)})}).next(()=>{const o=[],a=i.getReverseIterator();for(;a.hasNext();){const l=a.getNext(),u=l.key,d=l.value,h=IC();d.forEach(f=>{if(!s.has(f)){const g=CC(n.get(f),r.get(f));g!==null&&h.set(f,g),s=s.add(f)}}),o.push(this.documentOverlayCache.saveOverlays(e,u,h))}return L.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,i){return function(o){return K.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):w0(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,i):this.getDocumentsMatchingCollectionQuery(e,n,r,i)}getNextDocuments(e,n,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,i).next(s=>{const o=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,i-s.size):L.resolve(Nr());let a=-1,l=s;return o.next(u=>L.forEach(u,(d,h)=>(a<h.largestBatchId&&(a=h.largestBatchId),s.get(d)?L.resolve():this.remoteDocumentCache.getEntry(e,d).next(f=>{l=l.insert(d,f)}))).next(()=>this.populateOverlays(e,u,s)).next(()=>this.computeViews(e,l,u,se())).next(d=>({batchId:a,changes:EC(d)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new K(n)).next(r=>{let i=wu();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(e,n,r,i){const s=n.collectionGroup;let o=wu();return this.indexManager.getCollectionParents(e,s).next(a=>L.forEach(a,l=>{const u=function(h,f){return new Ti(f,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(n,l.child(s));return this.getDocumentsMatchingCollectionQuery(e,u,r,i).next(d=>{d.forEach((h,f)=>{o=o.insert(h,f)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,s,i))).next(o=>{s.forEach((l,u)=>{const d=u.getKey();o.get(d)===null&&(o=o.insert(d,Ve.newInvalidDocument(d)))});let a=wu();return o.forEach((l,u)=>{const d=s.get(l);d!==void 0&&Bu(d.mutation,u,yn.empty(),ze.now()),td(n,u)&&(a=a.insert(l,u))}),a})}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class r5{constructor(e){this.serializer=e,this.hr=new Map,this.Pr=new Map}getBundleMetadata(e,n){return L.resolve(this.hr.get(n))}saveBundleMetadata(e,n){return this.hr.set(n.id,function(i){return{id:i.id,version:i.version,createTime:ct(i.createTime)}}(n)),L.resolve()}getNamedQuery(e,n){return L.resolve(this.Pr.get(n))}saveNamedQuery(e,n){return this.Pr.set(n.name,function(i){return{name:i.name,query:C0(i.bundledQuery),readTime:ct(i.readTime)}}(n)),L.resolve()}}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class i5{constructor(){this.overlays=new Oe(K.comparator),this.Ir=new Map}getOverlay(e,n){return L.resolve(this.overlays.get(n))}getOverlays(e,n){const r=Nr();return L.forEach(n,i=>this.getOverlay(e,i).next(s=>{s!==null&&r.set(i,s)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((i,s)=>{this.ht(e,n,s)}),L.resolve()}removeOverlaysForBatchId(e,n,r){const i=this.Ir.get(r);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.Ir.delete(r)),L.resolve()}getOverlaysForCollection(e,n,r){const i=Nr(),s=n.length+1,o=new K(n.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const l=a.getNext().value,u=l.getKey();if(!n.isPrefixOf(u.path))break;u.path.length===s&&l.largestBatchId>r&&i.set(l.getKey(),l)}return L.resolve(i)}getOverlaysForCollectionGroup(e,n,r,i){let s=new Oe((u,d)=>u-d);const o=this.overlays.getIterator();for(;o.hasNext();){const u=o.getNext().value;if(u.getKey().getCollectionGroup()===n&&u.largestBatchId>r){let d=s.get(u.largestBatchId);d===null&&(d=Nr(),s=s.insert(u.largestBatchId,d)),d.set(u.getKey(),u)}}const a=Nr(),l=s.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((u,d)=>a.set(u,d)),!(a.size()>=i)););return L.resolve(a)}ht(e,n,r){const i=this.overlays.get(r.key);if(i!==null){const o=this.Ir.get(i.largestBatchId).delete(r.key);this.Ir.set(i.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new b0(n,r));let s=this.Ir.get(n);s===void 0&&(s=se(),this.Ir.set(n,s)),this.Ir.set(n,s.add(r.key))}}/** * @license * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class s5{constructor(){this.sessionToken=it.EMPTY_BYTE_STRING}getSessionToken(e){return L.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,L.resolve()}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class O0{constructor(){this.Tr=new be(bt.Er),this.dr=new be(bt.Ar)}isEmpty(){return this.Tr.isEmpty()}addReference(e,n){const r=new bt(e,n);this.Tr=this.Tr.add(r),this.dr=this.dr.add(r)}Rr(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Vr(new bt(e,n))}mr(e,n){e.forEach(r=>this.removeReference(r,n))}gr(e){const n=new K(new fe([])),r=new bt(n,e),i=new bt(n,e+1),s=[];return this.dr.forEachInRange([r,i],o=>{this.Vr(o),s.push(o.key)}),s}pr(){this.Tr.forEach(e=>this.Vr(e))}Vr(e){this.Tr=this.Tr.delete(e),this.dr=this.dr.delete(e)}yr(e){const n=new K(new fe([])),r=new bt(n,e),i=new bt(n,e+1);let s=se();return this.dr.forEachInRange([r,i],o=>{s=s.add(o.key)}),s}containsKey(e){const n=new bt(e,0),r=this.Tr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class bt{constructor(e,n){this.key=e,this.wr=n}static Er(e,n){return K.comparator(e.key,n.key)||re(e.wr,n.wr)}static Ar(e,n){return re(e.wr,n.wr)||K.comparator(e.key,n.key)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class o5{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.Sr=1,this.br=new be(bt.Er)}checkEmpty(e){return L.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,i){const s=this.Sr;this.Sr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new S0(s,n,r,i);this.mutationQueue.push(o);for(const a of i)this.br=this.br.add(new bt(a.key,s)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return L.resolve(o)}lookupMutationBatch(e,n){return L.resolve(this.Dr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,i=this.vr(r),s=i<0?0:i;return L.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return L.resolve(this.mutationQueue.length===0?-1:this.Sr-1)}getAllMutationBatches(e){return L.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new bt(n,0),i=new bt(n,Number.POSITIVE_INFINITY),s=[];return this.br.forEachInRange([r,i],o=>{const a=this.Dr(o.wr);s.push(a)}),L.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new be(re);return n.forEach(i=>{const s=new bt(i,0),o=new bt(i,Number.POSITIVE_INFINITY);this.br.forEachInRange([s,o],a=>{r=r.add(a.wr)})}),L.resolve(this.Cr(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,i=r.length+1;let s=r;K.isDocumentKey(s)||(s=s.child(""));const o=new bt(new K(s),0);let a=new be(re);return this.br.forEachWhile(l=>{const u=l.key.path;return!!r.isPrefixOf(u)&&(u.length===i&&(a=a.add(l.wr)),!0)},o),L.resolve(this.Cr(a))}Cr(e){const n=[];return e.forEach(r=>{const i=this.Dr(r);i!==null&&n.push(i)}),n}removeMutationBatch(e,n){X(this.Fr(n.batchId,"removed")===0),this.mutationQueue.shift();let r=this.br;return L.forEach(n.mutations,i=>{const s=new bt(i.key,n.batchId);return r=r.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.br=r})}On(e){}containsKey(e,n){const r=new bt(n,0),i=this.br.firstAfterOrEqual(r);return L.resolve(n.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,L.resolve()}Fr(e,n){return this.vr(e)}vr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Dr(e){const n=this.vr(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class a5{constructor(e){this.Mr=e,this.docs=function(){return new Oe(K.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,i=this.docs.get(r),s=i?i.size:0,o=this.Mr(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-s,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return L.resolve(r?r.document.mutableCopy():Ve.newInvalidDocument(n))}getEntries(e,n){let r=_n();return n.forEach(i=>{const s=this.docs.get(i);r=r.insert(i,s?s.document.mutableCopy():Ve.newInvalidDocument(i))}),L.resolve(r)}getDocumentsMatchingQuery(e,n,r,i){let s=_n();const o=n.path,a=new K(o.child("")),l=this.docs.getIteratorFrom(a);for(;l.hasNext();){const{key:u,value:{document:d}}=l.getNext();if(!o.isPrefixOf(u.path))break;u.path.length>o.length+1||m0(QP(d),r)<=0||(i.has(d.key)||td(n,d))&&(s=s.insert(d.key,d.mutableCopy()))}return L.resolve(s)}getAllFromCollectionGroup(e,n,r,i){Y()}Or(e,n){return L.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new l5(this)}getSize(e){return L.resolve(this.size)}}class l5 extends tk{constructor(e){super(),this.cr=e}applyChanges(e){const n=[];return this.changes.forEach((r,i)=>{i.isValidDocument()?n.push(this.cr.addEntry(e,i)):this.cr.removeEntry(r)}),L.waitFor(n)}getFromCache(e,n){return this.cr.getEntry(e,n)}getAllFromCache(e,n){return this.cr.getEntries(e,n)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class u5{constructor(e){this.persistence=e,this.Nr=new ks(n=>_o(n),Zc),this.lastRemoteSnapshotVersion=Z.min(),this.highestTargetId=0,this.Lr=0,this.Br=new O0,this.targetCount=0,this.kr=To.Bn()}forEachTarget(e,n){return this.Nr.forEach((r,i)=>n(i)),L.resolve()}getLastRemoteSnapshotVersion(e){return L.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return L.resolve(this.Lr)}allocateTargetId(e){return this.highestTargetId=this.kr.next(),L.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.Lr&&(this.Lr=n),L.resolve()}Kn(e){this.Nr.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.kr=new To(n),this.highestTargetId=n),e.sequenceNumber>this.Lr&&(this.Lr=e.sequenceNumber)}addTargetData(e,n){return this.Kn(n),this.targetCount+=1,L.resolve()}updateTargetData(e,n){return this.Kn(n),L.resolve()}removeTargetData(e,n){return this.Nr.delete(n.target),this.Br.gr(n.targetId),this.targetCount-=1,L.resolve()}removeTargets(e,n,r){let i=0;const s=[];return this.Nr.forEach((o,a)=>{a.sequenceNumber<=n&&r.get(a.targetId)===null&&(this.Nr.delete(o),s.push(this.removeMatchingKeysForTargetId(e,a.targetId)),i++)}),L.waitFor(s).next(()=>i)}getTargetCount(e){return L.resolve(this.targetCount)}getTargetData(e,n){const r=this.Nr.get(n)||null;return L.resolve(r)}addMatchingKeys(e,n,r){return this.Br.Rr(n,r),L.resolve()}removeMatchingKeys(e,n,r){this.Br.mr(n,r);const i=this.persistence.referenceDelegate,s=[];return i&&n.forEach(o=>{s.push(i.markPotentiallyOrphaned(e,o))}),L.waitFor(s)}removeMatchingKeysForTargetId(e,n){return this.Br.gr(n),L.resolve()}getMatchingKeysForTargetId(e,n){const r=this.Br.yr(n);return L.resolve(r)}containsKey(e,n){return L.resolve(this.Br.containsKey(n))}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ik{constructor(e,n){this.qr={},this.overlays={},this.Qr=new gn(0),this.Kr=!1,this.Kr=!0,this.$r=new s5,this.referenceDelegate=e(this),this.Ur=new u5(this),this.indexManager=new HB,this.remoteDocumentCache=function(i){return new a5(i)}(r=>this.referenceDelegate.Wr(r)),this.serializer=new GC(n),this.Gr=new r5(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.Kr=!1,Promise.resolve()}get started(){return this.Kr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new i5,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this.qr[e.toKey()];return r||(r=new o5(n,this.referenceDelegate),this.qr[e.toKey()]=r),r}getGlobalsCache(){return this.$r}getTargetCache(){return this.Ur}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Gr}runTransaction(e,n,r){z("MemoryPersistence","Starting transaction:",e);const i=new c5(this.Qr.next());return this.referenceDelegate.zr(),r(i).next(s=>this.referenceDelegate.jr(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}Hr(e,n){return L.or(Object.values(this.qr).map(r=>()=>r.containsKey(e,n)))}}class c5 extends JP{constructor(e){super(),this.currentSequenceNumber=e}}class zp{constructor(e){this.persistence=e,this.Jr=new O0,this.Yr=null}static Zr(e){return new zp(e)}get Xr(){if(this.Yr)return this.Yr;throw Y()}addReference(e,n,r){return this.Jr.addReference(r,n),this.Xr.delete(r.toString()),L.resolve()}removeReference(e,n,r){return this.Jr.removeReference(r,n),this.Xr.add(r.toString()),L.resolve()}markPotentiallyOrphaned(e,n){return this.Xr.add(n.toString()),L.resolve()}removeTarget(e,n){this.Jr.gr(n.targetId).forEach(i=>this.Xr.add(i.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(i=>{i.forEach(s=>this.Xr.add(s.toString()))}).next(()=>r.removeTargetData(e,n))}zr(){this.Yr=new Set}jr(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return L.forEach(this.Xr,r=>{const i=K.fromPath(r);return this.ei(e,i).next(s=>{s||n.removeEntry(i,Z.min())})}).next(()=>(this.Yr=null,n.apply(e)))}updateLimboDocument(e,n){return this.ei(e,n).next(r=>{r?this.Xr.delete(n.toString()):this.Xr.add(n.toString())})}Wr(e){return 0}ei(e,n){return L.or([()=>L.resolve(this.Jr.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Hr(e,n)])}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class d5{constructor(e){this.serializer=e}O(e,n,r,i){const s=new Lp("createOrUpgrade",n);r<1&&i>=1&&(function(l){l.createObjectStore("owner")}(e),function(l){l.createObjectStore("mutationQueues",{keyPath:"userId"}),l.createObjectStore("mutations",{keyPath:"batchId",autoIncrement:!0}).createIndex("userMutationsIndex",FT,{unique:!0}),l.createObjectStore("documentMutations")}(e),AS(e),function(l){l.createObjectStore("remoteDocuments")}(e));let o=L.resolve();return r<3&&i>=3&&(r!==0&&(function(l){l.deleteObjectStore("targetDocuments"),l.deleteObjectStore("targets"),l.deleteObjectStore("targetGlobal")}(e),AS(e)),o=o.next(()=>function(l){const u=l.store("targetGlobal"),d={highestTargetId:0,highestListenSequenceNumber:0,lastRemoteSnapshotVersion:Z.min().toTimestamp(),targetCount:0};return u.put("targetGlobalKey",d)}(s))),r<4&&i>=4&&(r!==0&&(o=o.next(()=>function(l,u){return u.store("mutations").U().next(d=>{l.deleteObjectStore("mutations"),l.createObjectStore("mutations",{keyPath:"batchId",autoIncrement:!0}).createIndex("userMutationsIndex",FT,{unique:!0});const h=u.store("mutations"),f=d.map(g=>h.put(g));return L.waitFor(f)})}(e,s))),o=o.next(()=>{(function(l){l.createObjectStore("clientMetadata",{keyPath:"clientId"})})(e)})),r<5&&i>=5&&(o=o.next(()=>this.ni(s))),r<6&&i>=6&&(o=o.next(()=>(function(l){l.createObjectStore("remoteDocumentGlobal")}(e),this.ri(s)))),r<7&&i>=7&&(o=o.next(()=>this.ii(s))),r<8&&i>=8&&(o=o.next(()=>this.si(e,s))),r<9&&i>=9&&(o=o.next(()=>{(function(l){l.objectStoreNames.contains("remoteDocumentChanges")&&l.deleteObjectStore("remoteDocumentChanges")})(e)})),r<10&&i>=10&&(o=o.next(()=>this.oi(s))),r<11&&i>=11&&(o=o.next(()=>{(function(l){l.createObjectStore("bundles",{keyPath:"bundleId"})})(e),function(l){l.createObjectStore("namedQueries",{keyPath:"name"})}(e)})),r<12&&i>=12&&(o=o.next(()=>{(function(l){const u=l.createObjectStore("documentOverlays",{keyPath:qj});u.createIndex("collectionPathOverlayIndex",Hj,{unique:!1}),u.createIndex("collectionGroupOverlayIndex",Kj,{unique:!1})})(e)})),r<13&&i>=13&&(o=o.next(()=>function(l){const u=l.createObjectStore("remoteDocumentsV14",{keyPath:Dj});u.createIndex("documentKeyIndex",Vj),u.createIndex("collectionGroupIndex",Lj)}(e)).next(()=>this._i(e,s)).next(()=>e.deleteObjectStore("remoteDocuments"))),r<14&&i>=14&&(o=o.next(()=>this.ai(e,s))),r<15&&i>=15&&(o=o.next(()=>function(l){l.createObjectStore("indexConfiguration",{keyPath:"indexId",autoIncrement:!0}).createIndex("collectionGroupIndex","collectionGroup",{unique:!1}),l.createObjectStore("indexState",{keyPath:Bj}).createIndex("sequenceNumberIndex",$j,{unique:!1}),l.createObjectStore("indexEntries",{keyPath:zj}).createIndex("documentKeyIndex",Wj,{unique:!1})}(e))),r<16&&i>=16&&(o=o.next(()=>{n.objectStore("indexState").clear()}).next(()=>{n.objectStore("indexEntries").clear()})),r<17&&i>=17&&(o=o.next(()=>{(function(l){l.createObjectStore("globals",{keyPath:"name"})})(e)})),o}ri(e){let n=0;return e.store("remoteDocuments").J((r,i)=>{n+=Bf(i)}).next(()=>{const r={byteSize:n};return e.store("remoteDocumentGlobal").put("remoteDocumentGlobalKey",r)})}ni(e){const n=e.store("mutationQueues"),r=e.store("mutations");return n.U().next(i=>L.forEach(i,s=>{const o=IDBKeyRange.bound([s.userId,-1],[s.userId,s.lastAcknowledgedBatchId]);return r.U("userMutationsIndex",o).next(a=>L.forEach(a,l=>{X(l.userId===s.userId);const u=qs(this.serializer,l);return XC(e,s.userId,u).next(()=>{})}))}))}ii(e){const n=e.store("targetDocuments"),r=e.store("remoteDocuments");return e.store("targetGlobal").get("targetGlobalKey").next(i=>{const s=[];return r.J((o,a)=>{const l=new fe(o),u=function(h){return[0,an(h)]}(l);s.push(n.get(u).next(d=>d?L.resolve():(h=>n.put({targetId:0,path:an(h),sequenceNumber:i.highestListenSequenceNumber}))(l)))}).next(()=>L.waitFor(s))})}si(e,n){e.createObjectStore("collectionParents",{keyPath:jj});const r=n.store("collectionParents"),i=new x0,s=o=>{if(i.add(o)){const a=o.lastSegment(),l=o.popLast();return r.put({collectionId:a,parent:an(l)})}};return n.store("remoteDocuments").J({H:!0},(o,a)=>{const l=new fe(o);return s(l.popLast())}).next(()=>n.store("documentMutations").J({H:!0},([o,a,l],u)=>{const d=Or(a);return s(d.popLast())}))}oi(e){const n=e.store("targets");return n.J((r,i)=>{const s=Iu(i),o=QC(this.serializer,s);return n.put(o)})}_i(e,n){const r=n.store("remoteDocuments"),i=[];return r.J((s,o)=>{const a=n.store("remoteDocumentsV14"),l=function(h){return h.document?new K(fe.fromString(h.document.name).popFirst(5)):h.noDocument?K.fromSegments(h.noDocument.path):h.unknownDocument?K.fromSegments(h.unknownDocument.path):Y()}(o).path.toArray(),u={prefixPath:l.slice(0,l.length-2),collectionGroup:l[l.length-2],documentId:l[l.length-1],readTime:o.readTime||[0,0],unknownDocument:o.unknownDocument,noDocument:o.noDocument,document:o.document,hasCommittedMutations:!!o.hasCommittedMutations};i.push(a.put(u))}).next(()=>L.waitFor(i))}ai(e,n){const r=n.store("mutations"),i=nk(this.serializer),s=new ik(zp.Zr,this.serializer.ct);return r.U().next(o=>{const a=new Map;return o.forEach(l=>{var u;let d=(u=a.get(l.userId))!==null&&u!==void 0?u:se();qs(this.serializer,l).keys().forEach(h=>d=d.add(h)),a.set(l.userId,d)}),L.forEach(a,(l,u)=>{const d=new Pt(u),h=Bp.lt(this.serializer,d),f=s.getIndexManager(d),g=$p.lt(d,this.serializer,f,s.referenceDelegate);return new rk(i,g,h,f).recalculateAndSaveOverlaysForDocumentKeys(new Gy(n,gn.oe),l).next()})})}}function AS(t){t.createObjectStore("targetDocuments",{keyPath:Fj}).createIndex("documentTargetsIndex",Uj,{unique:!0}),t.createObjectStore("targets",{keyPath:"targetId"}).createIndex("queryTargetsIndex",Mj,{unique:!0}),t.createObjectStore("targetGlobal")}const Cg="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.";class N0{constructor(e,n,r,i,s,o,a,l,u,d,h=17){if(this.allowTabSynchronization=e,this.persistenceKey=n,this.clientId=r,this.ui=s,this.window=o,this.document=a,this.ci=u,this.li=d,this.hi=h,this.Qr=null,this.Kr=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Pi=null,this.inForeground=!1,this.Ii=null,this.Ti=null,this.Ei=Number.NEGATIVE_INFINITY,this.di=f=>Promise.resolve(),!N0.D())throw new $(M.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new ZB(this,i),this.Ai=n+"main",this.serializer=new GC(l),this.Ri=new Fr(this.Ai,this.hi,new d5(this.serializer)),this.$r=new jB,this.Ur=new GB(this.referenceDelegate,this.serializer),this.remoteDocumentCache=nk(this.serializer),this.Gr=new UB,this.window&&this.window.localStorage?this.Vi=this.window.localStorage:(this.Vi=null,d===!1&&ut("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}start(){return this.mi().then(()=>{if(!this.isPrimary&&!this.allowTabSynchronization)throw new $(M.FAILED_PRECONDITION,Cg);return this.fi(),this.gi(),this.pi(),this.runTransaction("getHighestListenSequenceNumber","readonly",e=>this.Ur.getHighestSequenceNumber(e))}).then(e=>{this.Qr=new gn(e,this.ci)}).then(()=>{this.Kr=!0}).catch(e=>(this.Ri&&this.Ri.close(),Promise.reject(e)))}yi(e){return this.di=async n=>{if(this.started)return e(n)},e(this.isPrimary)}setDatabaseDeletedListener(e){this.Ri.L(async n=>{n.newVersion===null&&await e()})}setNetworkEnabled(e){this.networkEnabled!==e&&(this.networkEnabled=e,this.ui.enqueueAndForget(async()=>{this.started&&await this.mi()}))}mi(){return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",e=>oh(e).put({clientId:this.clientId,updateTimeMs:Date.now(),networkEnabled:this.networkEnabled,inForeground:this.inForeground}).next(()=>{if(this.isPrimary)return this.wi(e).next(n=>{n||(this.isPrimary=!1,this.ui.enqueueRetryable(()=>this.di(!1)))})}).next(()=>this.Si(e)).next(n=>this.isPrimary&&!n?this.bi(e).next(()=>!1):!!n&&this.Di(e).next(()=>!0))).catch(e=>{if(Cs(e))return z("IndexedDbPersistence","Failed to extend owner lease: ",e),this.isPrimary;if(!this.allowTabSynchronization)throw e;return z("IndexedDbPersistence","Releasing owner lease after error during lease refresh",e),!1}).then(e=>{this.isPrimary!==e&&this.ui.enqueueRetryable(()=>this.di(e)),this.isPrimary=e})}wi(e){return iu(e).get("owner").next(n=>L.resolve(this.vi(n)))}Ci(e){return oh(e).delete(this.clientId)}async Fi(){if(this.isPrimary&&!this.Mi(this.Ei,18e5)){this.Ei=Date.now();const e=await this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",n=>{const r=Tt(n,"clientMetadata");return r.U().next(i=>{const s=this.xi(i,18e5),o=i.filter(a=>s.indexOf(a)===-1);return L.forEach(o,a=>r.delete(a.clientId)).next(()=>o)})}).catch(()=>[]);if(this.Vi)for(const n of e)this.Vi.removeItem(this.Oi(n.clientId))}}pi(){this.Ti=this.ui.enqueueAfterDelay("client_metadata_refresh",4e3,()=>this.mi().then(()=>this.Fi()).then(()=>this.pi()))}vi(e){return!!e&&e.ownerId===this.clientId}Si(e){return this.li?L.resolve(!0):iu(e).get("owner").next(n=>{if(n!==null&&this.Mi(n.leaseTimestampMs,5e3)&&!this.Ni(n.ownerId)){if(this.vi(n)&&this.networkEnabled)return!0;if(!this.vi(n)){if(!n.allowTabSynchronization)throw new $(M.FAILED_PRECONDITION,Cg);return!1}}return!(!this.networkEnabled||!this.inForeground)||oh(e).U().next(r=>this.xi(r,5e3).find(i=>{if(this.clientId!==i.clientId){const s=!this.networkEnabled&&i.networkEnabled,o=!this.inForeground&&i.inForeground,a=this.networkEnabled===i.networkEnabled;if(s||o&&a)return!0}return!1})===void 0)}).next(n=>(this.isPrimary!==n&&z("IndexedDbPersistence",`Client ${n?"is":"is not"} eligible for a primary lease.`),n))}async shutdown(){this.Kr=!1,this.Li(),this.Ti&&(this.Ti.cancel(),this.Ti=null),this.Bi(),this.ki(),await this.Ri.runTransaction("shutdown","readwrite",["owner","clientMetadata"],e=>{const n=new Gy(e,gn.oe);return this.bi(n).next(()=>this.Ci(n))}),this.Ri.close(),this.qi()}xi(e,n){return e.filter(r=>this.Mi(r.updateTimeMs,n)&&!this.Ni(r.clientId))}Qi(){return this.runTransaction("getActiveClients","readonly",e=>oh(e).U().next(n=>this.xi(n,18e5).map(r=>r.clientId)))}get started(){return this.Kr}getGlobalsCache(){return this.$r}getMutationQueue(e,n){return $p.lt(e,this.serializer,n,this.referenceDelegate)}getTargetCache(){return this.Ur}getRemoteDocumentCache(){return this.remoteDocumentCache}getIndexManager(e){return new KB(e,this.serializer.ct.databaseId)}getDocumentOverlayCache(e){return Bp.lt(this.serializer,e)}getBundleCache(){return this.Gr}runTransaction(e,n,r){z("IndexedDbPersistence","Starting transaction:",e);const i=n==="readonly"?"readonly":"readwrite",s=function(l){return l===17?Yj:l===16?Qj:l===15?y0:l===14?rC:l===13?nC:l===12?Gj:l===11?tC:void Y()}(this.hi);let o;return this.Ri.runTransaction(e,i,s,a=>(o=new Gy(a,this.Qr?this.Qr.next():gn.oe),n==="readwrite-primary"?this.wi(o).next(l=>!!l||this.Si(o)).next(l=>{if(!l)throw ut(`Failed to obtain primary lease for action '${e}'.`),this.isPrimary=!1,this.ui.enqueueRetryable(()=>this.di(!1)),new $(M.FAILED_PRECONDITION,YP);return r(o)}).next(l=>this.Di(o).next(()=>l)):this.Ki(o).next(()=>r(o)))).then(a=>(o.raiseOnCommittedEvent(),a))}Ki(e){return iu(e).get("owner").next(n=>{if(n!==null&&this.Mi(n.leaseTimestampMs,5e3)&&!this.Ni(n.ownerId)&&!this.vi(n)&&!(this.li||this.allowTabSynchronization&&n.allowTabSynchronization))throw new $(M.FAILED_PRECONDITION,Cg)})}Di(e){const n={ownerId:this.clientId,allowTabSynchronization:this.allowTabSynchronization,leaseTimestampMs:Date.now()};return iu(e).put("owner",n)}static D(){return Fr.D()}bi(e){const n=iu(e);return n.get("owner").next(r=>this.vi(r)?(z("IndexedDbPersistence","Releasing primary lease."),n.delete("owner")):L.resolve())}Mi(e,n){const r=Date.now();return!(e<r-n)&&(!(e>r)||(ut(`Detected an update time that is in the future: ${e} > ${r}`),!1))}fi(){this.document!==null&&typeof this.document.addEventListener=="function"&&(this.Ii=()=>{this.ui.enqueueAndForget(()=>(this.inForeground=this.document.visibilityState==="visible",this.mi()))},this.document.addEventListener("visibilitychange",this.Ii),this.inForeground=this.document.visibilityState==="visible")}Bi(){this.Ii&&(this.document.removeEventListener("visibilitychange",this.Ii),this.Ii=null)}gi(){var e;typeof((e=this.window)===null||e===void 0?void 0:e.addEventListener)=="function"&&(this.Pi=()=>{this.Li();const n=/(?:Version|Mobile)\/1[456]/;CR()&&(navigator.appVersion.match(n)||navigator.userAgent.match(n))&&this.ui.enterRestrictedMode(!0),this.ui.enqueueAndForget(()=>this.shutdown())},this.window.addEventListener("pagehide",this.Pi))}ki(){this.Pi&&(this.window.removeEventListener("pagehide",this.Pi),this.Pi=null)}Ni(e){var n;try{const r=((n=this.Vi)===null||n===void 0?void 0:n.getItem(this.Oi(e)))!==null;return z("IndexedDbPersistence",`Client '${e}' ${r?"is":"is not"} zombied in LocalStorage`),r}catch(r){return ut("IndexedDbPersistence","Failed to get zombied client id.",r),!1}}Li(){if(this.Vi)try{this.Vi.setItem(this.Oi(this.clientId),String(Date.now()))}catch(e){ut("Failed to set zombie client id.",e)}}qi(){if(this.Vi)try{this.Vi.removeItem(this.Oi(this.clientId))}catch{}}Oi(e){return`firestore_zombie_${this.persistenceKey}_${e}`}}function iu(t){return Tt(t,"owner")}function oh(t){return Tt(t,"clientMetadata")}function D0(t,e){let n=t.projectId;return t.isDefaultDatabase||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class V0{constructor(e,n,r,i){this.targetId=e,this.fromCache=n,this.$i=r,this.Ui=i}static Wi(e,n){let r=se(),i=se();for(const s of n.docChanges)switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}return new V0(e,n.fromCache,r,i)}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class h5{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class sk{constructor(){this.Gi=!1,this.zi=!1,this.ji=100,this.Hi=function(){return CR()?8:XP(Ye())>0?6:4}()}initialize(e,n){this.Ji=e,this.indexManager=n,this.Gi=!0}getDocumentsMatchingQuery(e,n,r,i){const s={result:null};return this.Yi(e,n).next(o=>{s.result=o}).next(()=>{if(!s.result)return this.Zi(e,n,i,r).next(o=>{s.result=o})}).next(()=>{if(s.result)return;const o=new h5;return this.Xi(e,n,o).next(a=>{if(s.result=a,this.zi)return this.es(e,n,o,a.size)})}).next(()=>s.result)}es(e,n,r,i){return r.documentReadCount<this.ji?(ea()<=ce.DEBUG&&z("QueryEngine","SDK will not create cache indexes for query:",ta(n),"since it only creates cache indexes for collection contains","more than or equal to",this.ji,"documents"),L.resolve()):(ea()<=ce.DEBUG&&z("QueryEngine","Query:",ta(n),"scans",r.documentReadCount,"local documents and returns",i,"documents as results."),r.documentReadCount>this.Hi*i?(ea()<=ce.DEBUG&&z("QueryEngine","The SDK decides to create cache indexes for query:",ta(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,ln(n))):L.resolve())}Yi(e,n){if(JT(n))return L.resolve(null);let r=ln(n);return this.indexManager.getIndexType(e,r).next(i=>i===0?null:(n.limit!==null&&i===1&&(n=Ff(n,null,"F"),r=ln(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(s=>{const o=se(...s);return this.Ji.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,r).next(l=>{const u=this.ts(n,a);return this.ns(n,u,o,l.readTime)?this.Yi(e,Ff(n,null,"F")):this.rs(e,u,n,l)}))})))}Zi(e,n,r,i){return JT(n)||i.isEqual(Z.min())?L.resolve(null):this.Ji.getDocuments(e,r).next(s=>{const o=this.ts(n,s);return this.ns(n,o,r,i)?L.resolve(null):(ea()<=ce.DEBUG&&z("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),ta(n)),this.rs(e,o,n,GP(i,-1)).next(a=>a))})}ts(e,n){let r=new be(vC(e));return n.forEach((i,s)=>{td(e,s)&&(r=r.add(s))}),r}ns(e,n,r,i){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const s=e.limitType==="F"?n.last():n.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}Xi(e,n,r){return ea()<=ce.DEBUG&&z("QueryEngine","Using full collection scan to execute query:",ta(n)),this.Ji.getDocumentsMatchingQuery(e,n,Un.min(),r)}rs(e,n,r,i){return this.Ji.getDocumentsMatchingQuery(e,r,i).next(s=>(n.forEach(o=>{s=s.insert(o.key,o)}),s))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class f5{constructor(e,n,r,i){this.persistence=e,this.ss=n,this.serializer=i,this.os=new Oe(re),this._s=new ks(s=>_o(s),Zc),this.us=new Map,this.cs=e.getRemoteDocumentCache(),this.Ur=e.getTargetCache(),this.Gr=e.getBundleCache(),this.ls(r)}ls(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new rk(this.cs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.cs.setIndexManager(this.indexManager),this.ss.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.os))}}function ok(t,e,n,r){return new f5(t,e,n,r)}async function ak(t,e){const n=Q(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let i;return n.mutationQueue.getAllMutationBatches(r).next(s=>(i=s,n.ls(e),n.mutationQueue.getAllMutationBatches(r))).next(s=>{const o=[],a=[];let l=se();for(const u of i){o.push(u.batchId);for(const d of u.mutations)l=l.add(d.key)}for(const u of s){a.push(u.batchId);for(const d of u.mutations)l=l.add(d.key)}return n.localDocuments.getDocuments(r,l).next(u=>({hs:u,removedBatchIds:o,addedBatchIds:a}))})})}function p5(t,e){const n=Q(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const i=e.batch.keys(),s=n.cs.newChangeBuffer({trackRemovals:!0});return function(a,l,u,d){const h=u.batch,f=h.keys();let g=L.resolve();return f.forEach(_=>{g=g.next(()=>d.getEntry(l,_)).next(v=>{const T=u.docVersions.get(_);X(T!==null),v.version.compareTo(T)<0&&(h.applyToRemoteDocument(v,u),v.isValidDocument()&&(v.setReadTime(u.commitVersion),d.addEntry(v)))})}),g.next(()=>a.mutationQueue.removeMutationBatch(l,h))}(n,r,e,s).next(()=>s.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,i,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(a){let l=se();for(let u=0;u<a.mutationResults.length;++u)a.mutationResults[u].transformResults.length>0&&(l=l.add(a.batch.mutations[u].key));return l}(e))).next(()=>n.localDocuments.getDocuments(r,i))})}function lk(t){const e=Q(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.Ur.getLastRemoteSnapshotVersion(n))}function m5(t,e){const n=Q(t),r=e.snapshotVersion;let i=n.os;return n.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const o=n.cs.newChangeBuffer({trackRemovals:!0});i=n.os;const a=[];e.targetChanges.forEach((d,h)=>{const f=i.get(h);if(!f)return;a.push(n.Ur.removeMatchingKeys(s,d.removedDocuments,h).next(()=>n.Ur.addMatchingKeys(s,d.addedDocuments,h)));let g=f.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(h)!==null?g=g.withResumeToken(it.EMPTY_BYTE_STRING,Z.min()).withLastLimboFreeSnapshotVersion(Z.min()):d.resumeToken.approximateByteSize()>0&&(g=g.withResumeToken(d.resumeToken,r)),i=i.insert(h,g),function(v,T,S){return v.resumeToken.approximateByteSize()===0||T.snapshotVersion.toMicroseconds()-v.snapshotVersion.toMicroseconds()>=3e8?!0:S.addedDocuments.size+S.modifiedDocuments.size+S.removedDocuments.size>0}(f,g,d)&&a.push(n.Ur.updateTargetData(s,g))});let l=_n(),u=se();if(e.documentUpdates.forEach(d=>{e.resolvedLimboDocuments.has(d)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(s,d))}),a.push(uk(s,o,e.documentUpdates).next(d=>{l=d.Ps,u=d.Is})),!r.isEqual(Z.min())){const d=n.Ur.getLastRemoteSnapshotVersion(s).next(h=>n.Ur.setTargetsMetadata(s,s.currentSequenceNumber,r));a.push(d)}return L.waitFor(a).next(()=>o.apply(s)).next(()=>n.localDocuments.getLocalViewOfDocuments(s,l,u)).next(()=>l)}).then(s=>(n.os=i,s))}function uk(t,e,n){let r=se(),i=se();return n.forEach(s=>r=r.add(s)),e.getEntries(t,r).next(s=>{let o=_n();return n.forEach((a,l)=>{const u=s.get(a);l.isFoundDocument()!==u.isFoundDocument()&&(i=i.add(a)),l.isNoDocument()&&l.version.isEqual(Z.min())?(e.removeEntry(a,l.readTime),o=o.insert(a,l)):!u.isValidDocument()||l.version.compareTo(u.version)>0||l.version.compareTo(u.version)===0&&u.hasPendingWrites?(e.addEntry(l),o=o.insert(a,l)):z("LocalStore","Ignoring outdated watch update for ",a,". Current version:",u.version," Watch version:",l.version)}),{Ps:o,Is:i}})}function g5(t,e){const n=Q(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function Xa(t,e){const n=Q(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let i;return n.Ur.getTargetData(r,e).next(s=>s?(i=s,L.resolve(i)):n.Ur.allocateTargetId(r).next(o=>(i=new oi(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.Ur.addTargetData(r,i).next(()=>i))))}).then(r=>{const i=n.os.get(r.targetId);return(i===null||r.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.os=n.os.insert(r.targetId,r),n._s.set(e,r.targetId)),r})}async function Za(t,e,n){const r=Q(t),i=r.os.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,o=>r.persistence.referenceDelegate.removeTarget(o,i))}catch(o){if(!Cs(o))throw o;z("LocalStore",`Failed to update sequence numbers for target ${e}: ${o}`)}r.os=r.os.remove(e),r._s.delete(i.target)}function $f(t,e,n){const r=Q(t);let i=Z.min(),s=se();return r.persistence.runTransaction("Execute query","readwrite",o=>function(l,u,d){const h=Q(l),f=h._s.get(d);return f!==void 0?L.resolve(h.os.get(f)):h.Ur.getTargetData(u,d)}(r,o,ln(e)).next(a=>{if(a)return i=a.lastLimboFreeSnapshotVersion,r.Ur.getMatchingKeysForTargetId(o,a.targetId).next(l=>{s=l})}).next(()=>r.ss.getDocumentsMatchingQuery(o,e,n?i:Z.min(),n?s:se())).next(a=>(hk(r,_C(e),a),{documents:a,Ts:s})))}function ck(t,e){const n=Q(t),r=Q(n.Ur),i=n.os.get(e);return i?Promise.resolve(i.target):n.persistence.runTransaction("Get target data","readonly",s=>r.ot(s,e).next(o=>o?o.target:null))}function dk(t,e){const n=Q(t),r=n.us.get(e)||Z.min();return n.persistence.runTransaction("Get new document changes","readonly",i=>n.cs.getAllFromCollectionGroup(i,e,GP(r,-1),Number.MAX_SAFE_INTEGER)).then(i=>(hk(n,e,i),i))}function hk(t,e,n){let r=t.us.get(e)||Z.min();n.forEach((i,s)=>{s.readTime.compareTo(r)>0&&(r=s.readTime)}),t.us.set(e,r)}async function y5(t,e,n,r){const i=Q(t);let s=se(),o=_n();for(const u of n){const d=e.Es(u.metadata.name);u.document&&(s=s.add(d));const h=e.ds(u);h.setReadTime(e.As(u.metadata.readTime)),o=o.insert(d,h)}const a=i.cs.newChangeBuffer({trackRemovals:!0}),l=await Xa(i,function(d){return ln(_l(fe.fromString(`__bundle__/docs/${d}`)))}(r));return i.persistence.runTransaction("Apply bundle documents","readwrite",u=>uk(u,a,o).next(d=>(a.apply(u),d)).next(d=>i.Ur.removeMatchingKeysForTargetId(u,l.targetId).next(()=>i.Ur.addMatchingKeys(u,s,l.targetId)).next(()=>i.localDocuments.getLocalViewOfDocuments(u,d.Ps,d.Is)).next(()=>d.Ps)))}async function _5(t,e,n=se()){const r=await Xa(t,ln(C0(e.bundledQuery))),i=Q(t);return i.persistence.runTransaction("Save named query","readwrite",s=>{const o=ct(e.readTime);if(r.snapshotVersion.compareTo(o)>=0)return i.Gr.saveNamedQuery(s,e);const a=r.withResumeToken(it.EMPTY_BYTE_STRING,o);return i.os=i.os.insert(a.targetId,a),i.Ur.updateTargetData(s,a).next(()=>i.Ur.removeMatchingKeysForTargetId(s,r.targetId)).next(()=>i.Ur.addMatchingKeys(s,n,r.targetId)).next(()=>i.Gr.saveNamedQuery(s,e))})}function bS(t,e){return`firestore_clients_${t}_${e}`}function RS(t,e,n){let r=`firestore_mutations_${t}_${n}`;return e.isAuthenticated()&&(r+=`_${e.uid}`),r}function kg(t,e){return`firestore_targets_${t}_${e}`}class zf{constructor(e,n,r,i){this.user=e,this.batchId=n,this.state=r,this.error=i}static Rs(e,n,r){const i=JSON.parse(r);let s,o=typeof i=="object"&&["pending","acknowledged","rejected"].indexOf(i.state)!==-1&&(i.error===void 0||typeof i.error=="object");return o&&i.error&&(o=typeof i.error.message=="string"&&typeof i.error.code=="string",o&&(s=new $(i.error.code,i.error.message))),o?new zf(e,n,i.state,s):(ut("SharedClientState",`Failed to parse mutation state for ID '${n}': ${r}`),null)}Vs(){const e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}}class $u{constructor(e,n,r){this.targetId=e,this.state=n,this.error=r}static Rs(e,n){const r=JSON.parse(n);let i,s=typeof r=="object"&&["not-current","current","rejected"].indexOf(r.state)!==-1&&(r.error===void 0||typeof r.error=="object");return s&&r.error&&(s=typeof r.error.message=="string"&&typeof r.error.code=="string",s&&(i=new $(r.error.code,r.error.message))),s?new $u(e,r.state,i):(ut("SharedClientState",`Failed to parse target state for ID '${e}': ${n}`),null)}Vs(){const e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}}class Wf{constructor(e,n){this.clientId=e,this.activeTargetIds=n}static Rs(e,n){const r=JSON.parse(n);let i=typeof r=="object"&&r.activeTargetIds instanceof Array,s=E0();for(let o=0;i&&o<r.activeTargetIds.length;++o)i=ZP(r.activeTargetIds[o]),s=s.add(r.activeTargetIds[o]);return i?new Wf(e,s):(ut("SharedClientState",`Failed to parse client data for instance '${e}': ${n}`),null)}}class L0{constructor(e,n){this.clientId=e,this.onlineState=n}static Rs(e){const n=JSON.parse(e);return typeof n=="object"&&["Unknown","Online","Offline"].indexOf(n.onlineState)!==-1&&typeof n.clientId=="string"?new L0(n.clientId,n.onlineState):(ut("SharedClientState",`Failed to parse online state: ${e}`),null)}}class l_{constructor(){this.activeTargetIds=E0()}fs(e){this.activeTargetIds=this.activeTargetIds.add(e)}gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Vs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class xg{constructor(e,n,r,i,s){this.window=e,this.ui=n,this.persistenceKey=r,this.ps=i,this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null,this.ys=this.ws.bind(this),this.Ss=new Oe(re),this.started=!1,this.bs=[];const o=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=s,this.Ds=bS(this.persistenceKey,this.ps),this.vs=function(l){return`firestore_sequence_number_${l}`}(this.persistenceKey),this.Ss=this.Ss.insert(this.ps,new l_),this.Cs=new RegExp(`^firestore_clients_${o}_([^_]*)$`),this.Fs=new RegExp(`^firestore_mutations_${o}_(\\d+)(?:_(.*))?$`),this.Ms=new RegExp(`^firestore_targets_${o}_(\\d+)$`),this.xs=function(l){return`firestore_online_state_${l}`}(this.persistenceKey),this.Os=function(l){return`firestore_bundle_loaded_v2_${l}`}(this.persistenceKey),this.window.addEventListener("storage",this.ys)}static D(e){return!(!e||!e.localStorage)}async start(){const e=await this.syncEngine.Qi();for(const r of e){if(r===this.ps)continue;const i=this.getItem(bS(this.persistenceKey,r));if(i){const s=Wf.Rs(r,i);s&&(this.Ss=this.Ss.insert(s.clientId,s))}}this.Ns();const n=this.storage.getItem(this.xs);if(n){const r=this.Ls(n);r&&this.Bs(r)}for(const r of this.bs)this.ws(r);this.bs=[],this.window.addEventListener("pagehide",()=>this.shutdown()),this.started=!0}writeSequenceNumber(e){this.setItem(this.vs,JSON.stringify(e))}getAllActiveQueryTargets(){return this.ks(this.Ss)}isActiveQueryTarget(e){let n=!1;return this.Ss.forEach((r,i)=>{i.activeTargetIds.has(e)&&(n=!0)}),n}addPendingMutation(e){this.qs(e,"pending")}updateMutationState(e,n,r){this.qs(e,n,r),this.Qs(e)}addLocalQueryTarget(e,n=!0){let r="not-current";if(this.isActiveQueryTarget(e)){const i=this.storage.getItem(kg(this.persistenceKey,e));if(i){const s=$u.Rs(e,i);s&&(r=s.state)}}return n&&this.Ks.fs(e),this.Ns(),r}removeLocalQueryTarget(e){this.Ks.gs(e),this.Ns()}isLocalQueryTarget(e){return this.Ks.activeTargetIds.has(e)}clearQueryState(e){this.removeItem(kg(this.persistenceKey,e))}updateQueryState(e,n,r){this.$s(e,n,r)}handleUserChange(e,n,r){n.forEach(i=>{this.Qs(i)}),this.currentUser=e,r.forEach(i=>{this.addPendingMutation(i)})}setOnlineState(e){this.Us(e)}notifyBundleLoaded(e){this.Ws(e)}shutdown(){this.started&&(this.window.removeEventListener("storage",this.ys),this.removeItem(this.Ds),this.started=!1)}getItem(e){const n=this.storage.getItem(e);return z("SharedClientState","READ",e,n),n}setItem(e,n){z("SharedClientState","SET",e,n),this.storage.setItem(e,n)}removeItem(e){z("SharedClientState","REMOVE",e),this.storage.removeItem(e)}ws(e){const n=e;if(n.storageArea===this.storage){if(z("SharedClientState","EVENT",n.key,n.newValue),n.key===this.Ds)return void ut("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.ui.enqueueRetryable(async()=>{if(this.started){if(n.key!==null){if(this.Cs.test(n.key)){if(n.newValue==null){const r=this.Gs(n.key);return this.zs(r,null)}{const r=this.js(n.key,n.newValue);if(r)return this.zs(r.clientId,r)}}else if(this.Fs.test(n.key)){if(n.newValue!==null){const r=this.Hs(n.key,n.newValue);if(r)return this.Js(r)}}else if(this.Ms.test(n.key)){if(n.newValue!==null){const r=this.Ys(n.key,n.newValue);if(r)return this.Zs(r)}}else if(n.key===this.xs){if(n.newValue!==null){const r=this.Ls(n.newValue);if(r)return this.Bs(r)}}else if(n.key===this.vs){const r=function(s){let o=gn.oe;if(s!=null)try{const a=JSON.parse(s);X(typeof a=="number"),o=a}catch(a){ut("SharedClientState","Failed to read sequence number from WebStorage",a)}return o}(n.newValue);r!==gn.oe&&this.sequenceNumberHandler(r)}else if(n.key===this.Os){const r=this.Xs(n.newValue);await Promise.all(r.map(i=>this.syncEngine.eo(i)))}}}else this.bs.push(n)})}}get Ks(){return this.Ss.get(this.ps)}Ns(){this.setItem(this.Ds,this.Ks.Vs())}qs(e,n,r){const i=new zf(this.currentUser,e,n,r),s=RS(this.persistenceKey,this.currentUser,e);this.setItem(s,i.Vs())}Qs(e){const n=RS(this.persistenceKey,this.currentUser,e);this.removeItem(n)}Us(e){const n={clientId:this.ps,onlineState:e};this.storage.setItem(this.xs,JSON.stringify(n))}$s(e,n,r){const i=kg(this.persistenceKey,e),s=new $u(e,n,r);this.setItem(i,s.Vs())}Ws(e){const n=JSON.stringify(Array.from(e));this.setItem(this.Os,n)}Gs(e){const n=this.Cs.exec(e);return n?n[1]:null}js(e,n){const r=this.Gs(e);return Wf.Rs(r,n)}Hs(e,n){const r=this.Fs.exec(e),i=Number(r[1]),s=r[2]!==void 0?r[2]:null;return zf.Rs(new Pt(s),i,n)}Ys(e,n){const r=this.Ms.exec(e),i=Number(r[1]);return $u.Rs(i,n)}Ls(e){return L0.Rs(e)}Xs(e){return JSON.parse(e)}async Js(e){if(e.user.uid===this.currentUser.uid)return this.syncEngine.no(e.batchId,e.state,e.error);z("SharedClientState",`Ignoring mutation for non-active user ${e.user.uid}`)}Zs(e){return this.syncEngine.ro(e.targetId,e.state,e.error)}zs(e,n){const r=n?this.Ss.insert(e,n):this.Ss.remove(e),i=this.ks(this.Ss),s=this.ks(r),o=[],a=[];return s.forEach(l=>{i.has(l)||o.push(l)}),i.forEach(l=>{s.has(l)||a.push(l)}),this.syncEngine.io(o,a).then(()=>{this.Ss=r})}Bs(e){this.Ss.get(e.clientId)&&this.onlineStateHandler(e.onlineState)}ks(e){let n=E0();return e.forEach((r,i)=>{n=n.unionWith(i.activeTargetIds)}),n}}class fk{constructor(){this.so=new l_,this.oo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.so.fs(e),this.oo[e]||"not-current"}updateQueryState(e,n,r){this.oo[e]=n}removeLocalQueryTarget(e){this.so.gs(e)}isLocalQueryTarget(e){return this.so.activeTargetIds.has(e)}clearQueryState(e){delete this.oo[e]}getAllActiveQueryTargets(){return this.so.activeTargetIds}isActiveQueryTarget(e){return this.so.activeTargetIds.has(e)}start(){return this.so=new l_,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class v5{_o(e){}shutdown(){}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class PS{constructor(){this.ao=()=>this.uo(),this.co=()=>this.lo(),this.ho=[],this.Po()}_o(e){this.ho.push(e)}shutdown(){window.removeEventListener("online",this.ao),window.removeEventListener("offline",this.co)}Po(){window.addEventListener("online",this.ao),window.addEventListener("offline",this.co)}uo(){z("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.ho)e(0)}lo(){z("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.ho)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let ah=null;function Og(){return ah===null?ah=function(){return 268435456+Math.round(2147483648*Math.random())}():ah++,"0x"+ah.toString(16)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const w5={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class E5{constructor(e){this.Io=e.Io,this.To=e.To}Eo(e){this.Ao=e}Ro(e){this.Vo=e}mo(e){this.fo=e}onMessage(e){this.po=e}close(){this.To()}send(e){this.Io(e)}yo(){this.Ao()}wo(){this.Vo()}So(e){this.fo(e)}bo(e){this.po(e)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Ht="WebChannelConnection";class I5 extends class{constructor(n){this.databaseInfo=n,this.databaseId=n.databaseId;const r=n.ssl?"https":"http",i=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Do=r+"://"+n.host,this.vo=`projects/${i}/databases/${s}`,this.Co=this.databaseId.database==="(default)"?`project_id=${i}`:`project_id=${i}&database_id=${s}`}get Fo(){return!1}Mo(n,r,i,s,o){const a=Og(),l=this.xo(n,r.toUriEncodedString());z("RestConnection",`Sending RPC '${n}' ${a}:`,l,i);const u={"google-cloud-resource-prefix":this.vo,"x-goog-request-params":this.Co};return this.Oo(u,s,o),this.No(n,l,u,i).then(d=>(z("RestConnection",`Received RPC '${n}' ${a}: `,d),d),d=>{throw _r("RestConnection",`RPC '${n}' ${a} failed with error: `,d,"url: ",l,"request:",i),d})}Lo(n,r,i,s,o,a){return this.Mo(n,r,i,s,o)}Oo(n,r,i){n["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+yl}(),n["Content-Type"]="text/plain",this.databaseInfo.appId&&(n["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((s,o)=>n[o]=s),i&&i.headers.forEach((s,o)=>n[o]=s)}xo(n,r){const i=w5[n];return`${this.Do}/v1/${r}:${i}`}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}No(e,n,r,i){const s=Og();return new Promise((o,a)=>{const l=new UP;l.setWithCredentials(!0),l.listenOnce(BP.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case Dh.NO_ERROR:const d=l.getResponseJson();z(Ht,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(d)),o(d);break;case Dh.TIMEOUT:z(Ht,`RPC '${e}' ${s} timed out`),a(new $(M.DEADLINE_EXCEEDED,"Request time out"));break;case Dh.HTTP_ERROR:const h=l.getStatus();if(z(Ht,`RPC '${e}' ${s} failed with status:`,h,"response text:",l.getResponseText()),h>0){let f=l.getResponseJson();Array.isArray(f)&&(f=f[0]);const g=f==null?void 0:f.error;if(g&&g.status&&g.message){const _=function(T){const S=T.toLowerCase().replace(/_/g,"-");return Object.values(M).indexOf(S)>=0?S:M.UNKNOWN}(g.status);a(new $(_,g.message))}else a(new $(M.UNKNOWN,"Server responded with status "+l.getStatus()))}else a(new $(M.UNAVAILABLE,"Connection failed."));break;default:Y()}}finally{z(Ht,`RPC '${e}' ${s} completed.`)}});const u=JSON.stringify(i);z(Ht,`RPC '${e}' ${s} sending request:`,i),l.send(n,"POST",u,r,15)})}Bo(e,n,r){const i=Og(),s=[this.Do,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=WP(),a=zP(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},u=this.longPollingOptions.timeoutSeconds;u!==void 0&&(l.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(l.xmlHttpFactory=new jP({})),this.Oo(l.initMessageHeaders,n,r),l.encodeInitMessageHeaders=!0;const d=s.join("");z(Ht,`Creating RPC '${e}' stream ${i}: ${d}`,l);const h=o.createWebChannel(d,l);let f=!1,g=!1;const _=new E5({Io:T=>{g?z(Ht,`Not sending because RPC '${e}' stream ${i} is closed:`,T):(f||(z(Ht,`Opening RPC '${e}' stream ${i} transport.`),h.open(),f=!0),z(Ht,`RPC '${e}' stream ${i} sending:`,T),h.send(T))},To:()=>h.close()}),v=(T,S,w)=>{T.listen(S,E=>{try{w(E)}catch(x){setTimeout(()=>{throw x},0)}})};return v(h,vu.EventType.OPEN,()=>{g||(z(Ht,`RPC '${e}' stream ${i} transport opened.`),_.yo())}),v(h,vu.EventType.CLOSE,()=>{g||(g=!0,z(Ht,`RPC '${e}' stream ${i} transport closed`),_.So())}),v(h,vu.EventType.ERROR,T=>{g||(g=!0,_r(Ht,`RPC '${e}' stream ${i} transport errored:`,T),_.So(new $(M.UNAVAILABLE,"The operation could not be completed")))}),v(h,vu.EventType.MESSAGE,T=>{var S;if(!g){const w=T.data[0];X(!!w);const E=w,x=E.error||((S=E[0])===null||S===void 0?void 0:S.error);if(x){z(Ht,`RPC '${e}' stream ${i} received error:`,x);const O=x.status;let D=function(m){const R=pt[m];if(R!==void 0)return OC(R)}(O),A=x.message;D===void 0&&(D=M.INTERNAL,A="Unknown error status: "+O+" with message "+x.message),g=!0,_.So(new $(D,A)),h.close()}else z(Ht,`RPC '${e}' stream ${i} received:`,w),_.bo(w)}}),v(a,$P.STAT_EVENT,T=>{T.stat===Hy.PROXY?z(Ht,`RPC '${e}' stream ${i} detected buffering proxy`):T.stat===Hy.NOPROXY&&z(Ht,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{_.wo()},0),_}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function pk(){return typeof window<"u"?window:null}function Bh(){return typeof document<"u"?document:null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function sd(t){return new PB(t,!0)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class M0{constructor(e,n,r=1e3,i=1.5,s=6e4){this.ui=e,this.timerId=n,this.ko=r,this.qo=i,this.Qo=s,this.Ko=0,this.$o=null,this.Uo=Date.now(),this.reset()}reset(){this.Ko=0}Wo(){this.Ko=this.Qo}Go(e){this.cancel();const n=Math.floor(this.Ko+this.zo()),r=Math.max(0,Date.now()-this.Uo),i=Math.max(0,n-r);i>0&&z("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.Ko} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.$o=this.ui.enqueueAfterDelay(this.timerId,i,()=>(this.Uo=Date.now(),e())),this.Ko*=this.qo,this.Ko<this.ko&&(this.Ko=this.ko),this.Ko>this.Qo&&(this.Ko=this.Qo)}jo(){this.$o!==null&&(this.$o.skipDelay(),this.$o=null)}cancel(){this.$o!==null&&(this.$o.cancel(),this.$o=null)}zo(){return(Math.random()-.5)*this.Ko}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class mk{constructor(e,n,r,i,s,o,a,l){this.ui=e,this.Ho=r,this.Jo=i,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=l,this.state=0,this.Yo=0,this.Zo=null,this.Xo=null,this.stream=null,this.e_=0,this.t_=new M0(e,n)}n_(){return this.state===1||this.state===5||this.r_()}r_(){return this.state===2||this.state===3}start(){this.e_=0,this.state!==4?this.auth():this.i_()}async stop(){this.n_()&&await this.close(0)}s_(){this.state=0,this.t_.reset()}o_(){this.r_()&&this.Zo===null&&(this.Zo=this.ui.enqueueAfterDelay(this.Ho,6e4,()=>this.__()))}a_(e){this.u_(),this.stream.send(e)}async __(){if(this.r_())return this.close(0)}u_(){this.Zo&&(this.Zo.cancel(),this.Zo=null)}c_(){this.Xo&&(this.Xo.cancel(),this.Xo=null)}async close(e,n){this.u_(),this.c_(),this.t_.cancel(),this.Yo++,e!==4?this.t_.reset():n&&n.code===M.RESOURCE_EXHAUSTED?(ut(n.toString()),ut("Using maximum backoff delay to prevent overloading the backend."),this.t_.Wo()):n&&n.code===M.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.l_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.mo(n)}l_(){}auth(){this.state=1;const e=this.h_(this.Yo),n=this.Yo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,i])=>{this.Yo===n&&this.P_(r,i)},r=>{e(()=>{const i=new $(M.UNKNOWN,"Fetching auth token failed: "+r.message);return this.I_(i)})})}P_(e,n){const r=this.h_(this.Yo);this.stream=this.T_(e,n),this.stream.Eo(()=>{r(()=>this.listener.Eo())}),this.stream.Ro(()=>{r(()=>(this.state=2,this.Xo=this.ui.enqueueAfterDelay(this.Jo,1e4,()=>(this.r_()&&(this.state=3),Promise.resolve())),this.listener.Ro()))}),this.stream.mo(i=>{r(()=>this.I_(i))}),this.stream.onMessage(i=>{r(()=>++this.e_==1?this.E_(i):this.onNext(i))})}i_(){this.state=5,this.t_.Go(async()=>{this.state=0,this.start()})}I_(e){return z("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}h_(e){return n=>{this.ui.enqueueAndForget(()=>this.Yo===e?n():(z("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class T5 extends mk{constructor(e,n,r,i,s,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}T_(e,n){return this.connection.Bo("Listen",e,n)}E_(e){return this.onNext(e)}onNext(e){this.t_.reset();const n=xB(this.serializer,e),r=function(s){if(!("targetChange"in s))return Z.min();const o=s.targetChange;return o.targetIds&&o.targetIds.length?Z.min():o.readTime?ct(o.readTime):Z.min()}(e);return this.listener.d_(n,r)}A_(e){const n={};n.database=r_(this.serializer),n.addTarget=function(s,o){let a;const l=o.target;if(a=Lf(l)?{documents:$C(s,l)}:{query:zC(s,l)._t},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=LC(s,o.resumeToken);const u=t_(s,o.expectedCount);u!==null&&(a.expectedCount=u)}else if(o.snapshotVersion.compareTo(Z.min())>0){a.readTime=Ja(s,o.snapshotVersion.toTimestamp());const u=t_(s,o.expectedCount);u!==null&&(a.expectedCount=u)}return a}(this.serializer,e);const r=NB(this.serializer,e);r&&(n.labels=r),this.a_(n)}R_(e){const n={};n.database=r_(this.serializer),n.removeTarget=e,this.a_(n)}}class S5 extends mk{constructor(e,n,r,i,s,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}get V_(){return this.e_>0}start(){this.lastStreamToken=void 0,super.start()}l_(){this.V_&&this.m_([])}T_(e,n){return this.connection.Bo("Write",e,n)}E_(e){return X(!!e.streamToken),this.lastStreamToken=e.streamToken,X(!e.writeResults||e.writeResults.length===0),this.listener.f_()}onNext(e){X(!!e.streamToken),this.lastStreamToken=e.streamToken,this.t_.reset();const n=OB(e.writeResults,e.commitTime),r=ct(e.commitTime);return this.listener.g_(r,n)}p_(){const e={};e.database=r_(this.serializer),this.a_(e)}m_(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>Cc(this.serializer,r))};this.a_(n)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class A5 extends class{}{constructor(e,n,r,i){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=i,this.y_=!1}w_(){if(this.y_)throw new $(M.FAILED_PRECONDITION,"The client has already been terminated.")}Mo(e,n,r,i){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Mo(e,n_(n,r),i,s,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===M.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new $(M.UNKNOWN,s.toString())})}Lo(e,n,r,i,s){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.Lo(e,n_(n,r),i,o,a,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===M.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new $(M.UNKNOWN,o.toString())})}terminate(){this.y_=!0,this.connection.terminate()}}class b5{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.S_=0,this.b_=null,this.D_=!0}v_(){this.S_===0&&(this.C_("Unknown"),this.b_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.b_=null,this.F_("Backend didn't respond within 10 seconds."),this.C_("Offline"),Promise.resolve())))}M_(e){this.state==="Online"?this.C_("Unknown"):(this.S_++,this.S_>=1&&(this.x_(),this.F_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.C_("Offline")))}set(e){this.x_(),this.S_=0,e==="Online"&&(this.D_=!1),this.C_(e)}C_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}F_(e){const n=`Could not reach Cloud Firestore backend. ${e} This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.D_?(ut(n),this.D_=!1):z("OnlineStateTracker",n)}x_(){this.b_!==null&&(this.b_.cancel(),this.b_=null)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class R5{constructor(e,n,r,i,s){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.O_=[],this.N_=new Map,this.L_=new Set,this.B_=[],this.k_=s,this.k_._o(o=>{r.enqueueAndForget(async()=>{xs(this)&&(z("RemoteStore","Restarting streams for network reachability change."),await async function(l){const u=Q(l);u.L_.add(4),await El(u),u.q_.set("Unknown"),u.L_.delete(4),await od(u)}(this))})}),this.q_=new b5(r,i)}}async function od(t){if(xs(t))for(const e of t.B_)await e(!0)}async function El(t){for(const e of t.B_)await e(!1)}function Wp(t,e){const n=Q(t);n.N_.has(e.targetId)||(n.N_.set(e.targetId,e),j0(n)?U0(n):Tl(n).r_()&&F0(n,e))}function el(t,e){const n=Q(t),r=Tl(n);n.N_.delete(e),r.r_()&&gk(n,e),n.N_.size===0&&(r.r_()?r.o_():xs(n)&&n.q_.set("Unknown"))}function F0(t,e){if(t.Q_.xe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Z.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}Tl(t).A_(e)}function gk(t,e){t.Q_.xe(e),Tl(t).R_(e)}function U0(t){t.Q_=new SB({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ot:e=>t.N_.get(e)||null,tt:()=>t.datastore.serializer.databaseId}),Tl(t).start(),t.q_.v_()}function j0(t){return xs(t)&&!Tl(t).n_()&&t.N_.size>0}function xs(t){return Q(t).L_.size===0}function yk(t){t.Q_=void 0}async function P5(t){t.q_.set("Online")}async function C5(t){t.N_.forEach((e,n)=>{F0(t,e)})}async function k5(t,e){yk(t),j0(t)?(t.q_.M_(e),U0(t)):t.q_.set("Unknown")}async function x5(t,e,n){if(t.q_.set("Online"),e instanceof VC&&e.state===2&&e.cause)try{await async function(i,s){const o=s.cause;for(const a of s.targetIds)i.N_.has(a)&&(await i.remoteSyncer.rejectListen(a,o),i.N_.delete(a),i.Q_.removeTarget(a))}(t,e)}catch(r){z("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await qf(t,r)}else if(e instanceof jh?t.Q_.Ke(e):e instanceof DC?t.Q_.He(e):t.Q_.We(e),!n.isEqual(Z.min()))try{const r=await lk(t.localStore);n.compareTo(r)>=0&&await function(s,o){const a=s.Q_.rt(o);return a.targetChanges.forEach((l,u)=>{if(l.resumeToken.approximateByteSize()>0){const d=s.N_.get(u);d&&s.N_.set(u,d.withResumeToken(l.resumeToken,o))}}),a.targetMismatches.forEach((l,u)=>{const d=s.N_.get(l);if(!d)return;s.N_.set(l,d.withResumeToken(it.EMPTY_BYTE_STRING,d.snapshotVersion)),gk(s,l);const h=new oi(d.target,l,u,d.sequenceNumber);F0(s,h)}),s.remoteSyncer.applyRemoteEvent(a)}(t,n)}catch(r){z("RemoteStore","Failed to raise snapshot:",r),await qf(t,r)}}async function qf(t,e,n){if(!Cs(e))throw e;t.L_.add(1),await El(t),t.q_.set("Offline"),n||(n=()=>lk(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{z("RemoteStore","Retrying IndexedDB access"),await n(),t.L_.delete(1),await od(t)})}function _k(t,e){return e().catch(n=>qf(t,n,e))}async function Il(t){const e=Q(t),n=ys(e);let r=e.O_.length>0?e.O_[e.O_.length-1].batchId:-1;for(;O5(e);)try{const i=await g5(e.localStore,r);if(i===null){e.O_.length===0&&n.o_();break}r=i.batchId,N5(e,i)}catch(i){await qf(e,i)}vk(e)&&wk(e)}function O5(t){return xs(t)&&t.O_.length<10}function N5(t,e){t.O_.push(e);const n=ys(t);n.r_()&&n.V_&&n.m_(e.mutations)}function vk(t){return xs(t)&&!ys(t).n_()&&t.O_.length>0}function wk(t){ys(t).start()}async function D5(t){ys(t).p_()}async function V5(t){const e=ys(t);for(const n of t.O_)e.m_(n.mutations)}async function L5(t,e,n){const r=t.O_.shift(),i=A0.from(r,e,n);await _k(t,()=>t.remoteSyncer.applySuccessfulWrite(i)),await Il(t)}async function M5(t,e){e&&ys(t).V_&&await async function(r,i){if(function(o){return xC(o)&&o!==M.ABORTED}(i.code)){const s=r.O_.shift();ys(r).s_(),await _k(r,()=>r.remoteSyncer.rejectFailedWrite(s.batchId,i)),await Il(r)}}(t,e),vk(t)&&wk(t)}async function CS(t,e){const n=Q(t);n.asyncQueue.verifyOperationInProgress(),z("RemoteStore","RemoteStore received new credentials");const r=xs(n);n.L_.add(3),await El(n),r&&n.q_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.L_.delete(3),await od(n)}async function u_(t,e){const n=Q(t);e?(n.L_.delete(2),await od(n)):e||(n.L_.add(2),await El(n),n.q_.set("Unknown"))}function Tl(t){return t.K_||(t.K_=function(n,r,i){const s=Q(n);return s.w_(),new T5(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Eo:P5.bind(null,t),Ro:C5.bind(null,t),mo:k5.bind(null,t),d_:x5.bind(null,t)}),t.B_.push(async e=>{e?(t.K_.s_(),j0(t)?U0(t):t.q_.set("Unknown")):(await t.K_.stop(),yk(t))})),t.K_}function ys(t){return t.U_||(t.U_=function(n,r,i){const s=Q(n);return s.w_(),new S5(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Eo:()=>Promise.resolve(),Ro:D5.bind(null,t),mo:M5.bind(null,t),f_:V5.bind(null,t),g_:L5.bind(null,t)}),t.B_.push(async e=>{e?(t.U_.s_(),await Il(t)):(await t.U_.stop(),t.O_.length>0&&(z("RemoteStore",`Stopping write stream with ${t.O_.length} pending writes`),t.O_=[]))})),t.U_}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class B0{constructor(e,n,r,i,s){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=s,this.deferred=new xt,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,i,s){const o=Date.now()+r,a=new B0(e,n,o,i,s);return a.start(r),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new $(M.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Sl(t,e){if(ut("AsyncQueue",`${e}: ${t}`),Cs(t))return new $(M.UNAVAILABLE,`${e}: ${t}`);throw t}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ka{constructor(e){this.comparator=e?(n,r)=>e(n,r)||K.comparator(n.key,r.key):(n,r)=>K.comparator(n.key,r.key),this.keyedMap=wu(),this.sortedSet=new Oe(this.comparator)}static emptySet(e){return new ka(e.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof ka)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(!i.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet ( `+e.join(` `)+` )`}copy(e,n){const r=new ka;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class kS{constructor(){this.W_=new Oe(K.comparator)}track(e){const n=e.doc.key,r=this.W_.get(n);r?e.type!==0&&r.type===3?this.W_=this.W_.insert(n,e):e.type===3&&r.type!==1?this.W_=this.W_.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.W_=this.W_.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.W_=this.W_.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.W_=this.W_.remove(n):e.type===1&&r.type===2?this.W_=this.W_.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.W_=this.W_.insert(n,{type:2,doc:e.doc}):Y():this.W_=this.W_.insert(n,e)}G_(){const e=[];return this.W_.inorderTraversal((n,r)=>{e.push(r)}),e}}class tl{constructor(e,n,r,i,s,o,a,l,u){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=l,this.hasCachedResults=u}static fromInitialDocuments(e,n,r,i,s){const o=[];return n.forEach(a=>{o.push({type:0,doc:a})}),new tl(e,n,ka.emptySet(n),o,r,i,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&ed(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(n[i].type!==r[i].type||!n[i].doc.isEqual(r[i].doc))return!1;return!0}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class F5{constructor(){this.z_=void 0,this.j_=[]}H_(){return this.j_.some(e=>e.J_())}}class U5{constructor(){this.queries=xS(),this.onlineState="Unknown",this.Y_=new Set}terminate(){(function(n,r){const i=Q(n),s=i.queries;i.queries=xS(),s.forEach((o,a)=>{for(const l of a.j_)l.onError(r)})})(this,new $(M.ABORTED,"Firestore shutting down"))}}function xS(){return new ks(t=>yC(t),ed)}async function $0(t,e){const n=Q(t);let r=3;const i=e.query;let s=n.queries.get(i);s?!s.H_()&&e.J_()&&(r=2):(s=new F5,r=e.J_()?0:1);try{switch(r){case 0:s.z_=await n.onListen(i,!0);break;case 1:s.z_=await n.onListen(i,!1);break;case 2:await n.onFirstRemoteStoreListen(i)}}catch(o){const a=Sl(o,`Initialization of query '${ta(e.query)}' failed`);return void e.onError(a)}n.queries.set(i,s),s.j_.push(e),e.Z_(n.onlineState),s.z_&&e.X_(s.z_)&&W0(n)}async function z0(t,e){const n=Q(t),r=e.query;let i=3;const s=n.queries.get(r);if(s){const o=s.j_.indexOf(e);o>=0&&(s.j_.splice(o,1),s.j_.length===0?i=e.J_()?0:1:!s.H_()&&e.J_()&&(i=2))}switch(i){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function j5(t,e){const n=Q(t);let r=!1;for(const i of e){const s=i.query,o=n.queries.get(s);if(o){for(const a of o.j_)a.X_(i)&&(r=!0);o.z_=i}}r&&W0(n)}function B5(t,e,n){const r=Q(t),i=r.queries.get(e);if(i)for(const s of i.j_)s.onError(n);r.queries.delete(e)}function W0(t){t.Y_.forEach(e=>{e.next()})}var c_,OS;(OS=c_||(c_={})).ea="default",OS.Cache="cache";class q0{constructor(e,n,r){this.query=e,this.ta=n,this.na=!1,this.ra=null,this.onlineState="Unknown",this.options=r||{}}X_(e){if(!this.options.includeMetadataChanges){const r=[];for(const i of e.docChanges)i.type!==3&&r.push(i);e=new tl(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.na?this.ia(e)&&(this.ta.next(e),n=!0):this.sa(e,this.onlineState)&&(this.oa(e),n=!0),this.ra=e,n}onError(e){this.ta.error(e)}Z_(e){this.onlineState=e;let n=!1;return this.ra&&!this.na&&this.sa(this.ra,e)&&(this.oa(this.ra),n=!0),n}sa(e,n){if(!e.fromCache||!this.J_())return!0;const r=n!=="Offline";return(!this.options._a||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}ia(e){if(e.docChanges.length>0)return!0;const n=this.ra&&this.ra.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}oa(e){e=tl.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.na=!0,this.ta.next(e)}J_(){return this.options.source!==c_.Cache}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class $5{constructor(e,n){this.aa=e,this.byteLength=n}ua(){return"metadata"in this.aa}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class NS{constructor(e){this.serializer=e}Es(e){return Ur(this.serializer,e)}ds(e){return e.metadata.exists?BC(this.serializer,e.document,!1):Ve.newNoDocument(this.Es(e.metadata.name),this.As(e.metadata.readTime))}As(e){return ct(e)}}class z5{constructor(e,n,r){this.ca=e,this.localStore=n,this.serializer=r,this.queries=[],this.documents=[],this.collectionGroups=new Set,this.progress=Ek(e)}la(e){this.progress.bytesLoaded+=e.byteLength;let n=this.progress.documentsLoaded;if(e.aa.namedQuery)this.queries.push(e.aa.namedQuery);else if(e.aa.documentMetadata){this.documents.push({metadata:e.aa.documentMetadata}),e.aa.documentMetadata.exists||++n;const r=fe.fromString(e.aa.documentMetadata.name);this.collectionGroups.add(r.get(r.length-2))}else e.aa.document&&(this.documents[this.documents.length-1].document=e.aa.document,++n);return n!==this.progress.documentsLoaded?(this.progress.documentsLoaded=n,Object.assign({},this.progress)):null}ha(e){const n=new Map,r=new NS(this.serializer);for(const i of e)if(i.metadata.queries){const s=r.Es(i.metadata.name);for(const o of i.metadata.queries){const a=(n.get(o)||se()).add(s);n.set(o,a)}}return n}async complete(){const e=await y5(this.localStore,new NS(this.serializer),this.documents,this.ca.id),n=this.ha(this.documents);for(const r of this.queries)await _5(this.localStore,r,n.get(r.name));return this.progress.taskState="Success",{progress:this.progress,Pa:this.collectionGroups,Ia:e}}}function Ek(t){return{taskState:"Running",documentsLoaded:0,bytesLoaded:0,totalDocuments:t.totalDocuments,totalBytes:t.totalBytes}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ik{constructor(e){this.key=e}}class Tk{constructor(e){this.key=e}}class Sk{constructor(e,n){this.query=e,this.Ta=n,this.Ea=null,this.hasCachedResults=!1,this.current=!1,this.da=se(),this.mutatedKeys=se(),this.Aa=vC(e),this.Ra=new ka(this.Aa)}get Va(){return this.Ta}ma(e,n){const r=n?n.fa:new kS,i=n?n.Ra:this.Ra;let s=n?n.mutatedKeys:this.mutatedKeys,o=i,a=!1;const l=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,u=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((d,h)=>{const f=i.get(d),g=td(this.query,h)?h:null,_=!!f&&this.mutatedKeys.has(f.key),v=!!g&&(g.hasLocalMutations||this.mutatedKeys.has(g.key)&&g.hasCommittedMutations);let T=!1;f&&g?f.data.isEqual(g.data)?_!==v&&(r.track({type:3,doc:g}),T=!0):this.ga(f,g)||(r.track({type:2,doc:g}),T=!0,(l&&this.Aa(g,l)>0||u&&this.Aa(g,u)<0)&&(a=!0)):!f&&g?(r.track({type:0,doc:g}),T=!0):f&&!g&&(r.track({type:1,doc:f}),T=!0,(l||u)&&(a=!0)),T&&(g?(o=o.add(g),s=v?s.add(d):s.delete(d)):(o=o.delete(d),s=s.delete(d)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const d=this.query.limitType==="F"?o.last():o.first();o=o.delete(d.key),s=s.delete(d.key),r.track({type:1,doc:d})}return{Ra:o,fa:r,ns:a,mutatedKeys:s}}ga(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,i){const s=this.Ra;this.Ra=e.Ra,this.mutatedKeys=e.mutatedKeys;const o=e.fa.G_();o.sort((d,h)=>function(g,_){const v=T=>{switch(T){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Y()}};return v(g)-v(_)}(d.type,h.type)||this.Aa(d.doc,h.doc)),this.pa(r),i=i!=null&&i;const a=n&&!i?this.ya():[],l=this.da.size===0&&this.current&&!i?1:0,u=l!==this.Ea;return this.Ea=l,o.length!==0||u?{snapshot:new tl(this.query,e.Ra,s,o,e.mutatedKeys,l===0,u,!1,!!r&&r.resumeToken.approximateByteSize()>0),wa:a}:{wa:a}}Z_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Ra:this.Ra,fa:new kS,mutatedKeys:this.mutatedKeys,ns:!1},!1)):{wa:[]}}Sa(e){return!this.Ta.has(e)&&!!this.Ra.has(e)&&!this.Ra.get(e).hasLocalMutations}pa(e){e&&(e.addedDocuments.forEach(n=>this.Ta=this.Ta.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Ta=this.Ta.delete(n)),this.current=e.current)}ya(){if(!this.current)return[];const e=this.da;this.da=se(),this.Ra.forEach(r=>{this.Sa(r.key)&&(this.da=this.da.add(r.key))});const n=[];return e.forEach(r=>{this.da.has(r)||n.push(new Tk(r))}),this.da.forEach(r=>{e.has(r)||n.push(new Ik(r))}),n}ba(e){this.Ta=e.Ts,this.da=se();const n=this.ma(e.documents);return this.applyChanges(n,!0)}Da(){return tl.fromInitialDocuments(this.query,this.Ra,this.mutatedKeys,this.Ea===0,this.hasCachedResults)}}class W5{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class q5{constructor(e){this.key=e,this.va=!1}}class H5{constructor(e,n,r,i,s,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.Ca={},this.Fa=new ks(a=>yC(a),ed),this.Ma=new Map,this.xa=new Set,this.Oa=new Oe(K.comparator),this.Na=new Map,this.La=new O0,this.Ba={},this.ka=new Map,this.qa=To.kn(),this.onlineState="Unknown",this.Qa=void 0}get isPrimaryClient(){return this.Qa===!0}}async function K5(t,e,n=!0){const r=qp(t);let i;const s=r.Fa.get(e);return s?(r.sharedClientState.addLocalQueryTarget(s.targetId),i=s.view.Da()):i=await Ak(r,e,n,!0),i}async function G5(t,e){const n=qp(t);await Ak(n,e,!0,!1)}async function Ak(t,e,n,r){const i=await Xa(t.localStore,ln(e)),s=i.targetId,o=t.sharedClientState.addLocalQueryTarget(s,n);let a;return r&&(a=await H0(t,e,s,o==="current",i.resumeToken)),t.isPrimaryClient&&n&&Wp(t.remoteStore,i),a}async function H0(t,e,n,r,i){t.Ka=(h,f,g)=>async function(v,T,S,w){let E=T.view.ma(S);E.ns&&(E=await $f(v.localStore,T.query,!1).then(({documents:A})=>T.view.ma(A,E)));const x=w&&w.targetChanges.get(T.targetId),O=w&&w.targetMismatches.get(T.targetId)!=null,D=T.view.applyChanges(E,v.isPrimaryClient,x,O);return d_(v,T.targetId,D.wa),D.snapshot}(t,h,f,g);const s=await $f(t.localStore,e,!0),o=new Sk(e,s.Ts),a=o.ma(s.documents),l=id.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",i),u=o.applyChanges(a,t.isPrimaryClient,l);d_(t,n,u.wa);const d=new W5(e,n,o);return t.Fa.set(e,d),t.Ma.has(n)?t.Ma.get(n).push(e):t.Ma.set(n,[e]),u.snapshot}async function Q5(t,e,n){const r=Q(t),i=r.Fa.get(e),s=r.Ma.get(i.targetId);if(s.length>1)return r.Ma.set(i.targetId,s.filter(o=>!ed(o,e))),void r.Fa.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedClientState.isActiveQueryTarget(i.targetId)||await Za(r.localStore,i.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(i.targetId),n&&el(r.remoteStore,i.targetId),nl(r,i.targetId)}).catch(Ps)):(nl(r,i.targetId),await Za(r.localStore,i.targetId,!0))}async function Y5(t,e){const n=Q(t),r=n.Fa.get(e),i=n.Ma.get(r.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),el(n.remoteStore,r.targetId))}async function J5(t,e,n){const r=Y0(t);try{const i=await function(o,a){const l=Q(o),u=ze.now(),d=a.reduce((g,_)=>g.add(_.key),se());let h,f;return l.persistence.runTransaction("Locally write mutations","readwrite",g=>{let _=_n(),v=se();return l.cs.getEntries(g,d).next(T=>{_=T,_.forEach((S,w)=>{w.isValidDocument()||(v=v.add(S))})}).next(()=>l.localDocuments.getOverlayedDocuments(g,_)).next(T=>{h=T;const S=[];for(const w of a){const E=EB(w,h.get(w.key).overlayedDocument);E!=null&&S.push(new Si(w.key,E,lC(E.value.mapValue),$e.exists(!0)))}return l.mutationQueue.addMutationBatch(g,u,S,a)}).next(T=>{f=T;const S=T.applyToLocalDocumentSet(h,v);return l.documentOverlayCache.saveOverlays(g,T.batchId,S)})}).then(()=>({batchId:f.batchId,changes:EC(h)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(i.batchId),function(o,a,l){let u=o.Ba[o.currentUser.toKey()];u||(u=new Oe(re)),u=u.insert(a,l),o.Ba[o.currentUser.toKey()]=u}(r,i.batchId,n),await Ai(r,i.changes),await Il(r.remoteStore)}catch(i){const s=Sl(i,"Failed to persist write");n.reject(s)}}async function bk(t,e){const n=Q(t);try{const r=await m5(n.localStore,e);e.targetChanges.forEach((i,s)=>{const o=n.Na.get(s);o&&(X(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1),i.addedDocuments.size>0?o.va=!0:i.modifiedDocuments.size>0?X(o.va):i.removedDocuments.size>0&&(X(o.va),o.va=!1))}),await Ai(n,r,e)}catch(r){await Ps(r)}}function DS(t,e,n){const r=Q(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const i=[];r.Fa.forEach((s,o)=>{const a=o.view.Z_(e);a.snapshot&&i.push(a.snapshot)}),function(o,a){const l=Q(o);l.onlineState=a;let u=!1;l.queries.forEach((d,h)=>{for(const f of h.j_)f.Z_(a)&&(u=!0)}),u&&W0(l)}(r.eventManager,e),i.length&&r.Ca.d_(i),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function X5(t,e,n){const r=Q(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.Na.get(e),s=i&&i.key;if(s){let o=new Oe(K.comparator);o=o.insert(s,Ve.newNoDocument(s,Z.min()));const a=se().add(s),l=new rd(Z.min(),new Map,new Oe(re),o,a);await bk(r,l),r.Oa=r.Oa.remove(s),r.Na.delete(e),Q0(r)}else await Za(r.localStore,e,!1).then(()=>nl(r,e,n)).catch(Ps)}async function Z5(t,e){const n=Q(t),r=e.batch.batchId;try{const i=await p5(n.localStore,e);G0(n,r,null),K0(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await Ai(n,i)}catch(i){await Ps(i)}}async function e3(t,e,n){const r=Q(t);try{const i=await function(o,a){const l=Q(o);return l.persistence.runTransaction("Reject batch","readwrite-primary",u=>{let d;return l.mutationQueue.lookupMutationBatch(u,a).next(h=>(X(h!==null),d=h.keys(),l.mutationQueue.removeMutationBatch(u,h))).next(()=>l.mutationQueue.performConsistencyCheck(u)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(u,d,a)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(u,d)).next(()=>l.localDocuments.getDocuments(u,d))})}(r.localStore,e);G0(r,e,n),K0(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await Ai(r,i)}catch(i){await Ps(i)}}async function t3(t,e){const n=Q(t);xs(n.remoteStore)||z("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");try{const r=await function(o){const a=Q(o);return a.persistence.runTransaction("Get highest unacknowledged batch id","readonly",l=>a.mutationQueue.getHighestUnacknowledgedBatchId(l))}(n.localStore);if(r===-1)return void e.resolve();const i=n.ka.get(r)||[];i.push(e),n.ka.set(r,i)}catch(r){const i=Sl(r,"Initialization of waitForPendingWrites() operation failed");e.reject(i)}}function K0(t,e){(t.ka.get(e)||[]).forEach(n=>{n.resolve()}),t.ka.delete(e)}function G0(t,e,n){const r=Q(t);let i=r.Ba[r.currentUser.toKey()];if(i){const s=i.get(e);s&&(n?s.reject(n):s.resolve(),i=i.remove(e)),r.Ba[r.currentUser.toKey()]=i}}function nl(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Ma.get(e))t.Fa.delete(r),n&&t.Ca.$a(r,n);t.Ma.delete(e),t.isPrimaryClient&&t.La.gr(e).forEach(r=>{t.La.containsKey(r)||Rk(t,r)})}function Rk(t,e){t.xa.delete(e.path.canonicalString());const n=t.Oa.get(e);n!==null&&(el(t.remoteStore,n),t.Oa=t.Oa.remove(e),t.Na.delete(n),Q0(t))}function d_(t,e,n){for(const r of n)r instanceof Ik?(t.La.addReference(r.key,e),n3(t,r)):r instanceof Tk?(z("SyncEngine","Document no longer in limbo: "+r.key),t.La.removeReference(r.key,e),t.La.containsKey(r.key)||Rk(t,r.key)):Y()}function n3(t,e){const n=e.key,r=n.path.canonicalString();t.Oa.get(n)||t.xa.has(r)||(z("SyncEngine","New document in limbo: "+n),t.xa.add(r),Q0(t))}function Q0(t){for(;t.xa.size>0&&t.Oa.size<t.maxConcurrentLimboResolutions;){const e=t.xa.values().next().value;t.xa.delete(e);const n=new K(fe.fromString(e)),r=t.qa.next();t.Na.set(r,new q5(n)),t.Oa=t.Oa.insert(n,r),Wp(t.remoteStore,new oi(ln(_l(n.path)),r,"TargetPurposeLimboResolution",gn.oe))}}async function Ai(t,e,n){const r=Q(t),i=[],s=[],o=[];r.Fa.isEmpty()||(r.Fa.forEach((a,l)=>{o.push(r.Ka(l,e,n).then(u=>{var d;if((u||n)&&r.isPrimaryClient){const h=u?!u.fromCache:(d=n==null?void 0:n.targetChanges.get(l.targetId))===null||d===void 0?void 0:d.current;r.sharedClientState.updateQueryState(l.targetId,h?"current":"not-current")}if(u){i.push(u);const h=V0.Wi(l.targetId,u);s.push(h)}}))}),await Promise.all(o),r.Ca.d_(i),await async function(l,u){const d=Q(l);try{await d.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>L.forEach(u,f=>L.forEach(f.$i,g=>d.persistence.referenceDelegate.addReference(h,f.targetId,g)).next(()=>L.forEach(f.Ui,g=>d.persistence.referenceDelegate.removeReference(h,f.targetId,g)))))}catch(h){if(!Cs(h))throw h;z("LocalStore","Failed to update sequence numbers: "+h)}for(const h of u){const f=h.targetId;if(!h.fromCache){const g=d.os.get(f),_=g.snapshotVersion,v=g.withLastLimboFreeSnapshotVersion(_);d.os=d.os.insert(f,v)}}}(r.localStore,s))}async function r3(t,e){const n=Q(t);if(!n.currentUser.isEqual(e)){z("SyncEngine","User change. New user:",e.toKey());const r=await ak(n.localStore,e);n.currentUser=e,function(s,o){s.ka.forEach(a=>{a.forEach(l=>{l.reject(new $(M.CANCELLED,o))})}),s.ka.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await Ai(n,r.hs)}}function i3(t,e){const n=Q(t),r=n.Na.get(e);if(r&&r.va)return se().add(r.key);{let i=se();const s=n.Ma.get(e);if(!s)return i;for(const o of s){const a=n.Fa.get(o);i=i.unionWith(a.view.Va)}return i}}async function s3(t,e){const n=Q(t),r=await $f(n.localStore,e.query,!0),i=e.view.ba(r);return n.isPrimaryClient&&d_(n,e.targetId,i.wa),i}async function o3(t,e){const n=Q(t);return dk(n.localStore,e).then(r=>Ai(n,r))}async function a3(t,e,n,r){const i=Q(t),s=await function(a,l){const u=Q(a),d=Q(u.mutationQueue);return u.persistence.runTransaction("Lookup mutation documents","readonly",h=>d.Mn(h,l).next(f=>f?u.localDocuments.getDocuments(h,f):L.resolve(null)))}(i.localStore,e);s!==null?(n==="pending"?await Il(i.remoteStore):n==="acknowledged"||n==="rejected"?(G0(i,e,r||null),K0(i,e),function(a,l){Q(Q(a).mutationQueue).On(l)}(i.localStore,e)):Y(),await Ai(i,s)):z("SyncEngine","Cannot apply mutation batch with id: "+e)}async function l3(t,e){const n=Q(t);if(qp(n),Y0(n),e===!0&&n.Qa!==!0){const r=n.sharedClientState.getAllActiveQueryTargets(),i=await VS(n,r.toArray());n.Qa=!0,await u_(n.remoteStore,!0);for(const s of i)Wp(n.remoteStore,s)}else if(e===!1&&n.Qa!==!1){const r=[];let i=Promise.resolve();n.Ma.forEach((s,o)=>{n.sharedClientState.isLocalQueryTarget(o)?r.push(o):i=i.then(()=>(nl(n,o),Za(n.localStore,o,!0))),el(n.remoteStore,o)}),await i,await VS(n,r),function(o){const a=Q(o);a.Na.forEach((l,u)=>{el(a.remoteStore,u)}),a.La.pr(),a.Na=new Map,a.Oa=new Oe(K.comparator)}(n),n.Qa=!1,await u_(n.remoteStore,!1)}}async function VS(t,e,n){const r=Q(t),i=[],s=[];for(const o of e){let a;const l=r.Ma.get(o);if(l&&l.length!==0){a=await Xa(r.localStore,ln(l[0]));for(const u of l){const d=r.Fa.get(u),h=await s3(r,d);h.snapshot&&s.push(h.snapshot)}}else{const u=await ck(r.localStore,o);a=await Xa(r.localStore,u),await H0(r,Pk(u),o,!1,a.resumeToken)}i.push(a)}return r.Ca.d_(s),i}function Pk(t){return gC(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)}function u3(t){return function(n){return Q(Q(n).persistence).Qi()}(Q(t).localStore)}async function c3(t,e,n,r){const i=Q(t);if(i.Qa)return void z("SyncEngine","Ignoring unexpected query state notification.");const s=i.Ma.get(e);if(s&&s.length>0)switch(n){case"current":case"not-current":{const o=await dk(i.localStore,_C(s[0])),a=rd.createSynthesizedRemoteEventForCurrentChange(e,n==="current",it.EMPTY_BYTE_STRING);await Ai(i,o,a);break}case"rejected":await Za(i.localStore,e,!0),nl(i,e,r);break;default:Y()}}async function d3(t,e,n){const r=qp(t);if(r.Qa){for(const i of e){if(r.Ma.has(i)&&r.sharedClientState.isActiveQueryTarget(i)){z("SyncEngine","Adding an already active target "+i);continue}const s=await ck(r.localStore,i),o=await Xa(r.localStore,s);await H0(r,Pk(s),o.targetId,!1,o.resumeToken),Wp(r.remoteStore,o)}for(const i of n)r.Ma.has(i)&&await Za(r.localStore,i,!1).then(()=>{el(r.remoteStore,i),nl(r,i)}).catch(Ps)}}function qp(t){const e=Q(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=bk.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=i3.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=X5.bind(null,e),e.Ca.d_=j5.bind(null,e.eventManager),e.Ca.$a=B5.bind(null,e.eventManager),e}function Y0(t){const e=Q(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Z5.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=e3.bind(null,e),e}function h3(t,e,n){const r=Q(t);(async function(s,o,a){try{const l=await o.getMetadata();if(await function(g,_){const v=Q(g),T=ct(_.createTime);return v.persistence.runTransaction("hasNewerBundle","readonly",S=>v.Gr.getBundleMetadata(S,_.id)).then(S=>!!S&&S.createTime.compareTo(T)>=0)}(s.localStore,l))return await o.close(),a._completeWith(function(g){return{taskState:"Success",documentsLoaded:g.totalDocuments,bytesLoaded:g.totalBytes,totalDocuments:g.totalDocuments,totalBytes:g.totalBytes}}(l)),Promise.resolve(new Set);a._updateProgress(Ek(l));const u=new z5(l,s.localStore,o.serializer);let d=await o.Ua();for(;d;){const f=await u.la(d);f&&a._updateProgress(f),d=await o.Ua()}const h=await u.complete();return await Ai(s,h.Ia,void 0),await function(g,_){const v=Q(g);return v.persistence.runTransaction("Save bundle","readwrite",T=>v.Gr.saveBundleMetadata(T,_))}(s.localStore,l),a._completeWith(h.progress),Promise.resolve(h.Pa)}catch(l){return _r("SyncEngine",`Loading bundle failed with ${l}`),a._failWith(l),Promise.resolve(new Set)}})(r,e,n).then(i=>{r.sharedClientState.notifyBundleLoaded(i)})}class h_{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=sd(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,n){return null}createIndexBackfillerScheduler(e,n){return null}createLocalStore(e){return ok(this.persistence,new sk,e.initialUser,this.serializer)}createPersistence(e){return new ik(zp.Zr,this.serializer)}createSharedClientState(e){return new fk}async terminate(){var e,n;(e=this.gcScheduler)===null||e===void 0||e.stop(),(n=this.indexBackfillerScheduler)===null||n===void 0||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Ck extends h_{constructor(e,n,r){super(),this.Wa=e,this.cacheSizeBytes=n,this.forceOwnership=r,this.synchronizeTabs=!1}async initialize(e){await super.initialize(e),await this.Wa.initialize(this,e),await Y0(this.Wa.syncEngine),await Il(this.Wa.remoteStore),await this.persistence.yi(()=>(this.gcScheduler&&!this.gcScheduler.started&&this.gcScheduler.start(),this.indexBackfillerScheduler&&!this.indexBackfillerScheduler.started&&this.indexBackfillerScheduler.start(),Promise.resolve()))}createLocalStore(e){return ok(this.persistence,new sk,e.initialUser,this.serializer)}createGarbageCollectionScheduler(e,n){const r=this.persistence.referenceDelegate.garbageCollector;return new YB(r,e.asyncQueue,n)}createIndexBackfillerScheduler(e,n){const r=new xj(n,this.persistence);return new kj(e.asyncQueue,r)}createPersistence(e){const n=D0(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),r=this.cacheSizeBytes!==void 0?hn.withCacheSize(this.cacheSizeBytes):hn.DEFAULT;return new N0(this.synchronizeTabs,n,e.clientId,r,e.asyncQueue,pk(),Bh(),this.serializer,this.sharedClientState,!!this.forceOwnership)}createSharedClientState(e){return new fk}}class f3 extends Ck{constructor(e,n){super(e,n,!1),this.Wa=e,this.cacheSizeBytes=n,this.synchronizeTabs=!0}async initialize(e){await super.initialize(e);const n=this.Wa.syncEngine;this.sharedClientState instanceof xg&&(this.sharedClientState.syncEngine={no:a3.bind(null,n),ro:c3.bind(null,n),io:d3.bind(null,n),Qi:u3.bind(null,n),eo:o3.bind(null,n)},await this.sharedClientState.start()),await this.persistence.yi(async r=>{await l3(this.Wa.syncEngine,r),this.gcScheduler&&(r&&!this.gcScheduler.started?this.gcScheduler.start():r||this.gcScheduler.stop()),this.indexBackfillerScheduler&&(r&&!this.indexBackfillerScheduler.started?this.indexBackfillerScheduler.start():r||this.indexBackfillerScheduler.stop())})}createSharedClientState(e){const n=pk();if(!xg.D(n))throw new $(M.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");const r=D0(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);return new xg(n,e.asyncQueue,r,e.clientId,e.initialUser)}}class J0{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>DS(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=r3.bind(null,this.syncEngine),await u_(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new U5}()}createDatastore(e){const n=sd(e.databaseInfo.databaseId),r=function(s){return new I5(s)}(e.databaseInfo);return function(s,o,a,l){return new A5(s,o,a,l)}(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,i,s,o,a){return new R5(r,i,s,o,a)}(this.localStore,this.datastore,e.asyncQueue,n=>DS(this.syncEngine,n,0),function(){return PS.D()?new PS:new v5}())}createSyncEngine(e,n){return function(i,s,o,a,l,u,d){const h=new H5(i,s,o,a,l,u);return d&&(h.Qa=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await async function(i){const s=Q(i);z("RemoteStore","RemoteStore shutting down."),s.L_.add(5),await El(s),s.k_.shutdown(),s.q_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(n=this.eventManager)===null||n===void 0||n.terminate()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function LS(t,e=10240){let n=0;return{async read(){if(n<t.byteLength){const r={value:t.slice(n,n+e),done:!1};return n+=e,r}return{done:!0}},async cancel(){},releaseLock(){},closed:Promise.resolve()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Hp{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Ga(this.observer.next,e)}error(e){this.observer.error?this.Ga(this.observer.error,e):ut("Uncaught Error in snapshot listener:",e.toString())}za(){this.muted=!0}Ga(e,n){this.muted||setTimeout(()=>{this.muted||e(n)},0)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class p3{constructor(e,n){this.ja=e,this.serializer=n,this.metadata=new xt,this.buffer=new Uint8Array,this.Ha=function(){return new TextDecoder("utf-8")}(),this.Ja().then(r=>{r&&r.ua()?this.metadata.resolve(r.aa.metadata):this.metadata.reject(new Error(`The first element of the bundle is not a metadata, it is ${JSON.stringify(r==null?void 0:r.aa)}`))},r=>this.metadata.reject(r))}close(){return this.ja.cancel()}async getMetadata(){return this.metadata.promise}async Ua(){return await this.getMetadata(),this.Ja()}async Ja(){const e=await this.Ya();if(e===null)return null;const n=this.Ha.decode(e),r=Number(n);isNaN(r)&&this.Za(`length string (${n}) is not valid number`);const i=await this.Xa(r);return new $5(JSON.parse(i),e.length+r)}eu(){return this.buffer.findIndex(e=>e===123)}async Ya(){for(;this.eu()<0&&!await this.tu(););if(this.buffer.length===0)return null;const e=this.eu();e<0&&this.Za("Reached the end of bundle when a length string is expected.");const n=this.buffer.slice(0,e);return this.buffer=this.buffer.slice(e),n}async Xa(e){for(;this.buffer.length<e;)await this.tu()&&this.Za("Reached the end of bundle when more is expected.");const n=this.Ha.decode(this.buffer.slice(0,e));return this.buffer=this.buffer.slice(e),n}Za(e){throw this.ja.cancel(),new Error(`Invalid bundle format: ${e}`)}async tu(){const e=await this.ja.read();if(!e.done){const n=new Uint8Array(this.buffer.length+e.value.length);n.set(this.buffer),n.set(e.value,this.buffer.length),this.buffer=n}return e.done}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class m3{constructor(e){this.datastore=e,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastTransactionError=null,this.writtenDocs=new Set}async lookup(e){if(this.ensureCommitNotCalled(),this.mutations.length>0)throw this.lastTransactionError=new $(M.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;const n=await async function(i,s){const o=Q(i),a={documents:s.map(h=>Pc(o.serializer,h))},l=await o.Lo("BatchGetDocuments",o.serializer.databaseId,fe.emptyPath(),a,s.length),u=new Map;l.forEach(h=>{const f=kB(o.serializer,h);u.set(f.key.toString(),f)});const d=[];return s.forEach(h=>{const f=u.get(h.toString());X(!!f),d.push(f)}),d}(this.datastore,e);return n.forEach(r=>this.recordVersion(r)),n}set(e,n){this.write(n.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,n){try{this.write(n.toMutation(e,this.preconditionForUpdate(e)))}catch(r){this.lastTransactionError=r}this.writtenDocs.add(e.toString())}delete(e){this.write(new wl(e,this.precondition(e))),this.writtenDocs.add(e.toString())}async commit(){if(this.ensureCommitNotCalled(),this.lastTransactionError)throw this.lastTransactionError;const e=this.readVersions;this.mutations.forEach(n=>{e.delete(n.key.toString())}),e.forEach((n,r)=>{const i=K.fromPath(r);this.mutations.push(new T0(i,this.precondition(i)))}),await async function(r,i){const s=Q(r),o={writes:i.map(a=>Cc(s.serializer,a))};await s.Mo("Commit",s.serializer.databaseId,fe.emptyPath(),o)}(this.datastore,this.mutations),this.committed=!0}recordVersion(e){let n;if(e.isFoundDocument())n=e.version;else{if(!e.isNoDocument())throw Y();n=Z.min()}const r=this.readVersions.get(e.key.toString());if(r){if(!n.isEqual(r))throw new $(M.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),n)}precondition(e){const n=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&n?n.isEqual(Z.min())?$e.exists(!1):$e.updateTime(n):$e.none()}preconditionForUpdate(e){const n=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&n){if(n.isEqual(Z.min()))throw new $(M.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return $e.updateTime(n)}return $e.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class g3{constructor(e,n,r,i,s){this.asyncQueue=e,this.datastore=n,this.options=r,this.updateFunction=i,this.deferred=s,this.nu=r.maxAttempts,this.t_=new M0(this.asyncQueue,"transaction_retry")}ru(){this.nu-=1,this.iu()}iu(){this.t_.Go(async()=>{const e=new m3(this.datastore),n=this.su(e);n&&n.then(r=>{this.asyncQueue.enqueueAndForget(()=>e.commit().then(()=>{this.deferred.resolve(r)}).catch(i=>{this.ou(i)}))}).catch(r=>{this.ou(r)})})}su(e){try{const n=this.updateFunction(e);return!Xc(n)&&n.catch&&n.then?n:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(n){return this.deferred.reject(n),null}}ou(e){this.nu>0&&this._u(e)?(this.nu-=1,this.asyncQueue.enqueueAndForget(()=>(this.iu(),Promise.resolve()))):this.deferred.reject(e)}_u(e){if(e.name==="FirebaseError"){const n=e.code;return n==="aborted"||n==="failed-precondition"||n==="already-exists"||!xC(n)}return!1}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class y3{constructor(e,n,r,i){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=i,this.user=Pt.UNAUTHENTICATED,this.clientId=HP.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(r,async s=>{z("FirestoreClient","Received user=",s.uid),await this.authCredentialListener(s),this.user=s}),this.appCheckCredentials.start(r,s=>(z("FirestoreClient","Received new app check token=",s),this.appCheckCredentialListener(s,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new $(M.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new xt;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=Sl(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function $h(t,e){t.asyncQueue.verifyOperationInProgress(),z("FirestoreClient","Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async i=>{r.isEqual(i)||(await ak(e.localStore,i),r=i)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function f_(t,e){t.asyncQueue.verifyOperationInProgress();const n=await X0(t);z("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>CS(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,i)=>CS(e.remoteStore,i)),t._onlineComponents=e}function kk(t){return t.name==="FirebaseError"?t.code===M.FAILED_PRECONDITION||t.code===M.UNIMPLEMENTED:!(typeof DOMException<"u"&&t instanceof DOMException)||t.code===22||t.code===20||t.code===11}async function X0(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){z("FirestoreClient","Using user provided OfflineComponentProvider");try{await $h(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!kk(n))throw n;_r("Error using user provided cache. Falling back to memory cache: "+n),await $h(t,new h_)}}else z("FirestoreClient","Using default OfflineComponentProvider"),await $h(t,new h_);return t._offlineComponents}async function Kp(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(z("FirestoreClient","Using user provided OnlineComponentProvider"),await f_(t,t._uninitializedComponentsProvider._online)):(z("FirestoreClient","Using default OnlineComponentProvider"),await f_(t,new J0))),t._onlineComponents}function xk(t){return X0(t).then(e=>e.persistence)}function Z0(t){return X0(t).then(e=>e.localStore)}function Ok(t){return Kp(t).then(e=>e.remoteStore)}function ew(t){return Kp(t).then(e=>e.syncEngine)}function _3(t){return Kp(t).then(e=>e.datastore)}async function rl(t){const e=await Kp(t),n=e.eventManager;return n.onListen=K5.bind(null,e.syncEngine),n.onUnlisten=Q5.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=G5.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=Y5.bind(null,e.syncEngine),n}function v3(t){return t.asyncQueue.enqueue(async()=>{const e=await xk(t),n=await Ok(t);return e.setNetworkEnabled(!0),function(i){const s=Q(i);return s.L_.delete(0),od(s)}(n)})}function w3(t){return t.asyncQueue.enqueue(async()=>{const e=await xk(t),n=await Ok(t);return e.setNetworkEnabled(!1),async function(i){const s=Q(i);s.L_.add(0),await El(s),s.q_.set("Offline")}(n)})}function E3(t,e){const n=new xt;return t.asyncQueue.enqueueAndForget(async()=>async function(i,s,o){try{const a=await function(u,d){const h=Q(u);return h.persistence.runTransaction("read document","readonly",f=>h.localDocuments.getDocument(f,d))}(i,s);a.isFoundDocument()?o.resolve(a):a.isNoDocument()?o.resolve(null):o.reject(new $(M.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)"))}catch(a){const l=Sl(a,`Failed to get document '${s} from cache`);o.reject(l)}}(await Z0(t),e,n)),n.promise}function Nk(t,e,n={}){const r=new xt;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,a,l,u){const d=new Hp({next:f=>{o.enqueueAndForget(()=>z0(s,h));const g=f.docs.has(a);!g&&f.fromCache?u.reject(new $(M.UNAVAILABLE,"Failed to get document because the client is offline.")):g&&f.fromCache&&l&&l.source==="server"?u.reject(new $(M.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):u.resolve(f)},error:f=>u.reject(f)}),h=new q0(_l(a.path),d,{includeMetadataChanges:!0,_a:!0});return $0(s,h)}(await rl(t),t.asyncQueue,e,n,r)),r.promise}function I3(t,e){const n=new xt;return t.asyncQueue.enqueueAndForget(async()=>async function(i,s,o){try{const a=await $f(i,s,!0),l=new Sk(s,a.Ts),u=l.ma(a.documents),d=l.applyChanges(u,!1);o.resolve(d.snapshot)}catch(a){const l=Sl(a,`Failed to execute query '${s} against cache`);o.reject(l)}}(await Z0(t),e,n)),n.promise}function Dk(t,e,n={}){const r=new xt;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,a,l,u){const d=new Hp({next:f=>{o.enqueueAndForget(()=>z0(s,h)),f.fromCache&&l.source==="server"?u.reject(new $(M.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):u.resolve(f)},error:f=>u.reject(f)}),h=new q0(a,d,{includeMetadataChanges:!0,_a:!0});return $0(s,h)}(await rl(t),t.asyncQueue,e,n,r)),r.promise}function T3(t,e){const n=new Hp(e);return t.asyncQueue.enqueueAndForget(async()=>function(i,s){Q(i).Y_.add(s),s.next()}(await rl(t),n)),()=>{n.za(),t.asyncQueue.enqueueAndForget(async()=>function(i,s){Q(i).Y_.delete(s)}(await rl(t),n))}}function S3(t,e,n,r){const i=function(o,a){let l;return l=typeof o=="string"?NC().encode(o):o,function(d,h){return new p3(d,h)}(function(d,h){if(d instanceof Uint8Array)return LS(d,h);if(d instanceof ArrayBuffer)return LS(new Uint8Array(d),h);if(d instanceof ReadableStream)return d.getReader();throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream")}(l),a)}(n,sd(e));t.asyncQueue.enqueueAndForget(async()=>{h3(await ew(t),i,r)})}function A3(t,e){return t.asyncQueue.enqueue(async()=>function(r,i){const s=Q(r);return s.persistence.runTransaction("Get named query","readonly",o=>s.Gr.getNamedQuery(o,i))}(await Z0(t),e))}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Vk(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const MS=new Map;/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function tw(t,e,n){if(!n)throw new $(M.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Lk(t,e,n,r){if(e===!0&&r===!0)throw new $(M.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function FS(t){if(!K.isDocumentKey(t))throw new $(M.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function US(t){if(K.isDocumentKey(t))throw new $(M.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Gp(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":Y()}function _e(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new $(M.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Gp(t);throw new $(M.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}function Mk(t,e){if(e<=0)throw new $(M.INVALID_ARGUMENT,`Function ${t}() requires a positive number, but it was: ${e}.`)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class jS{constructor(e){var n,r;if(e.host===void 0){if(e.ssl!==void 0)throw new $(M.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=(n=e.ssl)===null||n===void 0||n;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new $(M.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}Lk("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Vk((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new $(M.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new $(M.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new $(M.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,i){return r.timeoutSeconds===i.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class ad{constructor(e,n,r,i){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new jS({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new $(M.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!==void 0}_setSettings(e){if(this._settingsFrozen)throw new $(M.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new jS(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new vj;switch(r.type){case"firstParty":return new Tj(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new $(M.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=MS.get(n);r&&(z("ComponentProvider","Removing Datastore"),MS.delete(n),r.terminate())}(this),Promise.resolve()}}function b3(t,e,n,r={}){var i;const s=(t=_e(t,ad))._getSettings(),o=`${e}:${n}`;if(s.host!=="firestore.googleapis.com"&&s.host!==o&&_r("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),t._setSettings(Object.assign(Object.assign({},s),{host:o,ssl:!1})),r.mockUserToken){let a,l;if(typeof r.mockUserToken=="string")a=r.mockUserToken,l=Pt.MOCK_USER;else{a=SL(r.mockUserToken,(i=t._app)===null||i===void 0?void 0:i.options.projectId);const u=r.mockUserToken.sub||r.mockUserToken.user_id;if(!u)throw new $(M.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");l=new Pt(u)}t._authCredentials=new wj(new qP(a,l))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let un=class Fk{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new Fk(this.firestore,e,this._query)}},Ge=class Uk{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new ss(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Uk(this.firestore,e,this._key)}},ss=class jk extends un{constructor(e,n,r){super(e,n,_l(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Ge(this.firestore,null,new K(e))}withConverter(e){return new jk(this.firestore,e,this._path)}};function Bk(t,e,...n){if(t=ee(t),tw("collection","path",e),t instanceof ad){const r=fe.fromString(e,...n);return US(r),new ss(t,null,r)}{if(!(t instanceof Ge||t instanceof ss))throw new $(M.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(fe.fromString(e,...n));return US(r),new ss(t.firestore,null,r)}}function R3(t,e){if(t=_e(t,ad),tw("collectionGroup","collection id",e),e.indexOf("/")>=0)throw new $(M.INVALID_ARGUMENT,`Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new un(t,null,function(r){return new Ti(fe.emptyPath(),r)}(e))}function Hf(t,e,...n){if(t=ee(t),arguments.length===1&&(e=HP.newId()),tw("doc","path",e),t instanceof ad){const r=fe.fromString(e,...n);return FS(r),new Ge(t,null,new K(r))}{if(!(t instanceof Ge||t instanceof ss))throw new $(M.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(fe.fromString(e,...n));return FS(r),new Ge(t.firestore,t instanceof ss?t.converter:null,new K(r))}}function $k(t,e){return t=ee(t),e=ee(e),(t instanceof Ge||t instanceof ss)&&(e instanceof Ge||e instanceof ss)&&t.firestore===e.firestore&&t.path===e.path&&t.converter===e.converter}function zk(t,e){return t=ee(t),e=ee(e),t instanceof un&&e instanceof un&&t.firestore===e.firestore&&ed(t._query,e._query)&&t.converter===e.converter}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class P3{constructor(){this.au=Promise.resolve(),this.uu=[],this.cu=!1,this.lu=[],this.hu=null,this.Pu=!1,this.Iu=!1,this.Tu=[],this.t_=new M0(this,"async_queue_retry"),this.Eu=()=>{const n=Bh();n&&z("AsyncQueue","Visibility state changed to "+n.visibilityState),this.t_.jo()};const e=Bh();e&&typeof e.addEventListener=="function"&&e.addEventListener("visibilitychange",this.Eu)}get isShuttingDown(){return this.cu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.du(),this.Au(e)}enterRestrictedMode(e){if(!this.cu){this.cu=!0,this.Iu=e||!1;const n=Bh();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this.Eu)}}enqueue(e){if(this.du(),this.cu)return new Promise(()=>{});const n=new xt;return this.Au(()=>this.cu&&this.Iu?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.uu.push(e),this.Ru()))}async Ru(){if(this.uu.length!==0){try{await this.uu[0](),this.uu.shift(),this.t_.reset()}catch(e){if(!Cs(e))throw e;z("AsyncQueue","Operation failed with retryable error: "+e)}this.uu.length>0&&this.t_.Go(()=>this.Ru())}}Au(e){const n=this.au.then(()=>(this.Pu=!0,e().catch(r=>{this.hu=r,this.Pu=!1;const i=function(o){let a=o.message||"";return o.stack&&(a=o.stack.includes(o.message)?o.stack:o.message+` `+o.stack),a}(r);throw ut("INTERNAL UNHANDLED ERROR: ",i),r}).then(r=>(this.Pu=!1,r))));return this.au=n,n}enqueueAfterDelay(e,n,r){this.du(),this.Tu.indexOf(e)>-1&&(n=0);const i=B0.createAndSchedule(this,e,n,r,s=>this.Vu(s));return this.lu.push(i),i}du(){this.hu&&Y()}verifyOperationInProgress(){}async mu(){let e;do e=this.au,await e;while(e!==this.au)}fu(e){for(const n of this.lu)if(n.timerId===e)return!0;return!1}gu(e){return this.mu().then(()=>{this.lu.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.lu)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.mu()})}pu(e){this.Tu.push(e)}Vu(e){const n=this.lu.indexOf(e);this.lu.splice(n,1)}}function p_(t){return function(n,r){if(typeof n!="object"||n===null)return!1;const i=n;for(const s of r)if(s in i&&typeof i[s]=="function")return!0;return!1}(t,["next","error","complete"])}class C3{constructor(){this._progressObserver={},this._taskCompletionResolver=new xt,this._lastProgress={taskState:"Running",totalBytes:0,totalDocuments:0,bytesLoaded:0,documentsLoaded:0}}onProgress(e,n,r){this._progressObserver={next:e,error:n,complete:r}}catch(e){return this._taskCompletionResolver.promise.catch(e)}then(e,n){return this._taskCompletionResolver.promise.then(e,n)}_completeWith(e){this._updateProgress(e),this._progressObserver.complete&&this._progressObserver.complete(),this._taskCompletionResolver.resolve(e)}_failWith(e){this._lastProgress.taskState="Error",this._progressObserver.next&&this._progressObserver.next(this._lastProgress),this._progressObserver.error&&this._progressObserver.error(e),this._taskCompletionResolver.reject(e)}_updateProgress(e){this._lastProgress=e,this._progressObserver.next&&this._progressObserver.next(e)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const k3=-1;let st=class extends ad{constructor(e,n,r,i){super(e,n,r,i),this.type="firestore",this._queue=function(){return new P3}(),this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||Wk(this),this._firestoreClient.terminate()}};function Nt(t){return t._firestoreClient||Wk(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function Wk(t){var e,n,r;const i=t._freezeSettings(),s=function(a,l,u,d){return new Zj(a,l,u,d.host,d.ssl,d.experimentalForceLongPolling,d.experimentalAutoDetectLongPolling,Vk(d.experimentalLongPollingOptions),d.useFetchStreams)}(t._databaseId,((e=t._app)===null||e===void 0?void 0:e.options.appId)||"",t._persistenceKey,i);t._firestoreClient=new y3(t._authCredentials,t._appCheckCredentials,t._queue,s),!((n=i.localCache)===null||n===void 0)&&n._offlineComponentProvider&&(!((r=i.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(t._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.localCache.kind,_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider})}function x3(t,e){Hk(t=_e(t,st));const n=Nt(t);if(n._uninitializedComponentsProvider)throw new $(M.FAILED_PRECONDITION,"SDK cache is already specified.");_r("enableIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");const r=t._freezeSettings(),i=new J0;return qk(n,i,new Ck(i,r.cacheSizeBytes,e==null?void 0:e.forceOwnership))}function O3(t){Hk(t=_e(t,st));const e=Nt(t);if(e._uninitializedComponentsProvider)throw new $(M.FAILED_PRECONDITION,"SDK cache is already specified.");_r("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");const n=t._freezeSettings(),r=new J0;return qk(e,r,new f3(r,n.cacheSizeBytes))}function qk(t,e,n){const r=new xt;return t.asyncQueue.enqueue(async()=>{try{await $h(t,n),await f_(t,e),r.resolve()}catch(i){const s=i;if(!kk(s))throw s;_r("Error enabling indexeddb cache. Falling back to memory cache: "+s),r.reject(s)}}).then(()=>r.promise)}function N3(t){if(t._initialized&&!t._terminated)throw new $(M.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");const e=new xt;return t._queue.enqueueAndForgetEvenWhileRestricted(async()=>{try{await async function(r){if(!Fr.D())return Promise.resolve();const i=r+"main";await Fr.delete(i)}(D0(t._databaseId,t._persistenceKey)),e.resolve()}catch(n){e.reject(n)}}),e.promise}function D3(t){return function(n){const r=new xt;return n.asyncQueue.enqueueAndForget(async()=>t3(await ew(n),r)),r.promise}(Nt(t=_e(t,st)))}function V3(t){return v3(Nt(t=_e(t,st)))}function L3(t){return w3(Nt(t=_e(t,st)))}function M3(t,e){const n=Nt(t=_e(t,st)),r=new C3;return S3(n,t._databaseId,e,r),r}function F3(t,e){return A3(Nt(t=_e(t,st)),e).then(n=>n?new un(t,null,n.query):null)}function Hk(t){if(t._initialized||t._terminated)throw new $(M.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.")}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Wr{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Wr(it.fromBase64String(e))}catch(n){throw new $(M.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new Wr(it.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let _s=class{constructor(...e){for(let n=0;n<e.length;++n)if(e[n].length===0)throw new $(M.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Be(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let Do=class{constructor(e){this._methodName=e}};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Qp{constructor(e,n){if(!isFinite(e)||e<-90||e>90)throw new $(M.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new $(M.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return re(this._lat,e._lat)||re(this._long,e._long)}}/** * @license * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class nw{constructor(e){this._values=(e||[]).map(n=>n)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,i){if(r.length!==i.length)return!1;for(let s=0;s<r.length;++s)if(r[s]!==i[s])return!1;return!0}(this._values,e._values)}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const U3=/^__.*__$/;class j3{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new Si(e,this.data,this.fieldMask,n,this.fieldTransforms):new vl(e,this.data,n,this.fieldTransforms)}}class Kk{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new Si(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function Gk(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Y()}}class Yp{constructor(e,n,r,i,s,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=i,s===void 0&&this.yu(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get wu(){return this.settings.wu}Su(e){return new Yp(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}bu(e){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(e),i=this.Su({path:r,Du:!1});return i.vu(e),i}Cu(e){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(e),i=this.Su({path:r,Du:!1});return i.yu(),i}Fu(e){return this.Su({path:void 0,Du:!0})}Mu(e){return Kf(e,this.settings.methodName,this.settings.xu||!1,this.path,this.settings.Ou)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}yu(){if(this.path)for(let e=0;e<this.path.length;e++)this.vu(this.path.get(e))}vu(e){if(e.length===0)throw this.Mu("Document fields must not be empty");if(Gk(this.wu)&&U3.test(e))throw this.Mu('Document fields cannot begin and end with "__"')}}class B3{constructor(e,n,r){this.databaseId=e,this.ignoreUndefinedProperties=n,this.serializer=r||sd(e)}Nu(e,n,r,i=!1){return new Yp({wu:e,methodName:n,Ou:r,path:Be.emptyPath(),Du:!1,xu:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function Vo(t){const e=t._freezeSettings(),n=sd(t._databaseId);return new B3(t._databaseId,!!e.ignoreUndefinedProperties,n)}function Jp(t,e,n,r,i,s={}){const o=t.Nu(s.merge||s.mergeFields?2:0,e,n,i);uw("Data must be an object, but it was:",o,r);const a=Jk(r,o);let l,u;if(s.merge)l=new yn(o.fieldMask),u=o.fieldTransforms;else if(s.mergeFields){const d=[];for(const h of s.mergeFields){const f=m_(e,h,n);if(!o.contains(f))throw new $(M.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);Zk(d,f)||d.push(f)}l=new yn(d),u=o.fieldTransforms.filter(h=>l.covers(h.field))}else l=null,u=o.fieldTransforms;return new j3(new Ft(a),l,u)}class ld extends Do{_toFieldTransform(e){if(e.wu!==2)throw e.wu===1?e.Mu(`${this._methodName}() can only appear at the top level of your update data`):e.Mu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof ld}}function Qk(t,e,n){return new Yp({wu:3,Ou:e.settings.Ou,methodName:t._methodName,Du:n},e.databaseId,e.serializer,e.ignoreUndefinedProperties)}class rw extends Do{_toFieldTransform(e){return new nd(e.path,new Qa)}isEqual(e){return e instanceof rw}}class iw extends Do{constructor(e,n){super(e),this.Lu=n}_toFieldTransform(e){const n=Qk(this,e,!0),r=this.Lu.map(s=>Lo(s,n)),i=new vo(r);return new nd(e.path,i)}isEqual(e){return e instanceof iw&&ja(this.Lu,e.Lu)}}class sw extends Do{constructor(e,n){super(e),this.Lu=n}_toFieldTransform(e){const n=Qk(this,e,!0),r=this.Lu.map(s=>Lo(s,n)),i=new wo(r);return new nd(e.path,i)}isEqual(e){return e instanceof sw&&ja(this.Lu,e.Lu)}}class ow extends Do{constructor(e,n){super(e),this.Bu=n}_toFieldTransform(e){const n=new Ya(e.serializer,SC(e.serializer,this.Bu));return new nd(e.path,n)}isEqual(e){return e instanceof ow&&this.Bu===e.Bu}}function aw(t,e,n,r){const i=t.Nu(1,e,n);uw("Data must be an object, but it was:",i,r);const s=[],o=Ft.empty();No(r,(l,u)=>{const d=cw(e,l,n);u=ee(u);const h=i.Cu(d);if(u instanceof ld)s.push(d);else{const f=Lo(u,h);f!=null&&(s.push(d),o.set(d,f))}});const a=new yn(s);return new Kk(o,a,i.fieldTransforms)}function lw(t,e,n,r,i,s){const o=t.Nu(1,e,n),a=[m_(e,r,n)],l=[i];if(s.length%2!=0)throw new $(M.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let f=0;f<s.length;f+=2)a.push(m_(e,s[f])),l.push(s[f+1]);const u=[],d=Ft.empty();for(let f=a.length-1;f>=0;--f)if(!Zk(u,a[f])){const g=a[f];let _=l[f];_=ee(_);const v=o.Cu(g);if(_ instanceof ld)u.push(g);else{const T=Lo(_,v);T!=null&&(u.push(g),d.set(g,T))}}const h=new yn(u);return new Kk(d,h,o.fieldTransforms)}function Yk(t,e,n,r=!1){return Lo(n,t.Nu(r?4:3,e))}function Lo(t,e){if(Xk(t=ee(t)))return uw("Unsupported field value:",e,t),Jk(t,e);if(t instanceof Do)return function(r,i){if(!Gk(i.wu))throw i.Mu(`${r._methodName}() can only be used with update() and set()`);if(!i.path)throw i.Mu(`${r._methodName}() is not currently supported inside arrays`);const s=r._toFieldTransform(i);s&&i.fieldTransforms.push(s)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.Du&&e.wu!==4)throw e.Mu("Nested arrays are not supported");return function(r,i){const s=[];let o=0;for(const a of r){let l=Lo(a,i.Fu(o));l==null&&(l={nullValue:"NULL_VALUE"}),s.push(l),o++}return{arrayValue:{values:s}}}(t,e)}return function(r,i){if((r=ee(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return SC(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const s=ze.fromDate(r);return{timestampValue:Ja(i.serializer,s)}}if(r instanceof ze){const s=new ze(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Ja(i.serializer,s)}}if(r instanceof Qp)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Wr)return{bytesValue:LC(i.serializer,r._byteString)};if(r instanceof Ge){const s=i.databaseId,o=r.firestore._databaseId;if(!o.isEqual(s))throw i.Mu(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:P0(r.firestore._databaseId||i.databaseId,r._key.path)}}if(r instanceof nw)return function(o,a){return{mapValue:{fields:{__type__:{stringValue:"__vector__"},value:{arrayValue:{values:o.toArray().map(l=>{if(typeof l!="number")throw a.Mu("VectorValues must only contain numeric values.");return I0(a.serializer,l)})}}}}}}(r,i);throw i.Mu(`Unsupported field value: ${Gp(r)}`)}(t,e)}function Jk(t,e){const n={};return iC(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):No(t,(r,i)=>{const s=Lo(i,e.bu(r));s!=null&&(n[r]=s)}),{mapValue:{fields:n}}}function Xk(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof ze||t instanceof Qp||t instanceof Wr||t instanceof Ge||t instanceof Do||t instanceof nw)}function uw(t,e,n){if(!Xk(n)||!function(i){return typeof i=="object"&&i!==null&&(Object.getPrototypeOf(i)===Object.prototype||Object.getPrototypeOf(i)===null)}(n)){const r=Gp(n);throw r==="an object"?e.Mu(t+" a custom object"):e.Mu(t+" "+r)}}function m_(t,e,n){if((e=ee(e))instanceof _s)return e._internalPath;if(typeof e=="string")return cw(t,e);throw Kf("Field path arguments must be of type string or ",t,!1,void 0,n)}const $3=new RegExp("[~\\*/\\[\\]]");function cw(t,e,n){if(e.search($3)>=0)throw Kf(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new _s(...e.split("."))._internalPath}catch{throw Kf(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function Kf(t,e,n,r,i){const s=r&&!r.isEmpty(),o=i!==void 0;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let l="";return(s||o)&&(l+=" (found",s&&(l+=` in field ${r}`),o&&(l+=` in document ${i}`),l+=")"),new $(M.INVALID_ARGUMENT,a+t+l)}function Zk(t,e){return t.some(n=>n.isEqual(e))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class kc{constructor(e,n,r,i,s){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new Ge(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new z3(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const n=this._document.data.field(Xp("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class z3 extends kc{data(){return super.data()}}function Xp(t,e){return typeof e=="string"?cw(t,e):e instanceof _s?e._internalPath:e._delegate._internalPath}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function ex(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new $(M.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class dw{}class ud extends dw{}function Di(t,e,...n){let r=[];e instanceof dw&&r.push(e),r=r.concat(n),function(s){const o=s.filter(l=>l instanceof hw).length,a=s.filter(l=>l instanceof Zp).length;if(o>1||o>0&&a>0)throw new $(M.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const i of r)t=i._apply(t);return t}class Zp extends ud{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new Zp(e,n,r)}_apply(e){const n=this._parse(e);return nx(e._query,n),new un(e.firestore,e.converter,e_(e._query,n))}_parse(e){const n=Vo(e.firestore);return function(s,o,a,l,u,d,h){let f;if(u.isKeyField()){if(d==="array-contains"||d==="array-contains-any")throw new $(M.INVALID_ARGUMENT,`Invalid Query. You can't perform '${d}' queries on documentId().`);if(d==="in"||d==="not-in"){$S(h,d);const g=[];for(const _ of h)g.push(BS(l,s,_));f={arrayValue:{values:g}}}else f=BS(l,s,h)}else d!=="in"&&d!=="not-in"&&d!=="array-contains-any"||$S(h,d),f=Yk(a,o,h,d==="in"||d==="not-in");return pe.create(u,d,f)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function W3(t,e,n){const r=e,i=Xp("where",t);return Zp._create(i,r,n)}class hw extends dw{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new hw(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:Se.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(i,s){let o=i;const a=s.getFlattenedFilters();for(const l of a)nx(o,l),o=e_(o,l)}(e._query,n),new un(e.firestore,e.converter,e_(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class fw extends ud{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new fw(e,n)}_apply(e){const n=function(i,s,o){if(i.startAt!==null)throw new $(M.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new $(M.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Rc(s,o)}(e._query,this._field,this._direction);return new un(e.firestore,e.converter,function(i,s){const o=i.explicitOrderBy.concat([s]);return new Ti(i.path,i.collectionGroup,o,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)}(e._query,n))}}function q3(t,e="asc"){const n=e,r=Xp("orderBy",t);return fw._create(r,n)}class em extends ud{constructor(e,n,r){super(),this.type=e,this._limit=n,this._limitType=r}static _create(e,n,r){return new em(e,n,r)}_apply(e){return new un(e.firestore,e.converter,Ff(e._query,this._limit,this._limitType))}}function H3(t){return Mk("limit",t),em._create("limit",t,"F")}function K3(t){return Mk("limitToLast",t),em._create("limitToLast",t,"L")}class tm extends ud{constructor(e,n,r){super(),this.type=e,this._docOrFields=n,this._inclusive=r}static _create(e,n,r){return new tm(e,n,r)}_apply(e){const n=tx(e,this.type,this._docOrFields,this._inclusive);return new un(e.firestore,e.converter,function(i,s){return new Ti(i.path,i.collectionGroup,i.explicitOrderBy.slice(),i.filters.slice(),i.limit,i.limitType,s,i.endAt)}(e._query,n))}}function G3(...t){return tm._create("startAt",t,!0)}function Q3(...t){return tm._create("startAfter",t,!1)}class nm extends ud{constructor(e,n,r){super(),this.type=e,this._docOrFields=n,this._inclusive=r}static _create(e,n,r){return new nm(e,n,r)}_apply(e){const n=tx(e,this.type,this._docOrFields,this._inclusive);return new un(e.firestore,e.converter,function(i,s){return new Ti(i.path,i.collectionGroup,i.explicitOrderBy.slice(),i.filters.slice(),i.limit,i.limitType,i.startAt,s)}(e._query,n))}}function Y3(...t){return nm._create("endBefore",t,!1)}function J3(...t){return nm._create("endAt",t,!0)}function tx(t,e,n,r){if(n[0]=ee(n[0]),n[0]instanceof kc)return function(s,o,a,l,u){if(!l)throw new $(M.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${a}().`);const d=[];for(const h of Ca(s))if(h.field.isKeyField())d.push(yo(o,l.key));else{const f=l.data.field(h.field);if(Mp(f))throw new $(M.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+h.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(f===null){const g=h.field.canonicalString();throw new $(M.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${g}' (used as the orderBy) does not exist.`)}d.push(f)}return new gs(d,u)}(t._query,t.firestore._databaseId,e,n[0]._document,r);{const i=Vo(t.firestore);return function(o,a,l,u,d,h){const f=o.explicitOrderBy;if(d.length>f.length)throw new $(M.INVALID_ARGUMENT,`Too many arguments provided to ${u}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const g=[];for(let _=0;_<d.length;_++){const v=d[_];if(f[_].field.isKeyField()){if(typeof v!="string")throw new $(M.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${u}(), but got a ${typeof v}`);if(!w0(o)&&v.indexOf("/")!==-1)throw new $(M.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${u}() must be a plain document ID, but '${v}' contains a slash.`);const T=o.path.child(fe.fromString(v));if(!K.isDocumentKey(T))throw new $(M.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${u}() must result in a valid document path, but '${T}' is not because it contains an odd number of segments.`);const S=new K(T);g.push(yo(a,S))}else{const T=Yk(l,u,v);g.push(T)}}return new gs(g,h)}(t._query,t.firestore._databaseId,i,e,n,r)}}function BS(t,e,n){if(typeof(n=ee(n))=="string"){if(n==="")throw new $(M.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!w0(e)&&n.indexOf("/")!==-1)throw new $(M.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(fe.fromString(n));if(!K.isDocumentKey(r))throw new $(M.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return yo(t,new K(r))}if(n instanceof Ge)return yo(t,n._key);throw new $(M.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Gp(n)}.`)}function $S(t,e){if(!Array.isArray(t)||t.length===0)throw new $(M.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function nx(t,e){const n=function(i,s){for(const o of i)for(const a of o.getFlattenedFilters())if(s.indexOf(a.op)>=0)return a.op;return null}(t.filters,function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new $(M.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new $(M.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class pw{convertValue(e,n="none"){switch(go(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Ue(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(fs(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw Y()}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return No(e,(i,s)=>{r[i]=this.convertValue(s,n)}),r}convertVectorValue(e){var n,r,i;const s=(i=(r=(n=e.fields)===null||n===void 0?void 0:n.value.arrayValue)===null||r===void 0?void 0:r.values)===null||i===void 0?void 0:i.map(o=>Ue(o.doubleValue));return new nw(s)}convertGeoPoint(e){return new Qp(Ue(e.latitude),Ue(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=_0(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(Sc(e));default:return null}}convertTimestamp(e){const n=gi(e);return new ze(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=fe.fromString(e);X(KC(r));const i=new ps(r.get(1),r.get(3)),s=new K(r.popFirst(5));return i.isEqual(n)||ut(`Document ${s} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),s}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function rm(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}class X3 extends pw{constructor(e){super(),this.firestore=e}convertBytes(e){return new Wr(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new Ge(this.firestore,null,n)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class eo{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}let yi=class extends kc{constructor(e,n,r,i,s,o){super(e,n,r,i,o),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new zu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(Xp("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}},zu=class extends yi{data(e={}){return super.data(e)}},vs=class{constructor(e,n,r,i){this._firestore=e,this._userDataWriter=n,this._snapshot=i,this.metadata=new eo(i.hasPendingWrites,i.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new zu(this._firestore,this._userDataWriter,r.key,r,new eo(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new $(M.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(i,s){if(i._snapshot.oldDocs.isEmpty()){let o=0;return i._snapshot.docChanges.map(a=>{const l=new zu(i._firestore,i._userDataWriter,a.doc.key,a.doc,new eo(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);return a.doc,{type:"added",doc:l,oldIndex:-1,newIndex:o++}})}{let o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(a=>s||a.type!==3).map(a=>{const l=new zu(i._firestore,i._userDataWriter,a.doc.key,a.doc,new eo(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);let u=-1,d=-1;return a.type!==0&&(u=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),d=o.indexOf(a.doc.key)),{type:Z3(a.type),doc:l,oldIndex:u,newIndex:d}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}};function Z3(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Y()}}function rx(t,e){return t instanceof yi&&e instanceof yi?t._firestore===e._firestore&&t._key.isEqual(e._key)&&(t._document===null?e._document===null:t._document.isEqual(e._document))&&t._converter===e._converter:t instanceof vs&&e instanceof vs&&t._firestore===e._firestore&&zk(t.query,e.query)&&t.metadata.isEqual(e.metadata)&&t._snapshot.isEqual(e._snapshot)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function e$(t){t=_e(t,Ge);const e=_e(t.firestore,st);return Nk(Nt(e),t._key).then(n=>mw(e,t,n))}class Mo extends pw{constructor(e){super(),this.firestore=e}convertBytes(e){return new Wr(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new Ge(this.firestore,null,n)}}function t$(t){t=_e(t,Ge);const e=_e(t.firestore,st),n=Nt(e),r=new Mo(e);return E3(n,t._key).then(i=>new yi(e,r,t._key,i,new eo(i!==null&&i.hasLocalMutations,!0),t.converter))}function n$(t){t=_e(t,Ge);const e=_e(t.firestore,st);return Nk(Nt(e),t._key,{source:"server"}).then(n=>mw(e,t,n))}function r$(t){t=_e(t,un);const e=_e(t.firestore,st),n=Nt(e),r=new Mo(e);return ex(t._query),Dk(n,t._query).then(i=>new vs(e,r,t,i))}function i$(t){t=_e(t,un);const e=_e(t.firestore,st),n=Nt(e),r=new Mo(e);return I3(n,t._query).then(i=>new vs(e,r,t,i))}function s$(t){t=_e(t,un);const e=_e(t.firestore,st),n=Nt(e),r=new Mo(e);return Dk(n,t._query,{source:"server"}).then(i=>new vs(e,r,t,i))}function zS(t,e,n){t=_e(t,Ge);const r=_e(t.firestore,st),i=rm(t.converter,e,n);return cd(r,[Jp(Vo(r),"setDoc",t._key,i,t.converter!==null,n).toMutation(t._key,$e.none())])}function WS(t,e,n,...r){t=_e(t,Ge);const i=_e(t.firestore,st),s=Vo(i);let o;return o=typeof(e=ee(e))=="string"||e instanceof _s?lw(s,"updateDoc",t._key,e,n,r):aw(s,"updateDoc",t._key,e),cd(i,[o.toMutation(t._key,$e.exists(!0))])}function o$(t){return cd(_e(t.firestore,st),[new wl(t._key,$e.none())])}function a$(t,e){const n=_e(t.firestore,st),r=Hf(t),i=rm(t.converter,e);return cd(n,[Jp(Vo(t.firestore),"addDoc",r._key,i,t.converter!==null,{}).toMutation(r._key,$e.exists(!1))]).then(()=>r)}function ix(t,...e){var n,r,i;t=ee(t);let s={includeMetadataChanges:!1,source:"default"},o=0;typeof e[o]!="object"||p_(e[o])||(s=e[o],o++);const a={includeMetadataChanges:s.includeMetadataChanges,source:s.source};if(p_(e[o])){const h=e[o];e[o]=(n=h.next)===null||n===void 0?void 0:n.bind(h),e[o+1]=(r=h.error)===null||r===void 0?void 0:r.bind(h),e[o+2]=(i=h.complete)===null||i===void 0?void 0:i.bind(h)}let l,u,d;if(t instanceof Ge)u=_e(t.firestore,st),d=_l(t._key.path),l={next:h=>{e[o]&&e[o](mw(u,t,h))},error:e[o+1],complete:e[o+2]};else{const h=_e(t,un);u=_e(h.firestore,st),d=h._query;const f=new Mo(u);l={next:g=>{e[o]&&e[o](new vs(u,f,h,g))},error:e[o+1],complete:e[o+2]},ex(t._query)}return function(f,g,_,v){const T=new Hp(v),S=new q0(g,T,_);return f.asyncQueue.enqueueAndForget(async()=>$0(await rl(f),S)),()=>{T.za(),f.asyncQueue.enqueueAndForget(async()=>z0(await rl(f),S))}}(Nt(u),d,a,l)}function l$(t,e){return T3(Nt(t=_e(t,st)),p_(e)?e:{next:e})}function cd(t,e){return function(r,i){const s=new xt;return r.asyncQueue.enqueueAndForget(async()=>J5(await ew(r),i,s)),s.promise}(Nt(t),e)}function mw(t,e,n){const r=n.docs.get(e._key),i=new Mo(t);return new yi(t,i,e._key,r,new eo(n.hasPendingWrites,n.fromCache),e.converter)}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const u$={maxAttempts:5};/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let c$=class{constructor(e,n){this._firestore=e,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=Vo(e)}set(e,n,r){this._verifyNotCommitted();const i=zi(e,this._firestore),s=rm(i.converter,n,r),o=Jp(this._dataReader,"WriteBatch.set",i._key,s,i.converter!==null,r);return this._mutations.push(o.toMutation(i._key,$e.none())),this}update(e,n,r,...i){this._verifyNotCommitted();const s=zi(e,this._firestore);let o;return o=typeof(n=ee(n))=="string"||n instanceof _s?lw(this._dataReader,"WriteBatch.update",s._key,n,r,i):aw(this._dataReader,"WriteBatch.update",s._key,n),this._mutations.push(o.toMutation(s._key,$e.exists(!0))),this}delete(e){this._verifyNotCommitted();const n=zi(e,this._firestore);return this._mutations=this._mutations.concat(new wl(n._key,$e.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new $(M.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}};function zi(t,e){if((t=ee(t)).firestore!==e)throw new $(M.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let d$=class extends class{constructor(n,r){this._firestore=n,this._transaction=r,this._dataReader=Vo(n)}get(n){const r=zi(n,this._firestore),i=new X3(this._firestore);return this._transaction.lookup([r._key]).then(s=>{if(!s||s.length!==1)return Y();const o=s[0];if(o.isFoundDocument())return new kc(this._firestore,i,o.key,o,r.converter);if(o.isNoDocument())return new kc(this._firestore,i,r._key,null,r.converter);throw Y()})}set(n,r,i){const s=zi(n,this._firestore),o=rm(s.converter,r,i),a=Jp(this._dataReader,"Transaction.set",s._key,o,s.converter!==null,i);return this._transaction.set(s._key,a),this}update(n,r,i,...s){const o=zi(n,this._firestore);let a;return a=typeof(r=ee(r))=="string"||r instanceof _s?lw(this._dataReader,"Transaction.update",o._key,r,i,s):aw(this._dataReader,"Transaction.update",o._key,r),this._transaction.update(o._key,a),this}delete(n){const r=zi(n,this._firestore);return this._transaction.delete(r._key),this}}{constructor(e,n){super(e,n),this._firestore=e}get(e){const n=zi(e,this._firestore),r=new Mo(this._firestore);return super.get(e).then(i=>new yi(this._firestore,r,n._key,i._document,new eo(!1,!1),n.converter))}};function h$(t,e,n){t=_e(t,st);const r=Object.assign(Object.assign({},u$),n);return function(s){if(s.maxAttempts<1)throw new $(M.INVALID_ARGUMENT,"Max attempts must be at least 1")}(r),function(s,o,a){const l=new xt;return s.asyncQueue.enqueueAndForget(async()=>{const u=await _3(s);new g3(s.asyncQueue,u,a,o,l).ru()}),l.promise}(Nt(t),i=>e(new d$(t,i)),r)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function f$(){return new ld("deleteField")}function p$(){return new rw("serverTimestamp")}function m$(...t){return new iw("arrayUnion",t)}function g$(...t){return new sw("arrayRemove",t)}function y$(t){return new ow("increment",t)}(function(e,n=!0){(function(i){yl=i})(bs),cs(new Br("firestore",(r,{instanceIdentifier:i,options:s})=>{const o=r.getProvider("app").getImmediate(),a=new st(new Ej(r.getProvider("auth-internal")),new Aj(r.getProvider("app-check-internal")),function(u,d){if(!Object.prototype.hasOwnProperty.apply(u.options,["projectId"]))throw new $(M.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new ps(u.options.projectId,d)}(o,i),o);return s=Object.assign({useFetchStreams:n},s),a._setSettings(s),a},"PUBLIC").setMultipleInstances(!0)),mr(VT,"4.7.2",e),mr(VT,"4.7.2","esm2017")})();const _$="@firebase/firestore-compat",v$="0.3.37";/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function gw(t,e){if(e===void 0)return{merge:!1};if(e.mergeFields!==void 0&&e.merge!==void 0)throw new $("invalid-argument",`Invalid options passed to function ${t}(): You cannot specify both "merge" and "mergeFields".`);return e}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function qS(){if(typeof Uint8Array>"u")throw new $("unimplemented","Uint8Arrays are not available in this environment.")}function HS(){if(!Jj())throw new $("unimplemented","Blobs are unavailable in Firestore in this environment.")}let sx=class g_{constructor(e){this._delegate=e}static fromBase64String(e){return HS(),new g_(Wr.fromBase64String(e))}static fromUint8Array(e){return qS(),new g_(Wr.fromUint8Array(e))}toBase64(){return HS(),this._delegate.toBase64()}toUint8Array(){return qS(),this._delegate.toUint8Array()}isEqual(e){return this._delegate.isEqual(e._delegate)}toString(){return"Blob(base64: "+this.toBase64()+")"}};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function y_(t){return w$(t,["next","error","complete"])}function w$(t,e){if(typeof t!="object"||t===null)return!1;const n=t;for(const r of e)if(r in n&&typeof n[r]=="function")return!0;return!1}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class E${enableIndexedDbPersistence(e,n){return x3(e._delegate,{forceOwnership:n})}enableMultiTabIndexedDbPersistence(e){return O3(e._delegate)}clearIndexedDbPersistence(e){return N3(e._delegate)}}class ox{constructor(e,n,r){this._delegate=n,this._persistenceProvider=r,this.INTERNAL={delete:()=>this.terminate()},e instanceof ps||(this._appCompat=e)}get _databaseId(){return this._delegate._databaseId}settings(e){const n=this._delegate._getSettings();!e.merge&&n.host!==e.host&&_r("You are overriding the original host. If you did not intend to override your settings, use {merge: true}."),e.merge&&(e=Object.assign(Object.assign({},n),e),delete e.merge),this._delegate._setSettings(e)}useEmulator(e,n,r={}){b3(this._delegate,e,n,r)}enableNetwork(){return V3(this._delegate)}disableNetwork(){return L3(this._delegate)}enablePersistence(e){let n=!1,r=!1;return e&&(n=!!e.synchronizeTabs,r=!!e.experimentalForceOwningTab,Lk("synchronizeTabs",n,"experimentalForceOwningTab",r)),n?this._persistenceProvider.enableMultiTabIndexedDbPersistence(this):this._persistenceProvider.enableIndexedDbPersistence(this,r)}clearPersistence(){return this._persistenceProvider.clearIndexedDbPersistence(this)}terminate(){return this._appCompat&&(this._appCompat._removeServiceInstance("firestore-compat"),this._appCompat._removeServiceInstance("firestore")),this._delegate._delete()}waitForPendingWrites(){return D3(this._delegate)}onSnapshotsInSync(e){return l$(this._delegate,e)}get app(){if(!this._appCompat)throw new $("failed-precondition","Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._appCompat}collection(e){try{return new il(this,Bk(this._delegate,e))}catch(n){throw rn(n,"collection()","Firestore.collection()")}}doc(e){try{return new Kn(this,Hf(this._delegate,e))}catch(n){throw rn(n,"doc()","Firestore.doc()")}}collectionGroup(e){try{return new nn(this,R3(this._delegate,e))}catch(n){throw rn(n,"collectionGroup()","Firestore.collectionGroup()")}}runTransaction(e){return h$(this._delegate,n=>e(new ax(this,n)))}batch(){return Nt(this._delegate),new lx(new c$(this._delegate,e=>cd(this._delegate,e)))}loadBundle(e){return M3(this._delegate,e)}namedQuery(e){return F3(this._delegate,e).then(n=>n?new nn(this,n):null)}}class im extends pw{constructor(e){super(),this.firestore=e}convertBytes(e){return new sx(new Wr(e))}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return Kn.forKey(n,this.firestore,null)}}function I$(t){yj(t)}class ax{constructor(e,n){this._firestore=e,this._delegate=n,this._userDataWriter=new im(e)}get(e){const n=to(e);return this._delegate.get(n).then(r=>new xc(this._firestore,new yi(this._firestore._delegate,this._userDataWriter,r._key,r._document,r.metadata,n.converter)))}set(e,n,r){const i=to(e);return r?(gw("Transaction.set",r),this._delegate.set(i,n,r)):this._delegate.set(i,n),this}update(e,n,r,...i){const s=to(e);return arguments.length===2?this._delegate.update(s,n):this._delegate.update(s,n,r,...i),this}delete(e){const n=to(e);return this._delegate.delete(n),this}}class lx{constructor(e){this._delegate=e}set(e,n,r){const i=to(e);return r?(gw("WriteBatch.set",r),this._delegate.set(i,n,r)):this._delegate.set(i,n),this}update(e,n,r,...i){const s=to(e);return arguments.length===2?this._delegate.update(s,n):this._delegate.update(s,n,r,...i),this}delete(e){const n=to(e);return this._delegate.delete(n),this}commit(){return this._delegate.commit()}}class So{constructor(e,n,r){this._firestore=e,this._userDataWriter=n,this._delegate=r}fromFirestore(e,n){const r=new zu(this._firestore._delegate,this._userDataWriter,e._key,e._document,e.metadata,null);return this._delegate.fromFirestore(new Oc(this._firestore,r),n??{})}toFirestore(e,n){return n?this._delegate.toFirestore(e,n):this._delegate.toFirestore(e)}static getInstance(e,n){const r=So.INSTANCES;let i=r.get(e);i||(i=new WeakMap,r.set(e,i));let s=i.get(n);return s||(s=new So(e,new im(e),n),i.set(n,s)),s}}So.INSTANCES=new WeakMap;class Kn{constructor(e,n){this.firestore=e,this._delegate=n,this._userDataWriter=new im(e)}static forPath(e,n,r){if(e.length%2!==0)throw new $("invalid-argument",`Invalid document reference. Document references must have an even number of segments, but ${e.canonicalString()} has ${e.length}`);return new Kn(n,new Ge(n._delegate,r,new K(e)))}static forKey(e,n,r){return new Kn(n,new Ge(n._delegate,r,e))}get id(){return this._delegate.id}get parent(){return new il(this.firestore,this._delegate.parent)}get path(){return this._delegate.path}collection(e){try{return new il(this.firestore,Bk(this._delegate,e))}catch(n){throw rn(n,"collection()","DocumentReference.collection()")}}isEqual(e){return e=ee(e),e instanceof Ge?$k(this._delegate,e):!1}set(e,n){n=gw("DocumentReference.set",n);try{return n?zS(this._delegate,e,n):zS(this._delegate,e)}catch(r){throw rn(r,"setDoc()","DocumentReference.set()")}}update(e,n,...r){try{return arguments.length===1?WS(this._delegate,e):WS(this._delegate,e,n,...r)}catch(i){throw rn(i,"updateDoc()","DocumentReference.update()")}}delete(){return o$(this._delegate)}onSnapshot(...e){const n=ux(e),r=cx(e,i=>new xc(this.firestore,new yi(this.firestore._delegate,this._userDataWriter,i._key,i._document,i.metadata,this._delegate.converter)));return ix(this._delegate,n,r)}get(e){let n;return(e==null?void 0:e.source)==="cache"?n=t$(this._delegate):(e==null?void 0:e.source)==="server"?n=n$(this._delegate):n=e$(this._delegate),n.then(r=>new xc(this.firestore,new yi(this.firestore._delegate,this._userDataWriter,r._key,r._document,r.metadata,this._delegate.converter)))}withConverter(e){return new Kn(this.firestore,e?this._delegate.withConverter(So.getInstance(this.firestore,e)):this._delegate.withConverter(null))}}function rn(t,e,n){return t.message=t.message.replace(e,n),t}function ux(t){for(const e of t)if(typeof e=="object"&&!y_(e))return e;return{}}function cx(t,e){var n,r;let i;return y_(t[0])?i=t[0]:y_(t[1])?i=t[1]:typeof t[0]=="function"?i={next:t[0],error:t[1],complete:t[2]}:i={next:t[1],error:t[2],complete:t[3]},{next:s=>{i.next&&i.next(e(s))},error:(n=i.error)===null||n===void 0?void 0:n.bind(i),complete:(r=i.complete)===null||r===void 0?void 0:r.bind(i)}}class xc{constructor(e,n){this._firestore=e,this._delegate=n}get ref(){return new Kn(this._firestore,this._delegate.ref)}get id(){return this._delegate.id}get metadata(){return this._delegate.metadata}get exists(){return this._delegate.exists()}data(e){return this._delegate.data(e)}get(e,n){return this._delegate.get(e,n)}isEqual(e){return rx(this._delegate,e._delegate)}}class Oc extends xc{data(e){const n=this._delegate.data(e);return this._delegate._converter||_j(n!==void 0),n}}class nn{constructor(e,n){this.firestore=e,this._delegate=n,this._userDataWriter=new im(e)}where(e,n,r){try{return new nn(this.firestore,Di(this._delegate,W3(e,n,r)))}catch(i){throw rn(i,/(orderBy|where)\(\)/,"Query.$1()")}}orderBy(e,n){try{return new nn(this.firestore,Di(this._delegate,q3(e,n)))}catch(r){throw rn(r,/(orderBy|where)\(\)/,"Query.$1()")}}limit(e){try{return new nn(this.firestore,Di(this._delegate,H3(e)))}catch(n){throw rn(n,"limit()","Query.limit()")}}limitToLast(e){try{return new nn(this.firestore,Di(this._delegate,K3(e)))}catch(n){throw rn(n,"limitToLast()","Query.limitToLast()")}}startAt(...e){try{return new nn(this.firestore,Di(this._delegate,G3(...e)))}catch(n){throw rn(n,"startAt()","Query.startAt()")}}startAfter(...e){try{return new nn(this.firestore,Di(this._delegate,Q3(...e)))}catch(n){throw rn(n,"startAfter()","Query.startAfter()")}}endBefore(...e){try{return new nn(this.firestore,Di(this._delegate,Y3(...e)))}catch(n){throw rn(n,"endBefore()","Query.endBefore()")}}endAt(...e){try{return new nn(this.firestore,Di(this._delegate,J3(...e)))}catch(n){throw rn(n,"endAt()","Query.endAt()")}}isEqual(e){return zk(this._delegate,e._delegate)}get(e){let n;return(e==null?void 0:e.source)==="cache"?n=i$(this._delegate):(e==null?void 0:e.source)==="server"?n=s$(this._delegate):n=r$(this._delegate),n.then(r=>new __(this.firestore,new vs(this.firestore._delegate,this._userDataWriter,this._delegate,r._snapshot)))}onSnapshot(...e){const n=ux(e),r=cx(e,i=>new __(this.firestore,new vs(this.firestore._delegate,this._userDataWriter,this._delegate,i._snapshot)));return ix(this._delegate,n,r)}withConverter(e){return new nn(this.firestore,e?this._delegate.withConverter(So.getInstance(this.firestore,e)):this._delegate.withConverter(null))}}class T${constructor(e,n){this._firestore=e,this._delegate=n}get type(){return this._delegate.type}get doc(){return new Oc(this._firestore,this._delegate.doc)}get oldIndex(){return this._delegate.oldIndex}get newIndex(){return this._delegate.newIndex}}class __{constructor(e,n){this._firestore=e,this._delegate=n}get query(){return new nn(this._firestore,this._delegate.query)}get metadata(){return this._delegate.metadata}get size(){return this._delegate.size}get empty(){return this._delegate.empty}get docs(){return this._delegate.docs.map(e=>new Oc(this._firestore,e))}docChanges(e){return this._delegate.docChanges(e).map(n=>new T$(this._firestore,n))}forEach(e,n){this._delegate.forEach(r=>{e.call(n,new Oc(this._firestore,r))})}isEqual(e){return rx(this._delegate,e._delegate)}}class il extends nn{constructor(e,n){super(e,n),this.firestore=e,this._delegate=n}get id(){return this._delegate.id}get path(){return this._delegate.path}get parent(){const e=this._delegate.parent;return e?new Kn(this.firestore,e):null}doc(e){try{return e===void 0?new Kn(this.firestore,Hf(this._delegate)):new Kn(this.firestore,Hf(this._delegate,e))}catch(n){throw rn(n,"doc()","CollectionReference.doc()")}}add(e){return a$(this._delegate,e).then(n=>new Kn(this.firestore,n))}isEqual(e){return $k(this._delegate,e._delegate)}withConverter(e){return new il(this.firestore,e?this._delegate.withConverter(So.getInstance(this.firestore,e)):this._delegate.withConverter(null))}}function to(t){return _e(t,Ge)}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class yw{constructor(...e){this._delegate=new _s(...e)}static documentId(){return new yw(Be.keyField().canonicalString())}isEqual(e){return e=ee(e),e instanceof _s?this._delegate._internalPath.isEqual(e._internalPath):!1}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Gs{constructor(e){this._delegate=e}static serverTimestamp(){const e=p$();return e._methodName="FieldValue.serverTimestamp",new Gs(e)}static delete(){const e=f$();return e._methodName="FieldValue.delete",new Gs(e)}static arrayUnion(...e){const n=m$(...e);return n._methodName="FieldValue.arrayUnion",new Gs(n)}static arrayRemove(...e){const n=g$(...e);return n._methodName="FieldValue.arrayRemove",new Gs(n)}static increment(e){const n=y$(e);return n._methodName="FieldValue.increment",new Gs(n)}isEqual(e){return this._delegate.isEqual(e._delegate)}}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const S$={Firestore:ox,GeoPoint:Qp,Timestamp:ze,Blob:sx,Transaction:ax,WriteBatch:lx,DocumentReference:Kn,DocumentSnapshot:xc,Query:nn,QueryDocumentSnapshot:Oc,QuerySnapshot:__,CollectionReference:il,FieldPath:yw,FieldValue:Gs,setLogLevel:I$,CACHE_SIZE_UNLIMITED:k3};function A$(t,e){t.INTERNAL.registerComponent(new Br("firestore-compat",n=>{const r=n.getProvider("app-compat").getImmediate(),i=n.getProvider("firestore").getImmediate();return e(r,i)},"PUBLIC").setServiceProps(Object.assign({},S$)))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function b$(t){A$(t,(e,n)=>new ox(e,n,new E$)),t.registerVersion(_$,v$)}b$(fl);/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Ao(){return window}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const R$=2e3;async function P$(t,e,n){var r;const{BuildInfo:i}=Ao();yr(e.sessionId,"AuthEvent did not contain a session ID");const s=await N$(e.sessionId),o={};return Kc()?o.ibi=i.packageName:Hc()?o.apn=i.packageName:Ot(t,"operation-not-supported-in-this-environment"),i.displayName&&(o.appDisplayName=i.displayName),o.sessionId=s,qy(t,n,e.type,void 0,(r=e.eventId)!==null&&r!==void 0?r:void 0,o)}async function C$(t){const{BuildInfo:e}=Ao(),n={};Kc()?n.iosBundleId=e.packageName:Hc()?n.androidPackageName=e.packageName:Ot(t,"operation-not-supported-in-this-environment"),await VP(t,n)}function k$(t){const{cordova:e}=Ao();return new Promise(n=>{e.plugins.browsertab.isAvailable(r=>{let i=null;r?e.plugins.browsertab.openUrl(t):i=e.InAppBrowser.open(t,IF()?"_blank":"_system","location=yes"),n(i)})})}async function x$(t,e,n){const{cordova:r}=Ao();let i=()=>{};try{await new Promise((s,o)=>{let a=null;function l(){var h;s();const f=(h=r.plugins.browsertab)===null||h===void 0?void 0:h.close;typeof f=="function"&&f(),typeof(n==null?void 0:n.close)=="function"&&n.close()}function u(){a||(a=window.setTimeout(()=>{o(It(t,"redirect-cancelled-by-user"))},R$))}function d(){(document==null?void 0:document.visibilityState)==="visible"&&u()}e.addPassiveListener(l),document.addEventListener("resume",u,!1),Hc()&&document.addEventListener("visibilitychange",d,!1),i=()=>{e.removePassiveListener(l),document.removeEventListener("resume",u,!1),document.removeEventListener("visibilitychange",d,!1),a&&window.clearTimeout(a)}})}finally{i()}}function O$(t){var e,n,r,i,s,o,a,l,u,d;const h=Ao();q(typeof((e=h==null?void 0:h.universalLinks)===null||e===void 0?void 0:e.subscribe)=="function",t,"invalid-cordova-configuration",{missingPlugin:"cordova-universal-links-plugin-fix"}),q(typeof((n=h==null?void 0:h.BuildInfo)===null||n===void 0?void 0:n.packageName)<"u",t,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-buildInfo"}),q(typeof((s=(i=(r=h==null?void 0:h.cordova)===null||r===void 0?void 0:r.plugins)===null||i===void 0?void 0:i.browsertab)===null||s===void 0?void 0:s.openUrl)=="function",t,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),q(typeof((l=(a=(o=h==null?void 0:h.cordova)===null||o===void 0?void 0:o.plugins)===null||a===void 0?void 0:a.browsertab)===null||l===void 0?void 0:l.isAvailable)=="function",t,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),q(typeof((d=(u=h==null?void 0:h.cordova)===null||u===void 0?void 0:u.InAppBrowser)===null||d===void 0?void 0:d.open)=="function",t,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-inappbrowser"})}async function N$(t){const e=D$(t),n=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(n)).map(i=>i.toString(16).padStart(2,"0")).join("")}function D$(t){if(yr(/[0-9a-zA-Z]+/.test(t),"Can only convert alpha-numeric strings"),typeof TextEncoder<"u")return new TextEncoder().encode(t);const e=new ArrayBuffer(t.length),n=new Uint8Array(e);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const V$=20;class L$ extends NP{constructor(){super(...arguments),this.passiveListeners=new Set,this.initPromise=new Promise(e=>{this.resolveInitialized=e})}addPassiveListener(e){this.passiveListeners.add(e)}removePassiveListener(e){this.passiveListeners.delete(e)}resetRedirect(){this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1}onEvent(e){return this.resolveInitialized(),this.passiveListeners.forEach(n=>n(e)),super.onEvent(e)}async initialized(){await this.initPromise}}function M$(t,e,n=null){return{type:e,eventId:n,urlResponse:null,sessionId:j$(),postBody:null,tenantId:t.tenantId,error:It(t,"no-auth-event")}}function F$(t,e){return v_()._set(w_(t),e)}async function KS(t){const e=await v_()._get(w_(t));return e&&await v_()._remove(w_(t)),e}function U$(t,e){var n,r;const i=$$(e);if(i.includes("/__/auth/callback")){const s=zh(i),o=s.firebaseError?B$(decodeURIComponent(s.firebaseError)):null,a=(r=(n=o==null?void 0:o.code)===null||n===void 0?void 0:n.split("auth/"))===null||r===void 0?void 0:r[1],l=a?It(a):null;return l?{type:t.type,eventId:t.eventId,tenantId:t.tenantId,error:l,urlResponse:null,sessionId:null,postBody:null}:{type:t.type,eventId:t.eventId,tenantId:t.tenantId,sessionId:t.sessionId,urlResponse:i,postBody:null}}return null}function j$(){const t=[],e="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let n=0;n<V$;n++){const r=Math.floor(Math.random()*e.length);t.push(e.charAt(r))}return t.join("")}function v_(){return Nn(xp)}function w_(t){return so("authEvent",t.config.apiKey,t.name)}function B$(t){try{return JSON.parse(t)}catch{return null}}function $$(t){const e=zh(t),n=e.link?decodeURIComponent(e.link):void 0,r=zh(n).link,i=e.deep_link_id?decodeURIComponent(e.deep_link_id):void 0;return zh(i).link||i||r||n||t}function zh(t){if(!(t!=null&&t.includes("?")))return{};const[e,...n]=t.split("?");return ya(n.join("?"))}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const z$=500;class W${constructor(){this._redirectPersistence=ds,this._shouldInitProactively=!0,this.eventManagers=new Map,this.originValidationPromises={},this._completeRedirectFn=Vp,this._overrideRedirectResult=h0}async _initialize(e){const n=e._key();let r=this.eventManagers.get(n);return r||(r=new L$(e),this.eventManagers.set(n,r),this.attachCallbackListeners(e,r)),r}_openPopup(e){Ot(e,"operation-not-supported-in-this-environment")}async _openRedirect(e,n,r,i){O$(e);const s=await this._initialize(e);await s.initialized(),s.resetRedirect(),bU(),await this._originValidation(e);const o=M$(e,r,i);await F$(e,o);const a=await P$(e,o,n),l=await k$(a);return x$(e,s,l)}_isIframeWebStorageSupported(e,n){throw new Error("Method not implemented.")}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=C$(e)),this.originValidationPromises[n]}attachCallbackListeners(e,n){const{universalLinks:r,handleOpenURL:i,BuildInfo:s}=Ao(),o=setTimeout(async()=>{await KS(e),n.onEvent(GS())},z$),a=async d=>{clearTimeout(o);const h=await KS(e);let f=null;h&&(d!=null&&d.url)&&(f=U$(h,d.url)),n.onEvent(f||GS())};typeof r<"u"&&typeof r.subscribe=="function"&&r.subscribe(null,a);const l=i,u=`${s.packageName.toLowerCase()}://`;Ao().handleOpenURL=async d=>{if(d.toLowerCase().startsWith(u)&&a({url:d}),typeof l=="function")try{l(d)}catch(h){console.error(h)}}}}const q$=W$;function GS(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:It("no-auth-event")}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function H$(t,e){rt(t)._logFramework(e)}var K$="@firebase/auth-compat",G$="0.5.14";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Q$=1e3;function Wu(){var t;return((t=self==null?void 0:self.location)===null||t===void 0?void 0:t.protocol)||null}function Y$(){return Wu()==="http:"||Wu()==="https:"}function dx(t=Ye()){return!!((Wu()==="file:"||Wu()==="ionic:"||Wu()==="capacitor:")&&t.toLowerCase().match(/iphone|ipad|ipod|android/))}function J$(){return qv()||Wv()}function X$(){return PR()&&(document==null?void 0:document.documentMode)===11}function Z$(t=Ye()){return/Edge\/\d+/.test(t)}function ez(t=Ye()){return X$()||Z$(t)}function hx(){try{const t=self.localStorage,e=Yc();if(t)return t.setItem(e,"1"),t.removeItem(e),ez()?pc():!0}catch{return _w()&&pc()}return!1}function _w(){return typeof global<"u"&&"WorkerGlobalScope"in global&&"importScripts"in global}function Ng(){return(Y$()||RR()||dx())&&!J$()&&hx()&&!_w()}function fx(){return dx()&&typeof document<"u"}async function tz(){return fx()?new Promise(t=>{const e=setTimeout(()=>{t(!1)},Q$);document.addEventListener("deviceready",()=>{clearTimeout(e),t(!0)})}):!1}function nz(){return typeof window<"u"?window:null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Cn={LOCAL:"local",NONE:"none",SESSION:"session"},su=q,px="persistence";function rz(t,e){if(su(Object.values(Cn).includes(e),t,"invalid-persistence-type"),qv()){su(e!==Cn.SESSION,t,"unsupported-persistence-type");return}if(Wv()){su(e===Cn.NONE,t,"unsupported-persistence-type");return}if(_w()){su(e===Cn.NONE||e===Cn.LOCAL&&pc(),t,"unsupported-persistence-type");return}su(e===Cn.NONE||hx(),t,"unsupported-persistence-type")}async function E_(t){await t._initializationPromise;const e=mx(),n=so(px,t.config.apiKey,t.name);e&&e.setItem(n,t._getPersistence())}function iz(t,e){const n=mx();if(!n)return[];const r=so(px,t,e);switch(n.getItem(r)){case Cn.NONE:return[za];case Cn.LOCAL:return[qa,ds];case Cn.SESSION:return[ds];default:return[]}}function mx(){var t;try{return((t=nz())===null||t===void 0?void 0:t.sessionStorage)||null}catch{return null}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const sz=q;class Gi{constructor(){this.browserResolver=Nn(LP),this.cordovaResolver=Nn(q$),this.underlyingResolver=null,this._redirectPersistence=ds,this._completeRedirectFn=Vp,this._overrideRedirectResult=h0}async _initialize(e){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._initialize(e)}async _openPopup(e,n,r,i){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openPopup(e,n,r,i)}async _openRedirect(e,n,r,i){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openRedirect(e,n,r,i)}_isIframeWebStorageSupported(e,n){this.assertedUnderlyingResolver._isIframeWebStorageSupported(e,n)}_originValidation(e){return this.assertedUnderlyingResolver._originValidation(e)}get _shouldInitProactively(){return fx()||this.browserResolver._shouldInitProactively}get assertedUnderlyingResolver(){return sz(this.underlyingResolver,"internal-error"),this.underlyingResolver}async selectUnderlyingResolver(){if(this.underlyingResolver)return;const e=await tz();this.underlyingResolver=e?this.cordovaResolver:this.browserResolver}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function gx(t){return t.unwrap()}function oz(t){return t.wrapped()}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function az(t){return yx(t)}function lz(t,e){var n;const r=(n=e.customData)===null||n===void 0?void 0:n._tokenResponse;if((e==null?void 0:e.code)==="auth/multi-factor-auth-required"){const i=e;i.resolver=new uz(t,D4(t,e))}else if(r){const i=yx(e),s=e;i&&(s.credential=i,s.tenantId=r.tenantId||void 0,s.email=r.email||void 0,s.phoneNumber=r.phoneNumber||void 0)}}function yx(t){const{_tokenResponse:e}=t instanceof on?t.customData:t;if(!e)return null;if(!(t instanceof on)&&"temporaryProof"in e&&"phoneNumber"in e)return mo.credentialFromResult(t);const n=e.providerId;if(!n||n===Zl.PASSWORD)return null;let r;switch(n){case Zl.GOOGLE:r=Pr;break;case Zl.FACEBOOK:r=Rr;break;case Zl.GITHUB:r=Cr;break;case Zl.TWITTER:r=kr;break;default:const{oauthIdToken:i,oauthAccessToken:s,oauthTokenSecret:o,pendingToken:a,nonce:l}=e;return!s&&!o&&!i&&!a?null:a?n.startsWith("saml.")?Wa._create(n,a):$r._fromParams({providerId:n,signInMethod:n,pendingToken:a,idToken:i,accessToken:s}):new Ra(n).credential({idToken:i,accessToken:s,rawNonce:l})}return t instanceof on?r.credentialFromError(t):r.credentialFromResult(t)}function fn(t,e){return e.catch(n=>{throw n instanceof on&&lz(t,n),n}).then(n=>{const r=n.operationType,i=n.user;return{operationType:r,credential:az(n),additionalUserInfo:x4(n),user:ai.getOrCreate(i)}})}async function I_(t,e){const n=await e;return{verificationId:n.verificationId,confirm:r=>fn(t,n.confirm(r))}}class uz{constructor(e,n){this.resolver=n,this.auth=oz(e)}get session(){return this.resolver.session}get hints(){return this.resolver.hints}resolveSignIn(e){return fn(gx(this.auth),this.resolver.resolveSignIn(e))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ai{constructor(e){this._delegate=e,this.multiFactor=F4(e)}static getOrCreate(e){return ai.USER_MAP.has(e)||ai.USER_MAP.set(e,new ai(e)),ai.USER_MAP.get(e)}delete(){return this._delegate.delete()}reload(){return this._delegate.reload()}toJSON(){return this._delegate.toJSON()}getIdTokenResult(e){return this._delegate.getIdTokenResult(e)}getIdToken(e){return this._delegate.getIdToken(e)}linkAndRetrieveDataWithCredential(e){return this.linkWithCredential(e)}async linkWithCredential(e){return fn(this.auth,mP(this._delegate,e))}async linkWithPhoneNumber(e,n){return I_(this.auth,fU(this._delegate,e,n))}async linkWithPopup(e){return fn(this.auth,IU(this._delegate,e,Gi))}async linkWithRedirect(e){return await E_(rt(this.auth)),xU(this._delegate,e,Gi)}reauthenticateAndRetrieveDataWithCredential(e){return this.reauthenticateWithCredential(e)}async reauthenticateWithCredential(e){return fn(this.auth,gP(this._delegate,e))}reauthenticateWithPhoneNumber(e,n){return I_(this.auth,pU(this._delegate,e,n))}reauthenticateWithPopup(e){return fn(this.auth,EU(this._delegate,e,Gi))}async reauthenticateWithRedirect(e){return await E_(rt(this.auth)),CU(this._delegate,e,Gi)}sendEmailVerification(e){return w4(this._delegate,e)}async unlink(e){return await l4(this._delegate,e),this}updateEmail(e){return S4(this._delegate,e)}updatePassword(e){return A4(this._delegate,e)}updatePhoneNumber(e){return mU(this._delegate,e)}updateProfile(e){return T4(this._delegate,e)}verifyBeforeUpdateEmail(e,n){return E4(this._delegate,e,n)}get emailVerified(){return this._delegate.emailVerified}get isAnonymous(){return this._delegate.isAnonymous}get metadata(){return this._delegate.metadata}get phoneNumber(){return this._delegate.phoneNumber}get providerData(){return this._delegate.providerData}get refreshToken(){return this._delegate.refreshToken}get tenantId(){return this._delegate.tenantId}get displayName(){return this._delegate.displayName}get email(){return this._delegate.email}get photoURL(){return this._delegate.photoURL}get providerId(){return this._delegate.providerId}get uid(){return this._delegate.uid}get auth(){return this._delegate.auth}}ai.USER_MAP=new WeakMap;/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ou=q;let T_=class{constructor(e,n){if(this.app=e,n.isInitialized()){this._delegate=n.getImmediate(),this.linkUnderlyingAuth();return}const{apiKey:r}=e.options;ou(r,"invalid-api-key",{appName:e.name}),ou(r,"invalid-api-key",{appName:e.name});const i=typeof window<"u"?Gi:void 0;this._delegate=n.initialize({options:{persistence:cz(r,e.name),popupRedirectResolver:i}}),this._delegate._updateErrorMap(tF),this.linkUnderlyingAuth()}get emulatorConfig(){return this._delegate.emulatorConfig}get currentUser(){return this._delegate.currentUser?ai.getOrCreate(this._delegate.currentUser):null}get languageCode(){return this._delegate.languageCode}set languageCode(e){this._delegate.languageCode=e}get settings(){return this._delegate.settings}get tenantId(){return this._delegate.tenantId}set tenantId(e){this._delegate.tenantId=e}useDeviceLanguage(){this._delegate.useDeviceLanguage()}signOut(){return this._delegate.signOut()}useEmulator(e,n){aP(this._delegate,e,n)}applyActionCode(e){return f4(this._delegate,e)}checkActionCode(e){return yP(this._delegate,e)}confirmPasswordReset(e,n){return h4(this._delegate,e,n)}async createUserWithEmailAndPassword(e,n){return fn(this._delegate,_P(this._delegate,e,n))}fetchProvidersForEmail(e){return this.fetchSignInMethodsForEmail(e)}fetchSignInMethodsForEmail(e){return v4(this._delegate,e)}isSignInWithEmailLink(e){return g4(this._delegate,e)}async getRedirectResult(){ou(Ng(),this._delegate,"operation-not-supported-in-this-environment");const e=await NU(this._delegate,Gi);return e?fn(this._delegate,Promise.resolve(e)):{credential:null,user:null}}addFrameworkForLogging(e){H$(this._delegate,e)}onAuthStateChanged(e,n,r){const{next:i,error:s,complete:o}=QS(e,n,r);return this._delegate.onAuthStateChanged(i,s,o)}onIdTokenChanged(e,n,r){const{next:i,error:s,complete:o}=QS(e,n,r);return this._delegate.onIdTokenChanged(i,s,o)}sendSignInLinkToEmail(e,n){return m4(this._delegate,e,n)}sendPasswordResetEmail(e,n){return d4(this._delegate,e,n||void 0)}async setPersistence(e){rz(this._delegate,e);let n;switch(e){case Cn.SESSION:n=ds;break;case Cn.LOCAL:n=await Nn(qa)._isAvailable()?qa:xp;break;case Cn.NONE:n=za;break;default:return Ot("argument-error",{appName:this._delegate.name})}return this._delegate.setPersistence(n)}signInAndRetrieveDataWithCredential(e){return this.signInWithCredential(e)}signInAnonymously(){return fn(this._delegate,a4(this._delegate))}signInWithCredential(e){return fn(this._delegate,Cp(this._delegate,e))}signInWithCustomToken(e){return fn(this._delegate,c4(this._delegate,e))}signInWithEmailAndPassword(e,n){return fn(this._delegate,vP(this._delegate,e,n))}signInWithEmailLink(e,n){return fn(this._delegate,y4(this._delegate,e,n))}signInWithPhoneNumber(e,n){return I_(this._delegate,hU(this._delegate,e,n))}async signInWithPopup(e){return ou(Ng(),this._delegate,"operation-not-supported-in-this-environment"),fn(this._delegate,wU(this._delegate,e,Gi))}async signInWithRedirect(e){return ou(Ng(),this._delegate,"operation-not-supported-in-this-environment"),await E_(this._delegate),RU(this._delegate,e,Gi)}updateCurrentUser(e){return this._delegate.updateCurrentUser(e)}verifyPasswordResetCode(e){return p4(this._delegate,e)}unwrap(){return this._delegate}_delete(){return this._delegate._delete()}linkUnderlyingAuth(){this._delegate.wrapped=()=>this}};T_.Persistence=Cn;function QS(t,e,n){let r=t;typeof t!="function"&&({next:r,error:e,complete:n}=t);const i=r;return{next:o=>i(o&&ai.getOrCreate(o)),error:e,complete:n}}function cz(t,e){const n=iz(t,e);if(typeof self<"u"&&!n.includes(qa)&&n.push(qa),typeof window<"u")for(const r of[xp,ds])n.includes(r)||n.push(r);return n.includes(za)||n.push(za),n}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class vw{constructor(){this.providerId="phone",this._delegate=new mo(gx(fl.auth()))}static credential(e,n){return mo.credential(e,n)}verifyPhoneNumber(e,n){return this._delegate.verifyPhoneNumber(e,n)}unwrap(){return this._delegate}}vw.PHONE_SIGN_IN_METHOD=mo.PHONE_SIGN_IN_METHOD;vw.PROVIDER_ID=mo.PROVIDER_ID;/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const dz=q;class hz{constructor(e,n,r=fl.app()){var i;dz((i=r.options)===null||i===void 0?void 0:i.apiKey,"invalid-api-key",{appName:r.name}),this._delegate=new cU(r.auth(),e,n),this.type=this._delegate.type}clear(){this._delegate.clear()}render(){return this._delegate.render()}verify(){return this._delegate.verify()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const fz="auth-compat";function pz(t){t.INTERNAL.registerComponent(new Br(fz,e=>{const n=e.getProvider("app-compat").getImmediate(),r=e.getProvider("auth");return new T_(n,r)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:Wo.EMAIL_SIGNIN,PASSWORD_RESET:Wo.PASSWORD_RESET,RECOVER_EMAIL:Wo.RECOVER_EMAIL,REVERT_SECOND_FACTOR_ADDITION:Wo.REVERT_SECOND_FACTOR_ADDITION,VERIFY_AND_CHANGE_EMAIL:Wo.VERIFY_AND_CHANGE_EMAIL,VERIFY_EMAIL:Wo.VERIFY_EMAIL}},EmailAuthProvider:Rs,FacebookAuthProvider:Rr,GithubAuthProvider:Cr,GoogleAuthProvider:Pr,OAuthProvider:Ra,SAMLAuthProvider:xf,PhoneAuthProvider:vw,PhoneMultiFactorGenerator:MP,RecaptchaVerifier:hz,TwitterAuthProvider:kr,Auth:T_,AuthCredential:ml,Error:on}).setInstantiationMode("LAZY").setMultipleInstances(!1)),t.registerVersion(K$,G$)}pz(fl);const mz={apiKey:"AIzaSyBFn4AtVdaO5wBmidvBV7J85Dx7VALkSXU",authDomain:"clone-ec584.firebaseapp.com",projectId:"clone-ec584",storageBucket:"clone-ec584.appspot.com",messagingSenderId:"458930854589",appId:"1:458930854589:web:a6811b07aeec67a41675d4"},_x=fl.initializeApp(mz),Gf=mj(_x),vx=_x.firestore();function gz(){const[{user:t,basket:e},n]=F.useContext(wi),r=e==null?void 0:e.reduce((i,s)=>s.amount+i,0);return C.jsx(C.Fragment,{children:C.jsxs("section",{className:$n.fixed,children:[C.jsx("section",{children:C.jsxs("div",{className:$n.header_container,children:[C.jsxs("div",{className:$n.logo_container,children:[C.jsx(ei,{to:"/",children:C.jsx("img",{src:qV,alt:"amazon logo"})}),C.jsxs("div",{className:$n.delivery,children:[C.jsx("span",{children:C.jsx(uL,{})}),C.jsxs("div",{children:[C.jsx("p",{children:"Deliver to"}),C.jsx("span",{children:"Ethiopia"})]})]})]}),C.jsxs("div",{className:$n.search,children:[C.jsxs("select",{name:"",id:"",style:{width:60},children:[C.jsx("option",{value:"",children:"All"}),C.jsx("option",{value:"",children:"All Departments"}),C.jsx("option",{value:"",children:"Arts & Carfts"}),C.jsx("option",{value:"",children:"Automotive"}),C.jsx("option",{value:"",children:"Baby"}),C.jsx("option",{value:"",children:"Beauty & Personal Care"}),C.jsx("option",{value:"",children:"Books"}),C.jsx("option",{value:"",children:"Boy's Fashion"}),C.jsx("option",{value:"",children:"Computer"}),C.jsx("option",{value:"",children:"Deals"}),C.jsx("option",{value:"",children:"Digital Music"}),C.jsx("option",{value:"",children:"Electronic"})]}),C.jsx("input",{type:"text",name:"",id:"",placeholder:"Search Amazon"}),C.jsx(cL,{size:38})]}),C.jsxs("div",{className:$n.order_container,children:[C.jsxs(ei,{to:"",className:$n.language,children:[C.jsx("img",{src:"https://upload.wikimedia.org/wikipedia/en/thumb/a/a4/Flag_of_the_United_States.svg/1024px-Flag_of_the_United_States.svg.png",alt:""}),C.jsx("select",{name:"",id:"",children:C.jsx("option",{value:"",children:"EN"})})]}),C.jsx(ei,{to:!t&&"/auth",children:C.jsx("div",{children:t?C.jsxs(C.Fragment,{children:[C.jsxs("p",{children:["Hello ",t==null?void 0:t.email.split("@")[0]]}),C.jsx("span",{onClick:()=>Gf.signOut(),children:"Sign Out"})]}):C.jsxs(C.Fragment,{children:[C.jsx("p",{children:"Hello, Sign in"}),C.jsxs("span",{children:[" ",C.jsx("div",{children:C.jsx("span",{className:$n.TheFont,children:"Account & Lists"})})]})]})})}),C.jsxs(ei,{to:"/orders",children:[C.jsx("p",{children:"Returns"}),C.jsx("span",{className:$n.TheFont,children:"& Orders"})]}),C.jsx(ei,{to:"/cart",className:$n.cart,children:C.jsxs("div",{className:$n.margin,children:[C.jsx(dL,{size:35}),"cart",C.jsx("span",{children:r})]})})]})]})}),C.jsx(fL,{})]})})}function Al({children:t}){return C.jsxs("div",{children:[C.jsx(gz,{}),t]})}var wx={exports:{}};/*! @preserve * numeral.js * version : 2.0.6 * author : Adam Draper * license : MIT * http://adamwdraper.github.com/Numeral-js/ */(function(t){(function(e,n){t.exports?t.exports=n():e.numeral=n()})(H_,function(){var e,n,r="2.0.6",i={},s={},o={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},a={currentLocale:o.currentLocale,zeroFormat:o.zeroFormat,nullFormat:o.nullFormat,defaultFormat:o.defaultFormat,scalePercentBy100:o.scalePercentBy100};function l(u,d){this._input=u,this._value=d}return e=function(u){var d,h,f,g;if(e.isNumeral(u))d=u.value();else if(u===0||typeof u>"u")d=0;else if(u===null||n.isNaN(u))d=null;else if(typeof u=="string")if(a.zeroFormat&&u===a.zeroFormat)d=0;else if(a.nullFormat&&u===a.nullFormat||!u.replace(/[^0-9]+/g,"").length)d=null;else{for(h in i)if(g=typeof i[h].regexps.unformat=="function"?i[h].regexps.unformat():i[h].regexps.unformat,g&&u.match(g)){f=i[h].unformat;break}f=f||e._.stringToNumber,d=f(u)}else d=Number(u)||null;return new l(u,d)},e.version=r,e.isNumeral=function(u){return u instanceof l},e._=n={numberToFormat:function(u,d,h){var f=s[e.options.currentLocale],g=!1,_=!1,v=0,T="",S=1e12,w=1e9,E=1e6,x=1e3,O="",D=!1,A,I,m,R,k,N,P;if(u=u||0,I=Math.abs(u),e._.includes(d,"(")?(g=!0,d=d.replace(/[\(|\)]/g,"")):(e._.includes(d,"+")||e._.includes(d,"-"))&&(k=e._.includes(d,"+")?d.indexOf("+"):u<0?d.indexOf("-"):-1,d=d.replace(/[\+|\-]/g,"")),e._.includes(d,"a")&&(A=d.match(/a(k|m|b|t)?/),A=A?A[1]:!1,e._.includes(d," a")&&(T=" "),d=d.replace(new RegExp(T+"a[kmbt]?"),""),I>=S&&!A||A==="t"?(T+=f.abbreviations.trillion,u=u/S):I<S&&I>=w&&!A||A==="b"?(T+=f.abbreviations.billion,u=u/w):I<w&&I>=E&&!A||A==="m"?(T+=f.abbreviations.million,u=u/E):(I<E&&I>=x&&!A||A==="k")&&(T+=f.abbreviations.thousand,u=u/x)),e._.includes(d,"[.]")&&(_=!0,d=d.replace("[.]",".")),m=u.toString().split(".")[0],R=d.split(".")[1],N=d.indexOf(","),v=(d.split(".")[0].split(",")[0].match(/0/g)||[]).length,R?(e._.includes(R,"[")?(R=R.replace("]",""),R=R.split("["),O=e._.toFixed(u,R[0].length+R[1].length,h,R[1].length)):O=e._.toFixed(u,R.length,h),m=O.split(".")[0],e._.includes(O,".")?O=f.delimiters.decimal+O.split(".")[1]:O="",_&&Number(O.slice(1))===0&&(O="")):m=e._.toFixed(u,0,h),T&&!A&&Number(m)>=1e3&&T!==f.abbreviations.trillion)switch(m=String(Number(m)/1e3),T){case f.abbreviations.thousand:T=f.abbreviations.million;break;case f.abbreviations.million:T=f.abbreviations.billion;break;case f.abbreviations.billion:T=f.abbreviations.trillion;break}if(e._.includes(m,"-")&&(m=m.slice(1),D=!0),m.length<v)for(var he=v-m.length;he>0;he--)m="0"+m;return N>-1&&(m=m.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+f.delimiters.thousands)),d.indexOf(".")===0&&(m=""),P=m+O+(T||""),g?P=(g&&D?"(":"")+P+(g&&D?")":""):k>=0?P=k===0?(D?"-":"+")+P:P+(D?"-":"+"):D&&(P="-"+P),P},stringToNumber:function(u){var d=s[a.currentLocale],h=u,f={thousand:3,million:6,billion:9,trillion:12},g,_,v;if(a.zeroFormat&&u===a.zeroFormat)_=0;else if(a.nullFormat&&u===a.nullFormat||!u.replace(/[^0-9]+/g,"").length)_=null;else{_=1,d.delimiters.decimal!=="."&&(u=u.replace(/\./g,"").replace(d.delimiters.decimal,"."));for(g in f)if(v=new RegExp("[^a-zA-Z]"+d.abbreviations[g]+"(?:\\)|(\\"+d.currency.symbol+")?(?:\\))?)?$"),h.match(v)){_*=Math.pow(10,f[g]);break}_*=(u.split("-").length+Math.min(u.split("(").length-1,u.split(")").length-1))%2?1:-1,u=u.replace(/[^0-9\.]+/g,""),_*=Number(u)}return _},isNaN:function(u){return typeof u=="number"&&isNaN(u)},includes:function(u,d){return u.indexOf(d)!==-1},insert:function(u,d,h){return u.slice(0,h)+d+u.slice(h)},reduce:function(u,d){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof d!="function")throw new TypeError(d+" is not a function");var h=Object(u),f=h.length>>>0,g=0,_;if(arguments.length===3)_=arguments[2];else{for(;g<f&&!(g in h);)g++;if(g>=f)throw new TypeError("Reduce of empty array with no initial value");_=h[g++]}for(;g<f;g++)g in h&&(_=d(_,h[g],g,h));return _},multiplier:function(u){var d=u.toString().split(".");return d.length<2?1:Math.pow(10,d[1].length)},correctionFactor:function(){var u=Array.prototype.slice.call(arguments);return u.reduce(function(d,h){var f=n.multiplier(h);return d>f?d:f},1)},toFixed:function(u,d,h,f){var g=u.toString().split("."),_=d-(f||0),v,T,S,w;return g.length===2?v=Math.min(Math.max(g[1].length,_),d):v=_,S=Math.pow(10,v),w=(h(u+"e+"+v)/S).toFixed(v),f>d-v&&(T=new RegExp("\\.?0{1,"+(f-(d-v))+"}$"),w=w.replace(T,"")),w}},e.options=a,e.formats=i,e.locales=s,e.locale=function(u){return u&&(a.currentLocale=u.toLowerCase()),a.currentLocale},e.localeData=function(u){if(!u)return s[a.currentLocale];if(u=u.toLowerCase(),!s[u])throw new Error("Unknown locale : "+u);return s[u]},e.reset=function(){for(var u in o)a[u]=o[u]},e.zeroFormat=function(u){a.zeroFormat=typeof u=="string"?u:null},e.nullFormat=function(u){a.nullFormat=typeof u=="string"?u:null},e.defaultFormat=function(u){a.defaultFormat=typeof u=="string"?u:"0.0"},e.register=function(u,d,h){if(d=d.toLowerCase(),this[u+"s"][d])throw new TypeError(d+" "+u+" already registered.");return this[u+"s"][d]=h,h},e.validate=function(u,d){var h,f,g,_,v,T,S,w;if(typeof u!="string"&&(u+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",u)),u=u.trim(),u.match(/^\d+$/))return!0;if(u==="")return!1;try{S=e.localeData(d)}catch{S=e.localeData(e.locale())}return g=S.currency.symbol,v=S.abbreviations,h=S.delimiters.decimal,S.delimiters.thousands==="."?f="\\.":f=S.delimiters.thousands,w=u.match(/^[^\d]+/),w!==null&&(u=u.substr(1),w[0]!==g)||(w=u.match(/[^\d]+$/),w!==null&&(u=u.slice(0,-1),w[0]!==v.thousand&&w[0]!==v.million&&w[0]!==v.billion&&w[0]!==v.trillion))?!1:(T=new RegExp(f+"{2}"),u.match(/[^\d.,]/g)?!1:(_=u.split(h),_.length>2?!1:_.length<2?!!_[0].match(/^\d+.*\d$/)&&!_[0].match(T):_[0].length===1?!!_[0].match(/^\d+$/)&&!_[0].match(T)&&!!_[1].match(/^\d+$/):!!_[0].match(/^\d+.*\d$/)&&!_[0].match(T)&&!!_[1].match(/^\d+$/)))},e.fn=l.prototype={clone:function(){return e(this)},format:function(u,d){var h=this._value,f=u||a.defaultFormat,g,_,v;if(d=d||Math.round,h===0&&a.zeroFormat!==null)_=a.zeroFormat;else if(h===null&&a.nullFormat!==null)_=a.nullFormat;else{for(g in i)if(f.match(i[g].regexps.format)){v=i[g].format;break}v=v||e._.numberToFormat,_=v(h,f,d)}return _},value:function(){return this._value},input:function(){return this._input},set:function(u){return this._value=Number(u),this},add:function(u){var d=n.correctionFactor.call(null,this._value,u);function h(f,g,_,v){return f+Math.round(d*g)}return this._value=n.reduce([this._value,u],h,0)/d,this},subtract:function(u){var d=n.correctionFactor.call(null,this._value,u);function h(f,g,_,v){return f-Math.round(d*g)}return this._value=n.reduce([u],h,Math.round(this._value*d))/d,this},multiply:function(u){function d(h,f,g,_){var v=n.correctionFactor(h,f);return Math.round(h*v)*Math.round(f*v)/Math.round(v*v)}return this._value=n.reduce([this._value,u],d,1),this},divide:function(u){function d(h,f,g,_){var v=n.correctionFactor(h,f);return Math.round(h*v)/Math.round(f*v)}return this._value=n.reduce([this._value,u],d),this},difference:function(u){return Math.abs(e(this._value).subtract(u).value())}},e.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(u){var d=u%10;return~~(u%100/10)===1?"th":d===1?"st":d===2?"nd":d===3?"rd":"th"},currency:{symbol:"$"}}),function(){e.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(u,d,h){var f=e._.includes(d," BPS")?" ":"",g;return u=u*1e4,d=d.replace(/\s?BPS/,""),g=e._.numberToFormat(u,d,h),e._.includes(g,")")?(g=g.split(""),g.splice(-1,0,f+"BPS"),g=g.join("")):g=g+f+"BPS",g},unformat:function(u){return+(e._.stringToNumber(u)*1e-4).toFixed(15)}})}(),function(){var u={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},d={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},h=u.suffixes.concat(d.suffixes.filter(function(g){return u.suffixes.indexOf(g)<0})),f=h.join("|");f="("+f.replace("B","B(?!PS)")+")",e.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(f)},format:function(g,_,v){var T,S=e._.includes(_,"ib")?d:u,w=e._.includes(_," b")||e._.includes(_," ib")?" ":"",E,x,O;for(_=_.replace(/\s?i?b/,""),E=0;E<=S.suffixes.length;E++)if(x=Math.pow(S.base,E),O=Math.pow(S.base,E+1),g===null||g===0||g>=x&&g<O){w+=S.suffixes[E],x>0&&(g=g/x);break}return T=e._.numberToFormat(g,_,v),T+w},unformat:function(g){var _=e._.stringToNumber(g),v,T;if(_){for(v=u.suffixes.length-1;v>=0;v--){if(e._.includes(g,u.suffixes[v])){T=Math.pow(u.base,v);break}if(e._.includes(g,d.suffixes[v])){T=Math.pow(d.base,v);break}}_*=T||1}return _}})}(),function(){e.register("format","currency",{regexps:{format:/(\$)/},format:function(u,d,h){var f=e.locales[e.options.currentLocale],g={before:d.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:d.match(/([\+|\-|\)|\s|\$]*)$/)[0]},_,v,T;for(d=d.replace(/\s?\$\s?/,""),_=e._.numberToFormat(u,d,h),u>=0?(g.before=g.before.replace(/[\-\(]/,""),g.after=g.after.replace(/[\-\)]/,"")):u<0&&!e._.includes(g.before,"-")&&!e._.includes(g.before,"(")&&(g.before="-"+g.before),T=0;T<g.before.length;T++)switch(v=g.before[T],v){case"$":_=e._.insert(_,f.currency.symbol,T);break;case" ":_=e._.insert(_," ",T+f.currency.symbol.length-1);break}for(T=g.after.length-1;T>=0;T--)switch(v=g.after[T],v){case"$":_=T===g.after.length-1?_+f.currency.symbol:e._.insert(_,f.currency.symbol,-(g.after.length-(1+T)));break;case" ":_=T===g.after.length-1?_+" ":e._.insert(_," ",-(g.after.length-(1+T)+f.currency.symbol.length-1));break}return _}})}(),function(){e.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(u,d,h){var f,g=typeof u=="number"&&!e._.isNaN(u)?u.toExponential():"0e+0",_=g.split("e");return d=d.replace(/e[\+|\-]{1}0/,""),f=e._.numberToFormat(Number(_[0]),d,h),f+"e"+_[1]},unformat:function(u){var d=e._.includes(u,"e+")?u.split("e+"):u.split("e-"),h=Number(d[0]),f=Number(d[1]);f=e._.includes(u,"e-")?f*=-1:f;function g(_,v,T,S){var w=e._.correctionFactor(_,v),E=_*w*(v*w)/(w*w);return E}return e._.reduce([h,Math.pow(10,f)],g,1)}})}(),function(){e.register("format","ordinal",{regexps:{format:/(o)/},format:function(u,d,h){var f=e.locales[e.options.currentLocale],g,_=e._.includes(d," o")?" ":"";return d=d.replace(/\s?o/,""),_+=f.ordinal(u),g=e._.numberToFormat(u,d,h),g+_}})}(),function(){e.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(u,d,h){var f=e._.includes(d," %")?" ":"",g;return e.options.scalePercentBy100&&(u=u*100),d=d.replace(/\s?\%/,""),g=e._.numberToFormat(u,d,h),e._.includes(g,")")?(g=g.split(""),g.splice(-1,0,f+"%"),g=g.join("")):g=g+f+"%",g},unformat:function(u){var d=e._.stringToNumber(u);return e.options.scalePercentBy100?d*.01:d}})}(),function(){e.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(u,d,h){var f=Math.floor(u/60/60),g=Math.floor((u-f*60*60)/60),_=Math.round(u-f*60*60-g*60);return f+":"+(g<10?"0"+g:g)+":"+(_<10?"0"+_:_)},unformat:function(u){var d=u.split(":"),h=0;return d.length===3?(h=h+Number(d[0])*60*60,h=h+Number(d[1])*60,h=h+Number(d[2])):d.length===2&&(h=h+Number(d[0])*60,h=h+Number(d[1])),Number(h)}})}(),e})})(wx);var yz=wx.exports;const _z=K_(yz);function ww({amount:t}){const e=_z(t).format("$0,0.00");return C.jsx("div",{children:e})}const Nc={black:"#000",white:"#fff"},Qo={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},Yo={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},Jo={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},Xo={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},Zo={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},au={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},vz={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};function bo(t){let e="https://mui.com/production-error/?code="+t;for(let n=1;n<arguments.length;n+=1)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified MUI error #"+t+"; visit "+e+" for the full message."}const wz="$$material";function S_(){return S_=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},S_.apply(null,arguments)}function Ex(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var Ez=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Iz=Ex(function(t){return Ez.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),Tz=!1;function Sz(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function Az(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var bz=function(){function t(n){var r=this;this._insertTag=function(i){var s;r.tags.length===0?r.insertionPoint?s=r.insertionPoint.nextSibling:r.prepend?s=r.container.firstChild:s=r.before:s=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(i,s),r.tags.push(i)},this.isSpeedy=n.speedy===void 0?!Tz:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(r){r.forEach(this._insertTag)},e.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Az(this));var i=this.tags[this.tags.length-1];if(this.isSpeedy){var s=Sz(i);try{s.insertRule(r,s.cssRules.length)}catch{}}else i.appendChild(document.createTextNode(r));this.ctr++},e.flush=function(){this.tags.forEach(function(r){var i;return(i=r.parentNode)==null?void 0:i.removeChild(r)}),this.tags=[],this.ctr=0},t}(),Kt="-ms-",Qf="-moz-",we="-webkit-",Ix="comm",Ew="rule",Iw="decl",Rz="@import",Tx="@keyframes",Pz="@layer",Cz=Math.abs,sm=String.fromCharCode,kz=Object.assign;function xz(t,e){return Mt(t,0)^45?(((e<<2^Mt(t,0))<<2^Mt(t,1))<<2^Mt(t,2))<<2^Mt(t,3):0}function Sx(t){return t.trim()}function Oz(t,e){return(t=e.exec(t))?t[0]:t}function Ee(t,e,n){return t.replace(e,n)}function A_(t,e){return t.indexOf(e)}function Mt(t,e){return t.charCodeAt(e)|0}function Dc(t,e,n){return t.slice(e,n)}function Sr(t){return t.length}function Tw(t){return t.length}function lh(t,e){return e.push(t),t}function Nz(t,e){return t.map(e).join("")}var om=1,sl=1,Ax=0,Sn=0,gt=0,bl="";function am(t,e,n,r,i,s,o){return{value:t,root:e,parent:n,type:r,props:i,children:s,line:om,column:sl,length:o,return:""}}function lu(t,e){return kz(am("",null,null,"",null,null,0),t,{length:-t.length},e)}function Dz(){return gt}function Vz(){return gt=Sn>0?Mt(bl,--Sn):0,sl--,gt===10&&(sl=1,om--),gt}function Vn(){return gt=Sn<Ax?Mt(bl,Sn++):0,sl++,gt===10&&(sl=1,om++),gt}function jr(){return Mt(bl,Sn)}function Wh(){return Sn}function dd(t,e){return Dc(bl,t,e)}function Vc(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function bx(t){return om=sl=1,Ax=Sr(bl=t),Sn=0,[]}function Rx(t){return bl="",t}function qh(t){return Sx(dd(Sn-1,b_(t===91?t+2:t===40?t+1:t)))}function Lz(t){for(;(gt=jr())&><33;)Vn();return Vc(t)>2||Vc(gt)>3?"":" "}function Mz(t,e){for(;--e&&Vn()&&!(gt<48||gt>102||gt>57&><65||gt>70&><97););return dd(t,Wh()+(e<6&&jr()==32&&Vn()==32))}function b_(t){for(;Vn();)switch(gt){case t:return Sn;case 34:case 39:t!==34&&t!==39&&b_(gt);break;case 40:t===41&&b_(t);break;case 92:Vn();break}return Sn}function Fz(t,e){for(;Vn()&&t+gt!==57;)if(t+gt===84&&jr()===47)break;return"/*"+dd(e,Sn-1)+"*"+sm(t===47?t:Vn())}function Uz(t){for(;!Vc(jr());)Vn();return dd(t,Sn)}function jz(t){return Rx(Hh("",null,null,null,[""],t=bx(t),0,[0],t))}function Hh(t,e,n,r,i,s,o,a,l){for(var u=0,d=0,h=o,f=0,g=0,_=0,v=1,T=1,S=1,w=0,E="",x=i,O=s,D=r,A=E;T;)switch(_=w,w=Vn()){case 40:if(_!=108&&Mt(A,h-1)==58){A_(A+=Ee(qh(w),"&","&\f"),"&\f")!=-1&&(S=-1);break}case 34:case 39:case 91:A+=qh(w);break;case 9:case 10:case 13:case 32:A+=Lz(_);break;case 92:A+=Mz(Wh()-1,7);continue;case 47:switch(jr()){case 42:case 47:lh(Bz(Fz(Vn(),Wh()),e,n),l);break;default:A+="/"}break;case 123*v:a[u++]=Sr(A)*S;case 125*v:case 59:case 0:switch(w){case 0:case 125:T=0;case 59+d:S==-1&&(A=Ee(A,/\f/g,"")),g>0&&Sr(A)-h&&lh(g>32?JS(A+";",r,n,h-1):JS(Ee(A," ","")+";",r,n,h-2),l);break;case 59:A+=";";default:if(lh(D=YS(A,e,n,u,d,i,a,E,x=[],O=[],h),s),w===123)if(d===0)Hh(A,e,D,D,x,s,h,a,O);else switch(f===99&&Mt(A,3)===110?100:f){case 100:case 108:case 109:case 115:Hh(t,D,D,r&&lh(YS(t,D,D,0,0,i,a,E,i,x=[],h),O),i,O,h,a,r?x:O);break;default:Hh(A,D,D,D,[""],O,0,a,O)}}u=d=g=0,v=S=1,E=A="",h=o;break;case 58:h=1+Sr(A),g=_;default:if(v<1){if(w==123)--v;else if(w==125&&v++==0&&Vz()==125)continue}switch(A+=sm(w),w*v){case 38:S=d>0?1:(A+="\f",-1);break;case 44:a[u++]=(Sr(A)-1)*S,S=1;break;case 64:jr()===45&&(A+=qh(Vn())),f=jr(),d=h=Sr(E=A+=Uz(Wh())),w++;break;case 45:_===45&&Sr(A)==2&&(v=0)}}return s}function YS(t,e,n,r,i,s,o,a,l,u,d){for(var h=i-1,f=i===0?s:[""],g=Tw(f),_=0,v=0,T=0;_<r;++_)for(var S=0,w=Dc(t,h+1,h=Cz(v=o[_])),E=t;S<g;++S)(E=Sx(v>0?f[S]+" "+w:Ee(w,/&\f/g,f[S])))&&(l[T++]=E);return am(t,e,n,i===0?Ew:a,l,u,d)}function Bz(t,e,n){return am(t,e,n,Ix,sm(Dz()),Dc(t,2,-2),0)}function JS(t,e,n,r){return am(t,e,n,Iw,Dc(t,0,r),Dc(t,r+1,-1),r)}function xa(t,e){for(var n="",r=Tw(t),i=0;i<r;i++)n+=e(t[i],i,t,e)||"";return n}function $z(t,e,n,r){switch(t.type){case Pz:if(t.children.length)break;case Rz:case Iw:return t.return=t.return||t.value;case Ix:return"";case Tx:return t.return=t.value+"{"+xa(t.children,r)+"}";case Ew:t.value=t.props.join(",")}return Sr(n=xa(t.children,r))?t.return=t.value+"{"+n+"}":""}function zz(t){var e=Tw(t);return function(n,r,i,s){for(var o="",a=0;a<e;a++)o+=t[a](n,r,i,s)||"";return o}}function Wz(t){return function(e){e.root||(e=e.return)&&t(e)}}var qz=function(e,n,r){for(var i=0,s=0;i=s,s=jr(),i===38&&s===12&&(n[r]=1),!Vc(s);)Vn();return dd(e,Sn)},Hz=function(e,n){var r=-1,i=44;do switch(Vc(i)){case 0:i===38&&jr()===12&&(n[r]=1),e[r]+=qz(Sn-1,n,r);break;case 2:e[r]+=qh(i);break;case 4:if(i===44){e[++r]=jr()===58?"&\f":"",n[r]=e[r].length;break}default:e[r]+=sm(i)}while(i=Vn());return e},Kz=function(e,n){return Rx(Hz(bx(e),n))},XS=new WeakMap,Gz=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var n=e.value,r=e.parent,i=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&n.charCodeAt(0)!==58&&!XS.get(r))&&!i){XS.set(e,!0);for(var s=[],o=Kz(n,s),a=r.props,l=0,u=0;l<o.length;l++)for(var d=0;d<a.length;d++,u++)e.props[u]=s[l]?o[l].replace(/&\f/g,a[d]):a[d]+" "+o[l]}}},Qz=function(e){if(e.type==="decl"){var n=e.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(e.return="",e.value="")}};function Px(t,e){switch(xz(t,e)){case 5103:return we+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return we+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return we+t+Qf+t+Kt+t+t;case 6828:case 4268:return we+t+Kt+t+t;case 6165:return we+t+Kt+"flex-"+t+t;case 5187:return we+t+Ee(t,/(\w+).+(:[^]+)/,we+"box-$1$2"+Kt+"flex-$1$2")+t;case 5443:return we+t+Kt+"flex-item-"+Ee(t,/flex-|-self/,"")+t;case 4675:return we+t+Kt+"flex-line-pack"+Ee(t,/align-content|flex-|-self/,"")+t;case 5548:return we+t+Kt+Ee(t,"shrink","negative")+t;case 5292:return we+t+Kt+Ee(t,"basis","preferred-size")+t;case 6060:return we+"box-"+Ee(t,"-grow","")+we+t+Kt+Ee(t,"grow","positive")+t;case 4554:return we+Ee(t,/([^-])(transform)/g,"$1"+we+"$2")+t;case 6187:return Ee(Ee(Ee(t,/(zoom-|grab)/,we+"$1"),/(image-set)/,we+"$1"),t,"")+t;case 5495:case 3959:return Ee(t,/(image-set\([^]*)/,we+"$1$`$1");case 4968:return Ee(Ee(t,/(.+:)(flex-)?(.*)/,we+"box-pack:$3"+Kt+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+we+t+t;case 4095:case 3583:case 4068:case 2532:return Ee(t,/(.+)-inline(.+)/,we+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Sr(t)-1-e>6)switch(Mt(t,e+1)){case 109:if(Mt(t,e+4)!==45)break;case 102:return Ee(t,/(.+:)(.+)-([^]+)/,"$1"+we+"$2-$3$1"+Qf+(Mt(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~A_(t,"stretch")?Px(Ee(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(Mt(t,e+1)!==115)break;case 6444:switch(Mt(t,Sr(t)-3-(~A_(t,"!important")&&10))){case 107:return Ee(t,":",":"+we)+t;case 101:return Ee(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+we+(Mt(t,14)===45?"inline-":"")+"box$3$1"+we+"$2$3$1"+Kt+"$2box$3")+t}break;case 5936:switch(Mt(t,e+11)){case 114:return we+t+Kt+Ee(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return we+t+Kt+Ee(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return we+t+Kt+Ee(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return we+t+Kt+t+t}return t}var Yz=function(e,n,r,i){if(e.length>-1&&!e.return)switch(e.type){case Iw:e.return=Px(e.value,e.length);break;case Tx:return xa([lu(e,{value:Ee(e.value,"@","@"+we)})],i);case Ew:if(e.length)return Nz(e.props,function(s){switch(Oz(s,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return xa([lu(e,{props:[Ee(s,/:(read-\w+)/,":"+Qf+"$1")]})],i);case"::placeholder":return xa([lu(e,{props:[Ee(s,/:(plac\w+)/,":"+we+"input-$1")]}),lu(e,{props:[Ee(s,/:(plac\w+)/,":"+Qf+"$1")]}),lu(e,{props:[Ee(s,/:(plac\w+)/,Kt+"input-$1")]})],i)}return""})}},Jz=[Yz],Xz=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(v){var T=v.getAttribute("data-emotion");T.indexOf(" ")!==-1&&(document.head.appendChild(v),v.setAttribute("data-s",""))})}var i=e.stylisPlugins||Jz,s={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(v){for(var T=v.getAttribute("data-emotion").split(" "),S=1;S<T.length;S++)s[T[S]]=!0;a.push(v)});var l,u=[Gz,Qz];{var d,h=[$z,Wz(function(v){d.insert(v)})],f=zz(u.concat(i,h)),g=function(T){return xa(jz(T),f)};l=function(T,S,w,E){d=w,g(T?T+"{"+S.styles+"}":S.styles),E&&(_.inserted[S.name]=!0)}}var _={key:n,sheet:new bz({key:n,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:l};return _.sheet.hydrate(a),_},Zz=!0;function e9(t,e,n){var r="";return n.split(" ").forEach(function(i){t[i]!==void 0?e.push(t[i]+";"):r+=i+" "}),r}var Cx=function(e,n,r){var i=e.key+"-"+n.name;(r===!1||Zz===!1)&&e.registered[i]===void 0&&(e.registered[i]=n.styles)},t9=function(e,n,r){Cx(e,n,r);var i=e.key+"-"+n.name;if(e.inserted[n.name]===void 0){var s=n;do e.insert(n===s?"."+i:"",s,e.sheet,!0),s=s.next;while(s!==void 0)}};function n9(t){for(var e=0,n,r=0,i=t.length;i>=4;++r,i-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var r9={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},i9=!1,s9=/[A-Z]|^ms/g,o9=/_EMO_([^_]+?)_([^]*?)_EMO_/g,kx=function(e){return e.charCodeAt(1)===45},ZS=function(e){return e!=null&&typeof e!="boolean"},Dg=Ex(function(t){return kx(t)?t:t.replace(s9,"-$&").toLowerCase()}),e1=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(o9,function(r,i,s){return Ar={name:i,styles:s,next:Ar},i})}return r9[e]!==1&&!kx(e)&&typeof n=="number"&&n!==0?n+"px":n},a9="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function Lc(t,e,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var i=n;if(i.anim===1)return Ar={name:i.name,styles:i.styles,next:Ar},i.name;var s=n;if(s.styles!==void 0){var o=s.next;if(o!==void 0)for(;o!==void 0;)Ar={name:o.name,styles:o.styles,next:Ar},o=o.next;var a=s.styles+";";return a}return l9(t,e,n)}case"function":{if(t!==void 0){var l=Ar,u=n(t);return Ar=l,Lc(t,e,u)}break}}var d=n;if(e==null)return d;var h=e[d];return h!==void 0?h:d}function l9(t,e,n){var r="";if(Array.isArray(n))for(var i=0;i<n.length;i++)r+=Lc(t,e,n[i])+";";else for(var s in n){var o=n[s];if(typeof o!="object"){var a=o;e!=null&&e[a]!==void 0?r+=s+"{"+e[a]+"}":ZS(a)&&(r+=Dg(s)+":"+e1(s,a)+";")}else{if(s==="NO_COMPONENT_SELECTOR"&&i9)throw new Error(a9);if(Array.isArray(o)&&typeof o[0]=="string"&&(e==null||e[o[0]]===void 0))for(var l=0;l<o.length;l++)ZS(o[l])&&(r+=Dg(s)+":"+e1(s,o[l])+";");else{var u=Lc(t,e,o);switch(s){case"animation":case"animationName":{r+=Dg(s)+":"+u+";";break}default:r+=s+"{"+u+"}"}}}}return r}var t1=/label:\s*([^\s;\n{]+)\s*(;|$)/g,Ar;function u9(t,e,n){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var r=!0,i="";Ar=void 0;var s=t[0];if(s==null||s.raw===void 0)r=!1,i+=Lc(n,e,s);else{var o=s;i+=o[0]}for(var a=1;a<t.length;a++)if(i+=Lc(n,e,t[a]),r){var l=s;i+=l[a]}t1.lastIndex=0;for(var u="",d;(d=t1.exec(i))!==null;)u+="-"+d[1];var h=n9(i)+u;return{name:h,styles:i,next:Ar}}var c9=function(e){return e()},d9=Jh.useInsertionEffect?Jh.useInsertionEffect:!1,h9=d9||c9,xx=F.createContext(typeof HTMLElement<"u"?Xz({key:"css"}):null);xx.Provider;var f9=function(e){return F.forwardRef(function(n,r){var i=F.useContext(xx);return e(n,i,r)})},p9=F.createContext({}),m9=Iz,g9=function(e){return e!=="theme"},n1=function(e){return typeof e=="string"&&e.charCodeAt(0)>96?m9:g9},r1=function(e,n,r){var i;if(n){var s=n.shouldForwardProp;i=e.__emotion_forwardProp&&s?function(o){return e.__emotion_forwardProp(o)&&s(o)}:s}return typeof i!="function"&&r&&(i=e.__emotion_forwardProp),i},y9=!1,_9=function(e){var n=e.cache,r=e.serialized,i=e.isStringTag;return Cx(n,r,i),h9(function(){return t9(n,r,i)}),null},v9=function t(e,n){var r=e.__emotion_real===e,i=r&&e.__emotion_base||e,s,o;n!==void 0&&(s=n.label,o=n.target);var a=r1(e,n,r),l=a||n1(i),u=!l("as");return function(){var d=arguments,h=r&&e.__emotion_styles!==void 0?e.__emotion_styles.slice(0):[];if(s!==void 0&&h.push("label:"+s+";"),d[0]==null||d[0].raw===void 0)h.push.apply(h,d);else{h.push(d[0][0]);for(var f=d.length,g=1;g<f;g++)h.push(d[g],d[0][g])}var _=f9(function(v,T,S){var w=u&&v.as||i,E="",x=[],O=v;if(v.theme==null){O={};for(var D in v)O[D]=v[D];O.theme=F.useContext(p9)}typeof v.className=="string"?E=e9(T.registered,x,v.className):v.className!=null&&(E=v.className+" ");var A=u9(h.concat(x),T.registered,O);E+=T.key+"-"+A.name,o!==void 0&&(E+=" "+o);var I=u&&a===void 0?n1(w):l,m={};for(var R in v)u&&R==="as"||I(R)&&(m[R]=v[R]);return m.className=E,S&&(m.ref=S),F.createElement(F.Fragment,null,F.createElement(_9,{cache:T,serialized:A,isStringTag:typeof w=="string"}),F.createElement(w,m))});return _.displayName=s!==void 0?s:"Styled("+(typeof i=="string"?i:i.displayName||i.name||"Component")+")",_.defaultProps=e.defaultProps,_.__emotion_real=_,_.__emotion_base=i,_.__emotion_styles=h,_.__emotion_forwardProp=a,Object.defineProperty(_,"toString",{value:function(){return o===void 0&&y9?"NO_COMPONENT_SELECTOR":"."+o}}),_.withComponent=function(v,T){return t(v,S_({},n,T,{shouldForwardProp:r1(_,T,!0)})).apply(void 0,h)},_}},w9=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],R_=v9.bind();w9.forEach(function(t){R_[t]=R_(t)});var Ox={exports:{}},E9="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",I9=E9,T9=I9;function Nx(){}function Dx(){}Dx.resetWarningCache=Nx;var S9=function(){function t(r,i,s,o,a,l){if(l!==T9){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Dx,resetWarningCache:Nx};return n.PropTypes=n,n};Ox.exports=S9();var Vx=Ox.exports;const qe=K_(Vx);/** * @mui/styled-engine v6.1.0 * * @license MIT * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function A9(t,e){return R_(t,e)}const b9=(t,e)=>{Array.isArray(t.__emotion_styles)&&(t.__emotion_styles=e(t.__emotion_styles))};function ti(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function Lx(t){if(!ti(t))return t;const e={};return Object.keys(t).forEach(n=>{e[n]=Lx(t[n])}),e}function Ln(t,e,n={clone:!0}){const r=n.clone?{...t}:t;return ti(t)&&ti(e)&&Object.keys(e).forEach(i=>{ti(e[i])&&Object.prototype.hasOwnProperty.call(t,i)&&ti(t[i])?r[i]=Ln(t[i],e[i],n):n.clone?r[i]=ti(e[i])?Lx(e[i]):e[i]:r[i]=e[i]}),r}const R9=t=>{const e=Object.keys(t).map(n=>({key:n,val:t[n]}))||[];return e.sort((n,r)=>n.val-r.val),e.reduce((n,r)=>({...n,[r.key]:r.val}),{})};function P9(t){const{values:e={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:r=5,...i}=t,s=R9(e),o=Object.keys(s);function a(f){return`@media (min-width:${typeof e[f]=="number"?e[f]:f}${n})`}function l(f){return`@media (max-width:${(typeof e[f]=="number"?e[f]:f)-r/100}${n})`}function u(f,g){const _=o.indexOf(g);return`@media (min-width:${typeof e[f]=="number"?e[f]:f}${n}) and (max-width:${(_!==-1&&typeof e[o[_]]=="number"?e[o[_]]:g)-r/100}${n})`}function d(f){return o.indexOf(f)+1<o.length?u(f,o[o.indexOf(f)+1]):a(f)}function h(f){const g=o.indexOf(f);return g===0?a(o[1]):g===o.length-1?l(o[g]):u(f,o[o.indexOf(f)+1]).replace("@media","@media not all and")}return{keys:o,values:s,up:a,down:l,between:u,only:d,not:h,unit:n,...i}}function C9(t,e){if(!t.containerQueries)return e;const n=Object.keys(e).filter(r=>r.startsWith("@container")).sort((r,i)=>{var o,a;const s=/min-width:\s*([0-9.]+)/;return+(((o=r.match(s))==null?void 0:o[1])||0)-+(((a=i.match(s))==null?void 0:a[1])||0)});return n.length?n.reduce((r,i)=>{const s=e[i];return delete r[i],r[i]=s,r},{...e}):e}function k9(t,e){return e==="@"||e.startsWith("@")&&(t.some(n=>e.startsWith(`@${n}`))||!!e.match(/^@\d/))}function x9(t,e){const n=e.match(/^@([^/]+)?\/?(.+)?$/);if(!n)return null;const[,r,i]=n,s=Number.isNaN(+r)?r||0:+r;return t.containerQueries(i).up(s)}function O9(t){const e=(s,o)=>s.replace("@media",o?`@container ${o}`:"@container");function n(s,o){s.up=(...a)=>e(t.breakpoints.up(...a),o),s.down=(...a)=>e(t.breakpoints.down(...a),o),s.between=(...a)=>e(t.breakpoints.between(...a),o),s.only=(...a)=>e(t.breakpoints.only(...a),o),s.not=(...a)=>{const l=e(t.breakpoints.not(...a),o);return l.includes("not all and")?l.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):l}}const r={},i=s=>(n(r,s),r);return n(i),{...t,containerQueries:i}}const N9={borderRadius:4};function qu(t,e){return e?Ln(t,e,{clone:!1}):t}const lm={xs:0,sm:600,md:900,lg:1200,xl:1536},i1={keys:["xs","sm","md","lg","xl"],up:t=>`@media (min-width:${lm[t]}px)`},D9={containerQueries:t=>({up:e=>{let n=typeof e=="number"?e:lm[e]||e;return typeof n=="number"&&(n=`${n}px`),t?`@container ${t} (min-width:${n})`:`@container (min-width:${n})`}})};function _i(t,e,n){const r=t.theme||{};if(Array.isArray(e)){const s=r.breakpoints||i1;return e.reduce((o,a,l)=>(o[s.up(s.keys[l])]=n(e[l]),o),{})}if(typeof e=="object"){const s=r.breakpoints||i1;return Object.keys(e).reduce((o,a)=>{if(k9(s.keys,a)){const l=x9(r.containerQueries?r:D9,a);l&&(o[l]=n(e[a],a))}else if(Object.keys(s.values||lm).includes(a)){const l=s.up(a);o[l]=n(e[a],a)}else{const l=a;o[l]=e[l]}return o},{})}return n(e)}function V9(t={}){var n;return((n=t.keys)==null?void 0:n.reduce((r,i)=>{const s=t.up(i);return r[s]={},r},{}))||{}}function L9(t,e){return t.reduce((n,r)=>{const i=n[r];return(!i||Object.keys(i).length===0)&&delete n[r],n},e)}function ws(t){if(typeof t!="string")throw new Error(bo(7));return t.charAt(0).toUpperCase()+t.slice(1)}function um(t,e,n=!0){if(!e||typeof e!="string")return null;if(t&&t.vars&&n){const r=`vars.${e}`.split(".").reduce((i,s)=>i&&i[s]?i[s]:null,t);if(r!=null)return r}return e.split(".").reduce((r,i)=>r&&r[i]!=null?r[i]:null,t)}function Yf(t,e,n,r=n){let i;return typeof t=="function"?i=t(n):Array.isArray(t)?i=t[n]||r:i=um(t,n)||r,e&&(i=e(i,r,t)),i}function dt(t){const{prop:e,cssProperty:n=t.prop,themeKey:r,transform:i}=t,s=o=>{if(o[e]==null)return null;const a=o[e],l=o.theme,u=um(l,r)||{};return _i(o,a,h=>{let f=Yf(u,i,h);return h===f&&typeof h=="string"&&(f=Yf(u,i,`${e}${h==="default"?"":ws(h)}`,h)),n===!1?f:{[n]:f}})};return s.propTypes={},s.filterProps=[e],s}function M9(t){const e={};return n=>(e[n]===void 0&&(e[n]=t(n)),e[n])}const F9={m:"margin",p:"padding"},U9={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},s1={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},j9=M9(t=>{if(t.length>2)if(s1[t])t=s1[t];else return[t];const[e,n]=t.split(""),r=F9[e],i=U9[n]||"";return Array.isArray(i)?i.map(s=>r+s):[r+i]}),Sw=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],Aw=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...Sw,...Aw];function hd(t,e,n,r){const i=um(t,e,!0)??n;return typeof i=="number"||typeof i=="string"?s=>typeof s=="string"?s:typeof i=="string"?`calc(${s} * ${i})`:i*s:Array.isArray(i)?s=>{if(typeof s=="string")return s;const o=Math.abs(s),a=i[o];return s>=0?a:typeof a=="number"?-a:`-${a}`}:typeof i=="function"?i:()=>{}}function bw(t){return hd(t,"spacing",8)}function fd(t,e){return typeof e=="string"||e==null?e:t(e)}function B9(t,e){return n=>t.reduce((r,i)=>(r[i]=fd(e,n),r),{})}function $9(t,e,n,r){if(!e.includes(n))return null;const i=j9(n),s=B9(i,r),o=t[n];return _i(t,o,s)}function Mx(t,e){const n=bw(t.theme);return Object.keys(t).map(r=>$9(t,e,r,n)).reduce(qu,{})}function Ze(t){return Mx(t,Sw)}Ze.propTypes={};Ze.filterProps=Sw;function et(t){return Mx(t,Aw)}et.propTypes={};et.filterProps=Aw;function Fx(t=8,e=bw({spacing:t})){if(t.mui)return t;const n=(...r)=>(r.length===0?[1]:r).map(s=>{const o=e(s);return typeof o=="number"?`${o}px`:o}).join(" ");return n.mui=!0,n}function cm(...t){const e=t.reduce((r,i)=>(i.filterProps.forEach(s=>{r[s]=i}),r),{}),n=r=>Object.keys(r).reduce((i,s)=>e[s]?qu(i,e[s](r)):i,{});return n.propTypes={},n.filterProps=t.reduce((r,i)=>r.concat(i.filterProps),[]),n}function qn(t){return typeof t!="number"?t:`${t}px solid`}function er(t,e){return dt({prop:t,themeKey:"borders",transform:e})}const z9=er("border",qn),W9=er("borderTop",qn),q9=er("borderRight",qn),H9=er("borderBottom",qn),K9=er("borderLeft",qn),G9=er("borderColor"),Q9=er("borderTopColor"),Y9=er("borderRightColor"),J9=er("borderBottomColor"),X9=er("borderLeftColor"),Z9=er("outline",qn),e6=er("outlineColor"),dm=t=>{if(t.borderRadius!==void 0&&t.borderRadius!==null){const e=hd(t.theme,"shape.borderRadius",4),n=r=>({borderRadius:fd(e,r)});return _i(t,t.borderRadius,n)}return null};dm.propTypes={};dm.filterProps=["borderRadius"];cm(z9,W9,q9,H9,K9,G9,Q9,Y9,J9,X9,dm,Z9,e6);const hm=t=>{if(t.gap!==void 0&&t.gap!==null){const e=hd(t.theme,"spacing",8),n=r=>({gap:fd(e,r)});return _i(t,t.gap,n)}return null};hm.propTypes={};hm.filterProps=["gap"];const fm=t=>{if(t.columnGap!==void 0&&t.columnGap!==null){const e=hd(t.theme,"spacing",8),n=r=>({columnGap:fd(e,r)});return _i(t,t.columnGap,n)}return null};fm.propTypes={};fm.filterProps=["columnGap"];const pm=t=>{if(t.rowGap!==void 0&&t.rowGap!==null){const e=hd(t.theme,"spacing",8),n=r=>({rowGap:fd(e,r)});return _i(t,t.rowGap,n)}return null};pm.propTypes={};pm.filterProps=["rowGap"];const t6=dt({prop:"gridColumn"}),n6=dt({prop:"gridRow"}),r6=dt({prop:"gridAutoFlow"}),i6=dt({prop:"gridAutoColumns"}),s6=dt({prop:"gridAutoRows"}),o6=dt({prop:"gridTemplateColumns"}),a6=dt({prop:"gridTemplateRows"}),l6=dt({prop:"gridTemplateAreas"}),u6=dt({prop:"gridArea"});cm(hm,fm,pm,t6,n6,r6,i6,s6,o6,a6,l6,u6);function Oa(t,e){return e==="grey"?e:t}const c6=dt({prop:"color",themeKey:"palette",transform:Oa}),d6=dt({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:Oa}),h6=dt({prop:"backgroundColor",themeKey:"palette",transform:Oa});cm(c6,d6,h6);function kn(t){return t<=1&&t!==0?`${t*100}%`:t}const f6=dt({prop:"width",transform:kn}),Rw=t=>{if(t.maxWidth!==void 0&&t.maxWidth!==null){const e=n=>{var i,s,o,a,l;const r=((o=(s=(i=t.theme)==null?void 0:i.breakpoints)==null?void 0:s.values)==null?void 0:o[n])||lm[n];return r?((l=(a=t.theme)==null?void 0:a.breakpoints)==null?void 0:l.unit)!=="px"?{maxWidth:`${r}${t.theme.breakpoints.unit}`}:{maxWidth:r}:{maxWidth:kn(n)}};return _i(t,t.maxWidth,e)}return null};Rw.filterProps=["maxWidth"];const p6=dt({prop:"minWidth",transform:kn}),m6=dt({prop:"height",transform:kn}),g6=dt({prop:"maxHeight",transform:kn}),y6=dt({prop:"minHeight",transform:kn});dt({prop:"size",cssProperty:"width",transform:kn});dt({prop:"size",cssProperty:"height",transform:kn});const _6=dt({prop:"boxSizing"});cm(f6,Rw,p6,m6,g6,y6,_6);const mm={border:{themeKey:"borders",transform:qn},borderTop:{themeKey:"borders",transform:qn},borderRight:{themeKey:"borders",transform:qn},borderBottom:{themeKey:"borders",transform:qn},borderLeft:{themeKey:"borders",transform:qn},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:qn},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:dm},color:{themeKey:"palette",transform:Oa},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:Oa},backgroundColor:{themeKey:"palette",transform:Oa},p:{style:et},pt:{style:et},pr:{style:et},pb:{style:et},pl:{style:et},px:{style:et},py:{style:et},padding:{style:et},paddingTop:{style:et},paddingRight:{style:et},paddingBottom:{style:et},paddingLeft:{style:et},paddingX:{style:et},paddingY:{style:et},paddingInline:{style:et},paddingInlineStart:{style:et},paddingInlineEnd:{style:et},paddingBlock:{style:et},paddingBlockStart:{style:et},paddingBlockEnd:{style:et},m:{style:Ze},mt:{style:Ze},mr:{style:Ze},mb:{style:Ze},ml:{style:Ze},mx:{style:Ze},my:{style:Ze},margin:{style:Ze},marginTop:{style:Ze},marginRight:{style:Ze},marginBottom:{style:Ze},marginLeft:{style:Ze},marginX:{style:Ze},marginY:{style:Ze},marginInline:{style:Ze},marginInlineStart:{style:Ze},marginInlineEnd:{style:Ze},marginBlock:{style:Ze},marginBlockStart:{style:Ze},marginBlockEnd:{style:Ze},displayPrint:{cssProperty:!1,transform:t=>({"@media print":{display:t}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:hm},rowGap:{style:pm},columnGap:{style:fm},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:kn},maxWidth:{style:Rw},minWidth:{transform:kn},height:{transform:kn},maxHeight:{transform:kn},minHeight:{transform:kn},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function v6(...t){const e=t.reduce((r,i)=>r.concat(Object.keys(i)),[]),n=new Set(e);return t.every(r=>n.size===Object.keys(r).length)}function w6(t,e){return typeof t=="function"?t(e):t}function E6(){function t(n,r,i,s){const o={[n]:r,theme:i},a=s[n];if(!a)return{[n]:r};const{cssProperty:l=n,themeKey:u,transform:d,style:h}=a;if(r==null)return null;if(u==="typography"&&r==="inherit")return{[n]:r};const f=um(i,u)||{};return h?h(o):_i(o,r,_=>{let v=Yf(f,d,_);return _===v&&typeof _=="string"&&(v=Yf(f,d,`${n}${_==="default"?"":ws(_)}`,_)),l===!1?v:{[l]:v}})}function e(n){const{sx:r,theme:i={}}=n||{};if(!r)return null;const s=i.unstable_sxConfig??mm;function o(a){let l=a;if(typeof a=="function")l=a(i);else if(typeof a!="object")return a;if(!l)return null;const u=V9(i.breakpoints),d=Object.keys(u);let h=u;return Object.keys(l).forEach(f=>{const g=w6(l[f],i);if(g!=null)if(typeof g=="object")if(s[f])h=qu(h,t(f,g,i,s));else{const _=_i({theme:i},g,v=>({[f]:v}));v6(_,g)?h[f]=e({sx:g,theme:i}):h=qu(h,_)}else h=qu(h,t(f,g,i,s))}),C9(i,L9(d,h))}return Array.isArray(r)?r.map(o):o(r)}return e}const pd=E6();pd.filterProps=["sx"];function I6(t,e){var r;const n=this;if(n.vars){if(!((r=n.colorSchemes)!=null&&r[t])||typeof n.getColorSchemeSelector!="function")return{};let i=n.getColorSchemeSelector(t);return i==="&"?e:((i.includes("data-")||i.includes("."))&&(i=`*:where(${i.replace(/\s*&$/,"")}) &`),{[i]:e})}return n.palette.mode===t?e:{}}function Ux(t={},...e){const{breakpoints:n={},palette:r={},spacing:i,shape:s={},...o}=t,a=P9(n),l=Fx(i);let u=Ln({breakpoints:a,direction:"ltr",components:{},palette:{mode:"light",...r},spacing:l,shape:{...N9,...s}},o);return u=O9(u),u.applyStyles=I6,u=e.reduce((d,h)=>Ln(d,h),u),u.unstable_sxConfig={...mm,...o==null?void 0:o.unstable_sxConfig},u.unstable_sx=function(h){return pd({sx:h,theme:this})},u}const o1=t=>t,T6=()=>{let t=o1;return{configure(e){t=e},generate(e){return t(e)},reset(){t=o1}}},S6=T6();function jx(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=jx(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Hu(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=jx(t))&&(r&&(r+=" "),r+=e);return r}const A6={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Pw(t,e,n="Mui"){const r=A6[e];return r?`${n}-${r}`:`${S6.generate(t)}-${e}`}function Bx(t,e,n="Mui"){const r={};return e.forEach(i=>{r[i]=Pw(t,i,n)}),r}const b6=Ux();function Vg(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}function P_(t,e,n){return C6(e)?n:e[t]||e}const uh=Symbol("mui.processed_props");function ch(t,e,n){if(uh in t)return t[uh];const r={...t,theme:P_(e,t.theme,n)};return t[uh]=r,r[uh]=r,r}function R6(t){return t?(e,n)=>n[t]:null}function Kh(t,e){var r;const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(i=>Kh(i,e));if(Array.isArray(n==null?void 0:n.variants)){const{variants:i,...s}=n;let o=s,a;e:for(let l=0;l<i.length;l+=1){const u=i[l];if(typeof u.props=="function"){if(a??(a={...e,...e.ownerState,ownerState:e.ownerState}),!u.props(a))continue}else for(const d in u.props)if(e[d]!==u.props[d]&&((r=e.ownerState)==null?void 0:r[d])!==u.props[d])continue e;Array.isArray(o)||(o=[o]),typeof u.style=="function"?(a??(a={...e,...e.ownerState,ownerState:e.ownerState}),o.push(u.style(a))):o.push(u.style)}return o}return n}function P6(t={}){const{themeId:e,defaultTheme:n=b6,rootShouldForwardProp:r=Vg,slotShouldForwardProp:i=Vg}=t,s=a=>pd(ch(a,e,n));return s.__mui_systemSx=!0,(a,l={})=>{b9(a,D=>D.filter(A=>!(A!=null&&A.__mui_systemSx)));const{name:u,slot:d,skipVariantsResolver:h,skipSx:f,overridesResolver:g=R6(x6(d)),..._}=l,v=h!==void 0?h:d&&d!=="Root"&&d!=="root"||!1,T=f||!1;let S,w=Vg;d==="Root"||d==="root"?w=r:d?w=i:k6(a)&&(w=void 0);const E=A9(a,{shouldForwardProp:w,label:S,..._}),x=D=>typeof D=="function"&&D.__emotion_real!==D||ti(D)?A=>Kh(D,ch(A,e,n)):D,O=(D,...A)=>{let I=x(D);const m=A?A.map(x):[];u&&g&&m.push(N=>{const P=P_(e,N.theme,n);if(!P.components||!P.components[u]||!P.components[u].styleOverrides)return null;const he=P.components[u].styleOverrides,oe={},vt=ch(N,e,n);for(const We in he)oe[We]=Kh(he[We],vt);return g(N,oe)}),u&&!v&&m.push(N=>{var oe,vt;const P=P_(e,N.theme,n),he=(vt=(oe=P==null?void 0:P.components)==null?void 0:oe[u])==null?void 0:vt.variants;return he?Kh({variants:he},ch(N,e,n)):null}),T||m.push(s);const R=m.length-A.length;if(Array.isArray(D)&&R>0){const N=new Array(R).fill("");I=[...D,...N],I.raw=[...D.raw,...N]}const k=E(I,...m);return a.muiName&&(k.muiName=a.muiName),k};return E.withConfig&&(O.withConfig=E.withConfig),O}}function C6(t){for(const e in t)return!1;return!0}function k6(t){return typeof t=="string"&&t.charCodeAt(0)>96}function x6(t){return t&&t.charAt(0).toLowerCase()+t.slice(1)}function C_(t,e){const n={...e};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const i=r;if(i==="components"||i==="slots")n[i]={...t[i],...n[i]};else if(i==="componentsProps"||i==="slotProps"){const s=t[i],o=e[i];if(!o)n[i]=s||{};else if(!s)n[i]=o;else{n[i]={...o};for(const a in s)if(Object.prototype.hasOwnProperty.call(s,a)){const l=a;n[i][l]=C_(s[l],o[l])}}}else n[i]===void 0&&(n[i]=t[i])}return n}function $x(t,e=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,n))}function Cw(t,e=0,n=1){return $x(t,e,n)}function O6(t){t=t.slice(1);const e=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let n=t.match(e);return n&&n[0].length===1&&(n=n.map(r=>r+r)),n?`rgb${n.length===4?"a":""}(${n.map((r,i)=>i<3?parseInt(r,16):Math.round(parseInt(r,16)/255*1e3)/1e3).join(", ")})`:""}function Es(t){if(t.type)return t;if(t.charAt(0)==="#")return Es(O6(t));const e=t.indexOf("("),n=t.substring(0,e);if(!["rgb","rgba","hsl","hsla","color"].includes(n))throw new Error(bo(9,t));let r=t.substring(e+1,t.length-1),i;if(n==="color"){if(r=r.split(" "),i=r.shift(),r.length===4&&r[3].charAt(0)==="/"&&(r[3]=r[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(i))throw new Error(bo(10,i))}else r=r.split(",");return r=r.map(s=>parseFloat(s)),{type:n,values:r,colorSpace:i}}const N6=t=>{const e=Es(t);return e.values.slice(0,3).map((n,r)=>e.type.includes("hsl")&&r!==0?`${n}%`:n).join(" ")},Tu=(t,e)=>{try{return N6(t)}catch{return t}};function gm(t){const{type:e,colorSpace:n}=t;let{values:r}=t;return e.includes("rgb")?r=r.map((i,s)=>s<3?parseInt(i,10):i):e.includes("hsl")&&(r[1]=`${r[1]}%`,r[2]=`${r[2]}%`),e.includes("color")?r=`${n} ${r.join(" ")}`:r=`${r.join(", ")}`,`${e}(${r})`}function zx(t){t=Es(t);const{values:e}=t,n=e[0],r=e[1]/100,i=e[2]/100,s=r*Math.min(i,1-i),o=(u,d=(u+n/30)%12)=>i-s*Math.max(Math.min(d-3,9-d,1),-1);let a="rgb";const l=[Math.round(o(0)*255),Math.round(o(8)*255),Math.round(o(4)*255)];return t.type==="hsla"&&(a+="a",l.push(e[3])),gm({type:a,values:l})}function k_(t){t=Es(t);let e=t.type==="hsl"||t.type==="hsla"?Es(zx(t)).values:t.values;return e=e.map(n=>(t.type!=="color"&&(n/=255),n<=.03928?n/12.92:((n+.055)/1.055)**2.4)),Number((.2126*e[0]+.7152*e[1]+.0722*e[2]).toFixed(3))}function D6(t,e){const n=k_(t),r=k_(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function V6(t,e){return t=Es(t),e=Cw(e),(t.type==="rgb"||t.type==="hsl")&&(t.type+="a"),t.type==="color"?t.values[3]=`/${e}`:t.values[3]=e,gm(t)}function dh(t,e,n){try{return V6(t,e)}catch{return t}}function kw(t,e){if(t=Es(t),e=Cw(e),t.type.includes("hsl"))t.values[2]*=1-e;else if(t.type.includes("rgb")||t.type.includes("color"))for(let n=0;n<3;n+=1)t.values[n]*=1-e;return gm(t)}function Ce(t,e,n){try{return kw(t,e)}catch{return t}}function xw(t,e){if(t=Es(t),e=Cw(e),t.type.includes("hsl"))t.values[2]+=(100-t.values[2])*e;else if(t.type.includes("rgb"))for(let n=0;n<3;n+=1)t.values[n]+=(255-t.values[n])*e;else if(t.type.includes("color"))for(let n=0;n<3;n+=1)t.values[n]+=(1-t.values[n])*e;return gm(t)}function ke(t,e,n){try{return xw(t,e)}catch{return t}}function L6(t,e=.15){return k_(t)>.5?kw(t,e):xw(t,e)}function hh(t,e,n){try{return L6(t,e)}catch{return t}}function M6(t,e){typeof t=="function"?t(e):t&&(t.current=e)}let a1=0;function F6(t){const[e,n]=F.useState(t),r=t||e;return F.useEffect(()=>{e==null&&(a1+=1,n(`mui-${a1}`))},[e]),r}const l1=Jh.useId;function Wx(t){if(l1!==void 0){const e=l1();return t??e}return F6(t)}function U6({controlled:t,default:e,name:n,state:r="value"}){const{current:i}=F.useRef(t!==void 0),[s,o]=F.useState(e),a=i?t:s,l=F.useCallback(u=>{i||o(u)},[]);return[a,l]}function j6(...t){return F.useMemo(()=>t.every(e=>e==null)?null:e=>{t.forEach(n=>{M6(n,e)})},t)}function u1(t){try{return t.matches(":focus-visible")}catch{}return!1}const B6={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"};function qx(t,e,n=void 0){const r={};for(const i in t){const s=t[i];let o="",a=!0;for(let l=0;l<s.length;l+=1){const u=s[l];u&&(o+=(a===!0?"":" ")+e(u),a=!1,n&&n[u]&&(o+=" "+n[u]))}r[i]=o}return r}const $6=F.createContext(),z6=()=>F.useContext($6)??!1,W6=F.createContext(void 0);function q6(t){const{theme:e,name:n,props:r}=t;if(!e||!e.components||!e.components[n])return r;const i=e.components[n];return i.defaultProps?C_(i.defaultProps,r):!i.styleOverrides&&!i.variants?C_(i,r):r}function H6({props:t,name:e}){const n=F.useContext(W6);return q6({props:t,name:e,theme:{components:n}})}function K6(t=""){function e(...r){if(!r.length)return"";const i=r[0];return typeof i=="string"&&!i.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${t?`${t}-`:""}${i}${e(...r.slice(1))})`:`, ${i}`}return(r,...i)=>`var(--${t?`${t}-`:""}${r}${e(...i)})`}const c1=(t,e,n,r=[])=>{let i=t;e.forEach((s,o)=>{o===e.length-1?Array.isArray(i)?i[Number(s)]=n:i&&typeof i=="object"&&(i[s]=n):i&&typeof i=="object"&&(i[s]||(i[s]=r.includes(s)?[]:{}),i=i[s])})},G6=(t,e,n)=>{function r(i,s=[],o=[]){Object.entries(i).forEach(([a,l])=>{(!n||n&&!n([...s,a]))&&l!=null&&(typeof l=="object"&&Object.keys(l).length>0?r(l,[...s,a],Array.isArray(l)?[...o,a]:o):e([...s,a],l,o))})}r(t)},Q6=(t,e)=>typeof e=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(r=>t.includes(r))||t[t.length-1].toLowerCase().indexOf("opacity")>=0?e:`${e}px`:e;function Lg(t,e){const{prefix:n,shouldSkipGeneratingVar:r}=e||{},i={},s={},o={};return G6(t,(a,l,u)=>{if((typeof l=="string"||typeof l=="number")&&(!r||!r(a,l))){const d=`--${n?`${n}-`:""}${a.join("-")}`,h=Q6(a,l);Object.assign(i,{[d]:h}),c1(s,a,`var(${d})`,u),c1(o,a,`var(${d}, ${h})`,u)}},a=>a[0]==="vars"),{css:i,vars:s,varsWithDefaults:o}}function Y6(t,e={}){const{getSelector:n=T,disableCssColorScheme:r,colorSchemeSelector:i}=e,{colorSchemes:s={},components:o,defaultColorScheme:a="light",...l}=t,{vars:u,css:d,varsWithDefaults:h}=Lg(l,e);let f=h;const g={},{[a]:_,...v}=s;if(Object.entries(v||{}).forEach(([E,x])=>{const{vars:O,css:D,varsWithDefaults:A}=Lg(x,e);f=Ln(f,A),g[E]={css:D,vars:O}}),_){const{css:E,vars:x,varsWithDefaults:O}=Lg(_,e);f=Ln(f,O),g[a]={css:E,vars:x}}function T(E,x){var D,A;let O=i;if(i==="class"&&(O=".%s"),i==="data"&&(O="[data-%s]"),i!=null&&i.startsWith("data-")&&!i.includes("%s")&&(O=`[${i}="%s"]`),E){if(O==="media")return t.defaultColorScheme===E?":root":{[`@media (prefers-color-scheme: ${((A=(D=s[E])==null?void 0:D.palette)==null?void 0:A.mode)||E})`]:{":root":x}};if(O)return t.defaultColorScheme===E?`:root, ${O.replace("%s",String(E))}`:O.replace("%s",String(E))}return":root"}return{vars:f,generateThemeVars:()=>{let E={...u};return Object.entries(g).forEach(([,{vars:x}])=>{E=Ln(E,x)}),E},generateStyleSheets:()=>{var I,m;const E=[],x=t.defaultColorScheme||"light";function O(R,k){Object.keys(k).length&&E.push(typeof R=="string"?{[R]:{...k}}:R)}O(n(void 0,{...d}),d);const{[x]:D,...A}=g;if(D){const{css:R}=D,k=(m=(I=s[x])==null?void 0:I.palette)==null?void 0:m.mode,N=!r&&k?{colorScheme:k,...R}:{...R};O(n(x,{...N}),N)}return Object.entries(A).forEach(([R,{css:k}])=>{var he,oe;const N=(oe=(he=s[R])==null?void 0:he.palette)==null?void 0:oe.mode,P=!r&&N?{colorScheme:N,...k}:{...k};O(n(R,{...P}),P)}),E}}}function J6(t){return function(n){return t==="media"?`@media (prefers-color-scheme: ${n})`:t?t.startsWith("data-")&&!t.includes("%s")?`[${t}="${n}"] &`:t==="class"?`.${n} &`:t==="data"?`[data-${n}] &`:`${t.replace("%s",n)} &`:"&"}}const d1={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:Nc.white,default:Nc.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},Mg={text:{primary:Nc.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:Nc.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function h1(t,e,n,r){const i=r.light||r,s=r.dark||r*1.5;t[e]||(t.hasOwnProperty(n)?t[e]=t[n]:e==="light"?t.light=xw(t.main,i):e==="dark"&&(t.dark=kw(t.main,s)))}function X6(t="light"){return t==="dark"?{main:Jo[200],light:Jo[50],dark:Jo[400]}:{main:Jo[700],light:Jo[400],dark:Jo[800]}}function Z6(t="light"){return t==="dark"?{main:Yo[200],light:Yo[50],dark:Yo[400]}:{main:Yo[500],light:Yo[300],dark:Yo[700]}}function eW(t="light"){return t==="dark"?{main:Qo[500],light:Qo[300],dark:Qo[700]}:{main:Qo[700],light:Qo[400],dark:Qo[800]}}function tW(t="light"){return t==="dark"?{main:Xo[400],light:Xo[300],dark:Xo[700]}:{main:Xo[700],light:Xo[500],dark:Xo[900]}}function nW(t="light"){return t==="dark"?{main:Zo[400],light:Zo[300],dark:Zo[700]}:{main:Zo[800],light:Zo[500],dark:Zo[900]}}function rW(t="light"){return t==="dark"?{main:au[400],light:au[300],dark:au[700]}:{main:"#ed6c02",light:au[500],dark:au[900]}}function Ow(t){const{mode:e="light",contrastThreshold:n=3,tonalOffset:r=.2,...i}=t,s=t.primary||X6(e),o=t.secondary||Z6(e),a=t.error||eW(e),l=t.info||tW(e),u=t.success||nW(e),d=t.warning||rW(e);function h(v){return D6(v,Mg.text.primary)>=n?Mg.text.primary:d1.text.primary}const f=({color:v,name:T,mainShade:S=500,lightShade:w=300,darkShade:E=700})=>{if(v={...v},!v.main&&v[S]&&(v.main=v[S]),!v.hasOwnProperty("main"))throw new Error(bo(11,T?` (${T})`:"",S));if(typeof v.main!="string")throw new Error(bo(12,T?` (${T})`:"",JSON.stringify(v.main)));return h1(v,"light",w,r),h1(v,"dark",E,r),v.contrastText||(v.contrastText=h(v.main)),v},g={dark:Mg,light:d1};return Ln({common:{...Nc},mode:e,primary:f({color:s,name:"primary"}),secondary:f({color:o,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:f({color:a,name:"error"}),warning:f({color:d,name:"warning"}),info:f({color:l,name:"info"}),success:f({color:u,name:"success"}),grey:vz,contrastThreshold:n,getContrastText:h,augmentColor:f,tonalOffset:r,...g[e]},i)}function iW(t){const e={};return Object.entries(t).forEach(r=>{const[i,s]=r;typeof s=="object"&&(e[i]=`${s.fontStyle?`${s.fontStyle} `:""}${s.fontVariant?`${s.fontVariant} `:""}${s.fontWeight?`${s.fontWeight} `:""}${s.fontStretch?`${s.fontStretch} `:""}${s.fontSize||""}${s.lineHeight?`/${s.lineHeight} `:""}${s.fontFamily||""}`)}),e}function sW(t,e){return{toolbar:{minHeight:56,[t.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[t.up("sm")]:{minHeight:64}},...e}}function oW(t){return Math.round(t*1e5)/1e5}const f1={textTransform:"uppercase"},p1='"Roboto", "Helvetica", "Arial", sans-serif';function aW(t,e){const{fontFamily:n=p1,fontSize:r=14,fontWeightLight:i=300,fontWeightRegular:s=400,fontWeightMedium:o=500,fontWeightBold:a=700,htmlFontSize:l=16,allVariants:u,pxToRem:d,...h}=typeof e=="function"?e(t):e,f=r/14,g=d||(T=>`${T/l*f}rem`),_=(T,S,w,E,x)=>({fontFamily:n,fontWeight:T,fontSize:g(S),lineHeight:w,...n===p1?{letterSpacing:`${oW(E/S)}em`}:{},...x,...u}),v={h1:_(i,96,1.167,-1.5),h2:_(i,60,1.2,-.5),h3:_(s,48,1.167,0),h4:_(s,34,1.235,.25),h5:_(s,24,1.334,0),h6:_(o,20,1.6,.15),subtitle1:_(s,16,1.75,.15),subtitle2:_(o,14,1.57,.1),body1:_(s,16,1.5,.15),body2:_(s,14,1.43,.15),button:_(o,14,1.75,.4,f1),caption:_(s,12,1.66,.4),overline:_(s,12,2.66,1,f1),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return Ln({htmlFontSize:l,pxToRem:g,fontFamily:n,fontSize:r,fontWeightLight:i,fontWeightRegular:s,fontWeightMedium:o,fontWeightBold:a,...v},h,{clone:!1})}const lW=.2,uW=.14,cW=.12;function Fe(...t){return[`${t[0]}px ${t[1]}px ${t[2]}px ${t[3]}px rgba(0,0,0,${lW})`,`${t[4]}px ${t[5]}px ${t[6]}px ${t[7]}px rgba(0,0,0,${uW})`,`${t[8]}px ${t[9]}px ${t[10]}px ${t[11]}px rgba(0,0,0,${cW})`].join(",")}const dW=["none",Fe(0,2,1,-1,0,1,1,0,0,1,3,0),Fe(0,3,1,-2,0,2,2,0,0,1,5,0),Fe(0,3,3,-2,0,3,4,0,0,1,8,0),Fe(0,2,4,-1,0,4,5,0,0,1,10,0),Fe(0,3,5,-1,0,5,8,0,0,1,14,0),Fe(0,3,5,-1,0,6,10,0,0,1,18,0),Fe(0,4,5,-2,0,7,10,1,0,2,16,1),Fe(0,5,5,-3,0,8,10,1,0,3,14,2),Fe(0,5,6,-3,0,9,12,1,0,3,16,2),Fe(0,6,6,-3,0,10,14,1,0,4,18,3),Fe(0,6,7,-4,0,11,15,1,0,4,20,3),Fe(0,7,8,-4,0,12,17,2,0,5,22,4),Fe(0,7,8,-4,0,13,19,2,0,5,24,4),Fe(0,7,9,-4,0,14,21,2,0,5,26,4),Fe(0,8,9,-5,0,15,22,2,0,6,28,5),Fe(0,8,10,-5,0,16,24,2,0,6,30,5),Fe(0,8,11,-5,0,17,26,2,0,6,32,5),Fe(0,9,11,-5,0,18,28,2,0,7,34,6),Fe(0,9,12,-6,0,19,29,2,0,7,36,6),Fe(0,10,13,-6,0,20,31,3,0,8,38,7),Fe(0,10,13,-6,0,21,33,3,0,8,40,7),Fe(0,10,14,-6,0,22,35,3,0,8,42,7),Fe(0,11,14,-7,0,23,36,3,0,9,44,8),Fe(0,11,15,-7,0,24,38,3,0,9,46,8)],hW={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},fW={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function m1(t){return`${Math.round(t)}ms`}function pW(t){if(!t)return 0;const e=t/36;return Math.min(Math.round((4+15*e**.25+e/5)*10),3e3)}function mW(t){const e={...hW,...t.easing},n={...fW,...t.duration};return{getAutoHeightDuration:pW,create:(i=["all"],s={})=>{const{duration:o=n.standard,easing:a=e.easeInOut,delay:l=0,...u}=s;return(Array.isArray(i)?i:[i]).map(d=>`${d} ${typeof o=="string"?o:m1(o)} ${a} ${typeof l=="string"?l:m1(l)}`).join(",")},...t,easing:e,duration:n}}const gW={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function x_(t={},...e){const{breakpoints:n,mixins:r={},spacing:i,palette:s={},transitions:o={},typography:a={},shape:l,...u}=t;if(t.vars)throw new Error(bo(20));const d=Ow(s),h=Ux(t);let f=Ln(h,{mixins:sW(h.breakpoints,r),palette:d,shadows:dW.slice(),typography:aW(d,a),transitions:mW(o),zIndex:{...gW}});return f=Ln(f,u),f=e.reduce((g,_)=>Ln(g,_),f),f.unstable_sxConfig={...mm,...u==null?void 0:u.unstable_sxConfig},f.unstable_sx=function(_){return pd({sx:_,theme:this})},f}function yW(t){let e;return t<1?e=5.11916*t**2:e=4.5*Math.log(t+1)+2,Math.round(e*10)/1e3}const _W=[...Array(25)].map((t,e)=>{if(e===0)return;const n=yW(e);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function Hx(t){return{inputPlaceholder:t==="dark"?.5:.42,inputUnderline:t==="dark"?.7:.42,switchTrackDisabled:t==="dark"?.2:.12,switchTrack:t==="dark"?.3:.38}}function Kx(t){return t==="dark"?_W:[]}function vW(t){const{palette:e={mode:"light"},opacity:n,overlays:r,...i}=t,s=Ow(e);return{palette:s,opacity:{...Hx(s.mode),...n},overlays:r||Kx(s.mode),...i}}function wW(t){var e;return!!t[0].match(/(cssVarPrefix|colorSchemeSelector|typography|mixins|breakpoints|direction|transitions)/)||!!t[0].match(/sxConfig$/)||t[0]==="palette"&&!!((e=t[1])!=null&&e.match(/(mode|contrastThreshold|tonalOffset)/))}const EW=t=>[...[...Array(24)].map((e,n)=>`--${t?`${t}-`:""}overlays-${n+1}`),`--${t?`${t}-`:""}palette-AppBar-darkBg`,`--${t?`${t}-`:""}palette-AppBar-darkColor`],IW=t=>(e,n)=>{const r=t.colorSchemeSelector;let i=r;if(r==="class"&&(i=".%s"),r==="data"&&(i="[data-%s]"),r!=null&&r.startsWith("data-")&&!r.includes("%s")&&(i=`[${r}="%s"]`),t.defaultColorScheme===e){if(e==="dark"){const s={};return EW(t.cssVarPrefix).forEach(o=>{s[o]=n[o],delete n[o]}),i==="media"?{":root":n,"@media (prefers-color-scheme: dark)":{":root":s}}:i?{[i.replace("%s",e)]:s,[`:root, ${i.replace("%s",e)}`]:n}:{":root":{...n,...s}}}if(i&&i!=="media")return`:root, ${i.replace("%s",String(e))}`}else if(e){if(i==="media")return{[`@media (prefers-color-scheme: ${String(e)})`]:{":root":n}};if(i)return i.replace("%s",String(e))}return":root"};function TW(t){return ti(t)||typeof t>"u"||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||Array.isArray(t)}function SW(t={}){const e={...t};function n(r){const i=Object.entries(r);for(let s=0;s<i.length;s++){const[o,a]=i[s];!TW(a)||o.startsWith("unstable_")?delete r[o]:ti(a)&&(r[o]={...a},n(r[o]))}}return n(e),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles'; const theme = ${JSON.stringify(e,null,2)}; theme.breakpoints = createBreakpoints(theme.breakpoints || {}); theme.transitions = createTransitions(theme.transitions || {}); export default theme;`}function AW(t,e){e.forEach(n=>{t[n]||(t[n]={})})}function B(t,e,n){!t[e]&&n&&(t[e]=n)}function Su(t){return!t||!t.startsWith("hsl")?t:zx(t)}function Qr(t,e){`${e}Channel`in t||(t[`${e}Channel`]=Tu(Su(t[e]),`MUI: Can't create \`palette.${e}Channel\` because \`palette.${e}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). To suppress this warning, you need to explicitly provide the \`palette.${e}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function bW(t){return typeof t=="number"?`${t}px`:typeof t=="string"||typeof t=="function"||Array.isArray(t)?t:"8px"}const Ir=t=>{try{return t()}catch{}},RW=(t="mui")=>K6(t);function Fg(t,e,n,r){if(!e)return;e=e===!0?{}:e;const i=r==="dark"?"dark":"light";if(!n){t[r]=vW({...e,palette:{mode:i,...e==null?void 0:e.palette}});return}const{palette:s,...o}=x_({...n,palette:{mode:i,...e==null?void 0:e.palette}});return t[r]={...e,palette:s,opacity:{...Hx(i),...e==null?void 0:e.opacity},overlays:(e==null?void 0:e.overlays)||Kx(i)},o}function PW(t={},...e){const{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:i=!1,cssVarPrefix:s="mui",shouldSkipGeneratingVar:o=wW,colorSchemeSelector:a=n.light&&n.dark?"media":void 0,...l}=t,u=Object.keys(n)[0],d=r||(n.light&&u!=="light"?"light":u),h=RW(s),{[d]:f,light:g,dark:_,...v}=n,T={...v};let S=f;if((d==="dark"&&!("dark"in n)||d==="light"&&!("light"in n))&&(S=!0),!S)throw new Error(bo(21,d));const w=Fg(T,S,l,d);g&&!T.light&&Fg(T,g,void 0,"light"),_&&!T.dark&&Fg(T,_,void 0,"dark");let E={defaultColorScheme:d,...w,cssVarPrefix:s,colorSchemeSelector:a,getCssVar:h,colorSchemes:T,font:{...iW(w.typography),...w.font},spacing:bW(l.spacing)};Object.keys(E.colorSchemes).forEach(I=>{const m=E.colorSchemes[I].palette,R=k=>{const N=k.split("-"),P=N[1],he=N[2];return h(k,m[P][he])};if(m.mode==="light"&&(B(m.common,"background","#fff"),B(m.common,"onBackground","#000")),m.mode==="dark"&&(B(m.common,"background","#000"),B(m.common,"onBackground","#fff")),AW(m,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),m.mode==="light"){B(m.Alert,"errorColor",Ce(m.error.light,.6)),B(m.Alert,"infoColor",Ce(m.info.light,.6)),B(m.Alert,"successColor",Ce(m.success.light,.6)),B(m.Alert,"warningColor",Ce(m.warning.light,.6)),B(m.Alert,"errorFilledBg",R("palette-error-main")),B(m.Alert,"infoFilledBg",R("palette-info-main")),B(m.Alert,"successFilledBg",R("palette-success-main")),B(m.Alert,"warningFilledBg",R("palette-warning-main")),B(m.Alert,"errorFilledColor",Ir(()=>m.getContrastText(m.error.main))),B(m.Alert,"infoFilledColor",Ir(()=>m.getContrastText(m.info.main))),B(m.Alert,"successFilledColor",Ir(()=>m.getContrastText(m.success.main))),B(m.Alert,"warningFilledColor",Ir(()=>m.getContrastText(m.warning.main))),B(m.Alert,"errorStandardBg",ke(m.error.light,.9)),B(m.Alert,"infoStandardBg",ke(m.info.light,.9)),B(m.Alert,"successStandardBg",ke(m.success.light,.9)),B(m.Alert,"warningStandardBg",ke(m.warning.light,.9)),B(m.Alert,"errorIconColor",R("palette-error-main")),B(m.Alert,"infoIconColor",R("palette-info-main")),B(m.Alert,"successIconColor",R("palette-success-main")),B(m.Alert,"warningIconColor",R("palette-warning-main")),B(m.AppBar,"defaultBg",R("palette-grey-100")),B(m.Avatar,"defaultBg",R("palette-grey-400")),B(m.Button,"inheritContainedBg",R("palette-grey-300")),B(m.Button,"inheritContainedHoverBg",R("palette-grey-A100")),B(m.Chip,"defaultBorder",R("palette-grey-400")),B(m.Chip,"defaultAvatarColor",R("palette-grey-700")),B(m.Chip,"defaultIconColor",R("palette-grey-700")),B(m.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),B(m.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),B(m.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),B(m.LinearProgress,"primaryBg",ke(m.primary.main,.62)),B(m.LinearProgress,"secondaryBg",ke(m.secondary.main,.62)),B(m.LinearProgress,"errorBg",ke(m.error.main,.62)),B(m.LinearProgress,"infoBg",ke(m.info.main,.62)),B(m.LinearProgress,"successBg",ke(m.success.main,.62)),B(m.LinearProgress,"warningBg",ke(m.warning.main,.62)),B(m.Skeleton,"bg",`rgba(${R("palette-text-primaryChannel")} / 0.11)`),B(m.Slider,"primaryTrack",ke(m.primary.main,.62)),B(m.Slider,"secondaryTrack",ke(m.secondary.main,.62)),B(m.Slider,"errorTrack",ke(m.error.main,.62)),B(m.Slider,"infoTrack",ke(m.info.main,.62)),B(m.Slider,"successTrack",ke(m.success.main,.62)),B(m.Slider,"warningTrack",ke(m.warning.main,.62));const k=hh(m.background.default,.8);B(m.SnackbarContent,"bg",k),B(m.SnackbarContent,"color",Ir(()=>m.getContrastText(k))),B(m.SpeedDialAction,"fabHoverBg",hh(m.background.paper,.15)),B(m.StepConnector,"border",R("palette-grey-400")),B(m.StepContent,"border",R("palette-grey-400")),B(m.Switch,"defaultColor",R("palette-common-white")),B(m.Switch,"defaultDisabledColor",R("palette-grey-100")),B(m.Switch,"primaryDisabledColor",ke(m.primary.main,.62)),B(m.Switch,"secondaryDisabledColor",ke(m.secondary.main,.62)),B(m.Switch,"errorDisabledColor",ke(m.error.main,.62)),B(m.Switch,"infoDisabledColor",ke(m.info.main,.62)),B(m.Switch,"successDisabledColor",ke(m.success.main,.62)),B(m.Switch,"warningDisabledColor",ke(m.warning.main,.62)),B(m.TableCell,"border",ke(dh(m.divider,1),.88)),B(m.Tooltip,"bg",dh(m.grey[700],.92))}if(m.mode==="dark"){B(m.Alert,"errorColor",ke(m.error.light,.6)),B(m.Alert,"infoColor",ke(m.info.light,.6)),B(m.Alert,"successColor",ke(m.success.light,.6)),B(m.Alert,"warningColor",ke(m.warning.light,.6)),B(m.Alert,"errorFilledBg",R("palette-error-dark")),B(m.Alert,"infoFilledBg",R("palette-info-dark")),B(m.Alert,"successFilledBg",R("palette-success-dark")),B(m.Alert,"warningFilledBg",R("palette-warning-dark")),B(m.Alert,"errorFilledColor",Ir(()=>m.getContrastText(m.error.dark))),B(m.Alert,"infoFilledColor",Ir(()=>m.getContrastText(m.info.dark))),B(m.Alert,"successFilledColor",Ir(()=>m.getContrastText(m.success.dark))),B(m.Alert,"warningFilledColor",Ir(()=>m.getContrastText(m.warning.dark))),B(m.Alert,"errorStandardBg",Ce(m.error.light,.9)),B(m.Alert,"infoStandardBg",Ce(m.info.light,.9)),B(m.Alert,"successStandardBg",Ce(m.success.light,.9)),B(m.Alert,"warningStandardBg",Ce(m.warning.light,.9)),B(m.Alert,"errorIconColor",R("palette-error-main")),B(m.Alert,"infoIconColor",R("palette-info-main")),B(m.Alert,"successIconColor",R("palette-success-main")),B(m.Alert,"warningIconColor",R("palette-warning-main")),B(m.AppBar,"defaultBg",R("palette-grey-900")),B(m.AppBar,"darkBg",R("palette-background-paper")),B(m.AppBar,"darkColor",R("palette-text-primary")),B(m.Avatar,"defaultBg",R("palette-grey-600")),B(m.Button,"inheritContainedBg",R("palette-grey-800")),B(m.Button,"inheritContainedHoverBg",R("palette-grey-700")),B(m.Chip,"defaultBorder",R("palette-grey-700")),B(m.Chip,"defaultAvatarColor",R("palette-grey-300")),B(m.Chip,"defaultIconColor",R("palette-grey-300")),B(m.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),B(m.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),B(m.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),B(m.LinearProgress,"primaryBg",Ce(m.primary.main,.5)),B(m.LinearProgress,"secondaryBg",Ce(m.secondary.main,.5)),B(m.LinearProgress,"errorBg",Ce(m.error.main,.5)),B(m.LinearProgress,"infoBg",Ce(m.info.main,.5)),B(m.LinearProgress,"successBg",Ce(m.success.main,.5)),B(m.LinearProgress,"warningBg",Ce(m.warning.main,.5)),B(m.Skeleton,"bg",`rgba(${R("palette-text-primaryChannel")} / 0.13)`),B(m.Slider,"primaryTrack",Ce(m.primary.main,.5)),B(m.Slider,"secondaryTrack",Ce(m.secondary.main,.5)),B(m.Slider,"errorTrack",Ce(m.error.main,.5)),B(m.Slider,"infoTrack",Ce(m.info.main,.5)),B(m.Slider,"successTrack",Ce(m.success.main,.5)),B(m.Slider,"warningTrack",Ce(m.warning.main,.5));const k=hh(m.background.default,.98);B(m.SnackbarContent,"bg",k),B(m.SnackbarContent,"color",Ir(()=>m.getContrastText(k))),B(m.SpeedDialAction,"fabHoverBg",hh(m.background.paper,.15)),B(m.StepConnector,"border",R("palette-grey-600")),B(m.StepContent,"border",R("palette-grey-600")),B(m.Switch,"defaultColor",R("palette-grey-300")),B(m.Switch,"defaultDisabledColor",R("palette-grey-600")),B(m.Switch,"primaryDisabledColor",Ce(m.primary.main,.55)),B(m.Switch,"secondaryDisabledColor",Ce(m.secondary.main,.55)),B(m.Switch,"errorDisabledColor",Ce(m.error.main,.55)),B(m.Switch,"infoDisabledColor",Ce(m.info.main,.55)),B(m.Switch,"successDisabledColor",Ce(m.success.main,.55)),B(m.Switch,"warningDisabledColor",Ce(m.warning.main,.55)),B(m.TableCell,"border",Ce(dh(m.divider,1),.68)),B(m.Tooltip,"bg",dh(m.grey[700],.92))}Qr(m.background,"default"),Qr(m.background,"paper"),Qr(m.common,"background"),Qr(m.common,"onBackground"),Qr(m,"divider"),Object.keys(m).forEach(k=>{const N=m[k];N&&typeof N=="object"&&(N.main&&B(m[k],"mainChannel",Tu(Su(N.main))),N.light&&B(m[k],"lightChannel",Tu(Su(N.light))),N.dark&&B(m[k],"darkChannel",Tu(Su(N.dark))),N.contrastText&&B(m[k],"contrastTextChannel",Tu(Su(N.contrastText))),k==="text"&&(Qr(m[k],"primary"),Qr(m[k],"secondary")),k==="action"&&(N.active&&Qr(m[k],"active"),N.selected&&Qr(m[k],"selected")))})}),E=e.reduce((I,m)=>Ln(I,m),E);const x={prefix:s,disableCssColorScheme:i,shouldSkipGeneratingVar:o,getSelector:IW(E)},{vars:O,generateThemeVars:D,generateStyleSheets:A}=Y6(E,x);return E.vars=O,Object.entries(E.colorSchemes[E.defaultColorScheme]).forEach(([I,m])=>{E[I]=m}),E.generateThemeVars=D,E.generateStyleSheets=A,E.generateSpacing=function(){return Fx(l.spacing,bw(this))},E.getColorSchemeSelector=J6(a),E.spacing=E.generateSpacing(),E.shouldSkipGeneratingVar=o,E.unstable_sxConfig={...mm,...l==null?void 0:l.unstable_sxConfig},E.unstable_sx=function(m){return pd({sx:m,theme:this})},E.toRuntimeSource=SW,E}function g1(t,e,n){t.colorSchemes&&n&&(t.colorSchemes[e]={...n!==!0&&n,palette:Ow({...n===!0?{}:n.palette,mode:e})})}function CW(t={},...e){const{palette:n,cssVariables:r=!1,colorSchemes:i=n?void 0:{light:!0},defaultColorScheme:s=n==null?void 0:n.mode,...o}=t,a=s||"light",l=i==null?void 0:i[a],u={...i,...n?{[a]:{...typeof l!="boolean"&&l,palette:n}}:void 0};if(r===!1){if(!("colorSchemes"in t))return x_(t,...e);let d=n;"palette"in t||u[a]&&(u[a]!==!0?d=u[a].palette:a==="dark"&&(d={mode:"dark"}));const h=x_({...t,palette:d},...e);return h.defaultColorScheme=a,h.colorSchemes=u,h.palette.mode==="light"&&(h.colorSchemes.light={...u.light!==!0&&u.light,palette:h.palette},g1(h,"dark",u.dark)),h.palette.mode==="dark"&&(h.colorSchemes.dark={...u.dark!==!0&&u.dark,palette:h.palette},g1(h,"light",u.light)),h}return!n&&!("light"in u)&&a==="light"&&(u.light=!0),PW({...o,colorSchemes:u,defaultColorScheme:a,...typeof r!="boolean"&&r},...e)}const kW=CW();function Gx(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}const xW=t=>Gx(t)&&t!=="classes",md=P6({themeId:wz,defaultTheme:kW,rootShouldForwardProp:xW}),y1={theme:void 0};function Nw(t){let e,n;return r=>{let i=e;return(i===void 0||r.theme!==n)&&(y1.theme=r.theme,i=t(y1),e=i,n=r.theme),i}}function Qx(t){return H6(t)}function OW(t){return Pw("MuiSvgIcon",t)}Bx("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const NW=t=>{const{color:e,fontSize:n,classes:r}=t,i={root:["root",e!=="inherit"&&`color${ws(e)}`,`fontSize${ws(n)}`]};return qx(i,OW,r)},DW=md("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.color!=="inherit"&&e[`color${ws(n.color)}`],e[`fontSize${ws(n.fontSize)}`]]}})(Nw(({theme:t})=>{var e,n,r,i,s,o,a,l,u,d,h,f,g,_;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(i=(e=t.transitions)==null?void 0:e.create)==null?void 0:i.call(e,"fill",{duration:(r=(n=(t.vars??t).transitions)==null?void 0:n.duration)==null?void 0:r.shorter}),variants:[{props:v=>!v.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((o=(s=t.typography)==null?void 0:s.pxToRem)==null?void 0:o.call(s,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((l=(a=t.typography)==null?void 0:a.pxToRem)==null?void 0:l.call(a,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((d=(u=t.typography)==null?void 0:u.pxToRem)==null?void 0:d.call(u,35))||"2.1875rem"}},...Object.entries((t.vars??t).palette).filter(([,v])=>v&&v.main).map(([v])=>{var T,S;return{props:{color:v},style:{color:(S=(T=(t.vars??t).palette)==null?void 0:T[v])==null?void 0:S.main}}}),{props:{color:"action"},style:{color:(f=(h=(t.vars??t).palette)==null?void 0:h.action)==null?void 0:f.active}},{props:{color:"disabled"},style:{color:(_=(g=(t.vars??t).palette)==null?void 0:g.action)==null?void 0:_.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),Jf=F.forwardRef(function(e,n){const r=Qx({props:e,name:"MuiSvgIcon"}),{children:i,className:s,color:o="inherit",component:a="svg",fontSize:l="medium",htmlColor:u,inheritViewBox:d=!1,titleAccess:h,viewBox:f="0 0 24 24",...g}=r,_=F.isValidElement(i)&&i.type==="svg",v={...r,color:o,component:a,fontSize:l,instanceFontSize:e.fontSize,inheritViewBox:d,viewBox:f,hasSvgAsChild:_},T={};d||(T.viewBox=f);const S=NW(v);return C.jsxs(DW,{as:a,className:Hu(S.root,s),focusable:"false",color:u,"aria-hidden":h?void 0:!0,role:h?"img":void 0,ref:n,...T,...g,..._&&i.props,ownerState:v,children:[_?i.props.children:i,h?C.jsx("title",{children:h}):null]})});Jf&&(Jf.muiName="SvgIcon");function Yx(t,e){function n(r,i){return C.jsx(Jf,{"data-testid":`${e}Icon`,ref:i,...r,children:t})}return n.muiName=Jf.muiName,F.memo(F.forwardRef(n))}const VW=Yx(C.jsx("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}),"Star"),LW=Yx(C.jsx("path",{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}),"StarBorder");function MW(t){return Pw("MuiRating",t)}const uu=Bx("MuiRating",["root","sizeSmall","sizeMedium","sizeLarge","readOnly","disabled","focusVisible","visuallyHidden","pristine","label","labelEmptyValueActive","icon","iconEmpty","iconFilled","iconHover","iconFocus","iconActive","decimal"]);function FW(t){const e=t.toString().split(".")[1];return e?e.length:0}function Ug(t,e){if(t==null)return t;const n=Math.round(t/e)*e;return Number(n.toFixed(FW(e)))}const UW=t=>{const{classes:e,size:n,readOnly:r,disabled:i,emptyValueFocused:s,focusVisible:o}=t,a={root:["root",`size${ws(n)}`,i&&"disabled",o&&"focusVisible",r&&"readOnly"],label:["label","pristine"],labelEmptyValue:[s&&"labelEmptyValueActive"],icon:["icon"],iconEmpty:["iconEmpty"],iconFilled:["iconFilled"],iconHover:["iconHover"],iconFocus:["iconFocus"],iconActive:["iconActive"],decimal:["decimal"],visuallyHidden:["visuallyHidden"]};return qx(a,MW,e)},jW=md("span",{name:"MuiRating",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[{[`& .${uu.visuallyHidden}`]:e.visuallyHidden},e.root,e[`size${ws(n.size)}`],n.readOnly&&e.readOnly]}})(Nw(({theme:t})=>({display:"inline-flex",position:"relative",fontSize:t.typography.pxToRem(24),color:"#faaf00",cursor:"pointer",textAlign:"left",width:"min-content",WebkitTapHighlightColor:"transparent",[`&.${uu.disabled}`]:{opacity:(t.vars||t).palette.action.disabledOpacity,pointerEvents:"none"},[`&.${uu.focusVisible} .${uu.iconActive}`]:{outline:"1px solid #999"},[`& .${uu.visuallyHidden}`]:B6,variants:[{props:{size:"small"},style:{fontSize:t.typography.pxToRem(18)}},{props:{size:"large"},style:{fontSize:t.typography.pxToRem(30)}},{props:({ownerState:e})=>e.readOnly,style:{pointerEvents:"none"}}]}))),Jx=md("label",{name:"MuiRating",slot:"Label",overridesResolver:({ownerState:t},e)=>[e.label,t.emptyValueFocused&&e.labelEmptyValueActive]})({cursor:"inherit",variants:[{props:({ownerState:t})=>t.emptyValueFocused,style:{top:0,bottom:0,position:"absolute",outline:"1px solid #999",width:"100%"}}]}),BW=md("span",{name:"MuiRating",slot:"Icon",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.icon,n.iconEmpty&&e.iconEmpty,n.iconFilled&&e.iconFilled,n.iconHover&&e.iconHover,n.iconFocus&&e.iconFocus,n.iconActive&&e.iconActive]}})(Nw(({theme:t})=>({display:"flex",transition:t.transitions.create("transform",{duration:t.transitions.duration.shortest}),pointerEvents:"none",variants:[{props:({ownerState:e})=>e.iconActive,style:{transform:"scale(1.2)"}},{props:({ownerState:e})=>e.iconEmpty,style:{color:(t.vars||t).palette.action.disabled}}]}))),$W=md("span",{name:"MuiRating",slot:"Decimal",shouldForwardProp:t=>Gx(t)&&t!=="iconActive",overridesResolver:(t,e)=>{const{iconActive:n}=t;return[e.decimal,n&&e.iconActive]}})({position:"relative",variants:[{props:({iconActive:t})=>t,style:{transform:"scale(1.2)"}}]});function zW(t){const{value:e,...n}=t;return C.jsx("span",{...n})}function _1(t){const{classes:e,disabled:n,emptyIcon:r,focus:i,getLabelText:s,highlightSelectedOnly:o,hover:a,icon:l,IconContainerComponent:u,isActive:d,itemValue:h,labelProps:f,name:g,onBlur:_,onChange:v,onClick:T,onFocus:S,readOnly:w,ownerState:E,ratingValue:x,ratingValueRounded:O}=t,D=o?h===x:h<=x,A=h<=a,I=h<=i,m=h===O,R=Wx(),k=C.jsx(BW,{as:u,value:h,className:Hu(e.icon,D?e.iconFilled:e.iconEmpty,A&&e.iconHover,I&&e.iconFocus,d&&e.iconActive),ownerState:{...E,iconEmpty:!D,iconFilled:D,iconHover:A,iconFocus:I,iconActive:d},children:r&&!D?r:l});return w?C.jsx("span",{...f,children:k}):C.jsxs(F.Fragment,{children:[C.jsxs(Jx,{ownerState:{...E,emptyValueFocused:void 0},htmlFor:R,...f,children:[k,C.jsx("span",{className:e.visuallyHidden,children:s(h)})]}),C.jsx("input",{className:e.visuallyHidden,onFocus:S,onBlur:_,onChange:v,onClick:T,disabled:n,value:h,id:R,type:"radio",name:g,checked:m})]})}const WW=C.jsx(VW,{fontSize:"inherit"}),qW=C.jsx(LW,{fontSize:"inherit"});function HW(t){return`${t||"0"} Star${t!==1?"s":""}`}const KW=F.forwardRef(function(e,n){const r=Qx({name:"MuiRating",props:e}),{className:i,defaultValue:s=null,disabled:o=!1,emptyIcon:a=qW,emptyLabelText:l="Empty",getLabelText:u=HW,highlightSelectedOnly:d=!1,icon:h=WW,IconContainerComponent:f=zW,max:g=5,name:_,onChange:v,onChangeActive:T,onMouseLeave:S,onMouseMove:w,precision:E=1,readOnly:x=!1,size:O="medium",value:D,...A}=r,I=Wx(_),[m,R]=U6({controlled:D,default:s,name:"Rating"}),k=Ug(m,E),N=z6(),[{hover:P,focus:he},oe]=F.useState({hover:-1,focus:-1});let vt=k;P!==-1&&(vt=P),he!==-1&&(vt=he);const[We,G]=F.useState(!1),te=F.useRef(),ne=j6(te,n),ue=Re=>{w&&w(Re);const ht=te.current,{right:Jt,left:bi,width:wr}=ht.getBoundingClientRect();let qr;N?qr=(Jt-Re.clientX)/wr:qr=(Re.clientX-bi)/wr;let sr=Ug(g*qr+E/2,E);sr=$x(sr,E,g),oe(Hr=>Hr.hover===sr&&Hr.focus===sr?Hr:{hover:sr,focus:sr}),G(!1),T&&P!==sr&&T(Re,sr)},Ie=Re=>{S&&S(Re);const ht=-1;oe({hover:ht,focus:ht}),T&&P!==ht&&T(Re,ht)},Me=Re=>{let ht=Re.target.value===""?null:parseFloat(Re.target.value);P!==-1&&(ht=P),R(ht),v&&v(Re,ht)},tr=Re=>{Re.clientX===0&&Re.clientY===0||(oe({hover:-1,focus:-1}),R(null),v&&parseFloat(Re.target.value)===k&&v(Re,null))},nr=Re=>{u1(Re.target)&&G(!0);const ht=parseFloat(Re.target.value);oe(Jt=>({hover:Jt.hover,focus:ht}))},rr=Re=>{if(P!==-1)return;u1(Re.target)||G(!1);const ht=-1;oe(Jt=>({hover:Jt.hover,focus:ht}))},[ir,Id]=F.useState(!1),Os={...r,defaultValue:s,disabled:o,emptyIcon:a,emptyLabelText:l,emptyValueFocused:ir,focusVisible:We,getLabelText:u,icon:h,IconContainerComponent:f,max:g,precision:E,readOnly:x,size:O},An=UW(Os);return C.jsxs(jW,{ref:ne,onMouseMove:ue,onMouseLeave:Ie,className:Hu(An.root,i,x&&"MuiRating-readOnly"),ownerState:Os,role:x?"img":null,"aria-label":x?u(vt):null,...A,children:[Array.from(new Array(g)).map((Re,ht)=>{const Jt=ht+1,bi={classes:An,disabled:o,emptyIcon:a,focus:he,getLabelText:u,highlightSelectedOnly:d,hover:P,icon:h,IconContainerComponent:f,name:I,onBlur:rr,onChange:Me,onClick:tr,onFocus:nr,ratingValue:vt,ratingValueRounded:k,readOnly:x,ownerState:Os},wr=Jt===Math.ceil(vt)&&(P!==-1||he!==-1);if(E<1){const qr=Array.from(new Array(1/E));return C.jsx($W,{className:Hu(An.decimal,wr&&An.iconActive),ownerState:Os,iconActive:wr,children:qr.map((sr,Hr)=>{const Fo=Ug(Jt-1+(Hr+1)*E,E);return C.jsx(_1,{...bi,isActive:!1,itemValue:Fo,labelProps:{style:qr.length-1===Hr?{}:{width:Fo===vt?`${(Hr+1)*E*100}%`:"0%",overflow:"hidden",position:"absolute"}}},Fo)})},Jt)}return C.jsx(_1,{...bi,isActive:wr,itemValue:Jt},Jt)}),!x&&!o&&C.jsxs(Jx,{className:Hu(An.label,An.labelEmptyValue),ownerState:Os,children:[C.jsx("input",{className:An.visuallyHidden,value:"",id:`${I}-empty`,type:"radio",name:I,checked:k==null,onFocus:()=>Id(!0),onBlur:()=>Id(!1),onChange:Me}),C.jsx("span",{className:An.visuallyHidden,children:l})]})]})}),GW="_card_container_gdfjg_1",QW="_button_gdfjg_10",YW="_rating_gdfjg_37",JW="_product_container_gdfjg_42",XW="_product_flexed_gdfjg_54",Au={card_container:GW,button:QW,rating:YW,product_container:JW,product_flexed:XW},Gn={ADD_TO_BASKET:" ADD_TO_BASKET",REMOVE_FROM_BASKET:"REMOVE_FORM_BASKET",SET_USER:"SET_USER",EMPTY_BASKET:"EMPTY_BASKET:"};function Rl({product:t,flex:e,renderDesc:n,renderAdd:r}){const{image:i,title:s,id:o,rating:a={},price:l,description:u}=t,{rate:d=0,count:h=0}=a,[f,g]=F.useContext(wi),_=()=>{g({type:Gn.ADD_TO_BASKET,item:{image:i,title:s,id:o,rating:a,price:l,description:u}})};return C.jsxs("div",{className:`${Au.card_container} ${e?Au.product_flexed:""}`,children:[C.jsx(ei,{to:`/products/${o}`,children:C.jsx("img",{src:i,alt:""})}),C.jsxs("div",{children:[C.jsx("h3",{children:s}),n&&C.jsx("div",{style:{maxWidth:"750px"},children:u}),C.jsxs("div",{className:Au.rating,children:[C.jsx(KW,{value:d,precision:.1}),C.jsx("small",{children:h})]}),C.jsx("div",{children:C.jsx(ww,{amount:l})}),r&&C.jsx("button",{className:Au.button,onClick:_,children:"add to cart"})]})]})}function ZW(t){return dl({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(t)}function e8(t){return dl({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 217.9L383 345c9.4 9.4 24.6 9.4 33.9 0 9.4-9.4 9.3-24.6 0-34L273 167c-9.1-9.1-23.7-9.3-33.1-.7L95 310.9c-4.7 4.7-7 10.9-7 17s2.3 12.3 7 17c9.4 9.4 24.6 9.4 33.9 0l127.1-127z"},child:[]}]})(t)}function t8(){const[{basket:t,user:e},n]=F.useContext(wi),r=t.reduce((o,a)=>a.price*a.amount+o,0),i=o=>{n({type:Gn.ADD_TO_BASKET,item:o})},s=o=>{n({type:Gn.REMOVE_FROM_BASKET,id:o})};return C.jsx(Al,{children:C.jsxs("section",{className:Ms.container,children:[C.jsxs("div",{className:Ms.cart_container,children:[C.jsx("h2",{children:"Hello"}),C.jsx("h3",{children:"Your shopping"}),C.jsx("hr",{}),(t==null?void 0:t.length)==0?C.jsx("p",{children:"Opps ! No item in your cart"}):t==null?void 0:t.map((o,a)=>C.jsxs("section",{className:Ms.cart_product,children:[C.jsx(Rl,{product:o,renderDesc:!0,flex:!0,renderAdd:!1},a),C.jsxs("div",{className:Ms.btn_container,children:[C.jsx("button",{className:Ms.btn,onClick:()=>i(o),children:C.jsx(e8,{size:20})}),C.jsx("span",{children:o.amount}),C.jsx("button",{className:Ms.btn,onClick:()=>s(o.id),children:C.jsx(ZW,{size:20})})]})]}))]}),(t==null?void 0:t.length)!==0&&C.jsxs("div",{className:Ms.subtotal,children:[C.jsxs("div",{children:[C.jsxs("p",{children:["Subtotal (",t==null?void 0:t.length," items)"]}),C.jsx(ww,{amount:r})]}),C.jsxs("span",{children:[C.jsx("input",{type:"checkbox"}),C.jsx("small",{children:"This order contains a gift"})]}),C.jsx(ei,{to:"/payments",children:"Continue to checkout"})]})]})})}var Xx={},ym={},Dw={},jg={},v1;function n8(){return v1||(v1=1,function(t){(function(e,n){n(t,F,Vx)})(H_,function(e,n,r){Object.defineProperty(e,"__esModule",{value:!0}),e.setHasSupportToCaptureOption=_;var i=o(n),s=o(r);function o(w){return w&&w.__esModule?w:{default:w}}var a=Object.assign||function(w){for(var E=1;E<arguments.length;E++){var x=arguments[E];for(var O in x)Object.prototype.hasOwnProperty.call(x,O)&&(w[O]=x[O])}return w};function l(w,E){var x={};for(var O in w)E.indexOf(O)>=0||Object.prototype.hasOwnProperty.call(w,O)&&(x[O]=w[O]);return x}function u(w,E){if(!(w instanceof E))throw new TypeError("Cannot call a class as a function")}var d=function(){function w(E,x){for(var O=0;O<x.length;O++){var D=x[O];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(E,D.key,D)}}return function(E,x,O){return x&&w(E.prototype,x),O&&w(E,O),E}}();function h(w,E){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E&&(typeof E=="object"||typeof E=="function")?E:w}function f(w,E){if(typeof E!="function"&&E!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof E);w.prototype=Object.create(E&&E.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),E&&(Object.setPrototypeOf?Object.setPrototypeOf(w,E):w.__proto__=E)}var g=!1;function _(w){g=w}try{addEventListener("test",null,Object.defineProperty({},"capture",{get:function(){_(!0)}}))}catch{}function v(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return g?w:w.capture}function T(w){if("touches"in w){var E=w.touches[0],x=E.pageX,O=E.pageY;return{x,y:O}}var D=w.screenX,A=w.screenY;return{x:D,y:A}}var S=function(w){f(E,w);function E(){var x;u(this,E);for(var O=arguments.length,D=Array(O),A=0;A<O;A++)D[A]=arguments[A];var I=h(this,(x=E.__proto__||Object.getPrototypeOf(E)).call.apply(x,[this].concat(D)));return I._handleSwipeStart=I._handleSwipeStart.bind(I),I._handleSwipeMove=I._handleSwipeMove.bind(I),I._handleSwipeEnd=I._handleSwipeEnd.bind(I),I._onMouseDown=I._onMouseDown.bind(I),I._onMouseMove=I._onMouseMove.bind(I),I._onMouseUp=I._onMouseUp.bind(I),I._setSwiperRef=I._setSwiperRef.bind(I),I}return d(E,[{key:"componentDidMount",value:function(){this.swiper&&this.swiper.addEventListener("touchmove",this._handleSwipeMove,v({capture:!0,passive:!1}))}},{key:"componentWillUnmount",value:function(){this.swiper&&this.swiper.removeEventListener("touchmove",this._handleSwipeMove,v({capture:!0,passive:!1}))}},{key:"_onMouseDown",value:function(O){this.props.allowMouseEvents&&(this.mouseDown=!0,document.addEventListener("mouseup",this._onMouseUp),document.addEventListener("mousemove",this._onMouseMove),this._handleSwipeStart(O))}},{key:"_onMouseMove",value:function(O){this.mouseDown&&this._handleSwipeMove(O)}},{key:"_onMouseUp",value:function(O){this.mouseDown=!1,document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("mousemove",this._onMouseMove),this._handleSwipeEnd(O)}},{key:"_handleSwipeStart",value:function(O){var D=T(O),A=D.x,I=D.y;this.moveStart={x:A,y:I},this.props.onSwipeStart(O)}},{key:"_handleSwipeMove",value:function(O){if(this.moveStart){var D=T(O),A=D.x,I=D.y,m=A-this.moveStart.x,R=I-this.moveStart.y;this.moving=!0;var k=this.props.onSwipeMove({x:m,y:R},O);k&&O.cancelable&&O.preventDefault(),this.movePosition={deltaX:m,deltaY:R}}}},{key:"_handleSwipeEnd",value:function(O){this.props.onSwipeEnd(O);var D=this.props.tolerance;this.moving&&this.movePosition&&(this.movePosition.deltaX<-D?this.props.onSwipeLeft(1,O):this.movePosition.deltaX>D&&this.props.onSwipeRight(1,O),this.movePosition.deltaY<-D?this.props.onSwipeUp(1,O):this.movePosition.deltaY>D&&this.props.onSwipeDown(1,O)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(O){this.swiper=O,this.props.innerRef(O)}},{key:"render",value:function(){var O=this.props;O.tagName;var D=O.className,A=O.style,I=O.children;O.allowMouseEvents,O.onSwipeUp,O.onSwipeDown,O.onSwipeLeft,O.onSwipeRight,O.onSwipeStart,O.onSwipeMove,O.onSwipeEnd,O.innerRef,O.tolerance;var m=l(O,["tagName","className","style","children","allowMouseEvents","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeMove","onSwipeEnd","innerRef","tolerance"]);return i.default.createElement(this.props.tagName,a({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:D,style:A},m),I)}}]),E}(n.Component);S.displayName="ReactSwipe",S.propTypes={tagName:s.default.string,className:s.default.string,style:s.default.object,children:s.default.node,allowMouseEvents:s.default.bool,onSwipeUp:s.default.func,onSwipeDown:s.default.func,onSwipeLeft:s.default.func,onSwipeRight:s.default.func,onSwipeStart:s.default.func,onSwipeMove:s.default.func,onSwipeEnd:s.default.func,innerRef:s.default.func,tolerance:s.default.number.isRequired},S.defaultProps={tagName:"div",allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},e.default=S})}(jg)),jg}(function(t){(function(e,n){n(t,n8())})(H_,function(e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=i(n);function i(s){return s&&s.__esModule?s:{default:s}}e.default=r.default})})(Dw);var gd={},Zx={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,r(a)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)e.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(Zx);var r8=Zx.exports;Object.defineProperty(gd,"__esModule",{value:!0});gd.default=void 0;var Vi=i8(r8);function i8(t){return t&&t.__esModule?t:{default:t}}function s8(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var o8={ROOT:function(e){return(0,Vi.default)(s8({"carousel-root":!0},e||"",!!e))},CAROUSEL:function(e){return(0,Vi.default)({carousel:!0,"carousel-slider":e})},WRAPPER:function(e,n){return(0,Vi.default)({"thumbs-wrapper":!e,"slider-wrapper":e,"axis-horizontal":n==="horizontal","axis-vertical":n!=="horizontal"})},SLIDER:function(e,n){return(0,Vi.default)({thumbs:!e,slider:e,animated:!n})},ITEM:function(e,n,r){return(0,Vi.default)({thumb:!e,slide:e,selected:n,previous:r})},ARROW_PREV:function(e){return(0,Vi.default)({"control-arrow control-prev":!0,"control-disabled":e})},ARROW_NEXT:function(e){return(0,Vi.default)({"control-arrow control-next":!0,"control-disabled":e})},DOT:function(e){return(0,Vi.default)({dot:!0,selected:e})}};gd.default=o8;var yd={},_m={};Object.defineProperty(_m,"__esModule",{value:!0});_m.outerWidth=void 0;var a8=function(e){var n=e.offsetWidth,r=getComputedStyle(e);return n+=parseInt(r.marginLeft)+parseInt(r.marginRight),n};_m.outerWidth=a8;var Pl={};Object.defineProperty(Pl,"__esModule",{value:!0});Pl.default=void 0;var l8=function(e,n,r){var i=e===0?e:e+n,s=r==="horizontal"?[i,0,0]:[0,i,0],o="translate3d",a="("+s.join(",")+")";return o+a};Pl.default=l8;var _d={};Object.defineProperty(_d,"__esModule",{value:!0});_d.default=void 0;var u8=function(){return window};_d.default=u8;Object.defineProperty(yd,"__esModule",{value:!0});yd.default=void 0;var lr=h8(F),Us=vm(gd),c8=_m,w1=vm(Pl),d8=vm(Dw),fh=vm(_d);function vm(t){return t&&t.__esModule?t:{default:t}}function eO(){if(typeof WeakMap!="function")return null;var t=new WeakMap;return eO=function(){return t},t}function h8(t){if(t&&t.__esModule)return t;if(t===null||Ku(t)!=="object"&&typeof t!="function")return{default:t};var e=eO();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=r?Object.getOwnPropertyDescriptor(t,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=t[i]}return n.default=t,e&&e.set(t,n),n}function Ku(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ku=function(n){return typeof n}:Ku=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Ku(t)}function O_(){return O_=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},O_.apply(this,arguments)}function f8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p8(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m8(t,e,n){return e&&p8(t.prototype,e),t}function g8(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&N_(t,e)}function N_(t,e){return N_=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},N_(t,e)}function y8(t){var e=v8();return function(){var r=Xf(t),i;if(e){var s=Xf(this).constructor;i=Reflect.construct(r,arguments,s)}else i=r.apply(this,arguments);return _8(this,i)}}function _8(t,e){return e&&(Ku(e)==="object"||typeof e=="function")?e:en(t)}function en(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function v8(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Xf(t){return Xf=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Xf(t)}function Gt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var w8=function(e){return e.hasOwnProperty("key")},Vw=function(t){g8(n,t);var e=y8(n);function n(r){var i;return f8(this,n),i=e.call(this,r),Gt(en(i),"itemsWrapperRef",void 0),Gt(en(i),"itemsListRef",void 0),Gt(en(i),"thumbsRef",void 0),Gt(en(i),"setItemsWrapperRef",function(s){i.itemsWrapperRef=s}),Gt(en(i),"setItemsListRef",function(s){i.itemsListRef=s}),Gt(en(i),"setThumbsRef",function(s,o){i.thumbsRef||(i.thumbsRef=[]),i.thumbsRef[o]=s}),Gt(en(i),"updateSizes",function(){if(!(!i.props.children||!i.itemsWrapperRef||!i.thumbsRef)){var s=lr.Children.count(i.props.children),o=i.itemsWrapperRef.clientWidth,a=i.props.thumbWidth?i.props.thumbWidth:(0,c8.outerWidth)(i.thumbsRef[0]),l=Math.floor(o/a),u=l<s,d=u?s-l:0;i.setState(function(h,f){return{itemSize:a,visibleItems:l,firstItem:u?i.getFirstItem(f.selectedItem):0,lastPosition:d,showArrows:u}})}}),Gt(en(i),"handleClickItem",function(s,o,a){if(!w8(a)||a.key==="Enter"){var l=i.props.onSelectItem;typeof l=="function"&&l(s,o)}}),Gt(en(i),"onSwipeStart",function(){i.setState({swiping:!0})}),Gt(en(i),"onSwipeEnd",function(){i.setState({swiping:!1})}),Gt(en(i),"onSwipeMove",function(s){var o=s.x;if(!i.state.itemSize||!i.itemsWrapperRef||!i.state.visibleItems)return!1;var a=0,l=lr.Children.count(i.props.children),u=-(i.state.firstItem*100)/i.state.visibleItems,d=Math.max(l-i.state.visibleItems,0),h=-d*100/i.state.visibleItems;u===a&&o>0&&(o=0),u===h&&o<0&&(o=0);var f=i.itemsWrapperRef.clientWidth,g=u+100/(f/o);return i.itemsListRef&&["WebkitTransform","MozTransform","MsTransform","OTransform","transform","msTransform"].forEach(function(_){i.itemsListRef.style[_]=(0,w1.default)(g,"%",i.props.axis)}),!0}),Gt(en(i),"slideRight",function(s){i.moveTo(i.state.firstItem-(typeof s=="number"?s:1))}),Gt(en(i),"slideLeft",function(s){i.moveTo(i.state.firstItem+(typeof s=="number"?s:1))}),Gt(en(i),"moveTo",function(s){s=s<0?0:s,s=s>=i.state.lastPosition?i.state.lastPosition:s,i.setState({firstItem:s})}),i.state={selectedItem:r.selectedItem,swiping:!1,showArrows:!1,firstItem:0,visibleItems:0,lastPosition:0},i}return m8(n,[{key:"componentDidMount",value:function(){this.setupThumbs()}},{key:"componentDidUpdate",value:function(i){this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem,firstItem:this.getFirstItem(this.props.selectedItem)}),this.props.children!==i.children&&this.updateSizes()}},{key:"componentWillUnmount",value:function(){this.destroyThumbs()}},{key:"setupThumbs",value:function(){(0,fh.default)().addEventListener("resize",this.updateSizes),(0,fh.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.updateSizes()}},{key:"destroyThumbs",value:function(){(0,fh.default)().removeEventListener("resize",this.updateSizes),(0,fh.default)().removeEventListener("DOMContentLoaded",this.updateSizes)}},{key:"getFirstItem",value:function(i){var s=i;return i>=this.state.lastPosition&&(s=this.state.lastPosition),i<this.state.firstItem+this.state.visibleItems&&(s=this.state.firstItem),i<this.state.firstItem&&(s=i),s}},{key:"renderItems",value:function(){var i=this;return this.props.children.map(function(s,o){var a=Us.default.ITEM(!1,o===i.state.selectedItem),l={key:o,ref:function(d){return i.setThumbsRef(d,o)},className:a,onClick:i.handleClickItem.bind(i,o,i.props.children[o]),onKeyDown:i.handleClickItem.bind(i,o,i.props.children[o]),"aria-label":"".concat(i.props.labels.item," ").concat(o+1),style:{width:i.props.thumbWidth}};return lr.default.createElement("li",O_({},l,{role:"button",tabIndex:0}),s)})}},{key:"render",value:function(){var i=this;if(!this.props.children)return null;var s=lr.Children.count(this.props.children)>1,o=this.state.showArrows&&this.state.firstItem>0,a=this.state.showArrows&&this.state.firstItem<this.state.lastPosition,l={},u=-this.state.firstItem*(this.state.itemSize||0),d=(0,w1.default)(u,"px",this.props.axis),h=this.props.transitionTime+"ms";return l={WebkitTransform:d,MozTransform:d,MsTransform:d,OTransform:d,transform:d,msTransform:d,WebkitTransitionDuration:h,MozTransitionDuration:h,MsTransitionDuration:h,OTransitionDuration:h,transitionDuration:h,msTransitionDuration:h},lr.default.createElement("div",{className:Us.default.CAROUSEL(!1)},lr.default.createElement("div",{className:Us.default.WRAPPER(!1),ref:this.setItemsWrapperRef},lr.default.createElement("button",{type:"button",className:Us.default.ARROW_PREV(!o),onClick:function(){return i.slideRight()},"aria-label":this.props.labels.leftArrow}),s?lr.default.createElement(d8.default,{tagName:"ul",className:Us.default.SLIDER(!1,this.state.swiping),onSwipeLeft:this.slideLeft,onSwipeRight:this.slideRight,onSwipeMove:this.onSwipeMove,onSwipeStart:this.onSwipeStart,onSwipeEnd:this.onSwipeEnd,style:l,innerRef:this.setItemsListRef,allowMouseEvents:this.props.emulateTouch},this.renderItems()):lr.default.createElement("ul",{className:Us.default.SLIDER(!1,this.state.swiping),ref:function(g){return i.setItemsListRef(g)},style:l},this.renderItems()),lr.default.createElement("button",{type:"button",className:Us.default.ARROW_NEXT(!a),onClick:function(){return i.slideLeft()},"aria-label":this.props.labels.rightArrow})))}}]),n}(lr.Component);yd.default=Vw;Gt(Vw,"displayName","Thumbs");Gt(Vw,"defaultProps",{axis:"horizontal",labels:{leftArrow:"previous slide / item",rightArrow:"next slide / item",item:"slide item"},selectedItem:0,thumbWidth:80,transitionTime:350});var wm={};Object.defineProperty(wm,"__esModule",{value:!0});wm.default=void 0;var E8=function(){return document};wm.default=E8;var xn={};Object.defineProperty(xn,"__esModule",{value:!0});xn.setPosition=xn.getPosition=xn.isKeyboardEvent=xn.defaultStatusFormatter=xn.noop=void 0;var I8=F,T8=S8(Pl);function S8(t){return t&&t.__esModule?t:{default:t}}var A8=function(){};xn.noop=A8;var b8=function(e,n){return"".concat(e," of ").concat(n)};xn.defaultStatusFormatter=b8;var R8=function(e){return e?e.hasOwnProperty("key"):!1};xn.isKeyboardEvent=R8;var P8=function(e,n){if(n.infiniteLoop&&++e,e===0)return 0;var r=I8.Children.count(n.children);if(n.centerMode&&n.axis==="horizontal"){var i=-e*n.centerSlidePercentage,s=r-1;return e&&(e!==s||n.infiniteLoop)?i+=(100-n.centerSlidePercentage)/2:e===s&&(i+=100-n.centerSlidePercentage),i}return-e*100};xn.getPosition=P8;var C8=function(e,n){var r={};return["WebkitTransform","MozTransform","MsTransform","OTransform","transform","msTransform"].forEach(function(i){r[i]=(0,T8.default)(e,"%",n)}),r};xn.setPosition=C8;var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.fadeAnimationHandler=Dr.slideStopSwipingHandler=Dr.slideSwipeAnimationHandler=Dr.slideAnimationHandler=void 0;var tO=F,k8=x8(Pl),Vr=xn;function x8(t){return t&&t.__esModule?t:{default:t}}function E1(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Qs(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?E1(Object(n),!0).forEach(function(r){O8(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E1(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function O8(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var N8=function(e,n){var r={},i=n.selectedItem,s=i,o=tO.Children.count(e.children)-1,a=e.infiniteLoop&&(i<0||i>o);if(a)return s<0?e.centerMode&&e.centerSlidePercentage&&e.axis==="horizontal"?r.itemListStyle=(0,Vr.setPosition)(-(o+2)*e.centerSlidePercentage-(100-e.centerSlidePercentage)/2,e.axis):r.itemListStyle=(0,Vr.setPosition)(-(o+2)*100,e.axis):s>o&&(r.itemListStyle=(0,Vr.setPosition)(0,e.axis)),r;var l=(0,Vr.getPosition)(i,e),u=(0,k8.default)(l,"%",e.axis),d=e.transitionTime+"ms";return r.itemListStyle={WebkitTransform:u,msTransform:u,OTransform:u,transform:u},n.swiping||(r.itemListStyle=Qs(Qs({},r.itemListStyle),{},{WebkitTransitionDuration:d,MozTransitionDuration:d,OTransitionDuration:d,transitionDuration:d,msTransitionDuration:d})),r};Dr.slideAnimationHandler=N8;var D8=function(e,n,r,i){var s={},o=n.axis==="horizontal",a=tO.Children.count(n.children),l=0,u=(0,Vr.getPosition)(r.selectedItem,n),d=n.infiniteLoop?(0,Vr.getPosition)(a-1,n)-100:(0,Vr.getPosition)(a-1,n),h=o?e.x:e.y,f=h;u===l&&h>0&&(f=0),u===d&&h<0&&(f=0);var g=u+100/(r.itemSize/f),_=Math.abs(h)>n.swipeScrollTolerance;return n.infiniteLoop&&_&&(r.selectedItem===0&&g>-100?g-=a*100:r.selectedItem===a-1&&g<-a*100&&(g+=a*100)),(!n.preventMovementUntilSwipeScrollTolerance||_||r.swipeMovementStarted)&&(r.swipeMovementStarted||i({swipeMovementStarted:!0}),s.itemListStyle=(0,Vr.setPosition)(g,n.axis)),_&&!r.cancelClick&&i({cancelClick:!0}),s};Dr.slideSwipeAnimationHandler=D8;var V8=function(e,n){var r=(0,Vr.getPosition)(n.selectedItem,e),i=(0,Vr.setPosition)(r,e.axis);return{itemListStyle:i}};Dr.slideStopSwipingHandler=V8;var L8=function(e,n){var r=e.transitionTime+"ms",i="ease-in-out",s={position:"absolute",display:"block",zIndex:-2,minHeight:"100%",opacity:0,top:0,right:0,left:0,bottom:0,transitionTimingFunction:i,msTransitionTimingFunction:i,MozTransitionTimingFunction:i,WebkitTransitionTimingFunction:i,OTransitionTimingFunction:i};return n.swiping||(s=Qs(Qs({},s),{},{WebkitTransitionDuration:r,MozTransitionDuration:r,OTransitionDuration:r,transitionDuration:r,msTransitionDuration:r})),{slideStyle:s,selectedStyle:Qs(Qs({},s),{},{opacity:1,position:"relative"}),prevStyle:Qs({},s)}};Dr.fadeAnimationHandler=L8;Object.defineProperty(ym,"__esModule",{value:!0});ym.default=void 0;var Te=U8(F),M8=vd(Dw),Zr=vd(gd),F8=vd(yd),ph=vd(wm),mh=vd(_d),bu=xn,Zf=Dr;function vd(t){return t&&t.__esModule?t:{default:t}}function nO(){if(typeof WeakMap!="function")return null;var t=new WeakMap;return nO=function(){return t},t}function U8(t){if(t&&t.__esModule)return t;if(t===null||Gu(t)!=="object"&&typeof t!="function")return{default:t};var e=nO();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=r?Object.getOwnPropertyDescriptor(t,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=t[i]}return n.default=t,e&&e.set(t,n),n}function Gu(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Gu=function(n){return typeof n}:Gu=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Gu(t)}function D_(){return D_=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},D_.apply(this,arguments)}function I1(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ur(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?I1(Object(n),!0).forEach(function(r){ae(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):I1(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function j8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function B8(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function $8(t,e,n){return e&&B8(t.prototype,e),t}function z8(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&V_(t,e)}function V_(t,e){return V_=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},V_(t,e)}function W8(t){var e=H8();return function(){var r=ep(t),i;if(e){var s=ep(this).constructor;i=Reflect.construct(r,arguments,s)}else i=r.apply(this,arguments);return q8(this,i)}}function q8(t,e){return e&&(Gu(e)==="object"||typeof e=="function")?e:le(t)}function le(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function H8(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function ep(t){return ep=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},ep(t)}function ae(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Lw=function(t){z8(n,t);var e=W8(n);function n(r){var i;j8(this,n),i=e.call(this,r),ae(le(i),"thumbsRef",void 0),ae(le(i),"carouselWrapperRef",void 0),ae(le(i),"listRef",void 0),ae(le(i),"itemsRef",void 0),ae(le(i),"timer",void 0),ae(le(i),"animationHandler",void 0),ae(le(i),"setThumbsRef",function(o){i.thumbsRef=o}),ae(le(i),"setCarouselWrapperRef",function(o){i.carouselWrapperRef=o}),ae(le(i),"setListRef",function(o){i.listRef=o}),ae(le(i),"setItemsRef",function(o,a){i.itemsRef||(i.itemsRef=[]),i.itemsRef[a]=o}),ae(le(i),"autoPlay",function(){Te.Children.count(i.props.children)<=1||(i.clearAutoPlay(),i.props.autoPlay&&(i.timer=setTimeout(function(){i.increment()},i.props.interval)))}),ae(le(i),"clearAutoPlay",function(){i.timer&&clearTimeout(i.timer)}),ae(le(i),"resetAutoPlay",function(){i.clearAutoPlay(),i.autoPlay()}),ae(le(i),"stopOnHover",function(){i.setState({isMouseEntered:!0},i.clearAutoPlay)}),ae(le(i),"startOnLeave",function(){i.setState({isMouseEntered:!1},i.autoPlay)}),ae(le(i),"isFocusWithinTheCarousel",function(){return i.carouselWrapperRef?!!((0,ph.default)().activeElement===i.carouselWrapperRef||i.carouselWrapperRef.contains((0,ph.default)().activeElement)):!1}),ae(le(i),"navigateWithKeyboard",function(o){if(i.isFocusWithinTheCarousel()){var a=i.props.axis,l=a==="horizontal",u={ArrowUp:38,ArrowRight:39,ArrowDown:40,ArrowLeft:37},d=l?u.ArrowRight:u.ArrowDown,h=l?u.ArrowLeft:u.ArrowUp;d===o.keyCode?i.increment():h===o.keyCode&&i.decrement()}}),ae(le(i),"updateSizes",function(){if(!(!i.state.initialized||!i.itemsRef||i.itemsRef.length===0)){var o=i.props.axis==="horizontal",a=i.itemsRef[0];if(a){var l=o?a.clientWidth:a.clientHeight;i.setState({itemSize:l}),i.thumbsRef&&i.thumbsRef.updateSizes()}}}),ae(le(i),"setMountState",function(){i.setState({hasMount:!0}),i.updateSizes()}),ae(le(i),"handleClickItem",function(o,a){if(Te.Children.count(i.props.children)!==0){if(i.state.cancelClick){i.setState({cancelClick:!1});return}i.props.onClickItem(o,a),o!==i.state.selectedItem&&i.setState({selectedItem:o})}}),ae(le(i),"handleOnChange",function(o,a){Te.Children.count(i.props.children)<=1||i.props.onChange(o,a)}),ae(le(i),"handleClickThumb",function(o,a){i.props.onClickThumb(o,a),i.moveTo(o)}),ae(le(i),"onSwipeStart",function(o){i.setState({swiping:!0}),i.props.onSwipeStart(o)}),ae(le(i),"onSwipeEnd",function(o){i.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),i.props.onSwipeEnd(o),i.clearAutoPlay(),i.state.autoPlay&&i.autoPlay()}),ae(le(i),"onSwipeMove",function(o,a){i.props.onSwipeMove(a);var l=i.props.swipeAnimationHandler(o,i.props,i.state,i.setState.bind(le(i)));return i.setState(ur({},l)),!!Object.keys(l).length}),ae(le(i),"decrement",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;i.moveTo(i.state.selectedItem-(typeof o=="number"?o:1))}),ae(le(i),"increment",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;i.moveTo(i.state.selectedItem+(typeof o=="number"?o:1))}),ae(le(i),"moveTo",function(o){if(typeof o=="number"){var a=Te.Children.count(i.props.children)-1;o<0&&(o=i.props.infiniteLoop?a:0),o>a&&(o=i.props.infiniteLoop?0:a),i.selectItem({selectedItem:o}),i.state.autoPlay&&i.state.isMouseEntered===!1&&i.resetAutoPlay()}}),ae(le(i),"onClickNext",function(){i.increment(1)}),ae(le(i),"onClickPrev",function(){i.decrement(1)}),ae(le(i),"onSwipeForward",function(){i.increment(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),ae(le(i),"onSwipeBackwards",function(){i.decrement(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),ae(le(i),"changeItem",function(o){return function(a){(!(0,bu.isKeyboardEvent)(a)||a.key==="Enter")&&i.moveTo(o)}}),ae(le(i),"selectItem",function(o){i.setState(ur({previousItem:i.state.selectedItem},o),function(){i.setState(i.animationHandler(i.props,i.state))}),i.handleOnChange(o.selectedItem,Te.Children.toArray(i.props.children)[o.selectedItem])}),ae(le(i),"getInitialImage",function(){var o=i.props.selectedItem,a=i.itemsRef&&i.itemsRef[o],l=a&&a.getElementsByTagName("img")||[];return l[0]}),ae(le(i),"getVariableItemHeight",function(o){var a=i.itemsRef&&i.itemsRef[o];if(i.state.hasMount&&a&&a.children.length){var l=a.children[0].getElementsByTagName("img")||[];if(l.length>0){var u=l[0];if(!u.complete){var d=function g(){i.forceUpdate(),u.removeEventListener("load",g)};u.addEventListener("load",d)}}var h=l[0]||a.children[0],f=h.clientHeight;return f>0?f:null}return null});var s={initialized:!1,previousItem:r.selectedItem,selectedItem:r.selectedItem,hasMount:!1,isMouseEntered:!1,autoPlay:r.autoPlay,swiping:!1,swipeMovementStarted:!1,cancelClick:!1,itemSize:1,itemListStyle:{},slideStyle:{},selectedStyle:{},prevStyle:{}};return i.animationHandler=typeof r.animationHandler=="function"&&r.animationHandler||r.animationHandler==="fade"&&Zf.fadeAnimationHandler||Zf.slideAnimationHandler,i.state=ur(ur({},s),i.animationHandler(r,s)),i}return $8(n,[{key:"componentDidMount",value:function(){this.props.children&&this.setupCarousel()}},{key:"componentDidUpdate",value:function(i,s){!i.children&&this.props.children&&!this.state.initialized&&this.setupCarousel(),!i.autoFocus&&this.props.autoFocus&&this.forceFocus(),s.swiping&&!this.state.swiping&&this.setState(ur({},this.props.stopSwipingHandler(this.props,this.state))),(i.selectedItem!==this.props.selectedItem||i.centerMode!==this.props.centerMode)&&(this.updateSizes(),this.moveTo(this.props.selectedItem)),i.autoPlay!==this.props.autoPlay&&(this.props.autoPlay?this.setupAutoPlay():this.destroyAutoPlay(),this.setState({autoPlay:this.props.autoPlay}))}},{key:"componentWillUnmount",value:function(){this.destroyCarousel()}},{key:"setupCarousel",value:function(){var i=this;this.bindEvents(),this.state.autoPlay&&Te.Children.count(this.props.children)>1&&this.setupAutoPlay(),this.props.autoFocus&&this.forceFocus(),this.setState({initialized:!0},function(){var s=i.getInitialImage();s&&!s.complete?s.addEventListener("load",i.setMountState):i.setMountState()})}},{key:"destroyCarousel",value:function(){this.state.initialized&&(this.unbindEvents(),this.destroyAutoPlay())}},{key:"setupAutoPlay",value:function(){this.autoPlay();var i=this.carouselWrapperRef;this.props.stopOnHover&&i&&(i.addEventListener("mouseenter",this.stopOnHover),i.addEventListener("mouseleave",this.startOnLeave))}},{key:"destroyAutoPlay",value:function(){this.clearAutoPlay();var i=this.carouselWrapperRef;this.props.stopOnHover&&i&&(i.removeEventListener("mouseenter",this.stopOnHover),i.removeEventListener("mouseleave",this.startOnLeave))}},{key:"bindEvents",value:function(){(0,mh.default)().addEventListener("resize",this.updateSizes),(0,mh.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.props.useKeyboardArrows&&(0,ph.default)().addEventListener("keydown",this.navigateWithKeyboard)}},{key:"unbindEvents",value:function(){(0,mh.default)().removeEventListener("resize",this.updateSizes),(0,mh.default)().removeEventListener("DOMContentLoaded",this.updateSizes);var i=this.getInitialImage();i&&i.removeEventListener("load",this.setMountState),this.props.useKeyboardArrows&&(0,ph.default)().removeEventListener("keydown",this.navigateWithKeyboard)}},{key:"forceFocus",value:function(){var i;(i=this.carouselWrapperRef)===null||i===void 0||i.focus()}},{key:"renderItems",value:function(i){var s=this;return this.props.children?Te.Children.map(this.props.children,function(o,a){var l=a===s.state.selectedItem,u=a===s.state.previousItem,d=l&&s.state.selectedStyle||u&&s.state.prevStyle||s.state.slideStyle||{};s.props.centerMode&&s.props.axis==="horizontal"&&(d=ur(ur({},d),{},{minWidth:s.props.centerSlidePercentage+"%"})),s.state.swiping&&s.state.swipeMovementStarted&&(d=ur(ur({},d),{},{pointerEvents:"none"}));var h={ref:function(g){return s.setItemsRef(g,a)},key:"itemKey"+a+(i?"clone":""),className:Zr.default.ITEM(!0,a===s.state.selectedItem,a===s.state.previousItem),onClick:s.handleClickItem.bind(s,a,o),style:d};return Te.default.createElement("li",h,s.props.renderItem(o,{isSelected:a===s.state.selectedItem,isPrevious:a===s.state.previousItem}))}):[]}},{key:"renderControls",value:function(){var i=this,s=this.props,o=s.showIndicators,a=s.labels,l=s.renderIndicator,u=s.children;return o?Te.default.createElement("ul",{className:"control-dots"},Te.Children.map(u,function(d,h){return l&&l(i.changeItem(h),h===i.state.selectedItem,h,a.item)})):null}},{key:"renderStatus",value:function(){return this.props.showStatus?Te.default.createElement("p",{className:"carousel-status"},this.props.statusFormatter(this.state.selectedItem+1,Te.Children.count(this.props.children))):null}},{key:"renderThumbs",value:function(){return!this.props.showThumbs||!this.props.children||Te.Children.count(this.props.children)===0?null:Te.default.createElement(F8.default,{ref:this.setThumbsRef,onSelectItem:this.handleClickThumb,selectedItem:this.state.selectedItem,transitionTime:this.props.transitionTime,thumbWidth:this.props.thumbWidth,labels:this.props.labels,emulateTouch:this.props.emulateTouch},this.props.renderThumbs(this.props.children))}},{key:"render",value:function(){var i=this;if(!this.props.children||Te.Children.count(this.props.children)===0)return null;var s=this.props.swipeable&&Te.Children.count(this.props.children)>1,o=this.props.axis==="horizontal",a=this.props.showArrows&&Te.Children.count(this.props.children)>1,l=a&&(this.state.selectedItem>0||this.props.infiniteLoop)||!1,u=a&&(this.state.selectedItem<Te.Children.count(this.props.children)-1||this.props.infiniteLoop)||!1,d=this.renderItems(!0),h=d.shift(),f=d.pop(),g={className:Zr.default.SLIDER(!0,this.state.swiping),onSwipeMove:this.onSwipeMove,onSwipeStart:this.onSwipeStart,onSwipeEnd:this.onSwipeEnd,style:this.state.itemListStyle,tolerance:this.props.swipeScrollTolerance},_={};if(o){if(g.onSwipeLeft=this.onSwipeForward,g.onSwipeRight=this.onSwipeBackwards,this.props.dynamicHeight){var v=this.getVariableItemHeight(this.state.selectedItem);_.height=v||"auto"}}else g.onSwipeUp=this.props.verticalSwipe==="natural"?this.onSwipeBackwards:this.onSwipeForward,g.onSwipeDown=this.props.verticalSwipe==="natural"?this.onSwipeForward:this.onSwipeBackwards,g.style=ur(ur({},g.style),{},{height:this.state.itemSize}),_.height=this.state.itemSize;return Te.default.createElement("div",{"aria-label":this.props.ariaLabel,className:Zr.default.ROOT(this.props.className),ref:this.setCarouselWrapperRef,tabIndex:this.props.useKeyboardArrows?0:void 0},Te.default.createElement("div",{className:Zr.default.CAROUSEL(!0),style:{width:this.props.width}},this.renderControls(),this.props.renderArrowPrev(this.onClickPrev,l,this.props.labels.leftArrow),Te.default.createElement("div",{className:Zr.default.WRAPPER(!0,this.props.axis),style:_},s?Te.default.createElement(M8.default,D_({tagName:"ul",innerRef:this.setListRef},g,{allowMouseEvents:this.props.emulateTouch}),this.props.infiniteLoop&&f,this.renderItems(),this.props.infiniteLoop&&h):Te.default.createElement("ul",{className:Zr.default.SLIDER(!0,this.state.swiping),ref:function(S){return i.setListRef(S)},style:this.state.itemListStyle||{}},this.props.infiniteLoop&&f,this.renderItems(),this.props.infiniteLoop&&h)),this.props.renderArrowNext(this.onClickNext,u,this.props.labels.rightArrow),this.renderStatus()),this.renderThumbs())}}]),n}(Te.default.Component);ym.default=Lw;ae(Lw,"displayName","Carousel");ae(Lw,"defaultProps",{ariaLabel:void 0,axis:"horizontal",centerSlidePercentage:80,interval:3e3,labels:{leftArrow:"previous slide / item",rightArrow:"next slide / item",item:"slide item"},onClickItem:bu.noop,onClickThumb:bu.noop,onChange:bu.noop,onSwipeStart:function(){},onSwipeEnd:function(){},onSwipeMove:function(){return!1},preventMovementUntilSwipeScrollTolerance:!1,renderArrowPrev:function(e,n,r){return Te.default.createElement("button",{type:"button","aria-label":r,className:Zr.default.ARROW_PREV(!n),onClick:e})},renderArrowNext:function(e,n,r){return Te.default.createElement("button",{type:"button","aria-label":r,className:Zr.default.ARROW_NEXT(!n),onClick:e})},renderIndicator:function(e,n,r,i){return Te.default.createElement("li",{className:Zr.default.DOT(n),onClick:e,onKeyDown:e,value:r,key:r,role:"button",tabIndex:0,"aria-label":"".concat(i," ").concat(r+1)})},renderItem:function(e){return e},renderThumbs:function(e){var n=Te.Children.map(e,function(r){var i=r;if(r.type!=="img"&&(i=Te.Children.toArray(r.props.children).find(function(s){return s.type==="img"})),!!i)return i});return n.filter(function(r){return r}).length===0?(console.warn("No images found! Can't build the thumb list without images. If you don't need thumbs, set showThumbs={false} in the Carousel. Note that it's not possible to get images rendered inside custom components. More info at https://github.com/leandrowd/react-responsive-carousel/blob/master/TROUBLESHOOTING.md"),[]):n},statusFormatter:bu.defaultStatusFormatter,selectedItem:0,showArrows:!0,showIndicators:!0,showStatus:!0,showThumbs:!0,stopOnHover:!0,swipeScrollTolerance:5,swipeable:!0,transitionTime:350,verticalSwipe:"standard",width:"100%",animationHandler:"slide",swipeAnimationHandler:Zf.slideSwipeAnimationHandler,stopSwipingHandler:Zf.slideStopSwipingHandler});var K8={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Carousel",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(t,"CarouselProps",{enumerable:!0,get:function(){return n.CarouselProps}}),Object.defineProperty(t,"Thumbs",{enumerable:!0,get:function(){return r.default}});var e=i(ym),n=K8,r=i(yd);function i(s){return s&&s.__esModule?s:{default:s}}})(Xx);const G8="_hero_img_yi31b_1",Q8={hero_img:G8},Y8="/assets/img1-BDcxK7H6.jpg",J8="/assets/img2-bl35EseN.jpg",X8="/assets/img3-Fp0oaH3y.jpg",Z8="/assets/img4-BPr44Ttk.jpg",eq="/assets/img5-CO6XiwvK.jpg",tq=[Y8,J8,X8,Z8,eq];function nq(){return C.jsxs("div",{children:[C.jsx(Xx.Carousel,{autoPlay:!0,infiniteLoop:!0,showIndicators:!1,showThumbs:!1,children:tq.map((t,e)=>C.jsx("img",{src:t,alt:"#"},e))}),C.jsx("div",{className:Q8.hero_img})]})}const rq="/assets/img6-BGhHGQ54.jpg",iq="/assets/img7-CWco2qHr.jpg",sq=[{title:"Electronics",name:"electronics",imgLink:iq},{title:"Discover fashion trends",name:"women's clothing",imgLink:rq},{title:"Men's Clothing",name:"men's clothing",imgLink:"https://m.media-amazon.com/images/I/618bcm65ksL._AC_UL480_FMwebp_QL65_.jpg"},{title:"Jewelery",name:"jewelery",imgLink:"https://m.media-amazon.com/images/I/71r7eWuCsaL._AC_UL480_FMwebp_QL65_.jpg"}],oq="_category_4qow1_1",aq="_category_container_4qow1_34",rO={category:oq,category_container:aq};function lq({data:t}){return C.jsx("div",{className:rO.category,children:C.jsxs(ei,{to:`category/${t.name}`,children:[C.jsx("span",{children:C.jsx("h2",{children:t.title})}),C.jsx("img",{src:t.imgLink,alt:""}),C.jsx("p",{children:"Shop now"})]})})}function uq(){return C.jsx("section",{className:rO.category_container,children:sq.map(t=>C.jsx(lq,{data:t},t.title))})}function iO(t,e){return function(){return t.apply(e,arguments)}}const{toString:cq}=Object.prototype,{getPrototypeOf:Mw}=Object,Em=(t=>e=>{const n=cq.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),vr=t=>(t=t.toLowerCase(),e=>Em(e)===t),Im=t=>e=>typeof e===t,{isArray:Cl}=Array,Mc=Im("undefined");function dq(t){return t!==null&&!Mc(t)&&t.constructor!==null&&!Mc(t.constructor)&&Mn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const sO=vr("ArrayBuffer");function hq(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&sO(t.buffer),e}const fq=Im("string"),Mn=Im("function"),oO=Im("number"),Tm=t=>t!==null&&typeof t=="object",pq=t=>t===!0||t===!1,Gh=t=>{if(Em(t)!=="object")return!1;const e=Mw(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},mq=vr("Date"),gq=vr("File"),yq=vr("Blob"),_q=vr("FileList"),vq=t=>Tm(t)&&Mn(t.pipe),wq=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Mn(t.append)&&((e=Em(t))==="formdata"||e==="object"&&Mn(t.toString)&&t.toString()==="[object FormData]"))},Eq=vr("URLSearchParams"),[Iq,Tq,Sq,Aq]=["ReadableStream","Request","Response","Headers"].map(vr),bq=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function wd(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),Cl(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{const s=n?Object.getOwnPropertyNames(t):Object.keys(t),o=s.length;let a;for(r=0;r<o;r++)a=s[r],e.call(null,t[a],a,t)}}function aO(t,e){e=e.toLowerCase();const n=Object.keys(t);let r=n.length,i;for(;r-- >0;)if(i=n[r],e===i.toLowerCase())return i;return null}const no=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,lO=t=>!Mc(t)&&t!==no;function L_(){const{caseless:t}=lO(this)&&this||{},e={},n=(r,i)=>{const s=t&&aO(e,i)||i;Gh(e[s])&&Gh(r)?e[s]=L_(e[s],r):Gh(r)?e[s]=L_({},r):Cl(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r<i;r++)arguments[r]&&wd(arguments[r],n);return e}const Rq=(t,e,n,{allOwnKeys:r}={})=>(wd(e,(i,s)=>{n&&Mn(i)?t[s]=iO(i,n):t[s]=i},{allOwnKeys:r}),t),Pq=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Cq=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},kq=(t,e,n,r)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!r||r(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=n!==!1&&Mw(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},xq=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},Oq=t=>{if(!t)return null;if(Cl(t))return t;let e=t.length;if(!oO(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Nq=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Mw(Uint8Array)),Dq=(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},Vq=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Lq=vr("HTMLFormElement"),Mq=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),T1=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Fq=vr("RegExp"),uO=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};wd(n,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(r[s]=o||i)}),Object.defineProperties(t,r)},Uq=t=>{uO(t,(e,n)=>{if(Mn(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Mn(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},jq=(t,e)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return Cl(t)?r(t):r(String(t).split(e)),n},Bq=()=>{},$q=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,Bg="abcdefghijklmnopqrstuvwxyz",S1="0123456789",cO={DIGIT:S1,ALPHA:Bg,ALPHA_DIGIT:Bg+Bg.toUpperCase()+S1},zq=(t=16,e=cO.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n};function Wq(t){return!!(t&&Mn(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const qq=t=>{const e=new Array(10),n=(r,i)=>{if(Tm(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=Cl(r)?[]:{};return wd(r,(o,a)=>{const l=n(o,i+1);!Mc(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return n(t,0)},Hq=vr("AsyncFunction"),Kq=t=>t&&(Tm(t)||Mn(t))&&Mn(t.then)&&Mn(t.catch),dO=((t,e)=>t?setImmediate:e?((n,r)=>(no.addEventListener("message",({source:i,data:s})=>{i===no&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),no.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Mn(no.postMessage)),Gq=typeof queueMicrotask<"u"?queueMicrotask.bind(no):typeof process<"u"&&process.nextTick||dO,j={isArray:Cl,isArrayBuffer:sO,isBuffer:dq,isFormData:wq,isArrayBufferView:hq,isString:fq,isNumber:oO,isBoolean:pq,isObject:Tm,isPlainObject:Gh,isReadableStream:Iq,isRequest:Tq,isResponse:Sq,isHeaders:Aq,isUndefined:Mc,isDate:mq,isFile:gq,isBlob:yq,isRegExp:Fq,isFunction:Mn,isStream:vq,isURLSearchParams:Eq,isTypedArray:Nq,isFileList:_q,forEach:wd,merge:L_,extend:Rq,trim:bq,stripBOM:Pq,inherits:Cq,toFlatObject:kq,kindOf:Em,kindOfTest:vr,endsWith:xq,toArray:Oq,forEachEntry:Dq,matchAll:Vq,isHTMLForm:Lq,hasOwnProperty:T1,hasOwnProp:T1,reduceDescriptors:uO,freezeMethods:Uq,toObjectSet:jq,toCamelCase:Mq,noop:Bq,toFiniteNumber:$q,findKey:aO,global:no,isContextDefined:lO,ALPHABET:cO,generateString:zq,isSpecCompliantForm:Wq,toJSONObject:qq,isAsyncFn:Hq,isThenable:Kq,setImmediate:dO,asap:Gq};function ie(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}j.inherits(ie,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:j.toJSONObject(this.config),code:this.code,status:this.status}}});const hO=ie.prototype,fO={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{fO[t]={value:t}});Object.defineProperties(ie,fO);Object.defineProperty(hO,"isAxiosError",{value:!0});ie.from=(t,e,n,r,i,s)=>{const o=Object.create(hO);return j.toFlatObject(t,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),ie.call(o,t.message,e,n,r,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const Qq=null;function M_(t){return j.isPlainObject(t)||j.isArray(t)}function pO(t){return j.endsWith(t,"[]")?t.slice(0,-2):t}function A1(t,e,n){return t?t.concat(e).map(function(i,s){return i=pO(i),!n&&s?"["+i+"]":i}).join(n?".":""):e}function Yq(t){return j.isArray(t)&&!t.some(M_)}const Jq=j.toFlatObject(j,{},null,function(e){return/^is[A-Z]/.test(e)});function Sm(t,e,n){if(!j.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=j.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,T){return!j.isUndefined(T[v])});const r=n.metaTokens,i=n.visitor||d,s=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&j.isSpecCompliantForm(e);if(!j.isFunction(i))throw new TypeError("visitor must be a function");function u(_){if(_===null)return"";if(j.isDate(_))return _.toISOString();if(!l&&j.isBlob(_))throw new ie("Blob is not supported. Use a Buffer instead.");return j.isArrayBuffer(_)||j.isTypedArray(_)?l&&typeof Blob=="function"?new Blob([_]):Buffer.from(_):_}function d(_,v,T){let S=_;if(_&&!T&&typeof _=="object"){if(j.endsWith(v,"{}"))v=r?v:v.slice(0,-2),_=JSON.stringify(_);else if(j.isArray(_)&&Yq(_)||(j.isFileList(_)||j.endsWith(v,"[]"))&&(S=j.toArray(_)))return v=pO(v),S.forEach(function(E,x){!(j.isUndefined(E)||E===null)&&e.append(o===!0?A1([v],x,s):o===null?v:v+"[]",u(E))}),!1}return M_(_)?!0:(e.append(A1(T,v,s),u(_)),!1)}const h=[],f=Object.assign(Jq,{defaultVisitor:d,convertValue:u,isVisitable:M_});function g(_,v){if(!j.isUndefined(_)){if(h.indexOf(_)!==-1)throw Error("Circular reference detected in "+v.join("."));h.push(_),j.forEach(_,function(S,w){(!(j.isUndefined(S)||S===null)&&i.call(e,S,j.isString(w)?w.trim():w,v,f))===!0&&g(S,v?v.concat(w):[w])}),h.pop()}}if(!j.isObject(t))throw new TypeError("data must be an object");return g(t),e}function b1(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Fw(t,e){this._pairs=[],t&&Sm(t,this,e)}const mO=Fw.prototype;mO.append=function(e,n){this._pairs.push([e,n])};mO.toString=function(e){const n=e?function(r){return e.call(this,r,b1)}:b1;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function Xq(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function gO(t,e,n){if(!e)return t;const r=n&&n.encode||Xq,i=n&&n.serialize;let s;if(i?s=i(e,n):s=j.isURLSearchParams(e)?e.toString():new Fw(e,n).toString(r),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class R1{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){j.forEach(this.handlers,function(r){r!==null&&e(r)})}}const yO={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Zq=typeof URLSearchParams<"u"?URLSearchParams:Fw,e7=typeof FormData<"u"?FormData:null,t7=typeof Blob<"u"?Blob:null,n7={isBrowser:!0,classes:{URLSearchParams:Zq,FormData:e7,Blob:t7},protocols:["http","https","file","blob","url","data"]},Uw=typeof window<"u"&&typeof document<"u",F_=typeof navigator=="object"&&navigator||void 0,r7=Uw&&(!F_||["ReactNative","NativeScript","NS"].indexOf(F_.product)<0),i7=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",s7=Uw&&window.location.href||"http://localhost",o7=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Uw,hasStandardBrowserEnv:r7,hasStandardBrowserWebWorkerEnv:i7,navigator:F_,origin:s7},Symbol.toStringTag,{value:"Module"})),In={...o7,...n7};function a7(t,e){return Sm(t,new In.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,s){return In.isNode&&j.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function l7(t){return j.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function u7(t){const e={},n=Object.keys(t);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],e[s]=t[s];return e}function _O(t){function e(n,r,i,s){let o=n[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=s>=n.length;return o=!o&&j.isArray(i)?i.length:o,l?(j.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!j.isObject(i[o]))&&(i[o]=[]),e(n,r,i[o],s)&&j.isArray(i[o])&&(i[o]=u7(i[o])),!a)}if(j.isFormData(t)&&j.isFunction(t.entries)){const n={};return j.forEachEntry(t,(r,i)=>{e(l7(r),i,n,0)}),n}return null}function c7(t,e,n){if(j.isString(t))try{return(e||JSON.parse)(t),j.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const Ed={transitional:yO,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=j.isObject(e);if(s&&j.isHTMLForm(e)&&(e=new FormData(e)),j.isFormData(e))return i?JSON.stringify(_O(e)):e;if(j.isArrayBuffer(e)||j.isBuffer(e)||j.isStream(e)||j.isFile(e)||j.isBlob(e)||j.isReadableStream(e))return e;if(j.isArrayBufferView(e))return e.buffer;if(j.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return a7(e,this.formSerializer).toString();if((a=j.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Sm(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),c7(e)):e}],transformResponse:[function(e){const n=this.transitional||Ed.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(j.isResponse(e)||j.isReadableStream(e))return e;if(e&&j.isString(e)&&(r&&!this.responseType||i)){const o=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ie.from(a,ie.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:In.classes.FormData,Blob:In.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};j.forEach(["delete","get","head","post","put","patch"],t=>{Ed.headers[t]={}});const d7=j.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),h7=t=>{const e={};let n,r,i;return t&&t.split(` `).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||e[n]&&d7[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},P1=Symbol("internals");function cu(t){return t&&String(t).trim().toLowerCase()}function Qh(t){return t===!1||t==null?t:j.isArray(t)?t.map(Qh):String(t)}function f7(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const p7=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function $g(t,e,n,r,i){if(j.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!j.isString(e)){if(j.isString(r))return e.indexOf(r)!==-1;if(j.isRegExp(r))return r.test(e)}}function m7(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function g7(t,e){const n=j.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}class Tn{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function s(a,l,u){const d=cu(l);if(!d)throw new Error("header name must be a non-empty string");const h=j.findKey(i,d);(!h||i[h]===void 0||u===!0||u===void 0&&i[h]!==!1)&&(i[h||l]=Qh(a))}const o=(a,l)=>j.forEach(a,(u,d)=>s(u,d,l));if(j.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(j.isString(e)&&(e=e.trim())&&!p7(e))o(h7(e),n);else if(j.isHeaders(e))for(const[a,l]of e.entries())s(l,a,r);else e!=null&&s(n,e,r);return this}get(e,n){if(e=cu(e),e){const r=j.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return f7(i);if(j.isFunction(n))return n.call(this,i,r);if(j.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=cu(e),e){const r=j.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||$g(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function s(o){if(o=cu(o),o){const a=j.findKey(r,o);a&&(!n||$g(r,r[a],a,n))&&(delete r[a],i=!0)}}return j.isArray(e)?e.forEach(s):s(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!e||$g(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const n=this,r={};return j.forEach(this,(i,s)=>{const o=j.findKey(r,s);if(o){n[o]=Qh(i),delete n[s];return}const a=e?m7(s):String(s).trim();a!==s&&delete n[s],n[a]=Qh(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return j.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&j.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[P1]=this[P1]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=cu(o);r[a]||(g7(i,o),r[a]=!0)}return j.isArray(e)?e.forEach(s):s(e),this}}Tn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);j.reduceDescriptors(Tn.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});j.freezeMethods(Tn);function zg(t,e){const n=this||Ed,r=e||n,i=Tn.from(r.headers);let s=r.data;return j.forEach(t,function(a){s=a.call(n,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function vO(t){return!!(t&&t.__CANCEL__)}function kl(t,e,n){ie.call(this,t??"canceled",ie.ERR_CANCELED,e,n),this.name="CanceledError"}j.inherits(kl,ie,{__CANCEL__:!0});function wO(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new ie("Request failed with status code "+n.status,[ie.ERR_BAD_REQUEST,ie.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function y7(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function _7(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const u=Date.now(),d=r[s];o||(o=u),n[i]=l,r[i]=u;let h=s,f=0;for(;h!==i;)f+=n[h++],h=h%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),u-o<e)return;const g=d&&u-d;return g?Math.round(f*1e3/g):void 0}}function v7(t,e){let n=0,r=1e3/e,i,s;const o=(u,d=Date.now())=>{n=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,u)};return[(...u)=>{const d=Date.now(),h=d-n;h>=r?o(u,d):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},r-h)))},()=>i&&o(i)]}const tp=(t,e,n=3)=>{let r=0;const i=_7(50,250);return v7(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,u=i(l),d=o<=a;r=o;const h={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&d?(a-o)/u:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(h)},n)},C1=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},k1=t=>(...e)=>j.asap(()=>t(...e)),w7=In.hasStandardBrowserEnv?function(){const e=In.navigator&&/(msie|trident)/i.test(In.navigator.userAgent),n=document.createElement("a");let r;function i(s){let o=s;return e&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=i(window.location.href),function(o){const a=j.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}(),E7=In.hasStandardBrowserEnv?{write(t,e,n,r,i,s){const o=[t+"="+encodeURIComponent(e)];j.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),j.isString(r)&&o.push("path="+r),j.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function I7(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function T7(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function EO(t,e){return t&&!I7(e)?T7(t,e):e}const x1=t=>t instanceof Tn?{...t}:t;function Ro(t,e){e=e||{};const n={};function r(u,d,h){return j.isPlainObject(u)&&j.isPlainObject(d)?j.merge.call({caseless:h},u,d):j.isPlainObject(d)?j.merge({},d):j.isArray(d)?d.slice():d}function i(u,d,h){if(j.isUndefined(d)){if(!j.isUndefined(u))return r(void 0,u,h)}else return r(u,d,h)}function s(u,d){if(!j.isUndefined(d))return r(void 0,d)}function o(u,d){if(j.isUndefined(d)){if(!j.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function a(u,d,h){if(h in e)return r(u,d);if(h in t)return r(void 0,u)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(u,d)=>i(x1(u),x1(d),!0)};return j.forEach(Object.keys(Object.assign({},t,e)),function(d){const h=l[d]||i,f=h(t[d],e[d],d);j.isUndefined(f)&&h!==a||(n[d]=f)}),n}const IO=t=>{const e=Ro({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=Tn.from(o),e.url=gO(EO(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let l;if(j.isFormData(n)){if(In.hasStandardBrowserEnv||In.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((l=o.getContentType())!==!1){const[u,...d]=l?l.split(";").map(h=>h.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...d].join("; "))}}if(In.hasStandardBrowserEnv&&(r&&j.isFunction(r)&&(r=r(e)),r||r!==!1&&w7(e.url))){const u=i&&s&&E7.read(s);u&&o.set(i,u)}return e},S7=typeof XMLHttpRequest<"u",A7=S7&&function(t){return new Promise(function(n,r){const i=IO(t);let s=i.data;const o=Tn.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:u}=i,d,h,f,g,_;function v(){g&&g(),_&&_(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let T=new XMLHttpRequest;T.open(i.method.toUpperCase(),i.url,!0),T.timeout=i.timeout;function S(){if(!T)return;const E=Tn.from("getAllResponseHeaders"in T&&T.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?T.responseText:T.response,status:T.status,statusText:T.statusText,headers:E,config:t,request:T};wO(function(A){n(A),v()},function(A){r(A),v()},O),T=null}"onloadend"in T?T.onloadend=S:T.onreadystatechange=function(){!T||T.readyState!==4||T.status===0&&!(T.responseURL&&T.responseURL.indexOf("file:")===0)||setTimeout(S)},T.onabort=function(){T&&(r(new ie("Request aborted",ie.ECONNABORTED,t,T)),T=null)},T.onerror=function(){r(new ie("Network Error",ie.ERR_NETWORK,t,T)),T=null},T.ontimeout=function(){let x=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const O=i.transitional||yO;i.timeoutErrorMessage&&(x=i.timeoutErrorMessage),r(new ie(x,O.clarifyTimeoutError?ie.ETIMEDOUT:ie.ECONNABORTED,t,T)),T=null},s===void 0&&o.setContentType(null),"setRequestHeader"in T&&j.forEach(o.toJSON(),function(x,O){T.setRequestHeader(O,x)}),j.isUndefined(i.withCredentials)||(T.withCredentials=!!i.withCredentials),a&&a!=="json"&&(T.responseType=i.responseType),u&&([f,_]=tp(u,!0),T.addEventListener("progress",f)),l&&T.upload&&([h,g]=tp(l),T.upload.addEventListener("progress",h),T.upload.addEventListener("loadend",g)),(i.cancelToken||i.signal)&&(d=E=>{T&&(r(!E||E.type?new kl(null,t,T):E),T.abort(),T=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const w=y7(i.url);if(w&&In.protocols.indexOf(w)===-1){r(new ie("Unsupported protocol "+w+":",ie.ERR_BAD_REQUEST,t));return}T.send(s||null)})},b7=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const s=function(u){if(!i){i=!0,a();const d=u instanceof Error?u:this.reason;r.abort(d instanceof ie?d:new kl(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new ie(`timeout ${e} of ms exceeded`,ie.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),t=null)};t.forEach(u=>u.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>j.asap(a),l}},R7=function*(t,e){let n=t.byteLength;if(!e||n<e){yield t;return}let r=0,i;for(;r<n;)i=r+e,yield t.slice(r,i),r=i},P7=async function*(t,e){for await(const n of C7(t))yield*R7(n,e)},C7=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},O1=(t,e,n,r)=>{const i=P7(t,e);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:d}=await i.next();if(u){a(),l.close();return}let h=d.byteLength;if(n){let f=s+=h;n(f)}l.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},Am=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",TO=Am&&typeof ReadableStream=="function",k7=Am&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),SO=(t,...e)=>{try{return!!t(...e)}catch{return!1}},x7=TO&&SO(()=>{let t=!1;const e=new Request(In.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),N1=64*1024,U_=TO&&SO(()=>j.isReadableStream(new Response("").body)),np={stream:U_&&(t=>t.body)};Am&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!np[e]&&(np[e]=j.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new ie(`Response type '${e}' is not supported`,ie.ERR_NOT_SUPPORT,r)})})})(new Response);const O7=async t=>{if(t==null)return 0;if(j.isBlob(t))return t.size;if(j.isSpecCompliantForm(t))return(await new Request(In.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(j.isArrayBufferView(t)||j.isArrayBuffer(t))return t.byteLength;if(j.isURLSearchParams(t)&&(t=t+""),j.isString(t))return(await k7(t)).byteLength},N7=async(t,e)=>{const n=j.toFiniteNumber(t.getContentLength());return n??O7(e)},D7=Am&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:l,responseType:u,headers:d,withCredentials:h="same-origin",fetchOptions:f}=IO(t);u=u?(u+"").toLowerCase():"text";let g=b7([i,s&&s.toAbortSignal()],o),_;const v=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let T;try{if(l&&x7&&n!=="get"&&n!=="head"&&(T=await N7(d,r))!==0){let O=new Request(e,{method:"POST",body:r,duplex:"half"}),D;if(j.isFormData(r)&&(D=O.headers.get("content-type"))&&d.setContentType(D),O.body){const[A,I]=C1(T,tp(k1(l)));r=O1(O.body,N1,A,I)}}j.isString(h)||(h=h?"include":"omit");const S="credentials"in Request.prototype;_=new Request(e,{...f,signal:g,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:S?h:void 0});let w=await fetch(_);const E=U_&&(u==="stream"||u==="response");if(U_&&(a||E&&v)){const O={};["status","statusText","headers"].forEach(m=>{O[m]=w[m]});const D=j.toFiniteNumber(w.headers.get("content-length")),[A,I]=a&&C1(D,tp(k1(a),!0))||[];w=new Response(O1(w.body,N1,A,()=>{I&&I(),v&&v()}),O)}u=u||"text";let x=await np[j.findKey(np,u)||"text"](w,t);return!E&&v&&v(),await new Promise((O,D)=>{wO(O,D,{data:x,headers:Tn.from(w.headers),status:w.status,statusText:w.statusText,config:t,request:_})})}catch(S){throw v&&v(),S&&S.name==="TypeError"&&/fetch/i.test(S.message)?Object.assign(new ie("Network Error",ie.ERR_NETWORK,t,_),{cause:S.cause||S}):ie.from(S,S&&S.code,t,_)}}),j_={http:Qq,xhr:A7,fetch:D7};j.forEach(j_,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const D1=t=>`- ${t}`,V7=t=>j.isFunction(t)||t===null||t===!1,AO={getAdapter:t=>{t=j.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let s=0;s<e;s++){n=t[s];let o;if(r=n,!V7(n)&&(r=j_[(o=String(n)).toLowerCase()],r===void 0))throw new ie(`Unknown adapter '${o}'`);if(r)break;i[o||"#"+s]=r}if(!r){const s=Object.entries(i).map(([a,l])=>`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : `+s.map(D1).join(` `):" "+D1(s[0]):"as no adapter specified";throw new ie("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:j_};function Wg(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new kl(null,t)}function V1(t){return Wg(t),t.headers=Tn.from(t.headers),t.data=zg.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),AO.getAdapter(t.adapter||Ed.adapter)(t).then(function(r){return Wg(t),r.data=zg.call(t,t.transformResponse,r),r.headers=Tn.from(r.headers),r},function(r){return vO(r)||(Wg(t),r&&r.response&&(r.response.data=zg.call(t,t.transformResponse,r.response),r.response.headers=Tn.from(r.response.headers))),Promise.reject(r)})}const bO="1.7.7",jw={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{jw[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const L1={};jw.transitional=function(e,n,r){function i(s,o){return"[Axios v"+bO+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new ie(i(o," has been removed"+(n?" in "+n:"")),ie.ERR_DEPRECATED);return n&&!L1[o]&&(L1[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,o,a):!0}};function L7(t,e,n){if(typeof t!="object")throw new ie("options must be an object",ie.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const a=t[s],l=a===void 0||o(a,s,t);if(l!==!0)throw new ie("option "+s+" must be "+l,ie.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ie("Unknown option "+s,ie.ERR_BAD_OPTION)}}const B_={assertOptions:L7,validators:jw},Li=B_.validators;class lo{constructor(e){this.defaults=e,this.interceptors={request:new R1,response:new R1}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` `+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Ro(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&B_.assertOptions(r,{silentJSONParsing:Li.transitional(Li.boolean),forcedJSONParsing:Li.transitional(Li.boolean),clarifyTimeoutError:Li.transitional(Li.boolean)},!1),i!=null&&(j.isFunction(i)?n.paramsSerializer={serialize:i}:B_.assertOptions(i,{encode:Li.function,serialize:Li.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&j.merge(s.common,s[n.method]);s&&j.forEach(["delete","get","head","post","put","patch","common"],_=>{delete s[_]}),n.headers=Tn.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(l=l&&v.synchronous,a.unshift(v.fulfilled,v.rejected))});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let d,h=0,f;if(!l){const _=[V1.bind(this),void 0];for(_.unshift.apply(_,a),_.push.apply(_,u),f=_.length,d=Promise.resolve(n);h<f;)d=d.then(_[h++],_[h++]);return d}f=a.length;let g=n;for(h=0;h<f;){const _=a[h++],v=a[h++];try{g=_(g)}catch(T){v.call(this,T);break}}try{d=V1.call(this,g)}catch(_){return Promise.reject(_)}for(h=0,f=u.length;h<f;)d=d.then(u[h++],u[h++]);return d}getUri(e){e=Ro(this.defaults,e);const n=EO(e.baseURL,e.url);return gO(n,e.params,e.paramsSerializer)}}j.forEach(["delete","get","head","options"],function(e){lo.prototype[e]=function(n,r){return this.request(Ro(r||{},{method:e,url:n,data:(r||{}).data}))}});j.forEach(["post","put","patch"],function(e){function n(r){return function(s,o,a){return this.request(Ro(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}lo.prototype[e]=n(),lo.prototype[e+"Form"]=n(!0)});class Bw{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new kl(s,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new Bw(function(i){e=i}),cancel:e}}}function M7(t){return function(n){return t.apply(null,n)}}function F7(t){return j.isObject(t)&&t.isAxiosError===!0}const $_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries($_).forEach(([t,e])=>{$_[e]=t});function RO(t){const e=new lo(t),n=iO(lo.prototype.request,e);return j.extend(n,lo.prototype,e,{allOwnKeys:!0}),j.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return RO(Ro(t,i))},n}const Je=RO(Ed);Je.Axios=lo;Je.CanceledError=kl;Je.CancelToken=Bw;Je.isCancel=vO;Je.VERSION=bO;Je.toFormData=Sm;Je.AxiosError=ie;Je.Cancel=Je.CanceledError;Je.all=function(e){return Promise.all(e)};Je.spread=M7;Je.isAxiosError=F7;Je.mergeConfig=Ro;Je.AxiosHeaders=Tn;Je.formToJSON=t=>_O(j.isHTMLForm(t)?new FormData(t):t);Je.getAdapter=AO.getAdapter;Je.HttpStatusCode=$_;Je.default=Je;const U7=Je.create({baseURL:"https://fakestoreapi.com"});var j7={cm:!0,mm:!0,in:!0,px:!0,pt:!0,pc:!0,em:!0,ex:!0,ch:!0,rem:!0,vw:!0,vh:!0,vmin:!0,vmax:!0,"%":!0};function PO(t){if(typeof t=="number")return{value:t,unit:"px"};var e,n=(t.match(/^[0-9.]*/)||"").toString();n.includes(".")?e=parseFloat(n):e=parseInt(n,10);var r=(t.match(/[^0-9]*$/)||"").toString();return j7[r]?{value:e,unit:r}:(console.warn("React Spinners: ".concat(t," is not a valid css value. Defaulting to ").concat(e,"px.")),{value:e,unit:"px"})}function _a(t){var e=PO(t);return"".concat(e.value).concat(e.unit)}var CO=function(t,e,n){var r="react-spinners-".concat(t,"-").concat(n);if(typeof window>"u"||!window.document)return r;var i=document.createElement("style");document.head.appendChild(i);var s=i.sheet,o=` @keyframes `.concat(r,` { `).concat(e,` } `);return s&&s.insertRule(o,0),r},rp=function(){return rp=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},rp.apply(this,arguments)},B7=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},$7=CO("ClipLoader","0% {transform: rotate(0deg) scale(1)} 50% {transform: rotate(180deg) scale(0.8)} 100% {transform: rotate(360deg) scale(1)}","clip");function z_(t){var e=t.loading,n=e===void 0?!0:e,r=t.color,i=r===void 0?"#000000":r,s=t.speedMultiplier,o=s===void 0?1:s,a=t.cssOverride,l=a===void 0?{}:a,u=t.size,d=u===void 0?35:u,h=B7(t,["loading","color","speedMultiplier","cssOverride","size"]),f=rp({background:"transparent !important",width:_a(d),height:_a(d),borderRadius:"100%",border:"2px solid",borderTopColor:i,borderBottomColor:"transparent",borderLeftColor:i,borderRightColor:i,display:"inline-block",animation:"".concat($7," ").concat(.75/o,"s 0s infinite linear"),animationFillMode:"both"},l);return n?F.createElement("span",rp({style:f},h)):null}var ft=function(){return ft=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},ft.apply(this,arguments)},z7=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},W7=CO("FadeLoader","50% {opacity: 0.3} 100% {opacity: 1}","fade");function q7(t){var e=t.loading,n=e===void 0?!0:e,r=t.color,i=r===void 0?"#000000":r,s=t.speedMultiplier,o=s===void 0?1:s,a=t.cssOverride,l=a===void 0?{}:a,u=t.height,d=u===void 0?15:u,h=t.width,f=h===void 0?5:h,g=t.radius,_=g===void 0?2:g,v=t.margin,T=v===void 0?2:v,S=z7(t,["loading","color","speedMultiplier","cssOverride","height","width","radius","margin"]),w=PO(T).value,E=w+18,x=E/2+E/5.5,O=ft({display:"inherit",position:"relative",fontSize:"0",top:E,left:E,width:"".concat(E*3,"px"),height:"".concat(E*3,"px")},l),D=function(oe){return{position:"absolute",width:_a(f),height:_a(d),margin:_a(T),backgroundColor:i,borderRadius:_a(_),transition:"2s",animationFillMode:"both",animation:"".concat(W7," ").concat(1.2/o,"s ").concat(oe*.12,"s infinite ease-in-out")}},A=ft(ft({},D(1)),{top:"".concat(E,"px"),left:"0"}),I=ft(ft({},D(2)),{top:"".concat(x,"px"),left:"".concat(x,"px"),transform:"rotate(-45deg)"}),m=ft(ft({},D(3)),{top:"0",left:"".concat(E,"px"),transform:"rotate(90deg)"}),R=ft(ft({},D(4)),{top:"".concat(-1*x,"px"),left:"".concat(x,"px"),transform:"rotate(45deg)"}),k=ft(ft({},D(5)),{top:"".concat(-1*E,"px"),left:"0"}),N=ft(ft({},D(6)),{top:"".concat(-1*x,"px"),left:"".concat(-1*x,"px"),transform:"rotate(-45deg)"}),P=ft(ft({},D(7)),{top:"0",left:"".concat(-1*E,"px"),transform:"rotate(90deg)"}),he=ft(ft({},D(8)),{top:"".concat(x,"px"),left:"".concat(-1*x,"px"),transform:"rotate(45deg)"});return n?F.createElement("span",ft({style:O},S),F.createElement("span",{style:A}),F.createElement("span",{style:I}),F.createElement("span",{style:m}),F.createElement("span",{style:R}),F.createElement("span",{style:k}),F.createElement("span",{style:N}),F.createElement("span",{style:P}),F.createElement("span",{style:he})):null}function $w(){return C.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"center"},children:C.jsx(q7,{color:"#36d7b7"})})}function H7(){const[t,e]=F.useState([]),[n,r]=F.useState(!1);return F.useEffect(()=>{r(!0),(async()=>{try{const s=await U7.get("/products");e(s.data),r(!1)}catch(s){console.log("The error is",s),n(fal)}})()},[]),C.jsx(C.Fragment,{children:n?C.jsx($w,{}):C.jsx("section",{className:Au.product_container,children:t==null?void 0:t.map(i=>C.jsx(Rl,{product:i,renderAdd:!0},i.id))})})}function K7(){return C.jsxs(Al,{children:[C.jsx(nq,{}),C.jsx(uq,{}),C.jsx(H7,{})]})}const G7="_payment_header_1bmiv_1",Q7="_Payment_1bmiv_7",Y7="_flex_1bmiv_10",J7="_payment_card_container_1bmiv_24",X7="_payment_price_1bmiv_31",Z7="_payment_details_1bmiv_28",eH="_loading_1bmiv_53",Yr={payment_header:G7,Payment:Q7,flex:Y7,payment_card_container:J7,payment_price:X7,payment_details:Z7,loading:eH};function M1(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function F1(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?M1(Object(n),!0).forEach(function(r){kO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):M1(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Yh(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yh=function(e){return typeof e}:Yh=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yh(t)}function kO(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xO(t,e){return tH(t)||nH(t,e)||rH(t,e)||iH()}function tH(t){if(Array.isArray(t))return t}function nH(t,e){var n=t&&(typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"]);if(n!=null){var r=[],i=!0,s=!1,o,a;try{for(n=n.call(t);!(i=(o=n.next()).done)&&(r.push(o.value),!(e&&r.length===e));i=!0);}catch(l){s=!0,a=l}finally{try{!i&&n.return!=null&&n.return()}finally{if(s)throw a}}return r}}function rH(t,e){if(t){if(typeof t=="string")return U1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U1(t,e)}}function U1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function iH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Rn=function(e,n,r){var i=!!r,s=me.useRef(r);me.useEffect(function(){s.current=r},[r]),me.useEffect(function(){if(!i||!e)return function(){};var o=function(){s.current&&s.current.apply(s,arguments)};return e.on(n,o),function(){e.off(n,o)}},[i,n,e,s])},W_=function(e){var n=me.useRef(e);return me.useEffect(function(){n.current=e},[e]),n.current},ol=function(e){return e!==null&&Yh(e)==="object"},sH=function(e){return ol(e)&&typeof e.then=="function"},oH=function(e){return ol(e)&&typeof e.elements=="function"&&typeof e.createToken=="function"&&typeof e.createPaymentMethod=="function"&&typeof e.confirmCardPayment=="function"},j1="[object Object]",aH=function t(e,n){if(!ol(e)||!ol(n))return e===n;var r=Array.isArray(e),i=Array.isArray(n);if(r!==i)return!1;var s=Object.prototype.toString.call(e)===j1,o=Object.prototype.toString.call(n)===j1;if(s!==o)return!1;if(!s&&!r)return e===n;var a=Object.keys(e),l=Object.keys(n);if(a.length!==l.length)return!1;for(var u={},d=0;d<a.length;d+=1)u[a[d]]=!0;for(var h=0;h<l.length;h+=1)u[l[h]]=!0;var f=Object.keys(u);if(f.length!==a.length)return!1;var g=e,_=n,v=function(S){return t(g[S],_[S])};return f.every(v)},OO=function(e,n,r){return ol(e)?Object.keys(e).reduce(function(i,s){var o=!ol(n)||!aH(e[s],n[s]);return r.includes(s)?(o&&console.warn("Unsupported prop change: options.".concat(s," is not a mutable property.")),i):o?F1(F1({},i||{}),{},kO({},s,e[s])):i},null):null},NO="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",B1=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NO;if(e===null||oH(e))return e;throw new Error(n)},lH=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NO;if(sH(e))return{tag:"async",stripePromise:Promise.resolve(e).then(function(i){return B1(i,n)})};var r=B1(e,n);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},uH=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:"react-stripe-js",version:"2.7.3"}),e.registerAppInfo({name:"react-stripe-js",version:"2.7.3",url:"https://stripe.com/docs/stripe-js/react"}))},bm=me.createContext(null);bm.displayName="ElementsContext";var DO=function(e,n){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(n," in an <Elements> provider."));return e},VO=function(e){var n=e.stripe,r=e.options,i=e.children,s=me.useMemo(function(){return lH(n)},[n]),o=me.useState(function(){return{stripe:s.tag==="sync"?s.stripe:null,elements:s.tag==="sync"?s.stripe.elements(r):null}}),a=xO(o,2),l=a[0],u=a[1];me.useEffect(function(){var f=!0,g=function(v){u(function(T){return T.stripe?T:{stripe:v,elements:v.elements(r)}})};return s.tag==="async"&&!l.stripe?s.stripePromise.then(function(_){_&&f&&g(_)}):s.tag==="sync"&&!l.stripe&&g(s.stripe),function(){f=!1}},[s,l,r]);var d=W_(n);me.useEffect(function(){d!==null&&d!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[d,n]);var h=W_(r);return me.useEffect(function(){if(l.elements){var f=OO(r,h,["clientSecret","fonts"]);f&&l.elements.update(f)}},[r,h,l.elements]),me.useEffect(function(){uH(l.stripe)},[l.stripe]),me.createElement(bm.Provider,{value:l},i)};VO.propTypes={stripe:qe.any,options:qe.object};var cH=function(e){var n=me.useContext(bm);return DO(n,e)},dH=function(){var e=cH("calls useElements()"),n=e.elements;return n};qe.func.isRequired;var LO=me.createContext(null);LO.displayName="CustomCheckoutSdkContext";var hH=function(e,n){if(!e)throw new Error("Could not find CustomCheckoutProvider context; You need to wrap the part of your app that ".concat(n," in an <CustomCheckoutProvider> provider."));return e},fH=me.createContext(null);fH.displayName="CustomCheckoutContext";qe.any,qe.shape({clientSecret:qe.string.isRequired,elementsOptions:qe.object}).isRequired;var q_=function(e){var n=me.useContext(LO),r=me.useContext(bm);if(n&&r)throw new Error("You cannot wrap the part of your app that ".concat(e," in both <CustomCheckoutProvider> and <Elements> providers."));return n?hH(n,e):DO(r,e)},pH=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},St=function(e,n){var r="".concat(pH(e),"Element"),i=function(l){var u=l.id,d=l.className,h=l.options,f=h===void 0?{}:h,g=l.onBlur,_=l.onFocus,v=l.onReady,T=l.onChange,S=l.onEscape,w=l.onClick,E=l.onLoadError,x=l.onLoaderStart,O=l.onNetworksChange,D=l.onConfirm,A=l.onCancel,I=l.onShippingAddressChange,m=l.onShippingRateChange,R=q_("mounts <".concat(r,">")),k="elements"in R?R.elements:null,N="customCheckoutSdk"in R?R.customCheckoutSdk:null,P=me.useState(null),he=xO(P,2),oe=he[0],vt=he[1],We=me.useRef(null),G=me.useRef(null);Rn(oe,"blur",g),Rn(oe,"focus",_),Rn(oe,"escape",S),Rn(oe,"click",w),Rn(oe,"loaderror",E),Rn(oe,"loaderstart",x),Rn(oe,"networkschange",O),Rn(oe,"confirm",D),Rn(oe,"cancel",A),Rn(oe,"shippingaddresschange",I),Rn(oe,"shippingratechange",m),Rn(oe,"change",T);var te;v&&(e==="expressCheckout"?te=v:te=function(){v(oe)}),Rn(oe,"ready",te),me.useLayoutEffect(function(){if(We.current===null&&G.current!==null&&(k||N)){var ue=null;N?ue=N.createElement(e,f):k&&(ue=k.create(e,f)),We.current=ue,vt(ue),ue&&ue.mount(G.current)}},[k,N,f]);var ne=W_(f);return me.useEffect(function(){if(We.current){var ue=OO(f,ne,["paymentRequest"]);ue&&We.current.update(ue)}},[f,ne]),me.useLayoutEffect(function(){return function(){if(We.current&&typeof We.current.destroy=="function")try{We.current.destroy(),We.current=null}catch{}}},[]),me.createElement("div",{id:u,className:d,ref:G})},s=function(l){q_("mounts <".concat(r,">"));var u=l.id,d=l.className;return me.createElement("div",{id:u,className:d})},o=n?s:i;return o.propTypes={id:qe.string,className:qe.string,onChange:qe.func,onBlur:qe.func,onFocus:qe.func,onReady:qe.func,onEscape:qe.func,onClick:qe.func,onLoadError:qe.func,onLoaderStart:qe.func,onNetworksChange:qe.func,onConfirm:qe.func,onCancel:qe.func,onShippingAddressChange:qe.func,onShippingRateChange:qe.func,options:qe.object},o.displayName=r,o.__elementType=e,o},At=typeof window>"u",mH=me.createContext(null);mH.displayName="EmbeddedCheckoutProviderContext";var gH=function(){var e=q_("calls useStripe()"),n=e.stripe;return n};St("auBankAccount",At);var $1=St("card",At);St("cardNumber",At);St("cardExpiry",At);St("cardCvc",At);St("fpxBank",At);St("iban",At);St("idealBank",At);St("p24Bank",At);St("epsBank",At);St("payment",At);St("expressCheckout",At);St("paymentRequestButton",At);St("linkAuthentication",At);St("address",At);St("shippingAddress",At);St("paymentMethodMessaging",At);St("affirmMessage",At);St("afterpayClearpayMessage",At);const yH=Je.create({baseURL:"https://api-bpkgyk2m7a-uc.a.run.app"});function _H(){const[{user:t,basket:e},n]=F.useContext(wi),r=e==null?void 0:e.reduce((_,v)=>v.amount+_,0),i=e.reduce((_,v)=>v.price*v.amount+_,0),s=gH(),o=dH(),a=Ep(),[l,u]=F.useState(null),[d,h]=F.useState(!1),f=_=>{var v,T;(v=_==null?void 0:_.error)!=null&&v.message?u((T=_==null?void 0:_.error)==null?void 0:T.message):u("")},g=async _=>{var v;_.preventDefault();try{h(!0);const S=(v=(await yH({method:"POST",url:`/payment/create?total=${i*100}`})).data)==null?void 0:v.client_secret,{paymentIntent:w}=await s.confirmCardPayment(S,{payment_method:{card:o.getElement($1)}});await vx.collection("users").doc(t.uid).collection("orders").doc(w.id).set({basket:e,amount:w.amount,created:w.created}),n({type:Gn.EMPTY_BASKET}),h(!1),a("/orders",{state:{msg:"You have placed new Order"}})}catch(T){console.log(T),h(!1)}};return C.jsxs(Al,{children:[C.jsxs("div",{className:Yr.payment_header,children:[" ","Checkout (",r,") items"]}),C.jsxs("section",{className:Yr.Payment,children:[C.jsxs("div",{className:Yr.flex,children:[C.jsx("h3",{children:"Delivery Address"}),C.jsxs("div",{children:[C.jsx("div",{children:t==null?void 0:t.email}),C.jsx("div",{children:"123 React Lane"}),C.jsx("div",{children:"Chicago, IL"})]})]}),C.jsx("hr",{}),C.jsxs("div",{className:Yr.flex,children:[C.jsx("h3",{children:"Review items and delivery"}),C.jsx("div",{children:e==null?void 0:e.map((_,v)=>C.jsx(Rl,{product:_,flex:!0},v))})]}),C.jsx("hr",{}),C.jsxs("div",{className:Yr.flex,children:[C.jsx("h3",{children:"Payment method"}),C.jsx("div",{className:Yr.payment_card_container,children:C.jsx("div",{className:Yr.payment_details,children:C.jsxs("form",{onSubmit:g,children:[l&&C.jsx("small",{style:{color:"red"},children:l}),C.jsx($1,{onChange:f}),C.jsxs("div",{className:Yr.payment_price,children:[C.jsx("div",{children:C.jsxs("span",{style:{display:"flex",gap:"10pxx"},children:[C.jsx("p",{children:" Total Order |"})," ",C.jsx(ww,{amount:i})]})}),C.jsx("button",{type:"submit",children:d?C.jsxs("div",{className:Yr.loading,children:[C.jsx(z_,{color:"grey",size:12}),C.jsx("p",{children:"please wait ..."})]}):"Pay Now"})]})]})})})]})]})]})}const vH="_container_10hxv_1",wH="_orders_container_10hxv_5",z1={container:vH,orders_container:wH};function EH(){const[{user:t},e]=F.useContext(wi),[n,r]=F.useState([]);return F.useEffect(()=>{t?vx.collection("users").doc(t.uid).collection("orders").orderBy("created","desc").onSnapshot(i=>{r(i.docs.map(s=>({id:s.id,data:s.data()})))}):r([])},[]),C.jsx(Al,{children:C.jsx("section",{className:z1.container,children:C.jsxs("div",{className:z1.orders_container,children:[C.jsx("h2",{children:"Your Orders"}),(n==null?void 0:n.length)==0&&C.jsx("div",{style:{padding:"20px"},children:"You don't have orders yet."}),C.jsx("div",{children:n==null?void 0:n.map((i,s)=>{var o,a;return C.jsxs("div",{children:[C.jsx("hr",{}),C.jsxs("p",{children:["Order ID: ",i==null?void 0:i.id]}),(a=(o=i==null?void 0:i.data)==null?void 0:o.basket)==null?void 0:a.map(l=>C.jsx(Rl,{flex:!0,product:l},l.id))]},s)})})]})})})}const IH="_products_container_1uki1_1",TH={products_container:IH},MO="https://fakestoreapi.com";function SH(){const{categoryName:t}=pR(),[e,n]=F.useState([]),[r,i]=F.useState(!1);return F.useEffect(()=>{i(!0),Je.get(`${MO}/Products/category/${t}`).then(s=>{n(s.data),i(!1)}).catch(s=>{console.log("err is",s),i(!1)})},[]),C.jsx(Al,{children:r?C.jsx($w,{}):C.jsxs("section",{children:[C.jsx("h1",{style:{padding:"30px"},children:"Results"}),C.jsxs("p",{style:{padding:"30px"},children:["Category / ",t]}),C.jsx("hr",{}),C.jsx("div",{className:TH.products_container,children:e==null?void 0:e.map(s=>C.jsx(Rl,{product:s,renderAdd:!0},s.id))})]})})}function AH(){const{productId:t}=pR(),[e,n]=F.useState(!1),[r,i]=F.useState({});return F.useEffect(()=>{n(!0),Je.get(`${MO}/products/${t}`).then(s=>{i(s.data),n(!1)}).catch(s=>{console.log("The error",s),n(!1)})},[]),C.jsx(Al,{children:e?C.jsx($w,{}):C.jsx(Rl,{product:r,flex:!0,renderDesc:!0,renderAdd:!0})})}const bH="_login_f9o34_1",RH="_login_container_f9o34_12",PH="_login_signInButton_f9o34_46",CH="_login_registerButton_f9o34_62",gh={login:bH,login_container:RH,login_signInButton:PH,login_registerButton:CH};function kH(){var g,_;const[t,e]=F.useState(""),[n,r]=F.useState(""),[i,s]=F.useState(""),[o,a]=F.useState({signIn:!1,signUp:!1}),[{user:l},u]=F.useContext(wi),d=Ep(),h=Wc(),f=async v=>{v.preventDefault(),console.log(v.target.name),v.target.name=="signin"?(a({...o,signIn:!0}),console.log(o),vP(Gf,t,n).then(T=>{console.log(T),u({type:Gn.SET_USER,user:T.user}),a({...o,signIn:!1}),d((h==null?void 0:h.redirect)||"/")}).catch(T=>{console.log("The errr",T),s(T.message),a({...o,signIn:!1})})):(_P(Gf,t,n),a({...o,signUp:!0}).then(T=>{console.log(T),u({type:Gn.SET_USER,user:T.user}),a({...o,signUp:!1}),d((h==null?void 0:h.redirect)||"/")}).catch(T=>{console.log("The errr",T),s(T.message),a({...o,signUp:!1})}))};return C.jsxs("section",{className:gh.login,children:[C.jsx(ei,{to:"/",children:C.jsx("img",{src:"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Amazon_logo.svg/1024px-Amazon_logo.svg.png",alt:""})}),C.jsxs("div",{className:gh.login_container,children:[C.jsx("h1",{children:"Sign In"}),((g=h==null?void 0:h.state)==null?void 0:g.msg)&&C.jsx("small",{style:{padding:"5px",textAlign:"center",color:"red",fontWeight:"bold"},children:(_=h==null?void 0:h.state)==null?void 0:_.msg}),C.jsxs("form",{action:"",children:[C.jsxs("div",{children:[C.jsx("label",{htmlFor:"email",children:"Email"}),C.jsx("input",{value:t,onChange:v=>e(v.target.value),type:"email",id:"email"})]}),C.jsxs("div",{children:[C.jsx("label",{htmlFor:"password",children:"Password"}),C.jsx("input",{value:n,onChange:v=>r(v.target.value),type:"password",id:"password"})]}),C.jsx("button",{type:"submit",onClick:f,name:"signin",className:gh.login_signInButton,children:o.signIn?C.jsx(z_,{color:"#000",size:15}):"Sign In"})]}),C.jsx("p",{children:"By signing-in you agree to the AMAZON FAKE CLONE Conditions of Use & Sale. Please see our Privacy Notice, our Cookies Notice and our Interest-Based Ads Notice."}),C.jsx("button",{type:"submit",onClick:f,name:"signup",className:gh.login_registerButton,children:o.signUp?C.jsx(z_,{color:"#000",size:15}):"Creat your Amazon Account"}),i&&C.jsx("small",{style:{paddingTop:"5px",color:"red"},children:i})]})]})}var FO="https://js.stripe.com/v3",xH=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,W1="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",OH=function(){for(var e=document.querySelectorAll('script[src^="'.concat(FO,'"]')),n=0;n<e.length;n++){var r=e[n];if(xH.test(r.src))return r}return null},q1=function(e){var n="",r=document.createElement("script");r.src="".concat(FO).concat(n);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(r),r},NH=function(e,n){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"4.4.0",startTime:n})},du=null,yh=null,_h=null,DH=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},VH=function(e,n){return function(){window.Stripe?e(window.Stripe):n(new Error("Stripe.js not available"))}},LH=function(e){return du!==null?du:(du=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&e&&console.warn(W1),window.Stripe){n(window.Stripe);return}try{var i=OH();if(i&&e)console.warn(W1);else if(!i)i=q1(e);else if(i&&_h!==null&&yh!==null){var s;i.removeEventListener("load",_h),i.removeEventListener("error",yh),(s=i.parentNode)===null||s===void 0||s.removeChild(i),i=q1(e)}_h=VH(n,r),yh=DH(r),i.addEventListener("load",_h),i.addEventListener("error",yh)}catch(o){r(o);return}}),du.catch(function(n){return du=null,Promise.reject(n)}))},MH=function(e,n,r){if(e===null)return null;var i=e.apply(void 0,n);return NH(i,r),i},hu,UO=!1,jO=function(){return hu||(hu=LH(null).catch(function(e){return hu=null,Promise.reject(e)}),hu)};Promise.resolve().then(function(){return jO()}).catch(function(t){UO||console.warn(t)});var FH=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];UO=!0;var i=Date.now();return jO().then(function(s){return MH(s,n,i)})};function H1({children:t,msg:e,redirect:n}){const r=Ep(),[{user:i},s]=F.useContext(wi);return F.useEffect(()=>{i||r("/auth",{state:{msg:e,redirect:n}})},[i]),t}const UH=FH("pk_test_51Q3byDGHKfd5AkHtnXbux4OPRcx8RArOAh5mbxb3UwuY2G9V0wgHmRvXC6rWv7rJMipQDJ7A0273pbH0pnUD3cDi00EFcdzzS1");function jH(){return C.jsx(VV,{children:C.jsxs(PV,{children:[C.jsx(Mi,{path:"/",element:C.jsx(K7,{})}),C.jsx(Mi,{path:"/auth",element:C.jsx(kH,{})}),C.jsx(Mi,{path:"/payments",element:C.jsx(H1,{msg:"You must log in to pay",redirect:"/payments",children:C.jsx(VO,{stripe:UH,children:C.jsx(_H,{})})})}),C.jsx(Mi,{path:"/orders",element:C.jsx(H1,{msg:"You must log in to access your orders",redirect:"/orders",children:C.jsx(EH,{})})}),C.jsx(Mi,{path:"/category/:categoryName",element:C.jsx(SH,{})}),C.jsx(Mi,{path:"/products/:productId",element:C.jsx(AH,{})}),C.jsx(Mi,{path:"/cart",element:C.jsx(t8,{})})]})})}function BH(){const[{user:t},e]=F.useContext(wi);return F.useEffect(()=>{Gf.onAuthStateChanged(n=>{e(n?{type:Gn.SET_USER,user:n}:{type:Gn.SET_USER,user:null})})},[]),C.jsx(C.Fragment,{children:C.jsx(jH,{})})}function $H(){return C.jsx(C.Fragment,{children:C.jsx(BH,{})})}const zH={basket:[],user:null},WH=(t,e)=>{switch(e.type){case Gn.ADD_TO_BASKET:if(t.basket.find(s=>s.id===e.item.id)){const s=t.basket.map(o=>o.id===e.item.id?{...o,amount:o.amount+1}:o);return{...t,basket:s}}else return{...t,basket:[...t.basket,{...e.item,amount:1}]};case Gn.REMOVE_FROM_BASKET:const r=t.basket.findIndex(s=>s.id===e.id);let i=[...t.basket];return r>=0&&(i[r].amount>1?i[r]={...i[r],amount:i[r].amount-1}:i.splice(r,1)),{...t,basket:i};case Gn.EMPTY_BASKET:return{...t,basket:[]};case Gn.SET_USER:return{...t,user:e.user};default:return t}};sR(document.getElementById("root")).render(C.jsx(F.StrictMode,{children:C.jsx(pL,{reducer:WH,initialState:zH,children:C.jsx($H,{})})}));